Skip to content

feat(core): migrate h3 v1 to v2 to align with devframe#346

Merged
antfu merged 1 commit into
mainfrom
antfu/migrate-h3-v2
May 14, 2026
Merged

feat(core): migrate h3 v1 to v2 to align with devframe#346
antfu merged 1 commit into
mainfrom
antfu/migrate-h3-v2

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 14, 2026

Description

devframe v0.2+ ships on h3 v2, but packages/core was still pinned to h3 v1 — and was already calling devframe's v2 serveStaticHandler against a v1 app by coincidental duck-typing. This bumps the catalog to h3: 2.0.1-rc.22 (matching devframe's exact pin) and rewrites the two h3 call sites in packages/core (server.ts, cli-commands.ts) onto v2 primitives: new H3(), defineHandler, event.res.status / event.res.headers.set(), return-value response bodies, toNodeHandler, and devframe's mountStaticHandler helper for prefix-stripped static mounts. The redundant event.node.req.url === '/' guard in the root redirect goes away because h3 v2's app.use('/', …) matches the exact pathname; the nested mount app.use(DEVTOOLS_MOUNT_PATH, h3) now passes the H3 instance directly so v2 routes through H3.mount() and strips the base prefix correctly.

An exported DevToolsMiddleware return interface is added so tsdown's d.ts bundler can name the public H3 type without leaking h3's internal H3$1 class — the published API snapshot now reads Promise<DevToolsMiddleware> instead of an inlined v1 { h3: App; middleware: NodeListener; … } shape.

Linked Issues

Additional context

pnpm lint, pnpm typecheck, pnpm test (190/190), and pnpm build (5/5) all pass. Manual browser smoke of the standalone CLI (pnpm -C packages/core run cli) — auth flow, root redirect, dock SPA, buildStaticDirs mounts — is recommended before merging.

devframe v0.2+ ships on h3 v2, but `packages/core` still pinned h3 v1
and was already calling devframe's v2 `serveStaticHandler` on a v1 app
by coincidental duck-typing. Bumps the catalog pin and rewrites the
two h3 call sites onto v2 primitives (`new H3()`, `defineHandler`,
`event.res.*`, `toNodeHandler`, `mountStaticHandler`). Exports a named
`DevToolsMiddleware` return interface so tsdown's d.ts bundler can
name the public `H3` type without leaking h3's internal class.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@346
npm i https://pkg.pr.new/@vitejs/devtools-kit@346
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@346
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@346

commit: 86f1e59

@antfu antfu changed the title refactor(core): migrate h3 v1 to v2 to align with devframe feat(core): migrate h3 v1 to v2 to align with devframe May 14, 2026
@antfu antfu merged commit 3b8a18f into main May 14, 2026
10 checks passed
@antfu antfu deleted the antfu/migrate-h3-v2 branch May 14, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant