-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
feat(logger): support NO_COLOR
#2228
Conversation
This is great. I'll review the details later. This will be introduced in the next "minor" version. |
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.
Looks good to me!
Hi @ryuapp ! Thanks. I'll merge this into the "next" branch for the |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [hono](https://hono.dev/) ([source](https://togithub.com/honojs/hono)) | [`^3.12.12` -> `^4.0.0`](https://renovatebot.com/diffs/npm/hono/3.12.12/4.1.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/hono/4.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/hono/4.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/hono/3.12.12/4.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/hono/3.12.12/4.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>honojs/hono (hono)</summary> ### [`v4.1.3`](https://togithub.com/honojs/hono/releases/tag/v4.1.3) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.2...v4.1.3) #### What's Changed - fix(deno): export jwt helpers for Deno in `src/helper.ts` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2385](https://togithub.com/honojs/hono/pull/2385) - fix(jsx): use self closing tag only if element has no children by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2384](https://togithub.com/honojs/hono/pull/2384) - feat(ssg): Support asynchronous hooks by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2381](https://togithub.com/honojs/hono/pull/2381) - fix(validator): use cached body for `json` and `form` validation by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2392](https://togithub.com/honojs/hono/pull/2392) - fix(jsx): escape attribute value for "style" by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2390](https://togithub.com/honojs/hono/pull/2390) **Full Changelog**: honojs/hono@v4.1.2...v4.1.3 ### [`v4.1.2`](https://togithub.com/honojs/hono/releases/tag/v4.1.2) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.1...v4.1.2) #### What's Changed - feat(utils/cookie): Typesafe cookie options by [@​Jxck](https://togithub.com/Jxck) in [https://github.com/honojs/hono/pull/2350](https://togithub.com/honojs/hono/pull/2350) - fix(router): accept reg exp meta characters in path by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2375](https://togithub.com/honojs/hono/pull/2375) - perf(utils/url): use `slice` + `indexOf` for `getPath()` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2376](https://togithub.com/honojs/hono/pull/2376) - fix(router): wildcard paths when using js reserved words (like constructor and **proto**) by [@​lmcarreiro](https://togithub.com/lmcarreiro) in [https://github.com/honojs/hono/pull/2357](https://togithub.com/honojs/hono/pull/2357) - fix(types): `MergePath` merge blank paths correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2365](https://togithub.com/honojs/hono/pull/2365) #### New Contributors - [@​lmcarreiro](https://togithub.com/lmcarreiro) made their first contribution in [https://github.com/honojs/hono/pull/2357](https://togithub.com/honojs/hono/pull/2357) **Full Changelog**: honojs/hono@v4.1.1...v4.1.2 ### [`v4.1.1`](https://togithub.com/honojs/hono/releases/tag/v4.1.1) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.0...v4.1.1) #### What's Changed - fix(context): export `ExecutionContext` from `hono` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2346](https://togithub.com/honojs/hono/pull/2346) - fix(client): Remove trailing slash from /index for precise path matching by [@​poteboy](https://togithub.com/poteboy) in [https://github.com/honojs/hono/pull/2344](https://togithub.com/honojs/hono/pull/2344) - ci: fix bun version for `denoify` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2362](https://togithub.com/honojs/hono/pull/2362) - refactor(jsx-renderer): remove unnecessary comments for eslint by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2361](https://togithub.com/honojs/hono/pull/2361) - fix(lambda-edge): Lambda@Edge GET/HEAD body error. by [@​trkbt10](https://togithub.com/trkbt10) in [https://github.com/honojs/hono/pull/2351](https://togithub.com/honojs/hono/pull/2351) - fix(jsx-renderer): don't overwrite headers if stream is `true` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2363](https://togithub.com/honojs/hono/pull/2363) - fix(context): set headers correctly if it has `this.#headers` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2364](https://togithub.com/honojs/hono/pull/2364) - fix(streaming): Fix stream SSE, not necessary close stream. by [@​damianpumar](https://togithub.com/damianpumar) in [https://github.com/honojs/hono/pull/2320](https://togithub.com/honojs/hono/pull/2320) #### New Contributors - [@​poteboy](https://togithub.com/poteboy) made their first contribution in [https://github.com/honojs/hono/pull/2344](https://togithub.com/honojs/hono/pull/2344) - [@​trkbt10](https://togithub.com/trkbt10) made their first contribution in [https://github.com/honojs/hono/pull/2351](https://togithub.com/honojs/hono/pull/2351) - [@​damianpumar](https://togithub.com/damianpumar) made their first contribution in [https://github.com/honojs/hono/pull/2320](https://togithub.com/honojs/hono/pull/2320) **Full Changelog**: honojs/hono@v4.1.0...v4.1.1 ### [`v4.1.0`](https://togithub.com/honojs/hono/releases/tag/v4.1.0) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.10...v4.1.0) Hono v4.1.0 is now available! Let's take a look at the new features. ##### WebSocket Helper Now Hono supports WebSockets! With [WebSocket helper](https://hono.dev/helpers/websocket), you can easily handle WebSockets in your application. Currently, Cloudflare Workers / Pages, Deno, and Bun adapters are available. ```ts const app = new Hono() app.get( '/ws', upgradeWebSocket((c) => { return { onMessage(event, ws) { console.log(`Message from client: ${event.data}`) ws.send('Hello from server!') }, onClose: () => { console.log('Connection closed') } } }) ) ``` PRC mode is now also supported for WebSockets endpoints. The following is a demo. ![WebSocket Helper](https://togithub.com/honojs/hono/assets/10682/46a60a53-b367-4f77-b727-fd535c5a5961) Thanks [@​nakasyou](https://togithub.com/nakasyou)! ##### Body Limit Middleware Introducing [Body Limit Middleware](https://hono.dev/middleware/builtin/body-limit). This middleware can limit the file size of the request body. ```ts const app = new Hono() app.post( '/upload', bodyLimit({ maxSize: 50 * 1024, // 50kb onError: (c) => { return c.text('overflow :(', 413) } }), async (c) => { const body = await c.req.parseBody() if (body['file'] instanceof File) { console.log(`Got file sized: ${body['file'].size}`) } return c.text('pass :)') } ) ``` Thanks [@​EdamAme-x](https://togithub.com/EdamAme-x) and [@​usualoma](https://togithub.com/usualoma)! ##### ES2022 We made the `target` in the `tsconfig.json` as ES2022 instead of ES2020. So, the generated JavaScript files are now ES2022. That made the file size smaller! The following is the result of the minify and build of "Hello World" with Wrangler. ```txt // ES2020 hono => Total Upload: 20.15 KiB / gzip: 7.42 KiB hono/tiny => Total Upload: 12.74 KiB / gzip: 4.69 KiB ``` ```txt // ES2022 hono => Total Upload: 18.46 KiB / gzip: 7.09 KiB hono/tiny => Total Upload: 11.12 KiB / gzip: 4.38 KiB ``` Performance has also been improved in some Node.js environments. ![SS](https://togithub.com/honojs/hono/assets/10682/2406e5c6-50c7-4e9a-b085-70cd47277434) ##### Other features - Cookie Helper - Supports `__Secure-` and `__Host- prefix` [https://github.com/honojs/hono/pull/2269](https://togithub.com/honojs/hono/pull/2269) - Cookie Helper - Check bis condition [https://github.com/honojs/hono/pull/2314](https://togithub.com/honojs/hono/pull/2314) - jsx/dom - Add more React staff [https://github.com/honojs/hono/pull/2197](https://togithub.com/honojs/hono/pull/2197) - SSG - Generate files concurrently [https://github.com/honojs/hono/pull/2187](https://togithub.com/honojs/hono/pull/2187) - HTTP Exception - Add `cause` option [https://github.com/honojs/hono/pull/2224](https://togithub.com/honojs/hono/pull/2224) - Logger - Support `NO_COLOR` [https://github.com/honojs/hono/pull/2228](https://togithub.com/honojs/hono/pull/2228) ##### All Updates - feat: Add a "cause" option to HTTPException by [@​Karibash](https://togithub.com/Karibash) in [https://github.com/honojs/hono/pull/2224](https://togithub.com/honojs/hono/pull/2224) - feat(logger): support `NO_COLOR` by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2228](https://togithub.com/honojs/hono/pull/2228) - feat(cookie): add secure and host prefix support by [@​Datron](https://togithub.com/Datron) in [https://github.com/honojs/hono/pull/2269](https://togithub.com/honojs/hono/pull/2269) - feat(ssg): generate files concurrently by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2187](https://togithub.com/honojs/hono/pull/2187) - feat(jsx): more react staff by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2197](https://togithub.com/honojs/hono/pull/2197) - feat: introduce Body Limit Middleware using stream by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2309](https://togithub.com/honojs/hono/pull/2309) - feat: Introduce WebSocket Helper / Adapter by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2265](https://togithub.com/honojs/hono/pull/2265) - refactor(SSG): separate middleware logic by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2315](https://togithub.com/honojs/hono/pull/2315) - chore: bump up `@hono/node-server` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2323](https://togithub.com/honojs/hono/pull/2323) - fix(body-limit): export `bodyLimit` for Deno by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2324](https://togithub.com/honojs/hono/pull/2324) - fix(websocket): export WebSocket helper for Deno by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2325](https://togithub.com/honojs/hono/pull/2325) - feat(cookie): Add Cookie bis condition check by [@​Jxck](https://togithub.com/Jxck) in [https://github.com/honojs/hono/pull/2314](https://togithub.com/honojs/hono/pull/2314) - Next by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2327](https://togithub.com/honojs/hono/pull/2327) ##### New Contributors - [@​Karibash](https://togithub.com/Karibash) made their first contribution in [https://github.com/honojs/hono/pull/2224](https://togithub.com/honojs/hono/pull/2224) - [@​Datron](https://togithub.com/Datron) made their first contribution in [https://github.com/honojs/hono/pull/2269](https://togithub.com/honojs/hono/pull/2269) - [@​Jxck](https://togithub.com/Jxck) made their first contribution in [https://github.com/honojs/hono/pull/2314](https://togithub.com/honojs/hono/pull/2314) **Full Changelog**: honojs/hono@v4.0.10...v4.1.0 ### [`v4.0.10`](https://togithub.com/honojs/hono/releases/tag/v4.0.10) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.9...v4.0.10) #### What's Changed - fix (jsx/dom): keep ref.current value during lifecycle. by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2307](https://togithub.com/honojs/hono/pull/2307) **Full Changelog**: honojs/hono@v4.0.9...v4.0.10 ### [`v4.0.9`](https://togithub.com/honojs/hono/releases/tag/v4.0.9) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.8...v4.0.9) ##### What's Changed - fix(stream): remove async from onabort by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2293](https://togithub.com/honojs/hono/pull/2293) - fix(types): use `{}` instead of Partial by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2305](https://togithub.com/honojs/hono/pull/2305) **Full Changelog**: honojs/hono@v4.0.8...v4.0.9 ### [`v4.0.8`](https://togithub.com/honojs/hono/releases/tag/v4.0.8) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.7...v4.0.8) #### What's Changed - fix(ssg): allow `app: Hono<any, any, any>` for `toSSG` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2272](https://togithub.com/honojs/hono/pull/2272) - fix(ssg): preserve binary files as-is by [@​berlysia](https://togithub.com/berlysia) in [https://github.com/honojs/hono/pull/2275](https://togithub.com/honojs/hono/pull/2275) - fix: fix comment by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2278](https://togithub.com/honojs/hono/pull/2278) - fix(deno/jsx-precompile): use html() tag function if value is a promise by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2283](https://togithub.com/honojs/hono/pull/2283) - fix(devDependencies): Fix the problem of missing glob package by [@​xx1124961758](https://togithub.com/xx1124961758) in [https://github.com/honojs/hono/pull/2277](https://togithub.com/honojs/hono/pull/2277) #### New Contributors - [@​berlysia](https://togithub.com/berlysia) made their first contribution in [https://github.com/honojs/hono/pull/2275](https://togithub.com/honojs/hono/pull/2275) - [@​xx1124961758](https://togithub.com/xx1124961758) made their first contribution in [https://github.com/honojs/hono/pull/2277](https://togithub.com/honojs/hono/pull/2277) **Full Changelog**: honojs/hono@v4.0.7...v4.0.8 ### [`v4.0.7`](https://togithub.com/honojs/hono/releases/tag/v4.0.7) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.6...v4.0.7) #### What's Changed - fix(jsx/dom): import from correct file for avoiding circular dependency by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2268](https://togithub.com/honojs/hono/pull/2268) - fix(types): `MergeSchemaPath` supports regexp path params by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2271](https://togithub.com/honojs/hono/pull/2271) **Full Changelog**: honojs/hono@v4.0.6...v4.0.7 ### [`v4.0.6`](https://togithub.com/honojs/hono/releases/tag/v4.0.6) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.5...v4.0.6) #### What's Changed - chore: use official deno installer by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2250](https://togithub.com/honojs/hono/pull/2250) - fix(reg-exp-router): use matchers\[METHOD_NAME_ALL] as fallback for unknown method by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2255](https://togithub.com/honojs/hono/pull/2255) - test: add router/common.case.test.ts by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2258](https://togithub.com/honojs/hono/pull/2258) - fix: assign value to element's property for input, textarea, select by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2261](https://togithub.com/honojs/hono/pull/2261) - perf(jsx/dom): update textContent only when content changes by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2264](https://togithub.com/honojs/hono/pull/2264) - fix(stream): avoid hang up when stream helper's callback throw error by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2262](https://togithub.com/honojs/hono/pull/2262) - fix(serve-static): support extensionless files and refactor by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2260](https://togithub.com/honojs/hono/pull/2260) **Full Changelog**: honojs/hono@v4.0.5...v4.0.6 ### [`v4.0.5`](https://togithub.com/honojs/hono/releases/tag/v4.0.5) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.4...v4.0.5) #### What's Changed - fix: Dot-containing paths do not correctly receive extension completion. by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2243](https://togithub.com/honojs/hono/pull/2243) - refactor(context): skip jsx type import by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2248](https://togithub.com/honojs/hono/pull/2248) - feat(jsx/dom): support namespace for svg and mathml elements by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2241](https://togithub.com/honojs/hono/pull/2241) **Full Changelog**: honojs/hono@v4.0.4...v4.0.5 ### [`v4.0.4`](https://togithub.com/honojs/hono/releases/tag/v4.0.4) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.3...v4.0.4) #### What's Changed - docs(contribution): add install flag `--frozen-lockfile` by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2229](https://togithub.com/honojs/hono/pull/2229) - refactor(jsx): shorten use hook a bit by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2231](https://togithub.com/honojs/hono/pull/2231) - fix(jsx/dom): fix finding element to insert before by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2230](https://togithub.com/honojs/hono/pull/2230) - feat(jsx): support HtmlEscapedString in html tag function by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2233](https://togithub.com/honojs/hono/pull/2233) - chore(package.json): remove `@edge` for `compute` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2235](https://togithub.com/honojs/hono/pull/2235) - fix(jwt): import cookie helper correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2238](https://togithub.com/honojs/hono/pull/2238) - fix(ssg): path of already extention by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2236](https://togithub.com/honojs/hono/pull/2236) - fix(validator): use the cached content by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2234](https://togithub.com/honojs/hono/pull/2234) **Full Changelog**: honojs/hono@v4.0.3...v4.0.4 ### [`v4.0.3`](https://togithub.com/honojs/hono/releases/tag/v4.0.3) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.2...v4.0.3) #### What's Changed - fix(jsx-renderer): support async component by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2211](https://togithub.com/honojs/hono/pull/2211) - fix(context): Inherit current status if not specified by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2218](https://togithub.com/honojs/hono/pull/2218) - fix(hono-base): custom not found with middleware like compress by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2220](https://togithub.com/honojs/hono/pull/2220) - refactor: jsx streaming by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2216](https://togithub.com/honojs/hono/pull/2216) **Full Changelog**: honojs/hono@v4.0.2...v4.0.3 ### [`v4.0.2`](https://togithub.com/honojs/hono/releases/tag/v4.0.2) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.1...v4.0.2) This is a patch release. But, it includes a minor feature. SSG helper now generates HTML files only if they are handling GET or ALL methods. #### What's Changed - fix: `createHandler` Response Types (handler x1) by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2192](https://togithub.com/honojs/hono/pull/2192) - fix(jsx/dom): Do not call insertBefore if the element position does not change by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2196](https://togithub.com/honojs/hono/pull/2196) - refactor(ssg): filter SSG Route by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2181](https://togithub.com/honojs/hono/pull/2181) - refactor(ssg): check `c.env` variables to disable/enable SSG by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2179](https://togithub.com/honojs/hono/pull/2179) - Fix regex pattern with length limit at replaceUrlParam by [@​the-fukui](https://togithub.com/the-fukui) in [https://github.com/honojs/hono/pull/2193](https://togithub.com/honojs/hono/pull/2193) - docs(readme): tweak by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2204](https://togithub.com/honojs/hono/pull/2204) - fix(router): LinearRouter and PatternRouter support regexp quantifiers by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2209](https://togithub.com/honojs/hono/pull/2209) #### New Contributors - [@​the-fukui](https://togithub.com/the-fukui) made their first contribution in [https://github.com/honojs/hono/pull/2193](https://togithub.com/honojs/hono/pull/2193) **Full Changelog**: honojs/hono@v4.0.1...v4.0.2 ### [`v4.0.1`](https://togithub.com/honojs/hono/releases/tag/v4.0.1) [Compare Source](https://togithub.com/honojs/hono/compare/v4.0.0...v4.0.1) #### What's Changed - fix(context): remove duplicate definition of render method by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2191](https://togithub.com/honojs/hono/pull/2191) - refactor(ssg): create request from saved requestInit in order to avoid memory leak warnings by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2186](https://togithub.com/honojs/hono/pull/2186) - feat(sse): Allow sending retry for SSE connection by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2188](https://togithub.com/honojs/hono/pull/2188) **Full Changelog**: honojs/hono@v4.0.0...v4.0.1 ### [`v4.0.0`](https://togithub.com/honojs/hono/releases/tag/v4.0.0) [Compare Source](https://togithub.com/honojs/hono/compare/v3.12.12...v4.0.0) > Going to full-stack. Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features. 1. Static Site Generation 2. Client Components 3. File-based Routing So Hono is going to full-stack. Let's take a look at the three features. #### 1. Static Site Generation We introduce SSG Helper. With it you can generate static pages of your Hono applications. To use this, create a separate file `build.ts` from the application and call the `toSSG()` function in it. ```ts import fs from 'node:fs/promises' import { toSSG } from 'hono/ssg' import app from './src/index' toSSG(app, fs) ``` There are adapters for Bun and Deno, so you can write shorter for Bun, for example. ```ts import { toSSG } from 'hono/bun' import app from './src/index' toSSG(app) ``` And, just run it. ```ts bun ./build.ts ``` Then HTML is generated. ```txt $ ls static about.html index.html ``` You can easily deploy this page to Cloudflare Pages, etc. ```txt $ wrangler pages deploy static ``` ##### With Vite We have created a plugin [`@hono/vite-ssg`](https://togithub.com/honojs/vite-plugins/tree/main/packages/ssg) for Vite. By using this, you will be able to develop and build a static sites with just the `vite` command. The configuration is the following: ```ts import build from '@​hono/vite-ssg' import devServer from '@​hono/vite-dev-server' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ build(), devServer({ entry: 'src/index.tsx' }) ] }) ``` If you want to develope, just run the command: ```txt vite ``` If you want to build, just run the command: ```txt vite build ``` In combination with the deployment mentioned above to Cloudflare Pages, you can develop, SSG build, and deploy non-stop. And each of them is extremely fast (the video is 2x faster). ![Screen cast](https://togithub.com/honojs/hono/assets/10682/4421cb84-fd04-46a3-a6bf-e955fcbdf388) #### 2. Client Components `hono/jsx` was originally designed to run server-side as an alternative to template engines such as Mustache. Server-side JSX is an interesting experiment, creating a new stack to combine with HTMX and Alpine.js. But that's not all. Now, `hono/jsx` runs on the client as well. We call it `hono/jsx/dom` or Client Components. The exact same code as React runs with Hono's JSX. ```tsx import { useState } from 'hono/jsx' import { render } from 'hono/jsx/dom' function Counter() { const [count, setCount] = useState(0) return ( <div> <p>Count: {count}</p> <button onClick={() => setCount(count + 1)}>Increment</button> </div> ) } function App() { return ( <html> <body> <Counter /> </body> </html> ) } const root = document.getElementById('root') render(<App />, root) ``` The Hooks listed below are also implemented and you can create Client Components just like in React. - useContext - useEffect - useState - useCallback - use - startTransition - useDeferredValue - useMemo - useLayoutEffect - Memo - isValidElement ##### `startViewTransition` family In addition, the original APIs, `startViewTransition` family make the View Transition API easy to use. ```tsx import { useState, startViewTransition } from 'hono/jsx' import { Style, css, keyframes } from 'hono/css' const fadeIn = keyframes` from { opacity: 0; } to { opacity: 1; } ` const App = () => { const [showTitleImage, setShowTitleImage] = useState(false) return ( <> <button onClick={() => startViewTransition(() => setShowTitleImage((state) => !state))}>Click!</button> <div> {!showTitleImage ? ( <img src="https://hono.dev/images/logo.png" /> ) : ( <div class={css` animation: ${fadeIn} 1s; background: url('https://hono.dev/images/logo-large.png'); background-size: contain; background-repeat: no-repeat; background-position: center; width: 500px; height: 200px; `} /> )} </div> </> ) } ``` You can easily create the animation. ![SC](https://togithub.com/honojs/hono/assets/10682/d64b5120-2f31-4227-bcad-19f2d0b2b90a) ##### Ultra-small The `hono/jsx/dom` is fast and ultra-small. It has a smaller JSX runtime dedicated to the DOM in addition to the common server and client ones. Just specify `hono/jsx/dom` instead of `hono/jsx` in `tsconfig.json`. ```json "jsx": "react-jsx", "jsxImportSource": "hono/jsx/dom" ``` The above counter example is **2.8KB** with Brotli compression. ![SS](https://togithub.com/honojs/hono/assets/10682/813ea09e-550d-49f2-bd51-4a205d38dee7) In comparison, React is **47.3 KB** for the same thing. ![SS](https://togithub.com/honojs/hono/assets/10682/915c1894-d993-4a31-b506-e14d2a839171) #### 3. File-based Routing Last is File-based Routing. This is not included in the hono package, but is provided in a separate package. It is named **HonoX**. ##### HonoX HonoX has the following features. - **File-based routing** - You can create a large application like Next.js. - **Fast SSR** - Rendering is ultra-fast thanks to Hono. - **BYOR** - You can bring your own renderer, not only one using hono/jsx. - **Islands hydration** - If you want interactions, create an island. JavaScript is hydrated only for it. - **Middleware** - It works as Hono, so you can use a lot of Hono's middleware. You can try it now. One of create-hono's starter templates named "***x-base***" uses HonoX. For detailed usage, please see the following HonoX repository. https://github.com/honojs/honox #### The core is still tiny The addition of this feature has no impact on the core. "Hello World" in hono/tiny is still small, only 12KB minified. #### Other new features - feat(base): Set Default Path to `'*'` for `app.use()` - [https://github.com/honojs/hono/pull/1753](https://togithub.com/honojs/hono/pull/1753) - feat(hono-base): `app.on` supports multiple paths - [https://github.com/honojs/hono/pull/1923](https://togithub.com/honojs/hono/pull/1923) - feat(css): Introduce pseudo global selector and class name based extend syntax - [https://github.com/honojs/hono/pull/1928](https://togithub.com/honojs/hono/pull/1928) - feat(jsx-renderer): Nested Layouts via Renderer - [https://github.com/honojs/hono/pull/1945](https://togithub.com/honojs/hono/pull/1945) - feat!: validator throws error rathar than return `c.json()` - [https://github.com/honojs/hono/pull/2021](https://togithub.com/honojs/hono/pull/2021) - feat: introduce Accepts Helper - [https://github.com/honojs/hono/pull/2001](https://togithub.com/honojs/hono/pull/2001) - feat(serve-static): `mimes` option for serve-static - [https://github.com/honojs/hono/pull/2094](https://togithub.com/honojs/hono/pull/2094) - feat!(validator): supports transformation - [https://github.com/honojs/hono/pull/2130](https://togithub.com/honojs/hono/pull/2130) #### Breaking Changes There are several breaking changes. Please see the Migration Guide below. https://github.com/honojs/hono/blob/main/docs/MIGRATION.md #### Thanks Thanks to all contributors. Great job on all the hard work! #### All Updates - feat(base): Set Default Path to '\*' for app.use() by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/1753](https://togithub.com/honojs/hono/pull/1753) - feat: Introduce jsx/dom by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1917](https://togithub.com/honojs/hono/pull/1917) - ci: enables CI in the v4 branch by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1933](https://togithub.com/honojs/hono/pull/1933) - feat(hono-base): `app.on` supports multiple paths by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1923](https://togithub.com/honojs/hono/pull/1923) - feat!: remove deprecated features by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1934](https://togithub.com/honojs/hono/pull/1934) - fix(jsx/dom): fix cleanup for deps by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1936](https://togithub.com/honojs/hono/pull/1936) - refactor(jsx/dom): replace existing content by render() by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1938](https://togithub.com/honojs/hono/pull/1938) - feat(css): Introduce pseudo global selector and class name based extend syntax by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1928](https://togithub.com/honojs/hono/pull/1928) - feat: Introducing a New SSG Adaptor/Helper by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/1904](https://togithub.com/honojs/hono/pull/1904) - chore(helper): Add experimental flag the SSG features by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/1967](https://togithub.com/honojs/hono/pull/1967) - refactor: remove unnecessary `import` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1969](https://togithub.com/honojs/hono/pull/1969) - refactor: remove and fix comments by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1970](https://togithub.com/honojs/hono/pull/1970) - ci: remove lagon runtime tests and other lagon things by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1971](https://togithub.com/honojs/hono/pull/1971) - refactor(ssg): SSG works without `node:path` by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/1965](https://togithub.com/honojs/hono/pull/1965) - feat(factory): remove `deprecated` from `Factory` and `createHandlers` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1979](https://togithub.com/honojs/hono/pull/1979) - fix(ssg): fix path parser bug & refactor code by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/1976](https://togithub.com/honojs/hono/pull/1976) - feat(ssg): Implement Dynamic File Extension on MIME Type and Enhanced Response Handling by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/1968](https://togithub.com/honojs/hono/pull/1968) - feat(jsx/dom): rewrite renderer to use virtual tree by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1981](https://togithub.com/honojs/hono/pull/1981) - refactor: faster for loop by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/1989](https://togithub.com/honojs/hono/pull/1989) - feat!(cloudflare-workers): make `manifest` required by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1984](https://togithub.com/honojs/hono/pull/1984) - chore: enables lint and format for `.tsx` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1994](https://togithub.com/honojs/hono/pull/1994) - feat(jsx/dom): provide jsx-runtime and jsx-dev-runtime via jsx/dom by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1986](https://togithub.com/honojs/hono/pull/1986) - fix(types): correct `c.get()` inference by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/1995](https://togithub.com/honojs/hono/pull/1995) - feat(jsx/dom): startTransition() and useTransition() by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1996](https://togithub.com/honojs/hono/pull/1996) - refactor(jsx): export components and hook function from top level 'hono/jsx' by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1997](https://togithub.com/honojs/hono/pull/1997) - feat(ssg): Ignore Dynamic Route by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/1990](https://togithub.com/honojs/hono/pull/1990) - feat: Added `ssgParams` middleware by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/1960](https://togithub.com/honojs/hono/pull/1960) - fix(ssg): fixed `isDynamicRoute` and `ssgParams` matter by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2006](https://togithub.com/honojs/hono/pull/2006) - feat(jsx/dom): support createContext and useContext in jsx/dom by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/1999](https://togithub.com/honojs/hono/pull/1999) - refactor(jsx/dom): make `useTransition()` handling more simple by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2003](https://togithub.com/honojs/hono/pull/2003) - chore(package.json): specify the config in `test:deno` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2014](https://togithub.com/honojs/hono/pull/2014) - chore(runtime-test): add `deno.lock` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2015](https://togithub.com/honojs/hono/pull/2015) - fix(jsx/dom): find "insertBefore" node from next node list if not found by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2017](https://togithub.com/honojs/hono/pull/2017) - feat!: validator throws error rathar than `return c.json()` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2021](https://togithub.com/honojs/hono/pull/2021) - refactor(ssg): Removal of Libraries Dependent on Node.js by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2012](https://togithub.com/honojs/hono/pull/2012) - feat!(deno): move middleware to helper by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2027](https://togithub.com/honojs/hono/pull/2027) - fix(SSG): Correct extension of the file output by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2029](https://togithub.com/honojs/hono/pull/2029) - feat(jsx/dom): Introduce startViewTransition() by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2020](https://togithub.com/honojs/hono/pull/2020) - fix(ssg): Remove ArrayBuffer from FileSystemModule's writeFile by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2032](https://togithub.com/honojs/hono/pull/2032) - refactor(jsx/dom): invoke update() in microtask by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2036](https://togithub.com/honojs/hono/pull/2036) - feat: introduce Accepts Helper by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2001](https://togithub.com/honojs/hono/pull/2001) - feat: improve `ssgParams` flexibility by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2024](https://togithub.com/honojs/hono/pull/2024) - refactor(types): name them `BlankSchema` or `BlankInput` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2040](https://togithub.com/honojs/hono/pull/2040) - feat(deno): export accpet helper for deno by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2041](https://togithub.com/honojs/hono/pull/2041) - docs: Add JSDoc by [@​nabeken5](https://togithub.com/nabeken5) in [https://github.com/honojs/hono/pull/1916](https://togithub.com/honojs/hono/pull/1916) - fix!(types): Fix context type when chaining routes with middlewares by [@​agatan](https://togithub.com/agatan) in [https://github.com/honojs/hono/pull/2046](https://togithub.com/honojs/hono/pull/2046) - refactor: rename accept to accepts by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2063](https://togithub.com/honojs/hono/pull/2063) - fix: use DOCTYPE by default by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2064](https://togithub.com/honojs/hono/pull/2064) - fix(ssg): Uniformly Convert Paths Ending with Slash to 'index.ext' Format by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2056](https://togithub.com/honojs/hono/pull/2056) - feat: Introduce `useViewTransition()` hook and `viewTransition()` helper by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2053](https://togithub.com/honojs/hono/pull/2053) - feat(ssg): support Improve Hook Handling by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2054](https://togithub.com/honojs/hono/pull/2054) - fix: await generate hook by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2074](https://togithub.com/honojs/hono/pull/2074) - fix:(ssg): make 'files' mandatory in ToSSGResult by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2071](https://togithub.com/honojs/hono/pull/2071) - feat(types): explicitly specify statusCode by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2073](https://togithub.com/honojs/hono/pull/2073) - chore: vitest test.pool to 'forks' by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2098](https://togithub.com/honojs/hono/pull/2098) - goodbye: lagon by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2087](https://togithub.com/honojs/hono/pull/2087) - refactor: faster for loop in jsx/dom by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2092](https://togithub.com/honojs/hono/pull/2092) - refactor: "if" on one line and deletion of unneeded variables by [@​EdamAme-x](https://togithub.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2093](https://togithub.com/honojs/hono/pull/2093) - fix: add typesVersions of accepts helper by [@​sor4chi](https://togithub.com/sor4chi) in [https://github.com/honojs/hono/pull/2096](https://togithub.com/honojs/hono/pull/2096) - chore: use Bun as a package manager by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2105](https://togithub.com/honojs/hono/pull/2105) - docs(contributing): add `Installing dependencies` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2113](https://togithub.com/honojs/hono/pull/2113) - feat(serve-static): `mimes` option for serve-static by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2094](https://togithub.com/honojs/hono/pull/2094) - feat(ssg): introduce `disableSSG` and `onlySSG` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2104](https://togithub.com/honojs/hono/pull/2104) - feat!(mime): reduce default mimes by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2119](https://togithub.com/honojs/hono/pull/2119) - feat(types): better `c.var` type by [@​Kyiro](https://togithub.com/Kyiro) in [https://github.com/honojs/hono/pull/2121](https://togithub.com/honojs/hono/pull/2121) - fix(jsx-renderer): correct nested layouts by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2128](https://togithub.com/honojs/hono/pull/2128) - feat!(validator): supports transformation by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2130](https://togithub.com/honojs/hono/pull/2130) - feat(jsx/dom): more react staff by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2132](https://togithub.com/honojs/hono/pull/2132) - refactor(jsx): Remove unused HONO_COMPONENT feature by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2139](https://togithub.com/honojs/hono/pull/2139) - fix(html): Remove circular dependencies in `hono/html` by [@​javascripter](https://togithub.com/javascripter) in [https://github.com/honojs/hono/pull/2143](https://togithub.com/honojs/hono/pull/2143) - Merge main into v4 by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2145](https://togithub.com/honojs/hono/pull/2145) - feat(jsx): "className" is now an alias for "class" by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2146](https://togithub.com/honojs/hono/pull/2146) - fix!(deno): put SSG helper into `helper.ts` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2150](https://togithub.com/honojs/hono/pull/2150) - refactor(jsx): Tidyup the types to be exported by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2151](https://togithub.com/honojs/hono/pull/2151) - fix(types): `MergeSchemePath` infers param types correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2152](https://togithub.com/honojs/hono/pull/2152) - fix(types): `MergeSchemaPath` infer inputs not only params by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2154](https://togithub.com/honojs/hono/pull/2154) - Fix/function for attribute by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2161](https://togithub.com/honojs/hono/pull/2161) - fix(jsx): The third argument of jsx(), key, is optional by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2162](https://togithub.com/honojs/hono/pull/2162) - Feat/more jsx event by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2165](https://togithub.com/honojs/hono/pull/2165) - docs: update the migration guide for releasing v4 by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2159](https://togithub.com/honojs/hono/pull/2159) - perf(mime): make `getExtension()` fast by [@​ryuapp](https://togithub.com/ryuapp) in [https://github.com/honojs/hono/pull/2168](https://togithub.com/honojs/hono/pull/2168) - v4 by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2167](https://togithub.com/honojs/hono/pull/2167) #### New Contributors - [@​EdamAme-x](https://togithub.com/EdamAme-x) made their first contribution in [https://github.com/honojs/hono/pull/1976](https://togithub.com/honojs/hono/pull/1976) - [@​nabeken5](https://togithub.com/nabeken5) made their first contribution in [https://github.com/honojs/hono/pull/1916](https://togithub.com/honojs/hono/pull/1916) - [@​Kyiro](https://togithub.com/Kyiro) made their first contribution in [https://github.com/honojs/hono/pull/2121](https://togithub.com/honojs/hono/pull/2121) - [@​javascripter](https://togithub.com/javascripter) made their first contribution in [https://github.com/honojs/hono/pull/2143](https://togithub.com/honojs/hono/pull/2143) **Full Changelog**: honojs/hono@v3.12.10...v4.0.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone America/Chicago, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/autoblocksai/cli). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNDUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [hono](https://hono.dev/) ([source](https://togithub.com/honojs/hono)) | [`4.1.4` -> `4.2.7`](https://renovatebot.com/diffs/npm/hono/4.1.4/4.2.7) | [![age](https://developer.mend.io/api/mc/badges/age/npm/hono/4.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/hono/4.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/hono/4.1.4/4.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/hono/4.1.4/4.2.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [CVE-2024-32869](https://togithub.com/honojs/hono/security/advisories/GHSA-3mpf-rcc7-5347) ### Summary When using serveStatic with deno, it is possible to directory traverse where main.ts is located. My environment is configured as per this tutorial https://hono.dev/getting-started/deno ### PoC ```bash $ tree . ├── deno.json ├── deno.lock ├── main.ts ├── README.md └── static └── a.txt ``` source ```jsx import { Hono } from 'https://deno.land/x/[email protected]/mod.ts' import { serveStatic } from 'https://deno.land/x/[email protected]/middleware.ts' const app = new Hono() app.use('/static/*', serveStatic({ root: './' })) Deno.serve(app.fetch) ``` request ```bash curl localhost:8000/static/%2e%2e/main.ts ``` response is content of main.ts ### Impact Unexpected files are retrieved. --- ### Release Notes <details> <summary>honojs/hono (hono)</summary> ### [`v4.2.7`](https://togithub.com/honojs/hono/releases/tag/v4.2.7) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.6...v4.2.7) This release fixes "[Restricted Directory Traversal in serveStatic with deno](https://togithub.com/honojs/hono/security/advisories/GHSA-3mpf-rcc7-5347)". **Full Changelog**: honojs/hono@v4.2.6...v4.2.7 ### [`v4.2.6`](https://togithub.com/honojs/hono/releases/tag/v4.2.6) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.5...v4.2.6) #### What's Changed - refactor(adapter/aws): Optimize multiple call of same conditions with polymorphism by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2521](https://togithub.com/honojs/hono/pull/2521) - fix(sse): close sse stream on end by [@​domeccleston](https://togithub.com/domeccleston) in [https://github.com/honojs/hono/pull/2529](https://togithub.com/honojs/hono/pull/2529) - fix(client): Don't show `$ws` when not used WebSockets by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2532](https://togithub.com/honojs/hono/pull/2532) - refactor(ssg): update utils.ts by [@​eltociear](https://togithub.com/eltociear) in [https://github.com/honojs/hono/pull/2519](https://togithub.com/honojs/hono/pull/2519) #### New Contributors - [@​domeccleston](https://togithub.com/domeccleston) made their first contribution in [https://github.com/honojs/hono/pull/2529](https://togithub.com/honojs/hono/pull/2529) - [@​eltociear](https://togithub.com/eltociear) made their first contribution in [https://github.com/honojs/hono/pull/2519](https://togithub.com/honojs/hono/pull/2519) **Full Changelog**: honojs/hono@v4.2.5...v4.2.6 ### [`v4.2.5`](https://togithub.com/honojs/hono/releases/tag/v4.2.5) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.4...v4.2.5) #### What's Changed - fix(client): Allow calling toString and valueOf on the proxy object by [@​ibash](https://togithub.com/ibash) in [https://github.com/honojs/hono/pull/2510](https://togithub.com/honojs/hono/pull/2510) - fix(adapter): handle multi value headers in AWS Lambda by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2494](https://togithub.com/honojs/hono/pull/2494) - fix(client): shuold not remove tailing slash from top-level URL by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2523](https://togithub.com/honojs/hono/pull/2523) - fix(jsx/dom): remove lookbehind assertion in event regexp by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2524](https://togithub.com/honojs/hono/pull/2524) #### New Contributors - [@​ibash](https://togithub.com/ibash) made their first contribution in [https://github.com/honojs/hono/pull/2510](https://togithub.com/honojs/hono/pull/2510) **Full Changelog**: honojs/hono@v4.2.4...v4.2.5 ### [`v4.2.4`](https://togithub.com/honojs/hono/releases/tag/v4.2.4) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.3...v4.2.4) ##### What's Changed - fix(jwt): Make JWT Header `typ` Field Optional to Enhance Compatibility by [@​naporin0624](https://togithub.com/naporin0624) in [https://github.com/honojs/hono/pull/2488](https://togithub.com/honojs/hono/pull/2488) - fix(testing): set `baseUrl` for `testClient` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2496](https://togithub.com/honojs/hono/pull/2496) - fix(validator): Default use to `OutputTypeExcludeResponseType` when `InputType` is unknown by [@​nagasawaryoya](https://togithub.com/nagasawaryoya) in [https://github.com/honojs/hono/pull/2500](https://togithub.com/honojs/hono/pull/2500) - refactor(trie-router): parentPatterns is updated but never queried by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2503](https://togithub.com/honojs/hono/pull/2503) - refactor: Remove redundant initializer by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2502](https://togithub.com/honojs/hono/pull/2502) - refactor(cloudflare-workers): Suppress eslint noise by [@​exoego](https://togithub.com/exoego) in [https://github.com/honojs/hono/pull/2504](https://togithub.com/honojs/hono/pull/2504) - fix(jsx): Add catch to async function's promise by [@​mwilkins91](https://togithub.com/mwilkins91) in [https://github.com/honojs/hono/pull/2471](https://togithub.com/honojs/hono/pull/2471) ##### New Contributors - [@​nagasawaryoya](https://togithub.com/nagasawaryoya) made their first contribution in [https://github.com/honojs/hono/pull/2500](https://togithub.com/honojs/hono/pull/2500) - [@​exoego](https://togithub.com/exoego) made their first contribution in [https://github.com/honojs/hono/pull/2503](https://togithub.com/honojs/hono/pull/2503) - [@​mwilkins91](https://togithub.com/mwilkins91) made their first contribution in [https://github.com/honojs/hono/pull/2471](https://togithub.com/honojs/hono/pull/2471) **Full Changelog**: honojs/hono@v4.2.3...v4.2.4 ### [`v4.2.3`](https://togithub.com/honojs/hono/releases/tag/v4.2.3) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.2...v4.2.3) #### What's Changed - fix(ssg): use response header to mark as disabled routes for SSG by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2477](https://togithub.com/honojs/hono/pull/2477) - fix(trailing-slash): export types in `package.json` correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2483](https://togithub.com/honojs/hono/pull/2483) - fix(client): fix websocket client protocol by [@​naporin0624](https://togithub.com/naporin0624) in [https://github.com/honojs/hono/pull/2479](https://togithub.com/honojs/hono/pull/2479) **Full Changelog**: honojs/hono@v4.2.2...v4.2.3 ### [`v4.2.2`](https://togithub.com/honojs/hono/releases/tag/v4.2.2) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.1...v4.2.2) #### What's Changed - feat(jsx-renderer): pass the context as 2nd arg by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2459](https://togithub.com/honojs/hono/pull/2459) - feat(client): accept a function that provides dynamic headers to hc by [@​niko-gardenanet](https://togithub.com/niko-gardenanet) in [https://github.com/honojs/hono/pull/2461](https://togithub.com/honojs/hono/pull/2461) - fix(client): infer `null` correctly by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2469](https://togithub.com/honojs/hono/pull/2469) #### New Contributors - [@​niko-gardenanet](https://togithub.com/niko-gardenanet) made their first contribution in [https://github.com/honojs/hono/pull/2461](https://togithub.com/honojs/hono/pull/2461) **Full Changelog**: honojs/hono@v4.2.1...v4.2.2 ### [`v4.2.1`](https://togithub.com/honojs/hono/releases/tag/v4.2.1) [Compare Source](https://togithub.com/honojs/hono/compare/v4.2.0...v4.2.1) #### What's Changed - fix(jws): Only import necessary helper (not all helpers) by [@​nicksrandall](https://togithub.com/nicksrandall) in [https://github.com/honojs/hono/pull/2458](https://togithub.com/honojs/hono/pull/2458) #### New Contributors - [@​nicksrandall](https://togithub.com/nicksrandall) made their first contribution in [https://github.com/honojs/hono/pull/2458](https://togithub.com/honojs/hono/pull/2458) **Full Changelog**: honojs/hono@v4.2.0...v4.2.1 ### [`v4.2.0`](https://togithub.com/honojs/hono/releases/tag/v4.2.0) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.7...v4.2.0) Hono v4.2.0 is now available! Let's take a look at the new features. #### Added more algorithms for JWT The number of algorithms that JWT util can handle has increased from only 3 to 13! This means that JWT util now implements many of the algorithms supported by JWT. - HS256 - HS384 - HS512 - RS256 - RS384 - RS512 - PS256 - PS384 - PS512 - ES256 - ES384 - ES512 - EdDSA You can use these algorithms from the JWT middleware or JWT helpers. Thanks [@​Code-Hex](https://togithub.com/Code-Hex)! #### Method Override Middleware [Method Override Middleware](https://hono.dev/middleware/builtin/method-override) has been added. This middleware override the method of the real request with the specified method. HTML `form` does not allow you to send a DELETE method request. Instead, by sending an input with `name` as `_method` and a value of `DELETE`, you can call the handler registered in `app.delete()`. ```ts const app = new Hono() // If no options are specified, the value of `_method` in the form, // e.g. DELETE, is used as the method. app.use('/posts', methodOverride({ app })) app.delete('/posts', (c) => { // .... }) ``` #### Trailing Slash Middleware [Trailing Slash Middleware](https://hono.dev/middleware/builtin/trailing-slash) resolves the handling of Trailing Slashes in GET requests. You can use `appendTrailingSlash` and `trimTrailingSlash` functions. For example, it redirects a GET request to `/about/me` to `/about/me/`. ```ts import { Hono } from 'hono' import { appendTrailingSlash } from 'hono/trailing-slash' const app = new Hono({ strict: true }) app.use(appendTrailingSlash()) app.get('/about/me/', (c) => c.text('With Trailing Slash')) ``` Thanks [@​rnmeow](https://togithub.com/rnmeow)! #### Other features - SSG Helper - Support `extensionMap` [https://github.com/honojs/hono/pull/2382](https://togithub.com/honojs/hono/pull/2382) - JSX/DOM - Add `userId` hook [https://github.com/honojs/hono/pull/2389](https://togithub.com/honojs/hono/pull/2389) - JWT Middleware - Improve error handling [https://github.com/honojs/hono/pull/2406](https://togithub.com/honojs/hono/pull/2406) - Request - Cache the body for re-using [https://github.com/honojs/hono/pull/2416](https://togithub.com/honojs/hono/pull/2416) - JWT Util - Add type helper to `payload` [https://github.com/honojs/hono/pull/2424](https://togithub.com/honojs/hono/pull/2424) - CORS Middleware - Pass context to `options.origin` function [https://github.com/honojs/hono/pull/2436](https://togithub.com/honojs/hono/pull/2436) - Cache Middleware - Support for the `vary` header option [https://github.com/honojs/hono/pull/2426](https://togithub.com/honojs/hono/pull/2426) - HTTP Exception - Add `cause` option [https://github.com/honojs/hono/pull/2224](https://togithub.com/honojs/hono/pull/2224) - Logger - Support `NO_COLOR` [https://github.com/honojs/hono/pull/2228](https://togithub.com/honojs/hono/pull/2228) - JWT Middleware - Add `JwtTokenInvalid` object as `cause` when JWT is invalid [https://github.com/honojs/hono/pull/2448](https://togithub.com/honojs/hono/pull/2448) - Bearer Auth Middleware - Add `verifyToken` option [https://github.com/honojs/hono/pull/2449](https://togithub.com/honojs/hono/pull/2449) - Basic Auth Middleware - Add `verifyUser` option [https://github.com/honojs/hono/pull/2450](https://togithub.com/honojs/hono/pull/2450) #### All Updates - feat(jwt): supported RS256, RS384, RS512 algorithm for JWT by [@​Code-Hex](https://togithub.com/Code-Hex) in [https://github.com/honojs/hono/pull/2339](https://togithub.com/honojs/hono/pull/2339) - added remain algorithm for JWT by [@​Code-Hex](https://togithub.com/Code-Hex) in [https://github.com/honojs/hono/pull/2352](https://togithub.com/honojs/hono/pull/2352) - acceptable CryptoKey in JWT sign and verify by [@​Code-Hex](https://togithub.com/Code-Hex) in [https://github.com/honojs/hono/pull/2373](https://togithub.com/honojs/hono/pull/2373) - feat(ssg): Support `extentionMap` by [@​watany-dev](https://togithub.com/watany-dev) in [https://github.com/honojs/hono/pull/2382](https://togithub.com/honojs/hono/pull/2382) - feat(jwt): support remaining algorithms by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2368](https://togithub.com/honojs/hono/pull/2368) - feat(jsx): add useId hook by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/2389](https://togithub.com/honojs/hono/pull/2389) - feat(middleware/jwt): improve error handling by [@​tfkhdyt](https://togithub.com/tfkhdyt) in [https://github.com/honojs/hono/pull/2406](https://togithub.com/honojs/hono/pull/2406) - feat(request): cache body for reusing by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2416](https://togithub.com/honojs/hono/pull/2416) - feat(jwt): Add type helper to `payload` by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2424](https://togithub.com/honojs/hono/pull/2424) - feat: introduce Method Override Middleware by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2420](https://togithub.com/honojs/hono/pull/2420) - feat(middleware/cors): pass context to options.origin function by [@​okmr-d](https://togithub.com/okmr-d) in [https://github.com/honojs/hono/pull/2436](https://togithub.com/honojs/hono/pull/2436) - feat: support for `vary` header in cache middleware by [@​naporin0624](https://togithub.com/naporin0624) in [https://github.com/honojs/hono/pull/2426](https://togithub.com/honojs/hono/pull/2426) - feat: add middlewares resolve trailing slashes on GET request by [@​rnmeow](https://togithub.com/rnmeow) in [https://github.com/honojs/hono/pull/2408](https://togithub.com/honojs/hono/pull/2408) - test: stub `crypto` if not exist by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2445](https://togithub.com/honojs/hono/pull/2445) - feat(jwt): literal typed `alg` option value by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2446](https://togithub.com/honojs/hono/pull/2446) - test(ssg): add test for content-type includes `;` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2447](https://togithub.com/honojs/hono/pull/2447) - feat(jwt): add `JwtTokenInvalid` object as `cause` when JWT is invalid by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2448](https://togithub.com/honojs/hono/pull/2448) - feat(bearer-auth): add `verifyToken` option by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2449](https://togithub.com/honojs/hono/pull/2449) - feat(basic-auth): add `verifyUser` option by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2450](https://togithub.com/honojs/hono/pull/2450) - Next by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2454](https://togithub.com/honojs/hono/pull/2454) #### New Contributors - [@​tfkhdyt](https://togithub.com/tfkhdyt) made their first contribution in [https://github.com/honojs/hono/pull/2406](https://togithub.com/honojs/hono/pull/2406) - [@​okmr-d](https://togithub.com/okmr-d) made their first contribution in [https://github.com/honojs/hono/pull/2436](https://togithub.com/honojs/hono/pull/2436) - [@​naporin0624](https://togithub.com/naporin0624) made their first contribution in [https://github.com/honojs/hono/pull/2426](https://togithub.com/honojs/hono/pull/2426) - [@​rnmeow](https://togithub.com/rnmeow) made their first contribution in [https://github.com/honojs/hono/pull/2408](https://togithub.com/honojs/hono/pull/2408) **Full Changelog**: honojs/hono@v4.1.7...v4.2.0 ### [`v4.1.7`](https://togithub.com/honojs/hono/releases/tag/v4.1.7) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.6...v4.1.7) #### What's Changed - fix(cache): check `globalThis.caches` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2444](https://togithub.com/honojs/hono/pull/2444) **Full Changelog**: honojs/hono@v4.1.6...v4.1.7 ### [`v4.1.6`](https://togithub.com/honojs/hono/releases/tag/v4.1.6) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.5...v4.1.6) #### What's Changed - chore(benchmark): add "loop" script by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2431](https://togithub.com/honojs/hono/pull/2431) - fix(cache): not enabled if `caches` is not defined by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2443](https://togithub.com/honojs/hono/pull/2443) **Full Changelog**: honojs/hono@v4.1.5...v4.1.6 ### [`v4.1.5`](https://togithub.com/honojs/hono/releases/tag/v4.1.5) [Compare Source](https://togithub.com/honojs/hono/compare/v4.1.4...v4.1.5) #### What's Changed - perf: Don't use `Arrap.prototype.map` if it is not needed return value by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/2419](https://togithub.com/honojs/hono/pull/2419) - fix(aws-lambda): handle response without body ([#​2401](https://togithub.com/honojs/hono/issues/2401)) by [@​KnisterPeter](https://togithub.com/KnisterPeter) in [https://github.com/honojs/hono/pull/2413](https://togithub.com/honojs/hono/pull/2413) - fix(validator): `await` cached contents by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/2430](https://togithub.com/honojs/hono/pull/2430) #### New Contributors - [@​KnisterPeter](https://togithub.com/KnisterPeter) made their first contribution in [https://github.com/honojs/hono/pull/2413](https://togithub.com/honojs/hono/pull/2413) **Full Changelog**: honojs/hono@v4.1.4...v4.1.5 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "" in timezone America/Chicago, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/autoblocksai/cli). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Can we please add this to the Hono docs at (https://hono.dev/docs/middleware/builtin/logger)? # Tip
To disable _status code coloring_, you can set a "NO_COLOR" environment variable. This is described at (https://no-color.org/). |
Adding this to the docs is a good idea. If so, we have to write the caution that it does not work on environments such as Cloudflare, which does not support @StuartMoncrieff Can you create a PR for it on honojs/website? That will be helpful. |
Related: #2007
This PR adds
utils/colors.ts
.We have to support
NO_COLOR
.Author should do the followings, if applicable
yarn denoify
to generate files for Deno