squint-cljs 0.12.192 → 0.12.193
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/lib/cli.js +45 -45
- package/lib/cljs.pprint.js +258 -258
- package/lib/compiler.js +741 -741
- package/lib/compiler.node.js +34 -31
- package/lib/compiler.sci.js +1135 -1138
- package/lib/node.nrepl_server.js +27 -19
- package/lib/squint.core.umd.js +1 -1
- package/package.json +1 -1
- package/src/squint/core.js +32 -18
- package/src/squint/multi.js +10 -10
- package/src/squint/set.js +3 -3
- package/src/squint/string.js +20 -3
- package/src/squint/test.js +42 -42
- package/vite.js +25 -1
package/src/squint/test.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as clojure_DOT_string from 'squint-cljs/src/squint/string.js';
|
|
|
4
4
|
var _STAR_current_env_STAR_ = null;
|
|
5
5
|
var _STAR_current_reporter_STAR_ = "cljs.test/default";
|
|
6
6
|
var current_reporter = function () {
|
|
7
|
-
const
|
|
8
|
-
if (squint_core.truth_(
|
|
9
|
-
return
|
|
7
|
+
const or__23719__auto__1 = _STAR_current_reporter_STAR_;
|
|
8
|
+
if (squint_core.truth_(or__23719__auto__1)) {
|
|
9
|
+
return or__23719__auto__1} else {
|
|
10
10
|
return "cljs.test/default"};
|
|
11
11
|
|
|
12
12
|
};
|
|
@@ -15,9 +15,9 @@ return ({"report-counters": ({"test": 0, "pass": 0, "fail": 0, "error": 0}), "te
|
|
|
15
15
|
|
|
16
16
|
};
|
|
17
17
|
var get_current_env = function () {
|
|
18
|
-
const
|
|
19
|
-
if (squint_core.truth_(
|
|
20
|
-
return
|
|
18
|
+
const or__23719__auto__1 = _STAR_current_env_STAR_;
|
|
19
|
+
if (squint_core.truth_(or__23719__auto__1)) {
|
|
20
|
+
return or__23719__auto__1} else {
|
|
21
21
|
return empty_env()};
|
|
22
22
|
|
|
23
23
|
};
|
|
@@ -34,10 +34,10 @@ return null;
|
|
|
34
34
|
var update_current_env_BANG_ = (() => {
|
|
35
35
|
const f1 = (function (var_args) {
|
|
36
36
|
const args21 = [];
|
|
37
|
-
const
|
|
37
|
+
const len__23467__auto__2 = arguments.length;
|
|
38
38
|
let i33 = 0;
|
|
39
39
|
while(true){
|
|
40
|
-
if ((i33 <
|
|
40
|
+
if ((i33 < len__23467__auto__2)) {
|
|
41
41
|
args21.push((arguments[i33]));
|
|
42
42
|
let G__4 = (i33 + 1);
|
|
43
43
|
i33 = G__4;
|
|
@@ -45,8 +45,8 @@ continue;
|
|
|
45
45
|
};break;
|
|
46
46
|
}
|
|
47
47
|
;
|
|
48
|
-
const
|
|
49
|
-
return f1.cljs$core$IFn$_invoke$arity$variadic((arguments[0]), (arguments[1]),
|
|
48
|
+
const argseq__23695__auto__5 = (((2 < args21.length)) ? (args21.slice(2)) : (null));
|
|
49
|
+
return f1.cljs$core$IFn$_invoke$arity$variadic((arguments[0]), (arguments[1]), argseq__23695__auto__5);
|
|
50
50
|
|
|
51
51
|
});
|
|
52
52
|
f1.cljs$core$IFn$_invoke$arity$variadic = (function (ks, f, args) {
|
|
@@ -60,17 +60,17 @@ return f1;
|
|
|
60
60
|
|
|
61
61
|
})();
|
|
62
62
|
var testing_contexts_str = function () {
|
|
63
|
-
const
|
|
64
|
-
if (squint_core.truth_(
|
|
65
|
-
const contexts2 =
|
|
63
|
+
const temp__23371__auto__1 = squint_core.seq(squint_core.get(get_current_env(), "testing-contexts"));
|
|
64
|
+
if (squint_core.truth_(temp__23371__auto__1)) {
|
|
65
|
+
const contexts2 = temp__23371__auto__1;
|
|
66
66
|
return clojure_DOT_string.join(" ", squint_core.reverse(contexts2));
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
};
|
|
70
70
|
var testing_vars_str = function () {
|
|
71
|
-
const
|
|
72
|
-
if (squint_core.truth_(
|
|
73
|
-
const vars2 =
|
|
71
|
+
const temp__23371__auto__1 = squint_core.seq(squint_core.get(get_current_env(), "testing-vars"));
|
|
72
|
+
if (squint_core.truth_(temp__23371__auto__1)) {
|
|
73
|
+
const vars2 = temp__23371__auto__1;
|
|
74
74
|
return clojure_DOT_string.join(" ", squint_core.map(squint_core.str, vars2));
|
|
75
75
|
};
|
|
76
76
|
|
|
@@ -85,10 +85,10 @@ var current_test_str = function () {
|
|
|
85
85
|
const vars1 = testing_vars_str();
|
|
86
86
|
const ctx2 = testing_contexts_str();
|
|
87
87
|
if (squint_core.truth_((() => {
|
|
88
|
-
const
|
|
89
|
-
if (squint_core.truth_(
|
|
88
|
+
const and__23759__auto__3 = vars1;
|
|
89
|
+
if (squint_core.truth_(and__23759__auto__3)) {
|
|
90
90
|
return ctx2} else {
|
|
91
|
-
return
|
|
91
|
+
return and__23759__auto__3};
|
|
92
92
|
|
|
93
93
|
})())) {
|
|
94
94
|
return `${vars1??''}${" "}${ctx2??''}`} else {
|
|
@@ -107,12 +107,12 @@ const line3 = squint_core.get(map__12, "line");
|
|
|
107
107
|
const column4 = squint_core.get(map__12, "column");
|
|
108
108
|
const file5 = squint_core.get(map__12, "file");
|
|
109
109
|
if (squint_core.truth_((() => {
|
|
110
|
-
const
|
|
111
|
-
if (squint_core.truth_(
|
|
112
|
-
return
|
|
113
|
-
const
|
|
114
|
-
if (squint_core.truth_(
|
|
115
|
-
return
|
|
110
|
+
const or__23719__auto__6 = line3;
|
|
111
|
+
if (squint_core.truth_(or__23719__auto__6)) {
|
|
112
|
+
return or__23719__auto__6} else {
|
|
113
|
+
const or__23719__auto__7 = column4;
|
|
114
|
+
if (squint_core.truth_(or__23719__auto__7)) {
|
|
115
|
+
return or__23719__auto__7} else {
|
|
116
116
|
return file5};
|
|
117
117
|
};
|
|
118
118
|
|
|
@@ -136,9 +136,9 @@ return inc_report_counter_BANG_("pass");
|
|
|
136
136
|
squint_multi.defmethod(report, ["cljs.test/default", "fail"], (function (m) {
|
|
137
137
|
inc_report_counter_BANG_("fail");
|
|
138
138
|
console.error(`${"FAIL in "}${current_test_str()??''}${(() => {
|
|
139
|
-
const
|
|
140
|
-
if (squint_core.truth_(
|
|
141
|
-
const l2 =
|
|
139
|
+
const temp__23371__auto__1 = report_loc(m);
|
|
140
|
+
if (squint_core.truth_(temp__23371__auto__1)) {
|
|
141
|
+
const l2 = temp__23371__auto__1;
|
|
142
142
|
return `${" ("}${l2??''}${")"}`;
|
|
143
143
|
};
|
|
144
144
|
|
|
@@ -152,9 +152,9 @@ return console.error(" actual:", squint_core.pr_str(squint_core.get(m, "actua
|
|
|
152
152
|
squint_multi.defmethod(report, ["cljs.test/default", "error"], (function (m) {
|
|
153
153
|
inc_report_counter_BANG_("error");
|
|
154
154
|
console.error(`${"ERROR in "}${current_test_str()??''}${(() => {
|
|
155
|
-
const
|
|
156
|
-
if (squint_core.truth_(
|
|
157
|
-
const l2 =
|
|
155
|
+
const temp__23371__auto__1 = report_loc(m);
|
|
156
|
+
if (squint_core.truth_(temp__23371__auto__1)) {
|
|
157
|
+
const l2 = temp__23371__auto__1;
|
|
158
158
|
return `${" ("}${l2??''}${")"}`;
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -197,10 +197,10 @@ return ((squint_core.get(results, "fail", 0) === 0) && (squint_core.get(results,
|
|
|
197
197
|
|
|
198
198
|
};
|
|
199
199
|
var async_QMARK_ = function (x) {
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
return
|
|
200
|
+
const c__23690__auto__1 = Promise;
|
|
201
|
+
const x__23691__auto__2 = x;
|
|
202
|
+
const ret__23692__auto__3 = (x__23691__auto__2 instanceof c__23690__auto__1);
|
|
203
|
+
return ret__23692__auto__3;
|
|
204
204
|
|
|
205
205
|
};
|
|
206
206
|
var wrap_async = function (setup, teardown) {
|
|
@@ -344,9 +344,9 @@ return f20;
|
|
|
344
344
|
var test_var = function (v) {
|
|
345
345
|
if (squint_core.truth_(squint_core.fn_QMARK_(v))) {
|
|
346
346
|
const test_name1 = (() => {
|
|
347
|
-
const
|
|
348
|
-
if (squint_core.truth_(
|
|
349
|
-
return
|
|
347
|
+
const or__23719__auto__2 = squint_core.get(squint_core.meta(v), "name");
|
|
348
|
+
if (squint_core.truth_(or__23719__auto__2)) {
|
|
349
|
+
return or__23719__auto__2} else {
|
|
350
350
|
return "anonymous"};
|
|
351
351
|
|
|
352
352
|
})();
|
|
@@ -469,10 +469,10 @@ var fresh_counters = ({"test": 0, "pass": 0, "fail": 0, "error": 0});
|
|
|
469
469
|
var run_tests = (() => {
|
|
470
470
|
const f26 = (function (var_args) {
|
|
471
471
|
const args271 = [];
|
|
472
|
-
const
|
|
472
|
+
const len__23467__auto__2 = arguments.length;
|
|
473
473
|
let i283 = 0;
|
|
474
474
|
while(true){
|
|
475
|
-
if ((i283 <
|
|
475
|
+
if ((i283 < len__23467__auto__2)) {
|
|
476
476
|
args271.push((arguments[i283]));
|
|
477
477
|
let G__4 = (i283 + 1);
|
|
478
478
|
i283 = G__4;
|
|
@@ -480,8 +480,8 @@ continue;
|
|
|
480
480
|
};break;
|
|
481
481
|
}
|
|
482
482
|
;
|
|
483
|
-
const
|
|
484
|
-
return f26.cljs$core$IFn$_invoke$arity$variadic(
|
|
483
|
+
const argseq__23695__auto__5 = (((0 < args271.length)) ? (args271.slice(0)) : (null));
|
|
484
|
+
return f26.cljs$core$IFn$_invoke$arity$variadic(argseq__23695__auto__5);
|
|
485
485
|
|
|
486
486
|
});
|
|
487
487
|
f26.cljs$core$IFn$_invoke$arity$variadic = (function (args) {
|
package/vite.js
CHANGED
|
@@ -77,8 +77,32 @@ async function __squintImport(spec) {
|
|
|
77
77
|
const url = await res.text();
|
|
78
78
|
return __rawImport(url);
|
|
79
79
|
}
|
|
80
|
+
// JS-interop completion against the page's globalThis. Mirrors js-completions
|
|
81
|
+
// in squint.repl.nrepl-server (node side) so browser and node behave the same.
|
|
82
|
+
function __jsCompletions(prefix) {
|
|
83
|
+
if (!prefix || !prefix.startsWith('js/')) return [];
|
|
84
|
+
const s = prefix.slice(3);
|
|
85
|
+
const parts = s.split('.');
|
|
86
|
+
const partial = parts[parts.length - 1];
|
|
87
|
+
const path = parts.slice(0, -1);
|
|
88
|
+
let obj = globalThis;
|
|
89
|
+
for (const seg of path) { obj = obj == null ? obj : obj[seg]; }
|
|
90
|
+
if (obj == null) return [];
|
|
91
|
+
const acc = new Set();
|
|
92
|
+
for (let o = obj; o != null; o = Object.getPrototypeOf(o)) {
|
|
93
|
+
for (const n of Object.getOwnPropertyNames(o)) acc.add(n);
|
|
94
|
+
}
|
|
95
|
+
const pre = 'js/' + (path.length ? path.join('.') + '.' : '');
|
|
96
|
+
return Array.from(acc).filter((n) => n.startsWith(partial)).sort().slice(0, 100).map((n) => pre + n);
|
|
97
|
+
}
|
|
80
98
|
if (import.meta.hot) {
|
|
81
|
-
import.meta.hot.on('squint:nrepl', async ({ op, code, id, session }) => {
|
|
99
|
+
import.meta.hot.on('squint:nrepl', async ({ op, code, id, session, prefix }) => {
|
|
100
|
+
if (op === 'complete-js') {
|
|
101
|
+
import.meta.hot.send('squint:nrepl-reply', {
|
|
102
|
+
op: 'complete-js', id, session, completions: __jsCompletions(prefix),
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
82
106
|
if (op !== 'eval') return;
|
|
83
107
|
// bare dynamic imports in eval'd code resolve through __squintImport
|
|
84
108
|
// (\\s* tolerates squint emitting e.g. \`import ('preact')\` for :refer)
|