codegraph-java 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (866) hide show
  1. package/README.md +131 -0
  2. package/dist/base-graph/index.d.ts +57 -0
  3. package/dist/base-graph/index.d.ts.map +1 -0
  4. package/dist/base-graph/index.js +175 -0
  5. package/dist/base-graph/index.js.map +1 -0
  6. package/dist/bin/codegraph.d.ts +28 -0
  7. package/dist/bin/codegraph.d.ts.map +1 -0
  8. package/dist/bin/codegraph.js +2615 -0
  9. package/dist/bin/codegraph.js.map +1 -0
  10. package/dist/bin/command-supervision.d.ts +49 -0
  11. package/dist/bin/command-supervision.d.ts.map +1 -0
  12. package/dist/bin/command-supervision.js +95 -0
  13. package/dist/bin/command-supervision.js.map +1 -0
  14. package/dist/bin/fatal-handler.d.ts +20 -0
  15. package/dist/bin/fatal-handler.d.ts.map +1 -0
  16. package/dist/bin/fatal-handler.js +118 -0
  17. package/dist/bin/fatal-handler.js.map +1 -0
  18. package/dist/bin/node-version-check.d.ts +45 -0
  19. package/dist/bin/node-version-check.d.ts.map +1 -0
  20. package/dist/bin/node-version-check.js +98 -0
  21. package/dist/bin/node-version-check.js.map +1 -0
  22. package/dist/bin/uninstall.d.ts +14 -0
  23. package/dist/bin/uninstall.d.ts.map +1 -0
  24. package/dist/bin/uninstall.js +36 -0
  25. package/dist/bin/uninstall.js.map +1 -0
  26. package/dist/context/formatter.d.ts +36 -0
  27. package/dist/context/formatter.d.ts.map +1 -0
  28. package/dist/context/formatter.js +269 -0
  29. package/dist/context/formatter.js.map +1 -0
  30. package/dist/context/index.d.ts +131 -0
  31. package/dist/context/index.d.ts.map +1 -0
  32. package/dist/context/index.js +1378 -0
  33. package/dist/context/index.js.map +1 -0
  34. package/dist/context/markers.d.ts +19 -0
  35. package/dist/context/markers.d.ts.map +1 -0
  36. package/dist/context/markers.js +22 -0
  37. package/dist/context/markers.js.map +1 -0
  38. package/dist/db/index.d.ts +380 -0
  39. package/dist/db/index.d.ts.map +1 -0
  40. package/dist/db/index.js +854 -0
  41. package/dist/db/index.js.map +1 -0
  42. package/dist/db/migrations.d.ts +44 -0
  43. package/dist/db/migrations.d.ts.map +1 -0
  44. package/dist/db/migrations.js +255 -0
  45. package/dist/db/migrations.js.map +1 -0
  46. package/dist/db/queries.d.ts +1060 -0
  47. package/dist/db/queries.d.ts.map +1 -0
  48. package/dist/db/queries.js +3191 -0
  49. package/dist/db/queries.js.map +1 -0
  50. package/dist/db/schema.sql +209 -0
  51. package/dist/db/sqlite-adapter.d.ts +55 -0
  52. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  53. package/dist/db/sqlite-adapter.js +135 -0
  54. package/dist/db/sqlite-adapter.js.map +1 -0
  55. package/dist/db/wal-valve.d.ts +119 -0
  56. package/dist/db/wal-valve.d.ts.map +1 -0
  57. package/dist/db/wal-valve.js +290 -0
  58. package/dist/db/wal-valve.js.map +1 -0
  59. package/dist/directory.d.ts +213 -0
  60. package/dist/directory.d.ts.map +1 -0
  61. package/dist/directory.js +781 -0
  62. package/dist/directory.js.map +1 -0
  63. package/dist/errors.d.ts +150 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +234 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/extraction/extraction-version.d.ts +25 -0
  68. package/dist/extraction/extraction-version.d.ts.map +1 -0
  69. package/dist/extraction/extraction-version.js +28 -0
  70. package/dist/extraction/extraction-version.js.map +1 -0
  71. package/dist/extraction/function-ref.d.ts +118 -0
  72. package/dist/extraction/function-ref.d.ts.map +1 -0
  73. package/dist/extraction/function-ref.js +746 -0
  74. package/dist/extraction/function-ref.js.map +1 -0
  75. package/dist/extraction/generated-detection.d.ts +66 -0
  76. package/dist/extraction/generated-detection.d.ts.map +1 -0
  77. package/dist/extraction/generated-detection.js +248 -0
  78. package/dist/extraction/generated-detection.js.map +1 -0
  79. package/dist/extraction/grammars.d.ts +148 -0
  80. package/dist/extraction/grammars.d.ts.map +1 -0
  81. package/dist/extraction/grammars.js +558 -0
  82. package/dist/extraction/grammars.js.map +1 -0
  83. package/dist/extraction/index.d.ts +367 -0
  84. package/dist/extraction/index.d.ts.map +1 -0
  85. package/dist/extraction/index.js +2833 -0
  86. package/dist/extraction/index.js.map +1 -0
  87. package/dist/extraction/kernel/decode.d.ts +9 -0
  88. package/dist/extraction/kernel/decode.d.ts.map +1 -0
  89. package/dist/extraction/kernel/decode.js +162 -0
  90. package/dist/extraction/kernel/decode.js.map +1 -0
  91. package/dist/extraction/kernel/index.d.ts +64 -0
  92. package/dist/extraction/kernel/index.d.ts.map +1 -0
  93. package/dist/extraction/kernel/index.js +204 -0
  94. package/dist/extraction/kernel/index.js.map +1 -0
  95. package/dist/extraction/kernel/layout.d.ts +101 -0
  96. package/dist/extraction/kernel/layout.d.ts.map +1 -0
  97. package/dist/extraction/kernel/layout.js +104 -0
  98. package/dist/extraction/kernel/layout.js.map +1 -0
  99. package/dist/extraction/kernel/loader.d.ts +103 -0
  100. package/dist/extraction/kernel/loader.d.ts.map +1 -0
  101. package/dist/extraction/kernel/loader.js +146 -0
  102. package/dist/extraction/kernel/loader.js.map +1 -0
  103. package/dist/extraction/languages/c-cpp.d.ts +124 -0
  104. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  105. package/dist/extraction/languages/c-cpp.js +1689 -0
  106. package/dist/extraction/languages/c-cpp.js.map +1 -0
  107. package/dist/extraction/languages/index.d.ts +11 -0
  108. package/dist/extraction/languages/index.d.ts.map +1 -0
  109. package/dist/extraction/languages/index.js +15 -0
  110. package/dist/extraction/languages/index.js.map +1 -0
  111. package/dist/extraction/languages/java.d.ts +3 -0
  112. package/dist/extraction/languages/java.d.ts.map +1 -0
  113. package/dist/extraction/languages/java.js +315 -0
  114. package/dist/extraction/languages/java.js.map +1 -0
  115. package/dist/extraction/languages/rust.d.ts +23 -0
  116. package/dist/extraction/languages/rust.d.ts.map +1 -0
  117. package/dist/extraction/languages/rust.js +169 -0
  118. package/dist/extraction/languages/rust.js.map +1 -0
  119. package/dist/extraction/parse-pool.d.ts +167 -0
  120. package/dist/extraction/parse-pool.d.ts.map +1 -0
  121. package/dist/extraction/parse-pool.js +421 -0
  122. package/dist/extraction/parse-pool.js.map +1 -0
  123. package/dist/extraction/parse-worker.d.ts +8 -0
  124. package/dist/extraction/parse-worker.d.ts.map +1 -0
  125. package/dist/extraction/parse-worker.js +138 -0
  126. package/dist/extraction/parse-worker.js.map +1 -0
  127. package/dist/extraction/store-worker.d.ts +24 -0
  128. package/dist/extraction/store-worker.d.ts.map +1 -0
  129. package/dist/extraction/store-worker.js +139 -0
  130. package/dist/extraction/store-worker.js.map +1 -0
  131. package/dist/extraction/store-writer.d.ts +63 -0
  132. package/dist/extraction/store-writer.d.ts.map +1 -0
  133. package/dist/extraction/store-writer.js +174 -0
  134. package/dist/extraction/store-writer.js.map +1 -0
  135. package/dist/extraction/syntax-tokens.d.ts +103 -0
  136. package/dist/extraction/syntax-tokens.d.ts.map +1 -0
  137. package/dist/extraction/syntax-tokens.js +381 -0
  138. package/dist/extraction/syntax-tokens.js.map +1 -0
  139. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  140. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  141. package/dist/extraction/tree-sitter-helpers.js +153 -0
  142. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  143. package/dist/extraction/tree-sitter-types.d.ts +260 -0
  144. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  145. package/dist/extraction/tree-sitter-types.js +10 -0
  146. package/dist/extraction/tree-sitter-types.js.map +1 -0
  147. package/dist/extraction/tree-sitter.d.ts +745 -0
  148. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  149. package/dist/extraction/tree-sitter.js +6725 -0
  150. package/dist/extraction/tree-sitter.js.map +1 -0
  151. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  152. package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  153. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  154. package/dist/extraction/wasm-runtime-flags.js +130 -0
  155. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  156. package/dist/graph/branch-guards.d.ts +248 -0
  157. package/dist/graph/branch-guards.d.ts.map +1 -0
  158. package/dist/graph/branch-guards.js +2231 -0
  159. package/dist/graph/branch-guards.js.map +1 -0
  160. package/dist/graph/dead-code.d.ts +251 -0
  161. package/dist/graph/dead-code.d.ts.map +1 -0
  162. package/dist/graph/dead-code.js +756 -0
  163. package/dist/graph/dead-code.js.map +1 -0
  164. package/dist/graph/dynamic-boundary-report.d.ts +121 -0
  165. package/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  166. package/dist/graph/dynamic-boundary-report.js +283 -0
  167. package/dist/graph/dynamic-boundary-report.js.map +1 -0
  168. package/dist/graph/index.d.ts +12 -0
  169. package/dist/graph/index.d.ts.map +1 -0
  170. package/dist/graph/index.js +28 -0
  171. package/dist/graph/index.js.map +1 -0
  172. package/dist/graph/named-symbol-flow.d.ts +153 -0
  173. package/dist/graph/named-symbol-flow.d.ts.map +1 -0
  174. package/dist/graph/named-symbol-flow.js +609 -0
  175. package/dist/graph/named-symbol-flow.js.map +1 -0
  176. package/dist/graph/queries.d.ts +106 -0
  177. package/dist/graph/queries.d.ts.map +1 -0
  178. package/dist/graph/queries.js +341 -0
  179. package/dist/graph/queries.js.map +1 -0
  180. package/dist/graph/traversal.d.ts +127 -0
  181. package/dist/graph/traversal.d.ts.map +1 -0
  182. package/dist/graph/traversal.js +599 -0
  183. package/dist/graph/traversal.js.map +1 -0
  184. package/dist/graph/type-hierarchy.d.ts +155 -0
  185. package/dist/graph/type-hierarchy.d.ts.map +1 -0
  186. package/dist/graph/type-hierarchy.js +382 -0
  187. package/dist/graph/type-hierarchy.js.map +1 -0
  188. package/dist/index.d.ts +886 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +2019 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/installer/beta-signup.d.ts +54 -0
  193. package/dist/installer/beta-signup.d.ts.map +1 -0
  194. package/dist/installer/beta-signup.js +178 -0
  195. package/dist/installer/beta-signup.js.map +1 -0
  196. package/dist/installer/config-writer.d.ts +28 -0
  197. package/dist/installer/config-writer.d.ts.map +1 -0
  198. package/dist/installer/config-writer.js +91 -0
  199. package/dist/installer/config-writer.js.map +1 -0
  200. package/dist/installer/index.d.ts +143 -0
  201. package/dist/installer/index.d.ts.map +1 -0
  202. package/dist/installer/index.js +632 -0
  203. package/dist/installer/index.js.map +1 -0
  204. package/dist/installer/instructions-template.d.ts +41 -0
  205. package/dist/installer/instructions-template.d.ts.map +1 -0
  206. package/dist/installer/instructions-template.js +53 -0
  207. package/dist/installer/instructions-template.js.map +1 -0
  208. package/dist/installer/targets/antigravity.d.ts +57 -0
  209. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  210. package/dist/installer/targets/antigravity.js +308 -0
  211. package/dist/installer/targets/antigravity.js.map +1 -0
  212. package/dist/installer/targets/claude.d.ts +62 -0
  213. package/dist/installer/targets/claude.d.ts.map +1 -0
  214. package/dist/installer/targets/claude.js +486 -0
  215. package/dist/installer/targets/claude.js.map +1 -0
  216. package/dist/installer/targets/codex.d.ts +32 -0
  217. package/dist/installer/targets/codex.d.ts.map +1 -0
  218. package/dist/installer/targets/codex.js +202 -0
  219. package/dist/installer/targets/codex.js.map +1 -0
  220. package/dist/installer/targets/copilot-cli.d.ts +32 -0
  221. package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  222. package/dist/installer/targets/copilot-cli.js +209 -0
  223. package/dist/installer/targets/copilot-cli.js.map +1 -0
  224. package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  225. package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  226. package/dist/installer/targets/copilot-jetbrains.js +238 -0
  227. package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  228. package/dist/installer/targets/copilot-vscode.d.ts +47 -0
  229. package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  230. package/dist/installer/targets/copilot-vscode.js +219 -0
  231. package/dist/installer/targets/copilot-vscode.js.map +1 -0
  232. package/dist/installer/targets/cursor.d.ts +35 -0
  233. package/dist/installer/targets/cursor.d.ts.map +1 -0
  234. package/dist/installer/targets/cursor.js +254 -0
  235. package/dist/installer/targets/cursor.js.map +1 -0
  236. package/dist/installer/targets/gemini.d.ts +26 -0
  237. package/dist/installer/targets/gemini.d.ts.map +1 -0
  238. package/dist/installer/targets/gemini.js +165 -0
  239. package/dist/installer/targets/gemini.js.map +1 -0
  240. package/dist/installer/targets/hermes.d.ts +18 -0
  241. package/dist/installer/targets/hermes.d.ts.map +1 -0
  242. package/dist/installer/targets/hermes.js +359 -0
  243. package/dist/installer/targets/hermes.js.map +1 -0
  244. package/dist/installer/targets/kiro.d.ts +27 -0
  245. package/dist/installer/targets/kiro.d.ts.map +1 -0
  246. package/dist/installer/targets/kiro.js +178 -0
  247. package/dist/installer/targets/kiro.js.map +1 -0
  248. package/dist/installer/targets/opencode.d.ts +38 -0
  249. package/dist/installer/targets/opencode.d.ts.map +1 -0
  250. package/dist/installer/targets/opencode.js +288 -0
  251. package/dist/installer/targets/opencode.js.map +1 -0
  252. package/dist/installer/targets/registry.d.ts +35 -0
  253. package/dist/installer/targets/registry.d.ts.map +1 -0
  254. package/dist/installer/targets/registry.js +101 -0
  255. package/dist/installer/targets/registry.js.map +1 -0
  256. package/dist/installer/targets/shared.d.ts +101 -0
  257. package/dist/installer/targets/shared.d.ts.map +1 -0
  258. package/dist/installer/targets/shared.js +264 -0
  259. package/dist/installer/targets/shared.js.map +1 -0
  260. package/dist/installer/targets/toml.d.ts +53 -0
  261. package/dist/installer/targets/toml.d.ts.map +1 -0
  262. package/dist/installer/targets/toml.js +226 -0
  263. package/dist/installer/targets/toml.js.map +1 -0
  264. package/dist/installer/targets/trae.d.ts +30 -0
  265. package/dist/installer/targets/trae.d.ts.map +1 -0
  266. package/dist/installer/targets/trae.js +164 -0
  267. package/dist/installer/targets/trae.js.map +1 -0
  268. package/dist/installer/targets/types.d.ts +108 -0
  269. package/dist/installer/targets/types.d.ts.map +1 -0
  270. package/dist/installer/targets/types.js +16 -0
  271. package/dist/installer/targets/types.js.map +1 -0
  272. package/dist/installer/targets/workbuddy.d.ts +29 -0
  273. package/dist/installer/targets/workbuddy.d.ts.map +1 -0
  274. package/dist/installer/targets/workbuddy.js +163 -0
  275. package/dist/installer/targets/workbuddy.js.map +1 -0
  276. package/dist/mcp/daemon-manager.d.ts +42 -0
  277. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  278. package/dist/mcp/daemon-manager.js +129 -0
  279. package/dist/mcp/daemon-manager.js.map +1 -0
  280. package/dist/mcp/daemon-paths.d.ts +79 -0
  281. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  282. package/dist/mcp/daemon-paths.js +219 -0
  283. package/dist/mcp/daemon-paths.js.map +1 -0
  284. package/dist/mcp/daemon-registry.d.ts +57 -0
  285. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  286. package/dist/mcp/daemon-registry.js +281 -0
  287. package/dist/mcp/daemon-registry.js.map +1 -0
  288. package/dist/mcp/daemon.d.ts +293 -0
  289. package/dist/mcp/daemon.d.ts.map +1 -0
  290. package/dist/mcp/daemon.js +864 -0
  291. package/dist/mcp/daemon.js.map +1 -0
  292. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  293. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  294. package/dist/mcp/dynamic-boundaries.js +360 -0
  295. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  296. package/dist/mcp/early-ppid.d.ts +26 -0
  297. package/dist/mcp/early-ppid.d.ts.map +1 -0
  298. package/dist/mcp/early-ppid.js +29 -0
  299. package/dist/mcp/early-ppid.js.map +1 -0
  300. package/dist/mcp/engine.d.ts +125 -0
  301. package/dist/mcp/engine.d.ts.map +1 -0
  302. package/dist/mcp/engine.js +392 -0
  303. package/dist/mcp/engine.js.map +1 -0
  304. package/dist/mcp/explore-dedup.d.ts +137 -0
  305. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  306. package/dist/mcp/explore-dedup.js +236 -0
  307. package/dist/mcp/explore-dedup.js.map +1 -0
  308. package/dist/mcp/explore-diagnostics.d.ts +289 -0
  309. package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  310. package/dist/mcp/explore-diagnostics.js +558 -0
  311. package/dist/mcp/explore-diagnostics.js.map +1 -0
  312. package/dist/mcp/explore-session-state.d.ts +217 -0
  313. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  314. package/dist/mcp/explore-session-state.js +322 -0
  315. package/dist/mcp/explore-session-state.js.map +1 -0
  316. package/dist/mcp/index.d.ts +137 -0
  317. package/dist/mcp/index.d.ts.map +1 -0
  318. package/dist/mcp/index.js +567 -0
  319. package/dist/mcp/index.js.map +1 -0
  320. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  321. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  322. package/dist/mcp/liveness-watchdog.js +269 -0
  323. package/dist/mcp/liveness-watchdog.js.map +1 -0
  324. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  325. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  326. package/dist/mcp/ppid-watchdog.js +64 -0
  327. package/dist/mcp/ppid-watchdog.js.map +1 -0
  328. package/dist/mcp/proxy.d.ts +87 -0
  329. package/dist/mcp/proxy.d.ts.map +1 -0
  330. package/dist/mcp/proxy.js +672 -0
  331. package/dist/mcp/proxy.js.map +1 -0
  332. package/dist/mcp/query-pool.d.ts +108 -0
  333. package/dist/mcp/query-pool.d.ts.map +1 -0
  334. package/dist/mcp/query-pool.js +315 -0
  335. package/dist/mcp/query-pool.js.map +1 -0
  336. package/dist/mcp/query-worker.d.ts +24 -0
  337. package/dist/mcp/query-worker.d.ts.map +1 -0
  338. package/dist/mcp/query-worker.js +87 -0
  339. package/dist/mcp/query-worker.js.map +1 -0
  340. package/dist/mcp/server-instructions.d.ts +34 -0
  341. package/dist/mcp/server-instructions.d.ts.map +1 -0
  342. package/dist/mcp/server-instructions.js +111 -0
  343. package/dist/mcp/server-instructions.js.map +1 -0
  344. package/dist/mcp/session.d.ts +109 -0
  345. package/dist/mcp/session.d.ts.map +1 -0
  346. package/dist/mcp/session.js +380 -0
  347. package/dist/mcp/session.js.map +1 -0
  348. package/dist/mcp/startup-handshake.d.ts +44 -0
  349. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  350. package/dist/mcp/startup-handshake.js +73 -0
  351. package/dist/mcp/startup-handshake.js.map +1 -0
  352. package/dist/mcp/stdin-teardown.d.ts +27 -0
  353. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  354. package/dist/mcp/stdin-teardown.js +49 -0
  355. package/dist/mcp/stdin-teardown.js.map +1 -0
  356. package/dist/mcp/tools.d.ts +877 -0
  357. package/dist/mcp/tools.d.ts.map +1 -0
  358. package/dist/mcp/tools.js +6371 -0
  359. package/dist/mcp/tools.js.map +1 -0
  360. package/dist/mcp/transport.d.ts +188 -0
  361. package/dist/mcp/transport.d.ts.map +1 -0
  362. package/dist/mcp/transport.js +377 -0
  363. package/dist/mcp/transport.js.map +1 -0
  364. package/dist/mcp/version.d.ts +19 -0
  365. package/dist/mcp/version.d.ts.map +1 -0
  366. package/dist/mcp/version.js +71 -0
  367. package/dist/mcp/version.js.map +1 -0
  368. package/dist/project-config.d.ts +158 -0
  369. package/dist/project-config.d.ts.map +1 -0
  370. package/dist/project-config.js +489 -0
  371. package/dist/project-config.js.map +1 -0
  372. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  373. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  374. package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
  375. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  376. package/dist/resolution/callback-synthesizer.d.ts +59 -0
  377. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  378. package/dist/resolution/callback-synthesizer.js +4066 -0
  379. package/dist/resolution/callback-synthesizer.js.map +1 -0
  380. package/dist/resolution/cooperative-yield.d.ts +40 -0
  381. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  382. package/dist/resolution/cooperative-yield.js +44 -0
  383. package/dist/resolution/cooperative-yield.js.map +1 -0
  384. package/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  385. package/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  386. package/dist/resolution/expo-router-synthesizer.js +189 -0
  387. package/dist/resolution/expo-router-synthesizer.js.map +1 -0
  388. package/dist/resolution/frameworks/astro.d.ts +9 -0
  389. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  390. package/dist/resolution/frameworks/astro.js +169 -0
  391. package/dist/resolution/frameworks/astro.js.map +1 -0
  392. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  393. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  394. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  395. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  396. package/dist/resolution/frameworks/cics.d.ts +20 -0
  397. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  398. package/dist/resolution/frameworks/cics.js +90 -0
  399. package/dist/resolution/frameworks/cics.js.map +1 -0
  400. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  401. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  402. package/dist/resolution/frameworks/csharp.js +335 -0
  403. package/dist/resolution/frameworks/csharp.js.map +1 -0
  404. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  405. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  406. package/dist/resolution/frameworks/drupal.js +367 -0
  407. package/dist/resolution/frameworks/drupal.js.map +1 -0
  408. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  409. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  410. package/dist/resolution/frameworks/expo-modules.js +148 -0
  411. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  412. package/dist/resolution/frameworks/expo-router.d.ts +189 -0
  413. package/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  414. package/dist/resolution/frameworks/expo-router.js +785 -0
  415. package/dist/resolution/frameworks/expo-router.js.map +1 -0
  416. package/dist/resolution/frameworks/express.d.ts +8 -0
  417. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  418. package/dist/resolution/frameworks/express.js +540 -0
  419. package/dist/resolution/frameworks/express.js.map +1 -0
  420. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  421. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  422. package/dist/resolution/frameworks/fabric.js +354 -0
  423. package/dist/resolution/frameworks/fabric.js.map +1 -0
  424. package/dist/resolution/frameworks/go.d.ts +8 -0
  425. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  426. package/dist/resolution/frameworks/go.js +184 -0
  427. package/dist/resolution/frameworks/go.js.map +1 -0
  428. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  429. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  430. package/dist/resolution/frameworks/goframe.js +112 -0
  431. package/dist/resolution/frameworks/goframe.js.map +1 -0
  432. package/dist/resolution/frameworks/index.d.ts +30 -0
  433. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  434. package/dist/resolution/frameworks/index.js +72 -0
  435. package/dist/resolution/frameworks/index.js.map +1 -0
  436. package/dist/resolution/frameworks/java.d.ts +8 -0
  437. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  438. package/dist/resolution/frameworks/java.js +517 -0
  439. package/dist/resolution/frameworks/java.js.map +1 -0
  440. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  441. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  442. package/dist/resolution/frameworks/laravel.js +257 -0
  443. package/dist/resolution/frameworks/laravel.js.map +1 -0
  444. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  445. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  446. package/dist/resolution/frameworks/nestjs.js +690 -0
  447. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  448. package/dist/resolution/frameworks/nextjs.d.ts +76 -0
  449. package/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  450. package/dist/resolution/frameworks/nextjs.js +328 -0
  451. package/dist/resolution/frameworks/nextjs.js.map +1 -0
  452. package/dist/resolution/frameworks/object-literal.d.ts +32 -0
  453. package/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  454. package/dist/resolution/frameworks/object-literal.js +139 -0
  455. package/dist/resolution/frameworks/object-literal.js.map +1 -0
  456. package/dist/resolution/frameworks/package-deps.d.ts +14 -0
  457. package/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  458. package/dist/resolution/frameworks/package-deps.js +78 -0
  459. package/dist/resolution/frameworks/package-deps.js.map +1 -0
  460. package/dist/resolution/frameworks/play.d.ts +19 -0
  461. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  462. package/dist/resolution/frameworks/play.js +111 -0
  463. package/dist/resolution/frameworks/play.js.map +1 -0
  464. package/dist/resolution/frameworks/python.d.ts +10 -0
  465. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  466. package/dist/resolution/frameworks/python.js +566 -0
  467. package/dist/resolution/frameworks/python.js.map +1 -0
  468. package/dist/resolution/frameworks/react-native.d.ts +29 -0
  469. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  470. package/dist/resolution/frameworks/react-native.js +549 -0
  471. package/dist/resolution/frameworks/react-native.js.map +1 -0
  472. package/dist/resolution/frameworks/react-router.d.ts +46 -0
  473. package/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  474. package/dist/resolution/frameworks/react-router.js +187 -0
  475. package/dist/resolution/frameworks/react-router.js.map +1 -0
  476. package/dist/resolution/frameworks/react.d.ts +9 -0
  477. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  478. package/dist/resolution/frameworks/react.js +257 -0
  479. package/dist/resolution/frameworks/react.js.map +1 -0
  480. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  481. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  482. package/dist/resolution/frameworks/ruby.js +302 -0
  483. package/dist/resolution/frameworks/ruby.js.map +1 -0
  484. package/dist/resolution/frameworks/rust.d.ts +8 -0
  485. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  486. package/dist/resolution/frameworks/rust.js +304 -0
  487. package/dist/resolution/frameworks/rust.js.map +1 -0
  488. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  489. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  490. package/dist/resolution/frameworks/svelte.js +258 -0
  491. package/dist/resolution/frameworks/svelte.js.map +1 -0
  492. package/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  493. package/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  494. package/dist/resolution/frameworks/sveltekit-router.js +156 -0
  495. package/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  496. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  497. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  498. package/dist/resolution/frameworks/swift-objc.js +252 -0
  499. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  500. package/dist/resolution/frameworks/swift.d.ts +10 -0
  501. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  502. package/dist/resolution/frameworks/swift.js +410 -0
  503. package/dist/resolution/frameworks/swift.js.map +1 -0
  504. package/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  505. package/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  506. package/dist/resolution/frameworks/tanstack-router.js +437 -0
  507. package/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  508. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  509. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  510. package/dist/resolution/frameworks/terraform.js +277 -0
  511. package/dist/resolution/frameworks/terraform.js.map +1 -0
  512. package/dist/resolution/frameworks/vue-router.d.ts +82 -0
  513. package/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  514. package/dist/resolution/frameworks/vue-router.js +377 -0
  515. package/dist/resolution/frameworks/vue-router.js.map +1 -0
  516. package/dist/resolution/frameworks/vue.d.ts +9 -0
  517. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  518. package/dist/resolution/frameworks/vue.js +303 -0
  519. package/dist/resolution/frameworks/vue.js.map +1 -0
  520. package/dist/resolution/go-module.d.ts +26 -0
  521. package/dist/resolution/go-module.d.ts.map +1 -0
  522. package/dist/resolution/go-module.js +78 -0
  523. package/dist/resolution/go-module.js.map +1 -0
  524. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  525. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  526. package/dist/resolution/goframe-synthesizer.js +163 -0
  527. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  528. package/dist/resolution/import-resolver.d.ts +84 -0
  529. package/dist/resolution/import-resolver.d.ts.map +1 -0
  530. package/dist/resolution/import-resolver.js +2240 -0
  531. package/dist/resolution/import-resolver.js.map +1 -0
  532. package/dist/resolution/index.d.ts +343 -0
  533. package/dist/resolution/index.d.ts.map +1 -0
  534. package/dist/resolution/index.js +2352 -0
  535. package/dist/resolution/index.js.map +1 -0
  536. package/dist/resolution/lru-cache.d.ts +24 -0
  537. package/dist/resolution/lru-cache.d.ts.map +1 -0
  538. package/dist/resolution/lru-cache.js +62 -0
  539. package/dist/resolution/lru-cache.js.map +1 -0
  540. package/dist/resolution/memory-budget.d.ts +48 -0
  541. package/dist/resolution/memory-budget.d.ts.map +1 -0
  542. package/dist/resolution/memory-budget.js +162 -0
  543. package/dist/resolution/memory-budget.js.map +1 -0
  544. package/dist/resolution/name-matcher.d.ts +153 -0
  545. package/dist/resolution/name-matcher.d.ts.map +1 -0
  546. package/dist/resolution/name-matcher.js +2412 -0
  547. package/dist/resolution/name-matcher.js.map +1 -0
  548. package/dist/resolution/next-router-synthesizer.d.ts +27 -0
  549. package/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  550. package/dist/resolution/next-router-synthesizer.js +113 -0
  551. package/dist/resolution/next-router-synthesizer.js.map +1 -0
  552. package/dist/resolution/path-aliases.d.ts +70 -0
  553. package/dist/resolution/path-aliases.d.ts.map +1 -0
  554. package/dist/resolution/path-aliases.js +346 -0
  555. package/dist/resolution/path-aliases.js.map +1 -0
  556. package/dist/resolution/react-router-synthesizer.d.ts +33 -0
  557. package/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  558. package/dist/resolution/react-router-synthesizer.js +126 -0
  559. package/dist/resolution/react-router-synthesizer.js.map +1 -0
  560. package/dist/resolution/resolver-pool.d.ts +106 -0
  561. package/dist/resolution/resolver-pool.d.ts.map +1 -0
  562. package/dist/resolution/resolver-pool.js +344 -0
  563. package/dist/resolution/resolver-pool.js.map +1 -0
  564. package/dist/resolution/resolver-worker.d.ts +17 -0
  565. package/dist/resolution/resolver-worker.d.ts.map +1 -0
  566. package/dist/resolution/resolver-worker.js +141 -0
  567. package/dist/resolution/resolver-worker.js.map +1 -0
  568. package/dist/resolution/strip-comments.d.ts +27 -0
  569. package/dist/resolution/strip-comments.d.ts.map +1 -0
  570. package/dist/resolution/strip-comments.js +492 -0
  571. package/dist/resolution/strip-comments.js.map +1 -0
  572. package/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  573. package/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  574. package/dist/resolution/sveltekit-synthesizer.js +173 -0
  575. package/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  576. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  577. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  578. package/dist/resolution/swift-objc-bridge.js +256 -0
  579. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  580. package/dist/resolution/synth-utils.d.ts +26 -0
  581. package/dist/resolution/synth-utils.d.ts.map +1 -0
  582. package/dist/resolution/synth-utils.js +75 -0
  583. package/dist/resolution/synth-utils.js.map +1 -0
  584. package/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  585. package/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  586. package/dist/resolution/tanstack-router-synthesizer.js +114 -0
  587. package/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  588. package/dist/resolution/tier-synthesizer.d.ts +48 -0
  589. package/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  590. package/dist/resolution/tier-synthesizer.js +907 -0
  591. package/dist/resolution/tier-synthesizer.js.map +1 -0
  592. package/dist/resolution/types.d.ts +290 -0
  593. package/dist/resolution/types.d.ts.map +1 -0
  594. package/dist/resolution/types.js +8 -0
  595. package/dist/resolution/types.js.map +1 -0
  596. package/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  597. package/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  598. package/dist/resolution/vue-router-synthesizer.js +115 -0
  599. package/dist/resolution/vue-router-synthesizer.js.map +1 -0
  600. package/dist/resolution/workspace-packages.d.ts +58 -0
  601. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  602. package/dist/resolution/workspace-packages.js +346 -0
  603. package/dist/resolution/workspace-packages.js.map +1 -0
  604. package/dist/search/identifier-segments.d.ts +70 -0
  605. package/dist/search/identifier-segments.d.ts.map +1 -0
  606. package/dist/search/identifier-segments.js +205 -0
  607. package/dist/search/identifier-segments.js.map +1 -0
  608. package/dist/search/query-parser.d.ts +57 -0
  609. package/dist/search/query-parser.d.ts.map +1 -0
  610. package/dist/search/query-parser.js +177 -0
  611. package/dist/search/query-parser.js.map +1 -0
  612. package/dist/search/query-paths.d.ts +57 -0
  613. package/dist/search/query-paths.d.ts.map +1 -0
  614. package/dist/search/query-paths.js +298 -0
  615. package/dist/search/query-paths.js.map +1 -0
  616. package/dist/search/query-utils.d.ts +102 -0
  617. package/dist/search/query-utils.d.ts.map +1 -0
  618. package/dist/search/query-utils.js +487 -0
  619. package/dist/search/query-utils.js.map +1 -0
  620. package/dist/sync/git-hooks.d.ts +45 -0
  621. package/dist/sync/git-hooks.d.ts.map +1 -0
  622. package/dist/sync/git-hooks.js +227 -0
  623. package/dist/sync/git-hooks.js.map +1 -0
  624. package/dist/sync/index.d.ts +19 -0
  625. package/dist/sync/index.d.ts.map +1 -0
  626. package/dist/sync/index.js +35 -0
  627. package/dist/sync/index.js.map +1 -0
  628. package/dist/sync/watch-policy.d.ts +48 -0
  629. package/dist/sync/watch-policy.d.ts.map +1 -0
  630. package/dist/sync/watch-policy.js +124 -0
  631. package/dist/sync/watch-policy.js.map +1 -0
  632. package/dist/sync/watcher.d.ts +401 -0
  633. package/dist/sync/watcher.d.ts.map +1 -0
  634. package/dist/sync/watcher.js +967 -0
  635. package/dist/sync/watcher.js.map +1 -0
  636. package/dist/sync/worktree.d.ts +63 -0
  637. package/dist/sync/worktree.d.ts.map +1 -0
  638. package/dist/sync/worktree.js +182 -0
  639. package/dist/sync/worktree.js.map +1 -0
  640. package/dist/telemetry/index.d.ts +143 -0
  641. package/dist/telemetry/index.d.ts.map +1 -0
  642. package/dist/telemetry/index.js +541 -0
  643. package/dist/telemetry/index.js.map +1 -0
  644. package/dist/types.d.ts +486 -0
  645. package/dist/types.d.ts.map +1 -0
  646. package/dist/types.js +118 -0
  647. package/dist/types.js.map +1 -0
  648. package/dist/ui/color.d.ts +21 -0
  649. package/dist/ui/color.d.ts.map +1 -0
  650. package/dist/ui/color.js +42 -0
  651. package/dist/ui/color.js.map +1 -0
  652. package/dist/ui/glyphs.d.ts +67 -0
  653. package/dist/ui/glyphs.d.ts.map +1 -0
  654. package/dist/ui/glyphs.js +125 -0
  655. package/dist/ui/glyphs.js.map +1 -0
  656. package/dist/ui/shimmer-progress.d.ts +11 -0
  657. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  658. package/dist/ui/shimmer-progress.js +164 -0
  659. package/dist/ui/shimmer-progress.js.map +1 -0
  660. package/dist/ui/shimmer-worker.d.ts +2 -0
  661. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  662. package/dist/ui/shimmer-worker.js +126 -0
  663. package/dist/ui/shimmer-worker.js.map +1 -0
  664. package/dist/ui/types.d.ts +15 -0
  665. package/dist/ui/types.d.ts.map +1 -0
  666. package/dist/ui/types.js +3 -0
  667. package/dist/ui/types.js.map +1 -0
  668. package/dist/ui-server/api/deadcode.d.ts +84 -0
  669. package/dist/ui-server/api/deadcode.d.ts.map +1 -0
  670. package/dist/ui-server/api/deadcode.js +136 -0
  671. package/dist/ui-server/api/deadcode.js.map +1 -0
  672. package/dist/ui-server/api/effects.d.ts +87 -0
  673. package/dist/ui-server/api/effects.d.ts.map +1 -0
  674. package/dist/ui-server/api/effects.js +499 -0
  675. package/dist/ui-server/api/effects.js.map +1 -0
  676. package/dist/ui-server/api/entrypoints.d.ts +86 -0
  677. package/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  678. package/dist/ui-server/api/entrypoints.js +279 -0
  679. package/dist/ui-server/api/entrypoints.js.map +1 -0
  680. package/dist/ui-server/api/events.d.ts +183 -0
  681. package/dist/ui-server/api/events.d.ts.map +1 -0
  682. package/dist/ui-server/api/events.js +430 -0
  683. package/dist/ui-server/api/events.js.map +1 -0
  684. package/dist/ui-server/api/file.d.ts +66 -0
  685. package/dist/ui-server/api/file.d.ts.map +1 -0
  686. package/dist/ui-server/api/file.js +222 -0
  687. package/dist/ui-server/api/file.js.map +1 -0
  688. package/dist/ui-server/api/filecode.d.ts +126 -0
  689. package/dist/ui-server/api/filecode.d.ts.map +1 -0
  690. package/dist/ui-server/api/filecode.js +205 -0
  691. package/dist/ui-server/api/filecode.js.map +1 -0
  692. package/dist/ui-server/api/flow.d.ts +226 -0
  693. package/dist/ui-server/api/flow.d.ts.map +1 -0
  694. package/dist/ui-server/api/flow.js +611 -0
  695. package/dist/ui-server/api/flow.js.map +1 -0
  696. package/dist/ui-server/api/hierarchy.d.ts +81 -0
  697. package/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  698. package/dist/ui-server/api/hierarchy.js +92 -0
  699. package/dist/ui-server/api/hierarchy.js.map +1 -0
  700. package/dist/ui-server/api/index.d.ts +90 -0
  701. package/dist/ui-server/api/index.d.ts.map +1 -0
  702. package/dist/ui-server/api/index.js +332 -0
  703. package/dist/ui-server/api/index.js.map +1 -0
  704. package/dist/ui-server/api/map.d.ts +187 -0
  705. package/dist/ui-server/api/map.d.ts.map +1 -0
  706. package/dist/ui-server/api/map.js +498 -0
  707. package/dist/ui-server/api/map.js.map +1 -0
  708. package/dist/ui-server/api/node.d.ts +81 -0
  709. package/dist/ui-server/api/node.d.ts.map +1 -0
  710. package/dist/ui-server/api/node.js +388 -0
  711. package/dist/ui-server/api/node.js.map +1 -0
  712. package/dist/ui-server/api/nodes.d.ts +25 -0
  713. package/dist/ui-server/api/nodes.d.ts.map +1 -0
  714. package/dist/ui-server/api/nodes.js +45 -0
  715. package/dist/ui-server/api/nodes.js.map +1 -0
  716. package/dist/ui-server/api/program.d.ts +139 -0
  717. package/dist/ui-server/api/program.d.ts.map +1 -0
  718. package/dist/ui-server/api/program.js +315 -0
  719. package/dist/ui-server/api/program.js.map +1 -0
  720. package/dist/ui-server/api/respond.d.ts +76 -0
  721. package/dist/ui-server/api/respond.d.ts.map +1 -0
  722. package/dist/ui-server/api/respond.js +186 -0
  723. package/dist/ui-server/api/respond.js.map +1 -0
  724. package/dist/ui-server/api/route-roots.d.ts +39 -0
  725. package/dist/ui-server/api/route-roots.d.ts.map +1 -0
  726. package/dist/ui-server/api/route-roots.js +96 -0
  727. package/dist/ui-server/api/route-roots.js.map +1 -0
  728. package/dist/ui-server/api/routes.d.ts +59 -0
  729. package/dist/ui-server/api/routes.d.ts.map +1 -0
  730. package/dist/ui-server/api/routes.js +112 -0
  731. package/dist/ui-server/api/routes.js.map +1 -0
  732. package/dist/ui-server/api/screens.d.ts +117 -0
  733. package/dist/ui-server/api/screens.d.ts.map +1 -0
  734. package/dist/ui-server/api/screens.js +611 -0
  735. package/dist/ui-server/api/screens.js.map +1 -0
  736. package/dist/ui-server/api/search.d.ts +29 -0
  737. package/dist/ui-server/api/search.d.ts.map +1 -0
  738. package/dist/ui-server/api/search.js +232 -0
  739. package/dist/ui-server/api/search.js.map +1 -0
  740. package/dist/ui-server/api/session.d.ts +52 -0
  741. package/dist/ui-server/api/session.d.ts.map +1 -0
  742. package/dist/ui-server/api/session.js +196 -0
  743. package/dist/ui-server/api/session.js.map +1 -0
  744. package/dist/ui-server/api/source.d.ts +200 -0
  745. package/dist/ui-server/api/source.d.ts.map +1 -0
  746. package/dist/ui-server/api/source.js +419 -0
  747. package/dist/ui-server/api/source.js.map +1 -0
  748. package/dist/ui-server/api/stats.d.ts +27 -0
  749. package/dist/ui-server/api/stats.d.ts.map +1 -0
  750. package/dist/ui-server/api/stats.js +164 -0
  751. package/dist/ui-server/api/stats.js.map +1 -0
  752. package/dist/ui-server/api/steps.d.ts +274 -0
  753. package/dist/ui-server/api/steps.d.ts.map +1 -0
  754. package/dist/ui-server/api/steps.js +1446 -0
  755. package/dist/ui-server/api/steps.js.map +1 -0
  756. package/dist/ui-server/api/trail-store.d.ts +142 -0
  757. package/dist/ui-server/api/trail-store.d.ts.map +1 -0
  758. package/dist/ui-server/api/trail-store.js +323 -0
  759. package/dist/ui-server/api/trail-store.js.map +1 -0
  760. package/dist/ui-server/api/trails.d.ts +163 -0
  761. package/dist/ui-server/api/trails.d.ts.map +1 -0
  762. package/dist/ui-server/api/trails.js +369 -0
  763. package/dist/ui-server/api/trails.js.map +1 -0
  764. package/dist/ui-server/api/when.d.ts +125 -0
  765. package/dist/ui-server/api/when.d.ts.map +1 -0
  766. package/dist/ui-server/api/when.js +251 -0
  767. package/dist/ui-server/api/when.js.map +1 -0
  768. package/dist/ui-server/api/wire.d.ts +179 -0
  769. package/dist/ui-server/api/wire.d.ts.map +1 -0
  770. package/dist/ui-server/api/wire.js +231 -0
  771. package/dist/ui-server/api/wire.js.map +1 -0
  772. package/dist/ui-server/assets.d.ts +40 -0
  773. package/dist/ui-server/assets.d.ts.map +1 -0
  774. package/dist/ui-server/assets.js +110 -0
  775. package/dist/ui-server/assets.js.map +1 -0
  776. package/dist/ui-server/constants.d.ts +32 -0
  777. package/dist/ui-server/constants.d.ts.map +1 -0
  778. package/dist/ui-server/constants.js +35 -0
  779. package/dist/ui-server/constants.js.map +1 -0
  780. package/dist/ui-server/highlight/index.d.ts +113 -0
  781. package/dist/ui-server/highlight/index.d.ts.map +1 -0
  782. package/dist/ui-server/highlight/index.js +307 -0
  783. package/dist/ui-server/highlight/index.js.map +1 -0
  784. package/dist/ui-server/highlight/languages.d.ts +36 -0
  785. package/dist/ui-server/highlight/languages.d.ts.map +1 -0
  786. package/dist/ui-server/highlight/languages.js +50 -0
  787. package/dist/ui-server/highlight/languages.js.map +1 -0
  788. package/dist/ui-server/index.d.ts +92 -0
  789. package/dist/ui-server/index.d.ts.map +1 -0
  790. package/dist/ui-server/index.js +399 -0
  791. package/dist/ui-server/index.js.map +1 -0
  792. package/dist/ui-server/open-browser.d.ts +31 -0
  793. package/dist/ui-server/open-browser.d.ts.map +1 -0
  794. package/dist/ui-server/open-browser.js +79 -0
  795. package/dist/ui-server/open-browser.js.map +1 -0
  796. package/dist/ui-server/security.d.ts +127 -0
  797. package/dist/ui-server/security.d.ts.map +1 -0
  798. package/dist/ui-server/security.js +332 -0
  799. package/dist/ui-server/security.js.map +1 -0
  800. package/dist/ui-server/static.d.ts +45 -0
  801. package/dist/ui-server/static.d.ts.map +1 -0
  802. package/dist/ui-server/static.js +165 -0
  803. package/dist/ui-server/static.js.map +1 -0
  804. package/dist/upgrade/index.d.ts +177 -0
  805. package/dist/upgrade/index.d.ts.map +1 -0
  806. package/dist/upgrade/index.js +665 -0
  807. package/dist/upgrade/index.js.map +1 -0
  808. package/dist/upgrade/remove-binary.d.ts +87 -0
  809. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  810. package/dist/upgrade/remove-binary.js +289 -0
  811. package/dist/upgrade/remove-binary.js.map +1 -0
  812. package/dist/upgrade/update-check.d.ts +92 -0
  813. package/dist/upgrade/update-check.d.ts.map +1 -0
  814. package/dist/upgrade/update-check.js +258 -0
  815. package/dist/upgrade/update-check.js.map +1 -0
  816. package/dist/utils.d.ts +224 -0
  817. package/dist/utils.d.ts.map +1 -0
  818. package/dist/utils.js +583 -0
  819. package/dist/utils.js.map +1 -0
  820. package/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  821. package/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  822. package/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  823. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  824. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  825. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  826. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  827. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  828. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  829. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  830. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  831. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  832. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  833. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  834. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  835. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  836. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  837. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  838. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  839. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  840. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  841. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  842. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  843. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  844. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  845. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  846. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  847. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  848. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  849. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  850. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  851. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  852. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  853. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  854. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  855. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  856. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  857. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  858. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  859. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  860. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  861. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  862. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  863. package/dist/viewer/assets/index-2IPslW5t.js +13 -0
  864. package/dist/viewer/assets/index-DSwi2Seu.css +1 -0
  865. package/dist/viewer/index.html +16 -0
  866. package/package.json +67 -0
@@ -0,0 +1,2240 @@
1
+ "use strict";
2
+ /**
3
+ * Import Resolver
4
+ *
5
+ * Resolves import paths to actual files and symbols.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.isNixPathImportRef = isNixPathImportRef;
42
+ exports.clearImportResolverMemos = clearImportResolverMemos;
43
+ exports.resolveImportPath = resolveImportPath;
44
+ exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
45
+ exports.loadCppIncludeDirs = loadCppIncludeDirs;
46
+ exports.isPhpIncludePathRef = isPhpIncludePathRef;
47
+ exports.isCobolCopybookRef = isCobolCopybookRef;
48
+ exports.extractImportMappings = extractImportMappings;
49
+ exports.clearImportMappingCache = clearImportMappingCache;
50
+ exports.extractReExports = extractReExports;
51
+ exports.resolveJvmImport = resolveJvmImport;
52
+ exports.resolveViaImport = resolveViaImport;
53
+ const fs = __importStar(require("fs"));
54
+ const path = __importStar(require("path"));
55
+ const path_aliases_1 = require("./path-aliases");
56
+ const workspace_packages_1 = require("./workspace-packages");
57
+ const name_matcher_1 = require("./name-matcher");
58
+ /**
59
+ * Extension resolution order by language
60
+ */
61
+ const EXTENSION_RESOLUTION = {
62
+ typescript: ['.ts', '.tsx', '.d.ts', '.js', '.jsx', '/index.ts', '/index.tsx', '/index.js'],
63
+ // ArkTS imports both `.ets` components and plain `.ts` logic modules —
64
+ // HarmonyOS projects are always a mix. `/Index.ets` (capital I) is ohpm's
65
+ // module-entry convention, hit when a bare workspace import ("data") is
66
+ // rewritten to the member's directory; lowercase variants for safety.
67
+ arkts: ['.ets', '.ts', '.d.ts', '.js', '/Index.ets', '/index.ets', '/index.ts', '/index.js'],
68
+ javascript: ['.js', '.jsx', '.mjs', '.cjs', '.xsjs', '.xsjslib', '/index.js', '/index.jsx'],
69
+ tsx: ['.tsx', '.ts', '.d.ts', '.js', '.jsx', '/index.tsx', '/index.ts', '/index.js'],
70
+ jsx: ['.jsx', '.js', '/index.jsx', '/index.js'],
71
+ // SFC consumers import plain TS/JS, sibling components, and barrels
72
+ // (`./lib` → `./lib/index.ts`). Without a list, relative imports from a
73
+ // `.svelte`/`.vue` file resolve to nothing, so barrel callers vanish (#629).
74
+ svelte: ['.ts', '.js', '.svelte', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.svelte'],
75
+ vue: ['.ts', '.js', '.vue', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.vue'],
76
+ astro: ['.ts', '.js', '.astro', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.astro'],
77
+ python: ['.py', '/__init__.py'],
78
+ go: ['.go'],
79
+ rust: ['.rs', '/mod.rs'],
80
+ java: ['.java'],
81
+ c: ['.h', '.c'],
82
+ cpp: ['.h', '.hpp', '.hxx', '.cpp', '.cc', '.cxx'],
83
+ csharp: ['.cs'],
84
+ php: ['.php'],
85
+ ruby: ['.rb'],
86
+ objc: ['.h', '.m', '.mm'],
87
+ nix: ['.nix', '/default.nix'],
88
+ };
89
+ function isNixPathImportRef(ref) {
90
+ return (ref.language === 'nix' &&
91
+ ref.referenceKind === 'imports' &&
92
+ (ref.referenceName.startsWith('./') || ref.referenceName.startsWith('../')) &&
93
+ !/[\s{}()[\];"'<>$]/.test(ref.referenceName));
94
+ }
95
+ /**
96
+ * Resolve an import path to an actual file
97
+ */
98
+ // Per-context memos for the two hottest pure lookups on the resolution path:
99
+ // import-specifier → file resolution and exported-symbol lookup. Both are pure
100
+ // given a stable file set + node table, which is exactly the window between
101
+ // ReferenceResolver.clearCaches() calls — clearImportResolverMemos() is invoked
102
+ // there, so the staleness discipline matches the resolver's own caches.
103
+ const importPathMemos = new WeakMap();
104
+ const exportedSymbolMemos = new WeakMap();
105
+ const DEFAULT_BINDING_KINDS = new Set(['function', 'class', 'component', 'constant', 'variable']);
106
+ const DEFAULT_EXPORT_BINDING_RE = /^[ \t]*export\s+default\s+([A-Za-z_$][\w$]*)\s*;?[ \t]*$/m;
107
+ const JS_FAMILY_FILE = /\.(?:[cm]?[jt]sx?)$/;
108
+ /** The identifier `export default NAME` names in a JS-family file, or null. */
109
+ function defaultExportBinding(filePath, context) {
110
+ if (!JS_FAMILY_FILE.test(filePath))
111
+ return null;
112
+ const source = context.readFile(filePath);
113
+ if (!source || !source.includes('export default'))
114
+ return null;
115
+ return source.match(DEFAULT_EXPORT_BINDING_RE)?.[1] ?? null;
116
+ }
117
+ const fileExportIndexes = new WeakMap();
118
+ function getFileExportIndex(filePath, context) {
119
+ let perFile = fileExportIndexes.get(context);
120
+ if (!perFile) {
121
+ perFile = new Map();
122
+ fileExportIndexes.set(context, perFile);
123
+ }
124
+ let idx = perFile.get(filePath);
125
+ if (!idx) {
126
+ idx = { byName: new Map(), defaultComponent: undefined, defaultFnClass: undefined, defaultBinding: undefined };
127
+ const nodesInFile = context.getNodesInFile(filePath);
128
+ for (const n of nodesInFile) {
129
+ if (!n.isExported)
130
+ continue;
131
+ if (!idx.byName.has(n.name))
132
+ idx.byName.set(n.name, n);
133
+ if (idx.defaultComponent === undefined && n.kind === 'component')
134
+ idx.defaultComponent = n;
135
+ if (idx.defaultFnClass === undefined && (n.kind === 'function' || n.kind === 'class'))
136
+ idx.defaultFnClass = n;
137
+ }
138
+ const bound = defaultExportBinding(filePath, context);
139
+ if (bound !== null) {
140
+ idx.defaultBinding = nodesInFile
141
+ .filter((n) => n.name === bound && DEFAULT_BINDING_KINDS.has(n.kind))
142
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0];
143
+ }
144
+ perFile.set(filePath, idx);
145
+ }
146
+ return idx;
147
+ }
148
+ /** Drop the per-context memo tables (see ReferenceResolver.clearCaches). */
149
+ function clearImportResolverMemos(context) {
150
+ importPathMemos.delete(context);
151
+ exportedSymbolMemos.delete(context);
152
+ fileExportIndexes.delete(context);
153
+ luaFileBasenameIndexes.delete(context);
154
+ cobolCopybookIndexes.delete(context);
155
+ }
156
+ function resolveImportPath(importPath, fromFile, language, context) {
157
+ let memo = importPathMemos.get(context);
158
+ if (!memo) {
159
+ memo = new Map();
160
+ importPathMemos.set(context, memo);
161
+ }
162
+ const key = `${language}\0${fromFile}\0${importPath}`;
163
+ const hit = memo.get(key);
164
+ if (hit !== undefined || memo.has(key))
165
+ return hit ?? null;
166
+ const resolved = resolveImportPathUncached(importPath, fromFile, language, context);
167
+ memo.set(key, resolved);
168
+ return resolved;
169
+ }
170
+ function resolveImportPathUncached(importPath, fromFile, language, context) {
171
+ // COBOL COPY/EXEC SQL INCLUDE names a copybook member, not a path — the
172
+ // compiler searches a library, so we match against indexed file basenames.
173
+ // Must run before isExternalImport: a bare member name would otherwise be
174
+ // misclassified as an external package.
175
+ if (language === 'cobol') {
176
+ return resolveCobolCopybook(importPath, fromFile, context);
177
+ }
178
+ // Skip external/npm packages — but pass the context so the
179
+ // bare-specifier heuristic can consult the project's tsconfig
180
+ // alias map first (custom prefixes like `@components/*` would
181
+ // otherwise be misclassified as npm).
182
+ if (isExternalImport(importPath, language, context)) {
183
+ return null;
184
+ }
185
+ const projectRoot = context.getProjectRoot();
186
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
187
+ // Handle relative imports
188
+ if (importPath.startsWith('.')) {
189
+ return resolveRelativeImport(importPath, fromDir, language, context);
190
+ }
191
+ // Handle absolute/aliased imports (like @/ or src/)
192
+ const aliased = resolveAliasedImport(importPath, projectRoot, language, context);
193
+ if (aliased)
194
+ return aliased;
195
+ // C/C++ include directory search: when neither relative nor aliased
196
+ // resolution found a match, search -I directories from
197
+ // compile_commands.json or heuristic probing.
198
+ if (language === 'c' || language === 'cpp') {
199
+ return resolveCppIncludePath(importPath, language, context);
200
+ }
201
+ return null;
202
+ }
203
+ /**
204
+ * COBOL copybook lookup: `COPY CVACT01Y` (or `EXEC SQL INCLUDE X`) names a
205
+ * library member resolved by the compiler's copybook search path, so we match
206
+ * the member against indexed file basenames, case-insensitively. `.cpy` wins
207
+ * over a same-named program; a same-directory hit wins within a tier. The
208
+ * stem index is built once per resolution context (a per-ref scan of every
209
+ * file node would go quadratic on copybook-heavy repos).
210
+ */
211
+ const cobolCopybookIndexes = new WeakMap();
212
+ /**
213
+ * Per-context basename → file-paths index for Lua/Luau require resolution
214
+ * (cobolCopybookIndexes pattern). resolveLuaRequire previously ran
215
+ * `getAllFiles().filter(endsWith)` FOUR times per require ref — ~7.5k string
216
+ * suffix scans each, measured at ~0.9ms/ref (2.7s combined on kong's 3k
217
+ * requires). Buckets preserve getAllFiles() iteration order so the per-suffix
218
+ * candidate list filters to exactly the array the full scan produced —
219
+ * identical matches, identical stable sort, identical winner.
220
+ */
221
+ const luaFileBasenameIndexes = new WeakMap();
222
+ function luaBasenameIndex(context) {
223
+ let index = luaFileBasenameIndexes.get(context);
224
+ if (!index) {
225
+ index = new Map();
226
+ for (const f of context.getAllFiles()) {
227
+ const base = f.split('/').pop() ?? '';
228
+ const paths = index.get(base);
229
+ if (paths)
230
+ paths.push(f);
231
+ else
232
+ index.set(base, [f]);
233
+ }
234
+ luaFileBasenameIndexes.set(context, index);
235
+ }
236
+ return index;
237
+ }
238
+ function resolveCobolCopybook(member, fromFile, context) {
239
+ let index = cobolCopybookIndexes.get(context);
240
+ if (!index) {
241
+ index = new Map();
242
+ for (const fileNode of context.getNodesByKind('file')) {
243
+ const normalized = fileNode.filePath.replace(/\\/g, '/');
244
+ const base = normalized.split('/').pop() ?? '';
245
+ const dot = base.lastIndexOf('.');
246
+ const stem = (dot > 0 ? base.slice(0, dot) : base).toLowerCase();
247
+ const paths = index.get(stem);
248
+ if (paths)
249
+ paths.push(fileNode.filePath);
250
+ else
251
+ index.set(stem, [fileNode.filePath]);
252
+ }
253
+ cobolCopybookIndexes.set(context, index);
254
+ }
255
+ const candidates = index.get(member.toLowerCase());
256
+ if (!candidates || candidates.length === 0)
257
+ return null;
258
+ const fromDir = fromFile.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
259
+ let best = null;
260
+ let bestScore = -1;
261
+ for (const candidate of candidates) {
262
+ const normalized = candidate.replace(/\\/g, '/');
263
+ const ext = normalized.slice(normalized.lastIndexOf('.')).toLowerCase();
264
+ let score = 0;
265
+ if (ext === '.cpy')
266
+ score += 4;
267
+ else if (ext === '.cbl' || ext === '.cob' || ext === '.cobol')
268
+ score += 2;
269
+ if (normalized.split('/').slice(0, -1).join('/') === fromDir)
270
+ score += 1;
271
+ if (score > bestScore) {
272
+ bestScore = score;
273
+ best = candidate;
274
+ }
275
+ }
276
+ return best;
277
+ }
278
+ /**
279
+ * C and C++ standard library header names (without delimiters).
280
+ * Used by isExternalImport to filter system includes from resolution.
281
+ */
282
+ const C_CPP_STDLIB_HEADERS = new Set([
283
+ // C standard library headers
284
+ 'assert.h', 'complex.h', 'ctype.h', 'errno.h', 'fenv.h', 'float.h',
285
+ 'inttypes.h', 'iso646.h', 'limits.h', 'locale.h', 'math.h', 'setjmp.h',
286
+ 'signal.h', 'stdalign.h', 'stdarg.h', 'stdatomic.h', 'stdbool.h',
287
+ 'stddef.h', 'stdint.h', 'stdio.h', 'stdlib.h', 'stdnoreturn.h',
288
+ 'string.h', 'tgmath.h', 'threads.h', 'time.h', 'uchar.h', 'wchar.h',
289
+ 'wctype.h',
290
+ // C++ C-library wrappers (cname form)
291
+ 'cassert', 'ccomplex', 'cctype', 'cerrno', 'cfenv', 'cfloat',
292
+ 'cinttypes', 'ciso646', 'climits', 'clocale', 'cmath', 'csetjmp',
293
+ 'csignal', 'cstdalign', 'cstdarg', 'cstdbool', 'cstddef', 'cstdint',
294
+ 'cstdio', 'cstdlib', 'cstring', 'ctgmath', 'ctime', 'cuchar',
295
+ 'cwchar', 'cwctype',
296
+ // C++ STL headers
297
+ 'algorithm', 'any', 'array', 'atomic', 'barrier', 'bit', 'bitset',
298
+ 'charconv', 'chrono', 'codecvt', 'compare', 'complex', 'concepts',
299
+ 'condition_variable', 'coroutine', 'deque', 'exception', 'execution',
300
+ 'expected', 'filesystem', 'format', 'forward_list', 'fstream',
301
+ 'functional', 'future', 'generator', 'initializer_list', 'iomanip',
302
+ 'ios', 'iosfwd', 'iostream', 'istream', 'iterator', 'latch',
303
+ 'limits', 'list', 'locale', 'map', 'mdspan', 'memory', 'memory_resource',
304
+ 'mutex', 'new', 'numbers', 'numeric', 'optional', 'ostream', 'print',
305
+ 'queue', 'random', 'ranges', 'ratio', 'regex', 'scoped_allocator',
306
+ 'semaphore', 'set', 'shared_mutex', 'source_location', 'span',
307
+ 'spanstream', 'sstream', 'stack', 'stacktrace', 'stdexcept',
308
+ 'stdfloat', 'stop_token', 'streambuf', 'string', 'string_view',
309
+ 'strstream', 'syncstream', 'system_error', 'thread', 'tuple',
310
+ 'type_traits', 'typeindex', 'typeinfo', 'unordered_map',
311
+ 'unordered_set', 'utility', 'valarray', 'variant', 'vector',
312
+ 'version',
313
+ ]);
314
+ /**
315
+ * Check if an import is external (npm package, etc.)
316
+ *
317
+ * `context` is consulted for project-defined path aliases
318
+ * (tsconfig/jsconfig `paths`). Without that check, custom prefixes
319
+ * like `@components/*` would fail the bare-specifier heuristic and
320
+ * be classified as external before alias resolution can run.
321
+ */
322
+ function isExternalImport(importPath, language, context) {
323
+ // Relative imports are not external
324
+ if (importPath.startsWith('.')) {
325
+ return false;
326
+ }
327
+ // Workspace-member imports (`@scope/ui`, `@scope/ui/widgets`) are LOCAL to
328
+ // a monorepo even though they look like bare npm specifiers. Consult the
329
+ // workspace map first so they aren't misclassified as external (#629). The
330
+ // map is null for single-package repos, so this is a no-op there.
331
+ const workspaces = context?.getWorkspacePackages?.();
332
+ if (workspaces && (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces)) {
333
+ return false;
334
+ }
335
+ // Common external patterns
336
+ if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx' || language === 'arkts') {
337
+ // Node built-ins
338
+ if (['fs', 'path', 'os', 'crypto', 'http', 'https', 'url', 'util', 'events', 'stream', 'child_process', 'buffer'].includes(importPath)) {
339
+ return true;
340
+ }
341
+ // Project-defined alias prefix? Treat as local.
342
+ const aliases = context?.getProjectAliases?.();
343
+ if (aliases) {
344
+ for (const pat of aliases.patterns) {
345
+ if (importPath.startsWith(pat.prefix))
346
+ return false;
347
+ }
348
+ }
349
+ // Scoped packages or bare specifiers that don't start with aliases
350
+ if (!importPath.startsWith('@/') && !importPath.startsWith('~/') && !importPath.startsWith('src/')) {
351
+ // Likely an npm package
352
+ return true;
353
+ }
354
+ }
355
+ if (language === 'python') {
356
+ // Standard library modules
357
+ const stdLibs = ['os', 'sys', 'json', 're', 'math', 'datetime', 'collections', 'typing', 'pathlib', 'logging'];
358
+ if (stdLibs.includes(importPath.split('.')[0])) {
359
+ return true;
360
+ }
361
+ }
362
+ if (language === 'go') {
363
+ // Relative imports (rare in idiomatic Go but the grammar allows them).
364
+ if (importPath.startsWith('.')) {
365
+ return false;
366
+ }
367
+ // In-module imports look like `<module-path>/sub/pkg` — local to
368
+ // this project. Without the module-path check we'd flag every
369
+ // cross-package call in a Go monorepo as external (issue #388).
370
+ const mod = context?.getGoModule?.();
371
+ if (mod && (importPath === mod.modulePath || importPath.startsWith(mod.modulePath + '/'))) {
372
+ return false;
373
+ }
374
+ // `internal/` packages stay local even when go.mod is missing —
375
+ // preserves the pre-#388 escape hatch for repos without a parsed module path.
376
+ if (importPath.includes('/internal/')) {
377
+ return false;
378
+ }
379
+ // Anything else is the Go standard library or a third-party module.
380
+ return true;
381
+ }
382
+ if (language === 'c' || language === 'cpp') {
383
+ // C/C++ standard library headers — both C-style (<stdio.h>) and
384
+ // C++-style (<cstdio>, <vector>) forms. Checked against the import
385
+ // path (which the extractor strips of <> or "" delimiters).
386
+ if (C_CPP_STDLIB_HEADERS.has(importPath))
387
+ return true;
388
+ // C++ headers without .h extension (e.g. "vector", "string")
389
+ const withoutExt = importPath.replace(/\.h$/, '');
390
+ if (C_CPP_STDLIB_HEADERS.has(withoutExt))
391
+ return true;
392
+ }
393
+ return false;
394
+ }
395
+ /**
396
+ * Resolve a relative import
397
+ */
398
+ function resolveRelativeImport(importPath, fromDir, language, context) {
399
+ const projectRoot = context.getProjectRoot();
400
+ const extensions = EXTENSION_RESOLUTION[language] || [];
401
+ // Python dotted-relative imports (`from .certs import x`, `from ..pkg.mod
402
+ // import y`): leading dots are PACKAGE levels (1 = current package), and the
403
+ // remainder is a dotted submodule path. `path.resolve(dir, '.certs')` would
404
+ // treat `.certs` as a literal hidden filename, so translate the Python form
405
+ // to a real filesystem-relative path before resolving.
406
+ if (language === 'python' && importPath.startsWith('.')) {
407
+ const dots = importPath.length - importPath.replace(/^\.+/, '').length;
408
+ const up = '../'.repeat(Math.max(0, dots - 1)); // 1 dot = current dir
409
+ const rest = importPath.slice(dots).replace(/\./g, '/'); // 'sub.mod' -> 'sub/mod'
410
+ const pyBase = path.resolve(fromDir, up + rest);
411
+ const pyRel = path.relative(projectRoot, pyBase).replace(/\\/g, '/');
412
+ for (const ext of extensions) {
413
+ if (context.fileExists(pyRel + ext))
414
+ return pyRel + ext;
415
+ }
416
+ if (pyRel && context.fileExists(pyRel))
417
+ return pyRel;
418
+ return null;
419
+ }
420
+ // Try the path as-is first
421
+ const basePath = path.resolve(fromDir, importPath);
422
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
423
+ // Try each extension
424
+ for (const ext of extensions) {
425
+ const candidatePath = relativePath + ext;
426
+ if (context.fileExists(candidatePath)) {
427
+ return candidatePath;
428
+ }
429
+ }
430
+ // Try without extension (might already have one)
431
+ if (context.fileExists(relativePath)) {
432
+ return relativePath;
433
+ }
434
+ return null;
435
+ }
436
+ /**
437
+ * Resolve an aliased/absolute import.
438
+ *
439
+ * Tries, in order:
440
+ * 1. Project-defined `compilerOptions.paths` (tsconfig/jsconfig).
441
+ * Each pattern can have multiple replacements; tried in tsconfig
442
+ * priority order with extension permutations.
443
+ * 2. The legacy hard-coded fallback list (`@/`, `~/`, `src/`, ...)
444
+ * for projects that have aliases but no tsconfig paths block.
445
+ * 3. Direct path lookup (with extensions).
446
+ */
447
+ function resolveAliasedImport(importPath, projectRoot, language, context) {
448
+ const extensions = EXTENSION_RESOLUTION[language] || [];
449
+ const tryWithExt = (basePath) => {
450
+ for (const ext of extensions) {
451
+ const candidate = basePath + ext;
452
+ if (context.fileExists(candidate))
453
+ return candidate;
454
+ }
455
+ if (context.fileExists(basePath))
456
+ return basePath;
457
+ return null;
458
+ };
459
+ // 1. Project tsconfig/jsconfig paths.
460
+ const aliasMap = context.getProjectAliases?.();
461
+ if (aliasMap) {
462
+ const candidates = (0, path_aliases_1.applyAliases)(importPath, aliasMap, projectRoot);
463
+ for (const c of candidates) {
464
+ const hit = tryWithExt(c);
465
+ if (hit)
466
+ return hit;
467
+ }
468
+ }
469
+ // 1.5 Workspace packages (`@scope/ui/widgets` → `packages/ui/widgets`).
470
+ // Resolves a monorepo member import to the member's directory; the
471
+ // extension/index permutations below then find its barrel (#629).
472
+ const workspaces = context.getWorkspacePackages?.();
473
+ if (workspaces) {
474
+ const base = (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces);
475
+ if (base) {
476
+ const hit = tryWithExt(base);
477
+ if (hit)
478
+ return hit;
479
+ }
480
+ }
481
+ // 2. Hard-coded fallback list. Kept for projects that use these
482
+ // conventional aliases without declaring them in tsconfig.
483
+ const fallbackAliases = {
484
+ '@/': 'src/',
485
+ '~/': 'src/',
486
+ '@src/': 'src/',
487
+ 'src/': 'src/',
488
+ '@app/': 'app/',
489
+ 'app/': 'app/',
490
+ };
491
+ for (const [alias, replacement] of Object.entries(fallbackAliases)) {
492
+ if (importPath.startsWith(alias)) {
493
+ const hit = tryWithExt(importPath.replace(alias, replacement));
494
+ if (hit)
495
+ return hit;
496
+ }
497
+ }
498
+ // 3. Direct path.
499
+ return tryWithExt(importPath);
500
+ }
501
+ /**
502
+ * C/C++ include directory cache (keyed by project root).
503
+ * Loaded once per resolver instance, shared across calls.
504
+ */
505
+ const cppIncludeDirCache = new Map();
506
+ /**
507
+ * Clear the C/C++ include directory cache (call between indexing runs)
508
+ */
509
+ function clearCppIncludeDirCache() {
510
+ cppIncludeDirCache.clear();
511
+ }
512
+ /**
513
+ * Discover C/C++ include search directories for a project.
514
+ *
515
+ * Strategy:
516
+ * 1. Look for compile_commands.json (Clang compilation database) in the
517
+ * project root and common build subdirectories. Parse -I and -isystem
518
+ * flags from compiler commands.
519
+ * 2. If no compilation database is found, probe for common convention
520
+ * directories (include/, src/, lib/, api/) and top-level directories
521
+ * containing .h/.hpp files.
522
+ *
523
+ * Returns paths relative to projectRoot.
524
+ */
525
+ function loadCppIncludeDirs(projectRoot) {
526
+ const cached = cppIncludeDirCache.get(projectRoot);
527
+ if (cached !== undefined)
528
+ return cached;
529
+ const dirs = loadCppIncludeDirsFromCompileDB(projectRoot)
530
+ || loadCppIncludeDirsHeuristic(projectRoot);
531
+ cppIncludeDirCache.set(projectRoot, dirs);
532
+ return dirs;
533
+ }
534
+ /**
535
+ * Try to load include directories from compile_commands.json.
536
+ * Returns null if no compilation database is found (so the heuristic
537
+ * fallback can run). Returns an array (possibly empty) otherwise.
538
+ */
539
+ function loadCppIncludeDirsFromCompileDB(projectRoot) {
540
+ const candidates = [
541
+ path.join(projectRoot, 'compile_commands.json'),
542
+ path.join(projectRoot, 'build', 'compile_commands.json'),
543
+ path.join(projectRoot, 'cmake-build-debug', 'compile_commands.json'),
544
+ path.join(projectRoot, 'cmake-build-release', 'compile_commands.json'),
545
+ path.join(projectRoot, 'out', 'compile_commands.json'),
546
+ ];
547
+ let dbPath;
548
+ for (const c of candidates) {
549
+ try {
550
+ if (fs.existsSync(c)) {
551
+ dbPath = c;
552
+ break;
553
+ }
554
+ }
555
+ catch {
556
+ // ignore
557
+ }
558
+ }
559
+ if (!dbPath)
560
+ return null;
561
+ try {
562
+ const content = fs.readFileSync(dbPath, 'utf-8');
563
+ const entries = JSON.parse(content);
564
+ if (!Array.isArray(entries))
565
+ return null;
566
+ const dirSet = new Set();
567
+ for (const entry of entries) {
568
+ const dir = entry.directory || projectRoot;
569
+ const args = entry.arguments || (entry.command ? shlexSplit(entry.command) : []);
570
+ for (let i = 0; i < args.length; i++) {
571
+ const arg = args[i];
572
+ let includeDir;
573
+ // -I<dir> (no space)
574
+ if (arg.startsWith('-I') && arg.length > 2) {
575
+ includeDir = arg.substring(2);
576
+ }
577
+ // -isystem <dir> (space-separated)
578
+ else if ((arg === '-isystem' || arg === '-I') && i + 1 < args.length) {
579
+ includeDir = args[i + 1];
580
+ i++; // skip next arg
581
+ }
582
+ if (includeDir) {
583
+ // Normalize: resolve relative to the compilation directory
584
+ const absPath = path.isAbsolute(includeDir)
585
+ ? includeDir
586
+ : path.resolve(dir, includeDir);
587
+ const relPath = path.relative(projectRoot, absPath).replace(/\\/g, '/');
588
+ // Skip system directories and paths outside the project
589
+ // (relative paths starting with .. or absolute paths like
590
+ // /usr/include or C:\usr on Windows)
591
+ if (!relPath.startsWith('..') && relPath.length > 0 && !path.isAbsolute(relPath)) {
592
+ dirSet.add(relPath);
593
+ }
594
+ }
595
+ }
596
+ }
597
+ return Array.from(dirSet);
598
+ }
599
+ catch {
600
+ return null;
601
+ }
602
+ }
603
+ /**
604
+ * Minimal shlex-style split for compiler command strings.
605
+ * Handles double-quoted and single-quoted arguments.
606
+ */
607
+ function shlexSplit(cmd) {
608
+ const result = [];
609
+ let i = 0;
610
+ while (i < cmd.length) {
611
+ // Skip whitespace
612
+ while (i < cmd.length && /\s/.test(cmd[i]))
613
+ i++;
614
+ if (i >= cmd.length)
615
+ break;
616
+ const ch = cmd[i];
617
+ if (ch === '"') {
618
+ i++;
619
+ let arg = '';
620
+ while (i < cmd.length && cmd[i] !== '"') {
621
+ if (cmd[i] === '\\' && i + 1 < cmd.length) {
622
+ i++;
623
+ arg += cmd[i];
624
+ }
625
+ else {
626
+ arg += cmd[i];
627
+ }
628
+ i++;
629
+ }
630
+ i++; // closing quote
631
+ result.push(arg);
632
+ }
633
+ else if (ch === "'") {
634
+ i++;
635
+ let arg = '';
636
+ while (i < cmd.length && cmd[i] !== "'") {
637
+ arg += cmd[i];
638
+ i++;
639
+ }
640
+ i++; // closing quote
641
+ result.push(arg);
642
+ }
643
+ else {
644
+ let arg = '';
645
+ while (i < cmd.length && !/\s/.test(cmd[i])) {
646
+ arg += cmd[i];
647
+ i++;
648
+ }
649
+ result.push(arg);
650
+ }
651
+ }
652
+ return result;
653
+ }
654
+ /**
655
+ * Heuristic include directory discovery when no compile_commands.json exists.
656
+ * Checks common convention directories and scans top-level dirs for headers.
657
+ */
658
+ function loadCppIncludeDirsHeuristic(projectRoot) {
659
+ const dirs = [];
660
+ const conventionDirs = ['include', 'src', 'lib', 'api', 'inc'];
661
+ try {
662
+ const entries = fs.readdirSync(projectRoot, { withFileTypes: true });
663
+ for (const entry of entries) {
664
+ if (!entry.isDirectory())
665
+ continue;
666
+ const name = entry.name;
667
+ // Convention directories
668
+ if (conventionDirs.includes(name.toLowerCase())) {
669
+ dirs.push(name);
670
+ continue;
671
+ }
672
+ // Any top-level directory containing .h or .hpp files
673
+ try {
674
+ const subFiles = fs.readdirSync(path.join(projectRoot, name));
675
+ if (subFiles.some(f => /\.(h|hpp|hxx|hh)$/i.test(f))) {
676
+ dirs.push(name);
677
+ }
678
+ }
679
+ catch {
680
+ // ignore permission errors
681
+ }
682
+ }
683
+ }
684
+ catch {
685
+ // ignore
686
+ }
687
+ return dirs;
688
+ }
689
+ /**
690
+ * Resolve a C/C++ include path by searching include directories.
691
+ * Called as a fallback after relative and aliased resolution fail.
692
+ */
693
+ function resolveCppIncludePath(importPath, language, context) {
694
+ const includeDirs = context.getCppIncludeDirs?.() ?? [];
695
+ const extensions = EXTENSION_RESOLUTION[language] ?? [];
696
+ for (const dir of includeDirs) {
697
+ const normalizedDir = dir.replace(/\\/g, '/');
698
+ for (const ext of extensions) {
699
+ const candidate = normalizedDir + '/' + importPath + ext;
700
+ if (context.fileExists(candidate))
701
+ return candidate;
702
+ }
703
+ // Try as-is (already has extension)
704
+ const candidate = normalizedDir + '/' + importPath;
705
+ if (context.fileExists(candidate))
706
+ return candidate;
707
+ }
708
+ return null;
709
+ }
710
+ /**
711
+ * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?
712
+ *
713
+ * include/require emit a file path ("lib.php", "inc/db.php", "../x.php"),
714
+ * whereas namespace use is an FQN (App\Foo\Bar) or a bare class symbol
715
+ * (Closure). PHP identifiers contain neither '/' nor '.', so a slash or dot
716
+ * marks a path-shaped include. Such references resolve to files only — never
717
+ * to a same-named symbol — so callers must not fall back to the name-matcher.
718
+ */
719
+ function isPhpIncludePathRef(ref) {
720
+ return (ref.language === 'php' &&
721
+ ref.referenceKind === 'imports' &&
722
+ (ref.referenceName.includes('/') || ref.referenceName.includes('.')));
723
+ }
724
+ /**
725
+ * Is this a COBOL COPY / EXEC SQL INCLUDE copybook reference? These resolve
726
+ * to files only (or stay unresolved for compiler-supplied members) — never
727
+ * to a same-named symbol via the name-matcher.
728
+ */
729
+ function isCobolCopybookRef(ref) {
730
+ return ref.language === 'cobol' && ref.referenceKind === 'imports';
731
+ }
732
+ /**
733
+ * Resolve a PHP include/require path to a project-relative file path.
734
+ *
735
+ * PHP resolves includes relative to the including file's directory (the
736
+ * common case for procedural codebases); php.ini `include_path` is not
737
+ * modeled. Callers pass an already-extracted static literal path.
738
+ */
739
+ function resolvePhpIncludePath(includePath, fromFile, context) {
740
+ const projectRoot = context.getProjectRoot();
741
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
742
+ const basePath = path.resolve(fromDir, includePath);
743
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
744
+ if (context.fileExists(relativePath))
745
+ return relativePath;
746
+ // The literal may omit the .php extension (e.g. include "config").
747
+ for (const ext of EXTENSION_RESOLUTION.php ?? []) {
748
+ if (context.fileExists(relativePath + ext))
749
+ return relativePath + ext;
750
+ }
751
+ return null;
752
+ }
753
+ /**
754
+ * Extract import mappings from a file
755
+ */
756
+ function extractImportMappings(_filePath, content, language) {
757
+ const mappings = [];
758
+ if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx' || language === 'arkts') {
759
+ mappings.push(...extractJSImports(content));
760
+ }
761
+ else if (language === 'svelte' || language === 'vue' || language === 'astro') {
762
+ // Svelte/Vue single-file components import via plain ES6 inside their
763
+ // `<script>` block (Astro: the `---` frontmatter). Without this, a
764
+ // `.svelte`/`.vue`/`.astro` consumer produces
765
+ // zero import mappings, so `resolveViaImport` can't run and a barrel
766
+ // import (`import { Foo } from './lib'`) falls back to name-matching —
767
+ // which silently fails whenever the re-export alias differs from the
768
+ // component's real name, yielding a false 0 callers (#629). The ES6
769
+ // import regex only matches `import … from '…'`, so running it over the
770
+ // whole SFC (markup + styles included) is safe.
771
+ mappings.push(...extractJSImports(content));
772
+ }
773
+ else if (language === 'python') {
774
+ mappings.push(...extractPythonImports(content));
775
+ }
776
+ else if (language === 'go') {
777
+ mappings.push(...extractGoImports(content));
778
+ }
779
+ else if (language === 'java' || language === 'kotlin') {
780
+ mappings.push(...extractJavaImports(content));
781
+ }
782
+ else if (language === 'php') {
783
+ mappings.push(...extractPHPImports(content));
784
+ }
785
+ else if (language === 'c' || language === 'cpp') {
786
+ mappings.push(...extractCppImports(content));
787
+ }
788
+ return mappings;
789
+ }
790
+ /**
791
+ * Extract JS/TS import mappings
792
+ */
793
+ function extractJSImports(content) {
794
+ const mappings = [];
795
+ // ES6 imports
796
+ const importRegex = /import\s+(?:(\w+)\s*,?\s*)?(?:\{([^}]+)\})?\s*(?:(\*)\s+as\s+(\w+))?\s*from\s*['"]([^'"]+)['"]/g;
797
+ let match;
798
+ while ((match = importRegex.exec(content)) !== null) {
799
+ const [, defaultImport, namedImports, star, namespaceAlias, source] = match;
800
+ // Default import
801
+ if (defaultImport) {
802
+ mappings.push({
803
+ localName: defaultImport,
804
+ exportedName: 'default',
805
+ source: source,
806
+ isDefault: true,
807
+ isNamespace: false,
808
+ });
809
+ }
810
+ // Named imports
811
+ if (namedImports) {
812
+ const names = namedImports.split(',').map((s) => s.trim());
813
+ for (const name of names) {
814
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
815
+ if (aliasMatch) {
816
+ mappings.push({
817
+ localName: aliasMatch[2],
818
+ exportedName: aliasMatch[1],
819
+ source: source,
820
+ isDefault: false,
821
+ isNamespace: false,
822
+ });
823
+ }
824
+ else if (name) {
825
+ mappings.push({
826
+ localName: name,
827
+ exportedName: name,
828
+ source: source,
829
+ isDefault: false,
830
+ isNamespace: false,
831
+ });
832
+ }
833
+ }
834
+ }
835
+ // Namespace import
836
+ if (star && namespaceAlias) {
837
+ mappings.push({
838
+ localName: namespaceAlias,
839
+ exportedName: '*',
840
+ source: source,
841
+ isDefault: false,
842
+ isNamespace: true,
843
+ });
844
+ }
845
+ }
846
+ // Require statements
847
+ const requireRegex = /(?:const|let|var)\s+(?:(\w+)|{([^}]+)})\s*=\s*require\(['"]([^'"]+)['"]\)/g;
848
+ while ((match = requireRegex.exec(content)) !== null) {
849
+ const [, defaultName, destructured, source] = match;
850
+ if (defaultName) {
851
+ mappings.push({
852
+ localName: defaultName,
853
+ exportedName: 'default',
854
+ source: source,
855
+ isDefault: true,
856
+ isNamespace: false,
857
+ });
858
+ }
859
+ if (destructured) {
860
+ const names = destructured.split(',').map((s) => s.trim());
861
+ for (const name of names) {
862
+ const aliasMatch = name.match(/(\w+)\s*:\s*(\w+)/);
863
+ if (aliasMatch) {
864
+ mappings.push({
865
+ localName: aliasMatch[2],
866
+ exportedName: aliasMatch[1],
867
+ source: source,
868
+ isDefault: false,
869
+ isNamespace: false,
870
+ });
871
+ }
872
+ else if (name) {
873
+ mappings.push({
874
+ localName: name,
875
+ exportedName: name,
876
+ source: source,
877
+ isDefault: false,
878
+ isNamespace: false,
879
+ });
880
+ }
881
+ }
882
+ }
883
+ }
884
+ return mappings;
885
+ }
886
+ /**
887
+ * Extract Python import mappings
888
+ */
889
+ function extractPythonImports(content) {
890
+ const mappings = [];
891
+ // from X import Y
892
+ const fromImportRegex = /from\s+([\w.]+)\s+import\s+([^#\n]+)/g;
893
+ let match;
894
+ while ((match = fromImportRegex.exec(content)) !== null) {
895
+ const [, source, imports] = match;
896
+ const names = imports.split(',').map((s) => s.trim());
897
+ for (const name of names) {
898
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
899
+ if (aliasMatch) {
900
+ mappings.push({
901
+ localName: aliasMatch[2],
902
+ exportedName: aliasMatch[1],
903
+ source: source,
904
+ isDefault: false,
905
+ isNamespace: false,
906
+ });
907
+ }
908
+ else if (name && name !== '*') {
909
+ mappings.push({
910
+ localName: name,
911
+ exportedName: name,
912
+ source: source,
913
+ isDefault: false,
914
+ isNamespace: false,
915
+ });
916
+ }
917
+ }
918
+ }
919
+ // import X
920
+ const importRegex = /^import\s+([\w.]+)(?:\s+as\s+(\w+))?/gm;
921
+ while ((match = importRegex.exec(content)) !== null) {
922
+ const [, source, alias] = match;
923
+ const localName = alias || source.split('.').pop();
924
+ mappings.push({
925
+ localName,
926
+ exportedName: '*',
927
+ source: source,
928
+ isDefault: false,
929
+ isNamespace: true,
930
+ });
931
+ }
932
+ return mappings;
933
+ }
934
+ /**
935
+ * Extract Go import mappings
936
+ */
937
+ function extractGoImports(content) {
938
+ const mappings = [];
939
+ // import "path" or import alias "path"
940
+ const singleImportRegex = /import\s+(?:(\w+)\s+)?["']([^"']+)["']/g;
941
+ let match;
942
+ while ((match = singleImportRegex.exec(content)) !== null) {
943
+ const [, alias, source] = match;
944
+ const packageName = source.split('/').pop();
945
+ mappings.push({
946
+ localName: alias || packageName,
947
+ exportedName: '*',
948
+ source: source,
949
+ isDefault: false,
950
+ isNamespace: true,
951
+ });
952
+ }
953
+ // import ( ... ) block
954
+ const blockImportRegex = /import\s*\(\s*([^)]+)\s*\)/gs;
955
+ while ((match = blockImportRegex.exec(content)) !== null) {
956
+ const block = match[1];
957
+ const lineRegex = /(?:(\w+)\s+)?["']([^"']+)["']/g;
958
+ let lineMatch;
959
+ while ((lineMatch = lineRegex.exec(block)) !== null) {
960
+ const [, alias, source] = lineMatch;
961
+ const packageName = source.split('/').pop();
962
+ mappings.push({
963
+ localName: alias || packageName,
964
+ exportedName: '*',
965
+ source: source,
966
+ isDefault: false,
967
+ isNamespace: true,
968
+ });
969
+ }
970
+ }
971
+ return mappings;
972
+ }
973
+ /**
974
+ * Extract Java / Kotlin import mappings.
975
+ *
976
+ * Java/Kotlin imports carry the full qualified name of the imported
977
+ * symbol — `import com.example.dao.converter.FooConverter;` — which is
978
+ * exactly the disambiguation signal we need when two packages both
979
+ * declare a `FooConverter`. Pre-#314 the resolver had no Java branch
980
+ * here at all, so this mapping was empty and cross-module name
981
+ * collisions were resolved by file-path proximity (often wrongly).
982
+ *
983
+ * `import static com.example.Foo.bar;` is parsed as a local-name `bar`
984
+ * pointing at FQN `com.example.Foo.bar` so static-method call sites
985
+ * (`bar(...)`) can resolve through the same import lookup.
986
+ */
987
+ function extractJavaImports(content) {
988
+ const mappings = [];
989
+ // Strip line and block comments so `// import foo;` doesn't false-match.
990
+ const stripped = content
991
+ .replace(/\/\*[\s\S]*?\*\//g, '')
992
+ .replace(/\/\/[^\n]*/g, '');
993
+ // `import [static] <fqn>[.*];`
994
+ const re = /^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)\s*;/gm;
995
+ let match;
996
+ while ((match = re.exec(stripped)) !== null) {
997
+ const fqn = match[2];
998
+ // `import com.example.*;` — wildcard. We can't materialize a single
999
+ // local name; skip and let name-matching handle members reachable
1000
+ // through the wildcard. (Future enhancement: enumerate package files.)
1001
+ if (fqn.endsWith('.*'))
1002
+ continue;
1003
+ const parts = fqn.split('.');
1004
+ const localName = parts[parts.length - 1];
1005
+ if (!localName)
1006
+ continue;
1007
+ mappings.push({
1008
+ localName,
1009
+ exportedName: localName,
1010
+ source: fqn,
1011
+ isDefault: false,
1012
+ isNamespace: false,
1013
+ });
1014
+ }
1015
+ return mappings;
1016
+ }
1017
+ /**
1018
+ * Extract PHP import mappings (use statements)
1019
+ */
1020
+ function extractPHPImports(content) {
1021
+ const mappings = [];
1022
+ // use Namespace\Class; or use Namespace\Class as Alias;
1023
+ const useRegex = /use\s+([\w\\]+)(?:\s+as\s+(\w+))?;/g;
1024
+ let match;
1025
+ while ((match = useRegex.exec(content)) !== null) {
1026
+ const [, fullPath, alias] = match;
1027
+ const className = fullPath.split('\\').pop();
1028
+ mappings.push({
1029
+ localName: alias || className,
1030
+ exportedName: className,
1031
+ source: fullPath,
1032
+ isDefault: false,
1033
+ isNamespace: false,
1034
+ });
1035
+ }
1036
+ return mappings;
1037
+ }
1038
+ /**
1039
+ * Extract C/C++ import mappings from #include directives.
1040
+ *
1041
+ * #include brings all symbols from the included header into scope
1042
+ * (namespace import), so each mapping uses isNamespace: true and
1043
+ * exportedName: '*'. The localName is set to the header's basename
1044
+ * without extension so that symbol references like `MyClass` can
1045
+ * match against any include that might provide it.
1046
+ */
1047
+ function extractCppImports(content) {
1048
+ const mappings = [];
1049
+ // Match both #include <...> and #include "..."
1050
+ const includeRegex = /^\s*#\s*include\s+[<"]([^>"]+)[>"]/gm;
1051
+ let match;
1052
+ while ((match = includeRegex.exec(content)) !== null) {
1053
+ const modulePath = match[1];
1054
+ // Basename without extension for localName matching
1055
+ const basename = modulePath.split('/').pop().replace(/\.(h|hpp|hxx|hh|inl|ipp|cxx|cc|cpp)$/, '');
1056
+ mappings.push({
1057
+ localName: basename || modulePath,
1058
+ exportedName: '*',
1059
+ source: modulePath,
1060
+ isDefault: false,
1061
+ isNamespace: true,
1062
+ });
1063
+ }
1064
+ return mappings;
1065
+ }
1066
+ // Cache import mappings per file to avoid re-reading and re-parsing
1067
+ const importMappingCache = new Map();
1068
+ /**
1069
+ * Clear the import mapping cache (call between indexing runs)
1070
+ */
1071
+ function clearImportMappingCache() {
1072
+ importMappingCache.clear();
1073
+ cppIncludeDirCache.clear();
1074
+ }
1075
+ /**
1076
+ * Strip JS line + block comments from `content` while preserving
1077
+ * string literals (so `"//"` inside a string stays intact). Used by
1078
+ * {@link extractReExports} so commented-out export-from statements
1079
+ * don't generate phantom re-export edges.
1080
+ *
1081
+ * Scanner is deliberately small: it only tracks the three contexts
1082
+ * relevant for JS/TS — single-quote string, double-quote string, and
1083
+ * template literal. Comment recognition is the JS spec subset, no
1084
+ * regex-literal awareness (which is fine for our use case: we don't
1085
+ * apply this to function bodies, only to top-level files).
1086
+ */
1087
+ function stripJsComments(content) {
1088
+ let out = '';
1089
+ let i = 0;
1090
+ let str = null;
1091
+ while (i < content.length) {
1092
+ const ch = content[i];
1093
+ if (str !== null) {
1094
+ out += ch;
1095
+ if (ch === '\\' && i + 1 < content.length) {
1096
+ out += content[i + 1];
1097
+ i += 2;
1098
+ continue;
1099
+ }
1100
+ if (ch === str)
1101
+ str = null;
1102
+ i++;
1103
+ continue;
1104
+ }
1105
+ if (ch === '"' || ch === "'" || ch === '`') {
1106
+ str = ch;
1107
+ out += ch;
1108
+ i++;
1109
+ continue;
1110
+ }
1111
+ if (ch === '/' && content[i + 1] === '/') {
1112
+ while (i < content.length && content[i] !== '\n')
1113
+ i++;
1114
+ continue;
1115
+ }
1116
+ if (ch === '/' && content[i + 1] === '*') {
1117
+ i += 2;
1118
+ while (i < content.length && !(content[i] === '*' && content[i + 1] === '/'))
1119
+ i++;
1120
+ i += 2;
1121
+ continue;
1122
+ }
1123
+ out += ch;
1124
+ i++;
1125
+ }
1126
+ return out;
1127
+ }
1128
+ /**
1129
+ * Extract JS/TS re-export declarations from `content`.
1130
+ *
1131
+ * Recognised forms:
1132
+ * export { foo } from './a';
1133
+ * export { foo as bar } from './a';
1134
+ * export * from './a';
1135
+ * export * as ns from './a'; (treated as wildcard for chasing)
1136
+ * export { default as Foo } from './a';
1137
+ *
1138
+ * The walker intentionally stays regex-based — the import-resolver
1139
+ * elsewhere in this file already chooses regex over a fresh
1140
+ * tree-sitter pass, and this function shares that trade-off. Errors
1141
+ * fall through silently; resolution simply skips the broken file.
1142
+ */
1143
+ function extractReExports(content, language) {
1144
+ if (language !== 'typescript' &&
1145
+ language !== 'javascript' &&
1146
+ language !== 'tsx' &&
1147
+ language !== 'jsx' &&
1148
+ language !== 'arkts') {
1149
+ return [];
1150
+ }
1151
+ const out = [];
1152
+ // Pre-strip block comments + line comments so a commented-out
1153
+ // `// export { x } from '...'` doesn't produce a phantom edge.
1154
+ // (Template literals are still a possible source of false positives;
1155
+ // a project that builds export statements as runtime strings is
1156
+ // out of scope.)
1157
+ const cleaned = stripJsComments(content);
1158
+ // Wildcard: `export * from '...'` or `export * as ns from '...'`
1159
+ const wildcardRe = /export\s*\*(?:\s+as\s+\w+)?\s*from\s*['"]([^'"]+)['"]/g;
1160
+ let m;
1161
+ while ((m = wildcardRe.exec(cleaned)) !== null) {
1162
+ out.push({ kind: 'wildcard', source: m[1] });
1163
+ }
1164
+ // Named: `export { a, b as c } from '...'`
1165
+ const namedRe = /export\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/g;
1166
+ while ((m = namedRe.exec(cleaned)) !== null) {
1167
+ const inner = m[1];
1168
+ const source = m[2];
1169
+ for (const raw of inner.split(',')) {
1170
+ const item = raw.trim();
1171
+ if (!item)
1172
+ continue;
1173
+ const aliasMatch = item.match(/^(\w+)\s+as\s+(\w+)$/);
1174
+ if (aliasMatch) {
1175
+ out.push({
1176
+ kind: 'named',
1177
+ exportedName: aliasMatch[2],
1178
+ originalName: aliasMatch[1],
1179
+ source,
1180
+ });
1181
+ }
1182
+ else if (/^\w+$/.test(item)) {
1183
+ out.push({
1184
+ kind: 'named',
1185
+ exportedName: item,
1186
+ originalName: item,
1187
+ source,
1188
+ });
1189
+ }
1190
+ }
1191
+ }
1192
+ return out;
1193
+ }
1194
+ /**
1195
+ * Resolve a reference using import mappings
1196
+ */
1197
+ /**
1198
+ * JVM (Java / Kotlin) imports use fully-qualified names (`import
1199
+ * com.example.foo.Bar`) decoupled from filenames, so the JS/Python
1200
+ * style filesystem path lookup misses them whenever the file isn't
1201
+ * named after its primary symbol (Kotlin `Utils.kt` exporting `Bar`,
1202
+ * top-level fns, extension fns). Resolve them through the
1203
+ * `qualifiedName` index instead — populated by the package_header /
1204
+ * package_declaration namespace wrappers in the extractor.
1205
+ */
1206
+ function resolveJvmImport(ref, context) {
1207
+ if (ref.referenceKind !== 'imports')
1208
+ return null;
1209
+ if (ref.language !== 'java' && ref.language !== 'kotlin')
1210
+ return null;
1211
+ const fqn = ref.referenceName;
1212
+ const lastDot = fqn.lastIndexOf('.');
1213
+ if (lastDot <= 0)
1214
+ return null;
1215
+ const pkg = fqn.substring(0, lastDot);
1216
+ const sym = fqn.substring(lastDot + 1);
1217
+ // Wildcard imports (`com.example.*`) deliberately punt to name-matcher.
1218
+ if (sym === '*')
1219
+ return null;
1220
+ const candidates = context.getNodesByQualifiedName(`${pkg}::${sym}`);
1221
+ if (candidates.length === 0)
1222
+ return null;
1223
+ // Kotlin Multiplatform: an `expect` declaration and its `actual`s share one
1224
+ // FQN across source sets (commonMain / androidMain / appleMain). Taking the
1225
+ // first candidate let a single platform `actual` absorb every common-side
1226
+ // import, so the `expect` (the canonical API a commonMain file imports)
1227
+ // looked unused. Prefer the candidate CLOSEST to the importing file by
1228
+ // directory proximity — a commonMain import resolves to the commonMain
1229
+ // declaration — with the `expect` side as a tiebreak.
1230
+ const best = candidates.length === 1 ? candidates[0] : pickClosestJvmCandidate(candidates, ref.filePath);
1231
+ return {
1232
+ original: ref,
1233
+ targetNodeId: best.id,
1234
+ confidence: 0.95,
1235
+ resolvedBy: 'import',
1236
+ };
1237
+ }
1238
+ /**
1239
+ * Pick the same-FQN candidate closest to `fromPath` by shared directory
1240
+ * prefix, preferring an `expect` declaration on a tie. Used to keep a Kotlin
1241
+ * Multiplatform `expect`/`actual` import resolving within the importer's own
1242
+ * source set instead of an arbitrary platform `actual`.
1243
+ */
1244
+ function pickClosestJvmCandidate(candidates, fromPath) {
1245
+ const fromDirs = fromPath.split('/').slice(0, -1);
1246
+ const sharedPrefix = (p) => {
1247
+ const d = p.split('/').slice(0, -1);
1248
+ let shared = 0;
1249
+ for (let i = 0; i < Math.min(fromDirs.length, d.length); i++) {
1250
+ if (fromDirs[i] === d[i])
1251
+ shared++;
1252
+ else
1253
+ break;
1254
+ }
1255
+ return shared;
1256
+ };
1257
+ const isExpect = (n) => Array.isArray(n.decorators) && n.decorators.includes('expect');
1258
+ let best = candidates[0];
1259
+ let bestProx = sharedPrefix(best.filePath);
1260
+ for (let i = 1; i < candidates.length; i++) {
1261
+ const c = candidates[i];
1262
+ const prox = sharedPrefix(c.filePath);
1263
+ if (prox > bestProx || (prox === bestProx && isExpect(c) && !isExpect(best))) {
1264
+ best = c;
1265
+ bestProx = prox;
1266
+ }
1267
+ }
1268
+ return best;
1269
+ }
1270
+ function resolveViaImport(ref, context) {
1271
+ // C/C++ #include references — resolve directly to the included file
1272
+ // (file→file edge), bypassing symbol lookup. The extractor emits these
1273
+ // with `referenceKind: 'imports'` and `referenceName: <include path>`
1274
+ // (e.g. "uint256.h" or "common/args.h"). Without this branch the
1275
+ // include-dir scan path inside resolveImportPath never produces an
1276
+ // edge — resolveViaImport's symbol lookup below would search the
1277
+ // resolved file for a symbol named like the file extension and fail.
1278
+ if ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports') {
1279
+ // C/C++ quoted includes (`#include "X.h"`) resolve relative to the
1280
+ // INCLUDING file's own directory first (the C standard's quoted-include
1281
+ // search order). Prefer a same-directory header over an -I directory or a
1282
+ // same-named header on another platform (windows/code/RNCAsyncStorage.h vs
1283
+ // apple/.../RNCAsyncStorage.h) — the include-dir heuristic below would
1284
+ // otherwise pick an arbitrary same-named header, leaving the real local one
1285
+ // with no dependents.
1286
+ const slash = ref.filePath.lastIndexOf('/');
1287
+ const fromDir = slash >= 0 ? ref.filePath.slice(0, slash) : '';
1288
+ const siblingPath = path.posix.normalize(fromDir ? `${fromDir}/${ref.referenceName}` : ref.referenceName);
1289
+ const siblingBase = siblingPath.split('/').pop();
1290
+ const sibling = context
1291
+ .getNodesByName(siblingBase)
1292
+ .find((n) => n.kind === 'file' && n.filePath === siblingPath);
1293
+ if (sibling) {
1294
+ return { original: ref, targetNodeId: sibling.id, confidence: 0.92, resolvedBy: 'import' };
1295
+ }
1296
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1297
+ if (!resolvedPath)
1298
+ return null;
1299
+ const basename = resolvedPath.split('/').pop();
1300
+ const fileNodes = context.getNodesByName(basename).filter((n) => n.kind === 'file');
1301
+ const fileNode = fileNodes.find((n) => n.filePath === resolvedPath);
1302
+ if (fileNode) {
1303
+ return {
1304
+ original: ref,
1305
+ targetNodeId: fileNode.id,
1306
+ confidence: 0.9,
1307
+ resolvedBy: 'import',
1308
+ };
1309
+ }
1310
+ return null;
1311
+ }
1312
+ // COBOL COPY / EXEC SQL INCLUDE — resolve the copybook member to a
1313
+ // file→file edge, mirroring the C/C++ include branch above. A member that
1314
+ // matches no indexed file (compiler-supplied copybooks like SQLCA/DFHAID)
1315
+ // stays unresolved — callers must not fall back to the symbol name-matcher,
1316
+ // which would connect it to a same-named import symbol elsewhere.
1317
+ if (isCobolCopybookRef(ref)) {
1318
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1319
+ if (!resolvedPath)
1320
+ return null;
1321
+ const basename = resolvedPath.split('/').pop();
1322
+ const fileNode = context
1323
+ .getNodesByName(basename)
1324
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1325
+ if (fileNode) {
1326
+ return {
1327
+ original: ref,
1328
+ targetNodeId: fileNode.id,
1329
+ confidence: 0.9,
1330
+ resolvedBy: 'import',
1331
+ };
1332
+ }
1333
+ return null;
1334
+ }
1335
+ // PHP include/require — resolve the static string path to a file→file
1336
+ // edge, mirroring the C/C++ branch above. Distinguish include PATHS from
1337
+ // namespace `use` symbols by shape: an include path contains a slash or a
1338
+ // file extension ("lib.php", "inc/db.php", "../x.php"), whereas a namespace
1339
+ // use is an FQN (App\Foo\Bar) or a bare class symbol (Closure) — PHP
1340
+ // identifiers contain neither '/' nor '.'. Only path-shaped references are
1341
+ // includes; symbol references fall through to the namespace resolution.
1342
+ if (isPhpIncludePathRef(ref)) {
1343
+ const resolvedPath = resolvePhpIncludePath(ref.referenceName, ref.filePath, context);
1344
+ if (resolvedPath) {
1345
+ const basename = resolvedPath.split('/').pop();
1346
+ const fileNode = context
1347
+ .getNodesByName(basename)
1348
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1349
+ if (fileNode) {
1350
+ return {
1351
+ original: ref,
1352
+ targetNodeId: fileNode.id,
1353
+ confidence: 0.9,
1354
+ resolvedBy: 'import',
1355
+ };
1356
+ }
1357
+ }
1358
+ // A path-shaped include that doesn't resolve to a known project file is a
1359
+ // dead end. Return unresolved rather than falling through to the symbol
1360
+ // name-matcher, which would mis-connect e.g. "inc/db.php" to an unrelated
1361
+ // db.php elsewhere in the tree — a wrong edge is worse than a missing one.
1362
+ return null;
1363
+ }
1364
+ // Nix static project-path imports (`import ./x.nix`, `builtins.import ./dir`,
1365
+ // `import ./x.nix {}`) resolve to file nodes only. Do not resolve
1366
+ // angle-bracket channels, attribute expressions, variables, or other dynamic
1367
+ // expressions as project files.
1368
+ if (isNixPathImportRef(ref)) {
1369
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1370
+ if (!resolvedPath)
1371
+ return null;
1372
+ const basename = resolvedPath.split('/').pop();
1373
+ const fileNode = context
1374
+ .getNodesByName(basename)
1375
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1376
+ if (fileNode) {
1377
+ return {
1378
+ original: ref,
1379
+ targetNodeId: fileNode.id,
1380
+ confidence: 0.9,
1381
+ resolvedBy: 'import',
1382
+ };
1383
+ }
1384
+ return null;
1385
+ }
1386
+ // Use cached import mappings (avoids re-reading and re-parsing per ref)
1387
+ const imports = context.getImportMappings(ref.filePath, ref.language);
1388
+ if (imports.length === 0 && !context.readFile(ref.filePath)) {
1389
+ return null;
1390
+ }
1391
+ // Go cross-package calls: `pkga.FuncX(...)` extracts to referenceName
1392
+ // `pkga.FuncX` and the import `github.com/example/myproject/pkga`
1393
+ // maps to a *package directory* containing one or more .go files.
1394
+ // The generic file-based lookup below can't follow that — issue #388.
1395
+ if (ref.language === 'go') {
1396
+ const goResult = resolveGoCrossPackageReference(ref, imports, context);
1397
+ if (goResult)
1398
+ return goResult;
1399
+ }
1400
+ // Java / Kotlin: imports are FQNs (`import com.example.Foo;`) — no
1401
+ // resolvable file path the JS/TS-style chain below could follow. Look
1402
+ // up the symbol by name and filter to the candidate whose file path
1403
+ // matches the imported FQN. This is the disambiguation signal that
1404
+ // breaks the same-name class collision the path-proximity matcher
1405
+ // can't resolve (issue #314).
1406
+ if (ref.language === 'java' || ref.language === 'kotlin') {
1407
+ const javaResult = resolveJavaImportedReference(ref, imports, context);
1408
+ if (javaResult)
1409
+ return javaResult;
1410
+ }
1411
+ // Python qualified access through an imported MODULE: `certs.where()` after
1412
+ // `from . import certs`, `mod.func()` after `import mod`. The receiver names a
1413
+ // submodule (a file), not a symbol, so the generic symbol lookup below would
1414
+ // search the *package* for `certs` instead of looking inside the module.
1415
+ if (ref.language === 'python') {
1416
+ const pyResult = resolvePythonModuleMember(ref, imports, context);
1417
+ if (pyResult)
1418
+ return pyResult;
1419
+ // Absolute dotted module import: `import conduit.apps.articles.signals`
1420
+ // (the standard Django AppConfig.ready() signal-registration pattern, and
1421
+ // any side-effect `import pkg.mod`). Map the dotted path to its file.
1422
+ const pyModResult = resolvePythonAbsoluteModule(ref, context);
1423
+ if (pyModResult)
1424
+ return pyModResult;
1425
+ }
1426
+ // Rust qualified path: resolve the module prefix of `crate::m::Item` /
1427
+ // `self::sub::Item` / `super::m::func` to a file, then find the leaf symbol in
1428
+ // it. Disambiguates common-name `pub use self::read::read` re-exports that
1429
+ // name-matching would land on the wrong same-named symbol.
1430
+ if (ref.language === 'rust' && ref.referenceName.includes('::')) {
1431
+ const rustResult = resolveRustPathReference(ref, context);
1432
+ if (rustResult)
1433
+ return rustResult;
1434
+ }
1435
+ // Lua / Luau `require(...)`: a dotted module path (`a.b.c` from
1436
+ // `require("a.b.c")`) or an instance-path leaf (`Signal` from
1437
+ // `require(script.Parent.Signal)`) — map it to a module file. There's no static
1438
+ // import statement, so the generic path-matcher can't bridge the dot↔slash /
1439
+ // leaf↔basename gap; resolve it explicitly to the module file.
1440
+ if ((ref.language === 'lua' || ref.language === 'luau') && ref.referenceKind === 'imports') {
1441
+ const luaResult = resolveLuaRequire(ref, context);
1442
+ if (luaResult)
1443
+ return luaResult;
1444
+ }
1445
+ // Whole-module / namespace imports → link the importing file to the module
1446
+ // file. Python `from . import certs` / `import mod`, and TS/JS `import * as ns
1447
+ // from './x'` (so a namespace touched only via a value-member read still
1448
+ // records the dependency). A named TS/JS import returns null here and falls
1449
+ // through to symbol resolution below.
1450
+ if (ref.language === 'python' ||
1451
+ ref.language === 'typescript' ||
1452
+ ref.language === 'tsx' ||
1453
+ ref.language === 'javascript' ||
1454
+ ref.language === 'jsx' ||
1455
+ ref.language === 'arkts') {
1456
+ const moduleFile = resolveModuleImportToFile(ref, imports, context);
1457
+ if (moduleFile)
1458
+ return moduleFile;
1459
+ }
1460
+ // Check if the reference name matches any import
1461
+ for (const imp of imports) {
1462
+ if (imp.localName === ref.referenceName || ref.referenceName.startsWith(imp.localName + '.')) {
1463
+ // Resolve the import path
1464
+ const resolvedPath = resolveImportPath(imp.source, ref.filePath, ref.language, context);
1465
+ if (resolvedPath) {
1466
+ const exportedName = imp.isDefault ? 'default' : imp.exportedName;
1467
+ const memberName = imp.isNamespace
1468
+ ? ref.referenceName.replace(imp.localName + '.', '')
1469
+ : null;
1470
+ const targetNode = findExportedSymbol(resolvedPath, { isDefault: imp.isDefault, isNamespace: imp.isNamespace, exportedName, memberName }, ref.language, context, new Set());
1471
+ if (targetNode) {
1472
+ // `Foo.bar()` / `Foo.CONST` — a NAMED (non-namespace) class import
1473
+ // accessed through a member. `findExportedSymbol` resolved `Foo` to
1474
+ // the class itself; descend into it so the reference links to the
1475
+ // member `bar`, not the class. Without this the edge points at the
1476
+ // class and `createEdges` then mis-promotes the call to an
1477
+ // `instantiates` edge, so the static method shows zero callers and a
1478
+ // hollow impact radius. (#825)
1479
+ if (!imp.isNamespace && ref.referenceName.startsWith(imp.localName + '.')) {
1480
+ const memberNode = resolveStaticMember(targetNode, ref, imp.localName, context);
1481
+ if (memberNode) {
1482
+ return {
1483
+ original: ref,
1484
+ targetNodeId: memberNode.id,
1485
+ confidence: 0.9,
1486
+ resolvedBy: 'import',
1487
+ };
1488
+ }
1489
+ // An imported object literal used as a namespace (#1573):
1490
+ // `api.call()` after `import { api } from './api'` where `api` is
1491
+ // `export const api = { call() {…} }`. Its members have bare
1492
+ // qualified names inside the constant's extent, so the
1493
+ // `Container::member` lookup above can't see them and the edge
1494
+ // landed on the constant — every cross-file caller of the method
1495
+ // went missing. Resolve the member by containment instead.
1496
+ if (targetNode.kind === 'constant' || targetNode.kind === 'variable') {
1497
+ const member = ref.referenceName.slice(imp.localName.length + 1).split('.')[0];
1498
+ if (member) {
1499
+ const literalMember = (0, name_matcher_1.resolveObjectLiteralMember)(targetNode, member, ref, context, 0.9, 'import');
1500
+ if (literalMember)
1501
+ return literalMember;
1502
+ const aliasMember = resolveObjectLiteralAlias(targetNode, member, ref, context);
1503
+ if (aliasMember)
1504
+ return aliasMember;
1505
+ }
1506
+ }
1507
+ // An imported VALUE (singleton constant / shared instance) called
1508
+ // through a member: `reproStore.notifyJoinGuildStatus()` after
1509
+ // `import { reproStore } from './store'`. findExportedSymbol
1510
+ // resolved the CONSTANT itself; linking the CALL there hides the
1511
+ // real callee — callers of the method miss every cross-file use
1512
+ // and the method can look unused (#1292). Infer the value's type
1513
+ // from its own declaration in the exporting file and resolve the
1514
+ // member on that type. resolveMethodOnType VALIDATES the type
1515
+ // declares the method, so a mis-inference falls through to the
1516
+ // constant edge below rather than fabricating a wrong one.
1517
+ const instanceMember = resolveImportedInstanceMember(targetNode, ref, imp.localName, context);
1518
+ if (instanceMember)
1519
+ return instanceMember;
1520
+ }
1521
+ return {
1522
+ original: ref,
1523
+ targetNodeId: targetNode.id,
1524
+ confidence: 0.9,
1525
+ resolvedBy: 'import',
1526
+ };
1527
+ }
1528
+ }
1529
+ }
1530
+ }
1531
+ return null;
1532
+ }
1533
+ /**
1534
+ * Resolve a Python qualified reference whose receiver is an imported MODULE:
1535
+ * `certs.where()` after `from . import certs`, `mod.func()` after `import mod`
1536
+ * or `from pkg import mod`. The receiver names a submodule (a file), not a
1537
+ * symbol, so the generic symbol lookup in `resolveViaImport` can't follow it —
1538
+ * it would search the *package* for `certs`/`mod` instead of looking inside the
1539
+ * module. This is the Python half of the cross-package qualified-call problem
1540
+ * (cf. `resolveGoCrossPackageReference` for Go's `pkg.Func`, issue #388).
1541
+ *
1542
+ * Builds the module's dotted import path from the binding — `from . import
1543
+ * certs` → `.certs`; `from pkg import mod` → `pkg.mod`; `import mod` → `mod` —
1544
+ * resolves it to the module file, and finds the member defined there. Returns
1545
+ * null when no module file exists at that path, so attribute access on an
1546
+ * imported *value* (`helper.attr` where `helper` is a function) falls through
1547
+ * to the other strategies untouched.
1548
+ */
1549
+ function resolvePythonModuleMember(ref, imports, context) {
1550
+ const dotIdx = ref.referenceName.indexOf('.');
1551
+ if (dotIdx <= 0)
1552
+ return null;
1553
+ const receiver = ref.referenceName.substring(0, dotIdx);
1554
+ // The immediate member of the module (first segment after the receiver).
1555
+ const member = ref.referenceName.substring(dotIdx + 1).split('.')[0];
1556
+ if (!member)
1557
+ return null;
1558
+ for (const imp of imports) {
1559
+ if (imp.localName !== receiver)
1560
+ continue;
1561
+ // `import mod` / `import numpy as np` bind the module at `source` itself;
1562
+ // `from . import certs` / `from pkg import mod` bind a SUBMODULE whose
1563
+ // dotted path is the source joined with the imported name.
1564
+ const modulePath = imp.isNamespace
1565
+ ? imp.source
1566
+ : imp.source.endsWith('.')
1567
+ ? imp.source + imp.localName
1568
+ : imp.source + '.' + imp.localName;
1569
+ // resolveImportPath only maps RELATIVE dotted paths (`.mod`, `..pkg.mod`); an
1570
+ // ABSOLUTE package path (`pkg.module` from `from pkg import module`, or a bare
1571
+ // `import pkg.mod`) resolves to null there, so fall back to the dotted-module
1572
+ // file lookup — the same asymmetry resolveModuleImportToFile already handles
1573
+ // for the file→file import edge. Without this, a `module.func()` call after
1574
+ // `from pkg import module` dropped its `calls` edge even though the import
1575
+ // edge resolved (#578).
1576
+ let resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1577
+ if (!resolvedPath) {
1578
+ resolvedPath = findPythonModuleFile(modulePath, context, ref.filePath)?.filePath ?? null;
1579
+ }
1580
+ if (!resolvedPath || resolvedPath === ref.filePath)
1581
+ continue;
1582
+ // Find the member as a top-level definition in the module file. Exclude
1583
+ // `method` so `mod.foo` never lands on a same-named class method.
1584
+ const target = context.getNodesInFile(resolvedPath).find((n) => n.name === member &&
1585
+ (n.kind === 'function' ||
1586
+ n.kind === 'class' ||
1587
+ n.kind === 'variable' ||
1588
+ n.kind === 'constant'));
1589
+ if (target) {
1590
+ return { original: ref, targetNodeId: target.id, confidence: 0.85, resolvedBy: 'import' };
1591
+ }
1592
+ }
1593
+ return null;
1594
+ }
1595
+ /**
1596
+ * Resolve a whole-MODULE import to that module's file (a file→file dependency).
1597
+ * The imported name is a module, not a symbol, so there's nothing to resolve to
1598
+ * — but importing a module IS a dependency on it. Covers:
1599
+ * - Python submodule imports — `from . import certs`, `from pkg import sub`;
1600
+ * - namespace imports — Python `import mod` / `import numpy as np`, and
1601
+ * TS/JS `import * as ns from './x'`.
1602
+ *
1603
+ * It is also the robust backstop for {@link resolvePythonModuleMember} and for
1604
+ * TS namespace usage: it records the dependency even when the used member is
1605
+ * re-exported elsewhere (requests' `certs.where`, re-exported from `certifi`),
1606
+ * the usage is module-level code that isn't extracted as a call, or a TS
1607
+ * namespace is touched only via a value-member read (`ns.SOME_CONST`).
1608
+ *
1609
+ * Only fires for dot-free `imports`-kind refs whose module path resolves to a
1610
+ * real file. A NAMED TS/JS import (`import { widget }`) is not a module, so it
1611
+ * returns null and normal symbol resolution handles it.
1612
+ */
1613
+ /**
1614
+ * Resolve a Lua/Luau `require(...)` to its module file. The reference name is
1615
+ * either a dotted module path (`telescope.config` → `telescope/config.lua`) or a
1616
+ * Roblox instance-path leaf (`Signal` from `require(script.Parent.Signal)` →
1617
+ * `Signal.luau`). We try `<path>.lua|.luau` and `<path>/init.lua|.luau`, matched
1618
+ * by path suffix (the module root — `lua/`, `src/`, … — is project-specific).
1619
+ * Among suffix matches, the one sharing the longest directory prefix with the
1620
+ * requiring file wins (instance-path requires resolve within the same package).
1621
+ */
1622
+ function resolveLuaRequire(ref, context) {
1623
+ const name = ref.referenceName;
1624
+ if (!name)
1625
+ return null;
1626
+ const base = name.includes('.') ? name.replace(/\./g, '/') : name;
1627
+ const suffixes = [`${base}.lua`, `${base}.luau`, `${base}/init.lua`, `${base}/init.luau`];
1628
+ const byBasename = luaBasenameIndex(context);
1629
+ const shared = (a, b) => {
1630
+ let i = 0;
1631
+ while (i < a.length && i < b.length && a[i] === b[i])
1632
+ i++;
1633
+ return i;
1634
+ };
1635
+ for (const suffix of suffixes) {
1636
+ // Only files sharing the suffix's basename can match — the bucket is in
1637
+ // getAllFiles() order, so this filter yields exactly what the full-list
1638
+ // scan did.
1639
+ const candidates = byBasename.get(suffix.split('/').pop() ?? '') ?? [];
1640
+ const matches = candidates.filter((f) => f === suffix || f.endsWith('/' + suffix));
1641
+ if (matches.length === 0)
1642
+ continue;
1643
+ matches.sort((x, y) => shared(y, ref.filePath) - shared(x, ref.filePath));
1644
+ const best = matches[0];
1645
+ if (best === ref.filePath)
1646
+ continue;
1647
+ const fileNode = context.getNodesInFile(best).find((n) => n.kind === 'file');
1648
+ if (fileNode) {
1649
+ // Confidence ≥ 0.9 so this deterministic path/suffix match wins over
1650
+ // name-matching, which otherwise resolves the require to the import node
1651
+ // itself (a same-name self-match).
1652
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1653
+ }
1654
+ }
1655
+ return null;
1656
+ }
1657
+ /**
1658
+ * `UploadApi.uploadARCapture()` where `UploadApi` is a NAMESPACE OBJECT — the
1659
+ * default-export façade most React Native API layers are written as:
1660
+ *
1661
+ * import { uploadARCapture } from './frames'
1662
+ * const UploadApi = { uploadARCapture, createFolder }
1663
+ * export default UploadApi
1664
+ *
1665
+ * The member is a shorthand (or `key: ident`) property whose value is a
1666
+ * binding of the object's file, not a function defined inside the literal,
1667
+ * so containment (`resolveObjectLiteralMember`) finds nothing and the call
1668
+ * landed on the constant — every cross-file caller of the API function went
1669
+ * missing. Read the literal's source, take the binding the member names, and
1670
+ * resolve it where the object's file would: a symbol declared there, else
1671
+ * through its own imports. Calls accept callable targets only.
1672
+ */
1673
+ function resolveObjectLiteralAlias(container, member, ref, context) {
1674
+ if (container.kind !== 'constant' && container.kind !== 'variable')
1675
+ return null;
1676
+ if (!JS_FAMILY_FILE.test(container.filePath))
1677
+ return null;
1678
+ if (!/^[A-Za-z_$][\w$]*$/.test(member))
1679
+ return null;
1680
+ const lines = context.getFileLines?.(container.filePath) ?? context.readFile(container.filePath)?.split('\n');
1681
+ if (!lines)
1682
+ return null;
1683
+ const extent = lines.slice(container.startLine - 1, container.endLine).join('\n');
1684
+ const brace = extent.indexOf('{');
1685
+ if (brace < 0)
1686
+ return null;
1687
+ const body = extent.slice(brace);
1688
+ const keyed = new RegExp(`[{,\\s]${member}\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[,}]`);
1689
+ const shorthand = new RegExp(`[{,\\s]${member}\\s*[,}]`);
1690
+ const k = body.match(keyed);
1691
+ const binding = k ? k[1] : shorthand.test(body) ? member : null;
1692
+ if (binding === null)
1693
+ return null;
1694
+ const callable = (n) => n.kind === 'function' || n.kind === 'method' || n.kind === 'class';
1695
+ const accepts = ref.referenceKind === 'calls'
1696
+ ? callable
1697
+ : (n) => callable(n) || n.kind === 'constant' || n.kind === 'variable' || n.kind === 'component';
1698
+ // Declared in the object's own file, outside the literal.
1699
+ const local = context
1700
+ .getNodesInFile(container.filePath)
1701
+ .filter((n) => n.name === binding && n.id !== container.id && accepts(n))
1702
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0];
1703
+ if (local)
1704
+ return { original: ref, targetNodeId: local.id, confidence: 0.9, resolvedBy: 'import' };
1705
+ // Imported into the object's file.
1706
+ for (const imp of context.getImportMappings(container.filePath, container.language)) {
1707
+ if (imp.localName !== binding || imp.isNamespace)
1708
+ continue;
1709
+ const resolvedPath = resolveImportPath(imp.source, container.filePath, container.language, context);
1710
+ if (!resolvedPath)
1711
+ continue;
1712
+ const target = findExportedSymbol(resolvedPath, {
1713
+ isDefault: imp.isDefault,
1714
+ isNamespace: false,
1715
+ exportedName: imp.isDefault ? 'default' : imp.exportedName,
1716
+ memberName: null,
1717
+ }, container.language, context, new Set());
1718
+ if (target && accepts(target)) {
1719
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1720
+ }
1721
+ }
1722
+ return null;
1723
+ }
1724
+ function resolveModuleImportToFile(ref, imports, context) {
1725
+ if (ref.referenceKind !== 'imports')
1726
+ return null;
1727
+ if (ref.referenceName.includes('.'))
1728
+ return null;
1729
+ for (const imp of imports) {
1730
+ if (imp.localName !== ref.referenceName)
1731
+ continue;
1732
+ let modulePath;
1733
+ if (imp.isNamespace || imp.isDefault) {
1734
+ // `import * as ns from './x'` (namespace) or `import x from './x'`
1735
+ // (default) — the dependency is on the MODULE FILE. A default import binds
1736
+ // a (possibly renamed) local to whatever the module's default export is
1737
+ // (`import articlesController from './article.controller'` ← `export
1738
+ // default router`), so the binding name can't be found as a symbol — link
1739
+ // the file the import resolves to instead. External modules don't resolve
1740
+ // (no file), so `import React from 'react'` creates no edge.
1741
+ modulePath = imp.source;
1742
+ }
1743
+ else if (ref.language === 'python') {
1744
+ // `from . import certs` — the imported NAME is a submodule of the source.
1745
+ modulePath = imp.source.endsWith('.')
1746
+ ? imp.source + imp.localName
1747
+ : imp.source + '.' + imp.localName;
1748
+ }
1749
+ else {
1750
+ // A named TS/JS import binds a symbol, not a module — leave it alone.
1751
+ continue;
1752
+ }
1753
+ const resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1754
+ if (resolvedPath && resolvedPath !== ref.filePath) {
1755
+ const fileNode = context.getNodesInFile(resolvedPath).find((n) => n.kind === 'file');
1756
+ if (fileNode) {
1757
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1758
+ }
1759
+ }
1760
+ // Python absolute `from a.b import submodule` (a FastAPI router aggregator's
1761
+ // `from app.api.routes import authentication`): resolveImportPath only maps
1762
+ // RELATIVE dotted paths to a file, so resolve the absolute dotted module
1763
+ // directly to its file node.
1764
+ if (ref.language === 'python') {
1765
+ const modFile = findPythonModuleFile(modulePath, context, ref.filePath);
1766
+ if (modFile) {
1767
+ return { original: ref, targetNodeId: modFile.id, confidence: 0.9, resolvedBy: 'import' };
1768
+ }
1769
+ }
1770
+ }
1771
+ return null;
1772
+ }
1773
+ /**
1774
+ * Find the file node for a Python dotted module path `a.b.c` — a module file
1775
+ * ending in `a/b/c.py`, or a package `a/b/c/__init__.py` (suffix-matched, so a
1776
+ * package rooted under `src/` etc. still resolves). Returns null for
1777
+ * stdlib/external modules (no matching repo file node), so `import os` creates
1778
+ * no edge. Shared by absolute `import a.b.c` and absolute `from a.b import c`
1779
+ * (where `c` is a submodule) resolution.
1780
+ */
1781
+ function findPythonModuleFile(mod, context, excludeFilePath) {
1782
+ if (!mod || mod.startsWith('.'))
1783
+ return null; // relative imports handled elsewhere
1784
+ const rel = mod.replace(/\./g, '/');
1785
+ const lastSeg = mod.split('.').pop();
1786
+ const endsWith = (p, want) => p === want || p.endsWith('/' + want);
1787
+ const moduleFile = context
1788
+ .getNodesByName(`${lastSeg}.py`)
1789
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}.py`));
1790
+ if (moduleFile)
1791
+ return moduleFile;
1792
+ const pkgFile = context
1793
+ .getNodesByName('__init__.py')
1794
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}/__init__.py`));
1795
+ return pkgFile ?? null;
1796
+ }
1797
+ /**
1798
+ * Resolve a Python ABSOLUTE dotted module import (`import a.b.c`) to its file —
1799
+ * the Django `AppConfig.ready(): import myapp.signals` pattern and any
1800
+ * side-effect module import.
1801
+ */
1802
+ function resolvePythonAbsoluteModule(ref, context) {
1803
+ if (ref.referenceKind !== 'imports')
1804
+ return null;
1805
+ // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1806
+ // (`from app.api.routes import authentication`) is ambiguous on its own — three
1807
+ // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1808
+ // which uses the import's source (`app.api.routes`) to build the full path.
1809
+ if (!ref.referenceName.includes('.'))
1810
+ return null;
1811
+ const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1812
+ return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1813
+ }
1814
+ /**
1815
+ * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix
1816
+ * (`A::B`) to a file and finding the leaf symbol (`C`) in it. This is the Rust
1817
+ * analog of {@link resolvePythonModuleMember} / {@link resolveGoCrossPackageReference}
1818
+ * and the precise answer to common-name re-exports (`pub use self::read::read`)
1819
+ * that name-matching can't disambiguate. Returns null when the prefix isn't a
1820
+ * real module path (e.g. `Widget::new` — `Widget` is a struct, not a module),
1821
+ * so associated-function calls and enum-variant paths fall through untouched.
1822
+ */
1823
+ function resolveRustPathReference(ref, context) {
1824
+ const segments = ref.referenceName.split('::').filter((s) => s.length > 0);
1825
+ if (segments.length < 2)
1826
+ return null;
1827
+ const leaf = segments[segments.length - 1];
1828
+ const modSegs = segments.slice(0, -1);
1829
+ const file = resolveRustModuleFile(modSegs, ref.filePath, context);
1830
+ if (!file || file === ref.filePath)
1831
+ return null;
1832
+ const target = context.getNodesInFile(file).find((n) => n.name === leaf &&
1833
+ (n.kind === 'function' ||
1834
+ n.kind === 'struct' ||
1835
+ n.kind === 'union' ||
1836
+ n.kind === 'enum' ||
1837
+ n.kind === 'trait' ||
1838
+ n.kind === 'type_alias' ||
1839
+ n.kind === 'constant' ||
1840
+ n.kind === 'method' ||
1841
+ n.kind === 'class' ||
1842
+ n.kind === 'interface'));
1843
+ if (target) {
1844
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1845
+ }
1846
+ return null;
1847
+ }
1848
+ /** The crate-root directory (holds `lib.rs`/`main.rs`), walking up from a file. */
1849
+ function rustCrateRootDir(fromFileAbs, context) {
1850
+ const projectRoot = context.getProjectRoot();
1851
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1852
+ let dir = path.dirname(fromFileAbs);
1853
+ for (let i = 0; i < 64; i++) {
1854
+ if (context.fileExists(toRel(path.join(dir, 'lib.rs'))) ||
1855
+ context.fileExists(toRel(path.join(dir, 'main.rs')))) {
1856
+ return dir;
1857
+ }
1858
+ const parent = path.dirname(dir);
1859
+ if (parent === dir)
1860
+ return null;
1861
+ dir = parent;
1862
+ }
1863
+ return null;
1864
+ }
1865
+ /** Directory under which the current file's module declares its SUBMODULES. */
1866
+ function rustSelfModuleDir(fromFileAbs) {
1867
+ const base = path.basename(fromFileAbs);
1868
+ const dir = path.dirname(fromFileAbs);
1869
+ // mod.rs / lib.rs / main.rs own their directory; `foo.rs`'s submodules live in `foo/`.
1870
+ if (base === 'mod.rs' || base === 'lib.rs' || base === 'main.rs')
1871
+ return dir;
1872
+ return path.join(dir, base.replace(/\.rs$/, ''));
1873
+ }
1874
+ /**
1875
+ * Resolve a Rust module path (segments WITHOUT the leaf symbol) to the file of
1876
+ * the last module segment — `crate::a::b` → `<crate>/a/b.rs` (or `.../b/mod.rs`).
1877
+ * Anchors on `crate` / `self` / `super`; a bare path is tried crate-relative.
1878
+ */
1879
+ function resolveRustModuleFile(segments, fromFile, context) {
1880
+ if (segments.length === 0)
1881
+ return null;
1882
+ const projectRoot = context.getProjectRoot();
1883
+ const fromAbs = path.join(projectRoot, fromFile);
1884
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1885
+ // Walk a sequence of module segments down from `startDir`, mapping each to a
1886
+ // `<seg>.rs` or `<seg>/mod.rs` file. Returns the leaf module's file, or null
1887
+ // if `startDir` is null or any segment has no file on disk.
1888
+ const resolveUnder = (startDir, rest) => {
1889
+ if (!startDir)
1890
+ return null;
1891
+ let dir = startDir;
1892
+ let targetFile = null;
1893
+ for (const seg of rest) {
1894
+ if (seg === 'self' || seg === 'crate' || seg === 'super')
1895
+ continue;
1896
+ const asFile = toRel(path.join(dir, seg + '.rs'));
1897
+ const asMod = toRel(path.join(dir, seg, 'mod.rs'));
1898
+ if (context.fileExists(asFile))
1899
+ targetFile = asFile;
1900
+ else if (context.fileExists(asMod))
1901
+ targetFile = asMod;
1902
+ else
1903
+ return null;
1904
+ dir = path.join(dir, seg);
1905
+ }
1906
+ return targetFile;
1907
+ };
1908
+ const first = segments[0];
1909
+ if (first === 'crate') {
1910
+ return resolveUnder(rustCrateRootDir(fromAbs, context), segments.slice(1));
1911
+ }
1912
+ if (first === 'self') {
1913
+ return resolveUnder(rustSelfModuleDir(fromAbs), segments.slice(1));
1914
+ }
1915
+ if (first === 'super') {
1916
+ let supers = 0;
1917
+ while (segments[supers] === 'super')
1918
+ supers++;
1919
+ let dir = rustSelfModuleDir(fromAbs);
1920
+ for (let s = 0; s < supers && dir; s++)
1921
+ dir = path.dirname(dir);
1922
+ return resolveUnder(dir, segments.slice(supers));
1923
+ }
1924
+ // Bare path. In expression position (`submodule::item()` — the router-assembly
1925
+ // and general cross-module-call pattern) the prefix is a SUBMODULE of the
1926
+ // current module, i.e. 2018 `self::`-relative — so try self-relative FIRST.
1927
+ // Fall back to crate-relative for 2015-edition / crate-root items. External
1928
+ // crate paths (`serde::de::Error`) miss both and fall through to name-matching.
1929
+ return (resolveUnder(rustSelfModuleDir(fromAbs), segments) ??
1930
+ resolveUnder(rustCrateRootDir(fromAbs, context), segments));
1931
+ }
1932
+ /**
1933
+ * Resolve a Java/Kotlin reference whose receiver is the simple name of
1934
+ * an imported FQN: `Foo.bar(...)` where `import com.example.Foo;`. The
1935
+ * imported FQN converts to a file-path suffix (`com/example/Foo.java`
1936
+ * or `.kt`) which uniquely identifies the right symbol when multiple
1937
+ * classes share the same simple name.
1938
+ *
1939
+ * Also handles bare references to the imported class itself
1940
+ * (`new Foo()` extraction emits `Foo` as a `references`/`instantiates`
1941
+ * ref) and `import static <Foo>.bar` style imports of a single member.
1942
+ */
1943
+ function resolveJavaImportedReference(ref, imports, context) {
1944
+ if (imports.length === 0)
1945
+ return null;
1946
+ const ext = ref.language === 'kotlin' ? '.kt' : '.java';
1947
+ for (const imp of imports) {
1948
+ const matchesBare = imp.localName === ref.referenceName;
1949
+ const matchesQualified = ref.referenceName.startsWith(imp.localName + '.');
1950
+ if (!matchesBare && !matchesQualified)
1951
+ continue;
1952
+ // Convert FQN to a file-path suffix. `com.example.Foo` ->
1953
+ // `com/example/Foo.java` (or `.kt`). The actual file may live
1954
+ // under any source root (`src/main/java/`, `src/`, etc.), so match
1955
+ // by suffix rather than exact path.
1956
+ const fqnPath = imp.source.replace(/\./g, '/') + ext;
1957
+ // Which symbol name to look up: the class itself, or a member.
1958
+ const memberName = matchesBare
1959
+ ? imp.localName
1960
+ : ref.referenceName.substring(imp.localName.length + 1);
1961
+ const candidates = context.getNodesByName(memberName);
1962
+ for (const node of candidates) {
1963
+ if (node.language !== ref.language)
1964
+ continue;
1965
+ const fp = node.filePath.replace(/\\/g, '/');
1966
+ if (fp.endsWith(fqnPath) || fp.endsWith('/' + fqnPath)) {
1967
+ return {
1968
+ original: ref,
1969
+ targetNodeId: node.id,
1970
+ confidence: 0.9,
1971
+ resolvedBy: 'import',
1972
+ };
1973
+ }
1974
+ }
1975
+ // `import static com.example.Foo.bar;` — the FQN's tail is the
1976
+ // member name, the part before is the owner class. Look up the
1977
+ // member named `<imp.localName>` (e.g. `bar`) and prefer the
1978
+ // candidate whose file matches the parent FQN's path.
1979
+ if (matchesBare) {
1980
+ const dot = imp.source.lastIndexOf('.');
1981
+ if (dot > 0) {
1982
+ const ownerFqn = imp.source.substring(0, dot);
1983
+ const ownerPath = ownerFqn.replace(/\./g, '/') + ext;
1984
+ for (const node of candidates) {
1985
+ if (node.language !== ref.language)
1986
+ continue;
1987
+ const fp = node.filePath.replace(/\\/g, '/');
1988
+ if (fp.endsWith(ownerPath) || fp.endsWith('/' + ownerPath)) {
1989
+ return {
1990
+ original: ref,
1991
+ targetNodeId: node.id,
1992
+ confidence: 0.9,
1993
+ resolvedBy: 'import',
1994
+ };
1995
+ }
1996
+ }
1997
+ }
1998
+ }
1999
+ }
2000
+ return null;
2001
+ }
2002
+ /**
2003
+ * Resolve a Go cross-package qualified reference (`pkga.FuncX`) by matching
2004
+ * the package alias against an in-module import, stripping the module prefix
2005
+ * to a project-relative directory, and locating the exported symbol in any
2006
+ * `.go` file under that directory. Returns `null` for stdlib / third-party
2007
+ * imports (no `go.mod`-relative match) so the rest of `resolveViaImport`
2008
+ * can still try the file-based path.
2009
+ */
2010
+ function resolveGoCrossPackageReference(ref, imports, context) {
2011
+ const mod = context.getGoModule?.();
2012
+ if (!mod)
2013
+ return null;
2014
+ // Qualified call: receiver before `.`, member after. A bare reference
2015
+ // (no dot) is a same-file/in-package call — handled elsewhere.
2016
+ const dotIdx = ref.referenceName.indexOf('.');
2017
+ if (dotIdx <= 0)
2018
+ return null;
2019
+ const receiver = ref.referenceName.substring(0, dotIdx);
2020
+ const memberName = ref.referenceName.substring(dotIdx + 1);
2021
+ if (!memberName)
2022
+ return null;
2023
+ for (const imp of imports) {
2024
+ if (imp.localName !== receiver)
2025
+ continue;
2026
+ // Only in-module imports map to a known directory.
2027
+ if (imp.source !== mod.modulePath && !imp.source.startsWith(mod.modulePath + '/')) {
2028
+ continue;
2029
+ }
2030
+ const pkgDir = imp.source === mod.modulePath
2031
+ ? ''
2032
+ : imp.source.substring(mod.modulePath.length + 1);
2033
+ // Look up the member by name and pick the candidate whose file lives
2034
+ // directly in the package directory. Match the immediate parent dir
2035
+ // exactly so a call to `pkga.FuncX` doesn't accidentally land on a
2036
+ // `FuncX` declared in `pkga/subpkg/`.
2037
+ const candidates = context.getNodesByName(memberName);
2038
+ for (const node of candidates) {
2039
+ if (node.language !== 'go')
2040
+ continue;
2041
+ if (!node.isExported)
2042
+ continue;
2043
+ const fp = node.filePath.replace(/\\/g, '/');
2044
+ const lastSlash = fp.lastIndexOf('/');
2045
+ const fileDir = lastSlash >= 0 ? fp.substring(0, lastSlash) : '';
2046
+ if (fileDir === pkgDir) {
2047
+ return {
2048
+ original: ref,
2049
+ targetNodeId: node.id,
2050
+ confidence: 0.9,
2051
+ resolvedBy: 'import',
2052
+ };
2053
+ }
2054
+ }
2055
+ }
2056
+ return null;
2057
+ }
2058
+ /** Recursive depth cap for re-export chain following. Real codebases
2059
+ * rarely chain barrels more than 2–3 deep; 8 is a generous safety
2060
+ * net that still bounds worst-case work. */
2061
+ const REEXPORT_MAX_DEPTH = 8;
2062
+ /**
2063
+ * Find an exported symbol in `filePath`, following `export { x } from
2064
+ * './other'` and `export * from './other'` chains until the original
2065
+ * declaration is reached. Cycle-safe via the `visited` set.
2066
+ *
2067
+ * Without this, every barrel-style import (`import { Foo } from
2068
+ * './index'` where `index.ts` only re-exports) used to resolve to
2069
+ * nothing — the existing code only looked for declarations IN the
2070
+ * resolved file, not declarations the file forwarded.
2071
+ */
2072
+ function findExportedSymbol(filePath, want, language, context, visited, depth = 0) {
2073
+ // Memoize fresh (top-level) lookups only: recursive re-export steps carry a
2074
+ // populated `visited` set, whose contents change the reachable answer.
2075
+ // Every ref to the same imported symbol repeats this exact walk, so the
2076
+ // top-level memo removes the re-export chase + per-file linear scans from
2077
+ // all but the first occurrence.
2078
+ if (depth === 0 && visited.size === 0) {
2079
+ let memo = exportedSymbolMemos.get(context);
2080
+ if (!memo) {
2081
+ memo = new Map();
2082
+ exportedSymbolMemos.set(context, memo);
2083
+ }
2084
+ const key = `${filePath}\0${want.isDefault ? 1 : 0}${want.isNamespace ? 1 : 0}\0${want.exportedName}\0${want.memberName ?? ''}\0${language}`;
2085
+ if (memo.has(key))
2086
+ return memo.get(key);
2087
+ const result = findExportedSymbolWalk(filePath, want, language, context, visited, depth);
2088
+ memo.set(key, result);
2089
+ return result;
2090
+ }
2091
+ return findExportedSymbolWalk(filePath, want, language, context, visited, depth);
2092
+ }
2093
+ function findExportedSymbolWalk(filePath, want, language, context, visited, depth) {
2094
+ if (depth > REEXPORT_MAX_DEPTH)
2095
+ return undefined;
2096
+ if (visited.has(filePath))
2097
+ return undefined;
2098
+ visited.add(filePath);
2099
+ const exportIndex = getFileExportIndex(filePath, context);
2100
+ // 1. Direct hit: the symbol is declared in this file.
2101
+ if (want.isDefault) {
2102
+ // Svelte/Vue single-file components ARE the module's default export,
2103
+ // but are extracted as kind 'component' (not function/class). Prefer
2104
+ // the component node; fall back to an exported function/class for the
2105
+ // `.ts`/`.tsx` `export default fn`/`class` case. Without the component
2106
+ // branch, an `export { default as X } from './X.svelte'` barrel never
2107
+ // resolves and the component shows a false 0 callers (#629).
2108
+ // A component file IS its default export; otherwise the statement that
2109
+ // names the binding beats the first-exported-function guess.
2110
+ const direct = exportIndex.defaultComponent ?? exportIndex.defaultBinding ?? exportIndex.defaultFnClass;
2111
+ if (direct)
2112
+ return direct;
2113
+ }
2114
+ else if (want.isNamespace && want.memberName) {
2115
+ const direct = exportIndex.byName.get(want.memberName);
2116
+ if (direct)
2117
+ return direct;
2118
+ }
2119
+ else {
2120
+ const direct = exportIndex.byName.get(want.exportedName);
2121
+ if (direct)
2122
+ return direct;
2123
+ }
2124
+ // 2. Re-export hit: the file forwards the symbol to another module.
2125
+ const reExports = context.getReExports?.(filePath, language) ?? [];
2126
+ if (reExports.length === 0)
2127
+ return undefined;
2128
+ // Look for explicit `export { want } from './other'` (with optional rename).
2129
+ const targetName = want.isDefault ? 'default' : want.exportedName;
2130
+ for (const rex of reExports) {
2131
+ if (rex.kind === 'named' && rex.exportedName === targetName) {
2132
+ const next = resolveImportPath(rex.source, filePath, language, context);
2133
+ if (!next)
2134
+ continue;
2135
+ // After rename: `export { foo as bar } from './x'` — to chase
2136
+ // `bar`, we look for `foo` in `./x`.
2137
+ const chained = findExportedSymbol(next, {
2138
+ isDefault: rex.originalName === 'default',
2139
+ isNamespace: false,
2140
+ exportedName: rex.originalName,
2141
+ memberName: null,
2142
+ }, language, context, visited, depth + 1);
2143
+ if (chained)
2144
+ return chained;
2145
+ }
2146
+ }
2147
+ // 3. Wildcard re-export: `export * from './other'` — try every
2148
+ // forwarding source. This is the barrel-of-barrels case.
2149
+ for (const rex of reExports) {
2150
+ if (rex.kind === 'wildcard') {
2151
+ const next = resolveImportPath(rex.source, filePath, language, context);
2152
+ if (!next)
2153
+ continue;
2154
+ const chained = findExportedSymbol(next, want, language, context, visited, depth + 1);
2155
+ if (chained)
2156
+ return chained;
2157
+ }
2158
+ }
2159
+ return undefined;
2160
+ }
2161
+ /** Node kinds that own static members reachable as `Container.member`. */
2162
+ const STATIC_MEMBER_CONTAINERS = new Set([
2163
+ 'class', 'struct', 'union', 'interface', 'enum', 'trait', 'protocol',
2164
+ ]);
2165
+ /**
2166
+ * Resolve `Container.member` — a static method/property access on a NAMED class
2167
+ * import (`import { Foo } …; Foo.bar()`) — to the member node, given the
2168
+ * already-resolved container class.
2169
+ *
2170
+ * Members carry a `Container::member` qualifiedName, so we look up
2171
+ * `${container.qualifiedName}::${member}` within the container's own file (the
2172
+ * file filter disambiguates same-named classes in other modules). Returns
2173
+ * undefined when the container isn't a member-owning kind or the member isn't
2174
+ * found, so the caller falls back to the container itself (prior behavior) —
2175
+ * languages whose members aren't `::`-qualified, and genuine class references,
2176
+ * are unaffected. See #825.
2177
+ */
2178
+ /**
2179
+ * Resolve a CALL through an imported value to the method on the value's own
2180
+ * type: `reproStore.notifyJoinGuildStatus()` where `reproStore` is
2181
+ * `export const reproStore = new ReproStore()` in the imported file (#1292).
2182
+ * The same-file form of this call already resolves via local-variable
2183
+ * receiver inference (#1108); this is the cross-file/import half. The type is
2184
+ * recovered from the VALUE'S OWN declaration lines in the exporting file
2185
+ * (initializer `= new T(...)` or a type annotation, per the shared #1108
2186
+ * pattern table), then the member is resolved AND VALIDATED on that type by
2187
+ * resolveMethodOnType — a failed inference or validation returns null so the
2188
+ * caller keeps its existing constant-edge behavior.
2189
+ */
2190
+ function resolveImportedInstanceMember(value, ref, localName, context) {
2191
+ if (ref.referenceKind !== 'calls')
2192
+ return null;
2193
+ if (value.kind !== 'constant' && value.kind !== 'variable')
2194
+ return null;
2195
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
2196
+ if (!member)
2197
+ return null;
2198
+ const source = context.readFile(value.filePath);
2199
+ if (!source)
2200
+ return null;
2201
+ // Only the value's own declaration lines — never the whole file, so a
2202
+ // same-named identifier elsewhere can't donate a type.
2203
+ const lines = source.split('\n');
2204
+ const declSlice = lines.slice(Math.max(0, value.startLine - 1), value.endLine).join('\n');
2205
+ const receiver = value.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2206
+ for (const pattern of (0, name_matcher_1.localReceiverTypePatterns)(value.language, receiver)) {
2207
+ const m = declSlice.match(pattern);
2208
+ if (!m || !m[1])
2209
+ continue;
2210
+ const typeName = (0, name_matcher_1.normalizeInferredTypeName)(m[1]);
2211
+ if (!typeName)
2212
+ continue;
2213
+ const resolved = (0, name_matcher_1.resolveMethodOnType)(typeName, member, ref, context, 0.85, 'instance-method');
2214
+ if (resolved)
2215
+ return resolved;
2216
+ }
2217
+ return null;
2218
+ }
2219
+ function resolveStaticMember(container, ref, localName, context) {
2220
+ if (!STATIC_MEMBER_CONTAINERS.has(container.kind))
2221
+ return undefined;
2222
+ // First segment after the receiver: `Foo.bar.baz` → `bar`.
2223
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
2224
+ if (!member)
2225
+ return undefined;
2226
+ const candidates = context
2227
+ .getNodesByQualifiedName(`${container.qualifiedName}::${member}`)
2228
+ .filter((n) => n.filePath === container.filePath);
2229
+ if (candidates.length === 0)
2230
+ return undefined;
2231
+ // When the reference is a call, prefer a callable member if several nodes
2232
+ // share the qualifiedName (e.g. a static property and a method).
2233
+ if (ref.referenceKind === 'calls') {
2234
+ const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function');
2235
+ if (callable)
2236
+ return callable;
2237
+ }
2238
+ return candidates[0];
2239
+ }
2240
+ //# sourceMappingURL=import-resolver.js.map