Skip to content

Commit

Permalink
Fix #718: expose spec
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 23, 2024
1 parent 748f73e commit 36de8d9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
:exclusions [org.babashka/sci]}
;; emmy needs SCI, here we use the same version as in render:
org.babashka/sci {:git/url "https://github.com/babashka/sci"
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
:git/sha "6d9380f55b3038769d5856fc67e7d7939ac981ef"}
io.github.nextjournal/clerk-slideshow {:git/sha "11a83fea564da04b9d17734f2031a4921d917893"}}}

:nextjournal/garden {:exec-fn nextjournal.clerk/serve!
Expand Down
4 changes: 2 additions & 2 deletions render/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
binaryage/devtools {:mvn/version "1.0.3"}
cider/cider-nrepl {:mvn/version "0.28.3"}
org.babashka/sci {:git/url "https://github.com/babashka/sci"
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
:git/sha "6d9380f55b3038769d5856fc67e7d7939ac981ef"}
org.clojure/clojurescript {:mvn/version "1.11.132"}
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
reagent/reagent {:mvn/version "1.2.0"}
io.github.babashka/sci.configs {:git/sha "8253c69a537bcc82e8ff122e5f905fe9d1e303f0"
io.github.babashka/sci.configs {:git/sha "eb1fcaacf6f98c27adf22002173d40ae4f9cfcb0"
:exclusions [org.babashka/sci]}
io.github.nextjournal/clojure-mode {:git/sha "1f55406087814a0dda6806396aa596dbe13ea302"}
thheller/shadow-cljs {:mvn/version "2.23.1"}
Expand Down
6 changes: 5 additions & 1 deletion src/nextjournal/clerk/cljs_libs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
reagent.ratom
user
clojure.pprint
cljs.pprint}))
cljs.pprint
clojure.spec.alpha
cljs.spec.alpha
clojure.spec.gen.alpha
cljs.spec.gen.alpha}))

(defn- ns-decl?
"Returns true if form is a (ns ...) declaration."
Expand Down
16 changes: 12 additions & 4 deletions src/nextjournal/clerk/sci_env.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
[sci.configs.applied-science.js-interop :as sci.configs.js-interop]
[sci.configs.reagent.reagent :as sci.configs.reagent]
[sci.configs.cljs.pprint :as sci.configs.pprint]
[sci.configs.cljs.spec.alpha :as sci.configs.spec]
[sci.core :as sci]
[sci.ctx-store]
[sci.nrepl.server :as nrepl]
[shadow.esm]))
[shadow.esm]
[cljs.repl]))

(defn ->render-fn+opts-with-*eval*-binding
"Establishes the `*eval*` binding to support alternative
Expand Down Expand Up @@ -164,7 +166,10 @@
"w3c-keyname" w3c-keyname}
:ns-aliases '{clojure.math cljs.math
cljs.repl clojure.repl
clojure.pprint cljs.pprint}
clojure.pprint cljs.pprint
clojure.spec.alpha cljs.spec.alpha
clojure.spec.gen.alpha cljs.spec.gen.alpha
clojure.spec.test.alpha cljs.spec.test.alpha}
:namespaces (merge {'nextjournal.clerk.viewer viewer-namespace
'nextjournal.clerk viewer-namespace ;; TODO: expose cljs variant of `nextjournal.clerk` with docstrings
'nextjournal.clerk.sci-env {'load-string+
Expand All @@ -173,7 +178,9 @@
'clojure.core {'read-string read-string
'implements? (sci/copy-var implements?* core-ns)
'time (sci/copy-var time core-ns)
'system-time (sci/copy-var system-time core-ns)}
'system-time (sci/copy-var system-time core-ns)
infinite? (sci/copy-var infinite? core-ns)
'update-vals (sci/copy-var update-vals core-ns)}
'clojure.repl {'pst pst-stub}}
(sci-copy-nss
'cljs.math
Expand All @@ -194,7 +201,8 @@

sci.configs.js-interop/namespaces
sci.configs.reagent/namespaces
sci.configs.pprint/namespaces)})
sci.configs.pprint/namespaces
sci.configs.spec/namespaces)})

(defn ^:export eval-form [f]
(sci/binding [sci/ns @last-ns]
Expand Down

0 comments on commit 36de8d9

Please sign in to comment.