@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codegraph +5 -0
- package/lib/dist/.test-build-engine.json +1 -0
- package/lib/dist/.test-build-viewer.json +1 -0
- package/lib/dist/bin/codegraph.d.ts +1 -0
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +605 -291
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +7 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +39 -27
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/bin/viewer-gate.d.ts +17 -0
- package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
- package/lib/dist/bin/viewer-gate.js +31 -0
- package/lib/dist/bin/viewer-gate.js.map +1 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +43 -2
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +21 -2
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +86 -31
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +40 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +454 -10
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +1080 -41
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +11 -1
- package/lib/dist/db/sqlite-adapter.d.ts +2 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +56 -7
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/synthesis-stage.d.ts +12 -0
- package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
- package/lib/dist/db/synthesis-stage.js +89 -0
- package/lib/dist/db/synthesis-stage.js.map +1 -0
- package/lib/dist/db/wal-valve.d.ts +32 -12
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +65 -22
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/db/wsl-shared-index.d.ts +53 -0
- package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
- package/lib/dist/db/wsl-shared-index.js +121 -0
- package/lib/dist/db/wsl-shared-index.js.map +1 -0
- package/lib/dist/directory.d.ts +131 -2
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +299 -23
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/errors.d.ts +14 -0
- package/lib/dist/errors.d.ts.map +1 -1
- package/lib/dist/errors.js +16 -1
- package/lib/dist/errors.js.map +1 -1
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/astro-extractor.js +7 -35
- package/lib/dist/extraction/astro-extractor.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +77 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +302 -71
- package/lib/dist/extraction/cfml-extractor.js.map +1 -1
- package/lib/dist/extraction/commonjs-requires.d.ts +23 -0
- package/lib/dist/extraction/commonjs-requires.d.ts.map +1 -0
- package/lib/dist/extraction/commonjs-requires.js +68 -0
- package/lib/dist/extraction/commonjs-requires.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/dfm-extractor.js +14 -10
- package/lib/dist/extraction/dfm-extractor.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts +6 -4
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +35 -14
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +9 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +42 -2
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +40 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +171 -1
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +132 -19
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +825 -195
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
- package/lib/dist/extraction/kernel/index.js +6 -0
- package/lib/dist/extraction/kernel/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +73 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +412 -16
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +14 -5
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
- package/lib/dist/extraction/languages/dart.js +16 -3
- package/lib/dist/extraction/languages/dart.js.map +1 -1
- package/lib/dist/extraction/languages/javascript.js +1 -1
- package/lib/dist/extraction/languages/javascript.js.map +1 -1
- package/lib/dist/extraction/languages/kotlin.d.ts +4 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/lib/dist/extraction/languages/kotlin.js +237 -36
- package/lib/dist/extraction/languages/kotlin.js.map +1 -1
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
- package/lib/dist/extraction/languages/lua.js +4 -1
- package/lib/dist/extraction/languages/lua.js.map +1 -1
- package/lib/dist/extraction/languages/python.d.ts.map +1 -1
- package/lib/dist/extraction/languages/python.js +71 -0
- package/lib/dist/extraction/languages/python.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +3 -0
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
- package/lib/dist/extraction/languages/scala.js +18 -3
- package/lib/dist/extraction/languages/scala.js.map +1 -1
- package/lib/dist/extraction/languages/swift.d.ts +15 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
- package/lib/dist/extraction/languages/swift.js +50 -0
- package/lib/dist/extraction/languages/swift.js.map +1 -1
- package/lib/dist/extraction/languages/typescript.d.ts +7 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/lib/dist/extraction/languages/typescript.js +30 -2
- package/lib/dist/extraction/languages/typescript.js.map +1 -1
- package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/liquid-extractor.js +98 -22
- package/lib/dist/extraction/liquid-extractor.js.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +6 -4
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-budget.d.ts +16 -0
- package/lib/dist/extraction/parse-budget.d.ts.map +1 -0
- package/lib/dist/extraction/parse-budget.js +24 -0
- package/lib/dist/extraction/parse-budget.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +12 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +51 -3
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +3 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sfc-script.d.ts +43 -0
- package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
- package/lib/dist/extraction/sfc-script.js +135 -0
- package/lib/dist/extraction/sfc-script.js.map +1 -0
- package/lib/dist/extraction/store-worker.js +5 -0
- package/lib/dist/extraction/store-worker.js.map +1 -1
- package/lib/dist/extraction/store-writer.d.ts +10 -2
- package/lib/dist/extraction/store-writer.d.ts.map +1 -1
- package/lib/dist/extraction/store-writer.js +12 -4
- package/lib/dist/extraction/store-writer.js.map +1 -1
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/svelte-extractor.js +7 -37
- package/lib/dist/extraction/svelte-extractor.js.map +1 -1
- package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
- package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/lib/dist/extraction/syntax-tokens.js +382 -0
- package/lib/dist/extraction/syntax-tokens.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +104 -17
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +943 -88
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vue-extractor.d.ts +7 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vue-extractor.js +73 -35
- package/lib/dist/extraction/vue-extractor.js.map +1 -1
- package/lib/dist/extraction/vue-options-api.d.ts +28 -0
- package/lib/dist/extraction/vue-options-api.d.ts.map +1 -0
- package/lib/dist/extraction/vue-options-api.js +196 -0
- package/lib/dist/extraction/vue-options-api.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/lib/dist/file-limits.d.ts +40 -0
- package/lib/dist/file-limits.d.ts.map +1 -0
- package/lib/dist/file-limits.js +147 -0
- package/lib/dist/file-limits.js.map +1 -0
- package/lib/dist/graph/branch-guards.d.ts +265 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -0
- package/lib/dist/graph/branch-guards.js +2326 -0
- package/lib/dist/graph/branch-guards.js.map +1 -0
- package/lib/dist/graph/dead-code.d.ts +251 -0
- package/lib/dist/graph/dead-code.d.ts.map +1 -0
- package/lib/dist/graph/dead-code.js +776 -0
- package/lib/dist/graph/dead-code.js.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/lib/dist/graph/dynamic-boundary-report.js +283 -0
- package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/lib/dist/graph/index.d.ts +4 -0
- package/lib/dist/graph/index.d.ts.map +1 -1
- package/lib/dist/graph/index.js +16 -1
- package/lib/dist/graph/index.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/lib/dist/graph/named-symbol-flow.js +559 -0
- package/lib/dist/graph/named-symbol-flow.js.map +1 -0
- package/lib/dist/graph/symbol-lookup.d.ts +83 -0
- package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
- package/lib/dist/graph/symbol-lookup.js +181 -0
- package/lib/dist/graph/symbol-lookup.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +9 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +61 -35
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/graph/type-hierarchy.d.ts +155 -0
- package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/lib/dist/graph/type-hierarchy.js +382 -0
- package/lib/dist/graph/type-hierarchy.js.map +1 -0
- package/lib/dist/index.d.ts +256 -11
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +402 -34
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +3 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
- package/lib/dist/installer/targets/antigravity.js +14 -2
- package/lib/dist/installer/targets/antigravity.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +3 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +35 -7
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +2 -1
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +14 -4
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.js +7 -1
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
- package/lib/dist/installer/targets/opencode.d.ts +16 -5
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
- package/lib/dist/installer/targets/opencode.js +73 -22
- package/lib/dist/installer/targets/opencode.js.map +1 -1
- package/lib/dist/installer/targets/shared.d.ts +14 -3
- package/lib/dist/installer/targets/shared.d.ts.map +1 -1
- package/lib/dist/installer/targets/shared.js +39 -11
- package/lib/dist/installer/targets/shared.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +7 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/answer-freshness.d.ts +10 -0
- package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/answer-freshness.js +68 -0
- package/lib/dist/mcp/answer-freshness.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +16 -0
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +2 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +20 -5
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +11 -4
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +132 -36
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +17 -7
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +116 -24
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +46 -42
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +30 -9
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +158 -66
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +5 -2
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
- package/lib/dist/mcp/explore-dedup.js +8 -5
- package/lib/dist/mcp/explore-dedup.js.map +1 -1
- package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
- package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness-worker.js +36 -0
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
- package/lib/dist/mcp/index-freshness.d.ts +13 -0
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
- package/lib/dist/mcp/index-freshness.js +117 -0
- package/lib/dist/mcp/index-freshness.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +3 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +95 -11
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +11 -2
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
- package/lib/dist/mcp/project-lifecycle.js +182 -0
- package/lib/dist/mcp/project-lifecycle.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +9 -2
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +201 -32
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +18 -3
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +67 -11
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/query-worker.js +2 -2
- package/lib/dist/mcp/query-worker.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +6 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +3 -1
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
- package/lib/dist/mcp/startup-handshake.js +10 -2
- package/lib/dist/mcp/startup-handshake.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +306 -36
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2395 -966
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/writer-lock.d.ts +61 -0
- package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
- package/lib/dist/mcp/writer-lock.js +260 -0
- package/lib/dist/mcp/writer-lock.js.map +1 -0
- package/lib/dist/resolution/alias-binding.d.ts +56 -0
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
- package/lib/dist/resolution/alias-binding.js +143 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts +49 -0
- package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/angular-template-synthesizer.js +359 -0
- package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +460 -144
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
- package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-constructor.js +123 -0
- package/lib/dist/resolution/cpp-constructor.js.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/cpp-macro-visibility.js +392 -0
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
- package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts +142 -0
- package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/angular-router.js +1126 -0
- package/lib/dist/resolution/frameworks/angular-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/astro.js +32 -6
- package/lib/dist/resolution/frameworks/astro.js.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/csharp.js +186 -24
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +10 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.js +95 -1
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.d.ts +195 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-router.js +847 -0
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +339 -45
- package/lib/dist/resolution/frameworks/express.js.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/fabric.js +13 -11
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +11 -28
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts +8 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +39 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +88 -68
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/laravel.js +369 -26
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts +35 -0
- package/lib/dist/resolution/frameworks/name-heuristic.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js +45 -0
- package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +288 -55
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nextjs.js +329 -0
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/object-literal.js +139 -0
- package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/package-deps.js +78 -0
- package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts +20 -0
- package/lib/dist/resolution/frameworks/page-component.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/page-component.js +45 -0
- package/lib/dist/resolution/frameworks/page-component.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/play.js +3 -1
- package/lib/dist/resolution/frameworks/play.js.map +1 -1
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/python.js +279 -26
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.js +153 -14
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +47 -0
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-router.js +201 -0
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +13 -2
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +542 -144
- package/lib/dist/resolution/frameworks/react.js.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/ruby.js +177 -17
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/rust.js +24 -22
- package/lib/dist/resolution/frameworks/rust.js.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/svelte.js +14 -6
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +253 -124
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts +98 -0
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue-router.js +500 -0
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -2
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue.js +45 -11
- package/lib/dist/resolution/frameworks/vue.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +66 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +643 -61
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +124 -25
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +769 -152
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts +13 -0
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
- package/lib/dist/resolution/js-builtins.js +48 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +101 -22
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +8267 -287
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/next-router-synthesizer.js +113 -0
- package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts +35 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/react-router-synthesizer.js +197 -0
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/resolver-pool.d.ts +22 -1
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +35 -5
- package/lib/dist/resolution/resolver-pool.js.map +1 -1
- package/lib/dist/resolution/resolver-worker.js +3 -0
- package/lib/dist/resolution/resolver-worker.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +6 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +58 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts +68 -0
- package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -0
- package/lib/dist/resolution/swift-type-visibility.js +454 -0
- package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
- package/lib/dist/resolution/synth-utils.d.ts +26 -0
- package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
- package/lib/dist/resolution/synth-utils.js +75 -0
- package/lib/dist/resolution/synth-utils.js.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts +54 -0
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/tier-synthesizer.js +1294 -0
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
- package/lib/dist/resolution/type-parameters.d.ts +11 -0
- package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
- package/lib/dist/resolution/type-parameters.js +287 -0
- package/lib/dist/resolution/type-parameters.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +105 -2
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.js +64 -0
- package/lib/dist/resolution/types.js.map +1 -1
- package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
- package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/lib/dist/search/query-paths.d.ts +50 -1
- package/lib/dist/search/query-paths.d.ts.map +1 -1
- package/lib/dist/search/query-paths.js +227 -12
- package/lib/dist/search/query-paths.js.map +1 -1
- package/lib/dist/search/query-utils.d.ts +15 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +35 -7
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watch-policy.d.ts +14 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -1
- package/lib/dist/sync/watch-policy.js +19 -0
- package/lib/dist/sync/watch-policy.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +52 -35
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +236 -100
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +22 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +54 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/telemetry/index.d.ts +4 -2
- package/lib/dist/telemetry/index.d.ts.map +1 -1
- package/lib/dist/telemetry/index.js +159 -66
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/types.d.ts +1 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +1 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
- package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/deadcode.js +136 -0
- package/lib/dist/ui-server/api/deadcode.js.map +1 -0
- package/lib/dist/ui-server/api/effects.d.ts +94 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
- package/lib/dist/ui-server/api/effects.js +527 -0
- package/lib/dist/ui-server/api/effects.js.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts +92 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/lib/dist/ui-server/api/entrypoints.js +364 -0
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
- package/lib/dist/ui-server/api/events.d.ts +183 -0
- package/lib/dist/ui-server/api/events.d.ts.map +1 -0
- package/lib/dist/ui-server/api/events.js +430 -0
- package/lib/dist/ui-server/api/events.js.map +1 -0
- package/lib/dist/ui-server/api/file.d.ts +66 -0
- package/lib/dist/ui-server/api/file.d.ts.map +1 -0
- package/lib/dist/ui-server/api/file.js +235 -0
- package/lib/dist/ui-server/api/file.js.map +1 -0
- package/lib/dist/ui-server/api/filecode.d.ts +126 -0
- package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/lib/dist/ui-server/api/filecode.js +205 -0
- package/lib/dist/ui-server/api/filecode.js.map +1 -0
- package/lib/dist/ui-server/api/flow.d.ts +226 -0
- package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
- package/lib/dist/ui-server/api/flow.js +612 -0
- package/lib/dist/ui-server/api/flow.js.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/lib/dist/ui-server/api/hierarchy.js +92 -0
- package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
- package/lib/dist/ui-server/api/index.d.ts +90 -0
- package/lib/dist/ui-server/api/index.d.ts.map +1 -0
- package/lib/dist/ui-server/api/index.js +332 -0
- package/lib/dist/ui-server/api/index.js.map +1 -0
- package/lib/dist/ui-server/api/map.d.ts +273 -0
- package/lib/dist/ui-server/api/map.d.ts.map +1 -0
- package/lib/dist/ui-server/api/map.js +781 -0
- package/lib/dist/ui-server/api/map.js.map +1 -0
- package/lib/dist/ui-server/api/node.d.ts +81 -0
- package/lib/dist/ui-server/api/node.d.ts.map +1 -0
- package/lib/dist/ui-server/api/node.js +394 -0
- package/lib/dist/ui-server/api/node.js.map +1 -0
- package/lib/dist/ui-server/api/nodes.d.ts +25 -0
- package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/nodes.js +45 -0
- package/lib/dist/ui-server/api/nodes.js.map +1 -0
- package/lib/dist/ui-server/api/program.d.ts +139 -0
- package/lib/dist/ui-server/api/program.d.ts.map +1 -0
- package/lib/dist/ui-server/api/program.js +315 -0
- package/lib/dist/ui-server/api/program.js.map +1 -0
- package/lib/dist/ui-server/api/respond.d.ts +76 -0
- package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
- package/lib/dist/ui-server/api/respond.js +186 -0
- package/lib/dist/ui-server/api/respond.js.map +1 -0
- package/lib/dist/ui-server/api/route-roots.d.ts +45 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/lib/dist/ui-server/api/route-roots.js +117 -0
- package/lib/dist/ui-server/api/route-roots.js.map +1 -0
- package/lib/dist/ui-server/api/routes.d.ts +61 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
- package/lib/dist/ui-server/api/routes.js +164 -0
- package/lib/dist/ui-server/api/routes.js.map +1 -0
- package/lib/dist/ui-server/api/screens.d.ts +117 -0
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
- package/lib/dist/ui-server/api/screens.js +626 -0
- package/lib/dist/ui-server/api/screens.js.map +1 -0
- package/lib/dist/ui-server/api/search.d.ts +29 -0
- package/lib/dist/ui-server/api/search.d.ts.map +1 -0
- package/lib/dist/ui-server/api/search.js +232 -0
- package/lib/dist/ui-server/api/search.js.map +1 -0
- package/lib/dist/ui-server/api/session.d.ts +52 -0
- package/lib/dist/ui-server/api/session.d.ts.map +1 -0
- package/lib/dist/ui-server/api/session.js +196 -0
- package/lib/dist/ui-server/api/session.js.map +1 -0
- package/lib/dist/ui-server/api/source.d.ts +200 -0
- package/lib/dist/ui-server/api/source.d.ts.map +1 -0
- package/lib/dist/ui-server/api/source.js +422 -0
- package/lib/dist/ui-server/api/source.js.map +1 -0
- package/lib/dist/ui-server/api/stats.d.ts +27 -0
- package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
- package/lib/dist/ui-server/api/stats.js +164 -0
- package/lib/dist/ui-server/api/stats.js.map +1 -0
- package/lib/dist/ui-server/api/steps.d.ts +274 -0
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
- package/lib/dist/ui-server/api/steps.js +1554 -0
- package/lib/dist/ui-server/api/steps.js.map +1 -0
- package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
- package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trail-store.js +323 -0
- package/lib/dist/ui-server/api/trail-store.js.map +1 -0
- package/lib/dist/ui-server/api/trails.d.ts +163 -0
- package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
- package/lib/dist/ui-server/api/trails.js +370 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -0
- package/lib/dist/ui-server/api/when.d.ts +133 -0
- package/lib/dist/ui-server/api/when.d.ts.map +1 -0
- package/lib/dist/ui-server/api/when.js +275 -0
- package/lib/dist/ui-server/api/when.js.map +1 -0
- package/lib/dist/ui-server/api/wire.d.ts +179 -0
- package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
- package/lib/dist/ui-server/api/wire.js +231 -0
- package/lib/dist/ui-server/api/wire.js.map +1 -0
- package/lib/dist/ui-server/assets.d.ts +40 -0
- package/lib/dist/ui-server/assets.d.ts.map +1 -0
- package/lib/dist/ui-server/assets.js +110 -0
- package/lib/dist/ui-server/assets.js.map +1 -0
- package/lib/dist/ui-server/constants.d.ts +32 -0
- package/lib/dist/ui-server/constants.d.ts.map +1 -0
- package/lib/dist/ui-server/constants.js +35 -0
- package/lib/dist/ui-server/constants.js.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts +28 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js +139 -0
- package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
- package/lib/dist/ui-server/highlight/index.d.ts +113 -0
- package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/index.js +312 -0
- package/lib/dist/ui-server/highlight/index.js.map +1 -0
- package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
- package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/languages.js +50 -0
- package/lib/dist/ui-server/highlight/languages.js.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts +7 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.d.ts.map +1 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js +20 -0
- package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
- package/lib/dist/ui-server/index.d.ts +92 -0
- package/lib/dist/ui-server/index.d.ts.map +1 -0
- package/lib/dist/ui-server/index.js +399 -0
- package/lib/dist/ui-server/index.js.map +1 -0
- package/lib/dist/ui-server/open-browser.d.ts +31 -0
- package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
- package/lib/dist/ui-server/open-browser.js +79 -0
- package/lib/dist/ui-server/open-browser.js.map +1 -0
- package/lib/dist/ui-server/security.d.ts +127 -0
- package/lib/dist/ui-server/security.d.ts.map +1 -0
- package/lib/dist/ui-server/security.js +332 -0
- package/lib/dist/ui-server/security.js.map +1 -0
- package/lib/dist/ui-server/static.d.ts +45 -0
- package/lib/dist/ui-server/static.d.ts.map +1 -0
- package/lib/dist/ui-server/static.js +165 -0
- package/lib/dist/ui-server/static.js.map +1 -0
- package/lib/dist/upgrade/index.d.ts +43 -5
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +157 -35
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/utils.d.ts +14 -2
- package/lib/dist/utils.d.ts.map +1 -1
- package/lib/dist/utils.js +25 -10
- package/lib/dist/utils.js.map +1 -1
- package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- package/lib/dist/viewer/assets/index-BSGpxBr9.js +99 -0
- package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
- package/lib/dist/viewer/index.html +16 -0
- package/lib/dist/worker-teardown.d.ts +48 -0
- package/lib/dist/worker-teardown.d.ts.map +1 -0
- package/lib/dist/worker-teardown.js +100 -0
- package/lib/dist/worker-teardown.js.map +1 -0
- package/lib/kernel/codegraph-kernel.node +2 -2
- package/lib/node_modules/.package-lock.json +4 -4
- package/lib/node_modules/picomatch/README.md +56 -51
- package/lib/node_modules/picomatch/lib/constants.js +4 -0
- package/lib/node_modules/picomatch/lib/parse.js +341 -1
- package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
- package/lib/node_modules/picomatch/lib/scan.js +30 -18
- package/lib/node_modules/picomatch/package.json +4 -4
- package/lib/package.json +9 -2
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ const vue_extractor_1 = require("./vue-extractor");
|
|
|
57
57
|
const mybatis_extractor_1 = require("./mybatis-extractor");
|
|
58
58
|
const cfml_extractor_1 = require("./cfml-extractor");
|
|
59
59
|
const kernel_1 = require("./kernel");
|
|
60
|
+
const commonjs_requires_1 = require("./commonjs-requires");
|
|
60
61
|
const frameworks_1 = require("../resolution/frameworks");
|
|
61
62
|
// Re-export for backward compatibility
|
|
62
63
|
var tree_sitter_helpers_2 = require("./tree-sitter-helpers");
|
|
@@ -71,6 +72,19 @@ const RTK_HOOK_NAME_RE = /^use[A-Z][A-Za-z0-9]*(?:Query|Mutation)$/;
|
|
|
71
72
|
/** React HOC callees whose result is itself a component — a PascalCase const
|
|
72
73
|
* initialized with one of these is a component, not a constant (#841). */
|
|
73
74
|
const REACT_COMPONENT_HOCS = new Set(['forwardRef', 'memo', 'React.forwardRef', 'React.memo']);
|
|
75
|
+
/**
|
|
76
|
+
* Method node types that spell a SIGNATURE — a declaration with no body (#1638).
|
|
77
|
+
*
|
|
78
|
+
* They are a method of whatever type declares them and nothing on their own, so
|
|
79
|
+
* they must not take `extractMethod`'s "no class-like parent, so treat it as a
|
|
80
|
+
* free function" fallback. The other `methodTypes` can: a `method_definition`
|
|
81
|
+
* outside a class really is a function. This one appears outside a class only
|
|
82
|
+
* inside a type literal (`type Handle = { stop(): void }`), whose members
|
|
83
|
+
* `extractTypeAlias` already extracts and attaches to the alias (#359) — take
|
|
84
|
+
* the fallback and the file gains a phantom top-level `function stop` beside
|
|
85
|
+
* the real `Handle::stop`.
|
|
86
|
+
*/
|
|
87
|
+
const SIGNATURE_METHOD_NODE_TYPES = new Set(['method_signature']);
|
|
74
88
|
/** Vue store collections whose object-literal members are the symbols an agent
|
|
75
89
|
* looks for. Extracted as function nodes so `actions`/`mutations`/`getters` are
|
|
76
90
|
* findable + readable (the foundation under any later dispatch-bridge synth). */
|
|
@@ -185,7 +199,7 @@ function extractNameRaw(node, source, extractor) {
|
|
|
185
199
|
// not from identifiers in their body. Without this, single-expression arrow
|
|
186
200
|
// functions like `const fn = () => someIdentifier` get named "someIdentifier"
|
|
187
201
|
// instead of "fn", because the fallback below finds the body identifier.
|
|
188
|
-
if (node.type === 'arrow_function' || node.type === 'function_expression') {
|
|
202
|
+
if (node.type === 'arrow_function' || node.type === 'function_expression' || node.type === 'generator_function') {
|
|
189
203
|
return '<anonymous>';
|
|
190
204
|
}
|
|
191
205
|
// Fall back to first identifier child
|
|
@@ -383,12 +397,109 @@ const LITERAL_RECEIVER_TYPES = new Set([
|
|
|
383
397
|
'list', 'list_literal', 'array', 'array_literal', 'array_creation_expression',
|
|
384
398
|
'dictionary', 'dict_literal', 'object', 'tuple', 'set',
|
|
385
399
|
]);
|
|
400
|
+
/**
|
|
401
|
+
* Languages whose member calls go through the TS/JS grammars.
|
|
402
|
+
*/
|
|
403
|
+
const TS_JS_CHAIN_LANGUAGES = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
|
|
404
|
+
/** Receiver node types (TS/JS grammars) that continue a member chain downward. */
|
|
405
|
+
const TS_JS_CHAIN_RECEIVER_TYPES = new Set(['member_expression', 'subscript_expression']);
|
|
406
|
+
/** The field of a `this.<field>.<method>()` receiver: public or ES private (#1496, #1987). */
|
|
407
|
+
const THIS_FIELD_PROPERTY_TYPES = new Set(['property_identifier', 'private_property_identifier']);
|
|
408
|
+
/** A Swift receiver that is a path of types, `API.PackageController.GetRoute` — two segments or more, each capitalized. */
|
|
409
|
+
const SWIFT_TYPE_PATH_RECEIVER = /^(?!Self\.)[A-Z]\w*(?:\.[A-Z]\w*)+$/;
|
|
410
|
+
/**
|
|
411
|
+
* Identifier-rooted member chains have no inferred property type (#1566),
|
|
412
|
+
* including host API chains (#1707). Keep the existing `window.MyNamespace`
|
|
413
|
+
* escape for project globals; call-result and `this` receivers have their own
|
|
414
|
+
* paths and are outside this guard.
|
|
415
|
+
*/
|
|
416
|
+
function isUnresolvedTsJsChain(node, source) {
|
|
417
|
+
let cur = node;
|
|
418
|
+
while (cur && TS_JS_CHAIN_RECEIVER_TYPES.has(cur.type)) {
|
|
419
|
+
cur = (0, tree_sitter_helpers_1.getChildByField)(cur, 'object');
|
|
420
|
+
}
|
|
421
|
+
return !!cur && cur.type === 'identifier' && (0, tree_sitter_helpers_1.getNodeText)(cur, source) !== 'window';
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* TS/JS wrappers that leave a member call's receiver the same object:
|
|
425
|
+
* `(x).m()`, `x!.m()`, `(x as T).m()`, `(x satisfies T).m()`, `(<T>x).m()`
|
|
426
|
+
* and `(await x).m()` all call `m` on what `x` holds.
|
|
427
|
+
*/
|
|
428
|
+
const TS_JS_TRANSPARENT_RECEIVER_TYPES = new Set([
|
|
429
|
+
'parenthesized_expression', 'non_null_expression', 'as_expression',
|
|
430
|
+
'satisfies_expression', 'type_assertion', 'await_expression',
|
|
431
|
+
]);
|
|
432
|
+
/**
|
|
433
|
+
* Strip {@link TS_JS_TRANSPARENT_RECEIVER_TYPES} wrappers off a receiver.
|
|
434
|
+
* tree-sitter-typescript parses `a && b!.c()` as `(a && b)!.c()`; the `!`
|
|
435
|
+
* belongs to the right operand, so a non-null over a binary expression peels
|
|
436
|
+
* to that operand.
|
|
437
|
+
*/
|
|
438
|
+
function peelTsJsReceiver(node) {
|
|
439
|
+
let cur = node;
|
|
440
|
+
while (TS_JS_TRANSPARENT_RECEIVER_TYPES.has(cur.type)) {
|
|
441
|
+
let inner = cur.type === 'type_assertion'
|
|
442
|
+
? cur.namedChild(cur.namedChildCount - 1)
|
|
443
|
+
: cur.namedChild(0);
|
|
444
|
+
if (cur.type === 'non_null_expression') {
|
|
445
|
+
while (inner?.type === 'binary_expression')
|
|
446
|
+
inner = (0, tree_sitter_helpers_1.getChildByField)(inner, 'right');
|
|
447
|
+
}
|
|
448
|
+
if (!inner)
|
|
449
|
+
break;
|
|
450
|
+
cur = inner;
|
|
451
|
+
}
|
|
452
|
+
return cur;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Whether a TS/JS receiver still collapses to the bare method name: `this` /
|
|
456
|
+
* `super` (the resolver reads the owner off the enclosing class), a member
|
|
457
|
+
* chain rooted at either or at `window` (the project-global escape of
|
|
458
|
+
* {@link isUnresolvedTsJsChain}), and `new C()` (its class is written at the
|
|
459
|
+
* call).
|
|
460
|
+
*/
|
|
461
|
+
function keepsBareTsJsReceiver(node, source) {
|
|
462
|
+
let cur = node;
|
|
463
|
+
while (cur && TS_JS_CHAIN_RECEIVER_TYPES.has(cur.type)) {
|
|
464
|
+
const object = (0, tree_sitter_helpers_1.getChildByField)(cur, 'object');
|
|
465
|
+
cur = object ? peelTsJsReceiver(object) : null;
|
|
466
|
+
}
|
|
467
|
+
if (!cur)
|
|
468
|
+
return false;
|
|
469
|
+
if (cur.type === 'this' || cur.type === 'super')
|
|
470
|
+
return true;
|
|
471
|
+
if (cur.type === 'identifier')
|
|
472
|
+
return (0, tree_sitter_helpers_1.getNodeText)(cur, source) === 'window';
|
|
473
|
+
return cur === node && cur.type === 'new_expression';
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* React hooks that bind a NAME to a handler function (`const onPress =
|
|
477
|
+
* useCallback(() => {…}, [])`). The arrow inside is extracted as a function
|
|
478
|
+
* node named by the declarator — see `reactHookBoundName`.
|
|
479
|
+
*/
|
|
480
|
+
const REACT_HANDLER_HOOKS = /^(?:React\.)?use(?:Callback|EffectEvent|Event)$/;
|
|
386
481
|
class TreeSitterExtractor {
|
|
482
|
+
/**
|
|
483
|
+
* The node's prose, from either place it can live: a preceding comment
|
|
484
|
+
* sibling (every language) or a docstring inside the body (Python's bare
|
|
485
|
+
* first-statement string, and the same shape in other languages that opt in
|
|
486
|
+
* via `getBodyDocstring`). When a node carries both, they are joined rather
|
|
487
|
+
* than one winning — they are two separate things the author wrote about the
|
|
488
|
+
* same symbol, and the column holds free text (#1905).
|
|
489
|
+
*/
|
|
490
|
+
docstringFor(node) {
|
|
491
|
+
const preceding = (0, tree_sitter_helpers_1.getPrecedingDocstring)(node, this.source);
|
|
492
|
+
const body = this.extractor?.getBodyDocstring?.(node, this.source);
|
|
493
|
+
if (preceding && body)
|
|
494
|
+
return `${preceding}\n\n${body}`;
|
|
495
|
+
return body || preceding;
|
|
496
|
+
}
|
|
387
497
|
filePath;
|
|
388
498
|
language;
|
|
389
499
|
source;
|
|
390
500
|
tree = null;
|
|
391
501
|
nodes = [];
|
|
502
|
+
nodeIds = new tree_sitter_helpers_1.NodeIdAllocator();
|
|
392
503
|
edges = [];
|
|
393
504
|
unresolvedReferences = [];
|
|
394
505
|
// Value-reference edges (default ON; set CODEGRAPH_VALUE_REFS=0 to disable; see flushValueRefs).
|
|
@@ -504,6 +615,9 @@ class TreeSitterExtractor {
|
|
|
504
615
|
isExported: false,
|
|
505
616
|
updatedAt: Date.now(),
|
|
506
617
|
};
|
|
618
|
+
const fileDocstring = this.extractor?.getBodyDocstring?.(this.tree.rootNode, this.source);
|
|
619
|
+
if (fileDocstring)
|
|
620
|
+
fileNode.docstring = fileDocstring;
|
|
507
621
|
this.nodes.push(fileNode);
|
|
508
622
|
// Push file node onto stack so top-level declarations get contains edges
|
|
509
623
|
this.nodeStack.push(fileNode.id);
|
|
@@ -522,6 +636,19 @@ class TreeSitterExtractor {
|
|
|
522
636
|
if (packageNodeId)
|
|
523
637
|
this.nodeStack.pop();
|
|
524
638
|
this.nodeStack.pop();
|
|
639
|
+
// A CommonJS `require('./x')` is a file import, like ESM's `import`. The
|
|
640
|
+
// kernel reads the same (kernel/index.ts and the parse worker's transport).
|
|
641
|
+
this.unresolvedReferences.push(...(0, commonjs_requires_1.commonJsRequireRefs)(this.filePath, this.source, this.language));
|
|
642
|
+
// hasError is routine for several grammars; warn only when no symbols survived.
|
|
643
|
+
const symbolCount = this.nodes.filter((n) => n.kind !== 'file').length;
|
|
644
|
+
if (this.tree?.rootNode.hasError && symbolCount === 0) {
|
|
645
|
+
this.errors.push({
|
|
646
|
+
message: `${this.filePath}: parse produced no symbols (tree has errors) — ` +
|
|
647
|
+
`the file is indexed but contributes nothing to the graph`,
|
|
648
|
+
severity: 'warning',
|
|
649
|
+
code: 'parse_error',
|
|
650
|
+
});
|
|
651
|
+
}
|
|
525
652
|
}
|
|
526
653
|
catch (error) {
|
|
527
654
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -587,6 +714,7 @@ class TreeSitterExtractor {
|
|
|
587
714
|
return;
|
|
588
715
|
const nodeType = node.type;
|
|
589
716
|
if (depth > 0 && (this.extractor?.functionTypes.includes(nodeType) ||
|
|
717
|
+
((this.language === 'lua' || this.language === 'luau') && nodeType === 'function_definition') ||
|
|
590
718
|
nodeType === 'arrow_function' ||
|
|
591
719
|
nodeType === 'function_expression' ||
|
|
592
720
|
nodeType === 'lambda_literal' ||
|
|
@@ -948,6 +1076,25 @@ class TreeSitterExtractor {
|
|
|
948
1076
|
if (skipChildren)
|
|
949
1077
|
return;
|
|
950
1078
|
}
|
|
1079
|
+
if (this.language === 'cpp' && (0, c_cpp_1.isCppConstructorDeclaration)(node)) {
|
|
1080
|
+
this.extractMethod(node);
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
// C/C++ function-like macros (`#define TRACE(x) ...`) become `constant`
|
|
1084
|
+
// nodes carrying the directive as their signature. A macro is a value,
|
|
1085
|
+
// never an executable callee: the resolver reads these to recognize a
|
|
1086
|
+
// call whose name is a macro visible in the translation unit and refuses
|
|
1087
|
+
// to bind it to a same-named function elsewhere (#1838). Mirrored in the
|
|
1088
|
+
// kernel (ccpp/mod.rs visit_node).
|
|
1089
|
+
if ((this.language === 'c' || this.language === 'cpp') && nodeType === 'preproc_function_def') {
|
|
1090
|
+
const name = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
1091
|
+
if (name) {
|
|
1092
|
+
this.createNode('constant', (0, tree_sitter_helpers_1.getNodeText)(name, this.source), node, {
|
|
1093
|
+
signature: (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim(),
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
951
1098
|
// C++ namespace blocks: carry the namespace name as a qualifiedName prefix
|
|
952
1099
|
// while walking the body, so `namespace flash { void compute_attn(); }`
|
|
953
1100
|
// indexes compute_attn with qualifiedName `flash::compute_attn` and a
|
|
@@ -973,6 +1120,36 @@ class TreeSitterExtractor {
|
|
|
973
1120
|
return;
|
|
974
1121
|
}
|
|
975
1122
|
}
|
|
1123
|
+
// C# block namespaces scope only their own body: serilog's Guard.cs opens
|
|
1124
|
+
// `namespace JetBrains.Annotations { … }` and then declares `static class
|
|
1125
|
+
// Guard` at the top level, and a file's second namespace is its own. A
|
|
1126
|
+
// namespace written inside another is `Outer.Inner` — the dotted name a
|
|
1127
|
+
// type's qualifiedName leads with — so it takes the outer's place on the
|
|
1128
|
+
// scope while its body is walked. (A file-scoped `namespace X;` covers
|
|
1129
|
+
// the whole file: extractFilePackage.) Mirrored in the kernel (csharp.rs).
|
|
1130
|
+
if (this.language === 'csharp' && nodeType === 'namespace_declaration') {
|
|
1131
|
+
const nsName = this.extractor.extractPackage?.(node, this.source);
|
|
1132
|
+
if (nsName) {
|
|
1133
|
+
const topId = this.nodeStack[this.nodeStack.length - 1];
|
|
1134
|
+
const top = this.nodes.find((n) => n.id === topId);
|
|
1135
|
+
const outer = top?.kind === 'namespace' ? top : null;
|
|
1136
|
+
if (outer)
|
|
1137
|
+
this.nodeStack.pop();
|
|
1138
|
+
const ns = this.createNode('namespace', outer ? `${outer.name}.${nsName}` : nsName, node);
|
|
1139
|
+
if (ns)
|
|
1140
|
+
this.nodeStack.push(ns.id);
|
|
1141
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
1142
|
+
const child = node.namedChild(i);
|
|
1143
|
+
if (child)
|
|
1144
|
+
this.visitNode(child);
|
|
1145
|
+
}
|
|
1146
|
+
if (ns)
|
|
1147
|
+
this.nodeStack.pop();
|
|
1148
|
+
if (outer)
|
|
1149
|
+
this.nodeStack.push(outer.id);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
976
1153
|
// Function-as-value capture (#756) — independent of the dispatch ladder
|
|
977
1154
|
// below (the captured container types have no other handler there), so it
|
|
978
1155
|
// can never shadow or be shadowed by an extraction branch.
|
|
@@ -1006,6 +1183,9 @@ class TreeSitterExtractor {
|
|
|
1006
1183
|
else if (classification === 'trait') {
|
|
1007
1184
|
this.extractClass(node, 'trait');
|
|
1008
1185
|
}
|
|
1186
|
+
else if (classification === 'module') {
|
|
1187
|
+
this.extractClass(node, 'module');
|
|
1188
|
+
}
|
|
1009
1189
|
else {
|
|
1010
1190
|
this.extractClass(node);
|
|
1011
1191
|
}
|
|
@@ -1016,12 +1196,23 @@ class TreeSitterExtractor {
|
|
|
1016
1196
|
this.extractClass(node);
|
|
1017
1197
|
skipChildren = true;
|
|
1018
1198
|
}
|
|
1019
|
-
// Check for method declarations (only if not already handled by functionTypes)
|
|
1020
|
-
|
|
1199
|
+
// Check for method declarations (only if not already handled by functionTypes).
|
|
1200
|
+
// A bodiless SIGNATURE only counts as one where a type declares it — see
|
|
1201
|
+
// SIGNATURE_METHOD_NODE_TYPES for what falling through would otherwise mint.
|
|
1202
|
+
else if (this.extractor.methodTypes.includes(nodeType)
|
|
1203
|
+
&& (!(TS_JS_CHAIN_LANGUAGES.has(this.language) || this.language === 'arkts')
|
|
1204
|
+
|| !SIGNATURE_METHOD_NODE_TYPES.has(nodeType) || this.isInsideClassLikeNode())) {
|
|
1021
1205
|
// TS/JS class fields parse as a methodTypes node; only function-valued
|
|
1022
1206
|
// fields are methods — a plain field (`public fonts: Fonts;`) is a
|
|
1023
|
-
// property (#808).
|
|
1024
|
-
|
|
1207
|
+
// property (#808). C++ lists `field_declaration` so pure-virtual methods
|
|
1208
|
+
// mint nodes (#1727); non-callable ones return 'skip' and fall through to
|
|
1209
|
+
// the children walk. classifyMethodNode is absent for other languages.
|
|
1210
|
+
const methodClass = this.extractor.classifyMethodNode?.(node) ?? 'method';
|
|
1211
|
+
if (methodClass === 'skip') {
|
|
1212
|
+
// Not a method — leave skipChildren false so data-member initializers
|
|
1213
|
+
// still contribute call/instantiation edges under the enclosing class.
|
|
1214
|
+
}
|
|
1215
|
+
else if (methodClass === 'property') {
|
|
1025
1216
|
const propNode = this.extractProperty(node);
|
|
1026
1217
|
// Walk the initializer so its calls/instantiations attribute to the
|
|
1027
1218
|
// property (`history = createHistory()` → history calls
|
|
@@ -1238,6 +1429,9 @@ class TreeSitterExtractor {
|
|
|
1238
1429
|
else if (this.extractor.callTypes.includes(nodeType)) {
|
|
1239
1430
|
this.extractCall(node);
|
|
1240
1431
|
}
|
|
1432
|
+
else if (this.language === 'kotlin' && nodeType === 'infix_expression') {
|
|
1433
|
+
this.extractKotlinInfixCall(node);
|
|
1434
|
+
}
|
|
1241
1435
|
// `new Foo(...)` / `Foo::new(...)` / object_creation_expression —
|
|
1242
1436
|
// produce an `instantiates` reference. Children still walked so
|
|
1243
1437
|
// nested calls inside the constructor args (`new Foo(bar())`) get
|
|
@@ -1264,20 +1458,16 @@ class TreeSitterExtractor {
|
|
|
1264
1458
|
else if (nodeType === 'impl_item') {
|
|
1265
1459
|
this.extractRustImplItem(node);
|
|
1266
1460
|
}
|
|
1267
|
-
//
|
|
1268
|
-
//
|
|
1269
|
-
//
|
|
1270
|
-
//
|
|
1271
|
-
//
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
this.extractTypeAnnotations(node, parentId);
|
|
1278
|
-
}
|
|
1279
|
-
// don't skipChildren — nested signatures still need traversal
|
|
1280
|
-
}
|
|
1461
|
+
// NOTE: `property_signature` / `method_signature` used to be handled here,
|
|
1462
|
+
// hanging their type annotations off the ENCLOSING INTERFACE — the only
|
|
1463
|
+
// anchor available while the members themselves went unextracted. Since
|
|
1464
|
+
// #1638 they are in the TS extractor's `methodTypes` / `propertyTypes`, so
|
|
1465
|
+
// the branches above claim them first (under the same `isInsideClassLikeNode`
|
|
1466
|
+
// guard this branch had, so nothing it used to reach is now missed) and this
|
|
1467
|
+
// one was dead. The `references` edges survive — `extractMethod` and
|
|
1468
|
+
// `extractProperty` each call `extractTypeAnnotations` — but now hang off
|
|
1469
|
+
// the member, which is the more precise anchor: `Api::fetch → PageId` says
|
|
1470
|
+
// which member wants the type, where `Api → PageId` only said the file did.
|
|
1281
1471
|
// Visit children (unless the extract method already visited them)
|
|
1282
1472
|
if (!skipChildren) {
|
|
1283
1473
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
@@ -1297,7 +1487,7 @@ class TreeSitterExtractor {
|
|
|
1297
1487
|
if (!name) {
|
|
1298
1488
|
return null;
|
|
1299
1489
|
}
|
|
1300
|
-
const id =
|
|
1490
|
+
const id = this.nodeIds.generate(this.filePath, kind, name, node.startPosition.row + 1, node.startPosition.column);
|
|
1301
1491
|
// Some grammars (e.g. Dart) model a function/method body as a *sibling* of
|
|
1302
1492
|
// the signature node, so the declaration node's own range is just the
|
|
1303
1493
|
// signature line. Extend endLine to the resolved body when it sits beyond
|
|
@@ -1468,7 +1658,9 @@ class TreeSitterExtractor {
|
|
|
1468
1658
|
parentNode.kind === 'interface' ||
|
|
1469
1659
|
parentNode.kind === 'trait' ||
|
|
1470
1660
|
parentNode.kind === 'enum' ||
|
|
1471
|
-
parentNode.kind === 'module'
|
|
1661
|
+
parentNode.kind === 'module' ||
|
|
1662
|
+
// A Java / Kotlin enum constant with a body of its own (see extractEnum).
|
|
1663
|
+
parentNode.kind === 'enum_member');
|
|
1472
1664
|
}
|
|
1473
1665
|
/**
|
|
1474
1666
|
* Ruby `CONST = …` assignment whose LHS is a `constant` node — a class/module
|
|
@@ -1499,13 +1691,15 @@ class TreeSitterExtractor {
|
|
|
1499
1691
|
// — SvelteKit actions). Inline-object arrows reached by the general walker
|
|
1500
1692
|
// get no override, so they still fall through to the <anonymous> skip below.
|
|
1501
1693
|
let name = nameOverride ?? extractName(node, this.source, this.extractor);
|
|
1694
|
+
// A CommonJS export assignment names the function it holds — see below.
|
|
1695
|
+
let commonJsExport = false;
|
|
1502
1696
|
// For arrow functions and function expressions assigned to variables,
|
|
1503
1697
|
// resolve the name from the parent variable_declarator.
|
|
1504
1698
|
// e.g. `export const useAuth = () => { ... }` — the arrow_function node
|
|
1505
1699
|
// has no `name` field; the name lives on the variable_declarator.
|
|
1506
1700
|
if (!nameOverride &&
|
|
1507
1701
|
name === '<anonymous>' &&
|
|
1508
|
-
(node.type === 'arrow_function' || node.type === 'function_expression')) {
|
|
1702
|
+
(node.type === 'arrow_function' || node.type === 'function_expression' || node.type === 'generator_function')) {
|
|
1509
1703
|
const parent = node.parent;
|
|
1510
1704
|
if (parent?.type === 'variable_declarator') {
|
|
1511
1705
|
const varName = (0, tree_sitter_helpers_1.getChildByField)(parent, 'name');
|
|
@@ -1513,6 +1707,19 @@ class TreeSitterExtractor {
|
|
|
1513
1707
|
name = (0, tree_sitter_helpers_1.getNodeText)(varName, this.source);
|
|
1514
1708
|
}
|
|
1515
1709
|
}
|
|
1710
|
+
else if (parent?.type === 'assignment_expression') {
|
|
1711
|
+
// `exports.getItems = async (req, res) => {…}` / `module.exports.x =
|
|
1712
|
+
// function () {…}` — the CommonJS controller style. The function is
|
|
1713
|
+
// anonymous only syntactically: the export property is the name every
|
|
1714
|
+
// `router.get('/items', getItems)` resolves. Without a node the handler
|
|
1715
|
+
// is invisible to callers/impact and its calls attribute to the file
|
|
1716
|
+
// (#1675). Same treatment `const X = () => {}` already gets.
|
|
1717
|
+
const exportName = this.commonJsExportName(parent, node);
|
|
1718
|
+
if (exportName) {
|
|
1719
|
+
name = exportName;
|
|
1720
|
+
commonJsExport = true;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1516
1723
|
}
|
|
1517
1724
|
if (name === '<anonymous>') {
|
|
1518
1725
|
// Don't emit a node for the anonymous wrapper itself, but still visit its
|
|
@@ -1537,10 +1744,10 @@ class TreeSitterExtractor {
|
|
|
1537
1744
|
}
|
|
1538
1745
|
return;
|
|
1539
1746
|
}
|
|
1540
|
-
const docstring =
|
|
1747
|
+
const docstring = this.docstringFor(node);
|
|
1541
1748
|
const signature = this.extractor.getSignature?.(node, this.source);
|
|
1542
1749
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1543
|
-
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1750
|
+
const isExported = commonJsExport || this.extractor.isExported?.(node, this.source);
|
|
1544
1751
|
const isAsync = this.extractor.isAsync?.(node);
|
|
1545
1752
|
const isStatic = this.extractor.isStatic?.(node);
|
|
1546
1753
|
const returnType = this.extractor.getReturnType?.(node, this.source);
|
|
@@ -1650,7 +1857,7 @@ class TreeSitterExtractor {
|
|
|
1650
1857
|
if (this.extractor.skipBodilessClass && !resolvedBody)
|
|
1651
1858
|
return;
|
|
1652
1859
|
const name = extractName(node, this.source, this.extractor);
|
|
1653
|
-
const docstring =
|
|
1860
|
+
const docstring = this.docstringFor(node);
|
|
1654
1861
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1655
1862
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1656
1863
|
const classNode = this.createNode(kind, name, node, {
|
|
@@ -1722,11 +1929,14 @@ class TreeSitterExtractor {
|
|
|
1722
1929
|
}
|
|
1723
1930
|
return;
|
|
1724
1931
|
}
|
|
1725
|
-
const docstring =
|
|
1932
|
+
const docstring = this.docstringFor(node);
|
|
1726
1933
|
const signature = this.extractor.getSignature?.(node, this.source);
|
|
1727
1934
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1728
1935
|
const isAsync = this.extractor.isAsync?.(node);
|
|
1729
1936
|
const isStatic = this.extractor.isStatic?.(node);
|
|
1937
|
+
// Only persist abstract when true — a false return must not mint `isAbstract: false`
|
|
1938
|
+
// on every ordinary method (breaks kernel↔wasm parity JSON equality).
|
|
1939
|
+
const isAbstract = this.extractor.isAbstract?.(node) ? true : undefined;
|
|
1730
1940
|
const returnType = this.extractor.getReturnType?.(node, this.source);
|
|
1731
1941
|
const extraProps = {
|
|
1732
1942
|
docstring,
|
|
@@ -1734,6 +1944,7 @@ class TreeSitterExtractor {
|
|
|
1734
1944
|
visibility,
|
|
1735
1945
|
isAsync,
|
|
1736
1946
|
isStatic,
|
|
1947
|
+
isAbstract,
|
|
1737
1948
|
returnType,
|
|
1738
1949
|
};
|
|
1739
1950
|
if (receiverType) {
|
|
@@ -1776,7 +1987,7 @@ class TreeSitterExtractor {
|
|
|
1776
1987
|
if (!this.extractor)
|
|
1777
1988
|
return;
|
|
1778
1989
|
const name = extractName(node, this.source, this.extractor);
|
|
1779
|
-
const docstring =
|
|
1990
|
+
const docstring = this.docstringFor(node);
|
|
1780
1991
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1781
1992
|
const kind = this.extractor.interfaceKind ?? 'interface';
|
|
1782
1993
|
const interfaceNode = this.createNode(kind, name, node, {
|
|
@@ -1818,11 +2029,18 @@ class TreeSitterExtractor {
|
|
|
1818
2029
|
// Skip forward declarations and type references (no body = not a definition)
|
|
1819
2030
|
// — EXCEPT C# positional records (`record struct M(decimal Amount);`),
|
|
1820
2031
|
// complete definitions with no body block. (#831)
|
|
2032
|
+
//
|
|
2033
|
+
// `allowBodilessStruct` is the per-language escape hatch for the same
|
|
2034
|
+
// situation: a bodiless struct that IS a complete definition (Rust's unit
|
|
2035
|
+
// struct `struct Unit;`). Opposite polarity from `skipBodilessClass`
|
|
2036
|
+
// (#1093) because the two defaults differ — a bodiless CLASS is kept
|
|
2037
|
+
// unless a language opts into skipping, a bodiless STRUCT is skipped
|
|
2038
|
+
// unless a language opts into keeping.
|
|
1821
2039
|
const body = (0, tree_sitter_helpers_1.getChildByField)(node, this.extractor.bodyField);
|
|
1822
|
-
if (!body && node.type !== 'record_declaration')
|
|
2040
|
+
if (!body && node.type !== 'record_declaration' && !this.extractor.allowBodilessStruct)
|
|
1823
2041
|
return;
|
|
1824
2042
|
const name = extractName(node, this.source, this.extractor);
|
|
1825
|
-
const docstring =
|
|
2043
|
+
const docstring = this.docstringFor(node);
|
|
1826
2044
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1827
2045
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1828
2046
|
const aggregateNode = this.createNode(kind, name, node, {
|
|
@@ -1862,7 +2080,7 @@ class TreeSitterExtractor {
|
|
|
1862
2080
|
if (!body)
|
|
1863
2081
|
return;
|
|
1864
2082
|
const name = extractName(node, this.source, this.extractor);
|
|
1865
|
-
const docstring =
|
|
2083
|
+
const docstring = this.docstringFor(node);
|
|
1866
2084
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1867
2085
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
1868
2086
|
const enumNode = this.createNode('enum', name, node, {
|
|
@@ -1882,7 +2100,19 @@ class TreeSitterExtractor {
|
|
|
1882
2100
|
if (!child)
|
|
1883
2101
|
continue;
|
|
1884
2102
|
if (memberTypes?.includes(child.type)) {
|
|
1885
|
-
this.extractEnumMembers(child);
|
|
2103
|
+
const member = this.extractEnumMembers(child);
|
|
2104
|
+
// Java's `PLUS { int apply(…) { … } }`, Kotlin's `NewBuffer { override
|
|
2105
|
+
// fun pipe() … }`: the constant's own body declares members of its own.
|
|
2106
|
+
const entryBody = member ? child.namedChildren.find((c) => c.type === 'class_body') : undefined;
|
|
2107
|
+
if (member && entryBody) {
|
|
2108
|
+
this.nodeStack.push(member.id);
|
|
2109
|
+
for (let j = 0; j < entryBody.namedChildCount; j++) {
|
|
2110
|
+
const inner = entryBody.namedChild(j);
|
|
2111
|
+
if (inner)
|
|
2112
|
+
this.visitNode(inner);
|
|
2113
|
+
}
|
|
2114
|
+
this.nodeStack.pop();
|
|
2115
|
+
}
|
|
1886
2116
|
}
|
|
1887
2117
|
else {
|
|
1888
2118
|
this.visitNode(child);
|
|
@@ -1898,22 +2128,24 @@ class TreeSitterExtractor {
|
|
|
1898
2128
|
// Try field-based name first (e.g. Rust enum_variant has a 'name' field)
|
|
1899
2129
|
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
1900
2130
|
if (nameNode) {
|
|
1901
|
-
this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source), node);
|
|
1902
|
-
return;
|
|
2131
|
+
return this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source), node);
|
|
1903
2132
|
}
|
|
1904
2133
|
// Check for identifier-like children (Swift: simple_identifier, TS: property_identifier)
|
|
2134
|
+
let first = null;
|
|
1905
2135
|
let found = false;
|
|
1906
2136
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
1907
2137
|
const child = node.namedChild(i);
|
|
1908
2138
|
if (child && (child.type === 'simple_identifier' || child.type === 'identifier' || child.type === 'property_identifier')) {
|
|
1909
|
-
this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(child, this.source), child);
|
|
2139
|
+
const created = this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(child, this.source), child);
|
|
2140
|
+
first ??= created;
|
|
1910
2141
|
found = true;
|
|
1911
2142
|
}
|
|
1912
2143
|
}
|
|
1913
2144
|
// If the node itself IS the identifier (e.g. TS property_identifier directly in enum body)
|
|
1914
2145
|
if (!found && node.namedChildCount === 0) {
|
|
1915
|
-
this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(node, this.source), node);
|
|
2146
|
+
return this.createNode('enum_member', (0, tree_sitter_helpers_1.getNodeText)(node, this.source), node);
|
|
1916
2147
|
}
|
|
2148
|
+
return first;
|
|
1917
2149
|
}
|
|
1918
2150
|
/**
|
|
1919
2151
|
* Extract a class property declaration (e.g. C# `public string Name { get; set; }`).
|
|
@@ -1922,7 +2154,7 @@ class TreeSitterExtractor {
|
|
|
1922
2154
|
extractProperty(node) {
|
|
1923
2155
|
if (!this.extractor)
|
|
1924
2156
|
return null;
|
|
1925
|
-
const docstring =
|
|
2157
|
+
const docstring = this.docstringFor(node);
|
|
1926
2158
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1927
2159
|
const isStatic = this.extractor.isStatic?.(node) ?? false;
|
|
1928
2160
|
const hookName = this.extractor.extractPropertyName?.(node, this.source);
|
|
@@ -1941,7 +2173,17 @@ class TreeSitterExtractor {
|
|
|
1941
2173
|
// and the initializer VALUE, which the generic finder below would
|
|
1942
2174
|
// wrongly pick — so fields use the type field only (#808). Other
|
|
1943
2175
|
// languages (C# property_declaration) keep the generic scan.
|
|
1944
|
-
|
|
2176
|
+
//
|
|
2177
|
+
// A `property_signature` (an interface member, #1638) carries a `type`
|
|
2178
|
+
// field and no value, so it reads the type field too. It cannot take the
|
|
2179
|
+
// generic scan: that scan's exclusion list covers `identifier` but not the
|
|
2180
|
+
// `property_identifier` an interface member is named with, so it stops on
|
|
2181
|
+
// the name and `interface Stats { counts: Record<string, number> }` yields
|
|
2182
|
+
// `signature: "counts counts"` instead of the type. Named explicitly
|
|
2183
|
+
// rather than folded into the field test so no other language's
|
|
2184
|
+
// `property_declaration` moves off the generic scan.
|
|
2185
|
+
const isTsJsField = node.type === 'public_field_definition' || node.type === 'field_definition'
|
|
2186
|
+
|| node.type === 'property_signature';
|
|
1945
2187
|
const typeNode = isTsJsField
|
|
1946
2188
|
? (0, tree_sitter_helpers_1.getChildByField)(node, 'type')
|
|
1947
2189
|
: node.namedChildren.find(c => c.type !== 'modifier' && c.type !== 'modifiers'
|
|
@@ -1975,7 +2217,7 @@ class TreeSitterExtractor {
|
|
|
1975
2217
|
extractField(node) {
|
|
1976
2218
|
if (!this.extractor)
|
|
1977
2219
|
return;
|
|
1978
|
-
const docstring =
|
|
2220
|
+
const docstring = this.docstringFor(node);
|
|
1979
2221
|
const visibility = this.extractor.getVisibility?.(node);
|
|
1980
2222
|
const isStatic = this.extractor.isStatic?.(node) ?? false;
|
|
1981
2223
|
// A class field that is actually a CONSTANT (Java `static final`, C# `const`
|
|
@@ -2055,6 +2297,21 @@ class TreeSitterExtractor {
|
|
|
2055
2297
|
// and the language-aware path in `extractTypeAnnotations` descends
|
|
2056
2298
|
// into that wrapper (#381).
|
|
2057
2299
|
this.extractTypeAnnotations(node, fieldNode.id);
|
|
2300
|
+
// Walk the initializer ATTRIBUTED to the declared field (#693, the
|
|
2301
|
+
// Go fix; same shape as the TS/JS class-field walk above). The
|
|
2302
|
+
// dispatcher only scanned this subtree for function-as-value
|
|
2303
|
+
// candidates, so a lambda / method reference / anonymous class in
|
|
2304
|
+
// `private final Runnable r = () -> target();` contributed NO call
|
|
2305
|
+
// edge at all and `target` looked callerless. Keyed on the `value`
|
|
2306
|
+
// FIELD, which only Java's `variable_declarator` carries — C#,
|
|
2307
|
+
// VB.NET and PHP spell their initializer differently and are
|
|
2308
|
+
// deliberately untouched here.
|
|
2309
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(decl, 'value');
|
|
2310
|
+
if (valueNode) {
|
|
2311
|
+
this.nodeStack.push(fieldNode.id);
|
|
2312
|
+
this.visitFunctionBody(valueNode, fieldNode.id);
|
|
2313
|
+
this.nodeStack.pop();
|
|
2314
|
+
}
|
|
2058
2315
|
}
|
|
2059
2316
|
}
|
|
2060
2317
|
}
|
|
@@ -2090,6 +2347,13 @@ class TreeSitterExtractor {
|
|
|
2090
2347
|
if (key && value && (value.type === 'arrow_function' || value.type === 'function_expression')) {
|
|
2091
2348
|
this.extractFunction(value, this.objectKeyName(key));
|
|
2092
2349
|
}
|
|
2350
|
+
else if (value?.type === 'call_expression') {
|
|
2351
|
+
// `key: Effect.fn("…")(function* () {…})` — see curriedWrapperBoundName.
|
|
2352
|
+
const fn = (0, tree_sitter_helpers_1.getChildByField)(value, 'arguments')?.namedChild(0);
|
|
2353
|
+
const bound = fn ? this.curriedWrapperBoundName(fn) : null;
|
|
2354
|
+
if (fn && bound)
|
|
2355
|
+
this.extractFunction(fn, bound);
|
|
2356
|
+
}
|
|
2093
2357
|
}
|
|
2094
2358
|
else if (member.type === 'method_definition') {
|
|
2095
2359
|
// Method shorthand: `{ fetchUser() {...} }`. extractMethod deliberately
|
|
@@ -2102,6 +2366,21 @@ class TreeSitterExtractor {
|
|
|
2102
2366
|
}
|
|
2103
2367
|
}
|
|
2104
2368
|
}
|
|
2369
|
+
/**
|
|
2370
|
+
* A top-level binding exported by a LATER statement rather than at its
|
|
2371
|
+
* declaration: `export default NAME`, `export { NAME }`, `export { NAME as
|
|
2372
|
+
* default }`. The declaration's own `isExported` (an `export_statement`
|
|
2373
|
+
* ancestor) cannot see these, so a store written as `const useStore =
|
|
2374
|
+
* create(…)` + `export default useStore` read as unexported and its actions
|
|
2375
|
+
* were never extracted. One anchored regex over the file source; JS-family
|
|
2376
|
+
* callers only.
|
|
2377
|
+
*/
|
|
2378
|
+
isExportedLater(name) {
|
|
2379
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(name))
|
|
2380
|
+
return false;
|
|
2381
|
+
const re = new RegExp(`^[ \\t]*export\\s+(?:default\\s+${name}\\s*;?[ \\t]*$|\\{[^}]*\\b${name}\\b[^}]*\\})`, 'm');
|
|
2382
|
+
return re.test(this.source);
|
|
2383
|
+
}
|
|
2105
2384
|
/** Property-key text with surrounding quotes stripped (`'foo'` → `foo`). */
|
|
2106
2385
|
objectKeyName(key) {
|
|
2107
2386
|
return (0, tree_sitter_helpers_1.getNodeText)(key, this.source).replace(/^['"`]|['"`]$/g, '');
|
|
@@ -2506,7 +2785,7 @@ class TreeSitterExtractor {
|
|
|
2506
2785
|
// Go: var_declaration, short_var_declaration, const_declaration
|
|
2507
2786
|
const isConst = this.extractor.isConst?.(node) ?? false;
|
|
2508
2787
|
const kind = isConst ? 'constant' : 'variable';
|
|
2509
|
-
const docstring =
|
|
2788
|
+
const docstring = this.docstringFor(node);
|
|
2510
2789
|
const isExported = this.extractor.isExported?.(node, this.source) ?? false;
|
|
2511
2790
|
// Extract variable declarators based on language
|
|
2512
2791
|
if (this.language === 'typescript' || this.language === 'javascript' ||
|
|
@@ -2534,7 +2813,7 @@ class TreeSitterExtractor {
|
|
|
2534
2813
|
}
|
|
2535
2814
|
const name = (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source);
|
|
2536
2815
|
// Arrow functions / function expressions: extract as function instead of variable
|
|
2537
|
-
if (valueNode && (valueNode.type === 'arrow_function' || valueNode.type === 'function_expression')) {
|
|
2816
|
+
if (valueNode && (valueNode.type === 'arrow_function' || valueNode.type === 'function_expression' || valueNode.type === 'generator_function')) {
|
|
2538
2817
|
this.extractFunction(valueNode);
|
|
2539
2818
|
continue;
|
|
2540
2819
|
}
|
|
@@ -2584,7 +2863,10 @@ class TreeSitterExtractor {
|
|
|
2584
2863
|
// never nodes — so `node`/`callers` on `fetchUser` return "not
|
|
2585
2864
|
// found" and the agent Reads the store to reconstruct the flow.
|
|
2586
2865
|
// Scoped to EXPORTED consts to exclude inline-object noise
|
|
2587
|
-
// (`ctx.set({...})`) the object-method skip deliberately avoids
|
|
2866
|
+
// (`ctx.set({...})`) the object-method skip deliberately avoids —
|
|
2867
|
+
// where "exported" includes the two-statement form `const useStore
|
|
2868
|
+
// = create(…)` … `export default useStore` (see isExportedLater),
|
|
2869
|
+
// the shape most React Native stores are written in.
|
|
2588
2870
|
const objectOfFns = valueNode && (valueNode.type === 'object' || valueNode.type === 'object_expression')
|
|
2589
2871
|
? valueNode
|
|
2590
2872
|
: valueNode?.type === 'call_expression'
|
|
@@ -2596,7 +2878,7 @@ class TreeSitterExtractor {
|
|
|
2596
2878
|
// whose functions are body-local consts — it must fall through to a
|
|
2597
2879
|
// normal body walk (extracting those consts), not be skipped here.
|
|
2598
2880
|
const hasInlineFns = !!objectOfFns && this.objectHasInlineFunctions(objectOfFns);
|
|
2599
|
-
const extractObjectMethods = isExported && !!objectOfFns && hasInlineFns;
|
|
2881
|
+
const extractObjectMethods = (isExported || this.isExportedLater(name)) && !!objectOfFns && hasInlineFns;
|
|
2600
2882
|
// RTK Query: `createApi`/`injectEndpoints` define endpoints as
|
|
2601
2883
|
// object-literal properties whose values are `build.query/mutation(...)`
|
|
2602
2884
|
// calls — nested under an `endpoints` arrow, so neither the
|
|
@@ -2623,19 +2905,25 @@ class TreeSitterExtractor {
|
|
|
2623
2905
|
VUE_STORE_COLLECTION_NAMES.has(name) && this.looksLikeVueStoreFile()) {
|
|
2624
2906
|
storeCollections.push(objectOfFns);
|
|
2625
2907
|
}
|
|
2626
|
-
// Visit the initializer body for calls
|
|
2627
|
-
//
|
|
2628
|
-
// / createApi / store-collection
|
|
2629
|
-
//
|
|
2630
|
-
//
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2908
|
+
// Visit the initializer body for calls, ATTRIBUTED to the declared
|
|
2909
|
+
// symbol (#693) — EXCEPT the shapes whose members are extracted
|
|
2910
|
+
// one-by-one below (the store-factory / createApi / store-collection
|
|
2911
|
+
// objects), where walking the whole initializer would re-visit each
|
|
2912
|
+
// member arrow and double-count its calls.
|
|
2913
|
+
//
|
|
2914
|
+
// Two things were wrong here before. The walk ran with only the FILE
|
|
2915
|
+
// on the stack, so `const cfg = load()` recorded the FILE as load's
|
|
2916
|
+
// caller — the exact leak Go's #693 fixed. And an object literal was
|
|
2917
|
+
// skipped outright, so `const obj = { handler: () => target() }`
|
|
2918
|
+
// contributed nothing at all unless the const was exported (only then
|
|
2919
|
+
// does extractObjectLiteralFunctions mint the members).
|
|
2920
|
+
const membersExtractedSeparately = extractObjectMethods || !!rtkEndpoints || !!piniaSetup || storeCollections.length > 0;
|
|
2921
|
+
if (valueNode && !membersExtractedSeparately) {
|
|
2922
|
+
if (varNode)
|
|
2923
|
+
this.nodeStack.push(varNode.id);
|
|
2638
2924
|
this.visitFunctionBody(valueNode, '');
|
|
2925
|
+
if (varNode)
|
|
2926
|
+
this.nodeStack.pop();
|
|
2639
2927
|
}
|
|
2640
2928
|
if (extractObjectMethods && objectOfFns) {
|
|
2641
2929
|
this.extractObjectLiteralFunctions(objectOfFns);
|
|
@@ -2659,17 +2947,32 @@ class TreeSitterExtractor {
|
|
|
2659
2947
|
const right = (0, tree_sitter_helpers_1.getChildByField)(node, 'right') || node.namedChild(1);
|
|
2660
2948
|
// Ruby constant assignments (`MAX = 3`) have a `constant`-typed LHS, not
|
|
2661
2949
|
// `identifier`; without this they were never extracted as symbols at all.
|
|
2950
|
+
let assigned = null;
|
|
2662
2951
|
if (left && (left.type === 'identifier' || left.type === 'constant')) {
|
|
2663
2952
|
const name = (0, tree_sitter_helpers_1.getNodeText)(left, this.source);
|
|
2664
2953
|
// Skip if name starts with lowercase and looks like a function call result
|
|
2665
2954
|
// Python constants are usually UPPER_CASE
|
|
2666
2955
|
const initValue = right ? (0, tree_sitter_helpers_1.getNodeText)(right, this.source).slice(0, 100) : undefined;
|
|
2667
2956
|
const initSignature = initValue ? `= ${initValue}${initValue.length >= 100 ? '...' : ''}` : undefined;
|
|
2668
|
-
this.createNode(kind, name, node, {
|
|
2957
|
+
assigned = this.createNode(kind, name, node, {
|
|
2669
2958
|
docstring,
|
|
2670
2959
|
signature: initSignature,
|
|
2671
2960
|
});
|
|
2672
2961
|
}
|
|
2962
|
+
// Walk the initializer ATTRIBUTED to the assigned name (#693). A
|
|
2963
|
+
// module-level `app = FastAPI()` / `ENGINE = create_engine(url)` /
|
|
2964
|
+
// `handler = lambda: run()` dropped every call on the right-hand side, so
|
|
2965
|
+
// whatever the module builds at import time linked to nothing. A tuple
|
|
2966
|
+
// target (`a, b = f(), g()`) mints no symbol, so its RHS is walked at the
|
|
2967
|
+
// enclosing scope rather than lost. Python only: Ruby shares this branch
|
|
2968
|
+
// and gets its own turn.
|
|
2969
|
+
if (this.language === 'python' && right) {
|
|
2970
|
+
if (assigned)
|
|
2971
|
+
this.nodeStack.push(assigned.id);
|
|
2972
|
+
this.visitFunctionBody(right, '');
|
|
2973
|
+
if (assigned)
|
|
2974
|
+
this.nodeStack.pop();
|
|
2975
|
+
}
|
|
2673
2976
|
}
|
|
2674
2977
|
else if (this.language === 'go') {
|
|
2675
2978
|
// Go: var_declaration, short_var_declaration, const_declaration
|
|
@@ -2735,15 +3038,26 @@ class TreeSitterExtractor {
|
|
|
2735
3038
|
const varList = assign.namedChildren.find((c) => c.type === 'variable_list');
|
|
2736
3039
|
const exprList = assign.namedChildren.find((c) => c.type === 'expression_list');
|
|
2737
3040
|
const values = exprList ? exprList.namedChildren : [];
|
|
2738
|
-
const
|
|
2739
|
-
|
|
2740
|
-
const name = (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source);
|
|
2741
|
-
if (!name)
|
|
2742
|
-
return;
|
|
3041
|
+
const targets = varList ? varList.namedChildren : [];
|
|
3042
|
+
targets.forEach((nameNode, i) => {
|
|
2743
3043
|
const valueNode = values[i];
|
|
3044
|
+
const target = this.luaAssignmentTarget(nameNode);
|
|
3045
|
+
if (!target)
|
|
3046
|
+
return;
|
|
3047
|
+
if (valueNode?.type === 'function_definition') {
|
|
3048
|
+
this.extractLuaFunctionValue(valueNode, target.name, target.receiver, docstring);
|
|
3049
|
+
return;
|
|
3050
|
+
}
|
|
3051
|
+
if (valueNode?.type === 'table_constructor') {
|
|
3052
|
+
this.extractLuaTableFunctions(valueNode, target.fullName);
|
|
3053
|
+
}
|
|
3054
|
+
// A dotted assignment updates a table member; it is not a standalone
|
|
3055
|
+
// variable node. Function-valued members were handled above.
|
|
3056
|
+
if (target.receiver || node.type === 'assignment_statement')
|
|
3057
|
+
return;
|
|
2744
3058
|
const initValue = valueNode ? (0, tree_sitter_helpers_1.getNodeText)(valueNode, this.source).slice(0, 100) : undefined;
|
|
2745
3059
|
const initSignature = initValue ? `= ${initValue}${initValue.length >= 100 ? '...' : ''}` : undefined;
|
|
2746
|
-
this.createNode(kind, name, nameNode, { docstring, signature: initSignature, isExported });
|
|
3060
|
+
this.createNode(kind, target.name, nameNode, { docstring, signature: initSignature, isExported });
|
|
2747
3061
|
});
|
|
2748
3062
|
}
|
|
2749
3063
|
else if (this.language === 'c') {
|
|
@@ -2808,6 +3122,8 @@ class TreeSitterExtractor {
|
|
|
2808
3122
|
else {
|
|
2809
3123
|
// Generic fallback for other languages
|
|
2810
3124
|
// Try to find identifier children
|
|
3125
|
+
const nameField = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
|
|
3126
|
+
let declared = null;
|
|
2811
3127
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
2812
3128
|
const child = node.namedChild(i);
|
|
2813
3129
|
if (child?.type === 'identifier' || child?.type === 'variable_declarator') {
|
|
@@ -2815,13 +3131,103 @@ class TreeSitterExtractor {
|
|
|
2815
3131
|
? (0, tree_sitter_helpers_1.getNodeText)(child, this.source)
|
|
2816
3132
|
: extractName(child, this.source, this.extractor);
|
|
2817
3133
|
if (name && name !== '<anonymous>') {
|
|
2818
|
-
this.createNode(kind, name, child, {
|
|
3134
|
+
const created = this.createNode(kind, name, child, {
|
|
2819
3135
|
docstring,
|
|
2820
3136
|
isExported,
|
|
2821
3137
|
});
|
|
3138
|
+
if (created && nameField && child.startIndex === nameField.startIndex) {
|
|
3139
|
+
declared = created;
|
|
3140
|
+
}
|
|
2822
3141
|
}
|
|
2823
3142
|
}
|
|
2824
3143
|
}
|
|
3144
|
+
// Walk the initializer ATTRIBUTED to the declared symbol (#693). Rust
|
|
3145
|
+
// only for now: `const N: usize = compute()` and
|
|
3146
|
+
// `static REGISTRY: Lazy<T> = Lazy::new(|| build())` dropped every call
|
|
3147
|
+
// inside the initializer, so a handler table or a lazily-built singleton
|
|
3148
|
+
// linked to nothing. The other languages sharing this fallback spell
|
|
3149
|
+
// their initializer differently and get their own turn.
|
|
3150
|
+
if (this.language === 'rust') {
|
|
3151
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'value');
|
|
3152
|
+
if (valueNode) {
|
|
3153
|
+
if (declared)
|
|
3154
|
+
this.nodeStack.push(declared.id);
|
|
3155
|
+
this.visitFunctionBody(valueNode, '');
|
|
3156
|
+
if (declared)
|
|
3157
|
+
this.nodeStack.pop();
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
/** Resolve a Lua assignment target into its callable name and optional table receiver. */
|
|
3163
|
+
luaAssignmentTarget(node) {
|
|
3164
|
+
if (node.type === 'identifier') {
|
|
3165
|
+
const name = (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim();
|
|
3166
|
+
return name ? { name, fullName: name } : null;
|
|
3167
|
+
}
|
|
3168
|
+
if (node.type !== 'dot_index_expression' &&
|
|
3169
|
+
node.type !== 'method_index_expression' &&
|
|
3170
|
+
node.type !== 'bracket_index_expression')
|
|
3171
|
+
return null;
|
|
3172
|
+
const table = (0, tree_sitter_helpers_1.getChildByField)(node, 'table');
|
|
3173
|
+
const field = (0, tree_sitter_helpers_1.getChildByField)(node, 'field') ?? (0, tree_sitter_helpers_1.getChildByField)(node, 'method');
|
|
3174
|
+
if (!table || !field)
|
|
3175
|
+
return null;
|
|
3176
|
+
const receiver = (0, tree_sitter_helpers_1.getNodeText)(table, this.source).trim();
|
|
3177
|
+
const name = this.luaStaticFieldName(field, node.type === 'bracket_index_expression');
|
|
3178
|
+
if (!receiver || !name)
|
|
3179
|
+
return null;
|
|
3180
|
+
return { name, receiver, fullName: `${receiver}.${name}` };
|
|
3181
|
+
}
|
|
3182
|
+
/** A statically-known Lua field name; dynamic bracket keys are not callable identities. */
|
|
3183
|
+
luaStaticFieldName(node, bracketed) {
|
|
3184
|
+
if (node.type === 'identifier') {
|
|
3185
|
+
return bracketed ? '' : (0, tree_sitter_helpers_1.getNodeText)(node, this.source).trim();
|
|
3186
|
+
}
|
|
3187
|
+
if (node.type === 'string') {
|
|
3188
|
+
const content = node.namedChildren.find((child) => child.type === 'string_content');
|
|
3189
|
+
return content ? (0, tree_sitter_helpers_1.getNodeText)(content, this.source).trim() : '';
|
|
3190
|
+
}
|
|
3191
|
+
return '';
|
|
3192
|
+
}
|
|
3193
|
+
/** Extract an anonymous Lua function using the name supplied by its assignment target. */
|
|
3194
|
+
extractLuaFunctionValue(node, name, receiver, docstring) {
|
|
3195
|
+
if (!this.extractor)
|
|
3196
|
+
return;
|
|
3197
|
+
const signature = this.extractor.getSignature?.(node, this.source);
|
|
3198
|
+
const extra = { docstring, signature };
|
|
3199
|
+
if (receiver)
|
|
3200
|
+
extra.qualifiedName = this.composeReceiverQualifiedName(receiver, name);
|
|
3201
|
+
else
|
|
3202
|
+
extra.isExported = this.extractor.isExported?.(node, this.source);
|
|
3203
|
+
const functionNode = this.createNode(receiver ? 'method' : 'function', name, node, extra);
|
|
3204
|
+
if (!functionNode)
|
|
3205
|
+
return;
|
|
3206
|
+
this.nodeStack.push(functionNode.id);
|
|
3207
|
+
const body = (0, tree_sitter_helpers_1.getChildByField)(node, this.extractor.bodyField);
|
|
3208
|
+
if (body)
|
|
3209
|
+
this.visitFunctionBody(body, functionNode.id);
|
|
3210
|
+
this.nodeStack.pop();
|
|
3211
|
+
}
|
|
3212
|
+
/** Extract function-valued keyed fields from a Lua table, including nested tables. */
|
|
3213
|
+
extractLuaTableFunctions(table, receiver) {
|
|
3214
|
+
for (const field of table.namedChildren) {
|
|
3215
|
+
if (field.type !== 'field')
|
|
3216
|
+
continue;
|
|
3217
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(field, 'name');
|
|
3218
|
+
const valueNode = (0, tree_sitter_helpers_1.getChildByField)(field, 'value');
|
|
3219
|
+
if (!nameNode || !valueNode)
|
|
3220
|
+
continue;
|
|
3221
|
+
const bracketed = (0, tree_sitter_helpers_1.getNodeText)(field, this.source).trimStart().startsWith('[');
|
|
3222
|
+
const name = this.luaStaticFieldName(nameNode, bracketed);
|
|
3223
|
+
if (!name)
|
|
3224
|
+
continue;
|
|
3225
|
+
if (valueNode.type === 'function_definition') {
|
|
3226
|
+
this.extractLuaFunctionValue(valueNode, name, receiver);
|
|
3227
|
+
}
|
|
3228
|
+
else if (valueNode.type === 'table_constructor') {
|
|
3229
|
+
this.extractLuaTableFunctions(valueNode, `${receiver}.${name}`);
|
|
3230
|
+
}
|
|
2825
3231
|
}
|
|
2826
3232
|
}
|
|
2827
3233
|
/**
|
|
@@ -2836,7 +3242,7 @@ class TreeSitterExtractor {
|
|
|
2836
3242
|
const name = extractName(node, this.source, this.extractor);
|
|
2837
3243
|
if (name === '<anonymous>')
|
|
2838
3244
|
return false;
|
|
2839
|
-
const docstring =
|
|
3245
|
+
const docstring = this.docstringFor(node);
|
|
2840
3246
|
const isExported = this.extractor.isExported?.(node, this.source);
|
|
2841
3247
|
// Check if this type alias is actually a struct or interface definition
|
|
2842
3248
|
// (e.g. Go: `type Foo struct { ... }` is a type_spec wrapping struct_type)
|
|
@@ -3000,7 +3406,7 @@ class TreeSitterExtractor {
|
|
|
3000
3406
|
const memberKind = child.type === 'method_signature'
|
|
3001
3407
|
? 'method'
|
|
3002
3408
|
: this.isTsFunctionTypedProperty(child) ? 'method' : 'property';
|
|
3003
|
-
const docstring =
|
|
3409
|
+
const docstring = this.docstringFor(child);
|
|
3004
3410
|
const signature = (0, tree_sitter_helpers_1.getNodeText)(child, this.source);
|
|
3005
3411
|
this.createNode(memberKind, memberName, child, {
|
|
3006
3412
|
docstring,
|
|
@@ -3648,6 +4054,33 @@ class TreeSitterExtractor {
|
|
|
3648
4054
|
return ownModule || null;
|
|
3649
4055
|
return this.erlangAtomMacros.get(macroName) ?? null;
|
|
3650
4056
|
}
|
|
4057
|
+
/**
|
|
4058
|
+
* A Kotlin infix call — `Users.id eq id1`, `a to b`, `x shouldBe y` — is a
|
|
4059
|
+
* call of the infix function in the middle: `receiver.fn` when the left
|
|
4060
|
+
* operand is a plain name (as `receiver.fn(arg)` would be), else the bare
|
|
4061
|
+
* name. Nothing records it otherwise, so a project's infix DSL had no
|
|
4062
|
+
* callers. Mirrored in the kernel's extract_infix_call (kotlin.rs).
|
|
4063
|
+
*/
|
|
4064
|
+
extractKotlinInfixCall(node) {
|
|
4065
|
+
if (this.nodeStack.length === 0 || node.namedChildCount !== 3)
|
|
4066
|
+
return;
|
|
4067
|
+
const lhs = node.namedChild(0);
|
|
4068
|
+
const fn = node.namedChild(1);
|
|
4069
|
+
if (!lhs || !fn || fn.type !== 'simple_identifier' || LITERAL_RECEIVER_TYPES.has(lhs.type))
|
|
4070
|
+
return;
|
|
4071
|
+
const callerId = this.nodeStack[this.nodeStack.length - 1];
|
|
4072
|
+
if (!callerId)
|
|
4073
|
+
return;
|
|
4074
|
+
const name = (0, tree_sitter_helpers_1.getNodeText)(fn, this.source);
|
|
4075
|
+
const receiver = lhs.type === 'simple_identifier' ? (0, tree_sitter_helpers_1.getNodeText)(lhs, this.source) : '';
|
|
4076
|
+
this.unresolvedReferences.push({
|
|
4077
|
+
fromNodeId: callerId,
|
|
4078
|
+
referenceName: receiver && receiver !== 'this' && receiver !== 'super' ? `${receiver}.${name}` : name,
|
|
4079
|
+
referenceKind: 'calls',
|
|
4080
|
+
line: node.startPosition.row + 1,
|
|
4081
|
+
column: node.startPosition.column,
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
3651
4084
|
extractCall(node) {
|
|
3652
4085
|
if (this.nodeStack.length === 0)
|
|
3653
4086
|
return;
|
|
@@ -4393,10 +4826,17 @@ class TreeSitterExtractor {
|
|
|
4393
4826
|
// This helps the resolver distinguish method calls from bare function calls
|
|
4394
4827
|
// (e.g., Python's console.print() vs builtin print())
|
|
4395
4828
|
// Skip self/this/cls as they don't aid resolution
|
|
4396
|
-
const
|
|
4829
|
+
const rawReceiver = (0, tree_sitter_helpers_1.getChildByField)(func, 'object') ||
|
|
4397
4830
|
(0, tree_sitter_helpers_1.getChildByField)(func, 'operand') ||
|
|
4398
4831
|
(0, tree_sitter_helpers_1.getChildByField)(func, 'argument') ||
|
|
4399
4832
|
func.namedChild(0);
|
|
4833
|
+
// TS/JS: look through wrappers that keep the receiver the same
|
|
4834
|
+
// object (`(x).m()`, `x!.m()`, `(x as T).m()`, `(await f()).m()`),
|
|
4835
|
+
// so the branches below see the identifier / call / chain the
|
|
4836
|
+
// call is really made on.
|
|
4837
|
+
const receiver = rawReceiver && TS_JS_CHAIN_LANGUAGES.has(this.language)
|
|
4838
|
+
? peelTsJsReceiver(rawReceiver)
|
|
4839
|
+
: rawReceiver;
|
|
4400
4840
|
// A LITERAL receiver — `", ".join(...)`, `"x".toUpperCase()`,
|
|
4401
4841
|
// `5.times`, `[].concat(...)` — calls a builtin of the literal's
|
|
4402
4842
|
// type, never a project symbol. The bare-name fallback below let
|
|
@@ -4417,6 +4857,18 @@ class TreeSitterExtractor {
|
|
|
4417
4857
|
calleeName = methodName;
|
|
4418
4858
|
}
|
|
4419
4859
|
}
|
|
4860
|
+
else if (this.language === 'rust' && receiver && receiver.type === 'self') {
|
|
4861
|
+
// Rust `self.method()`. Keep the `self.` prefix, exactly as the
|
|
4862
|
+
// field shape below does (#1585): the resolver reads the owner
|
|
4863
|
+
// off the CALLING method's qualified name and resolves the
|
|
4864
|
+
// method on that type. Collapsing to the bare method name handed
|
|
4865
|
+
// the resolver a name with no owner, which it then matched among
|
|
4866
|
+
// all same-named methods by file proximity — so `self.reset()`
|
|
4867
|
+
// inside `impl Target` landed on a `Decoy::reset` that happened
|
|
4868
|
+
// to sit nearer, with nothing in the edge to show it was a guess
|
|
4869
|
+
// (#1861). Mirrored in the kernel's extract_call (rustlang.rs).
|
|
4870
|
+
calleeName = `self.${methodName}`;
|
|
4871
|
+
}
|
|
4420
4872
|
else if (this.language === 'rust' &&
|
|
4421
4873
|
receiver &&
|
|
4422
4874
|
receiver.type === 'field_expression' &&
|
|
@@ -4497,6 +4949,20 @@ class TreeSitterExtractor {
|
|
|
4497
4949
|
}
|
|
4498
4950
|
calleeName = reencode ? `${innerCallee}().${methodName}` : methodName;
|
|
4499
4951
|
}
|
|
4952
|
+
else if (this.language === 'swift' &&
|
|
4953
|
+
receiver &&
|
|
4954
|
+
receiver.type === 'navigation_expression' &&
|
|
4955
|
+
SWIFT_TYPE_PATH_RECEIVER.test((0, tree_sitter_helpers_1.getNodeText)(receiver, this.source).replace(/\s+/g, ''))) {
|
|
4956
|
+
// Swift call through a type path — `API.PackageController.GetRoute.query(on:)`,
|
|
4957
|
+
// on one line or split before the `.query`. Keep the path: the
|
|
4958
|
+
// bare method name this used to emit exact-matched whichever
|
|
4959
|
+
// type's `query` came first (every route in a Vapor app has one).
|
|
4960
|
+
// The resolver finds the member on the type the path names, or
|
|
4961
|
+
// leaves the call unresolved. An instance chain (`self.store.load()`,
|
|
4962
|
+
// `viewModel.state.reset()`) is not a type path and stays bare.
|
|
4963
|
+
// Mirrored in the kernel's extract_call (swift.rs).
|
|
4964
|
+
calleeName = `${(0, tree_sitter_helpers_1.getNodeText)(receiver, this.source).replace(/\s+/g, '')}.${methodName}`;
|
|
4965
|
+
}
|
|
4500
4966
|
else if (this.language === 'cfscript' &&
|
|
4501
4967
|
receiver &&
|
|
4502
4968
|
receiver.type === 'member_expression' &&
|
|
@@ -4511,6 +4977,56 @@ class TreeSitterExtractor {
|
|
|
4511
4977
|
// name, which either failed to resolve or resolved ambiguously.
|
|
4512
4978
|
calleeName = `${(0, tree_sitter_helpers_1.getNodeText)(receiver, this.source)}.${methodName}`;
|
|
4513
4979
|
}
|
|
4980
|
+
else if ((this.language === 'typescript' ||
|
|
4981
|
+
this.language === 'javascript' ||
|
|
4982
|
+
this.language === 'tsx' ||
|
|
4983
|
+
this.language === 'jsx') &&
|
|
4984
|
+
receiver &&
|
|
4985
|
+
receiver.type === 'member_expression' &&
|
|
4986
|
+
(0, tree_sitter_helpers_1.getChildByField)(receiver, 'object')?.type === 'this' &&
|
|
4987
|
+
THIS_FIELD_PROPERTY_TYPES.has((0, tree_sitter_helpers_1.getChildByField)(receiver, 'property')?.type ?? '')) {
|
|
4988
|
+
// TS/JS call through a field of the enclosing class —
|
|
4989
|
+
// `this.mailer.send()` (#1496). Keep the `this.<field>` prefix:
|
|
4990
|
+
// the resolver reads the field's declared type off the class's
|
|
4991
|
+
// own declaration (`private mailer: Mailer`, `mailer = new
|
|
4992
|
+
// Mailer()`) and resolves the method on THAT type — or leaves the
|
|
4993
|
+
// ref unresolved when the type is external or unknown. Previously
|
|
4994
|
+
// this collapsed to the bare method name, which exact-matched
|
|
4995
|
+
// whichever same-named method was nearest — the calling method
|
|
4996
|
+
// itself when the two share a name, a self-edge not in the
|
|
4997
|
+
// source. Same discipline as Rust's `self.<field>` (#1585).
|
|
4998
|
+
// Mirrored in the kernel's extract_call (tsjs/extractors.rs).
|
|
4999
|
+
// An ES private field (`this.#items.add()`) is the same shape;
|
|
5000
|
+
// its name keeps the `#` (#1987).
|
|
5001
|
+
const fieldName = (0, tree_sitter_helpers_1.getNodeText)((0, tree_sitter_helpers_1.getChildByField)(receiver, 'property'), this.source);
|
|
5002
|
+
calleeName = `this.${fieldName}.${methodName}`;
|
|
5003
|
+
}
|
|
5004
|
+
else if ((this.language === 'typescript' ||
|
|
5005
|
+
this.language === 'javascript' ||
|
|
5006
|
+
this.language === 'tsx' ||
|
|
5007
|
+
this.language === 'jsx' ||
|
|
5008
|
+
this.language === 'python') &&
|
|
5009
|
+
receiver &&
|
|
5010
|
+
(receiver.type === 'call_expression' || receiver.type === 'call')) {
|
|
5011
|
+
// Receiver that is itself a call — `d.setdefault(k, []).append(v)`,
|
|
5012
|
+
// `make().run()`, `res.json().data` (#1683). The bare method name
|
|
5013
|
+
// this used to emit exact-matched any top-level project symbol of
|
|
5014
|
+
// that name and fabricated a call edge from an unrelated function
|
|
5015
|
+
// (`append`, `get`, `run`…). Keep the inner callee, encoded as
|
|
5016
|
+
// `<inner>().<method>` like the Java/Kotlin/C++ chains: the
|
|
5017
|
+
// marker never appears in an ordinary ref, so nothing name-matches
|
|
5018
|
+
// it, and a chain resolver can later infer the receiver's type
|
|
5019
|
+
// from what the inner call returns. An inner callee that is not a
|
|
5020
|
+
// plain name or member chain (`(await x)()`, `arr[0]()`) has no
|
|
5021
|
+
// static receiver at all — emit nothing: a silent miss, never a
|
|
5022
|
+
// wrong edge. The inner call is visited on its own either way.
|
|
5023
|
+
// Mirrored in the kernel (tsjs/extractors.rs, python.rs).
|
|
5024
|
+
const innerFn = (0, tree_sitter_helpers_1.getChildByField)(receiver, 'function');
|
|
5025
|
+
const innerCallee = innerFn ? (0, tree_sitter_helpers_1.getNodeText)(innerFn, this.source).replace(/\s+/g, '') : '';
|
|
5026
|
+
if (!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(innerCallee))
|
|
5027
|
+
return;
|
|
5028
|
+
calleeName = `${innerCallee}().${methodName}`;
|
|
5029
|
+
}
|
|
4514
5030
|
else if (this.language === 'go' &&
|
|
4515
5031
|
receiver &&
|
|
4516
5032
|
receiver.type === 'selector_expression' &&
|
|
@@ -4525,6 +5041,30 @@ class TreeSitterExtractor {
|
|
|
4525
5041
|
// inference (see matchGoFieldChainCall) or stay unresolved.
|
|
4526
5042
|
calleeName = `${(0, tree_sitter_helpers_1.getNodeText)(receiver, this.source).replace(/\s+/g, '')}.${methodName}`;
|
|
4527
5043
|
}
|
|
5044
|
+
else if (TS_JS_CHAIN_LANGUAGES.has(this.language) &&
|
|
5045
|
+
receiver &&
|
|
5046
|
+
TS_JS_CHAIN_RECEIVER_TYPES.has(receiver.type) &&
|
|
5047
|
+
isUnresolvedTsJsChain(receiver, this.source)) {
|
|
5048
|
+
// Keep the source call for effect reporting, but never collapse
|
|
5049
|
+
// it to a guessed method. The resolver only lets frameworks
|
|
5050
|
+
// with receiver evidence handle these qualified chains.
|
|
5051
|
+
const chain = (0, tree_sitter_helpers_1.getNodeText)(func, this.source).replace(/\s+/g, '').replace(/\?\./g, '.');
|
|
5052
|
+
if (!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*){2,}$/.test(chain))
|
|
5053
|
+
return;
|
|
5054
|
+
calleeName = chain;
|
|
5055
|
+
}
|
|
5056
|
+
else if (TS_JS_CHAIN_LANGUAGES.has(this.language) &&
|
|
5057
|
+
receiver &&
|
|
5058
|
+
!keepsBareTsJsReceiver(receiver, this.source)) {
|
|
5059
|
+
// Any other TS/JS receiver is an expression with no static
|
|
5060
|
+
// type here — `(a ?? b).map()`, `f().list.map()`,
|
|
5061
|
+
// `arr[0].run()`, `(() => {}).call()`. The bare method name this
|
|
5062
|
+
// used to emit exact-matched whichever project method shared the
|
|
5063
|
+
// name (`(await list()).map()` onto an adapter class's `map`).
|
|
5064
|
+
// Emit nothing: a silent miss, never a wrong edge. Mirrored in
|
|
5065
|
+
// the kernel's extract_call (tsjs/extractors.rs).
|
|
5066
|
+
return;
|
|
5067
|
+
}
|
|
4528
5068
|
else {
|
|
4529
5069
|
calleeName = methodName;
|
|
4530
5070
|
}
|
|
@@ -4728,43 +5268,103 @@ class TreeSitterExtractor {
|
|
|
4728
5268
|
}
|
|
4729
5269
|
}
|
|
4730
5270
|
/**
|
|
4731
|
-
*
|
|
4732
|
-
* that invokes a constructor — `Calculator calc(0)` (direct-init) or
|
|
4733
|
-
* `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
|
|
4734
|
-
* function declaration? Used to emit an `instantiates` edge for the
|
|
5271
|
+
* C++ stack construction — `Calculator calc(0)` / `Widget w{1, 2}` — is
|
|
4735
5272
|
* call-less construction syntax (#1035); heap `new T(...)` is handled
|
|
4736
5273
|
* separately by INSTANTIATION_KINDS.
|
|
4737
5274
|
*
|
|
4738
|
-
*
|
|
4739
|
-
*
|
|
4740
|
-
*
|
|
4741
|
-
*
|
|
4742
|
-
*
|
|
4743
|
-
*
|
|
4744
|
-
*
|
|
4745
|
-
*
|
|
4746
|
-
*
|
|
4747
|
-
*
|
|
4748
|
-
*
|
|
5275
|
+
* The `type` field must be a class-like NAMED type (`type_identifier`,
|
|
5276
|
+
* `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
|
|
5277
|
+
* `auto` (`placeholder_type_specifier` — that form always carries a real
|
|
5278
|
+
* `call_expression`, already handled), and sized specifiers are excluded —
|
|
5279
|
+
* they construct no class. `extern T x;` declares, it constructs nothing.
|
|
5280
|
+
*
|
|
5281
|
+
* Per declarator:
|
|
5282
|
+
* - a bare `identifier` is default construction (`T item;`) — arity 0;
|
|
5283
|
+
* - an `init_declarator` whose `value` is an `argument_list` (`(args)`) or
|
|
5284
|
+
* `initializer_list` (`{args}`) carries constructor arguments — arity is
|
|
5285
|
+
* the argument count. An array declarator's braces hold ELEMENTS, not
|
|
5286
|
+
* constructor arguments, so each braced element has its own arity;
|
|
5287
|
+
* - pointer / reference / function declarators construct nothing:
|
|
5288
|
+
* `T* p{}` is a null pointer, `T& r{x}` binds a reference, and the
|
|
5289
|
+
* most-vexing-parse `T c();` is a function declaration.
|
|
5290
|
+
*
|
|
5291
|
+
* `instantiates` (the type) is retained for initialized declarations,
|
|
5292
|
+
* preserving the #1035 dependency edges. `calls` (`T::T/arity`, resolved to
|
|
5293
|
+
* the constructor by src/resolution/cpp-constructor.ts, #1839) is emitted
|
|
5294
|
+
* for every declarator with an arity, default construction included.
|
|
5295
|
+
* Mirrored in the kernel (ccpp/mod.rs cpp_stack_constructions).
|
|
4749
5296
|
*/
|
|
4750
|
-
|
|
5297
|
+
cppStackConstructions(node) {
|
|
5298
|
+
const none = { instantiates: false, arities: [] };
|
|
4751
5299
|
const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
4752
5300
|
if (!typeNode ||
|
|
4753
5301
|
(typeNode.type !== 'type_identifier' &&
|
|
4754
5302
|
typeNode.type !== 'template_type' &&
|
|
4755
5303
|
typeNode.type !== 'qualified_identifier')) {
|
|
4756
|
-
return
|
|
5304
|
+
return none;
|
|
4757
5305
|
}
|
|
5306
|
+
let instantiates = false;
|
|
5307
|
+
const arities = [];
|
|
4758
5308
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
4759
5309
|
const child = node.namedChild(i);
|
|
4760
|
-
if (child
|
|
5310
|
+
if (!child)
|
|
5311
|
+
continue;
|
|
5312
|
+
if (child.type === 'storage_class_specifier' && (0, tree_sitter_helpers_1.getNodeText)(child, this.source) === 'extern')
|
|
5313
|
+
return none;
|
|
5314
|
+
if (child.type === 'identifier' || child.type === 'array_declarator') {
|
|
5315
|
+
if (child.type === 'array_declarator' && !this.cppObjectArray(child))
|
|
5316
|
+
continue;
|
|
5317
|
+
arities.push(0);
|
|
5318
|
+
continue;
|
|
5319
|
+
}
|
|
5320
|
+
if (child.type !== 'init_declarator')
|
|
5321
|
+
continue;
|
|
5322
|
+
const declarator = (0, tree_sitter_helpers_1.getChildByField)(child, 'declarator');
|
|
5323
|
+
if (declarator?.type !== 'identifier' && declarator?.type !== 'array_declarator')
|
|
4761
5324
|
continue;
|
|
4762
5325
|
const value = (0, tree_sitter_helpers_1.getChildByField)(child, 'value');
|
|
4763
|
-
if (value
|
|
4764
|
-
|
|
5326
|
+
if (!value || (value.type !== 'argument_list' && value.type !== 'initializer_list'))
|
|
5327
|
+
continue;
|
|
5328
|
+
instantiates = true;
|
|
5329
|
+
if (declarator.type === 'identifier') {
|
|
5330
|
+
arities.push(value.namedChildren.filter((c) => c.type !== 'comment').length);
|
|
5331
|
+
}
|
|
5332
|
+
else if (this.cppObjectArray(declarator)) {
|
|
5333
|
+
const dimensions = [];
|
|
5334
|
+
let array = declarator;
|
|
5335
|
+
while (array?.type === 'array_declarator') {
|
|
5336
|
+
const size = (0, tree_sitter_helpers_1.getChildByField)(array, 'size')?.text ?? '';
|
|
5337
|
+
dimensions.unshift(/^\d+$/.test(size) && Number.isSafeInteger(Number(size)) ? Number(size) : NaN);
|
|
5338
|
+
array = (0, tree_sitter_helpers_1.getChildByField)(array, 'declarator');
|
|
5339
|
+
}
|
|
5340
|
+
const elements = (list, depth) => {
|
|
5341
|
+
const entries = list.namedChildren.filter((c) => c.type !== 'comment');
|
|
5342
|
+
let elided = false;
|
|
5343
|
+
for (const entry of entries) {
|
|
5344
|
+
if (depth + 1 < dimensions.length) {
|
|
5345
|
+
if (entry.type === 'initializer_list')
|
|
5346
|
+
elements(entry, depth + 1);
|
|
5347
|
+
else
|
|
5348
|
+
elided = true; // Unbraced multidimensional layout needs type information.
|
|
5349
|
+
}
|
|
5350
|
+
else {
|
|
5351
|
+
arities.push(entry.type === 'initializer_list'
|
|
5352
|
+
? entry.namedChildren.filter((c) => c.type !== 'comment').length : 1);
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
if (!elided && (entries.length === 0 || dimensions[depth] > entries.length))
|
|
5356
|
+
arities.push(0);
|
|
5357
|
+
};
|
|
5358
|
+
elements(value, 0);
|
|
4765
5359
|
}
|
|
4766
5360
|
}
|
|
4767
|
-
return
|
|
5361
|
+
return { instantiates, arities };
|
|
5362
|
+
}
|
|
5363
|
+
cppObjectArray(node) {
|
|
5364
|
+
let element = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
5365
|
+
while (element?.type === 'array_declarator')
|
|
5366
|
+
element = (0, tree_sitter_helpers_1.getChildByField)(element, 'declarator');
|
|
5367
|
+
return element?.type === 'identifier';
|
|
4768
5368
|
}
|
|
4769
5369
|
/**
|
|
4770
5370
|
* Static-member / value-read pass. A type/enum/class used only via a member
|
|
@@ -4921,6 +5521,24 @@ class TreeSitterExtractor {
|
|
|
4921
5521
|
* (most non-decorator-using languages), the function is a no-op.
|
|
4922
5522
|
*/
|
|
4923
5523
|
extractDecoratorsFor(declNode, decoratedId) {
|
|
5524
|
+
// Rust outer attributes are siblings, not children of the function.
|
|
5525
|
+
// Preserve Tauri's runtime registration for the dead-code decorator rule.
|
|
5526
|
+
if (this.language === 'rust' && declNode.type === 'function_item') {
|
|
5527
|
+
for (let sibling = declNode.previousNamedSibling; sibling; sibling = sibling.previousNamedSibling) {
|
|
5528
|
+
if (sibling.type === 'line_comment' || sibling.type === 'block_comment')
|
|
5529
|
+
continue;
|
|
5530
|
+
if (sibling.type !== 'attribute_item')
|
|
5531
|
+
break;
|
|
5532
|
+
const attribute = sibling.namedChild(0);
|
|
5533
|
+
const name = attribute?.namedChild(0)?.text.replace(/\s/g, '');
|
|
5534
|
+
if (name === 'tauri::command') {
|
|
5535
|
+
const decorated = this.nodes.find(n => n.id === decoratedId);
|
|
5536
|
+
if (decorated)
|
|
5537
|
+
decorated.decorators = ['tauri::command'];
|
|
5538
|
+
break;
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
4924
5542
|
const consider = (n) => {
|
|
4925
5543
|
if (!n)
|
|
4926
5544
|
return;
|
|
@@ -5160,11 +5778,166 @@ class TreeSitterExtractor {
|
|
|
5160
5778
|
}
|
|
5161
5779
|
targets.add(target);
|
|
5162
5780
|
}
|
|
5781
|
+
/**
|
|
5782
|
+
* Whether an anonymous function is the whole value of a `variable_declarator`
|
|
5783
|
+
* with a plain identifier name — `const NAME = () => {…}` / `= function () {…}`.
|
|
5784
|
+
* JS-family only.
|
|
5785
|
+
*/
|
|
5786
|
+
declaratorBoundFunction(node) {
|
|
5787
|
+
if (this.language !== 'typescript' &&
|
|
5788
|
+
this.language !== 'javascript' &&
|
|
5789
|
+
this.language !== 'tsx' &&
|
|
5790
|
+
this.language !== 'jsx') {
|
|
5791
|
+
return false;
|
|
5792
|
+
}
|
|
5793
|
+
if (node.type !== 'arrow_function' && node.type !== 'function_expression')
|
|
5794
|
+
return false;
|
|
5795
|
+
const declarator = node.parent;
|
|
5796
|
+
if (!declarator || declarator.type !== 'variable_declarator')
|
|
5797
|
+
return false;
|
|
5798
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'value');
|
|
5799
|
+
if (!value || value.startIndex !== node.startIndex || value.endIndex !== node.endIndex)
|
|
5800
|
+
return false;
|
|
5801
|
+
return (0, tree_sitter_helpers_1.getChildByField)(declarator, 'name')?.type === 'identifier';
|
|
5802
|
+
}
|
|
5803
|
+
/**
|
|
5804
|
+
* The property a CommonJS export assignment binds a function to —
|
|
5805
|
+
* `exports.NAME = <node>` or `module.exports.NAME = <node>` — or null for
|
|
5806
|
+
* any other assignment. JS-family only; the node must be the assignment's
|
|
5807
|
+
* whole right-hand side.
|
|
5808
|
+
*/
|
|
5809
|
+
commonJsExportName(assignment, value) {
|
|
5810
|
+
if (this.language !== 'typescript' &&
|
|
5811
|
+
this.language !== 'javascript' &&
|
|
5812
|
+
this.language !== 'tsx' &&
|
|
5813
|
+
this.language !== 'jsx') {
|
|
5814
|
+
return null;
|
|
5815
|
+
}
|
|
5816
|
+
const right = (0, tree_sitter_helpers_1.getChildByField)(assignment, 'right');
|
|
5817
|
+
if (!right || right.startIndex !== value.startIndex || right.endIndex !== value.endIndex)
|
|
5818
|
+
return null;
|
|
5819
|
+
const left = (0, tree_sitter_helpers_1.getChildByField)(assignment, 'left');
|
|
5820
|
+
if (!left || left.type !== 'member_expression')
|
|
5821
|
+
return null;
|
|
5822
|
+
const object = (0, tree_sitter_helpers_1.getChildByField)(left, 'object');
|
|
5823
|
+
const property = (0, tree_sitter_helpers_1.getChildByField)(left, 'property');
|
|
5824
|
+
if (!object || !property || property.type !== 'property_identifier')
|
|
5825
|
+
return null;
|
|
5826
|
+
const objectText = (0, tree_sitter_helpers_1.getNodeText)(object, this.source);
|
|
5827
|
+
if (objectText !== 'exports' && objectText !== 'module.exports')
|
|
5828
|
+
return null;
|
|
5829
|
+
return (0, tree_sitter_helpers_1.getNodeText)(property, this.source);
|
|
5830
|
+
}
|
|
5831
|
+
/**
|
|
5832
|
+
* The declarator name a React handler hook binds an anonymous function to —
|
|
5833
|
+
* `const NAME = useCallback(<node>, [...])` — or null for any other shape.
|
|
5834
|
+
* JS-family only; the node must be the hook call's FIRST argument, and the
|
|
5835
|
+
* call's value must be bound directly by a `variable_declarator`.
|
|
5836
|
+
*/
|
|
5837
|
+
reactHookBoundName(node) {
|
|
5838
|
+
if (this.language !== 'typescript' &&
|
|
5839
|
+
this.language !== 'javascript' &&
|
|
5840
|
+
this.language !== 'tsx' &&
|
|
5841
|
+
this.language !== 'jsx') {
|
|
5842
|
+
return null;
|
|
5843
|
+
}
|
|
5844
|
+
if (node.type !== 'arrow_function' && node.type !== 'function_expression')
|
|
5845
|
+
return null;
|
|
5846
|
+
const args = node.parent;
|
|
5847
|
+
if (!args || args.type !== 'arguments')
|
|
5848
|
+
return null;
|
|
5849
|
+
const first = args.namedChild(0);
|
|
5850
|
+
if (!first || first.startIndex !== node.startIndex || first.endIndex !== node.endIndex)
|
|
5851
|
+
return null;
|
|
5852
|
+
const call = args.parent;
|
|
5853
|
+
if (!call || call.type !== 'call_expression')
|
|
5854
|
+
return null;
|
|
5855
|
+
const callee = (0, tree_sitter_helpers_1.getChildByField)(call, 'function');
|
|
5856
|
+
if (!callee || !REACT_HANDLER_HOOKS.test((0, tree_sitter_helpers_1.getNodeText)(callee, this.source)))
|
|
5857
|
+
return null;
|
|
5858
|
+
const declarator = call.parent;
|
|
5859
|
+
if (!declarator || declarator.type !== 'variable_declarator')
|
|
5860
|
+
return null;
|
|
5861
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'name');
|
|
5862
|
+
return nameNode?.type === 'identifier' ? (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source) : null;
|
|
5863
|
+
}
|
|
5864
|
+
/**
|
|
5865
|
+
* The declarator name for an anonymous function passed to a CURRIED wrapper
|
|
5866
|
+
* call — `const NAME = factory(...)(function () {…})` — or the property key
|
|
5867
|
+
* when the call is an object member, `{ NAME: factory(...)(fn) }`; else null.
|
|
5868
|
+
*
|
|
5869
|
+
* `reactHookBoundName` above already names a function through the declarator
|
|
5870
|
+
* that binds it; the shape is general, but that method is deliberately
|
|
5871
|
+
* bounded to the three React handler hooks. This is the same shape with a
|
|
5872
|
+
* different, equally decidable bound: the callee is itself a call, i.e. a
|
|
5873
|
+
* factory that returns the wrapper (#1747).
|
|
5874
|
+
*
|
|
5875
|
+
* Requiring the callee to be a call is what keeps this narrow. It admits
|
|
5876
|
+
* `Effect.fn("Session.run")(function* () {…})`, `connect(mapState)(fn)` and
|
|
5877
|
+
* a project's own `wrap("name")(fn)`, and it does not admit the one-call
|
|
5878
|
+
* forms where the argument is a computation rather than a body worth a node
|
|
5879
|
+
* of its own — `useMemo(() => 1 + 1, [])`, `arr.map(() => …)` — which stay
|
|
5880
|
+
* anonymous exactly as before.
|
|
5881
|
+
*
|
|
5882
|
+
* Generators are included here and not in `reactHookBoundName`: a React
|
|
5883
|
+
* handler is never a generator, while `function*` is the common form in the
|
|
5884
|
+
* ecosystem this shape comes from.
|
|
5885
|
+
*/
|
|
5886
|
+
curriedWrapperBoundName(node) {
|
|
5887
|
+
if (this.language !== 'typescript' &&
|
|
5888
|
+
this.language !== 'javascript' &&
|
|
5889
|
+
this.language !== 'tsx' &&
|
|
5890
|
+
this.language !== 'jsx') {
|
|
5891
|
+
return null;
|
|
5892
|
+
}
|
|
5893
|
+
if (node.type !== 'arrow_function' &&
|
|
5894
|
+
node.type !== 'function_expression' &&
|
|
5895
|
+
node.type !== 'generator_function') {
|
|
5896
|
+
return null;
|
|
5897
|
+
}
|
|
5898
|
+
const args = node.parent;
|
|
5899
|
+
if (!args || args.type !== 'arguments')
|
|
5900
|
+
return null;
|
|
5901
|
+
const first = args.namedChild(0);
|
|
5902
|
+
if (!first || first.startIndex !== node.startIndex || first.endIndex !== node.endIndex)
|
|
5903
|
+
return null;
|
|
5904
|
+
const call = args.parent;
|
|
5905
|
+
if (!call || call.type !== 'call_expression')
|
|
5906
|
+
return null;
|
|
5907
|
+
// The bound that replaces the hook allowlist: the thing being called is
|
|
5908
|
+
// itself a call, so this is the second application of a curried wrapper.
|
|
5909
|
+
const callee = (0, tree_sitter_helpers_1.getChildByField)(call, 'function');
|
|
5910
|
+
if (!callee || callee.type !== 'call_expression')
|
|
5911
|
+
return null;
|
|
5912
|
+
const binder = call.parent;
|
|
5913
|
+
if (!binder)
|
|
5914
|
+
return null;
|
|
5915
|
+
// `{ getMode: Effect.fn("…")(function* () {…}) }` — a service is often an
|
|
5916
|
+
// object a factory returns, so the wrapper's result lands in a `pair`. The
|
|
5917
|
+
// property key names it, as extractObjectLiteralFunctions names
|
|
5918
|
+
// `key: () => {}`.
|
|
5919
|
+
if (binder.type === 'pair') {
|
|
5920
|
+
const key = (0, tree_sitter_helpers_1.getChildByField)(binder, 'key');
|
|
5921
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(binder, 'value');
|
|
5922
|
+
if (!key || !value || value.startIndex !== call.startIndex || value.endIndex !== call.endIndex)
|
|
5923
|
+
return null;
|
|
5924
|
+
return this.objectKeyName(key);
|
|
5925
|
+
}
|
|
5926
|
+
if (binder.type !== 'variable_declarator')
|
|
5927
|
+
return null;
|
|
5928
|
+
const nameNode = (0, tree_sitter_helpers_1.getChildByField)(binder, 'name');
|
|
5929
|
+
return nameNode?.type === 'identifier' ? (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source) : null;
|
|
5930
|
+
}
|
|
5163
5931
|
visitFunctionBody(body, _functionId) {
|
|
5164
5932
|
if (!this.extractor)
|
|
5165
5933
|
return;
|
|
5166
5934
|
const visitForCallsAndStructure = (node) => {
|
|
5167
5935
|
const nodeType = node.type;
|
|
5936
|
+
// A function-like macro defined inside a body is still a macro (#1838).
|
|
5937
|
+
if ((this.language === 'c' || this.language === 'cpp') && nodeType === 'preproc_function_def') {
|
|
5938
|
+
this.visitNode(node);
|
|
5939
|
+
return;
|
|
5940
|
+
}
|
|
5168
5941
|
// Function-as-value capture (#756) — function bodies are walked here,
|
|
5169
5942
|
// not in visitNode, so the capture hook must fire in both walkers.
|
|
5170
5943
|
this.maybeCaptureFnRefs(node, nodeType);
|
|
@@ -5190,6 +5963,9 @@ class TreeSitterExtractor {
|
|
|
5190
5963
|
return;
|
|
5191
5964
|
}
|
|
5192
5965
|
}
|
|
5966
|
+
else if (this.language === 'kotlin' && nodeType === 'infix_expression') {
|
|
5967
|
+
this.extractKotlinInfixCall(node);
|
|
5968
|
+
}
|
|
5193
5969
|
else if (this.extractor.extractBareCall) {
|
|
5194
5970
|
const calleeName = this.extractor.extractBareCall(node, this.source);
|
|
5195
5971
|
if (calleeName && this.nodeStack.length > 0) {
|
|
@@ -5214,8 +5990,30 @@ class TreeSitterExtractor {
|
|
|
5214
5990
|
// (which strips template args / namespace and emits the `instantiates`
|
|
5215
5991
|
// ref). Children still recurse below, so a nested ctor-arg call
|
|
5216
5992
|
// (`Calculator calc(make())`) keeps its own `calls` ref.
|
|
5217
|
-
if (nodeType === 'declaration' && this.language === 'cpp'
|
|
5218
|
-
this.
|
|
5993
|
+
if (nodeType === 'declaration' && this.language === 'cpp') {
|
|
5994
|
+
const { instantiates, arities } = this.cppStackConstructions(node);
|
|
5995
|
+
if (instantiates)
|
|
5996
|
+
this.extractInstantiation(node);
|
|
5997
|
+
// One `calls` ref per constructed object, naming the constructor and
|
|
5998
|
+
// its argument count (`ns::T::T/1`) so the resolver can pick the
|
|
5999
|
+
// overload — a type is not a callee (#1839).
|
|
6000
|
+
const callerId = this.nodeStack[this.nodeStack.length - 1];
|
|
6001
|
+
const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
6002
|
+
if (callerId && typeNode && arities.length) {
|
|
6003
|
+
const className = (0, c_cpp_1.stripCppTemplateArgs)((0, tree_sitter_helpers_1.getNodeText)(typeNode, this.source));
|
|
6004
|
+
const name = className.split('::').filter(Boolean).pop();
|
|
6005
|
+
if (name) {
|
|
6006
|
+
for (const arity of arities) {
|
|
6007
|
+
this.unresolvedReferences.push({
|
|
6008
|
+
fromNodeId: callerId,
|
|
6009
|
+
referenceName: `${className}::${name}/${arity}`,
|
|
6010
|
+
referenceKind: 'calls',
|
|
6011
|
+
line: node.startPosition.row + 1,
|
|
6012
|
+
column: node.startPosition.column,
|
|
6013
|
+
});
|
|
6014
|
+
}
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
5219
6017
|
}
|
|
5220
6018
|
// C++ local function-pointer bindings (see cppLocalFnPtrs): record
|
|
5221
6019
|
// `auto kernel = &fn<…>;` declarations and `kernel = &other_fn<…>;`
|
|
@@ -5273,6 +6071,43 @@ class TreeSitterExtractor {
|
|
|
5273
6071
|
this.extractFunction(node);
|
|
5274
6072
|
return;
|
|
5275
6073
|
}
|
|
6074
|
+
// `const handleSubmit = useCallback(() => {…}, [deps])` — React's
|
|
6075
|
+
// memoised handler. The function is anonymous only syntactically: the
|
|
6076
|
+
// arrow is the first argument of a call whose result the declarator
|
|
6077
|
+
// binds, and that binding is the name every `onPress={handleSubmit}`
|
|
6078
|
+
// and `addListener('x', handleSubmit)` uses. Without a node of its own
|
|
6079
|
+
// the handler's calls attribute to the component and the JSX prop or
|
|
6080
|
+
// event registration has nothing to resolve to — the trigger of a flow
|
|
6081
|
+
// is invisible. Bounded to the hooks React documents for handlers
|
|
6082
|
+
// (`useCallback`, `useEffectEvent`, the experimental `useEvent`):
|
|
6083
|
+
// `useMemo` / `useEffect` callbacks are computations, not handlers.
|
|
6084
|
+
const hookBound = this.reactHookBoundName(node);
|
|
6085
|
+
if (hookBound) {
|
|
6086
|
+
this.extractFunction(node, hookBound);
|
|
6087
|
+
return;
|
|
6088
|
+
}
|
|
6089
|
+
// `const run = Effect.fn("Session.run")(function* () {…})` (#1747) —
|
|
6090
|
+
// the same declarator binding through a curried wrapper. Without a node
|
|
6091
|
+
// the body's calls attribute to the enclosing container, so the file or
|
|
6092
|
+
// the outer function picks up an outgoing edge that belongs to this
|
|
6093
|
+
// function and the callee's caller list names the wrong thing.
|
|
6094
|
+
const wrapperBound = this.curriedWrapperBoundName(node);
|
|
6095
|
+
if (wrapperBound) {
|
|
6096
|
+
this.extractFunction(node, wrapperBound);
|
|
6097
|
+
return;
|
|
6098
|
+
}
|
|
6099
|
+
// `const handleClear = () => {…}` inside a body (#1669) — the same
|
|
6100
|
+
// binding that names a function at module scope names one here, and in
|
|
6101
|
+
// a React component it is how every handler that skips `useCallback`
|
|
6102
|
+
// is written. Without a node the handler is absent from callers /
|
|
6103
|
+
// impact ("Symbol not found" reads like "no callers") and its calls
|
|
6104
|
+
// attribute to the component. extractFunction resolves the name from
|
|
6105
|
+
// the declarator; a destructuring or otherwise unnamed binding stays
|
|
6106
|
+
// anonymous and falls through.
|
|
6107
|
+
if (this.declaratorBoundFunction(node)) {
|
|
6108
|
+
this.extractFunction(node);
|
|
6109
|
+
return;
|
|
6110
|
+
}
|
|
5276
6111
|
}
|
|
5277
6112
|
// Extract structural nodes found inside function bodies.
|
|
5278
6113
|
// Each extract method visits its own children, so we return after extracting.
|
|
@@ -5286,6 +6121,8 @@ class TreeSitterExtractor {
|
|
|
5286
6121
|
this.extractInterface(node);
|
|
5287
6122
|
else if (classification === 'trait')
|
|
5288
6123
|
this.extractClass(node, 'trait');
|
|
6124
|
+
else if (classification === 'module')
|
|
6125
|
+
this.extractClass(node, 'module');
|
|
5289
6126
|
else
|
|
5290
6127
|
this.extractClass(node);
|
|
5291
6128
|
return;
|
|
@@ -5360,6 +6197,24 @@ class TreeSitterExtractor {
|
|
|
5360
6197
|
const child = node.namedChild(i);
|
|
5361
6198
|
if (!child)
|
|
5362
6199
|
continue;
|
|
6200
|
+
// Dart: `class A = B with M implements I;` keeps its supertypes in a
|
|
6201
|
+
// `mixin_application` — the same shapes as a class body's clauses.
|
|
6202
|
+
if (this.language === 'dart' && child.type === 'mixin_application_class') {
|
|
6203
|
+
const application = child.namedChildren.find((c) => c.type === 'mixin_application');
|
|
6204
|
+
for (const t of application?.namedChildren ?? []) {
|
|
6205
|
+
const targets = t.type === 'type_identifier' ? [t] : t.type === 'mixins' ? t.namedChildren.filter((m) => m.type === 'type_identifier') : t.type === 'interfaces' ? t.namedChildren : [];
|
|
6206
|
+
for (const target of targets) {
|
|
6207
|
+
this.unresolvedReferences.push({
|
|
6208
|
+
fromNodeId: classId,
|
|
6209
|
+
referenceName: (0, tree_sitter_helpers_1.getNodeText)(target, this.source),
|
|
6210
|
+
referenceKind: t.type === 'type_identifier' ? 'extends' : 'implements',
|
|
6211
|
+
line: target.startPosition.row + 1,
|
|
6212
|
+
column: target.startPosition.column,
|
|
6213
|
+
});
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
continue;
|
|
6217
|
+
}
|
|
5363
6218
|
if (child.type === 'extends_clause' ||
|
|
5364
6219
|
child.type === 'superclass' ||
|
|
5365
6220
|
child.type === 'base_clause' || // PHP class extends
|