@eslint-react/core 1.48.2 → 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.
package/dist/index.mjs CHANGED
@@ -1,916 +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
10
  // src/component/component-collector.ts
11
-
12
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/core.js
13
- // @__NO_SIDE_EFFECTS__
14
- function $constructor(name, initializer) {
15
- class _6 {
16
- constructor(def) {
17
- var _a;
18
- const th = this;
19
- _6.init(th, def);
20
- (_a = th._zod).deferred ?? (_a.deferred = []);
21
- for (const fn of th._zod.deferred) {
22
- fn();
23
- }
24
- }
25
- static init(inst, def) {
26
- var _a;
27
- inst._zod ?? (inst._zod = {});
28
- (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
29
- inst._zod.traits.add(name);
30
- initializer(inst, def);
31
- for (const k in _6.prototype) {
32
- Object.defineProperty(inst, k, { value: _6.prototype[k].bind(inst) });
33
- }
34
- inst._zod.constr = _6;
35
- inst._zod.def = def;
36
- }
37
- static [Symbol.hasInstance](inst) {
38
- return inst?._zod?.traits?.has(name);
39
- }
40
- }
41
- Object.defineProperty(_6, "name", { value: name });
42
- return _6;
43
- }
44
- var $ZodAsyncError = class extends Error {
45
- constructor() {
46
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
47
- }
48
- };
49
- var globalConfig = {};
50
- function config(config2) {
51
- return globalConfig;
52
- }
53
- function jsonStringifyReplacer(_6, value) {
54
- if (typeof value === "bigint")
55
- return value.toString();
56
- return value;
57
- }
58
- function cached(getter) {
59
- return {
60
- get value() {
61
- {
62
- const value = getter();
63
- Object.defineProperty(this, "value", { value });
64
- return value;
65
- }
66
- }
67
- };
68
- }
69
- function cleanRegex(source) {
70
- const start = source.startsWith("^") ? 1 : 0;
71
- const end = source.endsWith("$") ? source.length - 1 : source.length;
72
- return source.slice(start, end);
73
- }
74
- function defineLazy(object2, key, getter) {
75
- Object.defineProperty(object2, key, {
76
- get() {
77
- {
78
- const value = getter();
79
- object2[key] = value;
80
- return value;
81
- }
82
- },
83
- set(v) {
84
- Object.defineProperty(object2, key, {
85
- value: v
86
- // configurable: true,
87
- });
88
- },
89
- configurable: true
90
- });
91
- }
92
- function randomString(length = 10) {
93
- const chars = "abcdefghijklmnopqrstuvwxyz";
94
- let str = "";
95
- for (let i = 0; i < length; i++) {
96
- str += chars[Math.floor(Math.random() * chars.length)];
97
- }
98
- return str;
99
- }
100
- function esc(str) {
101
- return JSON.stringify(str);
102
- }
103
- function isObject(data) {
104
- return typeof data === "object" && data !== null;
105
- }
106
- var allowsEval = cached(() => {
107
- try {
108
- new Function("");
109
- return true;
110
- } catch (_6) {
111
- return false;
112
- }
113
- });
114
- function clone(inst, def) {
115
- return new inst._zod.constr(def);
116
- }
117
- function normalizeParams(_params) {
118
- const params = _params;
119
- if (!params)
120
- return {};
121
- if (typeof params === "string")
122
- return { error: () => params };
123
- if (params?.message !== void 0) {
124
- if (params?.error !== void 0)
125
- throw new Error("Cannot specify both `message` and `error` params");
126
- params.error = params.message;
127
- }
128
- delete params.message;
129
- if (typeof params.error === "string")
130
- return { ...params, error: () => params.error };
131
- return params;
132
- }
133
- function optionalObjectKeys(shape) {
134
- return Object.keys(shape).filter((k) => {
135
- return shape[k]._zod.qout === "true";
136
- });
137
- }
138
- function aborted(x, startIndex = 0) {
139
- for (let i = startIndex; i < x.issues.length; i++) {
140
- if (x.issues[i].continue !== true)
141
- return true;
142
- }
143
- return false;
144
- }
145
- function prefixIssues(path, issues) {
146
- return issues.map((iss) => {
147
- var _a;
148
- (_a = iss).path ?? (_a.path = []);
149
- iss.path.unshift(path);
150
- return iss;
151
- });
152
- }
153
- function unwrapMessage(message) {
154
- return typeof message === "string" ? message : message?.message;
155
- }
156
- function finalizeIssue(iss, ctx, config2) {
157
- const full = { ...iss, path: iss.path ?? [] };
158
- if (!iss.message) {
159
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
160
- full.message = message;
161
- }
162
- delete full.inst;
163
- delete full.continue;
164
- if (!ctx?.reportInput) {
165
- delete full.input;
166
- }
167
- return full;
168
- }
169
-
170
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/errors.js
171
- var ZOD_ERROR = Symbol.for("{{zod.error}}");
172
- var $ZodError = class {
173
- get message() {
174
- return JSON.stringify(this.issues, jsonStringifyReplacer, 2);
175
- }
176
- constructor(issues) {
177
- Object.defineProperty(this, "_tag", { value: ZOD_ERROR, enumerable: false });
178
- Object.defineProperty(this, "name", { value: "$ZodError", enumerable: false });
179
- this.issues = issues;
180
- }
181
- // @ts-ignore
182
- static [Symbol.hasInstance](inst) {
183
- return inst?._tag === ZOD_ERROR;
184
- }
185
- };
186
-
187
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/parse.js
188
- function _parse(schema, value, _ctx) {
189
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
190
- const result = schema._zod.run({ value, issues: [] }, ctx);
191
- if (result instanceof Promise) {
192
- throw new $ZodAsyncError();
193
- }
194
- if (result.issues.length) {
195
- throw new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
196
- }
197
- return result.value;
198
- }
199
- function _safeParse(schema, value, _ctx) {
200
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
201
- const result = schema._zod.run({ value, issues: [] }, ctx);
202
- if (result instanceof Promise) {
203
- throw new $ZodAsyncError();
204
- }
205
- return result.issues.length ? {
206
- success: false,
207
- error: new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
208
- } : { success: true, data: result.value };
209
- }
210
- async function _parseAsync(schema, value, _ctx) {
211
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
212
- let result = schema._zod.run({ value, issues: [] }, ctx);
213
- if (result instanceof Promise)
214
- result = await result;
215
- if (result.issues.length) {
216
- throw new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
217
- }
218
- return result.value;
219
- }
220
- async function _safeParseAsync(schema, value, _ctx) {
221
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
222
- let result = schema._zod.run({ value, issues: [] }, ctx);
223
- if (result instanceof Promise)
224
- result = await result;
225
- if (result.issues.length) {
226
- return {
227
- success: false,
228
- error: new (this?.Error ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
229
- };
230
- }
231
- return { success: true, data: result.value };
232
- }
233
- var string = (params) => {
234
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
235
- return new RegExp(`^${regex}$`);
236
- };
237
- var boolean = /true|false/i;
238
-
239
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/doc.js
240
- var Doc = class {
241
- constructor(args) {
242
- this.content = [];
243
- this.indent = 0;
244
- this.args = args;
245
- }
246
- indented(fn) {
247
- this.indent += 1;
248
- fn(this);
249
- this.indent -= 1;
250
- }
251
- write(arg) {
252
- if (typeof arg === "function") {
253
- arg(this, { execution: "sync" });
254
- arg(this, { execution: "async" });
255
- return;
256
- }
257
- const content = arg;
258
- const lines = content.split("\n").filter((x) => x);
259
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
260
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
261
- for (const line of dedented) {
262
- this.content.push(line);
263
- }
264
- }
265
- compile() {
266
- const lines = [...this.content.map((x) => ` ${x}`)];
267
- return new Function(...this.args, lines.join("\n"));
268
- }
269
- };
270
-
271
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/schemas.js
272
- var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
273
- var _a;
274
- inst ?? (inst = {});
275
- inst._zod.id = def.type + "_" + randomString(10);
276
- inst._zod.def = def;
277
- inst._zod.computed = inst._zod.computed || {};
278
- const checks = [...inst._zod.def.checks ?? []];
279
- def.type;
280
- if (inst._zod.traits.has("$ZodCheck")) {
281
- checks.unshift(inst);
282
- }
283
- for (const ch of checks) {
284
- ch._zod.onattach?.(inst);
285
- }
286
- if (checks.length === 0) {
287
- (_a = inst._zod).deferred ?? (_a.deferred = []);
288
- inst._zod.deferred?.push(() => {
289
- inst._zod.run = inst._zod.parse;
290
- });
291
- } else {
292
- const runChecks = (payload, checks2, ctx) => {
293
- let isAborted = aborted(payload);
294
- let asyncResult;
295
- for (const ch of checks2) {
296
- if (ch._zod.when) {
297
- const shouldRun = ch._zod.when(payload);
298
- if (!shouldRun)
299
- continue;
300
- } else {
301
- if (isAborted) {
302
- continue;
303
- }
304
- }
305
- const currLen = payload.issues.length;
306
- const _6 = ch._zod.check(payload);
307
- if (_6 instanceof Promise && ctx?.async === false) {
308
- throw new $ZodAsyncError();
309
- }
310
- if (asyncResult || _6 instanceof Promise) {
311
- asyncResult = asyncResult ?? Promise.resolve();
312
- asyncResult.then(async () => {
313
- await _6;
314
- const nextLen = payload.issues.length;
315
- if (nextLen === currLen)
316
- return;
317
- if (!isAborted)
318
- isAborted = aborted(payload, currLen);
319
- });
320
- } else {
321
- const nextLen = payload.issues.length;
322
- if (nextLen === currLen)
323
- continue;
324
- if (!isAborted)
325
- isAborted = aborted(payload, currLen);
326
- }
327
- }
328
- if (asyncResult) {
329
- return asyncResult.then(() => {
330
- return payload;
331
- });
332
- }
333
- return payload;
334
- };
335
- inst._zod.run = (payload, ctx) => {
336
- const result = inst._zod.parse(payload, ctx);
337
- if (result instanceof Promise) {
338
- if (ctx.async === false)
339
- throw new $ZodAsyncError();
340
- return result.then((result2) => runChecks(result2, checks, ctx));
341
- }
342
- return runChecks(result, checks, ctx);
343
- };
344
- }
345
- defineLazy(inst, "~standard", () => ({
346
- validate: (value) => {
347
- const result = inst._zod.run({ value, issues: [] }, {});
348
- if (result instanceof Promise) {
349
- return result.then(({ issues, value: value2 }) => {
350
- if (issues.length === 0)
351
- return { value: value2 };
352
- return { issues };
353
- });
354
- }
355
- if (result.issues.length === 0)
356
- return { value: result.value };
357
- return { issues: result.issues };
358
- },
359
- vendor: "zod",
360
- version: 1
361
- }));
362
- });
363
- var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
364
- $ZodType.init(inst, def);
365
- inst._zod.pattern = inst?._zod.computed?.pattern ?? string(inst._zod.computed);
366
- inst._zod.parse = (payload, _6) => {
367
- if (def.coerce)
368
- try {
369
- payload.value = String(payload.value);
370
- } catch (_7) {
371
- }
372
- if (typeof payload.value === "string")
373
- return payload;
374
- payload.issues.push({
375
- expected: "string",
376
- code: "invalid_type",
377
- input: payload.value,
378
- inst
379
- });
380
- return payload;
381
- };
382
- });
383
- var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
384
- $ZodType.init(inst, def);
385
- inst._zod.pattern = boolean;
386
- inst._zod.parse = (payload, _ctx) => {
387
- if (def.coerce)
388
- try {
389
- payload.value = Boolean(payload.value);
390
- } catch (_6) {
391
- }
392
- const input = payload.value;
393
- if (typeof input === "boolean")
394
- return payload;
395
- payload.issues.push({
396
- expected: "boolean",
397
- code: "invalid_type",
398
- input,
399
- inst
400
- });
401
- return payload;
402
- };
403
- });
404
- var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
405
- $ZodType.init(inst, def);
406
- inst._zod.parse = (payload) => payload;
407
- });
408
- function handleArrayResult(result, final, index) {
409
- if (result.issues.length) {
410
- final.issues.push(...prefixIssues(index, result.issues));
411
- }
412
- final.value[index] = result.value;
413
- }
414
- var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
415
- $ZodType.init(inst, def);
416
- inst._zod.parse = (payload, ctx) => {
417
- const input = payload.value;
418
- if (!Array.isArray(input)) {
419
- payload.issues.push({
420
- expected: "array",
421
- code: "invalid_type",
422
- input,
423
- inst
424
- });
425
- return payload;
426
- }
427
- payload.value = Array(input.length);
428
- const proms = [];
429
- for (let i = 0; i < input.length; i++) {
430
- const item = input[i];
431
- const result = def.element._zod.run({
432
- value: item,
433
- issues: []
434
- }, ctx);
435
- if (result instanceof Promise) {
436
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
437
- } else {
438
- handleArrayResult(result, payload, i);
439
- }
440
- }
441
- if (proms.length) {
442
- return Promise.all(proms).then(() => payload);
443
- }
444
- return payload;
445
- };
446
- });
447
- function handleObjectResult(result, final, key) {
448
- if (result.issues.length) {
449
- final.issues.push(...prefixIssues(key, result.issues));
450
- } else {
451
- final.value[key] = result.value;
452
- }
453
- }
454
- function handleOptionalObjectResult(result, final, key, input) {
455
- if (result.issues.length) {
456
- if (input[key] === void 0) {
457
- if (key in input) {
458
- final.value[key] = void 0;
459
- }
460
- } else {
461
- final.issues.push(...prefixIssues(key, result.issues));
462
- }
463
- } else if (result.value === void 0) {
464
- if (key in input)
465
- final.value[key] = void 0;
466
- } else {
467
- final.value[key] = result.value;
468
- }
469
- }
470
- var $ZodObjectLike = /* @__PURE__ */ $constructor("$ZodObjectLike", (inst, def) => {
471
- $ZodType.init(inst, def);
472
- defineLazy(inst._zod, "shape", () => def.shape);
473
- const _normalized = cached(() => {
474
- const keys = Object.keys(def.shape);
475
- return {
476
- shape: def.shape,
477
- keys,
478
- keySet: new Set(keys),
479
- numKeys: keys.length,
480
- optionalKeys: new Set(def.optional)
481
- };
482
- });
483
- defineLazy(inst._zod, "disc", () => {
484
- const shape = def.shape;
485
- const discMap = /* @__PURE__ */ new Map();
486
- let hasDisc = false;
487
- for (const key in shape) {
488
- const field = shape[key]._zod;
489
- if (field.values || field.disc) {
490
- hasDisc = true;
491
- const o = {
492
- values: new Set(field.values ?? []),
493
- maps: field.disc ? [field.disc] : []
494
- };
495
- discMap.set(key, o);
496
- }
497
- }
498
- if (!hasDisc)
499
- return void 0;
500
- return discMap;
501
- });
502
- const generateFastpass = (shape) => {
503
- const doc = new Doc(["shape", "payload", "ctx"]);
504
- const { keys, optionalKeys } = _normalized.value;
505
- const parseStr = (key) => {
506
- const k = esc(key);
507
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
508
- };
509
- doc.write(`const input = payload.value;`);
510
- const ids = {};
511
- for (const key of keys) {
512
- ids[key] = randomString(15);
513
- }
514
- for (const key of keys) {
515
- if (optionalKeys.has(key))
516
- continue;
517
- const id = ids[key];
518
- doc.write(`const ${id} = ${parseStr(key)};`);
519
- doc.write(`
520
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
521
- ...iss,
522
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
523
- })));`);
524
- }
525
- doc.write(`payload.value = {`);
526
- doc.indented(() => {
527
- for (const key of keys) {
528
- if (optionalKeys.has(key))
529
- continue;
530
- const id = ids[key];
531
- doc.write(` ${esc(key)}: ${id}.value,`);
532
- }
533
- });
534
- doc.write(`}`);
535
- for (const key of keys) {
536
- if (!optionalKeys.has(key))
537
- continue;
538
- const id = ids[key];
539
- doc.write(`const ${id} = ${parseStr(key)};`);
540
- const k = esc(key);
541
- doc.write(`
542
- if (${id}.issues.length) {
543
- if (input[${k}] === undefined) {
544
- if (${k} in input) {
545
- payload.value[${k}] = undefined;
546
- }
547
- } else {
548
- payload.issues = payload.issues.concat(
549
- ${id}.issues.map((iss) => ({
550
- ...iss,
551
- path: iss.path ? [${k}, ...iss.path] : [${k}],
552
- }))
553
- );
554
- }
555
- } else if (${id}.value === undefined) {
556
- if (${k} in input) payload.value[${k}] = undefined;
557
- } else {
558
- payload.value[${k}] = ${id}.value;
559
- }
560
- `);
561
- }
562
- doc.write(`return payload;`);
563
- const fn = doc.compile();
564
- return (payload, ctx) => fn(shape, payload, ctx);
565
- };
566
- let fastpass;
567
- const fastEnabled = allowsEval.value;
568
- const isObject2 = isObject;
569
- const { catchall } = def;
570
- inst._zod.parse = (payload, ctx) => {
571
- const input = payload.value;
572
- if (!isObject2(input)) {
573
- payload.issues.push({
574
- expected: "object",
575
- code: "invalid_type",
576
- input,
577
- inst
578
- });
579
- return payload;
580
- }
581
- const proms = [];
582
- if (fastEnabled && ctx?.async === false && ctx.noPrecompilation !== true) {
583
- if (!fastpass)
584
- fastpass = generateFastpass(def.shape);
585
- payload = fastpass(payload, ctx);
586
- } else {
587
- payload.value = {};
588
- const { keys, shape, optionalKeys } = _normalized.value;
589
- for (const key of keys) {
590
- const valueSchema = shape[key];
591
- const r = valueSchema._zod.run({ value: input[key], issues: [] }, ctx);
592
- const isOptional = optionalKeys.has(key);
593
- if (r instanceof Promise) {
594
- proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
595
- } else {
596
- if (isOptional) {
597
- handleOptionalObjectResult(r, payload, key, input);
598
- } else {
599
- handleObjectResult(r, payload, key);
600
- }
601
- }
602
- }
603
- }
604
- if (!catchall) {
605
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
606
- }
607
- const unrecognized = [];
608
- for (const key of Object.keys(input)) {
609
- if (_normalized.value.keySet.has(key))
610
- continue;
611
- if (catchall._zod.def.type === "never") {
612
- unrecognized.push(key);
613
- continue;
614
- }
615
- const r = catchall._zod.run({ value: input[key], issues: [] }, ctx);
616
- if (r instanceof Promise) {
617
- proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
618
- } else {
619
- handleObjectResult(r, payload, key);
620
- }
621
- }
622
- if (unrecognized.length) {
623
- payload.issues.push({
624
- code: "unrecognized_keys",
625
- keys: unrecognized,
626
- input,
627
- inst
628
- });
629
- }
630
- if (!proms.length)
631
- return payload;
632
- return Promise.all(proms).then(() => {
633
- return payload;
634
- });
635
- };
636
- });
637
- var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
638
- $ZodObjectLike.init(inst, def);
639
- });
640
- var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
641
- $ZodType.init(inst, def);
642
- inst._zod.qout = "true";
643
- if (def.innerType._zod.values)
644
- inst._zod.values = /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]);
645
- const pattern = def.innerType._zod.pattern;
646
- if (pattern)
647
- inst._zod.pattern = new RegExp(`^(${cleanRegex(pattern.source)})?$`);
648
- inst._zod.parse = (payload, ctx) => {
649
- if (payload.value === void 0) {
650
- return payload;
651
- }
652
- return def.innerType._zod.run(payload, ctx);
653
- };
654
- });
655
-
656
- // ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/api.js
657
- function _string(Class, params) {
658
- return new Class({
659
- type: "string",
660
- ...normalizeParams(params)
661
- });
662
- }
663
- function _boolean(Class, params) {
664
- return new Class({
665
- type: "boolean",
666
- ...normalizeParams(params)
667
- });
668
- }
669
- function _unknown(Class, params) {
670
- return new Class({
671
- type: "unknown",
672
- ...normalizeParams(params)
673
- });
674
- }
675
-
676
- // ../../node_modules/.pnpm/@zod+mini@4.0.0-beta.0/node_modules/@zod/mini/dist/esm/parse.js
677
- var parse2 = /* @__PURE__ */ _parse.bind({ Error: $ZodError });
678
- var safeParse = /* @__PURE__ */ _safeParse.bind({ Error: $ZodError });
679
- var parseAsync2 = /* @__PURE__ */ _parseAsync.bind({ Error: $ZodError });
680
- var safeParseAsync = /* @__PURE__ */ _safeParseAsync.bind({
681
- Error: $ZodError
682
- });
683
-
684
- // ../../node_modules/.pnpm/@zod+mini@4.0.0-beta.0/node_modules/@zod/mini/dist/esm/schemas.js
685
- var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
686
- if (!inst._zod)
687
- throw new Error("Uninitialized schema in mixin ZodMiniType.");
688
- $ZodType.init(inst, def);
689
- inst.def = def;
690
- inst.parse = (data, params) => parse2(inst, data, params);
691
- inst.safeParse = (data, params) => safeParse(inst, data, params);
692
- inst.parseAsync = async (data, params) => parseAsync2(inst, data, params);
693
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
694
- inst.check = (...checks) => {
695
- return inst.clone({
696
- ...def,
697
- checks: [
698
- ...def.checks ?? [],
699
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" } } } : ch)
700
- ]
701
- });
702
- };
703
- inst.clone = (_def) => clone(inst, _def ?? def);
704
- inst.brand = () => inst;
705
- inst.register = (reg, meta) => {
706
- reg.add(inst, meta);
707
- return inst;
708
- };
709
- });
710
- var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
711
- $ZodString.init(inst, def);
712
- ZodMiniType.init(inst, def);
713
- });
714
- function string2(params) {
715
- return _string(ZodMiniString, params);
716
- }
717
- var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
718
- $ZodBoolean.init(inst, def);
719
- ZodMiniType.init(inst, def);
720
- });
721
- function boolean2(params) {
722
- return _boolean(ZodMiniBoolean, params);
723
- }
724
- var ZodMiniUnknown = /* @__PURE__ */ $constructor("ZodMiniUnknown", (inst, def) => {
725
- $ZodUnknown.init(inst, def);
726
- ZodMiniType.init(inst, def);
727
- });
728
- function unknown(params) {
729
- return _unknown(ZodMiniUnknown, params);
730
- }
731
- var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
732
- $ZodArray.init(inst, def);
733
- ZodMiniType.init(inst, def);
734
- });
735
- function array(element, params) {
736
- return new ZodMiniArray({
737
- type: "array",
738
- element,
739
- // get element() {
740
- // return element;
741
- // },
742
- ...normalizeParams(params)
743
- });
744
- }
745
- var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
746
- $ZodObject.init(inst, def);
747
- ZodMiniType.init(inst, def);
748
- });
749
- function object(shape, params) {
750
- const def = {
751
- type: "object",
752
- shape: shape ?? {},
753
- get optional() {
754
- return optionalObjectKeys(shape ?? {});
755
- },
756
- ...normalizeParams(params)
757
- };
758
- return new ZodMiniObject(def);
759
- }
760
- var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
761
- $ZodOptional.init(inst, def);
762
- ZodMiniType.init(inst, def);
763
- });
764
- function optional(innerType, params) {
765
- return new ZodMiniOptional({
766
- type: "optional",
767
- innerType,
768
- ...normalizeParams(params)
769
- });
770
- }
771
-
772
- // ../shared/src/schemas.ts
773
- var CustomComponentPropSchema = object({
774
- /**
775
- * The name of the prop in the user-defined component.
776
- * @example
777
- * "to"
778
- */
779
- name: string2(),
780
- /**
781
- * The name of the prop in the host component.
782
- * @example
783
- * "href"
784
- */
785
- as: optional(string2()),
786
- /**
787
- * Whether the prop is controlled or not in the user-defined component.
788
- * @internal
789
- * @example
790
- * `true`
791
- */
792
- controlled: optional(boolean2()),
793
- /**
794
- * The default value of the prop in the user-defined component.
795
- * @example
796
- * `"/"`
797
- */
798
- defaultValue: optional(string2())
799
- });
800
- var CustomComponentSchema = object({
801
- /**
802
- * The name of the user-defined component.
803
- * @example
804
- * "Link"
805
- */
806
- name: string2(),
807
- /**
808
- * The name of the host component that the user-defined component represents.
809
- * @example
810
- * "a"
811
- */
812
- as: optional(string2()),
813
- /**
814
- * Attributes mapping between the user-defined component and the host component.
815
- * @example
816
- * `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
817
- */
818
- attributes: optional(array(CustomComponentPropSchema)),
819
- /**
820
- * The ESQuery selector to select the component precisely.
821
- * @internal
822
- * @example
823
- * `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
824
- */
825
- selector: optional(string2())
826
- });
827
- var CustomHooksSchema = object({
828
- use: optional(array(string2())),
829
- useActionState: optional(array(string2())),
830
- useCallback: optional(array(string2())),
831
- useContext: optional(array(string2())),
832
- useDebugValue: optional(array(string2())),
833
- useDeferredValue: optional(array(string2())),
834
- useEffect: optional(array(string2())),
835
- useFormStatus: optional(array(string2())),
836
- useId: optional(array(string2())),
837
- useImperativeHandle: optional(array(string2())),
838
- useInsertionEffect: optional(array(string2())),
839
- useLayoutEffect: optional(array(string2())),
840
- useMemo: optional(array(string2())),
841
- useOptimistic: optional(array(string2())),
842
- useReducer: optional(array(string2())),
843
- useRef: optional(array(string2())),
844
- useState: optional(array(string2())),
845
- useSyncExternalStore: optional(array(string2())),
846
- useTransition: optional(array(string2()))
847
- });
848
- object({
849
- /**
850
- * The source where React is imported from.
851
- * @description This allows to specify a custom import location for React when not using the official distribution.
852
- * @default `"react"`
853
- * @example `"@pika/react"`
854
- */
855
- importSource: optional(string2()),
856
- /**
857
- * The identifier that's used for JSX Element creation.
858
- * @default `"createElement"`
859
- * @deprecated
860
- */
861
- jsxPragma: optional(string2()),
862
- /**
863
- * The identifier that's used for JSX fragment elements.
864
- * @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
865
- * @default `"Fragment"`
866
- * @deprecated
867
- */
868
- jsxPragmaFrag: optional(string2()),
869
- /**
870
- * The name of the prop that is used for polymorphic components.
871
- * @description This is used to determine the type of the component.
872
- * @example `"as"`
873
- */
874
- polymorphicPropName: optional(string2()),
875
- /**
876
- * @default `true`
877
- * @internal
878
- */
879
- strict: optional(boolean2()),
880
- /**
881
- * Check both the shape and the import to determine if an API is from React.
882
- * @default `true`
883
- * @internal
884
- */
885
- skipImportCheck: optional(boolean2()),
886
- /**
887
- * React version to use, "detect" means auto detect React version from the project's dependencies.
888
- * If `importSource` is specified, an equivalent version of React should be provided here.
889
- * @example `"18.3.1"`
890
- * @default `"detect"`
891
- */
892
- version: optional(string2()),
893
- /**
894
- * A object to define additional hooks that are equivalent to the built-in React Hooks.
895
- * @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
896
- * @example `{ useEffect: ["useIsomorphicLayoutEffect"] }`
897
- */
898
- additionalHooks: optional(CustomHooksSchema),
899
- /**
900
- * An array of user-defined components
901
- * @description This is used to inform the ESLint React plugins how to treat these components during checks.
902
- * @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
903
- */
904
- additionalComponents: optional(array(CustomComponentSchema))
905
- });
906
- optional(
907
- object({
908
- "react-x": optional(unknown())
909
- }),
910
- {}
911
- );
912
- var DEFAULT_ESLINT_REACT_SETTINGS = {
913
- importSource: "react"};
914
11
  function getInstanceId(node, prev) {
915
12
  switch (true) {
916
13
  case (node.type === AST_NODE_TYPES.VariableDeclarator && node.init === prev):
@@ -1168,10 +265,10 @@ function isFunctionOfUseEffectSetup(node) {
1168
265
  function isFunctionOfUseEffectCleanup(node) {
1169
266
  if (node == null) return false;
1170
267
  const pReturn = AST9.findParentNode(node, AST9.is(AST_NODE_TYPES.ReturnStatement));
1171
- const pFaunction = AST9.findParentNode(node, AST9.isFunction);
268
+ const pFunction = AST9.findParentNode(node, AST9.isFunction);
1172
269
  const pFunctionOfReturn = AST9.findParentNode(pReturn, AST9.isFunction);
1173
- if (pFaunction !== pFunctionOfReturn) return false;
1174
- return isFunctionOfUseEffectSetup(pFaunction);
270
+ if (pFunction !== pFunctionOfReturn) return false;
271
+ return isFunctionOfUseEffectSetup(pFunction);
1175
272
  }
1176
273
  function stringifyJsx(node) {
1177
274
  switch (node.type) {
@@ -1642,10 +739,10 @@ function getComponentFlagFromInitPath(initPath) {
1642
739
  return flag;
1643
740
  }
1644
741
  function isComponentName(name) {
1645
- return RegExp$1.COMPONENT_NAME.test(name);
742
+ return RegExp.COMPONENT_NAME.test(name);
1646
743
  }
1647
744
  function isComponentNameLoose(name) {
1648
- return RegExp$1.COMPONENT_NAME_LOOSE.test(name);
745
+ return RegExp.COMPONENT_NAME_LOOSE.test(name);
1649
746
  }
1650
747
  function getComponentNameFromId(id) {
1651
748
  if (id == null) return _;