Skip to content

Releases: honojs/hono

v4.1.5

27 Mar 22:33
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v4.1.4...v4.1.5

v4.1.4

25 Mar 07:54
Compare
Choose a tag to compare

What's Changed

  • fix(jsx): allow null, undefined, and boolean as children by @usualoma in #2394
  • fix(reg-exp-router): escape meta characters for find middleware by @usualoma in #2411
  • refactor(types): optimize inferring handler types by @yusukebe in #2412

Full Changelog: v4.1.3...v4.1.4

v4.1.3

20 Mar 12:58
Compare
Choose a tag to compare

What's Changed

  • fix(deno): export jwt helpers for Deno in src/helper.ts by @yusukebe in #2385
  • fix(jsx): use self closing tag only if element has no children by @usualoma in #2384
  • feat(ssg): Support asynchronous hooks by @watany-dev in #2381
  • fix(validator): use cached body for json and form validation by @yusukebe in #2392
  • fix(jsx): escape attribute value for "style" by @usualoma in #2390

Full Changelog: v4.1.2...v4.1.3

v4.1.2

18 Mar 21:03
Compare
Choose a tag to compare

What's Changed

  • feat(utils/cookie): Typesafe cookie options by @Jxck in #2350
  • fix(router): accept reg exp meta characters in path by @usualoma in #2375
  • perf(utils/url): use slice + indexOf for getPath() by @yusukebe in #2376
  • fix(router): wildcard paths when using js reserved words (like constructor and proto) by @lmcarreiro in #2357
  • fix(types): MergePath merge blank paths correctly by @yusukebe in #2365

New Contributors

Full Changelog: v4.1.1...v4.1.2

v4.1.1

17 Mar 00:51
Compare
Choose a tag to compare

What's Changed

  • fix(context): export ExecutionContext from hono by @yusukebe in #2346
  • fix(client): Remove trailing slash from /index for precise path matching by @poteboy in #2344
  • ci: fix bun version for denoify by @yusukebe in #2362
  • refactor(jsx-renderer): remove unnecessary comments for eslint by @yusukebe in #2361
  • fix(lambda-edge): Lambda@Edge GET/HEAD body error. by @trkbt10 in #2351
  • fix(jsx-renderer): don't overwrite headers if stream is true by @yusukebe in #2363
  • fix(context): set headers correctly if it has this.#headers by @yusukebe in #2364
  • fix(streaming): Fix stream SSE, not necessary close stream. by @damianpumar in #2320

New Contributors

Full Changelog: v4.1.0...v4.1.1

v4.1.0

11 Mar 16:00
Compare
Choose a tag to compare

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, you can easily handle WebSockets in your application. Currently, Cloudflare Workers / Pages, Deno, and Bun adapters are available.

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

Thanks @nakasyou!

Body Limit Middleware

Introducing Body Limit Middleware. This middleware can limit the file size of the request body.

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 and @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.

// ES2020
hono => Total Upload: 20.15 KiB / gzip: 7.42 KiB
hono/tiny => Total Upload: 12.74 KiB / gzip: 4.69 KiB
// 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

Other features

  • Cookie Helper - Supports __Secure- and __Host- prefix #2269
  • Cookie Helper - Check bis condition #2314
  • jsx/dom - Add more React staff #2197
  • SSG - Generate files concurrently #2187
  • HTTP Exception - Add cause option #2224
  • Logger - Support NO_COLOR #2228

All Updates

New Contributors

Full Changelog: v4.0.10...v4.1.0

v4.0.10

05 Mar 22:28
Compare
Choose a tag to compare

What's Changed

  • fix (jsx/dom): keep ref.current value during lifecycle. by @usualoma in #2307

Full Changelog: v4.0.9...v4.0.10

v4.1.0-rc.1

04 Mar 13:22
Compare
Choose a tag to compare
v4.1.0-rc.1 Pre-release
Pre-release

This is a pre-release.

v4.0.9

03 Mar 05:20
Compare
Choose a tag to compare

What's Changed

Full Changelog: v4.0.8...v4.0.9

v4.0.8

28 Feb 08:40
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v4.0.7...v4.0.8