File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 138
138
(defn register-module [mod internal-name]
139
139
(swap! loaded-modules assoc internal-name mod))
140
140
141
+ (defn debug [& xs]
142
+ (binding [*print-fn* *print-err-fn*]
143
+ (apply prn xs)))
144
+
141
145
(defn load-js-module [libname internal-name reload?]
142
146
(-> (if-let [resolve (:resolve @ctx)]
143
147
(-> (resolve libname)
144
148
(.catch
145
149
(fn [_]
146
150
((.-resolve (:require @ctx)) libname))))
147
151
(js/Promise.resolve ((.-resolve (:require @ctx)) libname)))
148
- (.then (fn [path]
149
- ; ; (prn :path path)
150
- (let [file-url (if (str/starts-with? path " file:" )
152
+ (.then (fn [path]
153
+ (let [file-url (if (str/starts-with? (str path) " file:" )
151
154
path
152
- (when (fs/existsSync path)
153
- (url/pathToFileURL path)))
155
+ (when (fs/existsSync path)
156
+ (str ( url/pathToFileURL path) )))
154
157
path (if (and reload?
155
158
; ; not "node:fs" etc
156
159
file-url)
157
160
(str file-url " ?uuid=" (random-uuid ))
158
- path)]
161
+ ( or file-url path) )]
159
162
(esm/dynamic-import path))))
160
163
(.then (fn [mod]
161
164
(register-module mod internal-name)
You can’t perform that action at this time.
0 commit comments