Skip to content

v0.6.0

Choose a tag to compare

@sbesh91 sbesh91 released this 15 Jun 01:40
· 10 commits to main since this release
7ff87e6

hono-preact v0.6.0: release notes

Released: 2026-06-14

v0.6.0 is the largest release since the framework's first cut. It lands the
backlog from the primitives DX review: a client-navigation toolkit, typed route
params, single-source page guards, a form lifecycle, a content-glob route
helper, an LLM-facing documentation layer, and a hardened public/internal
boundary. It carries a handful of breaking changes, all small and mechanical to
migrate.

It also debuts a companion package: hono-preact-ui@0.1.0, a standalone
library of unstyled, accessible Preact UI primitives (Dialog, Popover, Tooltip,
Menu, Context Menu, Select, Combobox). It versions independently and is released
on its own line; see its own notes.

Highlights

Client navigation toolkit

Three additions make in-app navigation a first-class, typed concern:

  • useNavigate() returns an imperative navigate(href, options) for navigating
    from event handlers and effects, not just <a> clicks.
  • usePrefetch() (and the standalone prefetch()) warm a route's code and
    loader data on intent, for example on link hover or focus, so the destination
    is ready before the click.
  • Active-route detection: useRouteMatch() and useRouteActive() report
    whether a route is current (with exact/nested options), and NavLink is a
    link that styles itself from that state.

Typed route params

useParams() reads the current route's params, and defineLoader(routeId) /
serverRoute type a loader against the params its route actually declares. The
typing is pure type-level inference keyed off the route tree: no codegen, no
build step, no generated registry to keep in sync.

Single-source page guards

A route node now takes a use array of guards that gates both the route's
render and its loader/action RPC from one place, and inherits down the tree to
child routes. This replaces the previous split where definePage({ use })
guarded render and a separate convention guarded the server calls. One list,
one source of truth, applied uniformly.

Form lifecycle

Progressively-enhanced forms and actions gain onSuccess, onError,
invalidate, and reset hooks, plus shared invalidation so a successful
mutation can refresh the loader data it affected. Custom Select/Combobox inputs
from hono-preact-ui also reset correctly on a native form reset.

Content-glob routes

contentRoutes() turns an import.meta.glob map of content modules (MDX/markdown
pages) into route definitions in one call, so a docs or content site declares its
routes from the filesystem instead of by hand.

LLM-facing documentation and scaffolding

The project now ships machine-readable docs and agent-aware scaffolding:

  • Generated llms.txt and llms-full.txt so coding assistants can load an
    accurate, current description of the framework's API.
  • create-hono-preact scaffolds an AGENTS.md into new apps, and a new
    add-agents CLI command adds it to an existing app.
  • Several framework error messages were sharpened to say what went wrong and
    what to do about it.

Hardened public/internal boundary

The framework's advanced and framework-emitted plumbing moved behind explicit
/internal/runtime entry points, leaving the main entry points a curated public
surface. Most apps import only the public API and are unaffected; the change
matters only if you reached into internals.

Breaking changes

All of these are mechanical to migrate.

  • Page guards moved to the route node. Declare guards as a use array on the
    route instead of definePage({ use }). Page no longer accepts use or
    location. The single use list now gates render and loader/action RPC
    together, so the separate loaderUse / actionUse convention is gone.
  • useRouteChange removed. Run post-navigation work from
    useViewTransitionLifecycle({ onAfterSwap }) instead (the RouteChangeHandler
    type was removed with it).
  • getViewTransitionDirection removed. Navigation direction is now delivered
    to the view-transition types callback: subscribeViewTransitionTypes and
    useViewTransitionTypes receive { to, from, direction }, where direction
    is the still-exported NavDirection.
  • A few advanced exports moved behind /internal/runtime. The mutable env
    binding and framework-emitted server plumbing (the loaders handler, resolver
    factories) are no longer on the main entry points. If you imported them
    directly, pull them from hono-preact/internal/runtime (or
    hono-preact/server/internal/runtime). Typical apps never imported these.

Upgrading

npm install hono-preact@0.6.0

Scaffold a new app with the matching CLI:

npm create hono-preact@0.6.0

Then apply the breaking-change migrations above. If you don't use page guards,
useRouteChange, or framework internals, v0.6.0 is a drop-in upgrade.

The UI component library is released separately:

npm install hono-preact-ui@0.1.0