Live data from Hacker News

ClojureScript Is Not An Island: Integrating Node Modules

clojurescript.org

1–10 of 43 posts

Re: ClojureScript Is Not An Island: Integrating Node Modules

#3

This feature is really, really a long time coming. Myself and other ClojureScript core contributors are happy to answer any questions people may have.

It sounds like this handles extern inference if possible. Is that the case? I have wanted to play around with Webrtc for a while now but it basically requires adapter.js (https://github.com/webrtc/adapter) and as a result a ton of externs.

It would be cool if I could just plug and play!

Re: ClojureScript Is Not An Island: Integrating Node Modules

#4
post #3

This feature is really, really a long time coming. Myself and other ClojureScript core contributors are happy to answer any questions people may have.

It sounds like this handles extern inference if possible. Is that the case? I have wanted to play around with Webrtc for a while now but it basically requires adapter.js ( https://github.com/webrtc/adapter ) and as a result a ton of externs. It would be cool if I could just plug and play!

There's no extern inference required here as all the original sources are passed directly through Google Closure Compiler. As a benchmark for feasibility when we started we chose React.js as it's non-trivial and heavily depended upon in the ClojureScript ecosystem. We discovered that over all of React's sources we only need 4 extern definitions for 4 generated names in EventsPlugin. So as long as the JS library in question isn't relying on string-based meta programming everything should work.

Granted this rules out some libraries, there are plenty of libraries written in a simple straightforward style that will work just fine. In particular I am bullish about fantastic results with ES6+ libraries written with ES6 classes with static import/export. Closure will eat that stuff up.

Re: ClojureScript Is Not An Island: Integrating Node Modules

#6
post #3

Earlier quoted context omitted.

It sounds like this handles extern inference if possible. Is that the case? I have wanted to play around with Webrtc for a while now but it basically requires adapter.js ( https://github.com/webrtc/adapter ) and as a result a ton of externs. It would be cool if I could just plug and play!

There's no extern inference required here as all the original sources are passed directly through Google Closure Compiler. As a benchmark for feasibility when we started we chose React.js as it's non-trivial and heavily depended upon in the ClojureScript ecosystem. We discovered that over all of React's sources we only need 4 extern definitions for 4 generated names in EventsPlugin. So as long as the JS library in qu…

Just to add to this statement, even in cases where externs will still be necessary, adding CLJSJS packages[1] to your project's classpath will result in those externs being used even if you don't use the libraries that the packages provide.

http://github.com/cljsjs/packages

Re: ClojureScript Is Not An Island: Integrating Node Modules

#8

The thing I like about Clojurescript is the ability to escape the node/NPM ecosystem entirely. It's feature, not a bug, that I don't want to interoperate with node/NPM.

This functionality is opt-in, so you can still live on your island if you'd like :-)

Re: ClojureScript Is Not An Island: Integrating Node Modules

#9

The thing I like about Clojurescript is the ability to escape the node/NPM ecosystem entirely. It's feature, not a bug, that I don't want to interoperate with node/NPM.

I would say you are in a distinct minority here with that viewpoint :) I've been using / working on ClojureScript since the very beginning and the halfway integration with Node and NPM never seemed particularly desirable to me.

Re: ClojureScript Is Not An Island: Integrating Node Modules

#10
How does Clojurescript lookup for a module you declare?

For example, in https://github.com/omcljs/om/blob/c68e668a73cc534ecfdc71d631... (couldn't think of any Clojurescript library), you have `[om.dom`, `[cljsjs.react`, `[goog.dom`. Where does the compiler look for these things? How does it knows one is a local module and the other an external package?

I need to know this so I can implement it in https://github.com/fiatjaf/module-linker

Post reply on HN