-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from metosin/OptionalSCI
Optional SCI
- Loading branch information
Showing
10 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ node_modules | |
out | ||
.nrepl-port | ||
.dir-locals.el | ||
cljs-test-runner-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
echo 'Running CLJS test in Node with optimizations :none' | ||
clojure -A:test:cljs-test-runner -c '{:optimizations :none, :preloads [sci.core]}' "$@" | ||
|
||
echo 'Running CLJS test in Node with optimizations :advanced' | ||
clojure -A:test:cljs-test-runner -c '{:optimizations :advanced, :preloads [sci.core]}' "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
{:deps {:aliases [:shadow]} | ||
{:deps {:aliases [:shadow :sci]} | ||
:builds {:app {:target :browser | ||
:closure-defines {malli.registry/type "default"} | ||
:modules {:cljs {:entries [cljs.core]} | ||
:sci {:entries [sci.core] | ||
:depends-on #{:cljs}} | ||
:malli {:entries [malli.core] | ||
:depends-on #{:cljs :sci}} | ||
:depends-on #{:cljs}} | ||
:app {:entries [malli.app] | ||
:depends-on #{:malli}}}} | ||
:app-sci {:target :browser | ||
:closure-defines {malli.registry/type "default"} | ||
:devtools {:preloads [sci.core]} | ||
:modules {:cljs {:entries [cljs.core]} | ||
:sci {:entries [sci.core] | ||
:depends-on #{:cljs}} | ||
:malli {:entries [malli.core] | ||
:depends-on #{:cljs :sci}} | ||
:app {:entries [malli.app] | ||
:depends-on #{:malli}}}} | ||
:app2 {:target :browser | ||
:closure-defines {malli.registry/type "custom"} | ||
:modules {:cljs {:entries [cljs.core]} | ||
:sci {:entries [sci.core] | ||
:depends-on #{:cljs}} | ||
:malli {:entries [malli.core] | ||
:depends-on #{:cljs :sci}} | ||
:depends-on #{:cljs}} | ||
:app {:entries [malli.app2] | ||
:depends-on #{:malli}}}}}} | ||
:depends-on #{:malli}}}} | ||
:app2-sci {:target :browser | ||
:closure-defines {malli.registry/type "custom"} | ||
:devtools {:preloads [sci.core]} | ||
:modules {:cljs {:entries [cljs.core]} | ||
:sci {:entries [sci.core] | ||
:depends-on #{:cljs}} | ||
:malli {:entries [malli.core] | ||
:depends-on #{:cljs :sci}} | ||
:app {:entries [malli.app2] | ||
:depends-on #{:malli}}}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(ns malli.sci | ||
(:require #?(:clj [borkdude.dynaload-clj :refer [dynaload]] | ||
:cljs [borkdude.dynaload-cljs :refer-macros [dynaload]]))) | ||
|
||
(defn evaluator [options] | ||
(let [eval-string* @(dynaload 'sci.core/eval-string* {:default nil}) | ||
init @(dynaload 'sci.core/init {:default nil}) | ||
fork @(dynaload 'sci.core/fork {:default nil})] | ||
(if (and eval-string* init fork) | ||
(let [ctx (init options)] | ||
(fn eval [s] (eval-string* (fork ctx) s)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
#kaocha/v1 | ||
{:tests [{:id :unit | ||
:type :kaocha.type/clojure.test} | ||
{:id :unit-cljs | ||
:type :kaocha.type/cljs}]} | ||
;; https://github.com/lambdaisland/kaocha/issues/152 | ||
#_{:id :unit-cljs | ||
:plugins [:preloads] | ||
:kaocha.plugin.preloads/ns-names [sci.core] | ||
:type :kaocha.type/cljs}]} |