refactor!: replace startHttpAndWs and mountDevframe with initHub/initDevframe and ctx.install - #192
Merged
Conversation
…Devframe and ctx.install Remove the public `startHttpAndWs` API in favor of `initDevframe`/`initHub`, which now own the HTTP+WS binding internally (via the instance shell). Add an opt-in `register` flag to both factories so they publish to the instance registry via a dynamic import — `createDevServer` delegates to it. Replace the free `mountDevframe` function with a `ctx.install(devframe)` method on the hub context; `initHub`'s `devframes` list and every host go through it. Convert the legacy manual hosts and simplify the hub examples accordingly. BREAKING CHANGE: `startHttpAndWs` / `StartHttpAndWsOptions` and `mountDevframe` / `MountDevframeOptions` are removed. Use `initDevframe` / `initHub` (with `register` for registry publishing) and `ctx.install` instead.
❌ Deploy Preview for devfra failed.
|
…n guide The `unit-test / lint` CI job runs `pnpm typecheck`; `hub-hono-minimal` had a latent, cache-masked failure (unresolved `Bun` global in the Bun entry and a hono `ServerType` vs `node:http` `Server` mismatch). Type the Bun entry's slice locally instead of pulling `@types/bun`, and narrow the hono server cast. Revise `docs/guide/migration-0.9.md` end to end so it describes the final 0.9 surface: `startHttpAndWs` and `mountDevframe` are now documented as removed (in favor of `createDevServer`/`initDevframe`/`initHub` and `ctx.install`), the new opt-in `register` flag is covered, and the internals-move table reflects `StartedServer` (not `startHttpAndWs`) relocating to `devframe/internal`.
antfu
approved these changes
Aug 12, 2026
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.
Intent
Shrink the framework's public surface to two assembly factories and one hub-context method:
startHttpAndWsin favor ofinitDevframe/initHub, which now own the HTTP+WS binding internally (inlined into the instance shell).StartedServerstays (it'screateDevServer's return);StartHttpAndWsOptionsis gone.register?: boolean | Partial<DevframeInstanceRecord>that dynamically imports and callsregisterDevframeInstanceonce the origin resolves, tearing it down onclose().createDevServernow delegates to it rather than registering itself.mountDevframein favor of actx.install(devframe, options?)method on the hub context.initHub'sdevframeslist and every host go through it.MountDevframeOptions→InstallDevframeOptions.Examples
All hub examples now assemble through
initHub/initDevframewith minimal code: the two legacy manual hosts (a11y-messages-playground,storybook) and the a11y demo were converted, andhub-vite/hub-nextdrop their hand-rolledregisterDevframeInstancein favor ofregister.Notes
cwd, hub context, injected fakes, exposedctx) route through a shared repo-internal helpertests/helpers/serve-test-context.tssostartHttpAndWsis fully gone while their semantics are preserved.BREAKING CHANGE:startHttpAndWs/StartHttpAndWsOptionsandmountDevframe/MountDevframeOptionsare removed. UseinitDevframe/initHub(withregister) andctx.install.Verification
pnpm lint,pnpm knip,pnpm typecheck,pnpm build, andpnpm test(1077 tests, incl. regenerated tsnapi API snapshots) all pass. The pre-existinghub-hono-minimaltypecheck failure (missing@types/bunin the container) is unchanged frommainand unrelated.This PR was created with the help of an agent.