From 119922327b258e6641d5a10f79cfa8096ab17e7b Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 18 Nov 2023 12:09:01 +0100 Subject: [PATCH] Improve js-interop stub (#43) * Improve js-interop stub * Move squint macros to git --- .gitignore | 1 + package.json | 3 +- squint.edn | 2 +- src-squint/applied_science/js_interop.cljc | 45 ---------------------- yarn.lock | 4 ++ 5 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 src-squint/applied_science/js_interop.cljc diff --git a/.gitignore b/.gitignore index 6050c1f..3403d0a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ public/test out dist **/.DS_Store +.nrepl-port diff --git a/package.json b/package.json index 0764903..0ce14b6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "@lezer/lr": "^1.0.0", "@nextjournal/lezer-clojure": "1.0.0", "squint-cljs": "0.3.36", - "w3c-keyname": "^2.2.4" + "w3c-keyname": "^2.2.4", + "squint-macros": "https://github.com/squint-cljs/squint-macros" }, "comments": { "to run squint as a local dependency:": "bb yarn-install:squint-dev" diff --git a/squint.edn b/squint.edn index 187a09b..c3f7df4 100644 --- a/squint.edn +++ b/squint.edn @@ -1,2 +1,2 @@ -{:paths ["src-shared" "src-squint" "test"] +{:paths ["src-shared" "src-squint" "test" "node_modules/squint-macros/src"] :output-dir "dist"} diff --git a/src-squint/applied_science/js_interop.cljc b/src-squint/applied_science/js_interop.cljc deleted file mode 100644 index f5dd8e2..0000000 --- a/src-squint/applied_science/js_interop.cljc +++ /dev/null @@ -1,45 +0,0 @@ -(ns applied-science.js-interop - (:refer-clojure :exclude [defn get get-in fn let select-keys assoc!])) - -(defmacro lit [x] x) - -(defmacro defn [& body] - `(clojure.core/defn ~@body)) - -(defmacro get-in [& body] - `(clojure.core/get-in ~@body)) - -(defmacro fn [& body] - `(clojure.core/fn ~@body)) - -(defmacro let [& body] - `(clojure.core/let ~@body)) - -(defmacro call-in [obj path & fs] - `(.. ~obj ~@(map #(symbol (str "-" %)) path) ~@(map list fs))) - -(defmacro call [obj f] - (list (symbol (str "." f)) obj)) - -(defmacro !set [obj k v] - `(do (cljs.core/set! ~(list (symbol (str ".-" (name k))) obj) ~v) - ~obj)) - -(defmacro extend! [obj other] - `(js/Object.assign ~obj ~other)) - -(defmacro push! [obj v] - `(doto ~obj - (.push ~v))) - -(defmacro select-keys [obj ks] - `(clojure.core/select-keys ~obj ~ks)) - -(defmacro assoc! [& body] - `(clojure.core/assoc! ~@body)) - -(defmacro obj [& body] - `(cljs.core/js-obj ~@body)) - -(defmacro get [& body] - `(cljs.core/get ~@body)) diff --git a/yarn.lock b/yarn.lock index 3c2627c..b618367 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1346,6 +1346,10 @@ squint-cljs@0.3.36: chokidar "^3.5.3" glob "^10.3.10" +"squint-macros@https://github.com/squint-cljs/squint-macros": + version "0.0.0" + resolved "https://github.com/squint-cljs/squint-macros#57cb4e2f71cd74294139872ef7ba60ab946960dd" + stream-browserify@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz"