feat(trpc-server): bump up Hono version "v3" (#50)

* feat(trpc-server): bump up Hono version "v3"

* add changeset
pull/51/head
Yusuke Wada 2023-02-18 23:37:25 +09:00 committed by GitHub
parent 118c43bd74
commit b9e383fa88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/trpc-server': minor
---
feat: bump up Hono version "v3"

View File

@ -29,14 +29,14 @@
"homepage": "https://honojs.dev", "homepage": "https://honojs.dev",
"peerDependencies": { "peerDependencies": {
"@trpc/server": "^10.10.0", "@trpc/server": "^10.10.0",
"hono": "^2.7.5" "hono": "3.*"
}, },
"devDependencies": { "devDependencies": {
"@trpc/server": "^10.10.0", "@trpc/server": "^10.10.0",
"hono": "^2.7.5", "hono": "^3.0.0",
"zod": "^3.20.2" "zod": "^3.20.2"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"
} }
} }

View File

@ -1,20 +1,17 @@
import type { AnyRouter } from '@trpc/server' import type { AnyRouter } from '@trpc/server'
import type { FetchHandlerRequestOptions} from '@trpc/server/adapters/fetch' import type { FetchHandlerRequestOptions } from '@trpc/server/adapters/fetch'
import { fetchRequestHandler } from '@trpc/server/adapters/fetch' import { fetchRequestHandler } from '@trpc/server/adapters/fetch'
import type { MiddlewareHandler } from 'hono' import type { MiddlewareHandler } from 'hono'
type tRPCOptions = type tRPCOptions = Omit<FetchHandlerRequestOptions<AnyRouter>, 'req' | 'endpoint'> &
Omit< Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, 'endpoint'>>
FetchHandlerRequestOptions<AnyRouter>,
'req' | 'endpoint'
> & Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, 'endpoint'>>
export const trpcServer = ({ endpoint = '/trpc', ...rest }: tRPCOptions): MiddlewareHandler => { export const trpcServer = ({ endpoint = '/trpc', ...rest }: tRPCOptions): MiddlewareHandler => {
return async (c) => { return async (c) => {
const res = fetchRequestHandler({ const res = fetchRequestHandler({
...rest, ...rest,
endpoint, endpoint,
req: c.req, req: c.req.raw,
}) })
return res return res
} }

View File

@ -5212,7 +5212,7 @@ hono@3.0.0-rc.4:
resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.0-rc.4.tgz#7bfe8c89d4b004ff90d587c8ba45279a175fbce7" resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.0-rc.4.tgz#7bfe8c89d4b004ff90d587c8ba45279a175fbce7"
integrity sha512-76R3mb8kPeuD9TOmQ1WZi59w4QbpaUOlyX3wC7zQpt7IM7iFVBTxj2fpv++6ROPtd5iUBMCrmH/65ZrNXYYgmg== integrity sha512-76R3mb8kPeuD9TOmQ1WZi59w4QbpaUOlyX3wC7zQpt7IM7iFVBTxj2fpv++6ROPtd5iUBMCrmH/65ZrNXYYgmg==
hono@^2.6.1, hono@^2.7.5: hono@^2.6.1:
version "2.7.5" version "2.7.5"
resolved "https://registry.yarnpkg.com/hono/-/hono-2.7.5.tgz#2b0c39d39a057575962a7025373be4304dedca9c" resolved "https://registry.yarnpkg.com/hono/-/hono-2.7.5.tgz#2b0c39d39a057575962a7025373be4304dedca9c"
integrity sha512-UYrhUT1Xtalh7Xw/YGXee25wlWMiVIRfr0FbAJMEMyRpX9TFZ/6JKmVdCK7ioRnhAw7PfWBasjSBhdNXQ8/okQ== integrity sha512-UYrhUT1Xtalh7Xw/YGXee25wlWMiVIRfr0FbAJMEMyRpX9TFZ/6JKmVdCK7ioRnhAw7PfWBasjSBhdNXQ8/okQ==