WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@matthewp
Copy link
Contributor

@matthewp matthewp commented Dec 3, 2025

Changes

  • A lot of use of .prefault() and changing z.object(z.number()) to z.object(z.string(), z.number())

Testing

  • Existing tests pass
  • Most significant changes here are because error messages are a little different in Zod 4.

Docs

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-bot
Copy link

changeset-bot bot commented Dec 3, 2025

🦋 Changeset detected

Latest commit: 787325d

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

@github-actions github-actions bot added pkg: example Related to an example package (scope) pkg: astro Related to the core `astro` package (scope) docs pr labels Dec 3, 2025
@github-actions github-actions bot added pkg: svelte Related to Svelte (scope) pkg: integration Related to any renderer integration (scope) labels Dec 4, 2025
@florian-lefebvre florian-lefebvre added this to the v6.0.0 milestone Dec 5, 2025
@ematipico
Copy link
Member

Is the bot incorrect? #14956 (comment)

Copy link
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

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

Only some small things. Some of my older reviews need to be addressed still

@florian-lefebvre
Copy link
Member

florian-lefebvre commented Dec 9, 2025

So the missing things to address are:

@delucis
Copy link
Member

delucis commented Dec 9, 2025

Is the bot incorrect? #14956 (comment)

I think it’s not working correctly currently: we need e18e/action-dependency-diff#95 which isn’t released yet. I’ve asked if they can release that. If not, I’ll send a PR pinning to that commit hash directly.

Edit: Done in #14994

@matthewp
Copy link
Contributor Author

matthewp commented Dec 9, 2025

@florian-lefebvre everything has been done as far as i'm aware of except for #14956 (comment) (about the reference constant)

@florian-lefebvre
Copy link
Member

I'll check it out tomorrow morning

@github-actions github-actions bot removed the pkg: svelte Related to Svelte (scope) label Dec 10, 2025
Copy link
Member

@florian-lefebvre florian-lefebvre left a 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

@github-actions github-actions bot added the pkg: svelte Related to Svelte (scope) label Dec 10, 2025
@matthewp
Copy link
Contributor Author

@florian-lefebvre I still don't understand why 82f1de6 is necessary. can you explain?

@florian-lefebvre
Copy link
Member

In my zod 3/4 PR I would replace '@@REFERENCE@@' dynamically based on the zod version, for example to export const reference: import('astro/content/config').Z4Reference.

Now that we only support v4, this codegen logic has been removed so this flag was never replaced. Instead I "inlined" Z4Reference. This diff shows it's just about updating it from zod 3 to zod 4 types:

image

@matthewp
Copy link
Contributor Author

@florian-lefebvre why are types not coming from the implementation of reference?

@florian-lefebvre
Copy link
Member

florian-lefebvre commented Dec 10, 2025

Because in this case, reference() types rely on codegen stuff. Specifically the DataEntryMap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) pkg: svelte Related to Svelte (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Zod 4

5 participants