diff --git a/package.json b/package.json index c2c44d2..fa06b99 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "@nextjournal/lezer-clojure": "1.0.0", - "squint-cljs": "0.4.58", + "squint-cljs": "0.4.81", "w3c-keyname": "^2.2.4" }, "comments": { @@ -40,6 +40,7 @@ "devDependencies": { "@codemirror/lang-javascript": "^6.0.0", "@nextjournal/clojure-mode": "link:.", + "@squint-cljs/macros": "0.1.0", "d3-require": "^1.2.4", "emoji-regex": "^10.0.0", "framer-motion": "^6.2.8", @@ -54,8 +55,7 @@ "react-dom": "^17.0.2", "rollup-plugin-analyzer": "^4.0.0", "shadow-cljs": "2.19.5", - "vite": "^4.4.9", - "@squint-cljs/macros": "0.1.0" + "vite": "^4.4.9" }, "exports": { ".": "./dist/nextjournal/clojure_mode.mjs", diff --git a/public/squint/index.html b/public/squint/index.html index 9dc88f5..82fcadc 100644 --- a/public/squint/index.html +++ b/public/squint/index.html @@ -61,7 +61,7 @@ diff --git a/public/squint/js/demo.mjs b/public/squint/js/demo.mjs index 919e12b..85cd2ee 100644 --- a/public/squint/js/demo.mjs +++ b/public/squint/js/demo.mjs @@ -3,7 +3,7 @@ import { extension as eval_ext, cursor_node_string, top_level_string } from '@ne import { EditorView, drawSelection, keymap } from '@codemirror/view'; import { EditorState } from '@codemirror/state'; import { syntaxHighlighting, defaultHighlightStyle, foldGutter } from '@codemirror/language'; -import { compileString } from 'squint-cljs'; +import { compileStringEx } from 'squint-cljs'; let theme = EditorView.theme({ ".cm-content": {whitespace: "pre-wrap", @@ -24,11 +24,12 @@ let theme = EditorView.theme({ ".cm-cursor": {visibility: "hidden"}, "&.cm-focused .cm-cursor": {visibility: "visible"} }); - +let compilerState = null; let evalCode = async function (code) { - let js = compileString(`(do ${code})`, {repl: true, - context: 'return', - "elide-exports": true}) + compilerState = compileStringEx(`(do ${code})`, {repl: true, + context: 'return', + "elide-exports": true}, compilerState) + let js = compilerState.javascript; let result; try { result = {value: await eval(`(async function() { ${js} })()`)}; diff --git a/yarn.lock b/yarn.lock index 5ef76cb..86e6792 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1176,10 +1176,10 @@ source-map@^0.5.6: resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -squint-cljs@0.4.58: - version "0.4.58" - resolved "https://registry.yarnpkg.com/squint-cljs/-/squint-cljs-0.4.58.tgz#9dde3c431661ffd8f2596ad397e3c657bf91ffe9" - integrity sha512-X/F8gQfemySHHP6+nuQKUc6s+/3bYYGbKyiJDRqtyzbOYH/AIwaJM3RCGF7gAu99jSCcLrSh6NjIuwDKQicMXg== +squint-cljs@0.4.81: + version "0.4.81" + resolved "https://registry.yarnpkg.com/squint-cljs/-/squint-cljs-0.4.81.tgz#b1926c112a5caa12ed4ecc6f9035827dc4270bb7" + integrity sha512-ffMxWbL901+xHMlaXeUavfrhK+uX7tsZYzF9/kxJYGZ6+KLOGy1Ke9+osbVNR+Vd/uszX6O/YcpNxCJzThgTUA== dependencies: chokidar "^3.5.3"