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

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