Skip to content

refactor(zod/v4): use .superRefine() for externals #10609

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

colinaaa
Copy link
Collaborator

@colinaaa colinaaa commented Jun 9, 2025

Summary

Replace ZodRspackCrossChecker with .superRefine() (renamed to .check() in Zod v4) for umd external object (introduced in #8369).

The ZodRspackCrossChecker relies on internal methods of ZodType, such as _getOrReturnCtx and _getRootData, which are no longer exists in Zod v4.

I couldn't find a way to get the parent schema in Zod v4, so I decided to directly make the check from root with .superRefine().

The similar changes would be made to builtin:swc-loader in the next PR.

issue: #10467

Checklist

  • Tests updated (or not required).

I think we've got enough tests in #8369.

  • Documentation updated (or not required).

Copy link

netlify bot commented Jun 9, 2025

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit b6f141c
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68465dec3d4c250008b08107

Copy link

codspeed-hq bot commented Jun 9, 2025

CodSpeed Performance Report

Merging #10609 will not alter performance

Comparing colinaaa:zod-v4 (b6f141c) with main (26b3e78)

Summary

✅ 12 untouched benchmarks

@colinaaa colinaaa marked this pull request as ready for review June 9, 2025 06:38
@colinaaa colinaaa requested a review from LingyuCoder June 9, 2025 06:39
@h-a-n-a h-a-n-a merged commit dc0c44e into web-infra-dev:main Jun 10, 2025
54 of 56 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