Skip to content

Commit bde805f

Browse files
authored
feat: vite task devtools (#644)
1 parent 2a0316c commit bde805f

116 files changed

Lines changed: 6474 additions & 302 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. P
2525
| `packages/vite` | `@vitejs/devtools-vite` | Nuxt UI for the Vite dev server's plugin pipeline and module transforms. Hub-mounted via `Plugin.devtools.setup`. Serves at `/__devtools-vite/`. |
2626
| `packages/oxc` | `@vitejs/devtools-oxc` | Oxc toolchain (oxlint/oxfmt) inspector, donated from [`yuyinws/oxc-inspector`](https://github.com/yuyinws/oxc-inspector) with full history; owned by Leo. Advertised by core as a built-in install launcher in the `viteplus` group (installed on demand), mounted via `DevToolsOxc()` from `@vitejs/devtools-oxc/vite` once present, plus a standalone CLI/client. Its Nuxt client is on the shared stack — UnoCSS via `presetDevToolsUI` and `@vitejs/devtools-ui` components (an oxc-cyan `primary` scale derived from the `BannerOxcDevTools` accent) — and is wired into the turbo build, `vue-tsc` typecheck (own `src/tsconfig.json` reference) and export-snapshot gates. It dogfoods its own oxlint/oxfmt on itself (run `pnpm -C packages/oxc lint`), whose formatting conflicts with the repo-wide antfu ESLint config, so it stays out of the shared ESLint run. |
2727
| `packages/vitest` | `@vitejs/devtools-vitest` | Slim launcher for the Vitest UI, in the `viteplus` dock group. A `launcher` dock (only shown when the project uses Vitest) installs `@vitest/ui` on demand, spawns `vitest --ui`, then swaps to an iframe. Serves its favicon at `/__devtools-vitest/`. |
28+
| `packages/vite-task` | `@vitejs/devtools-vite-task` | Vite Plus task graph and dry-run cache inspector, mounted in the `viteplus` dock group. Serves at `/__devtools-vite-task/`. |
2829
| `packages/webext` | — | Browser extension scaffolding (ancillary). |
2930

3031
Meta-introspection ("DevTools for the DevTools") is provided by the official upstream `@devframes/plugin-inspect`, mounted as a built-in via `createPluginFromDevframe` (replaces the former `packages/self-inspect`).
@@ -38,10 +39,11 @@ flowchart TD
3839
hub --> devframe
3940
kit --> hub
4041
core --> kit
41-
core --> rolldown & vite & vitest
42+
core --> rolldown & vite & vitest & vite-task
4243
rolldown --> kit & ui
4344
vite --> kit & ui
4445
vitest --> kit
46+
vite-task --> kit
4547
webext --> core
4648
```
4749

@@ -110,6 +112,7 @@ All node-side warnings and errors use structured diagnostics via [`nostics`](htt
110112
| `RDDT` | `packages/rolldown` | `packages/rolldown/src/node/diagnostics.ts` |
111113
| `VDT` | `packages/vite` | `packages/vite/src/node/diagnostics.ts` |
112114
| `VTDT` | `packages/vitest` | `packages/vitest/src/node/diagnostics.ts` |
115+
| `VTKDT` | `packages/vite-task` | `packages/vite-task/src/node/diagnostics.ts` |
113116
| `OXDT` | `packages/oxc` | `packages/oxc/src/node/diagnostics.ts` |
114117

115118
`DF` codes belong to the upstream devframe/hub projects — file new ones there. The `DF8xxx` sub-range covers `@devframes/hub` (DF8100–DF8199 docks, DF8200–DF8299 terminals, DF8300–DF8399 messages, DF8400–DF8499 commands).

‎alias.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const alias = {
1616
'@vitejs/devtools-kit': r('kit/src/index.ts'),
1717
'@vitejs/devtools-rolldown': r('rolldown/src/index.ts'),
1818
'@vitejs/devtools-vite': r('vite/src/index.ts'),
19+
'@vitejs/devtools-vite-task': r('vite-task/src/index.ts'),
1920
'@vitejs/devtools-vitest': r('vitest/src/index.ts'),
2021
'@vitejs/devtools/internal': r('core/src/internal.ts'),
2122
'@vitejs/devtools/json-render': r('core/src/json-render.ts'),

‎docs/.vitepress/config.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const BuiltinDevToolsNav = [
4444
{ text: 'DevTools for Rolldown', link: '/rolldown/' },
4545
{ text: 'DevTools for Vite', link: '/vite/' },
4646
{ text: 'DevTools for Vitest', link: '/vitest/' },
47+
{ text: 'DevTools for Vite Task', link: '/vite-task/' },
4748
{ text: 'DevTools for Oxc', link: '/oxc/' },
4849
]
4950

@@ -123,6 +124,7 @@ export default extendConfig(withMermaid(defineConfig({
123124
{ text: 'DevTools for Rolldown', link: '/rolldown/' },
124125
{ text: 'DevTools for Vite', link: '/vite/' },
125126
{ text: 'DevTools for Vitest', link: '/vitest/' },
127+
{ text: 'DevTools for Vite Task', link: '/vite-task/' },
126128
{ text: 'DevTools for Oxc', link: '/oxc/' },
127129
],
128130
},
@@ -167,6 +169,14 @@ export default extendConfig(withMermaid(defineConfig({
167169
link: `/errors/${code}`,
168170
})),
169171
},
172+
{
173+
text: 'Vite Task DevTools (VTKDT)',
174+
collapsed: true,
175+
items: listErrorCodes('VTKDT').map(code => ({
176+
text: code,
177+
link: `/errors/${code}`,
178+
})),
179+
},
170180
],
171181
},
172182
],

‎docs/errors/VTKDT0001.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# VTKDT0001: Vite Plus Executable Not Found
6+
7+
## Message
8+
9+
> Local Vite Plus executable not found at "`{executable}`".
10+
11+
## Cause
12+
13+
The task inspector could not find the workspace's local Vite Plus executable in `node_modules/.bin`.
14+
15+
## Example
16+
17+
Opening the task inspector in a workspace where `vite-plus` has not been installed.
18+
19+
## Fix
20+
21+
Install `vite-plus` 1.6.0 or newer in the workspace root.
22+
23+
## Source
24+
25+
- [`packages/vite-task/src/node/tasks.ts`](https://github.com/vitejs/devtools/blob/main/packages/vite-task/src/node/tasks.ts) — `runJson()` throws this when the local executable is missing.

‎docs/errors/VTKDT0002.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# VTKDT0002: Unsupported Vite Plus Version
6+
7+
## Message
8+
9+
> Vite Plus `{version}` does not meet the required version >=1.6.0.
10+
11+
## Cause
12+
13+
The local Vite Plus version is older than the task inspector's required version, 1.6.0.
14+
15+
## Example
16+
17+
Opening the task inspector in a workspace using Vite Plus 1.5.0.
18+
19+
## Fix
20+
21+
Update the workspace's `vite-plus` dependency to 1.6.0 or newer.
22+
23+
## Source
24+
25+
- [`packages/vite-task/src/node/tasks.ts`](https://github.com/vitejs/devtools/blob/main/packages/vite-task/src/node/tasks.ts) — `runJson()` throws this when the local version is unsupported.

‎docs/errors/VTKDT0003.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# VTKDT0003: Vite Plus Command Failed
6+
7+
## Message
8+
9+
> Failed to run "`{command}`": `{reason}`
10+
11+
## Cause
12+
13+
A Vite Plus command failed, or the inspector could not recognize the output of `vp --version`.
14+
15+
## Example
16+
17+
Loading the task graph when a workspace task configuration causes `vp run --json` to fail.
18+
19+
## Fix
20+
21+
Check the local Vite Plus installation and workspace task configuration. Run the command shown in the diagnostic from the workspace root to inspect its output.
22+
23+
## Source
24+
25+
- [`packages/vite-task/src/node/tasks.ts`](https://github.com/vitejs/devtools/blob/main/packages/vite-task/src/node/tasks.ts) — `execute()` throws this on command failure; `runJson()` also throws it for unrecognized version output.

‎docs/errors/VTKDT0004.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# VTKDT0004: Invalid Vite Plus JSON
6+
7+
## Message
8+
9+
> Vite Plus returned invalid or unsupported JSON for "`{command}`".
10+
11+
## Cause
12+
13+
The inspector expects a version 1 JSON object with string `$schema` and `workspaceRoot` fields. Task graphs must also contain `tasks` and `packages` objects, and dry-run responses must contain a `plan` object.
14+
15+
## Example
16+
17+
Loading the task graph while workspace configuration prints additional text to standard output.
18+
19+
## Fix
20+
21+
Check the Vite Plus version and ensure the workspace configuration does not print to standard output.
22+
23+
## Source
24+
25+
- [`packages/vite-task/src/node/tasks.ts`](https://github.com/vitejs/devtools/blob/main/packages/vite-task/src/node/tasks.ts) — `runJson()` throws this when parsing fails or the top-level fields do not match the expected format.

‎docs/errors/VTKDT0005.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# VTKDT0005: Invalid Task Name
6+
7+
## Message
8+
9+
> Invalid task name "`{task}`".
10+
11+
## Cause
12+
13+
The requested task is empty, starts with a dash, or is absent from the task graph.
14+
15+
## Example
16+
17+
Requesting a run plan for a task that has been removed from the workspace configuration.
18+
19+
## Fix
20+
21+
Refresh the task graph and select a non-empty task name that does not start with a dash.
22+
23+
## Source
24+
25+
- [`packages/vite-task/src/node/tasks.ts`](https://github.com/vitejs/devtools/blob/main/packages/vite-task/src/node/tasks.ts) — `loadRunPlan()` throws this when the task name is invalid or missing from the graph.

‎docs/errors/index.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Vite DevTools uses structured diagnostics to surface actionable warnings and err
99
## How error codes work
1010

1111
- Codes follow the pattern **prefix + 4-digit number** (e.g., `DF0001`, `DTK0008`, `RDDT0002`).
12-
- Each prefix maps to a package: `DTK` for `@vitejs/devtools` (Vite-specific pieces), `RDDT` for `@vitejs/devtools-rolldown`, `VDT` for `@vitejs/devtools-vite`, `VTDT` for `@vitejs/devtools-vitest`. The framework-neutral `devframe` package documents its own `DF`-prefixed codes at the [Devframe docs site](https://devfra.me/errors/).
12+
- Each prefix maps to a package: `DTK` for `@vitejs/devtools` (Vite-specific pieces), `RDDT` for `@vitejs/devtools-rolldown`, `VDT` for `@vitejs/devtools-vite`, `VTDT` for `@vitejs/devtools-vitest`, `VTKDT` for `@vitejs/devtools-vite-task`. The framework-neutral `devframe` package documents its own `DF`-prefixed codes at the [Devframe docs site](https://devfra.me/errors/).
1313
- Every error page includes the cause, recommended fix, and a reference to the source file that emits it.
1414
- The diagnostics system is powered by [`nostics`](https://github.com/vercel-labs/nostics), which provides structured diagnostic codes with docs URLs and ANSI-formatted console output.
1515

@@ -71,6 +71,18 @@ Emitted by `@vitejs/devtools-vitest`.
7171
| [VTDT0001](./VTDT0001) | error | Vitest UI Install Failed |
7272
| [VTDT0002](./VTDT0002) | error | Vitest UI Server Unreachable |
7373

74+
## Vite Task DevTools (VTKDT)
75+
76+
Emitted by `@vitejs/devtools-vite-task`.
77+
78+
| Code | Level | Title |
79+
|------|-------|-------|
80+
| [VTKDT0001](./VTKDT0001) | error | Vite Plus Executable Not Found |
81+
| [VTKDT0002](./VTKDT0002) | error | Unsupported Vite Plus Version |
82+
| [VTKDT0003](./VTKDT0003) | error | Vite Plus Command Failed |
83+
| [VTKDT0004](./VTKDT0004) | error | Invalid Vite Plus JSON |
84+
| [VTKDT0005](./VTKDT0005) | error | Invalid Task Name |
85+
7486
## Oxc DevTools (OXDT)
7587

7688
Emitted by `@vitejs/devtools-oxc`.

‎docs/vite-task/index.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# DevTools for Vite Task
6+
7+
DevTools for Vite Task (`@vitejs/devtools-vite-task`) lets you explore your Vite+ task graph and track down cache misses.
8+
9+
## What it does
10+
11+
Select a task from the list or graph to see its run plan. DevTools builds the plan with `vp run --dry-run`.
12+
13+
- **Task Flow** — follow the planned order of tasks and expand a task to inspect its steps. When a cached run is available, its duration appears next to the task or step.
14+
- **Commands** — inspect each command and its cache status. **Inputs** and **Outputs** list the paths recorded for the cached run. Look under **Changes** to see which files or settings have changed since then.
15+
- **Dependencies** — see what the selected task depends on and which tasks depend on it. Follow a link to inspect a related task.
16+
17+
After editing an input, click **Refresh tasks** to see how the change affects the plan.
18+
19+
## Getting started
20+
21+
Use `vite-plus` v1.6.0 or later in your workspace root. To set up Vite DevTools, follow [Getting Started](/guide/).
22+
23+
In the DevTools dock, open **Vite Task** under **Vite+**. If you see **Install @vitejs/devtools-vite-task**, click it and restart your dev server once the installation finishes.

0 commit comments

Comments
 (0)