@eslint-react/jsx 1.5.11-next.9 → 1.5.11
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/dist/index.d.mts +4 -76
- package/dist/index.d.ts +4 -76
- package/dist/index.js +880 -312
- package/dist/index.mjs +881 -290
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var types = require('@typescript-eslint/types');
|
|
3
4
|
var ast = require('@eslint-react/ast');
|
|
4
|
-
var shared = require('@eslint-react/shared');
|
|
5
|
-
var memo = require('micro-memoize');
|
|
6
5
|
var _var = require('@eslint-react/var');
|
|
7
|
-
var types = require('@typescript-eslint/types');
|
|
8
6
|
require('@typescript-eslint/utils');
|
|
9
7
|
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var memo__default = /*#__PURE__*/_interopDefault(memo);
|
|
13
|
-
|
|
14
8
|
var __defProp = Object.defineProperty;
|
|
15
9
|
var __export = (target, all3) => {
|
|
16
10
|
for (var name in all3)
|
|
17
11
|
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
18
12
|
};
|
|
13
|
+
function resolveMemberExpressions(object, property) {
|
|
14
|
+
if (object.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
15
|
+
return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
|
|
16
|
+
}
|
|
17
|
+
if (object.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
18
|
+
return `${object.namespace.name}:${object.name.name}.${property.name}`;
|
|
19
|
+
}
|
|
20
|
+
return `${object.name}.${property.name}`;
|
|
21
|
+
}
|
|
22
|
+
function elementType(node) {
|
|
23
|
+
if (node.type === types.AST_NODE_TYPES.JSXOpeningFragment) {
|
|
24
|
+
return "<>";
|
|
25
|
+
}
|
|
26
|
+
const { name } = node;
|
|
27
|
+
if (name.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
28
|
+
const { object, property } = name;
|
|
29
|
+
return resolveMemberExpressions(object, property);
|
|
30
|
+
}
|
|
31
|
+
if (name.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
32
|
+
return `${name.namespace.name}:${name.name.name}`;
|
|
33
|
+
}
|
|
34
|
+
return name.name;
|
|
35
|
+
}
|
|
36
|
+
function isJSXElementOfUserDefinedComponent(node) {
|
|
37
|
+
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
38
|
+
}
|
|
39
|
+
function isJSXElementOfBuiltinComponent(node) {
|
|
40
|
+
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
|
|
41
|
+
}
|
|
19
42
|
|
|
20
43
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Function.js
|
|
21
44
|
var Function_exports = {};
|
|
@@ -192,17 +215,156 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
|
192
215
|
var hole = /* @__PURE__ */ unsafeCoerce(absurd);
|
|
193
216
|
var SK = (_2, b2) => b2;
|
|
194
217
|
|
|
218
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Array.js
|
|
219
|
+
var Array_exports = {};
|
|
220
|
+
__export(Array_exports, {
|
|
221
|
+
allocate: () => allocate,
|
|
222
|
+
append: () => append,
|
|
223
|
+
appendAll: () => appendAll,
|
|
224
|
+
cartesian: () => cartesian,
|
|
225
|
+
cartesianWith: () => cartesianWith,
|
|
226
|
+
chop: () => chop,
|
|
227
|
+
chunksOf: () => chunksOf,
|
|
228
|
+
contains: () => contains2,
|
|
229
|
+
containsWith: () => containsWith2,
|
|
230
|
+
copy: () => copy,
|
|
231
|
+
dedupe: () => dedupe,
|
|
232
|
+
dedupeAdjacent: () => dedupeAdjacent,
|
|
233
|
+
dedupeAdjacentWith: () => dedupeAdjacentWith,
|
|
234
|
+
dedupeWith: () => dedupeWith,
|
|
235
|
+
difference: () => difference,
|
|
236
|
+
differenceWith: () => differenceWith,
|
|
237
|
+
drop: () => drop,
|
|
238
|
+
dropRight: () => dropRight,
|
|
239
|
+
dropWhile: () => dropWhile,
|
|
240
|
+
empty: () => empty2,
|
|
241
|
+
every: () => every2,
|
|
242
|
+
extend: () => extend,
|
|
243
|
+
filter: () => filter2,
|
|
244
|
+
filterMap: () => filterMap2,
|
|
245
|
+
filterMapWhile: () => filterMapWhile,
|
|
246
|
+
findFirst: () => findFirst2,
|
|
247
|
+
findFirstIndex: () => findFirstIndex,
|
|
248
|
+
findLast: () => findLast,
|
|
249
|
+
findLastIndex: () => findLastIndex,
|
|
250
|
+
flatMap: () => flatMap2,
|
|
251
|
+
flatMapNullable: () => flatMapNullable2,
|
|
252
|
+
flatten: () => flatten2,
|
|
253
|
+
forEach: () => forEach,
|
|
254
|
+
fromIterable: () => fromIterable2,
|
|
255
|
+
fromNullable: () => fromNullable2,
|
|
256
|
+
fromOption: () => fromOption2,
|
|
257
|
+
fromRecord: () => fromRecord,
|
|
258
|
+
get: () => get,
|
|
259
|
+
getEquivalence: () => getEquivalence2,
|
|
260
|
+
getLefts: () => getLefts,
|
|
261
|
+
getOrder: () => getOrder2,
|
|
262
|
+
getRights: () => getRights,
|
|
263
|
+
getSomes: () => getSomes,
|
|
264
|
+
group: () => group,
|
|
265
|
+
groupBy: () => groupBy,
|
|
266
|
+
groupWith: () => groupWith,
|
|
267
|
+
head: () => head,
|
|
268
|
+
headNonEmpty: () => headNonEmpty,
|
|
269
|
+
init: () => init,
|
|
270
|
+
initNonEmpty: () => initNonEmpty,
|
|
271
|
+
insertAt: () => insertAt,
|
|
272
|
+
intersection: () => intersection,
|
|
273
|
+
intersectionWith: () => intersectionWith,
|
|
274
|
+
intersperse: () => intersperse,
|
|
275
|
+
isArray: () => isArray,
|
|
276
|
+
isEmptyArray: () => isEmptyArray,
|
|
277
|
+
isEmptyReadonlyArray: () => isEmptyReadonlyArray,
|
|
278
|
+
isNonEmptyArray: () => isNonEmptyArray2,
|
|
279
|
+
isNonEmptyReadonlyArray: () => isNonEmptyReadonlyArray,
|
|
280
|
+
join: () => join,
|
|
281
|
+
last: () => last,
|
|
282
|
+
lastNonEmpty: () => lastNonEmpty,
|
|
283
|
+
length: () => length,
|
|
284
|
+
liftEither: () => liftEither,
|
|
285
|
+
liftNullable: () => liftNullable2,
|
|
286
|
+
liftOption: () => liftOption,
|
|
287
|
+
liftPredicate: () => liftPredicate2,
|
|
288
|
+
make: () => make4,
|
|
289
|
+
makeBy: () => makeBy,
|
|
290
|
+
map: () => map2,
|
|
291
|
+
mapAccum: () => mapAccum,
|
|
292
|
+
match: () => match2,
|
|
293
|
+
matchLeft: () => matchLeft,
|
|
294
|
+
matchRight: () => matchRight,
|
|
295
|
+
max: () => max2,
|
|
296
|
+
min: () => min2,
|
|
297
|
+
modify: () => modify,
|
|
298
|
+
modifyNonEmptyHead: () => modifyNonEmptyHead,
|
|
299
|
+
modifyNonEmptyLast: () => modifyNonEmptyLast,
|
|
300
|
+
modifyOption: () => modifyOption,
|
|
301
|
+
of: () => of,
|
|
302
|
+
partition: () => partition,
|
|
303
|
+
partitionMap: () => partitionMap2,
|
|
304
|
+
prepend: () => prepend,
|
|
305
|
+
prependAll: () => prependAll,
|
|
306
|
+
range: () => range,
|
|
307
|
+
reduce: () => reduce,
|
|
308
|
+
reduceRight: () => reduceRight,
|
|
309
|
+
remove: () => remove,
|
|
310
|
+
replace: () => replace,
|
|
311
|
+
replaceOption: () => replaceOption,
|
|
312
|
+
replicate: () => replicate,
|
|
313
|
+
reverse: () => reverse,
|
|
314
|
+
rotate: () => rotate,
|
|
315
|
+
scan: () => scan,
|
|
316
|
+
scanRight: () => scanRight,
|
|
317
|
+
separate: () => separate,
|
|
318
|
+
setNonEmptyHead: () => setNonEmptyHead,
|
|
319
|
+
setNonEmptyLast: () => setNonEmptyLast,
|
|
320
|
+
some: () => some4,
|
|
321
|
+
sort: () => sort,
|
|
322
|
+
sortBy: () => sortBy,
|
|
323
|
+
sortWith: () => sortWith,
|
|
324
|
+
span: () => span,
|
|
325
|
+
split: () => split,
|
|
326
|
+
splitAt: () => splitAt,
|
|
327
|
+
splitNonEmptyAt: () => splitNonEmptyAt,
|
|
328
|
+
splitWhere: () => splitWhere,
|
|
329
|
+
tail: () => tail,
|
|
330
|
+
tailNonEmpty: () => tailNonEmpty,
|
|
331
|
+
take: () => take,
|
|
332
|
+
takeRight: () => takeRight,
|
|
333
|
+
takeWhile: () => takeWhile,
|
|
334
|
+
unappend: () => unappend,
|
|
335
|
+
unfold: () => unfold,
|
|
336
|
+
union: () => union,
|
|
337
|
+
unionWith: () => unionWith,
|
|
338
|
+
unprepend: () => unprepend,
|
|
339
|
+
unsafeGet: () => unsafeGet,
|
|
340
|
+
unzip: () => unzip,
|
|
341
|
+
zip: () => zip,
|
|
342
|
+
zipWith: () => zipWith2
|
|
343
|
+
});
|
|
344
|
+
|
|
195
345
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Equivalence.js
|
|
196
346
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
347
|
+
var array = (item) => make((self, that) => {
|
|
348
|
+
if (self.length !== that.length) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
for (let i2 = 0; i2 < self.length; i2++) {
|
|
352
|
+
const isEq = item(self[i2], that[i2]);
|
|
353
|
+
if (!isEq) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return true;
|
|
358
|
+
});
|
|
197
359
|
|
|
198
360
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/doNotation.js
|
|
199
|
-
var let_ = (
|
|
361
|
+
var let_ = (map3) => dual(3, (self, name, f2) => map3(self, (a2) => Object.assign({}, a2, {
|
|
200
362
|
[name]: f2(a2)
|
|
201
363
|
})));
|
|
202
|
-
var bindTo = (
|
|
364
|
+
var bindTo = (map3) => dual(2, (self, name) => map3(self, (a2) => ({
|
|
203
365
|
[name]: a2
|
|
204
366
|
})));
|
|
205
|
-
var bind = (
|
|
367
|
+
var bind = (map3, flatMap3) => dual(3, (self, name, f2) => flatMap3(self, (a2) => map3(f2(a2), (b2) => Object.assign({}, a2, {
|
|
206
368
|
[name]: b2
|
|
207
369
|
}))));
|
|
208
370
|
|
|
@@ -321,13 +483,13 @@ var all = (collection) => {
|
|
|
321
483
|
};
|
|
322
484
|
var productMany = (self, collection) => {
|
|
323
485
|
const rest = all(collection);
|
|
324
|
-
return ([
|
|
486
|
+
return ([head2, ...tail2]) => self(head2) === false ? false : rest(tail2);
|
|
325
487
|
};
|
|
326
488
|
var tuple = (...elements) => all(elements);
|
|
327
489
|
var struct = (fields) => {
|
|
328
|
-
const
|
|
490
|
+
const keys2 = Object.keys(fields);
|
|
329
491
|
return (a2) => {
|
|
330
|
-
for (const key of
|
|
492
|
+
for (const key of keys2) {
|
|
331
493
|
if (!fields[key](a2[key])) {
|
|
332
494
|
return false;
|
|
333
495
|
}
|
|
@@ -509,19 +671,19 @@ var PCGRandom = class {
|
|
|
509
671
|
* @category getter
|
|
510
672
|
* @since 2.0.0
|
|
511
673
|
*/
|
|
512
|
-
integer(
|
|
513
|
-
if (!
|
|
674
|
+
integer(max3) {
|
|
675
|
+
if (!max3) {
|
|
514
676
|
return this._next();
|
|
515
677
|
}
|
|
516
|
-
|
|
517
|
-
if ((
|
|
518
|
-
return this._next() &
|
|
678
|
+
max3 = max3 >>> 0;
|
|
679
|
+
if ((max3 & max3 - 1) === 0) {
|
|
680
|
+
return this._next() & max3 - 1;
|
|
519
681
|
}
|
|
520
682
|
let num = 0;
|
|
521
|
-
const skew = (-
|
|
683
|
+
const skew = (-max3 >>> 0) % max3 >>> 0;
|
|
522
684
|
for (num = this._next(); num < skew; num = this._next()) {
|
|
523
685
|
}
|
|
524
|
-
return num %
|
|
686
|
+
return num % max3;
|
|
525
687
|
}
|
|
526
688
|
/**
|
|
527
689
|
* Get a uniformly distributed IEEE-754 double between 0.0 and 1.0, with
|
|
@@ -980,6 +1142,13 @@ var right = (right2) => {
|
|
|
980
1142
|
var getLeft = (self) => isRight(self) ? none : some2(self.left);
|
|
981
1143
|
var getRight = (self) => isLeft(self) ? none : some2(self.right);
|
|
982
1144
|
|
|
1145
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Either.js
|
|
1146
|
+
var isLeft2 = isLeft;
|
|
1147
|
+
var isRight2 = isRight;
|
|
1148
|
+
|
|
1149
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/internal/array.js
|
|
1150
|
+
var isNonEmptyArray = (self) => self.length > 0;
|
|
1151
|
+
|
|
983
1152
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
|
|
984
1153
|
var Option_exports = {};
|
|
985
1154
|
__export(Option_exports, {
|
|
@@ -1044,6 +1213,37 @@ __export(Option_exports, {
|
|
|
1044
1213
|
|
|
1045
1214
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Order.js
|
|
1046
1215
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
1216
|
+
var number2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
1217
|
+
var combineMany = /* @__PURE__ */ dual(2, (self, collection) => make2((a1, a2) => {
|
|
1218
|
+
let out = self(a1, a2);
|
|
1219
|
+
if (out !== 0) {
|
|
1220
|
+
return out;
|
|
1221
|
+
}
|
|
1222
|
+
for (const O2 of collection) {
|
|
1223
|
+
out = O2(a1, a2);
|
|
1224
|
+
if (out !== 0) {
|
|
1225
|
+
return out;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return out;
|
|
1229
|
+
}));
|
|
1230
|
+
var empty = () => make2(() => 0);
|
|
1231
|
+
var combineAll = (collection) => combineMany(empty(), collection);
|
|
1232
|
+
var mapInput2 = /* @__PURE__ */ dual(2, (self, f2) => make2((b1, b2) => self(f2(b1), f2(b2))));
|
|
1233
|
+
var array2 = (O2) => make2((self, that) => {
|
|
1234
|
+
const aLen = self.length;
|
|
1235
|
+
const bLen = that.length;
|
|
1236
|
+
const len = Math.min(aLen, bLen);
|
|
1237
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
1238
|
+
const o2 = O2(self[i2], that[i2]);
|
|
1239
|
+
if (o2 !== 0) {
|
|
1240
|
+
return o2;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return number2(aLen, bLen);
|
|
1244
|
+
});
|
|
1245
|
+
var min = (O2) => dual(2, (self, that) => self === that || O2(self, that) < 1 ? self : that);
|
|
1246
|
+
var max = (O2) => dual(2, (self, that) => self === that || O2(self, that) > -1 ? self : that);
|
|
1047
1247
|
|
|
1048
1248
|
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Option.js
|
|
1049
1249
|
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
@@ -1212,32 +1412,598 @@ var gen = (f2) => {
|
|
|
1212
1412
|
return some3(state.value);
|
|
1213
1413
|
}
|
|
1214
1414
|
};
|
|
1415
|
+
|
|
1416
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Tuple.js
|
|
1417
|
+
var make3 = (...elements) => elements;
|
|
1418
|
+
|
|
1419
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Iterable.js
|
|
1420
|
+
var findFirst = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1421
|
+
let i2 = 0;
|
|
1422
|
+
for (const a2 of self) {
|
|
1423
|
+
const o2 = f2(a2, i2);
|
|
1424
|
+
if (isBoolean(o2)) {
|
|
1425
|
+
if (o2) {
|
|
1426
|
+
return some3(a2);
|
|
1427
|
+
}
|
|
1428
|
+
} else {
|
|
1429
|
+
if (isSome2(o2)) {
|
|
1430
|
+
return o2;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
i2++;
|
|
1434
|
+
}
|
|
1435
|
+
return none2();
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Record.js
|
|
1439
|
+
var collect = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1440
|
+
const out = [];
|
|
1441
|
+
for (const key of keys(self)) {
|
|
1442
|
+
out.push(f2(key, self[key]));
|
|
1443
|
+
}
|
|
1444
|
+
return out;
|
|
1445
|
+
});
|
|
1446
|
+
var toEntries = /* @__PURE__ */ collect((key, value) => [key, value]);
|
|
1447
|
+
var keys = (self) => Object.keys(self);
|
|
1448
|
+
|
|
1449
|
+
// ../../../node_modules/.pnpm/effect@3.1.2/node_modules/effect/dist/esm/Array.js
|
|
1450
|
+
var make4 = (...elements) => elements;
|
|
1451
|
+
var allocate = (n2) => new Array(n2);
|
|
1452
|
+
var makeBy = (n2, f2) => {
|
|
1453
|
+
const max3 = Math.max(1, Math.floor(n2));
|
|
1454
|
+
const out = new Array(max3);
|
|
1455
|
+
for (let i2 = 0; i2 < max3; i2++) {
|
|
1456
|
+
out[i2] = f2(i2);
|
|
1457
|
+
}
|
|
1458
|
+
return out;
|
|
1459
|
+
};
|
|
1460
|
+
var range = (start, end) => start <= end ? makeBy(end - start + 1, (i2) => start + i2) : [start];
|
|
1461
|
+
var replicate = /* @__PURE__ */ dual(2, (a2, n2) => makeBy(n2, () => a2));
|
|
1462
|
+
var fromIterable2 = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
1463
|
+
var fromRecord = toEntries;
|
|
1464
|
+
var fromOption2 = toArray;
|
|
1465
|
+
var match2 = /* @__PURE__ */ dual(2, (self, {
|
|
1466
|
+
onEmpty,
|
|
1467
|
+
onNonEmpty
|
|
1468
|
+
}) => isNonEmptyReadonlyArray(self) ? onNonEmpty(self) : onEmpty());
|
|
1469
|
+
var matchLeft = /* @__PURE__ */ dual(2, (self, {
|
|
1470
|
+
onEmpty,
|
|
1471
|
+
onNonEmpty
|
|
1472
|
+
}) => isNonEmptyReadonlyArray(self) ? onNonEmpty(headNonEmpty(self), tailNonEmpty(self)) : onEmpty());
|
|
1473
|
+
var matchRight = /* @__PURE__ */ dual(2, (self, {
|
|
1474
|
+
onEmpty,
|
|
1475
|
+
onNonEmpty
|
|
1476
|
+
}) => isNonEmptyReadonlyArray(self) ? onNonEmpty(initNonEmpty(self), lastNonEmpty(self)) : onEmpty());
|
|
1477
|
+
var prepend = /* @__PURE__ */ dual(2, (self, head2) => [head2, ...self]);
|
|
1478
|
+
var prependAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable2(that).concat(fromIterable2(self)));
|
|
1479
|
+
var append = /* @__PURE__ */ dual(2, (self, last2) => [...self, last2]);
|
|
1480
|
+
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable2(self).concat(fromIterable2(that)));
|
|
1481
|
+
var scan = /* @__PURE__ */ dual(3, (self, b2, f2) => {
|
|
1482
|
+
const out = [b2];
|
|
1483
|
+
let i2 = 0;
|
|
1484
|
+
for (const a2 of self) {
|
|
1485
|
+
out[i2 + 1] = f2(out[i2], a2);
|
|
1486
|
+
i2++;
|
|
1487
|
+
}
|
|
1488
|
+
return out;
|
|
1489
|
+
});
|
|
1490
|
+
var scanRight = /* @__PURE__ */ dual(3, (self, b2, f2) => {
|
|
1491
|
+
const input = fromIterable2(self);
|
|
1492
|
+
const out = new Array(input.length + 1);
|
|
1493
|
+
out[input.length] = b2;
|
|
1494
|
+
for (let i2 = input.length - 1; i2 >= 0; i2--) {
|
|
1495
|
+
out[i2] = f2(out[i2 + 1], input[i2]);
|
|
1496
|
+
}
|
|
1497
|
+
return out;
|
|
1498
|
+
});
|
|
1499
|
+
var isArray = Array.isArray;
|
|
1500
|
+
var isEmptyArray = (self) => self.length === 0;
|
|
1501
|
+
var isEmptyReadonlyArray = isEmptyArray;
|
|
1502
|
+
var isNonEmptyArray2 = isNonEmptyArray;
|
|
1503
|
+
var isNonEmptyReadonlyArray = isNonEmptyArray;
|
|
1504
|
+
var length = (self) => self.length;
|
|
1505
|
+
var isOutOfBound = (i2, as2) => i2 < 0 || i2 >= as2.length;
|
|
1506
|
+
var clamp = (i2, as2) => Math.floor(Math.min(Math.max(0, i2), as2.length));
|
|
1507
|
+
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
1508
|
+
const i2 = Math.floor(index);
|
|
1509
|
+
return isOutOfBound(i2, self) ? none2() : some3(self[i2]);
|
|
1510
|
+
});
|
|
1511
|
+
var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
1512
|
+
const i2 = Math.floor(index);
|
|
1513
|
+
if (isOutOfBound(i2, self)) {
|
|
1514
|
+
throw new Error(`Index ${i2} out of bounds`);
|
|
1515
|
+
}
|
|
1516
|
+
return self[i2];
|
|
1517
|
+
});
|
|
1518
|
+
var unprepend = (self) => [headNonEmpty(self), tailNonEmpty(self)];
|
|
1519
|
+
var unappend = (self) => [initNonEmpty(self), lastNonEmpty(self)];
|
|
1520
|
+
var head = /* @__PURE__ */ get(0);
|
|
1521
|
+
var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
|
|
1522
|
+
var last = (self) => isNonEmptyReadonlyArray(self) ? some3(lastNonEmpty(self)) : none2();
|
|
1523
|
+
var lastNonEmpty = (self) => self[self.length - 1];
|
|
1524
|
+
var tail = (self) => {
|
|
1525
|
+
const input = fromIterable2(self);
|
|
1526
|
+
return isNonEmptyReadonlyArray(input) ? some3(tailNonEmpty(input)) : none2();
|
|
1527
|
+
};
|
|
1528
|
+
var tailNonEmpty = (self) => self.slice(1);
|
|
1529
|
+
var init = (self) => {
|
|
1530
|
+
const input = fromIterable2(self);
|
|
1531
|
+
return isNonEmptyReadonlyArray(input) ? some3(initNonEmpty(input)) : none2();
|
|
1532
|
+
};
|
|
1533
|
+
var initNonEmpty = (self) => self.slice(0, -1);
|
|
1534
|
+
var take = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1535
|
+
const input = fromIterable2(self);
|
|
1536
|
+
return input.slice(0, clamp(n2, input));
|
|
1537
|
+
});
|
|
1538
|
+
var takeRight = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1539
|
+
const input = fromIterable2(self);
|
|
1540
|
+
const i2 = clamp(n2, input);
|
|
1541
|
+
return i2 === 0 ? [] : input.slice(-i2);
|
|
1542
|
+
});
|
|
1543
|
+
var takeWhile = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1544
|
+
let i2 = 0;
|
|
1545
|
+
const out = [];
|
|
1546
|
+
for (const a2 of self) {
|
|
1547
|
+
if (!predicate(a2, i2)) {
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
out.push(a2);
|
|
1551
|
+
i2++;
|
|
1552
|
+
}
|
|
1553
|
+
return out;
|
|
1554
|
+
});
|
|
1555
|
+
var spanIndex = (self, predicate) => {
|
|
1556
|
+
let i2 = 0;
|
|
1557
|
+
for (const a2 of self) {
|
|
1558
|
+
if (!predicate(a2, i2)) {
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1561
|
+
i2++;
|
|
1562
|
+
}
|
|
1563
|
+
return i2;
|
|
1564
|
+
};
|
|
1565
|
+
var span = /* @__PURE__ */ dual(2, (self, predicate) => splitAt(self, spanIndex(self, predicate)));
|
|
1566
|
+
var drop = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1567
|
+
const input = fromIterable2(self);
|
|
1568
|
+
return input.slice(clamp(n2, input), input.length);
|
|
1569
|
+
});
|
|
1570
|
+
var dropRight = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1571
|
+
const input = fromIterable2(self);
|
|
1572
|
+
return input.slice(0, input.length - clamp(n2, input));
|
|
1573
|
+
});
|
|
1574
|
+
var dropWhile = /* @__PURE__ */ dual(2, (self, predicate) => fromIterable2(self).slice(spanIndex(self, predicate)));
|
|
1575
|
+
var findFirstIndex = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1576
|
+
let i2 = 0;
|
|
1577
|
+
for (const a2 of self) {
|
|
1578
|
+
if (predicate(a2, i2)) {
|
|
1579
|
+
return some3(i2);
|
|
1580
|
+
}
|
|
1581
|
+
i2++;
|
|
1582
|
+
}
|
|
1583
|
+
return none2();
|
|
1584
|
+
});
|
|
1585
|
+
var findLastIndex = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1586
|
+
const input = fromIterable2(self);
|
|
1587
|
+
for (let i2 = input.length - 1; i2 >= 0; i2--) {
|
|
1588
|
+
if (predicate(input[i2], i2)) {
|
|
1589
|
+
return some3(i2);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
return none2();
|
|
1593
|
+
});
|
|
1594
|
+
var findFirst2 = findFirst;
|
|
1595
|
+
var findLast = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1596
|
+
const input = fromIterable2(self);
|
|
1597
|
+
for (let i2 = input.length - 1; i2 >= 0; i2--) {
|
|
1598
|
+
const a2 = input[i2];
|
|
1599
|
+
const o2 = f2(a2, i2);
|
|
1600
|
+
if (isBoolean(o2)) {
|
|
1601
|
+
if (o2) {
|
|
1602
|
+
return some3(a2);
|
|
1603
|
+
}
|
|
1604
|
+
} else {
|
|
1605
|
+
if (isSome2(o2)) {
|
|
1606
|
+
return o2;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
return none2();
|
|
1611
|
+
});
|
|
1612
|
+
var insertAt = /* @__PURE__ */ dual(3, (self, i2, b2) => {
|
|
1613
|
+
const out = Array.from(self);
|
|
1614
|
+
if (i2 < 0 || i2 > out.length) {
|
|
1615
|
+
return none2();
|
|
1616
|
+
}
|
|
1617
|
+
out.splice(i2, 0, b2);
|
|
1618
|
+
return some3(out);
|
|
1619
|
+
});
|
|
1620
|
+
var replace = /* @__PURE__ */ dual(3, (self, i2, b2) => modify(self, i2, () => b2));
|
|
1621
|
+
var replaceOption = /* @__PURE__ */ dual(3, (self, i2, b2) => modifyOption(self, i2, () => b2));
|
|
1622
|
+
var modify = /* @__PURE__ */ dual(3, (self, i2, f2) => getOrElse(modifyOption(self, i2, f2), () => Array.from(self)));
|
|
1623
|
+
var modifyOption = /* @__PURE__ */ dual(3, (self, i2, f2) => {
|
|
1624
|
+
const out = Array.from(self);
|
|
1625
|
+
if (isOutOfBound(i2, out)) {
|
|
1626
|
+
return none2();
|
|
1627
|
+
}
|
|
1628
|
+
const next = f2(out[i2]);
|
|
1629
|
+
out[i2] = next;
|
|
1630
|
+
return some3(out);
|
|
1631
|
+
});
|
|
1632
|
+
var remove = /* @__PURE__ */ dual(2, (self, i2) => {
|
|
1633
|
+
const out = Array.from(self);
|
|
1634
|
+
if (isOutOfBound(i2, out)) {
|
|
1635
|
+
return out;
|
|
1636
|
+
}
|
|
1637
|
+
out.splice(i2, 1);
|
|
1638
|
+
return out;
|
|
1639
|
+
});
|
|
1640
|
+
var reverse = (self) => Array.from(self).reverse();
|
|
1641
|
+
var sort = /* @__PURE__ */ dual(2, (self, O2) => {
|
|
1642
|
+
const out = Array.from(self);
|
|
1643
|
+
out.sort(O2);
|
|
1644
|
+
return out;
|
|
1645
|
+
});
|
|
1646
|
+
var sortWith = /* @__PURE__ */ dual(3, (self, f2, order) => sort(self, mapInput2(order, f2)));
|
|
1647
|
+
var sortBy = (...orders) => {
|
|
1648
|
+
const sortByAll = sort(combineAll(orders));
|
|
1649
|
+
return (self) => {
|
|
1650
|
+
const input = fromIterable2(self);
|
|
1651
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1652
|
+
return sortByAll(input);
|
|
1653
|
+
}
|
|
1654
|
+
return [];
|
|
1655
|
+
};
|
|
1656
|
+
};
|
|
1657
|
+
var zip = /* @__PURE__ */ dual(2, (self, that) => zipWith2(self, that, make3));
|
|
1658
|
+
var zipWith2 = /* @__PURE__ */ dual(3, (self, that, f2) => {
|
|
1659
|
+
const as2 = fromIterable2(self);
|
|
1660
|
+
const bs = fromIterable2(that);
|
|
1661
|
+
if (isNonEmptyReadonlyArray(as2) && isNonEmptyReadonlyArray(bs)) {
|
|
1662
|
+
const out = [f2(headNonEmpty(as2), headNonEmpty(bs))];
|
|
1663
|
+
const len = Math.min(as2.length, bs.length);
|
|
1664
|
+
for (let i2 = 1; i2 < len; i2++) {
|
|
1665
|
+
out[i2] = f2(as2[i2], bs[i2]);
|
|
1666
|
+
}
|
|
1667
|
+
return out;
|
|
1668
|
+
}
|
|
1669
|
+
return [];
|
|
1670
|
+
});
|
|
1671
|
+
var unzip = (self) => {
|
|
1672
|
+
const input = fromIterable2(self);
|
|
1673
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1674
|
+
const fa = [input[0][0]];
|
|
1675
|
+
const fb = [input[0][1]];
|
|
1676
|
+
for (let i2 = 1; i2 < input.length; i2++) {
|
|
1677
|
+
fa[i2] = input[i2][0];
|
|
1678
|
+
fb[i2] = input[i2][1];
|
|
1679
|
+
}
|
|
1680
|
+
return [fa, fb];
|
|
1681
|
+
}
|
|
1682
|
+
return [[], []];
|
|
1683
|
+
};
|
|
1684
|
+
var intersperse = /* @__PURE__ */ dual(2, (self, middle) => {
|
|
1685
|
+
const input = fromIterable2(self);
|
|
1686
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1687
|
+
const out = [headNonEmpty(input)];
|
|
1688
|
+
const tail2 = tailNonEmpty(input);
|
|
1689
|
+
for (let i2 = 0; i2 < tail2.length; i2++) {
|
|
1690
|
+
if (i2 < tail2.length) {
|
|
1691
|
+
out.push(middle);
|
|
1692
|
+
}
|
|
1693
|
+
out.push(tail2[i2]);
|
|
1694
|
+
}
|
|
1695
|
+
return out;
|
|
1696
|
+
}
|
|
1697
|
+
return [];
|
|
1698
|
+
});
|
|
1699
|
+
var modifyNonEmptyHead = /* @__PURE__ */ dual(2, (self, f2) => [f2(headNonEmpty(self)), ...tailNonEmpty(self)]);
|
|
1700
|
+
var setNonEmptyHead = /* @__PURE__ */ dual(2, (self, b2) => modifyNonEmptyHead(self, () => b2));
|
|
1701
|
+
var modifyNonEmptyLast = /* @__PURE__ */ dual(2, (self, f2) => append(initNonEmpty(self), f2(lastNonEmpty(self))));
|
|
1702
|
+
var setNonEmptyLast = /* @__PURE__ */ dual(2, (self, b2) => modifyNonEmptyLast(self, () => b2));
|
|
1703
|
+
var rotate = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1704
|
+
const input = fromIterable2(self);
|
|
1705
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1706
|
+
const len = input.length;
|
|
1707
|
+
const m2 = Math.round(n2) % len;
|
|
1708
|
+
if (isOutOfBound(Math.abs(m2), input) || m2 === 0) {
|
|
1709
|
+
return copy(input);
|
|
1710
|
+
}
|
|
1711
|
+
if (m2 < 0) {
|
|
1712
|
+
const [f2, s2] = splitNonEmptyAt(input, -m2);
|
|
1713
|
+
return appendAll(s2, f2);
|
|
1714
|
+
} else {
|
|
1715
|
+
return rotate(self, m2 - len);
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return [];
|
|
1719
|
+
});
|
|
1720
|
+
var containsWith2 = (isEquivalent) => dual(2, (self, a2) => {
|
|
1721
|
+
for (const i2 of self) {
|
|
1722
|
+
if (isEquivalent(a2, i2)) {
|
|
1723
|
+
return true;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
return false;
|
|
1727
|
+
});
|
|
1728
|
+
var _equivalence2 = /* @__PURE__ */ equivalence();
|
|
1729
|
+
var contains2 = /* @__PURE__ */ containsWith2(_equivalence2);
|
|
1730
|
+
var chop = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1731
|
+
const input = fromIterable2(self);
|
|
1732
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1733
|
+
const [b2, rest] = f2(input);
|
|
1734
|
+
const out = [b2];
|
|
1735
|
+
let next = rest;
|
|
1736
|
+
while (isNonEmptyArray(next)) {
|
|
1737
|
+
const [b3, rest2] = f2(next);
|
|
1738
|
+
out.push(b3);
|
|
1739
|
+
next = rest2;
|
|
1740
|
+
}
|
|
1741
|
+
return out;
|
|
1742
|
+
}
|
|
1743
|
+
return [];
|
|
1744
|
+
});
|
|
1745
|
+
var splitAt = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1746
|
+
const input = Array.from(self);
|
|
1747
|
+
const _n = Math.floor(n2);
|
|
1748
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1749
|
+
if (_n >= 1) {
|
|
1750
|
+
return splitNonEmptyAt(input, _n);
|
|
1751
|
+
}
|
|
1752
|
+
return [[], input];
|
|
1753
|
+
}
|
|
1754
|
+
return [input, []];
|
|
1755
|
+
});
|
|
1756
|
+
var splitNonEmptyAt = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1757
|
+
const _n = Math.max(1, Math.floor(n2));
|
|
1758
|
+
return _n >= self.length ? [copy(self), []] : [prepend(self.slice(1, _n), headNonEmpty(self)), self.slice(_n)];
|
|
1759
|
+
});
|
|
1760
|
+
var split = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1761
|
+
const input = fromIterable2(self);
|
|
1762
|
+
return chunksOf(input, Math.ceil(input.length / Math.floor(n2)));
|
|
1763
|
+
});
|
|
1764
|
+
var splitWhere = /* @__PURE__ */ dual(2, (self, predicate) => span(self, (a2, i2) => !predicate(a2, i2)));
|
|
1765
|
+
var copy = (self) => self.slice();
|
|
1766
|
+
var chunksOf = /* @__PURE__ */ dual(2, (self, n2) => {
|
|
1767
|
+
const input = fromIterable2(self);
|
|
1768
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1769
|
+
return chop(input, splitNonEmptyAt(n2));
|
|
1770
|
+
}
|
|
1771
|
+
return [];
|
|
1772
|
+
});
|
|
1773
|
+
var groupWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => chop(self, (as2) => {
|
|
1774
|
+
const h2 = headNonEmpty(as2);
|
|
1775
|
+
const out = [h2];
|
|
1776
|
+
let i2 = 1;
|
|
1777
|
+
for (; i2 < as2.length; i2++) {
|
|
1778
|
+
const a2 = as2[i2];
|
|
1779
|
+
if (isEquivalent(a2, h2)) {
|
|
1780
|
+
out.push(a2);
|
|
1781
|
+
} else {
|
|
1782
|
+
break;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
return [out, as2.slice(i2)];
|
|
1786
|
+
}));
|
|
1787
|
+
var group = /* @__PURE__ */ groupWith(/* @__PURE__ */ equivalence());
|
|
1788
|
+
var groupBy = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1789
|
+
const out = {};
|
|
1790
|
+
for (const a2 of self) {
|
|
1791
|
+
const k2 = f2(a2);
|
|
1792
|
+
if (Object.prototype.hasOwnProperty.call(out, k2)) {
|
|
1793
|
+
out[k2].push(a2);
|
|
1794
|
+
} else {
|
|
1795
|
+
out[k2] = [a2];
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
return out;
|
|
1799
|
+
});
|
|
1800
|
+
var unionWith = /* @__PURE__ */ dual(3, (self, that, isEquivalent) => {
|
|
1801
|
+
const a2 = fromIterable2(self);
|
|
1802
|
+
const b2 = fromIterable2(that);
|
|
1803
|
+
if (isNonEmptyReadonlyArray(a2)) {
|
|
1804
|
+
if (isNonEmptyReadonlyArray(b2)) {
|
|
1805
|
+
const dedupe2 = dedupeWith(isEquivalent);
|
|
1806
|
+
return dedupe2(appendAll(a2, b2));
|
|
1807
|
+
}
|
|
1808
|
+
return a2;
|
|
1809
|
+
}
|
|
1810
|
+
return b2;
|
|
1811
|
+
});
|
|
1812
|
+
var union = /* @__PURE__ */ dual(2, (self, that) => unionWith(self, that, _equivalence2));
|
|
1813
|
+
var intersectionWith = (isEquivalent) => {
|
|
1814
|
+
const has = containsWith2(isEquivalent);
|
|
1815
|
+
return dual(2, (self, that) => fromIterable2(self).filter((a2) => has(that, a2)));
|
|
1816
|
+
};
|
|
1817
|
+
var intersection = /* @__PURE__ */ intersectionWith(_equivalence2);
|
|
1818
|
+
var differenceWith = (isEquivalent) => {
|
|
1819
|
+
const has = containsWith2(isEquivalent);
|
|
1820
|
+
return dual(2, (self, that) => fromIterable2(self).filter((a2) => !has(that, a2)));
|
|
1821
|
+
};
|
|
1822
|
+
var difference = /* @__PURE__ */ differenceWith(_equivalence2);
|
|
1823
|
+
var empty2 = () => [];
|
|
1824
|
+
var of = (a2) => [a2];
|
|
1825
|
+
var map2 = /* @__PURE__ */ dual(2, (self, f2) => self.map(f2));
|
|
1826
|
+
var flatMap2 = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1827
|
+
if (isEmptyReadonlyArray(self)) {
|
|
1828
|
+
return [];
|
|
1829
|
+
}
|
|
1830
|
+
const out = [];
|
|
1831
|
+
for (let i2 = 0; i2 < self.length; i2++) {
|
|
1832
|
+
const inner = f2(self[i2], i2);
|
|
1833
|
+
for (let j2 = 0; j2 < inner.length; j2++) {
|
|
1834
|
+
out.push(inner[j2]);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
return out;
|
|
1838
|
+
});
|
|
1839
|
+
var flatten2 = /* @__PURE__ */ flatMap2(identity);
|
|
1840
|
+
var filterMap2 = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1841
|
+
const as2 = fromIterable2(self);
|
|
1842
|
+
const out = [];
|
|
1843
|
+
for (let i2 = 0; i2 < as2.length; i2++) {
|
|
1844
|
+
const o2 = f2(as2[i2], i2);
|
|
1845
|
+
if (isSome2(o2)) {
|
|
1846
|
+
out.push(o2.value);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
return out;
|
|
1850
|
+
});
|
|
1851
|
+
var filterMapWhile = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1852
|
+
let i2 = 0;
|
|
1853
|
+
const out = [];
|
|
1854
|
+
for (const a2 of self) {
|
|
1855
|
+
const b2 = f2(a2, i2);
|
|
1856
|
+
if (isSome2(b2)) {
|
|
1857
|
+
out.push(b2.value);
|
|
1858
|
+
} else {
|
|
1859
|
+
break;
|
|
1860
|
+
}
|
|
1861
|
+
i2++;
|
|
1862
|
+
}
|
|
1863
|
+
return out;
|
|
1864
|
+
});
|
|
1865
|
+
var partitionMap2 = /* @__PURE__ */ dual(2, (self, f2) => {
|
|
1866
|
+
const left2 = [];
|
|
1867
|
+
const right2 = [];
|
|
1868
|
+
const as2 = fromIterable2(self);
|
|
1869
|
+
for (let i2 = 0; i2 < as2.length; i2++) {
|
|
1870
|
+
const e2 = f2(as2[i2], i2);
|
|
1871
|
+
if (isLeft2(e2)) {
|
|
1872
|
+
left2.push(e2.left);
|
|
1873
|
+
} else {
|
|
1874
|
+
right2.push(e2.right);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
return [left2, right2];
|
|
1878
|
+
});
|
|
1879
|
+
var getSomes = /* @__PURE__ */ filterMap2(identity);
|
|
1880
|
+
var getLefts = (self) => {
|
|
1881
|
+
const out = [];
|
|
1882
|
+
for (const a2 of self) {
|
|
1883
|
+
if (isLeft2(a2)) {
|
|
1884
|
+
out.push(a2.left);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
return out;
|
|
1888
|
+
};
|
|
1889
|
+
var getRights = (self) => {
|
|
1890
|
+
const out = [];
|
|
1891
|
+
for (const a2 of self) {
|
|
1892
|
+
if (isRight2(a2)) {
|
|
1893
|
+
out.push(a2.right);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
return out;
|
|
1897
|
+
};
|
|
1898
|
+
var filter2 = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1899
|
+
const as2 = fromIterable2(self);
|
|
1900
|
+
const out = [];
|
|
1901
|
+
for (let i2 = 0; i2 < as2.length; i2++) {
|
|
1902
|
+
if (predicate(as2[i2], i2)) {
|
|
1903
|
+
out.push(as2[i2]);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
return out;
|
|
1907
|
+
});
|
|
1908
|
+
var partition = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
1909
|
+
const left2 = [];
|
|
1910
|
+
const right2 = [];
|
|
1911
|
+
const as2 = fromIterable2(self);
|
|
1912
|
+
for (let i2 = 0; i2 < as2.length; i2++) {
|
|
1913
|
+
if (predicate(as2[i2], i2)) {
|
|
1914
|
+
right2.push(as2[i2]);
|
|
1915
|
+
} else {
|
|
1916
|
+
left2.push(as2[i2]);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
return [left2, right2];
|
|
1920
|
+
});
|
|
1921
|
+
var separate = /* @__PURE__ */ partitionMap2(identity);
|
|
1922
|
+
var reduce = /* @__PURE__ */ dual(3, (self, b2, f2) => fromIterable2(self).reduce((b3, a2, i2) => f2(b3, a2, i2), b2));
|
|
1923
|
+
var reduceRight = /* @__PURE__ */ dual(3, (self, b2, f2) => fromIterable2(self).reduceRight((b3, a2, i2) => f2(b3, a2, i2), b2));
|
|
1924
|
+
var liftPredicate2 = (predicate) => (b2) => predicate(b2) ? [b2] : [];
|
|
1925
|
+
var liftOption = (f2) => (...a2) => fromOption2(f2(...a2));
|
|
1926
|
+
var fromNullable2 = (a2) => a2 == null ? empty2() : [a2];
|
|
1927
|
+
var liftNullable2 = (f2) => (...a2) => fromNullable2(f2(...a2));
|
|
1928
|
+
var flatMapNullable2 = /* @__PURE__ */ dual(2, (self, f2) => isNonEmptyReadonlyArray(self) ? fromNullable2(f2(headNonEmpty(self))) : empty2());
|
|
1929
|
+
var liftEither = (f2) => (...a2) => {
|
|
1930
|
+
const e2 = f2(...a2);
|
|
1931
|
+
return isLeft2(e2) ? [] : [e2.right];
|
|
1932
|
+
};
|
|
1933
|
+
var every2 = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
|
|
1934
|
+
var some4 = /* @__PURE__ */ dual(2, (self, predicate) => self.some(predicate));
|
|
1935
|
+
var extend = /* @__PURE__ */ dual(2, (self, f2) => self.map((_2, i2, as2) => f2(as2.slice(i2))));
|
|
1936
|
+
var min2 = /* @__PURE__ */ dual(2, (self, O2) => self.reduce(min(O2)));
|
|
1937
|
+
var max2 = /* @__PURE__ */ dual(2, (self, O2) => self.reduce(max(O2)));
|
|
1938
|
+
var unfold = (b2, f2) => {
|
|
1939
|
+
const out = [];
|
|
1940
|
+
let next = b2;
|
|
1941
|
+
let o2;
|
|
1942
|
+
while (isSome2(o2 = f2(next))) {
|
|
1943
|
+
const [a2, b3] = o2.value;
|
|
1944
|
+
out.push(a2);
|
|
1945
|
+
next = b3;
|
|
1946
|
+
}
|
|
1947
|
+
return out;
|
|
1948
|
+
};
|
|
1949
|
+
var getOrder2 = array2;
|
|
1950
|
+
var getEquivalence2 = array;
|
|
1951
|
+
var forEach = /* @__PURE__ */ dual(2, (self, f2) => fromIterable2(self).forEach((a2, i2) => f2(a2, i2)));
|
|
1952
|
+
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
1953
|
+
const input = fromIterable2(self);
|
|
1954
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
1955
|
+
const out = [headNonEmpty(input)];
|
|
1956
|
+
const rest = tailNonEmpty(input);
|
|
1957
|
+
for (const r2 of rest) {
|
|
1958
|
+
if (out.every((a2) => !isEquivalent(r2, a2))) {
|
|
1959
|
+
out.push(r2);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
return out;
|
|
1963
|
+
}
|
|
1964
|
+
return [];
|
|
1965
|
+
});
|
|
1966
|
+
var dedupe = (self) => dedupeWith(self, equivalence());
|
|
1967
|
+
var dedupeAdjacentWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
1968
|
+
const out = [];
|
|
1969
|
+
let lastA = none2();
|
|
1970
|
+
for (const a2 of self) {
|
|
1971
|
+
if (isNone2(lastA) || !isEquivalent(a2, lastA.value)) {
|
|
1972
|
+
out.push(a2);
|
|
1973
|
+
lastA = some3(a2);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
return out;
|
|
1977
|
+
});
|
|
1978
|
+
var dedupeAdjacent = /* @__PURE__ */ dedupeAdjacentWith(/* @__PURE__ */ equivalence());
|
|
1979
|
+
var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable2(self).join(sep));
|
|
1980
|
+
var mapAccum = /* @__PURE__ */ dual(3, (self, s2, f2) => {
|
|
1981
|
+
let i2 = 0;
|
|
1982
|
+
let s1 = s2;
|
|
1983
|
+
const out = [];
|
|
1984
|
+
for (const a2 of self) {
|
|
1985
|
+
const r2 = f2(s1, a2, i2);
|
|
1986
|
+
s1 = r2[0];
|
|
1987
|
+
out.push(r2[1]);
|
|
1988
|
+
i2++;
|
|
1989
|
+
}
|
|
1990
|
+
return [s1, out];
|
|
1991
|
+
});
|
|
1992
|
+
var cartesianWith = /* @__PURE__ */ dual(3, (self, that, f2) => flatMap2(self, (a2) => map2(that, (b2) => f2(a2, b2))));
|
|
1993
|
+
var cartesian = /* @__PURE__ */ dual(2, (self, that) => cartesianWith(self, that, (a2, b2) => [a2, b2]));
|
|
1994
|
+
|
|
1995
|
+
// src/pragma.ts
|
|
1215
1996
|
var RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
|
|
1216
1997
|
var RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
|
|
1217
|
-
function
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1998
|
+
function getJSXPragmaFromContext(context) {
|
|
1999
|
+
const { sourceCode } = context;
|
|
2000
|
+
return Function_exports.pipe(
|
|
2001
|
+
Array_exports.findFirst(sourceCode.getAllComments(), (node) => RE_JSX_ANNOTATION_REGEX.test(node.value)),
|
|
2002
|
+
Option_exports.map(({ value }) => RE_JSX_ANNOTATION_REGEX.exec(value)),
|
|
2003
|
+
Option_exports.flatMapNullable((matches) => matches?.[1]),
|
|
2004
|
+
Option_exports.filter((pragma) => RE_JS_IDENTIFIER_REGEX.test(pragma))
|
|
2005
|
+
);
|
|
1223
2006
|
}
|
|
1224
|
-
var getPragmaFromContext = memo__default.default(
|
|
1225
|
-
(context) => {
|
|
1226
|
-
const settings = shared.parseSchema(shared.ESLintSettingsSchema, context.settings);
|
|
1227
|
-
const pragma = settings.reactOptions?.jsxPragma;
|
|
1228
|
-
const { sourceCode } = context;
|
|
1229
|
-
const pragmaNode = sourceCode.getAllComments().find((node) => RE_JSX_ANNOTATION_REGEX.test(node.value));
|
|
1230
|
-
return Function_exports.pipe(
|
|
1231
|
-
Option_exports.orElse(Option_exports.fromNullable(pragma), () => Function_exports.pipe(
|
|
1232
|
-
Option_exports.fromNullable(pragmaNode),
|
|
1233
|
-
Option_exports.map(({ value }) => RE_JSX_ANNOTATION_REGEX.exec(value)),
|
|
1234
|
-
Option_exports.flatMapNullable((matches) => matches?.[1]?.split(".")[0])
|
|
1235
|
-
)),
|
|
1236
|
-
Option_exports.flatMap(Option_exports.liftPredicate((x2) => RE_JS_IDENTIFIER_REGEX.test(x2))),
|
|
1237
|
-
Option_exports.getOrElse(Function_exports.constant("React"))
|
|
1238
|
-
);
|
|
1239
|
-
}
|
|
1240
|
-
);
|
|
1241
2007
|
|
|
1242
2008
|
// ../../../node_modules/.pnpm/ts-pattern@5.1.1/node_modules/ts-pattern/dist/index.js
|
|
1243
2009
|
var t = Symbol.for("@ts-pattern/matcher");
|
|
@@ -1514,249 +2280,7 @@ var z = class _z {
|
|
|
1514
2280
|
}
|
|
1515
2281
|
};
|
|
1516
2282
|
|
|
1517
|
-
// src/
|
|
1518
|
-
function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
|
|
1519
|
-
const maybeVariable = _var.findVariable(variableName, initialScope);
|
|
1520
|
-
const maybeLatestDef = Option_exports.flatMapNullable(maybeVariable, (variable) => variable.defs.at(-1));
|
|
1521
|
-
if (Option_exports.isNone(maybeLatestDef))
|
|
1522
|
-
return false;
|
|
1523
|
-
const latestDef = maybeLatestDef.value;
|
|
1524
|
-
const { node, parent } = latestDef;
|
|
1525
|
-
if (node.type === ast.NodeType.VariableDeclarator && node.init) {
|
|
1526
|
-
const { init } = node;
|
|
1527
|
-
if (a({ type: "MemberExpression", object: { type: "Identifier", name: pragma } }, init))
|
|
1528
|
-
return true;
|
|
1529
|
-
if (a({ type: "Identifier", name: pragma }, init))
|
|
1530
|
-
return true;
|
|
1531
|
-
const maybeRequireExpression = $(init).with({
|
|
1532
|
-
type: ast.NodeType.CallExpression,
|
|
1533
|
-
callee: { type: ast.NodeType.Identifier, name: "require" }
|
|
1534
|
-
}, (exp) => Option_exports.some(exp)).with(
|
|
1535
|
-
{
|
|
1536
|
-
type: ast.NodeType.MemberExpression,
|
|
1537
|
-
object: {
|
|
1538
|
-
type: ast.NodeType.CallExpression,
|
|
1539
|
-
callee: { type: ast.NodeType.Identifier, name: "require" }
|
|
1540
|
-
}
|
|
1541
|
-
},
|
|
1542
|
-
({ object }) => Option_exports.some(object)
|
|
1543
|
-
).otherwise(Option_exports.none);
|
|
1544
|
-
if (Option_exports.isNone(maybeRequireExpression))
|
|
1545
|
-
return false;
|
|
1546
|
-
const requireExpression = maybeRequireExpression.value;
|
|
1547
|
-
const [firstArg] = requireExpression.arguments;
|
|
1548
|
-
if (firstArg?.type !== ast.NodeType.Literal)
|
|
1549
|
-
return false;
|
|
1550
|
-
return firstArg.value === pragma.toLowerCase();
|
|
1551
|
-
}
|
|
1552
|
-
return a({ type: "ImportDeclaration", source: { value: pragma.toLowerCase() } }, parent);
|
|
1553
|
-
}
|
|
1554
|
-
function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context)) {
|
|
1555
|
-
const isMatch = a({
|
|
1556
|
-
type: ast.NodeType.MemberExpression,
|
|
1557
|
-
object: {
|
|
1558
|
-
type: ast.NodeType.Identifier,
|
|
1559
|
-
name: pragma
|
|
1560
|
-
},
|
|
1561
|
-
property: {
|
|
1562
|
-
name
|
|
1563
|
-
}
|
|
1564
|
-
});
|
|
1565
|
-
return isMatch;
|
|
1566
|
-
}
|
|
1567
|
-
function isFromPragma(name) {
|
|
1568
|
-
return (node, context) => {
|
|
1569
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
1570
|
-
if (node.type === ast.NodeType.MemberExpression)
|
|
1571
|
-
return isPropertyOfPragma(name, context)(node);
|
|
1572
|
-
if (node.name === name)
|
|
1573
|
-
return isInitializedFromPragma(name, context, initialScope);
|
|
1574
|
-
return false;
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
function isFromPragmaMember(pragmaMemberName, name) {
|
|
1578
|
-
return (node, context, pragma = getPragmaFromContext(context)) => {
|
|
1579
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
1580
|
-
if (node.property.type !== ast.NodeType.Identifier || node.property.name !== name)
|
|
1581
|
-
return false;
|
|
1582
|
-
if (node.object.type === ast.NodeType.Identifier && node.object.name === pragmaMemberName) {
|
|
1583
|
-
return isInitializedFromPragma(node.object.name, context, initialScope, pragma);
|
|
1584
|
-
}
|
|
1585
|
-
if (node.object.type === ast.NodeType.MemberExpression && node.object.object.type === ast.NodeType.Identifier && node.object.object.name === pragma && node.object.property.type === ast.NodeType.Identifier) {
|
|
1586
|
-
return node.object.property.name === pragmaMemberName;
|
|
1587
|
-
}
|
|
1588
|
-
return false;
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
function isCallFromPragma(name) {
|
|
1592
|
-
return (node, context) => {
|
|
1593
|
-
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1594
|
-
return false;
|
|
1595
|
-
return isFromPragma(name)(node.callee, context);
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
function isCallFromPragmaMember(pragmaMemberName, name) {
|
|
1599
|
-
return (node, context) => {
|
|
1600
|
-
if (!ast.is(ast.NodeType.MemberExpression)(node.callee))
|
|
1601
|
-
return false;
|
|
1602
|
-
return isFromPragmaMember(pragmaMemberName, name)(node.callee, context);
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
// src/element/api.ts
|
|
1607
|
-
var isCreateElement = isFromPragma("createElement");
|
|
1608
|
-
var isCreateElementCall = (node, context) => {
|
|
1609
|
-
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1610
|
-
return false;
|
|
1611
|
-
return isCreateElement(node.callee, context);
|
|
1612
|
-
};
|
|
1613
|
-
var isCloneElement = isFromPragma("cloneElement");
|
|
1614
|
-
var isCloneElementCall = (node, context) => {
|
|
1615
|
-
if (!ast.isOneOf([ast.NodeType.Identifier, ast.NodeType.MemberExpression])(node.callee))
|
|
1616
|
-
return false;
|
|
1617
|
-
return isCloneElement(node.callee, context);
|
|
1618
|
-
};
|
|
1619
|
-
function resolveMemberExpressions(object, property) {
|
|
1620
|
-
if (object.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
1621
|
-
return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
|
|
1622
|
-
}
|
|
1623
|
-
if (object.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
1624
|
-
return `${object.namespace.name}:${object.name.name}.${property.name}`;
|
|
1625
|
-
}
|
|
1626
|
-
return `${object.name}.${property.name}`;
|
|
1627
|
-
}
|
|
1628
|
-
function elementType(node) {
|
|
1629
|
-
if (node.type === types.AST_NODE_TYPES.JSXOpeningFragment) {
|
|
1630
|
-
return "<>";
|
|
1631
|
-
}
|
|
1632
|
-
const { name } = node;
|
|
1633
|
-
if (name.type === types.AST_NODE_TYPES.JSXMemberExpression) {
|
|
1634
|
-
const { object, property } = name;
|
|
1635
|
-
return resolveMemberExpressions(object, property);
|
|
1636
|
-
}
|
|
1637
|
-
if (name.type === types.AST_NODE_TYPES.JSXNamespacedName) {
|
|
1638
|
-
return `${name.namespace.name}:${name.name.name}`;
|
|
1639
|
-
}
|
|
1640
|
-
return name.name;
|
|
1641
|
-
}
|
|
1642
|
-
function isInsideCreateElementProps(node, context) {
|
|
1643
|
-
return Function_exports.pipe(
|
|
1644
|
-
ast.traverseUp(node, (n2) => ast.is(ast.NodeType.CallExpression)(n2) && isCreateElementCall(n2, context)),
|
|
1645
|
-
Option_exports.filter(ast.is(ast.NodeType.CallExpression)),
|
|
1646
|
-
Option_exports.flatMapNullable((c2) => c2.arguments.at(1)),
|
|
1647
|
-
Option_exports.filter(ast.is(ast.NodeType.ObjectExpression)),
|
|
1648
|
-
Option_exports.zipWith(ast.traverseUp(node, ast.is(ast.NodeType.ObjectExpression)), (a2, b2) => a2 === b2),
|
|
1649
|
-
Option_exports.getOrElse(Function_exports.constFalse)
|
|
1650
|
-
);
|
|
1651
|
-
}
|
|
1652
|
-
function isChildrenOfCreateElement(node, context) {
|
|
1653
|
-
return Function_exports.pipe(
|
|
1654
|
-
Option_exports.fromNullable(node.parent),
|
|
1655
|
-
Option_exports.filter(ast.is(ast.NodeType.CallExpression)),
|
|
1656
|
-
Option_exports.filter((n2) => isCreateElementCall(n2, context)),
|
|
1657
|
-
Option_exports.exists(
|
|
1658
|
-
(n2) => n2.arguments.slice(2).some((arg) => arg === node)
|
|
1659
|
-
)
|
|
1660
|
-
);
|
|
1661
|
-
}
|
|
1662
|
-
function hasChildren(node, predicate) {
|
|
1663
|
-
if (Predicate_exports.isFunction(predicate))
|
|
1664
|
-
return node.children.some(predicate);
|
|
1665
|
-
return node.children.length > 0;
|
|
1666
|
-
}
|
|
1667
|
-
function isChildOfJSXElement(node) {
|
|
1668
|
-
return node.parent?.type === ast.NodeType.JSXElement && node.parent.children.some((child) => child === node);
|
|
1669
|
-
}
|
|
1670
|
-
function isJSXElementOfUserDefinedComponent(node) {
|
|
1671
|
-
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
1672
|
-
}
|
|
1673
|
-
function isJSXElementOfBuiltinComponent(node) {
|
|
1674
|
-
return node.openingElement.name.type === ast.NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
|
|
1675
|
-
}
|
|
1676
|
-
var isFragment = (node, pragma, fragment) => {
|
|
1677
|
-
if (!ast.isOneOf([ast.NodeType.JSXElement, ast.NodeType.JSXFragment])(node))
|
|
1678
|
-
return false;
|
|
1679
|
-
return isFragmentSyntax(node) || isFragmentElement(node, pragma, fragment);
|
|
1680
|
-
};
|
|
1681
|
-
var isFragmentSyntax = ast.is(ast.NodeType.JSXFragment);
|
|
1682
|
-
function isFragmentElement(node, pragma, fragment) {
|
|
1683
|
-
const { name } = node.openingElement;
|
|
1684
|
-
if (name.type === ast.NodeType.JSXIdentifier && name.name === fragment)
|
|
1685
|
-
return true;
|
|
1686
|
-
return name.type === ast.NodeType.JSXMemberExpression && name.object.type === ast.NodeType.JSXIdentifier && name.object.name === pragma && name.property.name === fragment;
|
|
1687
|
-
}
|
|
1688
|
-
var JSXValueHint = {
|
|
1689
|
-
None: 0n,
|
|
1690
|
-
SkipNullLiteral: 1n << 0n,
|
|
1691
|
-
SkipUndefinedLiteral: 1n << 1n,
|
|
1692
|
-
SkipBooleanLiteral: 1n << 2n,
|
|
1693
|
-
SkipStringLiteral: 1n << 3n,
|
|
1694
|
-
SkipNumberLiteral: 1n << 4n,
|
|
1695
|
-
SkipCreateElement: 1n << 5n,
|
|
1696
|
-
StrictArray: 1n << 6n,
|
|
1697
|
-
StrictLogical: 1n << 7n,
|
|
1698
|
-
StrictConditional: 1n << 8n
|
|
1699
|
-
};
|
|
1700
|
-
var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
|
|
1701
|
-
function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
1702
|
-
if (!node)
|
|
1703
|
-
return false;
|
|
1704
|
-
return $(node).with({ type: ast.NodeType.JSXElement }, Function_exports.constTrue).with({ type: ast.NodeType.JSXFragment }, Function_exports.constTrue).with({ type: ast.NodeType.JSXMemberExpression }, Function_exports.constTrue).with({ type: ast.NodeType.JSXNamespacedName }, Function_exports.constTrue).with({ type: ast.NodeType.Literal }, (node2) => {
|
|
1705
|
-
return $(node2.value).with(null, () => !(hint & JSXValueHint.SkipNullLiteral)).with(N.boolean, () => !(hint & JSXValueHint.SkipBooleanLiteral)).with(N.string, () => !(hint & JSXValueHint.SkipStringLiteral)).with(N.number, () => !(hint & JSXValueHint.SkipNumberLiteral)).otherwise(Function_exports.constFalse);
|
|
1706
|
-
}).with({ type: ast.NodeType.TemplateLiteral }, () => !(hint & JSXValueHint.SkipStringLiteral)).with({ type: ast.NodeType.ArrayExpression }, (node2) => {
|
|
1707
|
-
if (hint & JSXValueHint.StrictArray)
|
|
1708
|
-
return node2.elements.every((n2) => isJSXValue(n2, context, hint));
|
|
1709
|
-
return node2.elements.some((n2) => isJSXValue(n2, context, hint));
|
|
1710
|
-
}).with({ type: ast.NodeType.ConditionalExpression }, (node2) => {
|
|
1711
|
-
function leftHasJSX(node3) {
|
|
1712
|
-
if (Array.isArray(node3.consequent)) {
|
|
1713
|
-
if (hint & JSXValueHint.StrictArray) {
|
|
1714
|
-
return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
|
|
1715
|
-
}
|
|
1716
|
-
return node3.consequent.some((n2) => isJSXValue(n2, context, hint));
|
|
1717
|
-
}
|
|
1718
|
-
return isJSXValue(node3.consequent, context, hint);
|
|
1719
|
-
}
|
|
1720
|
-
function rightHasJSX(node3) {
|
|
1721
|
-
return isJSXValue(node3.alternate, context, hint);
|
|
1722
|
-
}
|
|
1723
|
-
if (hint & JSXValueHint.StrictConditional) {
|
|
1724
|
-
return leftHasJSX(node2) && rightHasJSX(node2);
|
|
1725
|
-
}
|
|
1726
|
-
return leftHasJSX(node2) || rightHasJSX(node2);
|
|
1727
|
-
}).with({ type: ast.NodeType.LogicalExpression }, (node2) => {
|
|
1728
|
-
return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
|
|
1729
|
-
}).with({ type: ast.NodeType.SequenceExpression }, (node2) => {
|
|
1730
|
-
const exp = node2.expressions.at(-1);
|
|
1731
|
-
return isJSXValue(exp, context, hint);
|
|
1732
|
-
}).with({ type: ast.NodeType.CallExpression }, (node2) => {
|
|
1733
|
-
if (hint & JSXValueHint.SkipCreateElement)
|
|
1734
|
-
return false;
|
|
1735
|
-
return isCreateElementCall(node2, context);
|
|
1736
|
-
}).with({ type: ast.NodeType.Identifier }, (node2) => {
|
|
1737
|
-
const { name } = node2;
|
|
1738
|
-
if (name === "undefined")
|
|
1739
|
-
return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
1740
|
-
if (ast.isJSXTagNameExpression(node2))
|
|
1741
|
-
return true;
|
|
1742
|
-
const initialScope = context.sourceCode.getScope(node2);
|
|
1743
|
-
const maybeVariable = _var.findVariable(name, initialScope);
|
|
1744
|
-
return Function_exports.pipe(
|
|
1745
|
-
maybeVariable,
|
|
1746
|
-
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
1747
|
-
Option_exports.exists((n2) => isJSXValue(n2, context, hint))
|
|
1748
|
-
);
|
|
1749
|
-
}).otherwise(Function_exports.constFalse);
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
// src/misc.ts
|
|
1753
|
-
function isFunctionReturningJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
1754
|
-
if (node.body.type !== ast.NodeType.BlockStatement) {
|
|
1755
|
-
return isJSXValue(node.body, context, hint);
|
|
1756
|
-
}
|
|
1757
|
-
const statements = ast.getNestedReturnStatements(node.body);
|
|
1758
|
-
return statements.some((statement) => isJSXValue(statement.argument, context, hint));
|
|
1759
|
-
}
|
|
2283
|
+
// src/prop/get-prop.ts
|
|
1760
2284
|
var { getStaticValue } = ast.ESLintCommunityESLintUtils;
|
|
1761
2285
|
function getPropName(node) {
|
|
1762
2286
|
return $(node.name).when(ast.is(ast.NodeType.JSXIdentifier), (n2) => n2.name).when(ast.is(ast.NodeType.JSXNamespacedName), (n2) => `${n2.namespace.name}:${n2.name.name}`).exhaustive();
|
|
@@ -1794,13 +2318,13 @@ function findPropInProperties(properties, context, initialScope, seenProps = [])
|
|
|
1794
2318
|
);
|
|
1795
2319
|
if (Option_exports.isNone(maybeInit))
|
|
1796
2320
|
return false;
|
|
1797
|
-
const
|
|
1798
|
-
if (
|
|
2321
|
+
const init2 = maybeInit.value;
|
|
2322
|
+
if (init2.type !== ast.NodeType.ObjectExpression)
|
|
1799
2323
|
return false;
|
|
1800
2324
|
if (seenProps.includes(name))
|
|
1801
2325
|
return false;
|
|
1802
2326
|
return Option_exports.isSome(
|
|
1803
|
-
findPropInProperties(
|
|
2327
|
+
findPropInProperties(init2.properties, context, initialScope, [...seenProps, name])(propName)
|
|
1804
2328
|
);
|
|
1805
2329
|
}).when(ast.is(ast.NodeType.ObjectExpression), (argument) => {
|
|
1806
2330
|
return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
|
|
@@ -1827,10 +2351,10 @@ function findPropInAttributes(attributes, context, initialScope) {
|
|
|
1827
2351
|
);
|
|
1828
2352
|
if (Option_exports.isNone(maybeInit))
|
|
1829
2353
|
return false;
|
|
1830
|
-
const
|
|
1831
|
-
if (!("properties" in
|
|
2354
|
+
const init2 = maybeInit.value;
|
|
2355
|
+
if (!("properties" in init2))
|
|
1832
2356
|
return false;
|
|
1833
|
-
return Option_exports.isSome(findPropInProperties(
|
|
2357
|
+
return Option_exports.isSome(findPropInProperties(init2.properties, context, initialScope)(propName));
|
|
1834
2358
|
}).when(ast.is(ast.NodeType.ObjectExpression), (argument) => {
|
|
1835
2359
|
return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
|
|
1836
2360
|
}).when(ast.is(ast.NodeType.MemberExpression), () => {
|
|
@@ -1877,37 +2401,82 @@ function isLineBreak(node) {
|
|
|
1877
2401
|
function isPaddingSpaces(node) {
|
|
1878
2402
|
return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
|
|
1879
2403
|
}
|
|
2404
|
+
var JSXValueHint = {
|
|
2405
|
+
None: 0n,
|
|
2406
|
+
SkipNullLiteral: 1n << 0n,
|
|
2407
|
+
SkipUndefinedLiteral: 1n << 1n,
|
|
2408
|
+
SkipBooleanLiteral: 1n << 2n,
|
|
2409
|
+
SkipStringLiteral: 1n << 3n,
|
|
2410
|
+
SkipNumberLiteral: 1n << 4n,
|
|
2411
|
+
SkipCreateElement: 1n << 5n,
|
|
2412
|
+
StrictArray: 1n << 6n,
|
|
2413
|
+
StrictLogical: 1n << 7n,
|
|
2414
|
+
StrictConditional: 1n << 8n
|
|
2415
|
+
};
|
|
2416
|
+
var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
|
|
2417
|
+
function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
|
|
2418
|
+
if (!node)
|
|
2419
|
+
return false;
|
|
2420
|
+
return $(node).with({ type: ast.NodeType.JSXElement }, Function_exports.constTrue).with({ type: ast.NodeType.JSXFragment }, Function_exports.constTrue).with({ type: ast.NodeType.JSXMemberExpression }, Function_exports.constTrue).with({ type: ast.NodeType.JSXNamespacedName }, Function_exports.constTrue).with({ type: ast.NodeType.Literal }, (node2) => {
|
|
2421
|
+
return $(node2.value).with(null, () => !(hint & JSXValueHint.SkipNullLiteral)).with(N.boolean, () => !(hint & JSXValueHint.SkipBooleanLiteral)).with(N.string, () => !(hint & JSXValueHint.SkipStringLiteral)).with(N.number, () => !(hint & JSXValueHint.SkipNumberLiteral)).otherwise(Function_exports.constFalse);
|
|
2422
|
+
}).with({ type: ast.NodeType.TemplateLiteral }, () => !(hint & JSXValueHint.SkipStringLiteral)).with({ type: ast.NodeType.ArrayExpression }, (node2) => {
|
|
2423
|
+
if (hint & JSXValueHint.StrictArray)
|
|
2424
|
+
return node2.elements.every((n2) => isJSXValue(n2, context, hint));
|
|
2425
|
+
return node2.elements.some((n2) => isJSXValue(n2, context, hint));
|
|
2426
|
+
}).with({ type: ast.NodeType.ConditionalExpression }, (node2) => {
|
|
2427
|
+
function leftHasJSX(node3) {
|
|
2428
|
+
if (Array.isArray(node3.consequent)) {
|
|
2429
|
+
if (hint & JSXValueHint.StrictArray) {
|
|
2430
|
+
return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
|
|
2431
|
+
}
|
|
2432
|
+
return node3.consequent.some((n2) => isJSXValue(n2, context, hint));
|
|
2433
|
+
}
|
|
2434
|
+
return isJSXValue(node3.consequent, context, hint);
|
|
2435
|
+
}
|
|
2436
|
+
function rightHasJSX(node3) {
|
|
2437
|
+
return isJSXValue(node3.alternate, context, hint);
|
|
2438
|
+
}
|
|
2439
|
+
if (hint & JSXValueHint.StrictConditional) {
|
|
2440
|
+
return leftHasJSX(node2) && rightHasJSX(node2);
|
|
2441
|
+
}
|
|
2442
|
+
return leftHasJSX(node2) || rightHasJSX(node2);
|
|
2443
|
+
}).with({ type: ast.NodeType.LogicalExpression }, (node2) => {
|
|
2444
|
+
return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
|
|
2445
|
+
}).with({ type: ast.NodeType.SequenceExpression }, (node2) => {
|
|
2446
|
+
const exp = node2.expressions.at(-1);
|
|
2447
|
+
return isJSXValue(exp, context, hint);
|
|
2448
|
+
}).with({ type: ast.NodeType.CallExpression }, (node2) => {
|
|
2449
|
+
if (hint & JSXValueHint.SkipCreateElement)
|
|
2450
|
+
return false;
|
|
2451
|
+
return $(node2.callee).with({ type: ast.NodeType.Identifier, name: "createElement" }, Function_exports.constTrue).with({ type: ast.NodeType.MemberExpression, property: { name: "createElement" } }, Function_exports.constTrue).otherwise(Function_exports.constFalse);
|
|
2452
|
+
}).with({ type: ast.NodeType.Identifier }, (node2) => {
|
|
2453
|
+
const { name } = node2;
|
|
2454
|
+
if (name === "undefined")
|
|
2455
|
+
return !(hint & JSXValueHint.SkipUndefinedLiteral);
|
|
2456
|
+
if (ast.isJSXTagNameExpression(node2))
|
|
2457
|
+
return true;
|
|
2458
|
+
const initialScope = context.sourceCode.getScope(node2);
|
|
2459
|
+
const maybeVariable = _var.findVariable(name, initialScope);
|
|
2460
|
+
return Function_exports.pipe(
|
|
2461
|
+
maybeVariable,
|
|
2462
|
+
Option_exports.flatMap(_var.getVariableInit(0)),
|
|
2463
|
+
Option_exports.exists((n2) => isJSXValue(n2, context, hint))
|
|
2464
|
+
);
|
|
2465
|
+
}).otherwise(Function_exports.constFalse);
|
|
2466
|
+
}
|
|
1880
2467
|
|
|
1881
2468
|
exports.DEFAULT_JSX_VALUE_HINT = DEFAULT_JSX_VALUE_HINT;
|
|
1882
2469
|
exports.JSXValueHint = JSXValueHint;
|
|
1883
2470
|
exports.elementType = elementType;
|
|
1884
2471
|
exports.findPropInAttributes = findPropInAttributes;
|
|
1885
2472
|
exports.findPropInProperties = findPropInProperties;
|
|
1886
|
-
exports.
|
|
1887
|
-
exports.getPragmaFromContext = getPragmaFromContext;
|
|
2473
|
+
exports.getJSXPragmaFromContext = getJSXPragmaFromContext;
|
|
1888
2474
|
exports.getProp = getProp;
|
|
1889
2475
|
exports.getPropName = getPropName;
|
|
1890
2476
|
exports.getPropValue = getPropValue;
|
|
1891
2477
|
exports.hasAnyProp = hasAnyProp;
|
|
1892
|
-
exports.hasChildren = hasChildren;
|
|
1893
2478
|
exports.hasEveryProp = hasEveryProp;
|
|
1894
2479
|
exports.hasProp = hasProp;
|
|
1895
|
-
exports.isCallFromPragma = isCallFromPragma;
|
|
1896
|
-
exports.isCallFromPragmaMember = isCallFromPragmaMember;
|
|
1897
|
-
exports.isChildOfJSXElement = isChildOfJSXElement;
|
|
1898
|
-
exports.isChildrenOfCreateElement = isChildrenOfCreateElement;
|
|
1899
|
-
exports.isCloneElement = isCloneElement;
|
|
1900
|
-
exports.isCloneElementCall = isCloneElementCall;
|
|
1901
|
-
exports.isCreateElement = isCreateElement;
|
|
1902
|
-
exports.isCreateElementCall = isCreateElementCall;
|
|
1903
|
-
exports.isFragment = isFragment;
|
|
1904
|
-
exports.isFragmentElement = isFragmentElement;
|
|
1905
|
-
exports.isFragmentSyntax = isFragmentSyntax;
|
|
1906
|
-
exports.isFromPragma = isFromPragma;
|
|
1907
|
-
exports.isFromPragmaMember = isFromPragmaMember;
|
|
1908
|
-
exports.isFunctionReturningJSXValue = isFunctionReturningJSXValue;
|
|
1909
|
-
exports.isInitializedFromPragma = isInitializedFromPragma;
|
|
1910
|
-
exports.isInsideCreateElementProps = isInsideCreateElementProps;
|
|
1911
2480
|
exports.isInsidePropValue = isInsidePropValue;
|
|
1912
2481
|
exports.isJSXElementOfBuiltinComponent = isJSXElementOfBuiltinComponent;
|
|
1913
2482
|
exports.isJSXElementOfUserDefinedComponent = isJSXElementOfUserDefinedComponent;
|
|
@@ -1915,6 +2484,5 @@ exports.isJSXValue = isJSXValue;
|
|
|
1915
2484
|
exports.isLineBreak = isLineBreak;
|
|
1916
2485
|
exports.isLiteral = isLiteral;
|
|
1917
2486
|
exports.isPaddingSpaces = isPaddingSpaces;
|
|
1918
|
-
exports.isPropertyOfPragma = isPropertyOfPragma;
|
|
1919
2487
|
exports.isWhiteSpace = isWhiteSpace;
|
|
1920
2488
|
exports.traverseUpProp = traverseUpProp;
|