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