@eslint-react/shared 1.45.2-next.0 → 1.45.3-beta.0

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as z from '@zod/mini';
2
+ import * as micro_memoize from 'micro-memoize';
2
3
  import { _ } from '@eslint-react/eff';
3
4
 
4
5
  /**
@@ -562,110 +563,6 @@ declare const DEFAULT_ESLINT_REACT_SETTINGS: {
562
563
  }[] | undefined;
563
564
  };
564
565
 
565
- interface Dictionary<Type> {
566
- [key: string]: Type;
567
- [index: number]: Type;
568
- }
569
-
570
- type AnyFn = (...args: any[]) => any;
571
-
572
- type Key = any[];
573
- type RawKey = Key | IArguments;
574
- type Value = any;
575
-
576
- interface CacheSnapshot {
577
- keys: Key[];
578
- size: number;
579
- values: Value[];
580
- }
581
-
582
- declare class Cache<Fn extends AnyFn> {
583
- readonly canTransformKey: boolean;
584
- readonly getKeyIndex: KeyIndexGetter;
585
- readonly options: NormalizedOptions<Fn>;
586
- readonly shouldCloneArguments: boolean;
587
- readonly shouldUpdateOnAdd: boolean;
588
- readonly shouldUpdateOnChange: boolean;
589
- readonly shouldUpdateOnHit: boolean;
590
-
591
- /**
592
- * The prevents call arguments which have cached results.
593
- */
594
- keys: Key[];
595
- /**
596
- * The results of previous cached calls.
597
- */
598
- values: Value[];
599
-
600
- constructor(options: NormalizedOptions<Fn>);
601
-
602
- /**
603
- * The number of cached [key,value] results.
604
- */
605
- get size(): number;
606
-
607
- /**
608
- * A copy of the cache at a moment in time. This is useful
609
- * to compare changes over time, since the cache mutates
610
- * internally for performance reasons.
611
- */
612
- get snapshot(): CacheSnapshot;
613
-
614
- /**
615
- * Order the array based on a Least-Recently-Used basis.
616
- */
617
- orderByLru(key: Key, value: Value, startingIndex: number): void;
618
-
619
- /**
620
- * Update the promise method to auto-remove from cache if rejected, and
621
- * if resolved then fire cache hit / changed.
622
- */
623
- updateAsyncCache(memoized: Memoized<Fn>): void;
624
- }
625
-
626
- type EqualityComparator = (object1: any, object2: any) => boolean;
627
-
628
- type MatchingKeyComparator = (key1: Key, key2: RawKey) => boolean;
629
-
630
- type CacheModifiedHandler<Fn extends AnyFn> = (
631
- cache: Cache<Fn>,
632
- options: NormalizedOptions<Fn>,
633
- memoized: Memoized<Fn>,
634
- ) => void;
635
-
636
- type KeyTransformer = (args: Key) => Key;
637
-
638
- type KeyIndexGetter = (keyToMatch: RawKey) => number;
639
-
640
- interface StandardOptions<Fn extends AnyFn> {
641
- isEqual?: EqualityComparator;
642
- isMatchingKey?: MatchingKeyComparator;
643
- isPromise?: boolean;
644
- maxSize?: number;
645
- onCacheAdd?: CacheModifiedHandler<Fn>;
646
- onCacheChange?: CacheModifiedHandler<Fn>;
647
- onCacheHit?: CacheModifiedHandler<Fn>;
648
- transformKey?: KeyTransformer;
649
- }
650
-
651
- interface Options<Fn extends AnyFn>
652
- extends StandardOptions<Fn>,
653
- Dictionary<any> {}
654
-
655
- interface NormalizedOptions<Fn extends AnyFn> extends Options<Fn> {
656
- isEqual: EqualityComparator;
657
- isPromise: boolean;
658
- maxSize: number;
659
- }
660
-
661
- type Memoized<Fn extends AnyFn> = Fn &
662
- Dictionary<any> & {
663
- cache: Cache<Fn>;
664
- fn: Fn;
665
- isMemoized: true;
666
- options: NormalizedOptions<Fn>;
667
- };
668
-
669
566
  /**
670
567
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
671
568
 
@@ -1353,7 +1250,9 @@ interface CustomComponentNormalized {
1353
1250
  name: string;
1354
1251
  as: string;
1355
1252
  attributes: CustomComponentPropNormalized[];
1356
- re: RegExp;
1253
+ re: {
1254
+ test(s: string): boolean;
1255
+ };
1357
1256
  }
1358
1257
  interface CustomComponentPropNormalized {
1359
1258
  name: string;
@@ -1385,14 +1284,14 @@ declare function unsafeDecodeSettings(data: unknown): PartialDeep<ESLintReactSet
1385
1284
  * @param data The data object.
1386
1285
  * @returns settings The settings.
1387
1286
  */
1388
- declare const decodeSettings: Memoized<(data: unknown) => ESLintReactSettings>;
1287
+ declare const decodeSettings: micro_memoize.Memoized<(data: unknown) => ESLintReactSettings>;
1389
1288
  /**
1390
1289
  * The memoized version of `ESLintReactSettings`.
1391
1290
  * @param settings The settings.
1392
1291
  * @returns The normalized settings.
1393
1292
  * @internal
1394
1293
  */
1395
- declare const toNormalizedSettings: Memoized<({ additionalComponents, additionalHooks, importSource, polymorphicPropName, skipImportCheck, version, ...rest }: ESLintReactSettings) => ESLintReactSettingsNormalized>;
1294
+ declare const toNormalizedSettings: micro_memoize.Memoized<({ additionalComponents, additionalHooks, importSource, polymorphicPropName, skipImportCheck, version, ...rest }: ESLintReactSettings) => ESLintReactSettingsNormalized>;
1396
1295
  declare function getSettingsFromContext(context: {
1397
1296
  settings: unknown;
1398
1297
  }): ESLintReactSettingsNormalized;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as z from '@zod/mini';
2
+ import * as micro_memoize from 'micro-memoize';
2
3
  import { _ } from '@eslint-react/eff';
3
4
 
4
5
  /**
@@ -562,110 +563,6 @@ declare const DEFAULT_ESLINT_REACT_SETTINGS: {
562
563
  }[] | undefined;
563
564
  };
564
565
 
565
- interface Dictionary<Type> {
566
- [key: string]: Type;
567
- [index: number]: Type;
568
- }
569
-
570
- type AnyFn = (...args: any[]) => any;
571
-
572
- type Key = any[];
573
- type RawKey = Key | IArguments;
574
- type Value = any;
575
-
576
- interface CacheSnapshot {
577
- keys: Key[];
578
- size: number;
579
- values: Value[];
580
- }
581
-
582
- declare class Cache<Fn extends AnyFn> {
583
- readonly canTransformKey: boolean;
584
- readonly getKeyIndex: KeyIndexGetter;
585
- readonly options: NormalizedOptions<Fn>;
586
- readonly shouldCloneArguments: boolean;
587
- readonly shouldUpdateOnAdd: boolean;
588
- readonly shouldUpdateOnChange: boolean;
589
- readonly shouldUpdateOnHit: boolean;
590
-
591
- /**
592
- * The prevents call arguments which have cached results.
593
- */
594
- keys: Key[];
595
- /**
596
- * The results of previous cached calls.
597
- */
598
- values: Value[];
599
-
600
- constructor(options: NormalizedOptions<Fn>);
601
-
602
- /**
603
- * The number of cached [key,value] results.
604
- */
605
- get size(): number;
606
-
607
- /**
608
- * A copy of the cache at a moment in time. This is useful
609
- * to compare changes over time, since the cache mutates
610
- * internally for performance reasons.
611
- */
612
- get snapshot(): CacheSnapshot;
613
-
614
- /**
615
- * Order the array based on a Least-Recently-Used basis.
616
- */
617
- orderByLru(key: Key, value: Value, startingIndex: number): void;
618
-
619
- /**
620
- * Update the promise method to auto-remove from cache if rejected, and
621
- * if resolved then fire cache hit / changed.
622
- */
623
- updateAsyncCache(memoized: Memoized<Fn>): void;
624
- }
625
-
626
- type EqualityComparator = (object1: any, object2: any) => boolean;
627
-
628
- type MatchingKeyComparator = (key1: Key, key2: RawKey) => boolean;
629
-
630
- type CacheModifiedHandler<Fn extends AnyFn> = (
631
- cache: Cache<Fn>,
632
- options: NormalizedOptions<Fn>,
633
- memoized: Memoized<Fn>,
634
- ) => void;
635
-
636
- type KeyTransformer = (args: Key) => Key;
637
-
638
- type KeyIndexGetter = (keyToMatch: RawKey) => number;
639
-
640
- interface StandardOptions<Fn extends AnyFn> {
641
- isEqual?: EqualityComparator;
642
- isMatchingKey?: MatchingKeyComparator;
643
- isPromise?: boolean;
644
- maxSize?: number;
645
- onCacheAdd?: CacheModifiedHandler<Fn>;
646
- onCacheChange?: CacheModifiedHandler<Fn>;
647
- onCacheHit?: CacheModifiedHandler<Fn>;
648
- transformKey?: KeyTransformer;
649
- }
650
-
651
- interface Options<Fn extends AnyFn>
652
- extends StandardOptions<Fn>,
653
- Dictionary<any> {}
654
-
655
- interface NormalizedOptions<Fn extends AnyFn> extends Options<Fn> {
656
- isEqual: EqualityComparator;
657
- isPromise: boolean;
658
- maxSize: number;
659
- }
660
-
661
- type Memoized<Fn extends AnyFn> = Fn &
662
- Dictionary<any> & {
663
- cache: Cache<Fn>;
664
- fn: Fn;
665
- isMemoized: true;
666
- options: NormalizedOptions<Fn>;
667
- };
668
-
669
566
  /**
670
567
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
671
568
 
@@ -1353,7 +1250,9 @@ interface CustomComponentNormalized {
1353
1250
  name: string;
1354
1251
  as: string;
1355
1252
  attributes: CustomComponentPropNormalized[];
1356
- re: RegExp;
1253
+ re: {
1254
+ test(s: string): boolean;
1255
+ };
1357
1256
  }
1358
1257
  interface CustomComponentPropNormalized {
1359
1258
  name: string;
@@ -1385,14 +1284,14 @@ declare function unsafeDecodeSettings(data: unknown): PartialDeep<ESLintReactSet
1385
1284
  * @param data The data object.
1386
1285
  * @returns settings The settings.
1387
1286
  */
1388
- declare const decodeSettings: Memoized<(data: unknown) => ESLintReactSettings>;
1287
+ declare const decodeSettings: micro_memoize.Memoized<(data: unknown) => ESLintReactSettings>;
1389
1288
  /**
1390
1289
  * The memoized version of `ESLintReactSettings`.
1391
1290
  * @param settings The settings.
1392
1291
  * @returns The normalized settings.
1393
1292
  * @internal
1394
1293
  */
1395
- declare const toNormalizedSettings: Memoized<({ additionalComponents, additionalHooks, importSource, polymorphicPropName, skipImportCheck, version, ...rest }: ESLintReactSettings) => ESLintReactSettingsNormalized>;
1294
+ declare const toNormalizedSettings: micro_memoize.Memoized<({ additionalComponents, additionalHooks, importSource, polymorphicPropName, skipImportCheck, version, ...rest }: ESLintReactSettings) => ESLintReactSettingsNormalized>;
1396
1295
  declare function getSettingsFromContext(context: {
1397
1296
  settings: unknown;
1398
1297
  }): ESLintReactSettingsNormalized;