Skip to content

feat(rolldown): add "Run build with devtools" button#431

Merged
antfu merged 10 commits into
mainfrom
feat/rolldown-run-build-button
Jul 22, 2026
Merged

feat(rolldown): add "Run build with devtools" button#431
antfu merged 10 commits into
mainfrom
feat/rolldown-run-build-button

Conversation

@antfubot

@antfubot antfubot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds a "Run build with devtools" button to the Rolldown DevTools so you can produce a build session without leaving DevTools — no manual config wiring required.

Clicking it:

  1. Spawns a vite build child process (via the hub terminals host) with Rolldown's devtools output forced on for that build.
  2. Navigates the host shell to the Terminals dock so the build streams into view.
  3. Refreshes the session list when the build exits, surfacing the new entry.

What's included

  • rolldown — build flag: DevToolsRolldownUI gained a configResolved hook that forces rolldownOptions.devtools when the spawned build carries VITE_DEVTOOLS_ROLLDOWN=true. Core already mounts this plugin into the Vite pipeline whenever @vitejs/devtools-rolldown is installed, so it runs during the spawned build with no core-side changes and no manual DevToolsIntegration wiring. A normal vite build is untouched.
  • core — dock-activation bridge: an interim devtoolskit:internal:navigate RPC broadcasts a vite:devtools:activate-dock client function that the shell handles by calling switchEntry, letting a mounted plugin iframe navigate the host to another dock. Cross-iframe dock navigation is a hub concern, so this is a deliberate Vite-side shim; focusing the exact terminal session is deferred to an upstream @devframes/* capability (the sessionId is already threaded through for when it lands).
  • rolldown: run-build / wait-for-build RPCs spawn the build (single in-flight, idempotent fixed session id) and signal completion; list-sessions is no longer client-cached so the list stays live.
  • rolldown UI: a primary button in the empty state and a persistent header action, each with a spinner, inline error surface, and auto-refresh on build exit.
  • docs: RDDT0003 diagnostic for build-spawn failures.

Scoped to running inside Vite DevTools during vite dev.

Linked Issues

Additional context

A companion upstream proposal for @devframes/hub / @devframes/plugin-terminals (a first-class cross-iframe dock-activation API + terminal session focus-by-id) will let core drop the interim navigate shim and enable exact-session focus. Reviewers: worth a look at the dock-activation bridge in packages/core/src/node/rpc/internal/navigate.ts + the shell handler in state/context.ts.

This PR was created with the help of an agent.

Adds a button to the Rolldown DevTools that spawns a `vite build` with Rolldown's devtools output forced on, streams it into the Terminals dock, and refreshes the session list once the new build lands.

- core: env-gated `DevToolsRolldownBuildFlag` build plugin forces
  `rolldownOptions.devtools` when `VITE_DEVTOOLS_ROLLDOWN` is set on a spawned
  build, so no manual `DevToolsIntegration` wiring is needed.
- core: interim dock-activation bridge (`devtoolskit:internal:navigate` RPC ->
  `vite:devtools:activate-dock` client broadcast -> shell `switchEntry`) so a
  mounted iframe can navigate the host to the Terminals dock. Exact terminal
  session focus is deferred to an upstream `@devframes/*` capability.
- rolldown: `run-build` / `wait-for-build` RPCs spawn `vite build` via the
  terminals host (single in-flight, idempotent) and signal completion; the
  session list is no longer client-cached so it stays live.
- rolldown UI: primary button in the empty state plus a persistent header
  action, with a spinner, error surface, and auto-refresh on build exit.
- docs: RDDT0003 diagnostic for build-spawn failures.
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@431

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@431

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@431

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@431

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@431

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@431

commit: 297cb0d

antfubot added 3 commits July 16, 2026 06:59
Move the env-gated `rolldownOptions.devtools` flag out of a dedicated core plugin and into `DevToolsRolldownUI`'s own `configResolved` hook. Core mounts this plugin into the Vite pipeline whenever `@vitejs/devtools-rolldown` is installed, so it runs during the spawned build without core needing to know about the env var.
The "Run build" button no longer jumps to the Terminals tab on the initial click. It starts the build in place; clicking it again while it is building opens that build's Terminals session to watch it stream.
antfubot added 6 commits July 21, 2026 22:59
Resolve conflicts and refactor onto devframe 0.7.5's dock-activation API:

- Drop the interim core navigation shim (the devtoolskit:internal:navigate RPC,
  the vite:devtools:activate-dock client function, and the shell handler) now
  that @devframes/hub ships hub:docks:activate + a shell handler for the
  devframe:docks:activate broadcast.
- The Rolldown "Run build" button's terminal navigation now calls the hub RPC
  hub:docks:activate({ dockId: DEVTOOLS_TERMINALS_DOCK_ID, params: { sessionId } })
  directly.
- Adopt main's class-based UnoCSS style for the button markup.
A finished build's terminal session can stay registered, so re-running with the fixed `vite:rolldown:build` id threw "Terminal session ... already registered". Append a monotonic run counter to give each spawn a unique session id, reusing the current session only while it is still running.
Clicking "Run build" now opens a modal that:
- shows the exact command (via a new vite:rolldown:get-build-command RPC) and asks for confirmation;
- on confirm, shows running status with "View in terminals" (jumps to the build's terminal session) and "Dismiss" (keeps the build running in the background);
- if the build finishes while the modal is still open, shows success or error — and on success lists the new session(s) as direct links to inspect them.
- Reuse packages/ui primitives: VisualLoading for the running state, VisualEmptyState for the no-new-session case, DisplayModuleId/DisplayBadge/DisplayTimestamp for the session cards, and the btn-action shortcut for all buttons.
- Drop the command from the running state (no longer relevant once it's launched).
- Give the modal body a fixed min-height so the panel doesn't jump as stages swap.
Bring antfu/design's Action/ActionButton and Action/ActionIconButton into packages/ui, adapted to the kit's semantic shortcuts:

- ActionButton: polymorphic (as/href/to) button with action/primary/text variants, sizes, icon, and a loading spinner. `primary` maps onto the shared btn-action-active tint; the spinner reuses i-svg-spinners-8-dots-rotate.
- ActionIconButton: round icon-only button with floating-vue tooltip, active state, compact variant, and a #badge slot. Backed by new btn-icon / btn-icon-compact shortcuts.
- Colocated stories for both.

Reuse them in the Rolldown build flow: the run-build buttons and modal actions become ActionButton, and the config-snippet copy control becomes an ActionIconButton.
Add a solid `btn-primary` shortcut (filled bg-primary-500 / white text) mirroring antfu/design, and switch ActionButton's `primary` variant to it instead of the subtle btn-action-active tint.
@antfu
antfu merged commit 0b4a157 into main Jul 22, 2026
9 checks passed
@antfu
antfu deleted the feat/rolldown-run-build-button branch July 22, 2026 01:31
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.

2 participants