clerk

peterh 2024-10-19T10:03:29.385769Z

Is it possible to require dependencies in a .cljs file loaded via :require-cljs true from a Clerk viewer? Where would I have to declare them? When I declare a dependency directly in deps.edn and require it in my cljs file, Clerk cannot find the namespace, so I assume this is not the right way to do it.

peterh 2024-10-20T21:45:05.327919Z

Just created the issue with a test repo: https://github.com/nextjournal/clerk/issues/718 Is there an issue in spec?

🙏 1
mkvlr 2024-10-19T12:23:42.412299Z

it depends. Clerk looks for cljs and cljc files on the classpath, so it should work for files coming from libraries as long as they are runnable in sci.

mkvlr 2024-10-19T12:24:18.054219Z

what’s the depedency and namespace you’re trying to load? Can you push a small repro somewhere?

peterh 2024-10-19T17:56:47.836199Z

I tried to require a library of my own (https://clojars.org/eu.formsandlines/formform - works both in clj and cljs), but get an exception "Could not find source for CLJS namespace: clojure.math", so I tried to just require clojure.math on its own, which doesn’t work either, even though it should be in the ClojureScript core? My lib depends on the log function from clojure.math. I have seen that it was introduced in Clojure 1.11, so maybe has not been included in SCI? However, the clojure.math.combinatorics ns works just fine. Some other libs I tried also have namespaces missing (e.g. clojure.spec.alpha in https://github.com/oakes/odoyle-rules).

mkvlr 2024-10-19T18:22:53.845859Z

ah, think we need to add it to the builtins. Would you mind filling an issue with these details?

peterh 2024-10-19T21:38:52.844409Z

You mean on the Clerk repo? Sure, can do that.

👍 1
peterh 2024-10-19T23:44:39.574469Z

Great, this works! Although now it’s missing clojure.spec.alpha (maybe also clojure.spec.gen.alpha, if this is not included) and goog. 🙂 Can they all just be added to the list or is there more work involved?

mkvlr 2024-10-20T00:15:23.825009Z

what from goog? (Parts should be there already)

mkvlr 2024-10-20T00:15:42.848319Z

if you need more it might be best to create an issue with a repro

mkvlr 2024-10-20T00:15:49.628459Z

then we can validate things are working

mkvlr 2024-10-20T00:26:06.330909Z

and not sure regarding spec.alpha

Zach 2024-10-19T15:18:31.666969Z

I may be a little late but I just upgraded clerk and love the new stack traces!

đź–¤ 4