cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2020-04-15T16:50:27.078400Z

Re the bundle target stuff https://clojurians.slack.com/archives/C07UQ678E/p1586791429463800 it suggests it'll be possible to write cljs libs which depend on npm libs, but it's not clear to me how that would work. Can someone pls explain?

dnolen 2020-04-15T16:51:08.079Z

@henryw374 deps.cljs is a file that can be in your artifact

dnolen 2020-04-15T16:51:25.079400Z

this file can declare {:npm-deps ...}

dnolen 2020-04-15T16:51:50.079900Z

ClojureScript scans for all of these when installing node deps

dnolen 2020-04-15T16:52:07.080200Z

trivial for any other tool to do that too

dnolen 2020-04-15T16:52:57.080500Z

there's really nothing else you need to do

2020-04-15T16:55:24.083Z

Thanks but npm-deps is not new... Is it new that it can be declared in deps.cljs?

dnolen 2020-04-15T16:55:31.083200Z

nope

dnolen 2020-04-15T16:55:53.083800Z

there's really almost nothing new in the :bundle target

dnolen 2020-04-15T16:56:23.084600Z

just tweaked stuff was already there + bug fixes

dnolen 2020-04-15T16:56:50.085200Z

a lot of the changes are related to making it easier to build custom tools over the public apis

dnolen 2020-04-15T16:57:04.085500Z

now that we've dropped Rhino / Nashorn / Graal.js

dnolen 2020-04-15T16:57:48.086500Z

Krell the new React Native tool is also a dogfood project - helps show what's missing

2020-04-15T17:01:43.090100Z

Ok I didn't think that was new... But I read the post to mean there was something new wrt cljs libs and npm. I had heard ppl say a while back they thought npm-deps was heading towards deprecation... Apparently not then!

dnolen 2020-04-15T17:02:35.090800Z

we decoupled a it from the Closure stuff a long time ago

dnolen 2020-04-15T17:02:49.091200Z

the old documentation makes it seems like it's tied to Closure processing - it is not

2020-04-15T17:04:17.091600Z

Ok thanks

dnolen 2020-04-15T17:08:16.092600Z

in fact it's trivial to switch a :bundler project and try to force everything through Closure - won't work for React of course (w/o manual intervention)

dnolen 2020-04-15T17:08:29.093100Z

but there's an interesting proposition here for libraries like say Transit.js

dnolen 2020-04-15T17:08:45.093500Z

which could easily be written in Closure friendly ES6

dnolen 2020-04-15T17:09:11.094100Z

granted you're not going to get much DCE because it's an encoder/decoder

dnolen 2020-04-15T17:09:16.094300Z

but you get the idea

dnolen 2020-04-15T17:10:07.095100Z

you could write a open source lib that you want JS users to directly consume/contribute that you also want to consume in ClojureScript but get DCE / code splitting

dnolen 2020-04-15T17:11:19.096300Z

currently node_modules handling is all or nothing - all :bundle or all Closure but will probably spend some brain cycles on how to allow partitioning that's not cumbersome in the near future

kommen 2020-04-15T18:12:59.098200Z

btw, here is my repo for graaljs support using the new :target-fn compiler option https://github.com/nextjournal/clojurescript-graaljs

3