Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
With CLJS-2298, support was added for automatically loading {{user.cljs}} or {{user.cljc}} files found "in a user's workspace". In particular, the revision involved specifically checking that any candidates found on the classpath were actually files on disk as opposed to files discovered in JARs. (See https://github.com/clojure/clojurescript/blob/6eedd0a08c49f7b0d4dcb30977b2fb38c90577bd/src/main/clojure/cljs/repl.cljc#L966).

If you instead depend (via git deps) on a library that has a {{user.cljs}} or {{user.cljc}} file, then checking that it is a file is insufficient as a guard. In addition, we should exclude any file found in gitlibs. We could accomplish this by reusing a function like {{cljs.closure/gitlibs-src?}}. (See https://github.com/clojure/clojurescript/blob/c2f5aba2f59cf30dbc13c968d8ee3f0e4359d38c/src/main/clojure/cljs/closure.clj#L64) Note that we can't reuse this function directly as is because it is temporarily set to return {{false}}. But, some of this capability could be factored into one of the util namespaces and reused from the REPL.

2 Answers

0 votes

Comment made by: namenu

I had no idea how to add tests around this patch.

However I've tested manually that

  • {{user.cljs}} from gitlibs is not autoloaded.
  • current workspace's {{user.cljs}} is still autoloaded.
0 votes
Reference: https://clojure.atlassian.net/browse/CLJS-2935 (reported by mfikes)