()
| 8 | import * as ui from './ui/index.ts' |
| 9 | |
| 10 | export function createDependencyGraph() { |
| 11 | const ctx = useAppCtx() |
| 12 | |
| 13 | const [graph, setGraph] = s.createSignal<debug.DGraphUpdate>(null) |
| 14 | |
| 15 | ctx.input.listen(e => { |
| 16 | // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check |
| 17 | switch (e.kind) { |
| 18 | case 'DgraphUpdate': |
| 19 | setGraph(e.data) |
| 20 | break |
| 21 | } |
| 22 | }) |
| 23 | |
| 24 | ctx.output.emit(msg('ToggleModule', {module: debug.DebuggerModule.Dgraph, enabled: true})) |
| 25 | s.onCleanup(() => { |
| 26 | ctx.output.emit(msg('ToggleModule', {module: debug.DebuggerModule.Dgraph, enabled: false})) |
| 27 | }) |
| 28 | |
| 29 | function inspectNode(id: debug.NodeID) { |
| 30 | const node = graph()?.[id] |
| 31 | // eslint-disable-next-line no-console |
| 32 | if (!node) return console.warn('inspectNode: node not found', id) |
| 33 | |
| 34 | if (node.type === debug.NodeType.Signal) { |
| 35 | ctx.inspector.setInspectedNode(node.graph ?? null, id) |
| 36 | } else { |
| 37 | ctx.inspector.setInspectedOwner(id) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | return { |
| 42 | graph, |
| 43 | inspectNode, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | type NodeOrder = { |
| 48 | flowOrder: readonly debug.NodeID[] |
no test coverage detected
searching dependent graphs…