@xiaou66/vite-plugin-vue-mcp-next 1.0.4 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/index.cjs +809 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +257 -0
- package/dist/index.d.ts +257 -0
- package/dist/index.js +760 -66
- package/dist/index.js.map +1 -1
- package/dist/runtime/client.cjs +615 -2
- package/dist/runtime/client.cjs.map +1 -1
- package/dist/runtime/client.js +615 -2
- package/dist/runtime/client.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
| Vue 组件状态 | Vue Runtime Bridge | Vue Runtime Bridge | 读取和编辑组件状态 |
|
|
20
20
|
| Router 信息 | Vue Runtime Bridge | Vue Runtime Bridge | 返回当前路由和路由表 |
|
|
21
21
|
| Pinia 状态 | Vue Runtime Bridge | Vue Runtime Bridge | 返回 Pinia inspector tree 和 store state |
|
|
22
|
+
| 性能诊断 | Runtime Hook | CDP 优先,Hook 兜底 | 可分析主线程卡顿、内存趋势和堆栈,CDP 时可导出 profile |
|
|
22
23
|
|
|
23
24
|
## 安装与使用
|
|
24
25
|
|
|
@@ -177,6 +178,19 @@ vueMcpNext({
|
|
|
177
178
|
},
|
|
178
179
|
plugins: []
|
|
179
180
|
}
|
|
181
|
+
},
|
|
182
|
+
performance: {
|
|
183
|
+
mode: 'auto',
|
|
184
|
+
maxDurationMs: 30000,
|
|
185
|
+
sampleIntervalMs: 250,
|
|
186
|
+
longTaskThresholdMs: 50,
|
|
187
|
+
saveDir: '.vite-mcp/performance',
|
|
188
|
+
memory: {
|
|
189
|
+
enabled: true
|
|
190
|
+
},
|
|
191
|
+
stacks: {
|
|
192
|
+
enabled: true
|
|
193
|
+
}
|
|
180
194
|
}
|
|
181
195
|
})
|
|
182
196
|
```
|
|
@@ -195,6 +209,7 @@ vueMcpNext({
|
|
|
195
209
|
| `screenshot` | `ScreenshotOptions` | CDP 优先,snapdom 降级 | 页面截图配置,控制真截图、DOM 降级截图、体积上限和 snapdom 扩展 |
|
|
196
210
|
| `screenshot.type` | `'path' \| 'base64'` | `'path'` | 项目级控制截图返回文件路径还是 base64 数据 |
|
|
197
211
|
| `screenshot.saveDir` | `string` | `'.vite-mcp/screenshot'` | 截图保存目录;相对路径按 Vite 项目根目录解析 |
|
|
212
|
+
| `performance` | `PerformanceOptions` | `auto + hook 兜底` | 性能诊断配置,控制采样时长、保存目录和 runtime / CDP 采集边界 |
|
|
198
213
|
|
|
199
214
|
`appendTo` 适合 playground、框架包装入口、或不希望通过 `transformIndexHtml` 注入的场景:
|
|
200
215
|
|
|
@@ -237,6 +252,37 @@ console.warn('mcp log', { ok: true })
|
|
|
237
252
|
|
|
238
253
|
如果需要完整 DevTools Console 行为,建议配置 CDP。
|
|
239
254
|
|
|
255
|
+
### 性能诊断
|
|
256
|
+
|
|
257
|
+
`performance.mode` 默认是 `auto`。插件会优先使用 CDP,拿到更完整的 CPU profile 和 heap snapshot;当没有调试权限时,会回退到页面 Hook,只采集浏览器公开可见的信号,例如长任务、事件循环延迟、内存趋势和运行时错误堆栈。
|
|
258
|
+
|
|
259
|
+
`performance.mode` 的含义如下:
|
|
260
|
+
|
|
261
|
+
- `auto`:能连上 CDP 就用 CDP,否则走 Hook
|
|
262
|
+
- `cdp`:强制使用 CDP,连不上就返回明确错误
|
|
263
|
+
- `hook`:只走 Hook,不尝试 CDP
|
|
264
|
+
- `off`:关闭性能诊断
|
|
265
|
+
|
|
266
|
+
可用工具如下:
|
|
267
|
+
|
|
268
|
+
- `record_performance`:一次性采样,适合快速判断页面是否卡顿
|
|
269
|
+
- `start_performance_recording` / `stop_performance_recording`:开始和结束一段录制,适合先观察现场再收口
|
|
270
|
+
- `get_performance_report`:读取最近缓存的报告和活动会话
|
|
271
|
+
- `take_heap_snapshot`:只支持 CDP,直接返回服务端保存的 heap snapshot 路径
|
|
272
|
+
|
|
273
|
+
示例:
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
record_performance
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
```text
|
|
280
|
+
start_performance_recording
|
|
281
|
+
stop_performance_recording
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
原始 CPU profile 和 heap snapshot 不会直接塞进 MCP 响应,而是由服务端写入 `performance.saveDir`,默认是 `.vite-mcp/performance`。工具返回的是摘要和文件路径,方便后续离线分析。
|
|
285
|
+
|
|
240
286
|
### CDP 配置
|
|
241
287
|
|
|
242
288
|
CDP(Chrome DevTools Protocol,Chrome DevTools 使用的浏览器调试协议)是可选能力。配置后,DOM、Console、Evaluate、Network 等通用 DevTools 能力会优先走 CDP;未配置或 target 不匹配时走页面 Hook 兜底。
|
|
@@ -692,3 +738,8 @@ npm publish
|
|
|
692
738
|
- `bugs: https://github.com/xiaou66/vite-plugin-vue-mcp-next/issues`
|
|
693
739
|
- `publishConfig.access: public`
|
|
694
740
|
- `files: dist, README.md, LICENSE`
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
# 友情链接
|
|
744
|
+
|
|
745
|
+
- [LINUX DO - 新的理想型社区](https://linux.do/)
|