@colbymchenry/codegraph-win32-arm64 1.6.1 → 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/lib/dist/.test-build-engine.json +1 -1
- package/lib/dist/.test-build-viewer.json +1 -1
- package/lib/dist/bin/codegraph.js +9 -3
- 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/db/queries.d.ts +31 -7
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +56 -10
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/directory.d.ts +30 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +45 -0
- package/lib/dist/directory.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 +76 -10
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/cfml-extractor.js +287 -68
- 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/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 +2 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +94 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +19 -4
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +227 -64
- 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 +15 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +122 -2
- 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 +8 -0
- package/lib/dist/extraction/languages/dart.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 +68 -0
- package/lib/dist/extraction/languages/kotlin.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 +21 -0
- package/lib/dist/extraction/languages/typescript.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.map +1 -1
- package/lib/dist/extraction/syntax-tokens.js +2 -1
- package/lib/dist/extraction/syntax-tokens.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +8 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +123 -6
- 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/graph/branch-guards.d.ts +17 -0
- package/lib/dist/graph/branch-guards.d.ts.map +1 -1
- package/lib/dist/graph/branch-guards.js +97 -2
- package/lib/dist/graph/branch-guards.js.map +1 -1
- package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
- package/lib/dist/graph/named-symbol-flow.js +8 -1
- package/lib/dist/graph/named-symbol-flow.js.map +1 -1
- package/lib/dist/index.d.ts +5 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +7 -0
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +8 -2
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +4 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +46 -12
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +2 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +13 -5
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/index-freshness-worker.js +7 -1
- package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
- package/lib/dist/mcp/index-freshness.d.ts +7 -1
- package/lib/dist/mcp/index-freshness.d.ts.map +1 -1
- package/lib/dist/mcp/index-freshness.js +31 -8
- package/lib/dist/mcp/index-freshness.js.map +1 -1
- package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
- package/lib/dist/mcp/project-lifecycle.js +5 -4
- package/lib/dist/mcp/project-lifecycle.js.map +1 -1
- 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 +194 -34
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +16 -1
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +58 -4
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +32 -2
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +120 -6
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
- package/lib/dist/resolution/alias-binding.js +16 -0
- package/lib/dist/resolution/alias-binding.js.map +1 -1
- 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.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +171 -3
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
- package/lib/dist/resolution/cpp-macro-visibility.js +57 -7
- package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
- 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 +127 -59
- 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 +6 -0
- package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/expo-router.js +62 -0
- package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/express.js +103 -44
- 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 +3 -2
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +11 -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 +9 -21
- 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 +282 -41
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nextjs.js +1 -0
- package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
- 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 +113 -26
- package/lib/dist/resolution/frameworks/python.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.d.ts +6 -5
- package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react-router.js +22 -8
- package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
- package/lib/dist/resolution/frameworks/react.d.ts +11 -1
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/react.js +367 -18
- 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.js +8 -5
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
- 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/vue-router.d.ts +26 -10
- package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/vue-router.js +176 -53
- package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
- 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 +28 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +269 -37
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +35 -0
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +224 -14
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
- package/lib/dist/resolution/js-builtins.js +2 -0
- package/lib/dist/resolution/js-builtins.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +33 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +6392 -227
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.d.ts +2 -0
- package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/react-router-synthesizer.js +80 -9
- package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +20 -1
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/lib/dist/resolution/resolver-pool.js +31 -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/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/tier-synthesizer.d.ts +7 -2
- package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/tier-synthesizer.js +365 -2
- package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
- 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 +27 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/types.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.map +1 -1
- package/lib/dist/telemetry/index.js +69 -27
- package/lib/dist/telemetry/index.js.map +1 -1
- package/lib/dist/ui-server/api/effects.d.ts +7 -0
- package/lib/dist/ui-server/api/effects.d.ts.map +1 -1
- package/lib/dist/ui-server/api/effects.js +35 -7
- package/lib/dist/ui-server/api/effects.js.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.d.ts +6 -0
- package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -1
- package/lib/dist/ui-server/api/entrypoints.js +91 -6
- package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
- package/lib/dist/ui-server/api/map.d.ts +41 -6
- package/lib/dist/ui-server/api/map.d.ts.map +1 -1
- package/lib/dist/ui-server/api/map.js +122 -22
- package/lib/dist/ui-server/api/map.js.map +1 -1
- package/lib/dist/ui-server/api/node.d.ts.map +1 -1
- package/lib/dist/ui-server/api/node.js +8 -2
- package/lib/dist/ui-server/api/node.js.map +1 -1
- package/lib/dist/ui-server/api/route-roots.d.ts +6 -0
- package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
- package/lib/dist/ui-server/api/route-roots.js +23 -2
- package/lib/dist/ui-server/api/route-roots.js.map +1 -1
- package/lib/dist/ui-server/api/routes.d.ts +2 -0
- package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
- package/lib/dist/ui-server/api/routes.js +61 -5
- package/lib/dist/ui-server/api/routes.js.map +1 -1
- package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
- package/lib/dist/ui-server/api/screens.js +16 -1
- package/lib/dist/ui-server/api/screens.js.map +1 -1
- package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
- package/lib/dist/ui-server/api/steps.js +124 -16
- package/lib/dist/ui-server/api/steps.js.map +1 -1
- package/lib/dist/ui-server/api/trails.js +1 -0
- package/lib/dist/ui-server/api/trails.js.map +1 -1
- package/lib/dist/ui-server/api/when.d.ts +10 -2
- package/lib/dist/ui-server/api/when.d.ts.map +1 -1
- package/lib/dist/ui-server/api/when.js +34 -10
- package/lib/dist/ui-server/api/when.js.map +1 -1
- 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.map +1 -1
- package/lib/dist/ui-server/highlight/index.js +6 -1
- package/lib/dist/ui-server/highlight/index.js.map +1 -1
- 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/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/viewer/assets/{index-D4S7YUPf.js → index-BSGpxBr9.js} +60 -58
- package/lib/dist/viewer/index.html +1 -1
- 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 +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-resolver.d.ts","sourceRoot":"","sources":["../../src/resolution/import-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"import-resolver.d.ts","sourceRoot":"","sources":["../../src/resolution/import-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA6CjG,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAO9D;AA4ID,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAQzE;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,IAAI,CAYf;AA+KD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CA2ET;AA6KD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAShE;AA6KD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAE9D;AA0BD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,GACjB,aAAa,EAAE,CA6BjB;AAyTD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAqDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAsDhF;AAED;;GAEG;AACH;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,CA6BpB;AAqDD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,GAAG,SAAS,CA6BhC;AAcD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAE7D;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,GAAG,SAAS,CA+ChC;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,WAAW,GAAG,IAAI,CAwTpB;AAk4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAsBT"}
|
|
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
41
41
|
exports.isNixPathImportRef = isNixPathImportRef;
|
|
42
42
|
exports.clearImportResolverMemos = clearImportResolverMemos;
|
|
43
43
|
exports.resolveImportPath = resolveImportPath;
|
|
44
|
+
exports.isExternalImport = isExternalImport;
|
|
44
45
|
exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
|
|
45
46
|
exports.loadCppIncludeDirs = loadCppIncludeDirs;
|
|
46
47
|
exports.isPhpIncludePathRef = isPhpIncludePathRef;
|
|
@@ -50,6 +51,8 @@ exports.clearImportMappingCache = clearImportMappingCache;
|
|
|
50
51
|
exports.extractReExports = extractReExports;
|
|
51
52
|
exports.resolveJvmImport = resolveJvmImport;
|
|
52
53
|
exports.resolvePhpImportedStaticCall = resolvePhpImportedStaticCall;
|
|
54
|
+
exports.isJsPathImportRef = isJsPathImportRef;
|
|
55
|
+
exports.resolvePhpQualifiedClassRef = resolvePhpQualifiedClassRef;
|
|
53
56
|
exports.resolveViaImport = resolveViaImport;
|
|
54
57
|
exports.isBoundToOutOfRepoImport = isBoundToOutOfRepoImport;
|
|
55
58
|
const fs = __importStar(require("fs"));
|
|
@@ -57,6 +60,7 @@ const path = __importStar(require("path"));
|
|
|
57
60
|
const path_aliases_1 = require("./path-aliases");
|
|
58
61
|
const alias_binding_1 = require("./alias-binding");
|
|
59
62
|
const workspace_packages_1 = require("./workspace-packages");
|
|
63
|
+
const strip_comments_1 = require("./strip-comments");
|
|
60
64
|
const name_matcher_1 = require("./name-matcher");
|
|
61
65
|
/**
|
|
62
66
|
* Extension resolution order by language
|
|
@@ -118,6 +122,25 @@ function defaultExportBinding(filePath, context) {
|
|
|
118
122
|
return source.match(DEFAULT_EXPORT_BINDING_RE)?.[1] ?? null;
|
|
119
123
|
}
|
|
120
124
|
const fileExportIndexes = new WeakMap();
|
|
125
|
+
/**
|
|
126
|
+
* `module.exports = …` (also `exports = module.exports = …`): the name it
|
|
127
|
+
* binds (`createApplication`, `function name(`, `class Name`) or the module
|
|
128
|
+
* it forwards (`require('./lib/express')`), or null.
|
|
129
|
+
*/
|
|
130
|
+
const COMMONJS_DEFAULT_EXPORT = /^[ \t]*(?:exports\s*=\s*)?module\.exports\s*=\s*(?:exports\s*=\s*)?(?:require\(\s*['"]([^'"]+)['"]\s*\)\s*;?[ \t]*$|(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)\s*\(|class\s+([A-Za-z_$][\w$]*)|([A-Za-z_$][\w$]*)\s*;?[ \t]*$)/m;
|
|
131
|
+
function commonJsDefaultExport(filePath, context) {
|
|
132
|
+
if (!JS_FAMILY_FILE.test(filePath))
|
|
133
|
+
return null;
|
|
134
|
+
if (context.fileContains && !context.fileContains(filePath, 'module.exports'))
|
|
135
|
+
return null;
|
|
136
|
+
const source = context.readFile(filePath);
|
|
137
|
+
if (!source || !source.includes('module.exports'))
|
|
138
|
+
return null;
|
|
139
|
+
const m = COMMONJS_DEFAULT_EXPORT.exec(source);
|
|
140
|
+
if (!m)
|
|
141
|
+
return null;
|
|
142
|
+
return m[1] ? { source: m[1] } : { name: m[2] ?? m[3] ?? m[4] };
|
|
143
|
+
}
|
|
121
144
|
function getFileExportIndex(filePath, context) {
|
|
122
145
|
let perFile = fileExportIndexes.get(context);
|
|
123
146
|
if (!perFile) {
|
|
@@ -189,6 +212,7 @@ function clearImportResolverMemos(context) {
|
|
|
189
212
|
luaFileBasenameIndexes.delete(context);
|
|
190
213
|
cobolCopybookIndexes.delete(context);
|
|
191
214
|
pythonModuleFileMemos.delete(context);
|
|
215
|
+
PY_MODULE_SYMBOLS.delete(context);
|
|
192
216
|
}
|
|
193
217
|
function resolveImportPath(importPath, fromFile, language, context) {
|
|
194
218
|
let memo = importPathMemos.get(context);
|
|
@@ -226,7 +250,7 @@ function resolveImportPathUncached(importPath, fromFile, language, context) {
|
|
|
226
250
|
return resolveRelativeImport(importPath, fromDir, language, context);
|
|
227
251
|
}
|
|
228
252
|
// Handle absolute/aliased imports (like @/ or src/)
|
|
229
|
-
const aliased = resolveAliasedImport(importPath, projectRoot, language, context);
|
|
253
|
+
const aliased = resolveAliasedImport(importPath, projectRoot, language, context, fromFile);
|
|
230
254
|
if (aliased)
|
|
231
255
|
return aliased;
|
|
232
256
|
// C/C++ include directory search: when neither relative nor aliased
|
|
@@ -470,9 +494,11 @@ function resolveRelativeImport(importPath, fromDir, language, context) {
|
|
|
470
494
|
// Try the path as-is first
|
|
471
495
|
const basePath = path.resolve(fromDir, importPath);
|
|
472
496
|
const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
|
|
473
|
-
// Try each extension
|
|
497
|
+
// Try each extension. `require('..')` up to the project root is its `index.js`.
|
|
474
498
|
for (const ext of extensions) {
|
|
475
|
-
|
|
499
|
+
if (relativePath === '' && !ext.startsWith('/'))
|
|
500
|
+
continue;
|
|
501
|
+
const candidatePath = relativePath === '' ? ext.slice(1) : relativePath + ext;
|
|
476
502
|
if (context.fileExists(candidatePath)) {
|
|
477
503
|
return candidatePath;
|
|
478
504
|
}
|
|
@@ -530,7 +556,7 @@ const EMITTED_SPECIFIER_LANGUAGES = new Set([
|
|
|
530
556
|
* for projects that have aliases but no tsconfig paths block.
|
|
531
557
|
* 3. Direct path lookup (with extensions).
|
|
532
558
|
*/
|
|
533
|
-
function resolveAliasedImport(importPath, projectRoot, language, context) {
|
|
559
|
+
function resolveAliasedImport(importPath, projectRoot, language, context, fromFile) {
|
|
534
560
|
const extensions = EXTENSION_RESOLUTION[language] || [];
|
|
535
561
|
const tryWithExt = (basePath) => {
|
|
536
562
|
for (const ext of extensions) {
|
|
@@ -542,9 +568,13 @@ function resolveAliasedImport(importPath, projectRoot, language, context) {
|
|
|
542
568
|
return basePath;
|
|
543
569
|
return findSourceForEmittedSpecifier(basePath, language, context);
|
|
544
570
|
};
|
|
545
|
-
// 1.
|
|
546
|
-
|
|
547
|
-
|
|
571
|
+
// 1. tsconfig/jsconfig paths: the config nearest the importing file (an
|
|
572
|
+
// app of a monorepo keeps its own `@/*`), then the project root's.
|
|
573
|
+
const nearest = fromFile ? context.getNearestAliases?.(fromFile) : null;
|
|
574
|
+
const rootMap = context.getProjectAliases?.();
|
|
575
|
+
for (const aliasMap of nearest && nearest !== rootMap ? [nearest, rootMap] : [rootMap]) {
|
|
576
|
+
if (!aliasMap)
|
|
577
|
+
continue;
|
|
548
578
|
const candidates = (0, path_aliases_1.applyAliases)(importPath, aliasMap, projectRoot);
|
|
549
579
|
for (const c of candidates) {
|
|
550
580
|
const hit = tryWithExt(c);
|
|
@@ -857,7 +887,7 @@ function extractImportMappings(_filePath, content, language) {
|
|
|
857
887
|
mappings.push(...extractJSImports(content));
|
|
858
888
|
}
|
|
859
889
|
else if (language === 'python') {
|
|
860
|
-
mappings.push(...extractPythonImports(content));
|
|
890
|
+
mappings.push(...extractPythonImports((0, strip_comments_1.stripCommentsForRegex)(content, 'python')));
|
|
861
891
|
}
|
|
862
892
|
else if (language === 'go') {
|
|
863
893
|
mappings.push(...extractGoImports(content));
|
|
@@ -878,8 +908,11 @@ function extractImportMappings(_filePath, content, language) {
|
|
|
878
908
|
*/
|
|
879
909
|
function extractJSImports(content) {
|
|
880
910
|
const mappings = [];
|
|
881
|
-
// ES6 imports
|
|
882
|
-
|
|
911
|
+
// ES6 imports. `import type { X }` / `import type * as ns` is TypeScript's
|
|
912
|
+
// type-only form, not a default import named `type` — which every such
|
|
913
|
+
// line used to add, making `type.innerType()` a call on an import.
|
|
914
|
+
// (`import type from './x'` still binds `type`: backtracking gives it back.)
|
|
915
|
+
const importRegex = /import\s+(?:type\s+(?=[{*]|(?!from\b)\w))?(?:(\w+)\s*,?\s*)?(?:\{([^}]+)\})?\s*(?:(\*)\s+as\s+(\w+))?\s*from\s*['"]([^'"]+)['"]/g;
|
|
883
916
|
let match;
|
|
884
917
|
while ((match = importRegex.exec(content)) !== null) {
|
|
885
918
|
const [, defaultImport, namedImports, star, namespaceAlias, source] = match;
|
|
@@ -895,7 +928,8 @@ function extractJSImports(content) {
|
|
|
895
928
|
}
|
|
896
929
|
// Named imports
|
|
897
930
|
if (namedImports) {
|
|
898
|
-
|
|
931
|
+
// `{ util, type objectUtil }`: an inline `type` modifier is not part of the name.
|
|
932
|
+
const names = namedImports.split(',').map((s) => s.trim().replace(/^type\s+(?=\w)/, ''));
|
|
899
933
|
for (const name of names) {
|
|
900
934
|
const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
|
|
901
935
|
if (aliasMatch) {
|
|
@@ -929,16 +963,17 @@ function extractJSImports(content) {
|
|
|
929
963
|
});
|
|
930
964
|
}
|
|
931
965
|
}
|
|
932
|
-
// Require statements
|
|
933
|
-
|
|
966
|
+
// Require statements — each declarator of a list too (`var express = require('../'),
|
|
967
|
+
// request = require('supertest')`), and a member of the module (`require('./utils').methods`).
|
|
968
|
+
const requireRegex = /(?:\b(?:const|let|var)\s+|,\s*)(?:([A-Za-z_$][\w$]*)|{([^}]+)})\s*=\s*require\(\s*['"]([^'"]+)['"]\s*\)(?:\s*\.\s*([A-Za-z_$][\w$]*))?/g;
|
|
934
969
|
while ((match = requireRegex.exec(content)) !== null) {
|
|
935
|
-
const [, defaultName, destructured, source] = match;
|
|
970
|
+
const [, defaultName, destructured, source, member] = match;
|
|
936
971
|
if (defaultName) {
|
|
937
972
|
mappings.push({
|
|
938
973
|
localName: defaultName,
|
|
939
|
-
exportedName: 'default',
|
|
974
|
+
exportedName: member ?? 'default',
|
|
940
975
|
source: source,
|
|
941
|
-
isDefault:
|
|
976
|
+
isDefault: member === undefined,
|
|
942
977
|
isNamespace: false,
|
|
943
978
|
});
|
|
944
979
|
}
|
|
@@ -974,12 +1009,13 @@ function extractJSImports(content) {
|
|
|
974
1009
|
*/
|
|
975
1010
|
function extractPythonImports(content) {
|
|
976
1011
|
const mappings = [];
|
|
977
|
-
// from X import Y
|
|
978
|
-
const fromImportRegex = /from\s+([\w.]+)\s+import\s+([^#\n]+)/g;
|
|
1012
|
+
// from X import Y, and the parenthesized form `from X import (\n Y,\n Z,\n)`
|
|
1013
|
+
const fromImportRegex = /from\s+([\w.]+)\s+import\s+(\([^)]*\)|[^#\n]+)/g;
|
|
979
1014
|
let match;
|
|
980
1015
|
while ((match = fromImportRegex.exec(content)) !== null) {
|
|
981
1016
|
const [, source, imports] = match;
|
|
982
|
-
const names = imports.
|
|
1017
|
+
const names = imports.trim().replace(/^\(|\)$/g, '')
|
|
1018
|
+
.split(',').map((s) => s.trim());
|
|
983
1019
|
for (const name of names) {
|
|
984
1020
|
const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
|
|
985
1021
|
if (aliasMatch) {
|
|
@@ -1076,8 +1112,8 @@ function extractJavaImports(content) {
|
|
|
1076
1112
|
const stripped = content
|
|
1077
1113
|
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
1078
1114
|
.replace(/\/\/[^\n]*/g, '');
|
|
1079
|
-
// `import [static] <fqn>[.*];`
|
|
1080
|
-
const re = /^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)\s
|
|
1115
|
+
// `import [static] <fqn>[.*];` — and Kotlin's `import <fqn> [as Alias]`, with no `;`.
|
|
1116
|
+
const re = /^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)(?:\s+as\s+([\w]+))?\s*(?:;|$)/gm;
|
|
1081
1117
|
let match;
|
|
1082
1118
|
while ((match = re.exec(stripped)) !== null) {
|
|
1083
1119
|
const fqn = match[2];
|
|
@@ -1087,12 +1123,12 @@ function extractJavaImports(content) {
|
|
|
1087
1123
|
if (fqn.endsWith('.*'))
|
|
1088
1124
|
continue;
|
|
1089
1125
|
const parts = fqn.split('.');
|
|
1090
|
-
const localName = parts[parts.length - 1];
|
|
1126
|
+
const localName = match[3] ?? parts[parts.length - 1];
|
|
1091
1127
|
if (!localName)
|
|
1092
1128
|
continue;
|
|
1093
1129
|
mappings.push({
|
|
1094
1130
|
localName,
|
|
1095
|
-
exportedName:
|
|
1131
|
+
exportedName: parts[parts.length - 1],
|
|
1096
1132
|
source: fqn,
|
|
1097
1133
|
isDefault: false,
|
|
1098
1134
|
isNamespace: false,
|
|
@@ -1241,11 +1277,11 @@ function extractReExports(content, language) {
|
|
|
1241
1277
|
// a project that builds export statements as runtime strings is
|
|
1242
1278
|
// out of scope.)
|
|
1243
1279
|
const cleaned = stripJsComments(content);
|
|
1244
|
-
// Wildcard: `export * from '...'
|
|
1245
|
-
const wildcardRe = /export\s*\*(?:\s+as\s
|
|
1280
|
+
// Wildcard: `export * from '...'`; `export * as ns from '...'` exports `ns` alone.
|
|
1281
|
+
const wildcardRe = /export\s*\*(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*from\s*['"]([^'"]+)['"]/g;
|
|
1246
1282
|
let m;
|
|
1247
1283
|
while ((m = wildcardRe.exec(cleaned)) !== null) {
|
|
1248
|
-
out.push({ kind: 'wildcard', source: m[
|
|
1284
|
+
out.push(m[1] ? { kind: 'namespace', exportedName: m[1], source: m[2] } : { kind: 'wildcard', source: m[2] });
|
|
1249
1285
|
}
|
|
1250
1286
|
// Named: `export { a, b as c } from '...'`
|
|
1251
1287
|
const namedRe = /export\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/g;
|
|
@@ -1321,6 +1357,29 @@ function resolveJvmImport(ref, context) {
|
|
|
1321
1357
|
resolvedBy: 'import',
|
|
1322
1358
|
};
|
|
1323
1359
|
}
|
|
1360
|
+
/** `Alias` / `Alias.member` through a renaming Kotlin import, by the imported FQN. */
|
|
1361
|
+
function resolveJvmAlias(ref, imports, context) {
|
|
1362
|
+
const dot = ref.referenceName.indexOf('.');
|
|
1363
|
+
const root = dot < 0 ? ref.referenceName : ref.referenceName.slice(0, dot);
|
|
1364
|
+
const imp = imports.find((m) => m.localName === root && m.localName !== m.exportedName);
|
|
1365
|
+
if (!imp)
|
|
1366
|
+
return null;
|
|
1367
|
+
const parts = imp.source.split('.');
|
|
1368
|
+
// The package is some prefix of the FQN; the rest is the type path (`Outer::Inner`).
|
|
1369
|
+
for (let i = parts.length - 1; i > 0; i--) {
|
|
1370
|
+
const target = context.getNodesByQualifiedName(`${parts.slice(0, i).join('.')}::${parts.slice(i).join('::')}`)[0];
|
|
1371
|
+
if (!target)
|
|
1372
|
+
continue;
|
|
1373
|
+
const member = dot < 0 ? null : ref.referenceName.slice(dot + 1);
|
|
1374
|
+
if (member === null)
|
|
1375
|
+
return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
|
|
1376
|
+
if (member.includes('.'))
|
|
1377
|
+
return null;
|
|
1378
|
+
const found = context.getNodesByQualifiedName(`${target.qualifiedName}::${member}`)[0];
|
|
1379
|
+
return found ? { original: ref, targetNodeId: found.id, confidence: 0.9, resolvedBy: 'import' } : null;
|
|
1380
|
+
}
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1324
1383
|
/**
|
|
1325
1384
|
* Pick the same-FQN candidate closest to `fromPath` by shared directory
|
|
1326
1385
|
* prefix, preferring an `expect` declaration on a tie. Used to keep a Kotlin
|
|
@@ -1394,7 +1453,105 @@ function resolvePhpImportedStaticCall(ref, context) {
|
|
|
1394
1453
|
return null;
|
|
1395
1454
|
return { original: ref, targetNodeId: methods[0].id, confidence: 0.95, resolvedBy: 'import' };
|
|
1396
1455
|
}
|
|
1456
|
+
const JS_MODULE_LANGUAGES = new Set(['javascript', 'jsx', 'typescript', 'tsx', 'arkts']);
|
|
1457
|
+
/**
|
|
1458
|
+
* A module specifier written as a path — relative (`./x`, `../x`), rooted, or
|
|
1459
|
+
* an alias with a folder in it (`@/lib/x`, `~/x`, `$lib/x`) — rather than an
|
|
1460
|
+
* imported binding's name or a bare package (`react`, `lodash`).
|
|
1461
|
+
*/
|
|
1462
|
+
function isJsPathSpecifier(name) {
|
|
1463
|
+
return name.startsWith('./') || name.startsWith('../') || name === '.' || name === '..' ||
|
|
1464
|
+
(name.includes('/') && !/\s/.test(name) && !/^@[\w.-]+\/[\w.-]+$/.test(name));
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* A JS/TS `imports` reference that names a module by path. It names a FILE, not
|
|
1468
|
+
* a symbol, so it skips the resolver's name-exists pre-filter — a CommonJS
|
|
1469
|
+
* `require('./x')` has no import node of that name to pass it.
|
|
1470
|
+
*/
|
|
1471
|
+
function isJsPathImportRef(ref) {
|
|
1472
|
+
return ref.referenceKind === 'imports' && JS_MODULE_LANGUAGES.has(ref.language) && isJsPathSpecifier(ref.referenceName);
|
|
1473
|
+
}
|
|
1474
|
+
/** PHP reference kinds whose name is a class name, written as in the source. */
|
|
1475
|
+
const PHP_CLASS_NAME_REFS = new Set(['instantiates', 'extends', 'implements', 'references']);
|
|
1476
|
+
/**
|
|
1477
|
+
* A PHP class name written with a namespace in it (#2256). `use App\Fields as
|
|
1478
|
+
* Field;` aliases a namespace, so `new Field\FirstName()`, `extends Field\Base`
|
|
1479
|
+
* and `Field\FirstName::make()` all name `App\Fields\FirstName`. PHP reads a
|
|
1480
|
+
* qualified name one way: a leading `\` makes it absolute; otherwise a first
|
|
1481
|
+
* segment a `use` imports is replaced by what it imports, and any other name is
|
|
1482
|
+
* relative to the current namespace. Both extractors emit the written name
|
|
1483
|
+
* verbatim, and with no `.` or `::` in it the pre-filter would drop it.
|
|
1484
|
+
* undefined means the ref is not a qualified class name (or names a method the
|
|
1485
|
+
* class inherits); null means it is but no single project class has that name
|
|
1486
|
+
* — it lives outside the project — so name fallbacks must not guess.
|
|
1487
|
+
*/
|
|
1488
|
+
function resolvePhpQualifiedClassRef(ref, context) {
|
|
1489
|
+
if (ref.language !== 'php')
|
|
1490
|
+
return undefined;
|
|
1491
|
+
let name = ref.referenceName;
|
|
1492
|
+
let member = null;
|
|
1493
|
+
if (ref.referenceKind === 'calls') {
|
|
1494
|
+
// A static call on the class: `Field\FirstName::make()` is written `Field\FirstName.make`.
|
|
1495
|
+
const call = /^(.*\\[^\\.:]+)(?:\.|::)(\w+)$/.exec(name);
|
|
1496
|
+
if (!call)
|
|
1497
|
+
return undefined;
|
|
1498
|
+
name = call[1];
|
|
1499
|
+
member = call[2];
|
|
1500
|
+
}
|
|
1501
|
+
else if (!PHP_CLASS_NAME_REFS.has(ref.referenceKind)) {
|
|
1502
|
+
return undefined;
|
|
1503
|
+
}
|
|
1504
|
+
const separator = name.indexOf('\\');
|
|
1505
|
+
if (separator < 0)
|
|
1506
|
+
return undefined;
|
|
1507
|
+
let fqn;
|
|
1508
|
+
if (separator === 0) {
|
|
1509
|
+
fqn = name.slice(1);
|
|
1510
|
+
}
|
|
1511
|
+
else {
|
|
1512
|
+
const head = name.slice(0, separator);
|
|
1513
|
+
const imp = context.getImportMappings(ref.filePath, ref.language).find((i) => i.localName === head);
|
|
1514
|
+
if (imp) {
|
|
1515
|
+
fqn = imp.source.replace(/^\\/, '') + name.slice(separator);
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
// `namespace App;` applies until the next namespace statement.
|
|
1519
|
+
const namespace = context.getNodesInFile(ref.filePath)
|
|
1520
|
+
.filter((n) => n.kind === 'namespace' && n.startLine <= ref.line)
|
|
1521
|
+
.sort((a, b) => b.startLine - a.startLine)[0];
|
|
1522
|
+
fqn = namespace ? `${namespace.qualifiedName}\\${name}` : name;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
const cut = fqn.lastIndexOf('\\');
|
|
1526
|
+
const qualifiedName = cut < 0 ? fqn : `${fqn.slice(0, cut)}::${fqn.slice(cut + 1)}`;
|
|
1527
|
+
const classes = context.getNodesByQualifiedName(qualifiedName)
|
|
1528
|
+
.filter((n) => n.language === 'php' && STATIC_MEMBER_CONTAINERS.has(n.kind));
|
|
1529
|
+
// A type mention can name something other than a class (a namespaced
|
|
1530
|
+
// constant or function), so it keeps the ordinary strategies.
|
|
1531
|
+
if (classes.length !== 1)
|
|
1532
|
+
return ref.referenceKind === 'references' ? undefined : null;
|
|
1533
|
+
const owner = classes[0];
|
|
1534
|
+
if (!member)
|
|
1535
|
+
return { original: ref, targetNodeId: owner.id, confidence: 0.95, resolvedBy: 'import' };
|
|
1536
|
+
const methods = context.getNodesByQualifiedName(`${owner.qualifiedName}::${member}`)
|
|
1537
|
+
.filter((n) => n.language === 'php' && n.kind === 'method' && n.filePath === owner.filePath);
|
|
1538
|
+
// A method the class inherits is left to the strategies that walk supertypes.
|
|
1539
|
+
if (methods.length !== 1)
|
|
1540
|
+
return undefined;
|
|
1541
|
+
return { original: ref, targetNodeId: methods[0].id, confidence: 0.95, resolvedBy: 'import' };
|
|
1542
|
+
}
|
|
1397
1543
|
function resolveViaImport(ref, context) {
|
|
1544
|
+
// A JS/TS module specifier — `import './polyfills'`, the module of `import x
|
|
1545
|
+
// from '../lib/a'`, a CommonJS `require('./application')` — names a FILE,
|
|
1546
|
+
// found the way the runtime finds it: extensions, `index` files, path
|
|
1547
|
+
// aliases. Matching the basename instead missed every extensionless one
|
|
1548
|
+
// (the common spelling) and could land on a same-named file elsewhere.
|
|
1549
|
+
if (isJsPathImportRef(ref)) {
|
|
1550
|
+
const file = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
|
|
1551
|
+
const fileNode = file && file !== ref.filePath ? context.getNodesInFile(file).find((n) => n.kind === 'file') : undefined;
|
|
1552
|
+
if (fileNode)
|
|
1553
|
+
return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
|
|
1554
|
+
}
|
|
1398
1555
|
// C/C++ #include references — resolve directly to the included file
|
|
1399
1556
|
// (file→file edge), bypassing symbol lookup. The extractor emits these
|
|
1400
1557
|
// with `referenceKind: 'imports'` and `referenceName: <include path>`
|
|
@@ -1584,6 +1741,13 @@ function resolveViaImport(ref, context) {
|
|
|
1584
1741
|
if (moduleFile)
|
|
1585
1742
|
return moduleFile;
|
|
1586
1743
|
}
|
|
1744
|
+
// Kotlin's `import app.model.Outer.Inner as Made`: `Made.create()` is the
|
|
1745
|
+
// aliased class's member, found by its FQN — nothing else binds the alias.
|
|
1746
|
+
if (ref.language === 'kotlin' && ref.referenceKind !== 'imports') {
|
|
1747
|
+
const aliased = resolveJvmAlias(ref, imports, context);
|
|
1748
|
+
if (aliased)
|
|
1749
|
+
return aliased;
|
|
1750
|
+
}
|
|
1587
1751
|
// Check if the reference name matches any import
|
|
1588
1752
|
for (const imp of imports) {
|
|
1589
1753
|
if (imp.localName === ref.referenceName || ref.referenceName.startsWith(imp.localName + '.')) {
|
|
@@ -1600,8 +1764,7 @@ function resolveViaImport(ref, context) {
|
|
|
1600
1764
|
? ref.referenceName.replace(imp.localName + '.', '')
|
|
1601
1765
|
: null;
|
|
1602
1766
|
const targetNode = findExportedSymbol(resolvedPath, { isDefault: imp.isDefault, isNamespace: imp.isNamespace, exportedName, memberName }, ref.language, context, new Set()) ?? (ref.language === 'python'
|
|
1603
|
-
?
|
|
1604
|
-
(n.kind === 'class' || n.kind === 'function' || n.kind === 'variable' || n.kind === 'constant'))
|
|
1767
|
+
? pythonModuleSymbol(resolvedPath, memberName ?? exportedName, context, 0)
|
|
1605
1768
|
: undefined);
|
|
1606
1769
|
if (targetNode) {
|
|
1607
1770
|
// `Foo.bar()` / `Foo.CONST` — a NAMED (non-namespace) class import
|
|
@@ -1729,13 +1892,10 @@ function resolvePythonModuleMember(ref, imports, context) {
|
|
|
1729
1892
|
}
|
|
1730
1893
|
if (!resolvedPath || resolvedPath === ref.filePath)
|
|
1731
1894
|
continue;
|
|
1732
|
-
// Find the member as a top-level definition in the module file
|
|
1733
|
-
// `method` so `mod.foo`
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
n.kind === 'class' ||
|
|
1737
|
-
n.kind === 'variable' ||
|
|
1738
|
-
n.kind === 'constant'));
|
|
1895
|
+
// Find the member as a top-level definition in the module file, or one it
|
|
1896
|
+
// re-exports (a package's `__init__.py`). Exclude `method` so `mod.foo`
|
|
1897
|
+
// never lands on a same-named class method.
|
|
1898
|
+
const target = pythonModuleSymbol(resolvedPath, member, context, 0);
|
|
1739
1899
|
if (target) {
|
|
1740
1900
|
return { original: ref, targetNodeId: target.id, confidence: 0.85, resolvedBy: 'import' };
|
|
1741
1901
|
}
|
|
@@ -1898,6 +2058,50 @@ function resolveModuleImportToFile(ref, imports, context) {
|
|
|
1898
2058
|
* caches; dropped by clearImportResolverMemos.
|
|
1899
2059
|
*/
|
|
1900
2060
|
const pythonModuleFileMemos = new WeakMap();
|
|
2061
|
+
/**
|
|
2062
|
+
* A top-level class / function / value named `name` in a Python module, or
|
|
2063
|
+
* one the module re-exports — `from .users import *`, `from .users import
|
|
2064
|
+
* User` — a few packages deep. netbox's `from users.models import User` names
|
|
2065
|
+
* `users/models/__init__.py`, which star-imports `.users`, where `User` is.
|
|
2066
|
+
*/
|
|
2067
|
+
const PY_MODULE_SYMBOLS = new WeakMap();
|
|
2068
|
+
function pythonModuleSymbol(file, name, context, depth) {
|
|
2069
|
+
let memo = PY_MODULE_SYMBOLS.get(context);
|
|
2070
|
+
if (!memo)
|
|
2071
|
+
PY_MODULE_SYMBOLS.set(context, (memo = new Map()));
|
|
2072
|
+
const key = `${file}\0${name}`;
|
|
2073
|
+
const hit = memo.get(key);
|
|
2074
|
+
if (hit !== undefined)
|
|
2075
|
+
return hit ?? undefined;
|
|
2076
|
+
// (A cycle of star imports reads as "not here" while it is being walked.)
|
|
2077
|
+
memo.set(key, null);
|
|
2078
|
+
const found = pythonModuleSymbolUncached(file, name, context, depth);
|
|
2079
|
+
memo.set(key, found ?? null);
|
|
2080
|
+
return found;
|
|
2081
|
+
}
|
|
2082
|
+
function pythonModuleSymbolUncached(file, name, context, depth) {
|
|
2083
|
+
const own = context.getNodesInFile(file).find((n) => n.name === name && !n.qualifiedName.includes('::') &&
|
|
2084
|
+
(n.kind === 'class' || n.kind === 'function' || n.kind === 'variable' || n.kind === 'constant'));
|
|
2085
|
+
if (own || depth >= 3)
|
|
2086
|
+
return own;
|
|
2087
|
+
// Re-exported by name (`from .users import User`), else through a star import
|
|
2088
|
+
// (`from .users import *` — not among the import mappings, so read here).
|
|
2089
|
+
const sources = context.getImportMappings(file, 'python')
|
|
2090
|
+
.filter((imp) => !imp.isNamespace && imp.localName === name)
|
|
2091
|
+
.map((imp) => ({ source: imp.source, exported: imp.exportedName }));
|
|
2092
|
+
for (const m of (context.readFile(file) ?? '').matchAll(/^\s*from\s+([\w.]+)\s+import\s+\*/gm)) {
|
|
2093
|
+
sources.push({ source: m[1], exported: name });
|
|
2094
|
+
}
|
|
2095
|
+
for (const { source, exported } of sources) {
|
|
2096
|
+
const target = resolveImportPath(source, file, 'python', context) ?? findPythonModuleFile(source, context, file)?.filePath ?? null;
|
|
2097
|
+
if (!target || target === file)
|
|
2098
|
+
continue;
|
|
2099
|
+
const found = pythonModuleSymbol(target, exported, context, depth + 1);
|
|
2100
|
+
if (found)
|
|
2101
|
+
return found;
|
|
2102
|
+
}
|
|
2103
|
+
return undefined;
|
|
2104
|
+
}
|
|
1901
2105
|
function findPythonModuleFile(mod, context, excludeFilePath) {
|
|
1902
2106
|
if (!mod || mod.startsWith('.'))
|
|
1903
2107
|
return null; // relative imports handled elsewhere
|
|
@@ -2241,6 +2445,20 @@ function findExportedSymbolWalk(filePath, want, language, context, visited, dept
|
|
|
2241
2445
|
const direct = exportIndex.defaultComponent ?? defaultExportBindingNode(filePath, exportIndex, context) ?? exportIndex.defaultFnClass;
|
|
2242
2446
|
if (direct)
|
|
2243
2447
|
return direct;
|
|
2448
|
+
// CommonJS: `module.exports = createApplication`, or `= require('./lib/express')`.
|
|
2449
|
+
const commonJs = commonJsDefaultExport(filePath, context);
|
|
2450
|
+
if (commonJs?.source) {
|
|
2451
|
+
const next = resolveImportPath(commonJs.source, filePath, language, context);
|
|
2452
|
+
if (next)
|
|
2453
|
+
return findExportedSymbol(next, want, language, context, visited, depth + 1);
|
|
2454
|
+
}
|
|
2455
|
+
else if (commonJs?.name) {
|
|
2456
|
+
const bound = nodesInFileNamed(filePath, commonJs.name, context)
|
|
2457
|
+
.filter((n) => DEFAULT_BINDING_KINDS.has(n.kind))
|
|
2458
|
+
.sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0];
|
|
2459
|
+
if (bound)
|
|
2460
|
+
return bound;
|
|
2461
|
+
}
|
|
2244
2462
|
}
|
|
2245
2463
|
else if (want.isNamespace && want.memberName) {
|
|
2246
2464
|
const direct = exportedByName(filePath, exportIndex, want.memberName, context);
|
|
@@ -2256,8 +2474,9 @@ function findExportedSymbolWalk(filePath, want, language, context, visited, dept
|
|
|
2256
2474
|
const reExports = context.getReExports?.(filePath, language) ?? [];
|
|
2257
2475
|
if (reExports.length === 0)
|
|
2258
2476
|
return undefined;
|
|
2259
|
-
// Look for explicit `export { want } from './other'` (with optional rename)
|
|
2260
|
-
|
|
2477
|
+
// Look for explicit `export { want } from './other'` (with optional rename) — for
|
|
2478
|
+
// `ns.member` through `import * as ns`, the member is the name wanted.
|
|
2479
|
+
const targetName = want.isDefault ? 'default' : want.isNamespace && want.memberName ? want.memberName : want.exportedName;
|
|
2261
2480
|
for (const rex of reExports) {
|
|
2262
2481
|
if (rex.kind === 'named' && rex.exportedName === targetName) {
|
|
2263
2482
|
const next = resolveImportPath(rex.source, filePath, language, context);
|
|
@@ -2275,6 +2494,19 @@ function findExportedSymbolWalk(filePath, want, language, context, visited, dept
|
|
|
2275
2494
|
return chained;
|
|
2276
2495
|
}
|
|
2277
2496
|
}
|
|
2497
|
+
// `z.core.util.fn` through `export * as core from './core'`: the member continues in that module.
|
|
2498
|
+
if (want.isNamespace && want.memberName) {
|
|
2499
|
+
const dot = want.memberName.indexOf('.');
|
|
2500
|
+
const head = dot < 0 ? want.memberName : want.memberName.slice(0, dot);
|
|
2501
|
+
const rex = dot < 0 ? undefined : reExports.find((r) => r.kind === 'namespace' && r.exportedName === head);
|
|
2502
|
+
if (rex) {
|
|
2503
|
+
const next = resolveImportPath(rex.source, filePath, language, context);
|
|
2504
|
+
const rest = want.memberName.slice(dot + 1);
|
|
2505
|
+
return next
|
|
2506
|
+
? findExportedSymbol(next, { ...want, exportedName: rest.split('.')[0], memberName: rest }, language, context, visited, depth + 1)
|
|
2507
|
+
: undefined;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2278
2510
|
// 3. Wildcard re-export: `export * from './other'` — try every
|
|
2279
2511
|
// forwarding source. This is the barrel-of-barrels case.
|
|
2280
2512
|
for (const rex of reExports) {
|