@hailstails/hone 0.1.0-pre.8 → 0.1.0-pre.9
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/ADOPTING.md +2 -2
- package/CHANGELOG.md +6 -0
- package/MIGRATING.md +1 -1
- package/README.md +4 -4
- package/api/audit.js +0 -1
- package/api/testing.js +8 -9
- package/chunks/chunk-5X2BR42Y.js +117 -0
- package/chunks/{chunk-NRXSM7BY.js → chunk-LHVFZMXD.js} +10 -7
- package/chunks/{chunk-5LCLBXP7.js → chunk-NILRE23T.js} +1 -1
- package/chunks/{chunk-P3NLETF5.js → chunk-OKQHVZLO.js} +1 -1
- package/chunks/{chunk-POZL7G62.js → chunk-OVEQ37JQ.js} +40 -37
- package/chunks/chunk-RNXPEK2U.js +77 -0
- package/chunks/{chunk-XXLMIBLS.js → chunk-XE6RNNZB.js} +162 -143
- package/chunks/{chunk-WPRR2MPJ.js → chunk-YL6WR3QW.js} +5 -5
- package/core/check/tool-command.js +20 -20
- package/mechanisms/audit/CD-1/any-cast.js +0 -1
- package/mechanisms/audit/CD-10/throws-in-tests.js +0 -1
- package/mechanisms/audit/CD-14/class-syntax.js +0 -1
- package/mechanisms/audit/CD-15/loops.js +0 -1
- package/mechanisms/audit/CD-17/clock-sources.js +0 -1
- package/mechanisms/audit/CD-19/import-boundaries.js +2 -3
- package/mechanisms/audit/CD-2/cast-expressions.js +0 -1
- package/mechanisms/audit/CD-23/export-test-sibling.js +0 -1
- package/mechanisms/audit/CD-25/dependency-isolation.js +0 -1
- package/mechanisms/audit/CD-26/module-mocking.js +0 -1
- package/mechanisms/audit/CD-27/test-body-logic.js +0 -1
- package/mechanisms/audit/CD-3/compiler-overrides.js +2 -861
- package/mechanisms/audit/CD-43/boolean-signatures.js +0 -1
- package/mechanisms/audit/CD-44/parameter-mutation.js +0 -1
- package/mechanisms/audit/CD-47/hermetic-git-spawns.js +0 -1
- package/mechanisms/audit/CD-5/comments-directives.js +3 -4
- package/mechanisms/audit/CD-6/identifier-names.js +0 -1
- package/mechanisms/audit/CD-7/categorical-paths.js +0 -1
- package/mechanisms/audit/CD-7a/factory-return-types.js +0 -1
- package/mechanisms/audit/CD-8/switch-defaults.js +0 -1
- package/mechanisms/audit/runner/runner.js +31 -27
- package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-2/cd2/cd2.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +0 -2
- package/mechanisms/eslint/runner/README.md +1 -1
- package/mechanisms/eslint/runner/runner.js +58 -2532
- package/package.json +6 -2
- package/THIRD-PARTY-NOTICES.md +0 -354
- package/chunks/chunk-MYX7GAVM.js +0 -73
- package/chunks/chunk-NCDYOPHG.js +0 -19832
- package/chunks/chunk-NZLE2WMY.js +0 -35
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
eslintConfigLookupSchema,
|
|
3
3
|
parsedJson
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-OVEQ37JQ.js";
|
|
5
5
|
import {
|
|
6
6
|
createDefaultPackageLocationPort,
|
|
7
7
|
installRootOfRunnerEntry,
|
|
8
8
|
toolchainBoundEmbeddedRunner
|
|
9
|
-
} from "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-OKQHVZLO.js";
|
|
10
10
|
import {
|
|
11
11
|
gatheredOutcomes,
|
|
12
12
|
listedOutcome
|
|
@@ -28,2349 +28,20 @@ import {
|
|
|
28
28
|
moduleFileForm,
|
|
29
29
|
repoPathSchema,
|
|
30
30
|
versionSupport
|
|
31
|
-
} from "../../../chunks/chunk-
|
|
31
|
+
} from "../../../chunks/chunk-LHVFZMXD.js";
|
|
32
32
|
import {
|
|
33
33
|
TOOL_IDENTITY,
|
|
34
34
|
clauseAddressText,
|
|
35
|
-
external_exports,
|
|
36
35
|
sameClauseAddress
|
|
37
|
-
} from "../../../chunks/chunk-
|
|
38
|
-
import {
|
|
39
|
-
__commonJS,
|
|
40
|
-
__toESM
|
|
41
|
-
} from "../../../chunks/chunk-NZLE2WMY.js";
|
|
42
|
-
|
|
43
|
-
// node_modules/prelude-ls/lib/Func.js
|
|
44
|
-
var require_Func = __commonJS({
|
|
45
|
-
"node_modules/prelude-ls/lib/Func.js"(exports, module) {
|
|
46
|
-
var apply;
|
|
47
|
-
var curry;
|
|
48
|
-
var flip;
|
|
49
|
-
var fix;
|
|
50
|
-
var over;
|
|
51
|
-
var memoize;
|
|
52
|
-
var toString$ = {}.toString;
|
|
53
|
-
apply = curry$(function(f, list) {
|
|
54
|
-
return f.apply(null, list);
|
|
55
|
-
});
|
|
56
|
-
curry = function(f) {
|
|
57
|
-
return curry$(f);
|
|
58
|
-
};
|
|
59
|
-
flip = curry$(function(f, x, y) {
|
|
60
|
-
return f(y, x);
|
|
61
|
-
});
|
|
62
|
-
fix = function(f) {
|
|
63
|
-
return /* @__PURE__ */ (function(g) {
|
|
64
|
-
return function() {
|
|
65
|
-
return f(g(g)).apply(null, arguments);
|
|
66
|
-
};
|
|
67
|
-
})(function(g) {
|
|
68
|
-
return function() {
|
|
69
|
-
return f(g(g)).apply(null, arguments);
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
over = curry$(function(f, g, x, y) {
|
|
74
|
-
return f(g(x), g(y));
|
|
75
|
-
});
|
|
76
|
-
memoize = function(f) {
|
|
77
|
-
var memo;
|
|
78
|
-
memo = {};
|
|
79
|
-
return function() {
|
|
80
|
-
var args, res$, i$, to$, key, arg;
|
|
81
|
-
res$ = [];
|
|
82
|
-
for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
|
|
83
|
-
res$.push(arguments[i$]);
|
|
84
|
-
}
|
|
85
|
-
args = res$;
|
|
86
|
-
key = (function() {
|
|
87
|
-
var i$2, ref$, len$, results$ = [];
|
|
88
|
-
for (i$2 = 0, len$ = (ref$ = args).length; i$2 < len$; ++i$2) {
|
|
89
|
-
arg = ref$[i$2];
|
|
90
|
-
results$.push(arg + toString$.call(arg).slice(8, -1));
|
|
91
|
-
}
|
|
92
|
-
return results$;
|
|
93
|
-
})().join("");
|
|
94
|
-
return memo[key] = key in memo ? memo[key] : f.apply(null, args);
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
module.exports = {
|
|
98
|
-
curry,
|
|
99
|
-
flip,
|
|
100
|
-
fix,
|
|
101
|
-
apply,
|
|
102
|
-
over,
|
|
103
|
-
memoize
|
|
104
|
-
};
|
|
105
|
-
function curry$(f, bound) {
|
|
106
|
-
var context, _curry = function(args) {
|
|
107
|
-
return f.length > 1 ? function() {
|
|
108
|
-
var params = args ? args.concat() : [];
|
|
109
|
-
context = bound ? context || this : this;
|
|
110
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
111
|
-
} : f;
|
|
112
|
-
};
|
|
113
|
-
return _curry();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// node_modules/prelude-ls/lib/List.js
|
|
119
|
-
var require_List = __commonJS({
|
|
120
|
-
"node_modules/prelude-ls/lib/List.js"(exports, module) {
|
|
121
|
-
var each;
|
|
122
|
-
var map;
|
|
123
|
-
var compact;
|
|
124
|
-
var filter;
|
|
125
|
-
var reject;
|
|
126
|
-
var remove;
|
|
127
|
-
var partition;
|
|
128
|
-
var find;
|
|
129
|
-
var head;
|
|
130
|
-
var first;
|
|
131
|
-
var tail;
|
|
132
|
-
var last;
|
|
133
|
-
var initial;
|
|
134
|
-
var empty;
|
|
135
|
-
var reverse;
|
|
136
|
-
var unique;
|
|
137
|
-
var uniqueBy;
|
|
138
|
-
var fold;
|
|
139
|
-
var foldl;
|
|
140
|
-
var fold1;
|
|
141
|
-
var foldl1;
|
|
142
|
-
var foldr;
|
|
143
|
-
var foldr1;
|
|
144
|
-
var unfoldr;
|
|
145
|
-
var concat;
|
|
146
|
-
var concatMap;
|
|
147
|
-
var flatten;
|
|
148
|
-
var difference;
|
|
149
|
-
var intersection;
|
|
150
|
-
var union;
|
|
151
|
-
var countBy;
|
|
152
|
-
var groupBy;
|
|
153
|
-
var andList;
|
|
154
|
-
var orList;
|
|
155
|
-
var any;
|
|
156
|
-
var all;
|
|
157
|
-
var sort;
|
|
158
|
-
var sortWith;
|
|
159
|
-
var sortBy;
|
|
160
|
-
var sum;
|
|
161
|
-
var product;
|
|
162
|
-
var mean;
|
|
163
|
-
var average;
|
|
164
|
-
var maximum;
|
|
165
|
-
var minimum;
|
|
166
|
-
var maximumBy;
|
|
167
|
-
var minimumBy;
|
|
168
|
-
var scan;
|
|
169
|
-
var scanl;
|
|
170
|
-
var scan1;
|
|
171
|
-
var scanl1;
|
|
172
|
-
var scanr;
|
|
173
|
-
var scanr1;
|
|
174
|
-
var slice;
|
|
175
|
-
var take;
|
|
176
|
-
var drop;
|
|
177
|
-
var splitAt;
|
|
178
|
-
var takeWhile;
|
|
179
|
-
var dropWhile;
|
|
180
|
-
var span;
|
|
181
|
-
var breakList;
|
|
182
|
-
var zip;
|
|
183
|
-
var zipWith;
|
|
184
|
-
var zipAll;
|
|
185
|
-
var zipAllWith;
|
|
186
|
-
var at;
|
|
187
|
-
var elemIndex;
|
|
188
|
-
var elemIndices;
|
|
189
|
-
var findIndex;
|
|
190
|
-
var findIndices;
|
|
191
|
-
var toString$ = {}.toString;
|
|
192
|
-
each = curry$(function(f, xs) {
|
|
193
|
-
var i$, len$, x;
|
|
194
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
195
|
-
x = xs[i$];
|
|
196
|
-
f(x);
|
|
197
|
-
}
|
|
198
|
-
return xs;
|
|
199
|
-
});
|
|
200
|
-
map = curry$(function(f, xs) {
|
|
201
|
-
var i$, len$, x, results$ = [];
|
|
202
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
203
|
-
x = xs[i$];
|
|
204
|
-
results$.push(f(x));
|
|
205
|
-
}
|
|
206
|
-
return results$;
|
|
207
|
-
});
|
|
208
|
-
compact = function(xs) {
|
|
209
|
-
var i$, len$, x, results$ = [];
|
|
210
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
211
|
-
x = xs[i$];
|
|
212
|
-
if (x) {
|
|
213
|
-
results$.push(x);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return results$;
|
|
217
|
-
};
|
|
218
|
-
filter = curry$(function(f, xs) {
|
|
219
|
-
var i$, len$, x, results$ = [];
|
|
220
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
221
|
-
x = xs[i$];
|
|
222
|
-
if (f(x)) {
|
|
223
|
-
results$.push(x);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return results$;
|
|
227
|
-
});
|
|
228
|
-
reject = curry$(function(f, xs) {
|
|
229
|
-
var i$, len$, x, results$ = [];
|
|
230
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
231
|
-
x = xs[i$];
|
|
232
|
-
if (!f(x)) {
|
|
233
|
-
results$.push(x);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return results$;
|
|
237
|
-
});
|
|
238
|
-
remove = curry$(function(el, xs) {
|
|
239
|
-
var i, x$;
|
|
240
|
-
i = elemIndex(el, xs);
|
|
241
|
-
x$ = xs.slice();
|
|
242
|
-
if (i != null) {
|
|
243
|
-
x$.splice(i, 1);
|
|
244
|
-
}
|
|
245
|
-
return x$;
|
|
246
|
-
});
|
|
247
|
-
partition = curry$(function(f, xs) {
|
|
248
|
-
var passed, failed, i$, len$, x;
|
|
249
|
-
passed = [];
|
|
250
|
-
failed = [];
|
|
251
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
252
|
-
x = xs[i$];
|
|
253
|
-
(f(x) ? passed : failed).push(x);
|
|
254
|
-
}
|
|
255
|
-
return [passed, failed];
|
|
256
|
-
});
|
|
257
|
-
find = curry$(function(f, xs) {
|
|
258
|
-
var i$, len$, x;
|
|
259
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
260
|
-
x = xs[i$];
|
|
261
|
-
if (f(x)) {
|
|
262
|
-
return x;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
head = first = function(xs) {
|
|
267
|
-
return xs[0];
|
|
268
|
-
};
|
|
269
|
-
tail = function(xs) {
|
|
270
|
-
if (!xs.length) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
return xs.slice(1);
|
|
274
|
-
};
|
|
275
|
-
last = function(xs) {
|
|
276
|
-
return xs[xs.length - 1];
|
|
277
|
-
};
|
|
278
|
-
initial = function(xs) {
|
|
279
|
-
if (!xs.length) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
return xs.slice(0, -1);
|
|
283
|
-
};
|
|
284
|
-
empty = function(xs) {
|
|
285
|
-
return !xs.length;
|
|
286
|
-
};
|
|
287
|
-
reverse = function(xs) {
|
|
288
|
-
return xs.concat().reverse();
|
|
289
|
-
};
|
|
290
|
-
unique = function(xs) {
|
|
291
|
-
var result, i$, len$, x;
|
|
292
|
-
result = [];
|
|
293
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
294
|
-
x = xs[i$];
|
|
295
|
-
if (!in$(x, result)) {
|
|
296
|
-
result.push(x);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return result;
|
|
300
|
-
};
|
|
301
|
-
uniqueBy = curry$(function(f, xs) {
|
|
302
|
-
var seen, i$, len$, x, val, results$ = [];
|
|
303
|
-
seen = [];
|
|
304
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
305
|
-
x = xs[i$];
|
|
306
|
-
val = f(x);
|
|
307
|
-
if (in$(val, seen)) {
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
310
|
-
seen.push(val);
|
|
311
|
-
results$.push(x);
|
|
312
|
-
}
|
|
313
|
-
return results$;
|
|
314
|
-
});
|
|
315
|
-
fold = foldl = curry$(function(f, memo, xs) {
|
|
316
|
-
var i$, len$, x;
|
|
317
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
318
|
-
x = xs[i$];
|
|
319
|
-
memo = f(memo, x);
|
|
320
|
-
}
|
|
321
|
-
return memo;
|
|
322
|
-
});
|
|
323
|
-
fold1 = foldl1 = curry$(function(f, xs) {
|
|
324
|
-
return fold(f, xs[0], xs.slice(1));
|
|
325
|
-
});
|
|
326
|
-
foldr = curry$(function(f, memo, xs) {
|
|
327
|
-
var i$, x;
|
|
328
|
-
for (i$ = xs.length - 1; i$ >= 0; --i$) {
|
|
329
|
-
x = xs[i$];
|
|
330
|
-
memo = f(x, memo);
|
|
331
|
-
}
|
|
332
|
-
return memo;
|
|
333
|
-
});
|
|
334
|
-
foldr1 = curry$(function(f, xs) {
|
|
335
|
-
return foldr(f, xs[xs.length - 1], xs.slice(0, -1));
|
|
336
|
-
});
|
|
337
|
-
unfoldr = curry$(function(f, b) {
|
|
338
|
-
var result, x, that;
|
|
339
|
-
result = [];
|
|
340
|
-
x = b;
|
|
341
|
-
while ((that = f(x)) != null) {
|
|
342
|
-
result.push(that[0]);
|
|
343
|
-
x = that[1];
|
|
344
|
-
}
|
|
345
|
-
return result;
|
|
346
|
-
});
|
|
347
|
-
concat = function(xss) {
|
|
348
|
-
return [].concat.apply([], xss);
|
|
349
|
-
};
|
|
350
|
-
concatMap = curry$(function(f, xs) {
|
|
351
|
-
var x;
|
|
352
|
-
return [].concat.apply([], (function() {
|
|
353
|
-
var i$, ref$, len$, results$ = [];
|
|
354
|
-
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
|
355
|
-
x = ref$[i$];
|
|
356
|
-
results$.push(f(x));
|
|
357
|
-
}
|
|
358
|
-
return results$;
|
|
359
|
-
})());
|
|
360
|
-
});
|
|
361
|
-
flatten = function(xs) {
|
|
362
|
-
var x;
|
|
363
|
-
return [].concat.apply([], (function() {
|
|
364
|
-
var i$, ref$, len$, results$ = [];
|
|
365
|
-
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
|
366
|
-
x = ref$[i$];
|
|
367
|
-
if (toString$.call(x).slice(8, -1) === "Array") {
|
|
368
|
-
results$.push(flatten(x));
|
|
369
|
-
} else {
|
|
370
|
-
results$.push(x);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return results$;
|
|
374
|
-
})());
|
|
375
|
-
};
|
|
376
|
-
difference = function(xs) {
|
|
377
|
-
var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
|
|
378
|
-
res$ = [];
|
|
379
|
-
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
380
|
-
res$.push(arguments[i$]);
|
|
381
|
-
}
|
|
382
|
-
yss = res$;
|
|
383
|
-
results = [];
|
|
384
|
-
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
385
|
-
x = xs[i$];
|
|
386
|
-
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
|
387
|
-
ys = yss[j$];
|
|
388
|
-
if (in$(x, ys)) {
|
|
389
|
-
continue outer;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
results.push(x);
|
|
393
|
-
}
|
|
394
|
-
return results;
|
|
395
|
-
};
|
|
396
|
-
intersection = function(xs) {
|
|
397
|
-
var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
|
|
398
|
-
res$ = [];
|
|
399
|
-
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
400
|
-
res$.push(arguments[i$]);
|
|
401
|
-
}
|
|
402
|
-
yss = res$;
|
|
403
|
-
results = [];
|
|
404
|
-
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
405
|
-
x = xs[i$];
|
|
406
|
-
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
|
407
|
-
ys = yss[j$];
|
|
408
|
-
if (!in$(x, ys)) {
|
|
409
|
-
continue outer;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
results.push(x);
|
|
413
|
-
}
|
|
414
|
-
return results;
|
|
415
|
-
};
|
|
416
|
-
union = function() {
|
|
417
|
-
var xss, res$, i$, to$, results, len$, xs, j$, len1$, x;
|
|
418
|
-
res$ = [];
|
|
419
|
-
for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
|
|
420
|
-
res$.push(arguments[i$]);
|
|
421
|
-
}
|
|
422
|
-
xss = res$;
|
|
423
|
-
results = [];
|
|
424
|
-
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
|
425
|
-
xs = xss[i$];
|
|
426
|
-
for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
|
|
427
|
-
x = xs[j$];
|
|
428
|
-
if (!in$(x, results)) {
|
|
429
|
-
results.push(x);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
return results;
|
|
434
|
-
};
|
|
435
|
-
countBy = curry$(function(f, xs) {
|
|
436
|
-
var results, i$, len$, x, key;
|
|
437
|
-
results = {};
|
|
438
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
439
|
-
x = xs[i$];
|
|
440
|
-
key = f(x);
|
|
441
|
-
if (key in results) {
|
|
442
|
-
results[key] += 1;
|
|
443
|
-
} else {
|
|
444
|
-
results[key] = 1;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return results;
|
|
448
|
-
});
|
|
449
|
-
groupBy = curry$(function(f, xs) {
|
|
450
|
-
var results, i$, len$, x, key;
|
|
451
|
-
results = {};
|
|
452
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
453
|
-
x = xs[i$];
|
|
454
|
-
key = f(x);
|
|
455
|
-
if (key in results) {
|
|
456
|
-
results[key].push(x);
|
|
457
|
-
} else {
|
|
458
|
-
results[key] = [x];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return results;
|
|
462
|
-
});
|
|
463
|
-
andList = function(xs) {
|
|
464
|
-
var i$, len$, x;
|
|
465
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
466
|
-
x = xs[i$];
|
|
467
|
-
if (!x) {
|
|
468
|
-
return false;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return true;
|
|
472
|
-
};
|
|
473
|
-
orList = function(xs) {
|
|
474
|
-
var i$, len$, x;
|
|
475
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
476
|
-
x = xs[i$];
|
|
477
|
-
if (x) {
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return false;
|
|
482
|
-
};
|
|
483
|
-
any = curry$(function(f, xs) {
|
|
484
|
-
var i$, len$, x;
|
|
485
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
486
|
-
x = xs[i$];
|
|
487
|
-
if (f(x)) {
|
|
488
|
-
return true;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return false;
|
|
492
|
-
});
|
|
493
|
-
all = curry$(function(f, xs) {
|
|
494
|
-
var i$, len$, x;
|
|
495
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
496
|
-
x = xs[i$];
|
|
497
|
-
if (!f(x)) {
|
|
498
|
-
return false;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return true;
|
|
502
|
-
});
|
|
503
|
-
sort = function(xs) {
|
|
504
|
-
return xs.concat().sort(function(x, y) {
|
|
505
|
-
if (x > y) {
|
|
506
|
-
return 1;
|
|
507
|
-
} else if (x < y) {
|
|
508
|
-
return -1;
|
|
509
|
-
} else {
|
|
510
|
-
return 0;
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
};
|
|
514
|
-
sortWith = curry$(function(f, xs) {
|
|
515
|
-
return xs.concat().sort(f);
|
|
516
|
-
});
|
|
517
|
-
sortBy = curry$(function(f, xs) {
|
|
518
|
-
return xs.concat().sort(function(x, y) {
|
|
519
|
-
if (f(x) > f(y)) {
|
|
520
|
-
return 1;
|
|
521
|
-
} else if (f(x) < f(y)) {
|
|
522
|
-
return -1;
|
|
523
|
-
} else {
|
|
524
|
-
return 0;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
sum = function(xs) {
|
|
529
|
-
var result, i$, len$, x;
|
|
530
|
-
result = 0;
|
|
531
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
532
|
-
x = xs[i$];
|
|
533
|
-
result += x;
|
|
534
|
-
}
|
|
535
|
-
return result;
|
|
536
|
-
};
|
|
537
|
-
product = function(xs) {
|
|
538
|
-
var result, i$, len$, x;
|
|
539
|
-
result = 1;
|
|
540
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
541
|
-
x = xs[i$];
|
|
542
|
-
result *= x;
|
|
543
|
-
}
|
|
544
|
-
return result;
|
|
545
|
-
};
|
|
546
|
-
mean = average = function(xs) {
|
|
547
|
-
var sum2, i$, len$, x;
|
|
548
|
-
sum2 = 0;
|
|
549
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
550
|
-
x = xs[i$];
|
|
551
|
-
sum2 += x;
|
|
552
|
-
}
|
|
553
|
-
return sum2 / xs.length;
|
|
554
|
-
};
|
|
555
|
-
maximum = function(xs) {
|
|
556
|
-
var max, i$, ref$, len$, x;
|
|
557
|
-
max = xs[0];
|
|
558
|
-
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
|
559
|
-
x = ref$[i$];
|
|
560
|
-
if (x > max) {
|
|
561
|
-
max = x;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
return max;
|
|
565
|
-
};
|
|
566
|
-
minimum = function(xs) {
|
|
567
|
-
var min, i$, ref$, len$, x;
|
|
568
|
-
min = xs[0];
|
|
569
|
-
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
|
570
|
-
x = ref$[i$];
|
|
571
|
-
if (x < min) {
|
|
572
|
-
min = x;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return min;
|
|
576
|
-
};
|
|
577
|
-
maximumBy = curry$(function(f, xs) {
|
|
578
|
-
var max, i$, ref$, len$, x;
|
|
579
|
-
max = xs[0];
|
|
580
|
-
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
|
581
|
-
x = ref$[i$];
|
|
582
|
-
if (f(x) > f(max)) {
|
|
583
|
-
max = x;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return max;
|
|
587
|
-
});
|
|
588
|
-
minimumBy = curry$(function(f, xs) {
|
|
589
|
-
var min, i$, ref$, len$, x;
|
|
590
|
-
min = xs[0];
|
|
591
|
-
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
|
592
|
-
x = ref$[i$];
|
|
593
|
-
if (f(x) < f(min)) {
|
|
594
|
-
min = x;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
return min;
|
|
598
|
-
});
|
|
599
|
-
scan = scanl = curry$(function(f, memo, xs) {
|
|
600
|
-
var last2, x;
|
|
601
|
-
last2 = memo;
|
|
602
|
-
return [memo].concat((function() {
|
|
603
|
-
var i$, ref$, len$, results$ = [];
|
|
604
|
-
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
|
605
|
-
x = ref$[i$];
|
|
606
|
-
results$.push(last2 = f(last2, x));
|
|
607
|
-
}
|
|
608
|
-
return results$;
|
|
609
|
-
})());
|
|
610
|
-
});
|
|
611
|
-
scan1 = scanl1 = curry$(function(f, xs) {
|
|
612
|
-
if (!xs.length) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
return scan(f, xs[0], xs.slice(1));
|
|
616
|
-
});
|
|
617
|
-
scanr = curry$(function(f, memo, xs) {
|
|
618
|
-
xs = xs.concat().reverse();
|
|
619
|
-
return scan(f, memo, xs).reverse();
|
|
620
|
-
});
|
|
621
|
-
scanr1 = curry$(function(f, xs) {
|
|
622
|
-
if (!xs.length) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
xs = xs.concat().reverse();
|
|
626
|
-
return scan(f, xs[0], xs.slice(1)).reverse();
|
|
627
|
-
});
|
|
628
|
-
slice = curry$(function(x, y, xs) {
|
|
629
|
-
return xs.slice(x, y);
|
|
630
|
-
});
|
|
631
|
-
take = curry$(function(n, xs) {
|
|
632
|
-
if (n <= 0) {
|
|
633
|
-
return xs.slice(0, 0);
|
|
634
|
-
} else {
|
|
635
|
-
return xs.slice(0, n);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
drop = curry$(function(n, xs) {
|
|
639
|
-
if (n <= 0) {
|
|
640
|
-
return xs;
|
|
641
|
-
} else {
|
|
642
|
-
return xs.slice(n);
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
splitAt = curry$(function(n, xs) {
|
|
646
|
-
return [take(n, xs), drop(n, xs)];
|
|
647
|
-
});
|
|
648
|
-
takeWhile = curry$(function(p, xs) {
|
|
649
|
-
var len, i;
|
|
650
|
-
len = xs.length;
|
|
651
|
-
if (!len) {
|
|
652
|
-
return xs;
|
|
653
|
-
}
|
|
654
|
-
i = 0;
|
|
655
|
-
while (i < len && p(xs[i])) {
|
|
656
|
-
i += 1;
|
|
657
|
-
}
|
|
658
|
-
return xs.slice(0, i);
|
|
659
|
-
});
|
|
660
|
-
dropWhile = curry$(function(p, xs) {
|
|
661
|
-
var len, i;
|
|
662
|
-
len = xs.length;
|
|
663
|
-
if (!len) {
|
|
664
|
-
return xs;
|
|
665
|
-
}
|
|
666
|
-
i = 0;
|
|
667
|
-
while (i < len && p(xs[i])) {
|
|
668
|
-
i += 1;
|
|
669
|
-
}
|
|
670
|
-
return xs.slice(i);
|
|
671
|
-
});
|
|
672
|
-
span = curry$(function(p, xs) {
|
|
673
|
-
return [takeWhile(p, xs), dropWhile(p, xs)];
|
|
674
|
-
});
|
|
675
|
-
breakList = curry$(function(p, xs) {
|
|
676
|
-
return span(compose$(p, not$), xs);
|
|
677
|
-
});
|
|
678
|
-
zip = curry$(function(xs, ys) {
|
|
679
|
-
var result, len, i$, len$, i, x;
|
|
680
|
-
result = [];
|
|
681
|
-
len = ys.length;
|
|
682
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
683
|
-
i = i$;
|
|
684
|
-
x = xs[i$];
|
|
685
|
-
if (i === len) {
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
result.push([x, ys[i]]);
|
|
689
|
-
}
|
|
690
|
-
return result;
|
|
691
|
-
});
|
|
692
|
-
zipWith = curry$(function(f, xs, ys) {
|
|
693
|
-
var result, len, i$, len$, i, x;
|
|
694
|
-
result = [];
|
|
695
|
-
len = ys.length;
|
|
696
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
697
|
-
i = i$;
|
|
698
|
-
x = xs[i$];
|
|
699
|
-
if (i === len) {
|
|
700
|
-
break;
|
|
701
|
-
}
|
|
702
|
-
result.push(f(x, ys[i]));
|
|
703
|
-
}
|
|
704
|
-
return result;
|
|
705
|
-
});
|
|
706
|
-
zipAll = function() {
|
|
707
|
-
var xss, res$, i$, to$, minLength, len$, xs, ref$, i, lresult$, j$, results$ = [];
|
|
708
|
-
res$ = [];
|
|
709
|
-
for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
|
|
710
|
-
res$.push(arguments[i$]);
|
|
711
|
-
}
|
|
712
|
-
xss = res$;
|
|
713
|
-
minLength = void 0;
|
|
714
|
-
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
|
715
|
-
xs = xss[i$];
|
|
716
|
-
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
|
717
|
-
}
|
|
718
|
-
for (i$ = 0; i$ < minLength; ++i$) {
|
|
719
|
-
i = i$;
|
|
720
|
-
lresult$ = [];
|
|
721
|
-
for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
|
|
722
|
-
xs = xss[j$];
|
|
723
|
-
lresult$.push(xs[i]);
|
|
724
|
-
}
|
|
725
|
-
results$.push(lresult$);
|
|
726
|
-
}
|
|
727
|
-
return results$;
|
|
728
|
-
};
|
|
729
|
-
zipAllWith = function(f) {
|
|
730
|
-
var xss, res$, i$, to$, minLength, len$, xs, ref$, i, results$ = [];
|
|
731
|
-
res$ = [];
|
|
732
|
-
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
733
|
-
res$.push(arguments[i$]);
|
|
734
|
-
}
|
|
735
|
-
xss = res$;
|
|
736
|
-
minLength = void 0;
|
|
737
|
-
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
|
738
|
-
xs = xss[i$];
|
|
739
|
-
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
|
740
|
-
}
|
|
741
|
-
for (i$ = 0; i$ < minLength; ++i$) {
|
|
742
|
-
i = i$;
|
|
743
|
-
results$.push(f.apply(null, fn$()));
|
|
744
|
-
}
|
|
745
|
-
return results$;
|
|
746
|
-
function fn$() {
|
|
747
|
-
var i$2, ref$2, len$2, results$2 = [];
|
|
748
|
-
for (i$2 = 0, len$2 = (ref$2 = xss).length; i$2 < len$2; ++i$2) {
|
|
749
|
-
xs = ref$2[i$2];
|
|
750
|
-
results$2.push(xs[i]);
|
|
751
|
-
}
|
|
752
|
-
return results$2;
|
|
753
|
-
}
|
|
754
|
-
};
|
|
755
|
-
at = curry$(function(n, xs) {
|
|
756
|
-
if (n < 0) {
|
|
757
|
-
return xs[xs.length + n];
|
|
758
|
-
} else {
|
|
759
|
-
return xs[n];
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
|
-
elemIndex = curry$(function(el, xs) {
|
|
763
|
-
var i$, len$, i, x;
|
|
764
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
765
|
-
i = i$;
|
|
766
|
-
x = xs[i$];
|
|
767
|
-
if (x === el) {
|
|
768
|
-
return i;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
elemIndices = curry$(function(el, xs) {
|
|
773
|
-
var i$, len$, i, x, results$ = [];
|
|
774
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
775
|
-
i = i$;
|
|
776
|
-
x = xs[i$];
|
|
777
|
-
if (x === el) {
|
|
778
|
-
results$.push(i);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return results$;
|
|
782
|
-
});
|
|
783
|
-
findIndex = curry$(function(f, xs) {
|
|
784
|
-
var i$, len$, i, x;
|
|
785
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
786
|
-
i = i$;
|
|
787
|
-
x = xs[i$];
|
|
788
|
-
if (f(x)) {
|
|
789
|
-
return i;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
findIndices = curry$(function(f, xs) {
|
|
794
|
-
var i$, len$, i, x, results$ = [];
|
|
795
|
-
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
|
796
|
-
i = i$;
|
|
797
|
-
x = xs[i$];
|
|
798
|
-
if (f(x)) {
|
|
799
|
-
results$.push(i);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
return results$;
|
|
803
|
-
});
|
|
804
|
-
module.exports = {
|
|
805
|
-
each,
|
|
806
|
-
map,
|
|
807
|
-
filter,
|
|
808
|
-
compact,
|
|
809
|
-
reject,
|
|
810
|
-
remove,
|
|
811
|
-
partition,
|
|
812
|
-
find,
|
|
813
|
-
head,
|
|
814
|
-
first,
|
|
815
|
-
tail,
|
|
816
|
-
last,
|
|
817
|
-
initial,
|
|
818
|
-
empty,
|
|
819
|
-
reverse,
|
|
820
|
-
difference,
|
|
821
|
-
intersection,
|
|
822
|
-
union,
|
|
823
|
-
countBy,
|
|
824
|
-
groupBy,
|
|
825
|
-
fold,
|
|
826
|
-
fold1,
|
|
827
|
-
foldl,
|
|
828
|
-
foldl1,
|
|
829
|
-
foldr,
|
|
830
|
-
foldr1,
|
|
831
|
-
unfoldr,
|
|
832
|
-
andList,
|
|
833
|
-
orList,
|
|
834
|
-
any,
|
|
835
|
-
all,
|
|
836
|
-
unique,
|
|
837
|
-
uniqueBy,
|
|
838
|
-
sort,
|
|
839
|
-
sortWith,
|
|
840
|
-
sortBy,
|
|
841
|
-
sum,
|
|
842
|
-
product,
|
|
843
|
-
mean,
|
|
844
|
-
average,
|
|
845
|
-
concat,
|
|
846
|
-
concatMap,
|
|
847
|
-
flatten,
|
|
848
|
-
maximum,
|
|
849
|
-
minimum,
|
|
850
|
-
maximumBy,
|
|
851
|
-
minimumBy,
|
|
852
|
-
scan,
|
|
853
|
-
scan1,
|
|
854
|
-
scanl,
|
|
855
|
-
scanl1,
|
|
856
|
-
scanr,
|
|
857
|
-
scanr1,
|
|
858
|
-
slice,
|
|
859
|
-
take,
|
|
860
|
-
drop,
|
|
861
|
-
splitAt,
|
|
862
|
-
takeWhile,
|
|
863
|
-
dropWhile,
|
|
864
|
-
span,
|
|
865
|
-
breakList,
|
|
866
|
-
zip,
|
|
867
|
-
zipWith,
|
|
868
|
-
zipAll,
|
|
869
|
-
zipAllWith,
|
|
870
|
-
at,
|
|
871
|
-
elemIndex,
|
|
872
|
-
elemIndices,
|
|
873
|
-
findIndex,
|
|
874
|
-
findIndices
|
|
875
|
-
};
|
|
876
|
-
function curry$(f, bound) {
|
|
877
|
-
var context, _curry = function(args) {
|
|
878
|
-
return f.length > 1 ? function() {
|
|
879
|
-
var params = args ? args.concat() : [];
|
|
880
|
-
context = bound ? context || this : this;
|
|
881
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
882
|
-
} : f;
|
|
883
|
-
};
|
|
884
|
-
return _curry();
|
|
885
|
-
}
|
|
886
|
-
function in$(x, xs) {
|
|
887
|
-
var i = -1, l = xs.length >>> 0;
|
|
888
|
-
while (++i < l) if (x === xs[i]) return true;
|
|
889
|
-
return false;
|
|
890
|
-
}
|
|
891
|
-
function compose$() {
|
|
892
|
-
var functions = arguments;
|
|
893
|
-
return function() {
|
|
894
|
-
var i, result;
|
|
895
|
-
result = functions[0].apply(this, arguments);
|
|
896
|
-
for (i = 1; i < functions.length; ++i) {
|
|
897
|
-
result = functions[i](result);
|
|
898
|
-
}
|
|
899
|
-
return result;
|
|
900
|
-
};
|
|
901
|
-
}
|
|
902
|
-
function not$(x) {
|
|
903
|
-
return !x;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
|
|
908
|
-
// node_modules/prelude-ls/lib/Obj.js
|
|
909
|
-
var require_Obj = __commonJS({
|
|
910
|
-
"node_modules/prelude-ls/lib/Obj.js"(exports, module) {
|
|
911
|
-
var values;
|
|
912
|
-
var keys;
|
|
913
|
-
var pairsToObj;
|
|
914
|
-
var objToPairs;
|
|
915
|
-
var listsToObj;
|
|
916
|
-
var objToLists;
|
|
917
|
-
var empty;
|
|
918
|
-
var each;
|
|
919
|
-
var map;
|
|
920
|
-
var compact;
|
|
921
|
-
var filter;
|
|
922
|
-
var reject;
|
|
923
|
-
var partition;
|
|
924
|
-
var find;
|
|
925
|
-
values = function(object) {
|
|
926
|
-
var i$, x, results$ = [];
|
|
927
|
-
for (i$ in object) {
|
|
928
|
-
x = object[i$];
|
|
929
|
-
results$.push(x);
|
|
930
|
-
}
|
|
931
|
-
return results$;
|
|
932
|
-
};
|
|
933
|
-
keys = function(object) {
|
|
934
|
-
var x, results$ = [];
|
|
935
|
-
for (x in object) {
|
|
936
|
-
results$.push(x);
|
|
937
|
-
}
|
|
938
|
-
return results$;
|
|
939
|
-
};
|
|
940
|
-
pairsToObj = function(object) {
|
|
941
|
-
var i$, len$, x, resultObj$ = {};
|
|
942
|
-
for (i$ = 0, len$ = object.length; i$ < len$; ++i$) {
|
|
943
|
-
x = object[i$];
|
|
944
|
-
resultObj$[x[0]] = x[1];
|
|
945
|
-
}
|
|
946
|
-
return resultObj$;
|
|
947
|
-
};
|
|
948
|
-
objToPairs = function(object) {
|
|
949
|
-
var key, value, results$ = [];
|
|
950
|
-
for (key in object) {
|
|
951
|
-
value = object[key];
|
|
952
|
-
results$.push([key, value]);
|
|
953
|
-
}
|
|
954
|
-
return results$;
|
|
955
|
-
};
|
|
956
|
-
listsToObj = curry$(function(keys2, values2) {
|
|
957
|
-
var i$, len$, i, key, resultObj$ = {};
|
|
958
|
-
for (i$ = 0, len$ = keys2.length; i$ < len$; ++i$) {
|
|
959
|
-
i = i$;
|
|
960
|
-
key = keys2[i$];
|
|
961
|
-
resultObj$[key] = values2[i];
|
|
962
|
-
}
|
|
963
|
-
return resultObj$;
|
|
964
|
-
});
|
|
965
|
-
objToLists = function(object) {
|
|
966
|
-
var keys2, values2, key, value;
|
|
967
|
-
keys2 = [];
|
|
968
|
-
values2 = [];
|
|
969
|
-
for (key in object) {
|
|
970
|
-
value = object[key];
|
|
971
|
-
keys2.push(key);
|
|
972
|
-
values2.push(value);
|
|
973
|
-
}
|
|
974
|
-
return [keys2, values2];
|
|
975
|
-
};
|
|
976
|
-
empty = function(object) {
|
|
977
|
-
var x;
|
|
978
|
-
for (x in object) {
|
|
979
|
-
return false;
|
|
980
|
-
}
|
|
981
|
-
return true;
|
|
982
|
-
};
|
|
983
|
-
each = curry$(function(f, object) {
|
|
984
|
-
var i$, x;
|
|
985
|
-
for (i$ in object) {
|
|
986
|
-
x = object[i$];
|
|
987
|
-
f(x);
|
|
988
|
-
}
|
|
989
|
-
return object;
|
|
990
|
-
});
|
|
991
|
-
map = curry$(function(f, object) {
|
|
992
|
-
var k, x, resultObj$ = {};
|
|
993
|
-
for (k in object) {
|
|
994
|
-
x = object[k];
|
|
995
|
-
resultObj$[k] = f(x);
|
|
996
|
-
}
|
|
997
|
-
return resultObj$;
|
|
998
|
-
});
|
|
999
|
-
compact = function(object) {
|
|
1000
|
-
var k, x, resultObj$ = {};
|
|
1001
|
-
for (k in object) {
|
|
1002
|
-
x = object[k];
|
|
1003
|
-
if (x) {
|
|
1004
|
-
resultObj$[k] = x;
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
return resultObj$;
|
|
1008
|
-
};
|
|
1009
|
-
filter = curry$(function(f, object) {
|
|
1010
|
-
var k, x, resultObj$ = {};
|
|
1011
|
-
for (k in object) {
|
|
1012
|
-
x = object[k];
|
|
1013
|
-
if (f(x)) {
|
|
1014
|
-
resultObj$[k] = x;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
return resultObj$;
|
|
1018
|
-
});
|
|
1019
|
-
reject = curry$(function(f, object) {
|
|
1020
|
-
var k, x, resultObj$ = {};
|
|
1021
|
-
for (k in object) {
|
|
1022
|
-
x = object[k];
|
|
1023
|
-
if (!f(x)) {
|
|
1024
|
-
resultObj$[k] = x;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
return resultObj$;
|
|
1028
|
-
});
|
|
1029
|
-
partition = curry$(function(f, object) {
|
|
1030
|
-
var passed, failed, k, x;
|
|
1031
|
-
passed = {};
|
|
1032
|
-
failed = {};
|
|
1033
|
-
for (k in object) {
|
|
1034
|
-
x = object[k];
|
|
1035
|
-
(f(x) ? passed : failed)[k] = x;
|
|
1036
|
-
}
|
|
1037
|
-
return [passed, failed];
|
|
1038
|
-
});
|
|
1039
|
-
find = curry$(function(f, object) {
|
|
1040
|
-
var i$, x;
|
|
1041
|
-
for (i$ in object) {
|
|
1042
|
-
x = object[i$];
|
|
1043
|
-
if (f(x)) {
|
|
1044
|
-
return x;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
module.exports = {
|
|
1049
|
-
values,
|
|
1050
|
-
keys,
|
|
1051
|
-
pairsToObj,
|
|
1052
|
-
objToPairs,
|
|
1053
|
-
listsToObj,
|
|
1054
|
-
objToLists,
|
|
1055
|
-
empty,
|
|
1056
|
-
each,
|
|
1057
|
-
map,
|
|
1058
|
-
filter,
|
|
1059
|
-
compact,
|
|
1060
|
-
reject,
|
|
1061
|
-
partition,
|
|
1062
|
-
find
|
|
1063
|
-
};
|
|
1064
|
-
function curry$(f, bound) {
|
|
1065
|
-
var context, _curry = function(args) {
|
|
1066
|
-
return f.length > 1 ? function() {
|
|
1067
|
-
var params = args ? args.concat() : [];
|
|
1068
|
-
context = bound ? context || this : this;
|
|
1069
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
1070
|
-
} : f;
|
|
1071
|
-
};
|
|
1072
|
-
return _curry();
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
|
|
1077
|
-
// node_modules/prelude-ls/lib/Str.js
|
|
1078
|
-
var require_Str = __commonJS({
|
|
1079
|
-
"node_modules/prelude-ls/lib/Str.js"(exports, module) {
|
|
1080
|
-
var split;
|
|
1081
|
-
var join;
|
|
1082
|
-
var lines;
|
|
1083
|
-
var unlines;
|
|
1084
|
-
var words;
|
|
1085
|
-
var unwords;
|
|
1086
|
-
var chars;
|
|
1087
|
-
var unchars;
|
|
1088
|
-
var reverse;
|
|
1089
|
-
var repeat;
|
|
1090
|
-
var capitalize;
|
|
1091
|
-
var camelize;
|
|
1092
|
-
var dasherize;
|
|
1093
|
-
split = curry$(function(sep, str) {
|
|
1094
|
-
return str.split(sep);
|
|
1095
|
-
});
|
|
1096
|
-
join = curry$(function(sep, xs) {
|
|
1097
|
-
return xs.join(sep);
|
|
1098
|
-
});
|
|
1099
|
-
lines = function(str) {
|
|
1100
|
-
if (!str.length) {
|
|
1101
|
-
return [];
|
|
1102
|
-
}
|
|
1103
|
-
return str.split("\n");
|
|
1104
|
-
};
|
|
1105
|
-
unlines = function(it) {
|
|
1106
|
-
return it.join("\n");
|
|
1107
|
-
};
|
|
1108
|
-
words = function(str) {
|
|
1109
|
-
if (!str.length) {
|
|
1110
|
-
return [];
|
|
1111
|
-
}
|
|
1112
|
-
return str.split(/[ ]+/);
|
|
1113
|
-
};
|
|
1114
|
-
unwords = function(it) {
|
|
1115
|
-
return it.join(" ");
|
|
1116
|
-
};
|
|
1117
|
-
chars = function(it) {
|
|
1118
|
-
return it.split("");
|
|
1119
|
-
};
|
|
1120
|
-
unchars = function(it) {
|
|
1121
|
-
return it.join("");
|
|
1122
|
-
};
|
|
1123
|
-
reverse = function(str) {
|
|
1124
|
-
return str.split("").reverse().join("");
|
|
1125
|
-
};
|
|
1126
|
-
repeat = curry$(function(n, str) {
|
|
1127
|
-
var result, i$;
|
|
1128
|
-
result = "";
|
|
1129
|
-
for (i$ = 0; i$ < n; ++i$) {
|
|
1130
|
-
result += str;
|
|
1131
|
-
}
|
|
1132
|
-
return result;
|
|
1133
|
-
});
|
|
1134
|
-
capitalize = function(str) {
|
|
1135
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1136
|
-
};
|
|
1137
|
-
camelize = function(it) {
|
|
1138
|
-
return it.replace(/[-_]+(.)?/g, function(arg$, c) {
|
|
1139
|
-
return (c != null ? c : "").toUpperCase();
|
|
1140
|
-
});
|
|
1141
|
-
};
|
|
1142
|
-
dasherize = function(str) {
|
|
1143
|
-
return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper) {
|
|
1144
|
-
return lower + "-" + (upper.length > 1 ? upper : upper.toLowerCase());
|
|
1145
|
-
}).replace(/^([A-Z]+)/, function(arg$, upper) {
|
|
1146
|
-
if (upper.length > 1) {
|
|
1147
|
-
return upper + "-";
|
|
1148
|
-
} else {
|
|
1149
|
-
return upper.toLowerCase();
|
|
1150
|
-
}
|
|
1151
|
-
});
|
|
1152
|
-
};
|
|
1153
|
-
module.exports = {
|
|
1154
|
-
split,
|
|
1155
|
-
join,
|
|
1156
|
-
lines,
|
|
1157
|
-
unlines,
|
|
1158
|
-
words,
|
|
1159
|
-
unwords,
|
|
1160
|
-
chars,
|
|
1161
|
-
unchars,
|
|
1162
|
-
reverse,
|
|
1163
|
-
repeat,
|
|
1164
|
-
capitalize,
|
|
1165
|
-
camelize,
|
|
1166
|
-
dasherize
|
|
1167
|
-
};
|
|
1168
|
-
function curry$(f, bound) {
|
|
1169
|
-
var context, _curry = function(args) {
|
|
1170
|
-
return f.length > 1 ? function() {
|
|
1171
|
-
var params = args ? args.concat() : [];
|
|
1172
|
-
context = bound ? context || this : this;
|
|
1173
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
1174
|
-
} : f;
|
|
1175
|
-
};
|
|
1176
|
-
return _curry();
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
// node_modules/prelude-ls/lib/Num.js
|
|
1182
|
-
var require_Num = __commonJS({
|
|
1183
|
-
"node_modules/prelude-ls/lib/Num.js"(exports, module) {
|
|
1184
|
-
var max;
|
|
1185
|
-
var min;
|
|
1186
|
-
var negate;
|
|
1187
|
-
var abs;
|
|
1188
|
-
var signum;
|
|
1189
|
-
var quot;
|
|
1190
|
-
var rem;
|
|
1191
|
-
var div;
|
|
1192
|
-
var mod;
|
|
1193
|
-
var recip;
|
|
1194
|
-
var pi;
|
|
1195
|
-
var tau;
|
|
1196
|
-
var exp;
|
|
1197
|
-
var sqrt;
|
|
1198
|
-
var ln;
|
|
1199
|
-
var pow;
|
|
1200
|
-
var sin;
|
|
1201
|
-
var tan;
|
|
1202
|
-
var cos;
|
|
1203
|
-
var asin;
|
|
1204
|
-
var acos;
|
|
1205
|
-
var atan;
|
|
1206
|
-
var atan2;
|
|
1207
|
-
var truncate;
|
|
1208
|
-
var round;
|
|
1209
|
-
var ceiling;
|
|
1210
|
-
var floor;
|
|
1211
|
-
var isItNaN;
|
|
1212
|
-
var even;
|
|
1213
|
-
var odd;
|
|
1214
|
-
var gcd;
|
|
1215
|
-
var lcm;
|
|
1216
|
-
max = curry$(function(x$, y$) {
|
|
1217
|
-
return x$ > y$ ? x$ : y$;
|
|
1218
|
-
});
|
|
1219
|
-
min = curry$(function(x$, y$) {
|
|
1220
|
-
return x$ < y$ ? x$ : y$;
|
|
1221
|
-
});
|
|
1222
|
-
negate = function(x) {
|
|
1223
|
-
return -x;
|
|
1224
|
-
};
|
|
1225
|
-
abs = Math.abs;
|
|
1226
|
-
signum = function(x) {
|
|
1227
|
-
if (x < 0) {
|
|
1228
|
-
return -1;
|
|
1229
|
-
} else if (x > 0) {
|
|
1230
|
-
return 1;
|
|
1231
|
-
} else {
|
|
1232
|
-
return 0;
|
|
1233
|
-
}
|
|
1234
|
-
};
|
|
1235
|
-
quot = curry$(function(x, y) {
|
|
1236
|
-
return ~~(x / y);
|
|
1237
|
-
});
|
|
1238
|
-
rem = curry$(function(x$, y$) {
|
|
1239
|
-
return x$ % y$;
|
|
1240
|
-
});
|
|
1241
|
-
div = curry$(function(x, y) {
|
|
1242
|
-
return Math.floor(x / y);
|
|
1243
|
-
});
|
|
1244
|
-
mod = curry$(function(x$, y$) {
|
|
1245
|
-
var ref$;
|
|
1246
|
-
return (x$ % (ref$ = y$) + ref$) % ref$;
|
|
1247
|
-
});
|
|
1248
|
-
recip = (function(it) {
|
|
1249
|
-
return 1 / it;
|
|
1250
|
-
});
|
|
1251
|
-
pi = Math.PI;
|
|
1252
|
-
tau = pi * 2;
|
|
1253
|
-
exp = Math.exp;
|
|
1254
|
-
sqrt = Math.sqrt;
|
|
1255
|
-
ln = Math.log;
|
|
1256
|
-
pow = curry$(function(x$, y$) {
|
|
1257
|
-
return Math.pow(x$, y$);
|
|
1258
|
-
});
|
|
1259
|
-
sin = Math.sin;
|
|
1260
|
-
tan = Math.tan;
|
|
1261
|
-
cos = Math.cos;
|
|
1262
|
-
asin = Math.asin;
|
|
1263
|
-
acos = Math.acos;
|
|
1264
|
-
atan = Math.atan;
|
|
1265
|
-
atan2 = curry$(function(x, y) {
|
|
1266
|
-
return Math.atan2(x, y);
|
|
1267
|
-
});
|
|
1268
|
-
truncate = function(x) {
|
|
1269
|
-
return ~~x;
|
|
1270
|
-
};
|
|
1271
|
-
round = Math.round;
|
|
1272
|
-
ceiling = Math.ceil;
|
|
1273
|
-
floor = Math.floor;
|
|
1274
|
-
isItNaN = function(x) {
|
|
1275
|
-
return x !== x;
|
|
1276
|
-
};
|
|
1277
|
-
even = function(x) {
|
|
1278
|
-
return x % 2 === 0;
|
|
1279
|
-
};
|
|
1280
|
-
odd = function(x) {
|
|
1281
|
-
return x % 2 !== 0;
|
|
1282
|
-
};
|
|
1283
|
-
gcd = curry$(function(x, y) {
|
|
1284
|
-
var z;
|
|
1285
|
-
x = Math.abs(x);
|
|
1286
|
-
y = Math.abs(y);
|
|
1287
|
-
while (y !== 0) {
|
|
1288
|
-
z = x % y;
|
|
1289
|
-
x = y;
|
|
1290
|
-
y = z;
|
|
1291
|
-
}
|
|
1292
|
-
return x;
|
|
1293
|
-
});
|
|
1294
|
-
lcm = curry$(function(x, y) {
|
|
1295
|
-
return Math.abs(Math.floor(x / gcd(x, y) * y));
|
|
1296
|
-
});
|
|
1297
|
-
module.exports = {
|
|
1298
|
-
max,
|
|
1299
|
-
min,
|
|
1300
|
-
negate,
|
|
1301
|
-
abs,
|
|
1302
|
-
signum,
|
|
1303
|
-
quot,
|
|
1304
|
-
rem,
|
|
1305
|
-
div,
|
|
1306
|
-
mod,
|
|
1307
|
-
recip,
|
|
1308
|
-
pi,
|
|
1309
|
-
tau,
|
|
1310
|
-
exp,
|
|
1311
|
-
sqrt,
|
|
1312
|
-
ln,
|
|
1313
|
-
pow,
|
|
1314
|
-
sin,
|
|
1315
|
-
tan,
|
|
1316
|
-
cos,
|
|
1317
|
-
acos,
|
|
1318
|
-
asin,
|
|
1319
|
-
atan,
|
|
1320
|
-
atan2,
|
|
1321
|
-
truncate,
|
|
1322
|
-
round,
|
|
1323
|
-
ceiling,
|
|
1324
|
-
floor,
|
|
1325
|
-
isItNaN,
|
|
1326
|
-
even,
|
|
1327
|
-
odd,
|
|
1328
|
-
gcd,
|
|
1329
|
-
lcm
|
|
1330
|
-
};
|
|
1331
|
-
function curry$(f, bound) {
|
|
1332
|
-
var context, _curry = function(args) {
|
|
1333
|
-
return f.length > 1 ? function() {
|
|
1334
|
-
var params = args ? args.concat() : [];
|
|
1335
|
-
context = bound ? context || this : this;
|
|
1336
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
1337
|
-
} : f;
|
|
1338
|
-
};
|
|
1339
|
-
return _curry();
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
|
-
|
|
1344
|
-
// node_modules/prelude-ls/lib/index.js
|
|
1345
|
-
var require_lib = __commonJS({
|
|
1346
|
-
"node_modules/prelude-ls/lib/index.js"(exports, module) {
|
|
1347
|
-
var Func;
|
|
1348
|
-
var List;
|
|
1349
|
-
var Obj;
|
|
1350
|
-
var Str;
|
|
1351
|
-
var Num;
|
|
1352
|
-
var id;
|
|
1353
|
-
var isType;
|
|
1354
|
-
var replicate;
|
|
1355
|
-
var prelude;
|
|
1356
|
-
var toString$ = {}.toString;
|
|
1357
|
-
Func = require_Func();
|
|
1358
|
-
List = require_List();
|
|
1359
|
-
Obj = require_Obj();
|
|
1360
|
-
Str = require_Str();
|
|
1361
|
-
Num = require_Num();
|
|
1362
|
-
id = function(x) {
|
|
1363
|
-
return x;
|
|
1364
|
-
};
|
|
1365
|
-
isType = curry$(function(type, x) {
|
|
1366
|
-
return toString$.call(x).slice(8, -1) === type;
|
|
1367
|
-
});
|
|
1368
|
-
replicate = curry$(function(n, x) {
|
|
1369
|
-
var i$, results$ = [];
|
|
1370
|
-
for (i$ = 0; i$ < n; ++i$) {
|
|
1371
|
-
results$.push(x);
|
|
1372
|
-
}
|
|
1373
|
-
return results$;
|
|
1374
|
-
});
|
|
1375
|
-
Str.empty = List.empty;
|
|
1376
|
-
Str.slice = List.slice;
|
|
1377
|
-
Str.take = List.take;
|
|
1378
|
-
Str.drop = List.drop;
|
|
1379
|
-
Str.splitAt = List.splitAt;
|
|
1380
|
-
Str.takeWhile = List.takeWhile;
|
|
1381
|
-
Str.dropWhile = List.dropWhile;
|
|
1382
|
-
Str.span = List.span;
|
|
1383
|
-
Str.breakStr = List.breakList;
|
|
1384
|
-
prelude = {
|
|
1385
|
-
Func,
|
|
1386
|
-
List,
|
|
1387
|
-
Obj,
|
|
1388
|
-
Str,
|
|
1389
|
-
Num,
|
|
1390
|
-
id,
|
|
1391
|
-
isType,
|
|
1392
|
-
replicate
|
|
1393
|
-
};
|
|
1394
|
-
prelude.each = List.each;
|
|
1395
|
-
prelude.map = List.map;
|
|
1396
|
-
prelude.filter = List.filter;
|
|
1397
|
-
prelude.compact = List.compact;
|
|
1398
|
-
prelude.reject = List.reject;
|
|
1399
|
-
prelude.partition = List.partition;
|
|
1400
|
-
prelude.find = List.find;
|
|
1401
|
-
prelude.head = List.head;
|
|
1402
|
-
prelude.first = List.first;
|
|
1403
|
-
prelude.tail = List.tail;
|
|
1404
|
-
prelude.last = List.last;
|
|
1405
|
-
prelude.initial = List.initial;
|
|
1406
|
-
prelude.empty = List.empty;
|
|
1407
|
-
prelude.reverse = List.reverse;
|
|
1408
|
-
prelude.difference = List.difference;
|
|
1409
|
-
prelude.intersection = List.intersection;
|
|
1410
|
-
prelude.union = List.union;
|
|
1411
|
-
prelude.countBy = List.countBy;
|
|
1412
|
-
prelude.groupBy = List.groupBy;
|
|
1413
|
-
prelude.fold = List.fold;
|
|
1414
|
-
prelude.foldl = List.foldl;
|
|
1415
|
-
prelude.fold1 = List.fold1;
|
|
1416
|
-
prelude.foldl1 = List.foldl1;
|
|
1417
|
-
prelude.foldr = List.foldr;
|
|
1418
|
-
prelude.foldr1 = List.foldr1;
|
|
1419
|
-
prelude.unfoldr = List.unfoldr;
|
|
1420
|
-
prelude.andList = List.andList;
|
|
1421
|
-
prelude.orList = List.orList;
|
|
1422
|
-
prelude.any = List.any;
|
|
1423
|
-
prelude.all = List.all;
|
|
1424
|
-
prelude.unique = List.unique;
|
|
1425
|
-
prelude.uniqueBy = List.uniqueBy;
|
|
1426
|
-
prelude.sort = List.sort;
|
|
1427
|
-
prelude.sortWith = List.sortWith;
|
|
1428
|
-
prelude.sortBy = List.sortBy;
|
|
1429
|
-
prelude.sum = List.sum;
|
|
1430
|
-
prelude.product = List.product;
|
|
1431
|
-
prelude.mean = List.mean;
|
|
1432
|
-
prelude.average = List.average;
|
|
1433
|
-
prelude.concat = List.concat;
|
|
1434
|
-
prelude.concatMap = List.concatMap;
|
|
1435
|
-
prelude.flatten = List.flatten;
|
|
1436
|
-
prelude.maximum = List.maximum;
|
|
1437
|
-
prelude.minimum = List.minimum;
|
|
1438
|
-
prelude.maximumBy = List.maximumBy;
|
|
1439
|
-
prelude.minimumBy = List.minimumBy;
|
|
1440
|
-
prelude.scan = List.scan;
|
|
1441
|
-
prelude.scanl = List.scanl;
|
|
1442
|
-
prelude.scan1 = List.scan1;
|
|
1443
|
-
prelude.scanl1 = List.scanl1;
|
|
1444
|
-
prelude.scanr = List.scanr;
|
|
1445
|
-
prelude.scanr1 = List.scanr1;
|
|
1446
|
-
prelude.slice = List.slice;
|
|
1447
|
-
prelude.take = List.take;
|
|
1448
|
-
prelude.drop = List.drop;
|
|
1449
|
-
prelude.splitAt = List.splitAt;
|
|
1450
|
-
prelude.takeWhile = List.takeWhile;
|
|
1451
|
-
prelude.dropWhile = List.dropWhile;
|
|
1452
|
-
prelude.span = List.span;
|
|
1453
|
-
prelude.breakList = List.breakList;
|
|
1454
|
-
prelude.zip = List.zip;
|
|
1455
|
-
prelude.zipWith = List.zipWith;
|
|
1456
|
-
prelude.zipAll = List.zipAll;
|
|
1457
|
-
prelude.zipAllWith = List.zipAllWith;
|
|
1458
|
-
prelude.at = List.at;
|
|
1459
|
-
prelude.elemIndex = List.elemIndex;
|
|
1460
|
-
prelude.elemIndices = List.elemIndices;
|
|
1461
|
-
prelude.findIndex = List.findIndex;
|
|
1462
|
-
prelude.findIndices = List.findIndices;
|
|
1463
|
-
prelude.apply = Func.apply;
|
|
1464
|
-
prelude.curry = Func.curry;
|
|
1465
|
-
prelude.flip = Func.flip;
|
|
1466
|
-
prelude.fix = Func.fix;
|
|
1467
|
-
prelude.over = Func.over;
|
|
1468
|
-
prelude.split = Str.split;
|
|
1469
|
-
prelude.join = Str.join;
|
|
1470
|
-
prelude.lines = Str.lines;
|
|
1471
|
-
prelude.unlines = Str.unlines;
|
|
1472
|
-
prelude.words = Str.words;
|
|
1473
|
-
prelude.unwords = Str.unwords;
|
|
1474
|
-
prelude.chars = Str.chars;
|
|
1475
|
-
prelude.unchars = Str.unchars;
|
|
1476
|
-
prelude.repeat = Str.repeat;
|
|
1477
|
-
prelude.capitalize = Str.capitalize;
|
|
1478
|
-
prelude.camelize = Str.camelize;
|
|
1479
|
-
prelude.dasherize = Str.dasherize;
|
|
1480
|
-
prelude.values = Obj.values;
|
|
1481
|
-
prelude.keys = Obj.keys;
|
|
1482
|
-
prelude.pairsToObj = Obj.pairsToObj;
|
|
1483
|
-
prelude.objToPairs = Obj.objToPairs;
|
|
1484
|
-
prelude.listsToObj = Obj.listsToObj;
|
|
1485
|
-
prelude.objToLists = Obj.objToLists;
|
|
1486
|
-
prelude.max = Num.max;
|
|
1487
|
-
prelude.min = Num.min;
|
|
1488
|
-
prelude.negate = Num.negate;
|
|
1489
|
-
prelude.abs = Num.abs;
|
|
1490
|
-
prelude.signum = Num.signum;
|
|
1491
|
-
prelude.quot = Num.quot;
|
|
1492
|
-
prelude.rem = Num.rem;
|
|
1493
|
-
prelude.div = Num.div;
|
|
1494
|
-
prelude.mod = Num.mod;
|
|
1495
|
-
prelude.recip = Num.recip;
|
|
1496
|
-
prelude.pi = Num.pi;
|
|
1497
|
-
prelude.tau = Num.tau;
|
|
1498
|
-
prelude.exp = Num.exp;
|
|
1499
|
-
prelude.sqrt = Num.sqrt;
|
|
1500
|
-
prelude.ln = Num.ln;
|
|
1501
|
-
prelude.pow = Num.pow;
|
|
1502
|
-
prelude.sin = Num.sin;
|
|
1503
|
-
prelude.tan = Num.tan;
|
|
1504
|
-
prelude.cos = Num.cos;
|
|
1505
|
-
prelude.acos = Num.acos;
|
|
1506
|
-
prelude.asin = Num.asin;
|
|
1507
|
-
prelude.atan = Num.atan;
|
|
1508
|
-
prelude.atan2 = Num.atan2;
|
|
1509
|
-
prelude.truncate = Num.truncate;
|
|
1510
|
-
prelude.round = Num.round;
|
|
1511
|
-
prelude.ceiling = Num.ceiling;
|
|
1512
|
-
prelude.floor = Num.floor;
|
|
1513
|
-
prelude.isItNaN = Num.isItNaN;
|
|
1514
|
-
prelude.even = Num.even;
|
|
1515
|
-
prelude.odd = Num.odd;
|
|
1516
|
-
prelude.gcd = Num.gcd;
|
|
1517
|
-
prelude.lcm = Num.lcm;
|
|
1518
|
-
prelude.VERSION = "1.2.1";
|
|
1519
|
-
module.exports = prelude;
|
|
1520
|
-
function curry$(f, bound) {
|
|
1521
|
-
var context, _curry = function(args) {
|
|
1522
|
-
return f.length > 1 ? function() {
|
|
1523
|
-
var params = args ? args.concat() : [];
|
|
1524
|
-
context = bound ? context || this : this;
|
|
1525
|
-
return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params);
|
|
1526
|
-
} : f;
|
|
1527
|
-
};
|
|
1528
|
-
return _curry();
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
});
|
|
36
|
+
} from "../../../chunks/chunk-5X2BR42Y.js";
|
|
1532
37
|
|
|
1533
|
-
//
|
|
1534
|
-
|
|
1535
|
-
"node_modules/levn/lib/parse-string.js"(exports, module) {
|
|
1536
|
-
(function() {
|
|
1537
|
-
var reject, special, tokenRegex;
|
|
1538
|
-
reject = require_lib().reject;
|
|
1539
|
-
function consumeOp(tokens, op) {
|
|
1540
|
-
if (tokens[0] === op) {
|
|
1541
|
-
return tokens.shift();
|
|
1542
|
-
} else {
|
|
1543
|
-
throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + ".");
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
function maybeConsumeOp(tokens, op) {
|
|
1547
|
-
if (tokens[0] === op) {
|
|
1548
|
-
return tokens.shift();
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
function consumeList(tokens, arg$, hasDelimiters) {
|
|
1552
|
-
var open, close, result, untilTest;
|
|
1553
|
-
open = arg$[0], close = arg$[1];
|
|
1554
|
-
if (hasDelimiters) {
|
|
1555
|
-
consumeOp(tokens, open);
|
|
1556
|
-
}
|
|
1557
|
-
result = [];
|
|
1558
|
-
untilTest = "," + (hasDelimiters ? close : "");
|
|
1559
|
-
while (tokens.length && (hasDelimiters && tokens[0] !== close)) {
|
|
1560
|
-
result.push(consumeElement(tokens, untilTest));
|
|
1561
|
-
maybeConsumeOp(tokens, ",");
|
|
1562
|
-
}
|
|
1563
|
-
if (hasDelimiters) {
|
|
1564
|
-
consumeOp(tokens, close);
|
|
1565
|
-
}
|
|
1566
|
-
return result;
|
|
1567
|
-
}
|
|
1568
|
-
function consumeArray(tokens, hasDelimiters) {
|
|
1569
|
-
return consumeList(tokens, ["[", "]"], hasDelimiters);
|
|
1570
|
-
}
|
|
1571
|
-
function consumeTuple(tokens, hasDelimiters) {
|
|
1572
|
-
return consumeList(tokens, ["(", ")"], hasDelimiters);
|
|
1573
|
-
}
|
|
1574
|
-
function consumeFields(tokens, hasDelimiters) {
|
|
1575
|
-
var result, untilTest, key;
|
|
1576
|
-
if (hasDelimiters) {
|
|
1577
|
-
consumeOp(tokens, "{");
|
|
1578
|
-
}
|
|
1579
|
-
result = {};
|
|
1580
|
-
untilTest = "," + (hasDelimiters ? "}" : "");
|
|
1581
|
-
while (tokens.length && (!hasDelimiters || tokens[0] !== "}")) {
|
|
1582
|
-
key = consumeValue(tokens, ":");
|
|
1583
|
-
consumeOp(tokens, ":");
|
|
1584
|
-
result[key] = consumeElement(tokens, untilTest);
|
|
1585
|
-
maybeConsumeOp(tokens, ",");
|
|
1586
|
-
}
|
|
1587
|
-
if (hasDelimiters) {
|
|
1588
|
-
consumeOp(tokens, "}");
|
|
1589
|
-
}
|
|
1590
|
-
return result;
|
|
1591
|
-
}
|
|
1592
|
-
function consumeValue(tokens, untilTest) {
|
|
1593
|
-
var out;
|
|
1594
|
-
untilTest == null && (untilTest = "");
|
|
1595
|
-
out = "";
|
|
1596
|
-
while (tokens.length && -1 === untilTest.indexOf(tokens[0])) {
|
|
1597
|
-
out += tokens.shift();
|
|
1598
|
-
}
|
|
1599
|
-
return out;
|
|
1600
|
-
}
|
|
1601
|
-
function consumeElement(tokens, untilTest) {
|
|
1602
|
-
switch (tokens[0]) {
|
|
1603
|
-
case "[":
|
|
1604
|
-
return consumeArray(tokens, true);
|
|
1605
|
-
case "(":
|
|
1606
|
-
return consumeTuple(tokens, true);
|
|
1607
|
-
case "{":
|
|
1608
|
-
return consumeFields(tokens, true);
|
|
1609
|
-
default:
|
|
1610
|
-
return consumeValue(tokens, untilTest);
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
function consumeTopLevel(tokens, types, options) {
|
|
1614
|
-
var ref$, type, structure, origTokens, result, finalResult, x$, y$;
|
|
1615
|
-
ref$ = types[0], type = ref$.type, structure = ref$.structure;
|
|
1616
|
-
origTokens = tokens.concat();
|
|
1617
|
-
if (!options.explicit && types.length === 1 && (!type && structure || (type === "Array" || type === "Object"))) {
|
|
1618
|
-
result = structure === "array" || type === "Array" ? consumeArray(tokens, tokens[0] === "[") : structure === "tuple" ? consumeTuple(tokens, tokens[0] === "(") : consumeFields(tokens, tokens[0] === "{");
|
|
1619
|
-
finalResult = tokens.length ? consumeElement(structure === "array" || type === "Array" ? (x$ = origTokens, x$.unshift("["), x$.push("]"), x$) : (y$ = origTokens, y$.unshift("("), y$.push(")"), y$)) : result;
|
|
1620
|
-
} else {
|
|
1621
|
-
finalResult = consumeElement(tokens);
|
|
1622
|
-
}
|
|
1623
|
-
return finalResult;
|
|
1624
|
-
}
|
|
1625
|
-
special = /\[\]\(\)}{:,/.source;
|
|
1626
|
-
tokenRegex = RegExp(`("(?:\\\\"|[^"])*")|('(?:\\\\'|[^'])*')|(/(?:\\\\/|[^/])*/[a-zA-Z]*)|(#.*#)|([` + special + "])|([^\\s" + special + "](?:\\s*[^\\s" + special + "]+)*)|\\s*");
|
|
1627
|
-
module.exports = function(types, string, options) {
|
|
1628
|
-
var tokens, node;
|
|
1629
|
-
options == null && (options = {});
|
|
1630
|
-
if (!options.explicit && types.length === 1 && types[0].type === "String") {
|
|
1631
|
-
return string;
|
|
1632
|
-
}
|
|
1633
|
-
tokens = reject(not$, string.split(tokenRegex));
|
|
1634
|
-
node = consumeTopLevel(tokens, types, options);
|
|
1635
|
-
if (!node) {
|
|
1636
|
-
throw new Error("Error parsing '" + string + "'.");
|
|
1637
|
-
}
|
|
1638
|
-
return node;
|
|
1639
|
-
};
|
|
1640
|
-
function not$(x) {
|
|
1641
|
-
return !x;
|
|
1642
|
-
}
|
|
1643
|
-
}).call(exports);
|
|
1644
|
-
}
|
|
1645
|
-
});
|
|
1646
|
-
|
|
1647
|
-
// node_modules/type-check/lib/parse-type.js
|
|
1648
|
-
var require_parse_type = __commonJS({
|
|
1649
|
-
"node_modules/type-check/lib/parse-type.js"(exports, module) {
|
|
1650
|
-
(function() {
|
|
1651
|
-
var identifierRegex, tokenRegex;
|
|
1652
|
-
identifierRegex = /[\$\w]+/;
|
|
1653
|
-
function peek(tokens) {
|
|
1654
|
-
var token;
|
|
1655
|
-
token = tokens[0];
|
|
1656
|
-
if (token == null) {
|
|
1657
|
-
throw new Error("Unexpected end of input.");
|
|
1658
|
-
}
|
|
1659
|
-
return token;
|
|
1660
|
-
}
|
|
1661
|
-
function consumeIdent(tokens) {
|
|
1662
|
-
var token;
|
|
1663
|
-
token = peek(tokens);
|
|
1664
|
-
if (!identifierRegex.test(token)) {
|
|
1665
|
-
throw new Error("Expected text, got '" + token + "' instead.");
|
|
1666
|
-
}
|
|
1667
|
-
return tokens.shift();
|
|
1668
|
-
}
|
|
1669
|
-
function consumeOp(tokens, op) {
|
|
1670
|
-
var token;
|
|
1671
|
-
token = peek(tokens);
|
|
1672
|
-
if (token !== op) {
|
|
1673
|
-
throw new Error("Expected '" + op + "', got '" + token + "' instead.");
|
|
1674
|
-
}
|
|
1675
|
-
return tokens.shift();
|
|
1676
|
-
}
|
|
1677
|
-
function maybeConsumeOp(tokens, op) {
|
|
1678
|
-
var token;
|
|
1679
|
-
token = tokens[0];
|
|
1680
|
-
if (token === op) {
|
|
1681
|
-
return tokens.shift();
|
|
1682
|
-
} else {
|
|
1683
|
-
return null;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
function consumeArray(tokens) {
|
|
1687
|
-
var types;
|
|
1688
|
-
consumeOp(tokens, "[");
|
|
1689
|
-
if (peek(tokens) === "]") {
|
|
1690
|
-
throw new Error("Must specify type of Array - eg. [Type], got [] instead.");
|
|
1691
|
-
}
|
|
1692
|
-
types = consumeTypes(tokens);
|
|
1693
|
-
consumeOp(tokens, "]");
|
|
1694
|
-
return {
|
|
1695
|
-
structure: "array",
|
|
1696
|
-
of: types
|
|
1697
|
-
};
|
|
1698
|
-
}
|
|
1699
|
-
function consumeTuple(tokens) {
|
|
1700
|
-
var components;
|
|
1701
|
-
components = [];
|
|
1702
|
-
consumeOp(tokens, "(");
|
|
1703
|
-
if (peek(tokens) === ")") {
|
|
1704
|
-
throw new Error("Tuple must be of at least length 1 - eg. (Type), got () instead.");
|
|
1705
|
-
}
|
|
1706
|
-
for (; ; ) {
|
|
1707
|
-
components.push(consumeTypes(tokens));
|
|
1708
|
-
maybeConsumeOp(tokens, ",");
|
|
1709
|
-
if (")" === peek(tokens)) {
|
|
1710
|
-
break;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
consumeOp(tokens, ")");
|
|
1714
|
-
return {
|
|
1715
|
-
structure: "tuple",
|
|
1716
|
-
of: components
|
|
1717
|
-
};
|
|
1718
|
-
}
|
|
1719
|
-
function consumeFields(tokens) {
|
|
1720
|
-
var fields, subset, ref$, key, types;
|
|
1721
|
-
fields = {};
|
|
1722
|
-
consumeOp(tokens, "{");
|
|
1723
|
-
subset = false;
|
|
1724
|
-
for (; ; ) {
|
|
1725
|
-
if (maybeConsumeOp(tokens, "...")) {
|
|
1726
|
-
subset = true;
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
ref$ = consumeField(tokens), key = ref$[0], types = ref$[1];
|
|
1730
|
-
fields[key] = types;
|
|
1731
|
-
maybeConsumeOp(tokens, ",");
|
|
1732
|
-
if ("}" === peek(tokens)) {
|
|
1733
|
-
break;
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
consumeOp(tokens, "}");
|
|
1737
|
-
return {
|
|
1738
|
-
structure: "fields",
|
|
1739
|
-
of: fields,
|
|
1740
|
-
subset
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
function consumeField(tokens) {
|
|
1744
|
-
var key, types;
|
|
1745
|
-
key = consumeIdent(tokens);
|
|
1746
|
-
consumeOp(tokens, ":");
|
|
1747
|
-
types = consumeTypes(tokens);
|
|
1748
|
-
return [key, types];
|
|
1749
|
-
}
|
|
1750
|
-
function maybeConsumeStructure(tokens) {
|
|
1751
|
-
switch (tokens[0]) {
|
|
1752
|
-
case "[":
|
|
1753
|
-
return consumeArray(tokens);
|
|
1754
|
-
case "(":
|
|
1755
|
-
return consumeTuple(tokens);
|
|
1756
|
-
case "{":
|
|
1757
|
-
return consumeFields(tokens);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
function consumeType(tokens) {
|
|
1761
|
-
var token, wildcard, type, structure;
|
|
1762
|
-
token = peek(tokens);
|
|
1763
|
-
wildcard = token === "*";
|
|
1764
|
-
if (wildcard || identifierRegex.test(token)) {
|
|
1765
|
-
type = wildcard ? consumeOp(tokens, "*") : consumeIdent(tokens);
|
|
1766
|
-
structure = maybeConsumeStructure(tokens);
|
|
1767
|
-
if (structure) {
|
|
1768
|
-
return structure.type = type, structure;
|
|
1769
|
-
} else {
|
|
1770
|
-
return {
|
|
1771
|
-
type
|
|
1772
|
-
};
|
|
1773
|
-
}
|
|
1774
|
-
} else {
|
|
1775
|
-
structure = maybeConsumeStructure(tokens);
|
|
1776
|
-
if (!structure) {
|
|
1777
|
-
throw new Error("Unexpected character: " + token);
|
|
1778
|
-
}
|
|
1779
|
-
return structure;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
function consumeTypes(tokens) {
|
|
1783
|
-
var lookahead, types, typesSoFar, typeObj, type, structure;
|
|
1784
|
-
if ("::" === peek(tokens)) {
|
|
1785
|
-
throw new Error("No comment before comment separator '::' found.");
|
|
1786
|
-
}
|
|
1787
|
-
lookahead = tokens[1];
|
|
1788
|
-
if (lookahead != null && lookahead === "::") {
|
|
1789
|
-
tokens.shift();
|
|
1790
|
-
tokens.shift();
|
|
1791
|
-
}
|
|
1792
|
-
types = [];
|
|
1793
|
-
typesSoFar = {};
|
|
1794
|
-
if ("Maybe" === peek(tokens)) {
|
|
1795
|
-
tokens.shift();
|
|
1796
|
-
types = [
|
|
1797
|
-
{
|
|
1798
|
-
type: "Undefined"
|
|
1799
|
-
},
|
|
1800
|
-
{
|
|
1801
|
-
type: "Null"
|
|
1802
|
-
}
|
|
1803
|
-
];
|
|
1804
|
-
typesSoFar = {
|
|
1805
|
-
Undefined: true,
|
|
1806
|
-
Null: true
|
|
1807
|
-
};
|
|
1808
|
-
}
|
|
1809
|
-
for (; ; ) {
|
|
1810
|
-
typeObj = consumeType(tokens), type = typeObj.type, structure = typeObj.structure;
|
|
1811
|
-
if (!typesSoFar[type]) {
|
|
1812
|
-
types.push(typeObj);
|
|
1813
|
-
}
|
|
1814
|
-
if (structure == null) {
|
|
1815
|
-
typesSoFar[type] = true;
|
|
1816
|
-
}
|
|
1817
|
-
if (!maybeConsumeOp(tokens, "|")) {
|
|
1818
|
-
break;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
return types;
|
|
1822
|
-
}
|
|
1823
|
-
tokenRegex = RegExp("\\.\\.\\.|::|->|" + identifierRegex.source + "|\\S", "g");
|
|
1824
|
-
module.exports = function(input) {
|
|
1825
|
-
var tokens, e;
|
|
1826
|
-
if (!input.length) {
|
|
1827
|
-
throw new Error("No type specified.");
|
|
1828
|
-
}
|
|
1829
|
-
tokens = input.match(tokenRegex) || [];
|
|
1830
|
-
if (in$("->", tokens)) {
|
|
1831
|
-
throw new Error("Function types are not supported. To validate that something is a function, you may use 'Function'.");
|
|
1832
|
-
}
|
|
1833
|
-
try {
|
|
1834
|
-
return consumeTypes(tokens);
|
|
1835
|
-
} catch (e$) {
|
|
1836
|
-
e = e$;
|
|
1837
|
-
throw new Error(e.message + " - Remaining tokens: " + JSON.stringify(tokens) + " - Initial input: '" + input + "'");
|
|
1838
|
-
}
|
|
1839
|
-
};
|
|
1840
|
-
function in$(x, xs) {
|
|
1841
|
-
var i = -1, l = xs.length >>> 0;
|
|
1842
|
-
while (++i < l) if (x === xs[i]) return true;
|
|
1843
|
-
return false;
|
|
1844
|
-
}
|
|
1845
|
-
}).call(exports);
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
1848
|
-
|
|
1849
|
-
// node_modules/type-check/lib/check.js
|
|
1850
|
-
var require_check = __commonJS({
|
|
1851
|
-
"node_modules/type-check/lib/check.js"(exports, module) {
|
|
1852
|
-
(function() {
|
|
1853
|
-
var ref$, any, all, isItNaN, types, defaultType, toString$ = {}.toString;
|
|
1854
|
-
ref$ = require_lib(), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN;
|
|
1855
|
-
types = {
|
|
1856
|
-
Number: {
|
|
1857
|
-
typeOf: "Number",
|
|
1858
|
-
validate: function(it) {
|
|
1859
|
-
return !isItNaN(it);
|
|
1860
|
-
}
|
|
1861
|
-
},
|
|
1862
|
-
NaN: {
|
|
1863
|
-
typeOf: "Number",
|
|
1864
|
-
validate: isItNaN
|
|
1865
|
-
},
|
|
1866
|
-
Int: {
|
|
1867
|
-
typeOf: "Number",
|
|
1868
|
-
validate: function(it) {
|
|
1869
|
-
return !isItNaN(it) && it % 1 === 0;
|
|
1870
|
-
}
|
|
1871
|
-
},
|
|
1872
|
-
Float: {
|
|
1873
|
-
typeOf: "Number",
|
|
1874
|
-
validate: function(it) {
|
|
1875
|
-
return !isItNaN(it);
|
|
1876
|
-
}
|
|
1877
|
-
},
|
|
1878
|
-
Date: {
|
|
1879
|
-
typeOf: "Date",
|
|
1880
|
-
validate: function(it) {
|
|
1881
|
-
return !isItNaN(it.getTime());
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
};
|
|
1885
|
-
defaultType = {
|
|
1886
|
-
array: "Array",
|
|
1887
|
-
tuple: "Array"
|
|
1888
|
-
};
|
|
1889
|
-
function checkArray(input, type, options) {
|
|
1890
|
-
return all(function(it) {
|
|
1891
|
-
return checkMultiple(it, type.of, options);
|
|
1892
|
-
}, input);
|
|
1893
|
-
}
|
|
1894
|
-
function checkTuple(input, type, options) {
|
|
1895
|
-
var i, i$, ref$2, len$, types2;
|
|
1896
|
-
i = 0;
|
|
1897
|
-
for (i$ = 0, len$ = (ref$2 = type.of).length; i$ < len$; ++i$) {
|
|
1898
|
-
types2 = ref$2[i$];
|
|
1899
|
-
if (!checkMultiple(input[i], types2, options)) {
|
|
1900
|
-
return false;
|
|
1901
|
-
}
|
|
1902
|
-
i++;
|
|
1903
|
-
}
|
|
1904
|
-
return input.length <= i;
|
|
1905
|
-
}
|
|
1906
|
-
function checkFields(input, type, options) {
|
|
1907
|
-
var inputKeys, numInputKeys, k, numOfKeys, key, ref$2, types2;
|
|
1908
|
-
inputKeys = {};
|
|
1909
|
-
numInputKeys = 0;
|
|
1910
|
-
for (k in input) {
|
|
1911
|
-
inputKeys[k] = true;
|
|
1912
|
-
numInputKeys++;
|
|
1913
|
-
}
|
|
1914
|
-
numOfKeys = 0;
|
|
1915
|
-
for (key in ref$2 = type.of) {
|
|
1916
|
-
types2 = ref$2[key];
|
|
1917
|
-
if (!checkMultiple(input[key], types2, options)) {
|
|
1918
|
-
return false;
|
|
1919
|
-
}
|
|
1920
|
-
if (inputKeys[key]) {
|
|
1921
|
-
numOfKeys++;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
return type.subset || numInputKeys === numOfKeys;
|
|
1925
|
-
}
|
|
1926
|
-
function checkStructure(input, type, options) {
|
|
1927
|
-
if (!(input instanceof Object)) {
|
|
1928
|
-
return false;
|
|
1929
|
-
}
|
|
1930
|
-
switch (type.structure) {
|
|
1931
|
-
case "fields":
|
|
1932
|
-
return checkFields(input, type, options);
|
|
1933
|
-
case "array":
|
|
1934
|
-
return checkArray(input, type, options);
|
|
1935
|
-
case "tuple":
|
|
1936
|
-
return checkTuple(input, type, options);
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
function check(input, typeObj, options) {
|
|
1940
|
-
var type, structure, setting, that;
|
|
1941
|
-
type = typeObj.type, structure = typeObj.structure;
|
|
1942
|
-
if (type) {
|
|
1943
|
-
if (type === "*") {
|
|
1944
|
-
return true;
|
|
1945
|
-
}
|
|
1946
|
-
setting = options.customTypes[type] || types[type];
|
|
1947
|
-
if (setting) {
|
|
1948
|
-
return (setting.typeOf === void 0 || setting.typeOf === toString$.call(input).slice(8, -1)) && setting.validate(input);
|
|
1949
|
-
} else {
|
|
1950
|
-
return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj, options));
|
|
1951
|
-
}
|
|
1952
|
-
} else if (structure) {
|
|
1953
|
-
if (that = defaultType[structure]) {
|
|
1954
|
-
if (that !== toString$.call(input).slice(8, -1)) {
|
|
1955
|
-
return false;
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
return checkStructure(input, typeObj, options);
|
|
1959
|
-
} else {
|
|
1960
|
-
throw new Error("No type defined. Input: " + input + ".");
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
function checkMultiple(input, types2, options) {
|
|
1964
|
-
if (toString$.call(types2).slice(8, -1) !== "Array") {
|
|
1965
|
-
throw new Error("Types must be in an array. Input: " + input + ".");
|
|
1966
|
-
}
|
|
1967
|
-
return any(function(it) {
|
|
1968
|
-
return check(input, it, options);
|
|
1969
|
-
}, types2);
|
|
1970
|
-
}
|
|
1971
|
-
module.exports = function(parsedType, input, options) {
|
|
1972
|
-
options == null && (options = {});
|
|
1973
|
-
if (options.customTypes == null) {
|
|
1974
|
-
options.customTypes = {};
|
|
1975
|
-
}
|
|
1976
|
-
return checkMultiple(input, parsedType, options);
|
|
1977
|
-
};
|
|
1978
|
-
}).call(exports);
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
|
|
1982
|
-
// node_modules/type-check/lib/index.js
|
|
1983
|
-
var require_lib2 = __commonJS({
|
|
1984
|
-
"node_modules/type-check/lib/index.js"(exports, module) {
|
|
1985
|
-
(function() {
|
|
1986
|
-
var VERSION, parseType, parsedTypeCheck, typeCheck;
|
|
1987
|
-
VERSION = "0.4.0";
|
|
1988
|
-
parseType = require_parse_type();
|
|
1989
|
-
parsedTypeCheck = require_check();
|
|
1990
|
-
typeCheck = function(type, input, options) {
|
|
1991
|
-
return parsedTypeCheck(parseType(type), input, options);
|
|
1992
|
-
};
|
|
1993
|
-
module.exports = {
|
|
1994
|
-
VERSION,
|
|
1995
|
-
typeCheck,
|
|
1996
|
-
parsedTypeCheck,
|
|
1997
|
-
parseType
|
|
1998
|
-
};
|
|
1999
|
-
}).call(exports);
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
|
|
2003
|
-
// node_modules/levn/lib/cast.js
|
|
2004
|
-
var require_cast = __commonJS({
|
|
2005
|
-
"node_modules/levn/lib/cast.js"(exports, module) {
|
|
2006
|
-
(function() {
|
|
2007
|
-
var parsedTypeCheck, types, toString$ = {}.toString;
|
|
2008
|
-
parsedTypeCheck = require_lib2().parsedTypeCheck;
|
|
2009
|
-
types = {
|
|
2010
|
-
"*": function(value, options) {
|
|
2011
|
-
switch (toString$.call(value).slice(8, -1)) {
|
|
2012
|
-
case "Array":
|
|
2013
|
-
return typeCast(value, {
|
|
2014
|
-
type: "Array"
|
|
2015
|
-
}, options);
|
|
2016
|
-
case "Object":
|
|
2017
|
-
return typeCast(value, {
|
|
2018
|
-
type: "Object"
|
|
2019
|
-
}, options);
|
|
2020
|
-
default:
|
|
2021
|
-
return {
|
|
2022
|
-
type: "Just",
|
|
2023
|
-
value: typesCast(value, [
|
|
2024
|
-
{
|
|
2025
|
-
type: "Undefined"
|
|
2026
|
-
},
|
|
2027
|
-
{
|
|
2028
|
-
type: "Null"
|
|
2029
|
-
},
|
|
2030
|
-
{
|
|
2031
|
-
type: "NaN"
|
|
2032
|
-
},
|
|
2033
|
-
{
|
|
2034
|
-
type: "Boolean"
|
|
2035
|
-
},
|
|
2036
|
-
{
|
|
2037
|
-
type: "Number"
|
|
2038
|
-
},
|
|
2039
|
-
{
|
|
2040
|
-
type: "Date"
|
|
2041
|
-
},
|
|
2042
|
-
{
|
|
2043
|
-
type: "RegExp"
|
|
2044
|
-
},
|
|
2045
|
-
{
|
|
2046
|
-
type: "Array"
|
|
2047
|
-
},
|
|
2048
|
-
{
|
|
2049
|
-
type: "Object"
|
|
2050
|
-
},
|
|
2051
|
-
{
|
|
2052
|
-
type: "String"
|
|
2053
|
-
}
|
|
2054
|
-
], (options.explicit = true, options))
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
},
|
|
2058
|
-
Undefined: function(it) {
|
|
2059
|
-
if (it === "undefined" || it === void 0) {
|
|
2060
|
-
return {
|
|
2061
|
-
type: "Just",
|
|
2062
|
-
value: void 0
|
|
2063
|
-
};
|
|
2064
|
-
} else {
|
|
2065
|
-
return {
|
|
2066
|
-
type: "Nothing"
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
},
|
|
2070
|
-
Null: function(it) {
|
|
2071
|
-
if (it === "null") {
|
|
2072
|
-
return {
|
|
2073
|
-
type: "Just",
|
|
2074
|
-
value: null
|
|
2075
|
-
};
|
|
2076
|
-
} else {
|
|
2077
|
-
return {
|
|
2078
|
-
type: "Nothing"
|
|
2079
|
-
};
|
|
2080
|
-
}
|
|
2081
|
-
},
|
|
2082
|
-
NaN: function(it) {
|
|
2083
|
-
if (it === "NaN") {
|
|
2084
|
-
return {
|
|
2085
|
-
type: "Just",
|
|
2086
|
-
value: NaN
|
|
2087
|
-
};
|
|
2088
|
-
} else {
|
|
2089
|
-
return {
|
|
2090
|
-
type: "Nothing"
|
|
2091
|
-
};
|
|
2092
|
-
}
|
|
2093
|
-
},
|
|
2094
|
-
Boolean: function(it) {
|
|
2095
|
-
if (it === "true") {
|
|
2096
|
-
return {
|
|
2097
|
-
type: "Just",
|
|
2098
|
-
value: true
|
|
2099
|
-
};
|
|
2100
|
-
} else if (it === "false") {
|
|
2101
|
-
return {
|
|
2102
|
-
type: "Just",
|
|
2103
|
-
value: false
|
|
2104
|
-
};
|
|
2105
|
-
} else {
|
|
2106
|
-
return {
|
|
2107
|
-
type: "Nothing"
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
},
|
|
2111
|
-
Number: function(it) {
|
|
2112
|
-
return {
|
|
2113
|
-
type: "Just",
|
|
2114
|
-
value: +it
|
|
2115
|
-
};
|
|
2116
|
-
},
|
|
2117
|
-
Int: function(it) {
|
|
2118
|
-
return {
|
|
2119
|
-
type: "Just",
|
|
2120
|
-
value: +it
|
|
2121
|
-
};
|
|
2122
|
-
},
|
|
2123
|
-
Float: function(it) {
|
|
2124
|
-
return {
|
|
2125
|
-
type: "Just",
|
|
2126
|
-
value: +it
|
|
2127
|
-
};
|
|
2128
|
-
},
|
|
2129
|
-
Date: function(value, options) {
|
|
2130
|
-
var that;
|
|
2131
|
-
if (that = /^\#([\s\S]*)\#$/.exec(value)) {
|
|
2132
|
-
return {
|
|
2133
|
-
type: "Just",
|
|
2134
|
-
value: new Date(+that[1] || that[1])
|
|
2135
|
-
};
|
|
2136
|
-
} else if (options.explicit) {
|
|
2137
|
-
return {
|
|
2138
|
-
type: "Nothing"
|
|
2139
|
-
};
|
|
2140
|
-
} else {
|
|
2141
|
-
return {
|
|
2142
|
-
type: "Just",
|
|
2143
|
-
value: new Date(+value || value)
|
|
2144
|
-
};
|
|
2145
|
-
}
|
|
2146
|
-
},
|
|
2147
|
-
RegExp: function(value, options) {
|
|
2148
|
-
var that;
|
|
2149
|
-
if (that = /^\/([\s\S]*)\/([gimy]*)$/.exec(value)) {
|
|
2150
|
-
return {
|
|
2151
|
-
type: "Just",
|
|
2152
|
-
value: new RegExp(that[1], that[2])
|
|
2153
|
-
};
|
|
2154
|
-
} else if (options.explicit) {
|
|
2155
|
-
return {
|
|
2156
|
-
type: "Nothing"
|
|
2157
|
-
};
|
|
2158
|
-
} else {
|
|
2159
|
-
return {
|
|
2160
|
-
type: "Just",
|
|
2161
|
-
value: new RegExp(value)
|
|
2162
|
-
};
|
|
2163
|
-
}
|
|
2164
|
-
},
|
|
2165
|
-
Array: function(value, options) {
|
|
2166
|
-
return castArray(value, {
|
|
2167
|
-
of: [{
|
|
2168
|
-
type: "*"
|
|
2169
|
-
}]
|
|
2170
|
-
}, options);
|
|
2171
|
-
},
|
|
2172
|
-
Object: function(value, options) {
|
|
2173
|
-
return castFields(value, {
|
|
2174
|
-
of: {}
|
|
2175
|
-
}, options);
|
|
2176
|
-
},
|
|
2177
|
-
String: function(it) {
|
|
2178
|
-
var replace, that;
|
|
2179
|
-
if (toString$.call(it).slice(8, -1) !== "String") {
|
|
2180
|
-
return {
|
|
2181
|
-
type: "Nothing"
|
|
2182
|
-
};
|
|
2183
|
-
}
|
|
2184
|
-
replace = function(value, quote) {
|
|
2185
|
-
return value.replace(/\\([^u]|u[0-9a-fA-F]{4})/g, function(all, escaped) {
|
|
2186
|
-
switch (escaped[0]) {
|
|
2187
|
-
case quote:
|
|
2188
|
-
return quote;
|
|
2189
|
-
case "\\":
|
|
2190
|
-
return "\\";
|
|
2191
|
-
case "b":
|
|
2192
|
-
return "\b";
|
|
2193
|
-
case "f":
|
|
2194
|
-
return "\f";
|
|
2195
|
-
case "n":
|
|
2196
|
-
return "\n";
|
|
2197
|
-
case "r":
|
|
2198
|
-
return "\r";
|
|
2199
|
-
case "t":
|
|
2200
|
-
return " ";
|
|
2201
|
-
case "u":
|
|
2202
|
-
return JSON.parse('"' + all + '"');
|
|
2203
|
-
default:
|
|
2204
|
-
return escaped;
|
|
2205
|
-
}
|
|
2206
|
-
});
|
|
2207
|
-
};
|
|
2208
|
-
if (that = it.match(/^'([\s\S]*)'$/)) {
|
|
2209
|
-
return {
|
|
2210
|
-
type: "Just",
|
|
2211
|
-
value: replace(that[1], "'")
|
|
2212
|
-
};
|
|
2213
|
-
} else if (that = it.match(/^"([\s\S]*)"$/)) {
|
|
2214
|
-
return {
|
|
2215
|
-
type: "Just",
|
|
2216
|
-
value: replace(that[1], '"')
|
|
2217
|
-
};
|
|
2218
|
-
} else {
|
|
2219
|
-
return {
|
|
2220
|
-
type: "Just",
|
|
2221
|
-
value: it
|
|
2222
|
-
};
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
};
|
|
2226
|
-
function castArray(node, type, options) {
|
|
2227
|
-
var typeOf, element;
|
|
2228
|
-
if (toString$.call(node).slice(8, -1) !== "Array") {
|
|
2229
|
-
return {
|
|
2230
|
-
type: "Nothing"
|
|
2231
|
-
};
|
|
2232
|
-
}
|
|
2233
|
-
typeOf = type.of;
|
|
2234
|
-
return {
|
|
2235
|
-
type: "Just",
|
|
2236
|
-
value: (function() {
|
|
2237
|
-
var i$, ref$, len$, results$ = [];
|
|
2238
|
-
for (i$ = 0, len$ = (ref$ = node).length; i$ < len$; ++i$) {
|
|
2239
|
-
element = ref$[i$];
|
|
2240
|
-
results$.push(typesCast(element, typeOf, options));
|
|
2241
|
-
}
|
|
2242
|
-
return results$;
|
|
2243
|
-
})()
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
|
-
function castTuple(node, type, options) {
|
|
2247
|
-
var result, i, i$, ref$, len$, types2, cast;
|
|
2248
|
-
if (toString$.call(node).slice(8, -1) !== "Array") {
|
|
2249
|
-
return {
|
|
2250
|
-
type: "Nothing"
|
|
2251
|
-
};
|
|
2252
|
-
}
|
|
2253
|
-
result = [];
|
|
2254
|
-
i = 0;
|
|
2255
|
-
for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
|
|
2256
|
-
types2 = ref$[i$];
|
|
2257
|
-
cast = typesCast(node[i], types2, options);
|
|
2258
|
-
if (toString$.call(cast).slice(8, -1) !== "Undefined") {
|
|
2259
|
-
result.push(cast);
|
|
2260
|
-
}
|
|
2261
|
-
i++;
|
|
2262
|
-
}
|
|
2263
|
-
if (node.length <= i) {
|
|
2264
|
-
return {
|
|
2265
|
-
type: "Just",
|
|
2266
|
-
value: result
|
|
2267
|
-
};
|
|
2268
|
-
} else {
|
|
2269
|
-
return {
|
|
2270
|
-
type: "Nothing"
|
|
2271
|
-
};
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
function castFields(node, type, options) {
|
|
2275
|
-
var typeOf, key, value;
|
|
2276
|
-
if (toString$.call(node).slice(8, -1) !== "Object") {
|
|
2277
|
-
return {
|
|
2278
|
-
type: "Nothing"
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
typeOf = type.of;
|
|
2282
|
-
return {
|
|
2283
|
-
type: "Just",
|
|
2284
|
-
value: (function() {
|
|
2285
|
-
var ref$, resultObj$ = {};
|
|
2286
|
-
for (key in ref$ = node) {
|
|
2287
|
-
value = ref$[key];
|
|
2288
|
-
resultObj$[typesCast(key, [{
|
|
2289
|
-
type: "String"
|
|
2290
|
-
}], options)] = typesCast(value, typeOf[key] || [{
|
|
2291
|
-
type: "*"
|
|
2292
|
-
}], options);
|
|
2293
|
-
}
|
|
2294
|
-
return resultObj$;
|
|
2295
|
-
})()
|
|
2296
|
-
};
|
|
2297
|
-
}
|
|
2298
|
-
function typeCast(node, typeObj, options) {
|
|
2299
|
-
var type, structure, castFunc, ref$;
|
|
2300
|
-
type = typeObj.type, structure = typeObj.structure;
|
|
2301
|
-
if (type) {
|
|
2302
|
-
castFunc = ((ref$ = options.customTypes[type]) != null ? ref$.cast : void 0) || types[type];
|
|
2303
|
-
if (!castFunc) {
|
|
2304
|
-
throw new Error("Type not defined: " + type + ".");
|
|
2305
|
-
}
|
|
2306
|
-
return castFunc(node, options, typesCast);
|
|
2307
|
-
} else {
|
|
2308
|
-
switch (structure) {
|
|
2309
|
-
case "array":
|
|
2310
|
-
return castArray(node, typeObj, options);
|
|
2311
|
-
case "tuple":
|
|
2312
|
-
return castTuple(node, typeObj, options);
|
|
2313
|
-
case "fields":
|
|
2314
|
-
return castFields(node, typeObj, options);
|
|
2315
|
-
}
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
function typesCast(node, types2, options) {
|
|
2319
|
-
var i$, len$, type, ref$, valueType, value;
|
|
2320
|
-
for (i$ = 0, len$ = types2.length; i$ < len$; ++i$) {
|
|
2321
|
-
type = types2[i$];
|
|
2322
|
-
ref$ = typeCast(node, type, options), valueType = ref$.type, value = ref$.value;
|
|
2323
|
-
if (valueType === "Nothing") {
|
|
2324
|
-
continue;
|
|
2325
|
-
}
|
|
2326
|
-
if (parsedTypeCheck([type], value, {
|
|
2327
|
-
customTypes: options.customTypes
|
|
2328
|
-
})) {
|
|
2329
|
-
return value;
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
throw new Error("Value " + JSON.stringify(node) + " does not type check against " + JSON.stringify(types2) + ".");
|
|
2333
|
-
}
|
|
2334
|
-
module.exports = function(node, types2, options) {
|
|
2335
|
-
if (!options.explicit && types2.length === 1 && types2[0].type === "String") {
|
|
2336
|
-
return node;
|
|
2337
|
-
}
|
|
2338
|
-
return typesCast(node, types2, options);
|
|
2339
|
-
};
|
|
2340
|
-
}).call(exports);
|
|
2341
|
-
}
|
|
2342
|
-
});
|
|
2343
|
-
|
|
2344
|
-
// node_modules/levn/lib/index.js
|
|
2345
|
-
var require_lib3 = __commonJS({
|
|
2346
|
-
"node_modules/levn/lib/index.js"(exports, module) {
|
|
2347
|
-
(function() {
|
|
2348
|
-
var parseString, cast, parseType, VERSION, parsedTypeParse, parse;
|
|
2349
|
-
parseString = require_parse_string();
|
|
2350
|
-
cast = require_cast();
|
|
2351
|
-
parseType = require_lib2().parseType;
|
|
2352
|
-
VERSION = "0.4.1";
|
|
2353
|
-
parsedTypeParse = function(parsedType, string, options) {
|
|
2354
|
-
options == null && (options = {});
|
|
2355
|
-
options.explicit == null && (options.explicit = false);
|
|
2356
|
-
options.customTypes == null && (options.customTypes = {});
|
|
2357
|
-
return cast(parseString(parsedType, string, options), parsedType, options);
|
|
2358
|
-
};
|
|
2359
|
-
parse = function(type, string, options) {
|
|
2360
|
-
return parsedTypeParse(parseType(type), string, options);
|
|
2361
|
-
};
|
|
2362
|
-
module.exports = {
|
|
2363
|
-
VERSION,
|
|
2364
|
-
parse,
|
|
2365
|
-
parsedTypeParse
|
|
2366
|
-
};
|
|
2367
|
-
}).call(exports);
|
|
2368
|
-
}
|
|
2369
|
-
});
|
|
38
|
+
// mechanisms/eslint/runner/create-eslint-runner.ts
|
|
39
|
+
import { z as z9 } from "zod";
|
|
2370
40
|
|
|
2371
41
|
// mechanisms/eslint/runner/core-install.ts
|
|
42
|
+
import { z } from "zod";
|
|
2372
43
|
var INSTALL_MANIFEST = "package.json";
|
|
2373
|
-
var namedManifestSchema =
|
|
44
|
+
var namedManifestSchema = z.object({ name: z.string() });
|
|
2374
45
|
var manifestFailure = (request) => ({
|
|
2375
46
|
outcome: "failed",
|
|
2376
47
|
error: { kind: "tool-failed", detail: `the core install's ${request.manifest} ${request.problem}` }
|
|
@@ -2392,18 +63,22 @@ var coreInstallOf = (request) => {
|
|
|
2392
63
|
return text.outcome === "failed" ? manifestFailure({ manifest, problem: `cannot be read: ${text.error.detail}` }) : packageNamedIn({ installRoot: request.installRoot, manifest, text: text.value });
|
|
2393
64
|
};
|
|
2394
65
|
|
|
66
|
+
// mechanisms/eslint/runner/eslint-instance.ts
|
|
67
|
+
import { z as z4 } from "zod";
|
|
68
|
+
|
|
2395
69
|
// mechanisms/eslint/runner/eslint-config-schema.ts
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
70
|
+
import { z as z2 } from "zod";
|
|
71
|
+
var resolvedConfigSchema = z2.union([
|
|
72
|
+
z2.undefined(),
|
|
73
|
+
z2.looseObject({
|
|
74
|
+
rules: z2.record(
|
|
75
|
+
z2.string(),
|
|
76
|
+
z2.tuple([z2.union([z2.literal(0), z2.literal(1), z2.literal(2)])], z2.unknown())
|
|
2402
77
|
).optional(),
|
|
2403
|
-
plugins:
|
|
2404
|
-
language:
|
|
2405
|
-
processor:
|
|
2406
|
-
languageOptions:
|
|
78
|
+
plugins: z2.record(z2.string(), z2.unknown()).optional(),
|
|
79
|
+
language: z2.unknown().optional(),
|
|
80
|
+
processor: z2.unknown().optional(),
|
|
81
|
+
languageOptions: z2.looseObject({ parser: z2.unknown().optional() }).optional()
|
|
2407
82
|
})
|
|
2408
83
|
]);
|
|
2409
84
|
var ruleStateOf = (request) => {
|
|
@@ -2419,180 +94,27 @@ var ruleStateOf = (request) => {
|
|
|
2419
94
|
};
|
|
2420
95
|
|
|
2421
96
|
// mechanisms/eslint/runner/eslint-plugin-schema.ts
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
97
|
+
import { z as z3 } from "zod";
|
|
98
|
+
var ruleVisitorSchema = z3.record(
|
|
99
|
+
z3.string(),
|
|
100
|
+
z3.function({ input: z3.array(z3.unknown()), output: z3.unknown() })
|
|
2425
101
|
);
|
|
2426
|
-
var ruleSchema =
|
|
2427
|
-
meta:
|
|
2428
|
-
type:
|
|
2429
|
-
messages:
|
|
102
|
+
var ruleSchema = z3.looseObject({
|
|
103
|
+
meta: z3.looseObject({
|
|
104
|
+
type: z3.enum(["problem", "suggestion", "layout"]),
|
|
105
|
+
messages: z3.record(z3.string(), z3.string()).optional()
|
|
2430
106
|
}),
|
|
2431
|
-
create:
|
|
107
|
+
create: z3.function({ input: [z3.unknown()], output: ruleVisitorSchema })
|
|
2432
108
|
});
|
|
2433
|
-
var eslintPluginModuleSchema =
|
|
2434
|
-
default:
|
|
109
|
+
var eslintPluginModuleSchema = z3.object({
|
|
110
|
+
default: z3.looseObject({ rules: z3.record(z3.string(), ruleSchema) })
|
|
2435
111
|
});
|
|
2436
|
-
var inlineConfigNodesSchema =
|
|
2437
|
-
|
|
112
|
+
var inlineConfigNodesSchema = z3.array(
|
|
113
|
+
z3.looseObject({ type: z3.enum(["Line", "Block"]), value: z3.string() })
|
|
2438
114
|
);
|
|
2439
115
|
|
|
2440
|
-
// node_modules/@eslint/plugin-kit/dist/esm/index.js
|
|
2441
|
-
var import_levn = __toESM(require_lib3(), 1);
|
|
2442
|
-
var directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u;
|
|
2443
|
-
var validSeverities = /* @__PURE__ */ new Set([0, 1, 2, "off", "warn", "error"]);
|
|
2444
|
-
function isSeverityValid(ruleConfig) {
|
|
2445
|
-
const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
|
2446
|
-
return validSeverities.has(severity);
|
|
2447
|
-
}
|
|
2448
|
-
function isEverySeverityValid(rulesConfig) {
|
|
2449
|
-
return Object.values(rulesConfig).every(isSeverityValid);
|
|
2450
|
-
}
|
|
2451
|
-
var DirectiveComment = class {
|
|
2452
|
-
/**
|
|
2453
|
-
* The label of the directive, such as "eslint", "eslint-disable", etc.
|
|
2454
|
-
* @type {string}
|
|
2455
|
-
*/
|
|
2456
|
-
label = "";
|
|
2457
|
-
/**
|
|
2458
|
-
* The value of the directive (the string after the label).
|
|
2459
|
-
* @type {string}
|
|
2460
|
-
*/
|
|
2461
|
-
value = "";
|
|
2462
|
-
/**
|
|
2463
|
-
* The justification of the directive (the string after the --).
|
|
2464
|
-
* @type {string}
|
|
2465
|
-
*/
|
|
2466
|
-
justification = "";
|
|
2467
|
-
/**
|
|
2468
|
-
* Creates a new directive comment.
|
|
2469
|
-
* @param {string} label The label of the directive.
|
|
2470
|
-
* @param {string} value The value of the directive.
|
|
2471
|
-
* @param {string} justification The justification of the directive.
|
|
2472
|
-
*/
|
|
2473
|
-
constructor(label, value, justification) {
|
|
2474
|
-
this.label = label;
|
|
2475
|
-
this.value = value;
|
|
2476
|
-
this.justification = justification;
|
|
2477
|
-
}
|
|
2478
|
-
};
|
|
2479
|
-
var ConfigCommentParser = class {
|
|
2480
|
-
/**
|
|
2481
|
-
* Parses a list of "name:string_value" or/and "name" options divided by comma or
|
|
2482
|
-
* whitespace. Used for "global" comments.
|
|
2483
|
-
* @param {string} string The string to parse.
|
|
2484
|
-
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
|
|
2485
|
-
*/
|
|
2486
|
-
parseStringConfig(string) {
|
|
2487
|
-
const items = (
|
|
2488
|
-
/** @type {StringConfig} */
|
|
2489
|
-
/* @__PURE__ */ Object.create(null)
|
|
2490
|
-
);
|
|
2491
|
-
const trimmedString = string.trim().replace(/(?<!\s)\s*([:,])\s*/gu, "$1");
|
|
2492
|
-
trimmedString.split(/\s|,+/u).forEach((name) => {
|
|
2493
|
-
if (!name) {
|
|
2494
|
-
return;
|
|
2495
|
-
}
|
|
2496
|
-
const [key, value = null] = name.split(":");
|
|
2497
|
-
items[key] = value;
|
|
2498
|
-
});
|
|
2499
|
-
return items;
|
|
2500
|
-
}
|
|
2501
|
-
/**
|
|
2502
|
-
* Parses a JSON-like config.
|
|
2503
|
-
* @param {string} string The string to parse.
|
|
2504
|
-
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
|
|
2505
|
-
*/
|
|
2506
|
-
parseJSONLikeConfig(string) {
|
|
2507
|
-
try {
|
|
2508
|
-
const items = (
|
|
2509
|
-
/** @type {RulesConfig} */
|
|
2510
|
-
import_levn.default.parse("Object", string) || {}
|
|
2511
|
-
);
|
|
2512
|
-
if (isEverySeverityValid(items)) {
|
|
2513
|
-
return {
|
|
2514
|
-
ok: true,
|
|
2515
|
-
config: items
|
|
2516
|
-
};
|
|
2517
|
-
}
|
|
2518
|
-
} catch {
|
|
2519
|
-
}
|
|
2520
|
-
const normalizedString = string.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":').replace(/([\]0-9])\s+(?=")/u, "$1,");
|
|
2521
|
-
try {
|
|
2522
|
-
const items = JSON.parse(`{${normalizedString}}`);
|
|
2523
|
-
return {
|
|
2524
|
-
ok: true,
|
|
2525
|
-
config: items
|
|
2526
|
-
};
|
|
2527
|
-
} catch (ex) {
|
|
2528
|
-
const errorMessage = ex instanceof Error ? ex.message : String(ex);
|
|
2529
|
-
return {
|
|
2530
|
-
ok: false,
|
|
2531
|
-
error: {
|
|
2532
|
-
message: `Failed to parse JSON from '${normalizedString}': ${errorMessage}`
|
|
2533
|
-
}
|
|
2534
|
-
};
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
/**
|
|
2538
|
-
* Parses a config of values separated by comma.
|
|
2539
|
-
* @param {string} string The string to parse.
|
|
2540
|
-
* @returns {BooleanConfig} Result map of values and true values
|
|
2541
|
-
*/
|
|
2542
|
-
parseListConfig(string) {
|
|
2543
|
-
const items = (
|
|
2544
|
-
/** @type {BooleanConfig} */
|
|
2545
|
-
/* @__PURE__ */ Object.create(null)
|
|
2546
|
-
);
|
|
2547
|
-
string.split(",").forEach((name) => {
|
|
2548
|
-
const trimmedName = name.trim().replace(
|
|
2549
|
-
/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/su,
|
|
2550
|
-
"$<ruleId>"
|
|
2551
|
-
);
|
|
2552
|
-
if (trimmedName) {
|
|
2553
|
-
items[trimmedName] = true;
|
|
2554
|
-
}
|
|
2555
|
-
});
|
|
2556
|
-
return items;
|
|
2557
|
-
}
|
|
2558
|
-
/**
|
|
2559
|
-
* Extract the directive and the justification from a given directive comment and trim them.
|
|
2560
|
-
* @param {string} value The comment text to extract.
|
|
2561
|
-
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
|
2562
|
-
*/
|
|
2563
|
-
#extractDirectiveComment(value) {
|
|
2564
|
-
const match = /\s-{2,}\s/u.exec(value);
|
|
2565
|
-
if (!match) {
|
|
2566
|
-
return { directivePart: value.trim(), justificationPart: "" };
|
|
2567
|
-
}
|
|
2568
|
-
const directive = value.slice(0, match.index).trim();
|
|
2569
|
-
const justification = value.slice(match.index + match[0].length).trim();
|
|
2570
|
-
return { directivePart: directive, justificationPart: justification };
|
|
2571
|
-
}
|
|
2572
|
-
/**
|
|
2573
|
-
* Parses a directive comment into directive text and value.
|
|
2574
|
-
* @param {string} string The string with the directive to be parsed.
|
|
2575
|
-
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
|
|
2576
|
-
*/
|
|
2577
|
-
parseDirective(string) {
|
|
2578
|
-
const { directivePart, justificationPart } = this.#extractDirectiveComment(string);
|
|
2579
|
-
const match = directivesPattern.exec(directivePart);
|
|
2580
|
-
if (!match) {
|
|
2581
|
-
return void 0;
|
|
2582
|
-
}
|
|
2583
|
-
const directiveText = match[1];
|
|
2584
|
-
const directiveValue = directivePart.slice(
|
|
2585
|
-
match.index + directiveText.length
|
|
2586
|
-
);
|
|
2587
|
-
return new DirectiveComment(
|
|
2588
|
-
directiveText,
|
|
2589
|
-
directiveValue.trim(),
|
|
2590
|
-
justificationPart
|
|
2591
|
-
);
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
|
|
2595
116
|
// mechanisms/eslint/runner/inline-config-parser.ts
|
|
117
|
+
import { ConfigCommentParser } from "@eslint/plugin-kit";
|
|
2596
118
|
var DISABLE_LABELS = [
|
|
2597
119
|
"eslint-disable",
|
|
2598
120
|
"eslint-disable-line",
|
|
@@ -2759,7 +281,7 @@ var resolvedRuleState = (request) => {
|
|
|
2759
281
|
if (!parsed.success) {
|
|
2760
282
|
return {
|
|
2761
283
|
outcome: "failed",
|
|
2762
|
-
error: { kind: "runner-invalid-output", detail:
|
|
284
|
+
error: { kind: "runner-invalid-output", detail: z4.prettifyError(parsed.error) }
|
|
2763
285
|
};
|
|
2764
286
|
}
|
|
2765
287
|
return { outcome: "ok", value: ruleStateOf({ resolved: parsed.data, ruleId: request.ruleId }) };
|
|
@@ -2932,7 +454,8 @@ var createEslintOn = (request) => (create) => {
|
|
|
2932
454
|
};
|
|
2933
455
|
|
|
2934
456
|
// mechanisms/eslint/runner/eslint-piece-settings-schema.ts
|
|
2935
|
-
|
|
457
|
+
import { z as z5 } from "zod";
|
|
458
|
+
var pieceModulePathSchema = z5.string().superRefine((text, context) => {
|
|
2936
459
|
if (isRepoPathText({ text }) === "not-repo-path" || moduleFileForm({ text }) === "not-module-file") {
|
|
2937
460
|
context.addIssue({
|
|
2938
461
|
code: "custom",
|
|
@@ -2940,12 +463,12 @@ var pieceModulePathSchema = external_exports.string().superRefine((text, context
|
|
|
2940
463
|
});
|
|
2941
464
|
}
|
|
2942
465
|
});
|
|
2943
|
-
var pluginNamespaceSchema =
|
|
2944
|
-
var eslintPieceSettingsSchema =
|
|
466
|
+
var pluginNamespaceSchema = z5.string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);
|
|
467
|
+
var eslintPieceSettingsSchema = z5.strictObject({
|
|
2945
468
|
pluginNamespace: pluginNamespaceSchema,
|
|
2946
469
|
pluginModule: pieceModulePathSchema,
|
|
2947
|
-
rule:
|
|
2948
|
-
options:
|
|
470
|
+
rule: z5.string(),
|
|
471
|
+
options: z5.array(z5.json()).readonly().optional()
|
|
2949
472
|
}).readonly();
|
|
2950
473
|
var ruleOptionsOf = (request) => request.settings.options ?? [];
|
|
2951
474
|
|
|
@@ -3056,17 +579,19 @@ var namespaceOwnershipRefusal = (request) => {
|
|
|
3056
579
|
};
|
|
3057
580
|
|
|
3058
581
|
// mechanisms/eslint/runner/eslint-file-schemas.ts
|
|
3059
|
-
|
|
3060
|
-
|
|
582
|
+
import { z as z6 } from "zod";
|
|
583
|
+
var packageJsonSchema = z6.looseObject({
|
|
584
|
+
scripts: z6.record(z6.string(), z6.string()).optional()
|
|
3061
585
|
});
|
|
3062
|
-
var suppressionsFileSchema =
|
|
3063
|
-
|
|
3064
|
-
|
|
586
|
+
var suppressionsFileSchema = z6.record(
|
|
587
|
+
z6.string(),
|
|
588
|
+
z6.record(z6.string(), z6.looseObject({ count: z6.number() }))
|
|
3065
589
|
);
|
|
3066
|
-
var eslintVersionFileSchema =
|
|
3067
|
-
var selectionLookupSchema =
|
|
590
|
+
var eslintVersionFileSchema = z6.looseObject({ version: z6.string() });
|
|
591
|
+
var selectionLookupSchema = z6.looseObject({ eslintConfigLookup: eslintConfigLookupSchema.optional() });
|
|
3068
592
|
|
|
3069
593
|
// mechanisms/eslint/runner/package-script-scanner.ts
|
|
594
|
+
import { z as z7 } from "zod";
|
|
3070
595
|
var SCRIPT_PIECES = /(?<single>'[^']*')|(?<double>"[^"]*")|(?<operator>&&|\|\||[;|])|(?<space>\s+)|(?<text>[^'"\s;|&]+|&)|(?<stray>['"])/g;
|
|
3071
596
|
var ESLINT_TOKEN = "eslint";
|
|
3072
597
|
var ESLINT_VERSIONED_PREFIX = "eslint@";
|
|
@@ -3437,7 +962,7 @@ var scanPackageJson = (request) => {
|
|
|
3437
962
|
if (!packageJson.success) {
|
|
3438
963
|
return {
|
|
3439
964
|
outcome: "failed",
|
|
3440
|
-
error: { kind: "tool-failed", detail: `${request.path}: ${
|
|
965
|
+
error: { kind: "tool-failed", detail: `${request.path}: ${z7.prettifyError(packageJson.error)}` }
|
|
3441
966
|
};
|
|
3442
967
|
}
|
|
3443
968
|
return Object.entries(packageJson.data.scripts ?? {}).reduce(
|
|
@@ -3927,6 +1452,7 @@ var slicedProjectionWrites = (request) => {
|
|
|
3927
1452
|
};
|
|
3928
1453
|
|
|
3929
1454
|
// mechanisms/eslint/runner/suppressions-scanner.ts
|
|
1455
|
+
import { z as z8 } from "zod";
|
|
3930
1456
|
var REPO_ROOT = "repo-root";
|
|
3931
1457
|
var ruleExceptions = (request) => request.ruleIds.flatMap(
|
|
3932
1458
|
(ruleId) => request.selectedRules.filter((rule) => rule.ruleId === ruleId).map(
|
|
@@ -3978,7 +1504,7 @@ var suppressionEntriesOf = (request) => {
|
|
|
3978
1504
|
if (!suppressions.success) {
|
|
3979
1505
|
return {
|
|
3980
1506
|
outcome: "failed",
|
|
3981
|
-
error: { kind: "tool-failed", detail: `${request.location}: ${
|
|
1507
|
+
error: { kind: "tool-failed", detail: `${request.location}: ${z8.prettifyError(suppressions.error)}` }
|
|
3982
1508
|
};
|
|
3983
1509
|
}
|
|
3984
1510
|
const baseSegments = baseSegmentsOf({ keysRelativeTo: request.keysRelativeTo });
|
|
@@ -4026,7 +1552,7 @@ var mappedOutcome = (request) => request.outcome.outcome === "failed" ? request.
|
|
|
4026
1552
|
var configuredClause = (request) => {
|
|
4027
1553
|
const settings = eslintPieceSettingsSchema.safeParse(request.clause.settings);
|
|
4028
1554
|
if (!settings.success) {
|
|
4029
|
-
return pieceInvalid({ pieceRoot: request.clause.pieceRoot, detail:
|
|
1555
|
+
return pieceInvalid({ pieceRoot: request.clause.pieceRoot, detail: z9.prettifyError(settings.error) });
|
|
4030
1556
|
}
|
|
4031
1557
|
const refusal = namespaceOwnershipRefusal({
|
|
4032
1558
|
address: request.clause.address,
|
|
@@ -4104,7 +1630,7 @@ var parsedPluginOf = (request) => {
|
|
|
4104
1630
|
}
|
|
4105
1631
|
const parsed = eslintPluginModuleSchema.safeParse(request.loaded.value);
|
|
4106
1632
|
if (!parsed.success) {
|
|
4107
|
-
return { outcome: "failed", error: { detail:
|
|
1633
|
+
return { outcome: "failed", error: { detail: z9.prettifyError(parsed.error) } };
|
|
4108
1634
|
}
|
|
4109
1635
|
return { outcome: "ok", value: parsed.data.default };
|
|
4110
1636
|
};
|
|
@@ -4791,7 +2317,7 @@ var conformedCases = (request) => {
|
|
|
4791
2317
|
}
|
|
4792
2318
|
const cwd = absolutePathSchema.safeParse(request.clause.pieceRoot);
|
|
4793
2319
|
if (!cwd.success) {
|
|
4794
|
-
return Promise.resolve(pieceInvalid({ pieceRoot: request.clause.pieceRoot, detail:
|
|
2320
|
+
return Promise.resolve(pieceInvalid({ pieceRoot: request.clause.pieceRoot, detail: z9.prettifyError(cwd.error) }));
|
|
4795
2321
|
}
|
|
4796
2322
|
return loadedPlugin({ configured: configured.value, modules: request.ports.modules }).then(
|
|
4797
2323
|
(selected) => lintedSourceCases({ selected, cwd: cwd.data, cases: request.cases, eslint: request.ports.eslint })
|