diff --git a/.gitignore b/.gitignore index f415989..e26d706 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ gh-pages/ /.clj-kondo/rewrite-clj /plugins/demo/resources/public/js/ .portal +resources/public/test/scratch.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 01e22e7..b2fff67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,21 @@ -## v0.7.24 (2025-08-20) +- [#114](https://github.com/babashka/scittle/issues/114): Enable source maps ([@jeroenvandijk](https://github.com/jeroenvandijk)) +- [#140](https://github.com/babashka/scittle/issues/140): Enable customizing the nrepl websocket port ([@PEZ](https://github.com/PEZ)) + +## v0.7.28 (2025-09-13) + +- [#137](https://github.com/babashka/scittle/issues/137): fix JS interop with reserved JS keyword (incorrectly munged) by bumping SCI + +## v0.7.27 (2025-08-21) + +- [#95](https://github.com/babashka/scittle/issues/121): support string requires + of `globalThis` js deps ([@chr15m](https://github.com/chr15m)). See + [docs](https://github.com/babashka/scittle/blob/main/doc/js-libraries.md). +- Potentially breaking: `(.-foo-bar {})` now behaves as `{}.foo_bar`, i.e. the property or method name is munged. + +## v0.7.26 (2025-08-20) - [#121](https://github.com/babashka/scittle/issues/121): add `cjohansen/dataspex` plugin ([@jeroenvandijk](https://github.com/jeroenvandijk)) - [#118](https://github.com/babashka/scittle/issues/118): add `goog.string/format` ([@jeroenvandijk](https://github.com/jeroenvandijk)) diff --git a/README.md b/README.md index 52d3130..01e1607 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ release Updates Github pages with new release build. ## Credits Idea by Arne Brasseur a.k.a [plexus](https://github.com/plexus). +Name by Alessandra Sierra (the name occurs first in [this](https://stuartsierra.com/2019/12/21/clojure-start-time-in-2019/) blog post). ## License diff --git a/build/src/scittle/build.clj b/build/src/scittle/build.clj index 879d05c..02382e5 100644 --- a/build/src/scittle/build.clj +++ b/build/src/scittle/build.clj @@ -78,6 +78,6 @@ :pretty-print true :pseudo-names true} :output-dir \"resources/public/js/dev\" - :modules {:scittle.cljs-devtools.dev {:entries [scittle.cljs-devtools] - :depends-on #{:scittle}}}}'" + :modules {:scittle.cljs-devtools {:entries [scittle.cljs-devtools] + :depends-on #{:scittle}}}}'" (str/join " " args))))) diff --git a/deps.edn b/deps.edn index a4ecb60..f7a5121 100644 --- a/deps.edn +++ b/deps.edn @@ -1,9 +1,9 @@ {:paths ["src" "resources"] :deps - {org.clojure/clojure {:mvn/version "1.11.1"} + {org.clojure/clojure {:mvn/version "1.12.2"} thheller/shadow-cljs {:mvn/version "3.1.8"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "9522bdadafcfbc5b86e3f37117df62634a9d923e"} + :git/sha "6758ba028da559c536a06becbbedade7b0ba6448"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} no.cjohansen/replicant {:mvn/version "2025.03.27"} diff --git a/doc/dev.md b/doc/dev.md index 40abc6b..b6bd354 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -90,20 +90,20 @@ To create a new NPM release: - Prepare version `package.json`, except patch (if anything should change here) - Run `bb npm-publish`: this will compile, bump patch version, create tag and and push to npm and Github -- `bb replace-version 0.6.16 0.7.23` +- `bb replace-version 0.6.16 0.7.28` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/js-libraries.md b/doc/js-libraries.md new file mode 100644 index 0000000..72cafb8 --- /dev/null +++ b/doc/js-libraries.md @@ -0,0 +1,49 @@ +# Loading JS libraries + +Since `v0.7.28` scittle allows to load libraries from the global enviroment. +This means you can load a library in a ` + + + + + + +``` + +## ES modules + +The async nature of ES modules makes them a litte bit more difficult to work +with in scittle. You need to disable automatic evaluation of script tags first +using `scittle.core.disable_auto_eval()`. In a `module` type ` + + + + + + + +``` diff --git a/doc/links.md b/doc/links.md index 0a0f4d8..0b4181a 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,9 +1,20 @@ -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.js-interop.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.replicant.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.js-interop.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.replicant.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/scittle.nrepl.js + +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.js-interop.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.replicant.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.7.28/dist/dev/scittle.cljs-devtools.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 905bab0..5541357 100644 --- a/doc/nrepl/README.md +++ b/doc/nrepl/README.md @@ -21,7 +21,7 @@ the normal routine: ``` html - + ``` Also include the CLJS file that you want to evaluate with nREPL: @@ -42,6 +42,16 @@ you should be able evaluate expressions in `playground.cljs`. See a demo Note that the nREPL server connection stays alive even after the browser window refreshes. +### Custom host address + +By default, the browser will connect to a websocket on the same host as it is loaded +from, using `window.location.hostname`. If you need something else you can specify +that setting the window variable `SCITTLE_NREPL_WEBSOCKET_HOST` like so: + +``` html + +``` + ### CIDER Choose `cider-connect-cljs`, select port `1339`, followed by the `nbb` REPL diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index 22524fe..5890a47 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/package-lock.json b/package-lock.json index 8b5e900..e5bd260 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.7.24" + "version": "0.7.28" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.7.24" + "version": "0.7.28" } diff --git a/package.json b/package.json index 2da8870..ab333e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.7.24", + "version": "0.7.28", "files": [ "dist" ], diff --git a/resources/public/cljs/replicant_tictactoe/game.cljs b/resources/public/cljs/replicant_tictactoe/game.cljs index 3f62d7f..9296baf 100644 --- a/resources/public/cljs/replicant_tictactoe/game.cljs +++ b/resources/public/cljs/replicant_tictactoe/game.cljs @@ -13,10 +13,13 @@ path)) (defn get-winning-path [{:keys [size tics]} y x] - (or (winner? tics (mapv #(vector y %) (range 0 size))) - (winner? tics (mapv #(vector % x) (range 0 size))) - (when (= y x) - (winner? tics (mapv #(vector % %) (range 0 size)))))) + (let [flip-y (fn [y] (- size 1 y))] + (or (winner? tics (mapv #(vector y %) (range 0 size))) + (winner? tics (mapv #(vector % x) (range 0 size))) + (when (= y x) + (winner? tics (mapv #(vector % %) (range 0 size)))) + (when (= (flip-y y) x) + (winner? tics (mapv #(vector (flip-y %) %) (range 0 size))))))) (defn maybe-conclude [game y x] (if-let [path (get-winning-path game y x)] diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index 2da02b1..800624b 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - +