@eslint-react/core 1.43.1-next.0 → 1.43.2-beta.0

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