GitXplorerGitXplorer
b

cljs-noderepl

public
165 stars
21 forks
5 issues

Commits

List of commits on branch master.
Unverified
529a740e653db58bcb923426c4956fdce89d6d6a

Merge pull request #19 from danskarda/fixes

bbodil committed 10 years ago
Unverified
28e514b282956c06bafbfad072ef44cba2a2c8d2

Fix #18 Pass compiler options to repl-env together with :target :nodejs

ddanskarda committed 10 years ago
Unverified
6e6392cd6982c439a2883efd962d266ac893e68e

Fix #12 Return result as a string

ddanskarda committed 10 years ago
Unverified
2210836c654ae08d8afb4312b8281a089e0cf855

Fix #16 Do not reexport basic types into context

ddanskarda committed 10 years ago
Unverified
cbf5d0689726891a40ceeffdc6b6b2d9ff2abcd0

Tag for 0.1.11 release.

bbodil committed 11 years ago
Unverified
0bf7b91f80f2c8aab2b0e3a2e955d6f20fe9583b

Merge branch 'master' of github.com:bodil/cljs-noderepl

bbodil committed 11 years ago

README

The README file for this repository.

cljs-noderepl

Provides a ClojureScript REPL running on Node.JS.

Requirements

You must have Node version 0.8.x or higher installed.

Leiningen Plugin

To setup the Leiningen plugin, add this to your project.clj or ~/.lein/profiles.clj:

:plugins [[org.bodil/lein-noderepl "0.1.11"]]

Then, start the REPL like this:

$ lein trampoline noderepl

In-Project Usage

Add the following dependency to your project.clj:

[org.bodil/cljs-noderepl "0.1.11"]

To launch the REPL the hard way, run lein repl and enter the following:

(require '[cljs.repl :as repl] '[cljs.repl.node :as node])
(repl/repl (node/repl-env))

Environment

The REPL is connected to a live Node process running a sandboxed environment, which provides all of Node's available global variables.

As an example, here's the standard Node hello world, in REPL ready ClojureScript:

(let [http (js/require "http")
      handler (fn [req res] (.end res "Hello sailor!"))
      server (.createServer http handler)]
  (.listen server 1337))

Readline Support

If you have rlwrap installed, the following provides basic readline and paren matching support:

rlwrap -r -m -q '\"' -b "(){}[],^%3@\";:'" lein trampoline noderepl

nREPL With Piggieback

You can get cljs-noderepl running on an nREPL server through Piggieback, though it's a bit fiddly. Here's how.

Add the cljs-noderepl dependency to your project.clj (it will bring in Piggieback transitively):

[org.bodil/cljs-noderepl "0.1.11"]

You may want to add this dependency to your :dev profile so it's not carried along when you deploy your library/application.

Then, add the Piggieback nREPL middleware, also in project.clj:

:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

Now, launch nREPL through Leiningen as usual - lein repl - and connect to it from wherever you prefer. You'll need to start the ClojureScript REPL manually once you have a Clojure REPL prompt:

user=> (require '[cljs.repl.node :as node])
user=> (node/run-node-nrepl)

License

Copyright © 2012 Bodil Stokke.

Distributed under the Eclipse Public License, the same as Clojure.