@presto1314w/vite-devtools-browser 0.3.2 → 0.3.5

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.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Uses @vue/devtools-kit to access Vue component tree and state
5
5
  */
6
- export function formatComponentTree(apps) {
6
+ export function formatComponentTree(apps, maxDepth = 50) {
7
7
  if (apps.length === 0)
8
8
  return "No Vue apps found";
9
9
  const output = [];
@@ -23,11 +23,17 @@ export function formatComponentTree(apps) {
23
23
  return;
24
24
  if (seen.has(instance))
25
25
  return;
26
+ if (depth > maxDepth) {
27
+ output.push(`${" ".repeat(depth)}[max depth reached]`);
28
+ return;
29
+ }
26
30
  seen.add(instance);
27
31
  const indent = " ".repeat(depth);
28
32
  const name = instance.type?.name || instance.type?.__name || "Anonymous";
29
33
  const uid = instance.uid ?? "?";
30
- output.push(`${indent}[${uid}] ${name}`);
34
+ const file = instance.type?.__file;
35
+ const fileSuffix = file ? ` [${file}]` : "";
36
+ output.push(`${indent}[${uid}] ${name}${fileSuffix}`);
31
37
  const subTree = instance.subTree;
32
38
  if (subTree?.component)
33
39
  visit(subTree.component, depth + 1);
@@ -169,6 +175,7 @@ export function formatPiniaStores(pinia, storeName, piniaFromWindow = true) {
169
175
  getterNames.push(...Array.from(rawGetters).map(String));
170
176
  else if (rawGetters && typeof rawGetters === "object")
171
177
  getterNames.push(...Object.keys(rawGetters));
178
+ const getterSet = new Set(getterNames);
172
179
  if (getterNames.length > 0) {
173
180
  output.push("## Getters");
174
181
  for (const key of getterNames) {
@@ -181,6 +188,24 @@ export function formatPiniaStores(pinia, storeName, piniaFromWindow = true) {
181
188
  }
182
189
  output.push("");
183
190
  }
191
+ // List actions (own functions on the store, excluding $ prefixed internals)
192
+ const actionNames = [];
193
+ if (store && typeof store === "object") {
194
+ for (const key of Object.keys(store)) {
195
+ if (key.startsWith("$") || key.startsWith("_"))
196
+ continue;
197
+ if (typeof store[key] === "function" && !getterSet.has(key)) {
198
+ actionNames.push(key);
199
+ }
200
+ }
201
+ }
202
+ if (actionNames.length > 0) {
203
+ output.push("## Actions");
204
+ for (const key of actionNames) {
205
+ output.push(` ${key}()`);
206
+ }
207
+ output.push("");
208
+ }
184
209
  return output.join("\n");
185
210
  }
186
211
  export function formatRouterInfo(actualRouter) {
@@ -199,6 +224,16 @@ export function formatRouterInfo(actualRouter) {
199
224
  if (currentRoute.query && Object.keys(currentRoute.query).length > 0) {
200
225
  output.push(` Query: ${JSON.stringify(currentRoute.query)}`);
201
226
  }
227
+ if (currentRoute.hash) {
228
+ output.push(` Hash: ${currentRoute.hash}`);
229
+ }
230
+ if (currentRoute.meta && Object.keys(currentRoute.meta).length > 0) {
231
+ output.push(` Meta: ${JSON.stringify(currentRoute.meta)}`);
232
+ }
233
+ const matched = currentRoute.matched;
234
+ if (Array.isArray(matched) && matched.length > 1) {
235
+ output.push(` Matched: ${matched.map((r) => r.path || r.name).join(" > ")}`);
236
+ }
202
237
  output.push("");
203
238
  }
204
239
  const routes = actualRouter.getRoutes?.() || actualRouter.options?.routes || [];
@@ -206,7 +241,10 @@ export function formatRouterInfo(actualRouter) {
206
241
  output.push("## All Routes");
207
242
  routes.forEach((route) => {
208
243
  const routeName = route.name ? ` (${route.name})` : "";
209
- output.push(` ${route.path}${routeName}`);
244
+ const meta = route.meta && Object.keys(route.meta).length > 0
245
+ ? ` meta=${JSON.stringify(route.meta)}`
246
+ : "";
247
+ output.push(` ${route.path}${routeName}${meta}`);
210
248
  });
211
249
  }
212
250
  return output.join("\n");
package/package.json CHANGED
@@ -1,65 +1,69 @@
1
- {
2
- "name": "@presto1314w/vite-devtools-browser",
3
- "version": "0.3.2",
4
- "description": "Runtime diagnostics CLI for Vite apps with event-stream correlation, HMR diagnosis, framework inspection, and mapped errors",
5
- "license": "MIT",
6
- "keywords": [
7
- "vite",
8
- "devtools",
9
- "debugging",
10
- "runtime-diagnostics",
11
- "hmr",
12
- "module-graph",
13
- "sourcemap",
14
- "vue",
15
- "react",
16
- "svelte",
17
- "cli",
18
- "ai-agents"
19
- ],
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/MapleCity1314/vite-browser.git"
23
- },
24
- "homepage": "https://github.com/MapleCity1314/vite-browser#readme",
25
- "bugs": {
26
- "url": "https://github.com/MapleCity1314/vite-browser/issues"
27
- },
28
- "type": "module",
29
- "engines": {
30
- "node": ">=20"
31
- },
32
- "files": [
33
- "dist"
34
- ],
35
- "bin": {
36
- "vite-browser": "dist/cli.js"
37
- },
38
- "scripts": {
39
- "start": "node --import tsx src/cli.ts",
40
- "dev": "tsx src/cli.ts",
41
- "typecheck": "tsc --noEmit",
42
- "build": "tsc -p tsconfig.build.json",
43
- "prepack": "pnpm build",
44
- "test": "vitest run",
45
- "test:watch": "vitest",
46
- "test:coverage": "vitest run --coverage",
47
- "test:evals": "vitest run --dir test/evals",
48
- "test:evals:ci": "vitest run --dir test/evals --coverage --reporter=default",
49
- "test:evals:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts"
50
- },
51
- "dependencies": {
52
- "playwright": "^1.50.0",
53
- "source-map-js": "^1.2.1"
54
- },
55
- "devDependencies": {
56
- "@types/node": "^22.0.0",
57
- "@vitest/coverage-v8": "^4.0.18",
58
- "@vue/devtools-kit": "^7.3.2",
59
- "@vue/devtools-api": "^7.3.2",
60
- "tsx": "^4.20.6",
61
- "typescript": "^5.7.0",
62
- "vitest": "^4.0.16"
63
- },
64
- "packageManager": "pnpm@10.29.2"
65
- }
1
+ {
2
+ "name": "@presto1314w/vite-devtools-browser",
3
+ "version": "0.3.5",
4
+ "description": "Runtime diagnostics CLI for Vite apps with event-stream correlation, HMR diagnosis, framework inspection, and mapped errors",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "vite",
8
+ "devtools",
9
+ "debugging",
10
+ "runtime-diagnostics",
11
+ "hmr",
12
+ "module-graph",
13
+ "sourcemap",
14
+ "vue",
15
+ "react",
16
+ "svelte",
17
+ "cli",
18
+ "ai-agents"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/MapleCity1314/vite-browser.git"
23
+ },
24
+ "homepage": "https://github.com/MapleCity1314/vite-browser#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/MapleCity1314/vite-browser/issues"
27
+ },
28
+ "type": "module",
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "bin": {
36
+ "vite-browser": "dist/cli.js"
37
+ },
38
+ "scripts": {
39
+ "start": "node --import tsx src/cli.ts",
40
+ "dev": "tsx src/cli.ts",
41
+ "docs:dev": "vitepress dev docs",
42
+ "docs:build": "vitepress build docs",
43
+ "docs:preview": "vitepress preview docs",
44
+ "typecheck": "tsc --noEmit",
45
+ "build": "tsc -p tsconfig.build.json",
46
+ "prepack": "pnpm build",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "test:coverage": "vitest run --coverage",
50
+ "test:evals": "vitest run --dir test/evals",
51
+ "test:evals:ci": "vitest run --dir test/evals --coverage --reporter=default",
52
+ "test:evals:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts"
53
+ },
54
+ "dependencies": {
55
+ "playwright": "^1.50.0",
56
+ "source-map-js": "^1.2.1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^22.0.0",
60
+ "@vitest/coverage-v8": "^4.0.18",
61
+ "@vue/devtools-api": "^7.3.2",
62
+ "@vue/devtools-kit": "^7.3.2",
63
+ "tsx": "^4.20.6",
64
+ "typescript": "^5.7.0",
65
+ "vitepress": "^1.6.4",
66
+ "vitest": "^4.0.16"
67
+ },
68
+ "packageManager": "pnpm@10.29.2"
69
+ }