@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.d.mts +1661 -172
- package/dist/index.d.ts +1661 -172
- package/dist/index.js +1013 -60
- package/dist/index.mjs +960 -9
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -4,18 +4,17 @@ 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');
|
|
10
7
|
var pm = require('picomatch');
|
|
11
8
|
|
|
12
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
11
|
|
|
15
12
|
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
|
16
|
-
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
17
13
|
var pm__default = /*#__PURE__*/_interopDefault(pm);
|
|
18
14
|
|
|
15
|
+
// src/cache.ts
|
|
16
|
+
var normalizedSettingsCache = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
|
|
19
18
|
// src/constants.ts
|
|
20
19
|
var NPM_SCOPE = "@eslint-react";
|
|
21
20
|
var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
|
|
@@ -240,151 +239,1099 @@ function getReactVersion(at = (typeof document === 'undefined' ? require('u' + '
|
|
|
240
239
|
eff.E.map((mod) => mod.version)
|
|
241
240
|
);
|
|
242
241
|
}
|
|
243
|
-
|
|
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({
|
|
244
497
|
// TODO: Define the schema for custom Hooks
|
|
245
498
|
});
|
|
246
|
-
var CustomAttributeSchema =
|
|
499
|
+
var CustomAttributeSchema = object({
|
|
247
500
|
/**
|
|
248
501
|
* The name of the attribute in the user-defined component.
|
|
249
502
|
* @example
|
|
250
503
|
* "to"
|
|
251
504
|
*/
|
|
252
|
-
name:
|
|
505
|
+
name: string(),
|
|
253
506
|
/**
|
|
254
507
|
* The name of the attribute in the built-in component.
|
|
255
508
|
* @example
|
|
256
509
|
* "href"
|
|
257
510
|
*/
|
|
258
|
-
as:
|
|
511
|
+
as: optional(string()),
|
|
259
512
|
/**
|
|
260
513
|
* Whether the attribute is controlled or not in the user-defined component.
|
|
261
514
|
* @example
|
|
262
515
|
* `true`
|
|
263
516
|
*/
|
|
264
|
-
controlled:
|
|
517
|
+
controlled: optional(boolean()),
|
|
265
518
|
/**
|
|
266
519
|
* The default value of the attribute in the user-defined component.
|
|
267
520
|
* @example
|
|
268
521
|
* `"/"`
|
|
269
522
|
*/
|
|
270
|
-
defaultValue:
|
|
523
|
+
defaultValue: optional(string())
|
|
271
524
|
});
|
|
272
|
-
var CustomComponentSchema =
|
|
525
|
+
var CustomComponentSchema = object({
|
|
273
526
|
/**
|
|
274
527
|
* The name of the user-defined component.
|
|
275
528
|
* @example
|
|
276
529
|
* "Link"
|
|
277
530
|
*/
|
|
278
|
-
name:
|
|
531
|
+
name: string(),
|
|
279
532
|
/**
|
|
280
533
|
* The ESQuery selector to select the component precisely.
|
|
281
534
|
* @example
|
|
282
535
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
283
536
|
*/
|
|
284
|
-
selector:
|
|
537
|
+
selector: optional(string()),
|
|
285
538
|
/**
|
|
286
539
|
* The name of the built-in component that the user-defined component represents.
|
|
287
540
|
* @example
|
|
288
541
|
* "a"
|
|
289
542
|
*/
|
|
290
|
-
as:
|
|
543
|
+
as: optional(string()),
|
|
291
544
|
/**
|
|
292
545
|
* Pre-defined attributes that are used in the user-defined component.
|
|
293
546
|
* @example
|
|
294
547
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
295
548
|
*/
|
|
296
|
-
attributes:
|
|
549
|
+
attributes: optional(array(CustomAttributeSchema))
|
|
297
550
|
});
|
|
298
|
-
var CustomComponentNormalizedSchema =
|
|
299
|
-
name:
|
|
300
|
-
as:
|
|
301
|
-
attributes:
|
|
302
|
-
re:
|
|
303
|
-
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())
|
|
304
557
|
});
|
|
305
|
-
var ESLintReactSettingsSchema =
|
|
558
|
+
var ESLintReactSettingsSchema = object({
|
|
306
559
|
/**
|
|
307
560
|
* The source where React is imported from.
|
|
308
561
|
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
309
562
|
* @default `"react"`
|
|
310
563
|
* @example `"@pika/react"`
|
|
311
564
|
*/
|
|
312
|
-
importSource:
|
|
565
|
+
importSource: optional(string()),
|
|
313
566
|
/**
|
|
314
567
|
* The identifier that’s used for JSX Element creation.
|
|
315
568
|
* @default `"createElement"`
|
|
316
569
|
* @deprecated
|
|
317
570
|
*/
|
|
318
|
-
jsxPragma:
|
|
571
|
+
jsxPragma: optional(string()),
|
|
319
572
|
/**
|
|
320
573
|
* The identifier that’s used for JSX fragment elements.
|
|
321
574
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
322
575
|
* @default `"Fragment"`
|
|
323
576
|
* @deprecated
|
|
324
577
|
*/
|
|
325
|
-
jsxPragmaFrag:
|
|
578
|
+
jsxPragmaFrag: optional(string()),
|
|
326
579
|
/**
|
|
327
580
|
* The name of the prop that is used for polymorphic components.
|
|
328
581
|
* @description This is used to determine the type of the component.
|
|
329
582
|
* @example `"as"`
|
|
330
583
|
*/
|
|
331
|
-
polymorphicPropName:
|
|
584
|
+
polymorphicPropName: optional(string()),
|
|
332
585
|
/**
|
|
333
586
|
* @internal
|
|
334
587
|
*/
|
|
335
|
-
strict:
|
|
588
|
+
strict: optional(boolean()),
|
|
336
589
|
/**
|
|
337
590
|
* @internal
|
|
338
591
|
*/
|
|
339
|
-
strictImportCheck:
|
|
592
|
+
strictImportCheck: optional(boolean()),
|
|
340
593
|
/**
|
|
341
594
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
342
595
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
343
596
|
* @example `"18.3.1"`
|
|
344
597
|
* @default `"detect"`
|
|
345
598
|
*/
|
|
346
|
-
version:
|
|
599
|
+
version: optional(string()),
|
|
347
600
|
/**
|
|
348
601
|
* An array of user-defined components
|
|
349
602
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
350
603
|
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
351
604
|
*/
|
|
352
|
-
additionalComponents:
|
|
605
|
+
additionalComponents: optional(array(CustomComponentSchema)),
|
|
353
606
|
/**
|
|
354
607
|
* A object of aliases for React built-in hooks.
|
|
355
608
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
356
609
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
357
610
|
*/
|
|
358
|
-
additionalHooks:
|
|
359
|
-
use:
|
|
360
|
-
useActionState:
|
|
361
|
-
useCallback:
|
|
362
|
-
useContext:
|
|
363
|
-
useDebugValue:
|
|
364
|
-
useDeferredValue:
|
|
365
|
-
useEffect:
|
|
366
|
-
useFormStatus:
|
|
367
|
-
useId:
|
|
368
|
-
useImperativeHandle:
|
|
369
|
-
useInsertionEffect:
|
|
370
|
-
useLayoutEffect:
|
|
371
|
-
useMemo:
|
|
372
|
-
useOptimistic:
|
|
373
|
-
useReducer:
|
|
374
|
-
useRef:
|
|
375
|
-
useState:
|
|
376
|
-
useSyncExternalStore:
|
|
377
|
-
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()))
|
|
378
631
|
}))
|
|
379
632
|
});
|
|
380
|
-
var ESLintSettingsSchema =
|
|
381
|
-
|
|
382
|
-
"react-x":
|
|
633
|
+
var ESLintSettingsSchema = optional(
|
|
634
|
+
object({
|
|
635
|
+
"react-x": optional(ESLintReactSettingsSchema),
|
|
383
636
|
/** @deprecated Use `react-x` instead */
|
|
384
|
-
reactOptions:
|
|
637
|
+
reactOptions: optional(ESLintReactSettingsSchema)
|
|
385
638
|
}),
|
|
386
639
|
{}
|
|
387
640
|
);
|
|
641
|
+
|
|
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
|
+
}
|
|
1051
|
+
|
|
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
|
+
}
|
|
388
1335
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
389
1336
|
additionalHooks: {
|
|
390
1337
|
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
@@ -393,16 +1340,16 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
393
1340
|
strictImportCheck: false,
|
|
394
1341
|
version: "detect"
|
|
395
1342
|
};
|
|
396
|
-
function
|
|
1343
|
+
function unsafeDecodeSettings(data) {
|
|
397
1344
|
return data?.["react-x"] ?? {};
|
|
398
1345
|
}
|
|
399
|
-
var decodeSettings =
|
|
1346
|
+
var decodeSettings = createMemoizedFunction((data) => {
|
|
400
1347
|
return {
|
|
401
1348
|
...DEFAULT_ESLINT_REACT_SETTINGS,
|
|
402
|
-
...
|
|
1349
|
+
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
403
1350
|
};
|
|
404
1351
|
}, { isEqual: (a, b) => a === b });
|
|
405
|
-
var normalizeSettings =
|
|
1352
|
+
var normalizeSettings = createMemoizedFunction((settings) => {
|
|
406
1353
|
const additionalComponents = settings.additionalComponents ?? [];
|
|
407
1354
|
return {
|
|
408
1355
|
...settings,
|
|
@@ -422,7 +1369,10 @@ var normalizeSettings = memoize__default.default((settings) => {
|
|
|
422
1369
|
}, /* @__PURE__ */ new Map()),
|
|
423
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)
|
|
424
1371
|
};
|
|
425
|
-
}, { isEqual:
|
|
1372
|
+
}, { isEqual: shallowEqual });
|
|
1373
|
+
function getSettingsFromContext(context) {
|
|
1374
|
+
return normalizeSettings(decodeSettings(context.settings));
|
|
1375
|
+
}
|
|
426
1376
|
var defineSettings = eff.F.identity;
|
|
427
1377
|
|
|
428
1378
|
exports.CustomAttributeSchema = CustomAttributeSchema;
|
|
@@ -448,5 +1398,8 @@ exports.createRuleForPlugin = createRuleForPlugin;
|
|
|
448
1398
|
exports.decodeSettings = decodeSettings;
|
|
449
1399
|
exports.defineSettings = defineSettings;
|
|
450
1400
|
exports.getReactVersion = getReactVersion;
|
|
1401
|
+
exports.getSettingsFromContext = getSettingsFromContext;
|
|
451
1402
|
exports.normalizeSettings = normalizeSettings;
|
|
452
|
-
exports.
|
|
1403
|
+
exports.normalizedSettingsCache = normalizedSettingsCache;
|
|
1404
|
+
exports.tryRequire = tryRequire;
|
|
1405
|
+
exports.unsafeDecodeSettings = unsafeDecodeSettings;
|