clojurific 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/cljf/launcher.js +15 -8
- package/package.json +2 -2
- package/compiler/deps.edn +0 -9
- package/compiler/src/main/cljs/cljs/analyzer/passes/and_or.cljc +0 -118
- package/compiler/src/main/cljs/cljs/analyzer/passes/lite.cljc +0 -32
- package/compiler/src/main/cljs/cljs/analyzer/passes.cljc +0 -32
- package/compiler/src/main/cljs/cljs/bootstrap_nodejs.js +0 -154
- package/compiler/src/main/cljs/cljs/core/specs/alpha.cljc +0 -272
- package/compiler/src/main/cljs/cljs/core/specs/alpha.cljs +0 -10
- package/compiler/src/main/cljs/cljs/core.cljs +0 -13194
- package/compiler/src/main/cljs/cljs/esm/goog/array.js +0 -61
- package/compiler/src/main/cljs/cljs/esm/goog/math.js +0 -1846
- package/compiler/src/main/cljs/cljs/esm/goog/object.js +0 -80
- package/compiler/src/main/cljs/cljs/esm/goog/string.js +0 -192
- package/compiler/src/main/cljs/cljs/esm/goog/userAgent/product.js +0 -10
- package/compiler/src/main/cljs/cljs/esm/goog.js +0 -90
- package/compiler/src/main/cljs/cljs/esm/karma.cljs +0 -103
- package/compiler/src/main/cljs/cljs/esm/lazy.clj +0 -51
- package/compiler/src/main/cljs/cljs/esm/lazy.cljs +0 -49
- package/compiler/src/main/cljs/cljs/esm/node_test.cljs +0 -21
- package/compiler/src/main/cljs/cljs/esm/repl_runtime.cljs +0 -353
- package/compiler/src/main/cljs/cljs/externs.js +0 -27
- package/compiler/src/main/cljs/cljs/imul.js +0 -11
- package/compiler/src/main/cljs/cljs/js.clj +0 -24
- package/compiler/src/main/cljs/cljs/js.cljs +0 -1432
- package/compiler/src/main/cljs/cljs/loader.cljs +0 -107
- package/compiler/src/main/cljs/cljs/main.clj +0 -67
- package/compiler/src/main/cljs/cljs/math.cljs +0 -869
- package/compiler/src/main/cljs/cljs/module_deps.js +0 -250
- package/compiler/src/main/cljs/cljs/nodejs.cljs +0 -27
- package/compiler/src/main/cljs/cljs/nodejs_externs.js +0 -3
- package/compiler/src/main/cljs/cljs/nodejscli.cljs +0 -22
- package/compiler/src/main/cljs/cljs/pprint.cljc +0 -167
- package/compiler/src/main/cljs/cljs/pprint.cljs +0 -3325
- package/compiler/src/main/cljs/cljs/proxy/impl.cljs +0 -32
- package/compiler/src/main/cljs/cljs/proxy.cljs +0 -184
- package/compiler/src/main/cljs/cljs/reader.clj +0 -18
- package/compiler/src/main/cljs/cljs/reader.cljs +0 -214
- package/compiler/src/main/cljs/cljs/repl.cljs +0 -206
- package/compiler/src/main/cljs/cljs/source_map/base64.cljs +0 -25
- package/compiler/src/main/cljs/cljs/source_map/base64_vlq.cljs +0 -102
- package/compiler/src/main/cljs/cljs/source_map.cljs +0 -305
- package/compiler/src/main/cljs/cljs/spec/alpha.cljc +0 -564
- package/compiler/src/main/cljs/cljs/spec/alpha.cljs +0 -1510
- package/compiler/src/main/cljs/cljs/spec/gen/alpha.cljc +0 -68
- package/compiler/src/main/cljs/cljs/spec/gen/alpha.cljs +0 -183
- package/compiler/src/main/cljs/cljs/spec/test/alpha.cljc +0 -329
- package/compiler/src/main/cljs/cljs/spec/test/alpha.cljs +0 -380
- package/compiler/src/main/cljs/cljs/stacktrace.cljc +0 -578
- package/compiler/src/main/cljs/cljs/test.cljc +0 -458
- package/compiler/src/main/cljs/cljs/test.cljs +0 -606
- package/compiler/src/main/cljs/clojure/browser/dom.cljs +0 -152
- package/compiler/src/main/cljs/clojure/browser/event.cljs +0 -101
- package/compiler/src/main/cljs/clojure/browser/net.cljs +0 -181
- package/compiler/src/main/cljs/clojure/browser/repl/preload.cljs +0 -13
- package/compiler/src/main/cljs/clojure/browser/repl.cljs +0 -283
- package/compiler/src/main/cljs/clojure/core/protocols.cljs +0 -29
- package/compiler/src/main/cljs/clojure/core/reducers.cljs +0 -312
- package/compiler/src/main/cljs/clojure/data.cljs +0 -162
- package/compiler/src/main/cljs/clojure/datafy.cljs +0 -63
- package/compiler/src/main/cljs/clojure/edn.cljs +0 -55
- package/compiler/src/main/cljs/clojure/reflect.cljs +0 -57
- package/compiler/src/main/cljs/clojure/set.cljs +0 -165
- package/compiler/src/main/cljs/clojure/string.cljs +0 -290
- package/compiler/src/main/cljs/clojure/walk.cljs +0 -98
- package/compiler/src/main/cljs/clojure/zip.cljs +0 -291
- package/compiler/src/main/cljs/process/env.cljs +0 -12
- package/compiler/src/main/cljs/shadow/resource.clj +0 -60
- package/compiler/src/main/cljs/shadow/resource.cljs +0 -10
- package/compiler/src/main/clojure/cljs/analyzer/api.cljc +0 -299
- package/compiler/src/main/clojure/cljs/analyzer/impl/namespaces.cljc +0 -68
- package/compiler/src/main/clojure/cljs/analyzer/impl.cljc +0 -59
- package/compiler/src/main/clojure/cljs/analyzer/macros.clj +0 -57
- package/compiler/src/main/clojure/cljs/analyzer/utils.clj +0 -36
- package/compiler/src/main/clojure/cljs/analyzer.cljc +0 -5292
- package/compiler/src/main/clojure/cljs/build/api.clj +0 -309
- package/compiler/src/main/clojure/cljs/cli.clj +0 -812
- package/compiler/src/main/clojure/cljs/closure.clj +0 -3440
- package/compiler/src/main/clojure/cljs/compiler/api.clj +0 -101
- package/compiler/src/main/clojure/cljs/compiler/macros.clj +0 -16
- package/compiler/src/main/clojure/cljs/compiler.cljc +0 -2748
- package/compiler/src/main/clojure/cljs/core/macros.clj +0 -43
- package/compiler/src/main/clojure/cljs/core/server.clj +0 -167
- package/compiler/src/main/clojure/cljs/core.cljc +0 -3719
- package/compiler/src/main/clojure/cljs/env/macros.clj +0 -37
- package/compiler/src/main/clojure/cljs/env.cljc +0 -102
- package/compiler/src/main/clojure/cljs/esm/repl/nrepl.clj +0 -151
- package/compiler/src/main/clojure/cljs/esm/repl.clj +0 -878
- package/compiler/src/main/clojure/cljs/esm.clj +0 -987
- package/compiler/src/main/clojure/cljs/externs/default.edn +0 -1549
- package/compiler/src/main/clojure/cljs/externs.clj +0 -479
- package/compiler/src/main/clojure/cljs/foreign/node.clj +0 -207
- package/compiler/src/main/clojure/cljs/instant.clj +0 -54
- package/compiler/src/main/clojure/cljs/js_deps.cljc +0 -412
- package/compiler/src/main/clojure/cljs/module_graph.cljc +0 -402
- package/compiler/src/main/clojure/cljs/repl/bootstrap.clj +0 -53
- package/compiler/src/main/clojure/cljs/repl/browser.clj +0 -540
- package/compiler/src/main/clojure/cljs/repl/node.clj +0 -253
- package/compiler/src/main/clojure/cljs/repl/node_repl.js +0 -114
- package/compiler/src/main/clojure/cljs/repl/reflect.clj +0 -85
- package/compiler/src/main/clojure/cljs/repl/server.clj +0 -236
- package/compiler/src/main/clojure/cljs/repl.cljc +0 -1615
- package/compiler/src/main/clojure/cljs/server/browser.clj +0 -54
- package/compiler/src/main/clojure/cljs/server/node.clj +0 -54
- package/compiler/src/main/clojure/cljs/source_map/base64.clj +0 -28
- package/compiler/src/main/clojure/cljs/source_map/base64_vlq.clj +0 -104
- package/compiler/src/main/clojure/cljs/source_map.clj +0 -369
- package/compiler/src/main/clojure/cljs/support.cljc +0 -18
- package/compiler/src/main/clojure/cljs/tagged_literals.cljc +0 -93
- package/compiler/src/main/clojure/cljs/util.cljc +0 -420
- package/compiler/src/main/clojure/cljs/vendor/bridge.clj +0 -42
- package/compiler/src/main/clojure/cljs/vendor/clojure/data/json.clj +0 -809
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/default_data_readers.clj +0 -303
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/edn.clj +0 -440
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/impl/commons.clj +0 -131
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/impl/errors.clj +0 -214
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/impl/inspect.clj +0 -91
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/impl/utils.clj +0 -127
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader/reader_types.clj +0 -431
- package/compiler/src/main/clojure/cljs/vendor/clojure/tools/reader.clj +0 -1035
- package/compiler/src/main/clojure/cljs/vendor/cognitect/transit.clj +0 -479
- /package/{compiler/no-clojurescript → no-clojurescript}/deps.edn +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
; Copyright (c) Rich Hickey. All rights reserved.
|
|
2
|
-
; The use and distribution terms for this software are covered by the
|
|
3
|
-
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
|
|
4
|
-
; which can be found in the file epl-v10.html at the root of this distribution.
|
|
5
|
-
; By using this software in any fashion, you are agreeing to be bound by
|
|
6
|
-
; the terms of this license.
|
|
7
|
-
; You must not remove this notice, or any other, from this software.
|
|
8
|
-
|
|
9
|
-
(ns cljs.core.macros
|
|
10
|
-
(:refer-clojure :exclude [alias])
|
|
11
|
-
(:require [clojure.java.io :as io]
|
|
12
|
-
[cljs.vendor.clojure.tools.reader :as reader]
|
|
13
|
-
[cljs.vendor.clojure.tools.reader.reader-types :as readers]
|
|
14
|
-
[cljs.env :as env]
|
|
15
|
-
[cljs.analyzer :as ana]
|
|
16
|
-
[cljs.repl :refer [source]])
|
|
17
|
-
(:import [java.io PushbackReader]))
|
|
18
|
-
|
|
19
|
-
(defn source-fn
|
|
20
|
-
[x]
|
|
21
|
-
(when-let [m (-> x resolve meta)]
|
|
22
|
-
(when-let [filepath (:file m)]
|
|
23
|
-
(let [f (io/file filepath)
|
|
24
|
-
f (if (.exists f)
|
|
25
|
-
f
|
|
26
|
-
(io/resource filepath))]
|
|
27
|
-
(when f
|
|
28
|
-
(with-open [pbr (PushbackReader. (io/reader f))]
|
|
29
|
-
(let [rdr (readers/source-logging-push-back-reader pbr)]
|
|
30
|
-
(dotimes [_ (dec (:line m))] (readers/read-line rdr))
|
|
31
|
-
(reader/read {:read-cond :allow :features #{:clj}} rdr))))))))
|
|
32
|
-
|
|
33
|
-
(defmacro import-macros [ns [& vars]]
|
|
34
|
-
(letfn [(->cljs-macro [[_ & rest]]
|
|
35
|
-
`(cljs.core/defmacro ~@rest))]
|
|
36
|
-
`(do
|
|
37
|
-
~@(binding [*ns* (find-ns ns)]
|
|
38
|
-
(doall (map (comp ->cljs-macro source-fn) vars))))))
|
|
39
|
-
|
|
40
|
-
(defmacro alias [[_ ns] [_ alias]]
|
|
41
|
-
(swap! env/*compiler* assoc-in
|
|
42
|
-
[::namespaces (.getName *ns*) :requires alias] ns)
|
|
43
|
-
nil)
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
; Copyright (c) Rich Hickey. All rights reserved.
|
|
2
|
-
; The use and distribution terms for this software are covered by the
|
|
3
|
-
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
|
|
4
|
-
; which can be found in the file epl-v10.html at the root of this distribution.
|
|
5
|
-
; By using this software in any fashion, you are agreeing to be bound by
|
|
6
|
-
; the terms of this license.
|
|
7
|
-
; You must not remove this notice, or any other, from this software.
|
|
8
|
-
|
|
9
|
-
(ns cljs.core.server
|
|
10
|
-
(:refer-clojure :exclude [with-bindings resolve-fn prepl io-prepl])
|
|
11
|
-
(:require [cljs.vendor.clojure.tools.reader.reader-types :as readers]
|
|
12
|
-
[cljs.vendor.clojure.tools.reader :as reader]
|
|
13
|
-
[cljs.env :as env]
|
|
14
|
-
[cljs.closure :as closure]
|
|
15
|
-
[cljs.analyzer :as ana]
|
|
16
|
-
[cljs.analyzer.api :as ana-api]
|
|
17
|
-
[cljs.repl :as repl]
|
|
18
|
-
[cljs.compiler :as comp]
|
|
19
|
-
[cljs.tagged-literals :as tags]))
|
|
20
|
-
|
|
21
|
-
(defmacro with-bindings [& body]
|
|
22
|
-
`(binding [ana/*cljs-ns* ana/*cljs-ns*
|
|
23
|
-
ana/*unchecked-if* ana/*unchecked-if*
|
|
24
|
-
ana/*unchecked-arrays* ana/*unchecked-arrays*]
|
|
25
|
-
~@body))
|
|
26
|
-
|
|
27
|
-
(defn- resolve-fn [valf]
|
|
28
|
-
(if (symbol? valf)
|
|
29
|
-
(or (resolve valf)
|
|
30
|
-
(when-let [nsname (namespace valf)]
|
|
31
|
-
(require (symbol nsname))
|
|
32
|
-
(resolve valf))
|
|
33
|
-
(throw (Exception. (str "can't resolve: " valf))))
|
|
34
|
-
valf))
|
|
35
|
-
|
|
36
|
-
(defn repl-quit? [v]
|
|
37
|
-
(#{":repl/quit" ":cljs/quit"} v))
|
|
38
|
-
|
|
39
|
-
(defn prepl
|
|
40
|
-
"A REPL with structured output (for programs)
|
|
41
|
-
reads forms to eval from in-reader (a LineNumberingPushbackReader)
|
|
42
|
-
Closing the input or passing the form :cljs/quit or :repl/quit will cause it
|
|
43
|
-
to return
|
|
44
|
-
|
|
45
|
-
Calls out-fn with data, one of:
|
|
46
|
-
{:tag :ret
|
|
47
|
-
:val string ;;eval result
|
|
48
|
-
:ns ns-name-string
|
|
49
|
-
:ms long ;;eval time in milliseconds
|
|
50
|
-
:form string ;;iff successfully read
|
|
51
|
-
}
|
|
52
|
-
{:tag :out
|
|
53
|
-
:val string} ;chars from during-eval *out*
|
|
54
|
-
{:tag :err
|
|
55
|
-
:val string} ;chars from during-eval *err*
|
|
56
|
-
{:tag :tap
|
|
57
|
-
:val string} ;values from tap>
|
|
58
|
-
|
|
59
|
-
You might get more than one :out or :err per eval, but exactly one :ret
|
|
60
|
-
tap output can happen at any time (i.e. between evals)
|
|
61
|
-
If during eval an attempt is made to read *in* it will read from in-reader unless :stdin is supplied
|
|
62
|
-
"
|
|
63
|
-
[repl-env {:keys [special-fns] :as opts} in-reader out-fn & {:keys [stdin]}]
|
|
64
|
-
(let [repl-opts (repl/repl-options repl-env)
|
|
65
|
-
opts (merge
|
|
66
|
-
{:def-emits-var true}
|
|
67
|
-
(closure/add-implicit-options
|
|
68
|
-
(merge-with (fn [a b] (if (nil? b) a b))
|
|
69
|
-
repl-opts opts)))
|
|
70
|
-
EOF (Object.)
|
|
71
|
-
tapfn #(out-fn {:tag :tap :val %1})
|
|
72
|
-
env (ana-api/empty-env)
|
|
73
|
-
special-fns (merge repl/default-special-fns special-fns)
|
|
74
|
-
is-special-fn? (set (keys special-fns))]
|
|
75
|
-
(env/ensure
|
|
76
|
-
(repl/maybe-install-npm-deps opts)
|
|
77
|
-
(comp/with-core-cljs opts
|
|
78
|
-
(fn []
|
|
79
|
-
(with-bindings
|
|
80
|
-
(binding [*in* (or stdin in-reader)
|
|
81
|
-
*out* (PrintWriter-on #(out-fn {:tag :out :val %1}) nil)
|
|
82
|
-
*err* (PrintWriter-on #(out-fn {:tag :err :val %1}) nil)
|
|
83
|
-
repl/*repl-env* repl-env]
|
|
84
|
-
(let [opts (merge opts (:merge-opts (repl/setup repl-env opts)))]
|
|
85
|
-
(binding [repl/*repl-opts* opts]
|
|
86
|
-
(repl/evaluate-form repl-env env "<cljs repl>"
|
|
87
|
-
(with-meta `(~'ns ~'cljs.user) {:line 1 :column 1}) identity opts)
|
|
88
|
-
(try
|
|
89
|
-
(add-tap tapfn)
|
|
90
|
-
(loop []
|
|
91
|
-
(when (try
|
|
92
|
-
(let [[form s] (binding [*ns* (create-ns ana/*cljs-ns*)
|
|
93
|
-
reader/resolve-symbol ana/resolve-symbol
|
|
94
|
-
reader/*data-readers* (merge tags/*cljs-data-readers*
|
|
95
|
-
(ana/load-data-readers))
|
|
96
|
-
reader/*alias-map* (ana/get-aliases ana/*cljs-ns*)]
|
|
97
|
-
(reader/read+string {:eof EOF :read-cond :allow :features #{:cljs}}
|
|
98
|
-
in-reader))]
|
|
99
|
-
(try
|
|
100
|
-
(when-not (identical? form EOF)
|
|
101
|
-
(let [start (System/nanoTime)
|
|
102
|
-
ret (if (and (seq? form) (is-special-fn? (first form)))
|
|
103
|
-
(do
|
|
104
|
-
((get special-fns (first form)) repl-env env form opts)
|
|
105
|
-
"nil")
|
|
106
|
-
(repl/eval-cljs repl-env env form opts))
|
|
107
|
-
ms (quot (- (System/nanoTime) start) 1000000)]
|
|
108
|
-
(when-not (repl-quit? ret)
|
|
109
|
-
(out-fn {:tag :ret
|
|
110
|
-
:val (if (instance? Throwable ret)
|
|
111
|
-
(Throwable->map ret)
|
|
112
|
-
ret)
|
|
113
|
-
:ns (name ana/*cljs-ns*)
|
|
114
|
-
:ms ms
|
|
115
|
-
:form s})
|
|
116
|
-
true)))
|
|
117
|
-
(catch Throwable ex
|
|
118
|
-
(out-fn {:tag :ret :val (Throwable->map ex)
|
|
119
|
-
:ns (name ana/*cljs-ns*) :form s
|
|
120
|
-
:exception true})
|
|
121
|
-
true)))
|
|
122
|
-
(catch Throwable ex
|
|
123
|
-
(out-fn {:tag :ret :val (Throwable->map ex)
|
|
124
|
-
:ns (name ana/*cljs-ns*)
|
|
125
|
-
:exception true})
|
|
126
|
-
true))
|
|
127
|
-
(recur)))
|
|
128
|
-
(finally
|
|
129
|
-
(remove-tap tapfn)
|
|
130
|
-
(repl/tear-down repl-env))))))))))))
|
|
131
|
-
|
|
132
|
-
(defn io-prepl
|
|
133
|
-
"prepl bound to *in* and *out*, suitable for use with e.g. server/repl (socket-repl).
|
|
134
|
-
:ret and :tap vals will be processed by valf, a fn of one argument
|
|
135
|
-
or a symbol naming same (default identity)"
|
|
136
|
-
[& {:keys [valf repl-env opts] :or {valf #(if (string? %) % (pr-str %))}}]
|
|
137
|
-
(let [valf (resolve-fn valf)
|
|
138
|
-
out *out*
|
|
139
|
-
lock (Object.)]
|
|
140
|
-
(prepl repl-env opts
|
|
141
|
-
(readers/source-logging-push-back-reader *in* 1 "NO_SOURCE_FILE")
|
|
142
|
-
#(binding [*out* out, *flush-on-newline* true, *print-readably* true]
|
|
143
|
-
(locking lock
|
|
144
|
-
(prn (cond-> %1
|
|
145
|
-
(#{:ret :tap} (:tag %1))
|
|
146
|
-
(assoc :val (valf (:val %1))))))))))
|
|
147
|
-
|
|
148
|
-
(comment
|
|
149
|
-
|
|
150
|
-
;; eval in order
|
|
151
|
-
|
|
152
|
-
(defmacro clj-eval [form]
|
|
153
|
-
`(quote ~(eval form)))
|
|
154
|
-
|
|
155
|
-
(require '[cljs.repl.node :as node])
|
|
156
|
-
|
|
157
|
-
(io-prepl :repl-env (node/repl-env))
|
|
158
|
-
|
|
159
|
-
;; wait a moment for Node REPL to be ready, then eval the following
|
|
160
|
-
|
|
161
|
-
(cljs.core.server/clj-eval
|
|
162
|
-
(cljs.analyzer.api/ns-resolve 'cljs.core 'first))
|
|
163
|
-
|
|
164
|
-
(require '[clojure.string :as string])
|
|
165
|
-
(string/includes? "foo" "o")
|
|
166
|
-
|
|
167
|
-
)
|