squint-cljs 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -24
- package/core.js +10 -3
- package/lib/cli.js +10 -10
- package/lib/compiler.js +146 -146
- package/lib/compiler.node.js +583 -582
- package/{node.js → node-api.js} +0 -0
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -10,9 +10,6 @@ performance, bundle size, ease of interop, etc.
|
|
|
10
10
|
> breaking changes. It's fine to use it for non-critical projects but don't use
|
|
11
11
|
> it in production yet.
|
|
12
12
|
|
|
13
|
-
Squint was previously called ClavaScript and the name may appear in some places
|
|
14
|
-
in this README. Please file an issue or PR if you spot one.
|
|
15
|
-
|
|
16
13
|
## Quickstart
|
|
17
14
|
|
|
18
15
|
Although it's early days, you're welcome to try out `squint` and submit issues.
|
|
@@ -56,6 +53,12 @@ so with caveats). This may work especially well for projects e.g. that you'd
|
|
|
56
53
|
like to deploy on CloudFlare workers, node scripts, Github actions, etc. that
|
|
57
54
|
need the extra performance, startup time and/or small bundle size.
|
|
58
55
|
|
|
56
|
+
## Talk
|
|
57
|
+
|
|
58
|
+
[](https://www.youtube.com/watch?v=oCd74TQ-gf4)
|
|
59
|
+
|
|
60
|
+
([slides](https://www.dropbox.com/s/955jgzy6hgpx67r/dcd2022-cljs-reimagined.pdf?dl=0))
|
|
61
|
+
|
|
59
62
|
## Differences with ClojureScript
|
|
60
63
|
|
|
61
64
|
- Squint does not protect you in any way from the pitfalls of JS with regards to truthiness, mutability and equality
|
|
@@ -70,6 +73,8 @@ need the extra performance, startup time and/or small bundle size.
|
|
|
70
73
|
- `println` is a synonym for `console.log`
|
|
71
74
|
- `pr-str` and `prn` coerce values to a string using `JSON.stringify`
|
|
72
75
|
|
|
76
|
+
If you are looking for ClojureScrip semantics, take a look at [cherry](https://github.com/squint-cljs/cherry).
|
|
77
|
+
|
|
73
78
|
### Seqs
|
|
74
79
|
|
|
75
80
|
Squint does not implement Clojure seqs. Instead it uses the JavaScript
|
|
@@ -151,6 +156,13 @@ Note that when using a Clojure expression, you escape the JSX context so when yo
|
|
|
151
156
|
#jsx [:span "Even"])])
|
|
152
157
|
```
|
|
153
158
|
|
|
159
|
+
To pass props, you can use `:&`:
|
|
160
|
+
|
|
161
|
+
``` clojure
|
|
162
|
+
(let [props {:a 1}]
|
|
163
|
+
#jsx [App {:& props}])
|
|
164
|
+
```
|
|
165
|
+
|
|
154
166
|
See an example of an application using JSX [here](https://squint-cljs.github.io/demos/squint/solidjs/) ([source](https://github.com/squint-cljs/squint/blob/main/examples/solidjs/src/App.cljs)).
|
|
155
167
|
|
|
156
168
|
## Async/await
|
|
@@ -165,27 +177,7 @@ squint supports `async/await`:
|
|
|
165
177
|
(println x) ;;=> 10
|
|
166
178
|
```
|
|
167
179
|
|
|
168
|
-
## Roadmap
|
|
169
|
-
|
|
170
|
-
In arbitrary order, these features are planned:
|
|
171
|
-
|
|
172
|
-
- Macros
|
|
173
|
-
- REPL
|
|
174
|
-
- Protocols
|
|
175
|
-
|
|
176
|
-
## Presentations
|
|
177
|
-
|
|
178
|
-
See [slides](https://www.dropbox.com/s/955jgzy6hgpx67r/dcd2022-cljs-reimagined.pdf?dl=0) of a presentation given at Dutch Clojure Days 2022 about cherry and squint.
|
|
179
|
-
|
|
180
|
-
## Core team
|
|
181
|
-
|
|
182
|
-
The core team consists of:
|
|
183
|
-
|
|
184
|
-
- Michiel Borkent ([@borkdude](https://github.com/borkdude))
|
|
185
|
-
- Will Acton ([@lilactown](https://github.com/lilactown))
|
|
186
|
-
- Cora Sutton ([@corasaurus-hex](https://github.com/corasaurus-hex))
|
|
187
|
-
|
|
188
180
|
License
|
|
189
181
|
=======
|
|
190
182
|
|
|
191
|
-
Squint is licensed under the EPL
|
|
183
|
+
Squint is licensed under the EPL. See epl-v10.html in the root directory for more information.
|
package/core.js
CHANGED
|
@@ -220,7 +220,11 @@ export function conj(...xs) {
|
|
|
220
220
|
const m = new Map(o);
|
|
221
221
|
|
|
222
222
|
for (const x of rest) {
|
|
223
|
-
|
|
223
|
+
if (!(x instanceof Array))
|
|
224
|
+
iterable(x).forEach((kv) => {
|
|
225
|
+
m.set(kv[0], kv[1]);
|
|
226
|
+
});
|
|
227
|
+
else m.set(x[0], x[1]);
|
|
224
228
|
}
|
|
225
229
|
|
|
226
230
|
return m;
|
|
@@ -233,7 +237,8 @@ export function conj(...xs) {
|
|
|
233
237
|
const o2 = { ...o };
|
|
234
238
|
|
|
235
239
|
for (const x of rest) {
|
|
236
|
-
|
|
240
|
+
if (!(x instanceof Array)) Object.assign(o2, x);
|
|
241
|
+
else o2[x[0]] = x[1];
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
return o2;
|
|
@@ -1122,4 +1127,6 @@ export function neg_QMARK_(x) {
|
|
|
1122
1127
|
|
|
1123
1128
|
export function pos_QMARK_(x) {
|
|
1124
1129
|
return x > 0;
|
|
1125
|
-
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// comment
|
package/lib/cli.js
CHANGED
|
@@ -2,36 +2,36 @@ import { $APP, shadow$provide, $jscomp } from "./cljs_core.js";
|
|
|
2
2
|
import "./compiler.node.js";
|
|
3
3
|
import "./compiler.js";
|
|
4
4
|
const shadow_esm_import = function(x) { return import(x) };
|
|
5
|
-
import*as esm_import$fs from"fs";import*as esm_import$readline from"readline";import*as esm_import$squint_cljs$core from"squint-cljs/core.js";import*as esm_import$process from"process";import*as esm_import$path from"path";
|
|
5
|
+
import*as esm_import$fs from"fs";import*as esm_import$readline from"readline";import*as esm_import$squint_cljs$core from"squint-cljs/core.js";import*as esm_import$process from"process";import*as esm_import$url from"url";import*as esm_import$path from"path";
|
|
6
6
|
var $8=function(a,b){return $APP.Je(a)&&$APP.Je(b)?$APP.np.j($APP.J.g([a,b],0)):$APP.Ae(a)&&($APP.He(a)||$APP.Be(a))&&$APP.Ae(b)&&($APP.He(b)||$APP.Be(b))?$APP.xj.g(a,b):b},a9=function(a,b){return $APP.qf.l(function(c,d){return $APP.op.j($8,$APP.J.g([c,d],0))},a,b)},c9=function(a){throw $APP.vq.g(["Unexpected format: ",$APP.t.h(a)].join(""),new $APP.p(null,1,[b9,a],null));},d9=function(a){var b=JSON.parse(a);return $APP.Te(b)?b:c9(a)},e9=function(a){var b=JSON.parse(a);return $APP.Ze(b)?b:c9(a)},
|
|
7
7
|
f9=function(a){var b=JSON.parse(a);return $APP.df(b)?b:c9(a)},g9=function(a){var b=JSON.parse(a);return"number"===typeof b?b:c9(a)},h9=function(a){return $APP.ee.g(":",0<a.length?a.charAt(0):null)?$APP.nl.h($APP.cl.g(a,1)):$APP.nl.h(a)},i9=function(a){return $APP.Ae(a)?$APP.x(a):a},j9=function(a){if("string"===typeof a)try{var b=0<a.length?a.charAt(0):null;if($APP.ee.g("true",a)||$APP.ee.g("false",a))var c=d9(a);else{if($APP.bb(isNaN(a)))var d=g9(a);else{var e=$APP.ee.g(":",b);var f=e?$APP.Zk(/:?[a-zA-Z0-9]+/,
|
|
8
8
|
a):e;d=$APP.r(f)?h9(a):a}c=d}return c}catch(l){return a}else return a},n9=function(a,b){var c=function(){switch(b instanceof $APP.D?b.xa:null){case "boolean":return d9;case "int":case "long":return e9;case "double":return f9;case "number":return g9;case "symbol":return $APP.yl;case "keyword":return h9;case "string":return $APP.xf;case "edn":return $APP.OM;case "auto":return j9;default:return b}}();if("string"===typeof a){try{var d=c.h?c.h(a):c.call(null,a)}catch(e){d=k9}if($APP.ee.g(k9,d))throw $APP.vq.g(["Coerce failure: cannot transform input ",
|
|
9
9
|
$APP.Pp.j($APP.J.g([a],0)),b instanceof $APP.D?" to ":" with ",$APP.t.h(b instanceof $APP.D?$APP.Lk(b):b)].join(""),new $APP.p(null,2,[l9,a,m9,b],null));return d}return a},o9=function(a,b,c){a=$APP.ef.g(a,b);c=$APP.r(a)?a:$APP.Ae(c)?$APP.pe(c):null;return $APP.r(c)?$APP.Ae(c)?$APP.wo.g($APP.Bg,c):c:null},p9=function(a,b,c,d){return $APP.Ak.g(b,c)?(c=$APP.jf(a,b),$APP.r(c)?($APP.A.l(c,0,null),c=$APP.A.l(c,1,null),$APP.Bk.l(a,b,$APP.r(d)?d.g?d.g(c,!0):d.call(null,c,!0):!0)):$APP.Bk.l(a,b,$APP.r(d)?
|
|
10
|
-
d.g?d.g(null,!0):d.call(null,null,!0):!0)):a},q9=function(a,b,c,d,e){d=$APP.r($APP.r(d)?!$APP.Ae(d):d)?n9(e,d):j9(e);return $APP.r(c)?$APP.Qo.B(a,b,c,d):$APP.Bk.l(a,b,d)},v9=function(a){return $APP.qf.l(function(b,c){var d=$APP.A.l(c,0,null);c=$APP.A.l(c,1,null);var e=$APP.uh(c),f=$APP.ef.g(e,r9),l=$APP.ef.g(e,s9);c=$APP.ef.g(e,$APP.Bt);var k=$APP.ef.g(e,$APP.
|
|
11
|
-
$APP.t.h(l)," between ",$APP.t.h($APP.ef.g(m,l))," and ",$APP.t.h(d)].join(""),new $APP.p(null,1,[s9,l],null));return $APP.Bk.l(m,l,d)}):b;b=$APP.r(k)?$APP.Qo.l(b,$APP.
|
|
10
|
+
d.g?d.g(null,!0):d.call(null,null,!0):!0)):a},q9=function(a,b,c,d,e){d=$APP.r($APP.r(d)?!$APP.Ae(d):d)?n9(e,d):j9(e);return $APP.r(c)?$APP.Qo.B(a,b,c,d):$APP.Bk.l(a,b,d)},v9=function(a){return $APP.qf.l(function(b,c){var d=$APP.A.l(c,0,null);c=$APP.A.l(c,1,null);var e=$APP.uh(c),f=$APP.ef.g(e,r9),l=$APP.ef.g(e,s9);c=$APP.ef.g(e,$APP.Bt);var k=$APP.ef.g(e,$APP.LE);e=$APP.ef.g(e,t9);b=$APP.r(f)?$APP.Qo.G(b,r9,$APP.Bk,d,f):b;b=$APP.r(l)?$APP.Qo.l(b,s9,function(m){if($APP.gf(m,l))throw $APP.vq.g(["Conflicting alias ",
|
|
11
|
+
$APP.t.h(l)," between ",$APP.t.h($APP.ef.g(m,l))," and ",$APP.t.h(d)].join(""),new $APP.p(null,1,[s9,l],null));return $APP.Bk.l(m,l,d)}):b;b=$APP.r(k)?$APP.Qo.l(b,$APP.LE,$APP.wo.g(function(m){return $APP.Bg.g(m,d)},$APP.Fk)):b;b=$APP.r(e)?$APP.Qo.G(b,t9,$APP.Bk,d,e):b;return $APP.r(c)?$APP.Qo.G(b,u9,$APP.Bk,d,c):b},$APP.th,a)},z9=function(a,b){b=$APP.uh(b);var c=$APP.ef.g(b,w9);b=$APP.Wk(function(d){var e=$APP.r(c)?null:$APP.nr(d,":");return!($APP.r(e)?e:$APP.nr(d,"-"))},a);a=$APP.A.l(b,0,null);
|
|
12
12
|
b=$APP.A.l(b,1,null);return new $APP.p(null,2,[x9,a,y9,b],null)},B9=function(a,b){if($APP.r(b))if($APP.w(a)){var c=$APP.de(a),d=$APP.ih(c,b);c=c<d?c:d;a=new $APP.F(null,2,5,$APP.G,[$APP.N.g($APP.Io.g(b,a),$APP.hi.g(c,a)),$APP.hi.g(c,b)],null)}else a=new $APP.F(null,2,5,$APP.G,[a,b],null);else a=new $APP.F(null,2,5,$APP.G,[a,b],null);b=a;a=$APP.A.l(b,0,null);b=$APP.A.l(b,1,null);return new $APP.p(null,2,[y9,a,A9,b],null)},S9=function(a,b){function c(eb){eb=$APP.np.j($APP.J.g([new $APP.p(null,2,[C9,
|
|
13
|
-
d,$APP.hs,D9],null),eb],0));return H.h?H.h(eb):H.call(null,eb)}var d=C9.h(b),e=$APP.r(d)?a9(b,$APP.J.g([v9(d)],0)):b,f=r9.h(e),l=function(){var eb=s9.h(e);return $APP.r(eb)?eb:$APP.XI.h(e)}(),k=E9.h(e),m=$APP.
|
|
13
|
+
d,$APP.hs,D9],null),eb],0));return H.h?H.h(eb):H.call(null,eb)}var d=C9.h(b),e=$APP.r(d)?a9(b,$APP.J.g([v9(d)],0)):b,f=r9.h(e),l=function(){var eb=s9.h(e);return $APP.r(eb)?eb:$APP.XI.h(e)}(),k=E9.h(e),m=$APP.LE.h(e),h=u9.h(e),q=w9.h(e),n=function(){var eb=F9.h(e);return $APP.r(eb)?eb:G9.h(e)}(),v=$APP.ee.g(!0,n)?function(){var eb=null==d?null:$APP.wk(d);eb=null==eb?null:$APP.N.g(eb,$APP.wk(f));return null==eb?null:$APP.Jk(eb)}():null==n?null:$APP.Jk(n),C=t9.h(e),H=function(){var eb=H9.h(e);return $APP.r(eb)?
|
|
14
14
|
eb:function(bc){bc=$APP.uh(bc);var yc=$APP.ef.g(bc,I9);throw $APP.vq.g(yc,bc);}}(),O=z9(a,null),P=$APP.uh(O),V=$APP.ef.g(P,x9),aa=$APP.ef.g(P,y9),da=function(){var eb=A9.h(e);eb=$APP.r(eb)?eb:J9.h(e);return $APP.r(eb)?B9(V,eb):new $APP.p(null,2,[A9,null,y9,aa],null)}(),ia=$APP.uh(da),na=$APP.ef.g(ia,y9),ca=$APP.ef.g(ia,A9),E=$APP.Ak.g(na,aa)?new $APP.F(null,2,5,$APP.G,[null,$APP.N.g(na,aa)],null):new $APP.F(null,2,5,$APP.G,[V,aa],null),z=$APP.A.l(E,0,null),ba=$APP.A.l(E,1,null),I=function(){for(var eb=
|
|
15
15
|
$APP.r(h)?h:$APP.th,bc=null,yc=null,Wf=$APP.r(q)?K9:null,sd=$APP.w(ba),Xf=ca;;){if($APP.bb(sd))return new $APP.F(null,3,5,$APP.G,[eb,bc,yc],null);var Bc=$APP.x(sd),Og=Bc instanceof $APP.D;if(Og){var Pc=p9(eb,bc,yc,null),Cb=yc,Yf=Wf;sd=$APP.y(sd);eb=Pc;bc=Bc;yc=Cb;Wf=Yf}else{Pc=Og?null:o9(k,bc,$APP.ef.g(f,bc));Cb=Og?null:0<Bc.length?Bc.charAt(0):null;var dk=Og?null:$APP.ee.g(Cb,"-"),ek=function(){var zc=Wf;return $APP.r(zc)?zc:$APP.r(dk)?K9:null}(),gj=Og?null:$APP.ee.g(":",Cb),fk=Og?null:function(){var zc=
|
|
16
16
|
$APP.Ak.g(K9,ek);return zc?(zc=gj,$APP.r(zc)?$APP.bb(bc)||$APP.ee.g(yc,bc):zc):zc}(),Pg=function(){var zc=ek;return $APP.r(zc)?zc:Og?null:$APP.r(fk)?L9:null}();if($APP.r(function(){var zc=dk;return $APP.r(zc)?zc:fk}())){if(Yf=(Cb=$APP.nr(Bc,"--"))&&$APP.ee.g("--",Bc)){var gk=$APP.y(sd);return new $APP.F(null,3,5,$APP.G,[function(){var zc=eb;return gk?$APP.ro.B(zc,$APP.Oo,new $APP.F(null,2,5,$APP.G,[D9,y9],null),$APP.sf(gk)):zc}(),bc,yc],null)}Bc=Cb?$APP.cl.g(Bc,2):$APP.Cr(Bc,/^(:|-|)/,"");Bc=Cb?$APP.Pw.g(Bc,
|
|
17
17
|
/=/):new $APP.F(null,1,5,$APP.G,[Bc],null);Cb=$APP.A.l(Bc,0,null);Bc=$APP.A.l(Bc,1,null);Cb=$APP.nl.h(Cb);Cb=$APP.ef.l(l,Cb,Cb);$APP.r(Bc)?(Pc=p9(eb,bc,yc,Pc),Yf=Pg,sd=$APP.Eg(Bc,$APP.Dd(sd)),eb=Pc,bc=Cb,yc=null,Wf=Yf):(Pc=p9(eb,bc,yc,Pc),Bc=Cb,Cb=yc,Yf=Pg,sd=$APP.y(sd),eb=Pc,bc=Bc,yc=Cb,Wf=Yf)}else if(Cb=$APP.ef.g(f,bc),Yf=$APP.ee.g(M9,Cb)&&$APP.Ak.g(Bc,"true")&&$APP.Ak.g(Bc,"false")||$APP.ee.g(yc,bc)&&$APP.bb(Pc))if(Xf=$APP.r(sd)?$APP.r(Xf)?B9(sd,Xf):new $APP.p(null,1,[y9,sd],null):new $APP.p(null,
|
|
18
18
|
1,[y9,sd],null),Pc=$APP.uh(Xf),Xf=$APP.ef.g(Pc,y9),Pc=$APP.ef.g(Pc,A9),$APP.Ak.g(sd,Xf))sd=Xf,Xf=Pc,Wf=Pg;else return new $APP.F(null,3,5,$APP.G,[$APP.ro.B(eb,$APP.Oo,new $APP.F(null,2,5,$APP.G,[D9,y9],null),$APP.sf(sd)),bc,yc],null);else{try{var Qg=q9(eb,bc,Pc,i9(Cb),Bc)}catch(zc){c(new $APP.p(null,4,[N9,r9,I9,$APP.xm(zc),O9,bc,P9,Bc],null)),Qg=eb}Pc=$APP.r(function(){var zc=$APP.ee.g(L9,Pg);return zc?gj:zc}())?null:bc;Bc=$APP.r(function(){var zc=$APP.ee.g(L9,Pg);return zc?gj:zc}())?null:bc;Cb=Pg;
|
|
19
19
|
sd=$APP.y(sd);eb=Qg;bc=Pc;yc=Bc;Wf=Cb}}}}(),K=$APP.A.l(I,0,null),ea=$APP.A.l(I,1,null),ja=$APP.A.l(I,2,null),ha=o9(k,ea,$APP.ef.g(n9,ea)),pa=function(){var eb=p9(K,ea,ja,ha);return $APP.w(z)?$APP.ro.B(eb,$APP.Po,new $APP.F(null,2,5,$APP.G,[D9,y9],null),function(bc){return $APP.xj.g($APP.sf(z),bc)}):eb}();if($APP.r(v)){a=$APP.w($APP.wk(pa));b=null;for(var ra=0,ua=0;;)if(ua<ra){var va=b.S(null,ua);$APP.gf(v,va)||c(new $APP.p(null,4,[N9,F9,I9,["Unknown option: ",$APP.t.h(va)].join(""),F9,v,O9,va],null));
|
|
20
|
-
ua+=1}else if(a=$APP.w(a))b=a,$APP.Me(b)?(a=$APP.Yc(b),ua=$APP.Zc(b),b=a,ra=$APP.de(a),a=ua):(a=$APP.x(b),$APP.gf(v,a)||c(new $APP.p(null,4,[N9,F9,I9,["Unknown option: ",$APP.t.h(a)].join(""),F9,v,O9,a],null)),a=$APP.y(b),b=null,ra=0),ua=0;else break}if($APP.r(m))for(a=$APP.w(m),b=null,ua=ra=0;;)if(ua<ra)va=b.S(null,ua),$APP.r($APP.jf(pa,va))||c(new $APP.p(null,4,[N9,$APP.
|
|
21
|
-
ua=$APP.Zc(b),b=a,ra=$APP.de(a),a=ua):(a=$APP.x(b),$APP.r($APP.jf(pa,a))||c(new $APP.p(null,4,[N9,$APP.
|
|
20
|
+
ua+=1}else if(a=$APP.w(a))b=a,$APP.Me(b)?(a=$APP.Yc(b),ua=$APP.Zc(b),b=a,ra=$APP.de(a),a=ua):(a=$APP.x(b),$APP.gf(v,a)||c(new $APP.p(null,4,[N9,F9,I9,["Unknown option: ",$APP.t.h(a)].join(""),F9,v,O9,a],null)),a=$APP.y(b),b=null,ra=0),ua=0;else break}if($APP.r(m))for(a=$APP.w(m),b=null,ua=ra=0;;)if(ua<ra)va=b.S(null,ua),$APP.r($APP.jf(pa,va))||c(new $APP.p(null,4,[N9,$APP.LE,I9,["Required option: ",$APP.t.h(va)].join(""),$APP.LE,m,O9,va],null)),ua+=1;else if(a=$APP.w(a))b=a,$APP.Me(b)?(a=$APP.Yc(b),
|
|
21
|
+
ua=$APP.Zc(b),b=a,ra=$APP.de(a),a=ua):(a=$APP.x(b),$APP.r($APP.jf(pa,a))||c(new $APP.p(null,4,[N9,$APP.LE,I9,["Required option: ",$APP.t.h(a)].join(""),$APP.LE,m,O9,a],null)),a=$APP.y(b),b=null,ra=0),ua=0;else break;if($APP.r(C))for(var Aa=$APP.w(C),Ea=null,xa=0,wa=0;;)if(wa<xa){var Ka=Ea.S(null,wa),Pa=$APP.A.l(Ka,0,null),Wa=$APP.A.l(Ka,1,null),hb=function(){var eb=(eb=$APP.Je(Wa))?Q9.h(Wa):eb;return $APP.r(eb)?eb:Wa}(),mb=$APP.jf(pa,Pa);if($APP.r(mb)){var Jb=mb,Xb=$APP.A.l(Jb,0,null),rc=$APP.A.l(Jb,
|
|
22
22
|
1,null);if(!$APP.r(hb.h?hb.h(rc):hb.call(null,rc))){var zb=function(){var eb=R9.h(Wa);return $APP.r(eb)?eb:function(){return function(bc){var yc=$APP.uh(bc);bc=$APP.ef.g(yc,O9);yc=$APP.ef.g(yc,P9);return["Invalid value for option ",$APP.t.h(bc),": ",$APP.t.h(yc)].join("")}}(Aa,Ea,xa,wa,eb,Jb,Xb,rc,mb,hb,Ka,Pa,Wa,d,e,f,l,k,m,h,q,n,v,C,H,c,O,P,V,aa,da,ia,na,ca,E,z,ba,I,K,ea,ja,ha,pa)}();c(new $APP.p(null,5,[N9,t9,I9,function(){var eb=new $APP.p(null,2,[O9,Pa,P9,rc],null);return zb.h?zb.h(eb):zb.call(null,
|
|
23
23
|
eb)}(),t9,C,O9,Pa,P9,rc],null))}}wa+=1}else{var Ne=$APP.w(Aa);if(Ne){var Mg=Ne;if($APP.Me(Mg))ra=$APP.Yc(Mg),a=$APP.Zc(Mg),b=ra,ra=$APP.de(ra),Aa=a,Ea=b,xa=ra;else{var ak=$APP.x(Mg),ej=$APP.A.l(ak,0,null),xh=$APP.A.l(ak,1,null),fj=function(){var eb=(eb=$APP.Je(xh))?Q9.h(xh):eb;return $APP.r(eb)?eb:xh}(),bk=$APP.jf(pa,ej);if($APP.r(bk)){var ck=bk,Um=$APP.A.l(ck,0,null),hc=$APP.A.l(ck,1,null);if(!$APP.r(fj.h?fj.h(hc):fj.call(null,hc))){var Ng=function(){var eb=R9.h(xh);return $APP.r(eb)?eb:function(){return function(bc){var yc=
|
|
24
24
|
$APP.uh(bc);bc=$APP.ef.g(yc,O9);yc=$APP.ef.g(yc,P9);return["Invalid value for option ",$APP.t.h(bc),": ",$APP.t.h(yc)].join("")}}(Aa,Ea,xa,wa,eb,ck,Um,hc,bk,fj,ak,ej,xh,Mg,Ne,d,e,f,l,k,m,h,q,n,v,C,H,c,O,P,V,aa,da,ia,na,ca,E,z,ba,I,K,ea,ja,ha,pa)}();c(new $APP.p(null,5,[N9,t9,I9,function(){var eb=new $APP.p(null,2,[O9,ej,P9,hc],null);return Ng.h?Ng.h(eb):Ng.call(null,eb)}(),t9,C,O9,ej,P9,hc],null))}}Aa=$APP.y(Mg);Ea=null;xa=0}wa=0}else break}return pa},T9=function(a,b){a=S9(a,b);b=D9.h($APP.we(a));
|
|
25
25
|
return $APP.Bk.l(b,$APP.kJ,$APP.In.g(a,D9))},U9=function(a,b){var c=$APP.ni($APP.de(a),b);b=$APP.A.l(c,0,null);c=$APP.A.l(c,1,null);return $APP.ee.g(b,a)?c:null},Y9=function(a,b){$APP.bi(V9,!1);a.setPrompt([$APP.t.h($APP.uy),"\x3d\x3e "].join(""));a.prompt();return $APP.oG($APP.ec(W9))?null:X9.g?X9.g(b,a):X9.call(null,b,a)},Z9=function(a){var b=$APP.Sr(a);a=$APP.Tr(a);var c=$APP.nG($APP.ec(W9));b=$APP.hi.g(b-1,c);c=$APP.w(b);b=$APP.x(c);c=$APP.y(c);a=$APP.r(b)?$APP.cl.g(b,a):null;$APP.bi(W9,$APP.dw.g("\n",
|
|
26
|
-
$APP.Eg(a,c)))},$9=function(a){var b=[".repl/",$APP.t.h($APP.$p.v()),".mjs"].join("");$APP.r(esm_import$fs.existsSync(".repl"))||esm_import$fs.mkdirSync(".repl");esm_import$fs.writeFileSync(b,a);return shadow_esm_import(esm_import$path.resolve(esm_import$process.cwd(),b)).finally(function(){return esm_import$fs.unlinkSync(b)})},b$=function(a,b,c){var d=function(){var f=$APP.uy;$APP.uy=$APP.ec(a$);try{return $APP.zy($APP.Pp.j($APP.J.g([a],0)),null)}finally{$APP.uy=
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
$APP.Eg(a,c)))},$9=function(a){var b=[".repl/",$APP.t.h($APP.$p.v()),".mjs"].join("");$APP.r(esm_import$fs.existsSync(".repl"))||esm_import$fs.mkdirSync(".repl");esm_import$fs.writeFileSync(b,a);return shadow_esm_import($APP.t.h(esm_import$url.pathToFileURL(esm_import$path.resolve(esm_import$process.cwd(),b)))).finally(function(){return esm_import$fs.unlinkSync(b)})},b$=function(a,b,c){var d=function(){var f=$APP.uy;$APP.uy=$APP.ec(a$);try{return $APP.zy($APP.Pp.j($APP.J.g([a],0)),null)}finally{$APP.uy=
|
|
27
|
+
f}}(),e=$APP.uh(d);d=$APP.ef.g(e,$APP.yy);e=$APP.ef.g(e,$APP.R);$APP.bi(a$,e);return $9(d).then(function(){esm_import$squint_cljs$core.println(globalThis._repl);return Y9(b,c)}).catch(function(f){esm_import$squint_cljs$core.println(f);return Y9(b,c)})},X9=function(a,b){if($APP.r(function(){var e=$APP.ec(V9);return $APP.r(e)?e:$APP.oG($APP.ec(W9))}()))return null;$APP.bi(V9,!0);var c=$APP.Tv($APP.ec(W9)),d=function(){try{return $APP.Vv(c,$APP.Sv($APP.th))}catch(f){var e=f;if(-1!=$APP.xm(e).indexOf("EOF while reading"))return c$;
|
|
28
|
+
Z9(c);$APP.Wp.j($APP.J.g([$APP.t.h(e)],0));return d$}}();if($APP.ee.g(d$,d))return Y9(b,a);if($APP.ee.g(c$,d))return $APP.bi(V9,!1);Z9(c);return $APP.ee.g($APP.Uv,d)?$APP.bi(V9,!1):b$(d,b,a)},e$=function(a){a.on("line",function(b){$APP.Tl.B(W9,$APP.t,b,"\n");return X9(null,a)})},g$=function(a,b){return $APP.r(f$.h(a))?($APP.Up.j($APP.J.g(["Usage: squint compile \x3cfiles\x3e \x3copts\x3e"],0)),$APP.Up(),$APP.Up.j($APP.J.g(["Options:\n\n--elide-imports: do not include imports\n--elide-exports: do not include exports\n--extension: default extension for JS files"],
|
|
29
29
|
0))):$APP.qf.l(function(c,d){return Promise.resolve(c).then(function(){$APP.Up.j($APP.J.g(["[squint] Compiling CLJS file:",d],0));return $APP.HM($APP.Bk.l(a,$APP.DM,d))}).then(function(e){e=$APP.uh(e);e=$APP.ef.g(e,$APP.FM);$APP.Up.j($APP.J.g(["[squint] Wrote JS file:",e],0));return e})},null,b)},K9=new $APP.D(null,"hyphens","hyphens",2113533609),C9=new $APP.D(null,"spec","spec",347520401),r9=new $APP.D(null,"coerce","coerce",1917884504),F9=new $APP.D(null,"restrict","restrict",-1071101511),L9=new $APP.D(null,
|
|
30
30
|
"keywords","keywords",1526959054),d$=new $APP.D("squint.repl.node","continue","squint.repl.node/continue",1558138730),I9=new $APP.D(null,"msg","msg",-1386103444),h$=new $APP.D(null,"show","show",-576705889),M9=new $APP.D(null,"boolean","boolean",-1919418404),l9=new $APP.D(null,"input","input",556931961),i$=new $APP.D(null,"rest-cmds","rest-cmds",-423198324),D9=new $APP.D("org.babashka","cli","org.babashka/cli",1162430315),A9=new $APP.D(null,"args-\x3eopts","args-\x3eopts",964391046),s9=new $APP.D(null,
|
|
31
31
|
"alias","alias",-2039751630),E9=new $APP.D(null,"collect","collect",-284321549),k9=new $APP.D("babashka.cli","error","babashka.cli/error",-939678701),j$=new $APP.D(null,"no-run","no-run",-1534313596),t9=new $APP.D(null,"validate","validate",-201300827),f$=new $APP.D(null,"help","help",-439233446),N9=new $APP.D(null,"cause","cause",231901252),m9=new $APP.D(null,"coerce-fn","coerce-fn",-821146515),y9=new $APP.D(null,"args","args",1315556576),w9=new $APP.D(null,"no-keyword-opts","no-keyword-opts",761286018),
|
|
32
32
|
P9=new $APP.D(null,"value","value",305978217),Q9=new $APP.D(null,"pred","pred",1927423397),G9=new $APP.D(null,"closed","closed",-919675359),c$=new $APP.D("squint.repl.node","eof-while-reading","squint.repl.node/eof-while-reading",198833493),H9=new $APP.D(null,"error-fn","error-fn",-171437615),O9=new $APP.D(null,"option","option",65132272),u9=new $APP.D(null,"exec-args","exec-args",-1860766354),R9=new $APP.D(null,"ex-msg","ex-msg",-1111774387),b9=new $APP.D(null,"s","s",1705939918),J9=new $APP.D(null,
|
|
33
33
|
"cmds-opts","cmds-opts",-390130362),k$=new $APP.D(null,"h","h",1109658740),l$=new $APP.D(null,"e","e",1381269198),x9=new $APP.D(null,"cmds","cmds",-1841503952);var W9=$APP.Sl.h(""),V9=$APP.Sl.h(!1),m$,n$=process.stdout.isTTY;m$=$APP.r(n$)?process.stdin.setRawMode:n$;process.binding("contextify");var a$=$APP.Sl.h($APP.uy),o$=function o$(a){switch(arguments.length){case 0:return o$.v();case 1:return o$.h(arguments[0]);default:throw Error(["Invalid arity: ",$APP.t.h(arguments.length)].join(""));}};o$.v=function(){return o$.h(null)};
|
|
34
|
-
o$.h=function(){$APP.uy=$APP.
|
|
34
|
+
o$.h=function(){$APP.uy=$APP.mA;$APP.zw=$APP.gw=!0;$APP.r(m$)&&process.stdin.setRawMode(!0);return $9("globalThis.user \x3d globalThis.user || {};").then(function(){return new Promise(function(a){var b=$APP.r(null)?esm_import$readline.createInterface({input:null,output:null}):esm_import$readline.createInterface({input:process.stdin,output:process.stdout});e$(b);b.setPrompt([$APP.t.h($APP.uy),"\x3d\x3e "].join(""));b.on("close",a);return b.prompt()})})};o$.m=1;var p$=new $APP.F(null,4,5,$APP.G,[new $APP.p(null,3,[x9,new $APP.F(null,1,5,$APP.G,["run"],null),$APP.nv,function(a){a=$APP.uh(a);a=$APP.ef.g(a,$APP.kJ);var b=$APP.uh(a),c=$APP.ef.g(b,$APP.ks);b=$APP.ef.g(b,f$);if($APP.r(b))return null;$APP.Up.j($APP.J.g(["[squint] Running",c],0));return $APP.HM($APP.Bk.l(a,$APP.DM,c)).then(function(d){d=$APP.uh(d);d=$APP.ef.g(d,$APP.FM);d=$APP.r(esm_import$path.isAbsolute(d))?d:[$APP.t.h(process.cwd()),"/",$APP.t.h(d)].join("");return shadow_esm_import(d)})},J9,
|
|
35
35
|
new $APP.F(null,1,5,$APP.G,[$APP.ks],null)],null),new $APP.p(null,3,[x9,new $APP.F(null,1,5,$APP.G,["compile"],null),r9,new $APP.p(null,2,[$APP.qy,M9,$APP.ry,M9],null),$APP.nv,function(a){var b=$APP.uh(a);a=$APP.ef.g(b,i$);b=$APP.ef.g(b,$APP.kJ);return g$(b,a)}],null),new $APP.p(null,2,[x9,new $APP.F(null,1,5,$APP.G,["repl"],null),$APP.nv,o$],null),new $APP.p(null,2,[x9,$APP.wi,$APP.nv,function(a){a=$APP.uh(a);var b=$APP.ef.g(a,i$),c=$APP.ef.g(a,$APP.kJ);a=l$.h(c);if($APP.r(a)){if($APP.r(f$.h(c)))return $APP.Up.j($APP.J.g(["Usage: squint -e \x3cexpr\x3e \x3copts\x3e\n\nOptions:\n\n--no-run: do not run compiled expression\n--show: print compiled expression"],
|
|
36
36
|
0));a=$APP.hG.h(a);var d=esm_import$fs.mkdtempSync(".tmp"),e=[$APP.t.h(d),"/squint.mjs"].join("");esm_import$fs.writeFileSync(e,a,"utf-8");$APP.r(h$.h(c))&&$APP.Up.j($APP.J.g([a],0));if($APP.r(j$.h(c)))return null;a=$APP.r(esm_import$path.isAbsolute(e))?e:[$APP.t.h(process.cwd()),"/",e].join("");return shadow_esm_import(a).finally(function(){return esm_import$fs.rmSync(d,{force:!0,recursive:!0})})}return $APP.r(function(){var f=f$.h(c);return $APP.r(f)?f:$APP.ee.g("help",$APP.x(b))||$APP.ze(b)}())?
|
|
37
37
|
$APP.Up.j($APP.J.g(["Squint v0.0.0\n\nUsage: squint \x3csubcommand\x3e \x3copts\x3e\n\nSubcommands:\n\n-e \x3cexpr\x3e Compile and run expression.\nrun \x3cfile.cljs\x3e Compile and run a file\ncompile \x3cfile.cljs\x3e ... Compile file(s)\nrepl Start repl\nhelp Print this help\n\nUse squint \x3csubcommand\x3e --help to show more info."],0)):g$(c,b)}],null)],null);(function(){var a=new $APP.p(null,1,[$APP.XI,new $APP.p(null,1,[k$,f$],null)],null),b=z9(process.argv.slice(2),a),c=$APP.uh(b),d=$APP.ef.g(c,x9),e=$APP.ef.g(c,y9);return $APP.qf.l(function(f,l){f=$APP.uh(l);var k=$APP.ef.g(f,x9),m=$APP.ef.g(f,$APP.nv),h=U9(k,d);if($APP.r(h)){l=function(){var v=null==h?null:$APP.w(h);return null==v?null:$APP.sf(v)}();l=$APP.N.g(l,e);f=T9(l,a9(a,$APP.J.g([f],0)));l=$APP.uh(f);var q=$APP.ef.g(l,$APP.kJ);f=$APP.ef.g(l,y9);l=$APP.ef.g(l,x9);var n=$APP.N.g(l,f);return $APP.Rd(function(){var v=
|