You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bump the h3 catalog pin to 2.0.1-rc.22 and rewrite devframe's HTTP
plumbing onto h3 v2's web-standard primitives. The h3 v1 `App` type is
no longer exported in v2, so devframe's public surface — the optional
`app` on `CreateDevServerOptions` / `StartHttpAndWsOptions`, the `app`
field on `StartedServer`, and the `onReady({ app })` callback — switches
from `App` to `H3`. Devframe bumps to `0.2.0` to reflect the breaking
type rename.
Internally: `createApp()` → `new H3()`, `toNodeListener` →
`toNodeHandler`, `defineEventHandler` → `defineHandler`,
`setResponseStatus`/`setResponseHeader` → `event.res.status` /
`event.res.headers.set(...)`, and the static file stream returns via
`Readable.toWeb(...)` instead of `sendStream`. The connection-meta
handler in `adapters/dev.ts` collapses to a plain `() => ({...})` now
that h3 auto-serializes object returns.
The trickiest v2 behavior change is route matching: `app.use(base, h)`
in v2 only matches the exact `base` path (not subpaths) and does not
strip the prefix from `event.url.pathname`. Static-dir mounts need
both. To avoid spreading that quirk across every call site, add a new
`mountStaticHandler(app, base, dir, options?)` export in
`devframe/utils/serve-static` that bundles the `${base}/**` route and
`withBase(base, ...)` prefix stripping. All four production/test mount
sites switch to it; the existing `serveStaticHandler` (h3 event
handler) and `serveStaticNodeMiddleware` (Connect middleware) are
kept unchanged.
Snapshots in `tests/__snapshots__/tsnapi/` are regenerated to reflect
the renamed types and the new `mountStaticHandler` export.
0 commit comments