-
Notifications
You must be signed in to change notification settings - Fork 3
refactor(deps): move zod to peerDependencies with v4-mini #278
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
Conversation
commit: |
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.
No issues found across 9 files
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.
Pull request overview
This PR attempts to refactor Zod dependency management by moving it from dependencies to peerDependencies and updating all imports to use a zod/v4 subpath. However, the implementation contains a critical issue: the zod/v4 import path does not exist in Zod's package exports.
Key changes attempted:
- Move zod from
dependenciestopeerDependencieswith version range>=3.25.0 <5 - Add zod to
devDependencies(^4.1.13) for development - Replace all zod imports with
zod/v4subpath (fromzod/miniandzod)
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/schema.ts | Updates import from zod/mini to invalid zod/v4 subpath |
| src/headers.ts | Updates import from zod/mini to invalid zod/v4 subpath |
| src/feedback.ts | Updates import from zod to invalid zod/v4 subpath |
| pnpm-workspace.yaml | Moves zod from prod catalog to dev catalog, adds peer catalog entry |
| pnpm-lock.yaml | Updates lock file to reflect catalog changes |
| package.json | Moves zod from dependencies to peerDependencies and devDependencies |
| examples/tanstack-ai-integration.ts | Updates import to invalid zod/v4 subpath |
| examples/claude-agent-sdk-integration.ts | Updates import to invalid zod/v4 subpath |
| examples/claude-agent-sdk-integration.test.ts | Updates import to invalid zod/v4 subpath |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import { tool, createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk'; | ||
| import { z } from 'zod'; | ||
| import { z } from 'zod/v4'; |
Copilot
AI
Jan 5, 2026
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.
The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.
The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.
| import { z } from 'zod/v4'; | |
| import { z } from 'zod'; |
src/schema.ts
Outdated
| @@ -1,4 +1,4 @@ | |||
| import { z } from 'zod/mini'; | |||
| import { z } from 'zod/v4'; | |||
Copilot
AI
Jan 5, 2026
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.
The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.
The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.
| import { z } from 'zod/v4'; | |
| import { z } from 'zod'; |
src/headers.ts
Outdated
| @@ -1,4 +1,4 @@ | |||
| import { z } from 'zod/mini'; | |||
| import { z } from 'zod/v4'; | |||
Copilot
AI
Jan 5, 2026
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.
The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.
The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.
| import { z } from 'zod/v4'; | |
| import { z } from 'zod'; |
examples/tanstack-ai-integration.ts
Outdated
| import { chat } from '@tanstack/ai'; | ||
| import { openai } from '@tanstack/ai-openai'; | ||
| import { z } from 'zod'; | ||
| import { z } from 'zod/v4'; |
Copilot
AI
Jan 5, 2026
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.
The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.
The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.
| import { z } from 'zod/v4'; | |
| import { z } from 'zod'; |
| import process from 'node:process'; | ||
| import { query, tool, createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk'; | ||
| import { z } from 'zod'; | ||
| import { z } from 'zod/v4'; |
Copilot
AI
Jan 5, 2026
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.
The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.
The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.
| import { z } from 'zod/v4'; | |
| import { z } from 'zod'; |
0560439 to
e2e883f
Compare
- Move zod from dependencies to peerDependencies (>=3.25.0 <5) - Use zod/v4-mini subpath for smaller bundle size in schema/headers - Use zod/v4 subpath in feedback.ts (requires .transform/.refine) - Add zod to devDependencies and examples for development/testing This allows users to bring their own zod version (3.25+ or 4.x) while ensuring compatibility with AI SDK's zod peer dependency. The v4-mini variant reduces bundle size for simple schemas.
e2e883f to
11108bc
Compare
Summary
>=3.25.0 <5)zod/v4-minisubpath for smaller bundle size in schema/headerszod/v4subpath in feedback.ts (requires.transform/.refine)Why
This allows users to bring their own zod version (3.25+ or 4.x) while ensuring compatibility with AI SDK's zod peer dependency. The
zod/v4-minivariant reduces bundle size for simple schemas.Test plan