feat(core): migrate h3 v1 to v2 to align with devframe#346
Merged
Conversation
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.
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
devframev0.2+ ships on h3 v2, butpackages/corewas still pinned to h3 v1 — and was already calling devframe's v2serveStaticHandleragainst a v1 app by coincidental duck-typing. This bumps the catalog toh3: 2.0.1-rc.22(matching devframe's exact pin) and rewrites the two h3 call sites inpackages/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'smountStaticHandlerhelper for prefix-stripped static mounts. The redundantevent.node.req.url === '/'guard in the root redirect goes away because h3 v2'sapp.use('/', …)matches the exact pathname; the nested mountapp.use(DEVTOOLS_MOUNT_PATH, h3)now passes theH3instance directly so v2 routes throughH3.mount()and strips the base prefix correctly.An exported
DevToolsMiddlewarereturn interface is added so tsdown's d.ts bundler can name the publicH3type without leaking h3's internalH3$1class — the published API snapshot now readsPromise<DevToolsMiddleware>instead of an inlined v1{ h3: App; middleware: NodeListener; … }shape.Linked Issues
Additional context
pnpm lint,pnpm typecheck,pnpm test(190/190), andpnpm build(5/5) all pass. Manual browser smoke of the standalone CLI (pnpm -C packages/core run cli) — auth flow, root redirect, dock SPA,buildStaticDirsmounts — is recommended before merging.