npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nrepl-cljs-sci

v0.0.13

Published

nREPL server for nodejs using Small Clojure Interpreter (SCI)

Downloads

3

Readme

nrepl-cljs-sci

npm version Clojars Project

nREPL server for NodeJS using SCI.

Usage

nrepl-cljs-sci can be used both in plain JS projects and in CLJS projects. See example/js for JS project example and example/cljs.

The start_server (start-server in CLJS) function takes an argument, that can be a JS object or a Clojure map. You can pass a reference to application state under the app key, which is the available at the nrepl repl under app/app symbol.

For example, use from JS project:

$ cd example/js
$ node index.js
Example app listening at http://localhost:3000
2021-08-01T18:48:35.553Z INFO [nrepl-cljs-sci.core:206] - nRepl server started on port 59600. nrepl-cljs-sci version 0.0.10

Then, in another shell:

$ curl http://localhost:3000
Hello World!

Connect to the nRepl server and run the following:

user> js/app
#js {:express_app #object[app], :root #js {:response "Hello World!"}}
user> (set! (.-response js/app.root) "Hello SCI!")
nil

Now, check the result via curl:

$ curl http://localhost:3000
Hello SCI!

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