Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit 654c189

Browse files
committed
Add all core functions
1 parent c069bff commit 654c189

File tree

8 files changed

+477
-31
lines changed

8 files changed

+477
-31
lines changed

squint/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ lib
88
report.html
99
test/scratch.js
1010
dist
11+
.work

squint/bb/tasks.clj

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
(ns tasks
2-
(:require [babashka.process :refer [shell]]
3-
[clojure.edn :as edn]
4-
[clojure.java.io :as io]))
5-
6-
(def core-config )
7-
8-
(def core-vars (:vars core-config))
9-
10-
(def core->js (:to-js core-config))
11-
12-
13-
(defn shadow-extra-config []
2+
(:require
3+
[babashka.fs :as fs]
4+
[babashka.process :refer [shell]]
5+
[clojure.edn :as edn]
6+
[clojure.java.io :as io]))
7+
(defn shadow-extra-config
8+
[]
149
(let [core-config (edn/read-string (slurp (io/resource "cherry/cljs.core.edn")))
1510
vars (:vars core-config)
16-
to-js (:to-js core-config)
17-
_ (prn to-js)
18-
ks (map #(get to-js % %) vars)
11+
ks (map #(symbol (munge %)) vars)
1912
vs (map #(symbol "cljs.core" (str %)) vars)
2013
core-map (zipmap ks vs)]
21-
(prn core-map)
2214
{:modules
2315
{:cljs_core {:exports core-map}}}))
2416

2517
(defn build-cherry-npm-package []
26-
(shell "npx shadow-cljs release cherry --config-merge"
27-
(shadow-extra-config)))
18+
(fs/create-dirs ".work")
19+
(spit ".work/config-merge.edn" (shadow-extra-config))
20+
(shell "npx shadow-cljs --config-merge .work/config-merge.edn release cherry"))

squint/corpus/core_vars.cljs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
(dissoc x :foo))
1919

2020
(log (str (foo {:foo 1 :bar 2})))
21+
22+
(prn (reverse (map (fn [x] (inc x)) [1 2 3])))

squint/corpus/core_vars.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { toJs, first, dissoc, get, vector, keyword, str, arrayMap } from 'cherry-cljs/cljs.core.js'
1+
import { first, dissoc, map, reverse, get, prn, vector, keyword, str, clj__GT_js, arrayMap } from 'cherry-cljs/cljs.core.js'
22

3-
const js_map = toJs(arrayMap(keyword("foo"), keyword("bar")));
3+
const js_map = clj__GT_js(arrayMap(keyword("foo"), keyword("bar")));
44
console.log(js_map);
55
const clj_map = arrayMap(keyword("foo/bar"), (1 + 2 + 3));
66
console.log(get(clj_map, keyword("foo/bar")));
@@ -13,3 +13,8 @@ return (function () {
1313
})();
1414
};
1515
log(str(foo(arrayMap(keyword("foo"), 1, keyword("bar"), 2))));
16+
prn(reverse(map(function (x) {
17+
return (function () {
18+
return (x + 1);
19+
})();
20+
}, vector(1, 2, 3))));

squint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "module",
33
"name": "cherry-cljs",
44
"sideEffects": false,
5-
"version": "0.0.0",
5+
"version": "0.0.0-alpha.8",
66
"files": [
77
"cljs.core.js",
88
"lib/cljs_core.js"

0 commit comments

Comments
 (0)