From 7409c6ec7619332fdb15969acce0d0fbf4aa22fe Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 19 Dec 2024 17:13:49 +0100 Subject: [PATCH 01/54] Bump ver --- doc/dev.md | 10 +++++----- doc/links.md | 14 +++++++------- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- resources/public/codemirror.html | 8 ++++---- resources/public/html/cljs-ajax.html | 4 ++-- resources/public/html/export.html | 2 +- resources/public/html/reagent.html | 4 ++-- resources/public/index.html | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index ebb5b8b..2b87a64 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.6.21` +- `bb replace-version 0.6.16 0.6.22` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/links.md b/doc/links.md index ca71b2e..a58dd12 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,7 +1,7 @@ -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.6.21/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.nrepl.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index ffccbe8..01953ef 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: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index b180e74..d228eed 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index e0d9190..f16344a 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + - - + + From dc54e3d6b20277a53b08f136e67154e12362a59c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 15 Mar 2025 11:07:06 +0100 Subject: [PATCH 07/54] eliminate unpkg --- resources/public/bookmarklet.html | 5 ++--- resources/public/codemirror.html | 4 ++-- resources/public/html/local.html | 4 ++-- resources/public/html/reagent.html | 4 ++-- resources/public/test/codemirror.html | 4 ++-- resources/public/tictactoe.html | 5 ++--- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/resources/public/bookmarklet.html b/resources/public/bookmarklet.html index 15dce60..e2cc947 100644 --- a/resources/public/bookmarklet.html +++ b/resources/public/bookmarklet.html @@ -4,9 +4,8 @@ - - - + + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index f16344a..d512ebe 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -3,8 +3,8 @@ - - + + diff --git a/resources/public/html/local.html b/resources/public/html/local.html index 603a5bc..d9c36bf 100644 --- a/resources/public/html/local.html +++ b/resources/public/html/local.html @@ -1,8 +1,8 @@ - - + + - - + + - - + + diff --git a/resources/public/tictactoe.html b/resources/public/tictactoe.html index 5b62e74..4462881 100644 --- a/resources/public/tictactoe.html +++ b/resources/public/tictactoe.html @@ -3,9 +3,8 @@ - - - + + From 07c8d4847d45ec9af2862234299fa5b9d95484cc Mon Sep 17 00:00:00 2001 From: ikappaki <34983288+ikappaki@users.noreply.github.com> Date: Mon, 2 Jun 2025 22:07:53 +0100 Subject: [PATCH 08/54] Add goog.string/htmlEscape (#106) Co-authored-by: ikappaki --- CHANGELOG.md | 1 + src/scittle/core.cljs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8bd57c..e45fe36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [#102](https://github.com/babashka/scittle/issues/102): add `applied-science/js-interop` plugin. +- [#105](https://github.com/babashka/scittle/issues/105): add `goog.string/htmlEscape`. ## v0.6.22 (2024-12-19) diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index 37ae25f..ee5ec27 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -2,7 +2,7 @@ (:refer-clojure :exclude [time]) (:require [cljs.reader :refer [read-string]] [goog.object :as gobject] - [goog.string] + [goog.string :as gstring] [sci.core :as sci] [sci.ctx-store :as store] [sci.impl.unrestrict] @@ -46,6 +46,7 @@ 'abs (sci/copy-var abs cljns)} 'goog.object {'set gobject/set 'get gobject/get} + 'goog.string {'htmlEscape gstring/htmlEscape} 'sci.core {'stacktrace sci/stacktrace 'format-stacktrace sci/format-stacktrace}}) From 19774245083a382a682be5b5f5d88cb5b24ea38f Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk <27645+jeroenvandijk@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:43:04 +0300 Subject: [PATCH 09/54] Add Replicant plugin (#108) * Add replicant tictactoe example * Update Changelog --- CHANGELOG.md | 1 + deps.edn | 2 + .../public/cljs/replicant-tictactoe/core.cljs | 33 ++++++++ .../public/cljs/replicant-tictactoe/game.cljs | 41 ++++++++++ .../public/cljs/replicant-tictactoe/style.css | 50 +++++++++++++ .../public/cljs/replicant-tictactoe/ui.cljs | 75 +++++++++++++++++++ resources/public/replicant_tictactoe.html | 46 ++++++++++++ shadow-cljs.edn | 2 + src/sci/configs/replicant/replicant_dom.cljs | 15 ++++ src/scittle/replicant.cljs | 8 ++ 10 files changed, 273 insertions(+) create mode 100644 resources/public/cljs/replicant-tictactoe/core.cljs create mode 100644 resources/public/cljs/replicant-tictactoe/game.cljs create mode 100644 resources/public/cljs/replicant-tictactoe/style.css create mode 100644 resources/public/cljs/replicant-tictactoe/ui.cljs create mode 100644 resources/public/replicant_tictactoe.html create mode 100644 src/sci/configs/replicant/replicant_dom.cljs create mode 100644 src/scittle/replicant.cljs diff --git a/CHANGELOG.md b/CHANGELOG.md index e45fe36..d16b989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ +- [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin. - [#102](https://github.com/babashka/scittle/issues/102): add `applied-science/js-interop` plugin. - [#105](https://github.com/babashka/scittle/issues/105): add `goog.string/htmlEscape`. diff --git a/deps.edn b/deps.edn index c21aef5..7deac6d 100644 --- a/deps.edn +++ b/deps.edn @@ -6,6 +6,8 @@ :git/sha "1e15f0f6a129ef7512351efc65f7475209d8cc4c"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} + no.cjohansen/replicant {:mvn/version "2025.02.02"} + re-frame/re-frame {:mvn/version "1.3.0"} cljsjs/react {:mvn/version "18.2.0-1"} cljsjs/react-dom {:mvn/version "18.2.0-1"} diff --git a/resources/public/cljs/replicant-tictactoe/core.cljs b/resources/public/cljs/replicant-tictactoe/core.cljs new file mode 100644 index 0000000..2897329 --- /dev/null +++ b/resources/public/cljs/replicant-tictactoe/core.cljs @@ -0,0 +1,33 @@ +;; COPIED FROM https://github.com/cjohansen/replicant-tic-tac-toe/blob/7a33fb12f0cd6658b2f555ff673dee031d4aa921/src/tic_tac_toe/core.cljs + +(ns replicant-tictactoe.core + (:require [replicant.dom :as r] + [replicant-tictactoe.game :as game] + [replicant-tictactoe.ui :as ui])) + +(defn start-new-game [store] + (reset! store (game/create-game {:size 3}))) + +(defn main [] + ;; Set up the atom + (let [store (atom nil) + el (js/document.getElementById "app")] + + ;; Globally handle DOM events + (r/set-dispatch! + (fn [_ [action & args]] + (case action + :tic (apply swap! store game/tic args) + :reset (start-new-game store)))) + + ;; Render on every change + (add-watch store ::render + (fn [_ _ _ game] + (->> (ui/game->ui-data game) + ui/render-game + (r/render el)))) + + ;; Trigger the first render by initializing the game. + (start-new-game store))) + +(main) \ No newline at end of file diff --git a/resources/public/cljs/replicant-tictactoe/game.cljs b/resources/public/cljs/replicant-tictactoe/game.cljs new file mode 100644 index 0000000..3f62d7f --- /dev/null +++ b/resources/public/cljs/replicant-tictactoe/game.cljs @@ -0,0 +1,41 @@ +;; COPIED FROM https://github.com/cjohansen/replicant-tic-tac-toe/blob/7a33fb12f0cd6658b2f555ff673dee031d4aa921/src/tic_tac_toe/game.cljs + +(ns replicant-tictactoe.game) + +(defn create-game [{:keys [size]}] + {:next-player :x + :size size}) + +(def next-player {:x :o, :o :x}) + +(defn winner? [tics path] + (when (= 1 (count (set (map tics path)))) + 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)))))) + +(defn maybe-conclude [game y x] + (if-let [path (get-winning-path game y x)] + (-> (dissoc game :next-player) + (assoc :over? true + :victory {:player (get-in game [:tics [y x]]) + :path path})) + (let [tie? (= (count (:tics game)) (* (:size game) (:size game)))] + (cond-> game + tie? (dissoc :next-player) + tie? (assoc :over? true))))) + +(defn tic [game y x] + (let [player (:next-player game)] + (if (or (get-in game [:tics [y x]]) + (<= (:size game) x) + (<= (:size game) y)) + game + (-> game + (assoc-in [:tics [y x]] player) + (assoc :next-player (next-player player)) + (maybe-conclude y x))))) \ No newline at end of file diff --git a/resources/public/cljs/replicant-tictactoe/style.css b/resources/public/cljs/replicant-tictactoe/style.css new file mode 100644 index 0000000..7ec052a --- /dev/null +++ b/resources/public/cljs/replicant-tictactoe/style.css @@ -0,0 +1,50 @@ +/* COPIED from https://github.com/cjohansen/replicant-tic-tac-toe/blob/7a33fb12f0cd6658b2f555ff673dee031d4aa921/resources/public/styles.css */ +.cell { + aspect-ratio: 1 / 1; + background: rgba(255, 255, 255, 0.8); + border-radius: 6%; + border: none; + display: block; + flex: 1 1 0%; + outline: none; + position: relative; + width: 100%; +} + +.cell-content { + opacity: 1; + transition: opacity 0.25s; +} + +.transparent { + opacity: 0; +} + +.cell-dim { + background: rgba(249, 249, 240, 0.3); +} + +.cell-highlight { + background: #fcfcf3; +} + +.clickable { + cursor: pointer; +} + +.board { + --gap: 0.75rem; + background: #833ab4; + background: linear-gradient(90deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%); + display: flex; + flex-direction: column; + gap: var(--gap); + padding: var(--gap); + max-width: 80vh; +} + +.row { + display: flex; + flex-direction: row; + gap: var(--gap); +} \ No newline at end of file diff --git a/resources/public/cljs/replicant-tictactoe/ui.cljs b/resources/public/cljs/replicant-tictactoe/ui.cljs new file mode 100644 index 0000000..c53dc65 --- /dev/null +++ b/resources/public/cljs/replicant-tictactoe/ui.cljs @@ -0,0 +1,75 @@ +;; COPIED FROM https://github.com/cjohansen/replicant-tic-tac-toe/blob/7a33fb12f0cd6658b2f555ff673dee031d4aa921/src/tic_tac_toe/ui.cljs + +(ns replicant-tictactoe.ui) + +(def mark-x + [:svg {:xmlns "http://www.w3.org/2000/svg" + :viewBox "0 -10 108 100"} + [:path + {:fill "currentColor" + :d "m1.753 69.19.36-1.08q.35-1.09 1.92-2.97 1.58-1.87 3.85-3.84 2.29-1.97 4.6-3.54 2.31-1.57 4.93-3.24 2.62-1.66 4.65-2.9 2.04-1.23 3.91-2.27 1.87-1.05 3.98-2.31 2.11-1.27 4.12-2.5 2.01-1.24 4.33-2.51l4.6-2.52q2.27-1.25 4.84-2.86 2.56-1.62 5.03-3.09 2.47-1.47 4.5-2.88 2.03-1.4 3.82-2.82t3.81-3.47q2.01-2.06 3.7-3.51 1.69-1.46 3.47-3.03 1.77-1.57 4.01-3.69 2.24-2.11 4.13-3.7 1.89-1.58 3.93-2.97 2.04-1.39 4.05-2.49 2.01-1.11 5.26-2.54 3.24-1.44 4.48-1.46 1.24-.01 2.42.37 1.18.37 2.18 1.11 1 .74 1.71 1.75.71 1.02 1.06 2.21.34 1.19.3 2.43-.05 1.24-.5 2.39-.44 1.16-1.23 2.12-.79.95-1.84 1.61-1.05.65-2.26.94-1.21.28-2.44.16-1.23-.11-2.37-.62-1.13-.5-2.04-1.34-.91-.84-1.51-1.93-.6-1.08-.81-2.3-.22-1.22-.04-2.45.18-1.23.75-2.33.56-1.1 1.45-1.97.89-.86 2.01-1.4 1.11-.54 2.35-.69 1.23-.15 2.44.1t2.29.87q1.07.63 1.88 1.56.82.93 1.29 2.08.48 1.14.56 2.38.09 1.24-.23 2.44-.31 1.19-.99 2.23-.68 1.04-1.66 1.8-.98.76-2.15 1.18l-1.16.41-2.28 1.17q-2.28 1.18-4.38 2.7-2.1 1.51-4.2 3.44-2.1 1.92-4.18 3.7-2.08 1.77-3.9 3.44-1.81 1.68-3.41 3.13-1.6 1.46-3.38 3.09-1.79 1.62-3.44 2.97-1.66 1.34-3.53 2.4-1.88 1.06-4.17 2.65-2.3 1.6-4.79 2.74-2.48 1.14-4.98 2.71-2.5 1.57-4.51 2.47-2.01.9-3.99 1.87-1.98.97-3.88 2.02-1.91 1.05-4.38 2.34-2.46 1.28-4.94 2.53-2.47 1.25-4.48 2.38-2 1.12-3.96 2.14-1.95 1.01-3.83 1.99-1.89.98-4.37 2.05-2.48 1.06-2.96 2.01-.48.96-.78 1.49-.3.53-.71.97-.41.44-.92.77-.51.34-1.09.54-.57.2-1.17.25-.6.06-1.2-.03t-1.16-.32q-.56-.23-1.05-.59-.49-.35-.89-.82-.39-.46-.65-1.01-.27-.54-.4-1.14-.13-.59-.12-1.19.02-.6.18-1.19l.16-.59Z"}] + [:path + {:fill "currentColor" + :d "m28.099 4.991 2.69 1.97q2.69 1.96 4.5 3.22 1.8 1.28 4.54 3.46 2.74 2.18 4.57 3.89t3.38 3.72q1.54 2.02 2.88 4.3 1.34 2.28 2.83 4.46 1.48 2.18 2.63 4.14 1.15 1.96 2.74 4.07 1.59 2.1 3.59 4.19 1.99 2.08 4.23 4.48 2.24 2.4 3.7 4.04 1.47 1.64 2.91 3.23 1.44 1.59 3.08 3.58 1.64 1.99 3.51 4.08 1.87 2.09 3.55 3.77 1.69 1.68 4.1 3.51 2.42 1.83 3.9 2.58 1.48.74 2.14 1.34.66.6 1.15 1.33.5.74.8 1.57.31.84.4 1.72.1.88-.02 1.76-.12.88-.44 1.71-.33.82-.84 1.55-.51.72-1.19 1.3-.67.58-1.46.98-.79.41-1.65.61-.87.2-1.76.19-.88-.01-1.74-.24-.86-.22-1.64-.64-.78-.42-2.27-2.72-1.48-2.3-1.52-3.49-.03-1.19.31-2.33.35-1.14 1.04-2.11.69-.97 1.66-1.67.96-.7 2.1-1.05 1.14-.35 2.33-.32 1.19.02 2.31.43t2.05 1.15q.93.75 1.58 1.75.64 1 .93 2.15.29 1.16.2 2.35-.09 1.18-.56 2.28-.47 1.1-1.26 1.99-.79.88-1.83 1.47t-2.2.82q-1.17.23-2.35.07-1.19-.16-2.25-.68-1.07-.53-1.92-1.37-.84-.84-1.37-1.9-.54-1.07-.7-2.25-.17-1.18.06-2.35.22-1.17.8-2.21.58-1.04 1.47-1.84.88-.79 1.98-1.27 1.09-.47 2.28-.57 1.18-.1 2.34.18 1.16.29 2.16.93 1.01.63 1.76 1.56.74.93-.33-.26-1.07-1.18-.41-.58.66.59 1.15 1.33.5.74.8 1.57.31.83.4 1.72.1.88-.02 1.76-.12.88-.44 1.7-.33.83-.84 1.55-.51.73-1.19 1.31-.67.58-1.46.98-.79.41-1.65.61-.87.2-1.75.19-.89-.01-1.75-.24-.86-.22-1.64-.64-.78-.42-2.73-1.57-1.95-1.14-4.26-2.95-2.31-1.8-3.87-3.43-1.57-1.62-3.17-3.29-1.6-1.66-3.55-4.05-1.95-2.39-3.33-4.15-1.39-1.76-2.77-3.4-1.38-1.64-3.07-3.56-1.7-1.91-3.91-4.13-2.2-2.22-3.74-4.1-1.54-1.88-2.79-3.75-1.24-1.87-2.4-4.33t-2.39-4.46q-1.23-2.01-2.4-4.59-1.17-2.59-2.53-5.01-1.36-2.43-3.35-4.44-1.99-2.02-4.52-4.27-2.54-2.25-5.33-4.04-2.81-1.79-3.28-2.21-.47-.41-.83-.92-.35-.51-.58-1.1-.22-.58-.3-1.2-.08-.62-.01-1.23.08-.62.29-1.21.22-.58.58-1.1.35-.51.81-.93.47-.42 1.02-.71t1.16-.45q.61-.15 1.23-.15t1.22.14q.61.15 1.17.44l.55.28Z"}]]) + +(def mark-o + [:svg {:xmlns "http://www.w3.org/2000/svg" + :viewBox "0 0 114 114"} + [:path + {:fill "none" + :stroke "currentColor" + :stroke-linecap "round" + :stroke-width "6" + :d "M74.616 8.935c7.73 2.38 15.96 9.34 21.58 16.04 5.63 6.69 10.57 15.46 12.18 24.11 1.6 8.65.74 19.67-2.53 27.77-3.27 8.11-10.12 15.37-17.09 20.88-6.98 5.51-16.07 10.81-24.76 12.17-8.7 1.35-19.32-.76-27.42-4.06-8.1-3.29-15.73-8.93-21.21-15.73-5.48-6.81-10.32-16.5-11.67-25.09-1.35-8.6.19-18.39 3.57-26.51 3.38-8.11 9.99-16.6 16.71-22.19 6.72-5.59 13.95-10.52 23.63-11.36 9.68-.84 28.04 4.34 34.45 6.32 6.42 1.97 4.37 4.6 4.04 5.55m-48.33-9.69c7.65-3.32 19.78-3.63 28.63-2.01 8.86 1.63 17.85 5.89 24.49 11.76 6.64 5.87 12.7 15.08 15.37 23.48 2.67 8.41 2.5 18.4.65 26.95-1.85 8.54-5.98 17.59-11.77 24.34-5.78 6.74-14.56 13.05-22.93 16.11-8.37 3.06-18.75 4.19-27.29 2.25-8.54-1.93-17.37-7.89-23.96-13.87-6.59-5.97-12.89-13.58-15.57-21.96-2.69-8.39-2.31-19.94-.56-28.34 1.75-8.4 5.21-15.74 11.06-22.09 5.85-6.35 19.92-13.32 24.04-16.01 4.12-2.7.37-1.1.67-.16"}]]) + +(defn render-cell [{:keys [content on-click dim? highlight? clickable?]}] + [:button.cell + {:on {:click on-click} + :class (cond-> [] + dim? (conj "cell-dim") + highlight? (conj "cell-highlight") + clickable? (conj "clickable"))} + (when content + [:div.cell-content + {:replicant/mounting {:class "transparent"} + :replicant/unmounting {:class "transparent"}} + content])]) + +(defn render-board [{:keys [rows]}] + [:div.board + (for [row rows] + [:div.row + (for [cell row] + (render-cell cell))])]) + +(defn render-game [{:keys [board button]}] + [:div + (render-board board) + (when button + [:button {:on {:click (:on-click button)} + :style {:margin-top 20 + :font-size 20}} + (:text button)])]) + +(def player->mark + {:x mark-x + :o mark-o}) + +(defn game->ui-data [{:keys [size tics victory over?]}] + (let [highlight? (set (:path victory))] + {:button (when over? + {:text "Start over" + :on-click [:reset]}) + :board + {:rows + (for [y (range size)] + (for [x (range size)] + (if-let [player (get tics [y x])] + (let [victorious? (highlight? [y x])] + (cond-> {:content (player->mark player)} + victorious? (assoc :highlight? true) + (and over? (not victorious?)) (assoc :dim? true))) + (if over? + {:dim? true} + {:clickable? true + :on-click [:tic y x]}))))}})) \ No newline at end of file diff --git a/resources/public/replicant_tictactoe.html b/resources/public/replicant_tictactoe.html new file mode 100644 index 0000000..94da4c1 --- /dev/null +++ b/resources/public/replicant_tictactoe.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + +

Scittle tic-tac-toe

+

What is Scittle?

+

Read the main page for more details.

+

The game

+
+

The following source was loaded and interpreted + from cljs/replicant_tictactoe/core.cljs using the + script tag: +


+<script type="application/x-scittle" src="cljs/replicant-tictactoe/ui.cljs"></script>
+<script type="application/x-scittle" src="cljs/replicant-tictactoe/game.cljs"></script>
+<script type="application/x-scittle" src="cljs/replicant-tictactoe/core.cljs"></script>
+
+
+

+
+ + + diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 73529a6..8040d70 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -24,6 +24,8 @@ :depends-on #{:scittle}} :scittle.reagent {:entries [scittle.reagent] :depends-on #{:scittle}} + :scittle.replicant {:entries [scittle.replicant] + :depends-on #{:scittle}} :scittle.re-frame {:entries [scittle.re-frame] :depends-on #{:scittle.reagent :scittle}} diff --git a/src/sci/configs/replicant/replicant_dom.cljs b/src/sci/configs/replicant/replicant_dom.cljs new file mode 100644 index 0000000..ea42f12 --- /dev/null +++ b/src/sci/configs/replicant/replicant_dom.cljs @@ -0,0 +1,15 @@ +(ns sci.configs.replicant.replicant-dom + (:require [replicant.dom :as rd] + [sci.core :as sci])) + +(def rdns (sci/create-ns 'replicant.dom nil)) + +(def replicant-dom-namespace + {'render (sci/copy-var rd/render rdns) + 'unmount (sci/copy-var rd/unmount rdns) + 'set-dispatch! (sci/copy-var rd/set-dispatch! rdns)}) + +(def namespaces {'replicant.dom replicant-dom-namespace}) + +(def config {:namespaces namespaces}) + diff --git a/src/scittle/replicant.cljs b/src/scittle/replicant.cljs new file mode 100644 index 0000000..327b451 --- /dev/null +++ b/src/scittle/replicant.cljs @@ -0,0 +1,8 @@ +(ns scittle.replicant + (:require + [sci.configs.replicant.replicant-dom :refer [replicant-dom-namespace]] + [scittle.core :as scittle])) + +(scittle/register-plugin! + ::replicant + {:namespaces {'replicant.dom replicant-dom-namespace}}) From a1b2723ef67ee81d4fc8bc94fe2ea1fa7e26c5bf Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk <27645+jeroenvandijk@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:31:38 +0300 Subject: [PATCH 10/54] Use replicant via sci.configs (#109) * Update Replicant plugin to use sci.configs * Update Replicant to 2025.03.27 --- deps.edn | 4 ++-- src/sci/configs/replicant/replicant_dom.cljs | 15 --------------- src/scittle/replicant.cljs | 4 ++-- 3 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 src/sci/configs/replicant/replicant_dom.cljs diff --git a/deps.edn b/deps.edn index 7deac6d..dd088c1 100644 --- a/deps.edn +++ b/deps.edn @@ -6,8 +6,8 @@ :git/sha "1e15f0f6a129ef7512351efc65f7475209d8cc4c"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} - no.cjohansen/replicant {:mvn/version "2025.02.02"} + no.cjohansen/replicant {:mvn/version "2025.03.27"} re-frame/re-frame {:mvn/version "1.3.0"} cljsjs/react {:mvn/version "18.2.0-1"} cljsjs/react-dom {:mvn/version "18.2.0-1"} @@ -22,7 +22,7 @@ io.github.babashka/sci.configs #_{:local/root "/Users/borkdude/dev/sci.configs"} {:git/url "https://github.com/babashka/sci.configs" - :git/sha "8253c69a537bcc82e8ff122e5f905fe9d1e303f0"}} + :git/sha "a96625e839d7b8a8910eaa1cc9ccf01bb9714458"}} :aliases {:dev {:extra-paths ["dev"] diff --git a/src/sci/configs/replicant/replicant_dom.cljs b/src/sci/configs/replicant/replicant_dom.cljs deleted file mode 100644 index ea42f12..0000000 --- a/src/sci/configs/replicant/replicant_dom.cljs +++ /dev/null @@ -1,15 +0,0 @@ -(ns sci.configs.replicant.replicant-dom - (:require [replicant.dom :as rd] - [sci.core :as sci])) - -(def rdns (sci/create-ns 'replicant.dom nil)) - -(def replicant-dom-namespace - {'render (sci/copy-var rd/render rdns) - 'unmount (sci/copy-var rd/unmount rdns) - 'set-dispatch! (sci/copy-var rd/set-dispatch! rdns)}) - -(def namespaces {'replicant.dom replicant-dom-namespace}) - -(def config {:namespaces namespaces}) - diff --git a/src/scittle/replicant.cljs b/src/scittle/replicant.cljs index 327b451..b1c9c7a 100644 --- a/src/scittle/replicant.cljs +++ b/src/scittle/replicant.cljs @@ -1,8 +1,8 @@ (ns scittle.replicant (:require - [sci.configs.replicant.replicant-dom :refer [replicant-dom-namespace]] + [sci.configs.cjohansen.replicant :refer [config]] [scittle.core :as scittle])) (scittle/register-plugin! ::replicant - {:namespaces {'replicant.dom replicant-dom-namespace}}) + config) From d9da6ffce10cc116ffbd9c58bba031aaf5a71f4d Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk <27645+jeroenvandijk@users.noreply.github.com> Date: Mon, 16 Jun 2025 17:06:08 +0300 Subject: [PATCH 11/54] Update release script for Replicant Tictactoe case (#112) --- resources/public/index.html | 1 + resources/public/replicant_tictactoe.html | 2 +- script/release.clj | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/public/index.html b/resources/public/index.html index 1ea1a77..1c67481 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -178,6 +178,7 @@ Babashka + scittle implementation of the Luminus guestbook.
  • Codemirror
  • +
  • Tic-tac-toe with Replicant
  • diff --git a/resources/public/replicant_tictactoe.html b/resources/public/replicant_tictactoe.html index 94da4c1..b518841 100644 --- a/resources/public/replicant_tictactoe.html +++ b/resources/public/replicant_tictactoe.html @@ -16,7 +16,7 @@ -

    Scittle tic-tac-toe

    +

    Scittle tic-tac-toe built with Replicant

    What is Scittle?

    Read the main page for more details.

    The game

    diff --git a/script/release.clj b/script/release.clj index 3a1591b..f64d85d 100755 --- a/script/release.clj +++ b/script/release.clj @@ -25,6 +25,9 @@ (fs/copy "resources/public/codemirror.html" "gh-pages" {:replace-existing true}) + +(fs/copy "resources/public/replicant_tictactoe.html" "gh-pages" + {:replace-existing true}) (def html-source-dir (fs/file "resources" "public" "html")) (def html-target-dir (fs/file "gh-pages" "html")) @@ -62,6 +65,9 @@ {:replace-existing true})) (fs/glob cljs-source-dir "*.cljs")) +(println "Copying dir resources/public/cljs/replicant-tictactoe") +(fs/copy-tree (fs/file cljs-source-dir "replicant-tictactoe") (fs/file cljs-target-dir "replicant-tictactoe") {:replace-existing true}) + (run! (fn [f] (println "Copying" (str f)) (fs/copy f From fea2ec5910e02257f5d09a08161016e2a7e4f300 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 17 Jun 2025 23:52:37 +0200 Subject: [PATCH 12/54] Fix #113: add unchecked-set and unchecked-get --- CHANGELOG.md | 7 ++++--- deps.edn | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d16b989..ccdf846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ -- [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin. -- [#102](https://github.com/babashka/scittle/issues/102): add `applied-science/js-interop` plugin. -- [#105](https://github.com/babashka/scittle/issues/105): add `goog.string/htmlEscape`. +- [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin +- [#102](https://github.com/babashka/scittle/issues/102): add `applied-science/js-interop` plugin +- [#105](https://github.com/babashka/scittle/issues/105): add `goog.string/htmlEscape` +- [#113](https://github.com/babashka/scittle/issues/113): add `unchecked-set` and `unchecked-get` ## v0.6.22 (2024-12-19) diff --git a/deps.edn b/deps.edn index dd088c1..5b8e7fd 100644 --- a/deps.edn +++ b/deps.edn @@ -3,10 +3,9 @@ {org.clojure/clojure {:mvn/version "1.11.1"} thheller/shadow-cljs {:mvn/version "2.20.15"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "1e15f0f6a129ef7512351efc65f7475209d8cc4c"} + :git/sha "87fa2d2648ef809e8c8c87279c51961dca41ed4d"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} - no.cjohansen/replicant {:mvn/version "2025.03.27"} re-frame/re-frame {:mvn/version "1.3.0"} cljsjs/react {:mvn/version "18.2.0-1"} From 6d92f73262d52a90694a6a74685790332e52806a Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:09:57 +0200 Subject: [PATCH 13/54] Bump SCI.configs --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 5b8e7fd..96ada15 100644 --- a/deps.edn +++ b/deps.edn @@ -21,7 +21,7 @@ io.github.babashka/sci.configs #_{:local/root "/Users/borkdude/dev/sci.configs"} {:git/url "https://github.com/babashka/sci.configs" - :git/sha "a96625e839d7b8a8910eaa1cc9ccf01bb9714458"}} + :git/sha "1ade6f94a2902211bed1f876472571da0c5e7278"}} :aliases {:dev {:extra-paths ["dev"] From cc8f830704869b68d143b5dd05303ea9fec8236d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:16:49 +0200 Subject: [PATCH 14/54] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccdf846..0a77d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ +## v0.7.23 (2025-06-18) + - [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin - [#102](https://github.com/babashka/scittle/issues/102): add `applied-science/js-interop` plugin - [#105](https://github.com/babashka/scittle/issues/105): add `goog.string/htmlEscape` From 6068026436d9b211213b43f3487f88af498d6a27 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:17:38 +0200 Subject: [PATCH 15/54] Bump minor version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d7dae2..087deac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.6.22", + "version": "0.7.22", "files": [ "dist" ], From b6d37ece2391c6c889a468760734bb7859d073d1 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:18:15 +0200 Subject: [PATCH 16/54] 0.7.23 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08bb440..074b6c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.6.22" + "version": "0.7.23" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.6.22" + "version": "0.7.23" } diff --git a/package.json b/package.json index 087deac..ac66b4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.7.22", + "version": "0.7.23", "files": [ "dist" ], From 3845e9962a9376b12d374698dceee1d2b103f970 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:19:24 +0200 Subject: [PATCH 17/54] Bump versions --- CHANGELOG.md | 2 +- doc/dev.md | 10 +++++----- doc/links.md | 14 +++++++------- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- resources/public/codemirror.html | 8 ++++---- resources/public/html/cljs-ajax.html | 4 ++-- resources/public/html/export.html | 2 +- resources/public/html/reagent.html | 4 ++-- resources/public/index.html | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a77d68..daeb199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - + diff --git a/doc/dev.md b/doc/dev.md index 2b87a64..40abc6b 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.6.22` +- `bb replace-version 0.6.16 0.7.23` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/links.md b/doc/links.md index a58dd12..c17e320 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,7 +1,7 @@ -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.6.22/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.7.23/dist/scittle.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.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 diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 01953ef..905bab0 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: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index d228eed..22524fe 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index d512ebe..2da02b1 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + - - - + + + @@ -25,9 +25,9 @@ from cljs/replicant_tictactoe/core.cljs using the script tag:
    
    -<script type="application/x-scittle" src="cljs/replicant-tictactoe/ui.cljs"></script>
    -<script type="application/x-scittle" src="cljs/replicant-tictactoe/game.cljs"></script>
    -<script type="application/x-scittle" src="cljs/replicant-tictactoe/core.cljs"></script>
    +<script type="application/x-scittle" src="cljs/replicant_tictactoe/ui.cljs"></script>
    +<script type="application/x-scittle" src="cljs/replicant_tictactoe/game.cljs"></script>
    +<script type="application/x-scittle" src="cljs/replicant_tictactoe/core.cljs"></script>
     
     

    @@ -39,7 +39,7 @@ (.highlightAll js/hljs))) (def oreq (js/XMLHttpRequest.)) (.addEventListener oreq "load" set-text) - (.open oreq "GET" "cljs/replicant-tictactoe/core.cljs") + (.open oreq "GET" "cljs/replicant_tictactoe/core.cljs") (.send oreq) From a9c0373fe47c92d9c21a351665556070ea306b06 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 18 Jun 2025 11:29:50 +0200 Subject: [PATCH 22/54] fix gh pages --- script/release.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/release.clj b/script/release.clj index f64d85d..4835975 100755 --- a/script/release.clj +++ b/script/release.clj @@ -25,7 +25,7 @@ (fs/copy "resources/public/codemirror.html" "gh-pages" {:replace-existing true}) - + (fs/copy "resources/public/replicant_tictactoe.html" "gh-pages" {:replace-existing true}) @@ -65,8 +65,8 @@ {:replace-existing true})) (fs/glob cljs-source-dir "*.cljs")) -(println "Copying dir resources/public/cljs/replicant-tictactoe") -(fs/copy-tree (fs/file cljs-source-dir "replicant-tictactoe") (fs/file cljs-target-dir "replicant-tictactoe") {:replace-existing true}) +(println "Copying dir resources/public/cljs/replicant_tictactoe") +(fs/copy-tree (fs/file cljs-source-dir "replicant_tictactoe") (fs/file cljs-target-dir "replicant_tictactoe") {:replace-existing true}) (run! (fn [f] (println "Copying" (str f)) From c03978105880c06d84f061a2595f6f9a4d55676e Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Wed, 2 Jul 2025 14:38:37 +0800 Subject: [PATCH 23/54] Document service worker usage. (#117) --- README.md | 4 ++++ doc/serviceworker.md | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 doc/serviceworker.md diff --git a/README.md b/README.md index a276016..52d3130 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ babashka or Clojure JVM): See [doc/nrepl](doc/nrepl). +### Service worker + +See [doc/serviceworker.md](doc/serviceworker.md). + ## Tasks Run `bb tasks` to see all available tasks: diff --git a/doc/serviceworker.md b/doc/serviceworker.md new file mode 100644 index 0000000..1048f77 --- /dev/null +++ b/doc/serviceworker.md @@ -0,0 +1,26 @@ +# Scittle in a service worker + +You can use Scittle to bootstrap a ClojureScript based service worker. + +Put the following code into e.g. `scittle-sw.js` to create a JavaScript based service worker, load Scittle, then fetch your script and eval it. + +```javascript +importScripts("scittle.min.js"); + +const request = await fetch("sw.cljs"); +const text = await request.text(); +const result = scittle.core.eval_string(text); +``` + +Then load `scittle-sw.js` in your HTML: + +```html + +``` + +This will load `sw.cljs` and eval it in the context of the service worker. + +A ready-made example can be found at [chr15m/scittle-template-serviceworker](https://github.com/chr15m/scittle-template-serviceworker). From 9a83349d691b4cbcaa498984e7b278a6b093eb2e Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk <27645+jeroenvandijk@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:24:35 +0300 Subject: [PATCH 24/54] Add goog.string/format #118 (#119) * Add goog.string/format #118 Also add empty goog.string.format for Cljs compatibility * Update changelog --- CHANGELOG.md | 2 ++ src/scittle/core.cljs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0847390..431fc4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ +- [#118](https://github.com/babashka/scittle/issues/118): add `goog.string/format` ([@jeroenvandijk](https://github.com/jeroenvandijk)) + ## v0.7.23 (2025-06-18) - [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin ([@jeroenvandijk](https://github.com/jeroenvandijk)) diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index ee5ec27..6ba88ad 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -3,6 +3,7 @@ (:require [cljs.reader :refer [read-string]] [goog.object :as gobject] [goog.string :as gstring] + [goog.string.format] [sci.core :as sci] [sci.ctx-store :as store] [sci.impl.unrestrict] @@ -46,7 +47,9 @@ 'abs (sci/copy-var abs cljns)} 'goog.object {'set gobject/set 'get gobject/get} - 'goog.string {'htmlEscape gstring/htmlEscape} + 'goog.string {'format gstring/format + 'htmlEscape gstring/htmlEscape} + 'goog.string.format {} ;; For cljs compatibility 'sci.core {'stacktrace sci/stacktrace 'format-stacktrace sci/format-stacktrace}}) From f92e23d8f279bcc466b07903926d62fbdc3395ac Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk <27645+jeroenvandijk@users.noreply.github.com> Date: Mon, 14 Jul 2025 19:34:23 +0300 Subject: [PATCH 25/54] Add dataspex plugin (#122) --- CHANGELOG.md | 1 + deps.edn | 3 ++- plugins/datascript/deps.edn | 3 ++- plugins/dataspex/deps.edn | 8 ++++++++ plugins/dataspex/src/scittle/dataspex.cljs | 9 +++++++++ plugins/dataspex/src/scittle_plugin.edn | 8 ++++++++ plugins/demo/bb.edn | 1 + plugins/hoplon/deps.edn | 3 ++- plugins/javelin/deps.edn | 3 ++- 9 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 plugins/dataspex/deps.edn create mode 100644 plugins/dataspex/src/scittle/dataspex.cljs create mode 100644 plugins/dataspex/src/scittle_plugin.edn diff --git a/CHANGELOG.md b/CHANGELOG.md index 431fc4f..74bb2bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ +- [#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)) ## v0.7.23 (2025-06-18) diff --git a/deps.edn b/deps.edn index 96ada15..fa33be6 100644 --- a/deps.edn +++ b/deps.edn @@ -21,7 +21,8 @@ io.github.babashka/sci.configs #_{:local/root "/Users/borkdude/dev/sci.configs"} {:git/url "https://github.com/babashka/sci.configs" - :git/sha "1ade6f94a2902211bed1f876472571da0c5e7278"}} + :git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" + :exclusions [org.babashka/sci]}} :aliases {:dev {:extra-paths ["dev"] diff --git a/plugins/datascript/deps.edn b/plugins/datascript/deps.edn index 1454ae1..467f4cd 100644 --- a/plugins/datascript/deps.edn +++ b/plugins/datascript/deps.edn @@ -1,3 +1,4 @@ {:deps {datascript/datascript {:mvn/version "1.3.12"} - io.github.babashka/sci.configs {:git/sha "33bd51e53700b224b4cb5bda59eb21b62f962745"}}} + io.github.babashka/sci.configs {:git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" + :exclusions [org.babashka/sci]}}} diff --git a/plugins/dataspex/deps.edn b/plugins/dataspex/deps.edn new file mode 100644 index 0000000..badf11e --- /dev/null +++ b/plugins/dataspex/deps.edn @@ -0,0 +1,8 @@ +{:deps + {no.cjohansen/dataspex {:git/url "https://github.com/cjohansen/dataspex" + :git/sha "02112200651c2bd932907bb69fba1ff50b881741" + :exclusions [ring/ring-core + ring/ring-jetty-adapter + com.cognitect/transit-clj]} + io.github.babashka/sci.configs {:git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" + :exclusions [org.babashka/sci]}}} diff --git a/plugins/dataspex/src/scittle/dataspex.cljs b/plugins/dataspex/src/scittle/dataspex.cljs new file mode 100644 index 0000000..66b3908 --- /dev/null +++ b/plugins/dataspex/src/scittle/dataspex.cljs @@ -0,0 +1,9 @@ +(ns scittle.dataspex + {:no-doc true} + (:require [sci.configs.cjohansen.dataspex :refer [config]] + [scittle.core :as scittle])) + +(defn init [] + (scittle/register-plugin! + ::dataspex + config)) diff --git a/plugins/dataspex/src/scittle_plugin.edn b/plugins/dataspex/src/scittle_plugin.edn new file mode 100644 index 0000000..af629e2 --- /dev/null +++ b/plugins/dataspex/src/scittle_plugin.edn @@ -0,0 +1,8 @@ +[{:name scittle/dataspex + :namespaces [dataspex.core] + :js "./scittle.dataspex.js" + :shadow-config + {:modules + {:scittle.dataspex {:init-fn scittle.dataspex/init + :depends-on #{:scittle :scittle.datascript} + :entries [dataspex.core]}}}}] diff --git a/plugins/demo/bb.edn b/plugins/demo/bb.edn index 86170d0..e7486c2 100644 --- a/plugins/demo/bb.edn +++ b/plugins/demo/bb.edn @@ -1,6 +1,7 @@ {:deps {io.github.babashka/scittle.build {:local/root "../../build"} ;; datascript plugin ; io.github.babashka/scittle.datascript {:local/root "../../plugins/datascript"} + io.github.babashka/scittle.dataspex {:local/root "../../plugins/dataspex"} io.github.babashka/scittle.javelin {:local/root "../../plugins/javelin"} io.github.babashka/scittle.hoplon {:local/root "../../plugins/hoplon"} io.github.babashka/http-server diff --git a/plugins/hoplon/deps.edn b/plugins/hoplon/deps.edn index e7aef52..0eab577 100644 --- a/plugins/hoplon/deps.edn +++ b/plugins/hoplon/deps.edn @@ -1,3 +1,4 @@ {:deps {hoplon/hoplon {:mvn/version "7.5.0"} - io.github.babashka/sci.configs {:git/sha "08bab21643bc0c63a5b99c65193c9d24888270b7"}}} + io.github.babashka/sci.configs {:git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" + :exclusions [org.babashka/sci]}}} diff --git a/plugins/javelin/deps.edn b/plugins/javelin/deps.edn index 135f602..f4b4533 100644 --- a/plugins/javelin/deps.edn +++ b/plugins/javelin/deps.edn @@ -1,3 +1,4 @@ {:deps {hoplon/javelin {:mvn/version "3.9.3"} - io.github.babashka/sci.configs {:git/sha "08bab21643bc0c63a5b99c65193c9d24888270b7"}}} + io.github.babashka/sci.configs {:git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" + :exclusions [org.babashka/sci]}}} From e8670cb1c8bad5c037b8b032fbbe8ab489e86b0b Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 21 Jul 2025 11:49:23 +0200 Subject: [PATCH 26/54] minor --- src/scittle/nrepl.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index bfea685..08cb7bb 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -11,7 +11,6 @@ (new js/WebSocket (ws-url (.-hostname (.-location js/window)) ws-port "_nrepl")))) (when-let [ws (nrepl-server/nrepl-websocket)] - (prn :ws ws) (set! (.-onmessage ws) (fn [event] (nrepl-server/handle-nrepl-message (edn/read-string (.-data event))))) From c4d7e74d2d77d0b16ac6d636c9e4999befdddbf2 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 21 Jul 2025 14:36:32 +0200 Subject: [PATCH 27/54] Bump sci.nrepl --- doc/nrepl/bb.edn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/nrepl/bb.edn b/doc/nrepl/bb.edn index e4cf885..fdd4518 100644 --- a/doc/nrepl/bb.edn +++ b/doc/nrepl/bb.edn @@ -1,5 +1,6 @@ {:deps {io.github.babashka/sci.nrepl - {:git/sha "2f8a9ed2d39a1b09d2b4d34d95494b56468f4a23"} + #_{:local/root "/Users/borkdude/dev/sci.nrepl"} + {:git/sha "4f7f6d652a71b5bdc0c110313a4908d956e7a97d"} io.github.babashka/http-server {:git/sha "b38c1f16ad2c618adae2c3b102a5520c261a7dd3"}} :tasks {http-server {:doc "Starts http server for serving static files" From c57a5f9285c6cf32985a126a4ae5774755e787ca Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 12 Aug 2025 20:29:50 +0200 Subject: [PATCH 28/54] Bump SCI: support set! syntax --- .gitignore | 1 + CHANGELOG.md | 1 + deps.edn | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 58fe583..f415989 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ gh-pages/ /.clj-kondo/.cache /.clj-kondo/rewrite-clj /plugins/demo/resources/public/js/ +.portal diff --git a/CHANGELOG.md b/CHANGELOG.md index 74bb2bf..5d166ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - [#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)) +- Support alternative `(set! #js {} -a 1)` CLJS syntax (by bumping SCI) ## v0.7.23 (2025-06-18) diff --git a/deps.edn b/deps.edn index fa33be6..fda2968 100644 --- a/deps.edn +++ b/deps.edn @@ -3,7 +3,7 @@ {org.clojure/clojure {:mvn/version "1.11.1"} thheller/shadow-cljs {:mvn/version "2.20.15"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "87fa2d2648ef809e8c8c87279c51961dca41ed4d"} + :git/sha "9522bdadafcfbc5b86e3f37117df62634a9d923e"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} no.cjohansen/replicant {:mvn/version "2025.03.27"} From cb968d06e3d9be335786fea707e576d48ecad154 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 20 Aug 2025 14:58:23 +0200 Subject: [PATCH 29/54] Scittle dev (#127) --- bb.edn | 8 +++++--- build/src/scittle/build.clj | 13 ++++++++++++- deps.edn | 5 +++-- resources/public/index_text.html | 13 +++++++++++++ shadow-cljs.edn | 8 ++++++-- src/scittle/cljs_devtools.cljs | 6 ++++++ 6 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 resources/public/index_text.html create mode 100644 src/scittle/cljs_devtools.cljs diff --git a/bb.edn b/bb.edn index bc4f02c..f76e437 100644 --- a/bb.edn +++ b/bb.edn @@ -44,9 +44,11 @@ :depends [prod] :task (do (fs/delete-tree "dist") - (fs/create-dirs "dist") - (run! (fn [f] (fs/copy f "dist")) - (fs/glob "resources/public/js" "*.js")))} + (fs/create-dirs "dist/dev") + (run! (fn [f] (fs/copy f "dist" {:replace-existing true})) + (fs/glob "resources/public/js" "*.{js,js.map}")) + (run! (fn [f] (fs/copy f "dist/dev" {:replace-existing true})) + (fs/glob "resources/public/js/dev" "*.{js,js.map}")))} bump-version {:doc "Bumps package.json and pushes new git tag" :task (do (shell "npm version patch") diff --git a/build/src/scittle/build.clj b/build/src/scittle/build.clj index 1e17a37..879d05c 100644 --- a/build/src/scittle/build.clj +++ b/build/src/scittle/build.clj @@ -69,4 +69,15 @@ * :action - compile action, defaults to release, but may also be compile or watch" [{:keys [action args] :or {action "release"}}] - (build* (format "-M -m shadow.cljs.devtools.cli --force-spawn %s main %s" action (str/join " " args)))) + (build* (format "-M -m shadow.cljs.devtools.cli --force-spawn %s main %s" action (str/join " " args))) + (when (= "release" action) + (println "Also building dev release build") + (build* (format "-M -m shadow.cljs.devtools.cli --force-spawn %s main %s %s" + action + "--config-merge '{:compiler-options {:optimizations :simple + :pretty-print true + :pseudo-names true} + :output-dir \"resources/public/js/dev\" + :modules {:scittle.cljs-devtools.dev {:entries [scittle.cljs-devtools] + :depends-on #{:scittle}}}}'" + (str/join " " args))))) diff --git a/deps.edn b/deps.edn index fda2968..a4ecb60 100644 --- a/deps.edn +++ b/deps.edn @@ -1,7 +1,7 @@ {:paths ["src" "resources"] :deps {org.clojure/clojure {:mvn/version "1.11.1"} - thheller/shadow-cljs {:mvn/version "2.20.15"} + thheller/shadow-cljs {:mvn/version "3.1.8"} org.babashka/sci {:git/url "https://github.com/babashka/sci" :git/sha "9522bdadafcfbc5b86e3f37117df62634a9d923e"} #_{:local/root "../babashka/sci"} @@ -22,7 +22,8 @@ #_{:local/root "/Users/borkdude/dev/sci.configs"} {:git/url "https://github.com/babashka/sci.configs" :git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1" - :exclusions [org.babashka/sci]}} + :exclusions [org.babashka/sci]} + binaryage/devtools {:mvn/version "1.0.7"}} :aliases {:dev {:extra-paths ["dev"] diff --git a/resources/public/index_text.html b/resources/public/index_text.html new file mode 100644 index 0000000..c5e58c0 --- /dev/null +++ b/resources/public/index_text.html @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 8040d70..7b6d8c4 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -6,7 +6,11 @@ :builds {:main - {:target :browser + {;; for dev build + #_#_:compiler-options {:optimizations :simple + :pretty-print true + :pseudo-names true} + :target :browser :js-options {:resolve {"react" {:target :global :global "React"} @@ -32,5 +36,5 @@ :scittle.cljs-ajax {:entries [scittle.cljs-ajax] :depends-on #{:scittle}}} :build-hooks [(shadow.cljs.build-report/hook)] - :output-dir "resources/public/js" + :output-dir "resources/public/js" ;; + "/dev" for dev build :devtools {:repl-pprint true}}}} diff --git a/src/scittle/cljs_devtools.cljs b/src/scittle/cljs_devtools.cljs new file mode 100644 index 0000000..cbe2082 --- /dev/null +++ b/src/scittle/cljs_devtools.cljs @@ -0,0 +1,6 @@ +(ns scittle.cljs-devtools + (:require [devtools.core :as devtools])) + +(devtools/set-pref! :disable-advanced-mode-check true) + +(devtools/install!) From 04df449d6f3b7fea290b6955285d57a839decc43 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 20 Aug 2025 15:04:48 +0200 Subject: [PATCH 30/54] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d166ea..01e22e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,13 @@ +## v0.7.24 (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)) - Support alternative `(set! #js {} -a 1)` CLJS syntax (by bumping SCI) +- Add source maps to distribution +- Add dev versions of all modules in the `dev` folder of the distribution + a `dev/scitte.cljs-devtools.js` module ## v0.7.23 (2025-06-18) From 982ffadaeaa63c8d78c7fd27041dfc368e404066 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 20 Aug 2025 15:06:30 +0200 Subject: [PATCH 31/54] 0.7.24 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 074b6c0..8b5e900 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.23" + "version": "0.7.24" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.7.23" + "version": "0.7.24" } diff --git a/package.json b/package.json index ac66b4e..2da8870 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.7.23", + "version": "0.7.24", "files": [ "dist" ], From 1857a18ee90c35824c89c4bee3b1a729a733e331 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 20 Aug 2025 15:07:36 +0200 Subject: [PATCH 32/54] bump version --- doc/dev.md | 10 +++++----- doc/links.md | 18 +++++++++--------- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- resources/public/codemirror.html | 8 ++++---- resources/public/html/cljs-ajax.html | 4 ++-- resources/public/html/export.html | 2 +- resources/public/html/reagent.html | 4 ++-- resources/public/index.html | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index 40abc6b..9c48c8c 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.24` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/links.md b/doc/links.md index 0a0f4d8..a3ba99f 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,9 +1,9 @@ -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.24/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.js-interop.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.replicant.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.7.24/dist/scittle.nrepl.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 905bab0..49ab456 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: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index 22524fe..96316fe 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index 2da02b1..1470da4 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + - + ``` Also include the CLJS file that you want to evaluate with nREPL: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index 96316fe..82a903b 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index 1470da4..417c977 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + + + + + + + +``` + +## 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/resources/public/index.html b/resources/public/index.html index 8645ebe..670d821 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -160,6 +160,12 @@ (js/console.log "In cljs")) + +

    JS libraries

    + + To use JavaScript libraries with Scittle, + see README.md +

    REPL

    From c48f9868c6d5ee9fbc4e796a937cef3233fb5a00 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 21 Aug 2025 15:02:29 +0200 Subject: [PATCH 41/54] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eba6bc3..495c622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,9 @@ ## 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)) +- [#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) From 6b56464bd67c2a65de93270f5b3ab6d483260ffd Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 21 Aug 2025 15:03:00 +0200 Subject: [PATCH 42/54] 0.7.27 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dad5d8c..9408bff 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.26" + "version": "0.7.27" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.7.26" + "version": "0.7.27" } diff --git a/package.json b/package.json index 0b85ba0..71d9dbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.7.26", + "version": "0.7.27", "files": [ "dist" ], From 9e1feb81af87f5d79269cddef9df007408496788 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 21 Aug 2025 15:03:34 +0200 Subject: [PATCH 43/54] version --- doc/dev.md | 10 ++++---- doc/links.md | 38 ++++++++++++++-------------- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 +-- resources/public/codemirror.html | 8 +++--- resources/public/html/cljs-ajax.html | 4 +-- resources/public/html/export.html | 2 +- resources/public/html/reagent.html | 4 +-- resources/public/index.html | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index c4447b6..b3c9924 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.26` +- `bb replace-version 0.6.16 0.7.27` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/links.md b/doc/links.md index 9943b02..ce5f490 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,20 +1,20 @@ -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.js-interop.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.replicant.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.js-interop.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.replicant.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/scittle.nrepl.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.js-interop.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.replicant.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.nrepl.js -https://cdn.jsdelivr.net/npm/scittle@0.7.26/dist/dev/scittle.cljs-devtools.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.js-interop.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.replicant.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.7.27/dist/dev/scittle.cljs-devtools.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index f3dbe26..4414aa9 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: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index 82a903b..7a8e80e 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index 417c977..b936266 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + + + - + ``` Also include the CLJS file that you want to evaluate with nREPL: diff --git a/doc/nrepl/index.html b/doc/nrepl/index.html index 7a8e80e..5890a47 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index b936266..800624b 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,13 +1,13 @@ - + - - - + + + - + + + + - + +``` + ### CIDER Choose `cider-connect-cljs`, select port `1339`, followed by the `nbb` REPL diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index 08cb7bb..ec4c38c 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -8,7 +8,9 @@ (when-let [ws-port (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)] (set! (.-ws_nrepl js/window) - (new js/WebSocket (ws-url (.-hostname (.-location js/window)) ws-port "_nrepl")))) + (new js/WebSocket (ws-url (or (.-SCITTLE_NREPL_WEBSOCKET_HOST js/window) + (.-hostname (.-location js/window))) + ws-port "_nrepl")))) (when-let [ws (nrepl-server/nrepl-websocket)] (set! (.-onmessage ws) From f72c1c163aeddcb3451becad3c19d6482751f404 Mon Sep 17 00:00:00 2001 From: FrankS Date: Tue, 9 Dec 2025 13:11:25 -0800 Subject: [PATCH 54/54] Expose cljs.core/Cons in SCI config (#142) This allows (instance? cljs.core/Cons x) to work in Scittle code. The Cons type exists in the compiled ClojureScript runtime but was not exposed by name in SCI's symbol table. Libraries like Trove need this for type checking in their const-form? function. --- src/scittle/core.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index 6a7ac60..c603d9c 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -44,7 +44,8 @@ 'NaN? (sci/copy-var NaN? cljns) 'infinite? (sci/copy-var infinite? cljns) 'iteration (sci/copy-var iteration cljns) - 'abs (sci/copy-var abs cljns)} + 'abs (sci/copy-var abs cljns) + 'Cons cljs.core/Cons} 'goog.object {'set gobject/set 'get gobject/get} 'goog.string {'format gstring/format