npm / zod-compiler
zod-compiler
What changed in zod-compiler 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-31.
4 breaking2 new APIs and options10 performance24 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initzod-compiler 234 changes
Breaking changes 3
Callbacks that return a Promise now throw.
Extraction refuses zod versions below 4.5; jit and the build plugin warn once.
Requires zod >=4.5.0; the peer range moved from ^4.0.0 to ^4.5.0. Stay on 1.x for older Zod.
Performance 10
A fast check is installed as .is() for records and loose or catchall objects.
Self-recursive root schemas are built in the single-pass build path.
The static filter skips transpilation for files with an obvious schema export.
z.url() is built in the single-pass build path and checked with URL.canParse.
Build-path properties are checked cheapest-first to improve performance.
Settled guards are skipped in dispatched options to improve performance.
.is() remains total over defaults.
Record and stringbool guards are short-circuited, improving performance.
Union tags are switched on directly, improving performance.
Email validation scans linearly, improving performance.
Fixes and other changes 21
Finalizing .error issues copies them instead of deleting input, avoiding mutation of the input.
The slow walk no longer writes into arrays, records or tuples supplied by the caller.
Set, map and discriminated union outputs now carry a member's replacement.
A preprocessed rewriting schema is now checked against the value it rewrote.
Failed union options no longer contribute their output to the union's result.
Avoids unhosted recursive fast checks after rollback.
Object properties are read from the original input, and loose and catchall outputs are rebuilt in zod's key order.
Sized integer formats outside the safe range now report zod's safe-integer issue.
Abort state is preserved through delegates, template literals and nested superRefines, allowing union pruning to work correctly.
Snapshots key presence before an absent-key property runs.
Matches Zod 4.5 behavior for code-point lengths, URL guarding, partial records, and non-finite received values.
Serves Zod's prototype methods when a compile-on-read accessor is stranded.
A discriminated-union miss lists dispatch values as options, matching Zod 4.5.
Matches Zod 4.5 multipleOf, credit-card, and fractional-length semantics.
Matches Zod 4.5 object, record, catch, and error-map semantics.
Keeps __proto__ out of loose, catchall, and record outputs.
Delegates symbol-keyed shapes and record key issues inside intersections.
Mirrors Zod 4.5 tuple issue order, preprocess aliasing, and short-input builds.
Follows Zod 4.5's optin ladder for tuples, optional values, and absent object keys.
Refreshes the well-known regex table for Zod 4.5.
Delegates loose records so unrecognized keys pass through.
zod-compiler 16 changes
Breaking changes 1
Callbacks whose source is not a function expression are rejected.
New APIs and options 2
The parallel option runs transforms on worker threads.
Adds an automatic Node.js JIT registration hook.
Fixes and other changes 3
Exports that throw when probed are skipped instead of causing the build to fail.
Transforms whose signature proves they read Zod's parse context are delegated to Zod.
The compiled IIFE is emitted after a self-referential declaration rather than inside its initializer.