Fork me on GitHub
#helix
<
2020-08-29
>
cfleming01:08:50

Right. If you’re just analysing and not compiling, then you don’t need the foreign libs (generally, not sure if that’s always true). Here’s a change that Thomas made to codox, which was the original code cljdoc was based on: https://gist.github.com/thheller/5bc57a7571cf83fd12190ab7165cdb46#file-codox-cljs-clj-L87-L91

cfleming01:08:50

So my understanding is that the code required to populate the js libs in the compiler state from node_modules is not called when using the analyser API, only when using the build API.

dominicm06:08:39

One potential problem (that doesn't affect helix) is that it's perfectly valid to require [react]

cfleming05:08:52

For my purposes, that shouldn’t affect analysis, I just need the analysis not to fail.

cfleming05:08:17

The external deps are hardly ever used in e.g. calculating var metadata.

dominicm06:08:44

No string required

Aron07:08:05

I thought I had to use strings. Damn I am still such a newb, now I have to go back and read this again.

dominicm11:08:48

You do (did?) in shadow, but not in clojurescript.

Aron11:08:19

isn't shadow just a builder for cljs+js?

Aron11:08:44

afaik it doesn't add new functionality, so it would be new information if it takes away existing ones

Aron11:08:05

haven't read it yet, it's saturday noon, I don't want to work yet

dominicm12:08:41

It does add new functionality. I believe it is a custom compiler, using the analysis data from clojurescript.

dominicm22:08:56

This is not true > It does not introduce new “syntax” for require I can think of two instances (:default and "./") where there's differences.

dominicm22:08:05

> It interfaces directly with cljs.analyzer and cljs.compiler and does some minor modifications since there are no “official” hooks into the namespace aliasing required for npm dependencies and such. Compilation of actual CLJS is unchanged and only the parts that involve interop with npm are changed. I'm very careful about introducing new stuff and want to remain 100% compatible, any new features are opt-in and have “fallbacks”.

dominicm22:08:23

This is really the key thing, it adds stuff, it's not comparable to Figwheel.

Aron23:08:57

Yeah, but then you must understand how confusing this is to me. Are you saying that the creator of this tool is either lying or mistaken? Not sure which is worse in this case 🙂

Aron23:08:38

Figwheel is also a build tool? Before shadow-cljs I couldn't use clojurescript, mostly because of the impossibility to use npm modules (and since clojurescript and clojure are much more different from each other than js in the browser and node.js, this meant that while a js module was usable anywhere, you couldn't really use the same libraries both on the frontend and on the backend in cljs/cljs). I am stating this because I tried many many many times, first with lein, then with boot, to have a usable dev env, but it never worked out. Shadow-cljs was and still is the only way I can use clojure for production. It never occurred to me to compare it to figwheel before.

dominicm07:08:50

I think there's a terminology gap. Maybe shadow technically is a build tool that uses the analysis differently? Maybe :default isn't syntax, but something else? I'm not sure.

dominicm07:08:47

You can do things in shadow requires which aren't possible with a normal clojurescript main build. If you use those features in a library, then your library users must use shadow too.

Aron11:08:38

so strings are needed because npm module names are not simple symbols, they have weird characters in them. This is something I am very curious how this approach: https://clojurescript.org/guides/webpack solves.