nREPL middleware enabling the transparent use of a ClojureScript REPL with nREPL tooling.
This is the public face of Piggieback. It has no hard dependency on
ClojureScript: when ClojureScript is on the classpath the real implementation
in cider.piggieback.cljs is loaded lazily on first use; otherwise the
middleware is a no-op and cljs-repl reports the missing dependency.
The session-state dynamic vars live here (rather than in the implementation namespace) because they are part of Piggieback's contract: other middleware, notably cider-nrepl, read them out of the session by their fully-qualified name. Keeping them here also lets the implementation namespace depend on this one without a load cycle.
nREPL middleware enabling the transparent use of a ClojureScript REPL with nREPL tooling. This is the public face of Piggieback. It has no hard dependency on ClojureScript: when ClojureScript is on the classpath the real implementation in `cider.piggieback.cljs` is loaded lazily on first use; otherwise the middleware is a no-op and `cljs-repl` reports the missing dependency. The session-state dynamic vars live here (rather than in the implementation namespace) because they are part of Piggieback's contract: other middleware, notably cider-nrepl, read them out of the session by their fully-qualified name. Keeping them here also lets the implementation namespace depend on this one without a load cycle.
(cljs-repl repl-env & options)Starts a ClojureScript REPL over top an nREPL session. Accepts all options usually accepted by e.g. cljs.repl/repl.
Starts a ClojureScript REPL over top an nREPL session. Accepts all options usually accepted by e.g. cljs.repl/repl.
(forwarding-writer target)Return a java.io.Writer that always delegates to the Writer currently held
in target (an atom).
ClojureScript repl envs (e.g. the Node env) capture *out* once, at setup
time, on the thread that pumps the JS runtime's output back to the user. Bound
via bound-fn, that thread keeps writing to the output of the message that
started the REPL, so every later evaluation's output ends up with the wrong
message id and vanishes entirely once that connection is closed (issue #111).
Handing the env a forwarding writer lets us repoint it at the current
message's output on each evaluation.
Return a `java.io.Writer` that always delegates to the Writer currently held in `target` (an atom). ClojureScript repl envs (e.g. the Node env) capture `*out*` once, at setup time, on the thread that pumps the JS runtime's output back to the user. Bound via `bound-fn`, that thread keeps writing to the output of the message that *started* the REPL, so every later evaluation's output ends up with the wrong message id and vanishes entirely once that connection is closed (issue #111). Handing the env a forwarding writer lets us repoint it at the current message's output on each evaluation.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |