@eslint-react/core 1.43.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.d.mts +2 -11
- package/dist/index.d.ts +2 -11
- package/dist/index.js +746 -352
- package/dist/index.mjs +747 -348
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var AST6 = require('@eslint-react/ast');
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var JSX3 = require('@eslint-react/jsx');
|
|
6
|
+
var kit = require('@eslint-react/kit');
|
|
6
7
|
var shared = require('@eslint-react/shared');
|
|
7
8
|
var types = require('@typescript-eslint/types');
|
|
8
9
|
var VAR = require('@eslint-react/var');
|
|
9
10
|
var tsPattern = require('ts-pattern');
|
|
10
|
-
require('@eslint-react/kit');
|
|
11
11
|
var birecord = require('birecord');
|
|
12
12
|
|
|
13
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -37,350 +37,747 @@ var birecord__default = /*#__PURE__*/_interopDefault(birecord);
|
|
|
37
37
|
|
|
38
38
|
// src/component/component-collector.ts
|
|
39
39
|
|
|
40
|
-
//
|
|
41
|
-
var DISPLAY_NAME_ASSIGNMENT_SELECTOR = [
|
|
42
|
-
"AssignmentExpression",
|
|
43
|
-
"[type]",
|
|
44
|
-
"[operator='=']",
|
|
45
|
-
"[left.type='MemberExpression']",
|
|
46
|
-
"[left.property.name='displayName']"
|
|
47
|
-
].join("");
|
|
48
|
-
|
|
49
|
-
// ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
50
|
-
var store;
|
|
40
|
+
// ../../node_modules/.pnpm/@zod+core@0.1.0/node_modules/@zod/core/dist/esm/core.js
|
|
51
41
|
// @__NO_SIDE_EFFECTS__
|
|
52
|
-
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) {
|
|
53
87
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
88
|
+
get value() {
|
|
89
|
+
{
|
|
90
|
+
const value = getter();
|
|
91
|
+
Object.defineProperty(this, "value", { value });
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
58
95
|
};
|
|
59
96
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
var store3;
|
|
66
|
-
// @__NO_SIDE_EFFECTS__
|
|
67
|
-
function getSchemaMessage(lang) {
|
|
68
|
-
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);
|
|
69
101
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
});
|
|
74
119
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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)];
|
|
80
125
|
}
|
|
81
|
-
|
|
82
|
-
|
|
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;
|
|
83
140
|
}
|
|
84
|
-
|
|
85
|
-
|
|
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;
|
|
86
155
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
path: other?.path,
|
|
102
|
-
issues: other?.issues,
|
|
103
|
-
lang: config2.lang,
|
|
104
|
-
abortEarly: config2.abortEarly,
|
|
105
|
-
abortPipeEarly: config2.abortPipeEarly
|
|
106
|
-
};
|
|
107
|
-
const isSchema = context.kind === "schema";
|
|
108
|
-
const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
109
|
-
if (message !== void 0) {
|
|
110
|
-
issue.message = typeof message === "function" ? (
|
|
111
|
-
// @ts-expect-error
|
|
112
|
-
message(issue)
|
|
113
|
-
) : 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;
|
|
114
170
|
}
|
|
115
|
-
|
|
116
|
-
|
|
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;
|
|
117
189
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
190
|
+
delete full.inst;
|
|
191
|
+
delete full.continue;
|
|
192
|
+
if (!ctx?.reportInput) {
|
|
193
|
+
delete full.input;
|
|
122
194
|
}
|
|
195
|
+
return full;
|
|
123
196
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
var ValiError = class extends Error {
|
|
135
|
-
/**
|
|
136
|
-
* Creates a Valibot error with useful information.
|
|
137
|
-
*
|
|
138
|
-
* @param issues The error issues.
|
|
139
|
-
*/
|
|
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
|
+
}
|
|
140
204
|
constructor(issues) {
|
|
141
|
-
|
|
142
|
-
this
|
|
205
|
+
Object.defineProperty(this, "_tag", { value: ZOD_ERROR, enumerable: false });
|
|
206
|
+
Object.defineProperty(this, "name", { value: "$ZodError", enumerable: false });
|
|
143
207
|
this.issues = issues;
|
|
144
208
|
}
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
static [Symbol.hasInstance](inst) {
|
|
211
|
+
return inst?._tag === ZOD_ERROR;
|
|
212
|
+
}
|
|
145
213
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
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;
|
|
155
226
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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 };
|
|
165
260
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return {
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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;
|
|
213
331
|
}
|
|
214
|
-
dataset.value.push(itemDataset.value);
|
|
215
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)));
|
|
216
461
|
} else {
|
|
217
|
-
|
|
462
|
+
handleArrayResult(result, payload, i);
|
|
218
463
|
}
|
|
219
|
-
return dataset;
|
|
220
464
|
}
|
|
465
|
+
if (proms.length) {
|
|
466
|
+
return Promise.all(proms).then(() => payload);
|
|
467
|
+
}
|
|
468
|
+
return payload;
|
|
221
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
|
+
}
|
|
222
477
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
reference: boolean,
|
|
229
|
-
expects: "boolean",
|
|
230
|
-
async: false,
|
|
231
|
-
message,
|
|
232
|
-
get "~standard"() {
|
|
233
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
234
|
-
},
|
|
235
|
-
"~run"(dataset, config2) {
|
|
236
|
-
if (typeof dataset.value === "boolean") {
|
|
237
|
-
dataset.typed = true;
|
|
238
|
-
} else {
|
|
239
|
-
_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;
|
|
240
483
|
}
|
|
241
|
-
|
|
484
|
+
} else {
|
|
485
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
242
486
|
}
|
|
243
|
-
}
|
|
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
|
+
}
|
|
244
493
|
}
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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;
|
|
319
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);
|
|
320
624
|
}
|
|
321
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)));
|
|
322
642
|
} else {
|
|
323
|
-
|
|
643
|
+
handleObjectResult(r, payload, key);
|
|
324
644
|
}
|
|
325
|
-
return dataset;
|
|
326
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
|
+
});
|
|
327
659
|
};
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (dataset.value === void 0) {
|
|
344
|
-
if (this.default !== void 0) {
|
|
345
|
-
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
346
|
-
}
|
|
347
|
-
if (dataset.value === void 0) {
|
|
348
|
-
dataset.typed = true;
|
|
349
|
-
return dataset;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
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;
|
|
353
675
|
}
|
|
676
|
+
return def.innerType._zod.run(payload, ctx);
|
|
354
677
|
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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({
|
|
360
683
|
type: "string",
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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 ?? {});
|
|
367
766
|
},
|
|
368
|
-
|
|
369
|
-
if (typeof dataset.value === "string") {
|
|
370
|
-
dataset.typed = true;
|
|
371
|
-
} else {
|
|
372
|
-
_addIssue(this, "type", dataset, config2);
|
|
373
|
-
}
|
|
374
|
-
return dataset;
|
|
375
|
-
}
|
|
767
|
+
...normalizeParams(params)
|
|
376
768
|
};
|
|
769
|
+
return new ZodMiniObject(def);
|
|
377
770
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
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
|
+
});
|
|
384
781
|
}
|
|
385
782
|
|
|
386
783
|
// ../shared/src/schemas.ts
|
|
@@ -390,26 +787,26 @@ var CustomComponentPropSchema = object({
|
|
|
390
787
|
* @example
|
|
391
788
|
* "to"
|
|
392
789
|
*/
|
|
393
|
-
name:
|
|
790
|
+
name: string2(),
|
|
394
791
|
/**
|
|
395
792
|
* The name of the prop in the host component.
|
|
396
793
|
* @example
|
|
397
794
|
* "href"
|
|
398
795
|
*/
|
|
399
|
-
as: optional(
|
|
796
|
+
as: optional(string2()),
|
|
400
797
|
/**
|
|
401
798
|
* Whether the prop is controlled or not in the user-defined component.
|
|
402
799
|
* @internal
|
|
403
800
|
* @example
|
|
404
801
|
* `true`
|
|
405
802
|
*/
|
|
406
|
-
controlled: optional(
|
|
803
|
+
controlled: optional(boolean2()),
|
|
407
804
|
/**
|
|
408
805
|
* The default value of the prop in the user-defined component.
|
|
409
806
|
* @example
|
|
410
807
|
* `"/"`
|
|
411
808
|
*/
|
|
412
|
-
defaultValue: optional(
|
|
809
|
+
defaultValue: optional(string2())
|
|
413
810
|
});
|
|
414
811
|
var CustomComponentSchema = object({
|
|
415
812
|
/**
|
|
@@ -417,13 +814,13 @@ var CustomComponentSchema = object({
|
|
|
417
814
|
* @example
|
|
418
815
|
* "Link"
|
|
419
816
|
*/
|
|
420
|
-
name:
|
|
817
|
+
name: string2(),
|
|
421
818
|
/**
|
|
422
819
|
* The name of the host component that the user-defined component represents.
|
|
423
820
|
* @example
|
|
424
821
|
* "a"
|
|
425
822
|
*/
|
|
426
|
-
as: optional(
|
|
823
|
+
as: optional(string2()),
|
|
427
824
|
/**
|
|
428
825
|
* Attributes mapping between the user-defined component and the host component.
|
|
429
826
|
* @example
|
|
@@ -436,28 +833,28 @@ var CustomComponentSchema = object({
|
|
|
436
833
|
* @example
|
|
437
834
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
438
835
|
*/
|
|
439
|
-
selector: optional(
|
|
836
|
+
selector: optional(string2())
|
|
440
837
|
});
|
|
441
838
|
var CustomHooksSchema = object({
|
|
442
|
-
use: optional(array(
|
|
443
|
-
useActionState: optional(array(
|
|
444
|
-
useCallback: optional(array(
|
|
445
|
-
useContext: optional(array(
|
|
446
|
-
useDebugValue: optional(array(
|
|
447
|
-
useDeferredValue: optional(array(
|
|
448
|
-
useEffect: optional(array(
|
|
449
|
-
useFormStatus: optional(array(
|
|
450
|
-
useId: optional(array(
|
|
451
|
-
useImperativeHandle: optional(array(
|
|
452
|
-
useInsertionEffect: optional(array(
|
|
453
|
-
useLayoutEffect: optional(array(
|
|
454
|
-
useMemo: optional(array(
|
|
455
|
-
useOptimistic: optional(array(
|
|
456
|
-
useReducer: optional(array(
|
|
457
|
-
useRef: optional(array(
|
|
458
|
-
useState: optional(array(
|
|
459
|
-
useSyncExternalStore: optional(array(
|
|
460
|
-
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()))
|
|
461
858
|
});
|
|
462
859
|
var ESLintReactSettingsSchema = object({
|
|
463
860
|
/**
|
|
@@ -466,43 +863,43 @@ var ESLintReactSettingsSchema = object({
|
|
|
466
863
|
* @default `"react"`
|
|
467
864
|
* @example `"@pika/react"`
|
|
468
865
|
*/
|
|
469
|
-
importSource: optional(
|
|
866
|
+
importSource: optional(string2()),
|
|
470
867
|
/**
|
|
471
868
|
* The identifier that's used for JSX Element creation.
|
|
472
869
|
* @default `"createElement"`
|
|
473
870
|
* @deprecated
|
|
474
871
|
*/
|
|
475
|
-
jsxPragma: optional(
|
|
872
|
+
jsxPragma: optional(string2()),
|
|
476
873
|
/**
|
|
477
874
|
* The identifier that's used for JSX fragment elements.
|
|
478
875
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
479
876
|
* @default `"Fragment"`
|
|
480
877
|
* @deprecated
|
|
481
878
|
*/
|
|
482
|
-
jsxPragmaFrag: optional(
|
|
879
|
+
jsxPragmaFrag: optional(string2()),
|
|
483
880
|
/**
|
|
484
881
|
* The name of the prop that is used for polymorphic components.
|
|
485
882
|
* @description This is used to determine the type of the component.
|
|
486
883
|
* @example `"as"`
|
|
487
884
|
*/
|
|
488
|
-
polymorphicPropName: optional(
|
|
885
|
+
polymorphicPropName: optional(string2()),
|
|
489
886
|
/**
|
|
490
887
|
* @internal
|
|
491
888
|
*/
|
|
492
|
-
strict: optional(
|
|
889
|
+
strict: optional(boolean2()),
|
|
493
890
|
/**
|
|
494
891
|
* Check both the shape and the import to determine if an API is from React.
|
|
495
892
|
* @description This can prevent false positives when using a irrelevant third-party library that has similar APIs to React.
|
|
496
893
|
* @default `true`
|
|
497
894
|
*/
|
|
498
|
-
skipImportCheck: optional(
|
|
895
|
+
skipImportCheck: optional(boolean2()),
|
|
499
896
|
/**
|
|
500
897
|
* React version to use, "detect" means auto detect React version from the project's dependencies.
|
|
501
898
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
502
899
|
* @example `"18.3.1"`
|
|
503
900
|
* @default `"detect"`
|
|
504
901
|
*/
|
|
505
|
-
version: optional(
|
|
902
|
+
version: optional(string2()),
|
|
506
903
|
/**
|
|
507
904
|
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
508
905
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
@@ -516,8 +913,16 @@ var ESLintReactSettingsSchema = object({
|
|
|
516
913
|
*/
|
|
517
914
|
additionalComponents: optional(array(CustomComponentSchema))
|
|
518
915
|
});
|
|
916
|
+
optional(
|
|
917
|
+
object({
|
|
918
|
+
"react-x": optional(ESLintReactSettingsSchema),
|
|
919
|
+
/** @deprecated Use `react-x` instead */
|
|
920
|
+
reactOptions: optional(ESLintReactSettingsSchema)
|
|
921
|
+
}),
|
|
922
|
+
{}
|
|
923
|
+
);
|
|
519
924
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
520
|
-
...
|
|
925
|
+
...parse2(ESLintReactSettingsSchema, {}),
|
|
521
926
|
importSource: "react"};
|
|
522
927
|
function getInstanceId(node, prev) {
|
|
523
928
|
switch (true) {
|
|
@@ -653,11 +1058,7 @@ var isForwardRefCall = isReactAPICall("forwardRef");
|
|
|
653
1058
|
var isMemoCall = isReactAPICall("memo");
|
|
654
1059
|
|
|
655
1060
|
// src/hook/hook-name.ts
|
|
656
|
-
var RE_HOOK_NAME = /^use[A-Z\d]/u;
|
|
657
1061
|
function isReactHookName(name) {
|
|
658
|
-
return name === "use" || RE_HOOK_NAME.test(name);
|
|
659
|
-
}
|
|
660
|
-
function isReactHookNameLoose(name) {
|
|
661
1062
|
return name.startsWith("use");
|
|
662
1063
|
}
|
|
663
1064
|
|
|
@@ -1062,13 +1463,11 @@ function getComponentFlagFromInitPath(initPath) {
|
|
|
1062
1463
|
}
|
|
1063
1464
|
return flag;
|
|
1064
1465
|
}
|
|
1065
|
-
var RE_COMPONENT_NAME = /^[A-Z]/u;
|
|
1066
|
-
var RE_COMPONENT_NAME_LOOSE = /^_?[A-Z]/u;
|
|
1067
1466
|
function isComponentName(name) {
|
|
1068
|
-
return
|
|
1467
|
+
return kit.RE.COMPONENT_NAME.test(name);
|
|
1069
1468
|
}
|
|
1070
1469
|
function isComponentNameLoose(name) {
|
|
1071
|
-
return
|
|
1470
|
+
return kit.RE.COMPONENT_NAME_LOOSE.test(name);
|
|
1072
1471
|
}
|
|
1073
1472
|
function getComponentNameFromId(id) {
|
|
1074
1473
|
if (id == null) return eff._;
|
|
@@ -1120,7 +1519,7 @@ function useComponentCollector(context, options = {}) {
|
|
|
1120
1519
|
const listeners = {
|
|
1121
1520
|
":function[type]": onFunctionEnter,
|
|
1122
1521
|
":function[type]:exit": onFunctionExit,
|
|
1123
|
-
"ArrowFunctionExpression[
|
|
1522
|
+
"ArrowFunctionExpression[body.type!='BlockStatement']"() {
|
|
1124
1523
|
const entry = getCurrentEntry();
|
|
1125
1524
|
if (entry == null) return;
|
|
1126
1525
|
const { body } = entry.node;
|
|
@@ -1144,7 +1543,7 @@ function useComponentCollector(context, options = {}) {
|
|
|
1144
1543
|
});
|
|
1145
1544
|
},
|
|
1146
1545
|
...collectDisplayName ? {
|
|
1147
|
-
[
|
|
1546
|
+
[kit.SEL.DISPLAY_NAME_ASSIGNMENT_EXPRESSION](node) {
|
|
1148
1547
|
const { left, right } = node;
|
|
1149
1548
|
if (left.type !== types.AST_NODE_TYPES.MemberExpression) return;
|
|
1150
1549
|
const componentName = left.object.type === types.AST_NODE_TYPES.Identifier ? left.object.name : eff._;
|
|
@@ -1275,10 +1674,6 @@ exports.ComponentDetectionHint = ComponentDetectionHint;
|
|
|
1275
1674
|
exports.ComponentFlag = ComponentFlag;
|
|
1276
1675
|
exports.ComponentPhaseRelevance = ComponentPhaseRelevance;
|
|
1277
1676
|
exports.DEFAULT_COMPONENT_DETECTION_HINT = DEFAULT_COMPONENT_DETECTION_HINT;
|
|
1278
|
-
exports.DISPLAY_NAME_ASSIGNMENT_SELECTOR = DISPLAY_NAME_ASSIGNMENT_SELECTOR;
|
|
1279
|
-
exports.RE_COMPONENT_NAME = RE_COMPONENT_NAME;
|
|
1280
|
-
exports.RE_COMPONENT_NAME_LOOSE = RE_COMPONENT_NAME_LOOSE;
|
|
1281
|
-
exports.RE_HOOK_NAME = RE_HOOK_NAME;
|
|
1282
1677
|
exports.getComponentFlagFromInitPath = getComponentFlagFromInitPath;
|
|
1283
1678
|
exports.getComponentNameFromId = getComponentNameFromId;
|
|
1284
1679
|
exports.getFunctionComponentId = getFunctionComponentId;
|
|
@@ -1353,7 +1748,6 @@ exports.isReactHookCallWithName = isReactHookCallWithName;
|
|
|
1353
1748
|
exports.isReactHookCallWithNameAlias = isReactHookCallWithNameAlias;
|
|
1354
1749
|
exports.isReactHookCallWithNameLoose = isReactHookCallWithNameLoose;
|
|
1355
1750
|
exports.isReactHookName = isReactHookName;
|
|
1356
|
-
exports.isReactHookNameLoose = isReactHookNameLoose;
|
|
1357
1751
|
exports.isRenderFunctionLoose = isRenderFunctionLoose;
|
|
1358
1752
|
exports.isRenderLike = isRenderLike;
|
|
1359
1753
|
exports.isRenderMethodLike = isRenderMethodLike;
|