Looks like both boot cljs and lein-cljsasset have their own way to define
externs/lib. This makes the task for library writer harder.

By defining a common standard directly supported by the ClojureScript
compiler we would have a generic solution all tools / IDE could benefit.
Probably the best option would be to rely on a directory layout / filename
convention so that non leiningen based solution are not penalized.

Is that something we want to include in the compiler?

2014-11-13 18:14 GMT-03:00 Micha Niskin <[email protected]>:

> The boot cljs compiler task solves these problems:
> https://github.com/adzerk/boot-cljs#preamble-externs-and-lib-files
>
> On Thursday, November 13, 2014 11:18:18 AM UTC-5, Paul Bostrom wrote:
> > "remove the need to rely on :preamble for non closure dependencies."
> > I took a stab at solving this problem with a lein plugin:
> > https://github.com/pbostrom/lein-cljsasset
> > It would be simple to expand to support an :externs field. Then the
> workflow would be that libraries declare the externs path in their
> project.clj, and users declare the target externs file in their
> environment, which they would then specify in their cljsbuild config. I'll
> admit it sounds a bit cumbersome still, and the whole workflow should
> probably be managed by a single tool. Just thinking out loud, the ideal
> tool would:
> > 1) Resolve JS/CSS dependencies from classpath and concat (and minify?)
> to a single file for each
> > 2) Resolve externs dependencies from classpath
> > 3) Advanced compile all CLJS/Closure dependencies and CLJS application
> code with externs file(s) from step 2
> > 4) Generate initialization/loading JS to load the JS/CSS files from step
> 1
> > 5) Output a single JS file that initializes and loads your application
> >
> > There would probably need to be another step in there which resolves
> image dependencies.
> >
> > On Monday, November 10, 2014 8:29:30 AM UTC-5, Julien Eluard wrote:
> > > I agree this would be a really great feature.
> > >
> > >
> > > There used to be a similar facility part of lein-cljsbuild allowing to
> package both the externs and eventual JS dependencies (see [1]) but it does
> not work anymore.
> > >
> > >
> > > Maybe something equivalent could be part of the clojurescript
> compiler? There already are some projects packaging externs and JS files
> (see [2]) so it would be a matter of defining a convention. It could also
> be an opportunity to remove the need to rely on :preamble for non closure
> dependencies.
> > >
> > >
> > > This would allow the creation of self-contained libraries and would
> greatly lower the barrier of using clojurescript libraries with
> dependencies.
> > >
> > >
> > > [1]
> https://github.com/jeluard/cljs-ol3js/tree/master/resources/closure-js
> > > [2] https://github.com/swannodette/react-cljs/tree/master/src/react
> > >
> > >
> > >
> > >
> > > 2014-11-10 8:37 GMT-03:00 Nikita Prokopov <[email protected]>:
> > > Hi!
> > >
> > >
> > >
> > > Right now lein-cljsbuild allows for externs to be specified on user
> side. E.g. I’m building app with react-cljs, I add dependency, but there’s
> also a second step: I need to put :externs ["react/externs/react.js"] into
> _my_ project.clj.
> > >
> > >
> > >
> > > This is tedious and easy to forget, leading to a lot of confusion (I
> developed for 2 month and everything was fine, then I turn on advanced
> build and nothing works).
> > >
> > >
> > >
> > > On the other hand, conceptually, externs are part of a library, not my
> user code. So, if library author thinks his library needs externs, he
> specifies it and packs externs along with library code, and they’re
> automatically used when I add dependency. So as a user I don’t manage
> external deps’ externs at all. As Thomas Heller puts it, it might be [a
> quality of life change](
> https://github.com/tonsky/datascript/issues/30#issuecomment-62253696).
> > >
> > >
> > >
> > > Any thought on it? Maybe there’s already a way to do that?
> > >
> > >
> > >
> > > Nikita.
> > >
> > >
> > >
> > > --
> > >
> > > Note that posts from new members are moderated - please be patient
> with your first post.
> > >
> > > ---
> > >
> > > You received this message because you are subscribed to the Google
> Groups "ClojureScript" group.
> > >
> > > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > >
> > > To post to this group, send email to [email protected].
> > >
> > > Visit this group at http://groups.google.com/group/clojurescript.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to