Skip to content

Commit 324a6f8

Browse files
committed
chore: update
2 parents 47f89e3 + 6f0f194 commit 324a6f8

File tree

307 files changed

+15877
-3637
lines changed

Some content is hidden

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

307 files changed

+15877
-3637
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ packages/kit/skills
1919
*.tsbuildinfo
2020
docs/.vitepress/cache
2121
.turbo
22+
.context

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

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ 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'),
1920
'@vitejs/devtools-kit/utils/shared-state': r('kit/src/utils/shared-state.ts'),
2021
'@vitejs/devtools-kit': r('kit/src/index.ts'),
2122
'@vitejs/devtools-rolldown': r('rolldown/src/index.ts'),
23+
'@vitejs/devtools-self-inspect': r('self-inspect/src/index.ts'),
24+
'@vitejs/devtools/internal': r('core/src/internal.ts'),
2225
'@vitejs/devtools/client/inject': r('core/src/client/inject/index.ts'),
2326
'@vitejs/devtools/client/webcomponents': r('core/src/client/webcomponents/index.ts'),
2427
'@vitejs/devtools': r('core/src/index.ts'),

docs/.vitepress/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ 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: 'Logs & Notifications', link: '/kit/logs' },
18+
{ text: 'Terminals & Processes', link: '/kit/terminals' },
19+
{ text: 'Examples', link: '/kit/examples' },
1720
]
1821

1922
const SocialLinks = [
@@ -66,6 +69,10 @@ export default extendConfig(withMermaid(defineConfig({
6669
{ text: 'Dock System', link: '/kit/dock-system' },
6770
{ text: 'RPC', link: '/kit/rpc' },
6871
{ text: 'Shared State', link: '/kit/shared-state' },
72+
{ text: 'Logs', link: '/kit/logs' },
73+
{ text: 'JSON Render', link: '/kit/json-render' },
74+
{ text: 'Terminals', link: '/kit/terminals' },
75+
{ text: 'Examples', link: '/kit/examples' },
6976
],
7077
},
7178
],

docs/guide/index.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ outline: deep
55
# Getting Started
66

77
> [!WARNING]
8-
> Vite DevTools is still in development and not yet ready for production use.
9-
> And currently Vite DevTools is designed only for Vite-Rolldown's build mode.
10-
> Dev mode and normal Vite are not supported yet.
8+
> Vite DevTools currently only supports build mode of Vite 8+.
9+
> Dev mode and Vite versions under 8 are not supported yet.
1110
1211
## What is Vite DevTools?
1312

@@ -25,24 +24,54 @@ Vite DevTools is a comprehensive set of developer tools for visualizing and anal
2524

2625
If you want to give an early preview, you can try it out by building this project from source, or install the preview build with the following steps:
2726

28-
Install or upgrade your Vite to the beta version 8:
27+
Install or upgrade your Vite to version 8:
2928

3029
<!-- eslint-skip -->
3130
```json [package.json]
3231
{
3332
"dependencies": {
34-
"vite": "^8.0.0-beta.7"
33+
"vite": "^8.0.0"
3534
}
3635
}
3736
```
3837

39-
Install the DevTools plugin:
38+
Install the required DevTools package:
4039

4140
```bash
4241
pnpm add -D @vitejs/devtools
4342
```
4443

45-
Enable the DevTools plugin in your Vite config and turn on the devtools mode for Rolldown:
44+
Vite DevTools has two client modes. Configure one mode at a time.
45+
46+
### Standalone mode
47+
48+
The DevTools client runs in a standalone window (no user app).
49+
50+
Configure `vite.config.ts`:
51+
52+
```ts [vite.config.ts] twoslash
53+
import { defineConfig } from 'vite'
54+
55+
export default defineConfig({
56+
devtools: {
57+
enabled: true,
58+
},
59+
})
60+
```
61+
62+
Run:
63+
64+
```bash
65+
pnpm build
66+
```
67+
68+
After the build completes, open the DevTools URL shown in the terminal.
69+
70+
### Embedded mode
71+
72+
The DevTools client runs inside an embedded floating panel.
73+
74+
Configure `vite.config.ts`:
4675

4776
```ts [vite.config.ts] twoslash
4877
import { DevTools } from '@vitejs/devtools'
@@ -60,18 +89,15 @@ export default defineConfig({
6089
})
6190
```
6291

63-
Run your Vite build, to generate the Rolldown build metadata:
92+
Run:
6493

6594
```bash
6695
pnpm build
67-
```
68-
69-
Open the DevTools panel in your browser to play with the DevTools:
70-
71-
```bash
7296
pnpm dev
7397
```
7498

99+
Then open your app in the browser and open the DevTools panel.
100+
75101
## What's Next?
76102

77103
Now that you have Vite DevTools set up, you can:
@@ -87,7 +113,7 @@ Now that you have Vite DevTools set up, you can:
87113
88114
- **Build mode only**: Currently works with Vite-Rolldown's build mode
89115
- **Dev mode**: Not yet supported (planned for future releases)
90-
- **Standard Vite**: Requires Rolldown Vite for now
116+
- **Vite Version**: Requires Vite 8 or higher versions for now
91117

92118
## Architecture Overview
93119

docs/kit/devtools-plugin.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,28 @@ export default function myAnalyzerPlugin(): Plugin {
210210
}
211211
```
212212

213+
## Debugging with Self Inspect
214+
215+
When developing or debugging a DevTools plugin, you can install `@vitejs/devtools-self-inspect` to get a live view of all registered RPC functions, dock entries, client scripts, and DevTools-enabled plugins:
216+
217+
```bash
218+
pnpm add -D @vitejs/devtools-self-inspect
219+
```
220+
221+
```ts [vite.config.ts]
222+
import { DevToolsSelfInspect } from '@vitejs/devtools-self-inspect'
223+
224+
export default defineConfig({
225+
plugins: [
226+
DevTools(),
227+
DevToolsSelfInspect(),
228+
// ...your plugins
229+
],
230+
})
231+
```
232+
233+
This adds a "Self Inspect" panel to DevTools that shows the internal state of the DevTools system — helpful for verifying that your plugin's RPC functions, docks, and client scripts are registered correctly.
234+
213235
## Next Steps
214236

215237
- **[Dock System](./dock-system)** - Learn about different dock entry types (iframe, action, custom renderer)

0 commit comments

Comments
 (0)