@octanejs/devtools 0.0.52 → 0.0.53
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/package.json +2 -2
- package/src/bridge.ts +3 -0
- package/src/client.ts +2 -0
- package/src/index.ts +2 -25
- package/src/panel/ComponentsTab.tsrx +3 -0
- package/src/panel/OctanePanel.tsrx +4 -5
- package/src/panel/PerfModelTab.tsrx +3 -0
- package/src/panel/ProfilerTab.tsrx +3 -0
- package/src/panel/TransitionsTab.tsrx +3 -0
- package/src/panel/styles.ts +2 -0
- package/src/plugin.tsrx +28 -0
- package/src/plugin.tsrx.d.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/devtools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@octanejs/testing-library": "0.1.63",
|
|
49
49
|
"@tanstack/devtools-event-bus": "0.4.2",
|
|
50
50
|
"@testing-library/jest-dom": "^6.9.1",
|
|
51
|
-
"octane": "0.13.
|
|
51
|
+
"octane": "0.13.6",
|
|
52
52
|
"vitest": "^4.1.10"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
package/src/bridge.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
OctaneDevtoolsEventClient,
|
|
3
5
|
type NodeDetail,
|
|
@@ -37,6 +39,7 @@ function getProfiler(): ProfilerGlobal | undefined {
|
|
|
37
39
|
// own re-renders from perpetually changing the profile snapshot — which, with
|
|
38
40
|
// the dedupe below, lets the live view settle when the app is idle.
|
|
39
41
|
const DEVTOOLS_OWN_COMPONENTS = new Set([
|
|
42
|
+
'OctaneDevtoolsPanel',
|
|
40
43
|
'OctanePanel',
|
|
41
44
|
'ComponentsTab',
|
|
42
45
|
'ProfilerTab',
|
package/src/client.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/** @jsxImportSource octane */
|
|
2
1
|
'use client';
|
|
2
|
+
'use strong';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import { OctaneDevtoolsEventClient } from './client';
|
|
6
|
-
import { startBridge } from './bridge';
|
|
7
|
-
import { OctanePanel } from './panel/OctanePanel.tsrx';
|
|
8
|
-
|
|
4
|
+
export { octaneDevtools } from './plugin.tsrx';
|
|
9
5
|
export { OctaneDevtoolsEventClient } from './client';
|
|
10
6
|
export { startBridge } from './bridge';
|
|
11
7
|
export { ComponentsTab } from './panel/ComponentsTab.tsrx';
|
|
@@ -14,22 +10,3 @@ export { TransitionsTab } from './panel/TransitionsTab.tsrx';
|
|
|
14
10
|
export { PerfModelTab } from './panel/PerfModelTab.tsrx';
|
|
15
11
|
export { OctanePanel } from './panel/OctanePanel.tsrx';
|
|
16
12
|
export type { TreeSnapshot, NodeDetail, WireTreeNode } from './client';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A TanStack Devtools plugin exposing live Octane runtime diagnostics. Add it to
|
|
20
|
-
* `<TanStackDevtools plugins={[octaneDevtools()]} />`. Starts the app-side bridge
|
|
21
|
-
* on first render; the bridge is a no-op unless the app was built with devtools
|
|
22
|
-
* enabled (`octane({ devtools: true })`).
|
|
23
|
-
*/
|
|
24
|
-
export function octaneDevtools() {
|
|
25
|
-
const client = new OctaneDevtoolsEventClient();
|
|
26
|
-
let stop: (() => void) | null = null;
|
|
27
|
-
return {
|
|
28
|
-
id: 'octane',
|
|
29
|
-
name: 'Octane',
|
|
30
|
-
render: () => {
|
|
31
|
-
if (stop === null) stop = startBridge(client);
|
|
32
|
-
return createElement(OctanePanel, { client });
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
// The Components tab: subscribes to the app-side bridge's `tree`/`inspect` events
|
|
2
4
|
// (startBridge) and renders the live component tree plus a selected-node state
|
|
3
5
|
// inspector. Read-only — selecting a node only asks the app to describe it
|
|
@@ -112,6 +114,7 @@ export function ComponentsTab(props: { client: OctaneDevtoolsEventClient }): Oct
|
|
|
112
114
|
setSelected(null);
|
|
113
115
|
}
|
|
114
116
|
});
|
|
117
|
+
client.emit('refresh', {});
|
|
115
118
|
return () => {
|
|
116
119
|
offTree();
|
|
117
120
|
offInspect();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
// The tab shell hosting the Components (P1), Profiler (P2), Transitions (P3),
|
|
2
4
|
// and Performance-model (P4) tabs. This is the plugin's top-level render()
|
|
3
|
-
// node — see ../index.ts. It injects the Octane-branded panel stylesheet once
|
|
4
|
-
//
|
|
5
|
+
// node — see ../index.ts. It injects the Octane-branded panel stylesheet once;
|
|
6
|
+
// each tab subscribes before requesting its current snapshot.
|
|
5
7
|
import { useEffect, useState } from 'octane';
|
|
6
8
|
import type { OctaneNode } from 'octane';
|
|
7
9
|
import { OctaneDevtoolsEventClient } from '../client';
|
|
@@ -33,9 +35,6 @@ export function OctanePanel(props: { client: OctaneDevtoolsEventClient }): Octan
|
|
|
33
35
|
el.textContent = OCTANE_DEVTOOLS_CSS;
|
|
34
36
|
document.head.appendChild(el);
|
|
35
37
|
}
|
|
36
|
-
// Pull a current snapshot so tabs show data on open, not only after the
|
|
37
|
-
// next scheduler flush.
|
|
38
|
-
client.emit('refresh', {});
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
return (
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
// The Performance-model tab: derives aggregate "what's slow" views from the SAME
|
|
2
4
|
// `profile` event the Profiler tab already consumes — no new event, bridge path, or
|
|
3
5
|
// runtime probe. Where the Profiler tab shows a per-commit table, this tab shows
|
|
@@ -17,6 +19,7 @@ export function PerfModelTab(props: { client: OctaneDevtoolsEventClient }): Octa
|
|
|
17
19
|
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
const off = client.on('profile', (e) => setSnapshot(e.payload));
|
|
22
|
+
client.emit('refresh', {});
|
|
20
23
|
return () => off();
|
|
21
24
|
});
|
|
22
25
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
// The Profiler tab: subscribes to the app-side bridge's `profile` event (startBridge,
|
|
2
4
|
// which reads globalThis.__OCTANE_PROFILER__ per flush) and renders a ranked
|
|
3
5
|
// self-time table plus a recent-commits list. Absent a profiler global on the app
|
|
@@ -16,6 +18,7 @@ export function ProfilerTab(props: { client: OctaneDevtoolsEventClient }): Octan
|
|
|
16
18
|
|
|
17
19
|
useEffect(() => {
|
|
18
20
|
const off = client.on('profile', (e) => setSnapshot(e.payload));
|
|
21
|
+
client.emit('refresh', {});
|
|
19
22
|
return () => off();
|
|
20
23
|
});
|
|
21
24
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strong';
|
|
2
|
+
|
|
1
3
|
// The Transitions & Suspense tab: subscribes to the app-side bridge's `transition`
|
|
2
4
|
// event (startBridge, which reads the devtools hook's getTransitionState() per
|
|
3
5
|
// flush) and renders the live pending-transition count plus each Suspense boundary's
|
|
@@ -20,6 +22,7 @@ export function TransitionsTab(props: { client: OctaneDevtoolsEventClient }): Oc
|
|
|
20
22
|
|
|
21
23
|
useEffect(() => {
|
|
22
24
|
const off = client.on('transition', (e) => setSnapshot(e.payload));
|
|
25
|
+
client.emit('refresh', {});
|
|
23
26
|
return () => off();
|
|
24
27
|
});
|
|
25
28
|
|
package/src/panel/styles.ts
CHANGED
package/src/plugin.tsrx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strong';
|
|
3
|
+
|
|
4
|
+
import { OctaneDevtoolsEventClient } from './client';
|
|
5
|
+
import { startBridge } from './bridge';
|
|
6
|
+
import { OctanePanel } from './panel/OctanePanel.tsrx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A TanStack Devtools plugin exposing live Octane runtime diagnostics. Add it to
|
|
10
|
+
* `<TanStackDevtools plugins={[octaneDevtools()]} />`. Starts the app-side bridge
|
|
11
|
+
* on first render; the bridge is a no-op unless the app was built with devtools
|
|
12
|
+
* enabled (`octane({ devtools: true })`).
|
|
13
|
+
*/
|
|
14
|
+
export function octaneDevtools() {
|
|
15
|
+
const client = new OctaneDevtoolsEventClient();
|
|
16
|
+
let stop: (() => void) | null = null;
|
|
17
|
+
const OctaneDevtoolsPanel = () => @{
|
|
18
|
+
<OctanePanel client={client} />
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
id: 'octane',
|
|
22
|
+
name: 'Octane',
|
|
23
|
+
render: () => {
|
|
24
|
+
if (stop === null) stop = startBridge(client);
|
|
25
|
+
return OctaneDevtoolsPanel;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|