Lumo is a standalone ClojureScript environment that runs on Node.js and the V8 JavaScript engine. It starts up instantaneously and has out-of-the-box access to the entire Node.js ecosystem.
REPL
Simplest way to install lumo:
$ brew install lumo
$ npm install -g lumo-cljs
After installed, you will get a CLI tool called lumo
.
$ lumo
Lumo 1.10.1
ClojureScript 1.10.520
Node.js v11.13.0
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Exit: Control+D or :cljs/quit or exit
cljs.user=> (println (+ 1 2 3))
6
nil
cljs.user=>
Node.js & npm modules
Accessing Node.js global variables with js interop:
cljs.user=> (.log js/console js/process.argv)
[ '/usr/local/Cellar/lumo/1.8.0/bin/lumo', 'nexe.js' ]
nil
Loading npm modules from node_modules/
with js/require
:
cljs.user=> (def escape-html (js/require "escape-html"))
cljs.user=> (escape-html "<div />")
"<div />"
Also possible to specify dependencies inside ns
form:
(ns app.main (:require ["fs" :as fs]))
(fs/readFileSync "package.json" "utf8")
Interpreter
Interpret a source file. Lumo also supports the --classpath
option.
$ lumo main.cljs
CLI options
To view all supported CLI options:
$ lumo -h