honojs/hono (hono)
### [`v4.6.1`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.1)
#### What's Changed
- fix(build): improve addExtension esbuild plugin by [@kt3k](https://redirect.github.com/kt3k) in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405)
#### New Contributors
- [@kt3k](https://redirect.github.com/kt3k) made their first contribution in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405)
**Full Changelog**: https://github.com/honojs/hono/compare/v4.6.0...v4.6.1
### [`v4.6.0`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.0)
[Compare Source](https://redirect.github.com/honojs/hono/compare/v4.5.11...v4.6.0)
Hono v4.6.0 is now available!
One of the highlights of this release is the **Context Storage Middleware**. Let's introduce it.
#### Context Storage Middleware
Many users may have been waiting for this feature. The [**Context Storage Middleware**](https://hono.dev/docs/middleware/builtin/context-storage) uses `AsyncLocalStorage` to allow handling of the current Context object even outside of handlers.
For example, let’s define a Hono app with a variable `message: string`.
```ts
type Env = {
Variables: {
message: string
}
}
const app = new Hono()
```
To enable Context Storage Middleware, register `contextStorage()` as middleware at the top and set the `message` value.
```ts
import { contextStorage } from 'hono/context-storage'
//...
app.use(contextStorage())
app.use(async (c, next) => {
c.set('message', 'Hello!')
await next()
})
```
`getContext()` returns the current Context object, allowing you to get the value of the `message` variable outside the handler.
```ts
import { getContext } from 'hono/context-storage'
app.get('/', (c) => {
return c.text(getMessage())
})
// Access the variable outside the handler.
const getMessage = () => {
return getContext().var.message
}
```
In the case of Cloudflare Workers, you can also access the `Bindings` outside the handler by using this middleware.
```ts
type Env = {
Bindings: {
KV: KVNamespace
}
}
const app = new Hono()
app.use(contextStorage())
const setKV = (value: string) => {
return getContext().env.KV.put('key', value)
}
```
Thanks [@marceloverdijk](https://redirect.github.com/marceloverdijk) !
#### New features
- feat(secureHeader): add Permissions-Policy header to secure headers middleware [https://github.com/honojs/hono/pull/3314](https://redirect.github.com/honojs/hono/pull/3314)
- feat(cloudflare-pages): enable `c.env.eventContext` in handleMiddleware [https://github.com/honojs/hono/pull/3332](https://redirect.github.com/honojs/hono/pull/3332)
- feat(websocket): Add generics type to `WSContext` [https://github.com/honojs/hono/pull/3337](https://redirect.github.com/honojs/hono/pull/3337)
- feat(jsx-renderer): set `Content-Encoding` when `stream` is true [https://github.com/honojs/hono/pull/3355](https://redirect.github.com/honojs/hono/pull/3355)
- feat(serveStatic): add `precompressed` option [https://github.com/honojs/hono/pull/3366](https://redirect.github.com/honojs/hono/pull/3366)
- feat(helper/streaming): Support `Promise` or (async) `JSX.Element` in `streamSSE` [https://github.com/honojs/hono/pull/3344](https://redirect.github.com/honojs/hono/pull/3344)
- feat(context): make fetch Response headers mutable [https://github.com/honojs/hono/pull/3318](https://redirect.github.com/honojs/hono/pull/3318)
- feat(serve-static): add `onFound` option [https://github.com/honojs/hono/pull/3396](https://redirect.github.com/honojs/hono/pull/3396)
- feat(basic-auth): added custom response message option [https://github.com/honojs/hono/pull/3371](https://redirect.github.com/honojs/hono/pull/3371)
- feat(bearer-auth): added custom response message options [https://github.com/honojs/hono/pull/3372](https://redirect.github.com/honojs/hono/pull/3372)
#### Other changes
- chore(jsx-renderer): fix typo in JSDoc by [@taga3s](https://redirect.github.com/taga3s) in [https://github.com/honojs/hono/pull/3378](https://redirect.github.com/honojs/hono/pull/3378)
- chore(deno): use the latest jsr libraries for testing by [@ryuapp](https://redirect.github.com/ryuapp) in [https://github.com/honojs/hono/pull/3375](https://redirect.github.com/honojs/hono/pull/3375)
- fix(secure-headers): optimize getPermissionsPolicyDirectives function by [@kbkn3](https://redirect.github.com/kbkn3) in [https://github.com/honojs/hono/pull/3398](https://redirect.github.com/honojs/hono/pull/3398)
- fix(bearer-auth): typo by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3404](https://redirect.github.com/honojs/hono/pull/3404)
#### New Contributors
- [@kbkn3](https://redirect.github.com/kbkn3) made their first contribution in [https://github.com/honojs/hono/pull/3314](https://redirect.github.com/honojs/hono/pull/3314)
- [@hayatosc](https://redirect.github.com/hayatosc) made their first contribution in [https://github.com/honojs/hono/pull/3337](https://redirect.github.com/honojs/hono/pull/3337)
- [@inetol](https://redirect.github.com/inetol) made their first contribution in [https://github.com/honojs/hono/pull/3366](https://redirect.github.com/honojs/hono/pull/3366)
**Full Changelog**: https://github.com/honojs/hono/compare/v4.5.11...v4.6.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ 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.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
^4.5.11
->^4.6.1
Release Notes
honojs/hono (hono)
### [`v4.6.1`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.1) #### What's Changed - fix(build): improve addExtension esbuild plugin by [@kt3k](https://redirect.github.com/kt3k) in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405) #### New Contributors - [@kt3k](https://redirect.github.com/kt3k) made their first contribution in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.0...v4.6.1 ### [`v4.6.0`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.0) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.5.11...v4.6.0) Hono v4.6.0 is now available! One of the highlights of this release is the **Context Storage Middleware**. Let's introduce it. #### Context Storage Middleware Many users may have been waiting for this feature. The [**Context Storage Middleware**](https://hono.dev/docs/middleware/builtin/context-storage) uses `AsyncLocalStorage` to allow handling of the current Context object even outside of handlers. For example, let’s define a Hono app with a variable `message: string`. ```ts type Env = { Variables: { message: string } } const app = new HonoConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ 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.
This PR was generated by Mend Renovate. View the repository job log.