@ecopages/dev-toolbar 0.2.0-beta.33 → 0.2.0-beta.35
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
CHANGED
|
@@ -28,7 +28,7 @@ Disable per project with `devToolbar: { enabled: false }`, or per process with `
|
|
|
28
28
|
|
|
29
29
|
## Built-in apps
|
|
30
30
|
|
|
31
|
-
- **Navigation** — route timing archive, initial load, client navigation latency, HMR status, page Integration (route owner); writes `#__ECO_DEV_NAV_TELEMETRY__` for machine/AI debug
|
|
31
|
+
- **Navigation** — route timing archive, initial load, client navigation latency, HMR status, page Integration (route owner); writes `#__ECO_DEV_NAV_TELEMETRY__` in `document.head` (with `data-eco-persist`) and exposes `window.__ECO_DEV_NAV_TELEMETRY__` for machine/AI debug
|
|
32
32
|
- **Deps** — Page Browser Graph entry/chunk assets, vendor URLs, lazy-load hints
|
|
33
33
|
- **Islands** — inspect island hosts stamped with `data-eco-island` (plus legacy React `eco-island` roots); click a row to highlight the live DOM node
|
|
34
34
|
- **A11y** — axe-core audit (with built-in fallback checks) and in-page highlights
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ export declare const DEV_TOOLBAR_PERSIST_KEY = "eco-dev-toolbar";
|
|
|
4
4
|
export declare const DEV_TOOLBAR_PLACEMENT_STORAGE_KEY = "ecopages:dev-toolbar:placement";
|
|
5
5
|
export declare const DEV_TOOLBAR_STEALTH_STORAGE_KEY = "ecopages:dev-toolbar:stealth";
|
|
6
6
|
export declare const DEV_TOOLBAR_NAVIGATION_APP_ID = "navigation";
|
|
7
|
+
export declare const DEV_TOOLBAR_NAV_TELEMETRY_PERSIST_KEY = "eco-dev-toolbar-nav-telemetry";
|
|
7
8
|
/** Full-opacity dwell after hover ends, before the fade phase. */
|
|
8
9
|
export declare const DEV_TOOLBAR_STEALTH_DWELL_MS = 4000;
|
|
9
10
|
/** Partial-opacity fade before the dock hides off-screen. */
|
package/src/runtime/constants.js
CHANGED
|
@@ -4,6 +4,7 @@ export const DEV_TOOLBAR_PERSIST_KEY = 'eco-dev-toolbar';
|
|
|
4
4
|
export const DEV_TOOLBAR_PLACEMENT_STORAGE_KEY = 'ecopages:dev-toolbar:placement';
|
|
5
5
|
export const DEV_TOOLBAR_STEALTH_STORAGE_KEY = 'ecopages:dev-toolbar:stealth';
|
|
6
6
|
export const DEV_TOOLBAR_NAVIGATION_APP_ID = 'navigation';
|
|
7
|
+
export const DEV_TOOLBAR_NAV_TELEMETRY_PERSIST_KEY = 'eco-dev-toolbar-nav-telemetry';
|
|
7
8
|
/** Full-opacity dwell after hover ends, before the fade phase. */
|
|
8
9
|
export const DEV_TOOLBAR_STEALTH_DWELL_MS = 4_000;
|
|
9
10
|
/** Partial-opacity fade before the dock hides off-screen. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEV_TOOLBAR_NAV_TELEMETRY_PERSIST_KEY } from './constants.js';
|
|
1
2
|
export const NAV_TELEMETRY_ELEMENT_ID = '__ECO_DEV_NAV_TELEMETRY__';
|
|
2
3
|
export const NAV_TELEMETRY_STORAGE_KEY = 'ecopages:dev-toolbar:nav-telemetry';
|
|
3
4
|
export const NAV_TELEMETRY_MAX_ENTRIES = 50;
|
|
@@ -88,7 +89,7 @@ function getTelemetryDocument() {
|
|
|
88
89
|
}
|
|
89
90
|
return document;
|
|
90
91
|
}
|
|
91
|
-
function buildSnapshot(
|
|
92
|
+
function buildSnapshot() {
|
|
92
93
|
const route = `${window.location.pathname}${window.location.search}`;
|
|
93
94
|
return {
|
|
94
95
|
updatedAt: new Date().toISOString(),
|
|
@@ -98,17 +99,21 @@ function buildSnapshot(doc = getTelemetryDocument()) {
|
|
|
98
99
|
summary: summarize(history),
|
|
99
100
|
};
|
|
100
101
|
}
|
|
102
|
+
function escapeTelemetryJson(snapshot) {
|
|
103
|
+
return JSON.stringify(snapshot).replace(/</g, '\\u003c');
|
|
104
|
+
}
|
|
101
105
|
function syncTelemetryElement(doc = getTelemetryDocument()) {
|
|
102
|
-
const snapshot = buildSnapshot(
|
|
106
|
+
const snapshot = buildSnapshot();
|
|
103
107
|
let element = doc.getElementById(NAV_TELEMETRY_ELEMENT_ID);
|
|
104
108
|
if (!element) {
|
|
105
109
|
const script = doc.createElement('script');
|
|
106
110
|
script.id = NAV_TELEMETRY_ELEMENT_ID;
|
|
107
111
|
script.setAttribute('type', 'application/json');
|
|
112
|
+
script.setAttribute('data-eco-persist', DEV_TOOLBAR_NAV_TELEMETRY_PERSIST_KEY);
|
|
108
113
|
element = script;
|
|
109
|
-
doc.
|
|
114
|
+
doc.head.append(element);
|
|
110
115
|
}
|
|
111
|
-
element.textContent =
|
|
116
|
+
element.textContent = escapeTelemetryJson(snapshot);
|
|
112
117
|
window.__ECO_DEV_NAV_TELEMETRY__ = createNavigationTelemetryApi();
|
|
113
118
|
return snapshot;
|
|
114
119
|
}
|
|
@@ -242,15 +247,16 @@ export function initNavigationTelemetry(doc = document) {
|
|
|
242
247
|
}
|
|
243
248
|
export function readNavigationTelemetrySnapshot(doc = document) {
|
|
244
249
|
const element = doc.getElementById(NAV_TELEMETRY_ELEMENT_ID);
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return undefined;
|
|
250
|
+
if (element?.textContent) {
|
|
251
|
+
try {
|
|
252
|
+
return JSON.parse(element.textContent);
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
// Fall through to the in-memory API when the DOM trace is stale or invalid.
|
|
256
|
+
}
|
|
253
257
|
}
|
|
258
|
+
const api = window.__ECO_DEV_NAV_TELEMETRY__;
|
|
259
|
+
return api?.getSnapshot();
|
|
254
260
|
}
|
|
255
261
|
/** Clears persisted navigation history and the DOM telemetry trace. */
|
|
256
262
|
export function clearNavigationTelemetryHistory() {
|
|
@@ -17,7 +17,7 @@ import '../apps/deps-panel.js';
|
|
|
17
17
|
import '../apps/islands-panel.js';
|
|
18
18
|
import '../apps/navigation-panel.js';
|
|
19
19
|
import '../apps/settings-panel.js';
|
|
20
|
-
import {
|
|
20
|
+
import { updateDevManifestInDocument } from '../api/dev-manifest.js';
|
|
21
21
|
import { DEV_TOOLBAR_ELEMENT_NAME, DEV_TOOLBAR_PERSIST_KEY } from '../runtime/constants.js';
|
|
22
22
|
import { readDevToolbarPreferences, writeDevToolbarPreferences, } from '../runtime/preferences.js';
|
|
23
23
|
import { A11yIcon, DepsIcon, IslandsIcon, NavigationIcon, SettingsIcon } from './icons.js';
|