From 7a6f00f4735e8d188bfc6972c4cf3d36bcb2c312 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Sun, 28 Dec 2025 12:36:56 +1100 Subject: [PATCH 1/6] chore: upgrade hono to 4.11.3 --- package.json | 2 +- packages/ajv-validator/package.json | 2 +- packages/ajv-validator/src/index.ts | 2 +- packages/arktype-validator/package.json | 2 +- packages/auth-js/package.json | 2 +- packages/bun-compress/package.json | 2 +- packages/bun-transpiler/package.json | 2 +- packages/capnweb/package.json | 2 +- packages/casbin/package.json | 2 +- packages/class-validator/package.json | 2 +- packages/clerk-auth/package.json | 2 +- packages/cloudflare-access/package.json | 2 +- packages/conform-validator/package.json | 2 +- packages/effect-validator/package.json | 2 +- packages/esbuild-transpiler/package.json | 2 +- packages/event-emitter/package.json | 2 +- packages/firebase-auth/package.json | 2 +- packages/graphql-server/package.json | 2 +- packages/hello/package.json | 2 +- packages/mcp/package.json | 2 +- packages/medley-router/package.json | 2 +- packages/node-ws/package.json | 2 +- packages/oauth-providers/package.json | 2 +- packages/oidc-auth/package.json | 2 +- packages/otel/package.json | 2 +- packages/prometheus/package.json | 2 +- packages/qwik-city/package.json | 2 +- packages/react-compat/package.json | 2 +- packages/react-renderer/package.json | 2 +- packages/sentry/package.json | 2 +- packages/session/package.json | 2 +- packages/standard-validator/package.json | 2 +- packages/stytch-auth/package.json | 2 +- packages/swagger-editor/package.json | 2 +- packages/swagger-ui/package.json | 2 +- packages/trpc-server/package.json | 2 +- packages/tsyringe/package.json | 2 +- packages/typebox-validator/package.json | 2 +- packages/typedriver-validator/package.json | 2 +- packages/typia-validator/package.json | 2 +- packages/ua-blocker/package.json | 2 +- packages/valibot-validator/package.json | 2 +- packages/zod-openapi/package.json | 2 +- packages/zod-validator/package.json | 2 +- yarn.lock | 94 +++++++++++----------- 45 files changed, 91 insertions(+), 91 deletions(-) diff --git a/package.json b/package.json index 874599509..4305a103c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@types/ws": "^8.18.0", "@vitest/coverage-istanbul": "^4.0.16", "eslint": "^9.34.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "pkg-pr-new": "^0.0.54", "prettier": "^3.6.2", "publint": "^0.3.16", diff --git a/packages/ajv-validator/package.json b/packages/ajv-validator/package.json index e1002900c..69deed7fa 100644 --- a/packages/ajv-validator/package.json +++ b/packages/ajv-validator/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "ajv": "^8.12.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/ajv-validator/src/index.ts b/packages/ajv-validator/src/index.ts index f43844948..7b4fdaf9d 100644 --- a/packages/ajv-validator/src/index.ts +++ b/packages/ajv-validator/src/index.ts @@ -82,7 +82,7 @@ export function ajvValidator< > { const ajv = new Ajv() const validate = ajv.compile(schema) - + // @ts-expect-error not typed well return validator(target, (data, c) => { const valid = validate(data) if (valid) { diff --git a/packages/arktype-validator/package.json b/packages/arktype-validator/package.json index 2b1ed33fe..50fcca84c 100644 --- a/packages/arktype-validator/package.json +++ b/packages/arktype-validator/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "arktype": "^2.1.20", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/auth-js/package.json b/packages/auth-js/package.json index 9daf2865c..3714578b5 100644 --- a/packages/auth-js/package.json +++ b/packages/auth-js/package.json @@ -64,7 +64,7 @@ "devDependencies": { "@auth/core": "^0.35.3", "@types/react": "^19", - "hono": "^4.11.1", + "hono": "^4.11.3", "react": "^19.2.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/bun-compress/package.json b/packages/bun-compress/package.json index 4409f4bf7..7df7419be 100644 --- a/packages/bun-compress/package.json +++ b/packages/bun-compress/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@types/bun": "^1.2.12", "@types/node": "^25.0.3", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/bun-transpiler/package.json b/packages/bun-transpiler/package.json index 358a8f8da..7c3e2cf63 100644 --- a/packages/bun-transpiler/package.json +++ b/packages/bun-transpiler/package.json @@ -44,7 +44,7 @@ "hono": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/capnweb/package.json b/packages/capnweb/package.json index b48bbb8ba..e2a4c0926 100644 --- a/packages/capnweb/package.json +++ b/packages/capnweb/package.json @@ -50,7 +50,7 @@ "@hono/node-ws": "^1.2.0", "@types/ws": "^8.5.0", "capnweb": "^0.3.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "publint": "^0.3.16", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/casbin/package.json b/packages/casbin/package.json index a5d5a6cb7..499d17253 100644 --- a/packages/casbin/package.json +++ b/packages/casbin/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "casbin": "^5.40.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/class-validator/package.json b/packages/class-validator/package.json index eb159f6bf..9e6f8a334 100644 --- a/packages/class-validator/package.json +++ b/packages/class-validator/package.json @@ -45,7 +45,7 @@ "hono": ">=3.9.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/clerk-auth/package.json b/packages/clerk-auth/package.json index 4d112759c..9446c44f7 100644 --- a/packages/clerk-auth/package.json +++ b/packages/clerk-auth/package.json @@ -50,7 +50,7 @@ }, "devDependencies": { "@types/react": "^19", - "hono": "^4.11.1", + "hono": "^4.11.3", "react": "^19.2.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/cloudflare-access/package.json b/packages/cloudflare-access/package.json index cc75dca74..fad6a4d81 100644 --- a/packages/cloudflare-access/package.json +++ b/packages/cloudflare-access/package.json @@ -44,7 +44,7 @@ "hono": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/conform-validator/package.json b/packages/conform-validator/package.json index 04322c486..ca49b52b5 100644 --- a/packages/conform-validator/package.json +++ b/packages/conform-validator/package.json @@ -50,7 +50,7 @@ "@conform-to/valibot": "^1.14.1", "@conform-to/yup": "^1.14.0", "@conform-to/zod": "^1.14.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "valibot": "^1.1.0", diff --git a/packages/effect-validator/package.json b/packages/effect-validator/package.json index 01ebfb51e..12194547a 100644 --- a/packages/effect-validator/package.json +++ b/packages/effect-validator/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "effect": "3.19.12", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/esbuild-transpiler/package.json b/packages/esbuild-transpiler/package.json index 17338e8cd..47fb01438 100644 --- a/packages/esbuild-transpiler/package.json +++ b/packages/esbuild-transpiler/package.json @@ -76,7 +76,7 @@ "devDependencies": { "esbuild": "^0.25.10", "esbuild-wasm": "^0.27.2", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/event-emitter/package.json b/packages/event-emitter/package.json index 7723529ee..2cd207442 100644 --- a/packages/event-emitter/package.json +++ b/packages/event-emitter/package.json @@ -46,7 +46,7 @@ "hono": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/firebase-auth/package.json b/packages/firebase-auth/package.json index 4b2a2cedc..e997a7d93 100644 --- a/packages/firebase-auth/package.json +++ b/packages/firebase-auth/package.json @@ -52,7 +52,7 @@ "devDependencies": { "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632", "firebase-tools": "^15.1.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/graphql-server/package.json b/packages/graphql-server/package.json index d9682bfcd..e5b1a7b76 100644 --- a/packages/graphql-server/package.json +++ b/packages/graphql-server/package.json @@ -47,7 +47,7 @@ "graphql": "^16.5.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/hello/package.json b/packages/hello/package.json index 4f6e64303..10e18a3a6 100644 --- a/packages/hello/package.json +++ b/packages/hello/package.json @@ -44,7 +44,7 @@ "hono": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 832f3d9b6..8612f5660 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -62,7 +62,7 @@ "@arethetypeswrong/cli": "^0.17.4", "@modelcontextprotocol/sdk": "^1.25.1", "@types/node": "^25.0.3", - "hono": "^4.11.1", + "hono": "^4.11.3", "hono-rate-limiter": "^0.4.2", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/medley-router/package.json b/packages/medley-router/package.json index 1fbee30a0..af416eebb 100644 --- a/packages/medley-router/package.json +++ b/packages/medley-router/package.json @@ -45,7 +45,7 @@ "hono": ">=3.8.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/node-ws/package.json b/packages/node-ws/package.json index 6305d1c6a..e9829dde4 100644 --- a/packages/node-ws/package.json +++ b/packages/node-ws/package.json @@ -43,7 +43,7 @@ "homepage": "https://github.com/honojs/middleware", "devDependencies": { "@hono/node-server": "^1.19.2", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/oauth-providers/package.json b/packages/oauth-providers/package.json index 10fd5947a..8930f0b63 100644 --- a/packages/oauth-providers/package.json +++ b/packages/oauth-providers/package.json @@ -82,7 +82,7 @@ "hono": ">=3.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "msw": "^2.10.5", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/oidc-auth/package.json b/packages/oidc-auth/package.json index 561264723..cd57db548 100644 --- a/packages/oidc-auth/package.json +++ b/packages/oidc-auth/package.json @@ -45,7 +45,7 @@ }, "devDependencies": { "@types/jsonwebtoken": "^9.0.10", - "hono": "^4.11.1", + "hono": "^4.11.3", "jsonwebtoken": "^9.0.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/otel/package.json b/packages/otel/package.json index 70ad5d82e..448fa29ee 100644 --- a/packages/otel/package.json +++ b/packages/otel/package.json @@ -52,7 +52,7 @@ "@opentelemetry/sdk-metrics": "^2.2.0", "@opentelemetry/sdk-trace-base": "^2.2.0", "@opentelemetry/sdk-trace-node": "^2.2.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/prometheus/package.json b/packages/prometheus/package.json index a9dd3a54b..c09ab282f 100644 --- a/packages/prometheus/package.json +++ b/packages/prometheus/package.json @@ -45,7 +45,7 @@ "prom-client": "^15.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "prom-client": "^15.0.0", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/qwik-city/package.json b/packages/qwik-city/package.json index c2e73cab8..f524781b7 100644 --- a/packages/qwik-city/package.json +++ b/packages/qwik-city/package.json @@ -46,7 +46,7 @@ "devDependencies": { "@builder.io/qwik": "^1.2.0", "@builder.io/qwik-city": "^1.17.1", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2" }, diff --git a/packages/react-compat/package.json b/packages/react-compat/package.json index ae03217cf..c82fe0fe9 100644 --- a/packages/react-compat/package.json +++ b/packages/react-compat/package.json @@ -39,7 +39,7 @@ "hono": ">=4.5.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2" } diff --git a/packages/react-renderer/package.json b/packages/react-renderer/package.json index 01e3db85f..390ffb486 100644 --- a/packages/react-renderer/package.json +++ b/packages/react-renderer/package.json @@ -49,7 +49,7 @@ "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632", "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", - "hono": "^4.11.1", + "hono": "^4.11.3", "react": "^19.2.3", "react-dom": "^19.2.3", "tsdown": "^0.15.9", diff --git a/packages/sentry/package.json b/packages/sentry/package.json index fe20a2fa6..d717f58db 100644 --- a/packages/sentry/package.json +++ b/packages/sentry/package.json @@ -48,7 +48,7 @@ "toucan-js": "^4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/session/package.json b/packages/session/package.json index a0b5b86e7..c0aba937a 100644 --- a/packages/session/package.json +++ b/packages/session/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "unstorage": "^1.17.0", diff --git a/packages/standard-validator/package.json b/packages/standard-validator/package.json index e87e3d6ec..9405da357 100644 --- a/packages/standard-validator/package.json +++ b/packages/standard-validator/package.json @@ -48,7 +48,7 @@ "devDependencies": { "@standard-schema/spec": "1.0.0", "arktype": "^2.1.20", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "valibot": "^1.1.0", diff --git a/packages/stytch-auth/package.json b/packages/stytch-auth/package.json index 96b493b3b..5e6aaac63 100644 --- a/packages/stytch-auth/package.json +++ b/packages/stytch-auth/package.json @@ -45,7 +45,7 @@ "stytch": "^12.32.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "stytch": "^12.32.0", "tsdown": "^0.15.9", "typescript": "^5.8.2", diff --git a/packages/swagger-editor/package.json b/packages/swagger-editor/package.json index d9e688196..f755967a4 100644 --- a/packages/swagger-editor/package.json +++ b/packages/swagger-editor/package.json @@ -45,7 +45,7 @@ "hono": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/swagger-ui/package.json b/packages/swagger-ui/package.json index 702eebaaf..5f233e9c7 100644 --- a/packages/swagger-ui/package.json +++ b/packages/swagger-ui/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@types/swagger-ui-dist": "^3.30.6", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/trpc-server/package.json b/packages/trpc-server/package.json index 741f16337..a354387d5 100644 --- a/packages/trpc-server/package.json +++ b/packages/trpc-server/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@trpc/server": "^11.7.1", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16", diff --git a/packages/tsyringe/package.json b/packages/tsyringe/package.json index 333efdadc..56337bcba 100644 --- a/packages/tsyringe/package.json +++ b/packages/tsyringe/package.json @@ -45,7 +45,7 @@ "tsyringe": ">=4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "reflect-metadata": "^0.2.2", "tsdown": "^0.15.9", "tsyringe": "^4.10.0", diff --git a/packages/typebox-validator/package.json b/packages/typebox-validator/package.json index e6bbbf46f..59ea6434e 100644 --- a/packages/typebox-validator/package.json +++ b/packages/typebox-validator/package.json @@ -45,7 +45,7 @@ "typebox": "^1.0.49" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typebox": "^1.0.49", "typescript": "^5.8.2", diff --git a/packages/typedriver-validator/package.json b/packages/typedriver-validator/package.json index ceea8c656..cf9dcfa7d 100644 --- a/packages/typedriver-validator/package.json +++ b/packages/typedriver-validator/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "arktype": "^2.0.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typebox": "^1.0.49", "typedriver": "^0.8.6", diff --git a/packages/typia-validator/package.json b/packages/typia-validator/package.json index 4b274d68e..b85ba97da 100644 --- a/packages/typia-validator/package.json +++ b/packages/typia-validator/package.json @@ -56,7 +56,7 @@ }, "devDependencies": { "@ryoppippi/unplugin-typia": "1.2.0", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "typia": "^9.7.2", diff --git a/packages/ua-blocker/package.json b/packages/ua-blocker/package.json index ac5a4418f..79b629a06 100644 --- a/packages/ua-blocker/package.json +++ b/packages/ua-blocker/package.json @@ -56,7 +56,7 @@ }, "devDependencies": { "@types/node": "^25.0.3", - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16" diff --git a/packages/valibot-validator/package.json b/packages/valibot-validator/package.json index d05741830..28e739440 100644 --- a/packages/valibot-validator/package.json +++ b/packages/valibot-validator/package.json @@ -39,7 +39,7 @@ "valibot": "^1.0.0 || ^1.0.0-beta.4 || ^1.0.0-rc" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "valibot": "^1.1.0", diff --git a/packages/zod-openapi/package.json b/packages/zod-openapi/package.json index c4e2771ce..11d6af1e4 100644 --- a/packages/zod-openapi/package.json +++ b/packages/zod-openapi/package.json @@ -45,7 +45,7 @@ "zod": "^4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16", diff --git a/packages/zod-validator/package.json b/packages/zod-validator/package.json index d40d606c6..01366f8f2 100644 --- a/packages/zod-validator/package.json +++ b/packages/zod-validator/package.json @@ -46,7 +46,7 @@ "zod": "^3.25.0 || ^4.0.0" }, "devDependencies": { - "hono": "^4.11.1", + "hono": "^4.11.3", "tsdown": "^0.15.9", "typescript": "^5.8.2", "vitest": "^4.0.16", diff --git a/yarn.lock b/yarn.lock index f283bd602..69930a1c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2000,7 +2000,7 @@ __metadata: resolution: "@hono/ajv-validator@workspace:packages/ajv-validator" dependencies: ajv: "npm:^8.12.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2015,7 +2015,7 @@ __metadata: resolution: "@hono/arktype-validator@workspace:packages/arktype-validator" dependencies: arktype: "npm:^2.1.20" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2031,7 +2031,7 @@ __metadata: dependencies: "@auth/core": "npm:^0.35.3" "@types/react": "npm:^19" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" react: "npm:^19.2.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2049,7 +2049,7 @@ __metadata: dependencies: "@types/bun": "npm:^1.2.12" "@types/node": "npm:^25.0.3" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2062,7 +2062,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/bun-transpiler@workspace:packages/bun-transpiler" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2079,7 +2079,7 @@ __metadata: "@hono/node-ws": "npm:^1.2.0" "@types/ws": "npm:^8.5.0" capnweb: "npm:^0.3.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" publint: "npm:^0.3.16" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2096,7 +2096,7 @@ __metadata: resolution: "@hono/casbin@workspace:packages/casbin" dependencies: casbin: "npm:^5.40.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2112,7 +2112,7 @@ __metadata: dependencies: class-transformer: "npm:^0.5.1" class-validator: "npm:^0.14.1" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" reflect-metadata: "npm:^0.2.2" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2129,7 +2129,7 @@ __metadata: "@clerk/backend": "npm:^2.4.1" "@clerk/types": "npm:^4.64.0" "@types/react": "npm:^19" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" react: "npm:^19.2.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2143,7 +2143,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/cloudflare-access@workspace:packages/cloudflare-access" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2160,7 +2160,7 @@ __metadata: "@conform-to/valibot": "npm:^1.14.1" "@conform-to/yup": "npm:^1.14.0" "@conform-to/zod": "npm:^1.14.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" valibot: "npm:^1.1.0" @@ -2178,7 +2178,7 @@ __metadata: resolution: "@hono/effect-validator@workspace:packages/effect-validator" dependencies: effect: "npm:3.19.12" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2194,7 +2194,7 @@ __metadata: dependencies: esbuild: "npm:^0.25.10" esbuild-wasm: "npm:^0.27.2" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2223,7 +2223,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/event-emitter@workspace:packages/event-emitter" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2239,7 +2239,7 @@ __metadata: "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632" firebase-auth-cloudflare-workers: "npm:^2.0.6" firebase-tools: "npm:^15.1.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2253,7 +2253,7 @@ __metadata: resolution: "@hono/graphql-server@workspace:packages/graphql-server" dependencies: graphql: "npm:^16.5.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2266,7 +2266,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/hello@workspace:packages/hello" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2282,7 +2282,7 @@ __metadata: "@arethetypeswrong/cli": "npm:^0.17.4" "@modelcontextprotocol/sdk": "npm:^1.25.1" "@types/node": "npm:^25.0.3" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" hono-rate-limiter: "npm:^0.4.2" pkce-challenge: "npm:^5.0.0" tsdown: "npm:^0.15.9" @@ -2302,7 +2302,7 @@ __metadata: resolution: "@hono/medley-router@workspace:packages/medley-router" dependencies: "@medley/router": "npm:^0.2.1" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2334,7 +2334,7 @@ __metadata: resolution: "@hono/node-ws@workspace:packages/node-ws" dependencies: "@hono/node-server": "npm:^1.19.2" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2349,7 +2349,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/oauth-providers@workspace:packages/oauth-providers" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" msw: "npm:^2.10.5" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2364,7 +2364,7 @@ __metadata: resolution: "@hono/oidc-auth@workspace:packages/oidc-auth" dependencies: "@types/jsonwebtoken": "npm:^9.0.10" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" jsonwebtoken: "npm:^9.0.3" oauth4webapi: "npm:^2.6.0" tsdown: "npm:^0.15.9" @@ -2385,7 +2385,7 @@ __metadata: "@opentelemetry/sdk-trace-base": "npm:^2.2.0" "@opentelemetry/sdk-trace-node": "npm:^2.2.0" "@opentelemetry/semantic-conventions": "npm:^1.28.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2398,7 +2398,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/prometheus@workspace:packages/prometheus" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" prom-client: "npm:^15.0.0" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2415,7 +2415,7 @@ __metadata: dependencies: "@builder.io/qwik": "npm:^1.2.0" "@builder.io/qwik-city": "npm:^1.17.1" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" peerDependencies: @@ -2429,7 +2429,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/react-compat@workspace:packages/react-compat" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" peerDependencies: @@ -2444,7 +2444,7 @@ __metadata: "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632" "@types/react": "npm:^19.2.7" "@types/react-dom": "npm:^19.2.3" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" react: "npm:^19.2.3" react-dom: "npm:^19.2.3" tsdown: "npm:^0.15.9" @@ -2461,7 +2461,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/sentry@workspace:packages/sentry" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" toucan-js: "npm:^4.0.0" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2476,7 +2476,7 @@ __metadata: resolution: "@hono/session@workspace:packages/session" dependencies: "@cloudflare/vitest-pool-workers": "https://pkg.pr.new/@cloudflare/vitest-pool-workers@11632" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" jose: "npm:^6.0.11" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2506,7 +2506,7 @@ __metadata: dependencies: "@standard-schema/spec": "npm:1.0.0" arktype: "npm:^2.1.20" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" valibot: "npm:^1.1.0" @@ -2522,7 +2522,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/stytch-auth@workspace:packages/stytch-auth" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" stytch: "npm:^12.32.0" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2537,7 +2537,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/swagger-editor@workspace:packages/swagger-editor" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2551,7 +2551,7 @@ __metadata: resolution: "@hono/swagger-ui@workspace:packages/swagger-ui" dependencies: "@types/swagger-ui-dist": "npm:^3.30.6" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2565,7 +2565,7 @@ __metadata: resolution: "@hono/trpc-server@workspace:packages/trpc-server" dependencies: "@trpc/server": "npm:^11.7.1" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2580,7 +2580,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/tsyringe@workspace:packages/tsyringe" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" reflect-metadata: "npm:^0.2.2" tsdown: "npm:^0.15.9" tsyringe: "npm:^4.10.0" @@ -2596,7 +2596,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/typebox-validator@workspace:packages/typebox-validator" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typebox: "npm:^1.0.49" typescript: "npm:^5.8.2" @@ -2612,7 +2612,7 @@ __metadata: resolution: "@hono/typedriver-validator@workspace:packages/typedriver-validator" dependencies: arktype: "npm:^2.0.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typebox: "npm:^1.0.49" typedriver: "npm:^0.8.6" @@ -2631,7 +2631,7 @@ __metadata: resolution: "@hono/typia-validator@workspace:packages/typia-validator" dependencies: "@ryoppippi/unplugin-typia": "npm:1.2.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" typia: "npm:^9.7.2" @@ -2647,7 +2647,7 @@ __metadata: resolution: "@hono/ua-blocker@workspace:packages/ua-blocker" dependencies: "@types/node": "npm:^25.0.3" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -2660,7 +2660,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/valibot-validator@workspace:packages/valibot-validator" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" valibot: "npm:^1.1.0" @@ -2677,7 +2677,7 @@ __metadata: dependencies: "@asteasolutions/zod-to-openapi": "npm:^8.1.0" "@hono/zod-validator": "workspace:^" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" openapi3-ts: "npm:^4.5.0" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" @@ -2694,7 +2694,7 @@ __metadata: version: 0.0.0-use.local resolution: "@hono/zod-validator@workspace:packages/zod-validator" dependencies: - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" tsdown: "npm:^0.15.9" typescript: "npm:^5.8.2" vitest: "npm:^4.0.16" @@ -9867,7 +9867,7 @@ __metadata: "@types/ws": "npm:^8.18.0" "@vitest/coverage-istanbul": "npm:^4.0.16" eslint: "npm:^9.34.0" - hono: "npm:^4.11.1" + hono: "npm:^4.11.3" pkg-pr-new: "npm:^0.0.54" prettier: "npm:^3.6.2" publint: "npm:^0.3.16" @@ -9888,10 +9888,10 @@ __metadata: languageName: node linkType: hard -"hono@npm:^4.11.1": - version: 4.11.1 - resolution: "hono@npm:4.11.1" - checksum: 10c0/d45041872a8b017422edff21ee98eb52e9bb45cc1c7175e3119ff16badbfe6d15fc0fb5ec3ec280b60a1e13e5c696e5494b2a2284f4a6b801dd4d59363a28f51 +"hono@npm:^4.11.3": + version: 4.11.3 + resolution: "hono@npm:4.11.3" + checksum: 10c0/9e68313b3329cab0d93633909c206073315b326aa05cf6f5596214cb6e3b9913c9b59650d46a86ec9e4865b4b195561289cca191623aa557a3c2380121ff39df languageName: node linkType: hard From a1ffd504b7ff1e96699cc22a2192f9c6b889ad3b Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Sun, 28 Dec 2025 12:22:03 +1100 Subject: [PATCH 2/6] chore(turbo): more build caching --- .github/workflows/autofix.yml | 5 ++--- .github/workflows/ci-bun-transpiler.yml | 5 +---- .github/workflows/ci.yml | 2 +- .github/workflows/pr.yml | 4 ++-- turbo.json | 4 ++++ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 2e2a5d9fd..50af9bac7 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -23,16 +23,15 @@ jobs: - uses: actions/cache@v5 with: path: .turbo - key: ${{ runner.os }}-turbo-autofix-${{ github.sha }} + key: ${{ runner.os }}-turbo-${{ github.sha }} restore-keys: | - ${{ runner.os }}-turbo-autofix- ${{ runner.os }}-turbo- - uses: actions/setup-node@v6 with: node-version-file: .tool-versions - run: yarn install + - run: yarn lint:fix --cache-strategy content - run: yarn format:fix - - run: yarn lint:fix - name: Apply fixes uses: autofix-ci/action@v1 with: diff --git a/.github/workflows/ci-bun-transpiler.yml b/.github/workflows/ci-bun-transpiler.yml index 3665b4fd6..a484bad35 100644 --- a/.github/workflows/ci-bun-transpiler.yml +++ b/.github/workflows/ci-bun-transpiler.yml @@ -18,10 +18,7 @@ jobs: with: bun-version-file: .tool-versions - run: yarn workspaces focus hono-middleware @hono/bun-transpiler - - run: yarn workspace @hono/bun-transpiler build - - run: yarn workspace @hono/bun-transpiler typecheck - - run: yarn eslint packages/bun-transpiler - - run: yarn prettier --check . !packages packages/bun-transpiler + - run: yarn turbo --filter @hono/bun-transpiler build - run: yarn workspace @hono/bun-transpiler test --coverage --coverage-reporter lcov - uses: codecov/codecov-action@v5 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bfb813b7..94fd952b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: with: node-version-file: .tool-versions - run: yarn workspaces focus hono-middleware @hono/${{ matrix.package }} - - run: yarn workspaces foreach --topological --recursive --from @hono/${{ matrix.package }} run build + - run: yarn turbo --filter @hono/${{ matrix.package }} build - run: yarn test --coverage --project @hono/${{ matrix.package }} id: test if: ${{ matrix.package != 'eslint-config' && matrix.package != 'qwik-city' && matrix.package != 'react-compat' }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8dc05ddeb..309f606c4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -42,7 +42,7 @@ jobs: node-version-file: .tool-versions - run: yarn - run: yarn typecheck - - run: yarn lint + - run: yarn lint --cache-strategy content - run: yarn format dry-run: @@ -70,7 +70,7 @@ jobs: with: node-version-file: .tool-versions - run: yarn workspaces focus hono-middleware @hono/${{ matrix.package }} - - run: yarn workspaces foreach --topological --recursive --from @hono/${{ matrix.package }} run build + - run: yarn turbo --filter @hono/${{ matrix.package }} build - run: yarn test --coverage --project @hono/${{ matrix.package }} id: test if: ${{ matrix.package != 'eslint-config' && matrix.package != 'qwik-city' && matrix.package != 'react-compat' }} diff --git a/turbo.json b/turbo.json index 6323b0335..6d79c4c44 100644 --- a/turbo.json +++ b/turbo.json @@ -1,6 +1,10 @@ { "$schema": "https://turborepo.com/schema.json", "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + }, "format": { "outputs": [".cache/.prettiercache"], "outputLogs": "new-only" From 6df2ab74ee56c6c841c6f2b72ed132524107db90 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Sun, 28 Dec 2025 12:43:23 +1100 Subject: [PATCH 3/6] chore: turbo build release --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d65985fb5..beacac7d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: run: yarn - name: Build - run: yarn build + run: yarn turbo build - name: Create Release Pull Request or Publish to npm id: changesets From e6e71a382421d36a2c063fd019d32dc540cec0b3 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Sun, 28 Dec 2025 12:47:44 +1100 Subject: [PATCH 4/6] chore(session): retry flakey tests --- packages/session/vitest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/session/vitest.config.ts b/packages/session/vitest.config.ts index cb366d3d8..f9f51bd86 100644 --- a/packages/session/vitest.config.ts +++ b/packages/session/vitest.config.ts @@ -15,5 +15,6 @@ export default defineProject({ globals: true, include: ['examples/**/*.test.ts', 'src/**/*.test.ts'], restoreMocks: true, + retry: 3, }, }) From 9e428a70a5e752328e0ebfae0fb66d80d36e4cff Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Sun, 28 Dec 2025 12:52:32 +1100 Subject: [PATCH 5/6] chore(turbo): add cache to more workflows --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/cr.yml | 9 ++++++++- .github/workflows/pr.yml | 6 ++++++ .github/workflows/release.yml | 8 ++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94fd952b9..e3e9ca6f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,12 @@ jobs: steps: - uses: actions/checkout@v6 + - uses: actions/cache@v5 + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - uses: actions/setup-node@v6 with: node-version-file: .tool-versions diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml index 30014818b..de03ba6bf 100644 --- a/.github/workflows/cr.yml +++ b/.github/workflows/cr.yml @@ -20,6 +20,13 @@ jobs: with: fetch-depth: 0 + - uses: actions/cache@v5 + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- + - uses: actions/setup-node@v6 with: node-version-file: .tool-versions @@ -28,7 +35,7 @@ jobs: run: yarn - name: Build - run: yarn build + run: yarn turbo build - name: Publish to StackBlitz run: yarn pkg-pr-new publish --compact --no-template './packages/*' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 309f606c4..19aea3231 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -66,6 +66,12 @@ jobs: steps: - uses: actions/checkout@v6 + - uses: actions/cache@v5 + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - uses: actions/setup-node@v6 with: node-version-file: .tool-versions diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index beacac7d5..17e65cb6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,14 @@ jobs: - name: Checkout Repo uses: actions/checkout@v6 + - name: Build Cache + uses: actions/cache@v5 + with: + path: .turbo + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- + - name: Setup Node.js 20.x uses: actions/setup-node@v6 with: From e5b2966441f0596839cf902108fe23df43203f51 Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Mon, 29 Dec 2025 09:57:21 +1100 Subject: [PATCH 6/6] feature(event-emitter): add env type paramater --- .changeset/rotten-radios-hope.md | 5 +++ packages/event-emitter/README.md | 18 ++++------ packages/event-emitter/src/index.test.ts | 6 ++-- packages/event-emitter/src/index.ts | 44 ++++++++++++++---------- 4 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 .changeset/rotten-radios-hope.md diff --git a/.changeset/rotten-radios-hope.md b/.changeset/rotten-radios-hope.md new file mode 100644 index 000000000..ec9164ba1 --- /dev/null +++ b/.changeset/rotten-radios-hope.md @@ -0,0 +1,5 @@ +--- +'@hono/event-emitter': minor +--- + +Add `EmitterEnv` type paramater diff --git a/packages/event-emitter/README.md b/packages/event-emitter/README.md index 7c7a64c28..bce3439d3 100644 --- a/packages/event-emitter/README.md +++ b/packages/event-emitter/README.md @@ -177,7 +177,7 @@ export default app ```ts // types.ts -import type { Emitter } from '@hono/event-emitter' +import type { EmitterEnv } from '@hono/event-emitter' export type User = { id: string @@ -192,13 +192,7 @@ export type AvailableEvents = { foo: { bar: number } } -export type Env = { - Bindings: {} - Variables: { - // Define emitter variable type - emitter: Emitter - } -} +export type Env = EmitterEnv ``` ```ts @@ -360,7 +354,7 @@ export default app Creates a Hono middleware that adds an event emitter to the context. ```ts -function emitter( +function emitter( eventHandlers?: EventHandlers, options?: EventEmitterOptions ): MiddlewareHandler @@ -386,7 +380,7 @@ app.use(emitter(eventHandlers)) Creates new instance of event emitter with provided handlers. This is usefull when you want to use the emitter as standalone feature instead of Hono middleware. ```ts -function createEmitter( +function createEmitter( eventHandlers?: EventHandlers, options?: EventEmitterOptions ): Emitter @@ -412,7 +406,7 @@ const ee = createEmitter(eventHandlers) A utility function to define a typed event handler. ```ts -function defineHandler( +function defineHandler( handler: EventHandler ): EventHandler ``` @@ -448,7 +442,7 @@ const handler = defineHandler((c, payload) => { A utility function to define multiple typed event handlers. ```ts -function defineHandlers(handlers: { +function defineHandlers(handlers: { [K in keyof EPMap]?: EventHandler[] }): { [K in keyof EPMap]?: EventHandler[] } ``` diff --git a/packages/event-emitter/src/index.test.ts b/packages/event-emitter/src/index.test.ts index 9c9b5fc41..2da124bbe 100644 --- a/packages/event-emitter/src/index.test.ts +++ b/packages/event-emitter/src/index.test.ts @@ -2,7 +2,7 @@ import { Hono } from 'hono' import type { Context } from 'hono' import { describe, expect, it, vi } from 'vitest' import { createEmitter, defineHandler, defineHandlers, emitter } from './index' -import type { Emitter } from './index' // Adjust the import path as needed +import type { Emitter, EmitterEnv } from './index' // Adjust the import path as needed describe('Event Emitter Middleware', () => { describe('createEmitter', () => { @@ -391,7 +391,7 @@ describe('Event Emitter Middleware', () => { 'todo:created': { id: string; text: string } } - type Env = { Variables: { emitter: Emitter } } + type Env = EmitterEnv const handlers = defineHandlers({ 'todo:created': [vi.fn((_c, _payload) => {})], @@ -423,7 +423,7 @@ describe('Event Emitter Middleware', () => { 'todo:created': { id: string; text: string } } - type Env = { Variables: { emitter: Emitter } } + type Env = EmitterEnv const handlers = defineHandlers({ 'todo:created': [vi.fn(async (_c, _payload) => {})], diff --git a/packages/event-emitter/src/index.ts b/packages/event-emitter/src/index.ts index 833194257..5a88cdf75 100644 --- a/packages/event-emitter/src/index.ts +++ b/packages/event-emitter/src/index.ts @@ -10,15 +10,20 @@ export type EventHandler = ( c: Context, payload: T ) => void | Promise -export type EventHandlers = { [K in keyof T]?: EventHandler[] } +export type EventHandlers = { [K in keyof T]?: EventHandler>[] } export type EventPayloadMap = { [key: string]: unknown } export type EmitAsyncOptions = { mode: 'concurrent' | 'sequencial' } export type EventEmitterOptions = { maxHandlers?: number } +export type EmitterEnv = Env & { + Variables: { + emitter: Emitter + } +} -export interface Emitter { - on(key: Key, handler: EventHandler): void - off(key: Key, handler?: EventHandler): void - emit(c: Context, key: Key, payload: EPMap[Key]): void +export interface Emitter = EmitterEnv> { + on(key: Key, handler: EventHandler): void + off(key: Key, handler?: EventHandler): void + emit(c: Context, key: Key, payload: EPMap[Key]): void emitAsync( c: Context, key: Key, @@ -33,9 +38,9 @@ export interface Emitter { * @returns The event handler. */ export const defineHandler = < - EPMap extends EventPayloadMap, + EPMap, Key extends keyof EPMap, - E extends Env = Env, + E extends EmitterEnv = EmitterEnv, >( handler: EventHandler ): EventHandler => { @@ -47,7 +52,7 @@ export const defineHandler = < * @param {EventHandler[]} handlers - An object where each key is an event type and the value is an array of event handlers. * @returns The event handlers. */ -export const defineHandlers = (handlers: { +export const defineHandlers = = EmitterEnv>(handlers: { [K in keyof EPMap]?: EventHandler[] }): { [K in keyof EPMap]?: EventHandler[] } => { return handlers @@ -122,12 +127,12 @@ export const defineHandlers = ( +export const createEmitter = ( eventHandlers?: EventHandlers, options?: EventEmitterOptions ): Emitter => { // A map of event keys and their corresponding event handlers. - const handlers: Map[]> = eventHandlers + const handlers: Map>[]> = eventHandlers ? new Map(Object.entries(eventHandlers)) : new Map() @@ -138,14 +143,17 @@ export const createEmitter = ( * @param {Function} handler Function that is invoked when the specified event occurs * @throws {TypeError} If the handler is not a function */ - on(key: Key, handler: EventHandler) { + on(key: Key, handler: EventHandler>) { if (typeof handler !== 'function') { throw new TypeError('The handler must be a function') } if (!handlers.has(key as EventKey)) { handlers.set(key as EventKey, []) } - const handlerArray = handlers.get(key as EventKey) as EventHandler[] + const handlerArray = handlers.get(key as EventKey) as EventHandler< + EPMap[Key], + EmitterEnv + >[] const limit = options?.maxHandlers ?? 10 if (handlerArray.length >= limit) { throw new RangeError( @@ -166,7 +174,7 @@ export const createEmitter = ( * @param {string|symbol} key Type of event to unregister `handler` from * @param {Function} handler - Handler function to remove */ - off(key: Key, handler?: EventHandler) { + off(key: Key, handler?: EventHandler>) { if (!handler) { handlers.delete(key as EventKey) } else { @@ -187,7 +195,7 @@ export const createEmitter = ( * @param {string|symbol} key - The event key * @param {EventPayloadMap[keyof EventPayloadMap]} payload - Data passed to each invoked handler */ - emit(c: Context, key: Key, payload: EPMap[Key]) { + emit(c: Context>, key: Key, payload: EPMap[Key]) { const handlerArray = handlers.get(key as EventKey) if (handlerArray) { for (const handler of handlerArray) { @@ -206,7 +214,7 @@ export const createEmitter = ( * @throws {AggregateError} If any handler encounters an error. */ async emitAsync( - c: Context, + c: Context>, key: Key, payload: EPMap[Key], options: EmitAsyncOptions = { mode: 'concurrent' } @@ -321,12 +329,12 @@ export const createEmitter = ( * }) * ``` */ -export const emitter = ( +export const emitter = ( eventHandlers?: EventHandlers, options?: EventEmitterOptions -): MiddlewareHandler => { +): MiddlewareHandler> => { // Create new instance to share with any middleware and handlers - const instance = createEmitter(eventHandlers, options) + const instance = createEmitter(eventHandlers, options) return async (c, next) => { c.set('emitter', instance) await next()