This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-31
Channels
- # announcements (8)
- # babashka (8)
- # beginners (13)
- # biff (1)
- # calva (1)
- # cider (12)
- # clj-kondo (16)
- # cljs-dev (3)
- # cljsrn (14)
- # clojure (18)
- # clojure-austin (2)
- # clojure-czech (3)
- # clojure-europe (54)
- # clojure-germany (5)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojure-spec (4)
- # clojure-survey (2)
- # clojure-uk (1)
- # clojured (15)
- # clojurescript (5)
- # conjure (6)
- # core-async (65)
- # cursive (24)
- # data-science (1)
- # emacs (9)
- # events (3)
- # graphql (5)
- # integrant (6)
- # jobs (2)
- # joyride (62)
- # lsp (5)
- # malli (10)
- # off-topic (20)
- # pathom (57)
- # polylith (18)
- # re-frame (12)
- # remote-jobs (3)
- # rewrite-clj (14)
- # sci (2)
- # shadow-cljs (41)
- # sql (9)
- # tools-deps (68)
Hi Thomas, in the context of Malli function instrumentation. I'm wondering if there is a way to tell the compiler, not only to always recompile a namespace (with {:dev/always true}
), but also to instruct the compiler to do so after all other namespaces - without needing a solution like you mentioned here https://clojureverse.org/t/problem-using-malli-clojurescript-instrumentation-and-shadow-cljs/8612/2
of explicitly including every namespace that you want to compile before the entry one (or preload).
The dream setup would be adding one piece of metadata to the entry namespace (for a webapp) and then getting repl friendly instrumentation. Not sure if this is possible, so wanted your opinion on the matter. Thanks.
define "repl friendly instrumentation"? the hot-reload cycle is entirely independent of the REPL so that confuses me?
Ah you're right - it's really just hot-reload - making sure the changes in leaf namespaces (changing the malli schema used by a function) is picked up in the entry namespace.
Here's the setup for instrumenting with fn metadata:
1. in your entry namespace in your after-load callback the user invokes a macro (
this scans all namespaces and collects any functions that have :malli/schema
metadata
2. In your leaf namespace like my.app.utils
you have a function like:
(defn minus-small-int
{:malli/schema [:=> [:cat :int] small-int]
:malli/scope #{:input :output}}
[x] (dec x))
3. I'm dev'ing this function and changing the schema and the implementation
The workflow I want is to just edit the leaf namespace and have the ()
call get macro-expanded and compiled + eval'd again with this new schema.
I'm also open to other suggestions about how to achieve this - maybe an editor command to submit that macro call? then your workflow is: save file. invoke editor command. ?or might just do a lot of work that is unnecessary and as such slow everything else down
oh very cool! Well at least it pushes the problem from a staleness one to a perf one. Is there a way in a macro to determine which namespaces have changed (provided by some compiler data?) that way I don't have to scan every ns
I mean strictly speaking yes but that would be shadow-cljs only and even then not guaranteed to be reliable
got it - would it be really bad to use the ns to lookup its file modified time ? that way I could store some state to keep track which ns's changed
I've gotten curious about the current best way to do documentation generation. Many of the previous ways to do this (Marginalia, Codox, Dynadoc) seem to mostly be via lein plugins (or deps.edn). What's the best way to generate docs with Shadow? (Or is everyone just using cljdoc?)
or just use lein with the plugins. they are all seperate tools that don't require shadow-cljs in any way to work
Hi all, I'm new here. I've got a question about problems compiling with shadow-cljs for a project using Fabric.js. We're currently trying to upgrade a bunch of packages; we are building ok pre-upgrade. As I understand it, fabric is using jsdom. On lein shadow compile app
we're seeing a whole bunch of errors like:
[:app] Compiling ...
Closure compilation failed with 20 errors
--- node_modules/jsdom/lib/jsdom/living/generated/AbortSignal.js:95
constructor is missing a call to super()
--- node_modules/jsdom/lib/jsdom/living/generated/Attr.js:96
constructor is missing a call to super()
--- node_modules/jsdom/lib/jsdom/living/generated/CDATASection.js:94
constructor is missing a call to super()
Googling I see this one question/answer in 2019 (https://clojurians-log.clojureverse.org/shadow-cljs/2021-08-13) to a similar constructor is missing a call to super()
error, but I'm not sure where to go from here. Any advice welcome!@emile what are you building? looks like it might be a browser build? jsdom is intended for node envs? what is your build :target
?
@thheller yes, :target is :browser. We have a clojurescript reframe component that uses Fabric.js and canvas element to let you draw various regions on top of an image, then turn what you've drawn into svg. Fabric is apparently using jsdom. Are you saying this should never have worked? 🙂
it appears to be an optional dependency. so something you have done must lead to its inclusion. not sure what
You'll have to forgive me, my grasp of dealing with dependency stuff is not strong. We are trying to upgrade a bunch of stuff, including shadow-cljs to 2.19.0 from 2.11.18. I'm trying to figure out what's pulling in jsdom now...
@thheller re: jsdom as optional dependency of fabric... our team is confused 🙂 We can't find anything explicit in our dependencies for jsdom. When we remove package-lock.json
, run npm install --no-optional
and then lein shadow compile app
we see:
[:app] Compiling ...
The required JS dependency "jsdom" is not available, it was required by "node_modules/fabric/dist/fabric.js".
Dependency Trace:
mobot_web/app.cljs
mobot_web/core.cljs
mobot_web/admin/views/core.cljs
mobot_web/admin/views/test_plan_runner.cljs
mobot_web/admin/views/components/assessment_region_editor.cljs
node_modules/fabric/dist/fabric.js
Searched for npm packages in:
/home/emile/dev/mobot-doc-change/mobot-web/node_modules
See:
it is trying to include jsdom conditionally in a way that shadow-cljs does not recognize properly. so it ends up trying to include it fully
Ah, thanks!
you can set this is :js-options
in your build config
:resolve {"jsdom" false
"jsdom/lib/jsdom/living/generated/utils" false
"jsdom/lib/jsdom/utils" false}
Much appreciated!