Skip to content

Zod V4 Updates - Zodix React Router - #2

Merged
resquino-truefit merged 2 commits into
masterfrom
rne-tsd-173-zod-v4-support
Jul 22, 2026
Merged

Zod V4 Updates - Zodix React Router#2
resquino-truefit merged 2 commits into
masterfrom
rne-tsd-173-zod-v4-support

Conversation

@resquino-truefit

@resquino-truefit resquino-truefit commented Jul 21, 2026

Copy link
Copy Markdown

Add zod v4 support via dual entry points

Summary

Adds a second entry point (@zreott-tf/zodix-react-router/v4) so consumers can use this package with zod v4 schemas, while keeping the existing default entry point (@zreott-tf/zodix-react-router) working for zod v3 schemas — no breaking change to the existing API surface, just a new import path.

What changed

  • src/v4/ (new): mirrors parsers.ts and schemas.ts, importing from the zod/v4 compat subpath instead of zod/v3. Re-exports the same zx API (parseParams, parseParamsSafe, parseQuery, parseQuerySafe, parseForm, parseFormSafe, BoolAsString, CheckboxAsString, IntAsString, NumAsString).
  • src/parsers.ts, src/schemas.ts: switched from import { z } from 'zod' to import { z } from 'zod/v3', pinning the default entry point to zod's v3-compat subpath explicitly.
  • build.js: added a second esbuild.buildSync pass bundling src/v4/index.tsdist/v4/index.js, with zod/zod/v4 kept external.
  • package.json:
    • Added an exports map with . and ./v4 conditions (each with their own types/default).
    • Bumped the zod devDependency to ^4.4.3 and widened the zod peerDependency to ^3.0.0 || ^4.0.0.
    • Version bump 0.1.00.2.0.
  • tsconfig.json: moduleResolution changed from node to bundler (plus module: esnext) — required so TypeScript respects the exports/types conditions on the zod/v3 and zod/v4 subpaths; the old node resolution mode ignores them.
  • Tests: existing parsers.test.ts/schemas.test.ts updated for the zod/v3 import; new src/v4/parsers.test.ts/src/v4/schemas.test.ts added, exercising the same suite against zod/v4.

Note

  • A follow-up PR to make use of the updated Zodix React Router within the Truefit Stack is ready as soon as this PR merges

Comment thread package.json Outdated
{
"name": "@zreott-tf/zodix-react-router",
"version": "0.1.0",
"version": "0.2.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can save the version bump until we release this. The np tool in the release script had me update it as part of the workflow.

@resquino-truefit
resquino-truefit merged commit 5617eca into master Jul 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants