@eslint-react/core 1.48.3-next.0 → 1.48.3

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.
Files changed (3) hide show
  1. package/dist/index.js +3 -1393
  2. package/dist/index.mjs +5 -1395
  3. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -1,1403 +1,13 @@
1
1
  import * as AST9 from '@eslint-react/ast';
2
2
  import { flip, dual, constFalse, identity, constTrue, _ } from '@eslint-react/eff';
3
- import { RegExp as RegExp$1, Selector } from '@eslint-react/kit';
4
- import { coerceSettings, getId } from '@eslint-react/shared';
3
+ import { RegExp, Selector } from '@eslint-react/kit';
4
+ import { coerceSettings, DEFAULT_ESLINT_REACT_SETTINGS, getId } from '@eslint-react/shared';
5
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
6
6
  import * as VAR3 from '@eslint-react/var';
7
7
  import { isMatching, P, match } from 'ts-pattern';
8
8
  import birecord from 'birecord';
9
9
 
10
- var __defProp = Object.defineProperty;
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
-
16
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/core.js
17
- // @__NO_SIDE_EFFECTS__
18
- function $constructor(name, initializer) {
19
- class _6 {
20
- constructor(def) {
21
- var _a;
22
- const th = this;
23
- _6.init(th, def);
24
- (_a = th._zod).deferred ?? (_a.deferred = []);
25
- for (const fn of th._zod.deferred) {
26
- fn();
27
- }
28
- }
29
- static init(inst, def) {
30
- var _a;
31
- inst._zod ?? (inst._zod = {});
32
- (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
33
- inst._zod.traits.add(name);
34
- initializer(inst, def);
35
- for (const k in _6.prototype) {
36
- Object.defineProperty(inst, k, { value: _6.prototype[k].bind(inst) });
37
- }
38
- inst._zod.constr = _6;
39
- inst._zod.def = def;
40
- }
41
- static [Symbol.hasInstance](inst) {
42
- return inst?._zod?.traits?.has(name);
43
- }
44
- }
45
- Object.defineProperty(_6, "name", { value: name });
46
- return _6;
47
- }
48
- var $ZodAsyncError = class extends Error {
49
- constructor() {
50
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
51
- }
52
- };
53
- var globalConfig = {};
54
- function config(config2) {
55
- return globalConfig;
56
- }
57
-
58
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/util.js
59
- var util_exports = {};
60
- __export(util_exports, {
61
- BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
62
- NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
63
- aborted: () => aborted,
64
- allowsEval: () => allowsEval,
65
- assert: () => assert,
66
- assertEqual: () => assertEqual,
67
- assertIs: () => assertIs,
68
- assertNever: () => assertNever,
69
- assertNotEqual: () => assertNotEqual,
70
- assignProp: () => assignProp,
71
- cached: () => cached,
72
- cleanInterfaceKey: () => cleanInterfaceKey,
73
- cleanInterfaceShape: () => cleanInterfaceShape,
74
- cleanRegex: () => cleanRegex,
75
- clone: () => clone,
76
- createTransparentProxy: () => createTransparentProxy,
77
- defineLazy: () => defineLazy,
78
- esc: () => esc,
79
- escapeRegex: () => escapeRegex,
80
- extend: () => extend,
81
- extendObjectLike: () => extendObjectLike,
82
- finalizeIssue: () => finalizeIssue,
83
- floatSafeRemainder: () => floatSafeRemainder,
84
- getElementAtPath: () => getElementAtPath,
85
- getLengthableOrigin: () => getLengthableOrigin,
86
- getParsedType: () => getParsedType,
87
- getSizableOrigin: () => getSizableOrigin,
88
- getValidEnumValues: () => getValidEnumValues,
89
- isObject: () => isObject,
90
- isPlainObject: () => isPlainObject,
91
- issue: () => issue,
92
- joinValues: () => joinValues,
93
- jsonStringifyReplacer: () => jsonStringifyReplacer,
94
- mergeObjectLike: () => mergeObjectLike,
95
- normalizeObjectLikeDef: () => normalizeObjectLikeDef,
96
- normalizeParams: () => normalizeParams,
97
- nullish: () => nullish,
98
- numKeys: () => numKeys,
99
- omit: () => omit,
100
- optionalInterfaceKeys: () => optionalInterfaceKeys,
101
- optionalObjectKeys: () => optionalObjectKeys,
102
- partialObjectLike: () => partialObjectLike,
103
- pick: () => pick,
104
- prefixIssues: () => prefixIssues,
105
- primitiveTypes: () => primitiveTypes,
106
- promiseAllObject: () => promiseAllObject,
107
- propertyKeyTypes: () => propertyKeyTypes,
108
- randomString: () => randomString,
109
- requiredObjectLike: () => requiredObjectLike,
110
- splitChecksAndParams: () => splitChecksAndParams,
111
- stringifyPrimitive: () => stringifyPrimitive,
112
- unwrapMessage: () => unwrapMessage
113
- });
114
- function assertEqual(val) {
115
- return val;
116
- }
117
- function assertNotEqual(val) {
118
- return val;
119
- }
120
- function assertIs(_arg) {
121
- }
122
- function assertNever(_x) {
123
- throw new Error();
124
- }
125
- function assert(_6) {
126
- }
127
- function getValidEnumValues(obj) {
128
- const validKeys = Object.keys(obj).filter((k) => typeof obj[obj[k]] !== "number");
129
- const filtered = {};
130
- for (const k of validKeys) {
131
- filtered[k] = obj[k];
132
- }
133
- return Object.values(filtered);
134
- }
135
- function joinValues(array2, separator = "|") {
136
- return array2.map((val) => stringifyPrimitive(val)).join(separator);
137
- }
138
- function jsonStringifyReplacer(_6, value) {
139
- if (typeof value === "bigint")
140
- return value.toString();
141
- return value;
142
- }
143
- function cached(getter) {
144
- return {
145
- get value() {
146
- {
147
- const value = getter();
148
- Object.defineProperty(this, "value", { value });
149
- return value;
150
- }
151
- }
152
- };
153
- }
154
- function nullish(input) {
155
- return input === null || input === void 0;
156
- }
157
- function cleanRegex(source) {
158
- const start = source.startsWith("^") ? 1 : 0;
159
- const end = source.endsWith("$") ? source.length - 1 : source.length;
160
- return source.slice(start, end);
161
- }
162
- function floatSafeRemainder(val, step) {
163
- const valDecCount = (val.toString().split(".")[1] || "").length;
164
- const stepDecCount = (step.toString().split(".")[1] || "").length;
165
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
166
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
167
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
168
- return valInt % stepInt / 10 ** decCount;
169
- }
170
- function defineLazy(object2, key, getter) {
171
- Object.defineProperty(object2, key, {
172
- get() {
173
- {
174
- const value = getter();
175
- object2[key] = value;
176
- return value;
177
- }
178
- },
179
- set(v) {
180
- Object.defineProperty(object2, key, {
181
- value: v
182
- // configurable: true,
183
- });
184
- },
185
- configurable: true
186
- });
187
- }
188
- function assignProp(target, prop, value) {
189
- Object.defineProperty(target, prop, {
190
- value,
191
- writable: true,
192
- enumerable: true,
193
- configurable: true
194
- });
195
- }
196
- function getElementAtPath(obj, path) {
197
- if (!path)
198
- return obj;
199
- return path.reduce((acc, key) => acc?.[key], obj);
200
- }
201
- function promiseAllObject(promisesObj) {
202
- const keys = Object.keys(promisesObj);
203
- const promises = keys.map((key) => promisesObj[key]);
204
- return Promise.all(promises).then((results) => {
205
- const resolvedObj = {};
206
- for (let i = 0; i < keys.length; i++) {
207
- resolvedObj[keys[i]] = results[i];
208
- }
209
- return resolvedObj;
210
- });
211
- }
212
- function randomString(length = 10) {
213
- const chars = "abcdefghijklmnopqrstuvwxyz";
214
- let str = "";
215
- for (let i = 0; i < length; i++) {
216
- str += chars[Math.floor(Math.random() * chars.length)];
217
- }
218
- return str;
219
- }
220
- function esc(str) {
221
- return JSON.stringify(str);
222
- }
223
- function isObject(data) {
224
- return typeof data === "object" && data !== null;
225
- }
226
- var allowsEval = cached(() => {
227
- try {
228
- new Function("");
229
- return true;
230
- } catch (_6) {
231
- return false;
232
- }
233
- });
234
- function isPlainObject(data) {
235
- return typeof data === "object" && data !== null && Object.getPrototypeOf(data) === Object.prototype;
236
- }
237
- function numKeys(data) {
238
- let keyCount = 0;
239
- for (const key in data) {
240
- if (Object.prototype.hasOwnProperty.call(data, key)) {
241
- keyCount++;
242
- }
243
- }
244
- return keyCount;
245
- }
246
- var getParsedType = (data) => {
247
- const t = typeof data;
248
- switch (t) {
249
- case "undefined":
250
- return "undefined";
251
- case "string":
252
- return "string";
253
- case "number":
254
- return Number.isNaN(data) ? "nan" : "number";
255
- case "boolean":
256
- return "boolean";
257
- case "function":
258
- return "function";
259
- case "bigint":
260
- return "bigint";
261
- case "symbol":
262
- return "symbol";
263
- case "object":
264
- if (Array.isArray(data)) {
265
- return "array";
266
- }
267
- if (data === null) {
268
- return "null";
269
- }
270
- if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
271
- return "promise";
272
- }
273
- if (typeof Map !== "undefined" && data instanceof Map) {
274
- return "map";
275
- }
276
- if (typeof Set !== "undefined" && data instanceof Set) {
277
- return "set";
278
- }
279
- if (typeof Date !== "undefined" && data instanceof Date) {
280
- return "date";
281
- }
282
- if (typeof File !== "undefined" && data instanceof File) {
283
- return "file";
284
- }
285
- return "object";
286
- default:
287
- throw new Error(`Unknown data type: ${t}`);
288
- }
289
- };
290
- var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
291
- var primitiveTypes = /* @__PURE__ */ new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
292
- function escapeRegex(str) {
293
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
294
- }
295
- function clone(inst, def) {
296
- return new inst._zod.constr(def);
297
- }
298
- function splitChecksAndParams(_paramsOrChecks, _checks) {
299
- const params = Array.isArray(_paramsOrChecks) ? {} : _paramsOrChecks ?? {};
300
- const checks = Array.isArray(_paramsOrChecks) ? _paramsOrChecks : _checks ?? [];
301
- return {
302
- checks,
303
- params
304
- };
305
- }
306
- function normalizeParams(_params) {
307
- const params = _params;
308
- if (!params)
309
- return {};
310
- if (typeof params === "string")
311
- return { error: () => params };
312
- if (params?.message !== void 0) {
313
- if (params?.error !== void 0)
314
- throw new Error("Cannot specify both `message` and `error` params");
315
- params.error = params.message;
316
- }
317
- delete params.message;
318
- if (typeof params.error === "string")
319
- return { ...params, error: () => params.error };
320
- return params;
321
- }
322
- function createTransparentProxy(getter) {
323
- let target;
324
- return new Proxy({}, {
325
- get(_6, prop, receiver) {
326
- target ?? (target = getter());
327
- return Reflect.get(target, prop, receiver);
328
- },
329
- set(_6, prop, value, receiver) {
330
- target ?? (target = getter());
331
- return Reflect.set(target, prop, value, receiver);
332
- },
333
- has(_6, prop) {
334
- target ?? (target = getter());
335
- return Reflect.has(target, prop);
336
- },
337
- deleteProperty(_6, prop) {
338
- target ?? (target = getter());
339
- return Reflect.deleteProperty(target, prop);
340
- },
341
- ownKeys(_6) {
342
- target ?? (target = getter());
343
- return Reflect.ownKeys(target);
344
- },
345
- getOwnPropertyDescriptor(_6, prop) {
346
- target ?? (target = getter());
347
- return Reflect.getOwnPropertyDescriptor(target, prop);
348
- },
349
- defineProperty(_6, prop, descriptor) {
350
- target ?? (target = getter());
351
- return Reflect.defineProperty(target, prop, descriptor);
352
- }
353
- // apply(target, thisArg, args) {
354
- // return Reflect.apply(target, thisArg, args);
355
- // },
356
- // construct(target, args, newTarget) {
357
- // return Reflect.construct(target, args, newTarget);
358
- // },
359
- });
360
- }
361
- function stringifyPrimitive(value) {
362
- if (typeof value === "bigint")
363
- return value.toString() + "n";
364
- if (typeof value === "string")
365
- return `"${value}"`;
366
- return `${value}`;
367
- }
368
- function optionalObjectKeys(shape) {
369
- return Object.keys(shape).filter((k) => {
370
- return shape[k]._zod.qout === "true";
371
- });
372
- }
373
- function optionalInterfaceKeys(shape) {
374
- return Object.keys(shape).filter((k) => {
375
- return k.endsWith("?");
376
- }).map((k) => k.replace(/\?$/, ""));
377
- }
378
- function cleanInterfaceKey(key) {
379
- return key.replace(/^\?/, "").replace(/\?$/, "");
380
- }
381
- function cleanInterfaceShape(_shape) {
382
- const keyMap = {};
383
- const shape = {};
384
- const optional2 = [];
385
- const defaulted = [];
386
- for (const [key, value] of Object.entries(_shape)) {
387
- if (key.endsWith("?"))
388
- optional2.push(key.slice(0, -1));
389
- if (key.startsWith("?"))
390
- defaulted.push(key.slice(1));
391
- const cleanKey = cleanInterfaceKey(key);
392
- shape[cleanKey] = value;
393
- keyMap[cleanKey] = key;
394
- }
395
- return { shape, keyMap, optional: optional2, defaulted };
396
- }
397
- var NUMBER_FORMAT_RANGES = {
398
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
399
- int32: [-2147483648, 2147483647],
400
- uint32: [0, 4294967295],
401
- float32: [-34028234663852886e22, 34028234663852886e22],
402
- float64: [-17976931348623157e292, 17976931348623157e292]
403
- };
404
- var BIGINT_FORMAT_RANGES = {
405
- int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
406
- uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
407
- };
408
- function pick(schema, mask) {
409
- const newShape = {};
410
- const newOptional = [];
411
- const currShape = schema._zod.def.shape;
412
- const currOptional = new Set(schema._zod.def.optional);
413
- for (const key in mask) {
414
- if (!(key in currShape)) {
415
- throw new Error(`Unrecognized key: "${key}"`);
416
- }
417
- if (!mask[key])
418
- continue;
419
- newShape[key] = currShape[key];
420
- if (currOptional.has(key)) {
421
- newOptional.push(key);
422
- }
423
- }
424
- return clone(schema, {
425
- ...schema._zod.def,
426
- shape: newShape,
427
- optional: newOptional,
428
- checks: []
429
- });
430
- }
431
- function omit(schema, mask) {
432
- const newShape = { ...schema._zod.def.shape };
433
- const newOptional = new Set(schema._zod.def.optional);
434
- for (const key in mask) {
435
- if (!(key in schema._zod.def.shape)) {
436
- throw new Error(`Unrecognized key: "${key}"`);
437
- }
438
- if (!mask[key])
439
- continue;
440
- delete newShape[key];
441
- newOptional.delete(key);
442
- }
443
- return clone(schema, {
444
- ...schema._zod.def,
445
- shape: newShape,
446
- optional: [...newOptional],
447
- checks: []
448
- });
449
- }
450
- function extend(schema, shape) {
451
- const def = {
452
- ...schema._zod.def,
453
- get shape() {
454
- const _shape = { ...schema._zod.def.shape, ...shape };
455
- assignProp(this, "shape", _shape);
456
- return _shape;
457
- },
458
- checks: []
459
- // delete existing checks
460
- };
461
- defineLazy(def, "shape", () => ({ ...schema._zod.def.shape, ...shape }));
462
- return clone(schema, def);
463
- }
464
- function mergeObjectLike(a, b) {
465
- const bKeys = new Set(Object.keys(b._zod.def.shape));
466
- const optional2 = [...a._zod.def.optional.filter((k) => !bKeys.has(k)), ...b._zod.def.optional];
467
- return clone(a, {
468
- ...a._zod.def,
469
- get shape() {
470
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
471
- assignProp(this, "shape", _shape);
472
- return _shape;
473
- },
474
- optional: optional2,
475
- catchall: b._zod.def.catchall,
476
- checks: []
477
- // delete existing checks
478
- });
479
- }
480
- function extendObjectLike(a, b) {
481
- const bKeys = new Set(Object.keys(b._zod.def.shape));
482
- const optional2 = [...a._zod.def.optional.filter((k) => !bKeys.has(k)), ...b._zod.def.optional];
483
- return clone(a, {
484
- ...a._zod.def,
485
- get shape() {
486
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
487
- assignProp(this, "shape", _shape);
488
- return _shape;
489
- },
490
- optional: optional2,
491
- checks: []
492
- // delete existent checks
493
- });
494
- }
495
- function partialObjectLike(Class, schema, mask) {
496
- const shape = { ...schema._zod.def.shape };
497
- const optional2 = new Set(schema._zod.def.optional);
498
- if (mask) {
499
- for (const key in mask) {
500
- if (!(key in shape)) {
501
- throw new Error(`Unrecognized key: "${key}"`);
502
- }
503
- if (!mask[key])
504
- continue;
505
- shape[key] = new Class({
506
- type: "optional",
507
- innerType: schema._zod.def.shape[key]
508
- });
509
- optional2.add(key);
510
- }
511
- } else {
512
- for (const key in schema._zod.def.shape) {
513
- shape[key] = new Class({
514
- type: "optional",
515
- innerType: schema._zod.def.shape[key]
516
- });
517
- optional2.add(key);
518
- }
519
- }
520
- return clone(schema, {
521
- ...schema._zod.def,
522
- shape,
523
- optional: [...optional2],
524
- checks: []
525
- });
526
- }
527
- function requiredObjectLike(Class, schema, mask) {
528
- const shape = { ...schema._zod.def.shape };
529
- if (mask) {
530
- for (const key in mask) {
531
- if (!(key in shape)) {
532
- throw new Error(`Unrecognized key: "${key}"`);
533
- }
534
- if (!mask[key])
535
- continue;
536
- shape[key] = new Class({
537
- type: "nonoptional",
538
- innerType: schema._zod.def.shape[key]
539
- });
540
- }
541
- } else {
542
- for (const key in schema._zod.def.shape) {
543
- shape[key] = new Class({
544
- type: "nonoptional",
545
- innerType: schema._zod.def.shape[key]
546
- });
547
- }
548
- }
549
- return clone(schema, {
550
- ...schema._zod.def,
551
- shape,
552
- optional: [],
553
- checks: []
554
- });
555
- }
556
- function normalizeObjectLikeDef(def) {
557
- if (def.type === "interface") {
558
- const keys = Object.keys(def.shape);
559
- const keySet = new Set(Object.keys(def.shape));
560
- return {
561
- shape: { ...def.shape },
562
- // resolve getters
563
- keys,
564
- keySet,
565
- numKeys: keys.length,
566
- optionalKeys: new Set(def.optional)
567
- };
568
- }
569
- if (def.type === "object") {
570
- const keys = Object.keys(def.shape);
571
- const keySet = new Set(Object.keys(def.shape));
572
- return {
573
- shape: { ...def.shape },
574
- // resolve getters
575
- keys,
576
- keySet,
577
- numKeys: keys.length,
578
- optionalKeys: new Set(def.optional)
579
- };
580
- }
581
- throw new Error("Invalid object-like type");
582
- }
583
- function aborted(x, startIndex = 0) {
584
- for (let i = startIndex; i < x.issues.length; i++) {
585
- if (x.issues[i].continue !== true)
586
- return true;
587
- }
588
- return false;
589
- }
590
- function prefixIssues(path, issues) {
591
- return issues.map((iss) => {
592
- var _a;
593
- (_a = iss).path ?? (_a.path = []);
594
- iss.path.unshift(path);
595
- return iss;
596
- });
597
- }
598
- function unwrapMessage(message) {
599
- return typeof message === "string" ? message : message?.message;
600
- }
601
- function finalizeIssue(iss, ctx, config2) {
602
- const full = { ...iss, path: iss.path ?? [] };
603
- if (!iss.message) {
604
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
605
- full.message = message;
606
- }
607
- delete full.inst;
608
- delete full.continue;
609
- if (!ctx?.reportInput) {
610
- delete full.input;
611
- }
612
- return full;
613
- }
614
- function getSizableOrigin(input) {
615
- if (input instanceof Set)
616
- return "set";
617
- if (input instanceof Map)
618
- return "map";
619
- if (input instanceof File)
620
- return "file";
621
- return "unknown";
622
- }
623
- function getLengthableOrigin(input) {
624
- if (Array.isArray(input))
625
- return "array";
626
- if (typeof input === "string")
627
- return "string";
628
- return "unknown";
629
- }
630
- function issue(...args) {
631
- const [iss, input, inst] = args;
632
- if (typeof iss === "string") {
633
- return {
634
- message: iss,
635
- code: "custom",
636
- input,
637
- inst
638
- };
639
- }
640
- return { ...iss };
641
- }
642
-
643
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/errors.js
644
- var ZOD_ERROR = Symbol.for("{{zod.error}}");
645
- var $ZodError = class {
646
- get message() {
647
- return JSON.stringify(this.issues, jsonStringifyReplacer, 2);
648
- }
649
- constructor(issues) {
650
- Object.defineProperty(this, "_tag", { value: ZOD_ERROR, enumerable: false });
651
- Object.defineProperty(this, "name", { value: "$ZodError", enumerable: false });
652
- this.issues = issues;
653
- }
654
- // @ts-ignore
655
- static [Symbol.hasInstance](inst) {
656
- return inst?._tag === ZOD_ERROR;
657
- }
658
- };
659
-
660
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/parse.js
661
- function _parse(schema, value, _ctx) {
662
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
663
- const result = schema._zod.run({ value, issues: [] }, ctx);
664
- if (result instanceof Promise) {
665
- throw new $ZodAsyncError();
666
- }
667
- if (result.issues.length) {
668
- throw new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
669
- }
670
- return result.value;
671
- }
672
- function _safeParse(schema, value, _ctx) {
673
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
674
- const result = schema._zod.run({ value, issues: [] }, ctx);
675
- if (result instanceof Promise) {
676
- throw new $ZodAsyncError();
677
- }
678
- return result.issues.length ? {
679
- success: false,
680
- error: new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
681
- } : { success: true, data: result.value };
682
- }
683
- async function _parseAsync(schema, value, _ctx) {
684
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
685
- let result = schema._zod.run({ value, issues: [] }, ctx);
686
- if (result instanceof Promise)
687
- result = await result;
688
- if (result.issues.length) {
689
- throw new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
690
- }
691
- return result.value;
692
- }
693
- async function _safeParseAsync(schema, value, _ctx) {
694
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
695
- let result = schema._zod.run({ value, issues: [] }, ctx);
696
- if (result instanceof Promise)
697
- result = await result;
698
- if (result.issues.length) {
699
- return {
700
- success: false,
701
- error: new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
702
- };
703
- }
704
- return { success: true, data: result.value };
705
- }
706
- var string = (params) => {
707
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
708
- return new RegExp(`^${regex}$`);
709
- };
710
- var boolean = /true|false/i;
711
-
712
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/doc.js
713
- var Doc = class {
714
- constructor(args = []) {
715
- this.content = [];
716
- this.indent = 0;
717
- if (this)
718
- this.args = args;
719
- }
720
- indented(fn) {
721
- this.indent += 1;
722
- fn(this);
723
- this.indent -= 1;
724
- }
725
- write(arg) {
726
- if (typeof arg === "function") {
727
- arg(this, { execution: "sync" });
728
- arg(this, { execution: "async" });
729
- return;
730
- }
731
- const content = arg;
732
- const lines = content.split("\n").filter((x) => x);
733
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
734
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
735
- for (const line of dedented) {
736
- this.content.push(line);
737
- }
738
- }
739
- compile() {
740
- const args = this?.args;
741
- const content = this?.content ?? [``];
742
- const lines = [...content.map((x) => ` ${x}`)];
743
- return new Function(...args, lines.join("\n"));
744
- }
745
- };
746
-
747
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/versions.js
748
- var version = {
749
- major: 0,
750
- minor: 5,
751
- patch: 1
752
- };
753
-
754
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/schemas.js
755
- var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
756
- var _a;
757
- inst ?? (inst = {});
758
- inst._zod.id = def.type + "_" + randomString(10);
759
- inst._zod.def = def;
760
- inst._zod.computed = inst._zod.computed || {};
761
- inst._zod.version = version;
762
- const checks = [...inst._zod.def.checks ?? []];
763
- def.type;
764
- if (inst._zod.traits.has("$ZodCheck")) {
765
- checks.unshift(inst);
766
- }
767
- for (const ch of checks) {
768
- ch._zod.onattach?.(inst);
769
- }
770
- if (checks.length === 0) {
771
- (_a = inst._zod).deferred ?? (_a.deferred = []);
772
- inst._zod.deferred?.push(() => {
773
- inst._zod.run = inst._zod.parse;
774
- });
775
- } else {
776
- const runChecks = (payload, checks2, ctx) => {
777
- let isAborted = aborted(payload);
778
- let asyncResult;
779
- for (const ch of checks2) {
780
- if (ch._zod.when) {
781
- const shouldRun = ch._zod.when(payload);
782
- if (!shouldRun)
783
- continue;
784
- } else {
785
- if (isAborted) {
786
- continue;
787
- }
788
- }
789
- const currLen = payload.issues.length;
790
- const _6 = ch._zod.check(payload);
791
- if (_6 instanceof Promise && ctx?.async === false) {
792
- throw new $ZodAsyncError();
793
- }
794
- if (asyncResult || _6 instanceof Promise) {
795
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
796
- await _6;
797
- const nextLen = payload.issues.length;
798
- if (nextLen === currLen)
799
- return;
800
- if (!isAborted)
801
- isAborted = aborted(payload, currLen);
802
- });
803
- } else {
804
- const nextLen = payload.issues.length;
805
- if (nextLen === currLen)
806
- continue;
807
- if (!isAborted)
808
- isAborted = aborted(payload, currLen);
809
- }
810
- }
811
- if (asyncResult) {
812
- return asyncResult.then(() => {
813
- return payload;
814
- });
815
- }
816
- return payload;
817
- };
818
- inst._zod.run = (payload, ctx) => {
819
- const result = inst._zod.parse(payload, ctx);
820
- if (result instanceof Promise) {
821
- if (ctx.async === false)
822
- throw new $ZodAsyncError();
823
- return result.then((result2) => runChecks(result2, checks, ctx));
824
- }
825
- return runChecks(result, checks, ctx);
826
- };
827
- }
828
- inst["~standard"] = {
829
- validate: (value) => {
830
- const result = inst._zod.run({ value, issues: [] }, {});
831
- if (result instanceof Promise) {
832
- return result.then(({ issues, value: value2 }) => {
833
- if (issues.length === 0)
834
- return { value: value2 };
835
- return { issues: issues.map((iss) => finalizeIssue(iss, {}, config())) };
836
- });
837
- }
838
- if (result.issues.length === 0)
839
- return { value: result.value };
840
- return { issues: result.issues.map((iss) => finalizeIssue(iss, {}, config())) };
841
- },
842
- vendor: "zod",
843
- version: 1
844
- };
845
- });
846
- var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
847
- $ZodType.init(inst, def);
848
- inst._zod.pattern = inst?._zod.computed?.pattern ?? string(inst._zod.computed);
849
- inst._zod.parse = (payload, _6) => {
850
- if (def.coerce)
851
- try {
852
- payload.value = String(payload.value);
853
- } catch (_7) {
854
- }
855
- if (typeof payload.value === "string")
856
- return payload;
857
- payload.issues.push({
858
- expected: "string",
859
- code: "invalid_type",
860
- input: payload.value,
861
- inst
862
- });
863
- return payload;
864
- };
865
- });
866
- var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
867
- $ZodType.init(inst, def);
868
- inst._zod.pattern = boolean;
869
- inst._zod.parse = (payload, _ctx) => {
870
- if (def.coerce)
871
- try {
872
- payload.value = Boolean(payload.value);
873
- } catch (_6) {
874
- }
875
- const input = payload.value;
876
- if (typeof input === "boolean")
877
- return payload;
878
- payload.issues.push({
879
- expected: "boolean",
880
- code: "invalid_type",
881
- input,
882
- inst
883
- });
884
- return payload;
885
- };
886
- });
887
- var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
888
- $ZodType.init(inst, def);
889
- inst._zod.parse = (payload) => payload;
890
- });
891
- function handleArrayResult(result, final, index) {
892
- if (result.issues.length) {
893
- final.issues.push(...prefixIssues(index, result.issues));
894
- }
895
- final.value[index] = result.value;
896
- }
897
- var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
898
- $ZodType.init(inst, def);
899
- inst._zod.parse = (payload, ctx) => {
900
- const input = payload.value;
901
- if (!Array.isArray(input)) {
902
- payload.issues.push({
903
- expected: "array",
904
- code: "invalid_type",
905
- input,
906
- inst
907
- });
908
- return payload;
909
- }
910
- payload.value = Array(input.length);
911
- const proms = [];
912
- for (let i = 0; i < input.length; i++) {
913
- const item = input[i];
914
- const result = def.element._zod.run({
915
- value: item,
916
- issues: []
917
- }, ctx);
918
- if (result instanceof Promise) {
919
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
920
- } else {
921
- handleArrayResult(result, payload, i);
922
- }
923
- }
924
- if (proms.length) {
925
- return Promise.all(proms).then(() => payload);
926
- }
927
- return payload;
928
- };
929
- });
930
- function handleObjectResult(result, final, key) {
931
- if (result.issues.length) {
932
- final.issues.push(...prefixIssues(key, result.issues));
933
- } else {
934
- final.value[key] = result.value;
935
- }
936
- }
937
- function handleOptionalObjectResult(result, final, key, input) {
938
- if (result.issues.length) {
939
- if (input[key] === void 0) {
940
- if (key in input) {
941
- final.value[key] = void 0;
942
- }
943
- } else {
944
- final.issues.push(...prefixIssues(key, result.issues));
945
- }
946
- } else if (result.value === void 0) {
947
- if (key in input)
948
- final.value[key] = void 0;
949
- } else {
950
- final.value[key] = result.value;
951
- }
952
- }
953
- var $ZodObjectLike = /* @__PURE__ */ $constructor("$ZodObjectLike", (inst, def) => {
954
- $ZodType.init(inst, def);
955
- const _normalized = cached(() => {
956
- const keys = Object.keys(def.shape);
957
- return {
958
- shape: def.shape,
959
- keys,
960
- keySet: new Set(keys),
961
- numKeys: keys.length,
962
- optionalKeys: new Set(def.optional)
963
- };
964
- });
965
- defineLazy(inst._zod, "disc", () => {
966
- const shape = def.shape;
967
- const discMap = /* @__PURE__ */ new Map();
968
- let hasDisc = false;
969
- for (const key in shape) {
970
- const field = shape[key]._zod;
971
- if (field.values || field.disc) {
972
- hasDisc = true;
973
- const o = {
974
- values: new Set(field.values ?? []),
975
- maps: field.disc ? [field.disc] : []
976
- };
977
- discMap.set(key, o);
978
- }
979
- }
980
- if (!hasDisc)
981
- return void 0;
982
- return discMap;
983
- });
984
- const generateFastpass = (shape) => {
985
- const doc = new Doc(["shape", "payload", "ctx"]);
986
- const { keys, optionalKeys } = _normalized.value;
987
- const parseStr = (key) => {
988
- const k = esc(key);
989
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
990
- };
991
- doc.write(`const input = payload.value;`);
992
- const ids = {};
993
- for (const key of keys) {
994
- ids[key] = randomString(15);
995
- }
996
- for (const key of keys) {
997
- if (optionalKeys.has(key))
998
- continue;
999
- const id = ids[key];
1000
- doc.write(`const ${id} = ${parseStr(key)};`);
1001
- doc.write(`
1002
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1003
- ...iss,
1004
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
1005
- })));`);
1006
- }
1007
- doc.write(`payload.value = {`);
1008
- doc.indented(() => {
1009
- for (const key of keys) {
1010
- if (optionalKeys.has(key))
1011
- continue;
1012
- const id = ids[key];
1013
- doc.write(` ${esc(key)}: ${id}.value,`);
1014
- }
1015
- });
1016
- doc.write(`}`);
1017
- for (const key of keys) {
1018
- if (!optionalKeys.has(key))
1019
- continue;
1020
- const id = ids[key];
1021
- doc.write(`const ${id} = ${parseStr(key)};`);
1022
- const k = esc(key);
1023
- doc.write(`
1024
- if (${id}.issues.length) {
1025
- if (input[${k}] === undefined) {
1026
- if (${k} in input) {
1027
- payload.value[${k}] = undefined;
1028
- }
1029
- } else {
1030
- payload.issues = payload.issues.concat(
1031
- ${id}.issues.map((iss) => ({
1032
- ...iss,
1033
- path: iss.path ? [${k}, ...iss.path] : [${k}],
1034
- }))
1035
- );
1036
- }
1037
- } else if (${id}.value === undefined) {
1038
- if (${k} in input) payload.value[${k}] = undefined;
1039
- } else {
1040
- payload.value[${k}] = ${id}.value;
1041
- }
1042
- `);
1043
- }
1044
- doc.write(`return payload;`);
1045
- const fn = doc.compile();
1046
- return (payload, ctx) => fn(shape, payload, ctx);
1047
- };
1048
- let fastpass;
1049
- const fastEnabled = allowsEval.value;
1050
- const isObject2 = isObject;
1051
- const { catchall } = def;
1052
- let value;
1053
- inst._zod.parse = (payload, ctx) => {
1054
- value ?? (value = _normalized.value);
1055
- const input = payload.value;
1056
- if (!isObject2(input)) {
1057
- payload.issues.push({
1058
- expected: "object",
1059
- code: "invalid_type",
1060
- input,
1061
- inst
1062
- });
1063
- return payload;
1064
- }
1065
- const proms = [];
1066
- if (fastEnabled && ctx?.async === false && ctx.noPrecompilation !== true) {
1067
- if (!fastpass)
1068
- fastpass = generateFastpass(def.shape);
1069
- payload = fastpass(payload, ctx);
1070
- } else {
1071
- payload.value = {};
1072
- const { keys, shape, optionalKeys } = value;
1073
- for (const key of keys) {
1074
- const valueSchema = shape[key];
1075
- const r = valueSchema._zod.run({ value: input[key], issues: [] }, ctx);
1076
- const isOptional = optionalKeys.has(key);
1077
- if (r instanceof Promise) {
1078
- proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
1079
- } else {
1080
- if (isOptional) {
1081
- handleOptionalObjectResult(r, payload, key, input);
1082
- } else {
1083
- handleObjectResult(r, payload, key);
1084
- }
1085
- }
1086
- }
1087
- }
1088
- if (!catchall) {
1089
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
1090
- }
1091
- const unrecognized = [];
1092
- const keySet = value.keySet;
1093
- const _catchall = catchall._zod;
1094
- const t = _catchall.def.type;
1095
- for (const key of Object.keys(input)) {
1096
- if (keySet.has(key))
1097
- continue;
1098
- if (t === "never") {
1099
- unrecognized.push(key);
1100
- continue;
1101
- }
1102
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1103
- if (r instanceof Promise) {
1104
- proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
1105
- } else {
1106
- handleObjectResult(r, payload, key);
1107
- }
1108
- }
1109
- if (unrecognized.length) {
1110
- payload.issues.push({
1111
- code: "unrecognized_keys",
1112
- keys: unrecognized,
1113
- input,
1114
- inst
1115
- });
1116
- }
1117
- if (!proms.length)
1118
- return payload;
1119
- return Promise.all(proms).then(() => {
1120
- return payload;
1121
- });
1122
- };
1123
- });
1124
- var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1125
- $ZodObjectLike.init(inst, def);
1126
- });
1127
- var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1128
- $ZodType.init(inst, def);
1129
- inst._zod.qout = "true";
1130
- if (def.innerType._zod.values)
1131
- inst._zod.values = /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]);
1132
- const pattern = def.innerType._zod.pattern;
1133
- if (pattern)
1134
- inst._zod.pattern = new RegExp(`^(${cleanRegex(pattern.source)})?$`);
1135
- inst._zod.parse = (payload, ctx) => {
1136
- if (payload.value === void 0) {
1137
- return payload;
1138
- }
1139
- return def.innerType._zod.run(payload, ctx);
1140
- };
1141
- });
1142
-
1143
- // ../../node_modules/.pnpm/@zod+core@0.5.1/node_modules/@zod/core/dist/esm/api.js
1144
- function _string(Class, params) {
1145
- return new Class({
1146
- type: "string",
1147
- ...normalizeParams(params)
1148
- });
1149
- }
1150
- function _boolean(Class, params) {
1151
- return new Class({
1152
- type: "boolean",
1153
- ...normalizeParams(params)
1154
- });
1155
- }
1156
- function _unknown(Class, params) {
1157
- return new Class({
1158
- type: "unknown",
1159
- ...normalizeParams(params)
1160
- });
1161
- }
1162
-
1163
- // ../../node_modules/.pnpm/@zod+mini@4.0.0-beta.20250415T232143_a6e9e9ac6408e2c9467a9c53ed9f86b4/node_modules/@zod/mini/dist/esm/parse.js
1164
- var parse2 = /* @__PURE__ */ _parse.bind({ Error: $ZodError });
1165
- var safeParse = /* @__PURE__ */ _safeParse.bind({ Error: $ZodError });
1166
- var parseAsync2 = /* @__PURE__ */ _parseAsync.bind({ Error: $ZodError });
1167
- var safeParseAsync = /* @__PURE__ */ _safeParseAsync.bind({
1168
- Error: $ZodError
1169
- });
1170
-
1171
- // ../../node_modules/.pnpm/@zod+mini@4.0.0-beta.20250415T232143_a6e9e9ac6408e2c9467a9c53ed9f86b4/node_modules/@zod/mini/dist/esm/schemas.js
1172
- var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
1173
- if (!inst._zod)
1174
- throw new Error("Uninitialized schema in mixin ZodMiniType.");
1175
- $ZodType.init(inst, def);
1176
- inst.def = def;
1177
- inst.parse = (data, params) => parse2(inst, data, params);
1178
- inst.safeParse = (data, params) => safeParse(inst, data, params);
1179
- inst.parseAsync = async (data, params) => parseAsync2(inst, data, params);
1180
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
1181
- inst.check = (...checks) => {
1182
- return inst.clone({
1183
- ...def,
1184
- checks: [
1185
- ...def.checks ?? [],
1186
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" } } } : ch)
1187
- ]
1188
- });
1189
- };
1190
- inst.clone = (_def) => clone(inst, _def ?? def);
1191
- inst.brand = () => inst;
1192
- inst.register = (reg, meta) => {
1193
- reg.add(inst, meta);
1194
- return inst;
1195
- };
1196
- });
1197
- var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
1198
- $ZodString.init(inst, def);
1199
- ZodMiniType.init(inst, def);
1200
- });
1201
- function string2(params) {
1202
- return _string(ZodMiniString, params);
1203
- }
1204
- var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
1205
- $ZodBoolean.init(inst, def);
1206
- ZodMiniType.init(inst, def);
1207
- });
1208
- function boolean2(params) {
1209
- return _boolean(ZodMiniBoolean, params);
1210
- }
1211
- var ZodMiniUnknown = /* @__PURE__ */ $constructor("ZodMiniUnknown", (inst, def) => {
1212
- $ZodUnknown.init(inst, def);
1213
- ZodMiniType.init(inst, def);
1214
- });
1215
- function unknown(params) {
1216
- return _unknown(ZodMiniUnknown, params);
1217
- }
1218
- var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
1219
- $ZodArray.init(inst, def);
1220
- ZodMiniType.init(inst, def);
1221
- });
1222
- function array(element, params) {
1223
- return new ZodMiniArray({
1224
- type: "array",
1225
- element,
1226
- // get element() {
1227
- // return element;
1228
- // },
1229
- ...util_exports.normalizeParams(params)
1230
- });
1231
- }
1232
- var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
1233
- $ZodObject.init(inst, def);
1234
- ZodMiniType.init(inst, def);
1235
- });
1236
- function object(shape, params) {
1237
- const def = {
1238
- type: "object",
1239
- shape: shape ?? {},
1240
- get optional() {
1241
- return util_exports.optionalObjectKeys(shape ?? {});
1242
- },
1243
- ...util_exports.normalizeParams(params)
1244
- };
1245
- return new ZodMiniObject(def);
1246
- }
1247
- var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
1248
- $ZodOptional.init(inst, def);
1249
- ZodMiniType.init(inst, def);
1250
- });
1251
- function optional(innerType, params) {
1252
- return new ZodMiniOptional({
1253
- type: "optional",
1254
- innerType,
1255
- ...util_exports.normalizeParams(params)
1256
- });
1257
- }
1258
-
1259
- // ../shared/src/schemas.ts
1260
- var CustomComponentPropSchema = object({
1261
- /**
1262
- * The name of the prop in the user-defined component.
1263
- * @example
1264
- * "to"
1265
- */
1266
- name: string2(),
1267
- /**
1268
- * The name of the prop in the host component.
1269
- * @example
1270
- * "href"
1271
- */
1272
- as: optional(string2()),
1273
- /**
1274
- * Whether the prop is controlled or not in the user-defined component.
1275
- * @internal
1276
- * @example
1277
- * `true`
1278
- */
1279
- controlled: optional(boolean2()),
1280
- /**
1281
- * The default value of the prop in the user-defined component.
1282
- * @example
1283
- * `"/"`
1284
- */
1285
- defaultValue: optional(string2())
1286
- });
1287
- var CustomComponentSchema = object({
1288
- /**
1289
- * The name of the user-defined component.
1290
- * @example
1291
- * "Link"
1292
- */
1293
- name: string2(),
1294
- /**
1295
- * The name of the host component that the user-defined component represents.
1296
- * @example
1297
- * "a"
1298
- */
1299
- as: optional(string2()),
1300
- /**
1301
- * Attributes mapping between the user-defined component and the host component.
1302
- * @example
1303
- * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
1304
- */
1305
- attributes: optional(array(CustomComponentPropSchema)),
1306
- /**
1307
- * The ESQuery selector to select the component precisely.
1308
- * @internal
1309
- * @example
1310
- * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
1311
- */
1312
- selector: optional(string2())
1313
- });
1314
- var CustomHooksSchema = object({
1315
- use: optional(array(string2())),
1316
- useActionState: optional(array(string2())),
1317
- useCallback: optional(array(string2())),
1318
- useContext: optional(array(string2())),
1319
- useDebugValue: optional(array(string2())),
1320
- useDeferredValue: optional(array(string2())),
1321
- useEffect: optional(array(string2())),
1322
- useFormStatus: optional(array(string2())),
1323
- useId: optional(array(string2())),
1324
- useImperativeHandle: optional(array(string2())),
1325
- useInsertionEffect: optional(array(string2())),
1326
- useLayoutEffect: optional(array(string2())),
1327
- useMemo: optional(array(string2())),
1328
- useOptimistic: optional(array(string2())),
1329
- useReducer: optional(array(string2())),
1330
- useRef: optional(array(string2())),
1331
- useState: optional(array(string2())),
1332
- useSyncExternalStore: optional(array(string2())),
1333
- useTransition: optional(array(string2()))
1334
- });
1335
- object({
1336
- /**
1337
- * The source where React is imported from.
1338
- * @description This allows to specify a custom import location for React when not using the official distribution.
1339
- * @default `"react"`
1340
- * @example `"@pika/react"`
1341
- */
1342
- importSource: optional(string2()),
1343
- /**
1344
- * The identifier that's used for JSX Element creation.
1345
- * @default `"createElement"`
1346
- * @deprecated
1347
- */
1348
- jsxPragma: optional(string2()),
1349
- /**
1350
- * The identifier that's used for JSX fragment elements.
1351
- * @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
1352
- * @default `"Fragment"`
1353
- * @deprecated
1354
- */
1355
- jsxPragmaFrag: optional(string2()),
1356
- /**
1357
- * The name of the prop that is used for polymorphic components.
1358
- * @description This is used to determine the type of the component.
1359
- * @example `"as"`
1360
- */
1361
- polymorphicPropName: optional(string2()),
1362
- /**
1363
- * @default `true`
1364
- * @internal
1365
- */
1366
- strict: optional(boolean2()),
1367
- /**
1368
- * Check both the shape and the import to determine if an API is from React.
1369
- * @default `true`
1370
- * @internal
1371
- */
1372
- skipImportCheck: optional(boolean2()),
1373
- /**
1374
- * React version to use, "detect" means auto detect React version from the project's dependencies.
1375
- * If `importSource` is specified, an equivalent version of React should be provided here.
1376
- * @example `"18.3.1"`
1377
- * @default `"detect"`
1378
- */
1379
- version: optional(string2()),
1380
- /**
1381
- * A object to define additional hooks that are equivalent to the built-in React Hooks.
1382
- * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
1383
- * @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
1384
- */
1385
- additionalHooks: optional(CustomHooksSchema),
1386
- /**
1387
- * An array of user-defined components
1388
- * @description This is used to inform the ESLint React plugins how to treat these components during checks.
1389
- * @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
1390
- */
1391
- additionalComponents: optional(array(CustomComponentSchema))
1392
- });
1393
- optional(
1394
- object({
1395
- "react-x": optional(unknown())
1396
- }),
1397
- {}
1398
- );
1399
- var DEFAULT_ESLINT_REACT_SETTINGS = {
1400
- importSource: "react"};
10
+ // src/component/component-collector.ts
1401
11
  function getInstanceId(node, prev) {
1402
12
  switch (true) {
1403
13
  case (node.type === AST_NODE_TYPES.VariableDeclarator && node.init === prev):
@@ -2129,10 +739,10 @@ function getComponentFlagFromInitPath(initPath) {
2129
739
  return flag;
2130
740
  }
2131
741
  function isComponentName(name) {
2132
- return RegExp$1.COMPONENT_NAME.test(name);
742
+ return RegExp.COMPONENT_NAME.test(name);
2133
743
  }
2134
744
  function isComponentNameLoose(name) {
2135
- return RegExp$1.COMPONENT_NAME_LOOSE.test(name);
745
+ return RegExp.COMPONENT_NAME_LOOSE.test(name);
2136
746
  }
2137
747
  function getComponentNameFromId(id) {
2138
748
  if (id == null) return _;