Releases: honojs/hono
v2.1.1
v2.1.0
BREAKING CHANGES
This release has the breaking changes. Please see the migration guide for more detail:
Summary
- TrieRouter is 9~10% faster.
- Enable adding types to
c.set
/c.get
by passing the Generics tonew Hono
. #472 c.req.parseBody
parses only FormData. Does not parse JSON, text, or ArrayBuffer. #487
Types for c.set/c.get
Now, we can add the types to the variables used in c.set
and c.get
. new Hono
receive the Generics for the variables and bindings which is for environment variables for Cloudflare Workers.
type Bindings = {
KV: KVNamespace
Storage: R2Bucket
}
type WebClient = {
user: string
pass: string
}
type Variables = {
client: WebClient
}
const app = new Hono<{ Variables: Variables; Bindings: Bindings }>()
app.get('/foo', (c) => {
const client = c.get('client') // client is WebClient
const kv = c.env.KV // kv is KVNamespace
//...
})
c.req.parseBody
Now, c.req.parseBody
has become only for parsing FormData. We have to parse the request body explicitly.
// `multipart/form` or `application/x-www-form-urlencoded`
const data = await c.req.parseBody()
const jsonData = await c.req.json() // for JSON body
const text = await c.req.text() // for text body
const arrayBuffer = await c.req.arrayBuffer() // for ArrayBuffer
What's Changed
- perf(trie-router): fine tuning, 9~10% faster by @yusukebe in #473
- fix(context): export
ContextVariableMap
correctly by @yusukebe in #476 - feat(types): enable adding Types for variables used in
c.set
/c.get
by @yusukebe in #478 - fix: enable passing Generics to c.req.parseBody, default is any by @yusukebe in #481
- docs(readme): add discord and twitter links by @yusukebe in #485
- [BREAKING] fix: make that
c.req.parseBody
parses onlyFormData
by @yusukebe in #487
Full Changelog: v2.0.9...v2.1.0
v2.0.9
Summary
Performance improvement - We have revised the await/async process so that it is faster in some situations.
It has been 8-9% faster in the benchmark:
hono - trie-router(default) x 393,919 ops/sec ±4.52% (86 runs sampled)
hono - regexp-router x 478,140 ops/sec ±2.85% (83 runs sampled)
hono optimized - trie-router(default) x 427,940 ops/sec ±4.32% (81 runs sampled)
hono optimized - regexp-router x 512,488 ops/sec ±5.28% (75 runs sampled)
Fastest is hono optimized - regexp-router
✨ Done in 28.36s.
On Bun, it has been 15% faster.
Before: Requests/sec: 57043.0018
After: Requests/sec: 65658.9860
What's Changed
- fix(context): fixed
ContextVariableMap
is not enabled in built code by @yusukebe in #465 - perf(compose): optimize
await
by @yusukebe in #466 - docs(readme): update benchmark results by @yusukebe in #467
- chore: add
FUNDING.yml
by @yusukebe in #468 - fix(compose): Support a handler that non-async and returning a promise. by @usualoma in #469
Full Changelog: v2.0.8...v2.0.9
v2.0.8
Summary
Mostly bug fixes:
- Fixed errors for ETag Middleware. There was a bug returning a server error when the file size is too large.
- Fixed Context header values "shifting". Sometimes, the values were not correct.
What's Changed
- refactor(compose): cache length by @yusukebe in #460
- fix(ETag): fixed an error when the file size is too large. by @yusukebe in #461
- refactor(mime): made
.ico
file's extension toimage/x-icon
by @yusukebe in #462 - fix(context): fix header values shifting by @yusukebe in #463
Full Changelog: v2.0.7...v2.0.8
v2.0.7
Summary
- JSX Middleware performance tuning.
- A token in the cookie is enabled for JWT Middleware.
- Fixed the bug for ETag Middleware.
What's Changed
- feat(jwt): enable token in cookie by @metrue in #441
- perf(jsx): JSX performance improvement by @usualoma in #444
- refactor(jsx): Support all the boolean attributes. by @usualoma in #446
- refactor: make
parsedBody
type asBody
by @yusukebe in #448 - refactor(
utils/html
): renameBuffer
toStringBuffer
by @yusukebe in #449 - fix(
utils/crypto
): stringify the parameter which is object increateHash
by @yusukebe in #452 - refactor: add
Json
type for JSON object by @yusukebe in #453 - fix(utils/crypto): make Binary and JSON object crypto correct by @yusukebe in #454
Full Changelog: v2.0.6...v2.0.7
v2.0.6
What's Changed
Added
Changed
- fix(jsx): Fix for JSX checked and selected props by @digitalmio in #430
Fixed
Others
New Contributors
- @digitalmio made their first contribution in #430
Full Changelog: v2.0.5...v2.0.6
v2.0.5
v2.0.4
v2.0.3
What's Changed
Added
- feat(middleware): implement Cache Middleware by @yusukebe in #417
- feat(jsx): support
jsxImportSource
by @yusukebe in #420
Fixed
- fix(package.json): export compress middleware by @yusukebe in #409
- fix(trie-router): fix the rule for capturing named parameters by @yusukebe in #419
Others
Full Changelog: v2.0.2...v2.0.3
v2.0.2
What's Changed
Changed
- Update context.ts by @bkniffler in #402
Fixed
- Pass path to serve-static middleware when using cloudflare module workers by @raytracer in #400
- fix(logger): specify
console.log
for default print fn by @yusukebe in #401
Others
- chore: add conf file to categorize the PRs on release note by @yusukebe in #404
- docs: rename
master
tomain
and remove README from middlewre directories by @yusukebe in #405
New Contributors
- @raytracer made their first contribution in #400
- @bkniffler made their first contribution in #402
Full Changelog: v2.0.1...v2.0.2