Merge branch 'main' into scittle-dev
This commit is contained in:
commit
f207d4d878
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,3 +17,4 @@ gh-pages/
|
|||
/.clj-kondo/.cache
|
||||
/.clj-kondo/rewrite-clj
|
||||
/plugins/demo/resources/public/js/
|
||||
.portal
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
<!-- - Create Github release with updated links from `doc/links.md` -->
|
||||
<!-- - `bb gh-pages` -->
|
||||
|
||||
- [#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)
|
||||
|
||||
- [#107](https://github.com/babashka/scittle/issues/107): add `replicant` plugin ([@jeroenvandijk](https://github.com/jeroenvandijk))
|
||||
|
|
|
@ -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:
|
||||
|
|
5
deps.edn
5
deps.edn
|
@ -3,7 +3,7 @@
|
|||
{org.clojure/clojure {:mvn/version "1.11.1"}
|
||||
thheller/shadow-cljs {:mvn/version "3.1.8"}
|
||||
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"}
|
||||
|
@ -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 "aa84a1b4f1fe45735e5b748769309fc842f737c1"}
|
||||
:git/sha "aa84a1b4f1fe45735e5b748769309fc842f737c1"
|
||||
:exclusions [org.babashka/sci]}
|
||||
binaryage/devtools {:mvn/version "1.0.7"}}
|
||||
:aliases
|
||||
{:dev
|
||||
|
|
|
@ -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"
|
||||
|
|
26
doc/serviceworker.md
Normal file
26
doc/serviceworker.md
Normal file
|
@ -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
|
||||
<script>
|
||||
if('serviceWorker' in navigator)
|
||||
navigator.serviceWorker.register('scittle-sw.js');
|
||||
</script>
|
||||
```
|
||||
|
||||
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).
|
|
@ -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]}}}
|
||||
|
|
8
plugins/dataspex/deps.edn
Normal file
8
plugins/dataspex/deps.edn
Normal file
|
@ -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]}}}
|
9
plugins/dataspex/src/scittle/dataspex.cljs
Normal file
9
plugins/dataspex/src/scittle/dataspex.cljs
Normal file
|
@ -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))
|
8
plugins/dataspex/src/scittle_plugin.edn
Normal file
8
plugins/dataspex/src/scittle_plugin.edn
Normal file
|
@ -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]}}}}]
|
|
@ -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
|
||||
|
|
|
@ -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]}}}
|
||||
|
|
|
@ -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]}}}
|
||||
|
|
|
@ -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}})
|
||||
|
||||
|
|
|
@ -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)))))
|
||||
|
|
Loading…
Reference in a new issue