@eslint-react/shared 1.23.1 → 1.23.2-beta.6

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.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- import { E, F } from '@eslint-react/eff';
3
- import { match, P, isMatching } from 'ts-pattern';
2
+ import { F, E } from '@eslint-react/eff';
3
+ import { isMatching, P, match } from 'ts-pattern';
4
4
  import module from 'node:module';
5
- import { object, string, optional, boolean, array, instance, parse } from 'valibot';
6
- import { shallowEqual } from 'fast-equals';
7
- import memoize from 'micro-memoize';
8
5
  import pm from 'picomatch';
9
6
 
7
+ // src/cache.ts
8
+ var normalizedSettingsCache = /* @__PURE__ */ new WeakMap();
9
+
10
10
  // src/constants.ts
11
11
  var NPM_SCOPE = "@eslint-react";
12
12
  var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
@@ -231,6 +231,260 @@ function getReactVersion(at = import.meta.url) {
231
231
  E.map((mod) => mod.version)
232
232
  );
233
233
  }
234
+
235
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
236
+ var store;
237
+ // @__NO_SIDE_EFFECTS__
238
+ function getGlobalConfig(config2) {
239
+ return {
240
+ lang: config2?.lang ?? store?.lang,
241
+ message: config2?.message,
242
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
243
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
244
+ };
245
+ }
246
+ // @__NO_SIDE_EFFECTS__
247
+ function _getStandardProps(context) {
248
+ return {
249
+ version: 1,
250
+ vendor: "valibot",
251
+ validate(value2) {
252
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
253
+ }
254
+ };
255
+ }
256
+ var ValiError = class extends Error {
257
+ /**
258
+ * Creates a Valibot error with useful information.
259
+ *
260
+ * @param issues The error issues.
261
+ */
262
+ constructor(issues) {
263
+ super(issues[0].message);
264
+ this.name = "ValiError";
265
+ this.issues = issues;
266
+ }
267
+ };
268
+ // @__NO_SIDE_EFFECTS__
269
+ function getDefault(schema, dataset, config2) {
270
+ return typeof schema.default === "function" ? (
271
+ // @ts-expect-error
272
+ schema.default(dataset, config2)
273
+ ) : (
274
+ // @ts-expect-error
275
+ schema.default
276
+ );
277
+ }
278
+ // @__NO_SIDE_EFFECTS__
279
+ function array(item, message) {
280
+ return {
281
+ kind: "schema",
282
+ type: "array",
283
+ reference: array,
284
+ expects: "Array",
285
+ async: false,
286
+ item,
287
+ message,
288
+ get "~standard"() {
289
+ return /* @__PURE__ */ _getStandardProps(this);
290
+ },
291
+ "~run"(dataset, config2) {
292
+ const input = dataset.value;
293
+ if (Array.isArray(input)) {
294
+ dataset.typed = true;
295
+ dataset.value = [];
296
+ for (let key = 0; key < input.length; key++) {
297
+ const value2 = input[key];
298
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
299
+ if (itemDataset.issues) {
300
+ const pathItem = {
301
+ type: "array",
302
+ origin: "value",
303
+ input,
304
+ key,
305
+ value: value2
306
+ };
307
+ for (const issue of itemDataset.issues) {
308
+ if (issue.path) {
309
+ issue.path.unshift(pathItem);
310
+ } else {
311
+ issue.path = [pathItem];
312
+ }
313
+ dataset.issues?.push(issue);
314
+ }
315
+ if (!dataset.issues) {
316
+ dataset.issues = itemDataset.issues;
317
+ }
318
+ if (config2.abortEarly) {
319
+ dataset.typed = false;
320
+ break;
321
+ }
322
+ }
323
+ if (!itemDataset.typed) {
324
+ dataset.typed = false;
325
+ }
326
+ dataset.value.push(itemDataset.value);
327
+ }
328
+ }
329
+ return dataset;
330
+ }
331
+ };
332
+ }
333
+ // @__NO_SIDE_EFFECTS__
334
+ function boolean(message) {
335
+ return {
336
+ kind: "schema",
337
+ type: "boolean",
338
+ reference: boolean,
339
+ expects: "boolean",
340
+ async: false,
341
+ message,
342
+ get "~standard"() {
343
+ return /* @__PURE__ */ _getStandardProps(this);
344
+ },
345
+ "~run"(dataset, config2) {
346
+ if (typeof dataset.value === "boolean") {
347
+ dataset.typed = true;
348
+ }
349
+ return dataset;
350
+ }
351
+ };
352
+ }
353
+ // @__NO_SIDE_EFFECTS__
354
+ function instance(class_, message) {
355
+ return {
356
+ kind: "schema",
357
+ type: "instance",
358
+ reference: instance,
359
+ expects: class_.name,
360
+ async: false,
361
+ class: class_,
362
+ message,
363
+ get "~standard"() {
364
+ return /* @__PURE__ */ _getStandardProps(this);
365
+ },
366
+ "~run"(dataset, config2) {
367
+ if (dataset.value instanceof this.class) {
368
+ dataset.typed = true;
369
+ }
370
+ return dataset;
371
+ }
372
+ };
373
+ }
374
+ // @__NO_SIDE_EFFECTS__
375
+ function object(entries, message) {
376
+ return {
377
+ kind: "schema",
378
+ type: "object",
379
+ reference: object,
380
+ expects: "Object",
381
+ async: false,
382
+ entries,
383
+ message,
384
+ get "~standard"() {
385
+ return /* @__PURE__ */ _getStandardProps(this);
386
+ },
387
+ "~run"(dataset, config2) {
388
+ const input = dataset.value;
389
+ if (input && typeof input === "object") {
390
+ dataset.typed = true;
391
+ dataset.value = {};
392
+ for (const key in this.entries) {
393
+ const value2 = input[key];
394
+ const valueDataset = this.entries[key]["~run"]({ value: value2 }, config2);
395
+ if (valueDataset.issues) {
396
+ const pathItem = {
397
+ type: "object",
398
+ origin: "value",
399
+ input,
400
+ key,
401
+ value: value2
402
+ };
403
+ for (const issue of valueDataset.issues) {
404
+ if (issue.path) {
405
+ issue.path.unshift(pathItem);
406
+ } else {
407
+ issue.path = [pathItem];
408
+ }
409
+ dataset.issues?.push(issue);
410
+ }
411
+ if (!dataset.issues) {
412
+ dataset.issues = valueDataset.issues;
413
+ }
414
+ if (config2.abortEarly) {
415
+ dataset.typed = false;
416
+ break;
417
+ }
418
+ }
419
+ if (!valueDataset.typed) {
420
+ dataset.typed = false;
421
+ }
422
+ if (valueDataset.value !== undefined || key in input) {
423
+ dataset.value[key] = valueDataset.value;
424
+ }
425
+ }
426
+ }
427
+ return dataset;
428
+ }
429
+ };
430
+ }
431
+ // @__NO_SIDE_EFFECTS__
432
+ function optional(wrapped, default_) {
433
+ return {
434
+ kind: "schema",
435
+ type: "optional",
436
+ reference: optional,
437
+ expects: `(${wrapped.expects} | undefined)`,
438
+ async: false,
439
+ wrapped,
440
+ default: default_,
441
+ get "~standard"() {
442
+ return /* @__PURE__ */ _getStandardProps(this);
443
+ },
444
+ "~run"(dataset, config2) {
445
+ if (dataset.value === undefined) {
446
+ if (this.default !== undefined) {
447
+ dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
448
+ }
449
+ if (dataset.value === undefined) {
450
+ dataset.typed = true;
451
+ return dataset;
452
+ }
453
+ }
454
+ return this.wrapped["~run"](dataset, config2);
455
+ }
456
+ };
457
+ }
458
+ // @__NO_SIDE_EFFECTS__
459
+ function string(message) {
460
+ return {
461
+ kind: "schema",
462
+ type: "string",
463
+ reference: string,
464
+ expects: "string",
465
+ async: false,
466
+ message,
467
+ get "~standard"() {
468
+ return /* @__PURE__ */ _getStandardProps(this);
469
+ },
470
+ "~run"(dataset, config2) {
471
+ if (typeof dataset.value === "string") {
472
+ dataset.typed = true;
473
+ }
474
+ return dataset;
475
+ }
476
+ };
477
+ }
478
+ // @__NO_SIDE_EFFECTS__
479
+ function parse(schema, input, config2) {
480
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
481
+ if (dataset.issues) {
482
+ throw new ValiError(dataset.issues);
483
+ }
484
+ return dataset.value;
485
+ }
486
+
487
+ // src/schemas.ts
234
488
  var CustomHookSchema = object({
235
489
  // TODO: Define the schema for custom Hooks
236
490
  });
@@ -376,6 +630,700 @@ var ESLintSettingsSchema = optional(
376
630
  }),
377
631
  {}
378
632
  );
633
+
634
+ // ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
635
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
636
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
637
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
638
+ function combineComparators(comparatorA, comparatorB) {
639
+ return function isEqual(a, b, state) {
640
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
641
+ };
642
+ }
643
+ function createIsCircular(areItemsEqual) {
644
+ return function isCircular(a, b, state) {
645
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") {
646
+ return areItemsEqual(a, b, state);
647
+ }
648
+ var cache = state.cache;
649
+ var cachedA = cache.get(a);
650
+ var cachedB = cache.get(b);
651
+ if (cachedA && cachedB) {
652
+ return cachedA === b && cachedB === a;
653
+ }
654
+ cache.set(a, b);
655
+ cache.set(b, a);
656
+ var result = areItemsEqual(a, b, state);
657
+ cache.delete(a);
658
+ cache.delete(b);
659
+ return result;
660
+ };
661
+ }
662
+ function getStrictProperties(object2) {
663
+ return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
664
+ }
665
+ var hasOwn = Object.hasOwn || function(object2, property) {
666
+ return hasOwnProperty.call(object2, property);
667
+ };
668
+ function sameValueZeroEqual(a, b) {
669
+ return a === b || !a && !b && a !== a && b !== b;
670
+ }
671
+ var PREACT_VNODE = "__v";
672
+ var PREACT_OWNER = "__o";
673
+ var REACT_OWNER = "_owner";
674
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
675
+ var keys = Object.keys;
676
+ function areArraysEqual(a, b, state) {
677
+ var index = a.length;
678
+ if (b.length !== index) {
679
+ return false;
680
+ }
681
+ while (index-- > 0) {
682
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
683
+ return false;
684
+ }
685
+ }
686
+ return true;
687
+ }
688
+ function areDatesEqual(a, b) {
689
+ return sameValueZeroEqual(a.getTime(), b.getTime());
690
+ }
691
+ function areErrorsEqual(a, b) {
692
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
693
+ }
694
+ function areFunctionsEqual(a, b) {
695
+ return a === b;
696
+ }
697
+ function areMapsEqual(a, b, state) {
698
+ var size = a.size;
699
+ if (size !== b.size) {
700
+ return false;
701
+ }
702
+ if (!size) {
703
+ return true;
704
+ }
705
+ var matchedIndices = new Array(size);
706
+ var aIterable = a.entries();
707
+ var aResult;
708
+ var bResult;
709
+ var index = 0;
710
+ while (aResult = aIterable.next()) {
711
+ if (aResult.done) {
712
+ break;
713
+ }
714
+ var bIterable = b.entries();
715
+ var hasMatch = false;
716
+ var matchIndex = 0;
717
+ while (bResult = bIterable.next()) {
718
+ if (bResult.done) {
719
+ break;
720
+ }
721
+ if (matchedIndices[matchIndex]) {
722
+ matchIndex++;
723
+ continue;
724
+ }
725
+ var aEntry = aResult.value;
726
+ var bEntry = bResult.value;
727
+ 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)) {
728
+ hasMatch = matchedIndices[matchIndex] = true;
729
+ break;
730
+ }
731
+ matchIndex++;
732
+ }
733
+ if (!hasMatch) {
734
+ return false;
735
+ }
736
+ index++;
737
+ }
738
+ return true;
739
+ }
740
+ var areNumbersEqual = sameValueZeroEqual;
741
+ function areObjectsEqual(a, b, state) {
742
+ var properties = keys(a);
743
+ var index = properties.length;
744
+ if (keys(b).length !== index) {
745
+ return false;
746
+ }
747
+ while (index-- > 0) {
748
+ if (!isPropertyEqual(a, b, state, properties[index])) {
749
+ return false;
750
+ }
751
+ }
752
+ return true;
753
+ }
754
+ function areObjectsEqualStrict(a, b, state) {
755
+ var properties = getStrictProperties(a);
756
+ var index = properties.length;
757
+ if (getStrictProperties(b).length !== index) {
758
+ return false;
759
+ }
760
+ var property;
761
+ var descriptorA;
762
+ var descriptorB;
763
+ while (index-- > 0) {
764
+ property = properties[index];
765
+ if (!isPropertyEqual(a, b, state, property)) {
766
+ return false;
767
+ }
768
+ descriptorA = getOwnPropertyDescriptor(a, property);
769
+ descriptorB = getOwnPropertyDescriptor(b, property);
770
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
771
+ return false;
772
+ }
773
+ }
774
+ return true;
775
+ }
776
+ function arePrimitiveWrappersEqual(a, b) {
777
+ return sameValueZeroEqual(a.valueOf(), b.valueOf());
778
+ }
779
+ function areRegExpsEqual(a, b) {
780
+ return a.source === b.source && a.flags === b.flags;
781
+ }
782
+ function areSetsEqual(a, b, state) {
783
+ var size = a.size;
784
+ if (size !== b.size) {
785
+ return false;
786
+ }
787
+ if (!size) {
788
+ return true;
789
+ }
790
+ var matchedIndices = new Array(size);
791
+ var aIterable = a.values();
792
+ var aResult;
793
+ var bResult;
794
+ while (aResult = aIterable.next()) {
795
+ if (aResult.done) {
796
+ break;
797
+ }
798
+ var bIterable = b.values();
799
+ var hasMatch = false;
800
+ var matchIndex = 0;
801
+ while (bResult = bIterable.next()) {
802
+ if (bResult.done) {
803
+ break;
804
+ }
805
+ if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
806
+ hasMatch = matchedIndices[matchIndex] = true;
807
+ break;
808
+ }
809
+ matchIndex++;
810
+ }
811
+ if (!hasMatch) {
812
+ return false;
813
+ }
814
+ }
815
+ return true;
816
+ }
817
+ function areTypedArraysEqual(a, b) {
818
+ var index = a.length;
819
+ if (b.length !== index) {
820
+ return false;
821
+ }
822
+ while (index-- > 0) {
823
+ if (a[index] !== b[index]) {
824
+ return false;
825
+ }
826
+ }
827
+ return true;
828
+ }
829
+ function areUrlsEqual(a, b) {
830
+ 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;
831
+ }
832
+ function isPropertyEqual(a, b, state, property) {
833
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
834
+ return true;
835
+ }
836
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
837
+ }
838
+ var ARGUMENTS_TAG = "[object Arguments]";
839
+ var BOOLEAN_TAG = "[object Boolean]";
840
+ var DATE_TAG = "[object Date]";
841
+ var ERROR_TAG = "[object Error]";
842
+ var MAP_TAG = "[object Map]";
843
+ var NUMBER_TAG = "[object Number]";
844
+ var OBJECT_TAG = "[object Object]";
845
+ var REG_EXP_TAG = "[object RegExp]";
846
+ var SET_TAG = "[object Set]";
847
+ var STRING_TAG = "[object String]";
848
+ var URL_TAG = "[object URL]";
849
+ var isArray = Array.isArray;
850
+ var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
851
+ var assign = Object.assign;
852
+ var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
853
+ function createEqualityComparator(_a) {
854
+ 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;
855
+ return function comparator(a, b, state) {
856
+ if (a === b) {
857
+ return true;
858
+ }
859
+ if (a == null || b == null) {
860
+ return false;
861
+ }
862
+ var type = typeof a;
863
+ if (type !== typeof b) {
864
+ return false;
865
+ }
866
+ if (type !== "object") {
867
+ if (type === "number") {
868
+ return areNumbersEqual2(a, b, state);
869
+ }
870
+ if (type === "function") {
871
+ return areFunctionsEqual2(a, b, state);
872
+ }
873
+ return false;
874
+ }
875
+ var constructor = a.constructor;
876
+ if (constructor !== b.constructor) {
877
+ return false;
878
+ }
879
+ if (constructor === Object) {
880
+ return areObjectsEqual2(a, b, state);
881
+ }
882
+ if (isArray(a)) {
883
+ return areArraysEqual2(a, b, state);
884
+ }
885
+ if (isTypedArray != null && isTypedArray(a)) {
886
+ return areTypedArraysEqual2(a, b, state);
887
+ }
888
+ if (constructor === Date) {
889
+ return areDatesEqual2(a, b, state);
890
+ }
891
+ if (constructor === RegExp) {
892
+ return areRegExpsEqual2(a, b, state);
893
+ }
894
+ if (constructor === Map) {
895
+ return areMapsEqual2(a, b, state);
896
+ }
897
+ if (constructor === Set) {
898
+ return areSetsEqual2(a, b, state);
899
+ }
900
+ var tag = getTag(a);
901
+ if (tag === DATE_TAG) {
902
+ return areDatesEqual2(a, b, state);
903
+ }
904
+ if (tag === REG_EXP_TAG) {
905
+ return areRegExpsEqual2(a, b, state);
906
+ }
907
+ if (tag === MAP_TAG) {
908
+ return areMapsEqual2(a, b, state);
909
+ }
910
+ if (tag === SET_TAG) {
911
+ return areSetsEqual2(a, b, state);
912
+ }
913
+ if (tag === OBJECT_TAG) {
914
+ return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
915
+ }
916
+ if (tag === URL_TAG) {
917
+ return areUrlsEqual2(a, b, state);
918
+ }
919
+ if (tag === ERROR_TAG) {
920
+ return areErrorsEqual2(a, b, state);
921
+ }
922
+ if (tag === ARGUMENTS_TAG) {
923
+ return areObjectsEqual2(a, b, state);
924
+ }
925
+ if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
926
+ return arePrimitiveWrappersEqual2(a, b, state);
927
+ }
928
+ return false;
929
+ };
930
+ }
931
+ function createEqualityComparatorConfig(_a) {
932
+ var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
933
+ var config = {
934
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
935
+ areDatesEqual,
936
+ areErrorsEqual,
937
+ areFunctionsEqual,
938
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
939
+ areNumbersEqual,
940
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
941
+ arePrimitiveWrappersEqual,
942
+ areRegExpsEqual,
943
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
944
+ areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
945
+ areUrlsEqual
946
+ };
947
+ if (createCustomConfig) {
948
+ config = assign({}, config, createCustomConfig(config));
949
+ }
950
+ if (circular) {
951
+ var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
952
+ var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
953
+ var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
954
+ var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
955
+ config = assign({}, config, {
956
+ areArraysEqual: areArraysEqual$1,
957
+ areMapsEqual: areMapsEqual$1,
958
+ areObjectsEqual: areObjectsEqual$1,
959
+ areSetsEqual: areSetsEqual$1
960
+ });
961
+ }
962
+ return config;
963
+ }
964
+ function createInternalEqualityComparator(compare) {
965
+ return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
966
+ return compare(a, b, state);
967
+ };
968
+ }
969
+ function createIsEqual(_a) {
970
+ var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
971
+ if (createState) {
972
+ return function isEqual(a, b) {
973
+ var _a2 = createState(), _b = _a2.cache, cache = _b === undefined ? circular ? /* @__PURE__ */ new WeakMap() : undefined : _b, meta = _a2.meta;
974
+ return comparator(a, b, {
975
+ cache,
976
+ equals,
977
+ meta,
978
+ strict
979
+ });
980
+ };
981
+ }
982
+ if (circular) {
983
+ return function isEqual(a, b) {
984
+ return comparator(a, b, {
985
+ cache: /* @__PURE__ */ new WeakMap(),
986
+ equals,
987
+ meta: undefined,
988
+ strict
989
+ });
990
+ };
991
+ }
992
+ var state = {
993
+ cache: undefined,
994
+ equals,
995
+ meta: undefined,
996
+ strict
997
+ };
998
+ return function isEqual(a, b) {
999
+ return comparator(a, b, state);
1000
+ };
1001
+ }
1002
+ createCustomEqual();
1003
+ createCustomEqual({ strict: true });
1004
+ createCustomEqual({ circular: true });
1005
+ createCustomEqual({
1006
+ circular: true,
1007
+ strict: true
1008
+ });
1009
+ var shallowEqual = createCustomEqual({
1010
+ createInternalComparator: function() {
1011
+ return sameValueZeroEqual;
1012
+ }
1013
+ });
1014
+ createCustomEqual({
1015
+ strict: true,
1016
+ createInternalComparator: function() {
1017
+ return sameValueZeroEqual;
1018
+ }
1019
+ });
1020
+ createCustomEqual({
1021
+ circular: true,
1022
+ createInternalComparator: function() {
1023
+ return sameValueZeroEqual;
1024
+ }
1025
+ });
1026
+ createCustomEqual({
1027
+ circular: true,
1028
+ createInternalComparator: function() {
1029
+ return sameValueZeroEqual;
1030
+ },
1031
+ strict: true
1032
+ });
1033
+ function createCustomEqual(options) {
1034
+ if (options === undefined) {
1035
+ options = {};
1036
+ }
1037
+ var _a = options.circular, circular = _a === undefined ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === undefined ? false : _b;
1038
+ var config = createEqualityComparatorConfig(options);
1039
+ var comparator = createEqualityComparator(config);
1040
+ var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
1041
+ return createIsEqual({ circular, comparator, createState, equals, strict });
1042
+ }
1043
+
1044
+ // ../../node_modules/.pnpm/micro-memoize@4.1.3/node_modules/micro-memoize/dist/micro-memoize.esm.js
1045
+ var DEFAULT_OPTIONS_KEYS = {
1046
+ isEqual: true,
1047
+ isMatchingKey: true,
1048
+ isPromise: true,
1049
+ maxSize: true,
1050
+ onCacheAdd: true,
1051
+ onCacheChange: true,
1052
+ onCacheHit: true,
1053
+ transformKey: true
1054
+ };
1055
+ var slice = Array.prototype.slice;
1056
+ function cloneArray(arrayLike) {
1057
+ var length = arrayLike.length;
1058
+ if (!length) {
1059
+ return [];
1060
+ }
1061
+ if (length === 1) {
1062
+ return [arrayLike[0]];
1063
+ }
1064
+ if (length === 2) {
1065
+ return [arrayLike[0], arrayLike[1]];
1066
+ }
1067
+ if (length === 3) {
1068
+ return [arrayLike[0], arrayLike[1], arrayLike[2]];
1069
+ }
1070
+ return slice.call(arrayLike, 0);
1071
+ }
1072
+ function getCustomOptions(options) {
1073
+ var customOptions = {};
1074
+ for (var key in options) {
1075
+ if (!DEFAULT_OPTIONS_KEYS[key]) {
1076
+ customOptions[key] = options[key];
1077
+ }
1078
+ }
1079
+ return customOptions;
1080
+ }
1081
+ function isMemoized(fn) {
1082
+ return typeof fn === "function" && fn.isMemoized;
1083
+ }
1084
+ function isSameValueZero(object1, object2) {
1085
+ return object1 === object2 || object1 !== object1 && object2 !== object2;
1086
+ }
1087
+ function mergeOptions(existingOptions, newOptions) {
1088
+ var target = {};
1089
+ for (var key in existingOptions) {
1090
+ target[key] = existingOptions[key];
1091
+ }
1092
+ for (var key in newOptions) {
1093
+ target[key] = newOptions[key];
1094
+ }
1095
+ return target;
1096
+ }
1097
+ var Cache = (
1098
+ /** @class */
1099
+ function() {
1100
+ function Cache2(options) {
1101
+ this.keys = [];
1102
+ this.values = [];
1103
+ this.options = options;
1104
+ var isMatchingKeyFunction = typeof options.isMatchingKey === "function";
1105
+ if (isMatchingKeyFunction) {
1106
+ this.getKeyIndex = this._getKeyIndexFromMatchingKey;
1107
+ } else if (options.maxSize > 1) {
1108
+ this.getKeyIndex = this._getKeyIndexForMany;
1109
+ } else {
1110
+ this.getKeyIndex = this._getKeyIndexForSingle;
1111
+ }
1112
+ this.canTransformKey = typeof options.transformKey === "function";
1113
+ this.shouldCloneArguments = this.canTransformKey || isMatchingKeyFunction;
1114
+ this.shouldUpdateOnAdd = typeof options.onCacheAdd === "function";
1115
+ this.shouldUpdateOnChange = typeof options.onCacheChange === "function";
1116
+ this.shouldUpdateOnHit = typeof options.onCacheHit === "function";
1117
+ }
1118
+ Object.defineProperty(Cache2.prototype, "size", {
1119
+ /**
1120
+ * The number of cached [key,value] results.
1121
+ */
1122
+ get: function() {
1123
+ return this.keys.length;
1124
+ },
1125
+ enumerable: false,
1126
+ configurable: true
1127
+ });
1128
+ Object.defineProperty(Cache2.prototype, "snapshot", {
1129
+ /**
1130
+ * A copy of the cache at a moment in time. This is useful
1131
+ * to compare changes over time, since the cache mutates
1132
+ * internally for performance reasons.
1133
+ */
1134
+ get: function() {
1135
+ return {
1136
+ keys: cloneArray(this.keys),
1137
+ size: this.size,
1138
+ values: cloneArray(this.values)
1139
+ };
1140
+ },
1141
+ enumerable: false,
1142
+ configurable: true
1143
+ });
1144
+ Cache2.prototype._getKeyIndexFromMatchingKey = function(keyToMatch) {
1145
+ var _a = this.options, isMatchingKey = _a.isMatchingKey, maxSize = _a.maxSize;
1146
+ var keys2 = this.keys;
1147
+ var keysLength = keys2.length;
1148
+ if (!keysLength) {
1149
+ return -1;
1150
+ }
1151
+ if (isMatchingKey(keys2[0], keyToMatch)) {
1152
+ return 0;
1153
+ }
1154
+ if (maxSize > 1) {
1155
+ for (var index = 1; index < keysLength; index++) {
1156
+ if (isMatchingKey(keys2[index], keyToMatch)) {
1157
+ return index;
1158
+ }
1159
+ }
1160
+ }
1161
+ return -1;
1162
+ };
1163
+ Cache2.prototype._getKeyIndexForMany = function(keyToMatch) {
1164
+ var isEqual = this.options.isEqual;
1165
+ var keys2 = this.keys;
1166
+ var keysLength = keys2.length;
1167
+ if (!keysLength) {
1168
+ return -1;
1169
+ }
1170
+ if (keysLength === 1) {
1171
+ return this._getKeyIndexForSingle(keyToMatch);
1172
+ }
1173
+ var keyLength = keyToMatch.length;
1174
+ var existingKey;
1175
+ var argIndex;
1176
+ if (keyLength > 1) {
1177
+ for (var index = 0; index < keysLength; index++) {
1178
+ existingKey = keys2[index];
1179
+ if (existingKey.length === keyLength) {
1180
+ argIndex = 0;
1181
+ for (; argIndex < keyLength; argIndex++) {
1182
+ if (!isEqual(existingKey[argIndex], keyToMatch[argIndex])) {
1183
+ break;
1184
+ }
1185
+ }
1186
+ if (argIndex === keyLength) {
1187
+ return index;
1188
+ }
1189
+ }
1190
+ }
1191
+ } else {
1192
+ for (var index = 0; index < keysLength; index++) {
1193
+ existingKey = keys2[index];
1194
+ if (existingKey.length === keyLength && isEqual(existingKey[0], keyToMatch[0])) {
1195
+ return index;
1196
+ }
1197
+ }
1198
+ }
1199
+ return -1;
1200
+ };
1201
+ Cache2.prototype._getKeyIndexForSingle = function(keyToMatch) {
1202
+ var keys2 = this.keys;
1203
+ if (!keys2.length) {
1204
+ return -1;
1205
+ }
1206
+ var existingKey = keys2[0];
1207
+ var length = existingKey.length;
1208
+ if (keyToMatch.length !== length) {
1209
+ return -1;
1210
+ }
1211
+ var isEqual = this.options.isEqual;
1212
+ if (length > 1) {
1213
+ for (var index = 0; index < length; index++) {
1214
+ if (!isEqual(existingKey[index], keyToMatch[index])) {
1215
+ return -1;
1216
+ }
1217
+ }
1218
+ return 0;
1219
+ }
1220
+ return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
1221
+ };
1222
+ Cache2.prototype.orderByLru = function(key, value, startingIndex) {
1223
+ var keys2 = this.keys;
1224
+ var values = this.values;
1225
+ var currentLength = keys2.length;
1226
+ var index = startingIndex;
1227
+ while (index--) {
1228
+ keys2[index + 1] = keys2[index];
1229
+ values[index + 1] = values[index];
1230
+ }
1231
+ keys2[0] = key;
1232
+ values[0] = value;
1233
+ var maxSize = this.options.maxSize;
1234
+ if (currentLength === maxSize && startingIndex === currentLength) {
1235
+ keys2.pop();
1236
+ values.pop();
1237
+ } else if (startingIndex >= maxSize) {
1238
+ keys2.length = values.length = maxSize;
1239
+ }
1240
+ };
1241
+ Cache2.prototype.updateAsyncCache = function(memoized) {
1242
+ var _this = this;
1243
+ var _a = this.options, onCacheChange = _a.onCacheChange, onCacheHit = _a.onCacheHit;
1244
+ var firstKey = this.keys[0];
1245
+ var firstValue = this.values[0];
1246
+ this.values[0] = firstValue.then(function(value) {
1247
+ if (_this.shouldUpdateOnHit) {
1248
+ onCacheHit(_this, _this.options, memoized);
1249
+ }
1250
+ if (_this.shouldUpdateOnChange) {
1251
+ onCacheChange(_this, _this.options, memoized);
1252
+ }
1253
+ return value;
1254
+ }, function(error) {
1255
+ var keyIndex = _this.getKeyIndex(firstKey);
1256
+ if (keyIndex !== -1) {
1257
+ _this.keys.splice(keyIndex, 1);
1258
+ _this.values.splice(keyIndex, 1);
1259
+ }
1260
+ throw error;
1261
+ });
1262
+ };
1263
+ return Cache2;
1264
+ }()
1265
+ );
1266
+ function createMemoizedFunction(fn, options) {
1267
+ if (options === undefined) {
1268
+ options = {};
1269
+ }
1270
+ if (isMemoized(fn)) {
1271
+ return createMemoizedFunction(fn.fn, mergeOptions(fn.options, options));
1272
+ }
1273
+ if (typeof fn !== "function") {
1274
+ throw new TypeError("You must pass a function to `memoize`.");
1275
+ }
1276
+ 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;
1277
+ var normalizedOptions = mergeOptions({
1278
+ isEqual,
1279
+ isMatchingKey,
1280
+ isPromise,
1281
+ maxSize,
1282
+ onCacheAdd,
1283
+ onCacheChange,
1284
+ onCacheHit,
1285
+ transformKey
1286
+ }, getCustomOptions(options));
1287
+ var cache = new Cache(normalizedOptions);
1288
+ var keys2 = cache.keys, values = cache.values, canTransformKey = cache.canTransformKey, shouldCloneArguments = cache.shouldCloneArguments, shouldUpdateOnAdd = cache.shouldUpdateOnAdd, shouldUpdateOnChange = cache.shouldUpdateOnChange, shouldUpdateOnHit = cache.shouldUpdateOnHit;
1289
+ var memoized = function() {
1290
+ var key = shouldCloneArguments ? cloneArray(arguments) : arguments;
1291
+ if (canTransformKey) {
1292
+ key = transformKey(key);
1293
+ }
1294
+ var keyIndex = keys2.length ? cache.getKeyIndex(key) : -1;
1295
+ if (keyIndex !== -1) {
1296
+ if (shouldUpdateOnHit) {
1297
+ onCacheHit(cache, normalizedOptions, memoized);
1298
+ }
1299
+ if (keyIndex) {
1300
+ cache.orderByLru(keys2[keyIndex], values[keyIndex], keyIndex);
1301
+ if (shouldUpdateOnChange) {
1302
+ onCacheChange(cache, normalizedOptions, memoized);
1303
+ }
1304
+ }
1305
+ } else {
1306
+ var newValue = fn.apply(this, arguments);
1307
+ var newKey = shouldCloneArguments ? key : cloneArray(arguments);
1308
+ cache.orderByLru(newKey, newValue, keys2.length);
1309
+ if (isPromise) {
1310
+ cache.updateAsyncCache(memoized);
1311
+ }
1312
+ if (shouldUpdateOnAdd) {
1313
+ onCacheAdd(cache, normalizedOptions, memoized);
1314
+ }
1315
+ if (shouldUpdateOnChange) {
1316
+ onCacheChange(cache, normalizedOptions, memoized);
1317
+ }
1318
+ }
1319
+ return values[0];
1320
+ };
1321
+ memoized.cache = cache;
1322
+ memoized.fn = fn;
1323
+ memoized.isMemoized = true;
1324
+ memoized.options = normalizedOptions;
1325
+ return memoized;
1326
+ }
379
1327
  var DEFAULT_ESLINT_REACT_SETTINGS = {
380
1328
  additionalHooks: {
381
1329
  useLayoutEffect: ["useIsomorphicLayoutEffect"]
@@ -384,16 +1332,16 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
384
1332
  strictImportCheck: false,
385
1333
  version: "detect"
386
1334
  };
387
- function unsafeReadSettings(data) {
1335
+ function unsafeDecodeSettings(data) {
388
1336
  return data?.["react-x"] ?? {};
389
1337
  }
390
- var decodeSettings = memoize((data) => {
1338
+ var decodeSettings = createMemoizedFunction((data) => {
391
1339
  return {
392
1340
  ...DEFAULT_ESLINT_REACT_SETTINGS,
393
1341
  ...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
394
1342
  };
395
1343
  }, { isEqual: (a, b) => a === b });
396
- var normalizeSettings = memoize((settings) => {
1344
+ var normalizeSettings = createMemoizedFunction((settings) => {
397
1345
  const additionalComponents = settings.additionalComponents ?? [];
398
1346
  return {
399
1347
  ...settings,
@@ -414,6 +1362,9 @@ var normalizeSettings = memoize((settings) => {
414
1362
  version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => E.getOrElse(getReactVersion(), F.constant("19.0.0"))).otherwise(F.identity)
415
1363
  };
416
1364
  }, { isEqual: shallowEqual });
1365
+ function getSettingsFromContext(context) {
1366
+ return normalizeSettings(decodeSettings(context.settings));
1367
+ }
417
1368
  var defineSettings = F.identity;
418
1369
 
419
- export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, normalizeSettings, unsafeReadSettings };
1370
+ export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, normalizedSettingsCache, tryRequire, unsafeDecodeSettings };