@bharanidev/bhgraph-win32-arm64 1.0.0

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