codegraph-java 0.1.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/README.md +131 -0
- package/dist/base-graph/index.d.ts +57 -0
- package/dist/base-graph/index.d.ts.map +1 -0
- package/dist/base-graph/index.js +175 -0
- package/dist/base-graph/index.js.map +1 -0
- package/dist/bin/codegraph.d.ts +28 -0
- package/dist/bin/codegraph.d.ts.map +1 -0
- package/dist/bin/codegraph.js +2615 -0
- package/dist/bin/codegraph.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +49 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +95 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/fatal-handler.d.ts +20 -0
- package/dist/bin/fatal-handler.d.ts.map +1 -0
- package/dist/bin/fatal-handler.js +118 -0
- package/dist/bin/fatal-handler.js.map +1 -0
- package/dist/bin/node-version-check.d.ts +45 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +98 -0
- package/dist/bin/node-version-check.js.map +1 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/bin/uninstall.d.ts.map +1 -0
- package/dist/bin/uninstall.js +36 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/context/formatter.d.ts +36 -0
- package/dist/context/formatter.d.ts.map +1 -0
- package/dist/context/formatter.js +269 -0
- package/dist/context/formatter.js.map +1 -0
- package/dist/context/index.d.ts +131 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1378 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/index.d.ts +380 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +854 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +255 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +1060 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +3191 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +209 -0
- package/dist/db/sqlite-adapter.d.ts +55 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sqlite-adapter.js +135 -0
- package/dist/db/sqlite-adapter.js.map +1 -0
- package/dist/db/wal-valve.d.ts +119 -0
- package/dist/db/wal-valve.d.ts.map +1 -0
- package/dist/db/wal-valve.js +290 -0
- package/dist/db/wal-valve.js.map +1 -0
- package/dist/directory.d.ts +213 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +781 -0
- package/dist/directory.js.map +1 -0
- package/dist/errors.d.ts +150 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +234 -0
- package/dist/errors.js.map +1 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/extraction-version.d.ts.map +1 -0
- package/dist/extraction/extraction-version.js +28 -0
- package/dist/extraction/extraction-version.js.map +1 -0
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/function-ref.d.ts.map +1 -0
- package/dist/extraction/function-ref.js +746 -0
- package/dist/extraction/function-ref.js.map +1 -0
- package/dist/extraction/generated-detection.d.ts +66 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +248 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +148 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +558 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +367 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +2833 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/kernel/decode.d.ts +9 -0
- package/dist/extraction/kernel/decode.d.ts.map +1 -0
- package/dist/extraction/kernel/decode.js +162 -0
- package/dist/extraction/kernel/decode.js.map +1 -0
- package/dist/extraction/kernel/index.d.ts +64 -0
- package/dist/extraction/kernel/index.d.ts.map +1 -0
- package/dist/extraction/kernel/index.js +204 -0
- package/dist/extraction/kernel/index.js.map +1 -0
- package/dist/extraction/kernel/layout.d.ts +101 -0
- package/dist/extraction/kernel/layout.d.ts.map +1 -0
- package/dist/extraction/kernel/layout.js +104 -0
- package/dist/extraction/kernel/layout.js.map +1 -0
- package/dist/extraction/kernel/loader.d.ts +103 -0
- package/dist/extraction/kernel/loader.d.ts.map +1 -0
- package/dist/extraction/kernel/loader.js +146 -0
- package/dist/extraction/kernel/loader.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +124 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +1689 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -0
- package/dist/extraction/languages/index.d.ts +11 -0
- package/dist/extraction/languages/index.d.ts.map +1 -0
- package/dist/extraction/languages/index.js +15 -0
- package/dist/extraction/languages/index.js.map +1 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.d.ts.map +1 -0
- package/dist/extraction/languages/java.js +315 -0
- package/dist/extraction/languages/java.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts +23 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -0
- package/dist/extraction/languages/rust.js +169 -0
- package/dist/extraction/languages/rust.js.map +1 -0
- package/dist/extraction/parse-pool.d.ts +167 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +421 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.d.ts.map +1 -0
- package/dist/extraction/parse-worker.js +138 -0
- package/dist/extraction/parse-worker.js.map +1 -0
- package/dist/extraction/store-worker.d.ts +24 -0
- package/dist/extraction/store-worker.d.ts.map +1 -0
- package/dist/extraction/store-worker.js +139 -0
- package/dist/extraction/store-worker.js.map +1 -0
- package/dist/extraction/store-writer.d.ts +63 -0
- package/dist/extraction/store-writer.d.ts.map +1 -0
- package/dist/extraction/store-writer.js +174 -0
- package/dist/extraction/store-writer.js.map +1 -0
- package/dist/extraction/syntax-tokens.d.ts +103 -0
- package/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/dist/extraction/syntax-tokens.js +381 -0
- package/dist/extraction/syntax-tokens.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-helpers.js +153 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +260 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter-types.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts +745 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +6725 -0
- package/dist/extraction/tree-sitter.js.map +1 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +130 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/branch-guards.d.ts +248 -0
- package/dist/graph/branch-guards.d.ts.map +1 -0
- package/dist/graph/branch-guards.js +2231 -0
- package/dist/graph/branch-guards.js.map +1 -0
- package/dist/graph/dead-code.d.ts +251 -0
- package/dist/graph/dead-code.d.ts.map +1 -0
- package/dist/graph/dead-code.js +756 -0
- package/dist/graph/dead-code.js.map +1 -0
- package/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/dist/graph/dynamic-boundary-report.js +283 -0
- package/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/dist/graph/index.d.ts +12 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +28 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/named-symbol-flow.d.ts +153 -0
- package/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/dist/graph/named-symbol-flow.js +609 -0
- package/dist/graph/named-symbol-flow.js.map +1 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +341 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +599 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/graph/type-hierarchy.d.ts +155 -0
- package/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/dist/graph/type-hierarchy.js +382 -0
- package/dist/graph/type-hierarchy.js.map +1 -0
- package/dist/index.d.ts +886 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2019 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/beta-signup.d.ts +54 -0
- package/dist/installer/beta-signup.d.ts.map +1 -0
- package/dist/installer/beta-signup.js +178 -0
- package/dist/installer/beta-signup.js.map +1 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/config-writer.d.ts.map +1 -0
- package/dist/installer/config-writer.js +91 -0
- package/dist/installer/config-writer.js.map +1 -0
- package/dist/installer/index.d.ts +143 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +632 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +41 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +53 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +62 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +486 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +32 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +202 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/installer/targets/copilot-cli.js +209 -0
- package/dist/installer/targets/copilot-cli.js.map +1 -0
- package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/dist/installer/targets/copilot-vscode.js +219 -0
- package/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +254 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +165 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -0
- package/dist/installer/targets/hermes.js +359 -0
- package/dist/installer/targets/hermes.js.map +1 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +38 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +288 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +101 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +101 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +264 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +53 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +226 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/trae.d.ts +30 -0
- package/dist/installer/targets/trae.d.ts.map +1 -0
- package/dist/installer/targets/trae.js +164 -0
- package/dist/installer/targets/trae.js.map +1 -0
- package/dist/installer/targets/types.d.ts +108 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/installer/targets/workbuddy.d.ts +29 -0
- package/dist/installer/targets/workbuddy.d.ts.map +1 -0
- package/dist/installer/targets/workbuddy.js +163 -0
- package/dist/installer/targets/workbuddy.js.map +1 -0
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/dist/mcp/daemon-manager.js +129 -0
- package/dist/mcp/daemon-manager.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +79 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +219 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon-registry.d.ts +57 -0
- package/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/dist/mcp/daemon-registry.js +281 -0
- package/dist/mcp/daemon-registry.js.map +1 -0
- package/dist/mcp/daemon.d.ts +293 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +864 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/dist/mcp/dynamic-boundaries.js +360 -0
- package/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/dist/mcp/early-ppid.d.ts +26 -0
- package/dist/mcp/early-ppid.d.ts.map +1 -0
- package/dist/mcp/early-ppid.js +29 -0
- package/dist/mcp/early-ppid.js.map +1 -0
- package/dist/mcp/engine.d.ts +125 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +392 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/explore-dedup.d.ts +137 -0
- package/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/dist/mcp/explore-dedup.js +236 -0
- package/dist/mcp/explore-dedup.js.map +1 -0
- package/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/dist/mcp/explore-diagnostics.js +558 -0
- package/dist/mcp/explore-diagnostics.js.map +1 -0
- package/dist/mcp/explore-session-state.d.ts +217 -0
- package/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/dist/mcp/explore-session-state.js +322 -0
- package/dist/mcp/explore-session-state.js.map +1 -0
- package/dist/mcp/index.d.ts +137 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +567 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/liveness-watchdog.d.ts +35 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/dist/mcp/liveness-watchdog.js +269 -0
- package/dist/mcp/liveness-watchdog.js.map +1 -0
- package/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/dist/mcp/ppid-watchdog.js +64 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -0
- package/dist/mcp/proxy.d.ts +87 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +672 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +108 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +315 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +34 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +111 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +109 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +380 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/startup-handshake.d.ts +44 -0
- package/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/dist/mcp/startup-handshake.js +73 -0
- package/dist/mcp/startup-handshake.js.map +1 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/dist/mcp/stdin-teardown.js +49 -0
- package/dist/mcp/stdin-teardown.js.map +1 -0
- package/dist/mcp/tools.d.ts +877 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +6371 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +377 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/project-config.d.ts +158 -0
- package/dist/project-config.d.ts.map +1 -0
- package/dist/project-config.js +489 -0
- package/dist/project-config.js.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +59 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +4066 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/cooperative-yield.d.ts +40 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +44 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/dist/resolution/expo-router-synthesizer.js +189 -0
- package/dist/resolution/expo-router-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/dist/resolution/frameworks/astro.js +169 -0
- package/dist/resolution/frameworks/astro.js.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/dist/resolution/frameworks/cics.d.ts +20 -0
- package/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/dist/resolution/frameworks/cics.js +90 -0
- package/dist/resolution/frameworks/cics.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/dist/resolution/frameworks/csharp.js +335 -0
- package/dist/resolution/frameworks/csharp.js.map +1 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +148 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/expo-router.d.ts +189 -0
- package/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-router.js +785 -0
- package/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/dist/resolution/frameworks/express.js +540 -0
- package/dist/resolution/frameworks/express.js.map +1 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/dist/resolution/frameworks/go.js +184 -0
- package/dist/resolution/frameworks/go.js.map +1 -0
- package/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/dist/resolution/frameworks/goframe.js +112 -0
- package/dist/resolution/frameworks/goframe.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +30 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +72 -0
- package/dist/resolution/frameworks/index.js.map +1 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/dist/resolution/frameworks/java.js +517 -0
- package/dist/resolution/frameworks/java.js.map +1 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/dist/resolution/frameworks/laravel.js +257 -0
- package/dist/resolution/frameworks/laravel.js.map +1 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nestjs.js +690 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nextjs.js +328 -0
- package/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/dist/resolution/frameworks/object-literal.js +139 -0
- package/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/dist/resolution/frameworks/package-deps.js +78 -0
- package/dist/resolution/frameworks/package-deps.js.map +1 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/dist/resolution/frameworks/python.js +566 -0
- package/dist/resolution/frameworks/python.js.map +1 -0
- package/dist/resolution/frameworks/react-native.d.ts +29 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +549 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react-router.d.ts +46 -0
- package/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-router.js +187 -0
- package/dist/resolution/frameworks/react-router.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts +9 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/dist/resolution/frameworks/react.js +257 -0
- package/dist/resolution/frameworks/react.js.map +1 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/dist/resolution/frameworks/ruby.js +302 -0
- package/dist/resolution/frameworks/ruby.js.map +1 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/dist/resolution/frameworks/rust.js +304 -0
- package/dist/resolution/frameworks/rust.js.map +1 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/dist/resolution/frameworks/svelte.js +258 -0
- package/dist/resolution/frameworks/svelte.js.map +1 -0
- package/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift.js +410 -0
- package/dist/resolution/frameworks/swift.js.map +1 -0
- package/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/dist/resolution/frameworks/terraform.js +277 -0
- package/dist/resolution/frameworks/terraform.js.map +1 -0
- package/dist/resolution/frameworks/vue-router.d.ts +82 -0
- package/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue-router.js +377 -0
- package/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue.js +303 -0
- package/dist/resolution/frameworks/vue.js.map +1 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/goframe-synthesizer.d.ts +29 -0
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/dist/resolution/goframe-synthesizer.js +163 -0
- package/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +84 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +2240 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +343 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +2352 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/memory-budget.d.ts +48 -0
- package/dist/resolution/memory-budget.d.ts.map +1 -0
- package/dist/resolution/memory-budget.js +162 -0
- package/dist/resolution/memory-budget.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +153 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +2412 -0
- package/dist/resolution/name-matcher.js.map +1 -0
- package/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/dist/resolution/next-router-synthesizer.js +113 -0
- package/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/dist/resolution/path-aliases.d.ts +70 -0
- package/dist/resolution/path-aliases.d.ts.map +1 -0
- package/dist/resolution/path-aliases.js +346 -0
- package/dist/resolution/path-aliases.js.map +1 -0
- package/dist/resolution/react-router-synthesizer.d.ts +33 -0
- package/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/dist/resolution/react-router-synthesizer.js +126 -0
- package/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/dist/resolution/resolver-pool.d.ts +106 -0
- package/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/dist/resolution/resolver-pool.js +344 -0
- package/dist/resolution/resolver-pool.js.map +1 -0
- package/dist/resolution/resolver-worker.d.ts +17 -0
- package/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/dist/resolution/resolver-worker.js +141 -0
- package/dist/resolution/resolver-worker.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/strip-comments.d.ts.map +1 -0
- package/dist/resolution/strip-comments.js +492 -0
- package/dist/resolution/strip-comments.js.map +1 -0
- package/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/synth-utils.d.ts +26 -0
- package/dist/resolution/synth-utils.d.ts.map +1 -0
- package/dist/resolution/synth-utils.js +75 -0
- package/dist/resolution/synth-utils.js.map +1 -0
- package/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/dist/resolution/tier-synthesizer.d.ts +48 -0
- package/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/dist/resolution/tier-synthesizer.js +907 -0
- package/dist/resolution/tier-synthesizer.js.map +1 -0
- package/dist/resolution/types.d.ts +290 -0
- package/dist/resolution/types.d.ts.map +1 -0
- package/dist/resolution/types.js +8 -0
- package/dist/resolution/types.js.map +1 -0
- package/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/dist/resolution/vue-router-synthesizer.js +115 -0
- package/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/dist/resolution/workspace-packages.d.ts +58 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +346 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/identifier-segments.d.ts +70 -0
- package/dist/search/identifier-segments.d.ts.map +1 -0
- package/dist/search/identifier-segments.js +205 -0
- package/dist/search/identifier-segments.js.map +1 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-parser.d.ts.map +1 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-parser.js.map +1 -0
- package/dist/search/query-paths.d.ts +57 -0
- package/dist/search/query-paths.d.ts.map +1 -0
- package/dist/search/query-paths.js +298 -0
- package/dist/search/query-paths.js.map +1 -0
- package/dist/search/query-utils.d.ts +102 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +487 -0
- package/dist/search/query-utils.js.map +1 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/git-hooks.d.ts.map +1 -0
- package/dist/sync/git-hooks.js +227 -0
- package/dist/sync/git-hooks.js.map +1 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +35 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watch-policy.d.ts.map +1 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watch-policy.js.map +1 -0
- package/dist/sync/watcher.d.ts +401 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +967 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/sync/worktree.d.ts +63 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +182 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/telemetry/index.d.ts +143 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +541 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/types.d.ts +486 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +118 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/color.d.ts +21 -0
- package/dist/ui/color.d.ts.map +1 -0
- package/dist/ui/color.js +42 -0
- package/dist/ui/color.js.map +1 -0
- package/dist/ui/glyphs.d.ts +67 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +125 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/dist/ui/shimmer-progress.js +164 -0
- package/dist/ui/shimmer-progress.js.map +1 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/dist/ui/shimmer-worker.js +126 -0
- package/dist/ui/shimmer-worker.js.map +1 -0
- package/dist/ui/types.d.ts +15 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/ui-server/api/deadcode.d.ts +84 -0
- package/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/dist/ui-server/api/deadcode.js +136 -0
- package/dist/ui-server/api/deadcode.js.map +1 -0
- package/dist/ui-server/api/effects.d.ts +87 -0
- package/dist/ui-server/api/effects.d.ts.map +1 -0
- package/dist/ui-server/api/effects.js +499 -0
- package/dist/ui-server/api/effects.js.map +1 -0
- package/dist/ui-server/api/entrypoints.d.ts +86 -0
- package/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/dist/ui-server/api/entrypoints.js +279 -0
- package/dist/ui-server/api/entrypoints.js.map +1 -0
- package/dist/ui-server/api/events.d.ts +183 -0
- package/dist/ui-server/api/events.d.ts.map +1 -0
- package/dist/ui-server/api/events.js +430 -0
- package/dist/ui-server/api/events.js.map +1 -0
- package/dist/ui-server/api/file.d.ts +66 -0
- package/dist/ui-server/api/file.d.ts.map +1 -0
- package/dist/ui-server/api/file.js +222 -0
- package/dist/ui-server/api/file.js.map +1 -0
- package/dist/ui-server/api/filecode.d.ts +126 -0
- package/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/dist/ui-server/api/filecode.js +205 -0
- package/dist/ui-server/api/filecode.js.map +1 -0
- package/dist/ui-server/api/flow.d.ts +226 -0
- package/dist/ui-server/api/flow.d.ts.map +1 -0
- package/dist/ui-server/api/flow.js +611 -0
- package/dist/ui-server/api/flow.js.map +1 -0
- package/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/dist/ui-server/api/hierarchy.js +92 -0
- package/dist/ui-server/api/hierarchy.js.map +1 -0
- package/dist/ui-server/api/index.d.ts +90 -0
- package/dist/ui-server/api/index.d.ts.map +1 -0
- package/dist/ui-server/api/index.js +332 -0
- package/dist/ui-server/api/index.js.map +1 -0
- package/dist/ui-server/api/map.d.ts +187 -0
- package/dist/ui-server/api/map.d.ts.map +1 -0
- package/dist/ui-server/api/map.js +498 -0
- package/dist/ui-server/api/map.js.map +1 -0
- package/dist/ui-server/api/node.d.ts +81 -0
- package/dist/ui-server/api/node.d.ts.map +1 -0
- package/dist/ui-server/api/node.js +388 -0
- package/dist/ui-server/api/node.js.map +1 -0
- package/dist/ui-server/api/nodes.d.ts +25 -0
- package/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/dist/ui-server/api/nodes.js +45 -0
- package/dist/ui-server/api/nodes.js.map +1 -0
- package/dist/ui-server/api/program.d.ts +139 -0
- package/dist/ui-server/api/program.d.ts.map +1 -0
- package/dist/ui-server/api/program.js +315 -0
- package/dist/ui-server/api/program.js.map +1 -0
- package/dist/ui-server/api/respond.d.ts +76 -0
- package/dist/ui-server/api/respond.d.ts.map +1 -0
- package/dist/ui-server/api/respond.js +186 -0
- package/dist/ui-server/api/respond.js.map +1 -0
- package/dist/ui-server/api/route-roots.d.ts +39 -0
- package/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/dist/ui-server/api/route-roots.js +96 -0
- package/dist/ui-server/api/route-roots.js.map +1 -0
- package/dist/ui-server/api/routes.d.ts +59 -0
- package/dist/ui-server/api/routes.d.ts.map +1 -0
- package/dist/ui-server/api/routes.js +112 -0
- package/dist/ui-server/api/routes.js.map +1 -0
- package/dist/ui-server/api/screens.d.ts +117 -0
- package/dist/ui-server/api/screens.d.ts.map +1 -0
- package/dist/ui-server/api/screens.js +611 -0
- package/dist/ui-server/api/screens.js.map +1 -0
- package/dist/ui-server/api/search.d.ts +29 -0
- package/dist/ui-server/api/search.d.ts.map +1 -0
- package/dist/ui-server/api/search.js +232 -0
- package/dist/ui-server/api/search.js.map +1 -0
- package/dist/ui-server/api/session.d.ts +52 -0
- package/dist/ui-server/api/session.d.ts.map +1 -0
- package/dist/ui-server/api/session.js +196 -0
- package/dist/ui-server/api/session.js.map +1 -0
- package/dist/ui-server/api/source.d.ts +200 -0
- package/dist/ui-server/api/source.d.ts.map +1 -0
- package/dist/ui-server/api/source.js +419 -0
- package/dist/ui-server/api/source.js.map +1 -0
- package/dist/ui-server/api/stats.d.ts +27 -0
- package/dist/ui-server/api/stats.d.ts.map +1 -0
- package/dist/ui-server/api/stats.js +164 -0
- package/dist/ui-server/api/stats.js.map +1 -0
- package/dist/ui-server/api/steps.d.ts +274 -0
- package/dist/ui-server/api/steps.d.ts.map +1 -0
- package/dist/ui-server/api/steps.js +1446 -0
- package/dist/ui-server/api/steps.js.map +1 -0
- package/dist/ui-server/api/trail-store.d.ts +142 -0
- package/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/dist/ui-server/api/trail-store.js +323 -0
- package/dist/ui-server/api/trail-store.js.map +1 -0
- package/dist/ui-server/api/trails.d.ts +163 -0
- package/dist/ui-server/api/trails.d.ts.map +1 -0
- package/dist/ui-server/api/trails.js +369 -0
- package/dist/ui-server/api/trails.js.map +1 -0
- package/dist/ui-server/api/when.d.ts +125 -0
- package/dist/ui-server/api/when.d.ts.map +1 -0
- package/dist/ui-server/api/when.js +251 -0
- package/dist/ui-server/api/when.js.map +1 -0
- package/dist/ui-server/api/wire.d.ts +179 -0
- package/dist/ui-server/api/wire.d.ts.map +1 -0
- package/dist/ui-server/api/wire.js +231 -0
- package/dist/ui-server/api/wire.js.map +1 -0
- package/dist/ui-server/assets.d.ts +40 -0
- package/dist/ui-server/assets.d.ts.map +1 -0
- package/dist/ui-server/assets.js +110 -0
- package/dist/ui-server/assets.js.map +1 -0
- package/dist/ui-server/constants.d.ts +32 -0
- package/dist/ui-server/constants.d.ts.map +1 -0
- package/dist/ui-server/constants.js +35 -0
- package/dist/ui-server/constants.js.map +1 -0
- package/dist/ui-server/highlight/index.d.ts +113 -0
- package/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/dist/ui-server/highlight/index.js +307 -0
- package/dist/ui-server/highlight/index.js.map +1 -0
- package/dist/ui-server/highlight/languages.d.ts +36 -0
- package/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/dist/ui-server/highlight/languages.js +50 -0
- package/dist/ui-server/highlight/languages.js.map +1 -0
- package/dist/ui-server/index.d.ts +92 -0
- package/dist/ui-server/index.d.ts.map +1 -0
- package/dist/ui-server/index.js +399 -0
- package/dist/ui-server/index.js.map +1 -0
- package/dist/ui-server/open-browser.d.ts +31 -0
- package/dist/ui-server/open-browser.d.ts.map +1 -0
- package/dist/ui-server/open-browser.js +79 -0
- package/dist/ui-server/open-browser.js.map +1 -0
- package/dist/ui-server/security.d.ts +127 -0
- package/dist/ui-server/security.d.ts.map +1 -0
- package/dist/ui-server/security.js +332 -0
- package/dist/ui-server/security.js.map +1 -0
- package/dist/ui-server/static.d.ts +45 -0
- package/dist/ui-server/static.d.ts.map +1 -0
- package/dist/ui-server/static.js +165 -0
- package/dist/ui-server/static.js.map +1 -0
- package/dist/upgrade/index.d.ts +177 -0
- package/dist/upgrade/index.d.ts.map +1 -0
- package/dist/upgrade/index.js +665 -0
- package/dist/upgrade/index.js.map +1 -0
- package/dist/upgrade/remove-binary.d.ts +87 -0
- package/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/dist/upgrade/remove-binary.js +289 -0
- package/dist/upgrade/remove-binary.js.map +1 -0
- package/dist/upgrade/update-check.d.ts +92 -0
- package/dist/upgrade/update-check.d.ts.map +1 -0
- package/dist/upgrade/update-check.js +258 -0
- package/dist/upgrade/update-check.js.map +1 -0
- package/dist/utils.d.ts +224 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +583 -0
- package/dist/utils.js.map +1 -0
- package/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- package/dist/viewer/assets/index-2IPslW5t.js +13 -0
- package/dist/viewer/assets/index-DSwi2Seu.css +1 -0
- package/dist/viewer/index.html +16 -0
- package/package.json +67 -0
|
@@ -0,0 +1,1446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `GET /api/steps` — what happens from here: a screen, a handler or any
|
|
4
|
+
* symbol as the ANCHOR, and everything it sets in motion drawn as typed steps.
|
|
5
|
+
*
|
|
6
|
+
* The Screens view (`screens.ts`) is already a picture of steps with one step
|
|
7
|
+
* type: it folds `HomeScreen → ItemsGrid → ItemCard → openObjectDetail` into
|
|
8
|
+
* one arrow labelled with its condition, because the reader wants the
|
|
9
|
+
* transition, not the plumbing. This endpoint keeps that fold and widens the
|
|
10
|
+
* set of things worth a box. Walking FORWARD from the anchor over calls,
|
|
11
|
+
* renders, handler bindings and navigations, a node is a step when it is:
|
|
12
|
+
*
|
|
13
|
+
* - a **screen** (a route reached over a `navigates` edge),
|
|
14
|
+
* - a **trigger** — a function wired as a value (`onPress={handleX}`,
|
|
15
|
+
* `addListener('x', handleX)`), the user's or the platform's way in,
|
|
16
|
+
* - a **bridge** call — the language changes under the call, JS → native
|
|
17
|
+
* (the React Native bridge resolver's edges, or any family crossing),
|
|
18
|
+
* - a native **event** landing back in JS (`sendEvent(withName:)` → the
|
|
19
|
+
* listener, via the RN event channel),
|
|
20
|
+
* - a **store** action — a function in a store file, the state it writes,
|
|
21
|
+
* - an **effect** — a call that leaves the index into the network, storage,
|
|
22
|
+
* the device or telemetry, drawn as its own box beside the function that
|
|
23
|
+
* makes it.
|
|
24
|
+
*
|
|
25
|
+
* Everything else — hooks, helpers, services, the components between a
|
|
26
|
+
* screen and its handlers — is `via`: listed on the link, never a box. The
|
|
27
|
+
* branch conditions along the folded chain join into the link's `when`, read
|
|
28
|
+
* from the source at request time exactly as the Screens view reads them.
|
|
29
|
+
*
|
|
30
|
+
* The picture is finite because it is ANCHORED and CAPPED, not because the
|
|
31
|
+
* graph is small: a bounded depth in steps, a bounded fan-out per node, a
|
|
32
|
+
* bounded number of nodes folded per step, and hubs and shared chrome (a top
|
|
33
|
+
* bar rendered on ten screens) are dead ends rather than paths. Every cap
|
|
34
|
+
* that fired is reported on the step it fired at, so a short picture never
|
|
35
|
+
* reads as "nothing else happens here".
|
|
36
|
+
*
|
|
37
|
+
* Read from the graph at request time, never cached: the `when` labels and
|
|
38
|
+
* the effect sites are read from the source as it stands.
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.STORE_FILE = exports.MAX_LIMIT = exports.DEFAULT_LIMIT = exports.MAX_DEPTH = exports.DEFAULT_DEPTH = void 0;
|
|
42
|
+
exports.crossing = crossing;
|
|
43
|
+
exports.isStoreFile = isStoreFile;
|
|
44
|
+
exports.effectCategory = effectCategory;
|
|
45
|
+
exports.buildSteps = buildSteps;
|
|
46
|
+
exports.projectKind = projectKind;
|
|
47
|
+
const respond_1 = require("./respond");
|
|
48
|
+
const when_1 = require("./when");
|
|
49
|
+
const program_1 = require("./program");
|
|
50
|
+
const effects_1 = require("./effects");
|
|
51
|
+
const branch_guards_1 = require("../../graph/branch-guards");
|
|
52
|
+
const route_roots_1 = require("./route-roots");
|
|
53
|
+
const nextjs_1 = require("../../resolution/frameworks/nextjs");
|
|
54
|
+
const routes_1 = require("./routes");
|
|
55
|
+
const wire_1 = require("./wire");
|
|
56
|
+
const query_utils_1 = require("../../search/query-utils");
|
|
57
|
+
// =============================================================================
|
|
58
|
+
// Caps
|
|
59
|
+
// =============================================================================
|
|
60
|
+
exports.DEFAULT_DEPTH = 8;
|
|
61
|
+
exports.MAX_DEPTH = 14;
|
|
62
|
+
exports.DEFAULT_LIMIT = 120;
|
|
63
|
+
exports.MAX_LIMIT = 400;
|
|
64
|
+
/** Nodes folded while exploring from ONE step before the walk stops. */
|
|
65
|
+
const MAX_FOLDED_PER_STEP = 300;
|
|
66
|
+
/** Hops of folded plumbing between two steps. */
|
|
67
|
+
const MAX_FOLD_DEPTH = 7;
|
|
68
|
+
/** Outgoing edges followed from one node; past this the node is a god function and the rest is announced. */
|
|
69
|
+
const MAX_FANOUT = 80;
|
|
70
|
+
/** Unresolved-reference scans (for effects) per request. */
|
|
71
|
+
const MAX_EFFECT_SCANS = 800;
|
|
72
|
+
/** Call sites read for conditions and arguments per request. */
|
|
73
|
+
const MAX_WHEN_SITES = 1600;
|
|
74
|
+
/** Call sites read for the callee as written (effect classification) per request — lookups on trees the guards parsed anyway. */
|
|
75
|
+
const MAX_CALL_SITES = 4000;
|
|
76
|
+
/** Longest effect-box label before its argument list is cut. */
|
|
77
|
+
const MAX_EFFECT_LABEL = 56;
|
|
78
|
+
/**
|
|
79
|
+
* A component rendered by this many distinct parents is chrome (a top bar, a
|
|
80
|
+
* button), not a screen's own behaviour. Higher than the Screens view's 3: that
|
|
81
|
+
* one attributes navigations, where three screens sharing a link is already
|
|
82
|
+
* chrome; this one decides what to WALK INTO, and a capture component shared
|
|
83
|
+
* by three capture flows is the screen's whole body.
|
|
84
|
+
*/
|
|
85
|
+
const SHARED_CHROME_MIN = 5;
|
|
86
|
+
/** Edges walked forward. `contains` only function → function (a hook's handlers); `references` only function-as-value. */
|
|
87
|
+
const WALK_KINDS = ['calls', 'instantiates', 'navigates', 'references', 'contains'];
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// Classification
|
|
90
|
+
// =============================================================================
|
|
91
|
+
const JS_FAMILY = new Set(['javascript', 'typescript', 'tsx', 'jsx']);
|
|
92
|
+
const NATIVE_FAMILY = new Set(['swift', 'objc', 'java', 'kotlin']);
|
|
93
|
+
/**
|
|
94
|
+
* JS → native is a bridge call; native → JS is an event. Anything else is one
|
|
95
|
+
* family — unless the edge itself says which way it crosses: a synthesized
|
|
96
|
+
* channel (`resolution/tier-synthesizer.ts`) marks a client's request onto its
|
|
97
|
+
* own route `client→server`, a socket message back `server→client`, and a
|
|
98
|
+
* queue job or a bus event as a `channel` whose landing is an arrival; a
|
|
99
|
+
* server action called from a client file is marked `client→server` at
|
|
100
|
+
* request time, by its directive.
|
|
101
|
+
*/
|
|
102
|
+
function crossing(from, to, meta = {}) {
|
|
103
|
+
if (meta.tier === 'client→server')
|
|
104
|
+
return 'bridge';
|
|
105
|
+
if (meta.tier === 'server→client')
|
|
106
|
+
return 'event';
|
|
107
|
+
if (meta.channel === 'queue' || meta.channel === 'event' || meta.channel === 'socket')
|
|
108
|
+
return 'event';
|
|
109
|
+
if (JS_FAMILY.has(from) && NATIVE_FAMILY.has(to))
|
|
110
|
+
return 'bridge';
|
|
111
|
+
if (NATIVE_FAMILY.has(from) && JS_FAMILY.has(to))
|
|
112
|
+
return 'event';
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A file that holds state: a store, a slice, a reducer. The graph has no
|
|
117
|
+
* "store" kind — a Zustand action is an ordinary function node — so the file
|
|
118
|
+
* is the evidence, and the legend says so.
|
|
119
|
+
*/
|
|
120
|
+
exports.STORE_FILE = /(?:^|\/)(?:stores?|storage|state|slices?|reducers?)\/|\.(?:store|storage|slice|reducer)\.[cm]?[jt]sx?$/i;
|
|
121
|
+
function isStoreFile(file) {
|
|
122
|
+
return exports.STORE_FILE.test(file.replace(/\\/g, '/'));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* What a call is when it leaves the index, by the reference text alone — the
|
|
126
|
+
* mobile app's table, kept for callers that have no language in hand. The
|
|
127
|
+
* Steps walk itself classifies on the call AS WRITTEN with the language and
|
|
128
|
+
* the project kind (`effects.ts`).
|
|
129
|
+
*/
|
|
130
|
+
function effectCategory(referenceName) {
|
|
131
|
+
return (0, effects_1.classifyEffect)({ text: referenceName, kind: 'calls' })?.category ?? null;
|
|
132
|
+
}
|
|
133
|
+
/** A method of a repository / DAO / mapper, by the container's name — the ORM boundary in a project that types it. */
|
|
134
|
+
const REPOSITORY_CONTAINER = /(?:Repository|Repositories|Repo|Dao|DAO|Mapper|Store|Datastore)$/;
|
|
135
|
+
/** Decorators that gate a handler: guards, interceptors, pipes, roles, auth, validation, transactions, throttles. */
|
|
136
|
+
const GUARD_DECORATOR = /^(?:UseGuards|UseInterceptors|UsePipes|UseFilters|Roles|Auth|Public|Permissions|Throttle|SkipThrottle|Authorize|AllowAnonymous|PreAuthorize|PostAuthorize|Secured|RolesAllowed|PermitAll|DenyAll|Transactional|Validated|login_required|permission_required|user_passes_test|staff_member_required|require_http_methods|require_POST|require_GET|csrf_exempt|csrf_protect|ratelimit|throttle_classes|permission_classes|authentication_classes|cache_page|ValidateAntiForgeryToken|RequireAuthorization|RequireRole|RequireHttps|EnableCors|CrossOrigin|Cacheable|CacheEvict|CachePut|RateLimiter|CircuitBreaker|Retry|Timeout|Bulkhead|jwt_required|Security|ApiBearerAuth|ApiKeyAuth|BearerAuth|OAuth|Scopes|Roles|HasRole|HasPermission|Idempotent|Lock|Locked|Retryable|Recover)$|Guard|Interceptor|Pipe$|Filter$|Auth|Role|Permission|Throttle|Valid|Transaction|Csrf|Limit/i;
|
|
137
|
+
/** Decorators that ARE the route, the DI wiring, or documentation — never a guard. */
|
|
138
|
+
const NOT_A_GUARD = /^(?:Get|Post|Put|Patch|Delete|Head|Options|All|Controller|RestController|Resolver|Query|Mutation|Subscription|Injectable|Module|Api\w*|Http(?:Get|Post|Put|Patch|Delete|Head|Options)|Route|RequestMapping|\w+Mapping|Component|Service|Repository|Bean|Autowired|Override|Inject|Param|Body|Res|Req|Headers|Ip|HostParam|Session|UploadedFiles?|HttpCode|Header|Redirect|Render|Version|SerializeOptions|ResponseBody|ResponseStatus|Produces|Consumes|FromBody|FromRoute|FromQuery|FromForm|FromHeader|FromServices|Path|PathVariable|RequestParam|RequestBody|RequestHeader|ModelAttribute|Valid|Args|Context|Parent|Info|Field|ObjectType|InputType|ArgsType|Entity|Column|PrimaryGeneratedColumn|OneToMany|ManyToOne|Prop|Schema|Type|Expose|Exclude|Transform|IsString|IsNumber|IsOptional|Length|Min|Max|Deprecated|SuppressWarnings|FunctionalInterface|Slf4j|Data|Builder|Getter|Setter|NoArgsConstructor|AllArgsConstructor|RequiredArgsConstructor|Value|ConfigurationProperties|Configuration|EnableScheduling|SpringBootApplication|Profile|Order|Primary|Qualifier|Lazy|Scope|JsonProperty|JsonIgnore|Nullable|NonNull|NotNull|Size|Pattern|Email|Positive|router\.\w+|app\.\w+|api\.\w+|bp\.\w+|blueprint\.\w+|\w+\.(?:route|get|post|put|patch|delete))$/;
|
|
139
|
+
/** Decorators that fire a function from outside a request: a job, an event, a message, a schedule. */
|
|
140
|
+
const CONSUMER_DECORATOR = /^(?:Process|Processor|OnEvent|OnQueueEvent|OnWorkerEvent|OnGlobalQueueEvent|Cron|Interval|Timeout|MessagePattern|EventPattern|SubscribeMessage|Scheduled|Schedules?|KafkaListener|RabbitListener|RabbitSubscribe|RabbitRPC|JmsListener|SqsListener|SqsMessageHandler|EventListener|TransactionalEventListener|StreamListener|ServiceActivator|receiver|shared_task|task|periodic_task|app\.task|celery\.task|on|hears|command|event|listen|listener|Consume|Consumer|Subscribe|Subscriber|CapSubscribe|Function|FunctionName|TimerTrigger|QueueTrigger|ServiceBusTrigger|EventGridTrigger|BlobTrigger|CosmosDBTrigger|Job|job|Worker|worker|EventHandler|CommandHandler|QueryHandler|OnMessage|MessageHandler|GrpcMethod|GrpcStreamMethod|WebSocketGateway|dramatiq\.actor|actor|huey\.task|db_task|Signal|signal|hook|Hook|OnModuleInit|OnApplicationBootstrap|PostConstruct|PreDestroy|Bean|Startup|Shutdown)$/;
|
|
141
|
+
/** The name of a decorator, before its arguments. */
|
|
142
|
+
function decoratorName(text) {
|
|
143
|
+
return text.replace(/\(.*$/s, '').trim();
|
|
144
|
+
}
|
|
145
|
+
/** The first string literal in a decorator's arguments — `'email'` of `@Process('email')`. */
|
|
146
|
+
function decoratorLiteral(text) {
|
|
147
|
+
const m = /\(\s*(['"`])((?:(?!\1).)*)\1/.exec(text);
|
|
148
|
+
return m ? `'${m[2]}'` : null;
|
|
149
|
+
}
|
|
150
|
+
function isGuardDecorator(text) {
|
|
151
|
+
const name = decoratorName(text);
|
|
152
|
+
if (NOT_A_GUARD.test(name))
|
|
153
|
+
return false;
|
|
154
|
+
return GUARD_DECORATOR.test(name);
|
|
155
|
+
}
|
|
156
|
+
/** FastAPI: `dependencies=[Depends(auth), Depends(rate_limit)]` inside the route decorator. */
|
|
157
|
+
function dependenciesIn(text) {
|
|
158
|
+
const m = /dependencies\s*=\s*\[([^\]]*)\]/.exec(text);
|
|
159
|
+
if (!m)
|
|
160
|
+
return [];
|
|
161
|
+
return m[1].split(/,(?![^()]*\))/).map((x) => x.trim()).filter(Boolean);
|
|
162
|
+
}
|
|
163
|
+
async function buildSteps(cg, projectRoot, query) {
|
|
164
|
+
const started = Date.now();
|
|
165
|
+
const depthCap = (0, respond_1.intParam)(query, 'depth', { min: 1, max: exports.MAX_DEPTH, default: exports.DEFAULT_DEPTH });
|
|
166
|
+
const limit = (0, respond_1.intParam)(query, 'limit', { min: 20, max: exports.MAX_LIMIT, default: exports.DEFAULT_LIMIT });
|
|
167
|
+
const through = query.get('through') === '1';
|
|
168
|
+
const stats = cg.getStats();
|
|
169
|
+
const index = { lastIndexedAt: cg.getLastIndexedAt() ?? null, edges: stats.edgeCount, files: stats.fileCount };
|
|
170
|
+
const { anchor, ambiguous } = resolveAnchor(cg, query);
|
|
171
|
+
// Route → where its code starts: the handler a resolver named, the page a
|
|
172
|
+
// screen file exports, or the route itself standing in for an inline
|
|
173
|
+
// handler (`route-roots.ts`) — and what kind of project this is, for the
|
|
174
|
+
// words the viewer uses.
|
|
175
|
+
const routes = cg.getNodesByKind('route');
|
|
176
|
+
const roots = (0, route_roots_1.routeRoots)(cg, routes);
|
|
177
|
+
const project = projectKind(routes, stats.edgesByKind?.navigates ?? 0);
|
|
178
|
+
const reader = (0, when_1.createSiteReader)(cg, projectRoot, MAX_WHEN_SITES);
|
|
179
|
+
const calls = (0, when_1.createSiteReader)(cg, projectRoot, MAX_CALL_SITES);
|
|
180
|
+
/** The conditions a site runs under, structured — one read, joined where a string is wanted. */
|
|
181
|
+
const guardsAt = (caller, site) => reader.guards(caller, site);
|
|
182
|
+
/** The loops a site is written inside — a run of calls that happens once per item. */
|
|
183
|
+
const loopsAt = (caller, site) => reader.loops(caller, site);
|
|
184
|
+
const argsAt = (caller, site) => reader.args(caller, site);
|
|
185
|
+
const withArgs = async (site, caller, at) => {
|
|
186
|
+
const args = await argsAt(caller, at);
|
|
187
|
+
return args === null ? site : { ...site, args };
|
|
188
|
+
};
|
|
189
|
+
/** The call as written at a site, and what it passes — one read for both. */
|
|
190
|
+
const callAt = (caller, site) => calls.callSite(caller, site);
|
|
191
|
+
/** A hop's position with its call's span and enclosing call, read from the tree; the bare position when unreadable. */
|
|
192
|
+
const hopAt = async (caller, at, callee) => {
|
|
193
|
+
const line = at.line ?? caller.startLine;
|
|
194
|
+
const column = at.column ?? 0;
|
|
195
|
+
const read = at.line ? await callAt(caller, { ...at, ...(callee ? { callee } : {}) }) : null;
|
|
196
|
+
// The read must be THIS call. An inline handler's edges carry the ROUTE's
|
|
197
|
+
// line (`router.post('/users/login', async (req, res) => {`), where the
|
|
198
|
+
// only call is the registration itself — and taking its span would make
|
|
199
|
+
// every call in the handler read as written inside it, and so as running
|
|
200
|
+
// first. A miss is a bare position: no span to nest by, no `within`.
|
|
201
|
+
const last = (n) => n.replace(/\([^()]*\)/g, '').split(/[.:]/).pop() ?? n;
|
|
202
|
+
const usable = read !== null && (!callee || last(read.callee) === last(callee));
|
|
203
|
+
if (!usable)
|
|
204
|
+
return { file: caller.filePath, line, column, end: { line, column }, within: null };
|
|
205
|
+
return {
|
|
206
|
+
file: caller.filePath,
|
|
207
|
+
line: read.span?.start.line ?? line,
|
|
208
|
+
column: read.span?.start.column ?? column,
|
|
209
|
+
end: read.span?.end ?? { line, column },
|
|
210
|
+
within: read.within ?? null,
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
const pointHop = (caller, at) => {
|
|
214
|
+
const line = at.line ?? caller.startLine;
|
|
215
|
+
const column = at.column ?? 0;
|
|
216
|
+
return { file: caller.filePath, line, column, end: { line, column }, within: null };
|
|
217
|
+
};
|
|
218
|
+
// The declared type of a receiver: `OwnerRepository owners` in a Spring
|
|
219
|
+
// controller makes `owners.save` the database; `private readonly
|
|
220
|
+
// usersService: UsersService` in a Nest controller says where
|
|
221
|
+
// `this.usersService.findByEmail` goes. The index keeps the first in a
|
|
222
|
+
// field's signature and nothing of the second, so the class body is read
|
|
223
|
+
// from the tree at request time, once per class.
|
|
224
|
+
const fileTypes = new Map();
|
|
225
|
+
const classTypes = new Map();
|
|
226
|
+
const receiverTypeFor = async (caller, callee) => {
|
|
227
|
+
const first = callee.replace(/^(?:this|self)\./, '').split(/[.:(]/)[0] ?? '';
|
|
228
|
+
if (!first || /^[A-Z]/.test(first))
|
|
229
|
+
return null;
|
|
230
|
+
const declared = await memberTypesOf(caller);
|
|
231
|
+
const own = declared.get(first) ?? declared.get(first.replace(/^_/, '')) ?? null;
|
|
232
|
+
if (own)
|
|
233
|
+
return own;
|
|
234
|
+
let types = fileTypes.get(caller.filePath);
|
|
235
|
+
if (!types) {
|
|
236
|
+
types = new Map();
|
|
237
|
+
for (const n of cg.getNodesInFile(caller.filePath)) {
|
|
238
|
+
if ((n.kind !== 'field' && n.kind !== 'property' && n.kind !== 'variable' && n.kind !== 'parameter') || !n.signature)
|
|
239
|
+
continue;
|
|
240
|
+
const sig = n.signature.replace(/\s+/g, ' ').trim();
|
|
241
|
+
// `OwnerRepository owners`, `private final OwnerRepository owners`, `owners: OwnerRepository`, `val owners: OwnerRepository`.
|
|
242
|
+
const typed = new RegExp(`(?:^|\\s)([A-Z][\\w<>,?. ]*?)\\s+${n.name}\\b`).exec(sig) ?? new RegExp(`\\b${n.name}\\s*:\\s*([A-Z][\\w<>,?. ]*)`).exec(sig);
|
|
243
|
+
if (typed && !types.has(n.name))
|
|
244
|
+
types.set(n.name, typed[1].trim());
|
|
245
|
+
}
|
|
246
|
+
fileTypes.set(caller.filePath, types);
|
|
247
|
+
}
|
|
248
|
+
return types.get(first) ?? null;
|
|
249
|
+
};
|
|
250
|
+
const memberTypesOf = async (node) => {
|
|
251
|
+
const key = `${node.filePath}:${node.startLine}`;
|
|
252
|
+
let types = classTypes.get(key);
|
|
253
|
+
if (!types) {
|
|
254
|
+
types = await calls.memberTypes(node);
|
|
255
|
+
classTypes.set(key, types);
|
|
256
|
+
}
|
|
257
|
+
return types;
|
|
258
|
+
};
|
|
259
|
+
// Where a member call really goes, by the receiver's declared type: the
|
|
260
|
+
// class named by the type, and its method of the call's name. Null when the
|
|
261
|
+
// type names nothing in the index (an ORM's `Repository<Cat>`) — then the
|
|
262
|
+
// call leaves the index, and the effect table says as what.
|
|
263
|
+
const classByName = new Map();
|
|
264
|
+
/** The class / interface / struct a declared type names in the index, or null for a library's. */
|
|
265
|
+
const classOfType = async (type) => {
|
|
266
|
+
const typeName = type.replace(/<.*$/, '').replace(/^[*&]+/, '').replace(/[?!]$/, '').split(/[.:]/).pop()?.trim() ?? '';
|
|
267
|
+
if (!typeName || /^(?:string|number|boolean|any|unknown|object|void|String|Integer|Long|Boolean|int|long|bool|var|dynamic|Object|List|Map|Set|Array|Promise|Optional|Task|IEnumerable|Iterable)$/.test(typeName))
|
|
268
|
+
return null;
|
|
269
|
+
let cls = classByName.get(typeName);
|
|
270
|
+
if (cls === undefined) {
|
|
271
|
+
const found = cg.getNodesByName(typeName).filter((n) => n.kind === 'class' || n.kind === 'interface' || n.kind === 'struct');
|
|
272
|
+
cls = found.find((n) => !(0, query_utils_1.isTestPath)(n.filePath)) ?? found[0] ?? null;
|
|
273
|
+
classByName.set(typeName, cls);
|
|
274
|
+
}
|
|
275
|
+
return cls;
|
|
276
|
+
};
|
|
277
|
+
const resolveByReceiver = async (caller, callee) => {
|
|
278
|
+
const segments = callee.replace(/\([^()]*\)/g, '').split(/[.:]+/).filter(Boolean);
|
|
279
|
+
if (segments.length < 2)
|
|
280
|
+
return null;
|
|
281
|
+
const type = await receiverTypeFor(caller, callee);
|
|
282
|
+
if (!type)
|
|
283
|
+
return null;
|
|
284
|
+
const cls = await classOfType(type);
|
|
285
|
+
if (!cls)
|
|
286
|
+
return null;
|
|
287
|
+
const method = segments[segments.length - 1];
|
|
288
|
+
const members = cg.getNodesInFile(cls.filePath).filter((n) => (n.kind === 'method' || n.kind === 'function') && n.name === method && n.startLine >= cls.startLine && n.endLine <= cls.endLine);
|
|
289
|
+
return members[0] ?? null;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* A name-match that the call as written disproves: the target is a method of
|
|
293
|
+
* the CALLER's own class, but the call names a receiver that is not `this` —
|
|
294
|
+
* and in the JS family a method of your own class cannot be called any other
|
|
295
|
+
* way. Only there: `self.` is a convention elsewhere, not a rule.
|
|
296
|
+
*/
|
|
297
|
+
const ownMethodWithoutReceiver = (caller, target, written) => {
|
|
298
|
+
if (!JS_FAMILY.has(caller.language) || target.kind !== 'method')
|
|
299
|
+
return false;
|
|
300
|
+
if (/^(?:this|self)[.?]/.test(written))
|
|
301
|
+
return false;
|
|
302
|
+
const container = (q) => q.replace(/[.:]+[^.:]*$/, '');
|
|
303
|
+
return caller.filePath === target.filePath && container(caller.qualifiedName) === container(target.qualifiedName);
|
|
304
|
+
};
|
|
305
|
+
/** A method the walk cannot enter (an interface's, an ORM's) on a repository-shaped container. */
|
|
306
|
+
const repositoryMethod = (target) => {
|
|
307
|
+
if (target.kind !== 'method' && target.kind !== 'function')
|
|
308
|
+
return false;
|
|
309
|
+
if ((0, query_utils_1.isTestPath)(target.filePath))
|
|
310
|
+
return false;
|
|
311
|
+
const container = target.qualifiedName.replace(/[.:]+[^.:]*$/, '').split(/[.:]+/).pop() ?? '';
|
|
312
|
+
if (!REPOSITORY_CONTAINER.test(container) && !/(?:^|\/)(?:repositories|repository|dao|daos|mappers)\//i.test(posix(target.filePath)))
|
|
313
|
+
return false;
|
|
314
|
+
return cg.getOutgoingEdgesFrom([target.id], WALK_KINDS).length === 0;
|
|
315
|
+
};
|
|
316
|
+
/** What runs before a route's handler: the middleware arguments at the registration, or the guard decorators on it. */
|
|
317
|
+
const chainFor = async (route, root) => {
|
|
318
|
+
const after = [];
|
|
319
|
+
if (JS_FAMILY.has(route.language)) {
|
|
320
|
+
const site = await calls.callSite(route, { line: route.startLine, column: 0 });
|
|
321
|
+
if (site && /\.(?:get|post|put|patch|delete|all|use|head|options|route)$/i.test(site.callee)) {
|
|
322
|
+
const args = site.argList.slice(1);
|
|
323
|
+
if (args.length > 0 && !/^\{/.test(args[args.length - 1]))
|
|
324
|
+
args.pop();
|
|
325
|
+
for (const a of args)
|
|
326
|
+
if (a && !/^\{ ?…? ?\}$/.test(a))
|
|
327
|
+
after.push(a);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (root && root.id !== route.id) {
|
|
331
|
+
const decs = await calls.decorators(root);
|
|
332
|
+
if (decs) {
|
|
333
|
+
for (const d of [...decs.class, ...decs.own]) {
|
|
334
|
+
if (!JS_FAMILY.has(root.language) && !/^(?:python)$/.test(root.language)) {
|
|
335
|
+
if (isGuardDecorator(d))
|
|
336
|
+
after.push(d);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
for (const dep of dependenciesIn(d))
|
|
340
|
+
after.push(dep);
|
|
341
|
+
if (isGuardDecorator(d))
|
|
342
|
+
after.push(d);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return [...new Set(after)];
|
|
347
|
+
};
|
|
348
|
+
/** The request a route's handler serves, as its trigger; a Next page's own work fires from its load. */
|
|
349
|
+
const requestTrigger = async (route, root) => {
|
|
350
|
+
const { method, path } = (0, routes_1.splitRouteName)(route.name);
|
|
351
|
+
if (method === null) {
|
|
352
|
+
if ((0, nextjs_1.nextRouteForFile)(route.filePath)?.kind === 'page')
|
|
353
|
+
return { kind: 'load', name: 'GET', of: path, in: basename(route.filePath) };
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
const after = await chainFor(route, root);
|
|
357
|
+
return { kind: 'request', name: method, of: path, in: basename(route.filePath), ...(after.length > 0 ? { after } : {}) };
|
|
358
|
+
};
|
|
359
|
+
/** A job, an event, a message or a schedule that fires a function, from its decorators. */
|
|
360
|
+
const consumerTrigger = async (node) => {
|
|
361
|
+
if (node.kind !== 'function' && node.kind !== 'method')
|
|
362
|
+
return null;
|
|
363
|
+
const decs = await calls.decorators(node);
|
|
364
|
+
if (!decs)
|
|
365
|
+
return null;
|
|
366
|
+
for (const d of decs.own) {
|
|
367
|
+
const name = decoratorName(d);
|
|
368
|
+
const last = name.split('.').pop() ?? name;
|
|
369
|
+
if (!CONSUMER_DECORATOR.test(name) && !CONSUMER_DECORATOR.test(last))
|
|
370
|
+
continue;
|
|
371
|
+
const guards = [...decs.class, ...decs.own].filter((x) => x !== d && isGuardDecorator(x));
|
|
372
|
+
return { kind: 'decorator', name, of: decoratorLiteral(d), in: basename(node.filePath), ...(guards.length > 0 ? { after: guards } : {}) };
|
|
373
|
+
}
|
|
374
|
+
return null;
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* The decision a site's innermost condition belongs to. The innermost guard
|
|
378
|
+
* is the one decided AT the call — the ternary whose two arms return two
|
|
379
|
+
* different routes — while the ones outside it are the context both arms
|
|
380
|
+
* share, so it is the innermost that says which way this site went.
|
|
381
|
+
*/
|
|
382
|
+
const decisionOf = (guards) => {
|
|
383
|
+
const g = guards[guards.length - 1];
|
|
384
|
+
if (!g || !g.branch)
|
|
385
|
+
return null;
|
|
386
|
+
// A one-sided guard (`if (!product) throw`) is a guard clause, not a
|
|
387
|
+
// choice with two drawn ways; it keeps its condition on the line.
|
|
388
|
+
if (g.form === 'guard')
|
|
389
|
+
return null;
|
|
390
|
+
return {
|
|
391
|
+
branch: g.branch,
|
|
392
|
+
on: (0, branch_guards_1.guardLabel)([{ ...g, negated: false }]),
|
|
393
|
+
arm: (0, branch_guards_1.guardLabel)([g]),
|
|
394
|
+
form: g.form === 'case' ? 'switch' : g.form === 'ternary' ? 'ternary' : g.form === 'catch' ? 'try' : 'if',
|
|
395
|
+
...(g.negated ? { not: true } : {}),
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
const steps = new Map();
|
|
399
|
+
const links = new Map();
|
|
400
|
+
/**
|
|
401
|
+
* What happens in each function, in the code's own order — the rail's
|
|
402
|
+
* material, recorded by the SAME pass that makes the links so the two
|
|
403
|
+
* readings can never hold different steps. Keyed by the function's node id,
|
|
404
|
+
* then by the site's position and what it reaches: a helper folded from two
|
|
405
|
+
* different steps is walked twice and must not be written twice.
|
|
406
|
+
*/
|
|
407
|
+
const programs = new Map();
|
|
408
|
+
const record = (fn, hop, guards, what, trigger = null, loops = []) => {
|
|
409
|
+
let sites = programs.get(fn.id);
|
|
410
|
+
if (!sites) {
|
|
411
|
+
sites = new Map();
|
|
412
|
+
programs.set(fn.id, sites);
|
|
413
|
+
}
|
|
414
|
+
const key = `${hop.line}:${hop.column}:${what.step ?? what.into ?? ''}`;
|
|
415
|
+
if (sites.has(key))
|
|
416
|
+
return;
|
|
417
|
+
sites.set(key, {
|
|
418
|
+
...what,
|
|
419
|
+
at: { line: hop.line, column: hop.column, end: hop.end },
|
|
420
|
+
...(hop.within ? { within: hop.within } : {}),
|
|
421
|
+
guards: [...guards],
|
|
422
|
+
...(loops.length > 0 ? { loops: [...loops] } : {}),
|
|
423
|
+
...(trigger ? { trigger } : {}),
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
const truncated = { steps: 0, hubs: 0, chrome: 0 };
|
|
427
|
+
let effectScans = 0;
|
|
428
|
+
const fanIn = new Map();
|
|
429
|
+
const chromeParents = new Map();
|
|
430
|
+
const fileScopeRefs = new Map();
|
|
431
|
+
const fileScopeUnresolved = new Map();
|
|
432
|
+
/**
|
|
433
|
+
* The spans of the calls that became effect steps, per function — and the
|
|
434
|
+
* step a binding written inside one arrives from. `Alert.prompt('Add
|
|
435
|
+
* Folder', …, [{ onPress: (name) => createBackgroundFolder(name) }])` is
|
|
436
|
+
* two facts: the prompt is a device box, and the prompt's button FIRES the
|
|
437
|
+
* handler — so the handler's line belongs to the prompt, not to the screen
|
|
438
|
+
* the prompt is written on, which fires everything and says nothing. A site
|
|
439
|
+
* is rewired only when its own trigger names the call (`onPress ·
|
|
440
|
+
* Alert.prompt(…)`) and its position falls inside that call's span in the
|
|
441
|
+
* same function; the innermost such span wins. An `onSubmit · useFormik(…)`
|
|
442
|
+
* names no effect and stays where it was.
|
|
443
|
+
*/
|
|
444
|
+
const firedSpans = new Map();
|
|
445
|
+
const firedByEffect = (fnId, at, of) => {
|
|
446
|
+
if (at.line === undefined)
|
|
447
|
+
return null;
|
|
448
|
+
const spans = firedSpans.get(fnId);
|
|
449
|
+
if (!spans)
|
|
450
|
+
return null;
|
|
451
|
+
const last = (n) => n.replace(/\([^()]*\)/g, '').split(/[.:]/).pop() ?? n;
|
|
452
|
+
const want = last(of);
|
|
453
|
+
const line = at.line;
|
|
454
|
+
const column = at.column ?? 0;
|
|
455
|
+
let best = null;
|
|
456
|
+
for (const s of spans) {
|
|
457
|
+
if (line < s.start.line || line > s.end.line)
|
|
458
|
+
continue;
|
|
459
|
+
if (line === s.start.line && column < s.start.column)
|
|
460
|
+
continue;
|
|
461
|
+
if (line === s.end.line && column > s.end.column)
|
|
462
|
+
continue;
|
|
463
|
+
if (!s.step.effect?.apis.some((api) => last(api) === want))
|
|
464
|
+
continue;
|
|
465
|
+
if (best === null || s.start.line > best.start.line || (s.start.line === best.start.line && s.start.column > best.start.column)) {
|
|
466
|
+
best = s;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return best?.step ?? null;
|
|
470
|
+
};
|
|
471
|
+
const stepFor = (node, kind, depth, extra = {}) => {
|
|
472
|
+
const existing = steps.get(node.id);
|
|
473
|
+
if (existing) {
|
|
474
|
+
// A listener the screen registers is a handler when first met, and the
|
|
475
|
+
// native event's landing when the walk arrives from the other side —
|
|
476
|
+
// the second is the fuller fact, and it names the event.
|
|
477
|
+
if (existing.kind === 'trigger' && kind === 'event') {
|
|
478
|
+
existing.kind = 'event';
|
|
479
|
+
if (extra.event)
|
|
480
|
+
existing.event = extra.event;
|
|
481
|
+
}
|
|
482
|
+
if (kind === 'event' && extra.event) {
|
|
483
|
+
existing.events = existing.events ?? (existing.event ? [existing.event] : []);
|
|
484
|
+
if (!existing.events.includes(extra.event))
|
|
485
|
+
existing.events.push(extra.event);
|
|
486
|
+
}
|
|
487
|
+
return existing;
|
|
488
|
+
}
|
|
489
|
+
if (steps.size >= limit) {
|
|
490
|
+
truncated.steps++;
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
const isRoute = node.kind === 'route';
|
|
494
|
+
const routeRoot = isRoute ? (roots.get(node.id) ?? null) : null;
|
|
495
|
+
const record = {
|
|
496
|
+
id: node.id,
|
|
497
|
+
// A route is a screen or an endpoint — except one reached across a
|
|
498
|
+
// tier (`fetch('/api/users')` onto its own route), which is the crossing.
|
|
499
|
+
kind: isRoute && kind !== 'bridge' ? 'screen' : kind,
|
|
500
|
+
anchor: false,
|
|
501
|
+
node: (0, wire_1.toNodeRef)(node),
|
|
502
|
+
label: node.name,
|
|
503
|
+
// A screen says its component, an endpoint its handler; a route the
|
|
504
|
+
// graph bound to nothing says only where it is registered.
|
|
505
|
+
sub: isRoute
|
|
506
|
+
? routeRoot === null
|
|
507
|
+
? basename(node.filePath)
|
|
508
|
+
: routeRoot.inline
|
|
509
|
+
? `inline handler · ${basename(node.filePath)}`
|
|
510
|
+
: routeRoot.node.name
|
|
511
|
+
: posix(node.filePath),
|
|
512
|
+
depth,
|
|
513
|
+
cut: null,
|
|
514
|
+
...extra,
|
|
515
|
+
root: isRoute ? (routeRoot?.node ?? null) : node,
|
|
516
|
+
};
|
|
517
|
+
if (kind === 'event' && extra.event)
|
|
518
|
+
record.events = [extra.event];
|
|
519
|
+
if (isRoute) {
|
|
520
|
+
record.screen = {
|
|
521
|
+
path: node.name,
|
|
522
|
+
component: routeRoot !== null && !routeRoot.inline ? (0, wire_1.toNodeRef)(routeRoot.node) : null,
|
|
523
|
+
endpoint: (0, routes_1.splitRouteName)(node.name).method !== null,
|
|
524
|
+
inline: routeRoot?.inline ?? false,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
steps.set(node.id, record);
|
|
528
|
+
return record;
|
|
529
|
+
};
|
|
530
|
+
// One box per (function, category): `uploadARCapture` makes one network
|
|
531
|
+
// call, three storage calls and three telemetry calls — three boxes, each
|
|
532
|
+
// listing its calls, not seven. A reply is the exception: its identity is
|
|
533
|
+
// the outcome, so `authUser` answering 200 or 401 is two boxes — each
|
|
534
|
+
// line into them then carries its own condition on the picture, the
|
|
535
|
+
// Screens view's idiom — and the sites whose status cannot be read share
|
|
536
|
+
// one `response` box labelled by the call.
|
|
537
|
+
const effectSub = (e, by) => [e.category, e.model, e.access, by.name].filter((x) => !!x).join(' · ');
|
|
538
|
+
const effectStep = (by, ref, effect, depth, status = null) => {
|
|
539
|
+
const category = effect.category;
|
|
540
|
+
const id = status !== null ? `effect:${by.id}:${category}:${status}` : `effect:${by.id}:${category}`;
|
|
541
|
+
const existing = steps.get(id);
|
|
542
|
+
if (existing) {
|
|
543
|
+
const e = existing.effect;
|
|
544
|
+
if (!e.apis.includes(ref.referenceName)) {
|
|
545
|
+
e.apis.push(ref.referenceName);
|
|
546
|
+
existing.label = `${e.apis[0]} +${e.apis.length - 1}`;
|
|
547
|
+
}
|
|
548
|
+
// Several models behind one box: list them; several accesses: say both.
|
|
549
|
+
if (effect.model && e.model !== effect.model) {
|
|
550
|
+
const models = new Set((e.model ?? '').split(', ').filter(Boolean));
|
|
551
|
+
models.add(effect.model);
|
|
552
|
+
e.model = [...models].slice(0, 3).join(', ') + (models.size > 3 ? ', …' : '');
|
|
553
|
+
}
|
|
554
|
+
if (effect.access && e.access && e.access !== effect.access)
|
|
555
|
+
e.access = undefined;
|
|
556
|
+
existing.sub = effectSub(e, by);
|
|
557
|
+
return existing;
|
|
558
|
+
}
|
|
559
|
+
if (steps.size >= limit) {
|
|
560
|
+
truncated.steps++;
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
const e = {
|
|
564
|
+
api: ref.referenceName,
|
|
565
|
+
apis: [ref.referenceName],
|
|
566
|
+
category,
|
|
567
|
+
by: (0, wire_1.toNodeRef)(by),
|
|
568
|
+
line: ref.line,
|
|
569
|
+
...(effect.model ? { model: effect.model } : {}),
|
|
570
|
+
...(effect.access ? { access: effect.access } : {}),
|
|
571
|
+
};
|
|
572
|
+
const record = {
|
|
573
|
+
id,
|
|
574
|
+
kind: 'effect',
|
|
575
|
+
anchor: false,
|
|
576
|
+
node: null,
|
|
577
|
+
label: ref.referenceName,
|
|
578
|
+
sub: effectSub(e, by),
|
|
579
|
+
depth,
|
|
580
|
+
cut: null,
|
|
581
|
+
effect: e,
|
|
582
|
+
root: null,
|
|
583
|
+
};
|
|
584
|
+
steps.set(id, record);
|
|
585
|
+
return record;
|
|
586
|
+
};
|
|
587
|
+
/** One effect site: the call as written, what it passes, when, what fires it, and — for a response — the status. */
|
|
588
|
+
const effectLink = async (step, fold, ref, trigger, fallbackArgs = null, requireReceiver = false) => {
|
|
589
|
+
const at = { line: ref.line, column: ref.column };
|
|
590
|
+
const site = await callAt(fold.node, { ...at, callee: ref.referenceName });
|
|
591
|
+
// The site read must be THIS call: its last segment is the reference's.
|
|
592
|
+
const last = (n) => n.replace(/\([^()]*\)/g, '').split(/[.:]/).pop() ?? n;
|
|
593
|
+
const usable = !!site && site.callee !== '' && last(site.callee) === last(ref.referenceName);
|
|
594
|
+
const text = usable ? site.callee : ref.referenceName;
|
|
595
|
+
if (requireReceiver && !/[.:>]/.test(text))
|
|
596
|
+
return false;
|
|
597
|
+
const args = usable ? site.args : fallbackArgs;
|
|
598
|
+
// The receiver's declared type counts only when the call leaves the
|
|
599
|
+
// index through it: a library's `Repository<Cat>`, or the project's own
|
|
600
|
+
// `OwnerRepository` interface whose `save` comes from Spring Data — never
|
|
601
|
+
// a project class that declares the method, which is a place to walk into.
|
|
602
|
+
const declared = await receiverTypeFor(fold.node, text);
|
|
603
|
+
const receiverType = declared && (await resolveByReceiver(fold.node, text)) === null ? declared : null;
|
|
604
|
+
const effect = (0, effects_1.classifyEffect)({
|
|
605
|
+
text,
|
|
606
|
+
kind: ref.referenceKind,
|
|
607
|
+
language: fold.node.language,
|
|
608
|
+
project,
|
|
609
|
+
receiverType,
|
|
610
|
+
args,
|
|
611
|
+
});
|
|
612
|
+
if (effect === null)
|
|
613
|
+
return false;
|
|
614
|
+
// A reply's status, read before its box exists — the box is per outcome.
|
|
615
|
+
// `NextResponse.json(user, { status: 201 })`: the code sits in an object
|
|
616
|
+
// the abbreviation reduced to its keys; the site reader kept it. And a
|
|
617
|
+
// body-sending reply that sets none is a 200, so a success has a box of
|
|
618
|
+
// its own beside the 401's.
|
|
619
|
+
const status = effect.category === 'response'
|
|
620
|
+
? ((0, effects_1.responseStatus)(text, args, ref.referenceKind) ?? (usable && typeof site.status === 'number' ? site.status : null) ?? (0, effects_1.implicitResponseStatus)(text))
|
|
621
|
+
: null;
|
|
622
|
+
// What fires this call, read before its box is made: a call bound inside
|
|
623
|
+
// ANOTHER effect's arguments — the axios.delete in a confirm dialog's
|
|
624
|
+
// button — hangs off that box, one step deeper, not off the screen.
|
|
625
|
+
const fired = trigger ?? (await triggerAt(fold.node, at));
|
|
626
|
+
const from = fired?.of ? (firedByEffect(fold.node.id, at, fired.of) ?? step) : step;
|
|
627
|
+
const target = effectStep(fold.node, { referenceName: text, line: ref.line }, effect, from.depth + 1, status);
|
|
628
|
+
if (target === null)
|
|
629
|
+
return true;
|
|
630
|
+
const guards = await guardsAt(fold.node, at);
|
|
631
|
+
const when = (0, branch_guards_1.guardLabel)(guards);
|
|
632
|
+
const wireSite = { file: posix(fold.node.filePath), line: ref.line, text, when: '' };
|
|
633
|
+
if (args !== null)
|
|
634
|
+
wireSite.args = args;
|
|
635
|
+
if (status !== null)
|
|
636
|
+
wireSite.status = status;
|
|
637
|
+
const effectDecision = decisionOf(guards);
|
|
638
|
+
if (effectDecision)
|
|
639
|
+
wireSite.decision = effectDecision;
|
|
640
|
+
// Where the call is written HERE — in this function, at this line. The
|
|
641
|
+
// rail places the step by it; the tree's row order uses the hop out of the
|
|
642
|
+
// step's root, which is the same position when nothing was folded.
|
|
643
|
+
const local = {
|
|
644
|
+
file: fold.node.filePath,
|
|
645
|
+
line: site?.span?.start.line ?? ref.line,
|
|
646
|
+
column: site?.span?.start.column ?? ref.column ?? 0,
|
|
647
|
+
end: site?.span?.end ?? { line: ref.line, column: ref.column ?? 0 },
|
|
648
|
+
within: site?.within ?? null,
|
|
649
|
+
};
|
|
650
|
+
// This call's own span, for the bindings written inside its arguments.
|
|
651
|
+
if (usable && site?.span) {
|
|
652
|
+
const list = firedSpans.get(fold.node.id) ?? [];
|
|
653
|
+
list.push({ start: { line: local.line, column: local.column }, end: local.end, step: target });
|
|
654
|
+
firedSpans.set(fold.node.id, list);
|
|
655
|
+
}
|
|
656
|
+
const hop = fold.first ?? local;
|
|
657
|
+
if (!target.first)
|
|
658
|
+
target.first = hop;
|
|
659
|
+
if (!target.region)
|
|
660
|
+
target.region = regionOf(from, fold.chain);
|
|
661
|
+
const id = link(from, target, 'effect', fold.chain, [...fold.whens, when], wireSite, null, fired, hop.within);
|
|
662
|
+
record(fold.node, local, guards, { step: target.id, link: id }, fired, await loopsAt(fold.node, at));
|
|
663
|
+
return true;
|
|
664
|
+
};
|
|
665
|
+
const link = (from, to, kind, chain, whens, site, edge, trigger = null, within = null) => {
|
|
666
|
+
const meta = (edge?.metadata ?? {});
|
|
667
|
+
const synthesized = edge?.provenance === 'heuristic';
|
|
668
|
+
const confidence = typeof meta.confidence === 'number' ? meta.confidence : null;
|
|
669
|
+
const via = chain.map(wire_1.toNodeRef);
|
|
670
|
+
const viaKey = via.map((v) => v.id).join('>');
|
|
671
|
+
const id = `${from.id} ${to.id} ${viaKey}`;
|
|
672
|
+
const when = whens.filter((w, i) => w && whens.indexOf(w) === i).join(' && ');
|
|
673
|
+
const stamped = { ...site, when, ...(trigger ? { trigger } : {}) };
|
|
674
|
+
// A `contains` edge is how a nested handler is FOUND, not a place it is
|
|
675
|
+
// called from: its row stays only while no call site has been seen.
|
|
676
|
+
const structural = (s) => s.text.startsWith('defines ');
|
|
677
|
+
const existing = links.get(id);
|
|
678
|
+
if (existing) {
|
|
679
|
+
if (structural(stamped) && existing.sites.some((s) => !structural(s)))
|
|
680
|
+
return id;
|
|
681
|
+
if (!structural(stamped) && existing.sites.every(structural))
|
|
682
|
+
existing.sites.length = 0;
|
|
683
|
+
// One statement, two references (`res.status(201)` and its `.json(…)`):
|
|
684
|
+
// the outer call is the site, the inner one folds into it.
|
|
685
|
+
const sameLine = existing.sites.findIndex((s) => s.file === site.file && s.line === site.line);
|
|
686
|
+
if (sameLine < 0)
|
|
687
|
+
existing.sites.push(stamped);
|
|
688
|
+
else if (stamped.text.startsWith(existing.sites[sameLine].text) && stamped.text.length > existing.sites[sameLine].text.length) {
|
|
689
|
+
existing.sites[sameLine] = stamped;
|
|
690
|
+
}
|
|
691
|
+
if (!existing.trigger && trigger)
|
|
692
|
+
existing.trigger = trigger;
|
|
693
|
+
if (!existing.within && within)
|
|
694
|
+
existing.within = within;
|
|
695
|
+
if (when !== existing.when) {
|
|
696
|
+
if (!when || !existing.when)
|
|
697
|
+
existing.when = '';
|
|
698
|
+
else if (!existing.when.split(' || ').includes(when))
|
|
699
|
+
existing.when = `${existing.when} || ${when}`;
|
|
700
|
+
}
|
|
701
|
+
return id;
|
|
702
|
+
}
|
|
703
|
+
links.set(id, {
|
|
704
|
+
id,
|
|
705
|
+
from: from.id,
|
|
706
|
+
to: to.id,
|
|
707
|
+
kind,
|
|
708
|
+
via,
|
|
709
|
+
when,
|
|
710
|
+
label: hopLabel(meta, synthesized),
|
|
711
|
+
synthesized,
|
|
712
|
+
uncertain: confidence !== null && confidence < wire_1.UNCERTAIN_BELOW,
|
|
713
|
+
sites: [stamped],
|
|
714
|
+
...(trigger ? { trigger } : {}),
|
|
715
|
+
...(within ? { within } : {}),
|
|
716
|
+
});
|
|
717
|
+
if (trigger && to.kind === 'trigger' && !to.trigger)
|
|
718
|
+
to.trigger = trigger;
|
|
719
|
+
return id;
|
|
720
|
+
};
|
|
721
|
+
/** What fires a site, with the function it is written in. */
|
|
722
|
+
const triggerAt = async (caller, at) => {
|
|
723
|
+
const t = await reader.trigger(caller, at);
|
|
724
|
+
return t ? { ...t, in: caller.name } : null;
|
|
725
|
+
};
|
|
726
|
+
// The anchor: a screen keeps its kind and explores from its component; an
|
|
727
|
+
// endpoint says the request that fires it and what runs before its handler;
|
|
728
|
+
// a function says the job, event or schedule written on it.
|
|
729
|
+
const first = stepFor(anchor, 'anchor', 0);
|
|
730
|
+
first.anchor = true;
|
|
731
|
+
if (anchor.kind === 'route') {
|
|
732
|
+
const t = await requestTrigger(anchor, first.root);
|
|
733
|
+
if (t)
|
|
734
|
+
first.trigger = t;
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
const t = await consumerTrigger(anchor);
|
|
738
|
+
if (t)
|
|
739
|
+
first.trigger = t;
|
|
740
|
+
}
|
|
741
|
+
// A screen's picture is laid out by REGION — the part of the screen each
|
|
742
|
+
// step belongs to. The evidence is the walk's own: a step reached out of the
|
|
743
|
+
// anchor descends through the fold's chain, whose FIRST node is the
|
|
744
|
+
// top-level component (or hook) of the screen's tree; a chain of nothing is
|
|
745
|
+
// a call written in the screen body itself; and a step reached from any
|
|
746
|
+
// other step belongs where its first-reaching parent does. First reach wins,
|
|
747
|
+
// as `first` does — a shared store is one box, in the region that got there
|
|
748
|
+
// first, and every other region's way in is a link. An endpoint or a
|
|
749
|
+
// function reads in the code's order and carries none of this.
|
|
750
|
+
const regions = first.kind === 'screen' && !first.screen?.endpoint;
|
|
751
|
+
const regionOf = (from, chain) => {
|
|
752
|
+
if (!regions)
|
|
753
|
+
return undefined;
|
|
754
|
+
if (!from.anchor)
|
|
755
|
+
return from.region;
|
|
756
|
+
const head = chain[0];
|
|
757
|
+
if (head)
|
|
758
|
+
return { id: head.id, label: head.name };
|
|
759
|
+
return { id: from.root?.id ?? from.id, label: from.root?.name ?? from.label };
|
|
760
|
+
};
|
|
761
|
+
const queue = [first];
|
|
762
|
+
/** Steps whose exploration has been queued — each is explored once, from the first row it appears on. */
|
|
763
|
+
const explored = new Set([first.id]);
|
|
764
|
+
while (queue.length > 0) {
|
|
765
|
+
const step = queue.shift();
|
|
766
|
+
if (step.root === null)
|
|
767
|
+
continue;
|
|
768
|
+
// Another screen is a chapter of its own: the Screens view draws the way
|
|
769
|
+
// between screens, and a picture that walked on through Home would be the
|
|
770
|
+
// whole app. Drawn as a boundary, entered on request.
|
|
771
|
+
// An endpoint reached across a tier is the same kind of boundary: the
|
|
772
|
+
// request's own picture starts at its handler, entered on request.
|
|
773
|
+
if ((step.kind === 'screen' || (step.kind === 'bridge' && step.node?.kind === 'route')) && !step.anchor && !through) {
|
|
774
|
+
step.cut = 'screen';
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
// A native event that lands in a COMPONENT — the capture overlay taking
|
|
778
|
+
// `onCaptureProgress` — lands on another screen's body: its picture is
|
|
779
|
+
// that screen's, not this one's. A boundary too, entered on request.
|
|
780
|
+
if (step.kind === 'event' && !step.anchor && !through && (0, route_roots_1.looksLikeComponent)(step.root)) {
|
|
781
|
+
step.cut = 'component';
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (step.depth >= depthCap) {
|
|
785
|
+
// Something to explore, and no room in the picture for it.
|
|
786
|
+
if (cg.getOutgoingEdgesFrom([step.root.id], WALK_KINDS).length > 0)
|
|
787
|
+
step.cut = 'depth';
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
// Breadth-first through the plumbing until the next steps.
|
|
791
|
+
const visited = new Set([step.root.id]);
|
|
792
|
+
let frontier = [{ node: step.root, chain: [], whens: [], first: null }];
|
|
793
|
+
for (let hop = 0; hop <= MAX_FOLD_DEPTH && frontier.length > 0; hop++) {
|
|
794
|
+
const next = [];
|
|
795
|
+
const ids = frontier.map((f) => f.node.id);
|
|
796
|
+
const outgoing = cg.getOutgoingEdgesFrom(ids, WALK_KINDS);
|
|
797
|
+
const bySource = new Map();
|
|
798
|
+
for (const e of outgoing) {
|
|
799
|
+
const list = bySource.get(e.source) ?? [];
|
|
800
|
+
list.push(e);
|
|
801
|
+
bySource.set(e.source, list);
|
|
802
|
+
}
|
|
803
|
+
// `const Memoized = memo(CaptureComponent)`: the wrapper is a component
|
|
804
|
+
// node with no edges of its own — the inner component is referenced
|
|
805
|
+
// from the FILE scope, at the wrapper's line. Lend the wrapper those
|
|
806
|
+
// references, so the screen that renders `<Memoized/>` walks on into
|
|
807
|
+
// what the component does.
|
|
808
|
+
// The same for a value a registration is written inside — `const
|
|
809
|
+
// worker = new Worker('q', async (job) => { … })`: the arrow's calls
|
|
810
|
+
// belong to the file scope and the constant spans them; a queue job
|
|
811
|
+
// lands on the constant, and the walk goes on into what the handler does.
|
|
812
|
+
for (const fold of frontier) {
|
|
813
|
+
const value = fold.node.kind === 'constant' || fold.node.kind === 'variable';
|
|
814
|
+
// Edges the walk would follow as BEHAVIOUR. `const signIn =
|
|
815
|
+
// validatedAction(schema, async (data) => { … })` holds a plain
|
|
816
|
+
// `references` edge to its schema and nothing else: counting that as
|
|
817
|
+
// "it has edges of its own" left the whole handler body unlent, and the
|
|
818
|
+
// picture showed one call out of nine.
|
|
819
|
+
const behaviour = (bySource.get(fold.node.id) ?? []).filter((e) => e.kind !== 'references' || e.metadata?.fnRef === true).length;
|
|
820
|
+
if ((fold.node.kind !== 'component' && !value) || behaviour > 0)
|
|
821
|
+
continue;
|
|
822
|
+
for (const e of fileScopeEdgesWithin(cg, fold.node, fileScopeRefs, value)) {
|
|
823
|
+
const list = bySource.get(fold.node.id) ?? [];
|
|
824
|
+
list.push({ ...e, source: fold.node.id });
|
|
825
|
+
bySource.set(fold.node.id, list);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const targetIds = new Set();
|
|
829
|
+
for (const list of bySource.values())
|
|
830
|
+
for (const e of list)
|
|
831
|
+
targetIds.add(e.target);
|
|
832
|
+
const targets = targetIds.size === 0 ? new Map() : cg.getNodesByIds([...targetIds]);
|
|
833
|
+
// Hubs and chrome are judged on the nodes about to be entered.
|
|
834
|
+
const unknownFanIn = [...targetIds].filter((id) => !fanIn.has(id));
|
|
835
|
+
if (unknownFanIn.length > 0)
|
|
836
|
+
for (const [id, n] of cg.getFanIn(unknownFanIn))
|
|
837
|
+
fanIn.set(id, n);
|
|
838
|
+
for (const fold of frontier) {
|
|
839
|
+
// A call a synthesized channel already follows — the `fetch` that
|
|
840
|
+
// reaches its own route, the `queue.add` its consumer picks up — is
|
|
841
|
+
// the crossing, not also a call outside the index.
|
|
842
|
+
const channelLines = new Set();
|
|
843
|
+
/** Per line, the last segment of each call a channel follows there (`add` of `emailQueue.add`). */
|
|
844
|
+
const channelCalls = new Map();
|
|
845
|
+
for (const e of bySource.get(fold.node.id) ?? []) {
|
|
846
|
+
const m = e.metadata;
|
|
847
|
+
if (typeof m?.channel !== 'string' || typeof e.line !== 'number')
|
|
848
|
+
continue;
|
|
849
|
+
channelLines.add(e.line);
|
|
850
|
+
if (typeof m.callee === 'string') {
|
|
851
|
+
const set = channelCalls.get(e.line) ?? new Set();
|
|
852
|
+
set.add(m.callee.split(/[.:]/).pop() ?? m.callee);
|
|
853
|
+
channelCalls.set(e.line, set);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
// Effects made by this node, folded or not. A value a handler is
|
|
857
|
+
// written inside (`const authUser = asyncHandler(async (req, res) =>
|
|
858
|
+
// …)`) made none itself — the arrow's calls belong to the file scope —
|
|
859
|
+
// so it is lent the file's, within its lines, as its call edges are.
|
|
860
|
+
if (effectScans < MAX_EFFECT_SCANS) {
|
|
861
|
+
effectScans++;
|
|
862
|
+
let refs = [];
|
|
863
|
+
try {
|
|
864
|
+
refs = cg.getUnresolvedReferencesFrom(fold.node.id);
|
|
865
|
+
if (refs.length === 0 && (fold.node.kind === 'constant' || fold.node.kind === 'variable'))
|
|
866
|
+
refs = fileScopeRefsWithin(cg, fold.node, fileScopeUnresolved);
|
|
867
|
+
}
|
|
868
|
+
catch {
|
|
869
|
+
refs = [];
|
|
870
|
+
}
|
|
871
|
+
for (const ref of [...refs].sort((a, b) => a.line - b.line || a.column - b.column)) {
|
|
872
|
+
if (ref.referenceKind !== 'calls' && ref.referenceKind !== 'instantiates')
|
|
873
|
+
continue;
|
|
874
|
+
if (channelLines.has(ref.line))
|
|
875
|
+
continue;
|
|
876
|
+
await effectLink(step, fold, { referenceName: ref.referenceName, referenceKind: ref.referenceKind, line: ref.line, column: ref.column }, null);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
let edges = (bySource.get(fold.node.id) ?? []).slice();
|
|
880
|
+
edges = edges.filter((e) => {
|
|
881
|
+
const meta = (e.metadata ?? {});
|
|
882
|
+
if (e.kind === 'references')
|
|
883
|
+
return meta.fnRef === true;
|
|
884
|
+
if (e.kind === 'contains') {
|
|
885
|
+
// A function's nested handlers; and, when the walk STARTS at a
|
|
886
|
+
// class (a ViewSet, a class-based view bound to a route), its
|
|
887
|
+
// methods — never a class met on the way, whose methods are not
|
|
888
|
+
// what the caller reached.
|
|
889
|
+
const t = targets.get(e.target);
|
|
890
|
+
const fromFunction = fold.node.kind === 'function' || fold.node.kind === 'method';
|
|
891
|
+
const fromRootClass = fold.node.kind === 'class' && fold.chain.length === 0 && fold.node.id === step.root?.id;
|
|
892
|
+
return (fromFunction || fromRootClass) && !!t && (t.kind === 'function' || t.kind === 'method');
|
|
893
|
+
}
|
|
894
|
+
return true;
|
|
895
|
+
});
|
|
896
|
+
edges.sort((a, b) => (a.line ?? 0) - (b.line ?? 0) || a.target.localeCompare(b.target));
|
|
897
|
+
if (edges.length > MAX_FANOUT) {
|
|
898
|
+
step.cut = 'fan-out';
|
|
899
|
+
edges = edges.slice(0, MAX_FANOUT);
|
|
900
|
+
}
|
|
901
|
+
const arrivals = [];
|
|
902
|
+
const fromTest = (0, query_utils_1.isTestPath)(fold.node.filePath);
|
|
903
|
+
for (const e of edges) {
|
|
904
|
+
const found = targets.get(e.target);
|
|
905
|
+
if (!found || found.kind === 'file')
|
|
906
|
+
continue;
|
|
907
|
+
const meta = (e.metadata ?? {});
|
|
908
|
+
// A member call the index kept only the last segment of (`create`
|
|
909
|
+
// for `prisma.user.create`) resolves by name alone — a guess, and
|
|
910
|
+
// often the wrong one. The call AS WRITTEN decides first: an effect
|
|
911
|
+
// is drawn as one and the guessed edge is not walked. A call through
|
|
912
|
+
// a project-made value (`client.post` on the axios instance) is the
|
|
913
|
+
// same case with the constant as the target.
|
|
914
|
+
let target = targets.get(e.target);
|
|
915
|
+
let retargeted = false;
|
|
916
|
+
// `api.get('/users')` resolves to the `api` constant — and
|
|
917
|
+
// `this.audioQueue.add('transcode')` to some `add` by name — AND,
|
|
918
|
+
// on the same line, a channel follows the call: the channel is the story.
|
|
919
|
+
if (typeof meta.channel !== 'string' && e.kind === 'calls' && channelLines.has(e.line ?? -1)) {
|
|
920
|
+
const written = typeof meta.refName === 'string' ? meta.refName : target.name;
|
|
921
|
+
const last = written.split(/[.:]/).pop() ?? written;
|
|
922
|
+
if (target.kind === 'constant' || target.kind === 'variable' || channelCalls.get(e.line)?.has(last))
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
if (e.kind === 'calls' && typeof meta.synthesizedBy !== 'string' && e.provenance !== 'heuristic') {
|
|
926
|
+
const refName = typeof meta.refName === 'string' ? meta.refName : target.name;
|
|
927
|
+
const bare = !refName.includes('.');
|
|
928
|
+
// A member call whose receiver is declared as a type the index
|
|
929
|
+
// holds no class for (`DataStore<UserPreferences>`) leaves the
|
|
930
|
+
// index too, whatever name-matched — an `updateData` on a test
|
|
931
|
+
// double, say.
|
|
932
|
+
let external = false;
|
|
933
|
+
if (!bare && target.kind !== 'constant' && target.kind !== 'variable') {
|
|
934
|
+
const declared = await receiverTypeFor(fold.node, refName);
|
|
935
|
+
external = !!declared && (await classOfType(declared)) === null;
|
|
936
|
+
}
|
|
937
|
+
if (bare || external || target.kind === 'constant' || target.kind === 'variable') {
|
|
938
|
+
const drawn = await effectLink(step, fold, { referenceName: refName, referenceKind: 'calls', line: e.line ?? fold.node.startLine, column: e.column }, null, null, true);
|
|
939
|
+
if (drawn)
|
|
940
|
+
continue;
|
|
941
|
+
// Not an effect: does the receiver's declared type say where the
|
|
942
|
+
// call goes? A class in the index wins over the name-only guess.
|
|
943
|
+
if (bare) {
|
|
944
|
+
const written = await callAt(fold.node, { line: e.line, column: e.column, callee: refName });
|
|
945
|
+
if (written && /[.:]/.test(written.callee) && (written.callee.split(/[.:]/).pop() ?? '') === refName) {
|
|
946
|
+
const real = await resolveByReceiver(fold.node, written.callee);
|
|
947
|
+
if (real && real.id !== target.id) {
|
|
948
|
+
target = real;
|
|
949
|
+
retargeted = true;
|
|
950
|
+
}
|
|
951
|
+
else if (real === null && ownMethodWithoutReceiver(fold.node, target, written.callee)) {
|
|
952
|
+
// `crypto.createHash('sha256').update(…)` in a method of a
|
|
953
|
+
// class that happens to have an `update`: the index kept
|
|
954
|
+
// only `update` and matched it by name. In this family a
|
|
955
|
+
// method of your own class is written `this.update(…)`, so
|
|
956
|
+
// a receiver that is not `this` proves the guess wrong. The
|
|
957
|
+
// call leaves the index — say nothing rather than the wrong thing.
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
if (target.id === fold.node.id)
|
|
965
|
+
continue;
|
|
966
|
+
// A production walk never enters a test double: an interface's
|
|
967
|
+
// dispatch into `TestUserDataRepository`, or a `DataStore` name-matched
|
|
968
|
+
// to the in-memory one, is the test suite's story. Judged after the
|
|
969
|
+
// call as written had its chance to be an effect.
|
|
970
|
+
if (!fromTest && (0, query_utils_1.isTestPath)(target.filePath))
|
|
971
|
+
continue;
|
|
972
|
+
const site = {
|
|
973
|
+
file: posix(fold.node.filePath),
|
|
974
|
+
line: e.line ?? fold.node.startLine,
|
|
975
|
+
text: siteText(e, meta, target),
|
|
976
|
+
when: '',
|
|
977
|
+
};
|
|
978
|
+
// What fires this hop, when the site is written under an event:
|
|
979
|
+
// the JSX prop, the `on*` option, the runs-later call. Read for
|
|
980
|
+
// every call-shaped hop, so a store action or an effect fired by
|
|
981
|
+
// a tap says so on its link too.
|
|
982
|
+
const isCall = e.kind === 'calls' || e.kind === 'instantiates' || (e.kind === 'references' && meta.fnRef === true);
|
|
983
|
+
const trigger = isCall ? await triggerAt(fold.node, { line: e.line, column: e.column }) : null;
|
|
984
|
+
// A server action, by its directive: a function in a `'use server'`
|
|
985
|
+
// file (or opening with the directive) called from a file that is
|
|
986
|
+
// not — the call crosses to the server, whatever the import says.
|
|
987
|
+
if (e.provenance !== 'heuristic' &&
|
|
988
|
+
(e.kind === 'calls' || (e.kind === 'references' && meta.fnRef === true)) &&
|
|
989
|
+
(target.kind === 'function' || target.kind === 'method') &&
|
|
990
|
+
JS_FAMILY.has(target.language) &&
|
|
991
|
+
JS_FAMILY.has(fold.node.language)) {
|
|
992
|
+
const callee = await calls.directive(target);
|
|
993
|
+
if ((callee.file === 'server' || callee.own) && (await calls.directive(fold.node)).file !== 'server') {
|
|
994
|
+
meta.tier = 'client→server';
|
|
995
|
+
meta.channel = 'server-action';
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
// What kind of step, if any, this edge arrives at.
|
|
999
|
+
let kind = null;
|
|
1000
|
+
let linkKind = 'calls';
|
|
1001
|
+
const extra = {};
|
|
1002
|
+
if (target.kind === 'route' && meta.tier !== 'client→server') {
|
|
1003
|
+
kind = 'screen';
|
|
1004
|
+
linkKind = 'navigates';
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
// A language change under the code is a step only on evidence: a
|
|
1008
|
+
// bridge resolver's edge (`bridge`, or a framework resolution), or
|
|
1009
|
+
// a synthesized channel's. A plain name-matched call across the
|
|
1010
|
+
// families (`arr.flat()` landing on a Swift `flat`) is noise, and
|
|
1011
|
+
// is neither drawn nor walked.
|
|
1012
|
+
const cross = crossing(fold.node.language, target.language, meta);
|
|
1013
|
+
const evidenced = e.provenance === 'heuristic' || meta.bridge === 'react-native' || meta.resolvedBy === 'framework' || meta.channel === 'server-action';
|
|
1014
|
+
if (cross !== null && !evidenced)
|
|
1015
|
+
continue;
|
|
1016
|
+
if (cross === 'event') {
|
|
1017
|
+
kind = 'event';
|
|
1018
|
+
linkKind = 'event';
|
|
1019
|
+
if (typeof meta.event === 'string')
|
|
1020
|
+
extra.event = meta.event;
|
|
1021
|
+
}
|
|
1022
|
+
else if (cross === 'bridge') {
|
|
1023
|
+
kind = 'bridge';
|
|
1024
|
+
linkKind = 'bridge';
|
|
1025
|
+
}
|
|
1026
|
+
else if ((target.kind === 'function' || target.kind === 'method') &&
|
|
1027
|
+
isStoreFile(target.filePath) &&
|
|
1028
|
+
!isStoreFile(fold.node.filePath)) {
|
|
1029
|
+
// A store action fired straight from a tap stays a store
|
|
1030
|
+
// action; the tap is on its link.
|
|
1031
|
+
kind = 'store';
|
|
1032
|
+
linkKind = 'store';
|
|
1033
|
+
}
|
|
1034
|
+
else if ((target.kind === 'function' || target.kind === 'method') &&
|
|
1035
|
+
!(0, route_roots_1.looksLikeComponent)(target) &&
|
|
1036
|
+
((e.kind === 'references' && meta.fnRef === true) || trigger !== null)) {
|
|
1037
|
+
// A handler: a function passed as a value (`onPress={handleX}`,
|
|
1038
|
+
// `addListener('x', handleX)`), or one called from under an
|
|
1039
|
+
// event binding (`onPress={() => handleLogin(values)}`,
|
|
1040
|
+
// `useFormik({ onSubmit: (v) => handleLogin(v) })`). A
|
|
1041
|
+
// component passed as a value (`memo(CaptureComponent)`) is a
|
|
1042
|
+
// render hop and folds like one.
|
|
1043
|
+
kind = 'trigger';
|
|
1044
|
+
linkKind = 'handler';
|
|
1045
|
+
if (trigger)
|
|
1046
|
+
extra.trigger = trigger;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (retargeted)
|
|
1050
|
+
meta.resolvedBy = 'receiver-type';
|
|
1051
|
+
arrivals.push({ e, target, meta, site, kind, linkKind, extra, trigger });
|
|
1052
|
+
}
|
|
1053
|
+
for (const a of arrivals) {
|
|
1054
|
+
if (a.kind === null)
|
|
1055
|
+
continue;
|
|
1056
|
+
const at = { line: a.e.line, column: a.e.column };
|
|
1057
|
+
// A binding written inside an effect call's arguments — the dialog's
|
|
1058
|
+
// `onPress` — arrives from that box, not from the step that owns
|
|
1059
|
+
// the fold: the prompt fires it.
|
|
1060
|
+
const firedBy = a.trigger?.of ? firedByEffect(fold.node.id, at, a.trigger.of) : null;
|
|
1061
|
+
const from = firedBy ?? step;
|
|
1062
|
+
const fresh = !steps.has(a.target.id);
|
|
1063
|
+
const to = stepFor(a.target, a.kind, from.depth + 1, a.extra);
|
|
1064
|
+
if (to === null)
|
|
1065
|
+
continue;
|
|
1066
|
+
if (fresh && !to.trigger) {
|
|
1067
|
+
const t = a.target.kind === 'route' ? await requestTrigger(a.target, to.root) : await consumerTrigger(a.target);
|
|
1068
|
+
if (t)
|
|
1069
|
+
to.trigger = t;
|
|
1070
|
+
}
|
|
1071
|
+
const guards = await guardsAt(fold.node, at);
|
|
1072
|
+
const when = (0, branch_guards_1.guardLabel)(guards);
|
|
1073
|
+
// A call-shaped hop says what it passes; a navigation already says
|
|
1074
|
+
// its href, a handler binding and a native event channel pass
|
|
1075
|
+
// nothing. A hop over a synthesized channel is a call in the source
|
|
1076
|
+
// — `fetch('/api/users', {…})`, `emailQueue.add('welcome', {…})` —
|
|
1077
|
+
// and its site reads as written.
|
|
1078
|
+
let site = a.site;
|
|
1079
|
+
if (typeof a.meta.channel === 'string' && a.meta.channel !== 'server-action') {
|
|
1080
|
+
const written = await callAt(fold.node, at);
|
|
1081
|
+
site = written && written.callee ? { ...a.site, text: written.callee, args: written.args } : await withArgs(a.site, fold.node, at);
|
|
1082
|
+
}
|
|
1083
|
+
else if (a.linkKind === 'bridge' ||
|
|
1084
|
+
a.linkKind === 'store' ||
|
|
1085
|
+
a.linkKind === 'calls' ||
|
|
1086
|
+
// A handler BOUND passes nothing (`onPress={handleX}`), but a
|
|
1087
|
+
// handler CALLED from under a binding is a call like any other —
|
|
1088
|
+
// and `tryCatchSync(onClosePress)`'s argument is the whole answer
|
|
1089
|
+
// to what a wrapper wraps.
|
|
1090
|
+
(a.linkKind === 'handler' && (a.e.kind === 'calls' || a.e.kind === 'instantiates'))) {
|
|
1091
|
+
site = await withArgs(a.site, fold.node, at);
|
|
1092
|
+
}
|
|
1093
|
+
// Where this step is first reached from: the hop out of the root
|
|
1094
|
+
// this fold descends from, else this site — its position orders the row.
|
|
1095
|
+
const isCallHop = a.e.kind === 'calls' || a.e.kind === 'instantiates' || a.e.kind === 'navigates';
|
|
1096
|
+
const local = isCallHop ? await hopAt(fold.node, at, a.target.name) : pointHop(fold.node, at);
|
|
1097
|
+
const hop = fold.first ?? local;
|
|
1098
|
+
if (!to.first)
|
|
1099
|
+
to.first = hop;
|
|
1100
|
+
if (!to.region)
|
|
1101
|
+
to.region = regionOf(from, fold.chain);
|
|
1102
|
+
const decision = decisionOf(guards);
|
|
1103
|
+
if (decision)
|
|
1104
|
+
site = { ...site, decision };
|
|
1105
|
+
const id = link(from, to, a.linkKind, fold.chain, [...fold.whens, when], site, a.e, a.trigger, hop.within);
|
|
1106
|
+
record(fold.node, local, guards, { step: to.id, link: id }, a.trigger, await loopsAt(fold.node, at));
|
|
1107
|
+
if (to.root !== null && !explored.has(to.id)) {
|
|
1108
|
+
explored.add(to.id);
|
|
1109
|
+
queue.push(to);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
for (const a of arrivals) {
|
|
1113
|
+
if (a.kind !== null)
|
|
1114
|
+
continue;
|
|
1115
|
+
const { e, target, meta } = a;
|
|
1116
|
+
// A call through a VALUE the effect table knows — `client.post` on
|
|
1117
|
+
// the axios instance the project made itself resolves to the
|
|
1118
|
+
// `client` constant, not to anything outside the index. The call
|
|
1119
|
+
// text is the evidence: the call is the effect, the constant is not
|
|
1120
|
+
// a place to walk into.
|
|
1121
|
+
// A thrown exception the framework answers with (`throw new
|
|
1122
|
+
// NotFoundException(…)` on a class the project defines) is a
|
|
1123
|
+
// response, not a place to walk into; a repository's method the
|
|
1124
|
+
// walk cannot enter (an interface's, the ORM's) is the database.
|
|
1125
|
+
if (e.kind === 'instantiates' && target.kind === 'class') {
|
|
1126
|
+
if (await effectLink(step, fold, { referenceName: target.name, referenceKind: 'instantiates', line: e.line ?? fold.node.startLine, column: e.column }, a.trigger))
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
if (e.kind === 'calls' && repositoryMethod(target)) {
|
|
1130
|
+
const container = target.qualifiedName.replace(/[.:]+[^.:]*$/, '').split(/[.:]+/).pop() ?? '';
|
|
1131
|
+
const api = typeof meta.refName === 'string' && meta.refName.includes('.') ? meta.refName : `${container}.${target.name}`;
|
|
1132
|
+
if (await effectLink(step, fold, { referenceName: api, referenceKind: 'calls', line: e.line ?? fold.node.startLine, column: e.column }, a.trigger))
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
// Already a step, reached here by a plain call: a link, not a fold.
|
|
1136
|
+
const known = steps.get(target.id);
|
|
1137
|
+
if (known) {
|
|
1138
|
+
if (known.id !== step.id) {
|
|
1139
|
+
const at = { line: e.line, column: e.column };
|
|
1140
|
+
const firedBy = a.trigger?.of ? firedByEffect(fold.node.id, at, a.trigger.of) : null;
|
|
1141
|
+
const guards = await guardsAt(fold.node, at);
|
|
1142
|
+
const local = await hopAt(fold.node, at, target.name);
|
|
1143
|
+
const hop = fold.first ?? local;
|
|
1144
|
+
const knownDecision = decisionOf(guards);
|
|
1145
|
+
const knownSite = await withArgs(a.site, fold.node, at);
|
|
1146
|
+
const id = link(firedBy ?? step, known, 'calls', fold.chain, [...fold.whens, (0, branch_guards_1.guardLabel)(guards)], knownDecision ? { ...knownSite, decision: knownDecision } : knownSite, e, a.trigger, hop.within);
|
|
1147
|
+
record(fold.node, local, guards, { step: known.id, link: id }, a.trigger, await loopsAt(fold.node, at));
|
|
1148
|
+
}
|
|
1149
|
+
continue;
|
|
1150
|
+
}
|
|
1151
|
+
// Plumbing: fold it and keep walking, unless it is a dead end.
|
|
1152
|
+
if (visited.has(target.id))
|
|
1153
|
+
continue;
|
|
1154
|
+
if ((fanIn.get(target.id) ?? 0) >= wire_1.HUB_THRESHOLD) {
|
|
1155
|
+
truncated.hubs++;
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
if (meta.synthesizedBy === 'jsx-render' && isSharedChrome(cg, target, chromeParents)) {
|
|
1159
|
+
truncated.chrome++;
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
if (visited.size >= MAX_FOLDED_PER_STEP) {
|
|
1163
|
+
step.cut = step.cut ?? 'folded';
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
visited.add(target.id);
|
|
1167
|
+
const at = { line: e.line, column: e.column };
|
|
1168
|
+
const guards = await guardsAt(fold.node, at);
|
|
1169
|
+
const local = e.kind === 'calls' || e.kind === 'instantiates' ? await hopAt(fold.node, at, target.name) : pointHop(fold.node, at);
|
|
1170
|
+
const first = fold.first ?? local;
|
|
1171
|
+
// The helper is drawn where it is CALLED: its own records are its
|
|
1172
|
+
// body, and this is the site the rail nests them under.
|
|
1173
|
+
record(fold.node, local, guards, { into: target.id }, a.trigger, await loopsAt(fold.node, at));
|
|
1174
|
+
next.push({ node: target, chain: [...fold.chain, target], whens: [...fold.whens, (0, branch_guards_1.guardLabel)(guards)], first });
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
frontier = next;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
// An effect box with ONE call behind it says what that call passes —
|
|
1181
|
+
// `axios.post('/auth/login', { email, password })` is the fact a reader
|
|
1182
|
+
// scans for; several calls list themselves in the panel instead.
|
|
1183
|
+
const sitesByStep = new Map();
|
|
1184
|
+
for (const l of links.values()) {
|
|
1185
|
+
const list = sitesByStep.get(l.to) ?? [];
|
|
1186
|
+
list.push(...l.sites);
|
|
1187
|
+
sitesByStep.set(l.to, list);
|
|
1188
|
+
}
|
|
1189
|
+
for (const step of steps.values()) {
|
|
1190
|
+
if (step.kind !== 'effect' || !step.effect)
|
|
1191
|
+
continue;
|
|
1192
|
+
const sites = sitesByStep.get(step.id) ?? [];
|
|
1193
|
+
// A response box is one outcome of the endpoint's contract: its status,
|
|
1194
|
+
// when literal, is its label (one per box by construction); the rows say
|
|
1195
|
+
// when. The box of unreadable statuses holds none and is labelled by its
|
|
1196
|
+
// call below.
|
|
1197
|
+
if (step.effect.category === 'response') {
|
|
1198
|
+
const statuses = [...new Set(sites.map((s) => s.status).filter((x) => typeof x === 'number'))].sort((a, b) => a - b);
|
|
1199
|
+
if (statuses.length > 0) {
|
|
1200
|
+
step.effect.statuses = statuses;
|
|
1201
|
+
step.label = statuses.join(' · ');
|
|
1202
|
+
continue;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
if (step.effect.apis.length !== 1)
|
|
1206
|
+
continue;
|
|
1207
|
+
if (sites.length !== 1 || sites[0].args === undefined)
|
|
1208
|
+
continue;
|
|
1209
|
+
const label = `${step.effect.api}(${sites[0].args})`;
|
|
1210
|
+
step.label = label.length > MAX_EFFECT_LABEL ? `${label.slice(0, MAX_EFFECT_LABEL - 2)}…)` : label;
|
|
1211
|
+
}
|
|
1212
|
+
// A row reads in the code's order: by the position of the hop that first
|
|
1213
|
+
// reached each step, a hop written inside another site's arguments before
|
|
1214
|
+
// that site — `generateToken(…)` in `res.json({ token: generateToken(…) })`
|
|
1215
|
+
// signs the token before the 200 is sent, so it comes first.
|
|
1216
|
+
const byDepth = new Map();
|
|
1217
|
+
for (const s of steps.values())
|
|
1218
|
+
byDepth.set(s.depth, [...(byDepth.get(s.depth) ?? []), s]);
|
|
1219
|
+
for (const row of byDepth.values()) {
|
|
1220
|
+
row.sort((a, b) => hopCompare(a.first, b.first) || a.label.localeCompare(b.label) || a.id.localeCompare(b.id));
|
|
1221
|
+
row.forEach((s, i) => {
|
|
1222
|
+
s.order = i;
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
const ordered = [...steps.values()].sort((a, b) => a.depth - b.depth || (a.order ?? 0) - (b.order ?? 0) || a.id.localeCompare(b.id));
|
|
1226
|
+
// The second reading: the same steps in the code's order. A step the walk
|
|
1227
|
+
// ENTERED reads on into its own body; a boundary (another screen, an
|
|
1228
|
+
// endpoint across a tier) does not — it is a chapter of its own, exactly as
|
|
1229
|
+
// on the picture.
|
|
1230
|
+
const nodesById = new Map();
|
|
1231
|
+
for (const s of steps.values())
|
|
1232
|
+
if (s.root)
|
|
1233
|
+
nodesById.set(s.root.id, s.root);
|
|
1234
|
+
const program = (0, program_1.buildProgram)({
|
|
1235
|
+
sites: new Map([...programs].map(([fn, sites]) => [fn, [...sites.values()]])),
|
|
1236
|
+
root: first.root?.id ?? null,
|
|
1237
|
+
node: (id) => {
|
|
1238
|
+
const found = nodesById.get(id) ?? cg.getNode(id);
|
|
1239
|
+
return found ? (0, wire_1.toNodeRef)(found) : null;
|
|
1240
|
+
},
|
|
1241
|
+
step: (id) => {
|
|
1242
|
+
const s = steps.get(id);
|
|
1243
|
+
if (!s)
|
|
1244
|
+
return null;
|
|
1245
|
+
return { reply: s.effect?.category === 'response', into: s.cut === null && s.root ? s.root.id : null };
|
|
1246
|
+
},
|
|
1247
|
+
});
|
|
1248
|
+
return {
|
|
1249
|
+
anchor: (0, wire_1.toNodeRef)(anchor),
|
|
1250
|
+
ambiguous,
|
|
1251
|
+
project,
|
|
1252
|
+
steps: ordered.map(({ root: _root, first: _first, ...step }) => step),
|
|
1253
|
+
links: [...links.values()].sort((a, b) => a.id.localeCompare(b.id)),
|
|
1254
|
+
program,
|
|
1255
|
+
// A screen is a set of handlers with no order between them; anything with a
|
|
1256
|
+
// body — a handler, an endpoint, any function — reads in the code's order.
|
|
1257
|
+
defaultView: program !== null && !(first.kind === 'screen' && !first.screen?.endpoint) ? 'order' : 'tree',
|
|
1258
|
+
depth: depthCap,
|
|
1259
|
+
limit,
|
|
1260
|
+
through,
|
|
1261
|
+
truncated,
|
|
1262
|
+
index,
|
|
1263
|
+
timing: { elapsedMs: Date.now() - started },
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
// =============================================================================
|
|
1267
|
+
// Helpers
|
|
1268
|
+
// =============================================================================
|
|
1269
|
+
/**
|
|
1270
|
+
* The anchor: `anchor=<id>`, or `symbol=<name>` resolved to the most
|
|
1271
|
+
* screen-like symbol of that name — a route first, then a component or
|
|
1272
|
+
* function, then a method — with the rest reported as `ambiguous`.
|
|
1273
|
+
*/
|
|
1274
|
+
function resolveAnchor(cg, query) {
|
|
1275
|
+
const id = query.get('anchor');
|
|
1276
|
+
if (id !== null && id.trim() !== '') {
|
|
1277
|
+
const node = cg.getNode(id);
|
|
1278
|
+
if (!node)
|
|
1279
|
+
throw (0, respond_1.notFound)(`No symbol with id "${id}" in this index.`, 'It may have moved in a re-index; open it from search or the Screens view.');
|
|
1280
|
+
return { anchor: node, ambiguous: [] };
|
|
1281
|
+
}
|
|
1282
|
+
const name = query.get('symbol');
|
|
1283
|
+
if (name === null || name.trim() === '')
|
|
1284
|
+
throw (0, respond_1.badRequest)('Give the picture an anchor: ?anchor=<node id> or ?symbol=<name>.');
|
|
1285
|
+
const rank = { route: 0, component: 1, function: 2, method: 3, class: 4, constant: 5, variable: 6 };
|
|
1286
|
+
const matches = cg
|
|
1287
|
+
.getNodesByName(name.trim())
|
|
1288
|
+
.filter((n) => n.kind !== 'file' && n.kind !== 'import' && n.kind !== 'export')
|
|
1289
|
+
.sort((a, b) => (rank[a.kind] ?? 9) - (rank[b.kind] ?? 9) || a.filePath.localeCompare(b.filePath) || a.startLine - b.startLine);
|
|
1290
|
+
const anchor = matches[0];
|
|
1291
|
+
if (!anchor)
|
|
1292
|
+
throw (0, respond_1.notFound)(`Nothing in this index is named "${name}".`, 'Try the search box; names are matched exactly.');
|
|
1293
|
+
return { anchor, ambiguous: matches.slice(1, 9).map(wire_1.toNodeRef) };
|
|
1294
|
+
}
|
|
1295
|
+
/** How many distinct parents render this node as a JSX child. Memoised per request. */
|
|
1296
|
+
function renderParents(cg, node, memo) {
|
|
1297
|
+
let parents = memo.get(node.id);
|
|
1298
|
+
if (parents === undefined) {
|
|
1299
|
+
const incoming = cg.getIncomingEdgesTo([node.id], ['calls']);
|
|
1300
|
+
const sources = new Set();
|
|
1301
|
+
for (const e of incoming) {
|
|
1302
|
+
if (e.metadata?.synthesizedBy === 'jsx-render')
|
|
1303
|
+
sources.add(e.source);
|
|
1304
|
+
}
|
|
1305
|
+
parents = sources.size;
|
|
1306
|
+
memo.set(node.id, parents);
|
|
1307
|
+
}
|
|
1308
|
+
return parents;
|
|
1309
|
+
}
|
|
1310
|
+
/** A component rendered by several distinct parents is chrome. */
|
|
1311
|
+
function isSharedChrome(cg, component, memo) {
|
|
1312
|
+
return renderParents(cg, component, memo) >= SHARED_CHROME_MIN;
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* What kind of project the picture is of, by what its routes are: endpoints
|
|
1316
|
+
* (`POST /users`) make an API; screens with navigation between them make an
|
|
1317
|
+
* app; both — pages and the endpoints behind them — make a web app.
|
|
1318
|
+
*/
|
|
1319
|
+
function projectKind(routes, navigates) {
|
|
1320
|
+
let endpoints = 0;
|
|
1321
|
+
let pages = 0;
|
|
1322
|
+
for (const r of routes) {
|
|
1323
|
+
if ((0, routes_1.splitRouteName)(r.name).method !== null)
|
|
1324
|
+
endpoints++;
|
|
1325
|
+
else if (r.name.startsWith('/')) {
|
|
1326
|
+
pages++;
|
|
1327
|
+
// A Next page is a web page whatever else the index holds.
|
|
1328
|
+
if ((0, nextjs_1.nextRouteForFile)(r.filePath)?.kind === 'page')
|
|
1329
|
+
return 'web';
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
if (endpoints === 0)
|
|
1333
|
+
return 'app';
|
|
1334
|
+
return navigates > 0 || pages > 0 ? 'web' : 'api';
|
|
1335
|
+
}
|
|
1336
|
+
function basename(p) {
|
|
1337
|
+
const s = posix(p);
|
|
1338
|
+
return s.slice(s.lastIndexOf('/') + 1);
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Function-as-value references — and, for a value, calls — made at a file's
|
|
1342
|
+
* top level within a node's lines: what `const Memoized = memo(CaptureComponent)`
|
|
1343
|
+
* leaves behind (the reference belongs to the file scope, the wrapper node
|
|
1344
|
+
* spans the line), and what `const worker = new Worker('q', async (job) =>
|
|
1345
|
+
* { … })` leaves behind (the handler's calls belong to the file scope, the
|
|
1346
|
+
* constant spans them).
|
|
1347
|
+
*/
|
|
1348
|
+
function fileScopeEdgesWithin(cg, node, memo, calls) {
|
|
1349
|
+
let refs = memo.get(node.filePath);
|
|
1350
|
+
if (refs === undefined) {
|
|
1351
|
+
const file = cg.getNodesInFile(node.filePath).find((n) => n.kind === 'file');
|
|
1352
|
+
refs = file
|
|
1353
|
+
? cg
|
|
1354
|
+
.getOutgoingEdgesFrom([file.id], ['references', 'calls', 'navigates'])
|
|
1355
|
+
.filter((e) => e.kind !== 'references' || e.metadata?.fnRef === true)
|
|
1356
|
+
: [];
|
|
1357
|
+
memo.set(node.filePath, refs);
|
|
1358
|
+
}
|
|
1359
|
+
return refs.filter((e) => (calls || e.kind === 'references') && typeof e.line === 'number' && e.line >= node.startLine && e.line <= node.endLine);
|
|
1360
|
+
}
|
|
1361
|
+
/** The file scope's unresolved calls within a value's lines — what a wrapped handler's arrow body leaves on the file node. */
|
|
1362
|
+
function fileScopeRefsWithin(cg, node, memo) {
|
|
1363
|
+
let refs = memo.get(node.filePath);
|
|
1364
|
+
if (refs === undefined) {
|
|
1365
|
+
const file = cg.getNodesInFile(node.filePath).find((n) => n.kind === 'file');
|
|
1366
|
+
try {
|
|
1367
|
+
refs = file ? cg.getUnresolvedReferencesFrom(file.id) : [];
|
|
1368
|
+
}
|
|
1369
|
+
catch {
|
|
1370
|
+
refs = [];
|
|
1371
|
+
}
|
|
1372
|
+
memo.set(node.filePath, refs);
|
|
1373
|
+
}
|
|
1374
|
+
return refs.filter((r) => r.line >= node.startLine && r.line <= node.endLine);
|
|
1375
|
+
}
|
|
1376
|
+
/** `push /capture`, `renders <Button>`, `via rn-event-channel`, `calls`. */
|
|
1377
|
+
function siteText(edge, meta, target) {
|
|
1378
|
+
if (edge.kind === 'navigates') {
|
|
1379
|
+
const method = edge.provenance === 'heuristic' ? 'returns' : typeof meta.navMethod === 'string' ? meta.navMethod : 'push';
|
|
1380
|
+
return `${method} ${typeof meta.href === 'string' ? meta.href : target.name}`;
|
|
1381
|
+
}
|
|
1382
|
+
if (meta.synthesizedBy === 'jsx-render')
|
|
1383
|
+
return `renders <${target.name}>`;
|
|
1384
|
+
if (edge.kind === 'references')
|
|
1385
|
+
return `passes ${target.name}`;
|
|
1386
|
+
if (edge.kind === 'contains')
|
|
1387
|
+
return `defines ${target.name}`;
|
|
1388
|
+
if (edge.kind === 'instantiates')
|
|
1389
|
+
return `new ${target.name}`;
|
|
1390
|
+
if (meta.bridge === 'react-native')
|
|
1391
|
+
return `bridge ${typeof meta.module === 'string' ? meta.module + '.' : ''}${target.name}`;
|
|
1392
|
+
if (meta.channel === 'http')
|
|
1393
|
+
return `${typeof meta.method === 'string' ? meta.method : 'GET'} ${typeof meta.href === 'string' ? meta.href : target.name}`;
|
|
1394
|
+
if (typeof meta.synthesizedBy === 'string')
|
|
1395
|
+
return `via ${meta.synthesizedBy}`;
|
|
1396
|
+
return `calls ${target.name}`;
|
|
1397
|
+
}
|
|
1398
|
+
/** The words on a hop that was not a plain call — the Flow strip's connector label, in short. */
|
|
1399
|
+
function hopLabel(meta, synthesized) {
|
|
1400
|
+
const parts = [];
|
|
1401
|
+
if (typeof meta.synthesizedBy === 'string')
|
|
1402
|
+
parts.push(`via ${meta.synthesizedBy}`);
|
|
1403
|
+
else if (synthesized)
|
|
1404
|
+
parts.push('inferred');
|
|
1405
|
+
if (meta.channel === 'server-action')
|
|
1406
|
+
parts.push('server action');
|
|
1407
|
+
if (meta.channel === 'http' && typeof meta.method === 'string')
|
|
1408
|
+
parts.push(`${meta.method} ${typeof meta.href === 'string' ? meta.href : ''}`.trim());
|
|
1409
|
+
if (meta.tier === 'client→server')
|
|
1410
|
+
parts.push('to the server');
|
|
1411
|
+
else if (meta.tier === 'server→client')
|
|
1412
|
+
parts.push('from the server');
|
|
1413
|
+
if (meta.resolvedBy === 'receiver-type')
|
|
1414
|
+
parts.push('by the receiver’s declared type');
|
|
1415
|
+
if (typeof meta.event === 'string')
|
|
1416
|
+
parts.push(`${meta.channel === 'queue' ? 'job' : meta.channel === 'socket' ? 'message' : 'event'} ${meta.event}`);
|
|
1417
|
+
if (typeof meta.queue === 'string')
|
|
1418
|
+
parts.push(`queue ${meta.queue}`);
|
|
1419
|
+
if (meta.bridge === 'react-native')
|
|
1420
|
+
parts.push(`React Native bridge${typeof meta.module === 'string' ? ` · ${meta.module}` : ''}`);
|
|
1421
|
+
if (typeof meta.registeredAt === 'string')
|
|
1422
|
+
parts.push(`registered at ${meta.registeredAt}`);
|
|
1423
|
+
return parts.join(' · ');
|
|
1424
|
+
}
|
|
1425
|
+
/** Source order of two hops: a hop written inside the other's call runs first; else by position; another file sorts after. */
|
|
1426
|
+
function hopCompare(a, b) {
|
|
1427
|
+
if (!a || !b)
|
|
1428
|
+
return a ? -1 : b ? 1 : 0;
|
|
1429
|
+
if (a.file !== b.file)
|
|
1430
|
+
return a.file.localeCompare(b.file);
|
|
1431
|
+
if (hopInside(a, b))
|
|
1432
|
+
return -1;
|
|
1433
|
+
if (hopInside(b, a))
|
|
1434
|
+
return 1;
|
|
1435
|
+
return a.line - b.line || a.column - b.column;
|
|
1436
|
+
}
|
|
1437
|
+
/** `x` starts strictly after `y` starts and before `y` ends. */
|
|
1438
|
+
function hopInside(x, y) {
|
|
1439
|
+
const afterStart = x.line > y.line || (x.line === y.line && x.column > y.column);
|
|
1440
|
+
const beforeEnd = x.line < y.end.line || (x.line === y.end.line && x.column < y.end.column);
|
|
1441
|
+
return afterStart && beforeEnd;
|
|
1442
|
+
}
|
|
1443
|
+
function posix(p) {
|
|
1444
|
+
return p.replace(/\\/g, '/');
|
|
1445
|
+
}
|
|
1446
|
+
//# sourceMappingURL=steps.js.map
|