This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-28
Channels
- # adventofcode (12)
- # announcements (1)
- # asami (18)
- # aws (1)
- # babashka (20)
- # beginners (80)
- # calva (11)
- # cider (10)
- # circleci (5)
- # cljsrn (2)
- # clojure (37)
- # clojure-australia (15)
- # clojure-europe (32)
- # clojure-nl (2)
- # clojure-uk (26)
- # clojured (7)
- # clojurescript (10)
- # clojurewerkz (3)
- # cursive (45)
- # data-science (12)
- # datomic (3)
- # emacs (8)
- # events (3)
- # fulcro (23)
- # graphql (5)
- # helix (3)
- # jobs (1)
- # jobs-discuss (1)
- # juxt (3)
- # lsp (12)
- # malli (4)
- # meander (4)
- # reagent (11)
- # releases (1)
- # shadow-cljs (28)
- # sql (35)
- # tools-deps (9)
- # xtdb (25)
Hi , in clj or cljs extra data readers are loaded from a data-readers.clj
file at the root. For example in https://github.com/weavejester/hashp
How would I go about adding those same readers in self-hosted cljs?
I have found register-tag-parser!
in reader but that seems to only apply when (reader/read-string {:some-k "some val"})
My case is in a live editor sending render of components to different divs based on the reader tag.
#r1 [a-com opts-1]
#r2 [a-com opts-2]
thanks in advance@fj.abanses pretty sure the self-hosted compiler uses this binding https://github.com/clojure/clojurescript/blob/017ce8812d9b73f5df076b20e818e0ae90b90812/src/main/clojure/cljs/tagged_literals.cljc#L87, so you can probably just bind that when you invoke the compiler? maybe the compile functions also take that as an arg?
@thheller many thanks. A first quick test shows that the approach works. <using shadow-cljs here>
(defn eval-str [source cb]
(binding [*cljs-data-readers* (merge *cljs-data-readers* {'r1 (fn [form] (str form))})]
(cljs/eval-str
c-state
source
"[test]"
{:eval cljs/js-eval
:load (partial boot/load c-state)
:ns (symbol project-ns)}
cb)))
The reason I ask is because I’m trying to automate versioning, releasing, and publishing to npm via circleci. It looks like you’ve automated building and testing @thheller. Do you do these steps manually?
Check out np by Sindre https://github.com/sindresorhus/np