A deep-dive into Piggieback, the nREPL middleware that enables ClojureScript evaluation over a standard nREPL server. The author explains how Piggieback hijacks nREPL sessions to reroute eval messages to a JavaScript runtime (Node, browser, etc.) via ClojureScript's IJavaScriptEnv protocol, without requiring any client-side changes. Key internals covered include session-based dispatch, the DelegatingReplEnv trick to prevent premature teardown, how the compiler environment is stashed for use by tools like cider-nrepl, and the two distinct code paths for REPL setup vs. steady-state evaluation. The post also covers known limitations (one Node REPL per JVM, no interrupt support, multi-form eval), contrasts Piggieback's approach with shadow-cljs, and summarizes recent 0.6.x/0.7.0 bug fixes and refactoring work done as part of the CIDER 2.0 effort.

17m read timeFrom metaredux.com
Post cover image
Table of contents
A little backstoryTwo languages, one serverHow it actually worksWhich environments does it support?The limitationsThe other approach: shadow-cljsWhat we’ve been up to latelyWhat’s next?Epilogue
137 Impressions