-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Upgrade to Zod 4 #14956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Zod 4 #14956
Conversation
Consolidate Zod v3 to v4 upgrade with comprehensive changes: - Remove dual Zod version support, standardize on v4 - Simplify type systems and remove experimental.zod4 flag - Update dependencies: js-yaml, magic-string, magicast to latest versions - Replace kleur with piccolore for CLI colors - Refactor content layer, actions, and config to use unified Zod handling - Simplify JSON schema generation and type generation - Remove z3/z4 branching logic throughout codebase - Update error handling to work with unified Zod implementation BREAKING CHANGE: Zod v3 support removed, project now requires Zod v4+
- Remove all z3 imports and replace with z4/zod - Remove z3-specific functions (formDataToZ3Object, handleZ3FormDataGetAll/Get, unwrapBaseZ3ObjectSchema, createZ3Image) - Remove dual-version type unions, simplify to z4-only types - Remove z3ErrorMap function, keep only z4ErrorMap - Remove checkZodSchemaCompatibility calls (no longer needed) - Simplify vite-plugin-experimental-zod4/utils.ts to no-op - Update package.json to require zod ^4.0.0 - Update test files and exports to reference z4 versions
🦋 Changeset detectedLatest commit: 93acc31 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I'll check it out tomorrow morning |
florian-lefebvre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM! The changeset will probably need to be updated after the linked docs PR is approved
|
@florian-lefebvre I still don't understand why 82f1de6 is necessary. can you explain? |
|
@florian-lefebvre why are types not coming from the implementation of reference? |
|
Because in this case, |
|
Let me know if you want me to handle the fonts breaking change, I made these changes very recently so I can probably untangle it quickly |
|
@florian-lefebvre yes, I would appreciate it if you could do that. Thank you! |
Co-authored-by: Sarah Rainsberger <[email protected]>
sarah11918
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for docs, and the docs PR is also good to go! Nice job, Matthew! 🎉
* feat: upgrade to Zod v4 Consolidate Zod v3 to v4 upgrade with comprehensive changes: - Remove dual Zod version support, standardize on v4 - Simplify type systems and remove experimental.zod4 flag - Update dependencies: js-yaml, magic-string, magicast to latest versions - Replace kleur with piccolore for CLI colors - Refactor content layer, actions, and config to use unified Zod handling - Simplify JSON schema generation and type generation - Remove z3/z4 branching logic throughout codebase - Update error handling to work with unified Zod implementation BREAKING CHANGE: Zod v3 support removed, project now requires Zod v4+ * Remove Zod v3 support, keep only v4 - Remove all z3 imports and replace with z4/zod - Remove z3-specific functions (formDataToZ3Object, handleZ3FormDataGetAll/Get, unwrapBaseZ3ObjectSchema, createZ3Image) - Remove dual-version type unions, simplify to z4-only types - Remove z3ErrorMap function, keep only z4ErrorMap - Remove checkZodSchemaCompatibility calls (no longer needed) - Simplify vite-plugin-experimental-zod4/utils.ts to no-op - Update package.json to require zod ^4.0.0 - Update test files and exports to reference z4 versions * Finish upgrade * skip these tests for now * skip this one too * correct mark the received item * fix config-validate tests * merge: resolve conflicts between zod4-m and next * fix remaining build error * remove references to zod4 thing * fixes * prevent the crash * switch to the native zod to json schema * oops * fix content layer tests * fix error map tests * fix actions test * fix intellisense tsts * fix schema test * fix: types * Update Svelte to exactly 5.43.8 in package and fixtures * fix svelte tests * fix more e2e * fix cloudflare tests * fix defineMiddleware issue * remove unused reference * fix examples types * pr comment stuff * changeset * remove experiemental flag * add some debugging here * remove debugging stuff * Update packages/astro/src/actions/vite-plugin-actions.ts Co-authored-by: Florian Lefebvre <[email protected]> * fix * fix: import * use zod/v4 imports in core * remove createDefineAction * remove unnecessary type alias * remove unused z4reference * rename stuff * unskip tests * rename back to createImage * nit * revert markdown change * put errorMap name back * address feedback on rss * fix: exports * Update packages/astro-rss/src/index.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro-rss/src/schema.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro-rss/src/util.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/assets/fonts/config.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/assets/fonts/types.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/content/loaders/types.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/content/config.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/core/config/schemas/relative.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/test/units/config/config-validate.test.js Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/test/units/actions/form-data-to-object.test.js Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/core/config/schemas/refined.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/content/content-layer.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/content/types-generator.ts Co-authored-by: Florian Lefebvre <[email protected]> * Update packages/astro/src/content/utils.ts Co-authored-by: Florian Lefebvre <[email protected]> * Use $ZodError * Update packages/astro/src/core/csp/config.ts Co-authored-by: Florian Lefebvre <[email protected]> * fix the build * fix e2e test * replace z4 with z * increase vercel test timeout * pr comments * export ImageFunction * use prefault * Validate experimental features special * bring back old locales * fix test * db needs to be a patch too * fix chainability of image * update zod imports * Discard changes to packages/integrations/svelte/package.json * Discard changes to packages/integrations/svelte/test/fixtures/async-rendering/package.json * refresh lockfile * chore: changeset * fix: reference() * skip broken svelte test * Update .changeset/dance-ornate-keen.md Co-authored-by: Sarah Rainsberger <[email protected]> * fix config vlaidate test --------- Co-authored-by: Florian Lefebvre <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]>

Changes
.prefault()and changingz.object(z.number())toz.object(z.string(), z.number())Testing
Docs