zod-compiler 1.23.6 → 1.23.7
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/core/codegen/build-path.d.ts.map +1 -1
- package/dist/core/codegen/build-path.js +57 -6
- package/dist/core/codegen/build-path.js.map +1 -1
- package/dist/core/codegen/context.d.ts +23 -3
- package/dist/core/codegen/context.d.ts.map +1 -1
- package/dist/core/codegen/context.js +23 -1
- package/dist/core/codegen/context.js.map +1 -1
- package/dist/core/codegen/dedupe.js +4 -1
- package/dist/core/codegen/dedupe.js.map +1 -1
- package/dist/core/codegen/emit-issue.d.ts +27 -2
- package/dist/core/codegen/emit-issue.d.ts.map +1 -1
- package/dist/core/codegen/emit-issue.js +8 -3
- package/dist/core/codegen/emit-issue.js.map +1 -1
- package/dist/core/codegen/issue-decls.d.ts +9 -3
- package/dist/core/codegen/issue-decls.d.ts.map +1 -1
- package/dist/core/codegen/issue-decls.js +10 -4
- package/dist/core/codegen/issue-decls.js.map +1 -1
- package/dist/core/codegen/schemas/catch.d.ts.map +1 -1
- package/dist/core/codegen/schemas/catch.js +1 -1
- package/dist/core/codegen/schemas/catch.js.map +1 -1
- package/dist/core/codegen/schemas/discriminated-union.d.ts.map +1 -1
- package/dist/core/codegen/schemas/discriminated-union.js +11 -3
- package/dist/core/codegen/schemas/discriminated-union.js.map +1 -1
- package/dist/core/codegen/schemas/effect.d.ts.map +1 -1
- package/dist/core/codegen/schemas/effect.js +3 -2
- package/dist/core/codegen/schemas/effect.js.map +1 -1
- package/dist/core/codegen/schemas/enum.d.ts.map +1 -1
- package/dist/core/codegen/schemas/enum.js +25 -0
- package/dist/core/codegen/schemas/enum.js.map +1 -1
- package/dist/core/codegen/schemas/literal.d.ts.map +1 -1
- package/dist/core/codegen/schemas/literal.js +37 -3
- package/dist/core/codegen/schemas/literal.js.map +1 -1
- package/dist/core/codegen/schemas/string-bool.d.ts.map +1 -1
- package/dist/core/codegen/schemas/string-bool.js +3 -2
- package/dist/core/codegen/schemas/string-bool.js.map +1 -1
- package/dist/core/codegen/schemas/string.d.ts.map +1 -1
- package/dist/core/codegen/schemas/string.js +13 -7
- package/dist/core/codegen/schemas/string.js.map +1 -1
- package/dist/core/codegen/schemas/template-literal.d.ts.map +1 -1
- package/dist/core/codegen/schemas/template-literal.js +2 -2
- package/dist/core/codegen/schemas/template-literal.js.map +1 -1
- package/dist/core/codegen/schemas/tuple.d.ts +11 -5
- package/dist/core/codegen/schemas/tuple.d.ts.map +1 -1
- package/dist/core/codegen/schemas/tuple.js +12 -6
- package/dist/core/codegen/schemas/tuple.js.map +1 -1
- package/dist/core/codegen/schemas/union.d.ts.map +1 -1
- package/dist/core/codegen/schemas/union.js +17 -17
- package/dist/core/codegen/schemas/union.js.map +1 -1
- package/dist/core/extract/checks.d.ts +18 -2
- package/dist/core/extract/checks.d.ts.map +1 -1
- package/dist/core/extract/checks.js +138 -11
- package/dist/core/extract/checks.js.map +1 -1
- package/dist/core/extract/extractors/array.d.ts.map +1 -1
- package/dist/core/extract/extractors/array.js +2 -2
- package/dist/core/extract/extractors/array.js.map +1 -1
- package/dist/core/extract/extractors/intersection.js +44 -0
- package/dist/core/extract/extractors/intersection.js.map +1 -1
- package/dist/core/extract/extractors/lazy.d.ts.map +1 -1
- package/dist/core/extract/extractors/lazy.js +2 -13
- package/dist/core/extract/extractors/lazy.js.map +1 -1
- package/dist/core/extract/extractors/literal.d.ts +14 -0
- package/dist/core/extract/extractors/literal.d.ts.map +1 -1
- package/dist/core/extract/extractors/literal.js +32 -4
- package/dist/core/extract/extractors/literal.js.map +1 -1
- package/dist/core/extract/extractors/number.d.ts.map +1 -1
- package/dist/core/extract/extractors/number.js +2 -2
- package/dist/core/extract/extractors/number.js.map +1 -1
- package/dist/core/extract/extractors/object.d.ts.map +1 -1
- package/dist/core/extract/extractors/object.js +2 -2
- package/dist/core/extract/extractors/object.js.map +1 -1
- package/dist/core/extract/extractors/record.d.ts.map +1 -1
- package/dist/core/extract/extractors/record.js +2 -0
- package/dist/core/extract/extractors/record.js.map +1 -1
- package/dist/core/extract/extractors/string.d.ts.map +1 -1
- package/dist/core/extract/extractors/string.js +2 -2
- package/dist/core/extract/extractors/string.js.map +1 -1
- package/dist/core/extract/extractors/union.js +2 -0
- package/dist/core/extract/extractors/union.js.map +1 -1
- package/dist/core/extract/recursion.d.ts +26 -0
- package/dist/core/extract/recursion.d.ts.map +1 -0
- package/dist/core/extract/recursion.js +37 -0
- package/dist/core/extract/recursion.js.map +1 -0
- package/dist/core/extract/registry.d.ts.map +1 -1
- package/dist/core/extract/registry.js +2 -0
- package/dist/core/extract/registry.js.map +1 -1
- package/dist/core/extract/types.d.ts +21 -6
- package/dist/core/extract/types.d.ts.map +1 -1
- package/dist/core/iife.d.ts +13 -0
- package/dist/core/iife.d.ts.map +1 -1
- package/dist/core/iife.js +14 -1
- package/dist/core/iife.js.map +1 -1
- package/dist/core/types.d.ts +49 -2
- package/dist/core/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core/types.d.ts
CHANGED
|
@@ -52,6 +52,24 @@ interface CheckStringFormat extends CheckBase {
|
|
|
52
52
|
protocolFlags?: string;
|
|
53
53
|
/** url-only: output url.href instead of the trimmed input. */
|
|
54
54
|
normalize?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Emit a BARE `invalid_format` issue — no `origin`, no `pattern`.
|
|
57
|
+
*
|
|
58
|
+
* Zod's `invalid_format` shape is not uniform, and the split follows which
|
|
59
|
+
* check instance ends up installed. `$ZodCheckStringFormat.init` installs the
|
|
60
|
+
* DEFAULT pattern check with `inst._zod.check ??= …`, and that default pushes
|
|
61
|
+
* `origin: "string"` plus `pattern: def.pattern.toString()`. A constructor
|
|
62
|
+
* that OVERRIDES `inst._zod.check` afterwards pushes its own issue instead —
|
|
63
|
+
* `$ZodCustomStringFormat` (what `z.stringFormat()`, `z.hex()`, `z.hostname()`
|
|
64
|
+
* and `z.hash()` all build) pushes only `{ code, format, input }`, because it
|
|
65
|
+
* validates through `def.fn` and never consults `def.pattern`.
|
|
66
|
+
*
|
|
67
|
+
* The compiler validates with the pattern either way, so this flag records
|
|
68
|
+
* WHICH issue shape to reproduce. Set from the structural `def.fn` marker in
|
|
69
|
+
* src/core/extract/checks.ts — a format's name is user-chosen, so it cannot be
|
|
70
|
+
* decided from a name list.
|
|
71
|
+
*/
|
|
72
|
+
bareIssue?: boolean;
|
|
55
73
|
}
|
|
56
74
|
interface CheckIncludes extends CheckBase {
|
|
57
75
|
kind: "includes";
|
|
@@ -92,6 +110,15 @@ interface RefineEffectCheckIR {
|
|
|
92
110
|
* the refined value itself.
|
|
93
111
|
*/
|
|
94
112
|
path?: (string | number)[];
|
|
113
|
+
/**
|
|
114
|
+
* `__rf[N]` index of the `params` object from `.refine(fn, { params })`.
|
|
115
|
+
* $ZodCustom copies it onto the issue (`if (def.params) _iss.params =
|
|
116
|
+
* def.params`) BY REFERENCE, so it is held as a reference rather than baked
|
|
117
|
+
* as a literal: the value may be anything (functions, symbols, a cycle), and
|
|
118
|
+
* an error map comparing `issue.params === myParams` — the reason to pass
|
|
119
|
+
* params at all — would fail against a per-failure copy.
|
|
120
|
+
*/
|
|
121
|
+
paramsRefIndex?: number;
|
|
95
122
|
}
|
|
96
123
|
/**
|
|
97
124
|
* A `superRefine` (or a raw `.check(payloadFn)`): a callback that receives zod's
|
|
@@ -217,9 +244,29 @@ interface AnyIR {
|
|
|
217
244
|
interface UnknownIR {
|
|
218
245
|
type: "unknown";
|
|
219
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* A value accepted by `z.literal()`.
|
|
249
|
+
*
|
|
250
|
+
* Zod TYPES the argument as `util.Literal = string | number | bigint | boolean
|
|
251
|
+
* | null | undefined`, but its runtime does `new Set(def.values).has(input)` —
|
|
252
|
+
* so anything at all parses, and a SYMBOL is the off-type value people actually
|
|
253
|
+
* pass (branded keys, well-known registry symbols). `symbol` is therefore
|
|
254
|
+
* admitted here; other reference values (an object, a function) are equally
|
|
255
|
+
* legal at runtime and are handled by the same route, because the codegen guard
|
|
256
|
+
* that splits the two paths ({@link import("./codegen/context.js").hasSourceForm})
|
|
257
|
+
* is a total `typeof` test rather than a list of exclusions.
|
|
258
|
+
*/
|
|
259
|
+
type LiteralValue = string | number | boolean | null | bigint | undefined | symbol;
|
|
220
260
|
interface LiteralIR {
|
|
221
261
|
type: "literal";
|
|
222
|
-
values:
|
|
262
|
+
values: LiteralValue[];
|
|
263
|
+
/**
|
|
264
|
+
* Index into `__rf[]` — the original `z.literal()` schema — present ONLY when
|
|
265
|
+
* at least one value has no JS source form. Codegen then tests membership
|
|
266
|
+
* against that schema's own `_zod.def.values` at runtime instead of emitting
|
|
267
|
+
* `===` comparisons it cannot spell. See the literal extractor and generator.
|
|
268
|
+
*/
|
|
269
|
+
refIndex?: number;
|
|
223
270
|
}
|
|
224
271
|
interface EnumIR {
|
|
225
272
|
type: "enum";
|
|
@@ -505,5 +552,5 @@ interface CompiledSchema<T> {
|
|
|
505
552
|
is(input: unknown): input is T;
|
|
506
553
|
}
|
|
507
554
|
//#endregion
|
|
508
|
-
export { AnyIR, ArrayIR, BigIntCheckIR, BigIntIR, BooleanIR, CatchIR, CheckBase, CheckBigIntGreaterThan, CheckBigIntLessThan, CheckBigIntMultipleOf, CheckDateGreaterThan, CheckDateLessThan, CheckEndsWith, CheckGreaterThan, CheckIR, CheckIncludes, CheckLengthEquals, CheckLessThan, CheckMaxLength, CheckMaxSize, CheckMimeType, CheckMinLength, CheckMinSize, CheckMultipleOf, CheckNumberFormat, CheckOrEffectIR, CheckSizeEquals, CheckStartsWith, CheckStringFormat, CompiledSchema, CustomIR, DateCheckIR, DateIR, DefaultIR, DiscoveredSchema, DiscriminatedUnionIR, EnumIR, FallbackIR, FileCheckIR, FileIR, IntersectionIR, LiteralIR, MapIR, NanIR, NeverIR, NullIR, NullableIR, NumberIR, ObjectIR, OptionalIR, OverwriteEffectCheckIR, PipeIR, PreprocessEffectIR, ReadonlyIR, RecordIR, RecursionTargetIR, RecursiveRefIR, RefineEffectCheckIR, SafeParseError, SafeParseResult, SafeParseSuccess, SchemaIR, SetCheckIR, SetIR, StringBoolIR, StringIR, SuperRefineEffectCheckIR, SymbolIR, TemplateLiteralIR, TransformEffectIR, TupleIR, TypeMessageCarrier, UndefinedIR, UnionIR, UnknownIR, VoidIR, ZodDelegateIR, ZodErrorLike, ZodIssueLike };
|
|
555
|
+
export { AnyIR, ArrayIR, BigIntCheckIR, BigIntIR, BooleanIR, CatchIR, CheckBase, CheckBigIntGreaterThan, CheckBigIntLessThan, CheckBigIntMultipleOf, CheckDateGreaterThan, CheckDateLessThan, CheckEndsWith, CheckGreaterThan, CheckIR, CheckIncludes, CheckLengthEquals, CheckLessThan, CheckMaxLength, CheckMaxSize, CheckMimeType, CheckMinLength, CheckMinSize, CheckMultipleOf, CheckNumberFormat, CheckOrEffectIR, CheckSizeEquals, CheckStartsWith, CheckStringFormat, CompiledSchema, CustomIR, DateCheckIR, DateIR, DefaultIR, DiscoveredSchema, DiscriminatedUnionIR, EnumIR, FallbackIR, FileCheckIR, FileIR, IntersectionIR, LiteralIR, LiteralValue, MapIR, NanIR, NeverIR, NullIR, NullableIR, NumberIR, ObjectIR, OptionalIR, OverwriteEffectCheckIR, PipeIR, PreprocessEffectIR, ReadonlyIR, RecordIR, RecursionTargetIR, RecursiveRefIR, RefineEffectCheckIR, SafeParseError, SafeParseResult, SafeParseSuccess, SchemaIR, SetCheckIR, SetIR, StringBoolIR, StringIR, SuperRefineEffectCheckIR, SymbolIR, TemplateLiteralIR, TransformEffectIR, TupleIR, TypeMessageCarrier, UndefinedIR, UnionIR, UnknownIR, VoidIR, ZodDelegateIR, ZodErrorLike, ZodIssueLike };
|
|
509
556
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/core/types.ts"],"mappings":";;;;;;UAQiB;;EAEf;;UAGe,uBAAuB;EACtC;EACA;;UAGe,uBAAuB;EACtC;EACA;;UAGe,0BAA0B;EACzC;EACA;;UAGe,yBAAyB;EACxC;EACA;EACA;;UAGe,sBAAsB;EACrC;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;;UAGe,0BAA0B;EACzC;EACA;;UAGe,0BAA0B;EACzC;EACA;EACA;;EAEA;;EAEA;EACA;;EAEA;EACA;;EAEA;;UAGe,sBAAsB;EACrC;EACA;EACA;;UAGe,wBAAwB;EACvC;EACA;;UAGe,sBAAsB;EACrC;EACA;;KAGU,UACR,iBACA,iBACA,oBACA,mBACA,gBACA,kBACA,oBACA,oBACA,gBACA,kBACA;UAMa;EACf;;;;;;EAMA;;;;;;;;;EASA;;EAEA;;;;;;EAMA;;;;;;;;;;;;;UAce;EACf;;EAEA;;;;;;UAOe;EACf;;EAEA;;;KAIU,kBACR,UACA,sBACA,2BACA;UAIa,6BAA6B;EAC5C;EACA;EACA;EACA;;UAGe,0BAA0B;EACzC;EACA;EACA;EACA;;KAGU,cAAc,uBAAuB;UAIhC,+BAA+B;EAC9C;;EAEA;EACA;;UAGe,4BAA4B;EAC3C;;EAEA;EACA;;UAGe,8BAA8B;EAC7C;;EAEA;;KAGU,gBAAgB,yBAAyB,sBAAsB;UAI1D,qBAAqB;EACpC;EACA;;UAGe,qBAAqB;EACpC;EACA;;UAGe,wBAAwB;EACvC;EACA;;KAGU,aAAa,eAAe,eAAe;UAItC,sBAAsB;EACrC;EACA;;KAGU,cAAc,eAAe,eAAe;UAIvC;EACf;EACA,QAAQ;EACR;;UAGe;EACf;EACA,QAAQ;EACR;;UAGe;EACf;EACA;;UAGe;EACf;EACA,QAAQ;EACR;;UAGe;EACf;EACA,QAAQ;EACR;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf;;UAGe;EACf
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/core/types.ts"],"mapp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