@presto1314w/vite-devtools-browser 0.2.0 → 0.2.2
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 +9 -3
- package/dist/diagnose.js +28 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,17 +17,23 @@ It ships in two forms:
|
|
|
17
17
|
- Agent Skill: scenario-based debugging workflows for coding assistants
|
|
18
18
|
- CLI Runtime (`@presto1314w/vite-devtools-browser`): structured shell commands for local Vite debugging
|
|
19
19
|
|
|
20
|
-
Current documented baseline: `v0.2.
|
|
20
|
+
Current documented baseline: `v0.2.2`.
|
|
21
21
|
|
|
22
22
|
## What's New In v0.2
|
|
23
23
|
|
|
24
|
-
`v0.2.
|
|
24
|
+
`v0.2.x` moves `vite-browser` from snapshot-style inspection toward runtime diagnosis:
|
|
25
25
|
|
|
26
26
|
- browser/runtime events are captured into a daemon-side event queue
|
|
27
27
|
- `correlate errors` links the current error to recent HMR-updated modules
|
|
28
28
|
- `diagnose hmr` turns runtime, trace, and error signals into structured findings
|
|
29
29
|
- skills and CLI flows now route more directly to runtime triage instead of raw log inspection
|
|
30
30
|
|
|
31
|
+
`v0.2.2` is the stabilization pass for this model:
|
|
32
|
+
|
|
33
|
+
- tighter `diagnose hmr` wording around websocket evidence and runtime ambiguity
|
|
34
|
+
- better test coverage for the four built-in diagnosis families
|
|
35
|
+
- docs and release positioning aligned around the stable `v0.2.x` surface
|
|
36
|
+
|
|
31
37
|
## Built For Agents
|
|
32
38
|
|
|
33
39
|
`vite-browser` is designed for agent workflows as much as local debugging.
|
|
@@ -195,7 +201,7 @@ vite-browser svelte tree
|
|
|
195
201
|
|
|
196
202
|
## Current Boundaries
|
|
197
203
|
|
|
198
|
-
`vite-browser` v0.2 is strong at:
|
|
204
|
+
`vite-browser` v0.2.2 is strong at:
|
|
199
205
|
|
|
200
206
|
- surfacing runtime state as structured shell output
|
|
201
207
|
- linking current errors to recent HMR/module activity
|
package/dist/diagnose.js
CHANGED
|
@@ -4,7 +4,9 @@ export function diagnoseHMR(input) {
|
|
|
4
4
|
detectMissingModule(input),
|
|
5
5
|
detectClosedWebsocket(input),
|
|
6
6
|
detectRepeatedFullReload(input),
|
|
7
|
-
]
|
|
7
|
+
]
|
|
8
|
+
.filter((result) => result !== null)
|
|
9
|
+
.sort(compareDiagnosisResults);
|
|
8
10
|
if (results.length > 0)
|
|
9
11
|
return results;
|
|
10
12
|
return [
|
|
@@ -58,18 +60,23 @@ function detectMissingModule(input) {
|
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
function detectClosedWebsocket(input) {
|
|
61
|
-
const
|
|
63
|
+
const runtimeState = extractRuntimeSocketState(input.runtimeText);
|
|
64
|
+
const runtimeClosed = runtimeState === "closed" || runtimeState === "closing";
|
|
62
65
|
const traceClosed = /disconnected|failed to connect|connection lost|ws closed/i.test(input.hmrTraceText);
|
|
63
66
|
if (!runtimeClosed && !traceClosed)
|
|
64
67
|
return null;
|
|
68
|
+
const runtimeOnly = runtimeClosed && !traceClosed;
|
|
69
|
+
const traceOnly = traceClosed && !runtimeClosed;
|
|
65
70
|
return {
|
|
66
71
|
code: "hmr-websocket-closed",
|
|
67
72
|
status: "fail",
|
|
68
73
|
confidence: runtimeClosed && traceClosed ? "high" : "medium",
|
|
69
74
|
summary: "The HMR websocket is not healthy.",
|
|
70
|
-
detail:
|
|
71
|
-
? "Runtime status reports the HMR socket as closed
|
|
72
|
-
:
|
|
75
|
+
detail: runtimeOnly
|
|
76
|
+
? "Runtime status reports the HMR socket as closed or closing."
|
|
77
|
+
: traceOnly
|
|
78
|
+
? "HMR trace contains disconnect or websocket failure messages."
|
|
79
|
+
: "Runtime status and HMR trace both indicate websocket instability.",
|
|
73
80
|
suggestion: "Check the dev server is running, the page is connected to the correct origin, and no proxy/firewall is blocking the websocket.",
|
|
74
81
|
};
|
|
75
82
|
}
|
|
@@ -86,3 +93,19 @@ function detectRepeatedFullReload(input) {
|
|
|
86
93
|
suggestion: "Check whether the changed module is outside HMR boundaries, introduces side effects, or triggers a circular dependency.",
|
|
87
94
|
};
|
|
88
95
|
}
|
|
96
|
+
function extractRuntimeSocketState(runtimeText) {
|
|
97
|
+
const match = runtimeText.match(/HMR Socket:\s*(open|closed|closing|connecting|unknown)/i);
|
|
98
|
+
const state = match?.[1]?.toLowerCase();
|
|
99
|
+
if (state === "open" || state === "closed" || state === "closing" || state === "connecting") {
|
|
100
|
+
return state;
|
|
101
|
+
}
|
|
102
|
+
return "unknown";
|
|
103
|
+
}
|
|
104
|
+
function compareDiagnosisResults(a, b) {
|
|
105
|
+
return scoreDiagnosis(b) - scoreDiagnosis(a);
|
|
106
|
+
}
|
|
107
|
+
function scoreDiagnosis(result) {
|
|
108
|
+
const statusScore = result.status === "fail" ? 30 : result.status === "warn" ? 20 : 10;
|
|
109
|
+
const confidenceScore = result.confidence === "high" ? 3 : result.confidence === "medium" ? 2 : 1;
|
|
110
|
+
return statusScore + confidenceScore;
|
|
111
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@presto1314w/vite-devtools-browser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Runtime diagnostics CLI for Vite apps with event-stream correlation, HMR diagnosis, framework inspection, and mapped errors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|