chore(zod-validator): upgrade zod to v4 and update import style in README.md (#1302)

* chore(zod-validator): upgrade zod to v4

* docs(zod-validator): update Zod import style to be more tree-shakeable in README.md

* chore(zod-validator): commit .changeset

* fix(zod-validator): correctly set the zod version to follow the official website doc

* chore(zod-validator): change `.changeset` to patch cause it does not include a new feature
pull/1305/head
kiki-kanri 2025-07-13 18:57:55 +08:00 committed by GitHub
parent 55e4b19a50
commit 9f6278f51c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 10 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/zod-validator': patch
---
correctly set the zod version to follow the official website doc

View File

@ -0,0 +1,5 @@
---
'@hono/zod-validator': patch
---
upgrade zod to v4 and import style to be more tree-shakeable in README.md

View File

@ -7,7 +7,7 @@ The validator middleware using [Zod](https://zod.dev) for [Hono](https://honojs.
## Usage ## Usage
```ts ```ts
import { z } from 'zod' import * as z from 'zod'
import { zValidator } from '@hono/zod-validator' import { zValidator } from '@hono/zod-validator'
const schema = z.object({ const schema = z.object({

View File

@ -42,7 +42,7 @@
"homepage": "https://github.com/honojs/middleware", "homepage": "https://github.com/honojs/middleware",
"peerDependencies": { "peerDependencies": {
"hono": ">=3.9.0", "hono": ">=3.9.0",
"zod": "^3.25.0" "zod": "^3.25.0 || ^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@arethetypeswrong/cli": "^0.17.4", "@arethetypeswrong/cli": "^0.17.4",
@ -51,6 +51,6 @@
"tsup": "^8.4.0", "tsup": "^8.4.0",
"typescript": "^5.8.2", "typescript": "^5.8.2",
"vitest": "^3.2.4", "vitest": "^3.2.4",
"zod": "~3.25.6" "zod": "^4.0.5"
} }
} }

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import type { Context, Env, Input, MiddlewareHandler, TypedResponse, ValidationTargets } from 'hono' import type { Context, Env, Input, MiddlewareHandler, TypedResponse, ValidationTargets } from 'hono'
import { validator } from 'hono/validator' import { validator } from 'hono/validator'
import type * as v3 from 'zod' import type * as v3 from 'zod/v3'
import type { ZodSafeParseResult as v4ZodSafeParseResult } from 'zod/v4' import type { ZodSafeParseResult as v4ZodSafeParseResult } from 'zod/v4'
import type * as v4 from 'zod/v4/core' import type * as v4 from 'zod/v4/core'

View File

@ -2760,10 +2760,10 @@ __metadata:
tsup: "npm:^8.4.0" tsup: "npm:^8.4.0"
typescript: "npm:^5.8.2" typescript: "npm:^5.8.2"
vitest: "npm:^3.2.4" vitest: "npm:^3.2.4"
zod: "npm:~3.25.6" zod: "npm:^4.0.5"
peerDependencies: peerDependencies:
hono: ">=3.9.0" hono: ">=3.9.0"
zod: ^3.25.0 zod: ^3.25.0 || ^4.0.0
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -16865,10 +16865,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"zod@npm:~3.25.6": "zod@npm:^4.0.5":
version: 3.25.36 version: 4.0.5
resolution: "zod@npm:3.25.36" resolution: "zod@npm:4.0.5"
checksum: 10c0/9ad8ca759d1a5d19c86d6e49a1bda817b3c0566ea0a8726d45994b9fcaac8d569db45a65218a7b4067ca18b07c5fc636a587a94cd05f76793174ace8b81742e3 checksum: 10c0/59449d731ca63849b6bcb14300aa6e2f042d440b3ed294b45c248519aec78780f85a5d1939a62c2ce82e9dc60afca77c8005e0a98d7517b0c2586d6c76940424
languageName: node languageName: node
linkType: hard linkType: hard