Skip to content

feat!: default build outDir to dist/__node-modules-inspector#152

Merged
antfu merged 4 commits into
mainfrom
antfu/devframe-0.1.21
May 8, 2026
Merged

feat!: default build outDir to dist/__node-modules-inspector#152
antfu merged 4 commits into
mainfrom
antfu/devframe-0.1.21

Conversation

@antfu
Copy link
Copy Markdown
Owner

@antfu antfu commented May 8, 2026

Summary

Bumps devframe from ^0.1.19 to ^0.1.21 (plus minor vite / bumpp bumps) and adapts the inspector to the upstream API + path-convention changes. The build CLI also moves to a deploy-friendly default output layout.

Breaking

  • node-modules-inspector build default --outDir changed from .node-modules-inspector to dist/__node-modules-inspector. The new path mirrors the underscore mount-path convention (feat(devframe)!: switch DevTools mount-path convention from /. to /__ vitejs/devtools#315) and survives static deploy platforms (Vercel, Netlify, GitHub Pages, …) that hide dotfile directories. Pass --outDir explicitly to keep the old layout.
  • Static export filenames followed devframe: .connection.json__connection.json, .rpc-dump/__rpc-dump/. The CLI uses the imported devframe constants, so source picks this up automatically — only hardcoded paths in the Playwright config and e2e tests were updated.

devframe 0.1.21 adaptation

  • createH3DevToolsHost now requires appName — passed devtool.id at the two manual call sites (build CLI + Nuxt dev API route).
  • StartedServer.rpcGroup.functions is strongly typed as DevToolsRpcServerFunctions; the payload-warmup cast goes through unknown to satisfy the stricter type while preserving runtime semantics.
  • fix(devframe)!: decouple docks/terminals/messages/commands from devframe vitejs/devtools#317 (decoupling docks/terminals/messages/commands into @vitejs/devtools-kit) is transparent — the inspector consumes only ctx.rpc.* and never used the relocated subsystems.

Build CLI: sub-base support hardened

build --base /__node-modules-inspector/ now also rewrites Nuxt's <script type=\"importmap\"> entry and buildAssetsDir:\"/_nuxt/\" — neither was caught by the previous (href|src)=\"/ regex, so the importmap pointed the entry chunk at the deploy origin and the SPA never hydrated under a sub-base.

e2e coverage

A new Playwright project build-subbase (port 13004) builds the static export with --base /__node-modules-inspector/ and serves the parent directory, verifying the inspector hydrates at /__node-modules-inspector/ without 4xx/5xx on JS/CSS/JSON/HTML. serve.mjs gained a --spa-base option so HTML navigation under the sub-base falls back to the right index.html.

Test plan

  • pnpm exec tsc --noEmit clean (the only remaining errors are pre-existing entries/*.vue modules generated by pnpm dev:prepare)
  • pnpm test:e2e --project build (root mode, 3 tests)
  • pnpm test:e2e --project build-subbase (sub-base mode, 3 tests)
  • pnpm test:e2e (full suite incl. dev + webcontainer projects)
  • node packages/node-modules-inspector/bin.mjs build produces dist/__node-modules-inspector/ with __connection.json and __rpc-dump/
  • serve dist/__node-modules-inspector works at `/`
  • serve dist with --base /__node-modules-inspector/ works at sub-path

🤖 Generated with Claude Code

- bump devframe to ^0.1.21 (also vite ^8.0.11, bumpp ^11.1.0)
- pass required appName to createH3DevToolsHost in CLI build and Nuxt dev
- route the rpcGroup.functions warmup cast through unknown
- update e2e tests + playwright config from /.connection.json and
  /.rpc-dump/ to /__connection.json and /__rpc-dump/ to match the new
  underscore mount-path convention (vitejs/devtools#315)

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 8, 2026

Open in StackBlitz

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

commit: e4754f5

antfu and others added 3 commits May 8, 2026 18:10
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Aligns with the underscore mount-path convention from devframe 0.1.21.
Verified both serve modes:

- serve dist/__node-modules-inspector (default --base /) — inspector at /
- serve dist --base /__node-modules-inspector/ — inspector at sub-path,
  HTML rewriting in the build action retargets absolute /_nuxt asset
  paths (Nuxt normalizes app.baseURL './' to '/').

BREAKING CHANGE: the default --outDir changed from .node-modules-inspector
to dist/__node-modules-inspector. Pass --outDir explicitly to keep the
old layout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a fourth Playwright project (`build-subbase`, port 13004) that
serves the static export from a parent directory so the inspector lives
at /__node-modules-inspector/ — the deploy shape implied by the new
default --outDir. The orchestrator builds a dedicated fixture with
`--base /__node-modules-inspector/`, and `serve.mjs` gained a
`--spa-base` option so HTML navigation requests under the sub-base fall
back to the right index.html.

The test fixture surfaced two gaps in the build CLI's rewrite that
broke hydration under a sub-base:

- Nuxt's <script type="importmap"> entry (`"#entry":"/_nuxt/..."`) and
  `buildAssetsDir:"/_nuxt/"` aren't matched by the `(href|src)="\/`
  regex. Added `"/_nuxt/` → `"${baseURL}_nuxt/` to cover both. Without
  it the importmap pointed the entry chunk at the deploy origin, the
  SPA never hydrated, and the page sat on /__node-modules-inspector/
  instead of redirecting to /grid/.

The new spec asserts no 4xx/5xx on JS/CSS/JSON/HTML responses during
SPA load (theme-vitesse fonts are pre-existing 404s in both root and
sub-base builds — they degrade to system fonts and don't gate
hydration, so the filter scopes 4xx checks to hydration-critical
extensions).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@antfu antfu changed the title chore: adapt to devframe 0.1.21 feat!: adapt to devframe 0.1.21 and default build outDir to dist/__node-modules-inspector May 8, 2026
@antfu antfu changed the title feat!: adapt to devframe 0.1.21 and default build outDir to dist/__node-modules-inspector feat!: default build outDir to dist/__node-modules-inspector May 8, 2026
@antfu antfu merged commit 9c237c3 into main May 8, 2026
11 checks passed
@antfu antfu deleted the antfu/devframe-0.1.21 branch May 8, 2026 09:51
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