refactor(adapters): rebuild createDevServer, viteDevBridge, and @devframes/next on initDevframe - #168
Merged
Merged
Conversation
This was referenced Aug 6, 2026
…frames/next on initDevframe
One wiring underneath every serving path: the adapters become thin
assemblies over the devframe/initiate instance.
- createDevServer = initDevframe + a node listener (listen-first so the
shared WS tier reports the real port; DF0052 rejection preserved;
registry/openBrowser/onReady unchanged; ws/rpcGroup/connectionMeta
surfaced from the instance transport)
- viteDevBridge bridge mode = instance.nodeMiddleware on Vite's stack;
the WS upgrade now shares Vite's own http server at <base>__ws (zero
extra ports; pinned devMiddleware.port keeps the explicit side-car)
and MCP moves onto the Vite origin at <base>__mcp
- @devframes/next reduces to memoization + defaults sugar (key-memoized
instance; MCP same-origin through the catch-all route)
- initDevframe grows the host-integration options the adapters need:
app, distDir: false, origin getter, getStorageDir,
destroyUnmatchedUpgrades, onPeerConnect/onPeerDisconnect passthrough
- resolveDevServerPort / resolveMcpConnectionMeta move to adapters/_shared
(re-exported from adapters/dev unchanged)
BREAKING CHANGE: viteDevBridge and @devframes/next advertise same-origin
relative endpoints now — websocket { path: '__ws' } on the host origin
(or { port, path: '__ws' } for a pinned side-car) and mcp
{ path: '__mcp' } — instead of side-car-port absolute paths.
antfu
force-pushed
the
feat/handler-adapters
branch
from
August 6, 2026 05:46
c7d6b22 to
9c7fa82
Compare
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
antfu
approved these changes
Aug 6, 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.
Layer 2 of the
/__devframes/standard-middleware stack (on #167). Seeplans/devframes-standard-middleware.md.Intent
One wiring underneath every serving path:
createDevServer(CLI),viteDevBridge(Vite), and@devframes/nextall become thin assemblies over thedevframe/initiateinstance, so the handler core gets the battle-testing of every adapter and no server surface is assembled twice.initDevframe+ a node listener. Listen-first so the shared WS tier reports the real bound port (port: 0works); DF0052 listen-rejection preserved; instance registry,--open,onReady, and theStartedServercontract (ws,rpcGroup,connectionMeta) unchanged.instance.nodeMiddlewareon Vite's connect stack and shares Vite's own http server for the WS upgrade at<base>__ws— zero extra ports, proxy/HTTPS friendly. A pinneddevMiddleware.portkeeps the explicit side-car. MCP moves onto the Vite origin at<base>__mcp.initDevframegrows the host-integration options the adapters need:app,distDir: false, origin getter,getStorageDir,destroyUnmatchedUpgrades,onPeerConnect/onPeerDisconnectpassthrough.Breaking changes
viteDevBridgeand@devframes/nextnow advertise same-origin relative endpoints —websocket: { path: '__ws' }on the host origin (or{ port, path: '__ws' }for a pinned side-car) andmcp: { path: '__mcp' }— instead of side-car-port absolute paths. The devframe client already resolves both forms.Stack
Created with the help of an agent.