Skip to content

Commit bf89e07

Browse files
authored
Expose cljs.pprint, clojure.math as cljs.math (#723)
1 parent 81ec0e0 commit bf89e07

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

notebooks/viewers/viewer_lib.cljc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
(ns viewers.viewer-lib
22
#?(:cljs (:require [nextjournal.clerk :as clerk]
3-
[foo.bar :as-alias foo])))
3+
[foo.bar :as-alias foo]
4+
[cljs.core :as c]
5+
[clojure.math :as math1]
6+
[cljs.math :as math2]
7+
[clojure.pprint :as pp])))
48

59
#?(:cljs `foo/x)
610

711
#?(:cljs (defn my-already-defined-function [x]
812
[:div
913
"Inspected value :)"
10-
[:div [clerk/inspect x]]]))
14+
(str (cljs.core/inc (math2/floor (math1/floor 1.2))))
15+
[:div [clerk/inspect x]]
16+
[:div (with-out-str (pp/pprint (range 20)))]]))

render/deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
org.clojure/clojurescript {:mvn/version "1.11.132"}
88
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
99
reagent/reagent {:mvn/version "1.2.0"}
10-
io.github.babashka/sci.configs {:git/sha "0702ea5a21ad92e6d7cca6d36de84271083ea68f"
10+
io.github.babashka/sci.configs {:git/sha "8253c69a537bcc82e8ff122e5f905fe9d1e303f0"
1111
:exclusions [org.babashka/sci]}
1212
io.github.nextjournal/clojure-mode {:git/sha "1f55406087814a0dda6806396aa596dbe13ea302"}
1313
thheller/shadow-cljs {:mvn/version "2.23.1"}

src/nextjournal/clerk/cljs_libs.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
cljs.math
1818
cljs.repl
1919
clojure.core
20+
cljs.core
2021
clojure.edn
2122
clojure.math
2223
clojure.repl
@@ -46,7 +47,9 @@
4647
reagent.core
4748
reagent.debug
4849
reagent.ratom
49-
user}))
50+
user
51+
clojure.pprint
52+
cljs.pprint}))
5053

5154
(defn- ns-decl?
5255
"Returns true if form is a (ns ...) declaration."

src/nextjournal/clerk/sci_env.cljs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
[reagent.ratom :as ratom]
3939
[sci.configs.applied-science.js-interop :as sci.configs.js-interop]
4040
[sci.configs.reagent.reagent :as sci.configs.reagent]
41+
[sci.configs.cljs.pprint :as sci.configs.pprint]
4142
[sci.core :as sci]
4243
[sci.ctx-store]
4344
[sci.nrepl.server :as nrepl]
@@ -162,7 +163,8 @@
162163
"react-dom" react-dom
163164
"w3c-keyname" w3c-keyname}
164165
:ns-aliases '{clojure.math cljs.math
165-
cljs.repl clojure.repl}
166+
cljs.repl clojure.repl
167+
clojure.pprint cljs.pprint}
166168
:namespaces (merge {'nextjournal.clerk.viewer viewer-namespace
167169
'nextjournal.clerk viewer-namespace ;; TODO: expose cljs variant of `nextjournal.clerk` with docstrings
168170
'nextjournal.clerk.sci-env {'load-string+
@@ -191,7 +193,8 @@
191193
'nextjournal.markdown.transform)
192194

193195
sci.configs.js-interop/namespaces
194-
sci.configs.reagent/namespaces)})
196+
sci.configs.reagent/namespaces
197+
sci.configs.pprint/namespaces)})
195198

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

0 commit comments

Comments
 (0)