| 1 |
(ns clojure.data.xml.cljs-repls |
| 2 |
(:require |
| 3 |
[cljs.repl :as repl] |
| 4 |
[cljs.repl.nashorn :as repl-nh] |
| 5 |
[cemerick.piggieback :as pback] |
| 6 |
[cljs.closure :as closure] |
| 7 |
[figwheel-sidecar.repl-api :refer [start-figwheel! stop-figwheel! cljs-repl]])) |
| 8 |
|
| 9 |
(defn nashorn-env [] |
| 10 |
(let [{:as env :keys [engine]} (repl-nh/repl-env)] |
| 11 |
(repl-nh/eval-resource engine "dxml-nashorn.generated.js" true) |
| 12 |
env)) |
| 13 |
|
| 14 |
(def handle-redirect (constantly {:status 307 :headers {"Location" "/cljs-tests/index.html"}})) |
| 15 |
|
| 16 |
(defn repl-figwheel! [] |
| 17 |
(start-figwheel! |
| 18 |
{:figwheel-options |
| 19 |
{:http-server-root "public" |
| 20 |
:ring-handler `handle-redirect} |
| 21 |
:all-builds |
| 22 |
[{:id "tests" |
| 23 |
:source-paths ["src/main/clojure" "src/test/clojure" "src/test/clojurescript"] |
| 24 |
:figwheel {:on-jsload "clojure.data.xml.test-cljs/-main"} |
| 25 |
:compiler {:main 'clojure.data.xml.test-cljs |
| 26 |
:preloads '[devtools.preload] |
| 27 |
:output-to "target/gen-resources/public/cljs-tests/main.js" |
| 28 |
:output-dir "target/gen-resources/public/cljs-tests/output" |
| 29 |
:asset-path "output" |
| 30 |
:source-map true}}]}) |
| 31 |
(cljs-repl)) |
| 32 |
|
| 33 |
(defn repl-piggieback! [] |
| 34 |
(pback/cljs-repl (nashorn-env))) |
| 35 |
|
| 36 |
(defn repl-main! [] |
| 37 |
(repl/repl (nashorn-env))) |