   (eval-str engine (format "nashorn_load(\"%s\");" file)))
 
 ;; Create a minimal build of Clojurescript from the core library.
-;;
-;; Copied rom clj.cljs.repl.node.
+;; Copied from clj.cljs.repl.node.
 (defn bootstrap-repl [engine output-dir opts]
   (env/ensure
-   (let [deps-file ".nashorn_repl_deps.js"
-         core (io/resource "cljs/core.cljs")
-         core-js (closure/compile core
-                                  (assoc opts :output-file (closure/src-file->target-file core)))
-         deps (closure/add-dependencies opts core-js)]
-     ;; output unoptimized code and the deps file
-     ;; for all compiled namespaces
-     (apply closure/output-unoptimized
-            (assoc opts :output-to (.getPath (io/file output-dir deps-file)))
-            deps)
-     ;; load the deps file so we can goog.require cljs.core etc.
-     (load-js-file engine deps-file))))
+    (let [deps-file ".nashorn_repl_deps.js"
+          core (io/resource "cljs/core.cljs")
+          core-js (closure/compile core
+                    (assoc opts
+                      :output-file (closure/src-file->target-file core)))
+          deps (closure/add-dependencies opts core-js)]
+      ;; output unoptimized code and the deps file
+      ;; for all compiled namespaces
+      (apply closure/output-unoptimized
+        (assoc opts :output-to (.getPath (io/file output-dir deps-file)))
+        deps)
+      ;; load the deps file so we can goog.require cljs.core etc.
+      (load-js-file engine deps-file))))
 
 (defn load-ns [engine ns]
-  (eval-str engine (format "goog.require(\"%s\");" (comp/munge (first ns)))))
+  (eval-str engine
+    (format "goog.require(\"%s\");" (comp/munge (first ns)))))
 
 (defn- stacktrace  [^Exception e]
-  (apply str (interpose "\n" (map #(str " " (.toString %)) (.getStackTrace e)))))
+  (apply str
+    (interpose "\n" (map #(str " " (.toString %)) (.getStackTrace e)))))
 
 (def repl-filename "<cljs repl>")
 

    (:require [cljs.repl.nashorn]
              [cemerick.piggieback]))

  (cemerick.piggieback/cljs-repl :repl-env (cljs.repl.nashorn/repl-env)
                                 :output-dir "resources/public/compiled"
                                 :cache-analysis true))

;; Implementation


(defn init-engine [engine output-dir debug]
  (eval-resource engine "goog/base.js" debug)
  (eval-resource engine "goog/deps.js" debug)
  (eval-str engine "var global = this") ; required by React
  (eval-str engine
    (format
      (str "var nashorn_load = function(path) {"
           "  var outputPath = \"%s\" + \"/\" + path;"
           (when debug "  print(\"loading: \" + outputPath) ; ")
           "  load(outputPath);"
           "};")
      output-dir))
  (eval-str engine
    (str "goog.global.CLOSURE_IMPORT_SCRIPT = function(path) {"
         " nashorn_load(\"goog/\" + path);"
         " return true;"
         "};"))
  (eval-str engine "goog.global.isProvided_ = function(name) { return false; };")
  engine)

