@vobs/devtools 1.0.0
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/LICENSE +21 -0
- package/README.md +50 -0
- package/package.json +22 -0
- package/src/index.test.ts +696 -0
- package/src/index.ts +2189 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vobs contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @vobs/devtools
|
|
2
|
+
|
|
3
|
+
Debug instrumentation for Vobs applications: owner trees, signals, effects, dependency graphs, update traces, DOM mutations, network requests and errors.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vobs/devtools
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { devtoolsPlugin, getDevTools } from '@vobs/devtools'
|
|
15
|
+
import { createVobs } from '@vobs/vobs'
|
|
16
|
+
|
|
17
|
+
createVobs({ render, plugins: [devtoolsPlugin({ maxUpdates: 200 })] })
|
|
18
|
+
|
|
19
|
+
const devtools = getDevTools()
|
|
20
|
+
devtools?.subscribe('update', trace => {
|
|
21
|
+
console.log(trace.signalName, trace.duration, trace.domUpdates.length)
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Signature | Description |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `createDevTools(options?)` | Start collecting debug data through the reactivity, runtime and HTTP debug hooks; returns a `DevToolsAPI`. Options include `expose`, `target`, `maxUpdates`, `slowUpdateThreshold`, `privacy`, `allowMutations` and `router`. |
|
|
30
|
+
| `enableDevTools(options?)` / `disableDevTools()` | Create or dispose the global instance. |
|
|
31
|
+
| `getDevTools()` | Read the active `DevToolsAPI`, or `null`. |
|
|
32
|
+
| `devtoolsPlugin(options?)` | Wrap collection in a `VobsPlugin` that also reports application errors; set `enabled: false` to skip. |
|
|
33
|
+
| `connectDevTools(options?)` | Expose the API to a panel over `postMessage` (request/response/event protocol); returns a disconnect function. |
|
|
34
|
+
| `api.getComponentTree()` / `api.getComponent(ownerId)` | Owner tree with per-component signals, effects, recent updates and DOM mutation counts. |
|
|
35
|
+
| `api.getSignals()` / `api.getSignal(id)` | Signal and memo values, owners and subscriber counts. |
|
|
36
|
+
| `api.getEffects()` | Effect status, execution count, last duration and last error. |
|
|
37
|
+
| `api.getDependencies(id)` / `api.getDependents(id)` | Dependency graph edges (`state-to-memo`, `memo-to-effect`, ...). |
|
|
38
|
+
| `api.getUpdates()` / `api.onUpdate(callback)` | One trace per update: previous/next values, affected effects, DOM updates, status and duration. |
|
|
39
|
+
| `api.getNetworkRequests()` | HTTP request traces with timing, retries, route and environment. |
|
|
40
|
+
| `api.getErrors()` / `api.reportError(phase, error, context?)` | Error traces grouped by phase and origin. |
|
|
41
|
+
| `api.subscribe(event, callback)` | Listen to `DEVTOOLS_EVENTS` such as `signal-update`, `effect-run`, `dom-update`, `network-request` or `error`; returns an unsubscribe function. |
|
|
42
|
+
| `api.setSignalValue(id, value)` | Mutate a signal; requires `allowMutations: true`. |
|
|
43
|
+
| `api.setCollectionPaused(paused)` / `api.clearUpdates()` / `api.clearNetworkRequests()` / `api.clearErrors()` / `api.clearLifecycleEvents()` | Collection control. |
|
|
44
|
+
| `api.getPerformanceMetrics()` / `api.takeMemorySnapshot()` | Update/effect/request timing aggregates and signal/effect/owner counts. |
|
|
45
|
+
| `api.exportDiagnostics()` / `api.importDiagnostics(snapshot)` | Export or restore a full `DevToolsDiagnosticSnapshot`. |
|
|
46
|
+
| `api.registerInspector(id, inspector)` / `api.registerTimeline(id, timeline?)` / `api.registerMetric(id, metric)` | Extension points surfaced through `getExtensionSnapshot()`. |
|
|
47
|
+
|
|
48
|
+
## Types
|
|
49
|
+
|
|
50
|
+
DevToolsAPI, DevToolsOptions, DevToolsPluginOptions, DevToolsBridgeOptions, DevToolsTarget, DevToolsRouterSource, DevToolsRouterContext, ComponentDebugNode, SignalDebugInfo, EffectDebugInfo, DependencyEdge, DependencyEdgeType, UpdateTrace, EffectExecutionInfo, DomUpdateInfo, LifecycleEvent, LifecycleEventType, NetworkRequestTrace, DebugErrorInfo, DevToolsErrorTrace, DevToolsErrorPhase, DevToolsErrorOrigin, DevToolsErrorRecovery, DevToolsErrorContext, DevToolsCollectionState, DevToolsPrivacyOptions, DevToolsPerformanceEntry, PerformanceMetrics, MemorySnapshot, DevToolsDiagnosticSnapshot, DevToolsExtensionSnapshot, DevToolsInspector, DevToolsTimeline, DevToolsTimelineEvent, DevToolsMetric, DevToolsSelection, DevToolsSSRRequestSnapshot, DevToolsWireRequest, DevToolsWireResponse, DevToolsWireEvent, DevToolsMessageTarget, DevToolsMessageEvent
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"license": "MIT",
|
|
3
|
+
"files": [
|
|
4
|
+
"src",
|
|
5
|
+
"README.md",
|
|
6
|
+
"LICENSE"
|
|
7
|
+
],
|
|
8
|
+
"name": "@vobs/devtools",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "src/index.ts",
|
|
12
|
+
"types": "src/index.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./src/index.ts"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@vobs/reactivity": "1.0.0",
|
|
18
|
+
"@vobs/runtime": "1.0.0",
|
|
19
|
+
"@vobs/http": "1.0.0",
|
|
20
|
+
"@vobs/vobs": "1.0.0"
|
|
21
|
+
}
|
|
22
|
+
}
|