Liking cljdoc? Tell your friends :D

nrepl-cljs-sci

nREPL server for NodeJS using SCI.

Usage

See example directory

Development instructions

  1. Start shadow-cljs server (for faster compile invocations)
bb shadow-server
  1. Compile nrepl-cljs-sci to JavaScript
bb shadow-compile
  1. Run nrepl-cljs-sci
bb node-server
  1. Run nrepl client
bb nrepl-client
nREPL server started on port 54784 on host localhost - nrepl://localhost:54784
[Rebel readline] Type :repl/help for online help info
  1. Send nrepl requests to the server
user=> (require '[nrepl.core :as nrepl])
nil
user=> (with-open [conn (nrepl/connect :port 7788)]
  #_=>   (let [response (nrepl/message (nrepl/client conn 1000) {:op "describe"})]
  #_=>     (println response)))
({:aux {}, :id af22bc8e-164a-4d22-b67d-6c676f1262a0, :ops {:describe {}, :eval {}}, :status [done], :versions {:nghttp2 1.41.0, :napi 7, :modules 83, :brotli 1.0.9, :zlib 1.2.11, :tz 2020a, :v8 8.4.371.19-node.18, :node 14.16.0, :openssl 1.1.1j, :icu 67.1, :cldr 37.0, :ares 1.16.1, :llhttp 2.1.3, :unicode 13.0, :uv 1.40.0}})
nil
user=> (with-open [conn (nrepl/connect :port 7788)]
  #_=>   (let [response (nrepl/message (nrepl/client conn 1000) {:op "eval" :code "(+ 1 1)"})]
  #_=>     (println response)))
({:id d4c78721-61de-4b20-a428-2fa941d49eb1, :ns user, :status [done], :value 2})
;; JS interop works too
user=> (with-open [conn (nrepl/connect :port 7788)]
  #_=>   (let [response (nrepl/message (nrepl/client conn 1000) {:op "eval" :code "js/process.versions"})]
  #_=>     (println response)))
({:id 0360a3a9-7899-417b-a195-ff999e0d2486, :ns user, :status [done], :value {:nghttp2 1.41.0, :napi 7, :modules 83, :brotli 1.0.9, :zlib 1.2.11, :tz 2020a, :v8 8.4.371.19-node.18, :node 14.16.0, :openssl 1.1.1j, :icu 67.1, :cldr 37.0, :ares 1.16.1, :llhttp 2.1.3, :unicode 13.0, :uv 1.40.0}})

Changelog

See CHANGELOG.md

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close