Skip to content

Releases: honojs/hono

v2.1.1

27 Aug 15:00
Compare
Choose a tag to compare

Summary

This is a patch release. Fixed type errors.

What's Changed

  • fix(type): fix type errors for Bindings and Variables by @yusukebe in #488

Full Changelog: v2.1.0...v2.1.1

v2.1.0

27 Aug 06:55
Compare
Choose a tag to compare

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 to new 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 only FormData by @yusukebe in #487

Full Changelog: v2.0.9...v2.1.0

v2.0.9

18 Aug 22:42
Compare
Choose a tag to compare

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

10 Aug 12:56
Compare
Choose a tag to compare

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 to image/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

06 Aug 21:53
Compare
Choose a tag to compare

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 as Body by @yusukebe in #448
  • refactor(utils/html): rename Buffer to StringBuffer by @yusukebe in #449
  • fix(utils/crypto): stringify the parameter which is object in createHash 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

31 Jul 13:23
Compare
Choose a tag to compare

What's Changed

Added

  • feat(context): Introduce ContextVariableMap. by @usualoma in #429

Changed

Fixed

  • fix(parseBody): return blank object when JSON body is nothing by @yusukebe in #433

Others

New Contributors

Full Changelog: v2.0.5...v2.0.6

v2.0.5

24 Jul 11:47
Compare
Choose a tag to compare

Sorry for the repeated releases.

What's Changed

Fixed

Full Changelog: v2.0.4...v2.0.5

v2.0.4

24 Jul 09:14
Compare
Choose a tag to compare

What's Changed

Fixed

  • fix(package.json): fix path for exporting jsx/jsx-runtime types by @yusukebe in #421

Full Changelog: v2.0.3...v2.0.4

v2.0.3

24 Jul 08:49
Compare
Choose a tag to compare

What's Changed

Added

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

18 Jul 03:31
Compare
Choose a tag to compare

What's Changed

Changed

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 to main and remove README from middlewre directories by @yusukebe in #405

New Contributors

Full Changelog: v2.0.1...v2.0.2