@eslint-react/shared 1.23.2-next.3 → 1.23.2
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 +1808 -172
- package/dist/index.d.ts +1808 -172
- package/dist/index.js +1023 -73
- package/dist/index.mjs +967 -22
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var utils = require('@typescript-eslint/utils');
|
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var tsPattern = require('ts-pattern');
|
|
6
6
|
var module$1 = require('module');
|
|
7
|
-
var valibot = require('valibot');
|
|
8
7
|
var pm = require('picomatch');
|
|
9
8
|
|
|
10
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -13,6 +12,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
12
|
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
|
14
13
|
var pm__default = /*#__PURE__*/_interopDefault(pm);
|
|
15
14
|
|
|
15
|
+
// src/cache.ts
|
|
16
|
+
var normalizedSettingsCache = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
|
|
16
18
|
// src/constants.ts
|
|
17
19
|
var NPM_SCOPE = "@eslint-react";
|
|
18
20
|
var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
|
|
@@ -23,7 +25,7 @@ var RE_KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
|
|
|
23
25
|
var RE_SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
|
|
24
26
|
var RE_CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
|
|
25
27
|
var RE_JAVASCRIPT_PROTOCOL = /^[\u0000-\u001F ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/iu;
|
|
26
|
-
var
|
|
28
|
+
var DOM_HTML_COMPONENT_TYPES = [
|
|
27
29
|
"aside",
|
|
28
30
|
"audio",
|
|
29
31
|
"b",
|
|
@@ -126,7 +128,7 @@ var HOST_HTML_COMPONENT_TYPES = [
|
|
|
126
128
|
"video",
|
|
127
129
|
"wbr"
|
|
128
130
|
];
|
|
129
|
-
var
|
|
131
|
+
var DOM_SVG_COMPONENT_TYPES = [
|
|
130
132
|
"a",
|
|
131
133
|
"animate",
|
|
132
134
|
"animateMotion",
|
|
@@ -237,156 +239,1099 @@ function getReactVersion(at = (typeof document === 'undefined' ? require('u' + '
|
|
|
237
239
|
eff.E.map((mod) => mod.version)
|
|
238
240
|
);
|
|
239
241
|
}
|
|
240
|
-
|
|
242
|
+
|
|
243
|
+
// ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
|
|
244
|
+
var store;
|
|
245
|
+
// @__NO_SIDE_EFFECTS__
|
|
246
|
+
function getGlobalConfig(config2) {
|
|
247
|
+
return {
|
|
248
|
+
lang: config2?.lang ?? store?.lang,
|
|
249
|
+
message: config2?.message,
|
|
250
|
+
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
251
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// @__NO_SIDE_EFFECTS__
|
|
255
|
+
function _getStandardProps(context) {
|
|
256
|
+
return {
|
|
257
|
+
version: 1,
|
|
258
|
+
vendor: "valibot",
|
|
259
|
+
validate(value2) {
|
|
260
|
+
return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
var ValiError = class extends Error {
|
|
265
|
+
/**
|
|
266
|
+
* Creates a Valibot error with useful information.
|
|
267
|
+
*
|
|
268
|
+
* @param issues The error issues.
|
|
269
|
+
*/
|
|
270
|
+
constructor(issues) {
|
|
271
|
+
super(issues[0].message);
|
|
272
|
+
this.name = "ValiError";
|
|
273
|
+
this.issues = issues;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
// @__NO_SIDE_EFFECTS__
|
|
277
|
+
function getDefault(schema, dataset, config2) {
|
|
278
|
+
return typeof schema.default === "function" ? (
|
|
279
|
+
// @ts-expect-error
|
|
280
|
+
schema.default(dataset, config2)
|
|
281
|
+
) : (
|
|
282
|
+
// @ts-expect-error
|
|
283
|
+
schema.default
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
// @__NO_SIDE_EFFECTS__
|
|
287
|
+
function array(item, message) {
|
|
288
|
+
return {
|
|
289
|
+
kind: "schema",
|
|
290
|
+
type: "array",
|
|
291
|
+
reference: array,
|
|
292
|
+
expects: "Array",
|
|
293
|
+
async: false,
|
|
294
|
+
item,
|
|
295
|
+
message,
|
|
296
|
+
get "~standard"() {
|
|
297
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
298
|
+
},
|
|
299
|
+
"~run"(dataset, config2) {
|
|
300
|
+
const input = dataset.value;
|
|
301
|
+
if (Array.isArray(input)) {
|
|
302
|
+
dataset.typed = true;
|
|
303
|
+
dataset.value = [];
|
|
304
|
+
for (let key = 0; key < input.length; key++) {
|
|
305
|
+
const value2 = input[key];
|
|
306
|
+
const itemDataset = this.item["~run"]({ value: value2 }, config2);
|
|
307
|
+
if (itemDataset.issues) {
|
|
308
|
+
const pathItem = {
|
|
309
|
+
type: "array",
|
|
310
|
+
origin: "value",
|
|
311
|
+
input,
|
|
312
|
+
key,
|
|
313
|
+
value: value2
|
|
314
|
+
};
|
|
315
|
+
for (const issue of itemDataset.issues) {
|
|
316
|
+
if (issue.path) {
|
|
317
|
+
issue.path.unshift(pathItem);
|
|
318
|
+
} else {
|
|
319
|
+
issue.path = [pathItem];
|
|
320
|
+
}
|
|
321
|
+
dataset.issues?.push(issue);
|
|
322
|
+
}
|
|
323
|
+
if (!dataset.issues) {
|
|
324
|
+
dataset.issues = itemDataset.issues;
|
|
325
|
+
}
|
|
326
|
+
if (config2.abortEarly) {
|
|
327
|
+
dataset.typed = false;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
if (!itemDataset.typed) {
|
|
332
|
+
dataset.typed = false;
|
|
333
|
+
}
|
|
334
|
+
dataset.value.push(itemDataset.value);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return dataset;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
// @__NO_SIDE_EFFECTS__
|
|
342
|
+
function boolean(message) {
|
|
343
|
+
return {
|
|
344
|
+
kind: "schema",
|
|
345
|
+
type: "boolean",
|
|
346
|
+
reference: boolean,
|
|
347
|
+
expects: "boolean",
|
|
348
|
+
async: false,
|
|
349
|
+
message,
|
|
350
|
+
get "~standard"() {
|
|
351
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
352
|
+
},
|
|
353
|
+
"~run"(dataset, config2) {
|
|
354
|
+
if (typeof dataset.value === "boolean") {
|
|
355
|
+
dataset.typed = true;
|
|
356
|
+
}
|
|
357
|
+
return dataset;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
// @__NO_SIDE_EFFECTS__
|
|
362
|
+
function instance(class_, message) {
|
|
363
|
+
return {
|
|
364
|
+
kind: "schema",
|
|
365
|
+
type: "instance",
|
|
366
|
+
reference: instance,
|
|
367
|
+
expects: class_.name,
|
|
368
|
+
async: false,
|
|
369
|
+
class: class_,
|
|
370
|
+
message,
|
|
371
|
+
get "~standard"() {
|
|
372
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
373
|
+
},
|
|
374
|
+
"~run"(dataset, config2) {
|
|
375
|
+
if (dataset.value instanceof this.class) {
|
|
376
|
+
dataset.typed = true;
|
|
377
|
+
}
|
|
378
|
+
return dataset;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
// @__NO_SIDE_EFFECTS__
|
|
383
|
+
function object(entries, message) {
|
|
384
|
+
return {
|
|
385
|
+
kind: "schema",
|
|
386
|
+
type: "object",
|
|
387
|
+
reference: object,
|
|
388
|
+
expects: "Object",
|
|
389
|
+
async: false,
|
|
390
|
+
entries,
|
|
391
|
+
message,
|
|
392
|
+
get "~standard"() {
|
|
393
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
394
|
+
},
|
|
395
|
+
"~run"(dataset, config2) {
|
|
396
|
+
const input = dataset.value;
|
|
397
|
+
if (input && typeof input === "object") {
|
|
398
|
+
dataset.typed = true;
|
|
399
|
+
dataset.value = {};
|
|
400
|
+
for (const key in this.entries) {
|
|
401
|
+
const value2 = input[key];
|
|
402
|
+
const valueDataset = this.entries[key]["~run"]({ value: value2 }, config2);
|
|
403
|
+
if (valueDataset.issues) {
|
|
404
|
+
const pathItem = {
|
|
405
|
+
type: "object",
|
|
406
|
+
origin: "value",
|
|
407
|
+
input,
|
|
408
|
+
key,
|
|
409
|
+
value: value2
|
|
410
|
+
};
|
|
411
|
+
for (const issue of valueDataset.issues) {
|
|
412
|
+
if (issue.path) {
|
|
413
|
+
issue.path.unshift(pathItem);
|
|
414
|
+
} else {
|
|
415
|
+
issue.path = [pathItem];
|
|
416
|
+
}
|
|
417
|
+
dataset.issues?.push(issue);
|
|
418
|
+
}
|
|
419
|
+
if (!dataset.issues) {
|
|
420
|
+
dataset.issues = valueDataset.issues;
|
|
421
|
+
}
|
|
422
|
+
if (config2.abortEarly) {
|
|
423
|
+
dataset.typed = false;
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (!valueDataset.typed) {
|
|
428
|
+
dataset.typed = false;
|
|
429
|
+
}
|
|
430
|
+
if (valueDataset.value !== undefined || key in input) {
|
|
431
|
+
dataset.value[key] = valueDataset.value;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return dataset;
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
// @__NO_SIDE_EFFECTS__
|
|
440
|
+
function optional(wrapped, default_) {
|
|
441
|
+
return {
|
|
442
|
+
kind: "schema",
|
|
443
|
+
type: "optional",
|
|
444
|
+
reference: optional,
|
|
445
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
446
|
+
async: false,
|
|
447
|
+
wrapped,
|
|
448
|
+
default: default_,
|
|
449
|
+
get "~standard"() {
|
|
450
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
451
|
+
},
|
|
452
|
+
"~run"(dataset, config2) {
|
|
453
|
+
if (dataset.value === undefined) {
|
|
454
|
+
if (this.default !== undefined) {
|
|
455
|
+
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
456
|
+
}
|
|
457
|
+
if (dataset.value === undefined) {
|
|
458
|
+
dataset.typed = true;
|
|
459
|
+
return dataset;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return this.wrapped["~run"](dataset, config2);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
// @__NO_SIDE_EFFECTS__
|
|
467
|
+
function string(message) {
|
|
468
|
+
return {
|
|
469
|
+
kind: "schema",
|
|
470
|
+
type: "string",
|
|
471
|
+
reference: string,
|
|
472
|
+
expects: "string",
|
|
473
|
+
async: false,
|
|
474
|
+
message,
|
|
475
|
+
get "~standard"() {
|
|
476
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
477
|
+
},
|
|
478
|
+
"~run"(dataset, config2) {
|
|
479
|
+
if (typeof dataset.value === "string") {
|
|
480
|
+
dataset.typed = true;
|
|
481
|
+
}
|
|
482
|
+
return dataset;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
// @__NO_SIDE_EFFECTS__
|
|
487
|
+
function parse(schema, input, config2) {
|
|
488
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
489
|
+
if (dataset.issues) {
|
|
490
|
+
throw new ValiError(dataset.issues);
|
|
491
|
+
}
|
|
492
|
+
return dataset.value;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// src/schemas.ts
|
|
496
|
+
var CustomHookSchema = object({
|
|
241
497
|
// TODO: Define the schema for custom Hooks
|
|
242
498
|
});
|
|
243
|
-
var CustomAttributeSchema =
|
|
499
|
+
var CustomAttributeSchema = object({
|
|
244
500
|
/**
|
|
245
501
|
* The name of the attribute in the user-defined component.
|
|
246
502
|
* @example
|
|
247
503
|
* "to"
|
|
248
504
|
*/
|
|
249
|
-
name:
|
|
505
|
+
name: string(),
|
|
250
506
|
/**
|
|
251
507
|
* The name of the attribute in the built-in component.
|
|
252
508
|
* @example
|
|
253
509
|
* "href"
|
|
254
510
|
*/
|
|
255
|
-
as:
|
|
511
|
+
as: optional(string()),
|
|
256
512
|
/**
|
|
257
513
|
* Whether the attribute is controlled or not in the user-defined component.
|
|
258
514
|
* @example
|
|
259
515
|
* `true`
|
|
260
516
|
*/
|
|
261
|
-
controlled:
|
|
517
|
+
controlled: optional(boolean()),
|
|
262
518
|
/**
|
|
263
519
|
* The default value of the attribute in the user-defined component.
|
|
264
520
|
* @example
|
|
265
521
|
* `"/"`
|
|
266
522
|
*/
|
|
267
|
-
defaultValue:
|
|
523
|
+
defaultValue: optional(string())
|
|
268
524
|
});
|
|
269
|
-
var CustomComponentSchema =
|
|
525
|
+
var CustomComponentSchema = object({
|
|
270
526
|
/**
|
|
271
527
|
* The name of the user-defined component.
|
|
272
528
|
* @example
|
|
273
529
|
* "Link"
|
|
274
530
|
*/
|
|
275
|
-
name:
|
|
531
|
+
name: string(),
|
|
276
532
|
/**
|
|
277
533
|
* The ESQuery selector to select the component precisely.
|
|
278
534
|
* @example
|
|
279
535
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
280
536
|
*/
|
|
281
|
-
selector:
|
|
537
|
+
selector: optional(string()),
|
|
282
538
|
/**
|
|
283
539
|
* The name of the built-in component that the user-defined component represents.
|
|
284
540
|
* @example
|
|
285
541
|
* "a"
|
|
286
542
|
*/
|
|
287
|
-
as:
|
|
543
|
+
as: optional(string()),
|
|
288
544
|
/**
|
|
289
545
|
* Pre-defined attributes that are used in the user-defined component.
|
|
290
546
|
* @example
|
|
291
547
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
292
548
|
*/
|
|
293
|
-
attributes:
|
|
549
|
+
attributes: optional(array(CustomAttributeSchema))
|
|
294
550
|
});
|
|
295
|
-
var CustomComponentNormalizedSchema =
|
|
296
|
-
name:
|
|
297
|
-
as:
|
|
298
|
-
attributes:
|
|
299
|
-
re:
|
|
300
|
-
selector:
|
|
551
|
+
var CustomComponentNormalizedSchema = object({
|
|
552
|
+
name: string(),
|
|
553
|
+
as: optional(string()),
|
|
554
|
+
attributes: optional(array(CustomAttributeSchema), []),
|
|
555
|
+
re: instance(RegExp),
|
|
556
|
+
selector: optional(string())
|
|
301
557
|
});
|
|
302
|
-
var ESLintReactSettingsSchema =
|
|
558
|
+
var ESLintReactSettingsSchema = object({
|
|
303
559
|
/**
|
|
304
560
|
* The source where React is imported from.
|
|
305
561
|
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
306
562
|
* @default `"react"`
|
|
307
563
|
* @example `"@pika/react"`
|
|
308
564
|
*/
|
|
309
|
-
importSource:
|
|
565
|
+
importSource: optional(string()),
|
|
310
566
|
/**
|
|
311
567
|
* The identifier that’s used for JSX Element creation.
|
|
312
568
|
* @default `"createElement"`
|
|
313
569
|
* @deprecated
|
|
314
570
|
*/
|
|
315
|
-
jsxPragma:
|
|
571
|
+
jsxPragma: optional(string()),
|
|
316
572
|
/**
|
|
317
573
|
* The identifier that’s used for JSX fragment elements.
|
|
318
574
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
319
575
|
* @default `"Fragment"`
|
|
320
576
|
* @deprecated
|
|
321
577
|
*/
|
|
322
|
-
jsxPragmaFrag:
|
|
578
|
+
jsxPragmaFrag: optional(string()),
|
|
323
579
|
/**
|
|
324
580
|
* The name of the prop that is used for polymorphic components.
|
|
325
581
|
* @description This is used to determine the type of the component.
|
|
326
582
|
* @example `"as"`
|
|
327
583
|
*/
|
|
328
|
-
polymorphicPropName:
|
|
584
|
+
polymorphicPropName: optional(string()),
|
|
329
585
|
/**
|
|
330
586
|
* @internal
|
|
331
587
|
*/
|
|
332
|
-
strict:
|
|
588
|
+
strict: optional(boolean()),
|
|
333
589
|
/**
|
|
334
590
|
* @internal
|
|
335
591
|
*/
|
|
336
|
-
strictImportCheck:
|
|
592
|
+
strictImportCheck: optional(boolean()),
|
|
337
593
|
/**
|
|
338
594
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
339
595
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
340
596
|
* @example `"18.3.1"`
|
|
341
597
|
* @default `"detect"`
|
|
342
598
|
*/
|
|
343
|
-
version:
|
|
599
|
+
version: optional(string()),
|
|
344
600
|
/**
|
|
345
601
|
* An array of user-defined components
|
|
346
602
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
347
603
|
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
348
604
|
*/
|
|
349
|
-
additionalComponents:
|
|
605
|
+
additionalComponents: optional(array(CustomComponentSchema)),
|
|
350
606
|
/**
|
|
351
607
|
* A object of aliases for React built-in hooks.
|
|
352
608
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
353
609
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
354
610
|
*/
|
|
355
|
-
additionalHooks:
|
|
356
|
-
use:
|
|
357
|
-
useActionState:
|
|
358
|
-
useCallback:
|
|
359
|
-
useContext:
|
|
360
|
-
useDebugValue:
|
|
361
|
-
useDeferredValue:
|
|
362
|
-
useEffect:
|
|
363
|
-
useFormStatus:
|
|
364
|
-
useId:
|
|
365
|
-
useImperativeHandle:
|
|
366
|
-
useInsertionEffect:
|
|
367
|
-
useLayoutEffect:
|
|
368
|
-
useMemo:
|
|
369
|
-
useOptimistic:
|
|
370
|
-
useReducer:
|
|
371
|
-
useRef:
|
|
372
|
-
useState:
|
|
373
|
-
useSyncExternalStore:
|
|
374
|
-
useTransition:
|
|
611
|
+
additionalHooks: optional(object({
|
|
612
|
+
use: optional(array(string())),
|
|
613
|
+
useActionState: optional(array(string())),
|
|
614
|
+
useCallback: optional(array(string())),
|
|
615
|
+
useContext: optional(array(string())),
|
|
616
|
+
useDebugValue: optional(array(string())),
|
|
617
|
+
useDeferredValue: optional(array(string())),
|
|
618
|
+
useEffect: optional(array(string())),
|
|
619
|
+
useFormStatus: optional(array(string())),
|
|
620
|
+
useId: optional(array(string())),
|
|
621
|
+
useImperativeHandle: optional(array(string())),
|
|
622
|
+
useInsertionEffect: optional(array(string())),
|
|
623
|
+
useLayoutEffect: optional(array(string())),
|
|
624
|
+
useMemo: optional(array(string())),
|
|
625
|
+
useOptimistic: optional(array(string())),
|
|
626
|
+
useReducer: optional(array(string())),
|
|
627
|
+
useRef: optional(array(string())),
|
|
628
|
+
useState: optional(array(string())),
|
|
629
|
+
useSyncExternalStore: optional(array(string())),
|
|
630
|
+
useTransition: optional(array(string()))
|
|
375
631
|
}))
|
|
376
632
|
});
|
|
377
|
-
var ESLintSettingsSchema =
|
|
378
|
-
|
|
379
|
-
"react-x":
|
|
633
|
+
var ESLintSettingsSchema = optional(
|
|
634
|
+
object({
|
|
635
|
+
"react-x": optional(ESLintReactSettingsSchema),
|
|
380
636
|
/** @deprecated Use `react-x` instead */
|
|
381
|
-
reactOptions:
|
|
637
|
+
reactOptions: optional(ESLintReactSettingsSchema)
|
|
382
638
|
}),
|
|
383
639
|
{}
|
|
384
640
|
);
|
|
385
641
|
|
|
386
|
-
//
|
|
387
|
-
var
|
|
642
|
+
// ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
|
|
643
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
644
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
645
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
646
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
647
|
+
return function isEqual(a, b, state) {
|
|
648
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function createIsCircular(areItemsEqual) {
|
|
652
|
+
return function isCircular(a, b, state) {
|
|
653
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
654
|
+
return areItemsEqual(a, b, state);
|
|
655
|
+
}
|
|
656
|
+
var cache = state.cache;
|
|
657
|
+
var cachedA = cache.get(a);
|
|
658
|
+
var cachedB = cache.get(b);
|
|
659
|
+
if (cachedA && cachedB) {
|
|
660
|
+
return cachedA === b && cachedB === a;
|
|
661
|
+
}
|
|
662
|
+
cache.set(a, b);
|
|
663
|
+
cache.set(b, a);
|
|
664
|
+
var result = areItemsEqual(a, b, state);
|
|
665
|
+
cache.delete(a);
|
|
666
|
+
cache.delete(b);
|
|
667
|
+
return result;
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function getStrictProperties(object2) {
|
|
671
|
+
return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
|
|
672
|
+
}
|
|
673
|
+
var hasOwn = Object.hasOwn || function(object2, property) {
|
|
674
|
+
return hasOwnProperty.call(object2, property);
|
|
675
|
+
};
|
|
676
|
+
function sameValueZeroEqual(a, b) {
|
|
677
|
+
return a === b || !a && !b && a !== a && b !== b;
|
|
678
|
+
}
|
|
679
|
+
var PREACT_VNODE = "__v";
|
|
680
|
+
var PREACT_OWNER = "__o";
|
|
681
|
+
var REACT_OWNER = "_owner";
|
|
682
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
683
|
+
var keys = Object.keys;
|
|
684
|
+
function areArraysEqual(a, b, state) {
|
|
685
|
+
var index = a.length;
|
|
686
|
+
if (b.length !== index) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
while (index-- > 0) {
|
|
690
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
function areDatesEqual(a, b) {
|
|
697
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
|
698
|
+
}
|
|
699
|
+
function areErrorsEqual(a, b) {
|
|
700
|
+
return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
|
|
701
|
+
}
|
|
702
|
+
function areFunctionsEqual(a, b) {
|
|
703
|
+
return a === b;
|
|
704
|
+
}
|
|
705
|
+
function areMapsEqual(a, b, state) {
|
|
706
|
+
var size = a.size;
|
|
707
|
+
if (size !== b.size) {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
if (!size) {
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
var matchedIndices = new Array(size);
|
|
714
|
+
var aIterable = a.entries();
|
|
715
|
+
var aResult;
|
|
716
|
+
var bResult;
|
|
717
|
+
var index = 0;
|
|
718
|
+
while (aResult = aIterable.next()) {
|
|
719
|
+
if (aResult.done) {
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
722
|
+
var bIterable = b.entries();
|
|
723
|
+
var hasMatch = false;
|
|
724
|
+
var matchIndex = 0;
|
|
725
|
+
while (bResult = bIterable.next()) {
|
|
726
|
+
if (bResult.done) {
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
if (matchedIndices[matchIndex]) {
|
|
730
|
+
matchIndex++;
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
var aEntry = aResult.value;
|
|
734
|
+
var bEntry = bResult.value;
|
|
735
|
+
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
736
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
matchIndex++;
|
|
740
|
+
}
|
|
741
|
+
if (!hasMatch) {
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
index++;
|
|
745
|
+
}
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
var areNumbersEqual = sameValueZeroEqual;
|
|
749
|
+
function areObjectsEqual(a, b, state) {
|
|
750
|
+
var properties = keys(a);
|
|
751
|
+
var index = properties.length;
|
|
752
|
+
if (keys(b).length !== index) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
while (index-- > 0) {
|
|
756
|
+
if (!isPropertyEqual(a, b, state, properties[index])) {
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return true;
|
|
761
|
+
}
|
|
762
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
763
|
+
var properties = getStrictProperties(a);
|
|
764
|
+
var index = properties.length;
|
|
765
|
+
if (getStrictProperties(b).length !== index) {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
768
|
+
var property;
|
|
769
|
+
var descriptorA;
|
|
770
|
+
var descriptorB;
|
|
771
|
+
while (index-- > 0) {
|
|
772
|
+
property = properties[index];
|
|
773
|
+
if (!isPropertyEqual(a, b, state, property)) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
777
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
778
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
|
779
|
+
return false;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return true;
|
|
783
|
+
}
|
|
784
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
785
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
|
786
|
+
}
|
|
787
|
+
function areRegExpsEqual(a, b) {
|
|
788
|
+
return a.source === b.source && a.flags === b.flags;
|
|
789
|
+
}
|
|
790
|
+
function areSetsEqual(a, b, state) {
|
|
791
|
+
var size = a.size;
|
|
792
|
+
if (size !== b.size) {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
if (!size) {
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
var matchedIndices = new Array(size);
|
|
799
|
+
var aIterable = a.values();
|
|
800
|
+
var aResult;
|
|
801
|
+
var bResult;
|
|
802
|
+
while (aResult = aIterable.next()) {
|
|
803
|
+
if (aResult.done) {
|
|
804
|
+
break;
|
|
805
|
+
}
|
|
806
|
+
var bIterable = b.values();
|
|
807
|
+
var hasMatch = false;
|
|
808
|
+
var matchIndex = 0;
|
|
809
|
+
while (bResult = bIterable.next()) {
|
|
810
|
+
if (bResult.done) {
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
814
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
matchIndex++;
|
|
818
|
+
}
|
|
819
|
+
if (!hasMatch) {
|
|
820
|
+
return false;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
function areTypedArraysEqual(a, b) {
|
|
826
|
+
var index = a.length;
|
|
827
|
+
if (b.length !== index) {
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
while (index-- > 0) {
|
|
831
|
+
if (a[index] !== b[index]) {
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return true;
|
|
836
|
+
}
|
|
837
|
+
function areUrlsEqual(a, b) {
|
|
838
|
+
return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
|
|
839
|
+
}
|
|
840
|
+
function isPropertyEqual(a, b, state, property) {
|
|
841
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
|
|
842
|
+
return true;
|
|
843
|
+
}
|
|
844
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
845
|
+
}
|
|
846
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
|
847
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
|
848
|
+
var DATE_TAG = "[object Date]";
|
|
849
|
+
var ERROR_TAG = "[object Error]";
|
|
850
|
+
var MAP_TAG = "[object Map]";
|
|
851
|
+
var NUMBER_TAG = "[object Number]";
|
|
852
|
+
var OBJECT_TAG = "[object Object]";
|
|
853
|
+
var REG_EXP_TAG = "[object RegExp]";
|
|
854
|
+
var SET_TAG = "[object Set]";
|
|
855
|
+
var STRING_TAG = "[object String]";
|
|
856
|
+
var URL_TAG = "[object URL]";
|
|
857
|
+
var isArray = Array.isArray;
|
|
858
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
|
859
|
+
var assign = Object.assign;
|
|
860
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
861
|
+
function createEqualityComparator(_a) {
|
|
862
|
+
var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual;
|
|
863
|
+
return function comparator(a, b, state) {
|
|
864
|
+
if (a === b) {
|
|
865
|
+
return true;
|
|
866
|
+
}
|
|
867
|
+
if (a == null || b == null) {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
var type = typeof a;
|
|
871
|
+
if (type !== typeof b) {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
874
|
+
if (type !== "object") {
|
|
875
|
+
if (type === "number") {
|
|
876
|
+
return areNumbersEqual2(a, b, state);
|
|
877
|
+
}
|
|
878
|
+
if (type === "function") {
|
|
879
|
+
return areFunctionsEqual2(a, b, state);
|
|
880
|
+
}
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
var constructor = a.constructor;
|
|
884
|
+
if (constructor !== b.constructor) {
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
if (constructor === Object) {
|
|
888
|
+
return areObjectsEqual2(a, b, state);
|
|
889
|
+
}
|
|
890
|
+
if (isArray(a)) {
|
|
891
|
+
return areArraysEqual2(a, b, state);
|
|
892
|
+
}
|
|
893
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
|
894
|
+
return areTypedArraysEqual2(a, b, state);
|
|
895
|
+
}
|
|
896
|
+
if (constructor === Date) {
|
|
897
|
+
return areDatesEqual2(a, b, state);
|
|
898
|
+
}
|
|
899
|
+
if (constructor === RegExp) {
|
|
900
|
+
return areRegExpsEqual2(a, b, state);
|
|
901
|
+
}
|
|
902
|
+
if (constructor === Map) {
|
|
903
|
+
return areMapsEqual2(a, b, state);
|
|
904
|
+
}
|
|
905
|
+
if (constructor === Set) {
|
|
906
|
+
return areSetsEqual2(a, b, state);
|
|
907
|
+
}
|
|
908
|
+
var tag = getTag(a);
|
|
909
|
+
if (tag === DATE_TAG) {
|
|
910
|
+
return areDatesEqual2(a, b, state);
|
|
911
|
+
}
|
|
912
|
+
if (tag === REG_EXP_TAG) {
|
|
913
|
+
return areRegExpsEqual2(a, b, state);
|
|
914
|
+
}
|
|
915
|
+
if (tag === MAP_TAG) {
|
|
916
|
+
return areMapsEqual2(a, b, state);
|
|
917
|
+
}
|
|
918
|
+
if (tag === SET_TAG) {
|
|
919
|
+
return areSetsEqual2(a, b, state);
|
|
920
|
+
}
|
|
921
|
+
if (tag === OBJECT_TAG) {
|
|
922
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
|
923
|
+
}
|
|
924
|
+
if (tag === URL_TAG) {
|
|
925
|
+
return areUrlsEqual2(a, b, state);
|
|
926
|
+
}
|
|
927
|
+
if (tag === ERROR_TAG) {
|
|
928
|
+
return areErrorsEqual2(a, b, state);
|
|
929
|
+
}
|
|
930
|
+
if (tag === ARGUMENTS_TAG) {
|
|
931
|
+
return areObjectsEqual2(a, b, state);
|
|
932
|
+
}
|
|
933
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
|
934
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
|
935
|
+
}
|
|
936
|
+
return false;
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function createEqualityComparatorConfig(_a) {
|
|
940
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
|
941
|
+
var config = {
|
|
942
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
943
|
+
areDatesEqual,
|
|
944
|
+
areErrorsEqual,
|
|
945
|
+
areFunctionsEqual,
|
|
946
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
947
|
+
areNumbersEqual,
|
|
948
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
949
|
+
arePrimitiveWrappersEqual,
|
|
950
|
+
areRegExpsEqual,
|
|
951
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
952
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
|
|
953
|
+
areUrlsEqual
|
|
954
|
+
};
|
|
955
|
+
if (createCustomConfig) {
|
|
956
|
+
config = assign({}, config, createCustomConfig(config));
|
|
957
|
+
}
|
|
958
|
+
if (circular) {
|
|
959
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
|
960
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
|
961
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
|
962
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
|
963
|
+
config = assign({}, config, {
|
|
964
|
+
areArraysEqual: areArraysEqual$1,
|
|
965
|
+
areMapsEqual: areMapsEqual$1,
|
|
966
|
+
areObjectsEqual: areObjectsEqual$1,
|
|
967
|
+
areSetsEqual: areSetsEqual$1
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
return config;
|
|
971
|
+
}
|
|
972
|
+
function createInternalEqualityComparator(compare) {
|
|
973
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
974
|
+
return compare(a, b, state);
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function createIsEqual(_a) {
|
|
978
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
979
|
+
if (createState) {
|
|
980
|
+
return function isEqual(a, b) {
|
|
981
|
+
var _a2 = createState(), _b = _a2.cache, cache = _b === undefined ? circular ? /* @__PURE__ */ new WeakMap() : undefined : _b, meta = _a2.meta;
|
|
982
|
+
return comparator(a, b, {
|
|
983
|
+
cache,
|
|
984
|
+
equals,
|
|
985
|
+
meta,
|
|
986
|
+
strict
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
if (circular) {
|
|
991
|
+
return function isEqual(a, b) {
|
|
992
|
+
return comparator(a, b, {
|
|
993
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
|
994
|
+
equals,
|
|
995
|
+
meta: undefined,
|
|
996
|
+
strict
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
var state = {
|
|
1001
|
+
cache: undefined,
|
|
1002
|
+
equals,
|
|
1003
|
+
meta: undefined,
|
|
1004
|
+
strict
|
|
1005
|
+
};
|
|
1006
|
+
return function isEqual(a, b) {
|
|
1007
|
+
return comparator(a, b, state);
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
createCustomEqual();
|
|
1011
|
+
createCustomEqual({ strict: true });
|
|
1012
|
+
createCustomEqual({ circular: true });
|
|
1013
|
+
createCustomEqual({
|
|
1014
|
+
circular: true,
|
|
1015
|
+
strict: true
|
|
1016
|
+
});
|
|
1017
|
+
var shallowEqual = createCustomEqual({
|
|
1018
|
+
createInternalComparator: function() {
|
|
1019
|
+
return sameValueZeroEqual;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
createCustomEqual({
|
|
1023
|
+
strict: true,
|
|
1024
|
+
createInternalComparator: function() {
|
|
1025
|
+
return sameValueZeroEqual;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
createCustomEqual({
|
|
1029
|
+
circular: true,
|
|
1030
|
+
createInternalComparator: function() {
|
|
1031
|
+
return sameValueZeroEqual;
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
createCustomEqual({
|
|
1035
|
+
circular: true,
|
|
1036
|
+
createInternalComparator: function() {
|
|
1037
|
+
return sameValueZeroEqual;
|
|
1038
|
+
},
|
|
1039
|
+
strict: true
|
|
1040
|
+
});
|
|
1041
|
+
function createCustomEqual(options) {
|
|
1042
|
+
if (options === undefined) {
|
|
1043
|
+
options = {};
|
|
1044
|
+
}
|
|
1045
|
+
var _a = options.circular, circular = _a === undefined ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === undefined ? false : _b;
|
|
1046
|
+
var config = createEqualityComparatorConfig(options);
|
|
1047
|
+
var comparator = createEqualityComparator(config);
|
|
1048
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
1049
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
1050
|
+
}
|
|
388
1051
|
|
|
389
|
-
//
|
|
1052
|
+
// ../../node_modules/.pnpm/micro-memoize@4.1.3/node_modules/micro-memoize/dist/micro-memoize.esm.js
|
|
1053
|
+
var DEFAULT_OPTIONS_KEYS = {
|
|
1054
|
+
isEqual: true,
|
|
1055
|
+
isMatchingKey: true,
|
|
1056
|
+
isPromise: true,
|
|
1057
|
+
maxSize: true,
|
|
1058
|
+
onCacheAdd: true,
|
|
1059
|
+
onCacheChange: true,
|
|
1060
|
+
onCacheHit: true,
|
|
1061
|
+
transformKey: true
|
|
1062
|
+
};
|
|
1063
|
+
var slice = Array.prototype.slice;
|
|
1064
|
+
function cloneArray(arrayLike) {
|
|
1065
|
+
var length = arrayLike.length;
|
|
1066
|
+
if (!length) {
|
|
1067
|
+
return [];
|
|
1068
|
+
}
|
|
1069
|
+
if (length === 1) {
|
|
1070
|
+
return [arrayLike[0]];
|
|
1071
|
+
}
|
|
1072
|
+
if (length === 2) {
|
|
1073
|
+
return [arrayLike[0], arrayLike[1]];
|
|
1074
|
+
}
|
|
1075
|
+
if (length === 3) {
|
|
1076
|
+
return [arrayLike[0], arrayLike[1], arrayLike[2]];
|
|
1077
|
+
}
|
|
1078
|
+
return slice.call(arrayLike, 0);
|
|
1079
|
+
}
|
|
1080
|
+
function getCustomOptions(options) {
|
|
1081
|
+
var customOptions = {};
|
|
1082
|
+
for (var key in options) {
|
|
1083
|
+
if (!DEFAULT_OPTIONS_KEYS[key]) {
|
|
1084
|
+
customOptions[key] = options[key];
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return customOptions;
|
|
1088
|
+
}
|
|
1089
|
+
function isMemoized(fn) {
|
|
1090
|
+
return typeof fn === "function" && fn.isMemoized;
|
|
1091
|
+
}
|
|
1092
|
+
function isSameValueZero(object1, object2) {
|
|
1093
|
+
return object1 === object2 || object1 !== object1 && object2 !== object2;
|
|
1094
|
+
}
|
|
1095
|
+
function mergeOptions(existingOptions, newOptions) {
|
|
1096
|
+
var target = {};
|
|
1097
|
+
for (var key in existingOptions) {
|
|
1098
|
+
target[key] = existingOptions[key];
|
|
1099
|
+
}
|
|
1100
|
+
for (var key in newOptions) {
|
|
1101
|
+
target[key] = newOptions[key];
|
|
1102
|
+
}
|
|
1103
|
+
return target;
|
|
1104
|
+
}
|
|
1105
|
+
var Cache = (
|
|
1106
|
+
/** @class */
|
|
1107
|
+
function() {
|
|
1108
|
+
function Cache2(options) {
|
|
1109
|
+
this.keys = [];
|
|
1110
|
+
this.values = [];
|
|
1111
|
+
this.options = options;
|
|
1112
|
+
var isMatchingKeyFunction = typeof options.isMatchingKey === "function";
|
|
1113
|
+
if (isMatchingKeyFunction) {
|
|
1114
|
+
this.getKeyIndex = this._getKeyIndexFromMatchingKey;
|
|
1115
|
+
} else if (options.maxSize > 1) {
|
|
1116
|
+
this.getKeyIndex = this._getKeyIndexForMany;
|
|
1117
|
+
} else {
|
|
1118
|
+
this.getKeyIndex = this._getKeyIndexForSingle;
|
|
1119
|
+
}
|
|
1120
|
+
this.canTransformKey = typeof options.transformKey === "function";
|
|
1121
|
+
this.shouldCloneArguments = this.canTransformKey || isMatchingKeyFunction;
|
|
1122
|
+
this.shouldUpdateOnAdd = typeof options.onCacheAdd === "function";
|
|
1123
|
+
this.shouldUpdateOnChange = typeof options.onCacheChange === "function";
|
|
1124
|
+
this.shouldUpdateOnHit = typeof options.onCacheHit === "function";
|
|
1125
|
+
}
|
|
1126
|
+
Object.defineProperty(Cache2.prototype, "size", {
|
|
1127
|
+
/**
|
|
1128
|
+
* The number of cached [key,value] results.
|
|
1129
|
+
*/
|
|
1130
|
+
get: function() {
|
|
1131
|
+
return this.keys.length;
|
|
1132
|
+
},
|
|
1133
|
+
enumerable: false,
|
|
1134
|
+
configurable: true
|
|
1135
|
+
});
|
|
1136
|
+
Object.defineProperty(Cache2.prototype, "snapshot", {
|
|
1137
|
+
/**
|
|
1138
|
+
* A copy of the cache at a moment in time. This is useful
|
|
1139
|
+
* to compare changes over time, since the cache mutates
|
|
1140
|
+
* internally for performance reasons.
|
|
1141
|
+
*/
|
|
1142
|
+
get: function() {
|
|
1143
|
+
return {
|
|
1144
|
+
keys: cloneArray(this.keys),
|
|
1145
|
+
size: this.size,
|
|
1146
|
+
values: cloneArray(this.values)
|
|
1147
|
+
};
|
|
1148
|
+
},
|
|
1149
|
+
enumerable: false,
|
|
1150
|
+
configurable: true
|
|
1151
|
+
});
|
|
1152
|
+
Cache2.prototype._getKeyIndexFromMatchingKey = function(keyToMatch) {
|
|
1153
|
+
var _a = this.options, isMatchingKey = _a.isMatchingKey, maxSize = _a.maxSize;
|
|
1154
|
+
var keys2 = this.keys;
|
|
1155
|
+
var keysLength = keys2.length;
|
|
1156
|
+
if (!keysLength) {
|
|
1157
|
+
return -1;
|
|
1158
|
+
}
|
|
1159
|
+
if (isMatchingKey(keys2[0], keyToMatch)) {
|
|
1160
|
+
return 0;
|
|
1161
|
+
}
|
|
1162
|
+
if (maxSize > 1) {
|
|
1163
|
+
for (var index = 1; index < keysLength; index++) {
|
|
1164
|
+
if (isMatchingKey(keys2[index], keyToMatch)) {
|
|
1165
|
+
return index;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return -1;
|
|
1170
|
+
};
|
|
1171
|
+
Cache2.prototype._getKeyIndexForMany = function(keyToMatch) {
|
|
1172
|
+
var isEqual = this.options.isEqual;
|
|
1173
|
+
var keys2 = this.keys;
|
|
1174
|
+
var keysLength = keys2.length;
|
|
1175
|
+
if (!keysLength) {
|
|
1176
|
+
return -1;
|
|
1177
|
+
}
|
|
1178
|
+
if (keysLength === 1) {
|
|
1179
|
+
return this._getKeyIndexForSingle(keyToMatch);
|
|
1180
|
+
}
|
|
1181
|
+
var keyLength = keyToMatch.length;
|
|
1182
|
+
var existingKey;
|
|
1183
|
+
var argIndex;
|
|
1184
|
+
if (keyLength > 1) {
|
|
1185
|
+
for (var index = 0; index < keysLength; index++) {
|
|
1186
|
+
existingKey = keys2[index];
|
|
1187
|
+
if (existingKey.length === keyLength) {
|
|
1188
|
+
argIndex = 0;
|
|
1189
|
+
for (; argIndex < keyLength; argIndex++) {
|
|
1190
|
+
if (!isEqual(existingKey[argIndex], keyToMatch[argIndex])) {
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
if (argIndex === keyLength) {
|
|
1195
|
+
return index;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
} else {
|
|
1200
|
+
for (var index = 0; index < keysLength; index++) {
|
|
1201
|
+
existingKey = keys2[index];
|
|
1202
|
+
if (existingKey.length === keyLength && isEqual(existingKey[0], keyToMatch[0])) {
|
|
1203
|
+
return index;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return -1;
|
|
1208
|
+
};
|
|
1209
|
+
Cache2.prototype._getKeyIndexForSingle = function(keyToMatch) {
|
|
1210
|
+
var keys2 = this.keys;
|
|
1211
|
+
if (!keys2.length) {
|
|
1212
|
+
return -1;
|
|
1213
|
+
}
|
|
1214
|
+
var existingKey = keys2[0];
|
|
1215
|
+
var length = existingKey.length;
|
|
1216
|
+
if (keyToMatch.length !== length) {
|
|
1217
|
+
return -1;
|
|
1218
|
+
}
|
|
1219
|
+
var isEqual = this.options.isEqual;
|
|
1220
|
+
if (length > 1) {
|
|
1221
|
+
for (var index = 0; index < length; index++) {
|
|
1222
|
+
if (!isEqual(existingKey[index], keyToMatch[index])) {
|
|
1223
|
+
return -1;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return 0;
|
|
1227
|
+
}
|
|
1228
|
+
return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
|
|
1229
|
+
};
|
|
1230
|
+
Cache2.prototype.orderByLru = function(key, value, startingIndex) {
|
|
1231
|
+
var keys2 = this.keys;
|
|
1232
|
+
var values = this.values;
|
|
1233
|
+
var currentLength = keys2.length;
|
|
1234
|
+
var index = startingIndex;
|
|
1235
|
+
while (index--) {
|
|
1236
|
+
keys2[index + 1] = keys2[index];
|
|
1237
|
+
values[index + 1] = values[index];
|
|
1238
|
+
}
|
|
1239
|
+
keys2[0] = key;
|
|
1240
|
+
values[0] = value;
|
|
1241
|
+
var maxSize = this.options.maxSize;
|
|
1242
|
+
if (currentLength === maxSize && startingIndex === currentLength) {
|
|
1243
|
+
keys2.pop();
|
|
1244
|
+
values.pop();
|
|
1245
|
+
} else if (startingIndex >= maxSize) {
|
|
1246
|
+
keys2.length = values.length = maxSize;
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
Cache2.prototype.updateAsyncCache = function(memoized) {
|
|
1250
|
+
var _this = this;
|
|
1251
|
+
var _a = this.options, onCacheChange = _a.onCacheChange, onCacheHit = _a.onCacheHit;
|
|
1252
|
+
var firstKey = this.keys[0];
|
|
1253
|
+
var firstValue = this.values[0];
|
|
1254
|
+
this.values[0] = firstValue.then(function(value) {
|
|
1255
|
+
if (_this.shouldUpdateOnHit) {
|
|
1256
|
+
onCacheHit(_this, _this.options, memoized);
|
|
1257
|
+
}
|
|
1258
|
+
if (_this.shouldUpdateOnChange) {
|
|
1259
|
+
onCacheChange(_this, _this.options, memoized);
|
|
1260
|
+
}
|
|
1261
|
+
return value;
|
|
1262
|
+
}, function(error) {
|
|
1263
|
+
var keyIndex = _this.getKeyIndex(firstKey);
|
|
1264
|
+
if (keyIndex !== -1) {
|
|
1265
|
+
_this.keys.splice(keyIndex, 1);
|
|
1266
|
+
_this.values.splice(keyIndex, 1);
|
|
1267
|
+
}
|
|
1268
|
+
throw error;
|
|
1269
|
+
});
|
|
1270
|
+
};
|
|
1271
|
+
return Cache2;
|
|
1272
|
+
}()
|
|
1273
|
+
);
|
|
1274
|
+
function createMemoizedFunction(fn, options) {
|
|
1275
|
+
if (options === undefined) {
|
|
1276
|
+
options = {};
|
|
1277
|
+
}
|
|
1278
|
+
if (isMemoized(fn)) {
|
|
1279
|
+
return createMemoizedFunction(fn.fn, mergeOptions(fn.options, options));
|
|
1280
|
+
}
|
|
1281
|
+
if (typeof fn !== "function") {
|
|
1282
|
+
throw new TypeError("You must pass a function to `memoize`.");
|
|
1283
|
+
}
|
|
1284
|
+
var _a = options.isEqual, isEqual = _a === undefined ? isSameValueZero : _a, isMatchingKey = options.isMatchingKey, _b = options.isPromise, isPromise = _b === undefined ? false : _b, _c = options.maxSize, maxSize = _c === undefined ? 1 : _c, onCacheAdd = options.onCacheAdd, onCacheChange = options.onCacheChange, onCacheHit = options.onCacheHit, transformKey = options.transformKey;
|
|
1285
|
+
var normalizedOptions = mergeOptions({
|
|
1286
|
+
isEqual,
|
|
1287
|
+
isMatchingKey,
|
|
1288
|
+
isPromise,
|
|
1289
|
+
maxSize,
|
|
1290
|
+
onCacheAdd,
|
|
1291
|
+
onCacheChange,
|
|
1292
|
+
onCacheHit,
|
|
1293
|
+
transformKey
|
|
1294
|
+
}, getCustomOptions(options));
|
|
1295
|
+
var cache = new Cache(normalizedOptions);
|
|
1296
|
+
var keys2 = cache.keys, values = cache.values, canTransformKey = cache.canTransformKey, shouldCloneArguments = cache.shouldCloneArguments, shouldUpdateOnAdd = cache.shouldUpdateOnAdd, shouldUpdateOnChange = cache.shouldUpdateOnChange, shouldUpdateOnHit = cache.shouldUpdateOnHit;
|
|
1297
|
+
var memoized = function() {
|
|
1298
|
+
var key = shouldCloneArguments ? cloneArray(arguments) : arguments;
|
|
1299
|
+
if (canTransformKey) {
|
|
1300
|
+
key = transformKey(key);
|
|
1301
|
+
}
|
|
1302
|
+
var keyIndex = keys2.length ? cache.getKeyIndex(key) : -1;
|
|
1303
|
+
if (keyIndex !== -1) {
|
|
1304
|
+
if (shouldUpdateOnHit) {
|
|
1305
|
+
onCacheHit(cache, normalizedOptions, memoized);
|
|
1306
|
+
}
|
|
1307
|
+
if (keyIndex) {
|
|
1308
|
+
cache.orderByLru(keys2[keyIndex], values[keyIndex], keyIndex);
|
|
1309
|
+
if (shouldUpdateOnChange) {
|
|
1310
|
+
onCacheChange(cache, normalizedOptions, memoized);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
} else {
|
|
1314
|
+
var newValue = fn.apply(this, arguments);
|
|
1315
|
+
var newKey = shouldCloneArguments ? key : cloneArray(arguments);
|
|
1316
|
+
cache.orderByLru(newKey, newValue, keys2.length);
|
|
1317
|
+
if (isPromise) {
|
|
1318
|
+
cache.updateAsyncCache(memoized);
|
|
1319
|
+
}
|
|
1320
|
+
if (shouldUpdateOnAdd) {
|
|
1321
|
+
onCacheAdd(cache, normalizedOptions, memoized);
|
|
1322
|
+
}
|
|
1323
|
+
if (shouldUpdateOnChange) {
|
|
1324
|
+
onCacheChange(cache, normalizedOptions, memoized);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
return values[0];
|
|
1328
|
+
};
|
|
1329
|
+
memoized.cache = cache;
|
|
1330
|
+
memoized.fn = fn;
|
|
1331
|
+
memoized.isMemoized = true;
|
|
1332
|
+
memoized.options = normalizedOptions;
|
|
1333
|
+
return memoized;
|
|
1334
|
+
}
|
|
390
1335
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
391
1336
|
additionalHooks: {
|
|
392
1337
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
@@ -395,20 +1340,19 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
395
1340
|
strictImportCheck: false,
|
|
396
1341
|
version: "detect"
|
|
397
1342
|
};
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return memoized;
|
|
404
|
-
}
|
|
405
|
-
const rawWithDefaults = {
|
|
1343
|
+
function unsafeDecodeSettings(data) {
|
|
1344
|
+
return data?.["react-x"] ?? {};
|
|
1345
|
+
}
|
|
1346
|
+
var decodeSettings = createMemoizedFunction((data) => {
|
|
1347
|
+
return {
|
|
406
1348
|
...DEFAULT_ESLINT_REACT_SETTINGS,
|
|
407
|
-
...
|
|
1349
|
+
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
408
1350
|
};
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
1351
|
+
}, { isEqual: (a, b) => a === b });
|
|
1352
|
+
var normalizeSettings = createMemoizedFunction((settings) => {
|
|
1353
|
+
const additionalComponents = settings.additionalComponents ?? [];
|
|
1354
|
+
return {
|
|
1355
|
+
...settings,
|
|
412
1356
|
additionalComponents: additionalComponents.map((component) => ({
|
|
413
1357
|
...component,
|
|
414
1358
|
attributes: component.attributes?.map((attr) => ({
|
|
@@ -423,10 +1367,11 @@ function getSettingsFromContext(context) {
|
|
|
423
1367
|
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
424
1368
|
return acc.set(name, as);
|
|
425
1369
|
}, /* @__PURE__ */ new Map()),
|
|
426
|
-
version: tsPattern.match(
|
|
1370
|
+
version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => eff.E.getOrElse(getReactVersion(), eff.F.constant("19.0.0"))).otherwise(eff.F.identity)
|
|
427
1371
|
};
|
|
428
|
-
|
|
429
|
-
|
|
1372
|
+
}, { isEqual: shallowEqual });
|
|
1373
|
+
function getSettingsFromContext(context) {
|
|
1374
|
+
return normalizeSettings(decodeSettings(context.settings));
|
|
430
1375
|
}
|
|
431
1376
|
var defineSettings = eff.F.identity;
|
|
432
1377
|
|
|
@@ -435,11 +1380,11 @@ exports.CustomComponentNormalizedSchema = CustomComponentNormalizedSchema;
|
|
|
435
1380
|
exports.CustomComponentSchema = CustomComponentSchema;
|
|
436
1381
|
exports.CustomHookSchema = CustomHookSchema;
|
|
437
1382
|
exports.DEFAULT_ESLINT_REACT_SETTINGS = DEFAULT_ESLINT_REACT_SETTINGS;
|
|
1383
|
+
exports.DOM_HTML_COMPONENT_TYPES = DOM_HTML_COMPONENT_TYPES;
|
|
1384
|
+
exports.DOM_SVG_COMPONENT_TYPES = DOM_SVG_COMPONENT_TYPES;
|
|
438
1385
|
exports.ESLintReactSettingsSchema = ESLintReactSettingsSchema;
|
|
439
1386
|
exports.ESLintSettingsSchema = ESLintSettingsSchema;
|
|
440
1387
|
exports.GITHUB_URL = GITHUB_URL;
|
|
441
|
-
exports.HOST_HTML_COMPONENT_TYPES = HOST_HTML_COMPONENT_TYPES;
|
|
442
|
-
exports.HOST_SVG_COMPONENT_TYPES = HOST_SVG_COMPONENT_TYPES;
|
|
443
1388
|
exports.NPM_SCOPE = NPM_SCOPE;
|
|
444
1389
|
exports.REACT_BUILD_IN_HOOKS = REACT_BUILD_IN_HOOKS;
|
|
445
1390
|
exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
|
|
@@ -450,6 +1395,11 @@ exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
|
|
|
450
1395
|
exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
|
|
451
1396
|
exports.WEBSITE_URL = WEBSITE_URL;
|
|
452
1397
|
exports.createRuleForPlugin = createRuleForPlugin;
|
|
1398
|
+
exports.decodeSettings = decodeSettings;
|
|
453
1399
|
exports.defineSettings = defineSettings;
|
|
454
1400
|
exports.getReactVersion = getReactVersion;
|
|
455
1401
|
exports.getSettingsFromContext = getSettingsFromContext;
|
|
1402
|
+
exports.normalizeSettings = normalizeSettings;
|
|
1403
|
+
exports.normalizedSettingsCache = normalizedSettingsCache;
|
|
1404
|
+
exports.tryRequire = tryRequire;
|
|
1405
|
+
exports.unsafeDecodeSettings = unsafeDecodeSettings;
|