@colbymchenry/codegraph-win32-arm64 0.9.9 → 1.0.1

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.
Files changed (313) hide show
  1. package/lib/dist/bin/codegraph.d.ts +1 -0
  2. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  3. package/lib/dist/bin/codegraph.js +394 -10
  4. package/lib/dist/bin/codegraph.js.map +1 -1
  5. package/lib/dist/bin/fatal-handler.d.ts +20 -0
  6. package/lib/dist/bin/fatal-handler.d.ts.map +1 -0
  7. package/lib/dist/bin/fatal-handler.js +118 -0
  8. package/lib/dist/bin/fatal-handler.js.map +1 -0
  9. package/lib/dist/context/index.d.ts.map +1 -1
  10. package/lib/dist/context/index.js +7 -0
  11. package/lib/dist/context/index.js.map +1 -1
  12. package/lib/dist/db/index.d.ts.map +1 -1
  13. package/lib/dist/db/index.js +2 -1
  14. package/lib/dist/db/index.js.map +1 -1
  15. package/lib/dist/db/migrations.d.ts +1 -1
  16. package/lib/dist/db/migrations.d.ts.map +1 -1
  17. package/lib/dist/db/migrations.js +10 -1
  18. package/lib/dist/db/migrations.js.map +1 -1
  19. package/lib/dist/db/queries.d.ts +43 -0
  20. package/lib/dist/db/queries.d.ts.map +1 -1
  21. package/lib/dist/db/queries.js +103 -7
  22. package/lib/dist/db/queries.js.map +1 -1
  23. package/lib/dist/db/schema.sql +1 -0
  24. package/lib/dist/db/sqlite-adapter.d.ts +7 -0
  25. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  26. package/lib/dist/db/sqlite-adapter.js +3 -0
  27. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  28. package/lib/dist/directory.d.ts +49 -2
  29. package/lib/dist/directory.d.ts.map +1 -1
  30. package/lib/dist/directory.js +173 -35
  31. package/lib/dist/directory.js.map +1 -1
  32. package/lib/dist/extraction/astro-extractor.d.ts +79 -0
  33. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -0
  34. package/lib/dist/extraction/astro-extractor.js +320 -0
  35. package/lib/dist/extraction/astro-extractor.js.map +1 -0
  36. package/lib/dist/extraction/extraction-version.d.ts +25 -0
  37. package/lib/dist/extraction/extraction-version.d.ts.map +1 -0
  38. package/lib/dist/extraction/extraction-version.js +28 -0
  39. package/lib/dist/extraction/extraction-version.js.map +1 -0
  40. package/lib/dist/extraction/function-ref.d.ts +118 -0
  41. package/lib/dist/extraction/function-ref.d.ts.map +1 -0
  42. package/lib/dist/extraction/function-ref.js +727 -0
  43. package/lib/dist/extraction/function-ref.js.map +1 -0
  44. package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
  45. package/lib/dist/extraction/generated-detection.js +3 -0
  46. package/lib/dist/extraction/generated-detection.js.map +1 -1
  47. package/lib/dist/extraction/grammars.d.ts +7 -1
  48. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  49. package/lib/dist/extraction/grammars.js +52 -4
  50. package/lib/dist/extraction/grammars.js.map +1 -1
  51. package/lib/dist/extraction/index.d.ts +34 -0
  52. package/lib/dist/extraction/index.d.ts.map +1 -1
  53. package/lib/dist/extraction/index.js +389 -62
  54. package/lib/dist/extraction/index.js.map +1 -1
  55. package/lib/dist/extraction/languages/c-cpp.d.ts +8 -0
  56. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  57. package/lib/dist/extraction/languages/c-cpp.js +87 -28
  58. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  59. package/lib/dist/extraction/languages/csharp.d.ts +22 -0
  60. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
  61. package/lib/dist/extraction/languages/csharp.js +84 -2
  62. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  63. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  64. package/lib/dist/extraction/languages/dart.js +161 -1
  65. package/lib/dist/extraction/languages/dart.js.map +1 -1
  66. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  67. package/lib/dist/extraction/languages/go.js +43 -2
  68. package/lib/dist/extraction/languages/go.js.map +1 -1
  69. package/lib/dist/extraction/languages/index.d.ts.map +1 -1
  70. package/lib/dist/extraction/languages/index.js +2 -0
  71. package/lib/dist/extraction/languages/index.js.map +1 -1
  72. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  73. package/lib/dist/extraction/languages/java.js +42 -1
  74. package/lib/dist/extraction/languages/java.js.map +1 -1
  75. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  76. package/lib/dist/extraction/languages/javascript.js +16 -0
  77. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  78. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  79. package/lib/dist/extraction/languages/kotlin.js +69 -0
  80. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  81. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  82. package/lib/dist/extraction/languages/objc.js +42 -0
  83. package/lib/dist/extraction/languages/objc.js.map +1 -1
  84. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  85. package/lib/dist/extraction/languages/pascal.js +11 -0
  86. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  87. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  88. package/lib/dist/extraction/languages/php.js +90 -1
  89. package/lib/dist/extraction/languages/php.js.map +1 -1
  90. package/lib/dist/extraction/languages/r.d.ts +3 -0
  91. package/lib/dist/extraction/languages/r.d.ts.map +1 -0
  92. package/lib/dist/extraction/languages/r.js +314 -0
  93. package/lib/dist/extraction/languages/r.js.map +1 -0
  94. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  95. package/lib/dist/extraction/languages/ruby.js +35 -0
  96. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  97. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  98. package/lib/dist/extraction/languages/rust.js +35 -2
  99. package/lib/dist/extraction/languages/rust.js.map +1 -1
  100. package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
  101. package/lib/dist/extraction/languages/scala.js +61 -1
  102. package/lib/dist/extraction/languages/scala.js.map +1 -1
  103. package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
  104. package/lib/dist/extraction/languages/swift.js +61 -0
  105. package/lib/dist/extraction/languages/swift.js.map +1 -1
  106. package/lib/dist/extraction/languages/typescript.d.ts +13 -0
  107. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  108. package/lib/dist/extraction/languages/typescript.js +38 -0
  109. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  110. package/lib/dist/extraction/liquid-extractor.d.ts +7 -0
  111. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  112. package/lib/dist/extraction/liquid-extractor.js +53 -9
  113. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  114. package/lib/dist/extraction/razor-extractor.d.ts +42 -0
  115. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -0
  116. package/lib/dist/extraction/razor-extractor.js +285 -0
  117. package/lib/dist/extraction/razor-extractor.js.map +1 -0
  118. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  119. package/lib/dist/extraction/svelte-extractor.js +6 -3
  120. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  121. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  122. package/lib/dist/extraction/tree-sitter-helpers.js +59 -10
  123. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  124. package/lib/dist/extraction/tree-sitter-types.d.ts +33 -0
  125. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  126. package/lib/dist/extraction/tree-sitter.d.ts +211 -0
  127. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  128. package/lib/dist/extraction/tree-sitter.js +1681 -49
  129. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  130. package/lib/dist/extraction/vue-extractor.d.ts +15 -0
  131. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  132. package/lib/dist/extraction/vue-extractor.js +94 -3
  133. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  134. package/lib/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  135. package/lib/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  136. package/lib/dist/graph/queries.d.ts.map +1 -1
  137. package/lib/dist/graph/queries.js +13 -40
  138. package/lib/dist/graph/queries.js.map +1 -1
  139. package/lib/dist/graph/traversal.d.ts.map +1 -1
  140. package/lib/dist/graph/traversal.js +16 -4
  141. package/lib/dist/graph/traversal.js.map +1 -1
  142. package/lib/dist/index.d.ts +34 -2
  143. package/lib/dist/index.d.ts.map +1 -1
  144. package/lib/dist/index.js +90 -8
  145. package/lib/dist/index.js.map +1 -1
  146. package/lib/dist/installer/index.d.ts.map +1 -1
  147. package/lib/dist/installer/index.js +63 -2
  148. package/lib/dist/installer/index.js.map +1 -1
  149. package/lib/dist/installer/instructions-template.d.ts +34 -11
  150. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  151. package/lib/dist/installer/instructions-template.js +44 -12
  152. package/lib/dist/installer/instructions-template.js.map +1 -1
  153. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  154. package/lib/dist/installer/targets/claude.js +6 -10
  155. package/lib/dist/installer/targets/claude.js.map +1 -1
  156. package/lib/dist/installer/targets/codex.js +4 -6
  157. package/lib/dist/installer/targets/codex.js.map +1 -1
  158. package/lib/dist/installer/targets/gemini.js +4 -6
  159. package/lib/dist/installer/targets/gemini.js.map +1 -1
  160. package/lib/dist/installer/targets/opencode.d.ts +9 -1
  161. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  162. package/lib/dist/installer/targets/opencode.js +91 -40
  163. package/lib/dist/installer/targets/opencode.js.map +1 -1
  164. package/lib/dist/installer/targets/shared.d.ts +14 -0
  165. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  166. package/lib/dist/installer/targets/shared.js +16 -0
  167. package/lib/dist/installer/targets/shared.js.map +1 -1
  168. package/lib/dist/mcp/daemon-manager.d.ts +42 -0
  169. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -0
  170. package/lib/dist/mcp/daemon-manager.js +129 -0
  171. package/lib/dist/mcp/daemon-manager.js.map +1 -0
  172. package/lib/dist/mcp/daemon-registry.d.ts +47 -0
  173. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -0
  174. package/lib/dist/mcp/daemon-registry.js +229 -0
  175. package/lib/dist/mcp/daemon-registry.js.map +1 -0
  176. package/lib/dist/mcp/daemon.d.ts +60 -1
  177. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  178. package/lib/dist/mcp/daemon.js +226 -8
  179. package/lib/dist/mcp/daemon.js.map +1 -1
  180. package/lib/dist/mcp/dynamic-boundaries.d.ts +41 -0
  181. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  182. package/lib/dist/mcp/dynamic-boundaries.js +359 -0
  183. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -0
  184. package/lib/dist/mcp/index.d.ts +1 -0
  185. package/lib/dist/mcp/index.d.ts.map +1 -1
  186. package/lib/dist/mcp/index.js +31 -9
  187. package/lib/dist/mcp/index.js.map +1 -1
  188. package/lib/dist/mcp/liveness-watchdog.d.ts +18 -0
  189. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  190. package/lib/dist/mcp/liveness-watchdog.js +207 -0
  191. package/lib/dist/mcp/liveness-watchdog.js.map +1 -0
  192. package/lib/dist/mcp/ppid-watchdog.d.ts +44 -0
  193. package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  194. package/lib/dist/mcp/ppid-watchdog.js +27 -0
  195. package/lib/dist/mcp/ppid-watchdog.js.map +1 -0
  196. package/lib/dist/mcp/proxy.d.ts +6 -0
  197. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  198. package/lib/dist/mcp/proxy.js +153 -24
  199. package/lib/dist/mcp/proxy.js.map +1 -1
  200. package/lib/dist/mcp/server-instructions.d.ts +12 -1
  201. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  202. package/lib/dist/mcp/server-instructions.js +43 -16
  203. package/lib/dist/mcp/server-instructions.js.map +1 -1
  204. package/lib/dist/mcp/session.d.ts +2 -0
  205. package/lib/dist/mcp/session.d.ts.map +1 -1
  206. package/lib/dist/mcp/session.js +49 -2
  207. package/lib/dist/mcp/session.js.map +1 -1
  208. package/lib/dist/mcp/stdin-teardown.d.ts +27 -0
  209. package/lib/dist/mcp/stdin-teardown.d.ts.map +1 -0
  210. package/lib/dist/mcp/stdin-teardown.js +49 -0
  211. package/lib/dist/mcp/stdin-teardown.js.map +1 -0
  212. package/lib/dist/mcp/tools.d.ts +71 -0
  213. package/lib/dist/mcp/tools.d.ts.map +1 -1
  214. package/lib/dist/mcp/tools.js +703 -85
  215. package/lib/dist/mcp/tools.js.map +1 -1
  216. package/lib/dist/mcp/transport.d.ts.map +1 -1
  217. package/lib/dist/mcp/transport.js +18 -2
  218. package/lib/dist/mcp/transport.js.map +1 -1
  219. package/lib/dist/resolution/callback-synthesizer.d.ts +3 -3
  220. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  221. package/lib/dist/resolution/callback-synthesizer.js +549 -21
  222. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  223. package/lib/dist/resolution/frameworks/astro.d.ts +9 -0
  224. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -0
  225. package/lib/dist/resolution/frameworks/astro.js +169 -0
  226. package/lib/dist/resolution/frameworks/astro.js.map +1 -0
  227. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  228. package/lib/dist/resolution/frameworks/expo-modules.js +6 -1
  229. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  230. package/lib/dist/resolution/frameworks/index.d.ts +1 -0
  231. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  232. package/lib/dist/resolution/frameworks/index.js +5 -1
  233. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  234. package/lib/dist/resolution/frameworks/java.js +6 -1
  235. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  236. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  237. package/lib/dist/resolution/frameworks/python.js +7 -3
  238. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  239. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  240. package/lib/dist/resolution/frameworks/react-native.js +53 -3
  241. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  242. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  243. package/lib/dist/resolution/frameworks/react.js +15 -3
  244. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  245. package/lib/dist/resolution/frameworks/svelte.js +5 -1
  246. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  247. package/lib/dist/resolution/frameworks/vue.js +24 -27
  248. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  249. package/lib/dist/resolution/import-resolver.d.ts +10 -0
  250. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  251. package/lib/dist/resolution/import-resolver.js +620 -2
  252. package/lib/dist/resolution/import-resolver.js.map +1 -1
  253. package/lib/dist/resolution/index.d.ts +80 -0
  254. package/lib/dist/resolution/index.d.ts.map +1 -1
  255. package/lib/dist/resolution/index.js +457 -7
  256. package/lib/dist/resolution/index.js.map +1 -1
  257. package/lib/dist/resolution/name-matcher.d.ts +61 -0
  258. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  259. package/lib/dist/resolution/name-matcher.js +590 -14
  260. package/lib/dist/resolution/name-matcher.js.map +1 -1
  261. package/lib/dist/resolution/types.d.ts +27 -3
  262. package/lib/dist/resolution/types.d.ts.map +1 -1
  263. package/lib/dist/resolution/workspace-packages.d.ts +48 -0
  264. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -0
  265. package/lib/dist/resolution/workspace-packages.js +208 -0
  266. package/lib/dist/resolution/workspace-packages.js.map +1 -0
  267. package/lib/dist/search/query-utils.d.ts +17 -1
  268. package/lib/dist/search/query-utils.d.ts.map +1 -1
  269. package/lib/dist/search/query-utils.js +79 -10
  270. package/lib/dist/search/query-utils.js.map +1 -1
  271. package/lib/dist/sync/watcher.d.ts +124 -32
  272. package/lib/dist/sync/watcher.d.ts.map +1 -1
  273. package/lib/dist/sync/watcher.js +326 -111
  274. package/lib/dist/sync/watcher.js.map +1 -1
  275. package/lib/dist/telemetry/index.d.ts +146 -0
  276. package/lib/dist/telemetry/index.d.ts.map +1 -0
  277. package/lib/dist/telemetry/index.js +544 -0
  278. package/lib/dist/telemetry/index.js.map +1 -0
  279. package/lib/dist/types.d.ts +17 -2
  280. package/lib/dist/types.d.ts.map +1 -1
  281. package/lib/dist/types.js +3 -0
  282. package/lib/dist/types.js.map +1 -1
  283. package/lib/dist/upgrade/index.d.ts +132 -0
  284. package/lib/dist/upgrade/index.d.ts.map +1 -0
  285. package/lib/dist/upgrade/index.js +462 -0
  286. package/lib/dist/upgrade/index.js.map +1 -0
  287. package/lib/dist/utils.d.ts +30 -24
  288. package/lib/dist/utils.d.ts.map +1 -1
  289. package/lib/dist/utils.js +64 -48
  290. package/lib/dist/utils.js.map +1 -1
  291. package/lib/node_modules/.package-lock.json +1 -29
  292. package/lib/package.json +1 -2
  293. package/package.json +1 -1
  294. package/lib/node_modules/chokidar/LICENSE +0 -21
  295. package/lib/node_modules/chokidar/README.md +0 -305
  296. package/lib/node_modules/chokidar/esm/handler.d.ts +0 -90
  297. package/lib/node_modules/chokidar/esm/handler.js +0 -629
  298. package/lib/node_modules/chokidar/esm/index.d.ts +0 -215
  299. package/lib/node_modules/chokidar/esm/index.js +0 -798
  300. package/lib/node_modules/chokidar/esm/package.json +0 -1
  301. package/lib/node_modules/chokidar/handler.d.ts +0 -90
  302. package/lib/node_modules/chokidar/handler.js +0 -635
  303. package/lib/node_modules/chokidar/index.d.ts +0 -215
  304. package/lib/node_modules/chokidar/index.js +0 -804
  305. package/lib/node_modules/chokidar/package.json +0 -69
  306. package/lib/node_modules/readdirp/LICENSE +0 -21
  307. package/lib/node_modules/readdirp/README.md +0 -120
  308. package/lib/node_modules/readdirp/esm/index.d.ts +0 -108
  309. package/lib/node_modules/readdirp/esm/index.js +0 -257
  310. package/lib/node_modules/readdirp/esm/package.json +0 -1
  311. package/lib/node_modules/readdirp/index.d.ts +0 -108
  312. package/lib/node_modules/readdirp/index.js +0 -263
  313. package/lib/node_modules/readdirp/package.json +0 -70
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.resolveImportPath = resolveImportPath;
42
42
  exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
43
43
  exports.loadCppIncludeDirs = loadCppIncludeDirs;
44
+ exports.isPhpIncludePathRef = isPhpIncludePathRef;
44
45
  exports.extractImportMappings = extractImportMappings;
45
46
  exports.clearImportMappingCache = clearImportMappingCache;
46
47
  exports.extractReExports = extractReExports;
@@ -49,6 +50,7 @@ exports.resolveViaImport = resolveViaImport;
49
50
  const fs = __importStar(require("fs"));
50
51
  const path = __importStar(require("path"));
51
52
  const path_aliases_1 = require("./path-aliases");
53
+ const workspace_packages_1 = require("./workspace-packages");
52
54
  /**
53
55
  * Extension resolution order by language
54
56
  */
@@ -57,6 +59,12 @@ const EXTENSION_RESOLUTION = {
57
59
  javascript: ['.js', '.jsx', '.mjs', '.cjs', '/index.js', '/index.jsx'],
58
60
  tsx: ['.tsx', '.ts', '.d.ts', '.js', '.jsx', '/index.tsx', '/index.ts', '/index.js'],
59
61
  jsx: ['.jsx', '.js', '/index.jsx', '/index.js'],
62
+ // SFC consumers import plain TS/JS, sibling components, and barrels
63
+ // (`./lib` → `./lib/index.ts`). Without a list, relative imports from a
64
+ // `.svelte`/`.vue` file resolve to nothing, so barrel callers vanish (#629).
65
+ svelte: ['.ts', '.js', '.svelte', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.svelte'],
66
+ vue: ['.ts', '.js', '.vue', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.vue'],
67
+ astro: ['.ts', '.js', '.astro', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.astro'],
60
68
  python: ['.py', '/__init__.py'],
61
69
  go: ['.go'],
62
70
  rust: ['.rs', '/mod.rs'],
@@ -146,6 +154,14 @@ function isExternalImport(importPath, language, context) {
146
154
  if (importPath.startsWith('.')) {
147
155
  return false;
148
156
  }
157
+ // Workspace-member imports (`@scope/ui`, `@scope/ui/widgets`) are LOCAL to
158
+ // a monorepo even though they look like bare npm specifiers. Consult the
159
+ // workspace map first so they aren't misclassified as external (#629). The
160
+ // map is null for single-package repos, so this is a no-op there.
161
+ const workspaces = context?.getWorkspacePackages?.();
162
+ if (workspaces && (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces)) {
163
+ return false;
164
+ }
149
165
  // Common external patterns
150
166
  if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
151
167
  // Node built-ins
@@ -212,6 +228,25 @@ function isExternalImport(importPath, language, context) {
212
228
  function resolveRelativeImport(importPath, fromDir, language, context) {
213
229
  const projectRoot = context.getProjectRoot();
214
230
  const extensions = EXTENSION_RESOLUTION[language] || [];
231
+ // Python dotted-relative imports (`from .certs import x`, `from ..pkg.mod
232
+ // import y`): leading dots are PACKAGE levels (1 = current package), and the
233
+ // remainder is a dotted submodule path. `path.resolve(dir, '.certs')` would
234
+ // treat `.certs` as a literal hidden filename, so translate the Python form
235
+ // to a real filesystem-relative path before resolving.
236
+ if (language === 'python' && importPath.startsWith('.')) {
237
+ const dots = importPath.length - importPath.replace(/^\.+/, '').length;
238
+ const up = '../'.repeat(Math.max(0, dots - 1)); // 1 dot = current dir
239
+ const rest = importPath.slice(dots).replace(/\./g, '/'); // 'sub.mod' -> 'sub/mod'
240
+ const pyBase = path.resolve(fromDir, up + rest);
241
+ const pyRel = path.relative(projectRoot, pyBase).replace(/\\/g, '/');
242
+ for (const ext of extensions) {
243
+ if (context.fileExists(pyRel + ext))
244
+ return pyRel + ext;
245
+ }
246
+ if (pyRel && context.fileExists(pyRel))
247
+ return pyRel;
248
+ return null;
249
+ }
215
250
  // Try the path as-is first
216
251
  const basePath = path.resolve(fromDir, importPath);
217
252
  const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
@@ -261,6 +296,18 @@ function resolveAliasedImport(importPath, projectRoot, language, context) {
261
296
  return hit;
262
297
  }
263
298
  }
299
+ // 1.5 Workspace packages (`@scope/ui/widgets` → `packages/ui/widgets`).
300
+ // Resolves a monorepo member import to the member's directory; the
301
+ // extension/index permutations below then find its barrel (#629).
302
+ const workspaces = context.getWorkspacePackages?.();
303
+ if (workspaces) {
304
+ const base = (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces);
305
+ if (base) {
306
+ const hit = tryWithExt(base);
307
+ if (hit)
308
+ return hit;
309
+ }
310
+ }
264
311
  // 2. Hard-coded fallback list. Kept for projects that use these
265
312
  // conventional aliases without declaring them in tsconfig.
266
313
  const fallbackAliases = {
@@ -490,6 +537,41 @@ function resolveCppIncludePath(importPath, language, context) {
490
537
  }
491
538
  return null;
492
539
  }
540
+ /**
541
+ * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?
542
+ *
543
+ * include/require emit a file path ("lib.php", "inc/db.php", "../x.php"),
544
+ * whereas namespace use is an FQN (App\Foo\Bar) or a bare class symbol
545
+ * (Closure). PHP identifiers contain neither '/' nor '.', so a slash or dot
546
+ * marks a path-shaped include. Such references resolve to files only — never
547
+ * to a same-named symbol — so callers must not fall back to the name-matcher.
548
+ */
549
+ function isPhpIncludePathRef(ref) {
550
+ return (ref.language === 'php' &&
551
+ ref.referenceKind === 'imports' &&
552
+ (ref.referenceName.includes('/') || ref.referenceName.includes('.')));
553
+ }
554
+ /**
555
+ * Resolve a PHP include/require path to a project-relative file path.
556
+ *
557
+ * PHP resolves includes relative to the including file's directory (the
558
+ * common case for procedural codebases); php.ini `include_path` is not
559
+ * modeled. Callers pass an already-extracted static literal path.
560
+ */
561
+ function resolvePhpIncludePath(includePath, fromFile, context) {
562
+ const projectRoot = context.getProjectRoot();
563
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
564
+ const basePath = path.resolve(fromDir, includePath);
565
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
566
+ if (context.fileExists(relativePath))
567
+ return relativePath;
568
+ // The literal may omit the .php extension (e.g. include "config").
569
+ for (const ext of EXTENSION_RESOLUTION.php ?? []) {
570
+ if (context.fileExists(relativePath + ext))
571
+ return relativePath + ext;
572
+ }
573
+ return null;
574
+ }
493
575
  /**
494
576
  * Extract import mappings from a file
495
577
  */
@@ -498,6 +580,18 @@ function extractImportMappings(_filePath, content, language) {
498
580
  if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
499
581
  mappings.push(...extractJSImports(content));
500
582
  }
583
+ else if (language === 'svelte' || language === 'vue' || language === 'astro') {
584
+ // Svelte/Vue single-file components import via plain ES6 inside their
585
+ // `<script>` block (Astro: the `---` frontmatter). Without this, a
586
+ // `.svelte`/`.vue`/`.astro` consumer produces
587
+ // zero import mappings, so `resolveViaImport` can't run and a barrel
588
+ // import (`import { Foo } from './lib'`) falls back to name-matching —
589
+ // which silently fails whenever the re-export alias differs from the
590
+ // component's real name, yielding a false 0 callers (#629). The ES6
591
+ // import regex only matches `import … from '…'`, so running it over the
592
+ // whole SFC (markup + styles included) is safe.
593
+ mappings.push(...extractJSImports(content));
594
+ }
501
595
  else if (language === 'python') {
502
596
  mappings.push(...extractPythonImports(content));
503
597
  }
@@ -947,13 +1041,53 @@ function resolveJvmImport(ref, context) {
947
1041
  const candidates = context.getNodesByQualifiedName(`${pkg}::${sym}`);
948
1042
  if (candidates.length === 0)
949
1043
  return null;
1044
+ // Kotlin Multiplatform: an `expect` declaration and its `actual`s share one
1045
+ // FQN across source sets (commonMain / androidMain / appleMain). Taking the
1046
+ // first candidate let a single platform `actual` absorb every common-side
1047
+ // import, so the `expect` (the canonical API a commonMain file imports)
1048
+ // looked unused. Prefer the candidate CLOSEST to the importing file by
1049
+ // directory proximity — a commonMain import resolves to the commonMain
1050
+ // declaration — with the `expect` side as a tiebreak.
1051
+ const best = candidates.length === 1 ? candidates[0] : pickClosestJvmCandidate(candidates, ref.filePath);
950
1052
  return {
951
1053
  original: ref,
952
- targetNodeId: candidates[0].id,
1054
+ targetNodeId: best.id,
953
1055
  confidence: 0.95,
954
1056
  resolvedBy: 'import',
955
1057
  };
956
1058
  }
1059
+ /**
1060
+ * Pick the same-FQN candidate closest to `fromPath` by shared directory
1061
+ * prefix, preferring an `expect` declaration on a tie. Used to keep a Kotlin
1062
+ * Multiplatform `expect`/`actual` import resolving within the importer's own
1063
+ * source set instead of an arbitrary platform `actual`.
1064
+ */
1065
+ function pickClosestJvmCandidate(candidates, fromPath) {
1066
+ const fromDirs = fromPath.split('/').slice(0, -1);
1067
+ const sharedPrefix = (p) => {
1068
+ const d = p.split('/').slice(0, -1);
1069
+ let shared = 0;
1070
+ for (let i = 0; i < Math.min(fromDirs.length, d.length); i++) {
1071
+ if (fromDirs[i] === d[i])
1072
+ shared++;
1073
+ else
1074
+ break;
1075
+ }
1076
+ return shared;
1077
+ };
1078
+ const isExpect = (n) => Array.isArray(n.decorators) && n.decorators.includes('expect');
1079
+ let best = candidates[0];
1080
+ let bestProx = sharedPrefix(best.filePath);
1081
+ for (let i = 1; i < candidates.length; i++) {
1082
+ const c = candidates[i];
1083
+ const prox = sharedPrefix(c.filePath);
1084
+ if (prox > bestProx || (prox === bestProx && isExpect(c) && !isExpect(best))) {
1085
+ best = c;
1086
+ bestProx = prox;
1087
+ }
1088
+ }
1089
+ return best;
1090
+ }
957
1091
  function resolveViaImport(ref, context) {
958
1092
  // C/C++ #include references — resolve directly to the included file
959
1093
  // (file→file edge), bypassing symbol lookup. The extractor emits these
@@ -963,6 +1097,23 @@ function resolveViaImport(ref, context) {
963
1097
  // edge — resolveViaImport's symbol lookup below would search the
964
1098
  // resolved file for a symbol named like the file extension and fail.
965
1099
  if ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports') {
1100
+ // C/C++ quoted includes (`#include "X.h"`) resolve relative to the
1101
+ // INCLUDING file's own directory first (the C standard's quoted-include
1102
+ // search order). Prefer a same-directory header over an -I directory or a
1103
+ // same-named header on another platform (windows/code/RNCAsyncStorage.h vs
1104
+ // apple/.../RNCAsyncStorage.h) — the include-dir heuristic below would
1105
+ // otherwise pick an arbitrary same-named header, leaving the real local one
1106
+ // with no dependents.
1107
+ const slash = ref.filePath.lastIndexOf('/');
1108
+ const fromDir = slash >= 0 ? ref.filePath.slice(0, slash) : '';
1109
+ const siblingPath = path.posix.normalize(fromDir ? `${fromDir}/${ref.referenceName}` : ref.referenceName);
1110
+ const siblingBase = siblingPath.split('/').pop();
1111
+ const sibling = context
1112
+ .getNodesByName(siblingBase)
1113
+ .find((n) => n.kind === 'file' && n.filePath === siblingPath);
1114
+ if (sibling) {
1115
+ return { original: ref, targetNodeId: sibling.id, confidence: 0.92, resolvedBy: 'import' };
1116
+ }
966
1117
  const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
967
1118
  if (!resolvedPath)
968
1119
  return null;
@@ -979,6 +1130,35 @@ function resolveViaImport(ref, context) {
979
1130
  }
980
1131
  return null;
981
1132
  }
1133
+ // PHP include/require — resolve the static string path to a file→file
1134
+ // edge, mirroring the C/C++ branch above. Distinguish include PATHS from
1135
+ // namespace `use` symbols by shape: an include path contains a slash or a
1136
+ // file extension ("lib.php", "inc/db.php", "../x.php"), whereas a namespace
1137
+ // use is an FQN (App\Foo\Bar) or a bare class symbol (Closure) — PHP
1138
+ // identifiers contain neither '/' nor '.'. Only path-shaped references are
1139
+ // includes; symbol references fall through to the namespace resolution.
1140
+ if (isPhpIncludePathRef(ref)) {
1141
+ const resolvedPath = resolvePhpIncludePath(ref.referenceName, ref.filePath, context);
1142
+ if (resolvedPath) {
1143
+ const basename = resolvedPath.split('/').pop();
1144
+ const fileNode = context
1145
+ .getNodesByName(basename)
1146
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1147
+ if (fileNode) {
1148
+ return {
1149
+ original: ref,
1150
+ targetNodeId: fileNode.id,
1151
+ confidence: 0.9,
1152
+ resolvedBy: 'import',
1153
+ };
1154
+ }
1155
+ }
1156
+ // A path-shaped include that doesn't resolve to a known project file is a
1157
+ // dead end. Return unresolved rather than falling through to the symbol
1158
+ // name-matcher, which would mis-connect e.g. "inc/db.php" to an unrelated
1159
+ // db.php elsewhere in the tree — a wrong edge is worse than a missing one.
1160
+ return null;
1161
+ }
982
1162
  // Use cached import mappings (avoids re-reading and re-parsing per ref)
983
1163
  const imports = context.getImportMappings(ref.filePath, ref.language);
984
1164
  if (imports.length === 0 && !context.readFile(ref.filePath)) {
@@ -1004,6 +1184,54 @@ function resolveViaImport(ref, context) {
1004
1184
  if (javaResult)
1005
1185
  return javaResult;
1006
1186
  }
1187
+ // Python qualified access through an imported MODULE: `certs.where()` after
1188
+ // `from . import certs`, `mod.func()` after `import mod`. The receiver names a
1189
+ // submodule (a file), not a symbol, so the generic symbol lookup below would
1190
+ // search the *package* for `certs` instead of looking inside the module.
1191
+ if (ref.language === 'python') {
1192
+ const pyResult = resolvePythonModuleMember(ref, imports, context);
1193
+ if (pyResult)
1194
+ return pyResult;
1195
+ // Absolute dotted module import: `import conduit.apps.articles.signals`
1196
+ // (the standard Django AppConfig.ready() signal-registration pattern, and
1197
+ // any side-effect `import pkg.mod`). Map the dotted path to its file.
1198
+ const pyModResult = resolvePythonAbsoluteModule(ref, context);
1199
+ if (pyModResult)
1200
+ return pyModResult;
1201
+ }
1202
+ // Rust qualified path: resolve the module prefix of `crate::m::Item` /
1203
+ // `self::sub::Item` / `super::m::func` to a file, then find the leaf symbol in
1204
+ // it. Disambiguates common-name `pub use self::read::read` re-exports that
1205
+ // name-matching would land on the wrong same-named symbol.
1206
+ if (ref.language === 'rust' && ref.referenceName.includes('::')) {
1207
+ const rustResult = resolveRustPathReference(ref, context);
1208
+ if (rustResult)
1209
+ return rustResult;
1210
+ }
1211
+ // Lua / Luau `require(...)`: a dotted module path (`a.b.c` from
1212
+ // `require("a.b.c")`) or an instance-path leaf (`Signal` from
1213
+ // `require(script.Parent.Signal)`) — map it to a module file. There's no static
1214
+ // import statement, so the generic path-matcher can't bridge the dot↔slash /
1215
+ // leaf↔basename gap; resolve it explicitly to the module file.
1216
+ if ((ref.language === 'lua' || ref.language === 'luau') && ref.referenceKind === 'imports') {
1217
+ const luaResult = resolveLuaRequire(ref, context);
1218
+ if (luaResult)
1219
+ return luaResult;
1220
+ }
1221
+ // Whole-module / namespace imports → link the importing file to the module
1222
+ // file. Python `from . import certs` / `import mod`, and TS/JS `import * as ns
1223
+ // from './x'` (so a namespace touched only via a value-member read still
1224
+ // records the dependency). A named TS/JS import returns null here and falls
1225
+ // through to symbol resolution below.
1226
+ if (ref.language === 'python' ||
1227
+ ref.language === 'typescript' ||
1228
+ ref.language === 'tsx' ||
1229
+ ref.language === 'javascript' ||
1230
+ ref.language === 'jsx') {
1231
+ const moduleFile = resolveModuleImportToFile(ref, imports, context);
1232
+ if (moduleFile)
1233
+ return moduleFile;
1234
+ }
1007
1235
  // Check if the reference name matches any import
1008
1236
  for (const imp of imports) {
1009
1237
  if (imp.localName === ref.referenceName || ref.referenceName.startsWith(imp.localName + '.')) {
@@ -1016,6 +1244,24 @@ function resolveViaImport(ref, context) {
1016
1244
  : null;
1017
1245
  const targetNode = findExportedSymbol(resolvedPath, { isDefault: imp.isDefault, isNamespace: imp.isNamespace, exportedName, memberName }, ref.language, context, new Set());
1018
1246
  if (targetNode) {
1247
+ // `Foo.bar()` / `Foo.CONST` — a NAMED (non-namespace) class import
1248
+ // accessed through a member. `findExportedSymbol` resolved `Foo` to
1249
+ // the class itself; descend into it so the reference links to the
1250
+ // member `bar`, not the class. Without this the edge points at the
1251
+ // class and `createEdges` then mis-promotes the call to an
1252
+ // `instantiates` edge, so the static method shows zero callers and a
1253
+ // hollow impact radius. (#825)
1254
+ if (!imp.isNamespace && ref.referenceName.startsWith(imp.localName + '.')) {
1255
+ const memberNode = resolveStaticMember(targetNode, ref, imp.localName, context);
1256
+ if (memberNode) {
1257
+ return {
1258
+ original: ref,
1259
+ targetNodeId: memberNode.id,
1260
+ confidence: 0.9,
1261
+ resolvedBy: 'import',
1262
+ };
1263
+ }
1264
+ }
1019
1265
  return {
1020
1266
  original: ref,
1021
1267
  targetNodeId: targetNode.id,
@@ -1028,6 +1274,333 @@ function resolveViaImport(ref, context) {
1028
1274
  }
1029
1275
  return null;
1030
1276
  }
1277
+ /**
1278
+ * Resolve a Python qualified reference whose receiver is an imported MODULE:
1279
+ * `certs.where()` after `from . import certs`, `mod.func()` after `import mod`
1280
+ * or `from pkg import mod`. The receiver names a submodule (a file), not a
1281
+ * symbol, so the generic symbol lookup in `resolveViaImport` can't follow it —
1282
+ * it would search the *package* for `certs`/`mod` instead of looking inside the
1283
+ * module. This is the Python half of the cross-package qualified-call problem
1284
+ * (cf. `resolveGoCrossPackageReference` for Go's `pkg.Func`, issue #388).
1285
+ *
1286
+ * Builds the module's dotted import path from the binding — `from . import
1287
+ * certs` → `.certs`; `from pkg import mod` → `pkg.mod`; `import mod` → `mod` —
1288
+ * resolves it to the module file, and finds the member defined there. Returns
1289
+ * null when no module file exists at that path, so attribute access on an
1290
+ * imported *value* (`helper.attr` where `helper` is a function) falls through
1291
+ * to the other strategies untouched.
1292
+ */
1293
+ function resolvePythonModuleMember(ref, imports, context) {
1294
+ const dotIdx = ref.referenceName.indexOf('.');
1295
+ if (dotIdx <= 0)
1296
+ return null;
1297
+ const receiver = ref.referenceName.substring(0, dotIdx);
1298
+ // The immediate member of the module (first segment after the receiver).
1299
+ const member = ref.referenceName.substring(dotIdx + 1).split('.')[0];
1300
+ if (!member)
1301
+ return null;
1302
+ for (const imp of imports) {
1303
+ if (imp.localName !== receiver)
1304
+ continue;
1305
+ // `import mod` / `import numpy as np` bind the module at `source` itself;
1306
+ // `from . import certs` / `from pkg import mod` bind a SUBMODULE whose
1307
+ // dotted path is the source joined with the imported name.
1308
+ const modulePath = imp.isNamespace
1309
+ ? imp.source
1310
+ : imp.source.endsWith('.')
1311
+ ? imp.source + imp.localName
1312
+ : imp.source + '.' + imp.localName;
1313
+ // resolveImportPath only maps RELATIVE dotted paths (`.mod`, `..pkg.mod`); an
1314
+ // ABSOLUTE package path (`pkg.module` from `from pkg import module`, or a bare
1315
+ // `import pkg.mod`) resolves to null there, so fall back to the dotted-module
1316
+ // file lookup — the same asymmetry resolveModuleImportToFile already handles
1317
+ // for the file→file import edge. Without this, a `module.func()` call after
1318
+ // `from pkg import module` dropped its `calls` edge even though the import
1319
+ // edge resolved (#578).
1320
+ let resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1321
+ if (!resolvedPath) {
1322
+ resolvedPath = findPythonModuleFile(modulePath, context, ref.filePath)?.filePath ?? null;
1323
+ }
1324
+ if (!resolvedPath || resolvedPath === ref.filePath)
1325
+ continue;
1326
+ // Find the member as a top-level definition in the module file. Exclude
1327
+ // `method` so `mod.foo` never lands on a same-named class method.
1328
+ const target = context.getNodesInFile(resolvedPath).find((n) => n.name === member &&
1329
+ (n.kind === 'function' ||
1330
+ n.kind === 'class' ||
1331
+ n.kind === 'variable' ||
1332
+ n.kind === 'constant'));
1333
+ if (target) {
1334
+ return { original: ref, targetNodeId: target.id, confidence: 0.85, resolvedBy: 'import' };
1335
+ }
1336
+ }
1337
+ return null;
1338
+ }
1339
+ /**
1340
+ * Resolve a whole-MODULE import to that module's file (a file→file dependency).
1341
+ * The imported name is a module, not a symbol, so there's nothing to resolve to
1342
+ * — but importing a module IS a dependency on it. Covers:
1343
+ * - Python submodule imports — `from . import certs`, `from pkg import sub`;
1344
+ * - namespace imports — Python `import mod` / `import numpy as np`, and
1345
+ * TS/JS `import * as ns from './x'`.
1346
+ *
1347
+ * It is also the robust backstop for {@link resolvePythonModuleMember} and for
1348
+ * TS namespace usage: it records the dependency even when the used member is
1349
+ * re-exported elsewhere (requests' `certs.where`, re-exported from `certifi`),
1350
+ * the usage is module-level code that isn't extracted as a call, or a TS
1351
+ * namespace is touched only via a value-member read (`ns.SOME_CONST`).
1352
+ *
1353
+ * Only fires for dot-free `imports`-kind refs whose module path resolves to a
1354
+ * real file. A NAMED TS/JS import (`import { widget }`) is not a module, so it
1355
+ * returns null and normal symbol resolution handles it.
1356
+ */
1357
+ /**
1358
+ * Resolve a Lua/Luau `require(...)` to its module file. The reference name is
1359
+ * either a dotted module path (`telescope.config` → `telescope/config.lua`) or a
1360
+ * Roblox instance-path leaf (`Signal` from `require(script.Parent.Signal)` →
1361
+ * `Signal.luau`). We try `<path>.lua|.luau` and `<path>/init.lua|.luau`, matched
1362
+ * by path suffix (the module root — `lua/`, `src/`, … — is project-specific).
1363
+ * Among suffix matches, the one sharing the longest directory prefix with the
1364
+ * requiring file wins (instance-path requires resolve within the same package).
1365
+ */
1366
+ function resolveLuaRequire(ref, context) {
1367
+ const name = ref.referenceName;
1368
+ if (!name)
1369
+ return null;
1370
+ const base = name.includes('.') ? name.replace(/\./g, '/') : name;
1371
+ const suffixes = [`${base}.lua`, `${base}.luau`, `${base}/init.lua`, `${base}/init.luau`];
1372
+ const files = context.getAllFiles();
1373
+ const shared = (a, b) => {
1374
+ let i = 0;
1375
+ while (i < a.length && i < b.length && a[i] === b[i])
1376
+ i++;
1377
+ return i;
1378
+ };
1379
+ for (const suffix of suffixes) {
1380
+ const matches = files.filter((f) => f === suffix || f.endsWith('/' + suffix));
1381
+ if (matches.length === 0)
1382
+ continue;
1383
+ matches.sort((x, y) => shared(y, ref.filePath) - shared(x, ref.filePath));
1384
+ const best = matches[0];
1385
+ if (best === ref.filePath)
1386
+ continue;
1387
+ const fileNode = context.getNodesInFile(best).find((n) => n.kind === 'file');
1388
+ if (fileNode) {
1389
+ // Confidence ≥ 0.9 so this deterministic path/suffix match wins over
1390
+ // name-matching, which otherwise resolves the require to the import node
1391
+ // itself (a same-name self-match).
1392
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1393
+ }
1394
+ }
1395
+ return null;
1396
+ }
1397
+ function resolveModuleImportToFile(ref, imports, context) {
1398
+ if (ref.referenceKind !== 'imports')
1399
+ return null;
1400
+ if (ref.referenceName.includes('.'))
1401
+ return null;
1402
+ for (const imp of imports) {
1403
+ if (imp.localName !== ref.referenceName)
1404
+ continue;
1405
+ let modulePath;
1406
+ if (imp.isNamespace || imp.isDefault) {
1407
+ // `import * as ns from './x'` (namespace) or `import x from './x'`
1408
+ // (default) — the dependency is on the MODULE FILE. A default import binds
1409
+ // a (possibly renamed) local to whatever the module's default export is
1410
+ // (`import articlesController from './article.controller'` ← `export
1411
+ // default router`), so the binding name can't be found as a symbol — link
1412
+ // the file the import resolves to instead. External modules don't resolve
1413
+ // (no file), so `import React from 'react'` creates no edge.
1414
+ modulePath = imp.source;
1415
+ }
1416
+ else if (ref.language === 'python') {
1417
+ // `from . import certs` — the imported NAME is a submodule of the source.
1418
+ modulePath = imp.source.endsWith('.')
1419
+ ? imp.source + imp.localName
1420
+ : imp.source + '.' + imp.localName;
1421
+ }
1422
+ else {
1423
+ // A named TS/JS import binds a symbol, not a module — leave it alone.
1424
+ continue;
1425
+ }
1426
+ const resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1427
+ if (resolvedPath && resolvedPath !== ref.filePath) {
1428
+ const fileNode = context.getNodesInFile(resolvedPath).find((n) => n.kind === 'file');
1429
+ if (fileNode) {
1430
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1431
+ }
1432
+ }
1433
+ // Python absolute `from a.b import submodule` (a FastAPI router aggregator's
1434
+ // `from app.api.routes import authentication`): resolveImportPath only maps
1435
+ // RELATIVE dotted paths to a file, so resolve the absolute dotted module
1436
+ // directly to its file node.
1437
+ if (ref.language === 'python') {
1438
+ const modFile = findPythonModuleFile(modulePath, context, ref.filePath);
1439
+ if (modFile) {
1440
+ return { original: ref, targetNodeId: modFile.id, confidence: 0.9, resolvedBy: 'import' };
1441
+ }
1442
+ }
1443
+ }
1444
+ return null;
1445
+ }
1446
+ /**
1447
+ * Find the file node for a Python dotted module path `a.b.c` — a module file
1448
+ * ending in `a/b/c.py`, or a package `a/b/c/__init__.py` (suffix-matched, so a
1449
+ * package rooted under `src/` etc. still resolves). Returns null for
1450
+ * stdlib/external modules (no matching repo file node), so `import os` creates
1451
+ * no edge. Shared by absolute `import a.b.c` and absolute `from a.b import c`
1452
+ * (where `c` is a submodule) resolution.
1453
+ */
1454
+ function findPythonModuleFile(mod, context, excludeFilePath) {
1455
+ if (!mod || mod.startsWith('.'))
1456
+ return null; // relative imports handled elsewhere
1457
+ const rel = mod.replace(/\./g, '/');
1458
+ const lastSeg = mod.split('.').pop();
1459
+ const endsWith = (p, want) => p === want || p.endsWith('/' + want);
1460
+ const moduleFile = context
1461
+ .getNodesByName(`${lastSeg}.py`)
1462
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}.py`));
1463
+ if (moduleFile)
1464
+ return moduleFile;
1465
+ const pkgFile = context
1466
+ .getNodesByName('__init__.py')
1467
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}/__init__.py`));
1468
+ return pkgFile ?? null;
1469
+ }
1470
+ /**
1471
+ * Resolve a Python ABSOLUTE dotted module import (`import a.b.c`) to its file —
1472
+ * the Django `AppConfig.ready(): import myapp.signals` pattern and any
1473
+ * side-effect module import.
1474
+ */
1475
+ function resolvePythonAbsoluteModule(ref, context) {
1476
+ if (ref.referenceKind !== 'imports')
1477
+ return null;
1478
+ // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1479
+ // (`from app.api.routes import authentication`) is ambiguous on its own — three
1480
+ // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1481
+ // which uses the import's source (`app.api.routes`) to build the full path.
1482
+ if (!ref.referenceName.includes('.'))
1483
+ return null;
1484
+ const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1485
+ return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1486
+ }
1487
+ /**
1488
+ * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix
1489
+ * (`A::B`) to a file and finding the leaf symbol (`C`) in it. This is the Rust
1490
+ * analog of {@link resolvePythonModuleMember} / {@link resolveGoCrossPackageReference}
1491
+ * and the precise answer to common-name re-exports (`pub use self::read::read`)
1492
+ * that name-matching can't disambiguate. Returns null when the prefix isn't a
1493
+ * real module path (e.g. `Widget::new` — `Widget` is a struct, not a module),
1494
+ * so associated-function calls and enum-variant paths fall through untouched.
1495
+ */
1496
+ function resolveRustPathReference(ref, context) {
1497
+ const segments = ref.referenceName.split('::').filter((s) => s.length > 0);
1498
+ if (segments.length < 2)
1499
+ return null;
1500
+ const leaf = segments[segments.length - 1];
1501
+ const modSegs = segments.slice(0, -1);
1502
+ const file = resolveRustModuleFile(modSegs, ref.filePath, context);
1503
+ if (!file || file === ref.filePath)
1504
+ return null;
1505
+ const target = context.getNodesInFile(file).find((n) => n.name === leaf &&
1506
+ (n.kind === 'function' ||
1507
+ n.kind === 'struct' ||
1508
+ n.kind === 'enum' ||
1509
+ n.kind === 'trait' ||
1510
+ n.kind === 'type_alias' ||
1511
+ n.kind === 'constant' ||
1512
+ n.kind === 'method' ||
1513
+ n.kind === 'class' ||
1514
+ n.kind === 'interface'));
1515
+ if (target) {
1516
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1517
+ }
1518
+ return null;
1519
+ }
1520
+ /** The crate-root directory (holds `lib.rs`/`main.rs`), walking up from a file. */
1521
+ function rustCrateRootDir(fromFileAbs, context) {
1522
+ const projectRoot = context.getProjectRoot();
1523
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1524
+ let dir = path.dirname(fromFileAbs);
1525
+ for (let i = 0; i < 64; i++) {
1526
+ if (context.fileExists(toRel(path.join(dir, 'lib.rs'))) ||
1527
+ context.fileExists(toRel(path.join(dir, 'main.rs')))) {
1528
+ return dir;
1529
+ }
1530
+ const parent = path.dirname(dir);
1531
+ if (parent === dir)
1532
+ return null;
1533
+ dir = parent;
1534
+ }
1535
+ return null;
1536
+ }
1537
+ /** Directory under which the current file's module declares its SUBMODULES. */
1538
+ function rustSelfModuleDir(fromFileAbs) {
1539
+ const base = path.basename(fromFileAbs);
1540
+ const dir = path.dirname(fromFileAbs);
1541
+ // mod.rs / lib.rs / main.rs own their directory; `foo.rs`'s submodules live in `foo/`.
1542
+ if (base === 'mod.rs' || base === 'lib.rs' || base === 'main.rs')
1543
+ return dir;
1544
+ return path.join(dir, base.replace(/\.rs$/, ''));
1545
+ }
1546
+ /**
1547
+ * Resolve a Rust module path (segments WITHOUT the leaf symbol) to the file of
1548
+ * the last module segment — `crate::a::b` → `<crate>/a/b.rs` (or `.../b/mod.rs`).
1549
+ * Anchors on `crate` / `self` / `super`; a bare path is tried crate-relative.
1550
+ */
1551
+ function resolveRustModuleFile(segments, fromFile, context) {
1552
+ if (segments.length === 0)
1553
+ return null;
1554
+ const projectRoot = context.getProjectRoot();
1555
+ const fromAbs = path.join(projectRoot, fromFile);
1556
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1557
+ // Walk a sequence of module segments down from `startDir`, mapping each to a
1558
+ // `<seg>.rs` or `<seg>/mod.rs` file. Returns the leaf module's file, or null
1559
+ // if `startDir` is null or any segment has no file on disk.
1560
+ const resolveUnder = (startDir, rest) => {
1561
+ if (!startDir)
1562
+ return null;
1563
+ let dir = startDir;
1564
+ let targetFile = null;
1565
+ for (const seg of rest) {
1566
+ if (seg === 'self' || seg === 'crate' || seg === 'super')
1567
+ continue;
1568
+ const asFile = toRel(path.join(dir, seg + '.rs'));
1569
+ const asMod = toRel(path.join(dir, seg, 'mod.rs'));
1570
+ if (context.fileExists(asFile))
1571
+ targetFile = asFile;
1572
+ else if (context.fileExists(asMod))
1573
+ targetFile = asMod;
1574
+ else
1575
+ return null;
1576
+ dir = path.join(dir, seg);
1577
+ }
1578
+ return targetFile;
1579
+ };
1580
+ const first = segments[0];
1581
+ if (first === 'crate') {
1582
+ return resolveUnder(rustCrateRootDir(fromAbs, context), segments.slice(1));
1583
+ }
1584
+ if (first === 'self') {
1585
+ return resolveUnder(rustSelfModuleDir(fromAbs), segments.slice(1));
1586
+ }
1587
+ if (first === 'super') {
1588
+ let supers = 0;
1589
+ while (segments[supers] === 'super')
1590
+ supers++;
1591
+ let dir = rustSelfModuleDir(fromAbs);
1592
+ for (let s = 0; s < supers && dir; s++)
1593
+ dir = path.dirname(dir);
1594
+ return resolveUnder(dir, segments.slice(supers));
1595
+ }
1596
+ // Bare path. In expression position (`submodule::item()` — the router-assembly
1597
+ // and general cross-module-call pattern) the prefix is a SUBMODULE of the
1598
+ // current module, i.e. 2018 `self::`-relative — so try self-relative FIRST.
1599
+ // Fall back to crate-relative for 2015-edition / crate-root items. External
1600
+ // crate paths (`serde::de::Error`) miss both and fall through to name-matching.
1601
+ return (resolveUnder(rustSelfModuleDir(fromAbs), segments) ??
1602
+ resolveUnder(rustCrateRootDir(fromAbs, context), segments));
1603
+ }
1031
1604
  /**
1032
1605
  * Resolve a Java/Kotlin reference whose receiver is the simple name of
1033
1606
  * an imported FQN: `Foo.bar(...)` where `import com.example.Foo;`. The
@@ -1177,7 +1750,14 @@ function findExportedSymbol(filePath, want, language, context, visited, depth =
1177
1750
  const nodesInFile = context.getNodesInFile(filePath);
1178
1751
  // 1. Direct hit: the symbol is declared in this file.
1179
1752
  if (want.isDefault) {
1180
- const direct = nodesInFile.find((n) => n.isExported && (n.kind === 'function' || n.kind === 'class'));
1753
+ // Svelte/Vue single-file components ARE the module's default export,
1754
+ // but are extracted as kind 'component' (not function/class). Prefer
1755
+ // the component node; fall back to an exported function/class for the
1756
+ // `.ts`/`.tsx` `export default fn`/`class` case. Without the component
1757
+ // branch, an `export { default as X } from './X.svelte'` barrel never
1758
+ // resolves and the component shows a false 0 callers (#629).
1759
+ const direct = nodesInFile.find((n) => n.isExported && n.kind === 'component') ??
1760
+ nodesInFile.find((n) => n.isExported && (n.kind === 'function' || n.kind === 'class'));
1181
1761
  if (direct)
1182
1762
  return direct;
1183
1763
  }
@@ -1228,4 +1808,42 @@ function findExportedSymbol(filePath, want, language, context, visited, depth =
1228
1808
  }
1229
1809
  return undefined;
1230
1810
  }
1811
+ /** Node kinds that own static members reachable as `Container.member`. */
1812
+ const STATIC_MEMBER_CONTAINERS = new Set([
1813
+ 'class', 'struct', 'interface', 'enum', 'trait', 'protocol',
1814
+ ]);
1815
+ /**
1816
+ * Resolve `Container.member` — a static method/property access on a NAMED class
1817
+ * import (`import { Foo } …; Foo.bar()`) — to the member node, given the
1818
+ * already-resolved container class.
1819
+ *
1820
+ * Members carry a `Container::member` qualifiedName, so we look up
1821
+ * `${container.qualifiedName}::${member}` within the container's own file (the
1822
+ * file filter disambiguates same-named classes in other modules). Returns
1823
+ * undefined when the container isn't a member-owning kind or the member isn't
1824
+ * found, so the caller falls back to the container itself (prior behavior) —
1825
+ * languages whose members aren't `::`-qualified, and genuine class references,
1826
+ * are unaffected. See #825.
1827
+ */
1828
+ function resolveStaticMember(container, ref, localName, context) {
1829
+ if (!STATIC_MEMBER_CONTAINERS.has(container.kind))
1830
+ return undefined;
1831
+ // First segment after the receiver: `Foo.bar.baz` → `bar`.
1832
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
1833
+ if (!member)
1834
+ return undefined;
1835
+ const candidates = context
1836
+ .getNodesByQualifiedName(`${container.qualifiedName}::${member}`)
1837
+ .filter((n) => n.filePath === container.filePath);
1838
+ if (candidates.length === 0)
1839
+ return undefined;
1840
+ // When the reference is a call, prefer a callable member if several nodes
1841
+ // share the qualifiedName (e.g. a static property and a method).
1842
+ if (ref.referenceKind === 'calls') {
1843
+ const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function');
1844
+ if (callable)
1845
+ return callable;
1846
+ }
1847
+ return candidates[0];
1848
+ }
1231
1849
  //# sourceMappingURL=import-resolver.js.map