This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-05
Channels
- # announcements (1)
- # beginners (72)
- # boot (4)
- # calva (35)
- # cider (8)
- # clara (13)
- # cljdoc (31)
- # cljs-dev (34)
- # clojure (64)
- # clojure-europe (1)
- # clojure-finland (3)
- # clojure-italy (23)
- # clojure-losangeles (3)
- # clojure-nl (35)
- # clojure-uk (19)
- # clojurescript (26)
- # cursive (19)
- # datomic (12)
- # duct (5)
- # editors (7)
- # emacs (25)
- # fulcro (40)
- # funcool (5)
- # jobs (2)
- # leiningen (3)
- # luminus (2)
- # lumo (3)
- # off-topic (19)
- # pathom (3)
- # planck (2)
- # reagent (6)
- # remote-jobs (4)
- # rum (1)
- # shadow-cljs (23)
- # spacemacs (6)
- # tools-deps (12)
should it be possible to require cljs.loader from a node target using npm-deps or is https://dev.clojure.org/jira/browse/CLJS-3067 expected?
@mkvlr cljs.loader
isn't really usable in node. don't know why compilation fails but otherwise you'd probably get runtime errors
@thheller yeah, I don’t want to use it there but my namespaces are used for node and the browser and they require it
think I have a fix by checking for (seq modules)
in https://github.com/clojure/clojurescript/blob/91be632537f324d114916984b12194e919b7b5b7/src/main/clojure/cljs/closure.clj#L1233
don’t have a clear idea on how to best address this, think I’d some feedback on the approach to take
@mkvlr ping @alexmiller about the permissions. they were locked down due to spam.
thanks, @U45J3R52L post for me for now
Perms added
It seems private calls from cljs.core are not warned about:
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -m cljs.main -re node
Downloading: org/clojure/clojurescript/maven-metadata.xml from
ClojureScript 1.10.520
cljs.user=> (maybe-warn 1)
1
nil
An example from the wild: https://github.com/reagent-project/reagent/blob/master/src/reagent/ratom.cljs#L106 (`pr-writer` is private in cljs.core)
That's odd; seems like qualified access doesn't slip through whatever crack that is.
ClojureScript 1.10.439
cljs.user=> maybe-warn
#object[cljs$core$maybe_warn]
cljs.user=> cljs.core/maybe-warn
WARNING: var: cljs.core/maybe-warn is not public at line 1 <cljs repl>
#object[cljs$core$maybe_warn]
If I had to guess it is because the core vars have all been referred and, for referred things, private var access catches them at the time they are referred. Probably easy to special-case situations involving cljs.core
.
@mfikes do you maybe have an idea for https://dev.clojure.org/jira/browse/CLJS-3067?
Hrm. I'm not familiar with what cljs.loader
does internally. Would need to take a deeper look.
there’s this special compilation pass in https://github.com/clojure/clojurescript/blob/91be632537f324d114916984b12194e919b7b5b7/src/main/clojure/cljs/closure.clj#L1228 but it throws without modules in module-graph/modules->module-uris
$ echo '(maybe-warn 1)' > src/foo.cljs
$ deps='{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"}}}'
$ clj -Sdeps "$deps" -m cljs.main -re node -i src/foo.cljs
1
@borkdude Hrm. I don't understand. Is this illustrating something different? (Or just another way to repro?)
Yeah. I think that is the root of the defect. IIRC, when you refer a var, that's the time at which the feature catches the fact that the var you are referring is private. After that, you are free to use it. (I don't recall why this is the case, but I recall it being easier to implement this way.)
https://github.com/clojure/clojurescript/commit/a3dd687b273baf5f05f88aaa62245f407ef8623f fixes our use case (requiring cljs.loader in the class path but not in the dependency tree of the node main). But not sure if its the right way.