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