Skip to content

Commit 5798431

Browse files
committed
chore: update
2 parents 4c1f1cd + 6d1e13d commit 5798431

File tree

385 files changed

+27309
-7908
lines changed

Some content is hidden

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

385 files changed

+27309
-7908
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ packages/vite/runtime
1414
packages/rolldown/src/public/fonts
1515
packages/rolldown/src/app/public/fonts
1616
packages/rolldown/runtime
17+
packages/kit/skills
1718
.rolldown
1819
*.tsbuildinfo
1920
docs/.vitepress/cache
2021
.turbo
22+
.context

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@
3434
"json",
3535
"jsonc",
3636
"yaml"
37-
]
37+
],
38+
39+
"npm.exclude": "**/{docs,examples/**}"
3840
}

AGENTS.md

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
11
# AGENTS GUIDE
22

3-
Quick reference for future agents working on this repo.
4-
53
## Stack & Structure
6-
- Monorepo via `pnpm` workspaces; builds orchestrated with `turbo`.
7-
- ESM TypeScript everywhere; bundling with `tsdown`.
8-
- Key packages:
9-
- `packages/core` (`@vitejs/devtools`): Vite plugin, CLI, host/runtime (docks, views, terminals), websocket RPC server, standalone/webcomponents client.
10-
- `packages/kit` (`@vitejs/devtools-kit`): public types/utilities (`defineRpcFunction`, shared state, events) for integration authors; client helpers.
11-
- `packages/rpc` (`@vitejs/devtools-rpc`): thin typed RPC wrapper over `birpc`, with WS presets.
12-
- `packages/rolldown` (`@vitejs/devtools-rolldown`): Nuxt-based UI served from the plugin; registers Vite dock and RPC functions for Rolldown build data.
13-
- `packages/webext`: browser extension scaffolding (currently ancillary).
14-
- Docs under `docs/` (VitePress); user-facing guides in `docs/guide`.
15-
- Path aliases defined in `alias.ts` and propagated to `tsconfig.base.json` (do not edit paths manually).
4+
5+
Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. Path aliases in `alias.ts` (propagated to `tsconfig.base.json` — do not edit manually).
6+
7+
### Packages
8+
9+
| Package | npm | Description |
10+
|---------|-----|-------------|
11+
| `packages/core` | `@vitejs/devtools` | Vite plugin, CLI, runtime hosts (docks, views, terminals), WS RPC server, standalone/webcomponents client |
12+
| `packages/kit` | `@vitejs/devtools-kit` | Public types/utilities for integration authors (`defineRpcFunction`, shared state, events, client helpers) |
13+
| `packages/rpc` | `@vitejs/devtools-rpc` | Typed RPC wrapper over `birpc` with WS presets |
14+
| `packages/ui` | `@vitejs/devtools-ui` | Shared UI components, composables, and UnoCSS preset (`presetDevToolsUI`). Private, not published |
15+
| `packages/rolldown` | `@vitejs/devtools-rolldown` | Nuxt UI for Rolldown build data. Serves at `/.devtools-rolldown/` |
16+
| `packages/vite` | `@vitejs/devtools-vite` | Nuxt UI for Vite DevTools (WIP). Serves at `/.devtools-vite/` |
17+
| `packages/self-inspect` | `@vitejs/devtools-self-inspect` | Meta-introspection — DevTools for the DevTools. Serves at `/.devtools-self-inspect/` |
18+
| `packages/webext` || Browser extension scaffolding (ancillary) |
19+
20+
Other top-level directories:
21+
- `docs/` — VitePress docs; guides in `docs/guide/`
22+
- `skills/` — Agent skill files generated from docs via [Agent Skills](https://agentskills.io/home). Structured references (RPC patterns, dock types, shared state, project structure) for AI agent context.
1623

1724
```mermaid
1825
flowchart TD
19-
core["@vitejs/devtools"] --> kit["@vitejs/devtools-kit"]
20-
core --> rpc["@vitejs/devtools-rpc"]
21-
core --> rolldownUI["@vitejs/devtools-rolldown (Nuxt UI)"]
22-
rolldownUI --> kit
23-
rolldownUI --> rpc
24-
webext["@vitejs/devtools-webext"] --> core
26+
core["core"] --> kit & rpc
27+
core --> rolldown & vite & self-inspect
28+
rolldown --> kit & rpc & ui
29+
vite --> kit & rpc & ui
30+
self-inspect --> kit & rpc
31+
webext --> core
2532
```
2633

27-
## Runtime Architecture (high level)
28-
- Plugin entry (`createDevToolsContext` in `packages/core/src/node/context.ts`) builds a `DevToolsNodeContext` with hosts for RPC, docks, views, terminals. It registers built-in RPC functions and invokes `plugin.devtools.setup` hooks from Vite plugins.
29-
- Node context vs client context:
30-
- **Node context**: server-side state (cwd, workspaceRoot, vite config, mode, rpc/docks/views/terminals hosts) plus internal storage (auth) from `context-internal.ts`. Used by plugins and RPC handlers.
31-
- **Client context**: webcomponents/Nuxt UI state (`packages/core/src/client/webcomponents/state/*`), holding dock entries, selected panels, and RPC client; created with `clientType` of `embedded` or `standalone`.
32-
- Websocket server (`packages/core/src/node/ws.ts`) exposes RPC via `@vitejs/devtools-rpc/presets/ws`. Auth is skipped in build mode or when `devtools.clientAuth` is `false`; trusted IDs stored under `node_modules/.vite/devtools/auth.json`.
33-
- DevTools middleware (`packages/core/src/node/server.ts`) serves connection meta and standalone client assets.
34-
- The Rolldown UI plugin (`packages/rolldown/src/node/plugin.ts`) registers RPC functions (Rolldown data fetchers) and hosts the Nuxt-generated static UI at `/.devtools-rolldown/`, adding a dock entry.
35-
- Nuxt app config (`packages/rolldown/src/nuxt.config.ts`): SPA, base `/.devtools-rolldown/`, disables Nuxt devtools, enables typed pages, uses Unocss/VueUse; sets `vite.devtools.clientAuth = false` for UI.
34+
## Architecture
3635

37-
## Client Modes (kit/core)
38-
- **Embedded mode**: default overlay injected into the host app; docks render inside the app shell; use `clientType: 'embedded'` when creating client context.
39-
- **Standalone mode**: runs the webcomponents UI as an independent page (see `packages/core/src/client/standalone`); useful for external access or when not injecting into the host app UI.
36+
- **Entry**: `createDevToolsContext` (`packages/core/src/node/context.ts`) builds `DevToolsNodeContext` with hosts for RPC, docks, views, terminals. Invokes `plugin.devtools.setup` hooks.
37+
- **Node context**: server-side (cwd, vite config, mode, hosts, auth storage at `node_modules/.vite/devtools/auth.json`).
38+
- **Client context**: webcomponents/Nuxt UI state (`packages/core/src/client/webcomponents/state/*`) — dock entries, panels, RPC client. Two modes: `embedded` (overlay in host app) and `standalone` (independent page).
39+
- **WS server** (`packages/core/src/node/ws.ts`): RPC via `@vitejs/devtools-rpc/presets/ws`. Auth skipped in build mode or when `devtools.clientAuth` is `false`.
40+
- **Nuxt UI plugins** (rolldown, vite, self-inspect): each registers RPC functions and hosts static Nuxt SPA at its own base path.
4041

41-
## Development Workflow
42-
- Install: `pnpm install` (repo requires `pnpm@10.x`).
43-
- Build all: `pnpm build` (runs `turbo run build`; for UI data, build generates Rolldown metadata under `packages/rolldown/node_modules/.rolldown`).
44-
- Dev:
45-
- Core playground: `pnpm -C packages/core run play`
46-
- Rolldown UI: `pnpm -C packages/rolldown run dev`
47-
- Standalone core client: `pnpm -C packages/core run dev:standalone`
48-
- Tests: `pnpm test` (Vitest; projects under `packages/*` and `test`).
49-
- Typecheck: `pnpm typecheck` (via `vue-tsc -b`).
50-
- Lint: `pnpm lint`
51-
- Use `pnpm lint --fix` to auto-resolve common issues.
52-
- Docs: `pnpm -C docs run docs` / `docs:build` / `docs:serve`.
42+
## Development
5343

54-
## Conventions & Guardrails
55-
- Prefer workspace imports via aliases from `alias.ts`.
56-
- Keep RPC additions typed; use `defineRpcFunction` from kit when adding server functions.
57-
- Docks/views/terminals are registered through hosts on `DevToolsNodeContext`; mutations should update shared state (`@vitejs/devtools-kit/utils/shared-state`).
58-
- When touching websocket auth or storage, note persisted state lives in `node_modules/.vite/devtools/auth.json` (created by `createStorage`).
59-
- For Nuxt UI changes, base path must remain `/.devtools-vite/`; keep `clientAuth` considerations in mind if exposing over network.
60-
- Project is currently focused on Rolldown build-mode analysis; dev-mode support is deferred.
44+
```sh
45+
pnpm install # requires pnpm@10.x
46+
pnpm build # turbo run build
47+
pnpm test # Vitest
48+
pnpm typecheck # vue-tsc -b
49+
pnpm lint --fix # ESLint
50+
pnpm -C packages/core run play # core playground
51+
pnpm -C packages/rolldown run dev # rolldown UI dev
52+
pnpm -C packages/core run dev:standalone # standalone client
53+
pnpm -C docs run docs # docs dev server
54+
```
55+
56+
## Conventions
57+
58+
- Use workspace aliases from `alias.ts`.
59+
- RPC functions must use `defineRpcFunction` from kit; always namespace IDs (`my-plugin:fn-name`).
60+
- Shared state via `@vitejs/devtools-kit/utils/shared-state`; keep values serializable.
61+
- Nuxt UI base paths: `/.devtools-rolldown/`, `/.devtools-vite/`, `/.devtools-self-inspect/`.
62+
- Shared UI components/preset in `packages/ui`; use `presetDevToolsUI` from `@vitejs/devtools-ui/unocss`.
63+
- Currently focused on Rolldown build-mode analysis; dev-mode support is deferred.
6164

62-
## Useful Paths
63-
- Core runtime: `packages/core/src/node/*`
64-
- Core webcomponents: `packages/core/src/client/webcomponents`
65-
- Kit utilities: `packages/kit/src/utils/*`
66-
- RPC presets: `packages/rpc/src/presets/ws/*`
67-
- Rolldown UI app: `packages/rolldown/src/app`
68-
- Docs: `docs/guide/*`
65+
## Before PRs
66+
67+
```sh
68+
pnpm lint && pnpm test && pnpm typecheck && pnpm build
69+
```
6970

70-
## Quick Checks Before PRs
71-
- Run `pnpm lint && pnpm test && pnpm typecheck`.
72-
- Ensure `pnpm build` succeeds (regenerates Rolldown metadata if needed).
73-
- Follow conventional commit style (`feat:`, `fix:`, etc.). README flags project as WIP; set expectations accordingly.
71+
Follow conventional commits (`feat:`, `fix:`, etc.).

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

CONTRIBUTING.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@ You can check the [TODO list](https://github.com/vitejs/devtools/issues/9) (excl
1010

1111
## Setup
1212

13+
Requires `pnpm@10.x`.
14+
1315
```bash
1416
pnpm install
1517
pnpm build # Required: generates Rolldown meta under ./packages/rolldown/node_modules/.rolldown
16-
pnpm dev # Start dev server
18+
19+
# Start Rolldown devtools UI
20+
pnpm dev:rolldown
21+
# Start Vite devtools UI
22+
pnpm dev:vite
23+
# Core playground (host app with DevTools overlay)
24+
pnpm play
25+
# Standalone client dev
26+
pnpm play:standalone
1727
```
1828

1929
**Note**: After pulling latest commits, remove `./packages/rolldown/node_modules/.rolldown` and rebuild to get the latest data format.
@@ -42,8 +52,8 @@ Main entry point and core functionality.
4252

4353
Utility library for integration authors.
4454

45-
- TypeScript types and interfaces
46-
- Utilities for custom docks, views, panels
55+
- TypeScript types and interfaces for docks, views, panels
56+
- `defineRpcFunction` and shared state utilities
4757
- Event system utilities
4858
- RPC client helpers
4959

@@ -66,9 +76,21 @@ Built-in UI panel for Rolldown integration.
6676

6777
---
6878

79+
### `packages/vite` - `@vitejs/devtools-vite`
80+
81+
UI for Vite DevTools (WIP).
82+
83+
---
84+
85+
### `packages/ui` - `@vitejs/devtools-ui`
86+
87+
Shared UI components, composables, and UnoCSS preset (`presetDevToolsUI`).
88+
89+
---
90+
6991
### `packages/rpc` - `@vitejs/devtools-rpc`
7092

71-
RPC layer for component communication.
93+
Typed RPC wrapper over `birpc` with WebSocket presets.
7294

7395
- RPC client/server implementations
7496
- WebSocket presets
@@ -79,6 +101,12 @@ RPC layer for component communication.
79101

80102
---
81103

104+
### `packages/self-inspect` - `@vitejs/devtools-self-inspect`
105+
106+
Meta-introspection — DevTools for the DevTools itself.
107+
108+
---
109+
82110
### `packages/webext` - `@vitejs/devtools-webext`
83111

84112
Browser extension (planned for future dev mode). **Not accepting contributions currently.**
@@ -87,14 +115,16 @@ Browser extension (planned for future dev mode). **Not accepting contributions c
87115

88116
## Scripts
89117

90-
- `pnpm build` - Build all packages
91-
- `pnpm watch` - Watch mode
92-
- `pnpm dev` - Dev server
93-
- `pnpm lint` - ESLint
118+
- `pnpm build` - Build all packages (via turbo)
119+
- `pnpm watch` - Watch mode for all packages
120+
- `pnpm play` - Core playground (host app with DevTools overlay)
121+
- `pnpm play:standalone` - Standalone client dev
122+
- `pnpm dev:rolldown` - Rolldown UI dev server
123+
- `pnpm dev:vite` - Vite UI dev server
124+
- `pnpm docs` - VitePress docs dev server
125+
- `pnpm lint` - ESLint (pass `--fix` to auto-fix)
94126
- `pnpm test` - Vitest
95-
- `pnpm typecheck` - Type check
96-
97-
Package-specific: `pnpm -C packages/core run cli`, `pnpm -C packages/rolldown run dev`
127+
- `pnpm typecheck` - vue-tsc type check
98128

99129
## Workflow
100130

@@ -107,5 +137,5 @@ Package-specific: `pnpm -C packages/core run cli`, `pnpm -C packages/rolldown ru
107137

108138
- **core**: CLI in `cli-commands.ts`, server in `server.ts`, components in `client/webcomponents/`
109139
- **kit**: Keep APIs stable, add types for public APIs, consider backward compatibility
110-
- **vite**: Nuxt 3 app, Vue 3 Composition API, test with `pnpm dev` after build
140+
- **vite**: Nuxt 4 app, Vue 3 Composition API, test with `pnpm dev` after build
111141
- **rpc**: Keep methods type-safe, document new methods, test client/server

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
Vite DevTools is a set of tools for visualizing the internal state and build analysis for Vite and Rolldown.
77

8-
> [!IMPORTANT]
9-
> This project is still in development. Not yet usable. You may preview it by building this project from source.
10-
11-
- 📖 [Documentation](https://vite-devtools.netlify.app)
8+
- 📖 [Documentation](https://devtools.vite.dev)
129
- 💡 [Contributing Guide](./CONTRIBUTING.md)
1310

1411
## 📄 Licenses

alias.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ export const alias = {
1616
'@vitejs/devtools-kit/constants': r('kit/src/constants.ts'),
1717
'@vitejs/devtools-kit/utils/events': r('kit/src/utils/events.ts'),
1818
'@vitejs/devtools-kit/utils/nanoid': r('kit/src/utils/nanoid.ts'),
19+
'@vitejs/devtools-kit/utils/human-id': r('kit/src/utils/human-id.ts'),
20+
'@vitejs/devtools-kit/utils/when': r('kit/src/utils/when.ts'),
1921
'@vitejs/devtools-kit/utils/shared-state': r('kit/src/utils/shared-state.ts'),
2022
'@vitejs/devtools-kit': r('kit/src/index.ts'),
2123
'@vitejs/devtools-rolldown': r('rolldown/src/index.ts'),
24+
'@vitejs/devtools-self-inspect': r('self-inspect/src/index.ts'),
25+
'@vitejs/devtools/internal': r('core/src/internal.ts'),
2226
'@vitejs/devtools/client/inject': r('core/src/client/inject/index.ts'),
2327
'@vitejs/devtools/client/webcomponents': r('core/src/client/webcomponents/index.ts'),
2428
'@vitejs/devtools': r('core/src/index.ts'),

docs/.vitepress/config.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const DevToolsKitNav = [
1414
{ text: 'Dock System', link: '/kit/dock-system' },
1515
{ text: 'RPC', link: '/kit/rpc' },
1616
{ text: 'Shared State', link: '/kit/shared-state' },
17+
{ text: 'Commands', link: '/kit/commands' },
18+
{ text: 'When Clauses', link: '/kit/when-clauses' },
19+
{ text: 'Logs & Notifications', link: '/kit/logs' },
20+
{ text: 'Terminals & Processes', link: '/kit/terminals' },
21+
{ text: 'Examples', link: '/kit/examples' },
1722
]
1823

1924
const SocialLinks = [
@@ -27,7 +32,7 @@ const SocialLinks = [
2732
// https://vitepress.dev/reference/site-config
2833
export default extendConfig(withMermaid(defineConfig({
2934
title: 'Vite DevTools',
30-
description: 'Visualize and analyze your Vite build process with powerful developer tools. Extensible architecture for building custom DevTools integrations.',
35+
description: 'An extensible devtools framework for the Vite ecosystem. Build, compose, and integrate developer tools with a unified foundation.',
3136
head: [
3237
['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
3338
],
@@ -37,6 +42,12 @@ export default extendConfig(withMermaid(defineConfig({
3742
// https://vitepress.dev/reference/default-theme-config
3843
nav: [
3944
{ text: 'Guide', link: '/guide/' },
45+
{
46+
text: 'Builtin DevTools',
47+
items: [
48+
{ text: 'DevTools for Rolldown', link: '/rolldown/' },
49+
],
50+
},
4051
{
4152
text: 'DevTools Kit',
4253
items: DevToolsKitNav,
@@ -55,7 +66,13 @@ export default extendConfig(withMermaid(defineConfig({
5566
text: 'Guide',
5667
items: [
5768
{ text: 'Getting Started', link: '/guide/' },
58-
{ text: 'Features', link: '/guide/features/' },
69+
],
70+
},
71+
{
72+
text: 'DevTools for Rolldown',
73+
items: [
74+
{ text: 'Introduction', link: '/rolldown/' },
75+
{ text: 'Features', link: '/rolldown/features' },
5976
],
6077
},
6178
{
@@ -66,6 +83,12 @@ export default extendConfig(withMermaid(defineConfig({
6683
{ text: 'Dock System', link: '/kit/dock-system' },
6784
{ text: 'RPC', link: '/kit/rpc' },
6885
{ text: 'Shared State', link: '/kit/shared-state' },
86+
{ text: 'Commands', link: '/kit/commands' },
87+
{ text: 'When Clauses', link: '/kit/when-clauses' },
88+
{ text: 'Logs', link: '/kit/logs' },
89+
{ text: 'JSON Render', link: '/kit/json-render' },
90+
{ text: 'Terminals', link: '/kit/terminals' },
91+
{ text: 'Examples', link: '/kit/examples' },
6992
],
7093
},
7194
],
@@ -87,7 +110,7 @@ export default extendConfig(withMermaid(defineConfig({
87110
title: 'Vite DevTools',
88111
items: [
89112
{ text: 'Guide', link: '/guide/' },
90-
{ text: 'Features', link: '/guide/features' },
113+
{ text: 'DevTools for Rolldown', link: '/rolldown/' },
91114
{ text: 'Release Notes', link: 'https://github.com/vitejs/devtools/releases' },
92115
{ text: 'Contributing', link: 'https://github.com/vitejs/devtools/blob/main/CONTRIBUTING.md' },
93116
],
@@ -96,6 +119,12 @@ export default extendConfig(withMermaid(defineConfig({
96119
title: 'DevTools Kit',
97120
items: DevToolsKitNav,
98121
},
122+
{
123+
title: 'Builtin DevTools',
124+
items: [
125+
{ text: 'DevTools for Rolldown', link: '/rolldown/' },
126+
],
127+
},
99128
],
100129
social: SocialLinks,
101130
},

docs/.vitepress/theme/Home.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import Spacer from '@components/shared/Spacer.vue'
1111

1212
<HeadingSection
1313
heading="Inspect, Analyze, Extend"
14-
subheading="Vite DevTools not only provides built-in features, but also a extensible architecture for custom integrations."
14+
subheading="Vite DevTools provides an extensible framework with built-in integrations like DevTools for Rolldown, plus an open architecture for custom tools."
1515
/>
1616

1717
<FeatureGrid />
1818

1919
<Spacer />
2020

2121
<Footer
22-
heading="Understand your Vite App Better"
23-
subheading="Visually inspect modules, plugins, chunks, assets, packages..." button-text="Get Started"
22+
heading="Understand Your Vite Ecosystem Better"
23+
subheading="Inspect builds, analyze performance, extend with custom integrations..." button-text="Get Started"
2424
button-link="/guide/"
2525
/>
2626
</template>

0 commit comments

Comments
 (0)