Packages

hono

4.13.19 · 16 Nov 2026MIT113.6M / weekRepositoryHomepagenpmAtom feed

Your version

1.4.7

13 Jun 2022Where it was published

1.6.4 is the newest release of 1.x.

In short

4 breaking1 new

  • Breaking

    This release includes BREAKING CHANGES.

  • Breaking

    h is obsolete, removed. Use jsx instead.

  • Breaking

    Don't write app.use('*', jsx()). It's not needed.

  • Breaking

    If you want to return HTML, use c.html()

Security

44 advisories affect 1.4.7; 4.13.16 fixes them

39 more

Release note

Summary

This release includes BREAKING CHANGES.

[BREAKING CHANGES] JSX Middleware

  • Breaking

    h is obsolete, removed. Use jsx instead.

  • Breaking

    Don't write app.use('*', jsx()). It's not needed.

  • Breaking

    If you want to return HTML, use c.html()

You can write as below:

import { Hono } from 'hono'
import { jsx } from 'hono/jsx'

const app = new Hono()

app.get('/', (c) => {
  return c.html(
    '<!doctype html>' +
    (
      <html>
        <body>
          <p>Hono!</p>
        </body>
      </html>
    )
  )
})

app.fire()

html Middleware

We've added html Middleware. It's powerful to use with JSX middleware. For more information, see documentation

import { Hono } from 'hono'
import { html } from 'hono/html'
import { jsx } from 'hono/jsx'

const app = new Hono()

interface SiteData {
  title: string
  children?: any
}

const Layout = (props: SiteData) => html`<!DOCTYPE html>
  <html>
    <head>
      <title>${props.title}</title>
    </head>
    <body>
      ${props.children}
    </body>
  </html>`

const Content = (props: { siteData: SiteData; name: string }) => (
  <Layout {...props.siteData}>
    <h1>Hello {props.name}</h1>
  </Layout>
)

app.get('/:name', (c) => {
  const { name } = c.req.param()
  const props = {
    name: name,
    siteData: {
      title: 'JSX with html sample',
    },
  }
  return c.html(<Content {...props} />)
})

app.fire()

Others

  • Implemented Fragment for JSX middleware.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.