Skip to content

Commit 980ca9e

Browse files
committed
docs: setup mermaid
1 parent c3880e4 commit 980ca9e

File tree

8 files changed

+1082
-595
lines changed

8 files changed

+1082
-595
lines changed

docs/.vitepress/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import {
44
groupIconMdPlugin,
55
groupIconVitePlugin,
66
} from 'vitepress-plugin-group-icons'
7+
import { withMermaid } from 'vitepress-plugin-mermaid'
78
import { version } from '../../package.json'
89

910
// https://vitepress.dev/reference/site-config
10-
export default defineConfig({
11+
export default withMermaid(defineConfig({
1112
title: 'Vite DevTools',
1213
description: 'Visualize and analyze your Vite build process with powerful developer tools. Extensible architecture for building custom DevTools integrations.',
1314
head: [
@@ -100,4 +101,4 @@ export default defineConfig({
100101
groupIconVitePlugin(),
101102
],
102103
},
103-
})
104+
}))

docs/kit/index.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,32 @@ DevTools Kit offers a complete toolkit for building DevTools integrations:
2323

2424
## Architecture Overview
2525

26-
```
27-
┌─────────────────────────────────────────────────────────────┐
28-
│ Browser (Client) │
29-
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
30-
│ │ Iframe │ │ Action │ │ Custom Renderer │ │
31-
│ │ Panel │ │ Button │ │ Panel │ │
32-
│ └──────┬──────┘ └──────┬──────┘ └──────────┬──────────┘ │
33-
│ │ │ │ │
34-
│ └────────────────┼────────────────────┘ │
35-
│ │ │
36-
│ ┌─────┴─────┐ │
37-
│ │ RPC Client│ │
38-
│ └─────┬─────┘ │
39-
└──────────────────────────┼──────────────────────────────────┘
40-
│ WebSocket
41-
┌──────────────────────────┼──────────────────────────────────┐
42-
│ ┌─────┴─────┐ │
43-
│ │ RPC Server│ │
44-
│ └─────┬─────┘ │
45-
│ │ │
46-
│ ┌───────────────────────┼───────────────────────────────┐ │
47-
│ │ DevTools Node Context │ │
48-
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐ │ │
49-
│ │ │ Docks │ │ Views │ │ RPC │ │ State │ │ │
50-
│ │ │ Host │ │ Host │ │ Host │ │ Host │ │ │
51-
│ │ └─────────┘ └─────────┘ └─────────┘ └──────────┘ │ │
52-
│ └───────────────────────────────────────────────────────┘ │
53-
│ Node.js (Server) │
54-
└─────────────────────────────────────────────────────────────┘
26+
```mermaid
27+
flowchart TB
28+
subgraph Browser["Browser (Client)"]
29+
direction TB
30+
subgraph DockEntries["Dock Entries"]
31+
Iframe["Iframe Panel"]
32+
Action["Action Button"]
33+
Custom["Custom Renderer"]
34+
end
35+
RpcClient["RPC Client"]
36+
DockEntries --> RpcClient
37+
end
38+
39+
RpcClient <-->|WebSocket| RpcServer
40+
41+
subgraph Server["Node.js (Server)"]
42+
direction TB
43+
RpcServer["RPC Server"]
44+
subgraph Context["DevTools Node Context"]
45+
Docks["Docks Host"]
46+
Views["Views Host"]
47+
Rpc["RPC Host"]
48+
State["State Host"]
49+
end
50+
RpcServer --> Context
51+
end
5552
```
5653

5754
## Why DevTools Kit?

docs/kit/rpc.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,14 @@ DevTools Kit provides a built-in RPC layer for type-safe bidirectional communica
88

99
## Overview
1010

11-
```
12-
┌─────────────────────────────────────────────────────────┐
13-
│ Browser Client │
14-
│ │
15-
│ await rpc.call('my-plugin:get-data', id) │
16-
│ │ │
17-
│ ▼ │
18-
└─────────────────────────┼───────────────────────────────┘
19-
│ WebSocket
20-
┌─────────────────────────┼───────────────────────────────┐
21-
│ ▼ │
22-
│ handler: async (id) => fetchData(id) │
23-
│ │
24-
│ Node.js Server │
25-
└─────────────────────────────────────────────────────────┘
11+
```mermaid
12+
sequenceDiagram
13+
participant Client as Browser Client
14+
participant Server as Node.js Server
15+
16+
Client->>Server: rpc.call('my-plugin:get-data', id)
17+
Note over Server: handler: async (id) =><br/>fetchData(id)
18+
Server->>Client: { id, data: '...' }
2619
```
2720

2821
## Server-Side Functions

docs/kit/shared-state.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ DevTools Kit provides a built-in shared state system for synchronizing data betw
88

99
## Overview
1010

11-
```
12-
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
13-
│ Client A │ │ Server │ │ Client B │
14-
│ │ │ │ │ │
15-
│ state.value() │◄────│ state.mutate() │────►│ state.value() │
16-
│ { count: 1 } │ │ { count: 1 } │ │ { count: 1 } │
17-
└──────────────────┘ └──────────────────┘ └──────────────────┘
18-
│ ▲ │
19-
│ WebSocket sync │ WebSocket sync │
20-
└────────────────────────┴────────────────────────┘
11+
```mermaid
12+
flowchart LR
13+
subgraph ClientA["Client A"]
14+
A_Value["state.value()<br/>{ count: 1 }"]
15+
end
16+
17+
subgraph Server["Server"]
18+
S_Mutate["state.mutate()<br/>{ count: 1 }"]
19+
end
20+
21+
subgraph ClientB["Client B"]
22+
B_Value["state.value()<br/>{ count: 1 }"]
23+
end
24+
25+
S_Mutate <-->|RPC sync| A_Value
26+
S_Mutate <-->|RPC sync| B_Value
2127
```
2228

2329
## Server-Side Usage

docs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"devDependencies": {
1111
"@shikijs/vitepress-twoslash": "catalog:docs",
1212
"@vitejs/devtools": "workspace:*",
13+
"mermaid": "catalog:docs",
1314
"vitepress": "catalog:docs",
14-
"vitepress-plugin-group-icons": "catalog:docs"
15+
"vitepress-plugin-group-icons": "catalog:docs",
16+
"vitepress-plugin-mermaid": "catalog:docs"
1517
}
1618
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@rolldown/debug": "catalog:deps",
8080
"chokidar": "catalog:devtools",
8181
"esbuild": "catalog:build",
82+
"langium": "catalog:resolutions",
8283
"nitropack": "catalog:build",
8384
"nuxt": "catalog:build",
8485
"rolldown": "catalog:build",

0 commit comments

Comments
 (0)