@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.2
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/bin/codegraph +5 -0
- package/lib/dist/.test-build-engine.json +1 -0
- package/lib/dist/.test-build-viewer.json +1 -0
- package/lib/dist/bin/codegraph.d.ts +1 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +605 -291
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +7 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +39 -27
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/bin/viewer-gate.d.ts +17 -0
- package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
- package/lib/dist/bin/viewer-gate.js +31 -0
- package/lib/dist/bin/viewer-gate.js.map +1 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +43 -2
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +21 -2
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +86 -31
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +40 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +454 -10
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1080 -41
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +11 -1
- package/lib/dist/db/sqlite-adapter.d.ts +2 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +56 -7
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts +12 -0
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
- package/lib/dist/db/synthesis-stage.js +89 -0
- package/lib/dist/db/synthesis-stage.js.map +1 -0
- package/lib/dist/db/wal-valve.d.ts +32 -12
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +65 -22
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.d.ts +53 -0
- package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
- package/lib/dist/db/wsl-shared-index.js +121 -0
- package/lib/dist/db/wsl-shared-index.js.map +1 -0
- package/lib/dist/directory.d.ts +131 -2
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +299 -23
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/errors.d.ts +14 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +16 -1
- package/lib/dist/errors.js.map +1 -1
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/astro-extractor.js +7 -35
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +77 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +302 -71
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.d.ts +23 -0
- package/lib/dist/extraction/commonjs-requires.d.ts.map +1 -0
- package/lib/dist/extraction/commonjs-requires.js +68 -0
- package/lib/dist/extraction/commonjs-requires.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/dfm-extractor.js +14 -10
- package/lib/dist/extraction/dfm-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts +6 -4
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +35 -14
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +9 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +42 -2
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +40 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +171 -1
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +132 -19
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +825 -195
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +6 -0
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +73 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +412 -16
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +14 -5
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +16 -3
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +1 -1
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts +4 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +237 -36
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
- package/lib/dist/extraction/languages/lua.js +4 -1
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/python.d.ts.map +1 -1
- package/lib/dist/extraction/languages/python.js +71 -0
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +3 -0
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
- package/lib/dist/extraction/languages/scala.js +18 -3
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/languages/swift.d.ts +15 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
- package/lib/dist/extraction/languages/swift.js +50 -0
- package/lib/dist/extraction/languages/swift.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts +7 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +30 -2
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +98 -22
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +6 -4
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-budget.d.ts +16 -0
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -0
- package/lib/dist/extraction/parse-budget.js +24 -0
- package/lib/dist/extraction/parse-budget.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +12 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +51 -3
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +3 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sfc-script.d.ts +43 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
- package/lib/dist/extraction/sfc-script.js +135 -0
- package/lib/dist/extraction/sfc-script.js.map +1 -0
- package/lib/dist/extraction/store-worker.js +5 -0
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.d.ts +10 -2
- package/lib/dist/extraction/store-writer.d.ts.map +1 -1
- package/lib/dist/extraction/store-writer.js +12 -4
- package/lib/dist/extraction/store-writer.js.map +1 -1
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/svelte-extractor.js +7 -37
- package/lib/dist/extraction/svelte-extractor.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/lib/dist/extraction/syntax-tokens.js +382 -0
- package/lib/dist/extraction/syntax-tokens.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +104 -17
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +943 -88
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +7 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +73 -35
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.d.ts +28 -0
- package/lib/dist/extraction/vue-options-api.d.ts.map +1 -0
- package/lib/dist/extraction/vue-options-api.js +196 -0
- package/lib/dist/extraction/vue-options-api.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/lib/dist/file-limits.d.ts +40 -0
- package/lib/dist/file-limits.d.ts.map +1 -0
- package/lib/dist/file-limits.js +147 -0
- package/lib/dist/file-limits.js.map +1 -0
- package/lib/dist/graph/branch-guards.d.ts +265 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -0
- package/lib/dist/graph/branch-guards.js +2326 -0
- package/lib/dist/graph/branch-guards.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +251 -0
- package/lib/dist/graph/dead-code.d.ts.map +1 -0
- package/lib/dist/graph/dead-code.js +776 -0
- package/lib/dist/graph/dead-code.js.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.js +283 -0
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/lib/dist/graph/index.d.ts +4 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +16 -1
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/lib/dist/graph/named-symbol-flow.js +559 -0
- package/lib/dist/graph/named-symbol-flow.js.map +1 -0
- package/lib/dist/graph/symbol-lookup.d.ts +83 -0
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
- package/lib/dist/graph/symbol-lookup.js +181 -0
- package/lib/dist/graph/symbol-lookup.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +9 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +61 -35
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.d.ts +155 -0
- package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/lib/dist/graph/type-hierarchy.js +382 -0
- package/lib/dist/graph/type-hierarchy.js.map +1 -0
- package/lib/dist/index.d.ts +256 -11
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +402 -34
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +3 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +14 -2
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +3 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +35 -7
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +2 -1
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +14 -4
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.js +7 -1
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
- package/lib/dist/installer/targets/opencode.d.ts +16 -5
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +73 -22
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +14 -3
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +39 -11
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +7 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/answer-freshness.d.ts +10 -0
- package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +68 -0
- package/lib/dist/mcp/answer-freshness.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +16 -0
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +20 -5
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +11 -4
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +132 -36
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +17 -7
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +116 -24
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +46 -42
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +30 -9
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +158 -66
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +5 -2
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
- package/lib/dist/mcp/explore-dedup.js +8 -5
- package/lib/dist/mcp/explore-dedup.js.map +1 -1
- package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
- package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +36 -0
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
- package/lib/dist/mcp/index-freshness.d.ts +13 -0
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness.js +117 -0
- package/lib/dist/mcp/index-freshness.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +3 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +95 -11
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +11 -2
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
- package/lib/dist/mcp/project-lifecycle.js +182 -0
- package/lib/dist/mcp/project-lifecycle.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +9 -2
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +201 -32
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +18 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +67 -11
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +2 -2
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +6 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +3 -1
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +10 -2
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +306 -36
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2395 -966
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +61 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
- package/lib/dist/mcp/writer-lock.js +260 -0
- package/lib/dist/mcp/writer-lock.js.map +1 -0
- package/lib/dist/resolution/alias-binding.d.ts +56 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
- package/lib/dist/resolution/alias-binding.js +143 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts +49 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.js +359 -0
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +460 -144
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-constructor.js +123 -0
- package/lib/dist/resolution/cpp-constructor.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.js +392 -0
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts +142 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.js +1126 -0
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +32 -6
- package/lib/dist/resolution/frameworks/astro.js.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +186 -24
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +10 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +95 -1
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +195 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-router.js +847 -0
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +339 -45
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +13 -11
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +11 -28
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +8 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +39 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +88 -68
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +369 -26
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts +35 -0
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js +45 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +288 -55
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.js +329 -0
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.js +139 -0
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.js +78 -0
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts +20 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.js +45 -0
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +3 -1
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +279 -26
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +153 -14
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +47 -0
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-router.js +201 -0
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +13 -2
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +542 -144
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +177 -17
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/rust.js +24 -22
- package/lib/dist/resolution/frameworks/rust.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +14 -6
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +253 -124
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts +98 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.js +500 -0
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -2
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +45 -11
- package/lib/dist/resolution/frameworks/vue.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +66 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +643 -61
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +124 -25
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +769 -152
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +13 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
- package/lib/dist/resolution/js-builtins.js +48 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +101 -22
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +8267 -287
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/next-router-synthesizer.js +113 -0
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts +35 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.js +197 -0
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/resolver-pool.d.ts +22 -1
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +35 -5
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/resolver-worker.js +3 -0
- package/lib/dist/resolution/resolver-worker.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +6 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +58 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts +68 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.js +454 -0
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
- package/lib/dist/resolution/synth-utils.d.ts +26 -0
- package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
- package/lib/dist/resolution/synth-utils.js +75 -0
- package/lib/dist/resolution/synth-utils.js.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts +54 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.js +1294 -0
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
- package/lib/dist/resolution/type-parameters.d.ts +11 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/type-parameters.js +287 -0
- package/lib/dist/resolution/type-parameters.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +105 -2
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +64 -0
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/lib/dist/search/query-paths.d.ts +50 -1
- package/lib/dist/search/query-paths.d.ts.map +1 -1
- package/lib/dist/search/query-paths.js +227 -12
- package/lib/dist/search/query-paths.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +15 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +35 -7
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watch-policy.d.ts +14 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -1
- package/lib/dist/sync/watch-policy.js +19 -0
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +52 -35
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +236 -100
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +22 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +54 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts +4 -2
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +159 -66
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +1 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +1 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/deadcode.js +136 -0
- package/lib/dist/ui-server/api/deadcode.js.map +1 -0
- package/lib/dist/ui-server/api/effects.d.ts +94 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
- package/lib/dist/ui-server/api/effects.js +527 -0
- package/lib/dist/ui-server/api/effects.js.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts +92 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.js +364 -0
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
- package/lib/dist/ui-server/api/events.d.ts +183 -0
- package/lib/dist/ui-server/api/events.d.ts.map +1 -0
- package/lib/dist/ui-server/api/events.js +430 -0
- package/lib/dist/ui-server/api/events.js.map +1 -0
- package/lib/dist/ui-server/api/file.d.ts +66 -0
- package/lib/dist/ui-server/api/file.d.ts.map +1 -0
- package/lib/dist/ui-server/api/file.js +235 -0
- package/lib/dist/ui-server/api/file.js.map +1 -0
- package/lib/dist/ui-server/api/filecode.d.ts +126 -0
- package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/filecode.js +205 -0
- package/lib/dist/ui-server/api/filecode.js.map +1 -0
- package/lib/dist/ui-server/api/flow.d.ts +226 -0
- package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
- package/lib/dist/ui-server/api/flow.js +612 -0
- package/lib/dist/ui-server/api/flow.js.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.js +92 -0
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
- package/lib/dist/ui-server/api/index.d.ts +90 -0
- package/lib/dist/ui-server/api/index.d.ts.map +1 -0
- package/lib/dist/ui-server/api/index.js +332 -0
- package/lib/dist/ui-server/api/index.js.map +1 -0
- package/lib/dist/ui-server/api/map.d.ts +273 -0
- package/lib/dist/ui-server/api/map.d.ts.map +1 -0
- package/lib/dist/ui-server/api/map.js +781 -0
- package/lib/dist/ui-server/api/map.js.map +1 -0
- package/lib/dist/ui-server/api/node.d.ts +81 -0
- package/lib/dist/ui-server/api/node.d.ts.map +1 -0
- package/lib/dist/ui-server/api/node.js +394 -0
- package/lib/dist/ui-server/api/node.js.map +1 -0
- package/lib/dist/ui-server/api/nodes.d.ts +25 -0
- package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/nodes.js +45 -0
- package/lib/dist/ui-server/api/nodes.js.map +1 -0
- package/lib/dist/ui-server/api/program.d.ts +139 -0
- package/lib/dist/ui-server/api/program.d.ts.map +1 -0
- package/lib/dist/ui-server/api/program.js +315 -0
- package/lib/dist/ui-server/api/program.js.map +1 -0
- package/lib/dist/ui-server/api/respond.d.ts +76 -0
- package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
- package/lib/dist/ui-server/api/respond.js +186 -0
- package/lib/dist/ui-server/api/respond.js.map +1 -0
- package/lib/dist/ui-server/api/route-roots.d.ts +45 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/lib/dist/ui-server/api/route-roots.js +117 -0
- package/lib/dist/ui-server/api/route-roots.js.map +1 -0
- package/lib/dist/ui-server/api/routes.d.ts +61 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/routes.js +164 -0
- package/lib/dist/ui-server/api/routes.js.map +1 -0
- package/lib/dist/ui-server/api/screens.d.ts +117 -0
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
- package/lib/dist/ui-server/api/screens.js +626 -0
- package/lib/dist/ui-server/api/screens.js.map +1 -0
- package/lib/dist/ui-server/api/search.d.ts +29 -0
- package/lib/dist/ui-server/api/search.d.ts.map +1 -0
- package/lib/dist/ui-server/api/search.js +232 -0
- package/lib/dist/ui-server/api/search.js.map +1 -0
- package/lib/dist/ui-server/api/session.d.ts +52 -0
- package/lib/dist/ui-server/api/session.d.ts.map +1 -0
- package/lib/dist/ui-server/api/session.js +196 -0
- package/lib/dist/ui-server/api/session.js.map +1 -0
- package/lib/dist/ui-server/api/source.d.ts +200 -0
- package/lib/dist/ui-server/api/source.d.ts.map +1 -0
- package/lib/dist/ui-server/api/source.js +422 -0
- package/lib/dist/ui-server/api/source.js.map +1 -0
- package/lib/dist/ui-server/api/stats.d.ts +27 -0
- package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
- package/lib/dist/ui-server/api/stats.js +164 -0
- package/lib/dist/ui-server/api/stats.js.map +1 -0
- package/lib/dist/ui-server/api/steps.d.ts +274 -0
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
- package/lib/dist/ui-server/api/steps.js +1554 -0
- package/lib/dist/ui-server/api/steps.js.map +1 -0
- package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trail-store.js +323 -0
- package/lib/dist/ui-server/api/trail-store.js.map +1 -0
- package/lib/dist/ui-server/api/trails.d.ts +163 -0
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trails.js +370 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -0
- package/lib/dist/ui-server/api/when.d.ts +133 -0
- package/lib/dist/ui-server/api/when.d.ts.map +1 -0
- package/lib/dist/ui-server/api/when.js +275 -0
- package/lib/dist/ui-server/api/when.js.map +1 -0
- package/lib/dist/ui-server/api/wire.d.ts +179 -0
- package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
- package/lib/dist/ui-server/api/wire.js +231 -0
- package/lib/dist/ui-server/api/wire.js.map +1 -0
- package/lib/dist/ui-server/assets.d.ts +40 -0
- package/lib/dist/ui-server/assets.d.ts.map +1 -0
- package/lib/dist/ui-server/assets.js +110 -0
- package/lib/dist/ui-server/assets.js.map +1 -0
- package/lib/dist/ui-server/constants.d.ts +32 -0
- package/lib/dist/ui-server/constants.d.ts.map +1 -0
- package/lib/dist/ui-server/constants.js +35 -0
- package/lib/dist/ui-server/constants.js.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts +28 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js +139 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts +113 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/index.js +312 -0
- package/lib/dist/ui-server/highlight/index.js.map +1 -0
- package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
- package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/languages.js +50 -0
- package/lib/dist/ui-server/highlight/languages.js.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts +7 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js +20 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
- package/lib/dist/ui-server/index.d.ts +92 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -0
- package/lib/dist/ui-server/index.js +399 -0
- package/lib/dist/ui-server/index.js.map +1 -0
- package/lib/dist/ui-server/open-browser.d.ts +31 -0
- package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
- package/lib/dist/ui-server/open-browser.js +79 -0
- package/lib/dist/ui-server/open-browser.js.map +1 -0
- package/lib/dist/ui-server/security.d.ts +127 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -0
- package/lib/dist/ui-server/security.js +332 -0
- package/lib/dist/ui-server/security.js.map +1 -0
- package/lib/dist/ui-server/static.d.ts +45 -0
- package/lib/dist/ui-server/static.d.ts.map +1 -0
- package/lib/dist/ui-server/static.js +165 -0
- package/lib/dist/ui-server/static.js.map +1 -0
- package/lib/dist/upgrade/index.d.ts +43 -5
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +157 -35
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/utils.d.ts +14 -2
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +25 -10
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- package/lib/dist/viewer/assets/index-BSGpxBr9.js +99 -0
- package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
- package/lib/dist/viewer/index.html +16 -0
- package/lib/dist/worker-teardown.d.ts +48 -0
- package/lib/dist/worker-teardown.d.ts.map +1 -0
- package/lib/dist/worker-teardown.js +100 -0
- package/lib/dist/worker-teardown.js.map +1 -0
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +4 -4
- package/lib/node_modules/picomatch/README.md +56 -51
- package/lib/node_modules/picomatch/lib/constants.js +4 -0
- package/lib/node_modules/picomatch/lib/parse.js +341 -1
- package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
- package/lib/node_modules/picomatch/lib/scan.js +30 -18
- package/lib/node_modules/picomatch/package.json +4 -4
- package/lib/package.json +9 -2
- package/package.json +1 -1
|
@@ -45,21 +45,45 @@ exports.ReferenceResolver = void 0;
|
|
|
45
45
|
exports.createResolver = createResolver;
|
|
46
46
|
const fs = __importStar(require("fs"));
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
|
+
const synthesis_stage_1 = require("../db/synthesis-stage");
|
|
49
|
+
const types_1 = require("./types");
|
|
48
50
|
const name_matcher_1 = require("./name-matcher");
|
|
51
|
+
const cpp_macro_visibility_1 = require("./cpp-macro-visibility");
|
|
52
|
+
const cpp_constructor_1 = require("./cpp-constructor");
|
|
53
|
+
const swift_type_visibility_1 = require("./swift-type-visibility");
|
|
54
|
+
const type_parameters_1 = require("./type-parameters");
|
|
49
55
|
const import_resolver_1 = require("./import-resolver");
|
|
50
56
|
const resolver_pool_1 = require("./resolver-pool");
|
|
57
|
+
const alias_binding_1 = require("./alias-binding");
|
|
51
58
|
const frameworks_1 = require("./frameworks");
|
|
52
59
|
const callback_synthesizer_1 = require("./callback-synthesizer");
|
|
53
60
|
const cooperative_yield_1 = require("./cooperative-yield");
|
|
61
|
+
const file_limits_1 = require("../file-limits");
|
|
54
62
|
const path_aliases_1 = require("./path-aliases");
|
|
55
63
|
const go_module_1 = require("./go-module");
|
|
56
64
|
const workspace_packages_1 = require("./workspace-packages");
|
|
57
65
|
const errors_1 = require("../errors");
|
|
66
|
+
const utils_1 = require("../utils");
|
|
58
67
|
const lru_cache_1 = require("./lru-cache");
|
|
68
|
+
const js_builtins_1 = require("./js-builtins");
|
|
69
|
+
const module_1 = require("module");
|
|
70
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
71
|
+
const NODE_BUILTINS = new Set(module_1.builtinModules);
|
|
59
72
|
/** Node kinds that can declare supertypes (extends/implements). */
|
|
60
73
|
const SUPERTYPE_BEARING_KINDS = new Set([
|
|
61
74
|
'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
|
|
62
75
|
]);
|
|
76
|
+
/**
|
|
77
|
+
* The only edges resolving a reference reads (getSupertypes' walk). The batch
|
|
78
|
+
* loop commits a batch that made any of these before the next batch fans out;
|
|
79
|
+
* its other edges land while that batch resolves. A resolution strategy that
|
|
80
|
+
* reads another edge kind must be added here.
|
|
81
|
+
*/
|
|
82
|
+
const RESOLUTION_READ_EDGE_KINDS = ['implements', 'extends'];
|
|
83
|
+
// SUPERTYPE_TARGET_KINDS (the kinds an extends/implements edge may TARGET)
|
|
84
|
+
// lives in ./types — the name-matcher needs the same set to restrict its
|
|
85
|
+
// candidate pool before ranking. It is deliberately wider than
|
|
86
|
+
// SUPERTYPE_BEARING_KINDS above, which is about the DECLARING side.
|
|
63
87
|
/**
|
|
64
88
|
* Languages whose chained static-factory/fluent calls defer to the conformance
|
|
65
89
|
* second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
|
|
@@ -92,13 +116,6 @@ function resolveCacheLimit() {
|
|
|
92
116
|
// Re-export types
|
|
93
117
|
__exportStar(require("./types"), exports);
|
|
94
118
|
// Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
|
|
95
|
-
const JS_BUILT_INS = new Set([
|
|
96
|
-
'console', 'window', 'document', 'global', 'process',
|
|
97
|
-
'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
|
|
98
|
-
'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
|
|
99
|
-
'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
|
|
100
|
-
'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
|
|
101
|
-
]);
|
|
102
119
|
const REACT_HOOKS = new Set([
|
|
103
120
|
'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
|
|
104
121
|
'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
|
|
@@ -219,8 +236,9 @@ class ReferenceResolver {
|
|
|
219
236
|
context;
|
|
220
237
|
frameworks = [];
|
|
221
238
|
// Chained static-factory/fluent call refs the first pass couldn't resolve,
|
|
222
|
-
// collected in-memory
|
|
223
|
-
//
|
|
239
|
+
// collected in-memory and left pending in the DB until the post-pass
|
|
240
|
+
// finishes, so a restart can recover the queue (#1577). Drained by
|
|
241
|
+
// resolveChainedCallsViaConformance
|
|
224
242
|
// once implements/extends edges exist, to resolve methods on a supertype the
|
|
225
243
|
// receiver conforms to (#750).
|
|
226
244
|
deferredChainRefs = [];
|
|
@@ -229,6 +247,7 @@ class ReferenceResolver {
|
|
|
229
247
|
// same reason as deferredChainRefs and drained by
|
|
230
248
|
// resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
|
|
231
249
|
deferredThisMemberRefs = [];
|
|
250
|
+
deferredRowIds = new Set();
|
|
232
251
|
// Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
|
|
233
252
|
// `_Imports.razor`, cascading to the project root). Used to disambiguate a
|
|
234
253
|
// markup type ref to the right C# namespace.
|
|
@@ -244,6 +263,12 @@ class ReferenceResolver {
|
|
|
244
263
|
lowerNameCache; // lower(name) → nodes cache
|
|
245
264
|
qualifiedNameCache; // qualified_name → nodes cache
|
|
246
265
|
fileLinesCache; // file → split lines cache
|
|
266
|
+
// id → node for the resolver's own point reads. Every resolved reference
|
|
267
|
+
// re-reads its target a few times (kind gate, language gate, alias
|
|
268
|
+
// following, edge creation) and targets recur ~5× on large repos; the query
|
|
269
|
+
// layer's cache is too small for that working set. Same stable window as the
|
|
270
|
+
// name caches above; absent ids are not cached.
|
|
271
|
+
nodeByIdCache;
|
|
247
272
|
methodMatchCache; // lang\0Type::method → matching method nodes
|
|
248
273
|
// Per-(language, methodName) owner index for getMethodMatches: buckets a
|
|
249
274
|
// method name's candidates by their qualifiedName's last two segments so a
|
|
@@ -280,6 +305,8 @@ class ReferenceResolver {
|
|
|
280
305
|
// resolution pass (same lifetime assumption as nameCache); clearCaches() resets
|
|
281
306
|
// it between passes. Callers must treat the returned array as read-only.
|
|
282
307
|
nodesByKindCache = new Map();
|
|
308
|
+
// Filesystem existence probes behind context.fileExists (paths not in knownFiles).
|
|
309
|
+
fileExistsMemo = new Map();
|
|
283
310
|
knownNames = null; // all known symbol names for fast pre-filtering
|
|
284
311
|
knownFiles = null;
|
|
285
312
|
cachesWarmed = false;
|
|
@@ -287,6 +314,8 @@ class ReferenceResolver {
|
|
|
287
314
|
// `null` = computed and absent. Treated as immutable for the
|
|
288
315
|
// resolver's lifetime; callers re-create the resolver if config changes.
|
|
289
316
|
projectAliases = undefined;
|
|
317
|
+
// Per directory: the aliases of the nearest non-root tsconfig declaring `paths`.
|
|
318
|
+
dirAliases = new Map();
|
|
290
319
|
// go.mod module path. Same lazy/immutable convention as projectAliases.
|
|
291
320
|
goModule = undefined;
|
|
292
321
|
// Monorepo workspace member packages. Same lazy/immutable convention.
|
|
@@ -308,6 +337,7 @@ class ReferenceResolver {
|
|
|
308
337
|
// Split-lines arrays are heavier than content strings; refs arrive
|
|
309
338
|
// file-ordered, so a small cache still hits nearly always.
|
|
310
339
|
this.fileLinesCache = new lru_cache_1.LRUCache(contentLimit);
|
|
340
|
+
this.nodeByIdCache = new lru_cache_1.LRUCache(Math.max(limit * 4, 20_000));
|
|
311
341
|
this.methodMatchCache = new lru_cache_1.LRUCache(limit);
|
|
312
342
|
this.context = this.createContext();
|
|
313
343
|
}
|
|
@@ -386,6 +416,16 @@ class ReferenceResolver {
|
|
|
386
416
|
this.knownNames = names;
|
|
387
417
|
this.cachesWarmed = true;
|
|
388
418
|
}
|
|
419
|
+
/** `queries.getNodeById` through the resolver's own id → node cache. */
|
|
420
|
+
nodeById(id) {
|
|
421
|
+
const cached = this.nodeByIdCache.get(id);
|
|
422
|
+
if (cached !== undefined)
|
|
423
|
+
return cached;
|
|
424
|
+
const node = this.queries.getNodeById(id);
|
|
425
|
+
if (node)
|
|
426
|
+
this.nodeByIdCache.set(id, node);
|
|
427
|
+
return node;
|
|
428
|
+
}
|
|
389
429
|
/**
|
|
390
430
|
* Clear internal caches
|
|
391
431
|
*/
|
|
@@ -398,12 +438,16 @@ class ReferenceResolver {
|
|
|
398
438
|
this.lowerNameCache.clear();
|
|
399
439
|
this.qualifiedNameCache.clear();
|
|
400
440
|
this.fileLinesCache.clear();
|
|
441
|
+
this.nodeByIdCache.clear();
|
|
401
442
|
this.methodMatchCache.clear();
|
|
402
443
|
this.methodOwnerIndexCache.clear();
|
|
403
444
|
this.supertypeMemo.clear();
|
|
404
445
|
this.supertypeGen++;
|
|
405
446
|
this.nodesByKindCache.clear();
|
|
447
|
+
this.fileExistsMemo.clear();
|
|
448
|
+
this.manifestScopes.clear();
|
|
406
449
|
this.knownNames = null;
|
|
450
|
+
this.knownLowerNames = null;
|
|
407
451
|
this.knownFiles = null;
|
|
408
452
|
this.cachesWarmed = false;
|
|
409
453
|
// The import-resolver's and name-matcher's per-context memos assume the
|
|
@@ -411,6 +455,9 @@ class ReferenceResolver {
|
|
|
411
455
|
if (this.context) {
|
|
412
456
|
(0, import_resolver_1.clearImportResolverMemos)(this.context);
|
|
413
457
|
(0, name_matcher_1.clearNameMatcherMemos)(this.context);
|
|
458
|
+
(0, cpp_macro_visibility_1.clearCppMacroVisibility)(this.context);
|
|
459
|
+
(0, swift_type_visibility_1.clearSwiftTypeVisibility)(this.context);
|
|
460
|
+
(0, type_parameters_1.clearTypeParameterMemos)(this.context);
|
|
414
461
|
}
|
|
415
462
|
}
|
|
416
463
|
/** `readFile` through the LRU content cache (null = read failed, also cached). */
|
|
@@ -420,6 +467,14 @@ class ReferenceResolver {
|
|
|
420
467
|
}
|
|
421
468
|
const fullPath = path.join(this.projectRoot, filePath);
|
|
422
469
|
try {
|
|
470
|
+
// Import resolvers may follow package metadata to an archive (`file:*.har`,
|
|
471
|
+
// for example). Reject anything extraction would not accept before UTF-8
|
|
472
|
+
// decoding can multiply a large binary blob into gigabytes of V8 heap.
|
|
473
|
+
const stats = fs.statSync(fullPath);
|
|
474
|
+
if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
|
|
475
|
+
this.fileCache.set(filePath, null);
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
423
478
|
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
424
479
|
this.fileCache.set(filePath, content);
|
|
425
480
|
return content;
|
|
@@ -430,17 +485,52 @@ class ReferenceResolver {
|
|
|
430
485
|
return null;
|
|
431
486
|
}
|
|
432
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* `readFileCached(filePath)?.includes(needle)` for an ASCII needle, searched
|
|
490
|
+
* in the raw bytes: an ASCII byte sequence survives UTF-8 decoding
|
|
491
|
+
* unchanged, and decoding is most of reading a file nobody keeps.
|
|
492
|
+
*/
|
|
493
|
+
fileContains(filePath, needle) {
|
|
494
|
+
if (this.fileCache.has(filePath))
|
|
495
|
+
return this.fileCache.get(filePath)?.includes(needle) ?? false;
|
|
496
|
+
const fullPath = path.join(this.projectRoot, filePath);
|
|
497
|
+
try {
|
|
498
|
+
const stats = fs.statSync(fullPath);
|
|
499
|
+
if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES)
|
|
500
|
+
return false;
|
|
501
|
+
return fs.readFileSync(fullPath).includes(needle);
|
|
502
|
+
}
|
|
503
|
+
catch {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
433
507
|
/**
|
|
434
508
|
* Create the resolution context
|
|
435
509
|
*/
|
|
436
510
|
createContext() {
|
|
437
511
|
return {
|
|
512
|
+
resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context),
|
|
513
|
+
isOutOfRepoImport: (source, fromFile, language) => (0, import_resolver_1.isExternalImport)(source, language, this.context) &&
|
|
514
|
+
(0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context) === null &&
|
|
515
|
+
this.isDeclaredOutsidePackage(source, fromFile),
|
|
438
516
|
getNodesInFile: (filePath) => {
|
|
439
517
|
if (!this.nodeCache.has(filePath)) {
|
|
440
518
|
this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
|
|
441
519
|
}
|
|
442
520
|
return this.nodeCache.get(filePath);
|
|
443
521
|
},
|
|
522
|
+
fileHasExportedNode: (filePath) => {
|
|
523
|
+
const cached = this.nodeCache.get(filePath);
|
|
524
|
+
return cached !== undefined ? cached.some((n) => n.isExported) : this.queries.fileHasExportedNode(filePath);
|
|
525
|
+
},
|
|
526
|
+
getExportedNodesInFile: (filePath) => {
|
|
527
|
+
const cached = this.nodeCache.get(filePath);
|
|
528
|
+
return cached !== undefined ? cached.filter((n) => n.isExported) : this.queries.getExportedNodesByFile(filePath);
|
|
529
|
+
},
|
|
530
|
+
getNodesInFileNamed: (filePath, name) => {
|
|
531
|
+
const cached = this.nodeCache.get(filePath);
|
|
532
|
+
return cached !== undefined ? cached.filter((n) => n.name === name) : this.queries.getNodesByFileAndName(filePath, name);
|
|
533
|
+
},
|
|
444
534
|
getNodesByName: (name) => {
|
|
445
535
|
const cached = this.nameCache.get(name);
|
|
446
536
|
if (cached !== undefined)
|
|
@@ -471,7 +561,7 @@ class ReferenceResolver {
|
|
|
471
561
|
for (const m of candidates) {
|
|
472
562
|
if (m.kind !== 'method')
|
|
473
563
|
continue;
|
|
474
|
-
if (m.language
|
|
564
|
+
if (!(0, name_matcher_1.sameLanguageFamily)(m.language, language))
|
|
475
565
|
continue;
|
|
476
566
|
const qn = m.qualifiedName;
|
|
477
567
|
if (qn === want || qn.endsWith(`::${want}`))
|
|
@@ -498,7 +588,7 @@ class ReferenceResolver {
|
|
|
498
588
|
for (const m of candidates) {
|
|
499
589
|
if (m.kind !== 'method')
|
|
500
590
|
continue;
|
|
501
|
-
if (m.language
|
|
591
|
+
if (!(0, name_matcher_1.sameLanguageFamily)(m.language, language))
|
|
502
592
|
continue;
|
|
503
593
|
const qn = m.qualifiedName;
|
|
504
594
|
const i2 = qn.lastIndexOf('::');
|
|
@@ -548,17 +638,40 @@ class ReferenceResolver {
|
|
|
548
638
|
return true;
|
|
549
639
|
}
|
|
550
640
|
}
|
|
551
|
-
// Fall back to filesystem for files not yet indexed
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
641
|
+
// Fall back to filesystem for files not yet indexed. `path.join` does
|
|
642
|
+
// not clamp, and relative-import resolution hands us paths carrying
|
|
643
|
+
// `../` segments, so the probe has to be contained (#1631): a path
|
|
644
|
+
// outside the root can never be an indexed project file, and the
|
|
645
|
+
// `knownFiles` check above already answered for everything that is.
|
|
646
|
+
// Lexical containment only: this is a per-candidate hot path, and the
|
|
647
|
+
// symlink half of `validatePathWithinRoot` costs two `realpathSync`
|
|
648
|
+
// calls per probe (~70x slower here). It would also be wrong to apply
|
|
649
|
+
// — indexing deliberately follows in-root symlinks whose targets live
|
|
650
|
+
// outside the root (#935), so only the `../` escape is refused.
|
|
651
|
+
// Memoized: import resolution probes the same candidate paths (every
|
|
652
|
+
// extension of a specifier) from every file that imports it, and the
|
|
653
|
+
// tree does not change within a resolution pass (same window as the
|
|
654
|
+
// file-content cache; dropped by clearCaches).
|
|
655
|
+
const probed = this.fileExistsMemo.get(filePath);
|
|
656
|
+
if (probed !== undefined)
|
|
657
|
+
return probed;
|
|
658
|
+
const fullPath = (0, utils_1.lexicalPathWithinRoot)(this.projectRoot, filePath);
|
|
659
|
+
let exists = false;
|
|
660
|
+
if (fullPath !== null) {
|
|
661
|
+
try {
|
|
662
|
+
exists = fs.existsSync(fullPath);
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
(0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
|
|
666
|
+
}
|
|
559
667
|
}
|
|
668
|
+
if (this.fileExistsMemo.size >= 200_000)
|
|
669
|
+
this.fileExistsMemo.clear();
|
|
670
|
+
this.fileExistsMemo.set(filePath, exists);
|
|
671
|
+
return exists;
|
|
560
672
|
},
|
|
561
673
|
readFile: (filePath) => this.readFileCached(filePath),
|
|
674
|
+
fileContains: (filePath, needle) => this.fileContains(filePath, needle),
|
|
562
675
|
getFileLines: (filePath) => {
|
|
563
676
|
const cached = this.fileLinesCache.get(filePath);
|
|
564
677
|
if (cached !== undefined)
|
|
@@ -599,7 +712,7 @@ class ReferenceResolver {
|
|
|
599
712
|
return result;
|
|
600
713
|
},
|
|
601
714
|
getNodeById: (id) => {
|
|
602
|
-
return this.
|
|
715
|
+
return this.nodeById(id);
|
|
603
716
|
},
|
|
604
717
|
getSupertypes: (typeName, language) => {
|
|
605
718
|
// Union the `implements`/`extends` targets of every same-named type node.
|
|
@@ -616,7 +729,9 @@ class ReferenceResolver {
|
|
|
616
729
|
return hit.supers;
|
|
617
730
|
const typeNodes = this.context
|
|
618
731
|
.getNodesByName(typeName)
|
|
619
|
-
|
|
732
|
+
// Scala singletons can inherit members even though they cannot be parents.
|
|
733
|
+
.filter((n) => n.language === language && (SUPERTYPE_BEARING_KINDS.has(n.kind) ||
|
|
734
|
+
(n.language === 'scala' && n.kind === 'module')));
|
|
620
735
|
let supers;
|
|
621
736
|
if (typeNodes.length === 0) {
|
|
622
737
|
supers = [];
|
|
@@ -624,11 +739,20 @@ class ReferenceResolver {
|
|
|
624
739
|
else {
|
|
625
740
|
const supertypes = new Set();
|
|
626
741
|
for (const tn of typeNodes) {
|
|
627
|
-
for (const edge of this.queries.getOutgoingEdges(tn.id,
|
|
628
|
-
const target = this.
|
|
742
|
+
for (const edge of this.queries.getOutgoingEdges(tn.id, RESOLUTION_READ_EDGE_KINDS)) {
|
|
743
|
+
const target = this.nodeById(edge.target);
|
|
629
744
|
if (target?.name && target.name !== typeName)
|
|
630
745
|
supertypes.add(target.name);
|
|
631
746
|
}
|
|
747
|
+
// A Swift conformance to a type the project only extends (SwiftUI's
|
|
748
|
+
// `View`) resolves to nothing — the extension is not the type — yet
|
|
749
|
+
// the members its extensions add are still the conformer's.
|
|
750
|
+
if (language === 'swift') {
|
|
751
|
+
for (const name of (0, swift_type_visibility_1.swiftExtendedConformances)(tn, this.context)) {
|
|
752
|
+
if (name !== typeName)
|
|
753
|
+
supertypes.add(name);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
632
756
|
}
|
|
633
757
|
supers = [...supertypes];
|
|
634
758
|
}
|
|
@@ -655,6 +779,31 @@ class ReferenceResolver {
|
|
|
655
779
|
}
|
|
656
780
|
return this.projectAliases;
|
|
657
781
|
},
|
|
782
|
+
getNearestAliases: (fromFile) => {
|
|
783
|
+
let dir = path.posix.dirname(fromFile.replace(/\\/g, '/'));
|
|
784
|
+
const walked = [];
|
|
785
|
+
let found = null;
|
|
786
|
+
while (dir && dir !== '.' && dir !== '/') {
|
|
787
|
+
const hit = this.dirAliases.get(dir);
|
|
788
|
+
if (hit !== undefined) {
|
|
789
|
+
found = hit;
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
walked.push(dir);
|
|
793
|
+
const abs = path.join(this.projectRoot, dir);
|
|
794
|
+
if (['tsconfig.json', 'jsconfig.json'].some((name) => fs.existsSync(path.join(abs, name)))) {
|
|
795
|
+
const aliases = (0, path_aliases_1.loadProjectAliases)(abs);
|
|
796
|
+
if (aliases) {
|
|
797
|
+
found = aliases;
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
dir = path.posix.dirname(dir);
|
|
802
|
+
}
|
|
803
|
+
for (const d of walked)
|
|
804
|
+
this.dirAliases.set(d, found);
|
|
805
|
+
return found;
|
|
806
|
+
},
|
|
658
807
|
getGoModule: () => {
|
|
659
808
|
if (this.goModule === undefined) {
|
|
660
809
|
this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
|
|
@@ -699,6 +848,7 @@ class ReferenceResolver {
|
|
|
699
848
|
resolveAll(unresolvedRefs, onProgress) {
|
|
700
849
|
// Pre-load all nodes into memory for fast lookups
|
|
701
850
|
this.warmCaches();
|
|
851
|
+
this.advanceSupertypeGeneration();
|
|
702
852
|
const resolved = [];
|
|
703
853
|
const unresolved = [];
|
|
704
854
|
const byMethod = {};
|
|
@@ -749,6 +899,22 @@ class ReferenceResolver {
|
|
|
749
899
|
},
|
|
750
900
|
};
|
|
751
901
|
}
|
|
902
|
+
/** Lowercased `knownNames`, built the first time a case-insensitive language asks. */
|
|
903
|
+
knownLowerNames = null;
|
|
904
|
+
/** `hasAnyPossibleMatch` for a language whose names ignore case: the name, or any `.`/`::`/`->` part of it. */
|
|
905
|
+
hasAnyPossibleMatchIgnoringCase(name) {
|
|
906
|
+
if (!this.knownNames)
|
|
907
|
+
return true;
|
|
908
|
+
if (!this.knownLowerNames || this.knownLowerNames.size === 0) {
|
|
909
|
+
this.knownLowerNames = new Set();
|
|
910
|
+
for (const known of this.knownNames)
|
|
911
|
+
this.knownLowerNames.add(known.toLowerCase());
|
|
912
|
+
}
|
|
913
|
+
const lower = name.toLowerCase();
|
|
914
|
+
if (this.knownLowerNames.has(lower))
|
|
915
|
+
return true;
|
|
916
|
+
return lower.split(/::|->|\./).some((part) => part.length > 0 && this.knownLowerNames.has(part));
|
|
917
|
+
}
|
|
752
918
|
/**
|
|
753
919
|
* Check if a reference name has any possible match in the codebase.
|
|
754
920
|
* Uses the pre-built knownNames set to skip expensive resolution
|
|
@@ -844,9 +1010,49 @@ class ReferenceResolver {
|
|
|
844
1010
|
return false;
|
|
845
1011
|
}
|
|
846
1012
|
/**
|
|
847
|
-
* Resolve a single reference
|
|
1013
|
+
* Resolve a single reference.
|
|
1014
|
+
*
|
|
1015
|
+
* Thin decorator over `resolveOneInner` so every strategy — framework,
|
|
1016
|
+
* import, name-match, chain, CFML component path — passes through the
|
|
1017
|
+
* inheritance target-kind gate at ONE seam. Filtering inside the
|
|
1018
|
+
* name-matcher would have covered `matchByExactName` only.
|
|
1019
|
+
* Calls that land on an alias binding then forward once to the callable
|
|
1020
|
+
* the alias names (see ./alias-binding), regardless of the strategy.
|
|
848
1021
|
*/
|
|
849
1022
|
resolveOne(ref) {
|
|
1023
|
+
// A C/C++ "call" whose name is a function-like macro visible in this
|
|
1024
|
+
// translation unit is a macro expansion, not a call — it must never bind
|
|
1025
|
+
// to a same-named function in another file (#1838).
|
|
1026
|
+
if ((0, cpp_macro_visibility_1.isVisibleCppMacro)(ref, this.context))
|
|
1027
|
+
return null;
|
|
1028
|
+
// A Swift type reference never lands on an `extension X {}` node, nor on a
|
|
1029
|
+
// nested type it cannot name bare (see ./swift-type-visibility).
|
|
1030
|
+
// A name a declaration around the reference declares as a type parameter
|
|
1031
|
+
// (`def f[A]`, `class Foo<T>`) is that parameter (see ./type-parameters).
|
|
1032
|
+
const candidate = (0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context);
|
|
1033
|
+
const scoped = this.gateRustScope(candidate, ref);
|
|
1034
|
+
const resolved = this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref);
|
|
1035
|
+
if (!resolved || ref.referenceKind !== 'calls')
|
|
1036
|
+
return resolved;
|
|
1037
|
+
const target = this.nodeById(resolved.targetNodeId);
|
|
1038
|
+
if (!target)
|
|
1039
|
+
return resolved;
|
|
1040
|
+
const dot = ref.referenceName.lastIndexOf('.');
|
|
1041
|
+
const memberName = dot >= 0 ? ref.referenceName.slice(dot + 1) : null;
|
|
1042
|
+
const forwarded = (0, alias_binding_1.resolveAliasBinding)(target, memberName, this.context);
|
|
1043
|
+
if (!forwarded || forwarded.id === resolved.targetNodeId)
|
|
1044
|
+
return resolved;
|
|
1045
|
+
return this.gateLanguage({
|
|
1046
|
+
...resolved,
|
|
1047
|
+
targetNodeId: forwarded.id,
|
|
1048
|
+
confidence: Math.min(resolved.confidence, 0.85),
|
|
1049
|
+
}, ref);
|
|
1050
|
+
}
|
|
1051
|
+
resolveOneInner(ref) {
|
|
1052
|
+
// A local C++ object construction (`T obj(args)`, ref `ns::T::T/1`)
|
|
1053
|
+
// resolves ONLY to a constructor of the lexically nearest `T` (#1839).
|
|
1054
|
+
if ((0, cpp_constructor_1.isCppConstructorRef)(ref))
|
|
1055
|
+
return (0, cpp_constructor_1.matchCppConstructor)(ref, this.context);
|
|
850
1056
|
// Skip built-in/external references
|
|
851
1057
|
if (this.isBuiltInOrExternal(ref)) {
|
|
852
1058
|
return null;
|
|
@@ -865,6 +1071,13 @@ class ReferenceResolver {
|
|
|
865
1071
|
(ref.referenceName.includes('.') || ref.referenceName.includes('/'))) {
|
|
866
1072
|
return this.resolveCfmlComponentPath(ref);
|
|
867
1073
|
}
|
|
1074
|
+
// A PHP class written with a namespace in it — `new Alias\X()` through a
|
|
1075
|
+
// `use Ns as Alias;` namespace alias, `extends Sub\Base`, `\Ns\X::make()`
|
|
1076
|
+
// (#2256). The pre-filter below would drop most of these before any import
|
|
1077
|
+
// strategy ran, and PHP gives each one exactly one meaning; resolve it first.
|
|
1078
|
+
const phpQualified = (0, import_resolver_1.resolvePhpQualifiedClassRef)(ref, this.context);
|
|
1079
|
+
if (phpQualified !== undefined)
|
|
1080
|
+
return this.gateLanguage(phpQualified, ref);
|
|
868
1081
|
// Fast pre-filter: skip if no symbol with this name exists anywhere
|
|
869
1082
|
// AND the name doesn't match a local import. The import escape is
|
|
870
1083
|
// necessary because re-export rename chains (`import { login }
|
|
@@ -874,8 +1087,9 @@ class ReferenceResolver {
|
|
|
874
1087
|
// ArkTS chained-attribute refs carry a leading dot (`.titleStyle`) that
|
|
875
1088
|
// routes them to the decorator-gated matcher; the symbol itself is
|
|
876
1089
|
// indexed under the bare name, so the existence check strips the dot.
|
|
877
|
-
// Nix static path imports (`import ./x.nix`)
|
|
878
|
-
//
|
|
1090
|
+
// Nix static path imports (`import ./x.nix`) and JS/TS module paths
|
|
1091
|
+
// (`require('./x')`) name a FILE, not a symbol — they bypass the
|
|
1092
|
+
// symbol-existence check and resolve via resolveViaImport.
|
|
879
1093
|
let existenceName = ref.language === 'arkts' && ref.referenceName.startsWith('.')
|
|
880
1094
|
? ref.referenceName.slice(1)
|
|
881
1095
|
: ref.referenceName;
|
|
@@ -885,13 +1099,17 @@ class ReferenceResolver {
|
|
|
885
1099
|
existenceName = existenceName.replace(/\/\d{1,3}$/, '');
|
|
886
1100
|
const tPre = this.profileStages ? process.hrtime.bigint() : 0n;
|
|
887
1101
|
const preFilterPass = (0, import_resolver_1.isNixPathImportRef)(ref) ||
|
|
1102
|
+
(0, import_resolver_1.isJsPathImportRef)(ref) ||
|
|
888
1103
|
this.hasAnyPossibleMatch(existenceName) ||
|
|
1104
|
+
// PHP, Pascal, CFML, COBOL and VB.NET names ignore case: `formatprice()`
|
|
1105
|
+
// calls `FormatPrice`, which the exact-name set never lists.
|
|
1106
|
+
(name_matcher_1.CASE_INSENSITIVE_LANGUAGES.has(ref.language) && this.hasAnyPossibleMatchIgnoringCase(existenceName)) ||
|
|
889
1107
|
this.matchesAnyImport(ref) ||
|
|
890
1108
|
this.frameworks.some((f) => f.claimsReference?.(ref.referenceName));
|
|
891
1109
|
if (this.profileStages)
|
|
892
1110
|
this.stageAdd('preFilter', ref, preFilterPass, tPre);
|
|
893
1111
|
if (!preFilterPass) {
|
|
894
|
-
return
|
|
1112
|
+
return this.gateLanguage((0, name_matcher_1.matchJsStoreBindingCall)(ref, this.context), ref);
|
|
895
1113
|
}
|
|
896
1114
|
// Function-as-value refs (#756) get a dedicated, strictly-gated path:
|
|
897
1115
|
// import-based resolution first (an imported callback resolves through its
|
|
@@ -904,9 +1122,12 @@ class ReferenceResolver {
|
|
|
904
1122
|
if (ref.referenceName.startsWith('this.')) {
|
|
905
1123
|
return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
|
|
906
1124
|
}
|
|
1125
|
+
if ((ref.language === 'python' || ref.language === 'go') && ref.referenceName.includes('.')) {
|
|
1126
|
+
return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
|
|
1127
|
+
}
|
|
907
1128
|
const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
908
1129
|
if (viaImport) {
|
|
909
|
-
const target = this.
|
|
1130
|
+
const target = this.nodeById(viaImport.targetNodeId);
|
|
910
1131
|
if (target &&
|
|
911
1132
|
(target.kind === 'function' ||
|
|
912
1133
|
target.kind === 'method' ||
|
|
@@ -938,16 +1159,24 @@ class ReferenceResolver {
|
|
|
938
1159
|
if (razorResult)
|
|
939
1160
|
return razorResult;
|
|
940
1161
|
}
|
|
1162
|
+
// An explicit PHP class import owns its static calls, including an
|
|
1163
|
+
// unavailable method. Do not let same-name fallbacks change the receiver
|
|
1164
|
+
// to an unrelated Service/Repository type (#1545).
|
|
1165
|
+
const phpStaticImport = (0, import_resolver_1.resolvePhpImportedStaticCall)(ref, this.context);
|
|
1166
|
+
if (phpStaticImport !== undefined)
|
|
1167
|
+
return this.gateLanguage(phpStaticImport, ref);
|
|
941
1168
|
const candidates = [];
|
|
942
1169
|
// Strategy 1: Try framework-specific resolution. Cross-language bridges
|
|
943
1170
|
// are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
|
|
944
|
-
// JS → native `calls`)
|
|
945
|
-
// edge between two KNOWN families (see its doc), never a `calls` bridge or
|
|
946
|
-
// a config↔code edge.
|
|
1171
|
+
// JS → native `calls`); other code references obey the shared family gate.
|
|
947
1172
|
const tFw = this.profileStages ? process.hrtime.bigint() : 0n;
|
|
948
1173
|
let fwEarly = null;
|
|
949
1174
|
for (const framework of this.frameworks) {
|
|
950
|
-
const
|
|
1175
|
+
const resolved = this.gateFrameworkLanguage(framework.resolve(ref, this.context), ref);
|
|
1176
|
+
// Name the resolver on the edge (`metadata.framework`): a Swift→ObjC or
|
|
1177
|
+
// React Native bridge hop says how it got into the graph, as a
|
|
1178
|
+
// synthesized edge's `synthesizedBy` does.
|
|
1179
|
+
const result = resolved ? { ...resolved, metadata: { ...resolved.metadata, framework: framework.name } } : null;
|
|
951
1180
|
if (result) {
|
|
952
1181
|
if (result.confidence >= 0.9) {
|
|
953
1182
|
fwEarly = result; // High confidence, return immediately (below)
|
|
@@ -960,9 +1189,38 @@ class ReferenceResolver {
|
|
|
960
1189
|
this.stageAdd('frameworks', ref, fwEarly !== null, tFw);
|
|
961
1190
|
if (fwEarly)
|
|
962
1191
|
return fwEarly;
|
|
1192
|
+
// A retained untyped chain supplies effect/call-site evidence only. In
|
|
1193
|
+
// particular, importing its root does not make the root its call target.
|
|
1194
|
+
// A path through module namespaces is not untyped: `z.coerce.number()`
|
|
1195
|
+
// after `import * as z`, where the barrel has `export * as coerce`.
|
|
1196
|
+
if ((0, name_matcher_1.isUnresolvedJsMemberCall)(ref)) {
|
|
1197
|
+
const root = ref.referenceName.slice(0, ref.referenceName.indexOf('.'));
|
|
1198
|
+
const namespace = this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.isNamespace && m.localName === root);
|
|
1199
|
+
if (!namespace)
|
|
1200
|
+
return null;
|
|
1201
|
+
const viaNamespace = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
1202
|
+
const target = viaNamespace ? this.nodeById(viaNamespace.targetNodeId) : null;
|
|
1203
|
+
return target && (target.kind === 'function' || target.kind === 'method' || target.kind === 'class' || target.kind === 'constant' || target.kind === 'variable')
|
|
1204
|
+
? viaNamespace : null;
|
|
1205
|
+
}
|
|
963
1206
|
// Strategy 2: Try import-based resolution
|
|
1207
|
+
// A TS/JS/Python call-receiver chain (`useStore.getState().reset`, #1683)
|
|
1208
|
+
// names the ROOT's import, not the method's: letting resolveViaImport see
|
|
1209
|
+
// it binds the call to the imported store constant and the method is
|
|
1210
|
+
// never looked up. The name-matcher owns the chain shape for these
|
|
1211
|
+
// languages — the Java/Kotlin/C++ chains keep their existing path.
|
|
1212
|
+
if (ref.referenceKind === 'calls' &&
|
|
1213
|
+
CHAIN_SHAPE.test(ref.referenceName) &&
|
|
1214
|
+
(ref.language === 'typescript' || ref.language === 'javascript' || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'python')) {
|
|
1215
|
+
return this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
|
|
1216
|
+
}
|
|
964
1217
|
const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
|
|
965
|
-
|
|
1218
|
+
// `self.get_ip()` is a method call on the instance even when the file
|
|
1219
|
+
// also imports a function named `get_ip`: the import never names it.
|
|
1220
|
+
const selfCall = ref.language === 'python' && ref.referenceKind === 'calls' &&
|
|
1221
|
+
this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === ref.referenceName) &&
|
|
1222
|
+
(0, name_matcher_1.isPythonSelfCall)(ref, this.context);
|
|
1223
|
+
const importResult = selfCall ? null : this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
966
1224
|
if (this.profileStages)
|
|
967
1225
|
this.stageAdd('viaImport', ref, !!importResult, tImp);
|
|
968
1226
|
if (importResult) {
|
|
@@ -997,8 +1255,15 @@ class ReferenceResolver {
|
|
|
997
1255
|
// matcher would link each `mkOption` call to whichever file's inherit
|
|
998
1256
|
// binding it happened to pick. Same-file matches only.
|
|
999
1257
|
if (nameResult) {
|
|
1000
|
-
const target = this.
|
|
1001
|
-
|
|
1258
|
+
const target = this.nodeById(nameResult.targetNodeId);
|
|
1259
|
+
// A definition its language makes file-local — a C `static`, a Kotlin
|
|
1260
|
+
// `private fun`, a Go unexported name in another package, a Rust
|
|
1261
|
+
// non-`pub` item outside its module subtree — cannot be what a name in
|
|
1262
|
+
// another file means, whichever strategy chose it (#1730).
|
|
1263
|
+
if (target && !(0, name_matcher_1.isVisibleAcrossFiles)(target, ref, this.context)) {
|
|
1264
|
+
nameResult = null;
|
|
1265
|
+
}
|
|
1266
|
+
else if (ref.language === 'nix') {
|
|
1002
1267
|
if (!target || target.filePath !== ref.filePath) {
|
|
1003
1268
|
nameResult = null;
|
|
1004
1269
|
}
|
|
@@ -1021,7 +1286,7 @@ class ReferenceResolver {
|
|
|
1021
1286
|
if (ref.referenceKind === 'calls' &&
|
|
1022
1287
|
CHAIN_LANGUAGES.has(ref.language) &&
|
|
1023
1288
|
CHAIN_SHAPE.test(ref.referenceName)) {
|
|
1024
|
-
this.
|
|
1289
|
+
this.deferReference(ref, this.deferredChainRefs);
|
|
1025
1290
|
}
|
|
1026
1291
|
else if (
|
|
1027
1292
|
// PHP `$this->prop->method()` (encoded `this->prop.method`): its method
|
|
@@ -1030,7 +1295,7 @@ class ReferenceResolver {
|
|
|
1030
1295
|
ref.referenceKind === 'calls' &&
|
|
1031
1296
|
ref.language === 'php' &&
|
|
1032
1297
|
PHP_PROP_SHAPE.test(ref.referenceName)) {
|
|
1033
|
-
this.
|
|
1298
|
+
this.deferReference(ref, this.deferredChainRefs);
|
|
1034
1299
|
}
|
|
1035
1300
|
return null;
|
|
1036
1301
|
}
|
|
@@ -1041,18 +1306,19 @@ class ReferenceResolver {
|
|
|
1041
1306
|
* Create edges from resolved references
|
|
1042
1307
|
*/
|
|
1043
1308
|
createEdges(resolved) {
|
|
1044
|
-
return resolved.
|
|
1309
|
+
return resolved.flatMap((ref) => {
|
|
1045
1310
|
// `function_ref` (#756) is internal-only: it persists as a `references`
|
|
1046
1311
|
// edge (the registration site depends on the callback), distinguishable
|
|
1047
1312
|
// by metadata.resolvedBy === 'function-ref'. callers/impact already
|
|
1048
1313
|
// traverse `references`, so registration sites surface with no
|
|
1049
1314
|
// graph-layer changes.
|
|
1050
|
-
let kind = ref.
|
|
1315
|
+
let kind = ref.edgeKind ??
|
|
1316
|
+
(ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind);
|
|
1051
1317
|
// Promote "extends" to "implements" when a class/struct targets an interface
|
|
1052
1318
|
if (kind === 'extends') {
|
|
1053
|
-
const targetNode = this.
|
|
1319
|
+
const targetNode = this.nodeById(ref.targetNodeId);
|
|
1054
1320
|
if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
|
|
1055
|
-
const sourceNode = this.
|
|
1321
|
+
const sourceNode = this.nodeById(ref.original.fromNodeId);
|
|
1056
1322
|
if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
|
|
1057
1323
|
kind = 'implements';
|
|
1058
1324
|
}
|
|
@@ -1064,19 +1330,27 @@ class ReferenceResolver {
|
|
|
1064
1330
|
// apart from a function call without symbol info, but resolution
|
|
1065
1331
|
// can: if `Foo` resolves to a class, the call IS an instantiation.
|
|
1066
1332
|
if (kind === 'calls') {
|
|
1067
|
-
const targetNode = this.
|
|
1333
|
+
const targetNode = this.nodeById(ref.targetNodeId);
|
|
1068
1334
|
if (targetNode &&
|
|
1069
1335
|
(targetNode.kind === 'class' || targetNode.kind === 'struct' || targetNode.kind === 'union')) {
|
|
1070
1336
|
kind = 'instantiates';
|
|
1071
1337
|
}
|
|
1072
1338
|
}
|
|
1073
|
-
|
|
1339
|
+
// One reference can name several targets — a navigation whose
|
|
1340
|
+
// destination is a conditional reaches every arm. Each becomes its own
|
|
1341
|
+
// edge, sharing this resolution's kind and confidence.
|
|
1342
|
+
const targets = [
|
|
1343
|
+
{ targetNodeId: ref.targetNodeId, metadata: ref.metadata },
|
|
1344
|
+
...(ref.alsoTargets ?? []),
|
|
1345
|
+
];
|
|
1346
|
+
return targets.map((t) => ({
|
|
1074
1347
|
source: ref.original.fromNodeId,
|
|
1075
|
-
target:
|
|
1348
|
+
target: t.targetNodeId,
|
|
1076
1349
|
kind,
|
|
1077
1350
|
line: ref.original.line,
|
|
1078
1351
|
column: ref.original.column,
|
|
1079
1352
|
metadata: {
|
|
1353
|
+
...(t.metadata ?? {}),
|
|
1080
1354
|
confidence: ref.confidence,
|
|
1081
1355
|
resolvedBy: ref.resolvedBy,
|
|
1082
1356
|
// The ORIGINAL reference text (and kind, when edge-kind promotion
|
|
@@ -1097,7 +1371,7 @@ class ReferenceResolver {
|
|
|
1097
1371
|
// exactly the edges this feature added.
|
|
1098
1372
|
...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
|
|
1099
1373
|
},
|
|
1100
|
-
};
|
|
1374
|
+
}));
|
|
1101
1375
|
});
|
|
1102
1376
|
}
|
|
1103
1377
|
/**
|
|
@@ -1146,10 +1420,25 @@ class ReferenceResolver {
|
|
|
1146
1420
|
}
|
|
1147
1421
|
return { byRowId, legacyKeys };
|
|
1148
1422
|
}
|
|
1423
|
+
/** A deferred attempt is unfinished work, not a final failure (#1577). */
|
|
1424
|
+
nonDeferredFailures(unresolved) {
|
|
1425
|
+
return unresolved.filter((ref) => ref.rowId == null || !this.deferredRowIds.has(ref.rowId));
|
|
1426
|
+
}
|
|
1427
|
+
deferReference(ref, queue) {
|
|
1428
|
+
queue.push(ref);
|
|
1429
|
+
if (ref.rowId != null)
|
|
1430
|
+
this.deferredRowIds.add(ref.rowId);
|
|
1431
|
+
}
|
|
1149
1432
|
/**
|
|
1150
1433
|
* Resolve and persist edges to database
|
|
1151
1434
|
*/
|
|
1152
1435
|
resolveAndPersist(unresolvedRefs, onProgress) {
|
|
1436
|
+
const prerequisites = unresolvedRefs.filter(ReferenceResolver.isPrerequisite);
|
|
1437
|
+
if (prerequisites.length > 0 && prerequisites.length < unresolvedRefs.length) {
|
|
1438
|
+
const first = this.resolveAndPersist(prerequisites, (current) => onProgress?.(current, unresolvedRefs.length));
|
|
1439
|
+
const rest = this.resolveAndPersist(unresolvedRefs.filter((ref) => !ReferenceResolver.isPrerequisite(ref)), (current) => onProgress?.(prerequisites.length + current, unresolvedRefs.length));
|
|
1440
|
+
return ReferenceResolver.mergeResults(first, rest);
|
|
1441
|
+
}
|
|
1153
1442
|
const result = this.resolveAll(unresolvedRefs, onProgress);
|
|
1154
1443
|
// Create edges from resolved references
|
|
1155
1444
|
const edges = this.createEdges(result.resolved);
|
|
@@ -1173,7 +1462,7 @@ class ReferenceResolver {
|
|
|
1173
1462
|
// is still 'pending', so any pending row at rest belongs to an
|
|
1174
1463
|
// interrupted run and the sweep can key off the pending count.
|
|
1175
1464
|
if (result.unresolved.length > 0) {
|
|
1176
|
-
const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(result.unresolved);
|
|
1465
|
+
const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
|
|
1177
1466
|
this.queries.markReferencesFailedByRowIds(byRowId);
|
|
1178
1467
|
this.queries.markReferencesFailed(legacyKeys);
|
|
1179
1468
|
}
|
|
@@ -1189,8 +1478,18 @@ class ReferenceResolver {
|
|
|
1189
1478
|
* a large edit lands many popular symbol names at once.
|
|
1190
1479
|
*/
|
|
1191
1480
|
async resolveAndPersistListYielding(refs) {
|
|
1481
|
+
const prerequisites = refs.filter(ReferenceResolver.isPrerequisite);
|
|
1482
|
+
if (prerequisites.length > 0 && prerequisites.length < refs.length) {
|
|
1483
|
+
const first = await this.resolveAndPersistListYielding(prerequisites);
|
|
1484
|
+
const rest = await this.resolveAndPersistListYielding(refs.filter((ref) => !ReferenceResolver.isPrerequisite(ref)));
|
|
1485
|
+
return ReferenceResolver.mergeResults(first, rest);
|
|
1486
|
+
}
|
|
1192
1487
|
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
1193
1488
|
const result = await this.resolveBatchYielding(refs, maybeYield);
|
|
1489
|
+
await this.persistResolutionResult(result, maybeYield);
|
|
1490
|
+
return result;
|
|
1491
|
+
}
|
|
1492
|
+
async persistResolutionResult(result, maybeYield) {
|
|
1194
1493
|
const PERSIST_CHUNK = 1000;
|
|
1195
1494
|
const edges = this.createEdges(result.resolved);
|
|
1196
1495
|
for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
|
|
@@ -1206,7 +1505,7 @@ class ReferenceResolver {
|
|
|
1206
1505
|
this.queries.deleteSpecificResolvedReferences(resolvedCleanup.legacyKeys.slice(i, i + PERSIST_CHUNK));
|
|
1207
1506
|
await maybeYield();
|
|
1208
1507
|
}
|
|
1209
|
-
const failedCleanup = ReferenceResolver.partitionFailedCleanup(result.unresolved);
|
|
1508
|
+
const failedCleanup = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
|
|
1210
1509
|
for (let i = 0; i < failedCleanup.byRowId.length; i += PERSIST_CHUNK) {
|
|
1211
1510
|
this.queries.markReferencesFailedByRowIds(failedCleanup.byRowId.slice(i, i + PERSIST_CHUNK));
|
|
1212
1511
|
await maybeYield();
|
|
@@ -1215,7 +1514,43 @@ class ReferenceResolver {
|
|
|
1215
1514
|
this.queries.markReferencesFailed(failedCleanup.legacyKeys.slice(i, i + PERSIST_CHUNK));
|
|
1216
1515
|
await maybeYield();
|
|
1217
1516
|
}
|
|
1218
|
-
return
|
|
1517
|
+
return edges.length;
|
|
1518
|
+
}
|
|
1519
|
+
/** Finalize the durable queue only AFTER its edges have been inserted. */
|
|
1520
|
+
async persistDeferredReferences(deferred, resolved) {
|
|
1521
|
+
for (const ref of deferred)
|
|
1522
|
+
if (ref.rowId != null)
|
|
1523
|
+
this.deferredRowIds.delete(ref.rowId);
|
|
1524
|
+
const matched = new Set(resolved.map((ref) => ref.original));
|
|
1525
|
+
const unresolved = deferred.filter((ref) => !matched.has(ref));
|
|
1526
|
+
const count = await this.persistResolutionResult({
|
|
1527
|
+
resolved,
|
|
1528
|
+
unresolved,
|
|
1529
|
+
stats: { total: deferred.length, resolved: resolved.length, unresolved: unresolved.length, byMethod: {} },
|
|
1530
|
+
}, (0, cooperative_yield_1.createYielder)());
|
|
1531
|
+
if (count > 0)
|
|
1532
|
+
this.clearCaches();
|
|
1533
|
+
return count;
|
|
1534
|
+
}
|
|
1535
|
+
/** Same two phases as the bounded DB reader: persist wiring before calls. */
|
|
1536
|
+
static isPrerequisite(ref) {
|
|
1537
|
+
return ref.referenceKind === 'imports' || ref.referenceKind === 'extends' || ref.referenceKind === 'implements';
|
|
1538
|
+
}
|
|
1539
|
+
static mergeResults(first, rest) {
|
|
1540
|
+
const byMethod = { ...first.stats.byMethod };
|
|
1541
|
+
for (const [method, count] of Object.entries(rest.stats.byMethod)) {
|
|
1542
|
+
byMethod[method] = (byMethod[method] ?? 0) + count;
|
|
1543
|
+
}
|
|
1544
|
+
return {
|
|
1545
|
+
resolved: first.resolved.concat(rest.resolved),
|
|
1546
|
+
unresolved: first.unresolved.concat(rest.unresolved),
|
|
1547
|
+
stats: {
|
|
1548
|
+
total: first.stats.total + rest.stats.total,
|
|
1549
|
+
resolved: first.stats.resolved + rest.stats.resolved,
|
|
1550
|
+
unresolved: first.stats.unresolved + rest.stats.unresolved,
|
|
1551
|
+
byMethod,
|
|
1552
|
+
},
|
|
1553
|
+
};
|
|
1219
1554
|
}
|
|
1220
1555
|
/**
|
|
1221
1556
|
* Second resolution pass for chained static-factory / fluent calls whose
|
|
@@ -1259,14 +1594,7 @@ class ReferenceResolver {
|
|
|
1259
1594
|
resolved.push(match);
|
|
1260
1595
|
await maybeYield();
|
|
1261
1596
|
}
|
|
1262
|
-
|
|
1263
|
-
return 0;
|
|
1264
|
-
const edges = this.createEdges(resolved);
|
|
1265
|
-
if (edges.length > 0) {
|
|
1266
|
-
this.queries.insertEdges(edges);
|
|
1267
|
-
this.clearCaches();
|
|
1268
|
-
}
|
|
1269
|
-
return edges.length;
|
|
1597
|
+
return this.persistDeferredReferences(deferred, resolved);
|
|
1270
1598
|
}
|
|
1271
1599
|
/**
|
|
1272
1600
|
* Resolve one batch with a yield checkpoint between EVERY ref so the #850
|
|
@@ -1418,6 +1746,7 @@ class ReferenceResolver {
|
|
|
1418
1746
|
unresolved.push(ref);
|
|
1419
1747
|
}
|
|
1420
1748
|
}
|
|
1749
|
+
this.deferredRowIds.clear(); // the admission side now owns both queues
|
|
1421
1750
|
return {
|
|
1422
1751
|
resolved,
|
|
1423
1752
|
unresolved,
|
|
@@ -1440,8 +1769,10 @@ class ReferenceResolver {
|
|
|
1440
1769
|
* would have.
|
|
1441
1770
|
*/
|
|
1442
1771
|
appendDeferredFromWorkers(deferredChain, deferredThisMember) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1772
|
+
for (const ref of deferredChain)
|
|
1773
|
+
this.deferReference(ref, this.deferredChainRefs);
|
|
1774
|
+
for (const ref of deferredThisMember)
|
|
1775
|
+
this.deferReference(ref, this.deferredThisMemberRefs);
|
|
1445
1776
|
}
|
|
1446
1777
|
/**
|
|
1447
1778
|
* Resolve and persist in batches to keep memory bounded.
|
|
@@ -1460,7 +1791,7 @@ class ReferenceResolver {
|
|
|
1460
1791
|
// the valve's timer-driven passive passes stay perpetually partial against
|
|
1461
1792
|
// the pool's continuous reads, which is how a kernel-scale resolution grew
|
|
1462
1793
|
// a 22GB WAL on a 4.6GB DB (migration plan §7a.1).
|
|
1463
|
-
parallel) {
|
|
1794
|
+
parallel, synthesize = true) {
|
|
1464
1795
|
// Resolution runs on the indexer's MAIN thread, and the #850 liveness
|
|
1465
1796
|
// watchdog SIGKILLs a process whose event loop stalls past its window (60s
|
|
1466
1797
|
// by default). A single dense batch's resolveAll — or the synthesis pass
|
|
@@ -1615,8 +1946,26 @@ class ReferenceResolver {
|
|
|
1615
1946
|
}
|
|
1616
1947
|
try {
|
|
1617
1948
|
try {
|
|
1949
|
+
// Orphans retain interruption/re-extraction order, not clean-index order.
|
|
1950
|
+
// A caller can precede its imports or supertypes by many batches (#1577).
|
|
1951
|
+
// Drain those prerequisites first, then start a fresh keyset cursor over
|
|
1952
|
+
// the remaining kinds. The disjoint filters let us prefetch across the
|
|
1953
|
+
// phase boundary before cleanup without re-reading the current batch.
|
|
1954
|
+
let prerequisites = true;
|
|
1955
|
+
let afterRowId = 0;
|
|
1956
|
+
const readNextBatch = () => {
|
|
1957
|
+
let next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
|
|
1958
|
+
if (next.length === 0 && prerequisites) {
|
|
1959
|
+
prerequisites = false;
|
|
1960
|
+
afterRowId = 0;
|
|
1961
|
+
next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
|
|
1962
|
+
}
|
|
1963
|
+
if (next.length > 0)
|
|
1964
|
+
afterRowId = next[next.length - 1].rowId;
|
|
1965
|
+
return next;
|
|
1966
|
+
};
|
|
1618
1967
|
tLp = Date.now();
|
|
1619
|
-
let batch =
|
|
1968
|
+
let batch = readNextBatch();
|
|
1620
1969
|
lp('read', tLp);
|
|
1621
1970
|
let inFlight = batch.length > 0 ? beginBatch(batch) : null;
|
|
1622
1971
|
while (batch.length > 0 && inFlight) {
|
|
@@ -1626,7 +1975,7 @@ class ReferenceResolver {
|
|
|
1626
1975
|
// enumeration yields the following batch (keyset — OFFSET re-walked the
|
|
1627
1976
|
// accumulated failed prefix every read, 54.6s at kernel scale, §7a.2).
|
|
1628
1977
|
tLp = Date.now();
|
|
1629
|
-
const nextBatch =
|
|
1978
|
+
const nextBatch = readNextBatch();
|
|
1630
1979
|
lp('read', tLp);
|
|
1631
1980
|
const tBatch = Date.now();
|
|
1632
1981
|
const result = await settleBatch(inFlight, batch);
|
|
@@ -1647,7 +1996,7 @@ class ReferenceResolver {
|
|
|
1647
1996
|
adaptiveSeqRefs += batch.length;
|
|
1648
1997
|
const remaining = total - processed - batch.length;
|
|
1649
1998
|
const projectedMs = (adaptiveSeqMs / Math.max(1, adaptiveSeqRefs)) * Math.max(0, remaining);
|
|
1650
|
-
if (projectedMs
|
|
1999
|
+
if ((0, resolver_pool_1.shouldEngageAdaptively)(projectedMs, remaining, ADAPTIVE_ENGAGE_SETTLE_MS)) {
|
|
1651
2000
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
|
|
1652
2001
|
console.error(`[pool-timing] adaptive engage: projected ${Math.round(projectedMs)}ms sequential settle over ${remaining} remaining refs`);
|
|
1653
2002
|
}
|
|
@@ -1699,27 +2048,36 @@ class ReferenceResolver {
|
|
|
1699
2048
|
// the remainder idempotently on the next run/sweep (#1187).
|
|
1700
2049
|
const PERSIST_CHUNK = 1000;
|
|
1701
2050
|
const tPersist = Date.now();
|
|
1702
|
-
//
|
|
1703
|
-
//
|
|
1704
|
-
//
|
|
1705
|
-
// receiver typed as a subclass only reaches a
|
|
1706
|
-
// base class if those edges are visible.
|
|
1707
|
-
// out first downgraded exactly those
|
|
1708
|
-
// the 0.9 typed-receiver path to the
|
|
2051
|
+
// A batch that made `extends`/`implements` edges persists them BEFORE
|
|
2052
|
+
// fanning out the next batch: later batches read them —
|
|
2053
|
+
// resolveMethodOnType walks supertype chains over edges that earlier
|
|
2054
|
+
// batches resolved, so a receiver typed as a subclass only reaches a
|
|
2055
|
+
// method declared on its base class if those edges are visible.
|
|
2056
|
+
// (Validated on dubbo: fanning out first downgraded exactly those
|
|
2057
|
+
// supertype-method resolutions from the 0.9 typed-receiver path to the
|
|
2058
|
+
// 0.65 word-overlap fallback.) They are the only edges resolution reads
|
|
2059
|
+
// (RESOLUTION_READ_EDGE_KINDS), so a batch that made none — every batch
|
|
2060
|
+
// after the prerequisite phase readNextBatch drains first — fans the
|
|
2061
|
+
// next batch out now and inserts while it resolves: the same writes in
|
|
2062
|
+
// the same order, and nothing the workers read differs.
|
|
1709
2063
|
tLp = Date.now();
|
|
1710
2064
|
const edges = this.createEdges(result.resolved);
|
|
1711
2065
|
lp('createEdges', tLp);
|
|
2066
|
+
const readEdge = edges.some((e) => RESOLUTION_READ_EDGE_KINDS.includes(e.kind));
|
|
2067
|
+
let nextInFlight = !readEdge && nextBatch.length > 0 ? beginBatch(nextBatch) : null;
|
|
1712
2068
|
tLp = Date.now();
|
|
1713
2069
|
for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
|
|
1714
2070
|
this.queries.insertEdges(edges.slice(i, i + PERSIST_CHUNK));
|
|
1715
2071
|
await maybeYield();
|
|
1716
2072
|
}
|
|
1717
2073
|
lp('insertEdges', tLp);
|
|
1718
|
-
// NOW fan the next batch out — workers see exactly the
|
|
1719
|
-
// sequential baseline would (every batch ≤ this one
|
|
1720
|
-
// the main thread spends the REST of the persist (ref
|
|
1721
|
-
// parking below) overlapped with their resolution —
|
|
1722
|
-
|
|
2074
|
+
// NOW fan the next batch out (if not already) — workers see exactly the
|
|
2075
|
+
// edge state the sequential baseline would (every batch ≤ this one
|
|
2076
|
+
// committed), while the main thread spends the REST of the persist (ref
|
|
2077
|
+
// deletes + failed parking below) overlapped with their resolution —
|
|
2078
|
+
// the double-buffer.
|
|
2079
|
+
if (!nextInFlight && nextBatch.length > 0)
|
|
2080
|
+
nextInFlight = beginBatch(nextBatch);
|
|
1723
2081
|
// Clean up resolved refs so they don't appear in the next batch —
|
|
1724
2082
|
// by row id, so a same-key sibling ref in a LATER batch (same caller
|
|
1725
2083
|
// calling the same callee at another line) is left pending for its own
|
|
@@ -1741,7 +2099,9 @@ class ReferenceResolver {
|
|
|
1741
2099
|
// only see pending rows) but stay retryable when a later sync adds a
|
|
1742
2100
|
// symbol that could satisfy them (#1240).
|
|
1743
2101
|
tLp = Date.now();
|
|
1744
|
-
const
|
|
2102
|
+
const failures = this.nonDeferredFailures(result.unresolved);
|
|
2103
|
+
const deferredCount = result.unresolved.length - failures.length;
|
|
2104
|
+
const failedCleanup = ReferenceResolver.partitionFailedCleanup(failures);
|
|
1745
2105
|
for (let i = 0; i < failedCleanup.byRowId.length; i += PERSIST_CHUNK) {
|
|
1746
2106
|
removedThisBatch += this.queries.markReferencesFailedByRowIds(failedCleanup.byRowId.slice(i, i + PERSIST_CHUNK));
|
|
1747
2107
|
await maybeYield();
|
|
@@ -1771,17 +2131,11 @@ class ReferenceResolver {
|
|
|
1771
2131
|
// first 5000 refs are all external/stdlib calls, resolution stopped at
|
|
1772
2132
|
// batch one and left the rest of the table as permanent orphans (#1187).
|
|
1773
2133
|
// The count-based guard below catches the true no-progress case.
|
|
1774
|
-
// Non-progress guard (defense-in-depth).
|
|
1775
|
-
// the
|
|
1776
|
-
//
|
|
1777
|
-
//
|
|
1778
|
-
//
|
|
1779
|
-
// `original.referenceName` differs from the stored row, so the keyed
|
|
1780
|
-
// delete/update no-ops, and we'd re-read + re-resolve + re-insert the
|
|
1781
|
-
// same rows forever (the runaway that grew a 99-file repo to 5M edges /
|
|
1782
|
-
// 1.4 GB before the Go-fallback fix). Stop rather than grow the graph
|
|
1783
|
-
// without bound. (An in-flight prefetched batch is abandoned unsettled —
|
|
1784
|
-
// fan-out has no side effects until settleBatch appends its results.)
|
|
2134
|
+
// Non-progress guard (defense-in-depth). Ordinary attempts must leave
|
|
2135
|
+
// the pending set; a mismatched original reference can make legacy-key
|
|
2136
|
+
// cleanup a no-op. Keep the guard against that broken persistence even
|
|
2137
|
+
// though keyset pagination now advances independently of row cleanup.
|
|
2138
|
+
// An abandoned prefetched batch has no side effects until settleBatch.
|
|
1785
2139
|
// Non-progress signal, now O(1): `changes` summed across this batch's
|
|
1786
2140
|
// deletes + failed-parks is the DIRECT evidence the guard's old count
|
|
1787
2141
|
// diff inferred — a resolver returning a mismatched name makes the keyed
|
|
@@ -1791,7 +2145,9 @@ class ReferenceResolver {
|
|
|
1791
2145
|
// runs only on the suspicious path (claimed-work batch removed nothing —
|
|
1792
2146
|
// e.g. every row was a sibling a legacy-key sweep already consumed),
|
|
1793
2147
|
// where it arbitrates stop-vs-continue exactly as before.
|
|
1794
|
-
|
|
2148
|
+
// Deferred refs legitimately remain pending for the post-pass. The
|
|
2149
|
+
// keyset cursor advances past them; they must not trigger this guard.
|
|
2150
|
+
if (removedThisBatch + deferredCount <= 0 && batch.length > 0) {
|
|
1795
2151
|
tLp = Date.now();
|
|
1796
2152
|
const remaining = this.queries.getUnresolvedReferencesCount();
|
|
1797
2153
|
lp('countGuard', tLp);
|
|
@@ -1828,6 +2184,21 @@ class ReferenceResolver {
|
|
|
1828
2184
|
await bp;
|
|
1829
2185
|
}
|
|
1830
2186
|
}
|
|
2187
|
+
// Indexes the bulk-edge window's end deferred: built once, while the pool
|
|
2188
|
+
// is busy with synthesis when it is, and in any case before this returns.
|
|
2189
|
+
let deferredBuilt = !bulkEdgesActive || !parallel?.bulkEdgeLoad?.deferred;
|
|
2190
|
+
const buildDeferredIndexes = () => {
|
|
2191
|
+
if (deferredBuilt)
|
|
2192
|
+
return;
|
|
2193
|
+
deferredBuilt = true;
|
|
2194
|
+
const tDeferred = Date.now();
|
|
2195
|
+
try {
|
|
2196
|
+
parallel.bulkEdgeLoad.deferred();
|
|
2197
|
+
}
|
|
2198
|
+
catch { /* healed by schema.sql on the next open, like a crash in the window */ }
|
|
2199
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
2200
|
+
console.error(`[phase-timing] deferred-edge-index: ${Date.now() - tDeferred}ms`);
|
|
2201
|
+
};
|
|
1831
2202
|
// Dynamic-edge synthesis: now that all base `calls` edges are persisted,
|
|
1832
2203
|
// synthesize observer/callback dispatch edges (dispatcher → registered
|
|
1833
2204
|
// callbacks) that static parsing leaves out. Best-effort — never fail the
|
|
@@ -1837,11 +2208,13 @@ class ReferenceResolver {
|
|
|
1837
2208
|
// loop. See docs/design/callback-edge-synthesis.md.
|
|
1838
2209
|
const tSynth = Date.now();
|
|
1839
2210
|
try {
|
|
1840
|
-
|
|
2211
|
+
if (synthesize)
|
|
2212
|
+
aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context, onSynthesisProgress, pool, parallel?.backpressure, buildDeferredIndexes);
|
|
1841
2213
|
}
|
|
1842
2214
|
catch {
|
|
1843
2215
|
// synthesis is additive and optional; ignore failures
|
|
1844
2216
|
}
|
|
2217
|
+
buildDeferredIndexes();
|
|
1845
2218
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
1846
2219
|
console.error(`[phase-timing] callback-synthesis: ${Date.now() - tSynth}ms`);
|
|
1847
2220
|
}
|
|
@@ -1860,21 +2233,75 @@ class ReferenceResolver {
|
|
|
1860
2233
|
stats: aggregateStats,
|
|
1861
2234
|
};
|
|
1862
2235
|
}
|
|
2236
|
+
/** Replace synthesis only after every base-resolution pass has finished. */
|
|
2237
|
+
async refreshSynthesis(dbPath, onProgress, backpressure) {
|
|
2238
|
+
this.clearCaches();
|
|
2239
|
+
const stage = new synthesis_stage_1.SynthesisStage(dbPath);
|
|
2240
|
+
try {
|
|
2241
|
+
const fresh = new ReferenceResolver(this.projectRoot, stage.queries);
|
|
2242
|
+
const count = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(stage.queries, fresh.context, onProgress, null, backpressure);
|
|
2243
|
+
await stage.publish(backpressure);
|
|
2244
|
+
return count;
|
|
2245
|
+
}
|
|
2246
|
+
finally {
|
|
2247
|
+
stage.close();
|
|
2248
|
+
this.clearCaches();
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
1863
2251
|
/**
|
|
1864
2252
|
* Get detected frameworks
|
|
1865
2253
|
*/
|
|
1866
2254
|
getDetectedFrameworks() {
|
|
1867
2255
|
return this.frameworks.map((f) => f.name);
|
|
1868
2256
|
}
|
|
2257
|
+
/**
|
|
2258
|
+
* True when `receiver` is a local name bound by an import that resolves to a
|
|
2259
|
+
* file IN THIS PROJECT — the only case where letting a python
|
|
2260
|
+
* built-in-method name through the filter is safe (#1681).
|
|
2261
|
+
*
|
|
2262
|
+
* Asking only whether SOME import bound the local name is not enough: every
|
|
2263
|
+
* import produces a mapping, stdlib and PyPI included, so that would also be
|
|
2264
|
+
* true for `os`, `requests`, `np`. Opening the filter for them lets
|
|
2265
|
+
* resolveViaImport find no project file, fall through to bare-name matching,
|
|
2266
|
+
* and bind `os.remove(p)` to whatever project method happens to be named
|
|
2267
|
+
* `remove` — reintroducing, through its own escape hatch, the fabricated-edge
|
|
2268
|
+
* class this filter exists to prevent.
|
|
2269
|
+
*
|
|
2270
|
+
* Resolving the specifier is the same question resolveViaImport will ask
|
|
2271
|
+
* next, so a receiver that passes here is one the qualified path can actually
|
|
2272
|
+
* serve; anything else stays a silent miss rather than a wrong edge.
|
|
2273
|
+
*/
|
|
2274
|
+
isPythonProjectModule(ref, receiver) {
|
|
2275
|
+
for (const imp of this.context.getImportMappings(ref.filePath, ref.language)) {
|
|
2276
|
+
if (imp.localName !== receiver)
|
|
2277
|
+
continue;
|
|
2278
|
+
// `import pkg.mod` / `import pkg.mod as m` binds the module `source`
|
|
2279
|
+
// names. `from pkg import mod` binds `pkg.mod`, and `from . import mod`
|
|
2280
|
+
// binds `.mod` — join without doubling the dot that makes `.` mean the
|
|
2281
|
+
// current package.
|
|
2282
|
+
const specifier = imp.isNamespace
|
|
2283
|
+
? imp.source
|
|
2284
|
+
: imp.source.endsWith('.')
|
|
2285
|
+
? `${imp.source}${imp.exportedName}`
|
|
2286
|
+
: `${imp.source}.${imp.exportedName}`;
|
|
2287
|
+
if ((0, import_resolver_1.resolveImportPath)(specifier, ref.filePath, ref.language, this.context)) {
|
|
2288
|
+
return true;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
return false;
|
|
2292
|
+
}
|
|
1869
2293
|
/**
|
|
1870
2294
|
* Check if reference is to a built-in or external symbol
|
|
1871
2295
|
*/
|
|
1872
2296
|
isBuiltInOrExternal(ref) {
|
|
1873
2297
|
const name = ref.referenceName;
|
|
1874
2298
|
const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
|
|
1875
|
-
|| ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts'
|
|
1876
|
-
|
|
1877
|
-
|
|
2299
|
+
|| ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts'
|
|
2300
|
+
|| ref.language === 'vue' || ref.language === 'svelte' || ref.language === 'astro';
|
|
2301
|
+
// JavaScript/TypeScript built-ins — unless the file imports its own
|
|
2302
|
+
// binding of that name (`import Map from './Map.svelte'`).
|
|
2303
|
+
if (isJsTs && js_builtins_1.JS_BUILT_INS.has(name) &&
|
|
2304
|
+
!this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === name)) {
|
|
1878
2305
|
return true;
|
|
1879
2306
|
}
|
|
1880
2307
|
// ArkTS resource-reference intrinsics — `$r('app.string.x')` /
|
|
@@ -1908,10 +2335,27 @@ class ReferenceResolver {
|
|
|
1908
2335
|
}
|
|
1909
2336
|
// Filter built-in methods on non-class receivers
|
|
1910
2337
|
// (e.g., items.append where items is a local list variable)
|
|
1911
|
-
// But allow if the capitalized receiver matches a known codebase class
|
|
2338
|
+
// But allow if the capitalized receiver matches a known codebase class,
|
|
2339
|
+
// OR the receiver is itself an imported project module — a module can
|
|
2340
|
+
// export a top-level function sharing a common collection-method name
|
|
2341
|
+
// (`ledger.append`, `from . import ledger`), and that call is a real
|
|
2342
|
+
// project dependency, not `list.append` (#1681). Without this, the
|
|
2343
|
+
// qualified ref never reaches resolveViaImport / resolvePythonModuleMember.
|
|
1912
2344
|
if (PYTHON_BUILT_IN_METHODS.has(method)) {
|
|
2345
|
+
// A module-scope collection binding is stronger evidence than a
|
|
2346
|
+
// coincidentally matching class name (#1652). Only use this file's
|
|
2347
|
+
// binding: an unrelated module may reuse the receiver for a collection.
|
|
2348
|
+
const isCollection = this.context.getNodesByName(receiver).some((node) => node.language === 'python' && node.filePath === ref.filePath &&
|
|
2349
|
+
(node.kind === 'variable' || node.kind === 'constant') &&
|
|
2350
|
+
node.qualifiedName === receiver &&
|
|
2351
|
+
/^=\s*(?:[\[{]|(?:dict|list|set|tuple|frozenset)\s*\(|\(\s*\)|\([^()]*,)/.test(node.signature ?? ''));
|
|
2352
|
+
if (isCollection)
|
|
2353
|
+
return true;
|
|
1913
2354
|
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
1914
|
-
|
|
2355
|
+
const isKnownClass = this.context.getNodesByName(capitalized).some((node) => node.language === 'python' &&
|
|
2356
|
+
(node.kind === 'class' || node.kind === 'struct' || node.kind === 'interface'));
|
|
2357
|
+
const isProjectModule = !isKnownClass && this.isPythonProjectModule(ref, receiver);
|
|
2358
|
+
if (!isKnownClass && !isProjectModule) {
|
|
1915
2359
|
return true;
|
|
1916
2360
|
}
|
|
1917
2361
|
}
|
|
@@ -1919,9 +2363,8 @@ class ReferenceResolver {
|
|
|
1919
2363
|
// A bare name colliding with a builtin method (index, get, update, count…)
|
|
1920
2364
|
// is only a builtin when NOTHING in the codebase declares it. A declared
|
|
1921
2365
|
// symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
|
|
1922
|
-
// `def get()` — is a real reference target.
|
|
1923
|
-
//
|
|
1924
|
-
// method silently loses its route→handler edge.
|
|
2366
|
+
// `def get()` — is a real reference target. Without this guard, every
|
|
2367
|
+
// handler named after a builtin method silently loses its route→handler edge.
|
|
1925
2368
|
if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
|
|
1926
2369
|
return true;
|
|
1927
2370
|
}
|
|
@@ -1972,28 +2415,16 @@ class ReferenceResolver {
|
|
|
1972
2415
|
* Get file path from node ID
|
|
1973
2416
|
*/
|
|
1974
2417
|
getFilePathFromNodeId(nodeId) {
|
|
1975
|
-
const node = this.
|
|
2418
|
+
const node = this.nodeById(nodeId);
|
|
1976
2419
|
return node?.filePath || '';
|
|
1977
2420
|
}
|
|
1978
2421
|
/**
|
|
1979
2422
|
* Get language from node ID
|
|
1980
2423
|
*/
|
|
1981
2424
|
getLanguageFromNodeId(nodeId) {
|
|
1982
|
-
const node = this.
|
|
2425
|
+
const node = this.nodeById(nodeId);
|
|
1983
2426
|
return node?.language || 'unknown';
|
|
1984
2427
|
}
|
|
1985
|
-
/**
|
|
1986
|
-
* Drop an import/name-strategy resolution that crosses a language family.
|
|
1987
|
-
* Two regimes (mirrors `applyLanguageGate`'s candidate filter):
|
|
1988
|
-
* - `references` (type usage): STRICT — a `Type.member` static read names a
|
|
1989
|
-
* same-family type, never a coincidentally same-named symbol in another
|
|
1990
|
-
* language. Drops any non-same-family target.
|
|
1991
|
-
* - `imports` (import binding / `#include`): both-known — a C++ `#include
|
|
1992
|
-
* "X.h"` must not resolve to a same-named ObjC header on another platform
|
|
1993
|
-
* (basename collision), but a singleton-family / SFC language (`vue` →
|
|
1994
|
-
* `.ts`) importing across is left alone.
|
|
1995
|
-
* Applies to the import (strategy 2) + name-match (strategy 3) results.
|
|
1996
|
-
*/
|
|
1997
2428
|
/**
|
|
1998
2429
|
* Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
|
|
1999
2430
|
* own `@using` directives plus every `_Imports.razor` from the file's folder up
|
|
@@ -2151,7 +2582,7 @@ class ReferenceResolver {
|
|
|
2151
2582
|
const member = ref.referenceName.slice('this.'.length);
|
|
2152
2583
|
if (!member)
|
|
2153
2584
|
return null;
|
|
2154
|
-
const fromNode = this.
|
|
2585
|
+
const fromNode = this.nodeById(ref.fromNodeId);
|
|
2155
2586
|
if (!fromNode)
|
|
2156
2587
|
return null;
|
|
2157
2588
|
// A hook declared at class-body level (Ruby `before_action :authenticate`)
|
|
@@ -2176,7 +2607,7 @@ class ReferenceResolver {
|
|
|
2176
2607
|
// Not on the class itself — possibly INHERITED. implements/extends
|
|
2177
2608
|
// edges don't exist yet in this pass, so retry in the supertype pass
|
|
2178
2609
|
// (resolveDeferredThisMemberRefs) instead of giving up.
|
|
2179
|
-
this.
|
|
2610
|
+
this.deferReference(ref, this.deferredThisMemberRefs);
|
|
2180
2611
|
return null;
|
|
2181
2612
|
}
|
|
2182
2613
|
const target = candidates.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
|
|
@@ -2207,10 +2638,41 @@ class ReferenceResolver {
|
|
|
2207
2638
|
// periodically so the #850 liveness watchdog heartbeat can fire (#1091).
|
|
2208
2639
|
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
2209
2640
|
const resolved = [];
|
|
2641
|
+
// Refs share supertypes (every `this.dispose` walks the same chain), and
|
|
2642
|
+
// nothing is written until the loop ends: read each type's supertype
|
|
2643
|
+
// edges, and each supertype's callable members by name, once.
|
|
2644
|
+
const supertypeEdges = new Map();
|
|
2645
|
+
const callableMembers = new Map();
|
|
2646
|
+
const supertypesOf = (id) => {
|
|
2647
|
+
let edges = supertypeEdges.get(id);
|
|
2648
|
+
if (!edges) {
|
|
2649
|
+
edges = this.queries.getOutgoingEdges(id, ['implements', 'extends']);
|
|
2650
|
+
supertypeEdges.set(id, edges);
|
|
2651
|
+
}
|
|
2652
|
+
return edges;
|
|
2653
|
+
};
|
|
2654
|
+
const callableMembersOf = (id) => {
|
|
2655
|
+
let byName = callableMembers.get(id);
|
|
2656
|
+
if (!byName) {
|
|
2657
|
+
byName = new Map();
|
|
2658
|
+
for (const c of this.queries.getOutgoingEdges(id, ['contains'])) {
|
|
2659
|
+
const m = this.nodeById(c.target);
|
|
2660
|
+
if (!m || (m.kind !== 'function' && m.kind !== 'method'))
|
|
2661
|
+
continue;
|
|
2662
|
+
const list = byName.get(m.name);
|
|
2663
|
+
if (list)
|
|
2664
|
+
list.push(m);
|
|
2665
|
+
else
|
|
2666
|
+
byName.set(m.name, [m]);
|
|
2667
|
+
}
|
|
2668
|
+
callableMembers.set(id, byName);
|
|
2669
|
+
}
|
|
2670
|
+
return byName;
|
|
2671
|
+
};
|
|
2210
2672
|
for (const ref of deferred) {
|
|
2211
2673
|
await maybeYield();
|
|
2212
2674
|
const member = ref.referenceName.slice('this.'.length);
|
|
2213
|
-
const fromNode = this.
|
|
2675
|
+
const fromNode = this.nodeById(ref.fromNodeId);
|
|
2214
2676
|
if (!fromNode || !member)
|
|
2215
2677
|
continue;
|
|
2216
2678
|
// Class-body-level hooks (Ruby) attribute to the CLASS node itself.
|
|
@@ -2250,24 +2712,18 @@ class ReferenceResolver {
|
|
|
2250
2712
|
for (let depth = 0; depth < 5 && frontierNodes.length > 0 && !target; depth++) {
|
|
2251
2713
|
const next = [];
|
|
2252
2714
|
for (const typeNode of frontierNodes) {
|
|
2253
|
-
for (const edge of
|
|
2254
|
-
const superNode = this.
|
|
2715
|
+
for (const edge of supertypesOf(typeNode.id)) {
|
|
2716
|
+
const superNode = this.nodeById(edge.target);
|
|
2255
2717
|
if (!superNode || seenNodes.has(superNode.id))
|
|
2256
2718
|
continue;
|
|
2257
2719
|
seenNodes.add(superNode.id);
|
|
2258
2720
|
if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
|
|
2259
2721
|
continue;
|
|
2260
2722
|
// Member lookup anchored on the supertype's contains edges.
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
m.
|
|
2265
|
-
(m.kind === 'function' || m.kind === 'method') &&
|
|
2266
|
-
(0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) {
|
|
2267
|
-
target = m;
|
|
2268
|
-
break;
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2723
|
+
target =
|
|
2724
|
+
callableMembersOf(superNode.id)
|
|
2725
|
+
.get(member)
|
|
2726
|
+
?.find((m) => (0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) ?? null;
|
|
2271
2727
|
if (target)
|
|
2272
2728
|
break;
|
|
2273
2729
|
next.push(superNode);
|
|
@@ -2286,47 +2742,208 @@ class ReferenceResolver {
|
|
|
2286
2742
|
});
|
|
2287
2743
|
}
|
|
2288
2744
|
}
|
|
2289
|
-
|
|
2290
|
-
return 0;
|
|
2291
|
-
const edges = this.createEdges(resolved);
|
|
2292
|
-
if (edges.length > 0) {
|
|
2293
|
-
this.queries.insertEdges(edges);
|
|
2294
|
-
this.clearCaches();
|
|
2295
|
-
}
|
|
2296
|
-
return edges.length;
|
|
2745
|
+
return this.persistDeferredReferences(deferred, resolved);
|
|
2297
2746
|
}
|
|
2298
|
-
|
|
2747
|
+
/**
|
|
2748
|
+
* Drop a resolution whose target cannot be what the reference names.
|
|
2749
|
+
* Applied at the `resolveOne` seam so it covers every strategy uniformly —
|
|
2750
|
+
* framework, import, name-match, chain, CFML component path.
|
|
2751
|
+
*
|
|
2752
|
+
* For `imports`: the target must be importable. A member that only exists
|
|
2753
|
+
* inside a type never is.
|
|
2754
|
+
*
|
|
2755
|
+
* For `extends`/`implements`, it cannot be describing a real supertype when:
|
|
2756
|
+
*
|
|
2757
|
+
* 1. The target's kind can never be a supertype (an enum member, a method,
|
|
2758
|
+
* a variable). `matchByExactName` additionally narrows its candidate
|
|
2759
|
+
* pool by the same set, so a legitimate supertype outranks a same-named
|
|
2760
|
+
* non-type rather than merely losing its edge.
|
|
2761
|
+
* 2. The name is imported from outside the repo, so NO local node is the
|
|
2762
|
+
* referent. Without this, filtering by kind alone just relocates the
|
|
2763
|
+
* false edge onto the next same-named local type.
|
|
2764
|
+
*
|
|
2765
|
+
* One exception to (1): a TypeScript VALUE that shares its name with a type
|
|
2766
|
+
* in the same file. `export const IFoo = createDecorator<IFoo>('foo')` beside
|
|
2767
|
+
* `export interface IFoo` is how VS Code declares every service, and an
|
|
2768
|
+
* import of `IFoo` resolves to the file with both — a strategy that takes the
|
|
2769
|
+
* first export of that name gets the value. The strategy found the right
|
|
2770
|
+
* file and name; the type declared there is the supertype, so the edge moves
|
|
2771
|
+
* to it rather than being dropped (dropping it lost ~900 `implements` edges
|
|
2772
|
+
* on vscode).
|
|
2773
|
+
*
|
|
2774
|
+
* Otherwise this only ever REMOVES an edge, never adds one. A dropped ref
|
|
2775
|
+
* stays in `unresolved_refs` as `failed`, which is the honest record for a
|
|
2776
|
+
* supertype that lives outside the repo — silent beats wrong.
|
|
2777
|
+
*/
|
|
2778
|
+
gateTargetKind(result, ref) {
|
|
2299
2779
|
if (!result)
|
|
2300
2780
|
return result;
|
|
2301
|
-
|
|
2302
|
-
|
|
2781
|
+
// A `#define` is a value, never a callee (#1838): a macro defined only in
|
|
2782
|
+
// an unrelated file is not what `NAME(x)` here expands to either.
|
|
2783
|
+
if (ref.referenceKind === 'calls') {
|
|
2784
|
+
const target = this.nodeById(result.targetNodeId);
|
|
2785
|
+
if (target?.kind === 'constant' && types_1.CPP_DEFINE_SIGNATURE.test(target.signature ?? ''))
|
|
2786
|
+
return null;
|
|
2787
|
+
}
|
|
2788
|
+
// An `imports` reference names something importable — never a member that
|
|
2789
|
+
// only exists inside a type.
|
|
2790
|
+
if (ref.referenceKind === 'imports') {
|
|
2791
|
+
const target = this.nodeById(result.targetNodeId);
|
|
2792
|
+
return target && !(0, types_1.isImportableKind)(target.kind) ? null : result;
|
|
2793
|
+
}
|
|
2794
|
+
if (!(0, types_1.isInheritanceRef)(ref))
|
|
2303
2795
|
return result;
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2796
|
+
const target = this.nodeById(result.targetNodeId);
|
|
2797
|
+
if (target && !(0, types_1.isSupertypeTarget)(target)) {
|
|
2798
|
+
const type = this.sameNamedTypeOfValue(target);
|
|
2799
|
+
if (!type)
|
|
2800
|
+
return null;
|
|
2801
|
+
result = { ...result, targetNodeId: type.id };
|
|
2802
|
+
}
|
|
2803
|
+
if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context))
|
|
2307
2804
|
return null;
|
|
2308
2805
|
return result;
|
|
2309
2806
|
}
|
|
2310
2807
|
/**
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
*
|
|
2319
|
-
*
|
|
2320
|
-
|
|
2321
|
-
|
|
2808
|
+
* `super.didMoveToWindow()` inside an override of `didMoveToWindow` calls
|
|
2809
|
+
* the PARENT's implementation, never the method making the call. Extraction
|
|
2810
|
+
* keeps a `super` call under the bare method name, so every strategy found
|
|
2811
|
+
* the enclosing method itself: one expo-camera view had eleven of its
|
|
2812
|
+
* overrides "calling" themselves. The parent's method is usually a
|
|
2813
|
+
* framework's (UIKit, Android, React); a self-edge is never it. Real
|
|
2814
|
+
* recursion keeps its edge — only a call written through `super` / `base`
|
|
2815
|
+
* (C#) / `[super …]` (Objective-C) / `parent::` (PHP) / `super().` (Python)
|
|
2816
|
+
* is declined.
|
|
2817
|
+
*/
|
|
2818
|
+
gateSuperSelfCall(result, ref) {
|
|
2819
|
+
if (!result || ref.referenceKind !== 'calls' || result.targetNodeId !== ref.fromNodeId)
|
|
2820
|
+
return result;
|
|
2821
|
+
const name = ref.referenceName.slice(Math.max(ref.referenceName.lastIndexOf('.'), ref.referenceName.lastIndexOf(':')) + 1);
|
|
2822
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(name))
|
|
2823
|
+
return result;
|
|
2824
|
+
const line = (this.context.getFileLines?.(ref.filePath) ?? this.context.readFile(ref.filePath)?.split(/\r?\n/))?.[ref.line - 1];
|
|
2825
|
+
if (!line)
|
|
2826
|
+
return result;
|
|
2827
|
+
const escaped = name.replace(/\$/g, '\\$');
|
|
2828
|
+
const viaSuper = new RegExp(String.raw `(?:\b(?:super|base)\s*(?:\(\s*(?:[\w.]+\s*,\s*\w+)?\s*\))?\s*\??\.\s*|\[\s*super\s+|\bparent\s*::\s*)` + escaped + String.raw `\b`);
|
|
2829
|
+
return viaSuper.test(line) ? null : result;
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* A bare Rust name reaches only what is in scope — every strategy's result,
|
|
2833
|
+
* a framework resolver's `Ok(x)` → `struct Ok` construction included (see
|
|
2834
|
+
* isRustNameInScope).
|
|
2835
|
+
*/
|
|
2836
|
+
gateRustScope(result, ref) {
|
|
2837
|
+
if (!result || ref.language !== 'rust' || !/^[A-Za-z_]\w*$/.test(ref.referenceName))
|
|
2838
|
+
return result;
|
|
2839
|
+
const target = this.nodeById(result.targetNodeId);
|
|
2840
|
+
return target && !(0, name_matcher_1.isRustNameInScope)(target, ref, this.context) ? null : result;
|
|
2841
|
+
}
|
|
2842
|
+
/** The repository's own package name, from its root package.json; null without one. */
|
|
2843
|
+
/** Per directory: the package names its package.json and every enclosing one own and depend on. */
|
|
2844
|
+
manifestScopes = new Map();
|
|
2845
|
+
/**
|
|
2846
|
+
* Is `source` a package from outside the repository? Only when the importing
|
|
2847
|
+
* file's package.json (or an enclosing one) declares it, or it is a Node
|
|
2848
|
+
* built-in or a runtime's virtual module. A specifier nothing declares is
|
|
2849
|
+
* an alias this resolver does not know — SvelteKit's `$lib/…`, Nuxt's
|
|
2850
|
+
* `~/…`, a nested app's own `@/…` — and stays the project's.
|
|
2851
|
+
*/
|
|
2852
|
+
isDeclaredOutsidePackage(source, fromFile) {
|
|
2853
|
+
// Deno's standard library is `@std/…` from JSR.
|
|
2854
|
+
if (/^(?:node|bun|jsr|npm|https?):/.test(source) || source.startsWith('@std/') || NODE_BUILTINS.has(source))
|
|
2855
|
+
return true;
|
|
2856
|
+
const name = source.startsWith('@') ? source.split('/').slice(0, 2).join('/') : source.split('/')[0];
|
|
2857
|
+
const normalized = fromFile.replace(/\\/g, '/');
|
|
2858
|
+
const scope = this.manifestScope(normalized.includes('/') ? normalized.slice(0, normalized.lastIndexOf('/')) : '');
|
|
2859
|
+
if (scope.own.has(name))
|
|
2860
|
+
return false;
|
|
2861
|
+
if (scope.deps.has(name))
|
|
2862
|
+
return true;
|
|
2863
|
+
// SvelteKit's `$app/…` and Astro's `astro:…` belong to the framework —
|
|
2864
|
+
// unless this repository is that framework.
|
|
2865
|
+
const provider = source.startsWith('astro:') ? 'astro' : /^\$(?:app|env|service-worker)(?:\/|$)/.test(source) ? '@sveltejs/kit' : null;
|
|
2866
|
+
return provider !== null && !scope.own.has(provider) && !this.context.getWorkspacePackages?.()?.byName.has(provider);
|
|
2867
|
+
}
|
|
2868
|
+
manifestScope(dir) {
|
|
2869
|
+
const memo = this.manifestScopes.get(dir);
|
|
2870
|
+
if (memo)
|
|
2871
|
+
return memo;
|
|
2872
|
+
const parent = dir === '' ? null : this.manifestScope(dir.includes('/') ? dir.slice(0, dir.lastIndexOf('/')) : '');
|
|
2873
|
+
let scope = parent ?? { own: new Set(), deps: new Set() };
|
|
2874
|
+
try {
|
|
2875
|
+
const json = JSON.parse(this.context.readFile(dir ? `${dir}/package.json` : 'package.json') ?? 'null');
|
|
2876
|
+
if (json && typeof json === 'object') {
|
|
2877
|
+
scope = { own: new Set(scope.own), deps: new Set(scope.deps) };
|
|
2878
|
+
if (typeof json.name === 'string' && json.name.length > 0)
|
|
2879
|
+
scope.own.add(json.name);
|
|
2880
|
+
for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
|
|
2881
|
+
const deps = json[field];
|
|
2882
|
+
if (!deps || typeof deps !== 'object')
|
|
2883
|
+
continue;
|
|
2884
|
+
for (const [dep, version] of Object.entries(deps)) {
|
|
2885
|
+
// `workspace:*`, `file:../shared`, `link:…`: a package in this repository.
|
|
2886
|
+
if (typeof version === 'string' && /^(?:workspace|file|link|portal):/.test(version))
|
|
2887
|
+
scope.own.add(dep);
|
|
2888
|
+
else
|
|
2889
|
+
scope.deps.add(dep);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
catch { /* no or unreadable package.json */ }
|
|
2895
|
+
// A Deno import map names packages the same way — an entry that maps to a
|
|
2896
|
+
// registry or a URL, not one that maps to a path in the repository.
|
|
2897
|
+
for (const file of ['deno.json', 'deno.jsonc']) {
|
|
2898
|
+
const raw = this.context.readFile(dir ? `${dir}/${file}` : file);
|
|
2899
|
+
if (!raw)
|
|
2900
|
+
continue;
|
|
2901
|
+
const json = (0, jsonc_parser_1.parse)(raw);
|
|
2902
|
+
const imports = json && typeof json === 'object' ? json.imports : undefined;
|
|
2903
|
+
if (!imports || typeof imports !== 'object')
|
|
2904
|
+
continue;
|
|
2905
|
+
for (const [key, target] of Object.entries(imports)) {
|
|
2906
|
+
if (typeof target !== 'string' || !/^(?:jsr|npm|https?):/.test(target))
|
|
2907
|
+
continue;
|
|
2908
|
+
if (scope === parent)
|
|
2909
|
+
scope = { own: new Set(scope.own), deps: new Set(scope.deps) };
|
|
2910
|
+
scope.deps.add(key.replace(/\/$/, ''));
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
this.manifestScopes.set(dir, scope);
|
|
2914
|
+
return scope;
|
|
2915
|
+
}
|
|
2916
|
+
/** The one supertype-kind node a TypeScript value shares its name and file with. */
|
|
2917
|
+
sameNamedTypeOfValue(value) {
|
|
2918
|
+
if (value.kind !== 'constant' && value.kind !== 'variable')
|
|
2919
|
+
return null;
|
|
2920
|
+
if (value.language !== 'typescript' && value.language !== 'tsx')
|
|
2921
|
+
return null;
|
|
2922
|
+
const types = this.context
|
|
2923
|
+
.getNodesInFile(value.filePath)
|
|
2924
|
+
.filter((n) => n.name === value.name && (0, types_1.isSupertypeTarget)(n));
|
|
2925
|
+
return types.length === 1 ? types[0] : null;
|
|
2926
|
+
}
|
|
2927
|
+
gateLanguage(result, ref) {
|
|
2928
|
+
if (!result)
|
|
2929
|
+
return result;
|
|
2930
|
+
return (0, name_matcher_1.gateLanguageMatch)(result, ref, this.context);
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Framework calls carry bridge evidence (RN/Expo JS → native). Other
|
|
2934
|
+
* framework results obey the same code-family boundary as name matches;
|
|
2935
|
+
* markup/config transitions remain open.
|
|
2322
2936
|
*/
|
|
2323
2937
|
gateFrameworkLanguage(result, ref) {
|
|
2324
2938
|
if (!result)
|
|
2325
2939
|
return result;
|
|
2326
|
-
if (ref.referenceKind
|
|
2940
|
+
if (ref.referenceKind === 'calls')
|
|
2327
2941
|
return result;
|
|
2328
2942
|
const tgt = this.getLanguageFromNodeId(result.targetNodeId);
|
|
2329
|
-
|
|
2943
|
+
// Package imports cannot target prose found by a framework's name lookup.
|
|
2944
|
+
if (ref.referenceKind === 'imports' && tgt === 'markdown' && ref.language !== 'markdown')
|
|
2945
|
+
return null;
|
|
2946
|
+
if (tgt && ref.language && (0, name_matcher_1.crossesCodeBoundary)(tgt, ref.language))
|
|
2330
2947
|
return null;
|
|
2331
2948
|
return result;
|
|
2332
2949
|
}
|