This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-22
Channels
- # architecture (1)
- # aws (3)
- # beginners (78)
- # boot (33)
- # cider (49)
- # cljs-dev (3)
- # clojure (82)
- # clojure-berlin (2)
- # clojure-dusseldorf (14)
- # clojure-gamedev (75)
- # clojure-italy (15)
- # clojure-nl (2)
- # clojure-poland (9)
- # clojure-russia (1)
- # clojure-spec (11)
- # clojure-uk (91)
- # clojurescript (17)
- # core-async (2)
- # cursive (1)
- # data-science (3)
- # datascript (34)
- # datomic (13)
- # docs (2)
- # duct (32)
- # emacs (8)
- # fulcro (95)
- # instaparse (17)
- # jobs (2)
- # jobs-discuss (1)
- # jobs-rus (4)
- # leiningen (1)
- # luminus (1)
- # lumo (4)
- # mount (1)
- # nrepl (1)
- # off-topic (98)
- # onyx (13)
- # portkey (12)
- # re-frame (10)
- # reagent (11)
- # remote-jobs (4)
- # rum (3)
- # shadow-cljs (34)
- # specter (7)
- # sql (1)
- # tools-deps (8)
@wilkerlucio typically I'd say this is due to the charset of the page. <meta charset="UTF-8">
typically fixes it for the browser. not sure about chrome extension though.
@wilkerlucio there seems to a be a long history related to this. in short CLJS will emit console.log("\u25B6\u2764\u25C0");
which works fine without setting a charset. Closure will optimize and turn that into console.log("▶❤◀");
however which then fails to load properly without a specified charset. see https://dev.clojure.org/jira/browse/CLJS-1547?focusedCommentId=42617
apparently the default charset is the problem here. if you set :compiler-options {:closure-output-charset "US-ASCII"}
it will keep the same escaped sequence that CLJS emits and the problem goes away
wonder if you can set the default charset for chrome, seems weird that it doesn't load UTF-8 properly by default
oh right. chrome does the right thing for the extension. the browser seems to require a charset though
hmm. i’m playing around with a bootstrapped build, wondering about how one might get a watch
build to send updates to the browser. Seems a two-part problem; first, figuring out how to get (require 'the-ns :reload)
to work (currently I have to dissoc a namespace from :cljs.analyzer/namespaces
before it will do anything), maybe modifying shadow.cljs.bootstrap.browser/load-namespaces
to accept a :reload
parameter, and second - any idea how a client could be notified when namespaces in a bootstrapped build are modified? i would guess one just wants a callback to be fired, maybe w/ a list of changed namespaces, as there is no way for shadow to know anything about what’s going on with compiler states in the browser
@thheller thanks! I'll try that out
@mhuebert you are talking about the bootstrap support build notifying the host build correct?
I would think the host build would need to do the work of putting it in the right place
yeah but currently there is no way for you to "hook" into anything the devtools client is doing
its complex enough as it is so I don't want to introduce another layer that might cause problems
yes. the only nit there is the first problem i mentioned above - i am not sure exactly where to fix it - that i have to dissoc the ns from the compiler-state before load-namespaces
will reload it
it would probably be best if you implemented your own shadow.cljs.bootstrap.browser
. I implemented that as a proof of concept but what you are asking goes way beyond what I planned for it
i am already running the watch build from a script via clj-run, maybe there is a way i can make a little hack to listen in for when shadow has recompiled things in my bootstrap build?
I do have plans for a generic API endpoint I want to build the UI on-top of. this would expose such data but thats pretty much in planning stages
since you'd probably need a websocket for subscription-ish things that is even further from existing
I guess you could build you own http server that you then connect a websocket to and notify whenever a compile finishes
$ shadow-cljs compile em-admin
shadow-cljs - config: /Users/grav/repo/eddie-michel/em-poc/shadow-cljs.edn cli version: 2.3.23 node: v8.6.0
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm compile em-admin
Exception in thread "main" java.lang.RuntimeException: No such var: module-graph/validate-inputs, compiling:(shadow/build/cljs_closure.clj:931:3)
at clojure.lang.Compiler.analyze(Compiler.java:6792)
What to do?I’m using :lein true
in my shadow-cljs.edn
, and I’ve added [thheller/shadow-cljs "2.3.23"]
to the deps in my project.clj
Hmm … cannot seem to get namespaces with dash (`-`) to work. For instance, a namespace, my-package.namespace
I would assume maps to my_package.namespace
, but that ends up being undefined. Works if I remove the dash from the namespace and use e.g. mypackage.namespace
@thheller so to know what to send the client, I could do something like this -
(def proc (watch))
(def output-chan
(let [c (chan)]
(tap (:output-mult proc) c)
c))
(defn bootstrap-compiled-sources [{:keys [type build-config info]}]
(when (and (= :build-complete type)
(= :bootstrap (:target build-config)))
(:compiled info)))
(def bootstrap-loop
(go-loop []
(let [evt (<! output-chan)]
(some-> (bootstrap-compiled-sources evt)
(println))
(recur))))