@bharanidev/bhgraph-darwin-x64 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bhgraph +19 -0
- package/lib/dist/bin/bhgraph.d.ts +26 -0
- package/lib/dist/bin/bhgraph.d.ts.map +1 -0
- package/lib/dist/bin/bhgraph.js +2207 -0
- package/lib/dist/bin/bhgraph.js.map +1 -0
- package/lib/dist/bin/command-supervision.d.ts +12 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -0
- package/lib/dist/bin/command-supervision.js +89 -0
- package/lib/dist/bin/command-supervision.js.map +1 -0
- package/lib/dist/bin/fatal-handler.d.ts +20 -0
- package/lib/dist/bin/fatal-handler.d.ts.map +1 -0
- package/lib/dist/bin/fatal-handler.js +118 -0
- package/lib/dist/bin/fatal-handler.js.map +1 -0
- package/lib/dist/bin/node-version-check.d.ts +37 -0
- package/lib/dist/bin/node-version-check.d.ts.map +1 -0
- package/lib/dist/bin/node-version-check.js +79 -0
- package/lib/dist/bin/node-version-check.js.map +1 -0
- package/lib/dist/bin/uninstall.d.ts +14 -0
- package/lib/dist/bin/uninstall.d.ts.map +1 -0
- package/lib/dist/bin/uninstall.js +36 -0
- package/lib/dist/bin/uninstall.js.map +1 -0
- package/lib/dist/context/formatter.d.ts +30 -0
- package/lib/dist/context/formatter.d.ts.map +1 -0
- package/lib/dist/context/formatter.js +263 -0
- package/lib/dist/context/formatter.js.map +1 -0
- package/lib/dist/context/index.d.ts +119 -0
- package/lib/dist/context/index.d.ts.map +1 -0
- package/lib/dist/context/index.js +1296 -0
- package/lib/dist/context/index.js.map +1 -0
- package/lib/dist/context/markers.d.ts +19 -0
- package/lib/dist/context/markers.d.ts.map +1 -0
- package/lib/dist/context/markers.js +22 -0
- package/lib/dist/context/markers.js.map +1 -0
- package/lib/dist/db/index.d.ts +142 -0
- package/lib/dist/db/index.d.ts.map +1 -0
- package/lib/dist/db/index.js +335 -0
- package/lib/dist/db/index.js.map +1 -0
- package/lib/dist/db/migrations.d.ts +44 -0
- package/lib/dist/db/migrations.d.ts.map +1 -0
- package/lib/dist/db/migrations.js +182 -0
- package/lib/dist/db/migrations.js.map +1 -0
- package/lib/dist/db/queries.d.ts +452 -0
- package/lib/dist/db/queries.d.ts.map +1 -0
- package/lib/dist/db/queries.js +1740 -0
- package/lib/dist/db/queries.js.map +1 -0
- package/lib/dist/db/schema.sql +182 -0
- package/lib/dist/db/sqlite-adapter.d.ts +53 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/lib/dist/db/sqlite-adapter.js +117 -0
- package/lib/dist/db/sqlite-adapter.js.map +1 -0
- package/lib/dist/directory.d.ts +183 -0
- package/lib/dist/directory.d.ts.map +1 -0
- package/lib/dist/directory.js +797 -0
- package/lib/dist/directory.js.map +1 -0
- package/lib/dist/errors.d.ts +136 -0
- package/lib/dist/errors.d.ts.map +1 -0
- package/lib/dist/errors.js +219 -0
- package/lib/dist/errors.js.map +1 -0
- package/lib/dist/extraction/astro-extractor.d.ts +79 -0
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/astro-extractor.js +320 -0
- package/lib/dist/extraction/astro-extractor.js.map +1 -0
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.d.ts +31 -0
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/dfm-extractor.js +151 -0
- package/lib/dist/extraction/dfm-extractor.js.map +1 -0
- package/lib/dist/extraction/extraction-version.d.ts +25 -0
- package/lib/dist/extraction/extraction-version.d.ts.map +1 -0
- package/lib/dist/extraction/extraction-version.js +28 -0
- package/lib/dist/extraction/extraction-version.js.map +1 -0
- package/lib/dist/extraction/function-ref.d.ts +118 -0
- package/lib/dist/extraction/function-ref.d.ts.map +1 -0
- package/lib/dist/extraction/function-ref.js +727 -0
- package/lib/dist/extraction/function-ref.js.map +1 -0
- package/lib/dist/extraction/generated-detection.d.ts +30 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -0
- package/lib/dist/extraction/generated-detection.js +83 -0
- package/lib/dist/extraction/generated-detection.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +123 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -0
- package/lib/dist/extraction/grammars.js +589 -0
- package/lib/dist/extraction/grammars.js.map +1 -0
- package/lib/dist/extraction/index.d.ts +232 -0
- package/lib/dist/extraction/index.d.ts.map +1 -0
- package/lib/dist/extraction/index.js +2269 -0
- package/lib/dist/extraction/index.js.map +1 -0
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +110 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.js +837 -0
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -0
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/csharp.d.ts +25 -0
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/lib/dist/extraction/languages/csharp.js +175 -0
- package/lib/dist/extraction/languages/csharp.js.map +1 -0
- package/lib/dist/extraction/languages/dart.d.ts +3 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -0
- package/lib/dist/extraction/languages/dart.js +374 -0
- package/lib/dist/extraction/languages/dart.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/go.d.ts +3 -0
- package/lib/dist/extraction/languages/go.d.ts.map +1 -0
- package/lib/dist/extraction/languages/go.js +111 -0
- package/lib/dist/extraction/languages/go.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts +10 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -0
- package/lib/dist/extraction/languages/index.js +71 -0
- package/lib/dist/extraction/languages/index.js.map +1 -0
- package/lib/dist/extraction/languages/java.d.ts +3 -0
- package/lib/dist/extraction/languages/java.d.ts.map +1 -0
- package/lib/dist/extraction/languages/java.js +315 -0
- package/lib/dist/extraction/languages/java.js.map +1 -0
- package/lib/dist/extraction/languages/javascript.d.ts +3 -0
- package/lib/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/javascript.js +106 -0
- package/lib/dist/extraction/languages/javascript.js.map +1 -0
- package/lib/dist/extraction/languages/kotlin.d.ts +3 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/lib/dist/extraction/languages/kotlin.js +379 -0
- package/lib/dist/extraction/languages/kotlin.js.map +1 -0
- package/lib/dist/extraction/languages/lua.d.ts +3 -0
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -0
- package/lib/dist/extraction/languages/lua.js +150 -0
- package/lib/dist/extraction/languages/lua.js.map +1 -0
- package/lib/dist/extraction/languages/luau.d.ts +3 -0
- package/lib/dist/extraction/languages/luau.d.ts.map +1 -0
- package/lib/dist/extraction/languages/luau.js +37 -0
- package/lib/dist/extraction/languages/luau.js.map +1 -0
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/objc.d.ts +3 -0
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -0
- package/lib/dist/extraction/languages/objc.js +175 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -0
- package/lib/dist/extraction/languages/pascal.d.ts +3 -0
- package/lib/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal.js +77 -0
- package/lib/dist/extraction/languages/pascal.js.map +1 -0
- package/lib/dist/extraction/languages/php.d.ts +3 -0
- package/lib/dist/extraction/languages/php.d.ts.map +1 -0
- package/lib/dist/extraction/languages/php.js +196 -0
- package/lib/dist/extraction/languages/php.js.map +1 -0
- package/lib/dist/extraction/languages/python.d.ts +3 -0
- package/lib/dist/extraction/languages/python.d.ts.map +1 -0
- package/lib/dist/extraction/languages/python.js +56 -0
- package/lib/dist/extraction/languages/python.js.map +1 -0
- package/lib/dist/extraction/languages/r.d.ts +3 -0
- package/lib/dist/extraction/languages/r.d.ts.map +1 -0
- package/lib/dist/extraction/languages/r.js +314 -0
- package/lib/dist/extraction/languages/r.js.map +1 -0
- package/lib/dist/extraction/languages/ruby.d.ts +3 -0
- package/lib/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/lib/dist/extraction/languages/ruby.js +149 -0
- package/lib/dist/extraction/languages/ruby.js.map +1 -0
- package/lib/dist/extraction/languages/rust.d.ts +3 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -0
- package/lib/dist/extraction/languages/rust.js +142 -0
- package/lib/dist/extraction/languages/rust.js.map +1 -0
- package/lib/dist/extraction/languages/scala.d.ts +3 -0
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -0
- package/lib/dist/extraction/languages/scala.js +209 -0
- package/lib/dist/extraction/languages/scala.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/swift.d.ts +3 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -0
- package/lib/dist/extraction/languages/swift.js +152 -0
- package/lib/dist/extraction/languages/swift.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/typescript.d.ts +16 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/typescript.js +167 -0
- package/lib/dist/extraction/languages/typescript.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/liquid-extractor.d.ts +59 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/liquid-extractor.js +357 -0
- package/lib/dist/extraction/liquid-extractor.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +68 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.js +300 -0
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +126 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -0
- package/lib/dist/extraction/parse-pool.js +319 -0
- package/lib/dist/extraction/parse-pool.js.map +1 -0
- package/lib/dist/extraction/parse-worker.d.ts +8 -0
- package/lib/dist/extraction/parse-worker.d.ts.map +1 -0
- package/lib/dist/extraction/parse-worker.js +97 -0
- package/lib/dist/extraction/parse-worker.js.map +1 -0
- package/lib/dist/extraction/razor-extractor.d.ts +42 -0
- package/lib/dist/extraction/razor-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/razor-extractor.js +285 -0
- package/lib/dist/extraction/razor-extractor.js.map +1 -0
- package/lib/dist/extraction/svelte-extractor.d.ts +56 -0
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/svelte-extractor.js +275 -0
- package/lib/dist/extraction/svelte-extractor.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js +153 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts +258 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.js +10 -0
- package/lib/dist/extraction/tree-sitter-types.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +706 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter.js +6506 -0
- package/lib/dist/extraction/tree-sitter.js.map +1 -0
- package/lib/dist/extraction/vue-extractor.d.ts +51 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/vue-extractor.js +254 -0
- package/lib/dist/extraction/vue-extractor.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/lib/dist/extraction/wasm-runtime-flags.js +106 -0
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/lib/dist/graph/index.d.ts +8 -0
- package/lib/dist/graph/index.d.ts.map +1 -0
- package/lib/dist/graph/index.js +13 -0
- package/lib/dist/graph/index.js.map +1 -0
- package/lib/dist/graph/queries.d.ts +106 -0
- package/lib/dist/graph/queries.d.ts.map +1 -0
- package/lib/dist/graph/queries.js +339 -0
- package/lib/dist/graph/queries.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +127 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -0
- package/lib/dist/graph/traversal.js +599 -0
- package/lib/dist/graph/traversal.js.map +1 -0
- package/lib/dist/index.d.ts +642 -0
- package/lib/dist/index.d.ts.map +1 -0
- package/lib/dist/index.js +1387 -0
- package/lib/dist/index.js.map +1 -0
- package/lib/dist/installer/config-writer.d.ts +28 -0
- package/lib/dist/installer/config-writer.d.ts.map +1 -0
- package/lib/dist/installer/config-writer.js +91 -0
- package/lib/dist/installer/config-writer.js.map +1 -0
- package/lib/dist/installer/index.d.ts +100 -0
- package/lib/dist/installer/index.d.ts.map +1 -0
- package/lib/dist/installer/index.js +526 -0
- package/lib/dist/installer/index.js.map +1 -0
- package/lib/dist/installer/instructions-template.d.ts +41 -0
- package/lib/dist/installer/instructions-template.d.ts.map +1 -0
- package/lib/dist/installer/instructions-template.js +53 -0
- package/lib/dist/installer/instructions-template.js.map +1 -0
- package/lib/dist/installer/targets/antigravity.d.ts +57 -0
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/lib/dist/installer/targets/antigravity.js +308 -0
- package/lib/dist/installer/targets/antigravity.js.map +1 -0
- package/lib/dist/installer/targets/claude.d.ts +62 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -0
- package/lib/dist/installer/targets/claude.js +454 -0
- package/lib/dist/installer/targets/claude.js.map +1 -0
- package/lib/dist/installer/targets/codex.d.ts +18 -0
- package/lib/dist/installer/targets/codex.d.ts.map +1 -0
- package/lib/dist/installer/targets/codex.js +185 -0
- package/lib/dist/installer/targets/codex.js.map +1 -0
- package/lib/dist/installer/targets/cursor.d.ts +35 -0
- package/lib/dist/installer/targets/cursor.d.ts.map +1 -0
- package/lib/dist/installer/targets/cursor.js +254 -0
- package/lib/dist/installer/targets/cursor.js.map +1 -0
- package/lib/dist/installer/targets/gemini.d.ts +26 -0
- package/lib/dist/installer/targets/gemini.d.ts.map +1 -0
- package/lib/dist/installer/targets/gemini.js +165 -0
- package/lib/dist/installer/targets/gemini.js.map +1 -0
- package/lib/dist/installer/targets/hermes.d.ts +18 -0
- package/lib/dist/installer/targets/hermes.d.ts.map +1 -0
- package/lib/dist/installer/targets/hermes.js +359 -0
- package/lib/dist/installer/targets/hermes.js.map +1 -0
- package/lib/dist/installer/targets/kiro.d.ts +27 -0
- package/lib/dist/installer/targets/kiro.d.ts.map +1 -0
- package/lib/dist/installer/targets/kiro.js +178 -0
- package/lib/dist/installer/targets/kiro.js.map +1 -0
- package/lib/dist/installer/targets/opencode.d.ts +38 -0
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -0
- package/lib/dist/installer/targets/opencode.js +288 -0
- package/lib/dist/installer/targets/opencode.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts +35 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -0
- package/lib/dist/installer/targets/registry.js +91 -0
- package/lib/dist/installer/targets/registry.js.map +1 -0
- package/lib/dist/installer/targets/shared.d.ts +101 -0
- package/lib/dist/installer/targets/shared.d.ts.map +1 -0
- package/lib/dist/installer/targets/shared.js +264 -0
- package/lib/dist/installer/targets/shared.js.map +1 -0
- package/lib/dist/installer/targets/toml.d.ts +52 -0
- package/lib/dist/installer/targets/toml.d.ts.map +1 -0
- package/lib/dist/installer/targets/toml.js +147 -0
- package/lib/dist/installer/targets/toml.js.map +1 -0
- package/lib/dist/installer/targets/types.d.ts +108 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -0
- package/lib/dist/installer/targets/types.js +16 -0
- package/lib/dist/installer/targets/types.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts +42 -0
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-manager.js +129 -0
- package/lib/dist/mcp/daemon-manager.js.map +1 -0
- package/lib/dist/mcp/daemon-paths.d.ts +73 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-paths.js +165 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -0
- package/lib/dist/mcp/daemon-registry.d.ts +47 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-registry.js +233 -0
- package/lib/dist/mcp/daemon-registry.js.map +1 -0
- package/lib/dist/mcp/daemon.d.ts +290 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -0
- package/lib/dist/mcp/daemon.js +840 -0
- package/lib/dist/mcp/daemon.js.map +1 -0
- package/lib/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/lib/dist/mcp/dynamic-boundaries.js +360 -0
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/engine.d.ts +122 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -0
- package/lib/dist/mcp/engine.js +350 -0
- package/lib/dist/mcp/engine.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +113 -0
- package/lib/dist/mcp/index.d.ts.map +1 -0
- package/lib/dist/mcp/index.js +498 -0
- package/lib/dist/mcp/index.js.map +1 -0
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/lib/dist/mcp/liveness-watchdog.js +207 -0
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -0
- package/lib/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/lib/dist/mcp/ppid-watchdog.js +64 -0
- package/lib/dist/mcp/ppid-watchdog.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +87 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -0
- package/lib/dist/mcp/proxy.js +659 -0
- package/lib/dist/mcp/proxy.js.map +1 -0
- package/lib/dist/mcp/query-pool.d.ts +94 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -0
- package/lib/dist/mcp/query-pool.js +297 -0
- package/lib/dist/mcp/query-pool.js.map +1 -0
- package/lib/dist/mcp/query-worker.d.ts +24 -0
- package/lib/dist/mcp/query-worker.d.ts.map +1 -0
- package/lib/dist/mcp/query-worker.js +87 -0
- package/lib/dist/mcp/query-worker.js.map +1 -0
- package/lib/dist/mcp/server-instructions.d.ts +34 -0
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -0
- package/lib/dist/mcp/server-instructions.js +106 -0
- package/lib/dist/mcp/server-instructions.js.map +1 -0
- package/lib/dist/mcp/session.d.ts +79 -0
- package/lib/dist/mcp/session.d.ts.map +1 -0
- package/lib/dist/mcp/session.js +330 -0
- package/lib/dist/mcp/session.js.map +1 -0
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/stdin-teardown.d.ts +27 -0
- package/lib/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/lib/dist/mcp/stdin-teardown.js +49 -0
- package/lib/dist/mcp/stdin-teardown.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +613 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -0
- package/lib/dist/mcp/tools.js +4424 -0
- package/lib/dist/mcp/tools.js.map +1 -0
- package/lib/dist/mcp/transport.d.ts +188 -0
- package/lib/dist/mcp/transport.d.ts.map +1 -0
- package/lib/dist/mcp/transport.js +359 -0
- package/lib/dist/mcp/transport.js.map +1 -0
- package/lib/dist/mcp/version.d.ts +19 -0
- package/lib/dist/mcp/version.d.ts.map +1 -0
- package/lib/dist/mcp/version.js +71 -0
- package/lib/dist/mcp/version.js.map +1 -0
- package/lib/dist/project-config.d.ts +94 -0
- package/lib/dist/project-config.d.ts.map +1 -0
- package/lib/dist/project-config.js +374 -0
- package/lib/dist/project-config.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +5 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js +1038 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +15 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.js +3658 -0
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -0
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts +9 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/astro.js +169 -0
- package/lib/dist/resolution/frameworks/astro.js.map +1 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.js +241 -0
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -0
- package/lib/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/drupal.js +367 -0
- package/lib/dist/resolution/frameworks/drupal.js.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.js +148 -0
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts +8 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/express.js +308 -0
- package/lib/dist/resolution/frameworks/express.js.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.js +354 -0
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -0
- package/lib/dist/resolution/frameworks/go.d.ts +8 -0
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/go.js +161 -0
- package/lib/dist/resolution/frameworks/go.js.map +1 -0
- package/lib/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/lib/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/goframe.js +112 -0
- package/lib/dist/resolution/frameworks/goframe.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts +50 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/index.js +175 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -0
- package/lib/dist/resolution/frameworks/java.d.ts +8 -0
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/java.js +517 -0
- package/lib/dist/resolution/frameworks/java.js.map +1 -0
- package/lib/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/laravel.js +257 -0
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.js +698 -0
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts +19 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/play.js +111 -0
- package/lib/dist/resolution/frameworks/play.js.map +1 -0
- package/lib/dist/resolution/frameworks/python.d.ts +10 -0
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/python.js +400 -0
- package/lib/dist/resolution/frameworks/python.js.map +1 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-native.js +410 -0
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +8 -0
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react.js +334 -0
- package/lib/dist/resolution/frameworks/react.js.map +1 -0
- package/lib/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/ruby.js +302 -0
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -0
- package/lib/dist/resolution/frameworks/rust.d.ts +8 -0
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/rust.js +304 -0
- package/lib/dist/resolution/frameworks/rust.js.map +1 -0
- package/lib/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/svelte.js +253 -0
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.js +252 -0
- package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts +10 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/swift.js +400 -0
- package/lib/dist/resolution/frameworks/swift.js.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -0
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue.js +303 -0
- package/lib/dist/resolution/frameworks/vue.js.map +1 -0
- package/lib/dist/resolution/go-module.d.ts +26 -0
- package/lib/dist/resolution/go-module.d.ts.map +1 -0
- package/lib/dist/resolution/go-module.js +78 -0
- package/lib/dist/resolution/go-module.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +28 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.js +158 -0
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/lib/dist/resolution/import-resolver.d.ts +85 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -0
- package/lib/dist/resolution/import-resolver.js +1974 -0
- package/lib/dist/resolution/import-resolver.js.map +1 -0
- package/lib/dist/resolution/index.d.ts +238 -0
- package/lib/dist/resolution/index.d.ts.map +1 -0
- package/lib/dist/resolution/index.js +1633 -0
- package/lib/dist/resolution/index.js.map +1 -0
- package/lib/dist/resolution/lru-cache.d.ts +24 -0
- package/lib/dist/resolution/lru-cache.d.ts.map +1 -0
- package/lib/dist/resolution/lru-cache.js +62 -0
- package/lib/dist/resolution/lru-cache.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +112 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -0
- package/lib/dist/resolution/name-matcher.js +1701 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -0
- package/lib/dist/resolution/path-aliases.d.ts +68 -0
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -0
- package/lib/dist/resolution/path-aliases.js +238 -0
- package/lib/dist/resolution/path-aliases.js.map +1 -0
- package/lib/dist/resolution/strip-comments.d.ts +27 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -0
- package/lib/dist/resolution/strip-comments.js +492 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -0
- package/lib/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/lib/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/lib/dist/resolution/swift-objc-bridge.js +256 -0
- package/lib/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +253 -0
- package/lib/dist/resolution/types.d.ts.map +1 -0
- package/lib/dist/resolution/types.js +8 -0
- package/lib/dist/resolution/types.js.map +1 -0
- package/lib/dist/resolution/workspace-packages.d.ts +58 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/lib/dist/resolution/workspace-packages.js +346 -0
- package/lib/dist/resolution/workspace-packages.js.map +1 -0
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/search/query-parser.d.ts +57 -0
- package/lib/dist/search/query-parser.d.ts.map +1 -0
- package/lib/dist/search/query-parser.js +177 -0
- package/lib/dist/search/query-parser.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +87 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -0
- package/lib/dist/search/query-utils.js +449 -0
- package/lib/dist/search/query-utils.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts +45 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -0
- package/lib/dist/sync/git-hooks.js +227 -0
- package/lib/dist/sync/git-hooks.js.map +1 -0
- package/lib/dist/sync/index.d.ts +19 -0
- package/lib/dist/sync/index.d.ts.map +1 -0
- package/lib/dist/sync/index.js +35 -0
- package/lib/dist/sync/index.js.map +1 -0
- package/lib/dist/sync/watch-policy.d.ts +48 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -0
- package/lib/dist/sync/watch-policy.js +124 -0
- package/lib/dist/sync/watch-policy.js.map +1 -0
- package/lib/dist/sync/watcher.d.ts +355 -0
- package/lib/dist/sync/watcher.d.ts.map +1 -0
- package/lib/dist/sync/watcher.js +848 -0
- package/lib/dist/sync/watcher.js.map +1 -0
- package/lib/dist/sync/worktree.d.ts +63 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -0
- package/lib/dist/sync/worktree.js +182 -0
- package/lib/dist/sync/worktree.js.map +1 -0
- package/lib/dist/telemetry/index.d.ts +143 -0
- package/lib/dist/telemetry/index.d.ts.map +1 -0
- package/lib/dist/telemetry/index.js +541 -0
- package/lib/dist/telemetry/index.js.map +1 -0
- package/lib/dist/types.d.ts +415 -0
- package/lib/dist/types.d.ts.map +1 -0
- package/lib/dist/types.js +91 -0
- package/lib/dist/types.js.map +1 -0
- package/lib/dist/ui/glyphs.d.ts +42 -0
- package/lib/dist/ui/glyphs.d.ts.map +1 -0
- package/lib/dist/ui/glyphs.js +78 -0
- package/lib/dist/ui/glyphs.js.map +1 -0
- package/lib/dist/ui/shimmer-progress.d.ts +11 -0
- package/lib/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/lib/dist/ui/shimmer-progress.js +90 -0
- package/lib/dist/ui/shimmer-progress.js.map +1 -0
- package/lib/dist/ui/shimmer-worker.d.ts +2 -0
- package/lib/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/lib/dist/ui/shimmer-worker.js +118 -0
- package/lib/dist/ui/shimmer-worker.js.map +1 -0
- package/lib/dist/ui/types.d.ts +17 -0
- package/lib/dist/ui/types.d.ts.map +1 -0
- package/lib/dist/ui/types.js +3 -0
- package/lib/dist/ui/types.js.map +1 -0
- package/lib/dist/upgrade/index.d.ts +132 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -0
- package/lib/dist/upgrade/index.js +498 -0
- package/lib/dist/upgrade/index.js.map +1 -0
- package/lib/dist/utils.d.ts +224 -0
- package/lib/dist/utils.d.ts.map +1 -0
- package/lib/dist/utils.js +583 -0
- package/lib/dist/utils.js.map +1 -0
- package/lib/node_modules/.package-lock.json +125 -0
- package/lib/node_modules/@clack/core/CHANGELOG.md +348 -0
- package/lib/node_modules/@clack/core/LICENSE +9 -0
- package/lib/node_modules/@clack/core/README.md +22 -0
- package/lib/node_modules/@clack/core/dist/index.d.mts +363 -0
- package/lib/node_modules/@clack/core/dist/index.mjs +17 -0
- package/lib/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/lib/node_modules/@clack/core/package.json +63 -0
- package/lib/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/lib/node_modules/@clack/prompts/LICENSE +9 -0
- package/lib/node_modules/@clack/prompts/README.md +375 -0
- package/lib/node_modules/@clack/prompts/dist/index.d.mts +396 -0
- package/lib/node_modules/@clack/prompts/dist/index.mjs +144 -0
- package/lib/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/lib/node_modules/@clack/prompts/package.json +68 -0
- package/lib/node_modules/commander/LICENSE +22 -0
- package/lib/node_modules/commander/Readme.md +1176 -0
- package/lib/node_modules/commander/esm.mjs +16 -0
- package/lib/node_modules/commander/index.js +24 -0
- package/lib/node_modules/commander/lib/argument.js +150 -0
- package/lib/node_modules/commander/lib/command.js +2777 -0
- package/lib/node_modules/commander/lib/error.js +39 -0
- package/lib/node_modules/commander/lib/help.js +747 -0
- package/lib/node_modules/commander/lib/option.js +380 -0
- package/lib/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/lib/node_modules/commander/package-support.json +19 -0
- package/lib/node_modules/commander/package.json +82 -0
- package/lib/node_modules/commander/typings/esm.d.mts +3 -0
- package/lib/node_modules/commander/typings/index.d.ts +1113 -0
- package/lib/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/lib/node_modules/fast-string-truncated-width/dist/index.js +111 -0
- package/lib/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
- package/lib/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/lib/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/lib/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
- package/lib/node_modules/fast-string-truncated-width/license +21 -0
- package/lib/node_modules/fast-string-truncated-width/package.json +35 -0
- package/lib/node_modules/fast-string-truncated-width/readme.md +59 -0
- package/lib/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/lib/node_modules/fast-string-width/dist/index.js +14 -0
- package/lib/node_modules/fast-string-width/license +21 -0
- package/lib/node_modules/fast-string-width/package.json +34 -0
- package/lib/node_modules/fast-string-width/readme.md +42 -0
- package/lib/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/lib/node_modules/fast-wrap-ansi/README.md +26 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.js +219 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
- package/lib/node_modules/fast-wrap-ansi/package.json +51 -0
- package/lib/node_modules/ignore/LICENSE-MIT +21 -0
- package/lib/node_modules/ignore/README.md +452 -0
- package/lib/node_modules/ignore/index.d.ts +81 -0
- package/lib/node_modules/ignore/index.js +784 -0
- package/lib/node_modules/ignore/legacy.js +681 -0
- package/lib/node_modules/ignore/package.json +87 -0
- package/lib/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/lib/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/lib/node_modules/jsonc-parser/README.md +364 -0
- package/lib/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/lib/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/lib/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/lib/node_modules/jsonc-parser/package.json +37 -0
- package/lib/node_modules/picomatch/LICENSE +21 -0
- package/lib/node_modules/picomatch/README.md +738 -0
- package/lib/node_modules/picomatch/index.js +17 -0
- package/lib/node_modules/picomatch/lib/constants.js +180 -0
- package/lib/node_modules/picomatch/lib/parse.js +1085 -0
- package/lib/node_modules/picomatch/lib/picomatch.js +341 -0
- package/lib/node_modules/picomatch/lib/scan.js +391 -0
- package/lib/node_modules/picomatch/lib/utils.js +72 -0
- package/lib/node_modules/picomatch/package.json +83 -0
- package/lib/node_modules/picomatch/posix.js +3 -0
- package/lib/node_modules/sisteransi/license +21 -0
- package/lib/node_modules/sisteransi/package.json +34 -0
- package/lib/node_modules/sisteransi/readme.md +113 -0
- package/lib/node_modules/sisteransi/src/index.js +58 -0
- package/lib/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/lib/node_modules/tree-sitter-wasms/LICENSE +24 -0
- package/lib/node_modules/tree-sitter-wasms/README.md +23 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/package.json +64 -0
- package/lib/node_modules/web-tree-sitter/LICENSE +21 -0
- package/lib/node_modules/web-tree-sitter/README.md +269 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
- package/lib/node_modules/web-tree-sitter/lib/alloc.c +48 -0
- package/lib/node_modules/web-tree-sitter/lib/alloc.h +41 -0
- package/lib/node_modules/web-tree-sitter/lib/array.h +291 -0
- package/lib/node_modules/web-tree-sitter/lib/atomic.h +68 -0
- package/lib/node_modules/web-tree-sitter/lib/clock.h +146 -0
- package/lib/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
- package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
- package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
- package/lib/node_modules/web-tree-sitter/lib/host.h +21 -0
- package/lib/node_modules/web-tree-sitter/lib/language.c +293 -0
- package/lib/node_modules/web-tree-sitter/lib/language.h +293 -0
- package/lib/node_modules/web-tree-sitter/lib/length.h +52 -0
- package/lib/node_modules/web-tree-sitter/lib/lexer.c +483 -0
- package/lib/node_modules/web-tree-sitter/lib/lexer.h +54 -0
- package/lib/node_modules/web-tree-sitter/lib/lib.c +12 -0
- package/lib/node_modules/web-tree-sitter/lib/node.c +875 -0
- package/lib/node_modules/web-tree-sitter/lib/parser.c +2297 -0
- package/lib/node_modules/web-tree-sitter/lib/parser.h +286 -0
- package/lib/node_modules/web-tree-sitter/lib/point.h +48 -0
- package/lib/node_modules/web-tree-sitter/lib/query.c +4347 -0
- package/lib/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
- package/lib/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
- package/lib/node_modules/web-tree-sitter/lib/stack.c +912 -0
- package/lib/node_modules/web-tree-sitter/lib/stack.h +133 -0
- package/lib/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
- package/lib/node_modules/web-tree-sitter/lib/subtree.h +399 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
- package/lib/node_modules/web-tree-sitter/lib/tree.c +170 -0
- package/lib/node_modules/web-tree-sitter/lib/tree.h +31 -0
- package/lib/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
- package/lib/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
- package/lib/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
- package/lib/node_modules/web-tree-sitter/lib/unicode.h +75 -0
- package/lib/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
- package/lib/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
- package/lib/node_modules/web-tree-sitter/package.json +98 -0
- package/lib/node_modules/web-tree-sitter/src/bindings.ts +26 -0
- package/lib/node_modules/web-tree-sitter/src/constants.ts +133 -0
- package/lib/node_modules/web-tree-sitter/src/index.ts +31 -0
- package/lib/node_modules/web-tree-sitter/src/language.ts +291 -0
- package/lib/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
- package/lib/node_modules/web-tree-sitter/src/marshal.ts +176 -0
- package/lib/node_modules/web-tree-sitter/src/node.ts +646 -0
- package/lib/node_modules/web-tree-sitter/src/parser.ts +325 -0
- package/lib/node_modules/web-tree-sitter/src/query.ts +973 -0
- package/lib/node_modules/web-tree-sitter/src/tree.ts +145 -0
- package/lib/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
- package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
- package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
- package/lib/package.json +64 -0
- package/node +0 -0
- package/package.json +17 -0
|
@@ -0,0 +1,1633 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Reference Resolution Orchestrator
|
|
4
|
+
*
|
|
5
|
+
* Coordinates all reference resolution strategies.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
41
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.ReferenceResolver = void 0;
|
|
45
|
+
exports.createResolver = createResolver;
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const name_matcher_1 = require("./name-matcher");
|
|
49
|
+
const import_resolver_1 = require("./import-resolver");
|
|
50
|
+
const frameworks_1 = require("./frameworks");
|
|
51
|
+
const callback_synthesizer_1 = require("./callback-synthesizer");
|
|
52
|
+
const cooperative_yield_1 = require("./cooperative-yield");
|
|
53
|
+
const path_aliases_1 = require("./path-aliases");
|
|
54
|
+
const go_module_1 = require("./go-module");
|
|
55
|
+
const workspace_packages_1 = require("./workspace-packages");
|
|
56
|
+
const errors_1 = require("../errors");
|
|
57
|
+
const lru_cache_1 = require("./lru-cache");
|
|
58
|
+
/** Node kinds that can declare supertypes (extends/implements). */
|
|
59
|
+
const SUPERTYPE_BEARING_KINDS = new Set([
|
|
60
|
+
'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
|
|
61
|
+
]);
|
|
62
|
+
/**
|
|
63
|
+
* Languages whose chained static-factory/fluent calls defer to the conformance
|
|
64
|
+
* second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
|
|
65
|
+
* `::`-receiver ones (Rust) via matchScopedCallChain.
|
|
66
|
+
*/
|
|
67
|
+
const CHAIN_LANGUAGES = new Set(['java', 'kotlin', 'csharp', 'swift', 'rust', 'go', 'scala', 'dart', 'objc', 'pascal']);
|
|
68
|
+
const SCOPED_CHAIN_LANGUAGES = new Set(['rust']);
|
|
69
|
+
/** The extractor's chained-receiver encoding: `<inner>().<method>`. */
|
|
70
|
+
const CHAIN_SHAPE = /^(.+)\(\)\.(\w+)$/;
|
|
71
|
+
/**
|
|
72
|
+
* Cache size limits. Each per-resolver cache is bounded so memory
|
|
73
|
+
* stays flat on large codebases (20k+ files). Sizes were chosen to
|
|
74
|
+
* cover the working set for typical resolution batches without
|
|
75
|
+
* exceeding a few hundred MB worst-case. Override via the env var
|
|
76
|
+
* `BHGRAPH_RESOLVER_CACHE_SIZE` (single integer applied to all
|
|
77
|
+
* caches) when tuning for very large or very small projects.
|
|
78
|
+
*/
|
|
79
|
+
const DEFAULT_CACHE_LIMIT = 5_000;
|
|
80
|
+
function resolveCacheLimit() {
|
|
81
|
+
const raw = process.env.BHGRAPH_RESOLVER_CACHE_SIZE;
|
|
82
|
+
if (!raw)
|
|
83
|
+
return DEFAULT_CACHE_LIMIT;
|
|
84
|
+
const parsed = Number.parseInt(raw, 10);
|
|
85
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
86
|
+
return parsed;
|
|
87
|
+
return DEFAULT_CACHE_LIMIT;
|
|
88
|
+
}
|
|
89
|
+
// Re-export types
|
|
90
|
+
__exportStar(require("./types"), exports);
|
|
91
|
+
// Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
|
|
92
|
+
const JS_BUILT_INS = new Set([
|
|
93
|
+
'console', 'window', 'document', 'global', 'process',
|
|
94
|
+
'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
|
|
95
|
+
'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
|
|
96
|
+
'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
|
|
97
|
+
'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
|
|
98
|
+
]);
|
|
99
|
+
const REACT_HOOKS = new Set([
|
|
100
|
+
'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
|
|
101
|
+
'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
|
|
102
|
+
]);
|
|
103
|
+
const PYTHON_BUILT_INS = new Set([
|
|
104
|
+
'print', 'len', 'range', 'str', 'int', 'float', 'list', 'dict', 'set', 'tuple',
|
|
105
|
+
'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
|
|
106
|
+
'super', 'self', 'cls', 'None', 'True', 'False',
|
|
107
|
+
]);
|
|
108
|
+
const PYTHON_BUILT_IN_TYPES = new Set([
|
|
109
|
+
'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
|
|
110
|
+
'bytes', 'bytearray', 'frozenset', 'object', 'super',
|
|
111
|
+
]);
|
|
112
|
+
const PYTHON_BUILT_IN_METHODS = new Set([
|
|
113
|
+
'append', 'extend', 'insert', 'remove', 'pop', 'clear', 'sort', 'reverse', 'copy',
|
|
114
|
+
'update', 'keys', 'values', 'items', 'get',
|
|
115
|
+
'add', 'discard', 'union', 'intersection', 'difference',
|
|
116
|
+
'split', 'join', 'strip', 'lstrip', 'rstrip', 'replace', 'lower', 'upper',
|
|
117
|
+
'startswith', 'endswith', 'find', 'index', 'count', 'encode', 'decode',
|
|
118
|
+
'format', 'isdigit', 'isalpha', 'isalnum',
|
|
119
|
+
'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
|
|
120
|
+
]);
|
|
121
|
+
const GO_STDLIB_PACKAGES = new Set([
|
|
122
|
+
'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
|
|
123
|
+
'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
|
|
124
|
+
'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
|
|
125
|
+
'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
|
|
126
|
+
'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
|
|
127
|
+
'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
|
|
128
|
+
'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
|
|
129
|
+
'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
|
|
130
|
+
'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
|
|
131
|
+
// Kubernetes-common stdlib aliases
|
|
132
|
+
'utilruntime', 'utilwait', 'utilnet',
|
|
133
|
+
]);
|
|
134
|
+
const GO_BUILT_INS = new Set([
|
|
135
|
+
'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
|
|
136
|
+
'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
|
|
137
|
+
'error', 'nil', 'true', 'false', 'iota',
|
|
138
|
+
'int', 'int8', 'int16', 'int32', 'int64',
|
|
139
|
+
'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uintptr',
|
|
140
|
+
'float32', 'float64', 'complex64', 'complex128',
|
|
141
|
+
'string', 'bool', 'byte', 'rune', 'any',
|
|
142
|
+
]);
|
|
143
|
+
const PASCAL_UNIT_PREFIXES = [
|
|
144
|
+
'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
|
|
145
|
+
'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
|
|
146
|
+
'IdHTTP', 'IdTCP', 'IdSSL',
|
|
147
|
+
];
|
|
148
|
+
const PASCAL_BUILT_INS = new Set([
|
|
149
|
+
'System', 'SysUtils', 'Classes', 'Types', 'Variants', 'StrUtils',
|
|
150
|
+
'Math', 'DateUtils', 'IOUtils', 'Generics.Collections', 'Generics.Defaults',
|
|
151
|
+
'Rtti', 'TypInfo', 'SyncObjs', 'RegularExpressions',
|
|
152
|
+
'SysInit', 'Windows', 'Messages', 'Graphics', 'Controls', 'Forms',
|
|
153
|
+
'Dialogs', 'StdCtrls', 'ExtCtrls', 'ComCtrls', 'Menus', 'ActnList',
|
|
154
|
+
'WriteLn', 'Write', 'ReadLn', 'Read', 'Inc', 'Dec', 'Ord', 'Chr',
|
|
155
|
+
'Length', 'SetLength', 'High', 'Low', 'Assigned', 'FreeAndNil',
|
|
156
|
+
'Format', 'IntToStr', 'StrToInt', 'FloatToStr', 'StrToFloat',
|
|
157
|
+
'Trim', 'UpperCase', 'LowerCase', 'Pos', 'Copy', 'Delete', 'Insert',
|
|
158
|
+
'Now', 'Date', 'Time', 'DateToStr', 'StrToDate',
|
|
159
|
+
'Raise', 'Exit', 'Break', 'Continue', 'Abort',
|
|
160
|
+
'True', 'False', 'nil', 'Self', 'Result',
|
|
161
|
+
'Create', 'Destroy', 'Free',
|
|
162
|
+
'TObject', 'TComponent', 'TPersistent', 'TInterfacedObject',
|
|
163
|
+
'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
|
|
164
|
+
'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
|
|
165
|
+
'IInterface', 'IUnknown',
|
|
166
|
+
]);
|
|
167
|
+
const C_BUILT_INS = new Set([
|
|
168
|
+
// Standard C library functions
|
|
169
|
+
'printf', 'fprintf', 'sprintf', 'snprintf', 'scanf', 'fscanf', 'sscanf',
|
|
170
|
+
'malloc', 'calloc', 'realloc', 'free',
|
|
171
|
+
'memcpy', 'memmove', 'memset', 'memcmp', 'memchr',
|
|
172
|
+
'strlen', 'strcpy', 'strncpy', 'strcat', 'strncat', 'strcmp', 'strncmp',
|
|
173
|
+
'strstr', 'strchr', 'strrchr', 'strtok', 'strdup',
|
|
174
|
+
'fopen', 'fclose', 'fread', 'fwrite', 'fgets', 'fputs', 'fputc', 'fgetc',
|
|
175
|
+
'feof', 'ferror', 'fflush', 'fseek', 'ftell', 'rewind',
|
|
176
|
+
'exit', 'abort', 'atexit', 'atoi', 'atol', 'atof', 'strtol', 'strtoul', 'strtod',
|
|
177
|
+
'qsort', 'bsearch',
|
|
178
|
+
'abs', 'labs', 'rand', 'srand',
|
|
179
|
+
'sin', 'cos', 'tan', 'sqrt', 'pow', 'log', 'log10', 'exp', 'ceil', 'floor', 'fabs',
|
|
180
|
+
'time', 'clock', 'difftime', 'mktime', 'localtime', 'gmtime', 'strftime', 'asctime',
|
|
181
|
+
'assert', 'errno',
|
|
182
|
+
'perror', 'remove', 'rename', 'tmpfile', 'tmpnam',
|
|
183
|
+
'getenv', 'system',
|
|
184
|
+
'signal', 'raise',
|
|
185
|
+
'setjmp', 'longjmp',
|
|
186
|
+
'va_start', 'va_end', 'va_arg', 'va_copy',
|
|
187
|
+
'NULL', 'EOF', 'BUFSIZ', 'FILENAME_MAX', 'RAND_MAX', 'EXIT_SUCCESS', 'EXIT_FAILURE',
|
|
188
|
+
'size_t', 'ptrdiff_t', 'wchar_t', 'intptr_t', 'uintptr_t',
|
|
189
|
+
'int8_t', 'int16_t', 'int32_t', 'int64_t',
|
|
190
|
+
'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
|
|
191
|
+
'FILE',
|
|
192
|
+
// POSIX additions commonly seen
|
|
193
|
+
'stat', 'lstat', 'fstat', 'open', 'close', 'read', 'write', 'pipe',
|
|
194
|
+
'fork', 'exec', 'waitpid', 'getpid', 'getppid', 'kill', 'sleep', 'usleep',
|
|
195
|
+
'pthread_create', 'pthread_join', 'pthread_mutex_lock', 'pthread_mutex_unlock',
|
|
196
|
+
'dlopen', 'dlsym', 'dlclose',
|
|
197
|
+
]);
|
|
198
|
+
const CPP_BUILT_INS = new Set([
|
|
199
|
+
// iostream objects (often used without std:: prefix via using)
|
|
200
|
+
'cout', 'cin', 'cerr', 'clog', 'endl', 'flush', 'ws',
|
|
201
|
+
'std', // the namespace itself when used as std::something
|
|
202
|
+
// Common C++ keywords that leak as references
|
|
203
|
+
'nullptr', 'true', 'false', 'this', 'sizeof', 'alignof', 'typeid',
|
|
204
|
+
'static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast',
|
|
205
|
+
'make_unique', 'make_shared', 'make_pair',
|
|
206
|
+
'move', 'forward', 'swap',
|
|
207
|
+
]);
|
|
208
|
+
/**
|
|
209
|
+
* Reference Resolver
|
|
210
|
+
*
|
|
211
|
+
* Orchestrates reference resolution using multiple strategies.
|
|
212
|
+
*/
|
|
213
|
+
class ReferenceResolver {
|
|
214
|
+
projectRoot;
|
|
215
|
+
queries;
|
|
216
|
+
context;
|
|
217
|
+
frameworks = [];
|
|
218
|
+
// Chained static-factory/fluent call refs the first pass couldn't resolve,
|
|
219
|
+
// collected in-memory (the batched resolver deletes unresolved refs from the
|
|
220
|
+
// DB, so they can't be re-read). Drained by resolveChainedCallsViaConformance
|
|
221
|
+
// once implements/extends edges exist, to resolve methods on a supertype the
|
|
222
|
+
// receiver conforms to (#750).
|
|
223
|
+
deferredChainRefs = [];
|
|
224
|
+
// `this.<member>` function-as-value refs whose member is NOT on the
|
|
225
|
+
// enclosing class itself — possibly inherited. Collected in-memory for the
|
|
226
|
+
// same reason as deferredChainRefs and drained by
|
|
227
|
+
// resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
|
|
228
|
+
deferredThisMemberRefs = [];
|
|
229
|
+
// Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
|
|
230
|
+
// `_Imports.razor`, cascading to the project root). Used to disambiguate a
|
|
231
|
+
// markup type ref to the right C# namespace.
|
|
232
|
+
razorUsingsCache = new Map();
|
|
233
|
+
// All per-resolver caches are LRU-bounded. Previously these were
|
|
234
|
+
// unbounded Maps that grew with every distinct lookup and OOM'd on
|
|
235
|
+
// codebases with 20k+ files (see issue: unbounded cache growth).
|
|
236
|
+
nodeCache; // per-file node cache
|
|
237
|
+
fileCache; // per-file content cache
|
|
238
|
+
importMappingCache;
|
|
239
|
+
reExportCache;
|
|
240
|
+
nameCache; // name → nodes cache
|
|
241
|
+
lowerNameCache; // lower(name) → nodes cache
|
|
242
|
+
qualifiedNameCache; // qualified_name → nodes cache
|
|
243
|
+
fileLinesCache; // file → split lines cache
|
|
244
|
+
methodMatchCache; // lang\0Type::method → matching method nodes
|
|
245
|
+
// Node kinds are a small fixed set (~24), so this is a plain Map, not an LRU.
|
|
246
|
+
// getNodesByKind returns the FULL node list for a kind; it was previously
|
|
247
|
+
// uncached — a per-ref `SELECT * FROM nodes WHERE kind=?` + row-mapping. Called
|
|
248
|
+
// for every dotted call ref by the Spring resolver (constants) and every
|
|
249
|
+
// `hook_` ref by the Drupal resolver (functions), that scan dominated
|
|
250
|
+
// resolution on large repos (#1180). The node set is stable within a
|
|
251
|
+
// resolution pass (same lifetime assumption as nameCache); clearCaches() resets
|
|
252
|
+
// it between passes. Callers must treat the returned array as read-only.
|
|
253
|
+
nodesByKindCache = new Map();
|
|
254
|
+
knownNames = null; // all known symbol names for fast pre-filtering
|
|
255
|
+
knownFiles = null;
|
|
256
|
+
cachesWarmed = false;
|
|
257
|
+
// tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
|
|
258
|
+
// `null` = computed and absent. Treated as immutable for the
|
|
259
|
+
// resolver's lifetime; callers re-create the resolver if config changes.
|
|
260
|
+
projectAliases = undefined;
|
|
261
|
+
// go.mod module path. Same lazy/immutable convention as projectAliases.
|
|
262
|
+
goModule = undefined;
|
|
263
|
+
// Monorepo workspace member packages. Same lazy/immutable convention.
|
|
264
|
+
workspacePackages = undefined;
|
|
265
|
+
constructor(projectRoot, queries) {
|
|
266
|
+
this.projectRoot = projectRoot;
|
|
267
|
+
this.queries = queries;
|
|
268
|
+
const limit = resolveCacheLimit();
|
|
269
|
+
// The content cache is heavier (full file text), so we give it a
|
|
270
|
+
// smaller budget than the metadata caches.
|
|
271
|
+
const contentLimit = Math.max(64, Math.floor(limit / 5));
|
|
272
|
+
this.nodeCache = new lru_cache_1.LRUCache(limit);
|
|
273
|
+
this.fileCache = new lru_cache_1.LRUCache(contentLimit);
|
|
274
|
+
this.importMappingCache = new lru_cache_1.LRUCache(limit);
|
|
275
|
+
this.reExportCache = new lru_cache_1.LRUCache(limit);
|
|
276
|
+
this.nameCache = new lru_cache_1.LRUCache(limit);
|
|
277
|
+
this.lowerNameCache = new lru_cache_1.LRUCache(limit);
|
|
278
|
+
this.qualifiedNameCache = new lru_cache_1.LRUCache(limit);
|
|
279
|
+
// Split-lines arrays are heavier than content strings; refs arrive
|
|
280
|
+
// file-ordered, so a small cache still hits nearly always.
|
|
281
|
+
this.fileLinesCache = new lru_cache_1.LRUCache(contentLimit);
|
|
282
|
+
this.methodMatchCache = new lru_cache_1.LRUCache(limit);
|
|
283
|
+
this.context = this.createContext();
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Initialize the resolver (detect frameworks, etc.)
|
|
287
|
+
*/
|
|
288
|
+
initialize() {
|
|
289
|
+
this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
|
|
290
|
+
this.clearCaches();
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Run each framework resolver's cross-file finalization pass and persist
|
|
294
|
+
* the returned node updates. Idempotent — safe to call after every indexAll
|
|
295
|
+
* and every incremental sync. Returns the number of nodes updated.
|
|
296
|
+
*
|
|
297
|
+
* Caches are cleared before/after so the post-extract pass sees fresh DB
|
|
298
|
+
* state and downstream queries see the updated names.
|
|
299
|
+
*/
|
|
300
|
+
runPostExtract() {
|
|
301
|
+
let updated = 0;
|
|
302
|
+
this.clearCaches();
|
|
303
|
+
for (const fw of this.frameworks) {
|
|
304
|
+
if (!fw.postExtract)
|
|
305
|
+
continue;
|
|
306
|
+
try {
|
|
307
|
+
const nodes = fw.postExtract(this.context);
|
|
308
|
+
for (const node of nodes) {
|
|
309
|
+
this.queries.updateNode(node);
|
|
310
|
+
updated++;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
(0, errors_1.logDebug)(`Framework '${fw.name}' postExtract failed`, {
|
|
315
|
+
error: err instanceof Error ? err.message : String(err),
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (updated > 0)
|
|
320
|
+
this.clearCaches();
|
|
321
|
+
return updated;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Pre-build lightweight caches for resolution.
|
|
325
|
+
* Node lookups are now handled by indexed SQLite queries instead of
|
|
326
|
+
* loading all nodes into memory (which caused OOM on large codebases).
|
|
327
|
+
* We cache the set of known symbol names for fast pre-filtering.
|
|
328
|
+
*/
|
|
329
|
+
warmCaches() {
|
|
330
|
+
if (this.cachesWarmed)
|
|
331
|
+
return;
|
|
332
|
+
// Only cache the set of known file paths (lightweight string set)
|
|
333
|
+
this.knownFiles = new Set(this.queries.getAllFilePaths());
|
|
334
|
+
// Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
|
|
335
|
+
this.knownNames = new Set(this.queries.getAllNodeNames());
|
|
336
|
+
this.cachesWarmed = true;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Clear internal caches
|
|
340
|
+
*/
|
|
341
|
+
clearCaches() {
|
|
342
|
+
this.nodeCache.clear();
|
|
343
|
+
this.fileCache.clear();
|
|
344
|
+
this.importMappingCache.clear();
|
|
345
|
+
this.reExportCache.clear();
|
|
346
|
+
this.nameCache.clear();
|
|
347
|
+
this.lowerNameCache.clear();
|
|
348
|
+
this.qualifiedNameCache.clear();
|
|
349
|
+
this.fileLinesCache.clear();
|
|
350
|
+
this.methodMatchCache.clear();
|
|
351
|
+
this.nodesByKindCache.clear();
|
|
352
|
+
this.knownNames = null;
|
|
353
|
+
this.knownFiles = null;
|
|
354
|
+
this.cachesWarmed = false;
|
|
355
|
+
}
|
|
356
|
+
/** `readFile` through the LRU content cache (null = read failed, also cached). */
|
|
357
|
+
readFileCached(filePath) {
|
|
358
|
+
if (this.fileCache.has(filePath)) {
|
|
359
|
+
return this.fileCache.get(filePath);
|
|
360
|
+
}
|
|
361
|
+
const fullPath = path.join(this.projectRoot, filePath);
|
|
362
|
+
try {
|
|
363
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
364
|
+
this.fileCache.set(filePath, content);
|
|
365
|
+
return content;
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
(0, errors_1.logDebug)('Failed to read file for resolution', { filePath, error: String(error) });
|
|
369
|
+
this.fileCache.set(filePath, null);
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Create the resolution context
|
|
375
|
+
*/
|
|
376
|
+
createContext() {
|
|
377
|
+
return {
|
|
378
|
+
getNodesInFile: (filePath) => {
|
|
379
|
+
if (!this.nodeCache.has(filePath)) {
|
|
380
|
+
this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
|
|
381
|
+
}
|
|
382
|
+
return this.nodeCache.get(filePath);
|
|
383
|
+
},
|
|
384
|
+
getNodesByName: (name) => {
|
|
385
|
+
const cached = this.nameCache.get(name);
|
|
386
|
+
if (cached !== undefined)
|
|
387
|
+
return cached;
|
|
388
|
+
const result = this.queries.getNodesByName(name);
|
|
389
|
+
this.nameCache.set(name, result);
|
|
390
|
+
return result;
|
|
391
|
+
},
|
|
392
|
+
getMethodMatches: (typeName, methodName, language) => {
|
|
393
|
+
const key = `${language} ${typeName}::${methodName}`;
|
|
394
|
+
const cached = this.methodMatchCache.get(key);
|
|
395
|
+
if (cached !== undefined)
|
|
396
|
+
return cached;
|
|
397
|
+
let candidates = this.nameCache.get(methodName);
|
|
398
|
+
if (candidates === undefined) {
|
|
399
|
+
candidates = this.queries.getNodesByName(methodName);
|
|
400
|
+
this.nameCache.set(methodName, candidates);
|
|
401
|
+
}
|
|
402
|
+
const want = `${typeName}::${methodName}`;
|
|
403
|
+
const matches = [];
|
|
404
|
+
for (const m of candidates) {
|
|
405
|
+
if (m.kind !== 'method')
|
|
406
|
+
continue;
|
|
407
|
+
if (m.language !== language)
|
|
408
|
+
continue;
|
|
409
|
+
const qn = m.qualifiedName;
|
|
410
|
+
if (qn === want || qn.endsWith(`::${want}`))
|
|
411
|
+
matches.push(m);
|
|
412
|
+
}
|
|
413
|
+
this.methodMatchCache.set(key, matches);
|
|
414
|
+
return matches;
|
|
415
|
+
},
|
|
416
|
+
getNodesByQualifiedName: (qualifiedName) => {
|
|
417
|
+
const cached = this.qualifiedNameCache.get(qualifiedName);
|
|
418
|
+
if (cached !== undefined)
|
|
419
|
+
return cached;
|
|
420
|
+
const result = this.queries.getNodesByQualifiedNameExact(qualifiedName);
|
|
421
|
+
this.qualifiedNameCache.set(qualifiedName, result);
|
|
422
|
+
return result;
|
|
423
|
+
},
|
|
424
|
+
getNodesByKind: (kind) => {
|
|
425
|
+
const cached = this.nodesByKindCache.get(kind);
|
|
426
|
+
if (cached !== undefined)
|
|
427
|
+
return cached;
|
|
428
|
+
const result = this.queries.getNodesByKind(kind);
|
|
429
|
+
this.nodesByKindCache.set(kind, result);
|
|
430
|
+
return result;
|
|
431
|
+
},
|
|
432
|
+
fileExists: (filePath) => {
|
|
433
|
+
// Check pre-built known files set first (O(1))
|
|
434
|
+
if (this.knownFiles) {
|
|
435
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
436
|
+
if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// Fall back to filesystem for files not yet indexed
|
|
441
|
+
const fullPath = path.join(this.projectRoot, filePath);
|
|
442
|
+
try {
|
|
443
|
+
return fs.existsSync(fullPath);
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
(0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
readFile: (filePath) => this.readFileCached(filePath),
|
|
451
|
+
getFileLines: (filePath) => {
|
|
452
|
+
const cached = this.fileLinesCache.get(filePath);
|
|
453
|
+
if (cached !== undefined)
|
|
454
|
+
return cached;
|
|
455
|
+
const source = this.readFileCached(filePath);
|
|
456
|
+
const lines = source === null ? null : source.split(/\r?\n/);
|
|
457
|
+
this.fileLinesCache.set(filePath, lines);
|
|
458
|
+
return lines;
|
|
459
|
+
},
|
|
460
|
+
getProjectRoot: () => this.projectRoot,
|
|
461
|
+
getAllFiles: () => {
|
|
462
|
+
return this.queries.getAllFilePaths();
|
|
463
|
+
},
|
|
464
|
+
listDirectories: (relativePath) => {
|
|
465
|
+
const target = relativePath === '.' || relativePath === ''
|
|
466
|
+
? this.projectRoot
|
|
467
|
+
: path.join(this.projectRoot, relativePath);
|
|
468
|
+
try {
|
|
469
|
+
return fs
|
|
470
|
+
.readdirSync(target, { withFileTypes: true })
|
|
471
|
+
.filter((entry) => entry.isDirectory())
|
|
472
|
+
.map((entry) => entry.name);
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
(0, errors_1.logDebug)('Failed to list directory for resolution', {
|
|
476
|
+
relativePath,
|
|
477
|
+
error: String(error),
|
|
478
|
+
});
|
|
479
|
+
return [];
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
getNodesByLowerName: (lowerName) => {
|
|
483
|
+
const cached = this.lowerNameCache.get(lowerName);
|
|
484
|
+
if (cached !== undefined)
|
|
485
|
+
return cached;
|
|
486
|
+
const result = this.queries.getNodesByLowerName(lowerName);
|
|
487
|
+
this.lowerNameCache.set(lowerName, result);
|
|
488
|
+
return result;
|
|
489
|
+
},
|
|
490
|
+
getNodeById: (id) => {
|
|
491
|
+
return this.queries.getNodeById(id);
|
|
492
|
+
},
|
|
493
|
+
getSupertypes: (typeName, language) => {
|
|
494
|
+
// Union the `implements`/`extends` targets of every same-named type node.
|
|
495
|
+
// Matching by simple name (not id) reconciles a type declared in one node
|
|
496
|
+
// (`KF::Builder`) with conformance declared in a separate extension node
|
|
497
|
+
// (`KF.Builder: KFOptionSetter`) — both have name `Builder`.
|
|
498
|
+
const typeNodes = this.context
|
|
499
|
+
.getNodesByName(typeName)
|
|
500
|
+
.filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) && n.language === language);
|
|
501
|
+
if (typeNodes.length === 0)
|
|
502
|
+
return [];
|
|
503
|
+
const supertypes = new Set();
|
|
504
|
+
for (const tn of typeNodes) {
|
|
505
|
+
for (const edge of this.queries.getOutgoingEdges(tn.id, ['implements', 'extends'])) {
|
|
506
|
+
const target = this.queries.getNodeById(edge.target);
|
|
507
|
+
if (target?.name && target.name !== typeName)
|
|
508
|
+
supertypes.add(target.name);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return [...supertypes];
|
|
512
|
+
},
|
|
513
|
+
getImportMappings: (filePath, language) => {
|
|
514
|
+
const cacheKey = filePath;
|
|
515
|
+
const cached = this.importMappingCache.get(cacheKey);
|
|
516
|
+
if (cached)
|
|
517
|
+
return cached;
|
|
518
|
+
const content = this.context.readFile(filePath);
|
|
519
|
+
if (!content) {
|
|
520
|
+
this.importMappingCache.set(cacheKey, []);
|
|
521
|
+
return [];
|
|
522
|
+
}
|
|
523
|
+
const mappings = (0, import_resolver_1.extractImportMappings)(filePath, content, language);
|
|
524
|
+
this.importMappingCache.set(cacheKey, mappings);
|
|
525
|
+
return mappings;
|
|
526
|
+
},
|
|
527
|
+
getProjectAliases: () => {
|
|
528
|
+
if (this.projectAliases === undefined) {
|
|
529
|
+
this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
|
|
530
|
+
}
|
|
531
|
+
return this.projectAliases;
|
|
532
|
+
},
|
|
533
|
+
getGoModule: () => {
|
|
534
|
+
if (this.goModule === undefined) {
|
|
535
|
+
this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
|
|
536
|
+
}
|
|
537
|
+
return this.goModule;
|
|
538
|
+
},
|
|
539
|
+
getWorkspacePackages: () => {
|
|
540
|
+
if (this.workspacePackages === undefined) {
|
|
541
|
+
this.workspacePackages = (0, workspace_packages_1.loadWorkspacePackages)(this.projectRoot);
|
|
542
|
+
}
|
|
543
|
+
return this.workspacePackages;
|
|
544
|
+
},
|
|
545
|
+
getReExports: (filePath, language) => {
|
|
546
|
+
const cached = this.reExportCache.get(filePath);
|
|
547
|
+
if (cached)
|
|
548
|
+
return cached;
|
|
549
|
+
const content = this.context.readFile(filePath);
|
|
550
|
+
if (!content) {
|
|
551
|
+
this.reExportCache.set(filePath, []);
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
// Re-exports are a JS/TS-only construct, and what matters is the
|
|
555
|
+
// BARREL file's own language — not the consuming reference's. A
|
|
556
|
+
// `.svelte`/`.vue` consumer threads its own language down the
|
|
557
|
+
// re-export chase, which would make extractReExports() bail on a
|
|
558
|
+
// `.ts` index barrel and silently break the chain (#629). Re-key
|
|
559
|
+
// the parse on the barrel's extension so the chase works no matter
|
|
560
|
+
// what kind of file imports through it.
|
|
561
|
+
const isJsFamily = /\.(?:d\.ts|[cm]?tsx?|[cm]?jsx?|ets)$/i.test(filePath);
|
|
562
|
+
const reExports = (0, import_resolver_1.extractReExports)(content, isJsFamily ? 'typescript' : language);
|
|
563
|
+
this.reExportCache.set(filePath, reExports);
|
|
564
|
+
return reExports;
|
|
565
|
+
},
|
|
566
|
+
getCppIncludeDirs: () => {
|
|
567
|
+
return (0, import_resolver_1.loadCppIncludeDirs)(this.projectRoot);
|
|
568
|
+
},
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Resolve all unresolved references
|
|
573
|
+
*/
|
|
574
|
+
resolveAll(unresolvedRefs, onProgress) {
|
|
575
|
+
// Pre-load all nodes into memory for fast lookups
|
|
576
|
+
this.warmCaches();
|
|
577
|
+
const resolved = [];
|
|
578
|
+
const unresolved = [];
|
|
579
|
+
const byMethod = {};
|
|
580
|
+
// Convert to our internal format, using denormalized fields when available
|
|
581
|
+
const refs = unresolvedRefs.map((ref) => ({
|
|
582
|
+
fromNodeId: ref.fromNodeId,
|
|
583
|
+
referenceName: ref.referenceName,
|
|
584
|
+
referenceKind: ref.referenceKind,
|
|
585
|
+
line: ref.line,
|
|
586
|
+
column: ref.column,
|
|
587
|
+
filePath: ref.filePath || this.getFilePathFromNodeId(ref.fromNodeId),
|
|
588
|
+
language: ref.language || this.getLanguageFromNodeId(ref.fromNodeId),
|
|
589
|
+
}));
|
|
590
|
+
const total = refs.length;
|
|
591
|
+
let lastReportedPercent = -1;
|
|
592
|
+
for (let i = 0; i < refs.length; i++) {
|
|
593
|
+
const ref = refs[i]; // Array index is guaranteed to be in bounds
|
|
594
|
+
const result = this.resolveOne(ref);
|
|
595
|
+
if (result) {
|
|
596
|
+
resolved.push(result);
|
|
597
|
+
byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
unresolved.push(ref);
|
|
601
|
+
}
|
|
602
|
+
// Report progress every 1% to avoid too many updates
|
|
603
|
+
if (onProgress) {
|
|
604
|
+
const currentPercent = Math.floor((i / total) * 100);
|
|
605
|
+
if (currentPercent > lastReportedPercent) {
|
|
606
|
+
lastReportedPercent = currentPercent;
|
|
607
|
+
onProgress(i + 1, total);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
// Final progress report
|
|
612
|
+
if (onProgress && total > 0) {
|
|
613
|
+
onProgress(total, total);
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
resolved,
|
|
617
|
+
unresolved,
|
|
618
|
+
stats: {
|
|
619
|
+
total: refs.length,
|
|
620
|
+
resolved: resolved.length,
|
|
621
|
+
unresolved: unresolved.length,
|
|
622
|
+
byMethod,
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Check if a reference name has any possible match in the codebase.
|
|
628
|
+
* Uses the pre-built knownNames set to skip expensive resolution
|
|
629
|
+
* for names that definitely don't exist as symbols.
|
|
630
|
+
*/
|
|
631
|
+
hasAnyPossibleMatch(name) {
|
|
632
|
+
if (!this.knownNames)
|
|
633
|
+
return true; // no pre-filter available
|
|
634
|
+
// Direct name match
|
|
635
|
+
if (this.knownNames.has(name))
|
|
636
|
+
return true;
|
|
637
|
+
// For qualified names like "obj.method" or "Class::method", check the parts
|
|
638
|
+
const dotIdx = name.indexOf('.');
|
|
639
|
+
if (dotIdx > 0) {
|
|
640
|
+
const receiver = name.substring(0, dotIdx);
|
|
641
|
+
const member = name.substring(dotIdx + 1);
|
|
642
|
+
if (this.knownNames.has(receiver) || this.knownNames.has(member))
|
|
643
|
+
return true;
|
|
644
|
+
// Also check capitalized receiver (instance-method resolution)
|
|
645
|
+
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
646
|
+
if (this.knownNames.has(capitalized))
|
|
647
|
+
return true;
|
|
648
|
+
// JVM FQN: `com.example.foo.Bar` — the only useful segment is the
|
|
649
|
+
// last one (`Bar`); the earlier check finds `example.foo.Bar` which
|
|
650
|
+
// never matches a node name.
|
|
651
|
+
const lastDot = name.lastIndexOf('.');
|
|
652
|
+
if (lastDot > dotIdx) {
|
|
653
|
+
const tail = name.substring(lastDot + 1);
|
|
654
|
+
if (tail && this.knownNames.has(tail))
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const colonIdx = name.indexOf('::');
|
|
659
|
+
if (colonIdx > 0) {
|
|
660
|
+
const receiver = name.substring(0, colonIdx);
|
|
661
|
+
const member = name.substring(colonIdx + 2);
|
|
662
|
+
if (this.knownNames.has(receiver) || this.knownNames.has(member))
|
|
663
|
+
return true;
|
|
664
|
+
// Multi-segment path `a::b::c` (a Rust/C++ module call like
|
|
665
|
+
// `database::profiles::find`) — the only segment that names a symbol is
|
|
666
|
+
// the last (`c`); `member` above is `b::c`, which never matches a node
|
|
667
|
+
// name, so without this the pre-filter drops the ref before the Rust path
|
|
668
|
+
// resolver ever sees it. Mirror the dotted-name leaf check above.
|
|
669
|
+
const lastColon = name.lastIndexOf('::');
|
|
670
|
+
if (lastColon > colonIdx) {
|
|
671
|
+
const tail = name.substring(lastColon + 2);
|
|
672
|
+
if (tail && this.knownNames.has(tail))
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// Lua/Luau method calls use a single `:` (`lg:log`); R uses `$` (`lg$log`).
|
|
677
|
+
// Check the member (and receiver) around these separators too, so the ref
|
|
678
|
+
// isn't dropped here before the method-call resolver ever sees it. The `:`
|
|
679
|
+
// case is skipped when the name actually contains `::` (handled above).
|
|
680
|
+
for (const sep of [':', '$']) {
|
|
681
|
+
if (sep === ':' && name.includes('::'))
|
|
682
|
+
continue;
|
|
683
|
+
const sepIdx = name.indexOf(sep);
|
|
684
|
+
if (sepIdx > 0) {
|
|
685
|
+
const receiver = name.substring(0, sepIdx);
|
|
686
|
+
const member = name.substring(sepIdx + 1);
|
|
687
|
+
if (this.knownNames.has(member) || this.knownNames.has(receiver))
|
|
688
|
+
return true;
|
|
689
|
+
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
690
|
+
if (this.knownNames.has(capitalized))
|
|
691
|
+
return true;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
// For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
|
|
695
|
+
const slashIdx = name.lastIndexOf('/');
|
|
696
|
+
if (slashIdx > 0) {
|
|
697
|
+
const fileName = name.substring(slashIdx + 1);
|
|
698
|
+
if (this.knownNames.has(fileName))
|
|
699
|
+
return true;
|
|
700
|
+
}
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Does `ref.referenceName` match an import declared in its containing
|
|
705
|
+
* file? Used as a pre-filter escape so re-export chain resolution
|
|
706
|
+
* still gets a chance when the name has no project-wide declaration.
|
|
707
|
+
*/
|
|
708
|
+
matchesAnyImport(ref) {
|
|
709
|
+
const imports = this.context.getImportMappings(ref.filePath, ref.language);
|
|
710
|
+
if (imports.length === 0)
|
|
711
|
+
return false;
|
|
712
|
+
for (const imp of imports) {
|
|
713
|
+
if (imp.localName === ref.referenceName ||
|
|
714
|
+
ref.referenceName.startsWith(imp.localName + '.')) {
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Resolve a single reference
|
|
722
|
+
*/
|
|
723
|
+
resolveOne(ref) {
|
|
724
|
+
// Skip built-in/external references
|
|
725
|
+
if (this.isBuiltInOrExternal(ref)) {
|
|
726
|
+
return null;
|
|
727
|
+
}
|
|
728
|
+
// CFML component paths in inheritance (#1152): `extends="coldbox.system.web.
|
|
729
|
+
// Controller"` names the supertype by its dot-separated path (or `extends=
|
|
730
|
+
// "../base"` by relative file path) — the graph indexes the class under its
|
|
731
|
+
// final segment only, so these die at the fast pre-filter below and never
|
|
732
|
+
// resolved. Handled by a dedicated path-corroborated matcher, gated to
|
|
733
|
+
// inheritance refs only (a dotted `calls` ref is a member-access chain, not
|
|
734
|
+
// a component path). No fallthrough on miss: the full path string can only
|
|
735
|
+
// ever mis-match downstream, and an unresolvable supertype usually lives in
|
|
736
|
+
// an out-of-repo library (mxunit, testbox) — silent beats wrong.
|
|
737
|
+
if ((ref.language === 'cfml' || ref.language === 'cfscript') &&
|
|
738
|
+
(ref.referenceKind === 'extends' || ref.referenceKind === 'implements') &&
|
|
739
|
+
(ref.referenceName.includes('.') || ref.referenceName.includes('/'))) {
|
|
740
|
+
return this.resolveCfmlComponentPath(ref);
|
|
741
|
+
}
|
|
742
|
+
// Fast pre-filter: skip if no symbol with this name exists anywhere
|
|
743
|
+
// AND the name doesn't match a local import. The import escape is
|
|
744
|
+
// necessary because re-export rename chains (`import { login }
|
|
745
|
+
// from './barrel'` where the barrel has `export { signIn as login }
|
|
746
|
+
// from './auth'`) intentionally call a name that has no
|
|
747
|
+
// declaration anywhere — only the renamed upstream symbol does.
|
|
748
|
+
// ArkTS chained-attribute refs carry a leading dot (`.titleStyle`) that
|
|
749
|
+
// routes them to the decorator-gated matcher; the symbol itself is
|
|
750
|
+
// indexed under the bare name, so the existence check strips the dot.
|
|
751
|
+
// Nix static path imports (`import ./x.nix`) name a FILE, not a symbol —
|
|
752
|
+
// they bypass the symbol-existence check and resolve via resolveViaImport.
|
|
753
|
+
const existenceName = ref.language === 'arkts' && ref.referenceName.startsWith('.')
|
|
754
|
+
? ref.referenceName.slice(1)
|
|
755
|
+
: ref.referenceName;
|
|
756
|
+
if (!(0, import_resolver_1.isNixPathImportRef)(ref) &&
|
|
757
|
+
!this.hasAnyPossibleMatch(existenceName) &&
|
|
758
|
+
!this.matchesAnyImport(ref) &&
|
|
759
|
+
!this.frameworks.some((f) => f.claimsReference?.(ref.referenceName))) {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
// Function-as-value refs (#756) get a dedicated, strictly-gated path:
|
|
763
|
+
// import-based resolution first (an imported callback resolves through its
|
|
764
|
+
// import, the most precise cross-file signal), then matchFunctionRef
|
|
765
|
+
// (same-file first, unique-only cross-file, function/method targets only).
|
|
766
|
+
// They never reach the framework or fuzzy strategies below.
|
|
767
|
+
if (ref.referenceKind === 'function_ref') {
|
|
768
|
+
// `this.<member>` values (TS/JS) resolve ONLY against the enclosing
|
|
769
|
+
// class's own members — never a same-named symbol elsewhere.
|
|
770
|
+
if (ref.referenceName.startsWith('this.')) {
|
|
771
|
+
return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
|
|
772
|
+
}
|
|
773
|
+
const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
774
|
+
if (viaImport) {
|
|
775
|
+
const target = this.queries.getNodeById(viaImport.targetNodeId);
|
|
776
|
+
if (target && (target.kind === 'function' || target.kind === 'method')) {
|
|
777
|
+
return viaImport;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
|
|
781
|
+
}
|
|
782
|
+
// JVM FQN imports skip framework/name-matcher: `import com.example.Bar`
|
|
783
|
+
// resolves directly through the qualifiedName index, which is unambiguous
|
|
784
|
+
// even when several `Bar` classes exist in different packages.
|
|
785
|
+
const jvmImport = (0, import_resolver_1.resolveJvmImport)(ref, this.context);
|
|
786
|
+
if (jvmImport)
|
|
787
|
+
return jvmImport;
|
|
788
|
+
// Razor/Blazor: a markup or `@code` type ref resolves through the file's
|
|
789
|
+
// `@using` namespaces (incl. folder `_Imports.razor`). This precisely
|
|
790
|
+
// disambiguates a simple name that exists in several namespaces — e.g.
|
|
791
|
+
// `CatalogBrand` resolving to `BlazorShared.Models::CatalogBrand` (the DTO,
|
|
792
|
+
// which the `.razor` `@using`s) rather than the same-named domain entity.
|
|
793
|
+
if (ref.language === 'razor') {
|
|
794
|
+
const razorResult = this.resolveRazorUsing(ref);
|
|
795
|
+
if (razorResult)
|
|
796
|
+
return razorResult;
|
|
797
|
+
}
|
|
798
|
+
const candidates = [];
|
|
799
|
+
// Strategy 1: Try framework-specific resolution. Cross-language bridges
|
|
800
|
+
// are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
|
|
801
|
+
// JS → native `calls`) — `gateFrameworkLanguage` only drops a type/import
|
|
802
|
+
// edge between two KNOWN families (see its doc), never a `calls` bridge or
|
|
803
|
+
// a config↔code edge.
|
|
804
|
+
for (const framework of this.frameworks) {
|
|
805
|
+
const result = this.gateFrameworkLanguage(framework.resolve(ref, this.context), ref);
|
|
806
|
+
if (result) {
|
|
807
|
+
if (result.confidence >= 0.9)
|
|
808
|
+
return result; // High confidence, return immediately
|
|
809
|
+
candidates.push(result);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
// Strategy 2: Try import-based resolution
|
|
813
|
+
const importResult = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
|
|
814
|
+
if (importResult) {
|
|
815
|
+
if (importResult.confidence >= 0.9)
|
|
816
|
+
return importResult;
|
|
817
|
+
candidates.push(importResult);
|
|
818
|
+
}
|
|
819
|
+
// PHP include/require paths resolve to files via import resolution only.
|
|
820
|
+
// If that didn't find the file, do NOT fall back to the symbol
|
|
821
|
+
// name-matcher — it would mis-connect e.g. "inc/db.php" to an unrelated
|
|
822
|
+
// db.php elsewhere in the tree (a wrong edge is worse than none, #660).
|
|
823
|
+
// Terraform refs are directory-scoped by language semantics — the
|
|
824
|
+
// framework resolver IS the whole rulebook (`var.X` can never legally
|
|
825
|
+
// bind outside its module directory), so the name-matcher's
|
|
826
|
+
// qualified-name fallback would only ever add wrong cross-module edges.
|
|
827
|
+
// Nix static path imports are file references for the same reason —
|
|
828
|
+
// falling through would let "./x.nix" name-match an unrelated node.
|
|
829
|
+
if ((0, import_resolver_1.isPhpIncludePathRef)(ref) || (0, import_resolver_1.isCobolCopybookRef)(ref) || (0, import_resolver_1.isNixPathImportRef)(ref) || ref.language === 'terraform') {
|
|
830
|
+
return candidates.length > 0
|
|
831
|
+
? candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best)
|
|
832
|
+
: null;
|
|
833
|
+
}
|
|
834
|
+
// Strategy 3: Try name matching
|
|
835
|
+
let nameResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
|
|
836
|
+
// Nix has no ambient cross-file namespace — a callee binds lexically
|
|
837
|
+
// (same file) or through explicit import/callPackage wiring (the import
|
|
838
|
+
// path above). A cross-file name match is wrong by construction: every
|
|
839
|
+
// module `inherit (lib) mkOption`s the same nixpkgs helpers, so the
|
|
840
|
+
// matcher would link each `mkOption` call to whichever file's inherit
|
|
841
|
+
// binding it happened to pick. Same-file matches only.
|
|
842
|
+
if (nameResult) {
|
|
843
|
+
const target = this.queries.getNodeById(nameResult.targetNodeId);
|
|
844
|
+
if (ref.language === 'nix') {
|
|
845
|
+
if (!target || target.filePath !== ref.filePath) {
|
|
846
|
+
nameResult = null;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
else if (target && target.language === 'nix') {
|
|
850
|
+
// The reverse direction is just as impossible: no other language can
|
|
851
|
+
// symbolically call into a .nix binding (interop is eval/CLI, never a
|
|
852
|
+
// linkable symbol) — without this, a Python script's `split()` lands
|
|
853
|
+
// on some module's `split = ...` binding as a low-confidence match.
|
|
854
|
+
nameResult = null;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
if (nameResult) {
|
|
858
|
+
candidates.push(nameResult);
|
|
859
|
+
}
|
|
860
|
+
if (candidates.length === 0) {
|
|
861
|
+
// Defer a chained static-factory/fluent call the first pass couldn't
|
|
862
|
+
// resolve — its method may live on a supertype the receiver conforms to,
|
|
863
|
+
// resolvable once implements/extends edges exist (the conformance pass).
|
|
864
|
+
if (ref.referenceKind === 'calls' &&
|
|
865
|
+
CHAIN_LANGUAGES.has(ref.language) &&
|
|
866
|
+
CHAIN_SHAPE.test(ref.referenceName)) {
|
|
867
|
+
this.deferredChainRefs.push(ref);
|
|
868
|
+
}
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
871
|
+
// Return highest confidence candidate
|
|
872
|
+
return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Create edges from resolved references
|
|
876
|
+
*/
|
|
877
|
+
createEdges(resolved) {
|
|
878
|
+
return resolved.map((ref) => {
|
|
879
|
+
// `function_ref` (#756) is internal-only: it persists as a `references`
|
|
880
|
+
// edge (the registration site depends on the callback), distinguishable
|
|
881
|
+
// by metadata.resolvedBy === 'function-ref'. callers/impact already
|
|
882
|
+
// traverse `references`, so registration sites surface with no
|
|
883
|
+
// graph-layer changes.
|
|
884
|
+
let kind = ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind;
|
|
885
|
+
// Promote "extends" to "implements" when a class/struct targets an interface
|
|
886
|
+
if (kind === 'extends') {
|
|
887
|
+
const targetNode = this.queries.getNodeById(ref.targetNodeId);
|
|
888
|
+
if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
|
|
889
|
+
const sourceNode = this.queries.getNodeById(ref.original.fromNodeId);
|
|
890
|
+
if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
|
|
891
|
+
kind = 'implements';
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
// Promote "calls" to "instantiates" when the resolved target is a
|
|
896
|
+
// class/struct. Languages without a `new` keyword (Python, Ruby)
|
|
897
|
+
// express instantiation as `Foo()` — extraction can't tell that
|
|
898
|
+
// apart from a function call without symbol info, but resolution
|
|
899
|
+
// can: if `Foo` resolves to a class, the call IS an instantiation.
|
|
900
|
+
if (kind === 'calls') {
|
|
901
|
+
const targetNode = this.queries.getNodeById(ref.targetNodeId);
|
|
902
|
+
if (targetNode && (targetNode.kind === 'class' || targetNode.kind === 'struct')) {
|
|
903
|
+
kind = 'instantiates';
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return {
|
|
907
|
+
source: ref.original.fromNodeId,
|
|
908
|
+
target: ref.targetNodeId,
|
|
909
|
+
kind,
|
|
910
|
+
line: ref.original.line,
|
|
911
|
+
column: ref.original.column,
|
|
912
|
+
metadata: {
|
|
913
|
+
confidence: ref.confidence,
|
|
914
|
+
resolvedBy: ref.resolvedBy,
|
|
915
|
+
// Uniform marker for function-as-value edges (#756), regardless of
|
|
916
|
+
// which strategy resolved them (import vs matchFunctionRef) — lets
|
|
917
|
+
// tooling label "callback registration" and lets validation diff
|
|
918
|
+
// exactly the edges this feature added.
|
|
919
|
+
...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
|
|
920
|
+
},
|
|
921
|
+
};
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Resolve and persist edges to database
|
|
926
|
+
*/
|
|
927
|
+
resolveAndPersist(unresolvedRefs, onProgress) {
|
|
928
|
+
const result = this.resolveAll(unresolvedRefs, onProgress);
|
|
929
|
+
// Create edges from resolved references
|
|
930
|
+
const edges = this.createEdges(result.resolved);
|
|
931
|
+
// Insert edges into database
|
|
932
|
+
if (edges.length > 0) {
|
|
933
|
+
this.queries.insertEdges(edges);
|
|
934
|
+
}
|
|
935
|
+
// Clean up resolved refs from unresolved_refs table so metrics are accurate
|
|
936
|
+
if (result.resolved.length > 0) {
|
|
937
|
+
this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
|
|
938
|
+
fromNodeId: r.original.fromNodeId,
|
|
939
|
+
referenceName: r.original.referenceName,
|
|
940
|
+
referenceKind: r.original.referenceKind,
|
|
941
|
+
})));
|
|
942
|
+
}
|
|
943
|
+
// Delete unresolvable refs too — parity with resolveAndPersistBatched.
|
|
944
|
+
// Keeping them bought nothing: a ref is only ever retried when its file
|
|
945
|
+
// is re-extracted, which cascade-deletes and re-inserts its rows anyway.
|
|
946
|
+
// And it broke the #1187 orphan sweep's invariant — after a COMPLETED
|
|
947
|
+
// pass the table must hold nothing that pass processed, so that any row
|
|
948
|
+
// still present belongs to an interrupted run and the sweep can key off
|
|
949
|
+
// a bare row count.
|
|
950
|
+
if (result.unresolved.length > 0) {
|
|
951
|
+
this.queries.deleteSpecificResolvedReferences(result.unresolved.map((r) => ({
|
|
952
|
+
fromNodeId: r.fromNodeId,
|
|
953
|
+
referenceName: r.referenceName,
|
|
954
|
+
referenceKind: r.referenceKind,
|
|
955
|
+
})));
|
|
956
|
+
}
|
|
957
|
+
return result;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Second resolution pass for chained static-factory / fluent calls whose
|
|
961
|
+
* chained method is defined on a SUPERTYPE the receiver's type conforms to —
|
|
962
|
+
* a protocol-extension / inherited / default-interface method (#750). The
|
|
963
|
+
* first pass can't resolve these because `implements`/`extends` edges aren't
|
|
964
|
+
* built yet; this runs AFTER edges are persisted, so `context.getSupertypes`
|
|
965
|
+
* (and the conformance fallback in resolveMethodOnType) can walk them.
|
|
966
|
+
*
|
|
967
|
+
* Operates only on the leftover unresolved refs that have the `inner().method`
|
|
968
|
+
* chain shape, for the dotted-chain languages — a small set — and is idempotent
|
|
969
|
+
* (re-resolving an already-resolved ref is a no-op since it's been deleted).
|
|
970
|
+
* Returns the number of newly-created edges.
|
|
971
|
+
*/
|
|
972
|
+
async resolveChainedCallsViaConformance() {
|
|
973
|
+
const deferred = this.deferredChainRefs;
|
|
974
|
+
this.deferredChainRefs = [];
|
|
975
|
+
if (deferred.length === 0)
|
|
976
|
+
return 0;
|
|
977
|
+
// Read fresh edges (the main pass built the implements/extends edges after
|
|
978
|
+
// these refs were deferred). matchDottedCallChain now resolves a method on a
|
|
979
|
+
// supertype via context.getSupertypes -> resolveMethodOnType's conformance walk.
|
|
980
|
+
this.clearCaches();
|
|
981
|
+
// This post-pass runs synchronously on the indexer's main thread; yield
|
|
982
|
+
// periodically so the #850 liveness watchdog heartbeat can fire on a repo
|
|
983
|
+
// with many deferred chained calls (#1091).
|
|
984
|
+
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
985
|
+
const resolved = [];
|
|
986
|
+
for (const ref of deferred) {
|
|
987
|
+
// `::`-receiver languages (Rust) split on `::` (matchScopedCallChain);
|
|
988
|
+
// dotted-receiver languages on `.` (matchDottedCallChain).
|
|
989
|
+
const chainMatch = SCOPED_CHAIN_LANGUAGES.has(ref.language)
|
|
990
|
+
? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
|
|
991
|
+
: (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
|
|
992
|
+
const match = this.gateLanguage(chainMatch, ref);
|
|
993
|
+
if (match)
|
|
994
|
+
resolved.push(match);
|
|
995
|
+
await maybeYield();
|
|
996
|
+
}
|
|
997
|
+
if (resolved.length === 0)
|
|
998
|
+
return 0;
|
|
999
|
+
const edges = this.createEdges(resolved);
|
|
1000
|
+
if (edges.length > 0) {
|
|
1001
|
+
this.queries.insertEdges(edges);
|
|
1002
|
+
this.clearCaches();
|
|
1003
|
+
}
|
|
1004
|
+
return edges.length;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Resolve one batch with a yield checkpoint between EVERY ref so the #850
|
|
1008
|
+
* liveness heartbeat can fire on a slow/dense batch (#1091). The checkpoint
|
|
1009
|
+
* granularity is per-ref — not per-N-refs — because per-ref cost is unbounded
|
|
1010
|
+
* in the worst case (a collision-heavy method name whose candidate set misses
|
|
1011
|
+
* the LRU re-fetches tens of thousands of rows): any fixed N multiplies that
|
|
1012
|
+
* worst case into the watchdog window, which is how v1.2.0 still got killed
|
|
1013
|
+
* at "Resolving refs" on large Java monorepos (#1122). `maybeYield()` is a
|
|
1014
|
+
* ~ns time check when under budget, so per-ref checkpoints cost nothing.
|
|
1015
|
+
* Behaviourally identical to `resolveAll(batch)`: `warmCaches()` is
|
|
1016
|
+
* idempotent (guarded) and `resolveOne` is independent per ref, so yielding
|
|
1017
|
+
* between refs changes only timing, never which edges get created.
|
|
1018
|
+
*/
|
|
1019
|
+
async resolveBatchYielding(batch, maybeYield) {
|
|
1020
|
+
this.warmCaches();
|
|
1021
|
+
const resolved = [];
|
|
1022
|
+
const unresolved = [];
|
|
1023
|
+
const byMethod = {};
|
|
1024
|
+
for (const raw of batch) {
|
|
1025
|
+
const ref = {
|
|
1026
|
+
fromNodeId: raw.fromNodeId,
|
|
1027
|
+
referenceName: raw.referenceName,
|
|
1028
|
+
referenceKind: raw.referenceKind,
|
|
1029
|
+
line: raw.line,
|
|
1030
|
+
column: raw.column,
|
|
1031
|
+
filePath: raw.filePath || this.getFilePathFromNodeId(raw.fromNodeId),
|
|
1032
|
+
language: raw.language || this.getLanguageFromNodeId(raw.fromNodeId),
|
|
1033
|
+
};
|
|
1034
|
+
const result = this.resolveOne(ref);
|
|
1035
|
+
if (result) {
|
|
1036
|
+
resolved.push(result);
|
|
1037
|
+
byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
unresolved.push(ref);
|
|
1041
|
+
}
|
|
1042
|
+
await maybeYield();
|
|
1043
|
+
}
|
|
1044
|
+
return {
|
|
1045
|
+
resolved,
|
|
1046
|
+
unresolved,
|
|
1047
|
+
stats: {
|
|
1048
|
+
total: batch.length,
|
|
1049
|
+
resolved: resolved.length,
|
|
1050
|
+
unresolved: unresolved.length,
|
|
1051
|
+
byMethod,
|
|
1052
|
+
},
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Resolve and persist in batches to keep memory bounded.
|
|
1057
|
+
* Processes unresolved references in chunks, persisting edges and cleaning
|
|
1058
|
+
* up resolved refs after each batch to avoid accumulating large arrays.
|
|
1059
|
+
*/
|
|
1060
|
+
async resolveAndPersistBatched(onProgress, batchSize = 5000) {
|
|
1061
|
+
this.warmCaches();
|
|
1062
|
+
// Resolution runs on the indexer's MAIN thread, and the #850 liveness
|
|
1063
|
+
// watchdog SIGKILLs a process whose event loop stalls past its window (60s
|
|
1064
|
+
// by default). A single dense batch's resolveAll — or the synthesis pass
|
|
1065
|
+
// below — can exceed that on a large repo, killing a VALID in-progress index
|
|
1066
|
+
// (#1091). A shared yielder lets both give the watchdog heartbeat a regular
|
|
1067
|
+
// window to fire; see ./cooperative-yield.
|
|
1068
|
+
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
1069
|
+
const total = this.queries.getUnresolvedReferencesCount();
|
|
1070
|
+
let processed = 0;
|
|
1071
|
+
const aggregateStats = {
|
|
1072
|
+
total: 0,
|
|
1073
|
+
resolved: 0,
|
|
1074
|
+
unresolved: 0,
|
|
1075
|
+
byMethod: {},
|
|
1076
|
+
};
|
|
1077
|
+
// Process in batches. We always read from offset 0 because resolved refs
|
|
1078
|
+
// are deleted after each batch, shifting the remaining rows forward.
|
|
1079
|
+
let prevRemaining = Number.POSITIVE_INFINITY;
|
|
1080
|
+
while (true) {
|
|
1081
|
+
const batch = this.queries.getUnresolvedReferencesBatch(0, batchSize);
|
|
1082
|
+
if (batch.length === 0)
|
|
1083
|
+
break;
|
|
1084
|
+
const result = await this.resolveBatchYielding(batch, maybeYield);
|
|
1085
|
+
// Persist edges immediately
|
|
1086
|
+
const edges = this.createEdges(result.resolved);
|
|
1087
|
+
if (edges.length > 0) {
|
|
1088
|
+
this.queries.insertEdges(edges);
|
|
1089
|
+
}
|
|
1090
|
+
// Clean up resolved refs so they don't appear in the next batch
|
|
1091
|
+
if (result.resolved.length > 0) {
|
|
1092
|
+
this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
|
|
1093
|
+
fromNodeId: r.original.fromNodeId,
|
|
1094
|
+
referenceName: r.original.referenceName,
|
|
1095
|
+
referenceKind: r.original.referenceKind,
|
|
1096
|
+
})));
|
|
1097
|
+
}
|
|
1098
|
+
// Delete unresolvable refs from this batch to avoid re-processing them
|
|
1099
|
+
if (result.unresolved.length > 0) {
|
|
1100
|
+
this.queries.deleteSpecificResolvedReferences(result.unresolved.map((r) => ({
|
|
1101
|
+
fromNodeId: r.fromNodeId,
|
|
1102
|
+
referenceName: r.referenceName,
|
|
1103
|
+
referenceKind: r.referenceKind,
|
|
1104
|
+
})));
|
|
1105
|
+
}
|
|
1106
|
+
// Aggregate stats
|
|
1107
|
+
aggregateStats.total += result.stats.total;
|
|
1108
|
+
aggregateStats.resolved += result.stats.resolved;
|
|
1109
|
+
aggregateStats.unresolved += result.stats.unresolved;
|
|
1110
|
+
for (const [method, count] of Object.entries(result.stats.byMethod)) {
|
|
1111
|
+
aggregateStats.byMethod[method] = (aggregateStats.byMethod[method] || 0) + count;
|
|
1112
|
+
}
|
|
1113
|
+
processed += batch.length;
|
|
1114
|
+
onProgress?.(processed, total);
|
|
1115
|
+
// Yield so progress UI can render between batches
|
|
1116
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
1117
|
+
// NOTE: there used to be an extra early break here when a batch resolved
|
|
1118
|
+
// nothing (`result.unresolved.length === batch.length`). That was wrong:
|
|
1119
|
+
// an all-unresolvable batch still DELETES its rows (progress), yet the
|
|
1120
|
+
// break abandoned every batch after it in the same run — on a repo whose
|
|
1121
|
+
// first 5000 refs are all external/stdlib calls, resolution stopped at
|
|
1122
|
+
// batch one and left the rest of the table as permanent orphans (#1187).
|
|
1123
|
+
// The count-based guard below catches the true no-progress case.
|
|
1124
|
+
// Non-progress guard (defense-in-depth). Because we re-read from offset 0
|
|
1125
|
+
// each pass, the unresolved_refs table MUST shrink every iteration — both
|
|
1126
|
+
// resolved and unresolved refs are deleted above. If it didn't shrink, a
|
|
1127
|
+
// resolver returned a match whose `original.referenceName` differs from the
|
|
1128
|
+
// stored row, so the keyed delete no-ops, and we'd re-read + re-resolve +
|
|
1129
|
+
// re-insert the same rows forever (the runaway that grew a 99-file repo to
|
|
1130
|
+
// 5M edges / 1.4 GB before the Go-fallback fix). Stop rather than grow the
|
|
1131
|
+
// graph without bound.
|
|
1132
|
+
const remaining = this.queries.getUnresolvedReferencesCount();
|
|
1133
|
+
if (remaining >= prevRemaining)
|
|
1134
|
+
break;
|
|
1135
|
+
prevRemaining = remaining;
|
|
1136
|
+
}
|
|
1137
|
+
// Dynamic-edge synthesis: now that all base `calls` edges are persisted,
|
|
1138
|
+
// synthesize observer/callback dispatch edges (dispatcher → registered
|
|
1139
|
+
// callbacks) that static parsing leaves out. Best-effort — never fail the
|
|
1140
|
+
// index on it. See docs/design/callback-edge-synthesis.md.
|
|
1141
|
+
try {
|
|
1142
|
+
aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context);
|
|
1143
|
+
}
|
|
1144
|
+
catch {
|
|
1145
|
+
// synthesis is additive and optional; ignore failures
|
|
1146
|
+
}
|
|
1147
|
+
return {
|
|
1148
|
+
resolved: [],
|
|
1149
|
+
unresolved: [],
|
|
1150
|
+
stats: aggregateStats,
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Get detected frameworks
|
|
1155
|
+
*/
|
|
1156
|
+
getDetectedFrameworks() {
|
|
1157
|
+
return this.frameworks.map((f) => f.name);
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Check if reference is to a built-in or external symbol
|
|
1161
|
+
*/
|
|
1162
|
+
isBuiltInOrExternal(ref) {
|
|
1163
|
+
const name = ref.referenceName;
|
|
1164
|
+
const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
|
|
1165
|
+
|| ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts';
|
|
1166
|
+
// JavaScript/TypeScript built-ins
|
|
1167
|
+
if (isJsTs && JS_BUILT_INS.has(name)) {
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
// ArkTS resource-reference intrinsics — `$r('app.string.x')` /
|
|
1171
|
+
// `$rawfile('x.png')` are framework-provided and appear dozens of times
|
|
1172
|
+
// per UI file; without this they can resolve to a stray same-named
|
|
1173
|
+
// symbol (e.g. a checked-in hvigor wrapper's `$r`).
|
|
1174
|
+
if (ref.language === 'arkts' && (name === '$r' || name === '$rawfile')) {
|
|
1175
|
+
return true;
|
|
1176
|
+
}
|
|
1177
|
+
// Common JS/TS library calls (console.log, Math.floor, JSON.parse)
|
|
1178
|
+
if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
|
|
1179
|
+
return true;
|
|
1180
|
+
}
|
|
1181
|
+
// React hooks from React itself
|
|
1182
|
+
if (isJsTs && REACT_HOOKS.has(name)) {
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1185
|
+
// Python built-ins (bare calls only — dotted calls like console.print are method calls)
|
|
1186
|
+
if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
|
|
1187
|
+
return true;
|
|
1188
|
+
}
|
|
1189
|
+
// Python built-in method calls (e.g., list.extend, dict.update)
|
|
1190
|
+
if (ref.language === 'python') {
|
|
1191
|
+
const dotIdx = name.indexOf('.');
|
|
1192
|
+
if (dotIdx > 0) {
|
|
1193
|
+
const receiver = name.substring(0, dotIdx);
|
|
1194
|
+
const method = name.substring(dotIdx + 1);
|
|
1195
|
+
// Filter calls on built-in types (list.append, dict.update, etc.)
|
|
1196
|
+
if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
|
|
1197
|
+
return true;
|
|
1198
|
+
}
|
|
1199
|
+
// Filter built-in methods on non-class receivers
|
|
1200
|
+
// (e.g., items.append where items is a local list variable)
|
|
1201
|
+
// But allow if the capitalized receiver matches a known codebase class
|
|
1202
|
+
if (PYTHON_BUILT_IN_METHODS.has(method)) {
|
|
1203
|
+
const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
|
|
1204
|
+
if (!this.knownNames?.has(capitalized)) {
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
// A bare name colliding with a builtin method (index, get, update, count…)
|
|
1210
|
+
// is only a builtin when NOTHING in the codebase declares it. A declared
|
|
1211
|
+
// symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
|
|
1212
|
+
// `def get()` — is a real reference target. Mirrors the knownNames guard on
|
|
1213
|
+
// the dotted branch above; without it, every handler named after a builtin
|
|
1214
|
+
// method silently loses its route→handler edge.
|
|
1215
|
+
if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
|
|
1216
|
+
return true;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
// Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
|
|
1220
|
+
if (ref.language === 'go') {
|
|
1221
|
+
const dotIdx = name.indexOf('.');
|
|
1222
|
+
if (dotIdx > 0) {
|
|
1223
|
+
const pkg = name.substring(0, dotIdx);
|
|
1224
|
+
if (GO_STDLIB_PACKAGES.has(pkg)) {
|
|
1225
|
+
return true;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (GO_BUILT_INS.has(name)) {
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
// Pascal/Delphi built-ins and standard library units
|
|
1233
|
+
if (ref.language === 'pascal') {
|
|
1234
|
+
if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
|
|
1235
|
+
return true;
|
|
1236
|
+
}
|
|
1237
|
+
if (PASCAL_BUILT_INS.has(name)) {
|
|
1238
|
+
return true;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
// C/C++ standard library symbols (printf, malloc, std::vector, etc.).
|
|
1242
|
+
// Names that collide with user-defined symbols are NOT filtered —
|
|
1243
|
+
// C and C++ projects routinely shadow stdlib names (custom allocators
|
|
1244
|
+
// define `malloc`/`free`, stream wrappers define `read`/`write`/`open`,
|
|
1245
|
+
// containers define `move`/`swap`, logging libs wrap `printf`). Killing
|
|
1246
|
+
// those resolutions makes the graph wrong, not cleaner. We only filter
|
|
1247
|
+
// when there's no user node with this name — then name-matching would
|
|
1248
|
+
// produce zero edges anyway and the filter just short-circuits work.
|
|
1249
|
+
if (ref.language === 'c' || ref.language === 'cpp') {
|
|
1250
|
+
// C++ std:: namespace prefix — safe to filter unconditionally,
|
|
1251
|
+
// since `std::foo` is never a user-defined qualified name in
|
|
1252
|
+
// tree-sitter output.
|
|
1253
|
+
if (name.startsWith('std::'))
|
|
1254
|
+
return true;
|
|
1255
|
+
if (C_BUILT_INS.has(name) || CPP_BUILT_INS.has(name)) {
|
|
1256
|
+
return !this.hasAnyPossibleMatch(name);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Get file path from node ID
|
|
1263
|
+
*/
|
|
1264
|
+
getFilePathFromNodeId(nodeId) {
|
|
1265
|
+
const node = this.queries.getNodeById(nodeId);
|
|
1266
|
+
return node?.filePath || '';
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Get language from node ID
|
|
1270
|
+
*/
|
|
1271
|
+
getLanguageFromNodeId(nodeId) {
|
|
1272
|
+
const node = this.queries.getNodeById(nodeId);
|
|
1273
|
+
return node?.language || 'unknown';
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Drop an import/name-strategy resolution that crosses a language family.
|
|
1277
|
+
* Two regimes (mirrors `applyLanguageGate`'s candidate filter):
|
|
1278
|
+
* - `references` (type usage): STRICT — a `Type.member` static read names a
|
|
1279
|
+
* same-family type, never a coincidentally same-named symbol in another
|
|
1280
|
+
* language. Drops any non-same-family target.
|
|
1281
|
+
* - `imports` (import binding / `#include`): both-known — a C++ `#include
|
|
1282
|
+
* "X.h"` must not resolve to a same-named ObjC header on another platform
|
|
1283
|
+
* (basename collision), but a singleton-family / SFC language (`vue` →
|
|
1284
|
+
* `.ts`) importing across is left alone.
|
|
1285
|
+
* Applies to the import (strategy 2) + name-match (strategy 3) results.
|
|
1286
|
+
*/
|
|
1287
|
+
/**
|
|
1288
|
+
* Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
|
|
1289
|
+
* own `@using` directives plus every `_Imports.razor` from the file's folder up
|
|
1290
|
+
* to the project root (Razor `_Imports` cascade). Cached per file.
|
|
1291
|
+
*/
|
|
1292
|
+
getRazorUsings(filePath) {
|
|
1293
|
+
const cached = this.razorUsingsCache.get(filePath);
|
|
1294
|
+
if (cached)
|
|
1295
|
+
return cached;
|
|
1296
|
+
const usings = new Set();
|
|
1297
|
+
const addFrom = (src) => {
|
|
1298
|
+
if (!src)
|
|
1299
|
+
return;
|
|
1300
|
+
for (const m of src.matchAll(/^\s*@using\s+(?:static\s+)?([A-Za-z_][\w.]*)/gm))
|
|
1301
|
+
usings.add(m[1]);
|
|
1302
|
+
};
|
|
1303
|
+
addFrom(this.context.readFile(filePath));
|
|
1304
|
+
let dir = filePath.includes('/') ? filePath.slice(0, filePath.lastIndexOf('/')) : '';
|
|
1305
|
+
// Walk up to the project root, reading each level's _Imports.razor.
|
|
1306
|
+
for (;;) {
|
|
1307
|
+
addFrom(this.context.readFile(dir ? `${dir}/_Imports.razor` : '_Imports.razor'));
|
|
1308
|
+
if (!dir)
|
|
1309
|
+
break;
|
|
1310
|
+
const slash = dir.lastIndexOf('/');
|
|
1311
|
+
dir = slash >= 0 ? dir.slice(0, slash) : '';
|
|
1312
|
+
}
|
|
1313
|
+
const arr = [...usings];
|
|
1314
|
+
this.razorUsingsCache.set(filePath, arr);
|
|
1315
|
+
return arr;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Resolve a Razor/Blazor simple type ref through the file's `@using`
|
|
1319
|
+
* namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose
|
|
1320
|
+
* qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the
|
|
1321
|
+
* `@using` set yields exactly ONE type (otherwise it stays ambiguous and falls
|
|
1322
|
+
* through to name-matching).
|
|
1323
|
+
*/
|
|
1324
|
+
resolveRazorUsing(ref) {
|
|
1325
|
+
if (ref.referenceName.includes('.') || ref.referenceName.includes('::'))
|
|
1326
|
+
return null;
|
|
1327
|
+
const usings = this.getRazorUsings(ref.filePath);
|
|
1328
|
+
if (usings.length === 0)
|
|
1329
|
+
return null;
|
|
1330
|
+
const found = new Map();
|
|
1331
|
+
for (const ns of usings) {
|
|
1332
|
+
for (const cand of this.context.getNodesByQualifiedName(`${ns}::${ref.referenceName}`)) {
|
|
1333
|
+
found.set(cand.id, cand);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
if (found.size !== 1)
|
|
1337
|
+
return null;
|
|
1338
|
+
const target = found.values().next().value;
|
|
1339
|
+
return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Resolve a CFML inheritance reference written as a component path (#1152).
|
|
1343
|
+
* Two forms exist in real code:
|
|
1344
|
+
*
|
|
1345
|
+
* - Dotted: `extends="coldbox.system.web.Controller"` — dots are directory
|
|
1346
|
+
* separators from the webroot or a CFML mapping. Mappings live in server
|
|
1347
|
+
* config / Application.cfc, so the leading segments may not exist in the
|
|
1348
|
+
* repo at all (in the coldbox repo itself the path is `system/web/
|
|
1349
|
+
* Controller.cfc` — the `coldbox.` root IS the repo). Matched by final
|
|
1350
|
+
* segment (the class), corroborated right-to-left against the candidate's
|
|
1351
|
+
* parent directories.
|
|
1352
|
+
* - Relative: `extends="../base"` / `extends="./base"` (the FW/1 style) —
|
|
1353
|
+
* resolved against the referencing file's own directory.
|
|
1354
|
+
*
|
|
1355
|
+
* Conservative by design: a candidate needs at least one corroborating
|
|
1356
|
+
* directory segment (a dotted path whose only same-named class sits in an
|
|
1357
|
+
* unrelated directory is almost always an out-of-repo library supertype —
|
|
1358
|
+
* mxunit/testbox/coldbox-as-dependency), and a corroboration tie yields no
|
|
1359
|
+
* edge. Directory comparison is case-insensitive (CFML path resolution is);
|
|
1360
|
+
* the class segment itself is matched exactly, which real code satisfies —
|
|
1361
|
+
* dotted paths are written to match the on-disk file name.
|
|
1362
|
+
*/
|
|
1363
|
+
resolveCfmlComponentPath(ref) {
|
|
1364
|
+
const cfmlCandidates = (name) => this.context
|
|
1365
|
+
.getNodesByName(name)
|
|
1366
|
+
.filter((n) => (n.kind === 'class' || n.kind === 'interface') &&
|
|
1367
|
+
(n.language === 'cfml' || n.language === 'cfscript'));
|
|
1368
|
+
const norm = (p) => p.replace(/\\/g, '/').toLowerCase();
|
|
1369
|
+
// Relative-path form: `../base`, `./base`, `sub/thing` — resolve against
|
|
1370
|
+
// the referencing file's directory and require an exact (case-insensitive)
|
|
1371
|
+
// file match.
|
|
1372
|
+
if (ref.referenceName.includes('/')) {
|
|
1373
|
+
const rel = ref.referenceName.replace(/\.cfc$/i, '');
|
|
1374
|
+
const fromDir = ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
|
|
1375
|
+
const parts = [...fromDir];
|
|
1376
|
+
for (const seg of rel.split('/')) {
|
|
1377
|
+
if (seg === '' || seg === '.')
|
|
1378
|
+
continue;
|
|
1379
|
+
if (seg === '..') {
|
|
1380
|
+
if (parts.length === 0)
|
|
1381
|
+
return null; // escapes the project root
|
|
1382
|
+
parts.pop();
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
parts.push(seg);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
const wantPath = norm(parts.join('/') + '.cfc');
|
|
1389
|
+
const className = parts[parts.length - 1];
|
|
1390
|
+
if (!className)
|
|
1391
|
+
return null;
|
|
1392
|
+
const target = cfmlCandidates(className).find((c) => norm(c.filePath) === wantPath);
|
|
1393
|
+
return target
|
|
1394
|
+
? { original: ref, targetNodeId: target.id, confidence: 0.95, resolvedBy: 'file-path' }
|
|
1395
|
+
: null;
|
|
1396
|
+
}
|
|
1397
|
+
// Dotted form.
|
|
1398
|
+
const segments = ref.referenceName.split('.').map((s) => s.trim()).filter(Boolean);
|
|
1399
|
+
if (segments.length < 2)
|
|
1400
|
+
return null;
|
|
1401
|
+
const className = segments[segments.length - 1];
|
|
1402
|
+
const dirSegments = segments.slice(0, -1);
|
|
1403
|
+
let best = null;
|
|
1404
|
+
let bestScore = 0;
|
|
1405
|
+
let tie = false;
|
|
1406
|
+
for (const cand of cfmlCandidates(className)) {
|
|
1407
|
+
const dirs = cand.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
|
|
1408
|
+
// Count matching directory segments right-to-left: for
|
|
1409
|
+
// `coldbox.system.web.Controller` vs `system/web/Controller.cfc`,
|
|
1410
|
+
// `web` and `system` match, then the repo root ends the run → score 2.
|
|
1411
|
+
let score = 0;
|
|
1412
|
+
while (score < dirSegments.length &&
|
|
1413
|
+
score < dirs.length &&
|
|
1414
|
+
dirSegments[dirSegments.length - 1 - score].toLowerCase() ===
|
|
1415
|
+
dirs[dirs.length - 1 - score].toLowerCase()) {
|
|
1416
|
+
score++;
|
|
1417
|
+
}
|
|
1418
|
+
if (score > bestScore) {
|
|
1419
|
+
best = cand;
|
|
1420
|
+
bestScore = score;
|
|
1421
|
+
tie = false;
|
|
1422
|
+
}
|
|
1423
|
+
else if (score === bestScore && score > 0) {
|
|
1424
|
+
tie = true;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
if (!best || bestScore === 0 || tie)
|
|
1428
|
+
return null;
|
|
1429
|
+
return { original: ref, targetNodeId: best.id, confidence: 0.9, resolvedBy: 'qualified-name' };
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Resolve a `this.<member>` function-as-value reference (#756/#808) to the
|
|
1433
|
+
* ENCLOSING CLASS's own member — never a same-named symbol elsewhere. The
|
|
1434
|
+
* registration idiom (`btn.on('click', this.handleClick)`) names a member
|
|
1435
|
+
* of the class being defined, so the only valid target shares the
|
|
1436
|
+
* from-symbol's qualified-name scope. Function/method targets only — a
|
|
1437
|
+
* property (a data field, post-#808 classification) yields no edge — same
|
|
1438
|
+
* file required, no fallback of any kind.
|
|
1439
|
+
*/
|
|
1440
|
+
resolveThisMemberFnRef(ref) {
|
|
1441
|
+
const member = ref.referenceName.slice('this.'.length);
|
|
1442
|
+
if (!member)
|
|
1443
|
+
return null;
|
|
1444
|
+
const fromNode = this.queries.getNodeById(ref.fromNodeId);
|
|
1445
|
+
if (!fromNode)
|
|
1446
|
+
return null;
|
|
1447
|
+
// A hook declared at class-body level (Ruby `before_action :authenticate`)
|
|
1448
|
+
// attributes to the CLASS node itself — its qualified name IS the scope.
|
|
1449
|
+
// For members, strip the member segment.
|
|
1450
|
+
let classPrefix;
|
|
1451
|
+
if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
|
|
1452
|
+
classPrefix = fromNode.qualifiedName;
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
const sep = fromNode.qualifiedName.lastIndexOf('::');
|
|
1456
|
+
if (sep <= 0)
|
|
1457
|
+
return null; // not inside a class scope
|
|
1458
|
+
classPrefix = fromNode.qualifiedName.slice(0, sep);
|
|
1459
|
+
}
|
|
1460
|
+
const candidates = this.context
|
|
1461
|
+
.getNodesByQualifiedName(`${classPrefix}::${member}`)
|
|
1462
|
+
.filter((n) => (n.kind === 'function' || n.kind === 'method') &&
|
|
1463
|
+
n.filePath === ref.filePath &&
|
|
1464
|
+
n.id !== ref.fromNodeId);
|
|
1465
|
+
if (candidates.length === 0) {
|
|
1466
|
+
// Not on the class itself — possibly INHERITED. implements/extends
|
|
1467
|
+
// edges don't exist yet in this pass, so retry in the supertype pass
|
|
1468
|
+
// (resolveDeferredThisMemberRefs) instead of giving up.
|
|
1469
|
+
this.deferredThisMemberRefs.push(ref);
|
|
1470
|
+
return null;
|
|
1471
|
+
}
|
|
1472
|
+
const target = candidates.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
|
|
1473
|
+
return {
|
|
1474
|
+
original: ref,
|
|
1475
|
+
targetNodeId: target.id,
|
|
1476
|
+
confidence: 0.95,
|
|
1477
|
+
resolvedBy: 'function-ref',
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Second pass for `this.<member>` refs whose member wasn't on the enclosing
|
|
1482
|
+
* class itself (#808): once implements/extends edges exist, walk the
|
|
1483
|
+
* class's supertypes (transitively, depth-capped) and resolve the member on
|
|
1484
|
+
* the nearest one that declares it — `this.handleSubmit` registered in a
|
|
1485
|
+
* subclass resolves to `FormBase::handleSubmit`. Validated targets only
|
|
1486
|
+
* (function/method kind, same language family); no match → no edge.
|
|
1487
|
+
* Mirrors resolveChainedCallsViaConformance's lifecycle. Returns the number
|
|
1488
|
+
* of newly-created edges.
|
|
1489
|
+
*/
|
|
1490
|
+
async resolveDeferredThisMemberRefs() {
|
|
1491
|
+
const deferred = this.deferredThisMemberRefs;
|
|
1492
|
+
this.deferredThisMemberRefs = [];
|
|
1493
|
+
if (deferred.length === 0)
|
|
1494
|
+
return 0;
|
|
1495
|
+
this.clearCaches();
|
|
1496
|
+
// Synchronous main-thread post-pass with a per-ref supertype BFS — yield
|
|
1497
|
+
// periodically so the #850 liveness watchdog heartbeat can fire (#1091).
|
|
1498
|
+
const maybeYield = (0, cooperative_yield_1.createYielder)();
|
|
1499
|
+
const resolved = [];
|
|
1500
|
+
for (const ref of deferred) {
|
|
1501
|
+
await maybeYield();
|
|
1502
|
+
const member = ref.referenceName.slice('this.'.length);
|
|
1503
|
+
const fromNode = this.queries.getNodeById(ref.fromNodeId);
|
|
1504
|
+
if (!fromNode || !member)
|
|
1505
|
+
continue;
|
|
1506
|
+
// Class-body-level hooks (Ruby) attribute to the CLASS node itself.
|
|
1507
|
+
let className;
|
|
1508
|
+
if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
|
|
1509
|
+
className = fromNode.name;
|
|
1510
|
+
}
|
|
1511
|
+
else {
|
|
1512
|
+
const sep = fromNode.qualifiedName.lastIndexOf('::');
|
|
1513
|
+
if (sep <= 0)
|
|
1514
|
+
continue;
|
|
1515
|
+
const classPrefix = fromNode.qualifiedName.slice(0, sep);
|
|
1516
|
+
className = classPrefix.includes('::')
|
|
1517
|
+
? classPrefix.slice(classPrefix.lastIndexOf('::') + 2)
|
|
1518
|
+
: classPrefix;
|
|
1519
|
+
}
|
|
1520
|
+
// NODE-anchored BFS up the supertype graph: start from the class node
|
|
1521
|
+
// in the ref's own file (never a same-named class elsewhere — rails has
|
|
1522
|
+
// a dozen `Engine`s), follow implements/extends EDGES to supertype
|
|
1523
|
+
// NODES, and look members up through `contains` edges. No name-based
|
|
1524
|
+
// unions anywhere — a name-keyed getSupertypes('Engine') merged every
|
|
1525
|
+
// Engine's parents and produced a cross-class wrong edge on rails.
|
|
1526
|
+
let frontierNodes = this.context
|
|
1527
|
+
.getNodesByName(className)
|
|
1528
|
+
.filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
|
|
1529
|
+
n.filePath === ref.filePath);
|
|
1530
|
+
if (frontierNodes.length === 0) {
|
|
1531
|
+
// The class itself may be declared in another file (partial/reopened
|
|
1532
|
+
// classes); fall back to same-family nodes of that name.
|
|
1533
|
+
frontierNodes = this.context
|
|
1534
|
+
.getNodesByName(className)
|
|
1535
|
+
.filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
|
|
1536
|
+
(0, name_matcher_1.sameLanguageFamily)(n.language, ref.language));
|
|
1537
|
+
}
|
|
1538
|
+
const seenNodes = new Set(frontierNodes.map((n) => n.id));
|
|
1539
|
+
let target = null;
|
|
1540
|
+
for (let depth = 0; depth < 5 && frontierNodes.length > 0 && !target; depth++) {
|
|
1541
|
+
const next = [];
|
|
1542
|
+
for (const typeNode of frontierNodes) {
|
|
1543
|
+
for (const edge of this.queries.getOutgoingEdges(typeNode.id, ['implements', 'extends'])) {
|
|
1544
|
+
const superNode = this.queries.getNodeById(edge.target);
|
|
1545
|
+
if (!superNode || seenNodes.has(superNode.id))
|
|
1546
|
+
continue;
|
|
1547
|
+
seenNodes.add(superNode.id);
|
|
1548
|
+
if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
|
|
1549
|
+
continue;
|
|
1550
|
+
// Member lookup anchored on the supertype's contains edges.
|
|
1551
|
+
for (const c of this.queries.getOutgoingEdges(superNode.id, ['contains'])) {
|
|
1552
|
+
const m = this.queries.getNodeById(c.target);
|
|
1553
|
+
if (m &&
|
|
1554
|
+
m.name === member &&
|
|
1555
|
+
(m.kind === 'function' || m.kind === 'method') &&
|
|
1556
|
+
(0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) {
|
|
1557
|
+
target = m;
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
if (target)
|
|
1562
|
+
break;
|
|
1563
|
+
next.push(superNode);
|
|
1564
|
+
}
|
|
1565
|
+
if (target)
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
frontierNodes = next;
|
|
1569
|
+
}
|
|
1570
|
+
if (target) {
|
|
1571
|
+
resolved.push({
|
|
1572
|
+
original: ref,
|
|
1573
|
+
targetNodeId: target.id,
|
|
1574
|
+
confidence: 0.85,
|
|
1575
|
+
resolvedBy: 'function-ref',
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
if (resolved.length === 0)
|
|
1580
|
+
return 0;
|
|
1581
|
+
const edges = this.createEdges(resolved);
|
|
1582
|
+
if (edges.length > 0) {
|
|
1583
|
+
this.queries.insertEdges(edges);
|
|
1584
|
+
this.clearCaches();
|
|
1585
|
+
}
|
|
1586
|
+
return edges.length;
|
|
1587
|
+
}
|
|
1588
|
+
gateLanguage(result, ref) {
|
|
1589
|
+
if (!result)
|
|
1590
|
+
return result;
|
|
1591
|
+
const tgt = this.getLanguageFromNodeId(result.targetNodeId);
|
|
1592
|
+
if (!tgt || !ref.language)
|
|
1593
|
+
return result;
|
|
1594
|
+
if ((ref.referenceKind === 'references' || ref.referenceKind === 'function_ref') && !(0, name_matcher_1.sameLanguageFamily)(tgt, ref.language))
|
|
1595
|
+
return null;
|
|
1596
|
+
if (ref.referenceKind === 'imports' && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
|
|
1597
|
+
return null;
|
|
1598
|
+
return result;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Drop a FRAMEWORK-strategy resolution that crosses two *known* language
|
|
1602
|
+
* families for a type-usage (`references`) or import-binding (`imports`)
|
|
1603
|
+
* edge. The framework strategy is intentionally ungated for cross-language
|
|
1604
|
+
* bridges, but those legitimate bridges are either `calls` edges (RN/Expo
|
|
1605
|
+
* JS → native) or config↔code edges whose config side (`yaml`/`blade`/…) is
|
|
1606
|
+
* not a known programming-language family. A `references`/`imports` edge
|
|
1607
|
+
* between two *known* families is always a coincidental name collision — the
|
|
1608
|
+
* React/Svelte/Vue PascalCase component resolvers name-match `getNodesByName`
|
|
1609
|
+
* without a language check, so a TS `<TestRunner>` ref happily matched a
|
|
1610
|
+
* Kotlin `class TestRunner`. Gating only the both-known-cross-family case
|
|
1611
|
+
* lets config bridges and `calls` bridges through untouched.
|
|
1612
|
+
*/
|
|
1613
|
+
gateFrameworkLanguage(result, ref) {
|
|
1614
|
+
if (!result)
|
|
1615
|
+
return result;
|
|
1616
|
+
if (ref.referenceKind !== 'references' && ref.referenceKind !== 'imports')
|
|
1617
|
+
return result;
|
|
1618
|
+
const tgt = this.getLanguageFromNodeId(result.targetNodeId);
|
|
1619
|
+
if (tgt && ref.language && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
|
|
1620
|
+
return null;
|
|
1621
|
+
return result;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
exports.ReferenceResolver = ReferenceResolver;
|
|
1625
|
+
/**
|
|
1626
|
+
* Create a reference resolver instance
|
|
1627
|
+
*/
|
|
1628
|
+
function createResolver(projectRoot, queries) {
|
|
1629
|
+
const resolver = new ReferenceResolver(projectRoot, queries);
|
|
1630
|
+
resolver.initialize();
|
|
1631
|
+
return resolver;
|
|
1632
|
+
}
|
|
1633
|
+
//# sourceMappingURL=index.js.map
|