From 2b2dc2de890c059eab4f87eff6db2aa3dc796c13 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 21 May 2022 21:11:01 +0200 Subject: [PATCH 001/175] wip --- deps.edn | 4 +++- src/scittle/core.cljs | 44 ++++++++++++++++++------------------------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/deps.edn b/deps.edn index f9461c6..b86c4e9 100644 --- a/deps.edn +++ b/deps.edn @@ -2,7 +2,9 @@ :deps {org.clojure/clojure {:mvn/version "1.10.3"} - org.babashka/sci {:mvn/version "0.3.5"} + org.babashka/sci #_{:mvn/version "0.3.5"} + {:git/url "https://github.com/babashka/sci" + :git/sha "b95519dc283bebafa3dcce01c3e9eaaa568d0fcb"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} cljsjs/react-dom {:mvn/version "17.0.2-0"} diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index 12c3afa..137434b 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] + [sci.async :as scia] [sci.core :as sci] [scittle.impl.common :refer [cljns]] [scittle.impl.error :as error])) @@ -30,32 +31,24 @@ 'get gobject/get}}) (def !sci-ctx (atom (sci/init {:namespaces namespaces - :classes {'js js/window - :allow :all} - :disable-arity-checks true}))) + :classes {'js js/window + :allow :all} + :disable-arity-checks true}))) (def !last-ns (volatile! @sci/ns)) (defn- -eval-string [s] - (sci/binding [sci/ns @!last-ns] - (let [rdr (sci/reader s)] - (loop [res nil] - (let [form (sci/parse-next @!sci-ctx rdr)] - (if (= :sci.core/eof form) - (do - (vreset! !last-ns @sci/ns) - res) - (recur (sci/eval-form @!sci-ctx form)))))))) + (scia/eval-string* @!sci-ctx s)) (defn ^:export eval-string [s] - (try (-eval-string s) - (catch :default e - (error/error-handler e (:src @!sci-ctx)) - (let [sci-error? (isa? (:type (ex-data e)) :sci/error)] - (throw (if sci-error? - (or (ex-cause e) e) - e)))))) + (.catch (-eval-string s) + (fn [e] + (error/error-handler e (:src @!sci-ctx)) + (let [sci-error? (isa? (:type (ex-data e)) :sci/error)] + (throw (if sci-error? + (or (ex-cause e) e) + e)))))) (defn register-plugin! [plug-in-name sci-opts] plug-in-name ;; unused for now @@ -67,9 +60,9 @@ (let [scittle-id (str (gensym "scittle-tag-"))] (gobject/set tag "scittle_id" scittle-id) (swap! !sci-ctx assoc-in [:src scittle-id] text) - (sci/binding [sci/file scittle-id] - (eval-string text)) - (eval-script-tags* (rest script-tags))) + (-> (sci/binding [sci/file scittle-id] + (eval-string text)) + (.then #(eval-script-tags* (rest script-tags))))) (let [src (.getAttribute tag "src") req (js/XMLHttpRequest.) _ (.open req "GET" src true) @@ -79,9 +72,9 @@ (gobject/set tag "scittle_id" src) ;; save source for error messages (swap! !sci-ctx assoc-in [:src src] response) - (sci/binding [sci/file src] - (eval-string response))) - (eval-script-tags* (rest script-tags)))))] + (-> (sci/binding [sci/file src] + (eval-string response)) + (.then #(eval-script-tags* (rest script-tags))))))))] (.send req))))) (defn ^:export eval-script-tags [] @@ -103,4 +96,3 @@ (enable-console-print!) (sci/alter-var-root sci/print-fn (constantly *print-fn*)) - From 19fe9152e7a0b91b4d6de0f98f6e3e3be6041c95 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 21 May 2022 21:51:42 +0200 Subject: [PATCH 002/175] wip [skip ci] --- deps.edn | 3 ++- resources/public/index.html | 12 +++++++++++- src/scittle/core.cljs | 9 +++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/deps.edn b/deps.edn index b86c4e9..72e6cfb 100644 --- a/deps.edn +++ b/deps.edn @@ -3,8 +3,9 @@ :deps {org.clojure/clojure {:mvn/version "1.10.3"} org.babashka/sci #_{:mvn/version "0.3.5"} - {:git/url "https://github.com/babashka/sci" + #_{:git/url "https://github.com/babashka/sci" :git/sha "b95519dc283bebafa3dcce01c3e9eaaa568d0fcb"} + {:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} cljsjs/react-dom {:mvn/version "17.0.2-0"} diff --git a/resources/public/index.html b/resources/public/index.html index e1356ad..60c22d2 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -49,7 +49,11 @@ (let [response (gobject/get req "response")] (set! (.-innerText code) response) (.highlightElement js/hljs code)))) - (.send req))) + (.send req))) + + (set! (.-eval_input js/window) (fn [] + (let [value (.-value (js/document.getElementById "myInput"))] + (js/scittle.core.eval_string value)))) @@ -118,6 +122,12 @@ Click me! + +

Evaluate

+ + +

REPL

diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index 137434b..bce0ecc 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -33,8 +33,13 @@ (def !sci-ctx (atom (sci/init {:namespaces namespaces :classes {'js js/window :allow :all} - :disable-arity-checks true}))) - + :disable-arity-checks true + :async-load-fn (fn [{:keys [libname ctx opts]}] + (-> (js* (str "import('" libname "')")) + (.then (fn [mod] + (sci/add-class! ctx (:as opts) mod))) + (.then (fn [_] + {:handled true}))))}))) (def !last-ns (volatile! @sci/ns)) From fe353c4c083551149dbd6309b2a847dc5e6860a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sj=C3=B8rup?= Date: Fri, 15 Jul 2022 10:44:42 +0200 Subject: [PATCH 003/175] add brackets in require in README.md (#30) --- doc/nrepl/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index af2abf7..266765f 100644 --- a/doc/nrepl/README.md +++ b/doc/nrepl/README.md @@ -7,7 +7,7 @@ In babashka or Clojure JVM, use the [sci.nrepl](https://github.com/babashka/sci.nrepl) dependency and run: ``` clojure -(require 'sci.nrepl.browser-server :as nrepl) +(require '[sci.nrepl.browser-server :as nrepl]) (nrepl/start! {:nrepl-port 1339 :websocket-port 1340}) ``` From a698bd4ed92cbaffebcfe90b1ea90e6d4af6219d Mon Sep 17 00:00:00 2001 From: Carnun Marcus-Page Date: Mon, 15 Aug 2022 13:34:44 +0100 Subject: [PATCH 004/175] Fix bookmarklet share link (#35) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, Twitter (and possibly other sites!) cut closing parens from the "Copy this link to share ⤴️" link. So a quick-and-dirty fix is to just append a bit of whitespace. A little more context (with pictures): https://twitter.com/CarnunMP/status/1559148858118111234 --- resources/public/cljs/bookmarklet.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/public/cljs/bookmarklet.cljs b/resources/public/cljs/bookmarklet.cljs index 0f9eb15..6fbe791 100644 --- a/resources/public/cljs/bookmarklet.cljs +++ b/resources/public/cljs/bookmarklet.cljs @@ -134,6 +134,7 @@ [:br] [(fn [] [:a {:href (str "?name=" (js/encodeURIComponent @*bookmark-name) - "&code=" (js/encodeURIComponent @*code))} "Copy this link to share ⤴️"])]])) + "&code=" (js/encodeURIComponent @*code) + " ")} "Copy this link to share ⤴️"])]])) (rdom/render [workspace] (.getElementById js/document "app")) From 25e9ea61af81f8a72c92b1c14259386be13dabf6 Mon Sep 17 00:00:00 2001 From: Carnun Marcus-Page Date: Tue, 16 Aug 2022 12:00:51 +0100 Subject: [PATCH 005/175] Fix fix of bookmarklet share link (#37) Related issue: https://github.com/babashka/scittle/issues/36 --- resources/public/cljs/bookmarklet.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/public/cljs/bookmarklet.cljs b/resources/public/cljs/bookmarklet.cljs index 6fbe791..69d2169 100644 --- a/resources/public/cljs/bookmarklet.cljs +++ b/resources/public/cljs/bookmarklet.cljs @@ -135,6 +135,6 @@ [(fn [] [:a {:href (str "?name=" (js/encodeURIComponent @*bookmark-name) "&code=" (js/encodeURIComponent @*code) - " ")} "Copy this link to share ⤴️"])]])) + "%20")} "Copy this link to share ⤴️"])]])) (rdom/render [workspace] (.getElementById js/document "app")) From 7bf5bc087dd3a4faffae17caa543c1fce473d692 Mon Sep 17 00:00:00 2001 From: Ray McDermott Date: Tue, 30 Aug 2022 11:02:11 +0200 Subject: [PATCH 006/175] Add promesa (#38) * Add promesa * Add promesa --- CHANGELOG.md | 3 +++ deps.edn | 1 + shadow-cljs.edn | 2 ++ src/scittle/promesa.cljs | 7 +++++++ 4 files changed, 13 insertions(+) create mode 100644 src/scittle/promesa.cljs diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d51c5..2832921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v0.2.9 +- Add support for promesa + ## v0.2.8 - Upgrade to SCI 0.3.1 diff --git a/deps.edn b/deps.edn index f9461c6..8adef32 100644 --- a/deps.edn +++ b/deps.edn @@ -8,6 +8,7 @@ cljsjs/react-dom {:mvn/version "17.0.2-0"} cljsjs/react-dom-server {:mvn/version "17.0.2-0"} cljs-ajax/cljs-ajax {:mvn/version "0.8.3"} + funcool/promesa {:mvn/version "8.0.450"} io.github.babashka/sci.nrepl #_{:local/root "../sci.nrepl"} diff --git a/shadow-cljs.edn b/shadow-cljs.edn index fe96550..6e948d0 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -16,6 +16,8 @@ {:scittle {:entries [scittle.core]} :scittle.nrepl {:entries [scittle.nrepl] :depends-on #{:scittle}} + :scittle.promesa {:entries [scittle.promesa] + :depends-on #{:scittle}} :scittle.reagent {:entries [scittle.reagent] :depends-on #{:scittle}} :scittle.cljs-ajax {:entries [scittle.cljs-ajax] diff --git a/src/scittle/promesa.cljs b/src/scittle/promesa.cljs new file mode 100644 index 0000000..4d84e3a --- /dev/null +++ b/src/scittle/promesa.cljs @@ -0,0 +1,7 @@ +(ns scittle.promesa + (:require [scittle.core :as scittle] + [sci.configs.funcool.promesa :as p])) + +(scittle/register-plugin! + ::promesa + p/config) From cf65ffaf20d9838852951d59880185c33cfd4557 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 31 Aug 2022 13:45:37 +0200 Subject: [PATCH 007/175] cljs.pprint (#39) --- bb.edn | 3 ++- deps.edn | 6 ++++-- resources/public/index.html | 15 +++++++++++++++ shadow-cljs.edn | 2 ++ src/scittle/core.cljs | 15 +++++++++------ src/scittle/pprint.cljs | 8 ++++++++ src/scittle/promesa.cljs | 5 +++-- 7 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 src/scittle/pprint.cljs diff --git a/bb.edn b/bb.edn index 9a89e71..6432ee4 100644 --- a/bb.edn +++ b/bb.edn @@ -15,7 +15,8 @@ (fs/delete-tree ".shadow-cljs"))} shadow:watch {:doc "Development build. Starts webserver and watches for changes." - :task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")} + :task (clojure {:extra-env {"SCI_ELIDE_VARS" "true"}} + "-M:dev -m shadow.cljs.devtools.cli watch main")} http-server {:doc "Starts http server for serving static files" :requires ([babashka.http-server :as http]) diff --git a/deps.edn b/deps.edn index 8adef32..29b133c 100644 --- a/deps.edn +++ b/deps.edn @@ -2,7 +2,9 @@ :deps {org.clojure/clojure {:mvn/version "1.10.3"} - org.babashka/sci {:mvn/version "0.3.5"} + org.babashka/sci {:git/url "https://github.com/babashka/sci" + :git/sha "133a7565749ac6cd5a8308182f0b1c7fc47e8a3d"} + #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} cljsjs/react-dom {:mvn/version "17.0.2-0"} @@ -14,7 +16,7 @@ #_{:local/root "../sci.nrepl"} {:git/sha "e83421ce9349c36df56a2eb936196dbb65b0de63"} io.github.babashka/sci.configs - {:git/sha "fcd367c6a6115c5c4e41f3a08ee5a8d5b3387a18"}} + {:git/sha "63225c8606d593c595d2f10a6fa5bf38103852df"}} :aliases {:dev diff --git a/resources/public/index.html b/resources/public/index.html index e1356ad..3214605 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -7,6 +7,8 @@ + + diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index aa342cd..a19a314 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -30,7 +30,9 @@ 'random-uuid random-uuid 'read-string (sci/copy-var read-string rns)} 'goog.object {'set gobject/set - 'get gobject/get}}) + 'get gobject/get} + 'sci.core {'stacktrace sci/stacktrace + 'format-stacktrace sci/format-stacktrace}}) (def !sci-ctx (atom (sci/init {:namespaces namespaces @@ -56,10 +58,7 @@ (try (-eval-string s) (catch :default e (error/error-handler e (:src @!sci-ctx)) - (let [sci-error? (isa? (:type (ex-data e)) :sci/error)] - (throw (if sci-error? - (or (ex-cause e) e) - e)))))) + (throw e)))) (defn register-plugin! [plug-in-name sci-opts] plug-in-name ;; unused for now From cfac8dbaa54e5be17680bfc2d2e6a76910b6c997 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 31 Aug 2022 17:22:26 +0200 Subject: [PATCH 010/175] Improve error during analysis, #34 --- deps.edn | 2 +- resources/public/html/local.html | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/deps.edn b/deps.edn index 29b133c..154cdf5 100644 --- a/deps.edn +++ b/deps.edn @@ -3,7 +3,7 @@ :deps {org.clojure/clojure {:mvn/version "1.10.3"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "133a7565749ac6cd5a8308182f0b1c7fc47e8a3d"} + :git/sha "6bbfec0ede429fc17cb9ba51a96582b4fcd6ea69"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} diff --git a/resources/public/html/local.html b/resources/public/html/local.html index 1d37726..603a5bc 100644 --- a/resources/public/html/local.html +++ b/resources/public/html/local.html @@ -5,22 +5,8 @@ From 2cb9e7de6805d33a6468db902dd0e6da01391d3c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 31 Aug 2022 17:28:07 +0200 Subject: [PATCH 011/175] Improve error renderer --- src/scittle/impl/error.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scittle/impl/error.cljs b/src/scittle/impl/error.cljs index f899fc2..b5edb4e 100644 --- a/src/scittle/impl/error.cljs +++ b/src/scittle/impl/error.cljs @@ -69,8 +69,8 @@ (when-let [m (.-message e)] (println (str "Message: " m))) (when-let [d (ex-data (ex-cause e) #_(.getCause e))] - (print (str "Data: ")) - (prn d)) + (println (str "Data: ") + (pr-str d))) (let [{:keys [:file :line :column]} d] (when line (println (str "Location: " From a049c8eddb131753bc25e760829623be768efdd3 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 31 Aug 2022 17:32:52 +0200 Subject: [PATCH 012/175] Bump version --- CHANGELOG.md | 9 ++++++--- bb.edn | 10 +++++----- doc/dev.md | 8 ++++---- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- resources/public/html/cljs-ajax.html | 4 ++-- resources/public/html/export.html | 2 +- resources/public/html/reagent.html | 4 ++-- resources/public/index.html | 2 +- 11 files changed, 27 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2832921..f60e269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # Changelog -## v0.2.9 -- Add support for promesa +## 0.3.9 -## v0.2.8 +- Add `scittle.promesa.js` plugin. This gives access to the [promesa](https://cljdoc.org/d/funcool/promesa/8.0.450/doc/user-guide) library. +- Add `scittle.pprint.js` plugin. This gives access to [cljs.pprint](https://cljs.github.io/api/cljs.pprint/). +- Improve error messages + +## v0.3.9 - Upgrade to SCI 0.3.1 - Upgrade to Reagent 1.1.0 diff --git a/bb.edn b/bb.edn index 6432ee4..1ca13e0 100644 --- a/bb.edn +++ b/bb.edn @@ -50,14 +50,11 @@ (shell "git push --atomic origin main" (str "v" (:version (json/parse-string (slurp "package.json") true)))))} - npm-publish {:doc "Updates Github pages with new release build." + npm-publish {:doc "Updates NPM ibrary" :task (do (run 'dist) (run 'bump-version) (shell "npm publish"))} - gh-pages {:doc "Updates Github pages with new release build." - :task (shell "script/release.clj")} - replace-version {:doc "Ported from bash one-liners. Expects two versions. TODO: port to Clojure." :task (let [[prev next] *command-line-args*] @@ -65,4 +62,7 @@ (format "rg %s --files-with-matches | xargs sed -i '' 's/%s/%s/g'" prev prev next)] {:inherit true}) - p/check))}}} + p/check))} + + gh-pages {:doc "Updates Github pages with new release build." + :task (shell "script/release.clj")}}} diff --git a/doc/dev.md b/doc/dev.md index c32b3b0..bbcbda8 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -91,13 +91,13 @@ To create a new release: To upgrade examples: ``` -rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.2.8.1.0/g' +rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.3.9.1.0/g' bb release cd gh-pages -git checkout -b v0.2.8 -git push --set-upstream origin v0.2.8 +git checkout -b v0.3.9 +git push --set-upstream origin v0.3.9 git checkout gh-pages cd .. ``` -Then make a new release on Github with the `v0.2.8` tag. +Then make a new release on Github with the `v0.3.9` tag. diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 266765f..f6b3afe 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 1882a05..e3b7729 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 56df0fc..f5a9e3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.2.8" + "version": "0.3.9" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.2.8" + "version": "0.3.9" } diff --git a/package.json b/package.json index 79befa3..ad17e26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.2.8", + "version": "0.3.9", "files": [ "dist" ], diff --git a/resources/public/html/cljs-ajax.html b/resources/public/html/cljs-ajax.html index f5ffb9d..3005882 100644 --- a/resources/public/html/cljs-ajax.html +++ b/resources/public/html/cljs-ajax.html @@ -1,7 +1,7 @@ - - + + + + - + - + ``` 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 e3b7729..8dadbdf 100644 --- a/doc/nrepl/index.html +++ b/doc/nrepl/index.html @@ -1,9 +1,9 @@ - + - + diff --git a/resources/public/html/cljs-ajax.html b/resources/public/html/cljs-ajax.html index 3005882..38c5cda 100644 --- a/resources/public/html/cljs-ajax.html +++ b/resources/public/html/cljs-ajax.html @@ -1,7 +1,7 @@ - - + + + + - + + + + + + + +
+
+ + + From 5157f98e09a237418580750668d1a96ccdc5557f Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 12:50:35 +0200 Subject: [PATCH 018/175] codemirror example --- resources/public/{html => }/codemirror.html | 0 script/release.clj | 3 +++ 2 files changed, 3 insertions(+) rename resources/public/{html => }/codemirror.html (100%) diff --git a/resources/public/html/codemirror.html b/resources/public/codemirror.html similarity index 100% rename from resources/public/html/codemirror.html rename to resources/public/codemirror.html diff --git a/script/release.clj b/script/release.clj index 00a2396..5293fa9 100755 --- a/script/release.clj +++ b/script/release.clj @@ -21,6 +21,9 @@ (fs/copy "resources/public/disable_auto_eval.html" "gh-pages" {:replace-existing true}) +(fs/copy "resources/public/codemirror.html" "gh-pages" + {:replace-existing true}) + (def html-source-dir (fs/file "resources" "public" "html")) (def html-target-dir (fs/file "gh-pages" "html")) (fs/create-dirs html-target-dir) From 7eec6ef0aa933a4745c328cd3b6ccac518b87579 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 13:52:52 +0200 Subject: [PATCH 019/175] update codemirror page --- resources/public/codemirror.html | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index 384a425..12850f1 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,7 +1,11 @@ - - + + + + + + - - + @@ -31,28 +31,18 @@ - +
- +
+
+ From 87a74118f6f2f88f923e6e948caa09016849b426 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 14:44:19 +0200 Subject: [PATCH 021/175] codemirror --- resources/public/codemirror.cljs | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 resources/public/codemirror.cljs diff --git a/resources/public/codemirror.cljs b/resources/public/codemirror.cljs new file mode 100644 index 0000000..57a0a0e --- /dev/null +++ b/resources/public/codemirror.cljs @@ -0,0 +1,54 @@ +(require '[clojure.string :as str]) +(declare cm) + +(defn eval-me [] + (js/scittle.core.eval_string (-> cm .-state .-doc .toString))) + +(def extension + (.of js/cv.keymap + (clj->js [{:key "Mod-Enter" + :run (fn [] + (prn :hoeooo) + (eval-me))} + #_{:key (str modifier "-Enter") + :shift (partial eval-top-level on-result) + :run (partial eval-at-cursor on-result)}]))) +(def cm + (let [doc (str/trim " +(require '[reagent.core :as r] + '[reagent.dom :as rdom]) + +(defonce state (r/atom {:clicks 0})) + +(defn my-component [] + [:div + [:p \"Clicks: \" (:clicks @state)] + [:p [:button {:on-click #(swap! state update :clicks inc)} + \"Click me!\"]]]) + +(rdom/render [my-component] (.getElementById js/document \"reagent\")) +")] + (js/cm.EditorView. #js {:doc doc + :extensions #js [js/cm.basicSetup, (js/lc.clojure), (.highest js/cs.Prec extension)] + :parent (js/document.querySelector "#app") + #_#_:dispatch (fn [tr] (-> cm (.update #js [tr])) (eval-me)) + }))) +(set! (.-eval_me js/globalThis) eval-me) +(set! (.-cm_instance js/globalThis) cm) + +(defn linux? [] + (some? (re-find #"(Linux)|(X11)" js/navigator.userAgent))) + +(defn mac? [] + (and (not (linux?)) + (some? (re-find #"(Mac)|(iPhone)|(iPad)|(iPod)" js/navigator.platform)))) + +(let [elt (js/document.getElementById "evalMe") + txt (.-innerText elt) + mod-symbol (if (mac?) + "⌘" + "⌃") + txt (str txt " " mod-symbol"-⏎")] + (set! (.-innerHTML elt) txt)) + +(eval-me) From a1c4464fdc92dbfbdee0d9ead9e584415a7de0f5 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 14:46:16 +0200 Subject: [PATCH 022/175] demo --- resources/public/codemirror.html | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index ece280f..c247c4d 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -39,6 +39,7 @@ +

Using @nextjournal/lang-clojure directly from npm in HTML!

From c9741b235ee1e6127fe5a1a84de006f838ba300d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 15:28:42 +0200 Subject: [PATCH 023/175] fix codemirror --- resources/public/codemirror.cljs | 54 -------------------------------- resources/public/codemirror.html | 14 ++++++--- 2 files changed, 9 insertions(+), 59 deletions(-) delete mode 100644 resources/public/codemirror.cljs diff --git a/resources/public/codemirror.cljs b/resources/public/codemirror.cljs deleted file mode 100644 index 57a0a0e..0000000 --- a/resources/public/codemirror.cljs +++ /dev/null @@ -1,54 +0,0 @@ -(require '[clojure.string :as str]) -(declare cm) - -(defn eval-me [] - (js/scittle.core.eval_string (-> cm .-state .-doc .toString))) - -(def extension - (.of js/cv.keymap - (clj->js [{:key "Mod-Enter" - :run (fn [] - (prn :hoeooo) - (eval-me))} - #_{:key (str modifier "-Enter") - :shift (partial eval-top-level on-result) - :run (partial eval-at-cursor on-result)}]))) -(def cm - (let [doc (str/trim " -(require '[reagent.core :as r] - '[reagent.dom :as rdom]) - -(defonce state (r/atom {:clicks 0})) - -(defn my-component [] - [:div - [:p \"Clicks: \" (:clicks @state)] - [:p [:button {:on-click #(swap! state update :clicks inc)} - \"Click me!\"]]]) - -(rdom/render [my-component] (.getElementById js/document \"reagent\")) -")] - (js/cm.EditorView. #js {:doc doc - :extensions #js [js/cm.basicSetup, (js/lc.clojure), (.highest js/cs.Prec extension)] - :parent (js/document.querySelector "#app") - #_#_:dispatch (fn [tr] (-> cm (.update #js [tr])) (eval-me)) - }))) -(set! (.-eval_me js/globalThis) eval-me) -(set! (.-cm_instance js/globalThis) cm) - -(defn linux? [] - (some? (re-find #"(Linux)|(X11)" js/navigator.userAgent))) - -(defn mac? [] - (and (not (linux?)) - (some? (re-find #"(Mac)|(iPhone)|(iPad)|(iPod)" js/navigator.platform)))) - -(let [elt (js/document.getElementById "evalMe") - txt (.-innerText elt) - mod-symbol (if (mac?) - "⌘" - "⌃") - txt (str txt " " mod-symbol"-⏎")] - (set! (.-innerHTML elt) txt)) - -(eval-me) diff --git a/resources/public/codemirror.html b/resources/public/codemirror.html index c247c4d..371548e 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -29,14 +29,18 @@ } - +

Using @nextjournal/lang-clojure directly from npm in HTML!

From 83e96ceb4a75915a20dc0cb73c573b8fe5691d70 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 10 Oct 2022 15:28:51 +0200 Subject: [PATCH 024/175] fix codemirror --- resources/public/cljs/codemirror.cljs | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 resources/public/cljs/codemirror.cljs diff --git a/resources/public/cljs/codemirror.cljs b/resources/public/cljs/codemirror.cljs new file mode 100644 index 0000000..57a0a0e --- /dev/null +++ b/resources/public/cljs/codemirror.cljs @@ -0,0 +1,54 @@ +(require '[clojure.string :as str]) +(declare cm) + +(defn eval-me [] + (js/scittle.core.eval_string (-> cm .-state .-doc .toString))) + +(def extension + (.of js/cv.keymap + (clj->js [{:key "Mod-Enter" + :run (fn [] + (prn :hoeooo) + (eval-me))} + #_{:key (str modifier "-Enter") + :shift (partial eval-top-level on-result) + :run (partial eval-at-cursor on-result)}]))) +(def cm + (let [doc (str/trim " +(require '[reagent.core :as r] + '[reagent.dom :as rdom]) + +(defonce state (r/atom {:clicks 0})) + +(defn my-component [] + [:div + [:p \"Clicks: \" (:clicks @state)] + [:p [:button {:on-click #(swap! state update :clicks inc)} + \"Click me!\"]]]) + +(rdom/render [my-component] (.getElementById js/document \"reagent\")) +")] + (js/cm.EditorView. #js {:doc doc + :extensions #js [js/cm.basicSetup, (js/lc.clojure), (.highest js/cs.Prec extension)] + :parent (js/document.querySelector "#app") + #_#_:dispatch (fn [tr] (-> cm (.update #js [tr])) (eval-me)) + }))) +(set! (.-eval_me js/globalThis) eval-me) +(set! (.-cm_instance js/globalThis) cm) + +(defn linux? [] + (some? (re-find #"(Linux)|(X11)" js/navigator.userAgent))) + +(defn mac? [] + (and (not (linux?)) + (some? (re-find #"(Mac)|(iPhone)|(iPad)|(iPod)" js/navigator.platform)))) + +(let [elt (js/document.getElementById "evalMe") + txt (.-innerText elt) + mod-symbol (if (mac?) + "⌘" + "⌃") + txt (str txt " " mod-symbol"-⏎")] + (set! (.-innerHTML elt) txt)) + +(eval-me) From 12e5a33964e0dd8feba8537c62867abb3aa5e81a Mon Sep 17 00:00:00 2001 From: rgkirch <6143833+rgkirch@users.noreply.github.com> Date: Thu, 13 Oct 2022 14:47:15 -0400 Subject: [PATCH 025/175] Update README.md (#42) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4095f0..121fac6 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ babashka or Clojure JVM): ``` clojure (require '[babashka.http-server :as http]) -(http/serve {:port 1341 :dir "resoures/public"} +(http/serve {:port 1341 :dir "resoures/public"}) @(promise) ;; wait until process is killed ``` From 693d6ff8c273e0964961a0a039a353ddb2443894 Mon Sep 17 00:00:00 2001 From: Srijayanth Sridhar <131062+craftybones@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:36:03 +0530 Subject: [PATCH 026/175] Fix scittle.nrepl to honor SCITTLE_NREPL_WEBSOCKET_PORT (#45) --- CHANGELOG.md | 4 ++++ src/scittle/nrepl.cljs | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b950e81..c854b63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl` + ## v0.3.10 - Add `scittle.promesa.js` plugin. This gives access to the [promesa](https://cljdoc.org/d/funcool/promesa/8.0.450/doc/user-guide) library. diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index e7fcad2..fffa295 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -31,9 +31,12 @@ :complete (let [completions (completions (assoc msg :ctx @!sci-ctx))] (nrepl-reply msg completions)))) -(when (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window) +(defn ws-url [host port path] + (str "ws://" host ":" port "/" path)) + +(when-let [ws-port (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)] (set! (.-ws_nrepl js/window) - (new js/WebSocket "ws://localhost:1340/_nrepl"))) + (new js/WebSocket (ws-url "localhost" ws-port "_nrepl")))) (when-let [ws (nrepl-websocket)] (prn :ws ws) From b2cad51995ddeeee579bd0238ba50a337a0e25d9 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Tue, 18 Oct 2022 17:13:35 +0200 Subject: [PATCH 027/175] Bump SCI --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 154cdf5..6c87d79 100644 --- a/deps.edn +++ b/deps.edn @@ -3,7 +3,7 @@ :deps {org.clojure/clojure {:mvn/version "1.10.3"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "6bbfec0ede429fc17cb9ba51a96582b4fcd6ea69"} + :git/sha "a201fd70567437e228359999ecdca337c3060b70"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.0"} cljsjs/react {:mvn/version "17.0.2-0"} From 77561555769686236df608f55e0d0cc6936dcc04 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 9 Nov 2022 12:15:57 +0100 Subject: [PATCH 028/175] Bump sci.configs --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 6c87d79..8181e2d 100644 --- a/deps.edn +++ b/deps.edn @@ -16,7 +16,7 @@ #_{:local/root "../sci.nrepl"} {:git/sha "e83421ce9349c36df56a2eb936196dbb65b0de63"} io.github.babashka/sci.configs - {:git/sha "63225c8606d593c595d2f10a6fa5bf38103852df"}} + {:git/sha "f5f1bd84d96f6a4be93cc695861649a4a0b3e45b"}} :aliases {:dev From 0ceda6ec9fce0503ee159c580ebda4e8f8c2653d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 11:39:41 +0100 Subject: [PATCH 029/175] Add all public vars of cljs ajax core --- CHANGELOG.md | 1 + src/scittle/cljs_ajax.cljs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c854b63..22045e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl` +- Add all public vars of `cljs-ajax` `ajax.core` ## v0.3.10 diff --git a/src/scittle/cljs_ajax.cljs b/src/scittle/cljs_ajax.cljs index a129e6e..8d1df17 100644 --- a/src/scittle/cljs_ajax.cljs +++ b/src/scittle/cljs_ajax.cljs @@ -1,13 +1,12 @@ (ns scittle.cljs-ajax - (:require [ajax.core :as ajx] + (:require [ajax.core] [sci.core :as sci] [scittle.core :as scittle])) (def ans (sci/create-ns 'ajax.core nil)) (def ajax-namespace - {'GET (sci/copy-var ajx/GET ans) - 'POST (sci/copy-var ajx/POST ans)}) + (sci/copy-ns ajax.core ans)) (scittle/register-plugin! ::ajax From 2db6f44219be79da79edc32818aa51f9c5593ce7 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 11:42:45 +0100 Subject: [PATCH 030/175] Upgrade libs --- deps.edn | 22 ++++++++++++---------- resources/public/index.html | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/deps.edn b/deps.edn index 8181e2d..e1539cf 100644 --- a/deps.edn +++ b/deps.edn @@ -1,24 +1,26 @@ {:paths ["src" "resources"] :deps - {org.clojure/clojure {:mvn/version "1.10.3"} + {org.clojure/clojure {:mvn/version "1.11.1"} org.babashka/sci {:git/url "https://github.com/babashka/sci" :git/sha "a201fd70567437e228359999ecdca337c3060b70"} #_{:local/root "../babashka/sci"} - reagent/reagent {:mvn/version "1.1.0"} - cljsjs/react {:mvn/version "17.0.2-0"} - cljsjs/react-dom {:mvn/version "17.0.2-0"} - cljsjs/react-dom-server {:mvn/version "17.0.2-0"} - cljs-ajax/cljs-ajax {:mvn/version "0.8.3"} - funcool/promesa {:mvn/version "8.0.450"} + reagent/reagent {:mvn/version "1.1.1"} + cljsjs/react {:mvn/version "18.2.0-1"} + cljsjs/react-dom {:mvn/version "18.2.0-1"} + cljsjs/react-dom-server {:mvn/version "18.2.0-1"} + cljs-ajax/cljs-ajax {:mvn/version "0.8.4"} + funcool/promesa {:mvn/version "9.1.540"} io.github.babashka/sci.nrepl #_{:local/root "../sci.nrepl"} - {:git/sha "e83421ce9349c36df56a2eb936196dbb65b0de63"} + {:git/url "https://github.com/babashka/sci.nrepl" + :git/sha "b75700da7797f9fc2b4ef1bef9df7230f9fd1e8c"} io.github.babashka/sci.configs - {:git/sha "f5f1bd84d96f6a4be93cc695861649a4a0b3e45b"}} + {:git/url "https://github.com/babashka/sci.configs" + :git/sha "2717e545e5a61d4cccd85350b9ad6265afc9146c"}} :aliases {:dev {:extra-paths ["dev"] - :extra-deps {thheller/shadow-cljs {:mvn/version "2.14.0"}}}}} + :extra-deps {thheller/shadow-cljs {:mvn/version "2.20.12"}}}}} diff --git a/resources/public/index.html b/resources/public/index.html index 6ac811d..0933342 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -3,8 +3,8 @@ - - + + From b10afa88acbba190d784d5a803f49dc7db3192b1 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 11:43:21 +0100 Subject: [PATCH 031/175] Upgrade libs --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22045e8..d898031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl` - Add all public vars of `cljs-ajax` `ajax.core` +- Upgrade several built-in libraries ## v0.3.10 From 623e9707bdfe0840dcec912bbdb5f3c75c14e910 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 12:48:34 +0100 Subject: [PATCH 032/175] Upgrade SCI --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index e1539cf..3428f7a 100644 --- a/deps.edn +++ b/deps.edn @@ -3,7 +3,7 @@ :deps {org.clojure/clojure {:mvn/version "1.11.1"} org.babashka/sci {:git/url "https://github.com/babashka/sci" - :git/sha "a201fd70567437e228359999ecdca337c3060b70"} + :git/sha "914919f248b7e3fc2ec59c435320145f588899d0"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} cljsjs/react {:mvn/version "18.2.0-1"} From ec81500dcb432fbe91e5224892404cf492b0c51c Mon Sep 17 00:00:00 2001 From: Brandon Olivier Date: Wed, 23 Nov 2022 05:51:49 -0600 Subject: [PATCH 033/175] Add support for re-frame (#46) * Bump sci.configs for re-frame * Update changelog Co-authored-by: Michiel Borkent --- CHANGELOG.md | 3 +++ deps.edn | 3 +-- shadow-cljs.edn | 2 ++ src/scittle/re_frame.cljs | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/scittle/re_frame.cljs diff --git a/CHANGELOG.md b/CHANGELOG.md index d898031..04487bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- Add `scittle.re-frame` plugin. This gives access to the + [re-frame](https://github.com/day8/re-frame) library. + - Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl` - Add all public vars of `cljs-ajax` `ajax.core` - Upgrade several built-in libraries diff --git a/deps.edn b/deps.edn index 3428f7a..ce94ba6 100644 --- a/deps.edn +++ b/deps.edn @@ -6,12 +6,12 @@ :git/sha "914919f248b7e3fc2ec59c435320145f588899d0"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} + 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"} cljsjs/react-dom-server {:mvn/version "18.2.0-1"} cljs-ajax/cljs-ajax {:mvn/version "0.8.4"} funcool/promesa {:mvn/version "9.1.540"} - io.github.babashka/sci.nrepl #_{:local/root "../sci.nrepl"} {:git/url "https://github.com/babashka/sci.nrepl" @@ -19,7 +19,6 @@ io.github.babashka/sci.configs {:git/url "https://github.com/babashka/sci.configs" :git/sha "2717e545e5a61d4cccd85350b9ad6265afc9146c"}} - :aliases {:dev {:extra-paths ["dev"] diff --git a/shadow-cljs.edn b/shadow-cljs.edn index df491cd..29bd674 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -18,6 +18,8 @@ :depends-on #{:scittle}} :scittle.promesa {:entries [scittle.promesa] :depends-on #{:scittle}} + :scittle.re-frame {:entries [scittle.re-frame] + :depends-on #{:scittle}} :scittle.pprint {:entries [scittle.pprint] :depends-on #{:scittle}} :scittle.reagent {:entries [scittle.reagent] diff --git a/src/scittle/re_frame.cljs b/src/scittle/re_frame.cljs new file mode 100644 index 0000000..39e219e --- /dev/null +++ b/src/scittle/re_frame.cljs @@ -0,0 +1,8 @@ +(ns scittle.re-frame + (:require + [sci.configs.re-frame.re-frame :as rf] + [scittle.core :as scittle])) + +(scittle/register-plugin! + ::re-frame + rf/config) From 39ffad78998f78eea946df87cc5bc49ec5493983 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 13:23:35 +0100 Subject: [PATCH 034/175] re-frame tweaks --- CHANGELOG.md | 1 - resources/public/index.html | 22 +++++++++++++++++++++- shadow-cljs.edn | 5 +++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04487bb..c23c5fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ - Add `scittle.re-frame` plugin. This gives access to the [re-frame](https://github.com/day8/re-frame) library. - - Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl` - Add all public vars of `cljs-ajax` `ajax.core` - Upgrade several built-in libraries diff --git a/resources/public/index.html b/resources/public/index.html index 0933342..e3f4950 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -6,6 +6,7 @@ + @@ -20,14 +21,26 @@ (def state (r/atom {:clicks 0})) + #_(require '[re-frame.core :as rf] + '[reagent.dom :as rdom]) + #_(rf/reg-event-fx ::click (fn [{:keys [db]} [_]] {:db (update db :clicks (fnil inc 0))})) + #_(rf/reg-sub ::clicks (fn [db _] (:clicks db))) + (defn my-component [] [:div [:p "Clicks: " (:clicks @state)] - [:p [:button {:on-click #(swap! state update :clicks inc)} + [:p [:button {:on-click #(do (swap! state update :clicks inc) + #_(rf/dispatch [::click]))} "Click me!"]]]) + #_(defn re-frame-component [] + (let [clicks (rf/subscribe [::clicks])] + [:div "Clicks:" @clicks])) + (rdom/render [my-component] (.getElementById js/document "app")) + #_(rdom/render [re-frame-component] (.getElementById js/document "re-frame")) + (require '[ajax.core :refer [GET]]) (defn handler [response] @@ -108,6 +121,13 @@
+ + +

Re-frame plugin

+ + To enable reagent, + in addition to the files needed for reagent, you need to include scittle.re-frame.js. +

Cljs-ajax plugin

diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 29bd674..47e5deb 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -18,12 +18,13 @@ :depends-on #{:scittle}} :scittle.promesa {:entries [scittle.promesa] :depends-on #{:scittle}} - :scittle.re-frame {:entries [scittle.re-frame] - :depends-on #{:scittle}} :scittle.pprint {:entries [scittle.pprint] :depends-on #{:scittle}} :scittle.reagent {:entries [scittle.reagent] :depends-on #{:scittle}} + :scittle.re-frame {:entries [scittle.re-frame] + :depends-on #{:scittle.reagent + :scittle}} :scittle.cljs-ajax {:entries [scittle.cljs-ajax] :depends-on #{:scittle}}} :build-hooks [(shadow.cljs.build-report/hook)] From 98b904c8194f31a0475359d33c91774d87110506 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 13:26:10 +0100 Subject: [PATCH 035/175] Prepare npm publish --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c23c5fd..3c90264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## v0.4.11 (2022-11-23) - Add `scittle.re-frame` plugin. This gives access to the [re-frame](https://github.com/day8/re-frame) library. diff --git a/package.json b/package.json index 029a24e..5761608 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.3.10", + "version": "0.4.10", "files": [ "dist" ], From e75a1ad6efea243d3c91f21f6101579eb78289d8 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 13:26:34 +0100 Subject: [PATCH 036/175] 0.4.11 --- 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 5ba0177..932ce97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.3.10" + "version": "0.4.11" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.3.10" + "version": "0.4.11" } diff --git a/package.json b/package.json index 5761608..9e18f16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.4.10", + "version": "0.4.11", "files": [ "dist" ], From fe0efbc70517921d7e927e0bca925b7689aca9aa Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Nov 2022 13:27:49 +0100 Subject: [PATCH 037/175] Update versions --- CHANGELOG.md | 2 +- doc/dev.md | 8 ++++---- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- resources/public/codemirror.html | 4 ++-- 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, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c90264..452c604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Add all public vars of `cljs-ajax` `ajax.core` - Upgrade several built-in libraries -## v0.3.10 +## v0.4.11 - Add `scittle.promesa.js` plugin. This gives access to the [promesa](https://cljdoc.org/d/funcool/promesa/8.0.450/doc/user-guide) library. - Add `scittle.pprint.js` plugin. This gives access to [cljs.pprint](https://cljs.github.io/api/cljs.pprint/). diff --git a/doc/dev.md b/doc/dev.md index aaf0321..cce91f6 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -91,13 +91,13 @@ To create a new release: To upgrade examples: ``` -rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.3.10.1.0/g' +rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.4.11.1.0/g' bb release cd gh-pages -git checkout -b v0.3.10 -git push --set-upstream origin v0.3.10 +git checkout -b v0.4.11 +git push --set-upstream origin v0.4.11 git checkout gh-pages cd .. ``` -Then make a new release on Github with the `v0.3.10` tag. +Then make a new release on Github with the `v0.4.11` tag. diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index d2a474c..2f08b4b 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 8dadbdf..b2ed06b 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 371548e..ba668c7 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,11 +1,11 @@ - + - + - + + + + - + - - + + + + + + + + + + + + + + + +

Using @nextjournal/lang-clojure directly from npm in HTML!

+
+
+
+
+ + + From 638efa590b9dfe20c778eed6a0a6cce5d992cd6c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 22 Dec 2022 21:18:20 +0100 Subject: [PATCH 046/175] Prep release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e18f16..3523c39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.4.11", + "version": "0.5.11", "files": [ "dist" ], From 7517e1afc5190c16be5fabd746ce27e288e83480 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 22 Dec 2022 21:21:10 +0100 Subject: [PATCH 047/175] Prep release --- doc/dev.md | 5 ++++- shadow-cljs.edn | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index cce91f6..f2110a1 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -86,7 +86,10 @@ To deploy to Github Pages: script/release.clj ``` -To create a new release: +To create a new NPM release: + +- Prepare minor version in `package.json` if it should be bumped +- Run `bb npm-publish` To upgrade examples: diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 47e5deb..fb2191e 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -18,7 +18,7 @@ :depends-on #{:scittle}} :scittle.promesa {:entries [scittle.promesa] :depends-on #{:scittle}} - :scittle.pprint {:entries [scittle.pprint] + :scittle.pprint {:entries [cljs.pprint] :depends-on #{:scittle}} :scittle.reagent {:entries [scittle.reagent] :depends-on #{:scittle}} From ade3c6e111cb167e0852baf39de77a0df8d139ae Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 22 Dec 2022 21:21:40 +0100 Subject: [PATCH 048/175] 0.5.12 --- 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 932ce97..bdcac4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.4.11" + "version": "0.5.12" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.4.11" + "version": "0.5.12" } diff --git a/package.json b/package.json index 3523c39..512fb98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.5.11", + "version": "0.5.12", "files": [ "dist" ], From 25feaf2641b3d497f4790e32654794e7358feb53 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 22 Dec 2022 21:26:47 +0100 Subject: [PATCH 049/175] Update versions --- CHANGELOG.md | 2 +- bb.edn | 5 ++++- doc/dev.md | 12 +++++++----- doc/nrepl/README.md | 2 +- doc/nrepl/index.html | 4 ++-- resources/public/codemirror.html | 6 +++--- 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, 24 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cd473..ef37f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ - Add all public vars of `cljs-ajax` `ajax.core` - Upgrade several built-in libraries -## v0.4.11 +## v0.5.12 - Add `scittle.promesa.js` plugin. This gives access to the [promesa](https://cljdoc.org/d/funcool/promesa/8.0.450/doc/user-guide) library. - Add `scittle.pprint.js` plugin. This gives access to [cljs.pprint](https://cljs.github.io/api/cljs.pprint/). diff --git a/bb.edn b/bb.edn index 1ca13e0..80f7d0a 100644 --- a/bb.edn +++ b/bb.edn @@ -55,7 +55,10 @@ (run 'bump-version) (shell "npm publish"))} - replace-version {:doc "Ported from bash one-liners. Expects two versions. TODO: port to Clojure." + replace-version {:doc "Ported from bash one-liners. Expects two versions. + TODO: port to Clojure. + TODO: skip changelog.md + " :task (let [[prev next] *command-line-args*] (-> (process ["bash" "-c" diff --git a/doc/dev.md b/doc/dev.md index f2110a1..a691ff2 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -89,18 +89,20 @@ script/release.clj To create a new NPM release: - Prepare minor version in `package.json` if it should be bumped -- Run `bb npm-publish` +- Run `bb npm-publish`: this will compile, bump minor version, create tag and and push to npm and Github +- Create Github release with updated links + To upgrade examples: ``` -rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.4.11.1.0/g' +rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.5.12.1.0/g' bb release cd gh-pages -git checkout -b v0.4.11 -git push --set-upstream origin v0.4.11 +git checkout -b v0.5.12 +git push --set-upstream origin v0.5.12 git checkout gh-pages cd .. ``` -Then make a new release on Github with the `v0.4.11` tag. +Then make a new release on Github with the `v0.5.12` tag. diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 2f08b4b..798f2ee 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 b2ed06b..c7ea1c7 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 0fdbdc5..64352f5 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,12 +1,12 @@ - + - - + + - + + + + - + + - + ``` 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 c7ea1c7..8efda9d 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 64352f5..2528a83 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,12 +1,12 @@ - + - - + + - + + + + - + - + ``` 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 8efda9d..2c16bd2 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 2528a83..5d0f1a7 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,12 +1,12 @@ - + - - + + - + + + + - + + + + + + + diff --git a/plugins/demo/shadow-cljs.edn b/plugins/demo/shadow-cljs.edn new file mode 100644 index 0000000..47e5deb --- /dev/null +++ b/plugins/demo/shadow-cljs.edn @@ -0,0 +1,32 @@ +{:deps + {:aliases [:dev]} + + :dev-http + {8000 "classpath:public"} + + :builds + {:main + {:target :browser + :js-options + {:resolve {"react" {:target :global + :global "React"} + "react-dom" {:target :global + :global "ReactDOM"}}} + :modules + {:scittle {:entries [scittle.core]} + :scittle.nrepl {:entries [scittle.nrepl] + :depends-on #{:scittle}} + :scittle.promesa {:entries [scittle.promesa] + :depends-on #{:scittle}} + :scittle.pprint {:entries [scittle.pprint] + :depends-on #{:scittle}} + :scittle.reagent {:entries [scittle.reagent] + :depends-on #{:scittle}} + :scittle.re-frame {:entries [scittle.re-frame] + :depends-on #{:scittle.reagent + :scittle}} + :scittle.cljs-ajax {:entries [scittle.cljs-ajax] + :depends-on #{:scittle}}} + :build-hooks [(shadow.cljs.build-report/hook)] + :output-dir "resources/public/js" + :devtools {:repl-pprint true}}}} From d6d5d48e44f91e5c60eb16d477f39fbd27d6545b Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 3 May 2023 21:40:52 +0200 Subject: [PATCH 069/175] plugins --- plugins/demo/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/demo/README.md b/plugins/demo/README.md index e9f58eb..bc6162b 100644 --- a/plugins/demo/README.md +++ b/plugins/demo/README.md @@ -2,6 +2,8 @@ A demo project of a custom scittle build. +To produce release `.js` files, run: `bb release`. + See: - `bb.edn` with From 0e15d9de79fd3ef97bdc4c5a32def527cd583a6c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 3 May 2023 21:42:24 +0200 Subject: [PATCH 070/175] docs --- plugins/demo/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/demo/README.md b/plugins/demo/README.md index bc6162b..f6141ab 100644 --- a/plugins/demo/README.md +++ b/plugins/demo/README.md @@ -1,6 +1,7 @@ # Demo A demo project of a custom scittle build. +This demo project uses the `scittle.datascript` plugin which isn't part of the normal scittle distribution. To produce release `.js` files, run: `bb release`. From b2879447efb0cb8939cf5bb9bfb170e4c8a6301c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 3 May 2023 21:42:41 +0200 Subject: [PATCH 071/175] doc --- plugins/demo/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/demo/README.md b/plugins/demo/README.md index f6141ab..9a4e3a1 100644 --- a/plugins/demo/README.md +++ b/plugins/demo/README.md @@ -1,6 +1,7 @@ # Demo A demo project of a custom scittle build. + This demo project uses the `scittle.datascript` plugin which isn't part of the normal scittle distribution. To produce release `.js` files, run: `bb release`. From 2c9f2b4c526af256d47b7b970bd65a282c62fe1c Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 3 May 2023 21:46:24 +0200 Subject: [PATCH 072/175] docs --- plugins/demo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/demo/README.md b/plugins/demo/README.md index 9a4e3a1..07fe38b 100644 --- a/plugins/demo/README.md +++ b/plugins/demo/README.md @@ -20,7 +20,7 @@ Available plugins are in the `plugins` directory inside the top level directory Writing a plugin involves writing -- SCI configuration (this can be shared with users in the [sci.configs](https://github.com/babashka/sci.configs) project +- SCI configuration (this can be shared via the [sci.configs](https://github.com/babashka/sci.configs) project too) - Adding a `scittle_plugin.edn` file on the plugin's classpath (e.g. in the `src` directory). This EDN file contains: - `:name`, name of the plugin - `:namespaces`: the namespaces exposed to SCI From cd4ac5c74eb20c78c43a125d560e94a98a6175a7 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 3 May 2023 22:24:34 +0200 Subject: [PATCH 073/175] minor --- plugins/demo/bb.edn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/demo/bb.edn b/plugins/demo/bb.edn index 516f478..bbf3388 100644 --- a/plugins/demo/bb.edn +++ b/plugins/demo/bb.edn @@ -11,8 +11,7 @@ :requires ([babashka.http-server :as http]) :task (do (http/serve {:port 1341 :dir "resources/public"}) (println "Serving static assets at http://localhost:1341"))} - -dev {:depends [watch serve] - :parallel true} + -dev {:depends [watch serve]} dev {:doc "Run compilation in watch mode and start http server" :task (do (run '-dev {:parallel true}) (deref (promise)))} From 5369c65bf43937ecd44b2f5272d40ef13ee2d66b Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 4 May 2023 17:00:13 +0200 Subject: [PATCH 074/175] changelog --- CHANGELOG.md | 7 ++++--- deps.edn | 2 +- script/changelog.clj | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 script/changelog.clj diff --git a/CHANGELOG.md b/CHANGELOG.md index ccfd16a..3a9d09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ ## Unreleased -- Use `window.location.hostname` for WebSocket connection -- Upgrade sci configs to `20f08f18` -- Update nrepl implementation, implement `eldoc` (`info`, `lookuup`) +- #58: build system for creating scittle distribution with custom libraries. See [plugins/demo](plugins/demo). +- Use `window.location.hostname` for WebSocket connection instead of hardcoding `"localhost"` ([@pyrmont](https://github.com/pyrmont)) +- Upgrade `sci.configs` to `"33bd51e53700b224b4cb5bda59eb21b62f962745"` +- Update nREPL implementation: implement `eldoc` (`info`, `lookup`) ([@benjamin-asdf](https://github.com/benjamin-asdf)) ## v0.5.14 (2023-01-05) diff --git a/deps.edn b/deps.edn index ec562ba..31be32c 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 "a85c488ee45700bcbe67bc01ab1c27407fff7887"} + :git/sha "7c59b7f6dcb192d9f43e8bc3106ec3c3110d7b13"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} re-frame/re-frame {:mvn/version "1.3.0"} diff --git a/script/changelog.clj b/script/changelog.clj new file mode 100755 index 0000000..f7810c6 --- /dev/null +++ b/script/changelog.clj @@ -0,0 +1,17 @@ +#!/usr/bin/env bb + +(ns changelog + (:require [clojure.string :as str])) + +(let [changelog (slurp "CHANGELOG.md") + replaced (str/replace changelog + #" #(\d+)" + (fn [[_ issue after]] + (format " [#%s](https://github.com/babashka/babashka/issues/%s)%s" + issue issue (str after)))) + replaced (str/replace replaced + #"@([a-zA-Z0-9-_]+)([, \.)])" + (fn [[_ name after]] + (format "[@%s](https://github.com/%s)%s" + name name after)))] + (spit "CHANGELOG.md" replaced)) From 0270b989f0cc89f60ae8ba6efa50f1e359f62781 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 4 May 2023 17:01:27 +0200 Subject: [PATCH 075/175] prepare version --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9d09d..8c49f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ [Scittle](https://github.com/babashka/scittle): execute Clojure(Script) directly from browser script tags via SCI! -## Unreleased +## v0.6.15 (2023-05-04) - #58: build system for creating scittle distribution with custom libraries. See [plugins/demo](plugins/demo). - Use `window.location.hostname` for WebSocket connection instead of hardcoding `"localhost"` ([@pyrmont](https://github.com/pyrmont)) diff --git a/package.json b/package.json index 89fda6b..ce5aad5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.5.14", + "version": "0.6.14", "files": [ "dist" ], From 923ac92b614e607906c12eff8c0fffacfee46bdf Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 4 May 2023 17:02:35 +0200 Subject: [PATCH 076/175] remove optional module --- bb.edn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bb.edn b/bb.edn index f355484..9f3560b 100644 --- a/bb.edn +++ b/bb.edn @@ -4,8 +4,7 @@ io.github.babashka/http-server {:git/sha "b38c1f16ad2c618adae2c3b102a5520c261a7dd3"} io.github.scittle/build - {:local/root "build"} - io.github.babashka/scittle.datascript {:local/root "plugins/datascript"}} + {:local/root "build"}} :tasks {:requires ([scittle.build :as build] From 725c9934d06848ec52dcfe73af6709c17761b7d9 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 4 May 2023 17:03:00 +0200 Subject: [PATCH 077/175] 0.6.15 --- 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 5018e65..324520a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "react": "17.0.1", "react-dom": "17.0.1" }, - "version": "0.5.14" + "version": "0.6.15" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.5.14" + "version": "0.6.15" } diff --git a/package.json b/package.json index ce5aad5..ecc2230 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.6.14", + "version": "0.6.15", "files": [ "dist" ], From a270f19c10e4b0e2c5d017b2da00b62a31ed4eb5 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 4 May 2023 17:05:54 +0200 Subject: [PATCH 078/175] bump example version --- 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 | 6 +++--- 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, 25 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c49f78..7fd7284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - Upgrade `sci.configs` to `"33bd51e53700b224b4cb5bda59eb21b62f962745"` - Update nREPL implementation: implement `eldoc` (`info`, `lookup`) ([@benjamin-asdf](https://github.com/benjamin-asdf)) -## v0.5.14 (2023-01-05) +## v0.6.15 (2023-01-05) - Fix destructuring in `defmethod` (by upgrading SCI) diff --git a/doc/dev.md b/doc/dev.md index 09d3346..df10d56 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.4.11 0.5.14` +- `bb replace-version 0.4.11 0.6.15` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` To upgrade examples: ``` -rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.5.14.1.0/g' +rg '0.0.1' --files-with-matches | xargs sed -i '' 's/0.0.6.15.1.0/g' bb release cd gh-pages -git checkout -b v0.5.14 -git push --set-upstream origin v0.5.14 +git checkout -b v0.6.15 +git push --set-upstream origin v0.6.15 git checkout gh-pages cd .. ``` -Then make a new release on Github with the `v0.5.14` tag. +Then make a new release on Github with the `v0.6.15` tag. diff --git a/doc/links.md b/doc/links.md index 33575c4..fcc3ca8 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,7 +1,7 @@ -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.5.14/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.nrepl.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 9ff7f08..7e7eab2 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 2c16bd2..e6d6552 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 5d0f1a7..e484fb1 100644 --- a/resources/public/codemirror.html +++ b/resources/public/codemirror.html @@ -1,12 +1,12 @@ - + - - + + - + + + + - + + + - + + +

Hello Hoplon!

diff --git a/plugins/hoplon/deps.edn b/plugins/hoplon/deps.edn new file mode 100644 index 0000000..e7aef52 --- /dev/null +++ b/plugins/hoplon/deps.edn @@ -0,0 +1,3 @@ +{:deps + {hoplon/hoplon {:mvn/version "7.5.0"} + io.github.babashka/sci.configs {:git/sha "08bab21643bc0c63a5b99c65193c9d24888270b7"}}} diff --git a/plugins/hoplon/src/scittle/hoplon.cljs b/plugins/hoplon/src/scittle/hoplon.cljs new file mode 100644 index 0000000..46e5a3b --- /dev/null +++ b/plugins/hoplon/src/scittle/hoplon.cljs @@ -0,0 +1,9 @@ +(ns scittle.hoplon + {:no-doc true} + (:require [sci.configs.hoplon.hoplon :refer [config]] + [scittle.core :as scittle])) + +(defn init [] + (scittle/register-plugin! + ::hoplon + config)) diff --git a/plugins/hoplon/src/scittle/javelin.cljs b/plugins/hoplon/src/scittle/javelin.cljs new file mode 100644 index 0000000..7334a2d --- /dev/null +++ b/plugins/hoplon/src/scittle/javelin.cljs @@ -0,0 +1,9 @@ +(ns scittle.javelin + {:no-doc true} + (:require [sci.configs.hoplon.javelin :refer [config]] + [scittle.core :as scittle])) + +(defn init [] + (scittle/register-plugin! + ::javelin + config)) diff --git a/plugins/hoplon/src/scittle_plugin.edn b/plugins/hoplon/src/scittle_plugin.edn new file mode 100644 index 0000000..5a9f8f6 --- /dev/null +++ b/plugins/hoplon/src/scittle_plugin.edn @@ -0,0 +1,13 @@ +[{:name scittle/hoplon + :namespaces [javelin.core + hoplon.core + hoplon.dom] + :js "./scittle.hoplon.js" + :shadow-config + {:modules + {:scittle.hoplon {:init-fn scittle.hoplon/init + :depends-on #{:scittle :scittle.javelin} + :entries [hoplon.core hoplon.dom]} + :scittle.javelin {:init-fn scittle.javelin/init + :depends-on #{:scittle} + :entries [javelin.core]}}}}] diff --git a/plugins/javelin/deps.edn b/plugins/javelin/deps.edn new file mode 100644 index 0000000..135f602 --- /dev/null +++ b/plugins/javelin/deps.edn @@ -0,0 +1,3 @@ +{:deps + {hoplon/javelin {:mvn/version "3.9.3"} + io.github.babashka/sci.configs {:git/sha "08bab21643bc0c63a5b99c65193c9d24888270b7"}}} diff --git a/plugins/javelin/src/scittle/javelin.cljs b/plugins/javelin/src/scittle/javelin.cljs new file mode 100644 index 0000000..7334a2d --- /dev/null +++ b/plugins/javelin/src/scittle/javelin.cljs @@ -0,0 +1,9 @@ +(ns scittle.javelin + {:no-doc true} + (:require [sci.configs.hoplon.javelin :refer [config]] + [scittle.core :as scittle])) + +(defn init [] + (scittle/register-plugin! + ::javelin + config)) diff --git a/plugins/javelin/src/scittle_plugin.edn b/plugins/javelin/src/scittle_plugin.edn new file mode 100644 index 0000000..c34873f --- /dev/null +++ b/plugins/javelin/src/scittle_plugin.edn @@ -0,0 +1,8 @@ +[{:name scittle/javelin + :namespaces [javelin.core] + :js "./scittle.javelin.js" + :shadow-config + {:modules + {:scittle.javelin {:init-fn scittle.javelin/init + :depends-on #{:scittle} + :entries [javelin.core]}}}}] diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index e474380..948e0d1 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -4,6 +4,7 @@ [goog.object :as gobject] [goog.string] [sci.core :as sci] + [sci.ctx-store :as store] [sci.impl.unrestrict] [scittle.impl.common :refer [cljns]] [scittle.impl.error :as error] @@ -45,12 +46,12 @@ 'sci.core {'stacktrace sci/stacktrace 'format-stacktrace sci/format-stacktrace}}) -(def !sci-ctx - (atom (sci/init {:namespaces namespaces - :classes {'js js/globalThis - :allow :all - 'Math js/Math} - :ns-aliases {'clojure.pprint 'cljs.pprint}}))) +(store/reset-ctx! + (sci/init {:namespaces namespaces + :classes {'js js/globalThis + :allow :all + 'Math js/Math} + :ns-aliases {'clojure.pprint 'cljs.pprint}})) (def !last-ns (volatile! @sci/ns)) @@ -58,21 +59,21 @@ (sci/binding [sci/ns @!last-ns] (let [rdr (sci/reader s)] (loop [res nil] - (let [form (sci/parse-next @!sci-ctx rdr)] + (let [form (sci/parse-next (store/get-ctx) rdr)] (if (= :sci.core/eof form) (do (vreset! !last-ns @sci/ns) res) - (recur (sci/eval-form @!sci-ctx form)))))))) + (recur (sci/eval-form (store/get-ctx) form)))))))) (defn ^:export eval-string [s] (try (-eval-string s) (catch :default e - (error/error-handler e (:src @!sci-ctx)) + (error/error-handler e (:src (store/get-ctx))) (throw e)))) (defn register-plugin! [_plug-in-name sci-opts] - (swap! !sci-ctx sci/merge-opts sci-opts)) + (store/swap-ctx! sci/merge-opts sci-opts)) (defn- eval-script-tags* [script-tags] (when-let [tag (first script-tags)] @@ -84,7 +85,7 @@ (let [response (gobject/get this "response")] (gobject/set tag "scittle_id" src) ;; save source for error messages - (swap! !sci-ctx assoc-in [:src src] response) + (store/swap-ctx! assoc-in [:src src] response) (sci/binding [sci/file src] (eval-string response))) (eval-script-tags* (rest script-tags)))))] @@ -92,7 +93,7 @@ (if-let [text (not-empty (str/trim (gobject/get tag "textContent")))] (let [scittle-id (str (gensym "scittle-tag-"))] (gobject/set tag "scittle_id" scittle-id) - (swap! !sci-ctx assoc-in [:src scittle-id] text) + (store/swap-ctx! assoc-in [:src scittle-id] text) (sci/binding [sci/file scittle-id] (eval-string text)) (eval-script-tags* (rest script-tags))) diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index d96ed6b..d4a8463 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -1,9 +1,10 @@ (ns scittle.nrepl (:require [clojure.edn :as edn] + [sci.ctx-store :as store] [sci.nrepl.completions :refer [completions]] [sci.nrepl.info :refer [info]] - [scittle.core :refer [!last-ns eval-string !sci-ctx]])) + [scittle.core :refer [!last-ns eval-string]])) (defn nrepl-websocket [] (.-ws_nrepl js/window)) @@ -29,7 +30,7 @@ :status ["error" "done"]}))))) (defn handle-nrepl-info [msg] - (let [info (info (assoc msg :ctx @!sci-ctx))] + (let [info (info (assoc msg :ctx (store/get-ctx)))] (nrepl-reply msg info))) (declare ops) @@ -61,13 +62,13 @@ :eldoc handle-nrepl-info :lookup handle-nrepl-info :describe handle-describe - :complete (fn [msg] (let [completions (completions (assoc msg :ctx @!sci-ctx))] + :complete (fn [msg] (let [completions (completions (assoc msg :ctx (store/get-ctx)))] (nrepl-reply msg completions)))}) (defn handle-nrepl-message [msg] (if-let [handler (ops (:op msg))] (handler msg) - (nrepl-reply (merge msg {:status ["error" "done"] :err "unkown-op"}) (assoc msg :ctx @!sci-ctx)))) + (nrepl-reply (merge msg {:status ["error" "done"] :err "unkown-op"}) (assoc msg :ctx (store/get-ctx))))) (defn ws-url [host port path] (str "ws://" host ":" port "/" path)) From 9791c281e32bc11029ac6c99418045fba355596f Mon Sep 17 00:00:00 2001 From: Alan Dipert Date: Mon, 20 Nov 2023 11:00:58 -0800 Subject: [PATCH 089/175] Update README.md (#74) --- plugins/demo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/demo/README.md b/plugins/demo/README.md index 07fe38b..7bd15f8 100644 --- a/plugins/demo/README.md +++ b/plugins/demo/README.md @@ -2,7 +2,7 @@ A demo project of a custom scittle build. -This demo project uses the `scittle.datascript` plugin which isn't part of the normal scittle distribution. +This demo project uses the `scittle.javelin` and `scittle.hoplon` plugins which aren't part of the normal scittle distribution. To produce release `.js` files, run: `bb release`. From 719de6242327623dcbf1a2a902c777a9d5054b82 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 22 Dec 2023 14:07:03 +0100 Subject: [PATCH 090/175] Avoid EDN read error in scittle nREPL --- src/scittle/nrepl.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index d4a8463..7a8041f 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -13,7 +13,8 @@ (.send (nrepl-websocket) (str (let [ns (or ns (str @!last-ns))] - (assoc payload :id id :session session :ns ns))))) + (-> (assoc payload :id id :session session :ns ns) + (dissoc :ctx)))))) (defn handle-nrepl-eval [{:keys [code] :as msg}] (let [[kind val] (try [::success (eval-string code)] @@ -68,7 +69,7 @@ (defn handle-nrepl-message [msg] (if-let [handler (ops (:op msg))] (handler msg) - (nrepl-reply (merge msg {:status ["error" "done"] :err "unkown-op"}) (assoc msg :ctx (store/get-ctx))))) + (nrepl-reply (merge msg {:status ["error" "done"] :err "unkown-op"}) msg))) (defn ws-url [host port path] (str "ws://" host ":" port "/" path)) From e83a1baa793e5be6e4ef75b6f183d9291e6691fe Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 22 Dec 2023 14:18:43 +0100 Subject: [PATCH 091/175] swap args --- src/scittle/nrepl.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scittle/nrepl.cljs b/src/scittle/nrepl.cljs index 7a8041f..53f4756 100644 --- a/src/scittle/nrepl.cljs +++ b/src/scittle/nrepl.cljs @@ -69,7 +69,7 @@ (defn handle-nrepl-message [msg] (if-let [handler (ops (:op msg))] (handler msg) - (nrepl-reply (merge msg {:status ["error" "done"] :err "unkown-op"}) msg))) + (nrepl-reply msg (merge msg {:status ["error" "done"] :err "unkown-op"})))) (defn ws-url [host port path] (str "ws://" host ":" port "/" path)) From 2d4782702c6073a237df0ebad668f029fcb0d5f9 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 22 Apr 2024 14:19:07 +0200 Subject: [PATCH 092/175] Fix #75: support reader conditionals in source code (#76) --- CHANGELOG.md | 1 + deps.edn | 2 +- resources/public/cljs/codemirror.cljs | 1 - src/scittle/core.cljs | 3 ++- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6e971f..99d7be9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#69](https://github.com/babashka/babashka/issues/69): executing script tag with src + whitespace doesn't work - [#72](https://github.com/babashka/babashka/issues/72): add clojure 1.11 functions like `update-vals` +- #75: Support reader conditionals in source code ## v0.6.15 (2023-05-04) diff --git a/deps.edn b/deps.edn index 54fd4b6..3717b68 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 "3e4689f5163c825ba6fd3085d08b0f95eee00c40"} + :git/sha "bf6a0f1e00313a902c62c59e440266612725b926"} #_{:local/root "../babashka/sci"} reagent/reagent {:mvn/version "1.1.1"} re-frame/re-frame {:mvn/version "1.3.0"} diff --git a/resources/public/cljs/codemirror.cljs b/resources/public/cljs/codemirror.cljs index 25e727b..db28746 100644 --- a/resources/public/cljs/codemirror.cljs +++ b/resources/public/cljs/codemirror.cljs @@ -8,7 +8,6 @@ (.of js/cv.keymap (clj->js [{:key "Mod-Enter" :run (fn [] - (prn :hoeooo) (eval-me))} #_{:key (str modifier "-Enter") :shift (partial eval-top-level on-result) diff --git a/src/scittle/core.cljs b/src/scittle/core.cljs index 948e0d1..a96111d 100644 --- a/src/scittle/core.cljs +++ b/src/scittle/core.cljs @@ -51,7 +51,8 @@ :classes {'js js/globalThis :allow :all 'Math js/Math} - :ns-aliases {'clojure.pprint 'cljs.pprint}})) + :ns-aliases {'clojure.pprint 'cljs.pprint} + :features #{:scittle :cljs}})) (def !last-ns (volatile! @sci/ns)) From d427054a86a7985c5a345776a1b73009e019ed41 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 22 Apr 2024 14:20:25 +0200 Subject: [PATCH 093/175] Bump sci.configs --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 3717b68..7576aec 100644 --- a/deps.edn +++ b/deps.edn @@ -19,7 +19,7 @@ io.github.babashka/sci.configs #_{:local/root "/Users/borkdude/dev/sci.configs"} {:git/url "https://github.com/babashka/sci.configs" - :git/sha "08bab21643bc0c63a5b99c65193c9d24888270b7"}} + :git/sha "ffa88d796a3a2fe0a0fce332c6bf56f36b7c5cd7"}} :aliases {:dev {:extra-paths ["dev"] From 1748d7d3b17f6b6fb7713d8cfba190bdda4c7a6d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 22 Apr 2024 14:24:28 +0200 Subject: [PATCH 094/175] 0.6.16 --- 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 324520a..001e104 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.15" + "version": "0.6.16" }, "node_modules/js-tokens": { "version": "4.0.0", @@ -129,5 +129,5 @@ } } }, - "version": "0.6.15" + "version": "0.6.16" } diff --git a/package.json b/package.json index ecc2230..3991b3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scittle", - "version": "0.6.15", + "version": "0.6.16", "files": [ "dist" ], From fcc1d1b843f2e45ea3d96e6220182cda5e8542dd Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Mon, 22 Apr 2024 14:25:26 +0200 Subject: [PATCH 095/175] Bump version --- CHANGELOG.md | 4 ++-- 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, 27 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99d7be9..7ebc3c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,14 @@ - [#72](https://github.com/babashka/babashka/issues/72): add clojure 1.11 functions like `update-vals` - #75: Support reader conditionals in source code -## v0.6.15 (2023-05-04) +## v0.6.16 (2023-05-04) - [#58](https://github.com/babashka/babashka/issues/58): build system for creating scittle distribution with custom libraries. See [plugins/demo](plugins/demo). - Use `window.location.hostname` for WebSocket connection instead of hardcoding `"localhost"` ([@pyrmont](https://github.com/pyrmont)) - Upgrade `sci.configs` to `"33bd51e53700b224b4cb5bda59eb21b62f962745"` - Update nREPL implementation: implement `eldoc` (`info`, `lookup`) ([@benjamin-asdf](https://github.com/benjamin-asdf)) -## v0.6.15 (2023-01-05) +## v0.6.16 (2023-01-05) - Fix destructuring in `defmethod` (by upgrading SCI) diff --git a/doc/dev.md b/doc/dev.md index a3d5c5d..4989af8 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.4.11 0.6.15` +- `bb replace-version 0.6.16 0.6.16` - Create Github release with updated links from `doc/links.md` - `bb gh-pages` - + - - + + - + diff --git a/doc/links.md b/doc/links.md index fcc3ca8..2f05f47 100644 --- a/doc/links.md +++ b/doc/links.md @@ -1,7 +1,7 @@ -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.cljs-ajax.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.reagent.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.re-frame.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.promesa.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.pprint.js -https://cdn.jsdelivr.net/npm/scittle@0.6.15/dist/scittle.nrepl.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.cljs-ajax.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.reagent.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.re-frame.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.promesa.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.pprint.js +https://cdn.jsdelivr.net/npm/scittle@0.6.16/dist/scittle.nrepl.js diff --git a/doc/nrepl/README.md b/doc/nrepl/README.md index 7e7eab2..851d013 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 e6d6552..dc00626 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 e90a009..3002a81 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 dc00626..82f399f 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 3002a81..8757d61 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 82f399f..42ba9bd 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 8757d61..820db65 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 42ba9bd..b180e74 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 0709699..e0d9190 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 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 128/175] 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 129/175] 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 130/175] 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 131/175] 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 132/175] 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 133/175] 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 134/175] 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 135/175] 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 136/175] 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 137/175] 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 138/175] 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 143/175] 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 144/175] 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 145/175] 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 146/175] 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 147/175] 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 148/175] 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 149/175] 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 150/175] 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 151/175] 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 152/175] 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 153/175] 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 162/175] 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 163/175] 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 164/175] 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 175/175] 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