feat(rolldown): add "Run build with devtools" button#431
Merged
Conversation
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.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
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.
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.
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.
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:
vite buildchild process (via the hub terminals host) with Rolldown'sdevtoolsoutput forced on for that build.What's included
DevToolsRolldownUIgained aconfigResolvedhook that forcesrolldownOptions.devtoolswhen the spawned build carriesVITE_DEVTOOLS_ROLLDOWN=true. Core already mounts this plugin into the Vite pipeline whenever@vitejs/devtools-rolldownis installed, so it runs during the spawned build with no core-side changes and no manualDevToolsIntegrationwiring. A normalvite buildis untouched.devtoolskit:internal:navigateRPC broadcasts avite:devtools:activate-dockclient function that the shell handles by callingswitchEntry, 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 (thesessionIdis already threaded through for when it lands).run-build/wait-for-buildRPCs spawn the build (single in-flight, idempotent fixed session id) and signal completion;list-sessionsis no longer client-cached so the list stays live.RDDT0003diagnostic 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 inpackages/core/src/node/rpc/internal/navigate.ts+ the shell handler instate/context.ts.This PR was created with the help of an agent.