Skip to content

Commit e2e883f

Browse files
committed
refactor(deps): move zod to peerDependencies with v4-mini
- 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.
1 parent d32fe37 commit e2e883f

File tree

7 files changed

+21
-15
lines changed

7 files changed

+21
-15
lines changed

examples/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"@tanstack/ai": "catalog:examples",
1313
"@tanstack/ai-openai": "catalog:examples",
1414
"ai": "catalog:peer",
15-
"openai": "catalog:peer"
15+
"openai": "catalog:peer",
16+
"zod": "catalog:dev"
1617
},
1718
"devDependencies": {
1819
"@types/node": "catalog:dev",

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
"dependencies": {
5454
"@modelcontextprotocol/sdk": "catalog:prod",
5555
"@orama/orama": "catalog:prod",
56-
"defu": "catalog:prod",
57-
"zod": "catalog:prod"
56+
"defu": "catalog:prod"
5857
},
5958
"devDependencies": {
6059
"@ai-sdk/provider": "catalog:dev",
@@ -78,12 +77,14 @@
7877
"type-fest": "catalog:dev",
7978
"typescript": "catalog:dev",
8079
"unplugin-unused": "catalog:dev",
81-
"vitest": "catalog:dev"
80+
"vitest": "catalog:dev",
81+
"zod": "catalog:dev"
8282
},
8383
"peerDependencies": {
8484
"@anthropic-ai/sdk": "catalog:peer",
8585
"ai": "catalog:peer",
86-
"openai": "catalog:peer"
86+
"openai": "catalog:peer",
87+
"zod": "catalog:peer"
8788
},
8889
"peerDependenciesMeta": {
8990
"@anthropic-ai/sdk": {

pnpm-lock.yaml

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ catalogs:
2828
typescript: ^5.8.3
2929
unplugin-unused: ^0.5.4
3030
vitest: ^4.0.15
31+
zod: ^4.1.13
3132
examples:
3233
'@anthropic-ai/claude-agent-sdk': ^0.1.67
3334
'@tanstack/ai': ^0.0.3
@@ -36,11 +37,11 @@ catalogs:
3637
'@anthropic-ai/sdk': ^0.52.0
3738
ai: ^5.0.108
3839
openai: ^6.2.0
40+
zod: '>=3.25.0 <5'
3941
prod:
4042
'@modelcontextprotocol/sdk': ^1.24.3
4143
'@orama/orama': ^3.1.11
4244
defu: ^6.1.4
43-
zod: ^4.1.13
4445

4546
enablePrePostScripts: true
4647

src/feedback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from 'zod';
1+
import { z } from 'zod/v4';
22
import { DEFAULT_BASE_URL } from './consts';
33
import { BaseTool } from './tool';
44
import type { ExecuteConfig, ExecuteOptions, JsonObject, JsonValue, ToolParameters } from './types';

src/headers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from 'zod/mini';
1+
import { z } from 'zod/v4-mini';
22
import type { JsonObject } from './types';
33

44
/**

src/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from 'zod/mini';
1+
import { z } from 'zod/v4-mini';
22
import { stackOneHeadersSchema } from './headers';
33

44
/**

0 commit comments

Comments
 (0)