8000 fix compiling stdin not working · repos-javascript-compilers/wisp@1f5c7e7 · GitHub
[go: up one dir, main page]

Skip to content < 8000 div data-target="react-partial.reactRoot">

Commit 1f5c7e7

Browse files
committed
fix compiling stdin not working
1 parent 35cdbcc commit 1f5c7
8000
e7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/wisp.wisp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
[source options]
3535
(let [channel (or (:print options) :code)
3636
output (compile source options)
37-
content (cond
38-
(= channel :code) (:code output)
39-
(= channel :forms) (map (fn [item]
40-
(str (pr-str (:form item)) "\n"))
41-
(:ast output))
42-
:else (pr-str (get output channel) 2 2))]
37+
content (if (= channel :code)
38+
(:code output)
39+
(JSON.stringify (get output channel) 2 2))]
40+
(if (:ast options) (map (fn [item]
41+
(.write process.stdout
42+
(str (pr-str item.form) "\n")))
43+
output.ast))
4344
(if (and (:output options) (:source-uri options) content)
4445
(writeFileSync (path.join (:output options) ;; `join` relies on `path`
4546
(str (basename (:source-uri options) ".wisp") ".js"))

0 commit comments

Comments
 (0)
0