Skip to content

refactor(cli): migrate dev command to devframe createDevServer#150

Merged
antfu merged 1 commit into
mainfrom
antfu/cli-create-dev-server
May 7, 2026
Merged

refactor(cli): migrate dev command to devframe createDevServer#150
antfu merged 1 commit into
mainfrom
antfu/cli-create-dev-server

Conversation

@antfu
Copy link
Copy Markdown
Owner

@antfu antfu commented May 7, 2026

Summary

  • Migrates the inspector dev CLI to createDevServer + resolveDevServerPort from devframe/adapters/dev (introduced in vitejs/devtools#304). The factory mounts the SPA, the /.connection.json endpoint, and the WS RPC server itself, so ~40 lines of bespoke h3 wiring plus the sirv dependency go away.
  • The build command is intentionally left on the manual path: devframe's createBuild does not yet forward flags to setup, so adopting it would silently drop --config/--depth. Filed as a follow-up.
  • The payload pre-warm is preserved via rpcGroup.functions['nmi:get-payload'], with a one-line note explaining that the proxy returns Promise<handler>.

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test --run (36/36 unit)
  • pnpm test:e2e — all 9 specs pass (3 dev, 3 build, 3 webcontainer)
  • Manual smoke: --port, --no-open, /.connection.json returns {"backend":"websocket","websocket":<port>}, SPA serves on /, nmi:get-payload warms in the background
  • Build regression: bin.mjs build --depth 3 --base /sub/ still produces a valid static export

🤖 Generated with Claude Code

Replace the manual h3 + startHttpAndWs orchestration with
createDevServer + resolveDevServerPort from devframe/adapters/dev
(vitejs/devtools#304). The factory now mounts the SPA, connection-meta
endpoint, and WS RPC server itself, so we drop ~40 lines of bespoke
wiring along with the sirv dependency. The build command is left as-is
since createBuild does not yet forward setup flags.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/node-modules-inspector@150
npm i https://pkg.pr.new/node-modules-tools@150

commit: 7e80718

@antfu antfu merged commit 520a90d into main May 7, 2026
11 checks passed
@antfu antfu deleted the antfu/cli-create-dev-server branch May 7, 2026 08:26
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