Skip to content

feat: graceful multiple imports exit + transform and refine#1273

Merged
fabian-hiller merged 4 commits intoopen-circle:mainfrom
paoloricciuti:other-codemod-fixes
Sep 6, 2025
Merged

feat: graceful multiple imports exit + transform and refine#1273
fabian-hiller merged 4 commits intoopen-circle:mainfrom
paoloricciuti:other-codemod-fixes

Conversation

@paoloricciuti
Copy link
Contributor

Some other small codemod fixes: this fixes transform, refine and adds a comment to explain why it's not possible to migrate the file when there's multiple zod imports (i also think we could try to be a bit smarter here and still migrate if at least one import is z from zod but that would lead to squiggles in the file unless we also replace all the zod types)

Copilot AI review requested due to automatic review settings August 8, 2025 12:43
@vercel
Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
valibot Ready Ready Preview Comment Sep 6, 2025 0:43am

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for transforming Zod's refine and transform methods to their Valibot equivalents and improves error handling for multiple import scenarios. The changes enhance the codemod to handle more Zod patterns while providing better feedback when transformation fails.

  • Adds transformation support for refine (to Valibot's check) and transform methods
  • Improves error handling by adding descriptive comments when imports cannot be transformed
  • Includes comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
schemas-and-links.ts Registers refine and transform method transformers
transform/transform.ts Implements Zod transform to Valibot transform conversion
refine/refine.ts Implements Zod refine to Valibot check conversion with message extraction
index.ts Adds error comment injection for unsuccessful import transformations
imports.ts Adds cause field to error return types for better error reporting
constants.ts Adds refine and transform to supported Zod methods list
test files Adds test fixtures for new functionality and multiple import scenarios

@paoloricciuti paoloricciuti changed the title feat: graceful multiple imports exit feat: graceful multiple imports exit + transform and refine Aug 8, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 10, 2025

Open in StackBlitz

npm i https://pkg.pr.new/valibot@1273

commit: a2e98bc

@fabian-hiller fabian-hiller merged commit ca72ba9 into open-circle:main Sep 6, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants