zod-compiler 1.0.15 → 1.0.17
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/README.md +2 -2
- package/dist/cli/emitter.js +1 -1
- package/dist/cli/emitter.js.map +1 -1
- package/dist/core/codegen/context.d.ts +6 -6
- package/dist/core/codegen/context.js +4 -4
- package/dist/core/codegen/emit-issue.d.ts +2 -2
- package/dist/core/codegen/emit-issue.js +18 -18
- package/dist/core/codegen/index.d.ts.map +1 -1
- package/dist/core/codegen/index.js +36 -11
- package/dist/core/codegen/index.js.map +1 -1
- package/dist/core/codegen/issue-decls.d.ts +17 -17
- package/dist/core/codegen/issue-decls.js +26 -26
- package/dist/core/codegen/schemas/catch.js +1 -1
- package/dist/core/codegen/schemas/catch.js.map +1 -1
- package/dist/core/codegen/schemas/effect.js +1 -1
- package/dist/core/codegen/schemas/effect.js.map +1 -1
- package/dist/core/codegen/schemas/fallback.js +1 -1
- package/dist/core/codegen/schemas/fallback.js.map +1 -1
- package/dist/core/codegen/schemas/number.js +3 -3
- package/dist/core/codegen/schemas/object.js +1 -1
- package/dist/core/codegen/schemas/object.js.map +1 -1
- package/dist/core/codegen/schemas/union.js +4 -4
- package/dist/core/codegen/schemas/union.js.map +1 -1
- package/dist/core/codegen/well-known-regex.d.ts +3 -3
- package/dist/core/codegen/well-known-regex.js +16 -16
- package/dist/core/iife.d.ts +19 -12
- package/dist/core/iife.d.ts.map +1 -1
- package/dist/core/iife.js +20 -13
- package/dist/core/iife.js.map +1 -1
- package/dist/unplugin/hoist-compile.d.ts +1 -1
- package/dist/unplugin/hoist-compile.js +1 -1
- package/dist/unplugin/transform.js +11 -11
- package/dist/unplugin/transform.js.map +1 -1
- package/dist/unplugin/virtual.d.ts +1 -1
- package/dist/unplugin/virtual.d.ts.map +1 -1
- package/dist/unplugin/virtual.js +11 -12
- package/dist/unplugin/virtual.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,8 +212,8 @@ Combinator chains on imported schemas also qualify: bases matching
|
|
|
212
212
|
|
|
213
213
|
### Bundle Size & Cross-File Dedup
|
|
214
214
|
|
|
215
|
-
Generated validators share a small runtime helper layer (`
|
|
216
|
-
wrapper, issue factories like `
|
|
215
|
+
Generated validators share a small runtime helper layer (`__zcMkv` validator
|
|
216
|
+
wrapper, issue factories like `__zcTS`/`__zcIT`, and well-known regexes for
|
|
217
217
|
`email`, `uuid`, `cuid`, `ipv4`, etc.).
|
|
218
218
|
|
|
219
219
|
On every supported bundler the plugin imports these helpers from a single
|
package/dist/cli/emitter.js
CHANGED
|
@@ -8,7 +8,7 @@ export function generateCompiledFileContent(schemas, sourceRelPath, options) {
|
|
|
8
8
|
}
|
|
9
9
|
const zodCompat = options?.zodCompat !== false;
|
|
10
10
|
// A schema needs the source import when:
|
|
11
|
-
// - zodCompat: true (
|
|
11
|
+
// - zodCompat: true (__zcMkv installs compiled methods on the schema)
|
|
12
12
|
// - has refEntries (fallback schemas referenced via __rf[])
|
|
13
13
|
const schemasNeedingImport = schemas.filter((s) => zodCompat || s.refEntries.length > 0);
|
|
14
14
|
const exports = schemas.map((schema) => {
|
package/dist/cli/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/cli/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAe3B,MAAM,UAAU,2BAA2B,CACzC,OAA6B,EAC7B,aAAqB,EACrB,OAAwB;IAExB,IAAI,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAA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AAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,cAAc,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAkB,EAAE,OAAe;IACzE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -7,14 +7,14 @@ export interface CodeGenResult {
|
|
|
7
7
|
/** Number of fallback schemas referenced by __rf[N] in the generated code. 0 = no fallbacks. */
|
|
8
8
|
refCount: number;
|
|
9
9
|
/**
|
|
10
|
-
* Helper names referenced by this schema in lean mode (e.g. "
|
|
10
|
+
* Helper names referenced by this schema in lean mode (e.g. "__zcTS", "__zcReEmail").
|
|
11
11
|
* Used by the unplugin transform to construct the `import { ... } from "virtual:zod-compiler/runtime"` line.
|
|
12
12
|
* Always empty in inline mode.
|
|
13
13
|
*/
|
|
14
14
|
usedHelpers: Set<string>;
|
|
15
15
|
/**
|
|
16
16
|
* Name of the hosted fast-check boolean function in the preamble (null when
|
|
17
|
-
* the schema has no Fast Path). generateIIFE passes it to
|
|
17
|
+
* the schema has no Fast Path). generateIIFE passes it to __zcMkv so parse()
|
|
18
18
|
* and parseAsync() can return valid input without allocating an
|
|
19
19
|
* intermediate SafeParseResult.
|
|
20
20
|
*/
|
|
@@ -97,16 +97,16 @@ export declare function emitTemp(ctx: CodeGenContext, prefix: string): string;
|
|
|
97
97
|
/**
|
|
98
98
|
* Pristine fallback delegate: declare `var __rfp_N=__rf[N].safeParse.bind(__rf[N]);`
|
|
99
99
|
* in the preamble and return the variable name. Generated code must NEVER read
|
|
100
|
-
* `__rf[N].safeParse` at parse time: `
|
|
100
|
+
* `__rf[N].safeParse` at parse time: `__zcMkv` installs the compiled safeParse as
|
|
101
101
|
* an OWN property on the original schema object, and whenever `__rf[N]` is that
|
|
102
102
|
* same object the read resolves to the compiled delegate itself — infinite
|
|
103
|
-
* recursion (RangeError on every parse). The fallback entry and the
|
|
103
|
+
* recursion (RangeError on every parse). The fallback entry and the __zcMkv
|
|
104
104
|
* target ARE the same object in compile mode (schemaExpr is the compile()
|
|
105
105
|
* argument identifier) and the CLI emitter ((__src_X as any).schema); in
|
|
106
106
|
* autoDiscover mode they are two textually identical constructions that any
|
|
107
107
|
* downstream CSE/dedup transform (babel-plugin-zod-hoist in a field incident)
|
|
108
108
|
* collapses back into one. Capturing at IIFE evaluation — before the trailing
|
|
109
|
-
* `return
|
|
109
|
+
* `return __zcMkv(...)` mutates anything — pins zod's own implementation; the
|
|
110
110
|
* worst case under cross-validator merges is delegating to an equivalent
|
|
111
111
|
* compiled validator (whose own delegates were captured even earlier), never
|
|
112
112
|
* a cycle.
|
|
@@ -146,7 +146,7 @@ export declare function escapeString(s: string | number): string;
|
|
|
146
146
|
*/
|
|
147
147
|
export declare function literalToJs(v: string | number | boolean | null | bigint | undefined): string;
|
|
148
148
|
/**
|
|
149
|
-
* Reference a shared runtime helper (e.g.
|
|
149
|
+
* Reference a shared runtime helper (e.g. __zcFsr) from generated code.
|
|
150
150
|
* Lean mode: registers it for the `virtual:zod-compiler/runtime` import.
|
|
151
151
|
* Inline mode: declares it once in the per-IIFE preamble.
|
|
152
152
|
*/
|
|
@@ -7,16 +7,16 @@ export function emitTemp(ctx, prefix) {
|
|
|
7
7
|
/**
|
|
8
8
|
* Pristine fallback delegate: declare `var __rfp_N=__rf[N].safeParse.bind(__rf[N]);`
|
|
9
9
|
* in the preamble and return the variable name. Generated code must NEVER read
|
|
10
|
-
* `__rf[N].safeParse` at parse time: `
|
|
10
|
+
* `__rf[N].safeParse` at parse time: `__zcMkv` installs the compiled safeParse as
|
|
11
11
|
* an OWN property on the original schema object, and whenever `__rf[N]` is that
|
|
12
12
|
* same object the read resolves to the compiled delegate itself — infinite
|
|
13
|
-
* recursion (RangeError on every parse). The fallback entry and the
|
|
13
|
+
* recursion (RangeError on every parse). The fallback entry and the __zcMkv
|
|
14
14
|
* target ARE the same object in compile mode (schemaExpr is the compile()
|
|
15
15
|
* argument identifier) and the CLI emitter ((__src_X as any).schema); in
|
|
16
16
|
* autoDiscover mode they are two textually identical constructions that any
|
|
17
17
|
* downstream CSE/dedup transform (babel-plugin-zod-hoist in a field incident)
|
|
18
18
|
* collapses back into one. Capturing at IIFE evaluation — before the trailing
|
|
19
|
-
* `return
|
|
19
|
+
* `return __zcMkv(...)` mutates anything — pins zod's own implementation; the
|
|
20
20
|
* worst case under cross-validator merges is delegating to an equivalent
|
|
21
21
|
* compiled validator (whose own delegates were captured even earlier), never
|
|
22
22
|
* a cycle.
|
|
@@ -139,7 +139,7 @@ export function literalToJs(v) {
|
|
|
139
139
|
return JSON.stringify(v);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* Reference a shared runtime helper (e.g.
|
|
142
|
+
* Reference a shared runtime helper (e.g. __zcFsr) from generated code.
|
|
143
143
|
* Lean mode: registers it for the `virtual:zod-compiler/runtime` import.
|
|
144
144
|
* Inline mode: declares it once in the per-IIFE preamble.
|
|
145
145
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* caller-supplied issues variable). Two emit modes:
|
|
6
6
|
*
|
|
7
7
|
* - inline (CLI .compiled.ts): emits the literal `{code:"too_small",...}` object.
|
|
8
|
-
* - lean (unplugin): emits a call like `
|
|
8
|
+
* - lean (unplugin): emits a call like `__zcTS(min,origin,inclusive,input,path)`
|
|
9
9
|
* and registers the helper in `ctx.usedHelpers` so the transform layer can
|
|
10
10
|
* construct the corresponding `import` from `"virtual:zod-compiler/runtime"`.
|
|
11
11
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Helpers default per the most common call-site kind; size-issue emitters
|
|
23
23
|
* accept `useTypeMsg: true` for node-level uses (tuple), and invalidValue
|
|
24
24
|
* accepts `useTypeMsg: false` for check-level uses (file mime).
|
|
25
|
-
* When no message lands, the
|
|
25
|
+
* When no message lands, the __zcFin finalizer applies the locale default.
|
|
26
26
|
*/
|
|
27
27
|
import type { CodeGenContext } from "./context.js";
|
|
28
28
|
/** Common slim slice of SlowGen + FastGen needed for issue emission. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* caller-supplied issues variable). Two emit modes:
|
|
6
6
|
*
|
|
7
7
|
* - inline (CLI .compiled.ts): emits the literal `{code:"too_small",...}` object.
|
|
8
|
-
* - lean (unplugin): emits a call like `
|
|
8
|
+
* - lean (unplugin): emits a call like `__zcTS(min,origin,inclusive,input,path)`
|
|
9
9
|
* and registers the helper in `ctx.usedHelpers` so the transform layer can
|
|
10
10
|
* construct the corresponding `import` from `"virtual:zod-compiler/runtime"`.
|
|
11
11
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Helpers default per the most common call-site kind; size-issue emitters
|
|
23
23
|
* accept `useTypeMsg: true` for node-level uses (tuple), and invalidValue
|
|
24
24
|
* accepts `useTypeMsg: false` for check-level uses (file mime).
|
|
25
|
-
* When no message lands, the
|
|
25
|
+
* When no message lands, the __zcFin finalizer applies the locale default.
|
|
26
26
|
*/
|
|
27
27
|
import { escapeString } from "./context.js";
|
|
28
28
|
function pushIssue(g, body) {
|
|
@@ -47,11 +47,11 @@ export function tooSmall(g, minimum, origin, inclusive, options) {
|
|
|
47
47
|
const m = resolveMessage(g, options?.message, options?.useTypeMsg === true);
|
|
48
48
|
if (g.ctx.mode === "lean") {
|
|
49
49
|
if (exact) {
|
|
50
|
-
g.ctx.usedHelpers.add("
|
|
51
|
-
return pushIssue(g, `
|
|
50
|
+
g.ctx.usedHelpers.add("__zcTSx");
|
|
51
|
+
return pushIssue(g, `__zcTSx(${minimum},${escapeString(origin)},${input},${path}${messageArg(m)})`);
|
|
52
52
|
}
|
|
53
|
-
g.ctx.usedHelpers.add("
|
|
54
|
-
return pushIssue(g, `
|
|
53
|
+
g.ctx.usedHelpers.add("__zcTS");
|
|
54
|
+
return pushIssue(g, `__zcTS(${minimum},${escapeString(origin)},${inclusive},${input},${path}${messageArg(m)})`);
|
|
55
55
|
}
|
|
56
56
|
if (exact) {
|
|
57
57
|
return pushIssue(g, `{code:"too_small",minimum:${minimum},origin:${escapeString(origin)},inclusive:true,exact:true${messageProp(m)},input:${input},path:${path}}`);
|
|
@@ -65,11 +65,11 @@ export function tooBig(g, maximum, origin, inclusive, options) {
|
|
|
65
65
|
const m = resolveMessage(g, options?.message, options?.useTypeMsg === true);
|
|
66
66
|
if (g.ctx.mode === "lean") {
|
|
67
67
|
if (exact) {
|
|
68
|
-
g.ctx.usedHelpers.add("
|
|
69
|
-
return pushIssue(g, `
|
|
68
|
+
g.ctx.usedHelpers.add("__zcTBx");
|
|
69
|
+
return pushIssue(g, `__zcTBx(${maximum},${escapeString(origin)},${input},${path}${messageArg(m)})`);
|
|
70
70
|
}
|
|
71
|
-
g.ctx.usedHelpers.add("
|
|
72
|
-
return pushIssue(g, `
|
|
71
|
+
g.ctx.usedHelpers.add("__zcTB");
|
|
72
|
+
return pushIssue(g, `__zcTB(${maximum},${escapeString(origin)},${inclusive},${input},${path}${messageArg(m)})`);
|
|
73
73
|
}
|
|
74
74
|
if (exact) {
|
|
75
75
|
return pushIssue(g, `{code:"too_big",maximum:${maximum},origin:${escapeString(origin)},inclusive:true,exact:true${messageProp(m)},input:${input},path:${path}}`);
|
|
@@ -82,8 +82,8 @@ export function invalidType(g, expected, options) {
|
|
|
82
82
|
// invalid_type is always created by the schema node — schema error applies.
|
|
83
83
|
const m = resolveMessage(g, options?.message, true);
|
|
84
84
|
if (g.ctx.mode === "lean" && !options?.extra) {
|
|
85
|
-
g.ctx.usedHelpers.add("
|
|
86
|
-
return pushIssue(g, `
|
|
85
|
+
g.ctx.usedHelpers.add("__zcIT");
|
|
86
|
+
return pushIssue(g, `__zcIT(${escapeString(expected)},${input},${path}${messageArg(m)})`);
|
|
87
87
|
}
|
|
88
88
|
const extra = options?.extra ? `,${options.extra}` : "";
|
|
89
89
|
return pushIssue(g, `{code:"invalid_type",expected:${escapeString(expected)}${extra}${messageProp(m)},input:${input},path:${path}}`);
|
|
@@ -95,9 +95,9 @@ export function invalidFormat(g, format, options) {
|
|
|
95
95
|
// Format issues are created by check instances — schema error never applies.
|
|
96
96
|
const m = options?.message;
|
|
97
97
|
if (g.ctx.mode === "lean") {
|
|
98
|
-
g.ctx.usedHelpers.add("
|
|
98
|
+
g.ctx.usedHelpers.add("__zcIF");
|
|
99
99
|
const extraArg = options?.extra ? `,{${options.extra}}` : m !== undefined ? ",undefined" : "";
|
|
100
|
-
return pushIssue(g, `
|
|
100
|
+
return pushIssue(g, `__zcIF(${formatExpr},${input},${path}${extraArg}${messageArg(m)})`);
|
|
101
101
|
}
|
|
102
102
|
const extra = options?.extra ? `,${options.extra}` : "";
|
|
103
103
|
return pushIssue(g, `{code:"invalid_format",format:${formatExpr}${extra}${messageProp(m)},input:${input},path:${path}}`);
|
|
@@ -108,8 +108,8 @@ export function unrecognizedKeys(g, keysExpr, options) {
|
|
|
108
108
|
// unrecognized_keys is created by the object schema node — schema error applies.
|
|
109
109
|
const m = resolveMessage(g, options?.message, true);
|
|
110
110
|
if (g.ctx.mode === "lean") {
|
|
111
|
-
g.ctx.usedHelpers.add("
|
|
112
|
-
return pushIssue(g, `
|
|
111
|
+
g.ctx.usedHelpers.add("__zcUK");
|
|
112
|
+
return pushIssue(g, `__zcUK(${keysExpr},${input},${path}${messageArg(m)})`);
|
|
113
113
|
}
|
|
114
114
|
return pushIssue(g, `{code:"unrecognized_keys",keys:${keysExpr}${messageProp(m)},input:${input},path:${path}}`);
|
|
115
115
|
}
|
|
@@ -119,8 +119,8 @@ export function invalidValue(g, valuesExpr, options) {
|
|
|
119
119
|
// Default: enum/literal invalid_value is created by the schema node.
|
|
120
120
|
const m = resolveMessage(g, options?.message, options?.useTypeMsg !== false);
|
|
121
121
|
if (g.ctx.mode === "lean") {
|
|
122
|
-
g.ctx.usedHelpers.add("
|
|
123
|
-
return pushIssue(g, `
|
|
122
|
+
g.ctx.usedHelpers.add("__zcIV");
|
|
123
|
+
return pushIssue(g, `__zcIV(${valuesExpr},${input},${path}${messageArg(m)})`);
|
|
124
124
|
}
|
|
125
125
|
return pushIssue(g, `{code:"invalid_value",values:${valuesExpr}${messageProp(m)},input:${input},path:${path}}`);
|
|
126
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAkB,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK/E,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAkB,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK/E,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,aAAa,CAqJf"}
|
|
@@ -24,9 +24,9 @@ export function generateValidator(ir, name, options) {
|
|
|
24
24
|
// Root-level fallback: the whole schema delegates to Zod, so zod's own
|
|
25
25
|
// safeParse result IS the result. Returning it directly skips the issue
|
|
26
26
|
// copy loop (which would force zod's eager ZodError construction), the
|
|
27
|
-
// pointless [].concat(path) rewrites, and the
|
|
27
|
+
// pointless [].concat(path) rewrites, and the __zcFin re-wrap. Delegation
|
|
28
28
|
// goes through the pre-mutation capture (emitRfDelegate) — here __rf[0]
|
|
29
|
-
// and the
|
|
29
|
+
// and the __zcMkv target are routinely the SAME object.
|
|
30
30
|
if (ir.type === "fallback" && ir.refIndex !== undefined) {
|
|
31
31
|
const delegate = emitRfDelegate(ctx, ir.refIndex);
|
|
32
32
|
return {
|
|
@@ -42,7 +42,7 @@ export function generateValidator(ir, name, options) {
|
|
|
42
42
|
let fastExpr = generateFast(ir, fg);
|
|
43
43
|
// Host the fast expression in a named boolean helper. Self-recursive
|
|
44
44
|
// schemas need it so recursive refs can call it; every other eligible
|
|
45
|
-
// schema benefits too:
|
|
45
|
+
// schema benefits too: __zcMkv wires it into parse()/parseAsync(), whose
|
|
46
46
|
// success paths then return the input directly — no intermediate
|
|
47
47
|
// SafeParseResult allocation (the safeParse function body is far past
|
|
48
48
|
// V8's inlining budget, so escape analysis never removes it).
|
|
@@ -54,14 +54,14 @@ export function generateValidator(ir, name, options) {
|
|
|
54
54
|
}
|
|
55
55
|
const sg = createSlowGen("_d", "_d", "[]", "_e", ctx);
|
|
56
56
|
const slowCode = generateSlow(ir, sg);
|
|
57
|
-
const
|
|
57
|
+
const buildCode = () => ["/* zod-compiler */", ...ctx.preamble].join("\n");
|
|
58
58
|
const functionDefParts = [`function ${fnName}(input){`];
|
|
59
59
|
if (fastExpr === "true") {
|
|
60
60
|
// Schema always succeeds (any/unknown) — skip slow path entirely
|
|
61
61
|
functionDefParts.push(`return{success:true,data:input};`);
|
|
62
62
|
functionDefParts.push(`}`);
|
|
63
63
|
return {
|
|
64
|
-
code,
|
|
64
|
+
code: buildCode(),
|
|
65
65
|
functionDef: functionDefParts.join("\n"),
|
|
66
66
|
refCount: options?.refCount ?? 0,
|
|
67
67
|
usedHelpers: ctx.usedHelpers,
|
|
@@ -75,12 +75,33 @@ export function generateValidator(ir, name, options) {
|
|
|
75
75
|
// value presence while the slow path SUCCEEDS by applying the default).
|
|
76
76
|
// The slow path's only output is therefore the issues array, observable
|
|
77
77
|
// solely through `.error` — defer the whole re-walk into the cached
|
|
78
|
-
// accessor (
|
|
78
|
+
// accessor (__zcFinD): a failed safeParse whose `.error` is never read
|
|
79
79
|
// costs the fast check alone.
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
//
|
|
81
|
+
// The walk is HOSTED as a named preamble function rather than a per-call
|
|
82
|
+
// closure, for two measured reasons: (1) a failed safeParse no longer
|
|
83
|
+
// allocates a closure environment + function object before the deferral
|
|
84
|
+
// even starts; (2) the safeParse body shrinks to two statements, putting
|
|
85
|
+
// it within V8's inlining budget — callers in hot loops get the
|
|
86
|
+
// success-path result object escape-analyzed away entirely, which the
|
|
87
|
+
// old shape (slow walk inlined into the body) made impossible.
|
|
88
|
+
ctx.usedHelpers.add("__zcFinD");
|
|
89
|
+
if (slowCode.includes(fnName)) {
|
|
90
|
+
// Self-recursive slow paths call the safeParse function by NAME
|
|
91
|
+
// (slowRecursiveRef) — that binding exists only inside the named
|
|
92
|
+
// function expression under the documented evaluation contract
|
|
93
|
+
// (`new Function(code + "return " + functionDef)`), so the walk stays
|
|
94
|
+
// a per-call closure for recursive schemas. Recursion is the rare
|
|
95
|
+
// shape; everything else gets the hosted walk.
|
|
96
|
+
functionDefParts.push(`if(${fastExpr}){return{success:true,data:input};}`, `return __zcFinD(function(input){`, `var _e=[];`, `var _d=input;`, slowCode, `return _e;`, `},input);`, `}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const walkName = `__sw_${ctx.counter++}`;
|
|
100
|
+
ctx.preamble.push(`function ${walkName}(input){var _e=[];\nvar _d=input;\n${slowCode}\nreturn _e;}`);
|
|
101
|
+
functionDefParts.push(`if(${fastExpr}){return{success:true,data:input};}`, `return __zcFinD(${walkName},input);`, `}`);
|
|
102
|
+
}
|
|
82
103
|
return {
|
|
83
|
-
code,
|
|
104
|
+
code: buildCode(),
|
|
84
105
|
functionDef: functionDefParts.join("\n"),
|
|
85
106
|
refCount: options?.refCount ?? 0,
|
|
86
107
|
usedHelpers: ctx.usedHelpers,
|
|
@@ -92,10 +113,14 @@ export function generateValidator(ir, name, options) {
|
|
|
92
113
|
// path must run eagerly — it can succeed where the fast check failed.
|
|
93
114
|
functionDefParts.push(`if(${fastExpr}){return{success:true,data:input};}`);
|
|
94
115
|
}
|
|
95
|
-
|
|
116
|
+
// Success branch inlined at the call site instead of inside __zcFin: the
|
|
117
|
+
// eager path (mutation schemas — coerce/default/trim/transform) returns
|
|
118
|
+
// here on EVERY parse, and the inline literal keeps the hot exit free of a
|
|
119
|
+
// cross-function call; __zcFin is reached only on failure.
|
|
120
|
+
functionDefParts.push(`var _e=[];`, `var _d=input;`, slowCode, `if(_e.length===0){return{success:true,data:_d};}`, `return __zcFin(_e,_d);`, `}`);
|
|
96
121
|
const functionDef = functionDefParts.join("\n");
|
|
97
122
|
return {
|
|
98
|
-
code,
|
|
123
|
+
code: buildCode(),
|
|
99
124
|
functionDef,
|
|
100
125
|
refCount: options?.refCount ?? 0,
|
|
101
126
|
usedHelpers: ctx.usedHelpers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU7D;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAAY,EACZ,IAAY,EACZ,OAAkC;IAElC,MAAM,MAAM,GAAG,aAAa,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,GAAgB,OAAO,EAAE,IAAI,IAAI,QAAQ,CAAC;IACpD,MAAM,GAAG,GAAmB;QAC1B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,MAAM;QACN,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,IAAI;QACJ,WAAW,EAAE,IAAI,GAAG,EAAE;KACvB,CAAC;IAEF,uEAAuE;IACvE,wEAAwE;IACxE,uEAAuE;IACvE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU7D;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAAY,EACZ,IAAY,EACZ,OAAkC;IAElC,MAAM,MAAM,GAAG,aAAa,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,GAAgB,OAAO,EAAE,IAAI,IAAI,QAAQ,CAAC;IACpD,MAAM,GAAG,GAAmB;QAC1B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,MAAM;QACN,UAAU,EAAE,IAAI,GAAG,E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AAC;AACJ,CAAC"}
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These functions produce the same `{code, ...}` shapes that lean-mode
|
|
5
5
|
* generated code would otherwise inline at every check site.
|
|
6
|
-
* Hosted in "virtual:zod-compiler/runtime" and called as `
|
|
6
|
+
* Hosted in "virtual:zod-compiler/runtime" and called as `__zcTS(...)` etc.
|
|
7
7
|
*
|
|
8
8
|
* Argument convention (positional, kept short to minimize call-site bytes):
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* __zcTS(minimum, origin, inclusive, input, path, msg?) — too_small
|
|
10
|
+
* __zcTB(maximum, origin, inclusive, input, path, msg?) — too_big
|
|
11
|
+
* __zcIT(expected, input, path, msg?) — invalid_type
|
|
12
|
+
* __zcIF(format, input, path, extra?, msg?) — invalid_format (extra merged into result)
|
|
13
|
+
* __zcIV(values, input, path, msg?) — invalid_value
|
|
14
|
+
* __zcUK(keys, input, path, msg?) — unrecognized_keys
|
|
15
15
|
*
|
|
16
16
|
* The trailing msg argument carries a static custom error message; when
|
|
17
|
-
* absent, the
|
|
17
|
+
* absent, the __zcFin finalizer applies the configured locale default.
|
|
18
18
|
*/
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
19
|
+
export declare const ZC_TS_DECL = "function __zcTS(m,o,i,inp,p,msg){var r={code:\"too_small\",minimum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
20
|
+
export declare const ZC_TS_EXACT_DECL = "function __zcTSx(m,o,inp,p,msg){var r={code:\"too_small\",minimum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
21
|
+
export declare const ZC_TB_DECL = "function __zcTB(m,o,i,inp,p,msg){var r={code:\"too_big\",maximum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
22
|
+
export declare const ZC_TB_EXACT_DECL = "function __zcTBx(m,o,inp,p,msg){var r={code:\"too_big\",maximum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
23
|
+
export declare const ZC_IT_DECL = "function __zcIT(e,inp,p,msg){var r={code:\"invalid_type\",expected:e,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
24
|
+
export declare const ZC_IF_DECL = "function __zcIF(f,inp,p,extra,msg){var r={code:\"invalid_format\",format:f,input:inp,path:p};if(extra)Object.assign(r,extra);if(msg!==undefined)r.message=msg;return r;}";
|
|
25
|
+
export declare const ZC_IV_DECL = "function __zcIV(values,inp,p,msg){var r={code:\"invalid_value\",values:values,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
26
|
+
export declare const ZC_UK_DECL = "function __zcUK(k,inp,p,msg){var r={code:\"unrecognized_keys\",keys:k,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
27
27
|
/** All issue factory declarations indexed by helper name. */
|
|
28
28
|
export declare const ISSUE_DECLS: Readonly<Record<string, string>>;
|
|
29
29
|
/** Helper names emitted by the issue factory call helpers in lean mode. */
|
|
@@ -33,7 +33,7 @@ export declare const ISSUE_HELPER_NAMES: readonly string[];
|
|
|
33
33
|
* Raw `%` mis-rejects valid multiples of decimal steps (0.3 % 0.1 !== 0);
|
|
34
34
|
* zod scales both operands to integers by their decimal-place count first.
|
|
35
35
|
*/
|
|
36
|
-
export declare const
|
|
36
|
+
export declare const ZC_FSR_DECL = "function __zcFsr(v,s){var vd=((\"\"+v).split(\".\")[1]||\"\").length;var ss=\"\"+s;var sd=(ss.split(\".\")[1]||\"\").length;if(sd===0&&/\\d?e-\\d?/.test(ss)){var m=ss.match(/\\d?e-(\\d?)/);if(m&&m[1]){sd=parseInt(m[1],10);}}var d=vd>sd?vd:sd;var vi=parseInt(v.toFixed(d).replace(\".\",\"\"),10);var si=parseInt(s.toFixed(d).replace(\".\",\"\"),10);return (vi%si)/Math.pow(10,d);}";
|
|
37
37
|
/** Non-issue runtime helper declarations hosted in the virtual module. */
|
|
38
38
|
export declare const RUNTIME_HELPER_DECLS: Readonly<Record<string, string>>;
|
|
39
39
|
//# sourceMappingURL=issue-decls.d.ts.map
|
|
@@ -3,37 +3,37 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These functions produce the same `{code, ...}` shapes that lean-mode
|
|
5
5
|
* generated code would otherwise inline at every check site.
|
|
6
|
-
* Hosted in "virtual:zod-compiler/runtime" and called as `
|
|
6
|
+
* Hosted in "virtual:zod-compiler/runtime" and called as `__zcTS(...)` etc.
|
|
7
7
|
*
|
|
8
8
|
* Argument convention (positional, kept short to minimize call-site bytes):
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* __zcTS(minimum, origin, inclusive, input, path, msg?) — too_small
|
|
10
|
+
* __zcTB(maximum, origin, inclusive, input, path, msg?) — too_big
|
|
11
|
+
* __zcIT(expected, input, path, msg?) — invalid_type
|
|
12
|
+
* __zcIF(format, input, path, extra?, msg?) — invalid_format (extra merged into result)
|
|
13
|
+
* __zcIV(values, input, path, msg?) — invalid_value
|
|
14
|
+
* __zcUK(keys, input, path, msg?) — unrecognized_keys
|
|
15
15
|
*
|
|
16
16
|
* The trailing msg argument carries a static custom error message; when
|
|
17
|
-
* absent, the
|
|
17
|
+
* absent, the __zcFin finalizer applies the configured locale default.
|
|
18
18
|
*/
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
19
|
+
export const ZC_TS_DECL = 'function __zcTS(m,o,i,inp,p,msg){var r={code:"too_small",minimum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
20
|
+
export const ZC_TS_EXACT_DECL = 'function __zcTSx(m,o,inp,p,msg){var r={code:"too_small",minimum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
21
|
+
export const ZC_TB_DECL = 'function __zcTB(m,o,i,inp,p,msg){var r={code:"too_big",maximum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
22
|
+
export const ZC_TB_EXACT_DECL = 'function __zcTBx(m,o,inp,p,msg){var r={code:"too_big",maximum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
23
|
+
export const ZC_IT_DECL = 'function __zcIT(e,inp,p,msg){var r={code:"invalid_type",expected:e,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
24
|
+
export const ZC_IF_DECL = 'function __zcIF(f,inp,p,extra,msg){var r={code:"invalid_format",format:f,input:inp,path:p};if(extra)Object.assign(r,extra);if(msg!==undefined)r.message=msg;return r;}';
|
|
25
|
+
export const ZC_IV_DECL = 'function __zcIV(values,inp,p,msg){var r={code:"invalid_value",values:values,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
26
|
+
export const ZC_UK_DECL = 'function __zcUK(k,inp,p,msg){var r={code:"unrecognized_keys",keys:k,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
27
27
|
/** All issue factory declarations indexed by helper name. */
|
|
28
28
|
export const ISSUE_DECLS = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
__zcTS: ZC_TS_DECL,
|
|
30
|
+
__zcTSx: ZC_TS_EXACT_DECL,
|
|
31
|
+
__zcTB: ZC_TB_DECL,
|
|
32
|
+
__zcTBx: ZC_TB_EXACT_DECL,
|
|
33
|
+
__zcIT: ZC_IT_DECL,
|
|
34
|
+
__zcIF: ZC_IF_DECL,
|
|
35
|
+
__zcIV: ZC_IV_DECL,
|
|
36
|
+
__zcUK: ZC_UK_DECL,
|
|
37
37
|
};
|
|
38
38
|
/** Helper names emitted by the issue factory call helpers in lean mode. */
|
|
39
39
|
export const ISSUE_HELPER_NAMES = Object.keys(ISSUE_DECLS);
|
|
@@ -42,9 +42,9 @@ export const ISSUE_HELPER_NAMES = Object.keys(ISSUE_DECLS);
|
|
|
42
42
|
* Raw `%` mis-rejects valid multiples of decimal steps (0.3 % 0.1 !== 0);
|
|
43
43
|
* zod scales both operands to integers by their decimal-place count first.
|
|
44
44
|
*/
|
|
45
|
-
export const
|
|
45
|
+
export const ZC_FSR_DECL = 'function __zcFsr(v,s){var vd=((""+v).split(".")[1]||"").length;var ss=""+s;var sd=(ss.split(".")[1]||"").length;if(sd===0&&/\\d?e-\\d?/.test(ss)){var m=ss.match(/\\d?e-(\\d?)/);if(m&&m[1]){sd=parseInt(m[1],10);}}var d=vd>sd?vd:sd;var vi=parseInt(v.toFixed(d).replace(".",""),10);var si=parseInt(s.toFixed(d).replace(".",""),10);return (vi%si)/Math.pow(10,d);}';
|
|
46
46
|
/** Non-issue runtime helper declarations hosted in the virtual module. */
|
|
47
47
|
export const RUNTIME_HELPER_DECLS = {
|
|
48
|
-
|
|
48
|
+
__zcFsr: ZC_FSR_DECL,
|
|
49
49
|
};
|
|
50
50
|
//# sourceMappingURL=issue-decls.js.map
|
|
@@ -11,7 +11,7 @@ export function slowCatch(ir, g) {
|
|
|
11
11
|
g.visit(ir.inner, { issues: tempIssues }),
|
|
12
12
|
`if(${tempIssues}.length>0){`,
|
|
13
13
|
`for(var ${idxVar}=0;${idxVar}<${tempIssues}.length;${idxVar}++){`,
|
|
14
|
-
`if(${tempIssues}[${idxVar}].message===undefined&&typeof
|
|
14
|
+
`if(${tempIssues}[${idxVar}].message===undefined&&typeof __zcMsg==="function"){${tempIssues}[${idxVar}].message=__zcMsg(${tempIssues}[${idxVar}]);}`,
|
|
15
15
|
`${tempIssues}[${idxVar}].input=undefined;`,
|
|
16
16
|
`}`,
|
|
17
17
|
`var ${cvVar}=__rf[${ir.refIndex}]._zod.def.catchValue;`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/catch.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAC,EAAgC,EAAE,CAAU;IACpE,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,oEAAoE;IACpE,0EAA0E;IAC1E,0EAA0E;IAC1E,kEAAkE;IAClE,OAAO;QACL,OAAO,UAAU,MAAM;QACvB,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QACzC,MAAM,UAAU,aAAa;QAC7B,WAAW,MAAM,MAAM,MAAM,IAAI,UAAU,WAAW,MAAM,MAAM;QAClE,MAAM,UAAU,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/catch.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAC,EAAgC,EAAE,CAAU;IACpE,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,oEAAoE;IACpE,0EAA0E;IAC1E,0EAA0E;IAC1E,kEAAkE;IAClE,OAAO;QACL,OAAO,UAAU,MAAM;QACvB,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QACzC,MAAM,UAAU,aAAa;QAC7B,WAAW,MAAM,MAAM,MAAM,IAAI,UAAU,WAAW,MAAM,MAAM;QAClE,MAAM,UAAU,IAAI,MAAM,uDAAuD,UAAU,IAAI,MAAM,qBAAqB,UAAU,IAAI,MAAM,MAAM;QACpJ,GAAG,UAAU,IAAI,MAAM,oBAAoB;QAC3C,GAAG;QACH,OAAO,KAAK,SAAS,EAAE,CAAC,QAAQ,wBAAwB;QACxD,GAAG,CAAC,CAAC,MAAM,WAAW,KAAK,iBAAiB,KAAK,WAAW,CAAC,CAAC,KAAK,WAAW,UAAU,kBAAkB,UAAU,WAAW,CAAC,CAAC,KAAK,MAAM,KAAK,GAAG;QACpJ,GAAG;QACH,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAW,EAAE,CAAU;IAC/C,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -25,7 +25,7 @@ export function slowEffect(ir, g) {
|
|
|
25
25
|
export function refineCheck(check, expr, g) {
|
|
26
26
|
// Custom issues are created by the refine check instance, so only the
|
|
27
27
|
// refine's own message applies (never the schema-level error). With no
|
|
28
|
-
// message baked in,
|
|
28
|
+
// message baked in, __zcFin applies the locale default ("Invalid input").
|
|
29
29
|
const messageProp = check.message === undefined ? "" : `,message:${JSON.stringify(check.message)}`;
|
|
30
30
|
return emit `
|
|
31
31
|
if(!(${check.source})(${expr})){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/effect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,E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;IACvE,0EAA0E;IAC1E,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IACjF,OAAO,IAAI,CAAA;WACF,KAAK,CAAC,MAAM,KAAK,IAAI;QACxB,CAAC,CAAC,MAAM,6BAA6B,CAAC,CAAC,IAAI,GAAG,WAAW,UAAU,IAAI;MACzE,CAAC;AACP,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { emit } from "../emit.js";
|
|
|
3
3
|
export function slowFallback(ir, g) {
|
|
4
4
|
if (ir.refIndex !== undefined) {
|
|
5
5
|
const idx = ir.refIndex;
|
|
6
|
-
// Captured pre-
|
|
6
|
+
// Captured pre-__zcMkv (emitRfDelegate): a per-parse `__rf[N].safeParse`
|
|
7
7
|
// read resolves to the compiled validator itself when CSE/dedup or an
|
|
8
8
|
// identifier schemaExpr makes the entry alias the mutated schema object.
|
|
9
9
|
const delegate = emitRfDelegate(g.ctx, idx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,UAAU,YAAY,CAAC,EAAc,EAAE,CAAU;IACrD,IAAI,EAAE,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;QACxB,
|
|
1
|
+
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,UAAU,YAAY,CAAC,EAAc,EAAE,CAAU;IACrD,IAAI,EAAE,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;QACxB,yEAAyE;QACzE,sEAAsE;QACtE,yEAAyE;QACzE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;QAC5B,OAAO,GAAG,IAAI,CAAA;YACN,IAAI,IAAI,QAAQ,IAAI,CAAC,CAAC,KAAK;YAC3B,IAAI;cACF,IAAI,IAAI,IAAI;kBACR,IAAI,MAAM,IAAI,IAAI,IAAI,WAAW,IAAI;YAC3C,CAAC,CAAC,MAAM,aAAa,IAAI,IAAI,IAAI;mBAC1B,CAAC,CAAC,IAAI,WAAW,IAAI,IAAI,IAAI;;;UAGtC,CAAC,CAAC,MAAM,IAAI,IAAI;;KAErB,IAAI,CAAC;IACR,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,MAAM,6BAA6B,CAAC,CAAC,IAAI,8BAA8B,EAAE,CAAC,MAAM,QAAQ,CAAC;AACvG,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { checkPriority, emitRuntimeHelper } from "../context.js";
|
|
2
2
|
import { emit } from "../emit.js";
|
|
3
3
|
import { invalidType, tooBig, tooSmall } from "../emit-issue.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ZC_FSR_DECL } from "../issue-decls.js";
|
|
5
5
|
import { refineCheck } from "./effect.js";
|
|
6
6
|
export function slowNumber(ir, g) {
|
|
7
7
|
let code = "";
|
|
@@ -102,7 +102,7 @@ export function slowNumber(ir, g) {
|
|
|
102
102
|
case "multiple_of": {
|
|
103
103
|
const msgProp = check.message !== undefined ? `,message:${JSON.stringify(check.message)}` : "";
|
|
104
104
|
// zod uses a float-safe remainder: raw % mis-rejects 0.3 % 0.1
|
|
105
|
-
const fsr = emitRuntimeHelper(g.ctx, "
|
|
105
|
+
const fsr = emitRuntimeHelper(g.ctx, "__zcFsr", ZC_FSR_DECL);
|
|
106
106
|
code += emit `
|
|
107
107
|
if(${fsr}(${g.input},${check.value})!==0){
|
|
108
108
|
${g.issues}.push({code:"not_multiple_of",divisor:${check.value},origin:"number"${msgProp},input:${g.input},path:${g.path}});
|
|
@@ -170,7 +170,7 @@ export function fastNumber(ir, g) {
|
|
|
170
170
|
parts.push(check.inclusive ? `${x}<=${check.value}` : `${x}<${check.value}`);
|
|
171
171
|
break;
|
|
172
172
|
case "multiple_of": {
|
|
173
|
-
const fsr = emitRuntimeHelper(g.ctx, "
|
|
173
|
+
const fsr = emitRuntimeHelper(g.ctx, "__zcFsr", ZC_FSR_DECL);
|
|
174
174
|
parts.push(`${fsr}(${x},${check.value})===0`);
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
@@ -88,7 +88,7 @@ export function fastObject(ir, g) {
|
|
|
88
88
|
}
|
|
89
89
|
// Strict unknown-key pass: hosted boolean helper (a for-in loop cannot live
|
|
90
90
|
// in the && chain). Same for-in iteration as the slow path — fast/slow
|
|
91
|
-
// agreement is load-bearing under the
|
|
91
|
+
// agreement is load-bearing under the __zcFinD deferral.
|
|
92
92
|
if (ir.strict) {
|
|
93
93
|
const keys = Object.keys(ir.properties);
|
|
94
94
|
const fnName = g.temp("so");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/object.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CA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