zod-compiler 1.0.17 → 1.1.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/README.md +170 -66
- package/dist/cli/commands/check.js +2 -2
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/index.js +45 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/logger.js +2 -2
- package/dist/cli/logger.js.map +1 -1
- package/dist/core/codegen/context.d.ts +16 -10
- package/dist/core/codegen/context.d.ts.map +1 -1
- package/dist/core/codegen/context.js +22 -40
- package/dist/core/codegen/context.js.map +1 -1
- package/dist/core/codegen/fast-path.js +1 -1
- package/dist/core/codegen/fast-path.js.map +1 -1
- package/dist/core/codegen/issue-decls.d.ts +0 -10
- package/dist/core/codegen/issue-decls.d.ts.map +1 -1
- package/dist/core/codegen/issue-decls.js +8 -10
- package/dist/core/codegen/issue-decls.js.map +1 -1
- package/dist/core/codegen/schemas/array.js +2 -2
- package/dist/core/codegen/schemas/array.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/number.js +2 -2
- package/dist/core/codegen/schemas/number.js.map +1 -1
- package/dist/core/codegen/schemas/object.d.ts.map +1 -1
- package/dist/core/codegen/schemas/object.js +2 -2
- package/dist/core/codegen/schemas/object.js.map +1 -1
- package/dist/core/codegen/schemas/string.js +3 -3
- package/dist/core/codegen/schemas/string.js.map +1 -1
- package/dist/core/codegen/slow-path.js +1 -1
- package/dist/core/codegen/slow-path.js.map +1 -1
- package/dist/core/extract/checks.d.ts +0 -2
- package/dist/core/extract/checks.d.ts.map +1 -1
- package/dist/core/extract/checks.js +1 -1
- package/dist/core/extract/checks.js.map +1 -1
- package/dist/unplugin/dep-graph.d.ts.map +1 -1
- package/dist/unplugin/dep-graph.js +13 -6
- package/dist/unplugin/dep-graph.js.map +1 -1
- package/dist/unplugin/hoist.d.ts.map +1 -1
- package/dist/unplugin/hoist.js.map +1 -1
- package/dist/unplugin/index.d.ts.map +1 -1
- package/dist/unplugin/index.js +24 -5
- package/dist/unplugin/index.js.map +1 -1
- package/dist/unplugin/transform.js +2 -2
- package/dist/unplugin/transform.js.map +1 -1
- package/dist/unplugin/types.d.ts +45 -17
- package/dist/unplugin/types.d.ts.map +1 -1
- package/dist/unplugin/types.js +22 -0
- package/dist/unplugin/types.js.map +1 -1
- package/package.json +17 -7
- package/dist/core/extract/extractors/index.d.ts +0 -32
- package/dist/core/extract/extractors/index.d.ts.map +0 -1
- package/dist/core/extract/extractors/index.js +0 -32
- package/dist/core/extract/extractors/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
**Compile Zod schemas into zero-overhead validation functions at build time.**
|
|
4
4
|
|
|
5
|
-
Keep your existing Zod schemas. Get **2-
|
|
5
|
+
Keep your existing Zod schemas. Get **2-74x faster** validation. No code changes required.
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
// vite.config.ts — add one line
|
|
9
9
|
import zodCompiler from "zod-compiler/vite";
|
|
10
|
+
|
|
10
11
|
export default defineConfig({
|
|
11
|
-
plugins: [zodCompiler(
|
|
12
|
+
plugins: [zodCompiler()],
|
|
12
13
|
});
|
|
13
14
|
```
|
|
14
15
|
|
|
@@ -23,7 +24,7 @@ export const UserSchema = z.object({
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
// Use it anywhere — tRPC, Hono, React Hook Form, etc.
|
|
26
|
-
// At build time, zod-compiler compiles it to a 2-
|
|
27
|
+
// At build time, zod-compiler compiles it to a 2-74x faster validator.
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
## Install
|
|
@@ -42,7 +43,7 @@ npm install zod-compiler zod@^4
|
|
|
42
43
|
|
|
43
44
|
There are three ways to use zod-compiler. Choose the one that fits your project.
|
|
44
45
|
|
|
45
|
-
### 1.
|
|
46
|
+
### 1. Automatic Mode (Default)
|
|
46
47
|
|
|
47
48
|
The plugin automatically detects and compiles all exported Zod schemas at build time. No wrappers, no imports from `zod-compiler` in your source code.
|
|
48
49
|
|
|
@@ -52,7 +53,7 @@ The plugin automatically detects and compiles all exported Zod schemas at build
|
|
|
52
53
|
import zodCompiler from "zod-compiler/vite";
|
|
53
54
|
|
|
54
55
|
export default defineConfig({
|
|
55
|
-
plugins: [zodCompiler(
|
|
56
|
+
plugins: [zodCompiler()],
|
|
56
57
|
});
|
|
57
58
|
```
|
|
58
59
|
|
|
@@ -118,7 +119,7 @@ validateUser.parse(data);
|
|
|
118
119
|
validateUser.safeParse(data);
|
|
119
120
|
```
|
|
120
121
|
|
|
121
|
-
`compile()` and
|
|
122
|
+
`compile()` and auto mode coexist — `compile()` schemas are detected first, then every remaining plain Zod export is picked up. To make `compile()` the _only_ path (no automatic detection, no build-time execution of plain schema files), pair it with `schemas: "explicit"` in the plugin options.
|
|
122
123
|
|
|
123
124
|
### 3. CLI (No Bundler)
|
|
124
125
|
|
|
@@ -133,6 +134,9 @@ npx zod-compiler generate src/ -o src/compiled/
|
|
|
133
134
|
|
|
134
135
|
# Watch mode
|
|
135
136
|
npx zod-compiler generate src/ --watch
|
|
137
|
+
|
|
138
|
+
# Only compile() calls (skip plain exports); minimal methods-only output
|
|
139
|
+
npx zod-compiler generate src/ --schemas explicit --emit bag
|
|
136
140
|
```
|
|
137
141
|
|
|
138
142
|
## Build Plugin
|
|
@@ -152,20 +156,23 @@ npx zod-compiler generate src/ --watch
|
|
|
152
156
|
|
|
153
157
|
### Options
|
|
154
158
|
|
|
155
|
-
| Option
|
|
156
|
-
|
|
|
157
|
-
| `
|
|
158
|
-
| `include`
|
|
159
|
-
| `exclude`
|
|
160
|
-
| `
|
|
161
|
-
| `verbose`
|
|
162
|
-
| `hoist`
|
|
163
|
-
| `apply`
|
|
164
|
-
| `cache`
|
|
159
|
+
| Option | Type | Default | Description |
|
|
160
|
+
| --------- | ----------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
161
|
+
| `schemas` | `"auto" \| "explicit"` | `"auto"` | How schemas are found. `"auto"`: every exported Zod schema compiles (also enables compiling hoisted in-function schemas). `"explicit"`: only `compile()`-wrapped schemas; only files importing zod-compiler execute at build time |
|
|
162
|
+
| `include` | `string[]` | — | Only process files matching these path globs (picomatch, matched anywhere in the path; plain substrings work too) |
|
|
163
|
+
| `exclude` | `string[]` | — | Skip files matching these path globs (same matching rules as `include`) |
|
|
164
|
+
| `output` | `"schema" \| "bag"` | `"schema"` | What a compiled export evaluates to. `"schema"`: the original Zod schema with compiled methods installed (full API preserved). `"bag"`: a minimal methods-only object — smaller bundles, breaks Zod-schema consumers |
|
|
165
|
+
| `verbose` | `boolean` | `false` | Log per-schema compilation status during build |
|
|
166
|
+
| `hoist` | `boolean` | `true` | Hoist Zod schemas defined inside function bodies to module scope so they're constructed once instead of per call (babel-plugin-zod-hoist equivalent). Only expressions built purely from imports and literals are hoisted |
|
|
167
|
+
| `apply` | `"build" \| "serve" \| "all"` | builds + Vitest | **Vite only**: when the plugin runs. By default, production builds and test runs are compiled (so tests exercise what ships); plain dev servers use the Zod fallback. `"all"` also compiles the dev server; `"build"` also skips tests |
|
|
168
|
+
| `cache` | `boolean \| string` | `true` | Persistent transform cache (`node_modules/.cache/zod-compiler`, or a custom directory). Skips discovery + codegen across processes when nothing changed; entries self-validate against dependency content hashes |
|
|
169
|
+
|
|
170
|
+
> `autoDiscover: boolean` and `zodCompat: boolean` still work as deprecated aliases
|
|
171
|
+
> (`autoDiscover: true` → `schemas: "auto"`, `zodCompat: false` → `output: "bag"`);
|
|
172
|
+
> the new options win when both are present.
|
|
165
173
|
|
|
166
174
|
```typescript
|
|
167
175
|
zodCompiler({
|
|
168
|
-
autoDiscover: true,
|
|
169
176
|
include: ["src/schemas"],
|
|
170
177
|
verbose: true,
|
|
171
178
|
});
|
|
@@ -210,6 +217,91 @@ Combinator chains on imported schemas also qualify: bases matching
|
|
|
210
217
|
`z.*` reference (`Base.extend({ a: z.string() })`). Configure via
|
|
211
218
|
`hoist: { schemaNamePattern: /Shape$/ }` (string and `null` accepted).
|
|
212
219
|
|
|
220
|
+
#### Hoisted schemas compile too (auto mode)
|
|
221
|
+
|
|
222
|
+
The most common shape this rescues is a schema that never leaves a function —
|
|
223
|
+
a [slonik](https://github.com/gajus/slonik) query, a tRPC input, a handler-local
|
|
224
|
+
validator. It is not exported, so export scanning alone would never see it:
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
import { pool, sql } from "./db.js";
|
|
228
|
+
import { z } from "zod";
|
|
229
|
+
|
|
230
|
+
const getUser = (id: number) => {
|
|
231
|
+
return pool.one(
|
|
232
|
+
sql.type(
|
|
233
|
+
z.object({
|
|
234
|
+
id: z.number(),
|
|
235
|
+
name: z.string(),
|
|
236
|
+
}),
|
|
237
|
+
)`SELECT id, name FROM users WHERE id = ${id}`,
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
In auto mode (the default), the build output is (verbatim, lightly trimmed):
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
import { __zcFin, __zcFinD, __zcIT, __zcMkv } from "virtual:zod-compiler/runtime";
|
|
246
|
+
const _zh_6c9cb1a3 = /* @__PURE__ */ (() => {
|
|
247
|
+
function __fc_0(input) {
|
|
248
|
+
return (
|
|
249
|
+
typeof input === "object" &&
|
|
250
|
+
input !== null &&
|
|
251
|
+
!Array.isArray(input) &&
|
|
252
|
+
Number.isFinite(input["id"]) &&
|
|
253
|
+
typeof input["name"] === "string"
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
function __sw_2(input) {
|
|
257
|
+
var _e = [];
|
|
258
|
+
/* error-collecting walk — runs only when .error is read */ return _e;
|
|
259
|
+
}
|
|
260
|
+
function safeParse__zh_6c9cb1a3(input) {
|
|
261
|
+
if (__fc_0(input)) {
|
|
262
|
+
return { success: true, data: input };
|
|
263
|
+
}
|
|
264
|
+
return __zcFinD(__sw_2, input);
|
|
265
|
+
}
|
|
266
|
+
return __zcMkv(
|
|
267
|
+
safeParse__zh_6c9cb1a3,
|
|
268
|
+
z.object({
|
|
269
|
+
id: z.number(),
|
|
270
|
+
name: z.string(),
|
|
271
|
+
}),
|
|
272
|
+
__fc_0,
|
|
273
|
+
);
|
|
274
|
+
})();
|
|
275
|
+
import { pool, sql } from "./db.js";
|
|
276
|
+
import { z } from "zod";
|
|
277
|
+
|
|
278
|
+
const getUser = (id: number) => {
|
|
279
|
+
return pool.one(sql.type(_zh_6c9cb1a3)`SELECT id, name FROM users WHERE id = ${id}`);
|
|
280
|
+
};
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Reading it bottom-up:
|
|
284
|
+
|
|
285
|
+
- **The real Zod schema is still constructed** (once, at module load) and is the
|
|
286
|
+
object `_zh_6c9cb1a3` resolves to — `__zcMkv` installs the compiled
|
|
287
|
+
`parse`/`safeParse`/`parseAsync`/`safeParseAsync` as own properties on it and
|
|
288
|
+
returns it. `sql.type()` receives a genuine Zod schema (identity, `.shape`,
|
|
289
|
+
`._zod`, Standard Schema all intact) whose `safeParse` happens to be compiled.
|
|
290
|
+
- **`__fc_0` is the Fast Path**: when slonik validates each row, a valid row
|
|
291
|
+
costs one boolean chain — no per-node traversal, no allocations beyond the
|
|
292
|
+
result object.
|
|
293
|
+
- **`__sw_2` + `__zcFinD` are the failure path**: an invalid row returns
|
|
294
|
+
`{success: false}` immediately; the full error walk runs lazily only if
|
|
295
|
+
`.error` is actually read.
|
|
296
|
+
- The `sql.type(...)` call itself stays at the call site (it closes over `id`
|
|
297
|
+
via the tagged template) — only its schema argument was hoisted and compiled.
|
|
298
|
+
|
|
299
|
+
Measured on this exact pattern: schema construction + validation drops from
|
|
300
|
+
~16,700ns to ~14ns per call — construction amortizes to module load, and
|
|
301
|
+
per-row validation rides the Fast Path. With `schemas: "explicit"` the same file
|
|
302
|
+
still gets the plain hoist (construction once instead of per call); the
|
|
303
|
+
compiled IIFE requires auto mode (the default) because the schema is anonymous.
|
|
304
|
+
|
|
213
305
|
### Bundle Size & Cross-File Dedup
|
|
214
306
|
|
|
215
307
|
Generated validators share a small runtime helper layer (`__zcMkv` validator
|
|
@@ -225,25 +317,24 @@ many files reference them.
|
|
|
225
317
|
|
|
226
318
|
The result: a 5-file project with 10 schemas all using `z.email()` and
|
|
227
319
|
`z.uuid()` produces a bundle where each shared regex appears exactly **once**.
|
|
228
|
-
Set `
|
|
320
|
+
Set `output: "bag"` to additionally drop the original Zod schema reference
|
|
229
321
|
when you don't need `instanceof` / `.shape` access on the compiled output.
|
|
230
322
|
|
|
231
|
-
###
|
|
323
|
+
### Auto Mode: Side Effects Warning
|
|
232
324
|
|
|
233
|
-
|
|
325
|
+
In auto mode (the default), the plugin executes files to inspect their exports. A static pre-filter skips files whose exports provably can't be schemas without executing them — but if a file has schema-shaped exports AND side effects (starts a server, connects to a database), those side effects run at build time.
|
|
234
326
|
|
|
235
327
|
**Fix:** Use `include` to limit which files are scanned:
|
|
236
328
|
|
|
237
329
|
```typescript
|
|
238
330
|
zodCompiler({
|
|
239
|
-
autoDiscover: true,
|
|
240
331
|
include: ["src/schemas", "src/validators"],
|
|
241
332
|
});
|
|
242
333
|
```
|
|
243
334
|
|
|
244
|
-
###
|
|
335
|
+
### schemas: "auto" vs "explicit"
|
|
245
336
|
|
|
246
|
-
| |
|
|
337
|
+
| | `"auto"` (default) | `"explicit"` + compile() |
|
|
247
338
|
| ---------------------------- | ---------------------------------------------------------- | ------------------------------------------- |
|
|
248
339
|
| Source code changes | None | Wrap each schema |
|
|
249
340
|
| `zod-compiler` import needed | No | Yes |
|
|
@@ -281,10 +372,10 @@ performance, run hoist-only in Vitest and compile only real builds:
|
|
|
281
372
|
|
|
282
373
|
```typescript
|
|
283
374
|
// vitest.config.ts — hoisting still applies; validation uses plain Zod
|
|
284
|
-
zodCompiler({
|
|
375
|
+
zodCompiler({ schemas: "explicit" });
|
|
285
376
|
|
|
286
377
|
// vite.config.ts (build)
|
|
287
|
-
zodCompiler({
|
|
378
|
+
zodCompiler({ include: ["src/schemas"] });
|
|
288
379
|
```
|
|
289
380
|
|
|
290
381
|
**3. Measure before tuning.** `ZOD_COMPILER_TIMING=1` prints per-phase wall
|
|
@@ -313,7 +404,7 @@ export const appRouter = t.router({
|
|
|
313
404
|
});
|
|
314
405
|
```
|
|
315
406
|
|
|
316
|
-
|
|
407
|
+
In auto mode (the default), `CreateUserSchema` is compiled at build time. The tRPC router uses the optimized version automatically. No `.input(compile(CreateUserSchema))` needed.
|
|
317
408
|
|
|
318
409
|
### Hono
|
|
319
410
|
|
|
@@ -395,7 +486,7 @@ npx zod-compiler check src/schemas.ts --json --fail-under 80
|
|
|
395
486
|
|
|
396
487
|
## What Gets Compiled
|
|
397
488
|
|
|
398
|
-
### Fully Compiled (2-
|
|
489
|
+
### Fully Compiled (2-74x faster)
|
|
399
490
|
|
|
400
491
|
`string`, `number`, `bigint`, `boolean`, `null`, `undefined`, `any`, `unknown`, `literal`, `enum`, `stringbool`, `date`, `file`, `object`, `strictObject` / `.strict()`, `looseObject`, `array`, `tuple`, `record`, `set`, `map`, `union`, `discriminatedUnion`, `intersection`, `pipe` (non-transform), `optional`, `nullable`, `readonly`, `default`, `catch`, `coerce`, `templateLiteral`, `symbol`, `void`, `nan`, `never`, `lazy` (self-recursive), `transform` / `refine` (zero-capture — see below)
|
|
401
492
|
|
|
@@ -405,14 +496,14 @@ All standard Zod checks are supported: `min`, `max`, `length`, `email`, `url`, `
|
|
|
405
496
|
|
|
406
497
|
These contain JavaScript callbacks that cannot be reproduced in generated code:
|
|
407
498
|
|
|
408
|
-
| Type
|
|
409
|
-
|
|
|
410
|
-
| `transform` / `refine` with captures
|
|
411
|
-
| `superRefine`
|
|
412
|
-
| `custom`
|
|
413
|
-
| `preprocess`
|
|
414
|
-
| `lazy` (non-recursive)
|
|
415
|
-
| `.catchall(schema)`
|
|
499
|
+
| Type | Why | Alternative |
|
|
500
|
+
| ------------------------------------ | ------------------------------------------------------------- | --------------------------------------------- |
|
|
501
|
+
| `transform` / `refine` with captures | Callback captures outer variables (or is async / takes `ctx`) | Use zero-capture callbacks or built-in checks |
|
|
502
|
+
| `superRefine` | Callback needs `ctx` for issue collection | Use `refine` or built-in checks |
|
|
503
|
+
| `custom` | Arbitrary validation logic | — |
|
|
504
|
+
| `preprocess` | Input preprocessing function | Use `z.coerce` when possible |
|
|
505
|
+
| `lazy` (non-recursive) | Cannot resolve inner type | Use self-referencing lazy for recursion |
|
|
506
|
+
| `.catchall(schema)` | Unknown keys validated against a value schema | `strictObject` and `looseObject` both compile |
|
|
416
507
|
|
|
417
508
|
**Zero-capture effects compile:** a `transform`/`refine` callback that takes a
|
|
418
509
|
single argument and references only its own parameters, locals, and safe
|
|
@@ -429,38 +520,42 @@ compiles; `z.string().transform((s) => s + suffix)` falls back (it captures
|
|
|
429
520
|
|
|
430
521
|
5-way comparison: **Zod v3** vs **Zod v4** vs **zod-compiler** vs **[Typia](https://typia.io/)** vs **[AJV](https://ajv.js.org/)**
|
|
431
522
|
|
|
432
|
-
| Scenario
|
|
433
|
-
|
|
|
434
|
-
| simple string
|
|
435
|
-
| string (min/max)
|
|
436
|
-
| number (int+positive)
|
|
437
|
-
| enum
|
|
438
|
-
| bigint (min/max)
|
|
439
|
-
| tuple [string, int, bool]
|
|
440
|
-
| record\<string, number\>
|
|
441
|
-
| set\<string\> (5 items)
|
|
442
|
-
| set\<string\> (20 items)
|
|
443
|
-
| map\<string, number\> (5 entries)
|
|
444
|
-
| map\<string, number\> (20 entries)
|
|
445
|
-
| pipe (non-transform)
|
|
446
|
-
| discriminatedUnion (3 variants)
|
|
447
|
-
|
|
|
448
|
-
| medium object (
|
|
449
|
-
|
|
|
450
|
-
| large object (
|
|
451
|
-
|
|
|
452
|
-
| recursive tree (
|
|
453
|
-
|
|
|
454
|
-
|
|
|
455
|
-
|
|
|
456
|
-
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
523
|
+
| Scenario | Zod v3 | Zod v4 | **zod-compiler** | Typia | AJV | vs Zod v4 |
|
|
524
|
+
| ------------------------------------------------- | ------ | ------ | ---------------- | ----- | ----- | --------- |
|
|
525
|
+
| simple string | 12.9M | 14.4M | **16.6M** | 17.0M | 17.5M | 1.2x |
|
|
526
|
+
| string (min/max) | 12.0M | 7.4M | **16.2M** | 17.0M | 14.5M | 2.2x |
|
|
527
|
+
| number (int+positive) | 11.7M | 7.8M | **16.4M** | 16.9M | 17.0M | 2.1x |
|
|
528
|
+
| enum | 11.5M | 11.9M | **15.3M** | 15.1M | 16.0M | 1.3x |
|
|
529
|
+
| bigint (min/max) | 11.7M | 7.7M | **16.1M** | — | — | 2.1x |
|
|
530
|
+
| tuple [string, int, bool] | 5.9M | 5.1M | **16.9M** | 17.8M | 16.6M | 3.3x |
|
|
531
|
+
| record\<string, number\> | 3.2M | 2.8M | **10.8M** | 12.1M | 15.7M | 3.9x |
|
|
532
|
+
| set\<string\> (5 items) | 3.7M | 2.2M | **14.4M** | — | — | 6.7x |
|
|
533
|
+
| set\<string\> (20 items) | 1.1M | 667K | **11.1M** | — | — | **17x** |
|
|
534
|
+
| map\<string, number\> (5 entries) | 1.8M | 1.2M | **10.4M** | — | — | 8.7x |
|
|
535
|
+
| map\<string, number\> (20 entries) | 582K | 315K | **8.1M** | — | — | **26x** |
|
|
536
|
+
| pipe (non-transform) | 8.8M | 5.8M | **16.6M** | — | — | 2.9x |
|
|
537
|
+
| discriminatedUnion (3 variants) | 3.1M | 3.9M | **15.1M** | 14.9M | 7.3M | 3.9x |
|
|
538
|
+
| strict object (DB row) | 1.8M | 3.2M | **7.2M** | — | — | 2.3x |
|
|
539
|
+
| medium object (valid) | 1.9M | 2.4M | **9.7M** | 10.5M | 7.4M | 4.0x |
|
|
540
|
+
| medium object (invalid) | 518K | 76K | **5.6M** | 2.9M | 7.7M | **74x** |
|
|
541
|
+
| large object (10 items) | 117K | 166K | **7.6M** | 5.8M | 1.0M | **46x** |
|
|
542
|
+
| large object (100 items) | 13K | 18K | **1.3M** | 1.2M | 110K | **72x** |
|
|
543
|
+
| recursive tree (7 nodes) | 572K | 2.1M | **12.9M** | 12.1M | 4.7M | 6.2x |
|
|
544
|
+
| recursive tree (121 nodes) | 31K | 140K | **1.9M** | 1.9M | 353K | **14x** |
|
|
545
|
+
| event log (combined) | 364K | 536K | **5.9M** | — | — | **11x** |
|
|
546
|
+
| object with transform (zero-capture) | 1.0M | 1.8M | **5.7M** | — | — | 3.2x |
|
|
547
|
+
| array 10 × transform (zero-capture) | 104K | 188K | **2.9M** | — | — | **15x** |
|
|
548
|
+
| array 50 × transform (zero-capture) | 24K | 43K | **737K** | — | — | **17x** |
|
|
549
|
+
| object with captured transform (partial fallback) | 1.4M | 6.1M | **6.5M** | — | — | 1.1x |
|
|
550
|
+
|
|
551
|
+
_ops/s, higher is better. "—" = not supported by the library. Measured with `vitest bench` on Apple M-series (zod 4.3.6, zod v3 3.23.8, typia 12, ajv 8)._
|
|
552
|
+
|
|
553
|
+
Performance scales with schema complexity. Nested objects and arrays see the biggest gains because zod-compiler eliminates per-node traversal overhead. `discriminatedUnion` uses O(1) `switch` dispatch instead of Zod's sequential trial. The invalid-input row is large because failed `safeParse` defers error materialization until `.error` is read. Zero-capture `transform`/`refine` callbacks are compiled (3-17x); schemas with captured callbacks fall back per-field and roughly match Zod.
|
|
554
|
+
|
|
555
|
+
`parse()` (throwing API) rides a zero-allocation fast path: medium object 2.2M → 9.1M ops/s (4.2x), large object (100 items) 18K → 1.4M ops/s (76x).
|
|
461
556
|
|
|
462
557
|
```bash
|
|
463
|
-
pnpm
|
|
558
|
+
pnpm benchmark # run locally
|
|
464
559
|
```
|
|
465
560
|
|
|
466
561
|
### Performance Architecture
|
|
@@ -474,6 +569,15 @@ Additional optimizations: check ordering (cheap checks first), pre-compiled rege
|
|
|
474
569
|
|
|
475
570
|
Run `npx zod-compiler check --json` to see which schemas qualify for Fast Path.
|
|
476
571
|
|
|
572
|
+
## Development
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
pnpm install
|
|
576
|
+
pnpm test
|
|
577
|
+
pnpm benchmark
|
|
578
|
+
pnpm lint
|
|
579
|
+
```
|
|
580
|
+
|
|
477
581
|
## Acknowledgements
|
|
478
582
|
|
|
479
|
-
zod-compiler started as a fork of [zod-aot](https://github.com/wakita181009/zod-aot) by [@wakita181009](https://github.com/wakita181009).
|
|
583
|
+
zod-compiler started as a fork of [zod-aot](https://github.com/wakita181009/zod-aot) by [@wakita181009](https://github.com/wakita181009).
|
|
@@ -48,9 +48,9 @@ function buildJsonReport(filePath, results) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
export async function runCheck(options) {
|
|
51
|
-
//
|
|
51
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
52
52
|
const out = console.log;
|
|
53
|
-
//
|
|
53
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
54
54
|
const err = console.error;
|
|
55
55
|
const colorEnabled = !options.noColor && process.stdout.isTTY === true;
|
|
56
56
|
const c = createColors(colorEnabled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/cli/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpD,+EAA+E;AAE/E,SAAS,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O,CAAC,IAAI,EAAE,CAAC;QACjB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACpC,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,YAAY,WAAW,wBAAwB,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;YAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;SAAM,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,23 +6,25 @@ import { logger } from "./logger.js";
|
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
7
|
const VERSION = require("../../package.json").version;
|
|
8
8
|
function printUsage() {
|
|
9
|
-
//
|
|
9
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
10
10
|
console.log(`
|
|
11
11
|
zod-compiler v${VERSION} — Compile Zod schemas into zero-overhead validation functions
|
|
12
12
|
|
|
13
13
|
Usage:
|
|
14
|
-
zod-compiler generate <files...> [-o <output>] [-w] [--
|
|
15
|
-
zod-compiler check <files...> [--json] [--fail-under <pct>] [--no-color] [--
|
|
14
|
+
zod-compiler generate <files...> [-o <output>] [-w] [--schemas <mode>]
|
|
15
|
+
zod-compiler check <files...> [--json] [--fail-under <pct>] [--no-color] [--schemas <mode>]
|
|
16
16
|
|
|
17
17
|
Commands:
|
|
18
|
-
generate Generate optimized validation code from
|
|
18
|
+
generate Generate optimized validation code from discovered schemas
|
|
19
19
|
check Check schemas with tree view, coverage, Fast Path status, and hints
|
|
20
20
|
|
|
21
21
|
Options:
|
|
22
22
|
-o, --output <path> Output file or directory
|
|
23
23
|
-w, --watch Watch for changes and regenerate
|
|
24
|
-
--
|
|
25
|
-
|
|
24
|
+
--schemas <explicit|auto> How schemas are found: "auto" (default) compiles every
|
|
25
|
+
exported Zod schema; "explicit" only compile()-wrapped ones
|
|
26
|
+
--emit <schema|bag> Compiled export shape: "schema" (default, full Zod API) or
|
|
27
|
+
"bag" (minimal methods-only object, smaller output)
|
|
26
28
|
--json Output diagnosis as JSON (check only)
|
|
27
29
|
--fail-under <pct> Exit with code 1 if any schema's coverage < pct (check only)
|
|
28
30
|
--no-color Disable colored output (check only)
|
|
@@ -33,12 +35,27 @@ Examples:
|
|
|
33
35
|
zod-compiler generate src/schemas.ts
|
|
34
36
|
zod-compiler generate src/schemas.ts -o src/schemas.compiled.ts
|
|
35
37
|
zod-compiler generate src/ --watch
|
|
36
|
-
zod-compiler generate src/
|
|
38
|
+
zod-compiler generate src/schemas.ts --schemas explicit
|
|
37
39
|
zod-compiler check src/schemas.ts
|
|
38
|
-
zod-compiler check src/env.ts --auto-discover
|
|
39
40
|
zod-compiler check src/schemas.ts --json --fail-under 80
|
|
40
41
|
`.trim());
|
|
41
42
|
}
|
|
43
|
+
/** Parse a `--schemas <explicit|auto>` value; exits on invalid input. */
|
|
44
|
+
function parseSchemasValue(val) {
|
|
45
|
+
if (val !== "explicit" && val !== "auto") {
|
|
46
|
+
logger.error('--schemas must be "explicit" or "auto"');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
return val === "auto";
|
|
50
|
+
}
|
|
51
|
+
/** Parse an `--emit <schema|bag>` value; exits on invalid input. */
|
|
52
|
+
function parseEmitValue(val) {
|
|
53
|
+
if (val !== "schema" && val !== "bag") {
|
|
54
|
+
logger.error('--emit must be "schema" or "bag"');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
return val === "schema";
|
|
58
|
+
}
|
|
42
59
|
function parseArgs(argv) {
|
|
43
60
|
const args = argv.slice(2);
|
|
44
61
|
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
@@ -54,7 +71,8 @@ function parseArgs(argv) {
|
|
|
54
71
|
let output;
|
|
55
72
|
let watch = false;
|
|
56
73
|
let zodCompat;
|
|
57
|
-
|
|
74
|
+
// Default "auto": every exported Zod schema compiles, matching the plugin.
|
|
75
|
+
let autoDiscover = true;
|
|
58
76
|
for (let i = 0; i < rest.length; i++) {
|
|
59
77
|
const arg = rest[i];
|
|
60
78
|
if (arg === "-o" || arg === "--output") {
|
|
@@ -69,10 +87,20 @@ function parseArgs(argv) {
|
|
|
69
87
|
else if (arg === "-w" || arg === "--watch") {
|
|
70
88
|
watch = true;
|
|
71
89
|
}
|
|
90
|
+
else if (arg === "--schemas") {
|
|
91
|
+
i++;
|
|
92
|
+
autoDiscover = parseSchemasValue(rest[i]);
|
|
93
|
+
}
|
|
94
|
+
else if (arg === "--emit") {
|
|
95
|
+
i++;
|
|
96
|
+
zodCompat = parseEmitValue(rest[i]);
|
|
97
|
+
}
|
|
72
98
|
else if (arg === "--no-zod-compat") {
|
|
99
|
+
logger.warn("--no-zod-compat is deprecated — use --emit bag");
|
|
73
100
|
zodCompat = false;
|
|
74
101
|
}
|
|
75
102
|
else if (arg === "--auto-discover") {
|
|
103
|
+
logger.warn("--auto-discover is deprecated — auto is now the default (--schemas auto)");
|
|
76
104
|
autoDiscover = true;
|
|
77
105
|
}
|
|
78
106
|
else if (arg.startsWith("-")) {
|
|
@@ -103,12 +131,17 @@ function parseArgs(argv) {
|
|
|
103
131
|
let json = false;
|
|
104
132
|
let failUnder;
|
|
105
133
|
let noColor = false;
|
|
106
|
-
|
|
134
|
+
// Default "auto", matching generate and the plugin.
|
|
135
|
+
let autoDiscover = true;
|
|
107
136
|
for (let i = 0; i < rest.length; i++) {
|
|
108
137
|
const arg = rest[i];
|
|
109
138
|
if (arg === "--json") {
|
|
110
139
|
json = true;
|
|
111
140
|
}
|
|
141
|
+
else if (arg === "--schemas") {
|
|
142
|
+
i++;
|
|
143
|
+
autoDiscover = parseSchemasValue(rest[i]);
|
|
144
|
+
}
|
|
112
145
|
else if (arg === "--fail-under") {
|
|
113
146
|
i++;
|
|
114
147
|
const val = rest[i];
|
|
@@ -127,6 +160,7 @@ function parseArgs(argv) {
|
|
|
127
160
|
noColor = true;
|
|
128
161
|
}
|
|
129
162
|
else if (arg === "--auto-discover") {
|
|
163
|
+
logger.warn("--auto-discover is deprecated — auto is now the default (--schemas auto)");
|
|
130
164
|
autoDiscover = true;
|
|
131
165
|
}
|
|
132
166
|
else if (arg.startsWith("-")) {
|
|
@@ -153,7 +187,7 @@ async function main() {
|
|
|
153
187
|
printUsage();
|
|
154
188
|
break;
|
|
155
189
|
case "version":
|
|
156
|
-
//
|
|
190
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
157
191
|
console.log(VERSION);
|
|
158
192
|
break;
|
|
159
193
|
case "generate": {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAY,OAAO,CAAC,oBAAoB,CAAyB,CAAC,OAAO,CAAC;AAUvF,SAAS,UAAU;IACjB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names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AQ,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;gBACzD,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;gBAC/D,MAAM,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrC,CAAC;YACD,MAAM;QACR,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;YACzD,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAChC,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACjC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/cli/logger.js
CHANGED
|
@@ -22,9 +22,9 @@ export function createColors(enabled) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
const colors = createColors(process.stdout.isTTY === true);
|
|
25
|
-
//
|
|
25
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
26
26
|
const log = console.log;
|
|
27
|
-
//
|
|
27
|
+
// oxlint-disable-next-line no-console -- CLI output
|
|
28
28
|
const logError = console.error;
|
|
29
29
|
export const logger = {
|
|
30
30
|
info(msg) {
|
package/dist/cli/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/cli/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAYnC,MAAM,SAAS,GAAW;IACxB,KA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