Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Sep 16, 2024
1 parent c2ec1b2 commit f27a0a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
11 changes: 7 additions & 4 deletions src/nextjournal/clerk/cljs_libs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,15 @@
(filter #(or (not dedupe-cljs)
(when-not (contains? @dedupe-cljs %)
(swap! dedupe-cljs conj %)
(prn :->>>>)
true))
(mapv slurp-resource (keep ns->resource (all-ns state)))))]
(-> doc
;; make sure :cljs-libs is the first key, so these are read + evaluated first
(aam/assoc-before :cljs-libs (mapv (fn [code-str] (v/->ViewerEval `(load-string ~code-str))) cljs-sources))
(aam/assoc-before :nextjournal.clerk/remount (valuehash :sha1 cljs-sources)))
(do
(prn cljs-sources)
(-> doc
;; make sure :cljs-libs is the first key, so these are read + evaluated first
(aam/assoc-before :cljs-libs (mapv (fn [code-str] (v/->ViewerEval `(load-string ~code-str))) cljs-sources))
(aam/assoc-before :nextjournal.clerk/remount (valuehash :sha1 cljs-sources))))
doc)))

;;;; Scratch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,4 @@
[1 2 3])

(comment
(require '[babashka.fs :as fs])
(fs/exists? "test/nextjournal/clerk/fixtures/require_cljs_bundle_dedupe_1.clj")
(clerk/build! {:paths ["test/nextjournal/clerk/fixtures/require_cljs_bundle_dedupe_1.clj"
"test/nextjournal/clerk/fixtures/require_cljs_bundle_dedupe_2.clj"]
:package :single-file})
(def build (slurp "public/build/index.html"))
(= 1 (re-find #"(prn ::identity)" build))
)

0 comments on commit f27a0a4

Please sign in to comment.