@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.4

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 (1110) hide show
  1. package/bin/codegraph +1 -1
  2. package/bin/codegraph.cmd +1 -1
  3. package/lib/dist/.test-build-engine.json +1 -1
  4. package/lib/dist/.test-build-viewer.json +1 -1
  5. package/lib/dist/bin/codegraph.d.ts +3 -0
  6. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  7. package/lib/dist/bin/codegraph.js +507 -702
  8. package/lib/dist/bin/codegraph.js.map +1 -1
  9. package/lib/dist/bin/command-supervision.js +1 -57
  10. package/lib/dist/bin/command-supervision.js.map +1 -1
  11. package/lib/dist/bin/fatal-handler.js +0 -46
  12. package/lib/dist/bin/fatal-handler.js.map +1 -1
  13. package/lib/dist/bin/node-version-check.js +0 -33
  14. package/lib/dist/bin/node-version-check.js.map +1 -1
  15. package/lib/dist/bin/uninstall.js +0 -19
  16. package/lib/dist/bin/uninstall.js.map +1 -1
  17. package/lib/dist/bin/viewer-gate.js +0 -14
  18. package/lib/dist/bin/viewer-gate.js.map +1 -1
  19. package/lib/dist/compile-cache.d.ts +2 -0
  20. package/lib/dist/compile-cache.d.ts.map +1 -0
  21. package/lib/dist/compile-cache.js +45 -0
  22. package/lib/dist/compile-cache.js.map +1 -0
  23. package/lib/dist/context/formatter.js +3 -66
  24. package/lib/dist/context/formatter.js.map +1 -1
  25. package/lib/dist/context/index.d.ts +44 -1
  26. package/lib/dist/context/index.d.ts.map +1 -1
  27. package/lib/dist/context/index.js +123 -430
  28. package/lib/dist/context/index.js.map +1 -1
  29. package/lib/dist/context/markers.js +0 -17
  30. package/lib/dist/context/markers.js.map +1 -1
  31. package/lib/dist/db/index.d.ts +44 -1
  32. package/lib/dist/db/index.d.ts.map +1 -1
  33. package/lib/dist/db/index.js +123 -395
  34. package/lib/dist/db/index.js.map +1 -1
  35. package/lib/dist/db/migrations.d.ts +11 -1
  36. package/lib/dist/db/migrations.d.ts.map +1 -1
  37. package/lib/dist/db/migrations.js +71 -79
  38. package/lib/dist/db/migrations.js.map +1 -1
  39. package/lib/dist/db/name-substring-index.d.ts +63 -0
  40. package/lib/dist/db/name-substring-index.d.ts.map +1 -0
  41. package/lib/dist/db/name-substring-index.js +151 -0
  42. package/lib/dist/db/name-substring-index.js.map +1 -0
  43. package/lib/dist/db/node-sqlite.d.ts +19 -0
  44. package/lib/dist/db/node-sqlite.d.ts.map +1 -0
  45. package/lib/dist/db/node-sqlite.js +23 -0
  46. package/lib/dist/db/node-sqlite.js.map +1 -0
  47. package/lib/dist/db/open-error.d.ts +36 -0
  48. package/lib/dist/db/open-error.d.ts.map +1 -0
  49. package/lib/dist/db/open-error.js +63 -0
  50. package/lib/dist/db/open-error.js.map +1 -0
  51. package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
  52. package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
  53. package/lib/dist/db/parameter-flow-queries.js +168 -0
  54. package/lib/dist/db/parameter-flow-queries.js.map +1 -0
  55. package/lib/dist/db/queries.d.ts +654 -34
  56. package/lib/dist/db/queries.d.ts.map +1 -1
  57. package/lib/dist/db/queries.js +1466 -1470
  58. package/lib/dist/db/queries.js.map +1 -1
  59. package/lib/dist/db/reference-tail.d.ts +83 -0
  60. package/lib/dist/db/reference-tail.d.ts.map +1 -0
  61. package/lib/dist/db/reference-tail.js +68 -0
  62. package/lib/dist/db/reference-tail.js.map +1 -0
  63. package/lib/dist/db/schema.sql +18 -2
  64. package/lib/dist/db/sqlite-adapter.d.ts +18 -1
  65. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  66. package/lib/dist/db/sqlite-adapter.js +12 -62
  67. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  68. package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
  69. package/lib/dist/db/synthesis-stage.js +2 -6
  70. package/lib/dist/db/synthesis-stage.js.map +1 -1
  71. package/lib/dist/db/wal-valve.js +1 -153
  72. package/lib/dist/db/wal-valve.js.map +1 -1
  73. package/lib/dist/db/wsl-shared-index.js +0 -37
  74. package/lib/dist/db/wsl-shared-index.js.map +1 -1
  75. package/lib/dist/directory.d.ts +51 -0
  76. package/lib/dist/directory.d.ts.map +1 -1
  77. package/lib/dist/directory.js +76 -530
  78. package/lib/dist/directory.js.map +1 -1
  79. package/lib/dist/engine.d.ts +15 -0
  80. package/lib/dist/engine.d.ts.map +1 -0
  81. package/lib/dist/engine.js +35 -0
  82. package/lib/dist/engine.js.map +1 -0
  83. package/lib/dist/errors.d.ts +10 -0
  84. package/lib/dist/errors.d.ts.map +1 -1
  85. package/lib/dist/errors.js +8 -101
  86. package/lib/dist/errors.js.map +1 -1
  87. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
  88. package/lib/dist/extraction/astro-extractor.js +11 -101
  89. package/lib/dist/extraction/astro-extractor.js.map +1 -1
  90. package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
  91. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  92. package/lib/dist/extraction/cfml-extractor.js +70 -206
  93. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  94. package/lib/dist/extraction/commonjs-requires.js +0 -31
  95. package/lib/dist/extraction/commonjs-requires.js.map +1 -1
  96. package/lib/dist/extraction/dfm-extractor.js +0 -21
  97. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  98. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  99. package/lib/dist/extraction/extraction-version.js +1 -24
  100. package/lib/dist/extraction/extraction-version.js.map +1 -1
  101. package/lib/dist/extraction/function-ref.d.ts +40 -0
  102. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  103. package/lib/dist/extraction/function-ref.js +157 -207
  104. package/lib/dist/extraction/function-ref.js.map +1 -1
  105. package/lib/dist/extraction/generated-detection.js +0 -165
  106. package/lib/dist/extraction/generated-detection.js.map +1 -1
  107. package/lib/dist/extraction/grammars.d.ts +73 -4
  108. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  109. package/lib/dist/extraction/grammars.js +160 -431
  110. package/lib/dist/extraction/grammars.js.map +1 -1
  111. package/lib/dist/extraction/index.d.ts +208 -7
  112. package/lib/dist/extraction/index.d.ts.map +1 -1
  113. package/lib/dist/extraction/index.js +594 -1383
  114. package/lib/dist/extraction/index.js.map +1 -1
  115. package/lib/dist/extraction/kernel/decode.js +0 -16
  116. package/lib/dist/extraction/kernel/decode.js.map +1 -1
  117. package/lib/dist/extraction/kernel/index.d.ts +3 -1
  118. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  119. package/lib/dist/extraction/kernel/index.js +48 -135
  120. package/lib/dist/extraction/kernel/index.js.map +1 -1
  121. package/lib/dist/extraction/kernel/layout.js +42 -76
  122. package/lib/dist/extraction/kernel/layout.js.map +1 -1
  123. package/lib/dist/extraction/kernel/loader.d.ts +5 -1
  124. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
  125. package/lib/dist/extraction/kernel/loader.js +0 -37
  126. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  127. package/lib/dist/extraction/languages/arkts.js +0 -59
  128. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  129. package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
  130. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  131. package/lib/dist/extraction/languages/c-cpp.js +789 -856
  132. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  133. package/lib/dist/extraction/languages/cfquery.js +0 -9
  134. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  135. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  136. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  137. package/lib/dist/extraction/languages/cfscript.js +80 -9
  138. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  139. package/lib/dist/extraction/languages/cobol.js +0 -114
  140. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  141. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  142. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  143. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  144. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  145. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  146. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  147. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  148. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  149. package/lib/dist/extraction/languages/csharp.js +3 -55
  150. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  151. package/lib/dist/extraction/languages/dart.d.ts +129 -0
  152. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  153. package/lib/dist/extraction/languages/dart.js +517 -162
  154. package/lib/dist/extraction/languages/dart.js.map +1 -1
  155. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  156. package/lib/dist/extraction/languages/erlang.js +15 -102
  157. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  158. package/lib/dist/extraction/languages/go.d.ts +48 -0
  159. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  160. package/lib/dist/extraction/languages/go.js +102 -31
  161. package/lib/dist/extraction/languages/go.js.map +1 -1
  162. package/lib/dist/extraction/languages/index.js +0 -6
  163. package/lib/dist/extraction/languages/index.js.map +1 -1
  164. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  165. package/lib/dist/extraction/languages/java.js +67 -78
  166. package/lib/dist/extraction/languages/java.js.map +1 -1
  167. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  168. package/lib/dist/extraction/languages/javascript.js +2 -12
  169. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  170. package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
  171. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  172. package/lib/dist/extraction/languages/kotlin.js +43 -197
  173. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  174. package/lib/dist/extraction/languages/lua.js +2 -39
  175. package/lib/dist/extraction/languages/lua.js.map +1 -1
  176. package/lib/dist/extraction/languages/luau.js +0 -14
  177. package/lib/dist/extraction/languages/luau.js.map +1 -1
  178. package/lib/dist/extraction/languages/nix.js +0 -16
  179. package/lib/dist/extraction/languages/nix.js.map +1 -1
  180. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  181. package/lib/dist/extraction/languages/objc.js +5 -16
  182. package/lib/dist/extraction/languages/objc.js.map +1 -1
  183. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  184. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  185. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  186. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  187. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  188. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  189. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  190. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  191. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  192. package/lib/dist/extraction/languages/pascal.js +3 -4
  193. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  194. package/lib/dist/extraction/languages/php.d.ts +9 -0
  195. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  196. package/lib/dist/extraction/languages/php.js +207 -44
  197. package/lib/dist/extraction/languages/php.js.map +1 -1
  198. package/lib/dist/extraction/languages/python.js +2 -20
  199. package/lib/dist/extraction/languages/python.js.map +1 -1
  200. package/lib/dist/extraction/languages/r.js +8 -78
  201. package/lib/dist/extraction/languages/r.js.map +1 -1
  202. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  203. package/lib/dist/extraction/languages/ruby.js +17 -25
  204. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  205. package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
  206. package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
  207. package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
  208. package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
  209. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  210. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  211. package/lib/dist/extraction/languages/rust.js +15 -47
  212. package/lib/dist/extraction/languages/rust.js.map +1 -1
  213. package/lib/dist/extraction/languages/scala.js +5 -41
  214. package/lib/dist/extraction/languages/scala.js.map +1 -1
  215. package/lib/dist/extraction/languages/solidity.js +1 -82
  216. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  217. package/lib/dist/extraction/languages/swift.js +3 -47
  218. package/lib/dist/extraction/languages/swift.js.map +1 -1
  219. package/lib/dist/extraction/languages/terraform.js +6 -152
  220. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  221. package/lib/dist/extraction/languages/typescript.d.ts +64 -0
  222. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  223. package/lib/dist/extraction/languages/typescript.js +73 -49
  224. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  225. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  226. package/lib/dist/extraction/languages/vbnet.js +9 -42
  227. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  228. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  229. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  230. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  231. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  232. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  233. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  234. package/lib/dist/extraction/liquid-extractor.js +89 -148
  235. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  236. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  237. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  238. package/lib/dist/extraction/parse-budget.d.ts +42 -7
  239. package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
  240. package/lib/dist/extraction/parse-budget.js +39 -15
  241. package/lib/dist/extraction/parse-budget.js.map +1 -1
  242. package/lib/dist/extraction/parse-pool.d.ts +29 -17
  243. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  244. package/lib/dist/extraction/parse-pool.js +49 -193
  245. package/lib/dist/extraction/parse-pool.js.map +1 -1
  246. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  247. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  248. package/lib/dist/extraction/parse-worker.js +5 -58
  249. package/lib/dist/extraction/parse-worker.js.map +1 -1
  250. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  251. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  252. package/lib/dist/extraction/razor-extractor.js +45 -69
  253. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  254. package/lib/dist/extraction/razor-script.d.ts +23 -0
  255. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  256. package/lib/dist/extraction/razor-script.js +244 -0
  257. package/lib/dist/extraction/razor-script.js.map +1 -0
  258. package/lib/dist/extraction/sfc-script.d.ts +42 -0
  259. package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
  260. package/lib/dist/extraction/sfc-script.js +32 -31
  261. package/lib/dist/extraction/sfc-script.js.map +1 -1
  262. package/lib/dist/extraction/store-worker.d.ts +1 -1
  263. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  264. package/lib/dist/extraction/store-worker.js +1 -38
  265. package/lib/dist/extraction/store-worker.js.map +1 -1
  266. package/lib/dist/extraction/store-writer.js +2 -34
  267. package/lib/dist/extraction/store-writer.js.map +1 -1
  268. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  269. package/lib/dist/extraction/svelte-extractor.js +11 -87
  270. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  271. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  272. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  273. package/lib/dist/extraction/syntax-tokens.js +4 -152
  274. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  275. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  276. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  277. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  278. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  279. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  280. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  281. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  282. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  283. package/lib/dist/extraction/tree-sitter.d.ts +518 -10
  284. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  285. package/lib/dist/extraction/tree-sitter.js +2118 -2554
  286. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  287. package/lib/dist/extraction/vue-extractor.d.ts +13 -0
  288. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  289. package/lib/dist/extraction/vue-extractor.js +52 -92
  290. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  291. package/lib/dist/extraction/vue-options-api.js +0 -32
  292. package/lib/dist/extraction/vue-options-api.js.map +1 -1
  293. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  294. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  295. package/lib/dist/extraction/vue-template-calls.js +497 -0
  296. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  297. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  298. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  299. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  300. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  301. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  302. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  303. package/lib/dist/extraction/wasm-runtime-flags.js +18 -89
  304. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  305. package/lib/dist/file-limits.d.ts +8 -0
  306. package/lib/dist/file-limits.d.ts.map +1 -1
  307. package/lib/dist/file-limits.js +13 -28
  308. package/lib/dist/file-limits.js.map +1 -1
  309. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  310. package/lib/dist/graph/branch-guards.js +4 -251
  311. package/lib/dist/graph/branch-guards.js.map +1 -1
  312. package/lib/dist/graph/call-sites.d.ts +12 -0
  313. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  314. package/lib/dist/graph/call-sites.js +17 -0
  315. package/lib/dist/graph/call-sites.js.map +1 -0
  316. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  317. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  318. package/lib/dist/graph/cobol-copybooks.js +45 -0
  319. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  320. package/lib/dist/graph/dead-code.d.ts +26 -4
  321. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  322. package/lib/dist/graph/dead-code.js +157 -311
  323. package/lib/dist/graph/dead-code.js.map +1 -1
  324. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  325. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  326. package/lib/dist/graph/file-cycles.d.ts +20 -0
  327. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  328. package/lib/dist/graph/file-cycles.js +79 -0
  329. package/lib/dist/graph/file-cycles.js.map +1 -0
  330. package/lib/dist/graph/file-drift.d.ts +35 -0
  331. package/lib/dist/graph/file-drift.d.ts.map +1 -0
  332. package/lib/dist/graph/file-drift.js +46 -0
  333. package/lib/dist/graph/file-drift.js.map +1 -0
  334. package/lib/dist/graph/go-package.d.ts +27 -0
  335. package/lib/dist/graph/go-package.d.ts.map +1 -0
  336. package/lib/dist/graph/go-package.js +49 -0
  337. package/lib/dist/graph/go-package.js.map +1 -0
  338. package/lib/dist/graph/index.d.ts +2 -0
  339. package/lib/dist/graph/index.d.ts.map +1 -1
  340. package/lib/dist/graph/index.js +4 -6
  341. package/lib/dist/graph/index.js.map +1 -1
  342. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  343. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  344. package/lib/dist/graph/named-symbol-flow.js +82 -223
  345. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  346. package/lib/dist/graph/owning-package.d.ts +59 -0
  347. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  348. package/lib/dist/graph/owning-package.js +120 -0
  349. package/lib/dist/graph/owning-package.js.map +1 -0
  350. package/lib/dist/graph/queries.d.ts +6 -3
  351. package/lib/dist/graph/queries.d.ts.map +1 -1
  352. package/lib/dist/graph/queries.js +4 -137
  353. package/lib/dist/graph/queries.js.map +1 -1
  354. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  355. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  356. package/lib/dist/graph/symbol-lookup.js +47 -89
  357. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  358. package/lib/dist/graph/symbol-references.d.ts +86 -0
  359. package/lib/dist/graph/symbol-references.d.ts.map +1 -0
  360. package/lib/dist/graph/symbol-references.js +304 -0
  361. package/lib/dist/graph/symbol-references.js.map +1 -0
  362. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  363. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  364. package/lib/dist/graph/synthesized-hop.js +62 -0
  365. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  366. package/lib/dist/graph/test-code.d.ts +33 -0
  367. package/lib/dist/graph/test-code.d.ts.map +1 -0
  368. package/lib/dist/graph/test-code.js +104 -0
  369. package/lib/dist/graph/test-code.js.map +1 -0
  370. package/lib/dist/graph/traversal.d.ts +31 -2
  371. package/lib/dist/graph/traversal.d.ts.map +1 -1
  372. package/lib/dist/graph/traversal.js +96 -226
  373. package/lib/dist/graph/traversal.js.map +1 -1
  374. package/lib/dist/graph/type-hierarchy.js +0 -138
  375. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  376. package/lib/dist/index.d.ts +214 -26
  377. package/lib/dist/index.d.ts.map +1 -1
  378. package/lib/dist/index.js +736 -1112
  379. package/lib/dist/index.js.map +1 -1
  380. package/lib/dist/installer/beta-signup.js +0 -39
  381. package/lib/dist/installer/beta-signup.js.map +1 -1
  382. package/lib/dist/installer/config-writer.js +0 -24
  383. package/lib/dist/installer/config-writer.js.map +1 -1
  384. package/lib/dist/installer/index.d.ts +13 -6
  385. package/lib/dist/installer/index.d.ts.map +1 -1
  386. package/lib/dist/installer/index.js +27 -160
  387. package/lib/dist/installer/index.js.map +1 -1
  388. package/lib/dist/installer/instructions-template.d.ts +16 -1
  389. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  390. package/lib/dist/installer/instructions-template.js +10 -38
  391. package/lib/dist/installer/instructions-template.js.map +1 -1
  392. package/lib/dist/installer/targets/antigravity.js +0 -113
  393. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  394. package/lib/dist/installer/targets/bob.d.ts +20 -0
  395. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  396. package/lib/dist/installer/targets/bob.js +83 -0
  397. package/lib/dist/installer/targets/bob.js.map +1 -0
  398. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  399. package/lib/dist/installer/targets/claude.js +1 -185
  400. package/lib/dist/installer/targets/claude.js.map +1 -1
  401. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  402. package/lib/dist/installer/targets/codex.js +17 -109
  403. package/lib/dist/installer/targets/codex.js.map +1 -1
  404. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  405. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  406. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  407. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  408. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  409. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  410. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  411. package/lib/dist/installer/targets/cursor.js +7 -88
  412. package/lib/dist/installer/targets/cursor.js.map +1 -1
  413. package/lib/dist/installer/targets/droid.d.ts +18 -0
  414. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/droid.js +92 -0
  416. package/lib/dist/installer/targets/droid.js.map +1 -0
  417. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  418. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  419. package/lib/dist/installer/targets/dsh.js +267 -0
  420. package/lib/dist/installer/targets/dsh.js.map +1 -0
  421. package/lib/dist/installer/targets/gemini.js +0 -37
  422. package/lib/dist/installer/targets/gemini.js.map +1 -1
  423. package/lib/dist/installer/targets/grok.d.ts +25 -0
  424. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  425. package/lib/dist/installer/targets/grok.js +96 -0
  426. package/lib/dist/installer/targets/grok.js.map +1 -0
  427. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  428. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  429. package/lib/dist/installer/targets/hermes.js +218 -214
  430. package/lib/dist/installer/targets/hermes.js.map +1 -1
  431. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  432. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  433. package/lib/dist/installer/targets/json-config.js +128 -0
  434. package/lib/dist/installer/targets/json-config.js.map +1 -0
  435. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  436. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  437. package/lib/dist/installer/targets/kimi.js +97 -0
  438. package/lib/dist/installer/targets/kimi.js.map +1 -0
  439. package/lib/dist/installer/targets/kiro.js +1 -41
  440. package/lib/dist/installer/targets/kiro.js.map +1 -1
  441. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  442. package/lib/dist/installer/targets/opencode.js +1 -103
  443. package/lib/dist/installer/targets/opencode.js.map +1 -1
  444. package/lib/dist/installer/targets/pi.d.ts +24 -0
  445. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  446. package/lib/dist/installer/targets/pi.js +100 -0
  447. package/lib/dist/installer/targets/pi.js.map +1 -0
  448. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  449. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  450. package/lib/dist/installer/targets/qoder.js +83 -0
  451. package/lib/dist/installer/targets/qoder.js.map +1 -0
  452. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  453. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  454. package/lib/dist/installer/targets/qwen.js +115 -0
  455. package/lib/dist/installer/targets/qwen.js.map +1 -0
  456. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  457. package/lib/dist/installer/targets/registry.js +18 -25
  458. package/lib/dist/installer/targets/registry.js.map +1 -1
  459. package/lib/dist/installer/targets/shared.d.ts +83 -13
  460. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  461. package/lib/dist/installer/targets/shared.js +201 -131
  462. package/lib/dist/installer/targets/shared.js.map +1 -1
  463. package/lib/dist/installer/targets/toml.d.ts +82 -6
  464. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  465. package/lib/dist/installer/targets/toml.js +318 -112
  466. package/lib/dist/installer/targets/toml.js.map +1 -1
  467. package/lib/dist/installer/targets/types.d.ts +1 -1
  468. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  469. package/lib/dist/installer/targets/types.js +0 -13
  470. package/lib/dist/installer/targets/types.js.map +1 -1
  471. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  472. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  473. package/lib/dist/installer/targets/windsurf.js +90 -0
  474. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  475. package/lib/dist/lazy-engine.d.ts +22 -0
  476. package/lib/dist/lazy-engine.d.ts.map +1 -0
  477. package/lib/dist/lazy-engine.js +16 -0
  478. package/lib/dist/lazy-engine.js.map +1 -0
  479. package/lib/dist/mcp/answer-freshness.js +0 -6
  480. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  481. package/lib/dist/mcp/daemon-manager.js +2 -23
  482. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  483. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  484. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  485. package/lib/dist/mcp/daemon-paths.js +9 -85
  486. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  487. package/lib/dist/mcp/daemon-proof.d.ts +19 -0
  488. package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
  489. package/lib/dist/mcp/daemon-proof.js +126 -0
  490. package/lib/dist/mcp/daemon-proof.js.map +1 -0
  491. package/lib/dist/mcp/daemon-registry.d.ts +47 -2
  492. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  493. package/lib/dist/mcp/daemon-registry.js +188 -139
  494. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  495. package/lib/dist/mcp/daemon.d.ts +69 -0
  496. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  497. package/lib/dist/mcp/daemon.js +186 -376
  498. package/lib/dist/mcp/daemon.js.map +1 -1
  499. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  500. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  501. package/lib/dist/mcp/early-ppid.js +0 -24
  502. package/lib/dist/mcp/early-ppid.js.map +1 -1
  503. package/lib/dist/mcp/engine.d.ts +24 -0
  504. package/lib/dist/mcp/engine.d.ts.map +1 -1
  505. package/lib/dist/mcp/engine.js +47 -152
  506. package/lib/dist/mcp/engine.js.map +1 -1
  507. package/lib/dist/mcp/explore-dedup.js +0 -108
  508. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  509. package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
  510. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
  511. package/lib/dist/mcp/explore-diagnostics.js +8 -116
  512. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  513. package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
  514. package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
  515. package/lib/dist/mcp/explore-one-symbol.js +431 -0
  516. package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
  517. package/lib/dist/mcp/explore-session-state.js +0 -129
  518. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  519. package/lib/dist/mcp/hook-client.d.ts +44 -0
  520. package/lib/dist/mcp/hook-client.d.ts.map +1 -0
  521. package/lib/dist/mcp/hook-client.js +202 -0
  522. package/lib/dist/mcp/hook-client.js.map +1 -0
  523. package/lib/dist/mcp/index-freshness-worker.js +1 -6
  524. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  525. package/lib/dist/mcp/index-freshness.js +0 -15
  526. package/lib/dist/mcp/index-freshness.js.map +1 -1
  527. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  528. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  529. package/lib/dist/mcp/index-version-warning.js +38 -0
  530. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  531. package/lib/dist/mcp/index.d.ts +29 -1
  532. package/lib/dist/mcp/index.d.ts.map +1 -1
  533. package/lib/dist/mcp/index.js +131 -300
  534. package/lib/dist/mcp/index.js.map +1 -1
  535. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  536. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  537. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  538. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  539. package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
  540. package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
  541. package/lib/dist/mcp/opencode-tool-names.js +24 -0
  542. package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
  543. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  544. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  545. package/lib/dist/mcp/process-identity.d.ts +42 -0
  546. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  547. package/lib/dist/mcp/process-identity.js +130 -0
  548. package/lib/dist/mcp/process-identity.js.map +1 -0
  549. package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
  550. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  551. package/lib/dist/mcp/project-lifecycle.js +70 -19
  552. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  553. package/lib/dist/mcp/prompt-explore.d.ts +19 -0
  554. package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
  555. package/lib/dist/mcp/prompt-explore.js +6 -0
  556. package/lib/dist/mcp/prompt-explore.js.map +1 -0
  557. package/lib/dist/mcp/proxy.d.ts +25 -7
  558. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  559. package/lib/dist/mcp/proxy.js +145 -274
  560. package/lib/dist/mcp/proxy.js.map +1 -1
  561. package/lib/dist/mcp/query-pool.d.ts +52 -3
  562. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  563. package/lib/dist/mcp/query-pool.js +114 -123
  564. package/lib/dist/mcp/query-pool.js.map +1 -1
  565. package/lib/dist/mcp/query-worker.js +24 -36
  566. package/lib/dist/mcp/query-worker.js.map +1 -1
  567. package/lib/dist/mcp/server-instructions.d.ts +18 -0
  568. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  569. package/lib/dist/mcp/server-instructions.js +12 -32
  570. package/lib/dist/mcp/server-instructions.js.map +1 -1
  571. package/lib/dist/mcp/session.d.ts +46 -0
  572. package/lib/dist/mcp/session.d.ts.map +1 -1
  573. package/lib/dist/mcp/session.js +70 -132
  574. package/lib/dist/mcp/session.js.map +1 -1
  575. package/lib/dist/mcp/startup-handshake.js +1 -48
  576. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  577. package/lib/dist/mcp/stdin-teardown.js +0 -28
  578. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  579. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  580. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  581. package/lib/dist/mcp/stdout-teardown.js +20 -0
  582. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  583. package/lib/dist/mcp/tools.d.ts +157 -18
  584. package/lib/dist/mcp/tools.d.ts.map +1 -1
  585. package/lib/dist/mcp/tools.js +797 -3621
  586. package/lib/dist/mcp/tools.js.map +1 -1
  587. package/lib/dist/mcp/transport.d.ts.map +1 -1
  588. package/lib/dist/mcp/transport.js +4 -96
  589. package/lib/dist/mcp/transport.js.map +1 -1
  590. package/lib/dist/mcp/version.d.ts +13 -1
  591. package/lib/dist/mcp/version.d.ts.map +1 -1
  592. package/lib/dist/mcp/version.js +19 -21
  593. package/lib/dist/mcp/version.js.map +1 -1
  594. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  595. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  596. package/lib/dist/mcp/writer-lock.js +49 -46
  597. package/lib/dist/mcp/writer-lock.js.map +1 -1
  598. package/lib/dist/project-config.d.ts +20 -0
  599. package/lib/dist/project-config.d.ts.map +1 -1
  600. package/lib/dist/project-config.js +31 -140
  601. package/lib/dist/project-config.js.map +1 -1
  602. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  603. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  604. package/lib/dist/resolution/alias-binding.js +7 -56
  605. package/lib/dist/resolution/alias-binding.js.map +1 -1
  606. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  607. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  608. package/lib/dist/resolution/ambient-modules.js +732 -0
  609. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  610. package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
  611. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
  612. package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
  613. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
  614. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  615. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  616. package/lib/dist/resolution/c-feature-variants.js +249 -0
  617. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  618. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  619. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  620. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  621. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  622. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  623. package/lib/dist/resolution/c-macro-renames.js +95 -0
  624. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  625. package/lib/dist/resolution/callback-synthesizer.d.ts +19 -5
  626. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  627. package/lib/dist/resolution/callback-synthesizer.js +1395 -1343
  628. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  629. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  630. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  631. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  632. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  633. package/lib/dist/resolution/cooperative-yield.js +0 -27
  634. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  635. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  636. package/lib/dist/resolution/cpp-constructor.js +15 -17
  637. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  638. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  639. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  640. package/lib/dist/resolution/cpp-includers.js +153 -0
  641. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  642. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  643. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  644. package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
  645. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  646. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  647. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  648. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  649. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  650. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  651. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  652. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  653. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  654. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  655. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  656. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  657. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  658. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  659. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  660. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  661. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  662. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  663. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  664. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  665. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  666. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  667. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  668. package/lib/dist/resolution/dart-libraries.js +721 -0
  669. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  670. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  671. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  672. package/lib/dist/resolution/dart-local-scope.js +565 -0
  673. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  674. package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
  675. package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
  676. package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
  677. package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
  678. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  679. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  680. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
  681. package/lib/dist/resolution/frameworks/angular-router.js +41 -208
  682. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
  683. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
  684. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
  685. package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
  686. package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
  687. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  688. package/lib/dist/resolution/frameworks/astro.js +4 -60
  689. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  690. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  691. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  692. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  693. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  694. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  695. package/lib/dist/resolution/frameworks/cics.js +7 -33
  696. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  698. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  699. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  700. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  701. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  702. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  703. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  704. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  705. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  706. package/lib/dist/resolution/frameworks/csharp.js +85 -102
  707. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  708. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  709. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  710. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  711. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  712. package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
  713. package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
  714. package/lib/dist/resolution/frameworks/elysia.js +683 -0
  715. package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
  716. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  717. package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
  718. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  719. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  720. package/lib/dist/resolution/frameworks/expo-router.js +9 -190
  721. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  722. package/lib/dist/resolution/frameworks/express.d.ts +48 -1
  723. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  724. package/lib/dist/resolution/frameworks/express.js +193 -199
  725. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  726. package/lib/dist/resolution/frameworks/fabric.js +1 -104
  727. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  728. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  729. package/lib/dist/resolution/frameworks/go.js +14 -43
  730. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  731. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  732. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/index.d.ts +14 -0
  734. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  735. package/lib/dist/resolution/frameworks/index.js +16 -50
  736. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  737. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  738. package/lib/dist/resolution/frameworks/java.js +203 -129
  739. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  740. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  741. package/lib/dist/resolution/frameworks/laravel.js +71 -136
  742. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  743. package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
  744. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
  745. package/lib/dist/resolution/frameworks/nestjs.js +2 -199
  746. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  747. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  748. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  749. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  750. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  751. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  752. package/lib/dist/resolution/frameworks/nextjs.js +10 -66
  753. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  754. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  755. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  756. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  757. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  758. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  759. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  760. package/lib/dist/resolution/frameworks/page-component.js +0 -14
  761. package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
  762. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  763. package/lib/dist/resolution/frameworks/play.js +26 -34
  764. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  765. package/lib/dist/resolution/frameworks/python.js +5 -102
  766. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  767. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  768. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  769. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  770. package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
  771. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  772. package/lib/dist/resolution/frameworks/react-router.js +10 -82
  773. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  774. package/lib/dist/resolution/frameworks/react.d.ts +57 -0
  775. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  776. package/lib/dist/resolution/frameworks/react.js +1449 -191
  777. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  778. package/lib/dist/resolution/frameworks/ruby.js +1 -61
  779. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  780. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  781. package/lib/dist/resolution/frameworks/rust.js +35 -56
  782. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  783. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  784. package/lib/dist/resolution/frameworks/svelte.js +7 -75
  785. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  786. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  787. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  788. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  789. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  790. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  791. package/lib/dist/resolution/frameworks/swift.js +0 -97
  792. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  793. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  794. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  795. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  796. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  797. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  798. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  799. package/lib/dist/resolution/frameworks/vue-router.js +11 -134
  800. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  801. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  802. package/lib/dist/resolution/frameworks/vue.js +42 -114
  803. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  804. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  805. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  806. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  807. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  808. package/lib/dist/resolution/go-module.d.ts +23 -7
  809. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  810. package/lib/dist/resolution/go-module.js +21 -24
  811. package/lib/dist/resolution/go-module.js.map +1 -1
  812. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  813. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  814. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  815. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  816. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  817. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  818. package/lib/dist/resolution/import-resolver.d.ts +278 -29
  819. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  820. package/lib/dist/resolution/import-resolver.js +1825 -1396
  821. package/lib/dist/resolution/import-resolver.js.map +1 -1
  822. package/lib/dist/resolution/index.d.ts +517 -6
  823. package/lib/dist/resolution/index.d.ts.map +1 -1
  824. package/lib/dist/resolution/index.js +1604 -1042
  825. package/lib/dist/resolution/index.js.map +1 -1
  826. package/lib/dist/resolution/js-builtins.d.ts +23 -0
  827. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  828. package/lib/dist/resolution/js-builtins.js +34 -14
  829. package/lib/dist/resolution/js-builtins.js.map +1 -1
  830. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  831. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  832. package/lib/dist/resolution/js-class-expressions.js +25 -0
  833. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  834. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  835. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  836. package/lib/dist/resolution/js-super-calls.js +94 -0
  837. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  838. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  839. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  840. package/lib/dist/resolution/jsx-code.js +459 -0
  841. package/lib/dist/resolution/jsx-code.js.map +1 -0
  842. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  843. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  844. package/lib/dist/resolution/lru-cache.js +43 -32
  845. package/lib/dist/resolution/lru-cache.js.map +1 -1
  846. package/lib/dist/resolution/memory-budget.js +0 -52
  847. package/lib/dist/resolution/memory-budget.js.map +1 -1
  848. package/lib/dist/resolution/module-importers.d.ts +210 -0
  849. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  850. package/lib/dist/resolution/module-importers.js +673 -0
  851. package/lib/dist/resolution/module-importers.js.map +1 -0
  852. package/lib/dist/resolution/name-matcher.d.ts +986 -7
  853. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  854. package/lib/dist/resolution/name-matcher.js +24176 -6745
  855. package/lib/dist/resolution/name-matcher.js.map +1 -1
  856. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  857. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  858. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  859. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  860. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  861. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  862. package/lib/dist/resolution/override-parameters.js +339 -0
  863. package/lib/dist/resolution/override-parameters.js.map +1 -0
  864. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  865. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  866. package/lib/dist/resolution/parameter-flow.js +474 -0
  867. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  868. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  869. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  870. package/lib/dist/resolution/pascal-scope.js +961 -0
  871. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  872. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  873. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  874. package/lib/dist/resolution/path-aliases.js +43 -110
  875. package/lib/dist/resolution/path-aliases.js.map +1 -1
  876. package/lib/dist/resolution/php-web-root.d.ts +39 -0
  877. package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
  878. package/lib/dist/resolution/php-web-root.js +141 -0
  879. package/lib/dist/resolution/php-web-root.js.map +1 -0
  880. package/lib/dist/resolution/project-scans.d.ts +38 -0
  881. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  882. package/lib/dist/resolution/project-scans.js +30 -0
  883. package/lib/dist/resolution/project-scans.js.map +1 -0
  884. package/lib/dist/resolution/python-overloads.d.ts +10 -0
  885. package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
  886. package/lib/dist/resolution/python-overloads.js +75 -0
  887. package/lib/dist/resolution/python-overloads.js.map +1 -0
  888. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  889. package/lib/dist/resolution/react-router-synthesizer.js +3 -55
  890. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  891. package/lib/dist/resolution/resolver-pool.d.ts +23 -2
  892. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  893. package/lib/dist/resolution/resolver-pool.js +43 -111
  894. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  895. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  896. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  897. package/lib/dist/resolution/resolver-worker.js +8 -37
  898. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  899. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  900. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  901. package/lib/dist/resolution/resurrect-ref.js +19 -0
  902. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  903. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  904. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  905. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  906. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  907. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  908. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  909. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  910. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  911. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  912. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  913. package/lib/dist/resolution/rust-scopes.js +730 -0
  914. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  915. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  916. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  917. package/lib/dist/resolution/shopify-themes.js +19 -0
  918. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  919. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  920. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  921. package/lib/dist/resolution/strip-comments.js +164 -119
  922. package/lib/dist/resolution/strip-comments.js.map +1 -1
  923. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  924. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  925. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  926. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  927. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  928. package/lib/dist/resolution/swift-type-visibility.js +62 -104
  929. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  930. package/lib/dist/resolution/synth-utils.js +1 -22
  931. package/lib/dist/resolution/synth-utils.js.map +1 -1
  932. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  933. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  934. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  935. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  936. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  937. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  938. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
  939. package/lib/dist/resolution/tier-synthesizer.js +35 -177
  940. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  941. package/lib/dist/resolution/type-parameters.d.ts +23 -0
  942. package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
  943. package/lib/dist/resolution/type-parameters.js +52 -54
  944. package/lib/dist/resolution/type-parameters.js.map +1 -1
  945. package/lib/dist/resolution/types.d.ts +192 -11
  946. package/lib/dist/resolution/types.d.ts.map +1 -1
  947. package/lib/dist/resolution/types.js +0 -47
  948. package/lib/dist/resolution/types.js.map +1 -1
  949. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  950. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  951. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  952. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  953. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  954. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  955. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  956. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  957. package/lib/dist/resolution/workspace-packages.js +573 -152
  958. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  959. package/lib/dist/search/identifier-segments.js +2 -93
  960. package/lib/dist/search/identifier-segments.js.map +1 -1
  961. package/lib/dist/search/query-parser.js +0 -54
  962. package/lib/dist/search/query-parser.js.map +1 -1
  963. package/lib/dist/search/query-paths.js +0 -167
  964. package/lib/dist/search/query-paths.js.map +1 -1
  965. package/lib/dist/search/query-utils.d.ts +44 -0
  966. package/lib/dist/search/query-utils.d.ts.map +1 -1
  967. package/lib/dist/search/query-utils.js +120 -198
  968. package/lib/dist/search/query-utils.js.map +1 -1
  969. package/lib/dist/sync/git-hooks.d.ts +14 -5
  970. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  971. package/lib/dist/sync/git-hooks.js +118 -65
  972. package/lib/dist/sync/git-hooks.js.map +1 -1
  973. package/lib/dist/sync/index.js +0 -14
  974. package/lib/dist/sync/index.js.map +1 -1
  975. package/lib/dist/sync/watch-policy.js +0 -45
  976. package/lib/dist/sync/watch-policy.js.map +1 -1
  977. package/lib/dist/sync/watcher.d.ts +29 -11
  978. package/lib/dist/sync/watcher.d.ts.map +1 -1
  979. package/lib/dist/sync/watcher.js +83 -487
  980. package/lib/dist/sync/watcher.js.map +1 -1
  981. package/lib/dist/sync/worktree.d.ts +7 -2
  982. package/lib/dist/sync/worktree.d.ts.map +1 -1
  983. package/lib/dist/sync/worktree.js +24 -97
  984. package/lib/dist/sync/worktree.js.map +1 -1
  985. package/lib/dist/telemetry/index.d.ts.map +1 -1
  986. package/lib/dist/telemetry/index.js +15 -135
  987. package/lib/dist/telemetry/index.js.map +1 -1
  988. package/lib/dist/types.d.ts +46 -0
  989. package/lib/dist/types.d.ts.map +1 -1
  990. package/lib/dist/types.js +15 -44
  991. package/lib/dist/types.js.map +1 -1
  992. package/lib/dist/ui/color.js +0 -19
  993. package/lib/dist/ui/color.js.map +1 -1
  994. package/lib/dist/ui/glyphs.js +2 -45
  995. package/lib/dist/ui/glyphs.js.map +1 -1
  996. package/lib/dist/ui/shimmer-progress.js +0 -21
  997. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  998. package/lib/dist/ui/shimmer-worker.js +0 -22
  999. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  1000. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  1001. package/lib/dist/ui-server/api/deadcode.js +2 -31
  1002. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  1003. package/lib/dist/ui-server/api/effects.js +0 -111
  1004. package/lib/dist/ui-server/api/effects.js.map +1 -1
  1005. package/lib/dist/ui-server/api/entrypoints.js +0 -142
  1006. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  1007. package/lib/dist/ui-server/api/events.js +0 -145
  1008. package/lib/dist/ui-server/api/events.js.map +1 -1
  1009. package/lib/dist/ui-server/api/file.js +0 -80
  1010. package/lib/dist/ui-server/api/file.js.map +1 -1
  1011. package/lib/dist/ui-server/api/filecode.js +0 -95
  1012. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  1013. package/lib/dist/ui-server/api/flow.js +0 -149
  1014. package/lib/dist/ui-server/api/flow.js.map +1 -1
  1015. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  1016. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  1017. package/lib/dist/ui-server/api/index.js +0 -88
  1018. package/lib/dist/ui-server/api/index.js.map +1 -1
  1019. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  1020. package/lib/dist/ui-server/api/map.js +4 -317
  1021. package/lib/dist/ui-server/api/map.js.map +1 -1
  1022. package/lib/dist/ui-server/api/node.js +0 -111
  1023. package/lib/dist/ui-server/api/node.js.map +1 -1
  1024. package/lib/dist/ui-server/api/nodes.js +0 -16
  1025. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  1026. package/lib/dist/ui-server/api/program.js +0 -90
  1027. package/lib/dist/ui-server/api/program.js.map +1 -1
  1028. package/lib/dist/ui-server/api/respond.js +0 -60
  1029. package/lib/dist/ui-server/api/respond.js.map +1 -1
  1030. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  1031. package/lib/dist/ui-server/api/route-roots.js +2 -44
  1032. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  1033. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  1034. package/lib/dist/ui-server/api/routes.js +4 -60
  1035. package/lib/dist/ui-server/api/routes.js.map +1 -1
  1036. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  1037. package/lib/dist/ui-server/api/screens.js +4 -174
  1038. package/lib/dist/ui-server/api/screens.js.map +1 -1
  1039. package/lib/dist/ui-server/api/search.js +0 -62
  1040. package/lib/dist/ui-server/api/search.js.map +1 -1
  1041. package/lib/dist/ui-server/api/session.js +0 -58
  1042. package/lib/dist/ui-server/api/session.js.map +1 -1
  1043. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  1044. package/lib/dist/ui-server/api/source.js +0 -161
  1045. package/lib/dist/ui-server/api/source.js.map +1 -1
  1046. package/lib/dist/ui-server/api/stats.js +0 -58
  1047. package/lib/dist/ui-server/api/stats.js.map +1 -1
  1048. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  1049. package/lib/dist/ui-server/api/steps.js +5 -381
  1050. package/lib/dist/ui-server/api/steps.js.map +1 -1
  1051. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  1052. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  1053. package/lib/dist/ui-server/api/trail-store.js +24 -106
  1054. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  1055. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  1056. package/lib/dist/ui-server/api/trails.js +19 -94
  1057. package/lib/dist/ui-server/api/trails.js.map +1 -1
  1058. package/lib/dist/ui-server/api/when.js +0 -36
  1059. package/lib/dist/ui-server/api/when.js.map +1 -1
  1060. package/lib/dist/ui-server/api/wire.js +0 -58
  1061. package/lib/dist/ui-server/api/wire.js.map +1 -1
  1062. package/lib/dist/ui-server/assets.js +0 -35
  1063. package/lib/dist/ui-server/assets.js.map +1 -1
  1064. package/lib/dist/ui-server/constants.js +0 -26
  1065. package/lib/dist/ui-server/constants.js.map +1 -1
  1066. package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
  1067. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
  1068. package/lib/dist/ui-server/highlight/index.js +1 -132
  1069. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  1070. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  1071. package/lib/dist/ui-server/highlight/languages.js +0 -31
  1072. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  1073. package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
  1074. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
  1075. package/lib/dist/ui-server/index.d.ts +25 -0
  1076. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1077. package/lib/dist/ui-server/index.js +35 -103
  1078. package/lib/dist/ui-server/index.js.map +1 -1
  1079. package/lib/dist/ui-server/open-browser.js +0 -34
  1080. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1081. package/lib/dist/ui-server/security.d.ts +5 -0
  1082. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1083. package/lib/dist/ui-server/security.js +11 -147
  1084. package/lib/dist/ui-server/security.js.map +1 -1
  1085. package/lib/dist/ui-server/static.js +0 -41
  1086. package/lib/dist/ui-server/static.js.map +1 -1
  1087. package/lib/dist/upgrade/index.d.ts +18 -5
  1088. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1089. package/lib/dist/upgrade/index.js +73 -229
  1090. package/lib/dist/upgrade/index.js.map +1 -1
  1091. package/lib/dist/upgrade/remove-binary.js +2 -67
  1092. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1093. package/lib/dist/upgrade/update-check.js +1 -81
  1094. package/lib/dist/upgrade/update-check.js.map +1 -1
  1095. package/lib/dist/utils.d.ts +69 -1
  1096. package/lib/dist/utils.d.ts.map +1 -1
  1097. package/lib/dist/utils.js +224 -266
  1098. package/lib/dist/utils.js.map +1 -1
  1099. package/lib/dist/worker-teardown.js +0 -47
  1100. package/lib/dist/worker-teardown.js.map +1 -1
  1101. package/lib/kernel/codegraph-kernel.node +2 -2
  1102. package/lib/node_modules/.package-lock.json +4 -4
  1103. package/lib/node_modules/ignore/README.md +138 -8
  1104. package/lib/node_modules/ignore/index.d.ts +56 -20
  1105. package/lib/node_modules/ignore/index.js +1033 -221
  1106. package/lib/node_modules/ignore/legacy.js +871 -178
  1107. package/lib/node_modules/ignore/package.json +10 -4
  1108. package/lib/package.json +14 -8
  1109. package/node.exe +2 -2
  1110. package/package.json +1 -1
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Reference Resolution Orchestrator
4
- *
5
- * Coordinates all reference resolution strategies.
6
- */
7
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
3
  if (k2 === undefined) k2 = k;
9
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -42,67 +37,80 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
42
37
  };
43
38
  Object.defineProperty(exports, "__esModule", { value: true });
44
39
  exports.ReferenceResolver = void 0;
40
+ exports.parseModuleConfigSnapshot = parseModuleConfigSnapshot;
41
+ exports.changedModuleConfigs = changedModuleConfigs;
42
+ exports.moduleConfigLanguages = moduleConfigLanguages;
43
+ exports.changedRoutes = changedRoutes;
45
44
  exports.createResolver = createResolver;
46
45
  const fs = __importStar(require("fs"));
47
46
  const path = __importStar(require("path"));
48
47
  const synthesis_stage_1 = require("../db/synthesis-stage");
49
48
  const types_1 = require("./types");
50
49
  const name_matcher_1 = require("./name-matcher");
50
+ const name_matcher_2 = require("./name-matcher");
51
+ const name_matcher_3 = require("./name-matcher");
51
52
  const cpp_macro_visibility_1 = require("./cpp-macro-visibility");
52
53
  const cpp_constructor_1 = require("./cpp-constructor");
54
+ const name_matcher_4 = require("./name-matcher");
55
+ const name_matcher_5 = require("./name-matcher");
56
+ const cpp_supertypes_1 = require("./cpp-supertypes");
53
57
  const swift_type_visibility_1 = require("./swift-type-visibility");
58
+ const dart_libraries_1 = require("./dart-libraries");
59
+ const vbnet_receivers_1 = require("./vbnet-receivers");
60
+ const pascal_scope_1 = require("./pascal-scope");
54
61
  const type_parameters_1 = require("./type-parameters");
62
+ const dart_local_scope_1 = require("./dart-local-scope");
63
+ const python_overloads_1 = require("./python-overloads");
64
+ const cpp_type_aliases_1 = require("./cpp-type-aliases");
65
+ const project_scans_1 = require("./project-scans");
66
+ const cpp_includers_1 = require("./cpp-includers");
67
+ const c_macro_renames_1 = require("./c-macro-renames");
68
+ const name_matcher_6 = require("./name-matcher");
69
+ const name_matcher_7 = require("./name-matcher");
70
+ const c_feature_variants_1 = require("./c-feature-variants");
71
+ const ambient_modules_1 = require("./ambient-modules");
72
+ const shopify_themes_1 = require("./shopify-themes");
73
+ const js_super_calls_1 = require("./js-super-calls");
74
+ const js_class_expressions_1 = require("./js-class-expressions");
75
+ const ruby_constant_paths_1 = require("./ruby-constant-paths");
55
76
  const import_resolver_1 = require("./import-resolver");
56
77
  const resolver_pool_1 = require("./resolver-pool");
57
78
  const alias_binding_1 = require("./alias-binding");
79
+ const cargo_workspace_1 = require("./frameworks/cargo-workspace");
58
80
  const frameworks_1 = require("./frameworks");
81
+ const package_deps_1 = require("./frameworks/package-deps");
59
82
  const callback_synthesizer_1 = require("./callback-synthesizer");
83
+ const project_config_1 = require("../project-config");
84
+ const php_web_root_1 = require("./php-web-root");
85
+ const php_1 = require("../extraction/languages/php");
60
86
  const cooperative_yield_1 = require("./cooperative-yield");
87
+ const parameter_flow_1 = require("./parameter-flow");
61
88
  const file_limits_1 = require("../file-limits");
89
+ const crypto_1 = require("crypto");
62
90
  const path_aliases_1 = require("./path-aliases");
63
91
  const go_module_1 = require("./go-module");
64
92
  const workspace_packages_1 = require("./workspace-packages");
65
93
  const errors_1 = require("../errors");
94
+ const strip_comments_1 = require("./strip-comments");
66
95
  const utils_1 = require("../utils");
96
+ const resurrect_ref_1 = require("./resurrect-ref");
67
97
  const lru_cache_1 = require("./lru-cache");
98
+ const query_utils_1 = require("../search/query-utils");
68
99
  const js_builtins_1 = require("./js-builtins");
69
100
  const module_1 = require("module");
70
101
  const jsonc_parser_1 = require("jsonc-parser");
71
102
  const NODE_BUILTINS = new Set(module_1.builtinModules);
72
- /** Node kinds that can declare supertypes (extends/implements). */
73
103
  const SUPERTYPE_BEARING_KINDS = new Set([
74
104
  'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
75
105
  ]);
76
- /**
77
- * The only edges resolving a reference reads (getSupertypes' walk). The batch
78
- * loop commits a batch that made any of these before the next batch fans out;
79
- * its other edges land while that batch resolves. A resolution strategy that
80
- * reads another edge kind must be added here.
81
- */
82
106
  const RESOLUTION_READ_EDGE_KINDS = ['implements', 'extends'];
83
- // SUPERTYPE_TARGET_KINDS (the kinds an extends/implements edge may TARGET)
84
- // lives in ./types — the name-matcher needs the same set to restrict its
85
- // candidate pool before ranking. It is deliberately wider than
86
- // SUPERTYPE_BEARING_KINDS above, which is about the DECLARING side.
87
- /**
88
- * Languages whose chained static-factory/fluent calls defer to the conformance
89
- * second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
90
- * `::`-receiver ones (Rust) via matchScopedCallChain.
91
- */
92
107
  const CHAIN_LANGUAGES = new Set(['java', 'kotlin', 'csharp', 'swift', 'rust', 'go', 'scala', 'dart', 'objc', 'pascal']);
93
108
  const SCOPED_CHAIN_LANGUAGES = new Set(['rust']);
94
- /** The extractor's chained-receiver encoding: `<inner>().<method>`. */
109
+ const JS_SELF_CALL_LANGUAGES = new Set(['typescript', 'tsx', 'javascript', 'jsx', 'vue', 'svelte', 'astro']);
95
110
  const CHAIN_SHAPE = /^(.+)\(\)\.(\w+)$/;
96
- /** PHP `$this->prop->method()` encoded as `this->prop.method` — no `()`, so CHAIN_SHAPE misses it. */
97
111
  const PHP_PROP_SHAPE = /^this->\w+\.\w+$/;
98
- /**
99
- * Cache size limits. Each per-resolver cache is bounded so memory
100
- * stays flat on large codebases (20k+ files). Sizes were chosen to
101
- * cover the working set for typical resolution batches without
102
- * exceeding a few hundred MB worst-case. Override via the env var
103
- * `CODEGRAPH_RESOLVER_CACHE_SIZE` (single integer applied to all
104
- * caches) when tuning for very large or very small projects.
105
- */
112
+ const CFML_CONSTRUCTED_CALL = /^([A-Za-z_$][\w$.-]*)\(\)\.([A-Za-z_$][\w$]*)$/;
113
+ const DEFAULT_READER_SAMPLE_FILES = 8;
106
114
  const DEFAULT_CACHE_LIMIT = 5_000;
107
115
  function resolveCacheLimit() {
108
116
  const raw = process.env.CODEGRAPH_RESOLVER_CACHE_SIZE;
@@ -113,9 +121,7 @@ function resolveCacheLimit() {
113
121
  return parsed;
114
122
  return DEFAULT_CACHE_LIMIT;
115
123
  }
116
- // Re-export types
117
124
  __exportStar(require("./types"), exports);
118
- // Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
119
125
  const REACT_HOOKS = new Set([
120
126
  'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
121
127
  'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
@@ -125,6 +131,30 @@ const PYTHON_BUILT_INS = new Set([
125
131
  'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
126
132
  'super', 'self', 'cls', 'None', 'True', 'False',
127
133
  ]);
134
+ const PYTHON_BUILTIN_NAMES = new Set([
135
+ 'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes',
136
+ 'callable', 'chr', 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate',
137
+ 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
138
+ 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'map', 'max',
139
+ 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr',
140
+ 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
141
+ 'type', 'vars', 'zip', '__import__', 'Ellipsis', 'NotImplemented', 'exit', 'quit', 'copyright', 'credits',
142
+ 'license',
143
+ 'BaseException', 'BaseExceptionGroup', 'Exception', 'ExceptionGroup', 'GeneratorExit', 'KeyboardInterrupt',
144
+ 'SystemExit', 'ArithmeticError', 'FloatingPointError', 'OverflowError', 'ZeroDivisionError', 'AssertionError',
145
+ 'AttributeError', 'BufferError', 'EOFError', 'ImportError', 'ModuleNotFoundError', 'LookupError', 'IndexError',
146
+ 'KeyError', 'MemoryError', 'NameError', 'UnboundLocalError', 'OSError', 'EnvironmentError', 'IOError',
147
+ 'WindowsError', 'BlockingIOError', 'ChildProcessError', 'ConnectionError', 'BrokenPipeError',
148
+ 'ConnectionAbortedError', 'ConnectionRefusedError', 'ConnectionResetError', 'FileExistsError',
149
+ 'FileNotFoundError', 'InterruptedError', 'IsADirectoryError', 'NotADirectoryError', 'PermissionError',
150
+ 'ProcessLookupError', 'TimeoutError', 'ReferenceError', 'RuntimeError', 'NotImplementedError',
151
+ 'PythonFinalizationError', 'RecursionError', 'StopAsyncIteration', 'StopIteration', 'SyntaxError',
152
+ 'IndentationError', 'TabError', 'SystemError', 'TypeError', 'ValueError', 'UnicodeError',
153
+ 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeTranslateError',
154
+ 'Warning', 'BytesWarning', 'DeprecationWarning', 'EncodingWarning', 'FutureWarning', 'ImportWarning',
155
+ 'PendingDeprecationWarning', 'ResourceWarning', 'RuntimeWarning', 'SyntaxWarning', 'UnicodeWarning',
156
+ 'UserWarning',
157
+ ]);
128
158
  const PYTHON_BUILT_IN_TYPES = new Set([
129
159
  'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
130
160
  'bytes', 'bytearray', 'frozenset', 'object', 'super',
@@ -138,19 +168,6 @@ const PYTHON_BUILT_IN_METHODS = new Set([
138
168
  'format', 'isdigit', 'isalpha', 'isalnum',
139
169
  'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
140
170
  ]);
141
- const GO_STDLIB_PACKAGES = new Set([
142
- 'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
143
- 'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
144
- 'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
145
- 'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
146
- 'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
147
- 'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
148
- 'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
149
- 'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
150
- 'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
151
- // Kubernetes-common stdlib aliases
152
- 'utilruntime', 'utilwait', 'utilnet',
153
- ]);
154
171
  const GO_BUILT_INS = new Set([
155
172
  'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
156
173
  'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
@@ -160,6 +177,8 @@ const GO_BUILT_INS = new Set([
160
177
  'float32', 'float64', 'complex64', 'complex128',
161
178
  'string', 'bool', 'byte', 'rune', 'any',
162
179
  ]);
180
+ const PASCAL_CAST_TARGET_KINDS = new Set(['class', 'struct', 'interface', 'enum', 'type_alias']);
181
+ const TYPE_COMPANION_VALUE_KINDS = new Set(['function', 'class', 'component', 'constant', 'variable']);
163
182
  const PASCAL_UNIT_PREFIXES = [
164
183
  'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
165
184
  'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
@@ -183,9 +202,8 @@ const PASCAL_BUILT_INS = new Set([
183
202
  'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
184
203
  'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
185
204
  'IInterface', 'IUnknown',
186
- ]);
205
+ ].map((name) => name.toLowerCase()));
187
206
  const C_BUILT_INS = new Set([
188
- // Standard C library functions
189
207
  'printf', 'fprintf', 'sprintf', 'snprintf', 'scanf', 'fscanf', 'sscanf',
190
208
  'malloc', 'calloc', 'realloc', 'free',
191
209
  'memcpy', 'memmove', 'memset', 'memcmp', 'memchr',
@@ -209,123 +227,173 @@ const C_BUILT_INS = new Set([
209
227
  'int8_t', 'int16_t', 'int32_t', 'int64_t',
210
228
  'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
211
229
  'FILE',
212
- // POSIX additions commonly seen
213
230
  'stat', 'lstat', 'fstat', 'open', 'close', 'read', 'write', 'pipe',
214
231
  'fork', 'exec', 'waitpid', 'getpid', 'getppid', 'kill', 'sleep', 'usleep',
215
232
  'pthread_create', 'pthread_join', 'pthread_mutex_lock', 'pthread_mutex_unlock',
216
233
  'dlopen', 'dlsym', 'dlclose',
217
234
  ]);
218
235
  const CPP_BUILT_INS = new Set([
219
- // iostream objects (often used without std:: prefix via using)
220
236
  'cout', 'cin', 'cerr', 'clog', 'endl', 'flush', 'ws',
221
- 'std', // the namespace itself when used as std::something
222
- // Common C++ keywords that leak as references
237
+ 'std',
223
238
  'nullptr', 'true', 'false', 'this', 'sizeof', 'alignof', 'typeid',
224
239
  'static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast',
225
240
  'make_unique', 'make_shared', 'make_pair',
226
241
  'move', 'forward', 'swap',
227
242
  ]);
228
- /**
229
- * Reference Resolver
230
- *
231
- * Orchestrates reference resolution using multiple strategies.
232
- */
243
+ const MODULE_CONFIG_ROOT_FILES = ['tsconfig.json', 'jsconfig.json', 'tsconfig.base.json', 'go.mod', 'Cargo.toml', ...import_resolver_1.CPP_COMPILE_DB_FILES, project_config_1.PROJECT_CONFIG_FILENAME];
244
+ function parseModuleConfigSnapshot(stored) {
245
+ if (!stored)
246
+ return {};
247
+ try {
248
+ const parsed = JSON.parse(stored);
249
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
250
+ return {};
251
+ return Object.fromEntries(Object.entries(parsed).filter(([, v]) => typeof v === 'string'));
252
+ }
253
+ catch {
254
+ return {};
255
+ }
256
+ }
257
+ function moduleConfigSnapshot(projectRoot, files, previous) {
258
+ const snapshot = {};
259
+ for (const abs of files) {
260
+ const rel = path.relative(projectRoot, abs).replace(/\\/g, '/');
261
+ snapshot[rel] = moduleConfigEntry(abs, previous[rel], projectRoot);
262
+ }
263
+ return snapshot;
264
+ }
265
+ function moduleConfigEntry(abs, previous, projectRoot) {
266
+ let stat;
267
+ try {
268
+ stat = fs.statSync(abs, { throwIfNoEntry: false });
269
+ }
270
+ catch { }
271
+ if (!stat?.isFile())
272
+ return 'absent';
273
+ const stamp = `${stat.mtimeMs}:${stat.size}`;
274
+ return previous?.endsWith(`@${stamp}`) ? previous : `${moduleConfigDigest(abs, projectRoot)}@${stamp}`;
275
+ }
276
+ function moduleConfigDigest(abs, projectRoot) {
277
+ const file = path.basename(abs);
278
+ if (file === project_config_1.PROJECT_CONFIG_FILENAME) {
279
+ const webRoot = (0, project_config_1.loadWebRoot)(path.dirname(abs));
280
+ return webRoot === null ? 'absent' : (0, crypto_1.createHash)('sha256').update(`webRoot=${webRoot}`).digest('hex').slice(0, 16);
281
+ }
282
+ const read = file === 'go.mod' ? (0, go_module_1.loadGoModule)(path.dirname(abs))?.modulePath ?? ''
283
+ : file === 'Cargo.toml' ? cargoManifestDigestText(abs)
284
+ : file === 'compile_commands.json' ? ((0, import_resolver_1.readCompileDbIncludeDirs)(abs, projectRoot) ?? []).join('\n')
285
+ : file === 'package.json' ? packageJsonMainOf(abs)
286
+ : (0, path_aliases_1.aliasConfigFields)(abs) ?? '';
287
+ return (0, crypto_1.createHash)('sha256').update(read).digest('hex').slice(0, 16);
288
+ }
289
+ function readPackageJson(abs) {
290
+ try {
291
+ const text = (0, file_limits_1.readSourceText)(abs);
292
+ if (text === null)
293
+ return null;
294
+ const json = JSON.parse(text.replace(/^\uFEFF/, ''));
295
+ return json && typeof json === 'object' && !Array.isArray(json) ? json : null;
296
+ }
297
+ catch {
298
+ return null;
299
+ }
300
+ }
301
+ const LOCAL_DEPENDENCY_SPEC = /^(?:(?:workspace|file|link|portal):|\.{1,2}\/|~\/|\/)/;
302
+ function packageJsonMainOf(abs) {
303
+ try {
304
+ return (0, import_resolver_1.packageJsonMain)(fs.readFileSync(abs, 'utf-8')) ?? '';
305
+ }
306
+ catch {
307
+ return '';
308
+ }
309
+ }
310
+ function cargoManifestDigestText(abs) {
311
+ try {
312
+ return (0, name_matcher_1.cargoManifestFields)(fs.readFileSync(abs, 'utf-8'));
313
+ }
314
+ catch {
315
+ return '';
316
+ }
317
+ }
318
+ function changedModuleConfigs(was, now) {
319
+ const digest = (entry) => entry.split('@')[0];
320
+ const buildFilesKnown = 'Cargo.toml' in was;
321
+ return Object.keys(now).filter((rel) => (buildFilesKnown || !/(?:^|\/)(?:Cargo\.toml|compile_commands\.json)$/.test(rel)) &&
322
+ digest(was[rel] ?? 'absent') !== digest(now[rel]));
323
+ }
324
+ function moduleConfigLanguages(changed) {
325
+ const languages = new Set();
326
+ for (const rel of changed) {
327
+ if (/(?:^|\/)go\.mod$/.test(rel))
328
+ languages.add('go');
329
+ else if (rel === project_config_1.PROJECT_CONFIG_FILENAME)
330
+ languages.add('php');
331
+ else if (/(?:^|\/)Cargo\.toml$/.test(rel))
332
+ languages.add('rust');
333
+ else if (/(?:^|\/)compile_commands\.json$/.test(rel))
334
+ for (const language of ['c', 'cpp'])
335
+ languages.add(language);
336
+ else
337
+ for (const language of import_resolver_1.ESM_IMPORT_LANGUAGES)
338
+ languages.add(language);
339
+ }
340
+ return languages;
341
+ }
233
342
  class ReferenceResolver {
234
343
  projectRoot;
235
344
  queries;
236
345
  context;
237
346
  frameworks = [];
238
- // Chained static-factory/fluent call refs the first pass couldn't resolve,
239
- // collected in-memory and left pending in the DB until the post-pass
240
- // finishes, so a restart can recover the queue (#1577). Drained by
241
- // resolveChainedCallsViaConformance
242
- // once implements/extends edges exist, to resolve methods on a supertype the
243
- // receiver conforms to (#750).
347
+ frameworksByLanguage = new Map();
244
348
  deferredChainRefs = [];
245
- // `this.<member>` function-as-value refs whose member is NOT on the
246
- // enclosing class itself — possibly inherited. Collected in-memory for the
247
- // same reason as deferredChainRefs and drained by
248
- // resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
249
349
  deferredThisMemberRefs = [];
250
350
  deferredRowIds = new Set();
251
- // Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
252
- // `_Imports.razor`, cascading to the project root). Used to disambiguate a
253
- // markup type ref to the right C# namespace.
254
351
  razorUsingsCache = new Map();
255
- // All per-resolver caches are LRU-bounded. Previously these were
256
- // unbounded Maps that grew with every distinct lookup and OOM'd on
257
- // codebases with 20k+ files (see issue: unbounded cache growth).
258
- nodeCache; // per-file node cache
259
- fileCache; // per-file content cache
352
+ nodeCache;
353
+ fileCache;
260
354
  importMappingCache;
261
355
  reExportCache;
262
- nameCache; // name → nodes cache
263
- lowerNameCache; // lower(name) → nodes cache
264
- qualifiedNameCache; // qualified_name → nodes cache
265
- fileLinesCache; // file → split lines cache
266
- // id → node for the resolver's own point reads. Every resolved reference
267
- // re-reads its target a few times (kind gate, language gate, alias
268
- // following, edge creation) and targets recur ~5× on large repos; the query
269
- // layer's cache is too small for that working set. Same stable window as the
270
- // name caches above; absent ids are not cached.
356
+ nameCache;
357
+ lowerNameCache;
358
+ qualifiedNameCache;
359
+ fileLinesCache;
271
360
  nodeByIdCache;
272
- methodMatchCache; // lang\0Type::method → matching method nodes
273
- // Per-(language, methodName) owner index for getMethodMatches: buckets a
274
- // method name's candidates by their qualifiedName's last two segments so a
275
- // (type, method) query is a lookup instead of an O(candidates) filter per
276
- // methodMatchCache miss. Derived purely from node rows (stable through the
277
- // resolution loop, same window nameCache relies on); dropped in clearCaches.
361
+ methodMatchCache;
278
362
  methodOwnerIndexCache = new Map();
279
- // Generation-tagged memo for getSupertypes. Supertype edges GROW during the
280
- // resolution loop (batch k persists its implements/extends edges BEFORE
281
- // batch k+1 fans out — the #1320 ordering), so a plain cache would freeze an
282
- // early batch's emptier answer and change later batches' outcomes. Within
283
- // one batch the edge state is fixed by that same ordering, so entries are
284
- // tagged with a generation that advances at every batch entry point
285
- // (resolveBatchYielding / resolveListForAdmission) — a stale-gen entry is
286
- // recomputed, making the memo behavior-identical to no memo at every point
287
- // in time. On the Swift compiler the unmemoized walk ran 971k times for
288
- // 565s of combined worker time (~581µs each, recursion-multiplied).
289
363
  supertypeGen = 0;
290
364
  supertypeMemo = new Map();
291
- /** Invalidate the getSupertypes memo — call when resolved edges may have advanced. */
365
+ supertypeNodeMemo = new Map();
366
+ superclassNodeMemo = new Map();
292
367
  advanceSupertypeGeneration() {
293
368
  this.supertypeGen++;
294
- // Lazy invalidation via the gen tag; bound the map so a long run over many
295
- // batches doesn't accrete dead entries.
296
369
  if (this.supertypeMemo.size > 50_000)
297
370
  this.supertypeMemo.clear();
371
+ if (this.supertypeNodeMemo.size > 50_000)
372
+ this.supertypeNodeMemo.clear();
373
+ if (this.superclassNodeMemo.size > 50_000)
374
+ this.superclassNodeMemo.clear();
298
375
  }
299
- // Node kinds are a small fixed set (~24), so this is a plain Map, not an LRU.
300
- // getNodesByKind returns the FULL node list for a kind; it was previously
301
- // uncached — a per-ref `SELECT * FROM nodes WHERE kind=?` + row-mapping. Called
302
- // for every dotted call ref by the Spring resolver (constants) and every
303
- // `hook_` ref by the Drupal resolver (functions), that scan dominated
304
- // resolution on large repos (#1180). The node set is stable within a
305
- // resolution pass (same lifetime assumption as nameCache); clearCaches() resets
306
- // it between passes. Callers must treat the returned array as read-only.
307
376
  nodesByKindCache = new Map();
308
- // Filesystem existence probes behind context.fileExists (paths not in knownFiles).
309
377
  fileExistsMemo = new Map();
310
- knownNames = null; // all known symbol names for fast pre-filtering
378
+ knownNames = null;
311
379
  knownFiles = null;
312
380
  cachesWarmed = false;
313
- // tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
314
- // `null` = computed and absent. Treated as immutable for the
315
- // resolver's lifetime; callers re-create the resolver if config changes.
316
381
  projectAliases = undefined;
317
- // Per directory: the aliases of the nearest non-root tsconfig declaring `paths`.
318
382
  dirAliases = new Map();
319
- // go.mod module path. Same lazy/immutable convention as projectAliases.
320
- goModule = undefined;
321
- // Monorepo workspace member packages. Same lazy/immutable convention.
383
+ phpWebRoots = null;
384
+ cargoCrates = undefined;
385
+ compileDbIncludeDirs = undefined;
386
+ layoutIncludeDirs = undefined;
387
+ goModuleByDir = new Map();
388
+ goModules = null;
389
+ goPackageDirs = new Map();
322
390
  workspacePackages = undefined;
391
+ workspaceDiscovery = null;
392
+ moduleConfigFiles = new Set();
323
393
  constructor(projectRoot, queries) {
324
394
  this.projectRoot = projectRoot;
325
395
  this.queries = queries;
326
396
  const limit = resolveCacheLimit();
327
- // The content cache is heavier (full file text), so we give it a
328
- // smaller budget than the metadata caches.
329
397
  const contentLimit = Math.max(64, Math.floor(limit / 5));
330
398
  this.nodeCache = new lru_cache_1.LRUCache(limit);
331
399
  this.fileCache = new lru_cache_1.LRUCache(contentLimit);
@@ -334,28 +402,31 @@ class ReferenceResolver {
334
402
  this.nameCache = new lru_cache_1.LRUCache(limit);
335
403
  this.lowerNameCache = new lru_cache_1.LRUCache(limit);
336
404
  this.qualifiedNameCache = new lru_cache_1.LRUCache(limit);
337
- // Split-lines arrays are heavier than content strings; refs arrive
338
- // file-ordered, so a small cache still hits nearly always.
339
405
  this.fileLinesCache = new lru_cache_1.LRUCache(contentLimit);
340
406
  this.nodeByIdCache = new lru_cache_1.LRUCache(Math.max(limit * 4, 20_000));
341
407
  this.methodMatchCache = new lru_cache_1.LRUCache(limit);
342
408
  this.context = this.createContext();
343
409
  }
344
- /**
345
- * Initialize the resolver (detect frameworks, etc.)
346
- */
347
- initialize() {
348
- this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
410
+ initialize(frameworks) {
411
+ this.workspacePackages = undefined;
412
+ this.workspaceDiscovery = null;
413
+ this.cargoCrates = undefined;
414
+ this.compileDbIncludeDirs = undefined;
415
+ this.layoutIncludeDirs = undefined;
349
416
  this.clearCaches();
417
+ this.frameworks = frameworks
418
+ ? (0, frameworks_1.getAllFrameworkResolvers)().filter((f) => frameworks.includes(f.name))
419
+ : (0, frameworks_1.detectFrameworks)(this.context);
420
+ this.frameworksByLanguage.clear();
421
+ }
422
+ frameworksFor(language) {
423
+ let frameworks = this.frameworksByLanguage.get(language);
424
+ if (!frameworks) {
425
+ frameworks = (0, frameworks_1.getResolvingFrameworks)(this.frameworks, language);
426
+ this.frameworksByLanguage.set(language, frameworks);
427
+ }
428
+ return frameworks;
350
429
  }
351
- /**
352
- * Run each framework resolver's cross-file finalization pass and persist
353
- * the returned node updates. Idempotent — safe to call after every indexAll
354
- * and every incremental sync. Returns the number of nodes updated.
355
- *
356
- * Caches are cleared before/after so the post-extract pass sees fresh DB
357
- * state and downstream queries see the updated names.
358
- */
359
430
  runPostExtract() {
360
431
  let updated = 0;
361
432
  this.clearCaches();
@@ -375,33 +446,91 @@ class ReferenceResolver {
375
446
  });
376
447
  }
377
448
  }
449
+ for (const fw of this.frameworks) {
450
+ if (!fw.crossFileNodes)
451
+ continue;
452
+ try {
453
+ updated += this.reconcileCrossFileNodes(fw.crossFileNodes(this.context));
454
+ }
455
+ catch (err) {
456
+ (0, errors_1.logDebug)(`Framework '${fw.name}' crossFileNodes failed`, {
457
+ error: err instanceof Error ? err.message : String(err),
458
+ });
459
+ }
460
+ }
378
461
  if (updated > 0)
379
462
  this.clearCaches();
380
463
  return updated;
381
464
  }
382
- /**
383
- * Pre-build lightweight caches for resolution.
384
- * Node lookups are now handled by indexed SQLite queries instead of
385
- * loading all nodes into memory (which caused OOM on large codebases).
386
- * We cache the set of known symbol names for fast pre-filtering.
387
- */
465
+ reconcileCrossFileNodes(result) {
466
+ const wanted = new Map();
467
+ for (const node of result.nodes)
468
+ if (result.owns(node))
469
+ wanted.set(node.id, node);
470
+ const existing = new Map();
471
+ for (const node of this.queries.getNodesByKind(result.kind))
472
+ if (result.owns(node))
473
+ existing.set(node.id, node);
474
+ let changed = 0;
475
+ for (const [id, old] of existing) {
476
+ if (wanted.has(id))
477
+ continue;
478
+ const refs = this.queries.getCrossFileIncomingEdgesWithTarget(old.filePath)
479
+ .filter((e) => e.target === id)
480
+ .map((e) => (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(e))
481
+ .filter((r) => r !== null);
482
+ if (refs.length > 0)
483
+ this.queries.insertUnresolvedRefsBatch(refs);
484
+ this.queries.deleteNode(id);
485
+ changed++;
486
+ }
487
+ const added = [];
488
+ for (const [id, node] of wanted) {
489
+ const old = existing.get(id);
490
+ if (!old)
491
+ added.push(node);
492
+ else if (old.name !== node.name || old.qualifiedName !== node.qualifiedName) {
493
+ this.queries.updateNode(node);
494
+ changed++;
495
+ }
496
+ }
497
+ if (added.length > 0) {
498
+ this.queries.insertNodes(added);
499
+ const ids = new Set(added.map((n) => n.id));
500
+ this.queries.insertUnresolvedRefsBatch(result.references.filter((r) => ids.has(r.fromNodeId)));
501
+ changed += added.length;
502
+ }
503
+ return changed;
504
+ }
505
+ reopenRouteModuleReaders(changedFilePaths) {
506
+ const readers = this.frameworks.filter((f) => f.lazyModules);
507
+ if (readers.length === 0 || changedFilePaths.length === 0)
508
+ return 0;
509
+ const changed = new Set(changedFilePaths);
510
+ const edgeIds = [];
511
+ const refs = [];
512
+ for (const edge of this.queries.getRouteEdgesMovedBy(changedFilePaths)) {
513
+ const ref = (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(edge);
514
+ if (!ref)
515
+ continue;
516
+ const asked = { ...ref, filePath: edge.sourceFilePath, language: edge.sourceLanguage };
517
+ const reads = readers.some((f) => f.lazyModules(asked, this.context).some((file) => changed.has(file)));
518
+ if (!reads)
519
+ continue;
520
+ edgeIds.push(edge.edgeId);
521
+ refs.push(ref);
522
+ }
523
+ if (refs.length > 0)
524
+ this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
525
+ return refs.length;
526
+ }
388
527
  warmCaches() {
389
528
  if (this.cachesWarmed)
390
529
  return;
391
- // Only cache the set of known file paths (lightweight string set)
392
530
  this.knownFiles = new Set(this.queries.getAllFilePaths());
393
- // Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
394
531
  this.knownNames = new Set(this.queries.getAllNodeNames());
395
532
  this.cachesWarmed = true;
396
533
  }
397
- /**
398
- * warmCaches for the async resolution entry points: streams the distinct
399
- * name set with periodic yields instead of one synchronous `.all()`. On a
400
- * multi-million-node index the DISTINCT scan is a solid multi-second block
401
- * (measured up to 28s inside `codegraph sync` on the Linux kernel index),
402
- * long enough to matter to the #850 watchdog on slower hardware. Same
403
- * result, same memory — only the event loop keeps turning.
404
- */
405
534
  async warmCachesYielding(onYield) {
406
535
  if (this.cachesWarmed)
407
536
  return;
@@ -416,7 +545,12 @@ class ReferenceResolver {
416
545
  this.knownNames = names;
417
546
  this.cachesWarmed = true;
418
547
  }
419
- /** `queries.getNodeById` through the resolver's own id → node cache. */
548
+ projectScans() {
549
+ return (0, project_scans_1.readProjectScans)(this.context, this.queries, this.fileExistsMemo);
550
+ }
551
+ adoptProjectScans(scans) {
552
+ (0, project_scans_1.adoptProjectScans)(this.context, scans, this.fileExistsMemo);
553
+ }
420
554
  nodeById(id) {
421
555
  const cached = this.nodeByIdCache.get(id);
422
556
  if (cached !== undefined)
@@ -426,10 +560,14 @@ class ReferenceResolver {
426
560
  this.nodeByIdCache.set(id, node);
427
561
  return node;
428
562
  }
429
- /**
430
- * Clear internal caches
431
- */
432
563
  clearCaches() {
564
+ this.mocklessContext = null;
565
+ this.mocklessBase = null;
566
+ this.manualMocks = undefined;
567
+ this.classExpressionFreeViews = new WeakMap();
568
+ this.classExpressionFreeBases = new WeakMap();
569
+ this.classExpressionIndex = undefined;
570
+ this.classExpressionOnlyNameSet = null;
433
571
  this.nodeCache.clear();
434
572
  this.fileCache.clear();
435
573
  this.importMappingCache.clear();
@@ -442,40 +580,91 @@ class ReferenceResolver {
442
580
  this.methodMatchCache.clear();
443
581
  this.methodOwnerIndexCache.clear();
444
582
  this.supertypeMemo.clear();
583
+ this.supertypeNodeMemo.clear();
584
+ this.superclassNodeMemo.clear();
445
585
  this.supertypeGen++;
446
586
  this.nodesByKindCache.clear();
447
587
  this.fileExistsMemo.clear();
448
588
  this.manifestScopes.clear();
589
+ this.installedPackages.clear();
590
+ this.directoryListings.clear();
591
+ this.searchedModules.clear();
592
+ this.realModulesDirs.clear();
593
+ this.ownPackageNames = null;
594
+ this.phpWebRoots = null;
595
+ this.installedNames.clear();
449
596
  this.knownNames = null;
450
597
  this.knownLowerNames = null;
451
598
  this.knownFiles = null;
599
+ this.goModules = null;
600
+ this.goPackageDirs.clear();
452
601
  this.cachesWarmed = false;
453
- // The import-resolver's and name-matcher's per-context memos assume the
454
- // same stable window as the caches above — drop them together.
602
+ this.pythonFileBindings = null;
455
603
  if (this.context) {
456
604
  (0, import_resolver_1.clearImportResolverMemos)(this.context);
457
605
  (0, name_matcher_1.clearNameMatcherMemos)(this.context);
606
+ (0, ruby_constant_paths_1.clearRubyConstantPathMemos)(this.context);
458
607
  (0, cpp_macro_visibility_1.clearCppMacroVisibility)(this.context);
459
608
  (0, swift_type_visibility_1.clearSwiftTypeVisibility)(this.context);
609
+ (0, dart_libraries_1.clearDartLibraryMemos)(this.context);
610
+ (0, vbnet_receivers_1.clearVbnetReceiverMemos)(this.context);
611
+ (0, pascal_scope_1.clearPascalScopeMemos)(this.context);
460
612
  (0, type_parameters_1.clearTypeParameterMemos)(this.context);
613
+ (0, dart_local_scope_1.clearDartLocalScopeMemos)(this.context);
614
+ (0, cpp_type_aliases_1.clearCppTypeAliasMemos)(this.context);
615
+ (0, cpp_supertypes_1.clearCppSupertypeMemos)(this.context);
616
+ (0, cpp_includers_1.clearCppIncluderMemos)(this.context);
617
+ (0, c_macro_renames_1.clearCMacroRenames)(this.context);
618
+ (0, c_feature_variants_1.clearCFeatureVariantMemos)(this.context);
619
+ (0, ambient_modules_1.clearAmbientModuleMemos)(this.context);
620
+ (0, python_overloads_1.clearPythonOverloadMemos)(this.context);
621
+ (0, package_deps_1.clearDeclaredDependencies)(this.context);
461
622
  }
462
623
  }
463
- /** `readFile` through the LRU content cache (null = read failed, also cached). */
624
+ nearestGoModule(dir) {
625
+ const walked = [];
626
+ let found;
627
+ for (;;) {
628
+ found = this.goModuleByDir.get(dir);
629
+ if (found !== undefined)
630
+ break;
631
+ walked.push(dir);
632
+ found = (0, go_module_1.loadGoModule)(path.join(this.projectRoot, dir));
633
+ if (found)
634
+ this.moduleConfigFiles.add(path.join(this.projectRoot, dir, 'go.mod'));
635
+ if (found || dir === '')
636
+ break;
637
+ dir = goDirOf(dir);
638
+ }
639
+ for (const d of walked)
640
+ this.goModuleByDir.set(d, found);
641
+ return found;
642
+ }
643
+ getGoModules() {
644
+ if (this.goModules)
645
+ return this.goModules;
646
+ const dirs = new Set(['']);
647
+ for (const file of this.knownFiles ?? this.queries.getAllFilePaths()) {
648
+ if (file.endsWith('.go'))
649
+ dirs.add(goDirOf(file));
650
+ }
651
+ const modules = new Set();
652
+ for (const dir of dirs) {
653
+ const mod = this.nearestGoModule(dir);
654
+ const modDir = mod ? path.relative(this.projectRoot, mod.rootDir).split(path.sep).join('/') : '';
655
+ if (mod && !/(?:^|\/)(?:testdata|[_.][^/]*)(?:\/|$)/.test(modDir))
656
+ modules.add(mod);
657
+ }
658
+ this.goModules = [...modules];
659
+ return this.goModules;
660
+ }
464
661
  readFileCached(filePath) {
465
662
  if (this.fileCache.has(filePath)) {
466
663
  return this.fileCache.get(filePath);
467
664
  }
468
665
  const fullPath = path.join(this.projectRoot, filePath);
469
666
  try {
470
- // Import resolvers may follow package metadata to an archive (`file:*.har`,
471
- // for example). Reject anything extraction would not accept before UTF-8
472
- // decoding can multiply a large binary blob into gigabytes of V8 heap.
473
- const stats = fs.statSync(fullPath);
474
- if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
475
- this.fileCache.set(filePath, null);
476
- return null;
477
- }
478
- const content = fs.readFileSync(fullPath, 'utf-8');
667
+ const content = (0, file_limits_1.readSourceText)(fullPath);
479
668
  this.fileCache.set(filePath, content);
480
669
  return content;
481
670
  }
@@ -485,11 +674,6 @@ class ReferenceResolver {
485
674
  return null;
486
675
  }
487
676
  }
488
- /**
489
- * `readFileCached(filePath)?.includes(needle)` for an ASCII needle, searched
490
- * in the raw bytes: an ASCII byte sequence survives UTF-8 decoding
491
- * unchanged, and decoding is most of reading a file nobody keeps.
492
- */
493
677
  fileContains(filePath, needle) {
494
678
  if (this.fileCache.has(filePath))
495
679
  return this.fileCache.get(filePath)?.includes(needle) ?? false;
@@ -504,15 +688,33 @@ class ReferenceResolver {
504
688
  return false;
505
689
  }
506
690
  }
507
- /**
508
- * Create the resolution context
509
- */
691
+ scanFile(filePath) {
692
+ if (this.fileCache.has(filePath))
693
+ return this.fileCache.get(filePath) ?? null;
694
+ try {
695
+ return (0, file_limits_1.readSourceText)(path.join(this.projectRoot, filePath), 'latin1');
696
+ }
697
+ catch {
698
+ return null;
699
+ }
700
+ }
510
701
  createContext() {
511
702
  return {
512
- resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context),
513
- isOutOfRepoImport: (source, fromFile, language) => (0, import_resolver_1.isExternalImport)(source, language, this.context) &&
514
- (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context) === null &&
515
- this.isDeclaredOutsidePackage(source, fromFile),
703
+ resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context) ??
704
+ ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports' &&
705
+ !(0, import_resolver_1.isExternalImport)(ref.referenceName, ref.language, this.context) ? (0, name_matcher_1.matchByFilePath)(ref, this.context) : null),
706
+ isOutOfRepoImport: (source, fromFile, language) => {
707
+ if (!(0, import_resolver_1.isExternalImport)(source, language, this.context, { aliasPrefixes: false, fromFile }))
708
+ return false;
709
+ const resolved = (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context);
710
+ if (resolved !== null && this.isIndexedFile(resolved))
711
+ return false;
712
+ return this.isDeclaredOutsidePackage(source, fromFile) ||
713
+ (import_resolver_1.ESM_IMPORT_LANGUAGES.has(language) && this.isInstalledPackage(source, fromFile));
714
+ },
715
+ resolveModuleFile: (source, fromFile, language) => (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context),
716
+ isDeclaredPackage: (source, fromFile) => this.isDeclaredOutsidePackage(source, fromFile),
717
+ isIndexedFile: (filePath) => this.isIndexedFile(filePath),
516
718
  getNodesInFile: (filePath) => {
517
719
  if (!this.nodeCache.has(filePath)) {
518
720
  this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
@@ -539,6 +741,7 @@ class ReferenceResolver {
539
741
  this.nameCache.set(name, result);
540
742
  return result;
541
743
  },
744
+ isAbsentName: (name) => this.knownNames !== null && !this.knownNames.has(name),
542
745
  getMethodMatches: (typeName, methodName, language) => {
543
746
  const key = `${language} ${typeName}::${methodName}`;
544
747
  const cached = this.methodMatchCache.get(key);
@@ -552,11 +755,6 @@ class ReferenceResolver {
552
755
  const want = `${typeName}::${methodName}`;
553
756
  let matches;
554
757
  if (typeName.includes('::') || methodName.includes(':')) {
555
- // Legacy linear filter for the shapes the owner index below can't
556
- // key exactly: a multi-segment typeName (the endsWith test then
557
- // spans more than two `::` segments) and ObjC selectors (whose
558
- // single/empty-keyword colons defeat the segment split). Tiny
559
- // populations; the per-key memo above still amortizes them.
560
758
  matches = [];
561
759
  for (const m of candidates) {
562
760
  if (m.kind !== 'method')
@@ -569,18 +767,6 @@ class ReferenceResolver {
569
767
  }
570
768
  }
571
769
  else {
572
- // Owner index: the linear filter above is O(all same-named methods)
573
- // per CACHE MISS, and on overload-heavy landscapes the distinct
574
- // (type, method) key space is so large the per-key memo never
575
- // amortizes — Swift's `init` has tens of thousands of candidates
576
- // and the compiler repo measured 732µs per failing call, most of it
577
- // this scan (re-entered once per supertype recursion level, too).
578
- // Bucket each (language, methodName)'s candidates ONCE by the
579
- // qualifiedName's last two `::` segments — exactly the span the
580
- // `qn === want || qn.endsWith('::' + want)` predicate tests for a
581
- // segment-clean typeName — then every query is a map lookup.
582
- // Bucket insertion follows candidate order, so each bucket is
583
- // byte-identical to what the linear filter produced.
584
770
  const idxKey = `${language} ${methodName}`;
585
771
  let ownerIndex = this.methodOwnerIndexCache.get(idxKey);
586
772
  if (!ownerIndex) {
@@ -593,7 +779,7 @@ class ReferenceResolver {
593
779
  const qn = m.qualifiedName;
594
780
  const i2 = qn.lastIndexOf('::');
595
781
  if (i2 < 0)
596
- continue; // single-segment qn can never match `T::m`
782
+ continue;
597
783
  const i1 = qn.lastIndexOf('::', i2 - 1);
598
784
  const bucketKey = i1 < 0 ? qn : qn.slice(i1 + 2);
599
785
  const bucket = ownerIndex.get(bucketKey);
@@ -625,33 +811,14 @@ class ReferenceResolver {
625
811
  this.nodesByKindCache.set(kind, result);
626
812
  return result;
627
813
  },
628
- // Streamed, uncached — synthesizers scan-and-filter whole kinds, and
629
- // both the materialized array AND the per-kind cache retention are
630
- // O(nodes) memory (#1212). Per-ref resolvers keep the cached array
631
- // variant above.
632
814
  iterateNodesByKind: (kind) => this.queries.iterateNodesByKind(kind),
633
815
  fileExists: (filePath) => {
634
- // Check pre-built known files set first (O(1))
635
816
  if (this.knownFiles) {
636
- const normalized = filePath.replace(/\\/g, '/');
637
- if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
817
+ if (this.knownFiles.has(filePath))
818
+ return true;
819
+ if (filePath.includes('\\') && this.knownFiles.has(filePath.replace(/\\/g, '/')))
638
820
  return true;
639
- }
640
821
  }
641
- // Fall back to filesystem for files not yet indexed. `path.join` does
642
- // not clamp, and relative-import resolution hands us paths carrying
643
- // `../` segments, so the probe has to be contained (#1631): a path
644
- // outside the root can never be an indexed project file, and the
645
- // `knownFiles` check above already answered for everything that is.
646
- // Lexical containment only: this is a per-candidate hot path, and the
647
- // symlink half of `validatePathWithinRoot` costs two `realpathSync`
648
- // calls per probe (~70x slower here). It would also be wrong to apply
649
- // — indexing deliberately follows in-root symlinks whose targets live
650
- // outside the root (#935), so only the `../` escape is refused.
651
- // Memoized: import resolution probes the same candidate paths (every
652
- // extension of a specifier) from every file that imports it, and the
653
- // tree does not change within a resolution pass (same window as the
654
- // file-content cache; dropped by clearCaches).
655
822
  const probed = this.fileExistsMemo.get(filePath);
656
823
  if (probed !== undefined)
657
824
  return probed;
@@ -671,7 +838,11 @@ class ReferenceResolver {
671
838
  return exists;
672
839
  },
673
840
  readFile: (filePath) => this.readFileCached(filePath),
841
+ noteModuleConfigFile: (filePath) => {
842
+ this.moduleConfigFiles.add(path.join(this.projectRoot, filePath));
843
+ },
674
844
  fileContains: (filePath, needle) => this.fileContains(filePath, needle),
845
+ scanFile: (filePath) => this.scanFile(filePath),
675
846
  getFileLines: (filePath) => {
676
847
  const cached = this.fileLinesCache.get(filePath);
677
848
  if (cached !== undefined)
@@ -711,25 +882,21 @@ class ReferenceResolver {
711
882
  this.lowerNameCache.set(lowerName, result);
712
883
  return result;
713
884
  },
885
+ getNodeNamesOfKinds: (language, kinds) => this.queries.getNodeNamesOfKinds(language, kinds),
886
+ rememberNode: (node) => {
887
+ if (!this.nodeByIdCache.has(node.id))
888
+ this.nodeByIdCache.set(node.id, node);
889
+ },
714
890
  getNodeById: (id) => {
715
891
  return this.nodeById(id);
716
892
  },
717
893
  getSupertypes: (typeName, language) => {
718
- // Union the `implements`/`extends` targets of every same-named type node.
719
- // Matching by simple name (not id) reconciles a type declared in one node
720
- // (`KF::Builder`) with conformance declared in a separate extension node
721
- // (`KF.Builder: KFOptionSetter`) — both have name `Builder`.
722
- // Memoized per batch generation (see supertypeMemo): within a batch the
723
- // edge state is fixed, and the conformance walk re-queries the same
724
- // popular supertypes (Swift stdlib protocols especially) thousands of
725
- // times per batch.
726
894
  const memoKey = `${language} ${typeName}`;
727
895
  const hit = this.supertypeMemo.get(memoKey);
728
896
  if (hit && hit.gen === this.supertypeGen)
729
897
  return hit.supers;
730
898
  const typeNodes = this.context
731
899
  .getNodesByName(typeName)
732
- // Scala singletons can inherit members even though they cannot be parents.
733
900
  .filter((n) => n.language === language && (SUPERTYPE_BEARING_KINDS.has(n.kind) ||
734
901
  (n.language === 'scala' && n.kind === 'module')));
735
902
  let supers;
@@ -744,9 +911,6 @@ class ReferenceResolver {
744
911
  if (target?.name && target.name !== typeName)
745
912
  supertypes.add(target.name);
746
913
  }
747
- // A Swift conformance to a type the project only extends (SwiftUI's
748
- // `View`) resolves to nothing — the extension is not the type — yet
749
- // the members its extensions add are still the conformer's.
750
914
  if (language === 'swift') {
751
915
  for (const name of (0, swift_type_visibility_1.swiftExtendedConformances)(tn, this.context)) {
752
916
  if (name !== typeName)
@@ -759,6 +923,32 @@ class ReferenceResolver {
759
923
  this.supertypeMemo.set(memoKey, { gen: this.supertypeGen, supers });
760
924
  return supers;
761
925
  },
926
+ getSupertypeNodes: (id) => {
927
+ const hit = this.supertypeNodeMemo.get(id);
928
+ if (hit && hit.gen === this.supertypeGen)
929
+ return hit.nodes;
930
+ const nodes = [];
931
+ for (const edge of this.queries.getOutgoingEdges(id, RESOLUTION_READ_EDGE_KINDS)) {
932
+ const target = this.nodeById(edge.target);
933
+ if (target)
934
+ nodes.push(target);
935
+ }
936
+ this.supertypeNodeMemo.set(id, { gen: this.supertypeGen, nodes });
937
+ return nodes;
938
+ },
939
+ getSuperclassNodes: (id) => {
940
+ const hit = this.superclassNodeMemo.get(id);
941
+ if (hit && hit.gen === this.supertypeGen)
942
+ return hit.nodes;
943
+ const nodes = [];
944
+ for (const edge of this.queries.getOutgoingEdges(id, ['extends'])) {
945
+ const target = this.nodeById(edge.target);
946
+ if (target)
947
+ nodes.push(target);
948
+ }
949
+ this.superclassNodeMemo.set(id, { gen: this.supertypeGen, nodes });
950
+ return nodes;
951
+ },
762
952
  getImportMappings: (filePath, language) => {
763
953
  const cacheKey = filePath;
764
954
  const cached = this.importMappingCache.get(cacheKey);
@@ -775,7 +965,7 @@ class ReferenceResolver {
775
965
  },
776
966
  getProjectAliases: () => {
777
967
  if (this.projectAliases === undefined) {
778
- this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
968
+ this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot, this.moduleConfigFiles);
779
969
  }
780
970
  return this.projectAliases;
781
971
  },
@@ -792,7 +982,7 @@ class ReferenceResolver {
792
982
  walked.push(dir);
793
983
  const abs = path.join(this.projectRoot, dir);
794
984
  if (['tsconfig.json', 'jsconfig.json'].some((name) => fs.existsSync(path.join(abs, name)))) {
795
- const aliases = (0, path_aliases_1.loadProjectAliases)(abs);
985
+ const aliases = (0, path_aliases_1.loadProjectAliases)(abs, this.moduleConfigFiles);
796
986
  if (aliases) {
797
987
  found = aliases;
798
988
  break;
@@ -804,15 +994,23 @@ class ReferenceResolver {
804
994
  this.dirAliases.set(d, found);
805
995
  return found;
806
996
  },
807
- getGoModule: () => {
808
- if (this.goModule === undefined) {
809
- this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
810
- }
811
- return this.goModule;
997
+ getPhpWebRoot: (fromFile) => this.phpWebRootOf(fromFile),
998
+ getGoPackageDir: (importPath, fromFile) => {
999
+ const own = fromFile === undefined ? null : this.nearestGoModule(goDirOf(fromFile));
1000
+ const key = `${importPath}\0${own?.rootDir ?? ''}`;
1001
+ const hit = this.goPackageDirs.get(key);
1002
+ if (hit !== undefined)
1003
+ return hit;
1004
+ const mod = (0, go_module_1.findGoModuleForImport)(importPath, this.getGoModules(), own);
1005
+ const dir = mod ? (0, go_module_1.goModulePackageDir)(importPath, mod, this.projectRoot) : null;
1006
+ this.goPackageDirs.set(key, dir);
1007
+ return dir;
812
1008
  },
813
1009
  getWorkspacePackages: () => {
814
1010
  if (this.workspacePackages === undefined) {
815
- this.workspacePackages = (0, workspace_packages_1.loadWorkspacePackages)(this.projectRoot);
1011
+ const { packages, discovery } = (0, workspace_packages_1.loadWorkspacePackagesAndManifests)(this.projectRoot);
1012
+ this.workspacePackages = packages;
1013
+ this.workspaceDiscovery = discovery;
816
1014
  }
817
1015
  return this.workspacePackages;
818
1016
  },
@@ -825,34 +1023,27 @@ class ReferenceResolver {
825
1023
  this.reExportCache.set(filePath, []);
826
1024
  return [];
827
1025
  }
828
- // Re-exports are a JS/TS-only construct, and what matters is the
829
- // BARREL file's own language — not the consuming reference's. A
830
- // `.svelte`/`.vue` consumer threads its own language down the
831
- // re-export chase, which would make extractReExports() bail on a
832
- // `.ts` index barrel and silently break the chain (#629). Re-key
833
- // the parse on the barrel's extension so the chase works no matter
834
- // what kind of file imports through it.
835
1026
  const isJsFamily = /\.(?:d\.ts|[cm]?tsx?|[cm]?jsx?|ets)$/i.test(filePath);
836
- const reExports = (0, import_resolver_1.extractReExports)(content, isJsFamily ? 'typescript' : language);
1027
+ const barrelLanguage = isJsFamily ? 'typescript' : /\.py$/i.test(filePath) ? 'python' : language;
1028
+ const reExports = (0, import_resolver_1.extractReExports)(content, barrelLanguage);
837
1029
  this.reExportCache.set(filePath, reExports);
838
1030
  return reExports;
839
1031
  },
840
1032
  getCppIncludeDirs: () => {
841
- return (0, import_resolver_1.loadCppIncludeDirs)(this.projectRoot);
1033
+ if (this.compileDbIncludeDirs === undefined)
1034
+ this.compileDbIncludeDirs = (0, import_resolver_1.loadCppIncludeDirsFromCompileDB)(this.projectRoot);
1035
+ return this.compileDbIncludeDirs ?? (this.layoutIncludeDirs ??= (0, import_resolver_1.loadCppIncludeDirsHeuristic)(this.projectRoot));
842
1036
  },
1037
+ getCargoCrates: () => this.readCargoCrates(),
1038
+ getCppIncludeNodes: () => this.queries.getCppIncludeNodes(),
843
1039
  };
844
1040
  }
845
- /**
846
- * Resolve all unresolved references
847
- */
848
1041
  resolveAll(unresolvedRefs, onProgress) {
849
- // Pre-load all nodes into memory for fast lookups
850
1042
  this.warmCaches();
851
1043
  this.advanceSupertypeGeneration();
852
1044
  const resolved = [];
853
1045
  const unresolved = [];
854
1046
  const byMethod = {};
855
- // Convert to our internal format, using denormalized fields when available
856
1047
  const refs = unresolvedRefs.map((ref) => ({
857
1048
  fromNodeId: ref.fromNodeId,
858
1049
  referenceName: ref.referenceName,
@@ -866,16 +1057,15 @@ class ReferenceResolver {
866
1057
  const total = refs.length;
867
1058
  let lastReportedPercent = -1;
868
1059
  for (let i = 0; i < refs.length; i++) {
869
- const ref = refs[i]; // Array index is guaranteed to be in bounds
1060
+ const ref = refs[i];
870
1061
  const result = this.resolveOneTimed(ref);
871
1062
  if (result) {
872
1063
  resolved.push(result);
873
1064
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
874
1065
  }
875
1066
  else {
876
- unresolved.push(ref);
1067
+ unresolved.push(this.parkable(ref));
877
1068
  }
878
- // Report progress every 1% to avoid too many updates
879
1069
  if (onProgress) {
880
1070
  const currentPercent = Math.floor((i / total) * 100);
881
1071
  if (currentPercent > lastReportedPercent) {
@@ -884,7 +1074,6 @@ class ReferenceResolver {
884
1074
  }
885
1075
  }
886
1076
  }
887
- // Final progress report
888
1077
  if (onProgress && total > 0) {
889
1078
  onProgress(total, total);
890
1079
  }
@@ -899,9 +1088,7 @@ class ReferenceResolver {
899
1088
  },
900
1089
  };
901
1090
  }
902
- /** Lowercased `knownNames`, built the first time a case-insensitive language asks. */
903
1091
  knownLowerNames = null;
904
- /** `hasAnyPossibleMatch` for a language whose names ignore case: the name, or any `.`/`::`/`->` part of it. */
905
1092
  hasAnyPossibleMatchIgnoringCase(name) {
906
1093
  if (!this.knownNames)
907
1094
  return true;
@@ -915,35 +1102,26 @@ class ReferenceResolver {
915
1102
  return true;
916
1103
  return lower.split(/::|->|\./).some((part) => part.length > 0 && this.knownLowerNames.has(part));
917
1104
  }
918
- /**
919
- * Check if a reference name has any possible match in the codebase.
920
- * Uses the pre-built knownNames set to skip expensive resolution
921
- * for names that definitely don't exist as symbols.
922
- */
923
1105
  hasAnyPossibleMatch(name) {
924
1106
  if (!this.knownNames)
925
- return true; // no pre-filter available
926
- // Direct name match
927
- if (this.knownNames.has(name))
928
1107
  return true;
929
- // For qualified names like "obj.method" or "Class::method", check the parts
1108
+ const only = this.classExpressionFreeBases.has(this.context) ? this.classExpressionOnlyNames() : null;
1109
+ const known = (n) => this.knownNames.has(n) && !(only?.has(n) ?? false);
1110
+ if (known(name))
1111
+ return true;
930
1112
  const dotIdx = name.indexOf('.');
931
1113
  if (dotIdx > 0) {
932
1114
  const receiver = name.substring(0, dotIdx);
933
1115
  const member = name.substring(dotIdx + 1);
934
- if (this.knownNames.has(receiver) || this.knownNames.has(member))
1116
+ if (known(receiver) || known(member))
935
1117
  return true;
936
- // Also check capitalized receiver (instance-method resolution)
937
1118
  const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
938
- if (this.knownNames.has(capitalized))
1119
+ if (known(capitalized))
939
1120
  return true;
940
- // JVM FQN: `com.example.foo.Bar` — the only useful segment is the
941
- // last one (`Bar`); the earlier check finds `example.foo.Bar` which
942
- // never matches a node name.
943
1121
  const lastDot = name.lastIndexOf('.');
944
1122
  if (lastDot > dotIdx) {
945
1123
  const tail = name.substring(lastDot + 1);
946
- if (tail && this.knownNames.has(tail))
1124
+ if (tail && known(tail))
947
1125
  return true;
948
1126
  }
949
1127
  }
@@ -951,24 +1129,15 @@ class ReferenceResolver {
951
1129
  if (colonIdx > 0) {
952
1130
  const receiver = name.substring(0, colonIdx);
953
1131
  const member = name.substring(colonIdx + 2);
954
- if (this.knownNames.has(receiver) || this.knownNames.has(member))
1132
+ if (known(receiver) || known(member))
955
1133
  return true;
956
- // Multi-segment path `a::b::c` (a Rust/C++ module call like
957
- // `database::profiles::find`) — the only segment that names a symbol is
958
- // the last (`c`); `member` above is `b::c`, which never matches a node
959
- // name, so without this the pre-filter drops the ref before the Rust path
960
- // resolver ever sees it. Mirror the dotted-name leaf check above.
961
1134
  const lastColon = name.lastIndexOf('::');
962
1135
  if (lastColon > colonIdx) {
963
1136
  const tail = name.substring(lastColon + 2);
964
- if (tail && this.knownNames.has(tail))
1137
+ if (tail && known(tail))
965
1138
  return true;
966
1139
  }
967
1140
  }
968
- // Lua/Luau method calls use a single `:` (`lg:log`); R uses `$` (`lg$log`).
969
- // Check the member (and receiver) around these separators too, so the ref
970
- // isn't dropped here before the method-call resolver ever sees it. The `:`
971
- // case is skipped when the name actually contains `::` (handled above).
972
1141
  for (const sep of [':', '$']) {
973
1142
  if (sep === ':' && name.includes('::'))
974
1143
  continue;
@@ -976,27 +1145,21 @@ class ReferenceResolver {
976
1145
  if (sepIdx > 0) {
977
1146
  const receiver = name.substring(0, sepIdx);
978
1147
  const member = name.substring(sepIdx + 1);
979
- if (this.knownNames.has(member) || this.knownNames.has(receiver))
1148
+ if (known(member) || known(receiver))
980
1149
  return true;
981
1150
  const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
982
- if (this.knownNames.has(capitalized))
1151
+ if (known(capitalized))
983
1152
  return true;
984
1153
  }
985
1154
  }
986
- // For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
987
1155
  const slashIdx = name.lastIndexOf('/');
988
1156
  if (slashIdx > 0) {
989
1157
  const fileName = name.substring(slashIdx + 1);
990
- if (this.knownNames.has(fileName))
1158
+ if (known(fileName))
991
1159
  return true;
992
1160
  }
993
1161
  return false;
994
1162
  }
995
- /**
996
- * Does `ref.referenceName` match an import declared in its containing
997
- * file? Used as a pre-filter escape so re-export chain resolution
998
- * still gets a chance when the name has no project-wide declaration.
999
- */
1000
1163
  matchesAnyImport(ref) {
1001
1164
  const imports = this.context.getImportMappings(ref.filePath, ref.language);
1002
1165
  if (imports.length === 0)
@@ -1009,177 +1172,336 @@ class ReferenceResolver {
1009
1172
  }
1010
1173
  return false;
1011
1174
  }
1012
- /**
1013
- * Resolve a single reference.
1014
- *
1015
- * Thin decorator over `resolveOneInner` so every strategy — framework,
1016
- * import, name-match, chain, CFML component path — passes through the
1017
- * inheritance target-kind gate at ONE seam. Filtering inside the
1018
- * name-matcher would have covered `matchByExactName` only.
1019
- * Calls that land on an alias binding then forward once to the callable
1020
- * the alias names (see ./alias-binding), regardless of the strategy.
1021
- */
1175
+ pythonAttrRetryCandidates(touched, ceiling = 2000) {
1176
+ const touchedSet = new Set(touched);
1177
+ const closure = this.queries.getPythonImporterClosure(touched).filter((f) => !touchedSet.has(f));
1178
+ const keyOf = (ref) => `${ref.fromNodeId}\0${ref.referenceName}`;
1179
+ const resolvable = (refs) => {
1180
+ const answers = new Map();
1181
+ return refs.filter((ref) => {
1182
+ if (!ref.filePath || !ref.language)
1183
+ return false;
1184
+ const key = keyOf(ref);
1185
+ let ok = answers.get(key);
1186
+ if (ok === undefined)
1187
+ answers.set(key, (ok = (0, name_matcher_1.pythonAttrRefResolves)(ref, this.context)));
1188
+ return ok;
1189
+ });
1190
+ };
1191
+ const candidates = this.queries.getFailedPythonAttrRefKeys(closure);
1192
+ const load = (keys) => this.queries.getUnresolvedReferencesByIds(keys.map((k) => k.id));
1193
+ if (new Set(candidates.map(keyOf)).size <= ceiling)
1194
+ return resolvable(load(candidates));
1195
+ const assigned = new Set();
1196
+ const defined = new Set();
1197
+ const subclassing = new Set();
1198
+ const calling = new Set();
1199
+ for (const file of touched) {
1200
+ const source = this.context.readFile(file);
1201
+ if (source) {
1202
+ const text = (0, strip_comments_1.stripCommentsForRegex)(source, 'python');
1203
+ for (const m of text.matchAll(/\b(?:self|cls)\.(\w+)\s*(?::[^=\n]*)?=(?!=)|^[ \t]+(\w+)\s*(?::[^=\n]*)?=(?!=)/gm)) {
1204
+ assigned.add((m[1] ?? m[2]));
1205
+ }
1206
+ }
1207
+ for (const n of this.context.getNodesInFile(file)) {
1208
+ if (n.kind === 'class' || n.kind === 'function' || n.kind === 'method')
1209
+ defined.add(n.name);
1210
+ }
1211
+ for (const f of this.queries.getPythonFilesWithEdgesInto(file, ['extends'], ['class']))
1212
+ subclassing.add(f);
1213
+ for (const f of this.queries.getPythonFilesWithEdgesInto(file, ['calls', 'instantiates'], ['function', 'method', 'class'])) {
1214
+ calling.add(f);
1215
+ }
1216
+ }
1217
+ const callees = new Map();
1218
+ const assignedCallees = (file, attr) => {
1219
+ let byAttr = callees.get(file);
1220
+ if (!byAttr) {
1221
+ byAttr = new Map();
1222
+ const source = this.context.readFile(file);
1223
+ const text = source ? (0, strip_comments_1.stripCommentsForRegex)(source, 'python') : '';
1224
+ for (const m of text.matchAll(/\b(\w+)\s*(?::[^=\n]*)?=(?!=)\s*(?:await\s+)?(?:[\w.]*\.)?(\w+)\s*\(/g)) {
1225
+ let set = byAttr.get(m[1]);
1226
+ if (!set)
1227
+ byAttr.set(m[1], (set = new Set()));
1228
+ set.add(m[2]);
1229
+ }
1230
+ callees.set(file, byAttr);
1231
+ }
1232
+ return byAttr.get(attr) ?? new Set();
1233
+ };
1234
+ const kept = candidates.filter((ref) => {
1235
+ const name = ref.referenceName;
1236
+ if (name.includes('().'))
1237
+ return defined.has(name.split('().')[0].split('.').pop());
1238
+ const segs = name.split('.');
1239
+ if (segs.length !== 3 || !segs.every((seg) => /^[A-Za-z_]\w*$/.test(seg)))
1240
+ return false;
1241
+ const attr = segs[1];
1242
+ if (assigned.has(attr))
1243
+ return true;
1244
+ if (subclassing.has(ref.filePath) && (segs[0] === 'self' || segs[0] === 'cls'))
1245
+ return true;
1246
+ return calling.has(ref.filePath) && [...assignedCallees(ref.filePath, attr)].some((c) => defined.has(c));
1247
+ });
1248
+ return new Set(kept.map(keyOf)).size <= ceiling ? resolvable(load(kept)) : null;
1249
+ }
1022
1250
  resolveOne(ref) {
1023
- // A C/C++ "call" whose name is a function-like macro visible in this
1024
- // translation unit is a macro expansion, not a call — it must never bind
1025
- // to a same-named function in another file (#1838).
1251
+ const outer = this.context;
1252
+ const unviewed = this.classExpressionFreeBases.get(outer) ?? outer;
1253
+ const base = unviewed === this.mocklessContext && this.mocklessBase ? this.mocklessBase : unviewed;
1254
+ const mockless = this.mocklessContextFor(ref, base) ?? base;
1255
+ const context = this.classExpressionFreeContextFor(ref, mockless) ?? mockless;
1256
+ this.lastResolved = { ref, context };
1257
+ return this.resolveOneWith(context, ref);
1258
+ }
1259
+ lastResolved = null;
1260
+ resolveOneWith(context, ref) {
1261
+ const outer = this.context;
1262
+ if (context === outer)
1263
+ return this.resolveOneIn(ref);
1264
+ this.context = context;
1265
+ try {
1266
+ return this.resolveOneIn(ref);
1267
+ }
1268
+ finally {
1269
+ this.context = outer;
1270
+ }
1271
+ }
1272
+ resolveOneIn(ref) {
1273
+ if (ref.referenceKind === 'function_ref' && ref.language === 'rust' && ref.referenceName.includes('::')) {
1274
+ return this.resolveRustPathValue(ref);
1275
+ }
1276
+ const byName = (0, name_matcher_1.rustChainedCallByName)(ref);
1277
+ if (byName) {
1278
+ const resolved = this.resolveOneIn(byName);
1279
+ return resolved && { ...resolved, original: ref };
1280
+ }
1026
1281
  if ((0, cpp_macro_visibility_1.isVisibleCppMacro)(ref, this.context))
1027
1282
  return null;
1028
- // A Swift type reference never lands on an `extension X {}` node, nor on a
1029
- // nested type it cannot name bare (see ./swift-type-visibility).
1030
- // A name a declaration around the reference declares as a type parameter
1031
- // (`def f[A]`, `class Foo<T>`) is that parameter (see ./type-parameters).
1032
- const candidate = (0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context);
1283
+ const candidate = (0, dart_local_scope_1.gateDartLocal)((0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context), ref, this.context);
1033
1284
  const scoped = this.gateRustScope(candidate, ref);
1034
- const resolved = this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref);
1285
+ const resolved = (0, python_overloads_1.preferPythonImplementation)((0, name_matcher_1.preferGoBuildTwin)(this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref), ref, this.context), ref, this.context);
1286
+ if (resolved && ref.language === 'dart' && ref.referenceKind === 'references' &&
1287
+ resolved.targetNodeId === ref.fromNodeId)
1288
+ return null;
1289
+ if (resolved && ((0, name_matcher_1.isPythonFromImportModule)(ref, this.context) || (0, name_matcher_2.isPythonImportStatementModule)(ref, this.context))) {
1290
+ const module = this.nodeById(resolved.targetNodeId);
1291
+ if (module && module.kind !== 'file' && module.kind !== 'module')
1292
+ return null;
1293
+ }
1294
+ if (resolved && (resolved.byName || resolved.resolvedBy === 'exact-match' || resolved.resolvedBy === 'fuzzy') &&
1295
+ (0, name_matcher_1.isGuessedRecordAccessor)(resolved, ref, this.context))
1296
+ return null;
1297
+ if (resolved && (resolved.byName || resolved.resolvedBy === 'exact-match' || resolved.resolvedBy === 'fuzzy')) {
1298
+ const target = this.nodeById(resolved.targetNodeId);
1299
+ if (target && (0, name_matcher_1.crossesWorkspaceRoot)(target, ref, this.context))
1300
+ return null;
1301
+ }
1302
+ if (resolved && resolved.resolvedBy === 'import' && (0, name_matcher_1.isImportShadowedByJsBinding)(resolved, ref, this.context))
1303
+ return null;
1304
+ if (resolved && (0, name_matcher_4.isRefusedDeepThisTarget)(resolved, ref, this.context))
1305
+ return null;
1306
+ if (resolved && resolved.resolvedBy !== 'import') {
1307
+ const specifier = (0, ambient_modules_1.ambientModuleDeclarations)(this.context).get(resolved.targetNodeId);
1308
+ const declaringFile = specifier === undefined ? undefined : this.nodeById(resolved.targetNodeId)?.filePath;
1309
+ if (declaringFile !== undefined && declaringFile !== ref.filePath &&
1310
+ !(0, import_resolver_1.reachesAmbientModule)(ref, specifier, declaringFile, this.context))
1311
+ return null;
1312
+ }
1313
+ if (resolved && ref.language === 'python' && ref.referenceKind === 'calls' && resolved.resolvedBy !== 'framework') {
1314
+ const target = this.nodeById(resolved.targetNodeId);
1315
+ if (target && !(0, name_matcher_7.pythonSelfCallReaches)(target, ref, this.context))
1316
+ return null;
1317
+ }
1035
1318
  if (!resolved || ref.referenceKind !== 'calls')
1036
1319
  return resolved;
1037
- const target = this.nodeById(resolved.targetNodeId);
1320
+ const call = ref.language === 'pascal' ? (0, pascal_scope_1.gatePascalCall)(resolved, ref, this.context) : resolved;
1321
+ if (!call)
1322
+ return null;
1323
+ const target = this.nodeById(call.targetNodeId);
1038
1324
  if (!target)
1039
- return resolved;
1325
+ return call;
1040
1326
  const dot = ref.referenceName.lastIndexOf('.');
1041
1327
  const memberName = dot >= 0 ? ref.referenceName.slice(dot + 1) : null;
1042
1328
  const forwarded = (0, alias_binding_1.resolveAliasBinding)(target, memberName, this.context);
1043
- if (!forwarded || forwarded.id === resolved.targetNodeId)
1044
- return resolved;
1329
+ if (!forwarded || forwarded.id === call.targetNodeId)
1330
+ return call;
1045
1331
  return this.gateLanguage({
1046
- ...resolved,
1332
+ ...call,
1047
1333
  targetNodeId: forwarded.id,
1048
- confidence: Math.min(resolved.confidence, 0.85),
1334
+ confidence: Math.min(call.confidence, 0.85),
1049
1335
  }, ref);
1050
1336
  }
1337
+ resolveRustPathValue(ref) {
1338
+ const asCall = this.resolveOneIn({ ...ref, referenceKind: 'calls' });
1339
+ const target = asCall ? this.nodeById(asCall.targetNodeId) : undefined;
1340
+ if (!asCall || !target || (target.kind !== 'function' && target.kind !== 'method'))
1341
+ return null;
1342
+ if ((0, name_matcher_1.isRustTraitImplMember)(target, this.context))
1343
+ return null;
1344
+ const segments = ref.referenceName.split('::');
1345
+ if ((0, name_matcher_1.isRustOtherTypesMethod)(target, segments[segments.length - 2].replace(/^r#/, ''), this.context))
1346
+ return null;
1347
+ return { original: ref, targetNodeId: target.id, confidence: asCall.confidence, resolvedBy: 'function-ref' };
1348
+ }
1051
1349
  resolveOneInner(ref) {
1052
- // A local C++ object construction (`T obj(args)`, ref `ns::T::T/1`)
1053
- // resolves ONLY to a constructor of the lexically nearest `T` (#1839).
1054
1350
  if ((0, cpp_constructor_1.isCppConstructorRef)(ref))
1055
1351
  return (0, cpp_constructor_1.matchCppConstructor)(ref, this.context);
1056
- // Skip built-in/external references
1352
+ if ((0, cpp_supertypes_1.isCppSupertypeRef)(ref))
1353
+ return (0, cpp_supertypes_1.matchCppSupertype)(ref, this.context);
1354
+ if ((0, cpp_supertypes_1.isCppDeclaredTypeRef)(ref, this.context))
1355
+ return (0, cpp_supertypes_1.matchCppDeclaredType)(ref, this.context);
1356
+ if ((0, name_matcher_6.isObjcDeclaredTypeRef)(ref))
1357
+ return (0, name_matcher_6.matchByExactName)(ref, this.context);
1358
+ if ((0, pascal_scope_1.isPascalParenlessRef)(ref))
1359
+ return (0, pascal_scope_1.matchPascalParenlessRef)(ref, this.context);
1360
+ if ((0, pascal_scope_1.isPascalSystemCall)(ref, this.context))
1361
+ return (0, pascal_scope_1.matchPascalSystemCall)(ref, this.context);
1362
+ const nested = (0, pascal_scope_1.matchPascalNestedCall)(ref, this.context);
1363
+ if (nested)
1364
+ return nested;
1365
+ if ((0, name_matcher_1.isDartMemberRead)(ref))
1366
+ return (0, name_matcher_1.matchDartMemberRead)(ref, this.context);
1367
+ if ((0, name_matcher_1.isDartChainLink)(ref, this.context))
1368
+ return (0, name_matcher_1.matchDartChainLink)(ref, this.context);
1369
+ if ((0, name_matcher_1.isDartAnnotation)(ref))
1370
+ return (0, name_matcher_1.matchDartAnnotation)(ref, this.context);
1371
+ const asserted = (0, name_matcher_1.matchGoAssertedCall)(ref, this.context);
1372
+ if (asserted !== undefined)
1373
+ return asserted;
1374
+ const builtin = (0, name_matcher_1.matchGoBuiltinReceiverCall)(ref, this.context);
1375
+ if (builtin !== undefined)
1376
+ return builtin;
1377
+ const indexed = (0, name_matcher_1.matchGoIndexedCall)(ref, this.context);
1378
+ if (indexed !== undefined)
1379
+ return indexed;
1380
+ const chained = (0, name_matcher_1.matchGoChainedCall)(ref, this.context);
1381
+ if (chained !== undefined)
1382
+ return chained;
1383
+ const themeFile = (0, shopify_themes_1.matchShopifyThemeFile)(ref, this.context);
1384
+ if (themeFile !== undefined)
1385
+ return themeFile;
1386
+ const superCall = (0, js_super_calls_1.matchJsSuperCall)(ref, this.context);
1387
+ if (superCall !== undefined)
1388
+ return superCall;
1389
+ if (ref.language === 'kotlin' && ref.referenceKind === 'calls') {
1390
+ const root = ref.referenceName.slice(0, ref.referenceName.indexOf('.'));
1391
+ if (root && this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === root)) {
1392
+ const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1393
+ if (viaImport)
1394
+ return viaImport;
1395
+ }
1396
+ const chain = (0, name_matcher_1.matchKotlinReceiverChain)(ref, this.context);
1397
+ if (chain && 'method' in chain) {
1398
+ const bare = this.resolveOneInner({ ...ref, referenceName: chain.method });
1399
+ return bare ? { ...bare, original: ref } : null;
1400
+ }
1401
+ if (chain !== undefined)
1402
+ return this.gateLanguage(chain, ref);
1403
+ }
1057
1404
  if (this.isBuiltInOrExternal(ref)) {
1058
- return null;
1405
+ return this.isPythonBuiltinNamedMethodCall(ref)
1406
+ ? this.gateLanguage((0, name_matcher_1.matchPythonTypedLocalCall)(ref, this.context), ref)
1407
+ : null;
1059
1408
  }
1060
- // CFML component paths in inheritance (#1152): `extends="coldbox.system.web.
1061
- // Controller"` names the supertype by its dot-separated path (or `extends=
1062
- // "../base"` by relative file path) — the graph indexes the class under its
1063
- // final segment only, so these die at the fast pre-filter below and never
1064
- // resolved. Handled by a dedicated path-corroborated matcher, gated to
1065
- // inheritance refs only (a dotted `calls` ref is a member-access chain, not
1066
- // a component path). No fallthrough on miss: the full path string can only
1067
- // ever mis-match downstream, and an unresolvable supertype usually lives in
1068
- // an out-of-repo library (mxunit, testbox) — silent beats wrong.
1069
1409
  if ((ref.language === 'cfml' || ref.language === 'cfscript') &&
1070
1410
  (ref.referenceKind === 'extends' || ref.referenceKind === 'implements') &&
1071
1411
  (ref.referenceName.includes('.') || ref.referenceName.includes('/'))) {
1072
1412
  return this.resolveCfmlComponentPath(ref);
1073
1413
  }
1074
- // A PHP class written with a namespace in it — `new Alias\X()` through a
1075
- // `use Ns as Alias;` namespace alias, `extends Sub\Base`, `\Ns\X::make()`
1076
- // (#2256). The pre-filter below would drop most of these before any import
1077
- // strategy ran, and PHP gives each one exactly one meaning; resolve it first.
1414
+ if (ref.language === 'cfml' || ref.language === 'cfscript') {
1415
+ if (ref.referenceKind === 'instantiates' && ref.referenceName.includes('.'))
1416
+ return this.resolveCfmlComponentPath(ref);
1417
+ if (ref.referenceKind === 'calls' && CFML_CONSTRUCTED_CALL.test(ref.referenceName))
1418
+ return this.resolveCfmlConstructedCall(ref);
1419
+ }
1420
+ if ((ref.language === 'cfml' || ref.language === 'cfscript') && ref.referenceKind === 'imports' && isCfmlTemplatePath(ref.referenceName)) {
1421
+ const included = this.resolveCfmlIncludePath(ref) ?? (0, name_matcher_1.matchByFilePath)(ref, this.context);
1422
+ if (included && this.nodeById(included.targetNodeId)?.filePath === ref.filePath)
1423
+ return null;
1424
+ return this.gateLanguage(included, ref);
1425
+ }
1078
1426
  const phpQualified = (0, import_resolver_1.resolvePhpQualifiedClassRef)(ref, this.context);
1079
1427
  if (phpQualified !== undefined)
1080
1428
  return this.gateLanguage(phpQualified, ref);
1081
- // Fast pre-filter: skip if no symbol with this name exists anywhere
1082
- // AND the name doesn't match a local import. The import escape is
1083
- // necessary because re-export rename chains (`import { login }
1084
- // from './barrel'` where the barrel has `export { signIn as login }
1085
- // from './auth'`) intentionally call a name that has no
1086
- // declaration anywhere — only the renamed upstream symbol does.
1087
- // ArkTS chained-attribute refs carry a leading dot (`.titleStyle`) that
1088
- // routes them to the decorator-gated matcher; the symbol itself is
1089
- // indexed under the bare name, so the existence check strips the dot.
1090
- // Nix static path imports (`import ./x.nix`) and JS/TS module paths
1091
- // (`require('./x')`) name a FILE, not a symbol — they bypass the
1092
- // symbol-existence check and resolve via resolveViaImport.
1429
+ const rubyPath = (0, ruby_constant_paths_1.matchRubyConstantPathRef)(ref, this.context);
1430
+ if (rubyPath !== undefined)
1431
+ return this.gateLanguage(rubyPath, ref);
1432
+ const rustBound = (0, name_matcher_1.matchRustUseBoundName)(ref, this.context);
1433
+ if (rustBound !== undefined)
1434
+ return this.gateLanguage(rustBound, ref);
1093
1435
  let existenceName = ref.language === 'arkts' && ref.referenceName.startsWith('.')
1094
1436
  ? ref.referenceName.slice(1)
1095
1437
  : ref.referenceName;
1096
- // Erlang refs carry the call-site arity (`f/1`, `mod::f/2` — #1610); the
1097
- // name index stores bare names, so existence is checked arity-less.
1098
1438
  if (ref.language === 'erlang')
1099
1439
  existenceName = existenceName.replace(/\/\d{1,3}$/, '');
1440
+ if ((ref.language === 'cpp' || ref.language === 'c') && existenceName.startsWith('::')) {
1441
+ existenceName = existenceName.slice(2);
1442
+ }
1100
1443
  const tPre = this.profileStages ? process.hrtime.bigint() : 0n;
1101
1444
  const preFilterPass = (0, import_resolver_1.isNixPathImportRef)(ref) ||
1102
1445
  (0, import_resolver_1.isJsPathImportRef)(ref) ||
1103
1446
  this.hasAnyPossibleMatch(existenceName) ||
1104
- // PHP, Pascal, CFML, COBOL and VB.NET names ignore case: `formatprice()`
1105
- // calls `FormatPrice`, which the exact-name set never lists.
1106
1447
  (name_matcher_1.CASE_INSENSITIVE_LANGUAGES.has(ref.language) && this.hasAnyPossibleMatchIgnoringCase(existenceName)) ||
1107
1448
  this.matchesAnyImport(ref) ||
1108
- this.frameworks.some((f) => f.claimsReference?.(ref.referenceName));
1449
+ this.frameworksFor(ref.language).some((f) => f.claimsReference?.(ref.referenceName));
1109
1450
  if (this.profileStages)
1110
1451
  this.stageAdd('preFilter', ref, preFilterPass, tPre);
1111
1452
  if (!preFilterPass) {
1112
1453
  return this.gateLanguage((0, name_matcher_1.matchJsStoreBindingCall)(ref, this.context), ref);
1113
1454
  }
1114
- // Function-as-value refs (#756) get a dedicated, strictly-gated path:
1115
- // import-based resolution first (an imported callback resolves through its
1116
- // import, the most precise cross-file signal), then matchFunctionRef
1117
- // (same-file first, unique-only cross-file, function/method targets only).
1118
- // They never reach the framework or fuzzy strategies below.
1455
+ if ((0, vbnet_receivers_1.isVbMemberRead)(ref))
1456
+ return this.gateLanguage((0, vbnet_receivers_1.matchVbMemberRead)(ref, this.context), ref);
1457
+ if ((0, vbnet_receivers_1.isVbPathCall)(ref)) {
1458
+ return this.gateLanguage((0, vbnet_receivers_1.matchVbPathCall)(ref, this.context, (name) => (0, name_matcher_1.isStdMethodName)('vbnet', name)), ref);
1459
+ }
1460
+ const tsQualified = (0, import_resolver_1.resolveTsQualifiedTypeRef)(ref, this.context);
1461
+ if (tsQualified !== undefined)
1462
+ return this.gateLanguage(tsQualified, ref);
1119
1463
  if (ref.referenceKind === 'function_ref') {
1120
- // `this.<member>` values (TS/JS) resolve ONLY against the enclosing
1121
- // class's own members — never a same-named symbol elsewhere.
1122
1464
  if (ref.referenceName.startsWith('this.')) {
1123
1465
  return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
1124
1466
  }
1125
- if ((ref.language === 'python' || ref.language === 'go') && ref.referenceName.includes('.')) {
1467
+ if ((ref.language === 'python' || ref.language === 'go' || ref.language === 'csharp') && ref.referenceName.includes('.')) {
1126
1468
  return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
1127
1469
  }
1128
1470
  const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1129
- if (viaImport) {
1471
+ if (viaImport && !(0, name_matcher_1.isImportShadowedByJsBinding)(viaImport, ref, this.context)) {
1130
1472
  const target = this.nodeById(viaImport.targetNodeId);
1131
1473
  if (target &&
1132
1474
  (target.kind === 'function' ||
1133
1475
  target.kind === 'method' ||
1134
- // Python (#1478): an imported class used as a value (`return
1135
- // OrgSerializerFull`) resolves through its import like any
1136
- // callback — mirrors matchFunctionRef's bareClassOk.
1137
1476
  (ref.language === 'python' && target.kind === 'class'))) {
1138
1477
  return viaImport;
1139
1478
  }
1140
1479
  }
1141
1480
  return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
1142
1481
  }
1143
- // JVM FQN imports skip framework/name-matcher: `import com.example.Bar`
1144
- // resolves directly through the qualifiedName index, which is unambiguous
1145
- // even when several `Bar` classes exist in different packages.
1146
1482
  const tJvm = this.profileStages ? process.hrtime.bigint() : 0n;
1147
1483
  const jvmImport = (0, import_resolver_1.resolveJvmImport)(ref, this.context);
1148
1484
  if (this.profileStages)
1149
1485
  this.stageAdd('jvmImport', ref, !!jvmImport, tJvm);
1150
1486
  if (jvmImport)
1151
1487
  return jvmImport;
1152
- // Razor/Blazor: a markup or `@code` type ref resolves through the file's
1153
- // `@using` namespaces (incl. folder `_Imports.razor`). This precisely
1154
- // disambiguates a simple name that exists in several namespaces — e.g.
1155
- // `CatalogBrand` resolving to `BlazorShared.Models::CatalogBrand` (the DTO,
1156
- // which the `.razor` `@using`s) rather than the same-named domain entity.
1157
1488
  if (ref.language === 'razor') {
1158
1489
  const razorResult = this.resolveRazorUsing(ref);
1159
1490
  if (razorResult)
1160
1491
  return razorResult;
1161
1492
  }
1162
- // An explicit PHP class import owns its static calls, including an
1163
- // unavailable method. Do not let same-name fallbacks change the receiver
1164
- // to an unrelated Service/Repository type (#1545).
1165
1493
  const phpStaticImport = (0, import_resolver_1.resolvePhpImportedStaticCall)(ref, this.context);
1166
1494
  if (phpStaticImport !== undefined)
1167
1495
  return this.gateLanguage(phpStaticImport, ref);
1168
1496
  const candidates = [];
1169
- // Strategy 1: Try framework-specific resolution. Cross-language bridges
1170
- // are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
1171
- // JS → native `calls`); other code references obey the shared family gate.
1172
1497
  const tFw = this.profileStages ? process.hrtime.bigint() : 0n;
1173
1498
  let fwEarly = null;
1174
- for (const framework of this.frameworks) {
1499
+ for (const framework of this.frameworksFor(ref.language)) {
1175
1500
  const resolved = this.gateFrameworkLanguage(framework.resolve(ref, this.context), ref);
1176
- // Name the resolver on the edge (`metadata.framework`): a Swift→ObjC or
1177
- // React Native bridge hop says how it got into the graph, as a
1178
- // synthesized edge's `synthesizedBy` does.
1179
1501
  const result = resolved ? { ...resolved, metadata: { ...resolved.metadata, framework: framework.name } } : null;
1180
1502
  if (result) {
1181
1503
  if (result.confidence >= 0.9) {
1182
- fwEarly = result; // High confidence, return immediately (below)
1504
+ fwEarly = result;
1183
1505
  break;
1184
1506
  }
1185
1507
  candidates.push(result);
@@ -1189,38 +1511,41 @@ class ReferenceResolver {
1189
1511
  this.stageAdd('frameworks', ref, fwEarly !== null, tFw);
1190
1512
  if (fwEarly)
1191
1513
  return fwEarly;
1192
- // A retained untyped chain supplies effect/call-site evidence only. In
1193
- // particular, importing its root does not make the root its call target.
1194
- // A path through module namespaces is not untyped: `z.coerce.number()`
1195
- // after `import * as z`, where the barrel has `export * as coerce`.
1514
+ if (this.frameworksFor(ref.language).some((f) => f.ownsReference?.(ref, this.context))) {
1515
+ return candidates.length > 0
1516
+ ? candidates.reduce((best, curr) => (curr.confidence > best.confidence ? curr : best))
1517
+ : null;
1518
+ }
1196
1519
  if ((0, name_matcher_1.isUnresolvedJsMemberCall)(ref)) {
1197
1520
  const root = ref.referenceName.slice(0, ref.referenceName.indexOf('.'));
1198
1521
  const namespace = this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.isNamespace && m.localName === root);
1199
1522
  if (!namespace)
1200
- return null;
1523
+ return this.gateLanguage((0, name_matcher_1.matchObjectPathCall)(ref, this.context), ref);
1201
1524
  const viaNamespace = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1202
1525
  const target = viaNamespace ? this.nodeById(viaNamespace.targetNodeId) : null;
1203
1526
  return target && (target.kind === 'function' || target.kind === 'method' || target.kind === 'class' || target.kind === 'constant' || target.kind === 'variable')
1204
1527
  ? viaNamespace : null;
1205
1528
  }
1206
- // Strategy 2: Try import-based resolution
1207
- // A TS/JS/Python call-receiver chain (`useStore.getState().reset`, #1683)
1208
- // names the ROOT's import, not the method's: letting resolveViaImport see
1209
- // it binds the call to the imported store constant and the method is
1210
- // never looked up. The name-matcher owns the chain shape for these
1211
- // languages — the Java/Kotlin/C++ chains keep their existing path.
1212
1529
  if (ref.referenceKind === 'calls' &&
1213
1530
  CHAIN_SHAPE.test(ref.referenceName) &&
1214
1531
  (ref.language === 'typescript' || ref.language === 'javascript' || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'python')) {
1215
- return this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1532
+ const chainResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1533
+ if (!chainResult && name_matcher_1.NEW_RECEIVER_SHAPE.test(ref.referenceName)) {
1534
+ const cls = (0, name_matcher_1.newReceiverClass)(ref, this.context);
1535
+ if (cls && this.context.getNodesByName(cls).some((n) => n.kind === 'class' && (0, name_matcher_1.sameLanguageFamily)(n.language, ref.language))) {
1536
+ this.deferReference(ref, this.deferredChainRefs);
1537
+ }
1538
+ }
1539
+ return chainResult;
1216
1540
  }
1217
1541
  const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
1218
- // `self.get_ip()` is a method call on the instance even when the file
1219
- // also imports a function named `get_ip`: the import never names it.
1220
- const selfCall = ref.language === 'python' && ref.referenceKind === 'calls' &&
1542
+ const selfCall = ref.referenceKind === 'calls' &&
1543
+ (ref.language === 'python' || JS_SELF_CALL_LANGUAGES.has(ref.language)) &&
1221
1544
  this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === ref.referenceName) &&
1222
- (0, name_matcher_1.isPythonSelfCall)(ref, this.context);
1223
- const importResult = selfCall ? null : this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1545
+ ((0, name_matcher_1.isPythonSelfCall)(ref, this.context) || (0, name_matcher_3.isJsThisCall)(ref, this.context));
1546
+ let importResult = selfCall ? null : this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1547
+ if (importResult && (0, name_matcher_1.isImportShadowedByJsBinding)(importResult, ref, this.context))
1548
+ importResult = null;
1224
1549
  if (this.profileStages)
1225
1550
  this.stageAdd('viaImport', ref, !!importResult, tImp);
1226
1551
  if (importResult) {
@@ -1228,38 +1553,17 @@ class ReferenceResolver {
1228
1553
  return importResult;
1229
1554
  candidates.push(importResult);
1230
1555
  }
1231
- // PHP include/require paths resolve to files via import resolution only.
1232
- // If that didn't find the file, do NOT fall back to the symbol
1233
- // name-matcher — it would mis-connect e.g. "inc/db.php" to an unrelated
1234
- // db.php elsewhere in the tree (a wrong edge is worse than none, #660).
1235
- // Terraform refs are directory-scoped by language semantics — the
1236
- // framework resolver IS the whole rulebook (`var.X` can never legally
1237
- // bind outside its module directory), so the name-matcher's
1238
- // qualified-name fallback would only ever add wrong cross-module edges.
1239
- // Nix static path imports are file references for the same reason —
1240
- // falling through would let "./x.nix" name-match an unrelated node.
1241
- if ((0, import_resolver_1.isPhpIncludePathRef)(ref) || (0, import_resolver_1.isCobolCopybookRef)(ref) || (0, import_resolver_1.isNixPathImportRef)(ref) || ref.language === 'terraform') {
1556
+ if ((0, import_resolver_1.isPhpIncludePathRef)(ref) || (0, import_resolver_1.isCobolCopybookRef)(ref) || (0, import_resolver_1.isNixPathImportRef)(ref) || (0, import_resolver_1.isDartImportRef)(ref) || (0, import_resolver_1.isLuaRequireRef)(ref) || ref.language === 'terraform') {
1242
1557
  return candidates.length > 0
1243
1558
  ? candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best)
1244
1559
  : null;
1245
1560
  }
1246
- // Strategy 3: Try name matching
1247
1561
  const tName = this.profileStages ? process.hrtime.bigint() : 0n;
1248
1562
  let nameResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1249
1563
  if (this.profileStages)
1250
1564
  this.stageAdd('nameMatch', ref, !!nameResult, tName);
1251
- // Nix has no ambient cross-file namespace — a callee binds lexically
1252
- // (same file) or through explicit import/callPackage wiring (the import
1253
- // path above). A cross-file name match is wrong by construction: every
1254
- // module `inherit (lib) mkOption`s the same nixpkgs helpers, so the
1255
- // matcher would link each `mkOption` call to whichever file's inherit
1256
- // binding it happened to pick. Same-file matches only.
1257
1565
  if (nameResult) {
1258
1566
  const target = this.nodeById(nameResult.targetNodeId);
1259
- // A definition its language makes file-local — a C `static`, a Kotlin
1260
- // `private fun`, a Go unexported name in another package, a Rust
1261
- // non-`pub` item outside its module subtree — cannot be what a name in
1262
- // another file means, whichever strategy chose it (#1730).
1263
1567
  if (target && !(0, name_matcher_1.isVisibleAcrossFiles)(target, ref, this.context)) {
1264
1568
  nameResult = null;
1265
1569
  }
@@ -1269,10 +1573,6 @@ class ReferenceResolver {
1269
1573
  }
1270
1574
  }
1271
1575
  else if (target && target.language === 'nix') {
1272
- // The reverse direction is just as impossible: no other language can
1273
- // symbolically call into a .nix binding (interop is eval/CLI, never a
1274
- // linkable symbol) — without this, a Python script's `split()` lands
1275
- // on some module's `split = ...` binding as a low-confidence match.
1276
1576
  nameResult = null;
1277
1577
  }
1278
1578
  }
@@ -1280,41 +1580,24 @@ class ReferenceResolver {
1280
1580
  candidates.push(nameResult);
1281
1581
  }
1282
1582
  if (candidates.length === 0) {
1283
- // Defer a chained static-factory/fluent call the first pass couldn't
1284
- // resolve — its method may live on a supertype the receiver conforms to,
1285
- // resolvable once implements/extends edges exist (the conformance pass).
1286
1583
  if (ref.referenceKind === 'calls' &&
1287
1584
  CHAIN_LANGUAGES.has(ref.language) &&
1288
1585
  CHAIN_SHAPE.test(ref.referenceName)) {
1289
1586
  this.deferReference(ref, this.deferredChainRefs);
1290
1587
  }
1291
- else if (
1292
- // PHP `$this->prop->method()` (encoded `this->prop.method`): its method
1293
- // may live on the property's declared supertype, resolvable only once
1294
- // implements/extends edges exist — defer to the same conformance pass.
1295
- ref.referenceKind === 'calls' &&
1588
+ else if (ref.referenceKind === 'calls' &&
1296
1589
  ref.language === 'php' &&
1297
1590
  PHP_PROP_SHAPE.test(ref.referenceName)) {
1298
1591
  this.deferReference(ref, this.deferredChainRefs);
1299
1592
  }
1300
1593
  return null;
1301
1594
  }
1302
- // Return highest confidence candidate
1303
1595
  return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
1304
1596
  }
1305
- /**
1306
- * Create edges from resolved references
1307
- */
1308
1597
  createEdges(resolved) {
1309
1598
  return resolved.flatMap((ref) => {
1310
- // `function_ref` (#756) is internal-only: it persists as a `references`
1311
- // edge (the registration site depends on the callback), distinguishable
1312
- // by metadata.resolvedBy === 'function-ref'. callers/impact already
1313
- // traverse `references`, so registration sites surface with no
1314
- // graph-layer changes.
1315
1599
  let kind = ref.edgeKind ??
1316
1600
  (ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind);
1317
- // Promote "extends" to "implements" when a class/struct targets an interface
1318
1601
  if (kind === 'extends') {
1319
1602
  const targetNode = this.nodeById(ref.targetNodeId);
1320
1603
  if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
@@ -1324,11 +1607,17 @@ class ReferenceResolver {
1324
1607
  }
1325
1608
  }
1326
1609
  }
1327
- // Promote "calls" to "instantiates" when the resolved target is a
1328
- // class/struct/union. Languages without a `new` keyword (Python, Ruby)
1329
- // express instantiation as `Foo()` — extraction can't tell that
1330
- // apart from a function call without symbol info, but resolution
1331
- // can: if `Foo` resolves to a class, the call IS an instantiation.
1610
+ if (kind === 'calls' && ref.original.language === 'go') {
1611
+ const targetNode = this.nodeById(ref.targetNodeId);
1612
+ if (targetNode && name_matcher_1.GO_TYPE_KINDS.has(targetNode.kind))
1613
+ kind = 'references';
1614
+ }
1615
+ if (kind === 'calls' &&
1616
+ ref.original.language === 'pascal' &&
1617
+ !ref.original.referenceName.includes('.') &&
1618
+ PASCAL_CAST_TARGET_KINDS.has(this.nodeById(ref.targetNodeId)?.kind ?? '')) {
1619
+ kind = 'references';
1620
+ }
1332
1621
  if (kind === 'calls') {
1333
1622
  const targetNode = this.nodeById(ref.targetNodeId);
1334
1623
  if (targetNode &&
@@ -1336,9 +1625,6 @@ class ReferenceResolver {
1336
1625
  kind = 'instantiates';
1337
1626
  }
1338
1627
  }
1339
- // One reference can name several targets — a navigation whose
1340
- // destination is a conditional reaches every arm. Each becomes its own
1341
- // edge, sharing this resolution's kind and confidence.
1342
1628
  const targets = [
1343
1629
  { targetNodeId: ref.targetNodeId, metadata: ref.metadata },
1344
1630
  ...(ref.alsoTargets ?? []),
@@ -1353,36 +1639,13 @@ class ReferenceResolver {
1353
1639
  ...(t.metadata ?? {}),
1354
1640
  confidence: ref.confidence,
1355
1641
  resolvedBy: ref.resolvedBy,
1356
- // The ORIGINAL reference text (and kind, when edge-kind promotion
1357
- // rewrote it — calls→instantiates, extends→implements,
1358
- // function_ref→references). If this edge's target is later removed
1359
- // by a re-index, the edge is resurrected as exactly this ref and
1360
- // re-resolved (#1240 removal case) — a faithful resurrection, so
1361
- // re-resolution can never bind anywhere a full re-index wouldn't.
1362
- // Reconstruction from the target node's name instead would strip
1363
- // receiver/qualifier context (`h.greet` → `greet`) and risk a
1364
- // wrong rebind; edges without refName (pre-#1240, synthesized) are
1365
- // deliberately NOT resurrected for the same reason.
1366
1642
  refName: ref.original.referenceName,
1367
1643
  ...(ref.original.referenceKind !== kind ? { refKind: ref.original.referenceKind } : {}),
1368
- // Uniform marker for function-as-value edges (#756), regardless of
1369
- // which strategy resolved them (import vs matchFunctionRef) — lets
1370
- // tooling label "callback registration" and lets validation diff
1371
- // exactly the edges this feature added.
1372
1644
  ...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
1373
1645
  },
1374
1646
  }));
1375
1647
  });
1376
1648
  }
1377
- /**
1378
- * Split resolved refs into rows deletable by id and hand-built refs that
1379
- * must fall back to the key-tuple delete. Rows loaded from the database
1380
- * carry their row id and are deleted by exactly that id; the key tuple
1381
- * omits line/col, so it also removes SIBLING rows — the same caller calling
1382
- * the same callee at other lines — that a later batch hadn't attempted yet:
1383
- * when a batch boundary split a caller's same-named call sites, the later
1384
- * sites' edges were silently never created (#1269).
1385
- */
1386
1649
  static partitionResolvedCleanup(resolved) {
1387
1650
  const rowIds = [];
1388
1651
  const legacyKeys = [];
@@ -1398,29 +1661,29 @@ class ReferenceResolver {
1398
1661
  }
1399
1662
  return { rowIds, legacyKeys };
1400
1663
  }
1401
- /**
1402
- * Same row-id precision for parking unresolvable refs as status='failed'
1403
- * (#1240): the key-tuple fallback would flip same-key sibling rows in later
1404
- * batches to 'failed' before they were ever attempted, and resolution
1405
- * outcome can differ per call site (receiver-type inference reads the
1406
- * ref's line), so a sibling must not inherit this row's failure (#1269).
1407
- */
1408
1664
  static partitionFailedCleanup(unresolved) {
1409
1665
  const byRowId = [];
1410
1666
  const legacyKeys = [];
1411
1667
  for (const r of unresolved) {
1412
1668
  if (r.rowId != null)
1413
- byRowId.push({ rowId: r.rowId, referenceName: r.referenceName });
1669
+ byRowId.push({ rowId: r.rowId, referenceName: r.referenceName, referenceKind: r.referenceKind, nameTail: r.nameTail });
1414
1670
  else
1415
1671
  legacyKeys.push({
1416
1672
  fromNodeId: r.fromNodeId,
1417
1673
  referenceName: r.referenceName,
1418
1674
  referenceKind: r.referenceKind,
1675
+ nameTail: r.nameTail,
1419
1676
  });
1420
1677
  }
1421
1678
  return { byRowId, legacyKeys };
1422
1679
  }
1423
- /** A deferred attempt is unfinished work, not a final failure (#1577). */
1680
+ parkable(ref) {
1681
+ const read = this.lastResolved?.ref === ref ? this.lastResolved.context : this.context;
1682
+ const tail = (0, import_resolver_1.importBindingTail)(ref, this.context, read);
1683
+ if (tail)
1684
+ ref.nameTail = tail;
1685
+ return ref;
1686
+ }
1424
1687
  nonDeferredFailures(unresolved) {
1425
1688
  return unresolved.filter((ref) => ref.rowId == null || !this.deferredRowIds.has(ref.rowId));
1426
1689
  }
@@ -1429,9 +1692,6 @@ class ReferenceResolver {
1429
1692
  if (ref.rowId != null)
1430
1693
  this.deferredRowIds.add(ref.rowId);
1431
1694
  }
1432
- /**
1433
- * Resolve and persist edges to database
1434
- */
1435
1695
  resolveAndPersist(unresolvedRefs, onProgress) {
1436
1696
  const prerequisites = unresolvedRefs.filter(ReferenceResolver.isPrerequisite);
1437
1697
  if (prerequisites.length > 0 && prerequisites.length < unresolvedRefs.length) {
@@ -1440,27 +1700,15 @@ class ReferenceResolver {
1440
1700
  return ReferenceResolver.mergeResults(first, rest);
1441
1701
  }
1442
1702
  const result = this.resolveAll(unresolvedRefs, onProgress);
1443
- // Create edges from resolved references
1444
1703
  const edges = this.createEdges(result.resolved);
1445
- // Insert edges into database
1446
1704
  if (edges.length > 0) {
1447
1705
  this.queries.insertEdges(edges);
1448
1706
  }
1449
- // Clean up resolved refs from unresolved_refs table so metrics are accurate
1450
1707
  if (result.resolved.length > 0) {
1451
1708
  const { rowIds, legacyKeys } = ReferenceResolver.partitionResolvedCleanup(result.resolved);
1452
1709
  this.queries.deleteReferencesByRowIds(rowIds);
1453
1710
  this.queries.deleteSpecificResolvedReferences(legacyKeys);
1454
1711
  }
1455
- // Park unresolvable refs as status='failed' — parity with
1456
- // resolveAndPersistBatched. Deleting them was wrong (#1240): a ref whose
1457
- // own file never changes is otherwise gone forever, so when a DIFFERENT
1458
- // file later gains the export/symbol that would satisfy it, no sync can
1459
- // recreate the edge — only a full re-index. Failed rows are excluded from
1460
- // the pending readers, which preserves the #1187 orphan sweep's
1461
- // invariant in status form: after a COMPLETED pass nothing it processed
1462
- // is still 'pending', so any pending row at rest belongs to an
1463
- // interrupted run and the sweep can key off the pending count.
1464
1712
  if (result.unresolved.length > 0) {
1465
1713
  const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
1466
1714
  this.queries.markReferencesFailedByRowIds(byRowId);
@@ -1468,15 +1716,6 @@ class ReferenceResolver {
1468
1716
  }
1469
1717
  return result;
1470
1718
  }
1471
- /**
1472
- * Yielding counterpart of {@link resolveAndPersist} for a caller-supplied
1473
- * ref list — used by sync's failed-ref retry pass (#1240). Same persistence
1474
- * semantics: resolved refs become edges and their rows are deleted;
1475
- * still-unresolvable refs are (re-)marked failed (a no-op for rows already
1476
- * in that status). Yields per-ref because sync can run on the daemon's
1477
- * liveness-watchdog thread (#850/#1091) and a retry set is unbounded when
1478
- * a large edit lands many popular symbol names at once.
1479
- */
1480
1719
  async resolveAndPersistListYielding(refs) {
1481
1720
  const prerequisites = refs.filter(ReferenceResolver.isPrerequisite);
1482
1721
  if (prerequisites.length > 0 && prerequisites.length < refs.length) {
@@ -1516,7 +1755,6 @@ class ReferenceResolver {
1516
1755
  }
1517
1756
  return edges.length;
1518
1757
  }
1519
- /** Finalize the durable queue only AFTER its edges have been inserted. */
1520
1758
  async persistDeferredReferences(deferred, resolved) {
1521
1759
  for (const ref of deferred)
1522
1760
  if (ref.rowId != null)
@@ -1532,7 +1770,6 @@ class ReferenceResolver {
1532
1770
  this.clearCaches();
1533
1771
  return count;
1534
1772
  }
1535
- /** Same two phases as the bounded DB reader: persist wiring before calls. */
1536
1773
  static isPrerequisite(ref) {
1537
1774
  return ref.referenceKind === 'imports' || ref.referenceKind === 'extends' || ref.referenceKind === 'implements';
1538
1775
  }
@@ -1552,43 +1789,22 @@ class ReferenceResolver {
1552
1789
  },
1553
1790
  };
1554
1791
  }
1555
- /**
1556
- * Second resolution pass for chained static-factory / fluent calls whose
1557
- * chained method is defined on a SUPERTYPE the receiver's type conforms to —
1558
- * a protocol-extension / inherited / default-interface method (#750). The
1559
- * first pass can't resolve these because `implements`/`extends` edges aren't
1560
- * built yet; this runs AFTER edges are persisted, so `context.getSupertypes`
1561
- * (and the conformance fallback in resolveMethodOnType) can walk them.
1562
- *
1563
- * Operates only on the leftover unresolved refs that have the `inner().method`
1564
- * chain shape, for the dotted-chain languages — a small set — and is idempotent
1565
- * (re-resolving an already-resolved ref is a no-op since it's been deleted).
1566
- * Returns the number of newly-created edges.
1567
- */
1568
1792
  async resolveChainedCallsViaConformance() {
1569
1793
  const deferred = this.deferredChainRefs;
1570
1794
  this.deferredChainRefs = [];
1571
1795
  if (deferred.length === 0)
1572
1796
  return 0;
1573
- // Read fresh edges (the main pass built the implements/extends edges after
1574
- // these refs were deferred). matchDottedCallChain now resolves a method on a
1575
- // supertype via context.getSupertypes -> resolveMethodOnType's conformance walk.
1576
1797
  this.clearCaches();
1577
- // This post-pass runs synchronously on the indexer's main thread; yield
1578
- // periodically so the #850 liveness watchdog heartbeat can fire on a repo
1579
- // with many deferred chained calls (#1091).
1580
1798
  const maybeYield = (0, cooperative_yield_1.createYielder)();
1581
1799
  const resolved = [];
1582
1800
  for (const ref of deferred) {
1583
- // PHP `this->prop.method` resolves via matchMethodCall (declared-type
1584
- // inference + resolveMethodOnType conformance walk); `::`-receiver
1585
- // languages (Rust) split on `::` (matchScopedCallChain); other
1586
- // dotted-receiver languages on `.` (matchDottedCallChain).
1587
1801
  const chainMatch = (ref.language === 'php' && PHP_PROP_SHAPE.test(ref.referenceName))
1588
1802
  ? (0, name_matcher_1.matchMethodCall)(ref, this.context)
1589
- : SCOPED_CHAIN_LANGUAGES.has(ref.language)
1590
- ? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
1591
- : (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
1803
+ : name_matcher_1.NEW_RECEIVER_SHAPE.test(ref.referenceName)
1804
+ ? (0, name_matcher_1.matchNewReceiverCall)(ref, this.context)
1805
+ : SCOPED_CHAIN_LANGUAGES.has(ref.language)
1806
+ ? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
1807
+ : (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
1592
1808
  const match = this.gateLanguage(chainMatch, ref);
1593
1809
  if (match)
1594
1810
  resolved.push(match);
@@ -1596,19 +1812,6 @@ class ReferenceResolver {
1596
1812
  }
1597
1813
  return this.persistDeferredReferences(deferred, resolved);
1598
1814
  }
1599
- /**
1600
- * Resolve one batch with a yield checkpoint between EVERY ref so the #850
1601
- * liveness heartbeat can fire on a slow/dense batch (#1091). The checkpoint
1602
- * granularity is per-ref — not per-N-refs — because per-ref cost is unbounded
1603
- * in the worst case (a collision-heavy method name whose candidate set misses
1604
- * the LRU re-fetches tens of thousands of rows): any fixed N multiplies that
1605
- * worst case into the watchdog window, which is how v1.2.0 still got killed
1606
- * at "Resolving refs" on large Java monorepos (#1122). `maybeYield()` is a
1607
- * ~ns time check when under budget, so per-ref checkpoints cost nothing.
1608
- * Behaviourally identical to `resolveAll(batch)`: `warmCaches()` is
1609
- * idempotent (guarded) and `resolveOne` is independent per ref, so yielding
1610
- * between refs changes only timing, never which edges get created.
1611
- */
1612
1815
  async resolveBatchYielding(batch, maybeYield) {
1613
1816
  this.warmCaches();
1614
1817
  this.advanceSupertypeGeneration();
@@ -1632,10 +1835,8 @@ class ReferenceResolver {
1632
1835
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
1633
1836
  }
1634
1837
  else {
1635
- unresolved.push(ref);
1838
+ unresolved.push(this.parkable(ref));
1636
1839
  }
1637
- // Fast-path the per-ref yield check: awaiting the async no-op costs a
1638
- // microtask hop per ref, which dominates at ~10⁵ refs (see MaybeYield).
1639
1840
  const y = maybeYield();
1640
1841
  if (y)
1641
1842
  await y;
@@ -1651,30 +1852,7 @@ class ReferenceResolver {
1651
1852
  },
1652
1853
  };
1653
1854
  }
1654
- /**
1655
- * Resolve a list of refs and return everything the ADMISSION side needs to
1656
- * persist the outcome: resolutions, failures, the deferred post-pass refs
1657
- * this run produced (drained, so the caller owns routing them), and stats.
1658
- * This is the resolver-worker entry point — it runs the exact per-ref loop
1659
- * of resolveBatchYielding, minus the main-thread yields (worker threads have
1660
- * no watchdog heartbeat to starve). Results are in input order.
1661
- */
1662
- /**
1663
- * CODEGRAPH_RESOLVE_PROFILE=1: per-outcome wall-clock histogram of
1664
- * resolveOne, keyed by the winning strategy (`resolvedBy`) or
1665
- * `fail:<referenceKind>` — the §7a.2 "profile the per-ref path" probe. The
1666
- * kernel-scale batch loop is ~430s and CORE-INVARIANT (835.9s pooled-4-on-8
1667
- * ≈ 812.5s sequential-on-2 for the whole superphase), so the next lever is
1668
- * which CLASS of ref the time belongs to, not more parallelism. Off by
1669
- * default: the hrtime pair costs ~100ns/ref only when the env is set.
1670
- */
1671
1855
  resolveProfile = process.env.CODEGRAPH_RESOLVE_PROFILE ? new Map() : null;
1672
- /**
1673
- * CODEGRAPH_RESOLVE_PROFILE=2 additionally attributes time to the
1674
- * STRATEGIES inside resolveOne (`stage:<name>|<refKind>|hit/miss` rows in
1675
- * the same histogram) — i.e. WHICH machinery a failing class of refs pays
1676
- * for, not just that it fails. =1 keeps the per-outcome rows only.
1677
- */
1678
1856
  profileStages = process.env.CODEGRAPH_RESOLVE_PROFILE === '2';
1679
1857
  stageAdd(stage, ref, hit, t0) {
1680
1858
  if (!this.resolveProfile)
@@ -1707,7 +1885,6 @@ class ReferenceResolver {
1707
1885
  }
1708
1886
  return result;
1709
1887
  }
1710
- /** Dump the CODEGRAPH_RESOLVE_PROFILE histogram to stderr (no-op when off). */
1711
1888
  dumpResolveProfile(label) {
1712
1889
  if (!this.resolveProfile || this.resolveProfile.size === 0)
1713
1890
  return;
@@ -1717,7 +1894,6 @@ class ReferenceResolver {
1717
1894
  for (const r of rows) {
1718
1895
  console.error(`[resolve-profile] ${label} ${r.k}: n=${r.n} total=${(r.ms / 1000).toFixed(1)}s avg=${((r.ms * 1000) / Math.max(1, r.n)).toFixed(0)}µs`);
1719
1896
  }
1720
- // =2 only: this thread's matchReference sub-stage table rides along.
1721
1897
  (0, name_matcher_1.dumpNameMatcherProfile)(label);
1722
1898
  }
1723
1899
  resolveListForAdmission(refs) {
@@ -1743,10 +1919,10 @@ class ReferenceResolver {
1743
1919
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
1744
1920
  }
1745
1921
  else {
1746
- unresolved.push(ref);
1922
+ unresolved.push(this.parkable(ref));
1747
1923
  }
1748
1924
  }
1749
- this.deferredRowIds.clear(); // the admission side now owns both queues
1925
+ this.deferredRowIds.clear();
1750
1926
  return {
1751
1927
  resolved,
1752
1928
  unresolved,
@@ -1755,57 +1931,20 @@ class ReferenceResolver {
1755
1931
  byMethod,
1756
1932
  };
1757
1933
  }
1758
- /**
1759
- * The resolver's live ResolutionContext — resolver-pool workers use it to
1760
- * run synthesis passes against their own read-only connection.
1761
- */
1762
1934
  getResolutionContext() {
1763
1935
  return this.context;
1764
1936
  }
1765
- /**
1766
- * Re-queue deferred post-pass refs produced by resolver workers, preserving
1767
- * their admission order so resolveChainedCallsViaConformance /
1768
- * resolveDeferredThisMemberRefs process them exactly as the sequential path
1769
- * would have.
1770
- */
1771
1937
  appendDeferredFromWorkers(deferredChain, deferredThisMember) {
1772
1938
  for (const ref of deferredChain)
1773
1939
  this.deferReference(ref, this.deferredChainRefs);
1774
1940
  for (const ref of deferredThisMember)
1775
1941
  this.deferReference(ref, this.deferredThisMemberRefs);
1776
1942
  }
1777
- /**
1778
- * Resolve and persist in batches to keep memory bounded.
1779
- * Processes unresolved references in chunks, persisting edges and cleaning
1780
- * up resolved refs after each batch to avoid accumulating large arrays.
1781
- */
1782
- async resolveAndPersistBatched(onProgress, batchSize = 5000, onSynthesisProgress,
1783
- // When provided, big batches fan out across a read-only resolver-worker
1784
- // pool with results admitted in canonical order (see resolver-pool.ts).
1785
- // Sequential fallback on any pool failure. CODEGRAPH_NO_PARALLEL_RESOLVE=1
1786
- // disables entirely. bulkEdgeLoad hooks (when provided) bracket the batch
1787
- // loop with drop/recreate of the non-unique edge indexes on big runs —
1788
- // see DatabaseConnection.beginBulkEdgeLoad. backpressure (when provided)
1789
- // is the WAL valve's writer-side backstop (WalCheckpointValve.backpressure):
1790
- // called at pool-idle boundaries so a full backfill can actually complete —
1791
- // the valve's timer-driven passive passes stay perpetually partial against
1792
- // the pool's continuous reads, which is how a kernel-scale resolution grew
1793
- // a 22GB WAL on a 4.6GB DB (migration plan §7a.1).
1794
- parallel, synthesize = true) {
1795
- // Resolution runs on the indexer's MAIN thread, and the #850 liveness
1796
- // watchdog SIGKILLs a process whose event loop stalls past its window (60s
1797
- // by default). A single dense batch's resolveAll — or the synthesis pass
1798
- // below — can exceed that on a large repo, killing a VALID in-progress index
1799
- // (#1091). A shared yielder lets both give the watchdog heartbeat a regular
1800
- // window to fire; see ./cooperative-yield.
1943
+ async resolveAndPersistBatched(onProgress, batchSize = 5000, onSynthesisProgress, parallel, synthesize = true) {
1801
1944
  const maybeYield = (0, cooperative_yield_1.createYielder)();
1802
1945
  if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
1803
1946
  console.error(`[pool-timing] backpressure hook: ${parallel?.backpressure ? 'present' : 'absent'}`);
1804
1947
  }
1805
- // CODEGRAPH_RESOLVE_PROFILE loop-stage attribution: the §7a.2 kernel-scale
1806
- // histogram showed resolveOne owns only ~93s of the ~436s batch loop —
1807
- // these counters name where the other ~340s goes (reads, edge build+insert,
1808
- // deletes/marks, the per-batch count guard).
1809
1948
  const loopProf = process.env.CODEGRAPH_RESOLVE_PROFILE
1810
1949
  ? { read: 0, settle: 0, backpressure: 0, recycle: 0, createEdges: 0, insertEdges: 0, deletes: 0, marks: 0, countGuard: 0 }
1811
1950
  : null;
@@ -1821,24 +1960,21 @@ class ReferenceResolver {
1821
1960
  unresolved: 0,
1822
1961
  byMethod: {},
1823
1962
  };
1824
- // Parallel pool, started immediately but never awaited up front: early
1825
- // batches run sequentially while the workers boot (module load + readonly
1826
- // DB open + framework detect + cache warm ≈ hundreds of ms), and the loop
1827
- // switches to fan-out the moment the pool reports ready — so pool boot
1828
- // costs zero wall-clock. Any failure downgrades to sequential permanently.
1829
1963
  let pool = null;
1830
1964
  let poolReady = false;
1831
- // True once pool creation has been attempted by EITHER engage site (the
1832
- // up-front ref-count gate or the adaptive projection below) — a pool that
1833
- // failed or was destroyed must stay down (downgrade is permanent), and
1834
- // tryCreate's sizing probes shouldn't re-run every batch on hosts that
1835
- // declined.
1836
1965
  let poolEngageTried = false;
1837
- const createPool = (t0, why) => {
1966
+ const createPool = (t0, why, worth) => {
1838
1967
  poolEngageTried = true;
1839
1968
  if (!parallel)
1840
1969
  return null;
1841
- const p = resolver_pool_1.ResolverPool.tryCreate(parallel.dbPath, this.projectRoot);
1970
+ const p = resolver_pool_1.ResolverPool.tryCreate(parallel.dbPath, this.projectRoot, parallel.shareFrameworks ? this.getDetectedFrameworks() : undefined, worth);
1971
+ if (p && parallel.shareFrameworks) {
1972
+ const scans = this.projectScans();
1973
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1974
+ console.error(`[pool-timing] project scans: ${scans.cpp ? 'shared' : 'none'}`);
1975
+ if (scans.cpp)
1976
+ p.shareScans(scans);
1977
+ }
1842
1978
  p?.ready().then(() => {
1843
1979
  poolReady = true;
1844
1980
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
@@ -1852,33 +1988,15 @@ class ReferenceResolver {
1852
1988
  };
1853
1989
  if (parallel && total >= (0, resolver_pool_1.minRefsForPool)()) {
1854
1990
  pool = createPool(Date.now(), 'ref-count');
1991
+ if (pool)
1992
+ await (0, resolver_pool_1.poolStartSettled)(pool.ready());
1855
1993
  }
1856
- // Adaptive engagement bar (see the batch-loop hook): projected remaining
1857
- // sequential settle above this boots the pool mid-loop. Boot is async and
1858
- // fan-out waits for ready, so a marginal engage costs background boot
1859
- // only; the bar just needs to clear the fan-out's own overhead class.
1860
1994
  const ADAPTIVE_ENGAGE_SETTLE_MS = 400;
1861
1995
  let adaptiveSeqMs = 0;
1862
1996
  let adaptiveSeqRefs = 0;
1863
- // Process in PIPELINED batches (double-buffer). The enumeration is the
1864
- // head of the pending set in rowid order; every ref a persisted batch
1865
- // processed leaves the pending set (resolved rows are deleted,
1866
- // unresolvable ones flip to status='failed'), shifting the remaining
1867
- // pending rows forward.
1868
1997
  let prevRemaining = Number.POSITIVE_INFINITY;
1869
- // Cadence for the worker connection recycling below — ~8 batches
1870
- // ≈ 40k refs between recycles keeps the WAL shallow at kernel scale
1871
- // while a small sync never recycles at all. (25 recovered only half
1872
- // the write tax — the WAL re-deepened between recycles; reopens are
1873
- // sub-millisecond so the shorter cadence is ~free.)
1874
1998
  const RECYCLE_EVERY_BATCHES = 8;
1875
1999
  let batchesSinceRecycle = 0;
1876
- // Begin one batch: fan out to the pool when it's ready and the batch is
1877
- // big enough — workers then resolve batch k+1 WHILE the main thread
1878
- // persists batch k (persist measured at ~58% of resolution wall on a
1879
- // 255k-ref repo, all of it previously spent with the pool idle).
1880
- // Sequential batches stay lazy: they run on the main thread at settle
1881
- // time, where an early start would only contend with the persist.
1882
2000
  const beginBatch = (batch) => {
1883
2001
  if (pool && poolReady && resolver_pool_1.ResolverPool.worthParallel(batch.length)) {
1884
2002
  return {
@@ -1888,11 +2006,6 @@ class ReferenceResolver {
1888
2006
  }
1889
2007
  return { mode: 'seq' };
1890
2008
  };
1891
- // Settle an in-flight batch to a ResolutionResult. Deferred post-pass refs
1892
- // are appended HERE, in loop order — never inside the fan-out promise — so
1893
- // admission order stays exactly the sequential order even while a later
1894
- // batch resolves concurrently. A pool failure downgrades to sequential
1895
- // permanently and re-resolves this batch on the main thread.
1896
2009
  const settleBatch = async (inFlight, batch) => {
1897
2010
  if (inFlight.mode === 'pool') {
1898
2011
  const settled = await inFlight.settled;
@@ -1918,41 +2031,27 @@ class ReferenceResolver {
1918
2031
  }
1919
2032
  return this.resolveBatchYielding(batch, maybeYield);
1920
2033
  };
1921
- // Bulk edge load: on big runs, drop the non-unique edge indexes for the
1922
- // duration of the batch loop (the identity index stays — OR IGNORE dedup
1923
- // and the source-keyed supertype-walk reads both live on it). Recreated in
1924
- // the inner finally BEFORE synthesis, whose passes read kind-keyed.
1925
- // Measured on a 224k-edge resolution set: insert 2.8s → 1.1s + 0.3s
1926
- // recreate. Same ref-count gate as the pool so small syncs never pay the
1927
- // recreate cost.
1928
2034
  let bulkEdgesActive = false;
1929
2035
  if (parallel?.bulkEdgeLoad && total >= (0, resolver_pool_1.minRefsForPool)()) {
1930
2036
  try {
1931
2037
  parallel.bulkEdgeLoad.begin();
1932
2038
  bulkEdgesActive = true;
1933
2039
  }
1934
- catch { /* keep the indexes; inserts just pay the per-row maintenance */ }
2040
+ catch { }
1935
2041
  }
1936
- // Same gate for the ref-index window: the loop's deletes stop maintaining
1937
- // the five sync-path unresolved_refs indexes, and the end-of-loop rebuild
1938
- // is near-free (only failed refs survive the loop).
1939
2042
  let bulkRefsActive = false;
1940
2043
  if (parallel?.refIndexLoad && total >= (0, resolver_pool_1.minRefsForPool)()) {
1941
2044
  try {
1942
2045
  parallel.refIndexLoad.begin();
1943
2046
  bulkRefsActive = true;
1944
2047
  }
1945
- catch { /* keep the indexes; deletes just pay the per-row maintenance */ }
2048
+ catch { }
1946
2049
  }
1947
2050
  try {
1948
2051
  try {
1949
- // Orphans retain interruption/re-extraction order, not clean-index order.
1950
- // A caller can precede its imports or supertypes by many batches (#1577).
1951
- // Drain those prerequisites first, then start a fresh keyset cursor over
1952
- // the remaining kinds. The disjoint filters let us prefetch across the
1953
- // phase boundary before cleanup without re-reading the current batch.
1954
2052
  let prerequisites = true;
1955
2053
  let afterRowId = 0;
2054
+ let readDependents = false;
1956
2055
  const readNextBatch = () => {
1957
2056
  let next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
1958
2057
  if (next.length === 0 && prerequisites) {
@@ -1962,35 +2061,30 @@ class ReferenceResolver {
1962
2061
  }
1963
2062
  if (next.length > 0)
1964
2063
  afterRowId = next[next.length - 1].rowId;
2064
+ readDependents = !prerequisites;
1965
2065
  return next;
1966
2066
  };
1967
2067
  tLp = Date.now();
1968
2068
  let batch = readNextBatch();
1969
2069
  lp('read', tLp);
2070
+ let batchIsDependents = readDependents;
1970
2071
  let inFlight = batch.length > 0 ? beginBatch(batch) : null;
1971
2072
  while (batch.length > 0 && inFlight) {
1972
- // Prefetch the NEXT batch before this one persists: this batch's rows
1973
- // are still pending (nothing has mutated the table since they were
1974
- // read), so seeking past this batch's last row id in the same rowid
1975
- // enumeration yields the following batch (keyset — OFFSET re-walked the
1976
- // accumulated failed prefix every read, 54.6s at kernel scale, §7a.2).
1977
2073
  tLp = Date.now();
1978
2074
  const nextBatch = readNextBatch();
1979
2075
  lp('read', tLp);
2076
+ const nextIsDependents = readDependents;
2077
+ let nextInFlight = null;
2078
+ if (batchIsDependents && inFlight.mode === 'pool' && nextBatch.length > 0 && batchesSinceRecycle + 1 < RECYCLE_EVERY_BATCHES) {
2079
+ const ahead = beginBatch(nextBatch);
2080
+ if (ahead.mode === 'pool')
2081
+ nextInFlight = ahead;
2082
+ }
1980
2083
  const tBatch = Date.now();
1981
2084
  const result = await settleBatch(inFlight, batch);
1982
2085
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1983
2086
  console.error(`[pool-timing] batch ${inFlight.mode}: ${batch.length} refs in ${Date.now() - tBatch}ms`);
1984
2087
  lp('settle', tBatch);
1985
- // Adaptive pool engagement: the fixed ref-count gate can't see PER-REF
1986
- // cost, and settle rates differ ~9× by language (56k Rust refs cost
1987
- // more sequential settle than 154k Go refs — 36µs vs 4µs measured on
1988
- // tokio/prometheus). After each sequential batch, project the remaining
1989
- // settle from the observed rate and boot the pool mid-loop when it
1990
- // clears the bar. The loop already switches to fan-out only when the
1991
- // async boot reports ready, admission order is mode-independent, and
1992
- // 2-core/low-memory hosts still decline inside tryCreate's sizing —
1993
- // so the switch changes wall-clock, never the graph.
1994
2088
  if (inFlight.mode === 'seq' && parallel && pool === null && !poolEngageTried) {
1995
2089
  adaptiveSeqMs += Date.now() - tBatch;
1996
2090
  adaptiveSeqRefs += batch.length;
@@ -2000,30 +2094,14 @@ class ReferenceResolver {
2000
2094
  if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
2001
2095
  console.error(`[pool-timing] adaptive engage: projected ${Math.round(projectedMs)}ms sequential settle over ${remaining} remaining refs`);
2002
2096
  }
2003
- pool = createPool(Date.now(), 'adaptive');
2097
+ pool = createPool(Date.now(), 'adaptive', (0, resolver_pool_1.resolveWorkersWorthStarting)(projectedMs));
2004
2098
  }
2005
2099
  }
2006
- // WAL-valve backstop at the ONE pool-idle boundary of the double-buffer
2007
- // (this batch settled, the next not yet fanned out): past the hard cap
2008
- // the writer parks for a full backfill here, where the pool's readers
2009
- // are all between statements — so the backfill completes, readers
2010
- // re-enter at SQLite's backfilled mark, and the next persist commit
2011
- // WRAPS the WAL instead of growing it. No-op (one fstat) under the cap.
2012
2100
  tLp = Date.now();
2013
- const bp = parallel?.backpressure?.();
2101
+ const bp = nextInFlight ? null : parallel?.backpressure?.();
2014
2102
  if (bp)
2015
2103
  await bp;
2016
2104
  lp('backpressure', tLp);
2017
- // Recycle the workers' read connections periodically at this same
2018
- // worker-idle boundary (batch k settled, batch k+1 not yet fanned
2019
- // out): a long-lived reader pins WAL checkpoint progress, and the
2020
- // deep WAL that accumulates behind it taxes the writer's OWN page
2021
- // operations — the §7a.6 writes-under-readers finding (deletes
2022
- // 42.6s → 118.8s from 0 to 4 attached readers; an aggressive valve
2023
- // recovered the writes but paid +129s in full-park folds). Releasing
2024
- // the read marks every ~25 batches lets the existing checkpoints
2025
- // advance instead, at ~milliseconds of reopen cost. A failed recycle
2026
- // downgrades to sequential permanently, same as a failed fan-out.
2027
2105
  if (pool && poolReady && ++batchesSinceRecycle >= RECYCLE_EVERY_BATCHES) {
2028
2106
  batchesSinceRecycle = 0;
2029
2107
  tLp = Date.now();
@@ -2039,49 +2117,24 @@ class ReferenceResolver {
2039
2117
  }
2040
2118
  lp('recycle', tLp);
2041
2119
  }
2042
- // Persist in bounded sub-transactions with yields between: a whole
2043
- // batch's edge insert / keyed deletes are otherwise one solid
2044
- // synchronous span each on a multi-GB index, sitting BETWEEN the
2045
- // per-ref yields — the last unyielded stretch of the resolution loop.
2046
- // Crash semantics are unchanged (already several transactions): edges
2047
- // land before their refs are deleted, so a kill mid-way re-resolves
2048
- // the remainder idempotently on the next run/sweep (#1187).
2049
2120
  const PERSIST_CHUNK = 1000;
2050
2121
  const tPersist = Date.now();
2051
- // A batch that made `extends`/`implements` edges persists them BEFORE
2052
- // fanning out the next batch: later batches read them —
2053
- // resolveMethodOnType walks supertype chains over edges that earlier
2054
- // batches resolved, so a receiver typed as a subclass only reaches a
2055
- // method declared on its base class if those edges are visible.
2056
- // (Validated on dubbo: fanning out first downgraded exactly those
2057
- // supertype-method resolutions from the 0.9 typed-receiver path to the
2058
- // 0.65 word-overlap fallback.) They are the only edges resolution reads
2059
- // (RESOLUTION_READ_EDGE_KINDS), so a batch that made none — every batch
2060
- // after the prerequisite phase readNextBatch drains first — fans the
2061
- // next batch out now and inserts while it resolves: the same writes in
2062
- // the same order, and nothing the workers read differs.
2063
2122
  tLp = Date.now();
2064
2123
  const edges = this.createEdges(result.resolved);
2065
2124
  lp('createEdges', tLp);
2066
2125
  const readEdge = edges.some((e) => RESOLUTION_READ_EDGE_KINDS.includes(e.kind));
2067
- let nextInFlight = !readEdge && nextBatch.length > 0 ? beginBatch(nextBatch) : null;
2126
+ if (readEdge)
2127
+ nextInFlight = null;
2128
+ else if (!nextInFlight && nextBatch.length > 0)
2129
+ nextInFlight = beginBatch(nextBatch);
2068
2130
  tLp = Date.now();
2069
2131
  for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
2070
2132
  this.queries.insertEdges(edges.slice(i, i + PERSIST_CHUNK));
2071
2133
  await maybeYield();
2072
2134
  }
2073
2135
  lp('insertEdges', tLp);
2074
- // NOW fan the next batch out (if not already) — workers see exactly the
2075
- // edge state the sequential baseline would (every batch ≤ this one
2076
- // committed), while the main thread spends the REST of the persist (ref
2077
- // deletes + failed parking below) overlapped with their resolution —
2078
- // the double-buffer.
2079
2136
  if (!nextInFlight && nextBatch.length > 0)
2080
2137
  nextInFlight = beginBatch(nextBatch);
2081
- // Clean up resolved refs so they don't appear in the next batch —
2082
- // by row id, so a same-key sibling ref in a LATER batch (same caller
2083
- // calling the same callee at another line) is left pending for its own
2084
- // attempt instead of being swept out with this batch's rows (#1269).
2085
2138
  tLp = Date.now();
2086
2139
  let removedThisBatch = 0;
2087
2140
  const resolvedCleanup = ReferenceResolver.partitionResolvedCleanup(result.resolved);
@@ -2094,10 +2147,6 @@ class ReferenceResolver {
2094
2147
  await maybeYield();
2095
2148
  }
2096
2149
  lp('deletes', tLp);
2097
- // Park unresolvable refs from this batch as status='failed' so they
2098
- // leave the pending set (the batch reader and non-progress guard below
2099
- // only see pending rows) but stay retryable when a later sync adds a
2100
- // symbol that could satisfy them (#1240).
2101
2150
  tLp = Date.now();
2102
2151
  const failures = this.nonDeferredFailures(result.unresolved);
2103
2152
  const deferredCount = result.unresolved.length - failures.length;
@@ -2113,7 +2162,6 @@ class ReferenceResolver {
2113
2162
  lp('marks', tLp);
2114
2163
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2115
2164
  console.error(`[pool-timing] batch persist: ${Date.now() - tPersist}ms`);
2116
- // Aggregate stats
2117
2165
  aggregateStats.total += result.stats.total;
2118
2166
  aggregateStats.resolved += result.stats.resolved;
2119
2167
  aggregateStats.unresolved += result.stats.unresolved;
@@ -2122,31 +2170,7 @@ class ReferenceResolver {
2122
2170
  }
2123
2171
  processed += batch.length;
2124
2172
  onProgress?.(processed, total);
2125
- // Yield so progress UI can render between batches
2126
2173
  await new Promise(resolve => setImmediate(resolve));
2127
- // NOTE: there used to be an extra early break here when a batch resolved
2128
- // nothing (`result.unresolved.length === batch.length`). That was wrong:
2129
- // an all-unresolvable batch still DELETES its rows (progress), yet the
2130
- // break abandoned every batch after it in the same run — on a repo whose
2131
- // first 5000 refs are all external/stdlib calls, resolution stopped at
2132
- // batch one and left the rest of the table as permanent orphans (#1187).
2133
- // The count-based guard below catches the true no-progress case.
2134
- // Non-progress guard (defense-in-depth). Ordinary attempts must leave
2135
- // the pending set; a mismatched original reference can make legacy-key
2136
- // cleanup a no-op. Keep the guard against that broken persistence even
2137
- // though keyset pagination now advances independently of row cleanup.
2138
- // An abandoned prefetched batch has no side effects until settleBatch.
2139
- // Non-progress signal, now O(1): `changes` summed across this batch's
2140
- // deletes + failed-parks is the DIRECT evidence the guard's old count
2141
- // diff inferred — a resolver returning a mismatched name makes the keyed
2142
- // cleanup no-op, which shows up here as zero removals. The per-batch
2143
- // COUNT(*) it replaces walked every remaining pending row — O(N²/batch)
2144
- // over a run, 93.9s of the kernel-scale batch loop (§7a.2). A REAL count
2145
- // runs only on the suspicious path (claimed-work batch removed nothing —
2146
- // e.g. every row was a sibling a legacy-key sweep already consumed),
2147
- // where it arbitrates stop-vs-continue exactly as before.
2148
- // Deferred refs legitimately remain pending for the post-pass. The
2149
- // keyset cursor advances past them; they must not trigger this guard.
2150
2174
  if (removedThisBatch + deferredCount <= 0 && batch.length > 0) {
2151
2175
  tLp = Date.now();
2152
2176
  const remaining = this.queries.getUnresolvedReferencesCount();
@@ -2155,16 +2179,12 @@ class ReferenceResolver {
2155
2179
  break;
2156
2180
  prevRemaining = remaining;
2157
2181
  }
2158
- // Advance the pipeline: the prefetched batch (already fanned out when
2159
- // the pool is on) becomes the current one.
2160
2182
  batch = nextBatch;
2183
+ batchIsDependents = nextIsDependents;
2161
2184
  inFlight = nextInFlight;
2162
2185
  }
2163
2186
  }
2164
2187
  finally {
2165
- // Recreate the edge indexes BEFORE synthesis (kind-keyed reads) and on
2166
- // any error path. A crash before this line is healed by the next
2167
- // DatabaseConnection open (schema.sql re-applies IF NOT EXISTS).
2168
2188
  if (bulkRefsActive) {
2169
2189
  const tRef = Date.now();
2170
2190
  await parallel.refIndexLoad.end();
@@ -2176,16 +2196,11 @@ class ReferenceResolver {
2176
2196
  await parallel.bulkEdgeLoad.end();
2177
2197
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2178
2198
  console.error(`[phase-timing] edge-index-recreate: ${Date.now() - tIdx}ms`);
2179
- // The recreate just wrote every non-unique edge index into the WAL
2180
- // (multi-GB at kernel scale) with the pool idle — fold before the
2181
- // synthesis passes pin readers against it for minutes.
2182
2199
  const bp = parallel?.backpressure?.();
2183
2200
  if (bp)
2184
2201
  await bp;
2185
2202
  }
2186
2203
  }
2187
- // Indexes the bulk-edge window's end deferred: built once, while the pool
2188
- // is busy with synthesis when it is, and in any case before this returns.
2189
2204
  let deferredBuilt = !bulkEdgesActive || !parallel?.bulkEdgeLoad?.deferred;
2190
2205
  const buildDeferredIndexes = () => {
2191
2206
  if (deferredBuilt)
@@ -2195,24 +2210,16 @@ class ReferenceResolver {
2195
2210
  try {
2196
2211
  parallel.bulkEdgeLoad.deferred();
2197
2212
  }
2198
- catch { /* healed by schema.sql on the next open, like a crash in the window */ }
2213
+ catch { }
2199
2214
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2200
2215
  console.error(`[phase-timing] deferred-edge-index: ${Date.now() - tDeferred}ms`);
2201
2216
  };
2202
- // Dynamic-edge synthesis: now that all base `calls` edges are persisted,
2203
- // synthesize observer/callback dispatch edges (dispatcher → registered
2204
- // callbacks) that static parsing leaves out. Best-effort — never fail the
2205
- // index on it. The pool (when it survived resolution) is REUSED to fan the
2206
- // independent passes across its read-only workers — that's why its destroy
2207
- // lives in the finally below, after synthesis, not at the end of the batch
2208
- // loop. See docs/design/callback-edge-synthesis.md.
2209
2217
  const tSynth = Date.now();
2210
2218
  try {
2211
2219
  if (synthesize)
2212
2220
  aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context, onSynthesisProgress, pool, parallel?.backpressure, buildDeferredIndexes);
2213
2221
  }
2214
2222
  catch {
2215
- // synthesis is additive and optional; ignore failures
2216
2223
  }
2217
2224
  buildDeferredIndexes();
2218
2225
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
@@ -2233,7 +2240,35 @@ class ReferenceResolver {
2233
2240
  stats: aggregateStats,
2234
2241
  };
2235
2242
  }
2236
- /** Replace synthesis only after every base-resolution pass has finished. */
2243
+ trackParameterFlows() {
2244
+ return new parameter_flow_1.FlowChange(this.queries);
2245
+ }
2246
+ async resolveParameterFlows(change) {
2247
+ const t0 = Date.now();
2248
+ let changed = 0;
2249
+ try {
2250
+ const flows = this.queries.parameterFlows;
2251
+ for (const { retarget, drop, restore, stats, language, record } of await (0, parameter_flow_1.planParameterFlows)(this.queries, this.context, change)) {
2252
+ flows.retargetCalls(retarget.flatMap((r) => (r.edgeId === undefined ? [] : [r.edgeId])), retarget.flatMap((r) => (r.rowId === undefined ? [] : [r.rowId])), this.createEdges(retarget.map((r) => r.resolved)));
2253
+ flows.replaceEdgesWithFlowMarkedRefs(drop.map((d) => d.edgeId), drop.map((d) => d.reference));
2254
+ if (retarget.length + drop.length > 0)
2255
+ flows.noteParameterFlows();
2256
+ if (restore.length > 0) {
2257
+ flows.restoreCalls(restore.flatMap((r) => (r.edgeId === undefined ? [] : [r.edgeId])), restore.flatMap((r) => (r.rowId === undefined ? [] : [r.rowId])), restore.map((r) => r.reference));
2258
+ const files = new Set(restore.flatMap((r) => (r.reference.filePath === undefined ? [] : [r.reference.filePath])));
2259
+ await this.resolveAndPersistListYielding(this.queries.getUnresolvedReferencesByFiles([...files]));
2260
+ }
2261
+ flows.setRecord(language, record);
2262
+ changed += retarget.length + drop.length + restore.length;
2263
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2264
+ console.error(`[phase-timing] parameter-flow: ${Date.now() - t0}ms ${JSON.stringify(stats)}`);
2265
+ }
2266
+ }
2267
+ catch (error) {
2268
+ (0, errors_1.logDebug)('Parameter flows failed', { error: String(error) });
2269
+ }
2270
+ return changed;
2271
+ }
2237
2272
  async refreshSynthesis(dbPath, onProgress, backpressure) {
2238
2273
  this.clearCaches();
2239
2274
  const stage = new synthesis_stage_1.SynthesisStage(dbPath);
@@ -2248,37 +2283,279 @@ class ReferenceResolver {
2248
2283
  this.clearCaches();
2249
2284
  }
2250
2285
  }
2251
- /**
2252
- * Get detected frameworks
2253
- */
2286
+ getPythonRootFingerprint() {
2287
+ return (0, import_resolver_1.pythonRootFingerprint)(this.diskContext());
2288
+ }
2289
+ refreshWorkspacePackages(knownManifests) {
2290
+ const { packages: fresh, discovery } = (0, workspace_packages_1.loadWorkspacePackagesAndManifests)(this.projectRoot, knownManifests);
2291
+ if (discovery)
2292
+ this.workspaceDiscovery = discovery;
2293
+ const fingerprint = (0, workspace_packages_1.workspaceFingerprint)(fresh);
2294
+ if (this.workspacePackages === undefined || (0, workspace_packages_1.workspaceFingerprint)(this.workspacePackages) !== fingerprint) {
2295
+ this.workspacePackages = fresh;
2296
+ this.clearCaches();
2297
+ }
2298
+ return fingerprint;
2299
+ }
2300
+ getWorkspaceDiscovery() {
2301
+ return this.workspaceDiscovery;
2302
+ }
2303
+ getModuleConfigSnapshot(previous, treeMoved = false) {
2304
+ const was = parseModuleConfigSnapshot(previous);
2305
+ if (treeMoved || !('Cargo.toml' in was)) {
2306
+ this.cargoCrates = undefined;
2307
+ this.layoutIncludeDirs = undefined;
2308
+ this.readCargoCrates();
2309
+ }
2310
+ const files = new Set(this.moduleConfigFiles);
2311
+ for (const name of MODULE_CONFIG_ROOT_FILES)
2312
+ files.add(path.join(this.projectRoot, name));
2313
+ for (const rel of Object.keys(was))
2314
+ files.add(path.join(this.projectRoot, rel));
2315
+ return moduleConfigSnapshot(this.projectRoot, files, was);
2316
+ }
2317
+ readCargoCrates() {
2318
+ if (!this.cargoCrates) {
2319
+ this.cargoCrates = (0, cargo_workspace_1.readCargoWorkspaceCrateMap)(this.diskContext());
2320
+ for (const dir of this.cargoCrates.values())
2321
+ this.moduleConfigFiles.add(path.join(this.projectRoot, dir, 'Cargo.toml'));
2322
+ }
2323
+ return this.cargoCrates;
2324
+ }
2325
+ resetModuleConfig() {
2326
+ this.projectAliases = undefined;
2327
+ this.dirAliases.clear();
2328
+ this.goModuleByDir.clear();
2329
+ this.goPackageDirs.clear();
2330
+ this.cargoCrates = undefined;
2331
+ this.compileDbIncludeDirs = undefined;
2332
+ this.moduleConfigFiles.clear();
2333
+ this.clearCaches();
2334
+ this.readCargoCrates();
2335
+ }
2336
+ getWorkspaceFingerprint() {
2337
+ return (0, workspace_packages_1.workspaceFingerprint)(this.context.getWorkspacePackages?.() ?? null);
2338
+ }
2339
+ phpWebRootOf(fromFile) {
2340
+ const configured = (0, project_config_1.loadWebRoot)(this.projectRoot);
2341
+ if (configured !== null)
2342
+ return configured;
2343
+ return this.inferredPhpWebRoots().get((0, php_web_root_1.folderOf)(fromFile)) ?? null;
2344
+ }
2345
+ inferredPhpWebRoots() {
2346
+ if (this.phpWebRoots === null) {
2347
+ const prefix = `${php_1.PHP_DOCUMENT_ROOT}/`;
2348
+ const includes = this.queries.getPhpDocumentRootIncludes(prefix)
2349
+ .map((row) => ({ filePath: row.filePath, written: row.name.slice(prefix.length) }));
2350
+ this.phpWebRoots = includes.length === 0
2351
+ ? new Map()
2352
+ : (0, php_web_root_1.inferPhpWebRoots)(includes, (relPath) => this.context.fileExists(relPath));
2353
+ }
2354
+ return this.phpWebRoots;
2355
+ }
2356
+ getPhpWebRootSnapshot() {
2357
+ return (0, php_web_root_1.phpWebRootSnapshot)((0, project_config_1.loadWebRoot)(this.projectRoot), this.inferredPhpWebRoots());
2358
+ }
2359
+ phpWebRootsMoved(before, now) {
2360
+ return (0, php_web_root_1.phpWebRootsMoved)(before, now);
2361
+ }
2362
+ workspacePackageDirOf(file) {
2363
+ const ws = this.context.getWorkspacePackages?.();
2364
+ return ws ? (0, workspace_packages_1.workspacePackageDirOf)(ws, file) : null;
2365
+ }
2366
+ getPythonReopenScope(changedFiles) {
2367
+ return (0, import_resolver_1.pythonReopenScope)(this.diskContext(), changedFiles);
2368
+ }
2369
+ getPythonScriptModuleScope(editedFiles) {
2370
+ return (0, import_resolver_1.pythonScriptModuleScope)(this.context, editedFiles);
2371
+ }
2372
+ getPythonPackageImporters(initFiles) {
2373
+ return (0, import_resolver_1.pythonPackageImporters)(this.context, initFiles);
2374
+ }
2375
+ diskContext() {
2376
+ return {
2377
+ ...this.context,
2378
+ readFile: (filePath) => {
2379
+ try {
2380
+ const abs = path.join(this.projectRoot, filePath);
2381
+ return fs.statSync(abs).isFile() ? fs.readFileSync(abs, 'utf-8') : null;
2382
+ }
2383
+ catch {
2384
+ return null;
2385
+ }
2386
+ },
2387
+ };
2388
+ }
2254
2389
  getDetectedFrameworks() {
2255
2390
  return this.frameworks.map((f) => f.name);
2256
2391
  }
2257
- /**
2258
- * True when `receiver` is a local name bound by an import that resolves to a
2259
- * file IN THIS PROJECT — the only case where letting a python
2260
- * built-in-method name through the filter is safe (#1681).
2261
- *
2262
- * Asking only whether SOME import bound the local name is not enough: every
2263
- * import produces a mapping, stdlib and PyPI included, so that would also be
2264
- * true for `os`, `requests`, `np`. Opening the filter for them lets
2265
- * resolveViaImport find no project file, fall through to bare-name matching,
2266
- * and bind `os.remove(p)` to whatever project method happens to be named
2267
- * `remove` — reintroducing, through its own escape hatch, the fabricated-edge
2268
- * class this filter exists to prevent.
2269
- *
2270
- * Resolving the specifier is the same question resolveViaImport will ask
2271
- * next, so a receiver that passes here is one the qualified path can actually
2272
- * serve; anything else stays a silent miss rather than a wrong edge.
2273
- */
2392
+ resolveModuleFile(specifier, fromFile, language) {
2393
+ return (0, import_resolver_1.resolveImportPath)(specifier, fromFile, language, this.context);
2394
+ }
2395
+ resolveNow(ref) {
2396
+ if (!ref.filePath || !ref.language)
2397
+ return null;
2398
+ const resolved = this.resolveOne({ ...ref, filePath: ref.filePath, language: ref.language });
2399
+ return resolved ? { targetNodeId: resolved.targetNodeId, resolvedBy: resolved.resolvedBy } : null;
2400
+ }
2401
+ hasNavigationRouters() {
2402
+ return this.frameworks.some((f) => f.navigation !== undefined);
2403
+ }
2404
+ reopenNavigationsFor(routes, changedFilePaths = [], perNameCeiling = 500) {
2405
+ if (routes.length === 0)
2406
+ return 0;
2407
+ const plans = [];
2408
+ const tails = new Set();
2409
+ for (const router of this.frameworks) {
2410
+ if (!router.navigation)
2411
+ continue;
2412
+ const scopes = new Set();
2413
+ for (const route of routes) {
2414
+ for (const scope of router.navigation.scope(route, this.context) ?? [])
2415
+ scopes.add(scope);
2416
+ }
2417
+ if (scopes.size === 0)
2418
+ continue;
2419
+ plans.push({ router, scopes: [...scopes] });
2420
+ for (const tail of router.navigation.tails)
2421
+ tails.add(tail);
2422
+ }
2423
+ if (plans.length === 0)
2424
+ return 0;
2425
+ const claimed = (name, filePath) => plans.some(({ router, scopes }) => scopes.some((scope) => filePath.startsWith(scope)) && router.claimsReference?.(name) === true);
2426
+ const fresh = new Set(changedFilePaths);
2427
+ const failed = new Map();
2428
+ for (const ref of this.queries.getFailedCallsByTail([...tails])) {
2429
+ if (fresh.has(ref.filePath) || !claimed(ref.referenceName, ref.filePath))
2430
+ continue;
2431
+ const rowIds = failed.get(ref.referenceName);
2432
+ if (rowIds)
2433
+ rowIds.push(ref.rowId);
2434
+ else
2435
+ failed.set(ref.referenceName, [ref.rowId]);
2436
+ }
2437
+ const resolved = new Map();
2438
+ for (const edge of this.queries.getResolvedNavigations()) {
2439
+ const name = edge.metadata?.refName;
2440
+ if (typeof name !== 'string' || fresh.has(edge.sourceFilePath) || !claimed(name, edge.sourceFilePath))
2441
+ continue;
2442
+ const edges = resolved.get(name);
2443
+ if (edges)
2444
+ edges.push(edge);
2445
+ else
2446
+ resolved.set(name, [edge]);
2447
+ }
2448
+ const rowIds = [];
2449
+ const edgeIds = [];
2450
+ const refs = [];
2451
+ const sites = new Set();
2452
+ for (const name of new Set([...failed.keys(), ...resolved.keys()])) {
2453
+ const rows = failed.get(name) ?? [];
2454
+ const edges = resolved.get(name) ?? [];
2455
+ if (rows.length + edges.length > perNameCeiling)
2456
+ continue;
2457
+ for (const rowId of rows)
2458
+ rowIds.push(rowId);
2459
+ for (const edge of edges) {
2460
+ const ref = (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(edge);
2461
+ if (!ref)
2462
+ continue;
2463
+ edgeIds.push(edge.edgeId);
2464
+ const site = `${ref.fromNodeId}\0${ref.referenceName}\0${ref.line}\0${ref.column}`;
2465
+ if (sites.has(site))
2466
+ continue;
2467
+ sites.add(site);
2468
+ refs.push(ref);
2469
+ }
2470
+ }
2471
+ if (edgeIds.length > 0)
2472
+ this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
2473
+ return this.queries.reopenFailedReferences(rowIds) + refs.length;
2474
+ }
2475
+ changedDefaultExports(modifiedFilePaths, changedFilePaths, resolvedUpToEdgeId) {
2476
+ const fresh = new Set(changedFilePaths);
2477
+ const moved = [];
2478
+ for (const filePath of modifiedFilePaths) {
2479
+ if (!(0, import_resolver_1.isJsFamilyFile)(filePath))
2480
+ continue;
2481
+ const bindings = new Map();
2482
+ for (const i of this.queries.getImportsInto(`file:${filePath}`, filePath)) {
2483
+ if (i.refName === null || fresh.has(i.filePath) || !(0, import_resolver_1.isModuleBindingName)(i.refName))
2484
+ continue;
2485
+ const names = bindings.get(i.filePath) ?? new Set();
2486
+ names.add(i.refName);
2487
+ bindings.set(i.filePath, names);
2488
+ }
2489
+ if (bindings.size === 0)
2490
+ continue;
2491
+ const language = this.queries.getFileByPath(filePath)?.language;
2492
+ if (!language)
2493
+ continue;
2494
+ const readsDefault = (e) => {
2495
+ const name = e.metadata?.refName;
2496
+ return typeof name === 'string' && e.metadata?.resolvedBy === 'import' && e.edgeId <= resolvedUpToEdgeId &&
2497
+ !e.target.startsWith('file:') && bindings.get(e.sourceFilePath)?.has(name) === true;
2498
+ };
2499
+ let readers = this.queries.getCrossFileIncomingEdgesWithTarget(filePath).filter(readsDefault);
2500
+ if (readers.length === 0) {
2501
+ const now = (0, import_resolver_1.moduleDefaultExport)(filePath, language, this.context);
2502
+ if (!now || now.filePath === filePath)
2503
+ continue;
2504
+ readers = [...bindings].slice(0, DEFAULT_READER_SAMPLE_FILES)
2505
+ .flatMap(([file, names]) => this.queries.getResolutionEdgesThrough(file, [...names]))
2506
+ .filter(readsDefault);
2507
+ }
2508
+ const was = new Set();
2509
+ for (const e of readers) {
2510
+ const now = (0, import_resolver_1.moduleDefaultExport)(filePath, e.sourceLanguage, this.context);
2511
+ if (now && (e.target === now.id || (e.kind === 'calls' && (0, alias_binding_1.resolveAliasBinding)(now, null, this.context)?.id === e.target)))
2512
+ continue;
2513
+ was.add(e.target);
2514
+ }
2515
+ if (was.size > 0)
2516
+ moved.push({ path: filePath, language, was: [...was] });
2517
+ }
2518
+ return moved;
2519
+ }
2520
+ couldNameAnyOf(files) {
2521
+ const added = new Set(files);
2522
+ const names = new Set(files.map((file) => file.slice(file.lastIndexOf('/') + 1)));
2523
+ return (reference) => {
2524
+ const language = reference.language || this.getLanguageFromNodeId(reference.fromNodeId);
2525
+ if (!import_resolver_1.ESM_IMPORT_LANGUAGES.has(language))
2526
+ return false;
2527
+ const ref = {
2528
+ fromNodeId: reference.fromNodeId,
2529
+ referenceName: reference.referenceName,
2530
+ referenceKind: reference.referenceKind,
2531
+ line: reference.line,
2532
+ column: reference.column,
2533
+ filePath: reference.filePath || this.getFilePathFromNodeId(reference.fromNodeId),
2534
+ language,
2535
+ rowId: reference.rowId,
2536
+ };
2537
+ const name = ref.referenceName;
2538
+ if (names.has(name.slice(name.lastIndexOf('/') + 1)))
2539
+ return true;
2540
+ const target = (0, import_resolver_1.resolveImportPath)(name, ref.filePath, language, this.context);
2541
+ if (target !== null && added.has(target) && (0, import_resolver_1.jsModuleFile)(ref, this.context) === target)
2542
+ return true;
2543
+ return name.includes('/') && this.frameworksFor(language).some((framework) => {
2544
+ const result = framework.resolve(ref, this.context);
2545
+ return result !== null && added.has(this.nodeById(result.targetNodeId)?.filePath ?? '');
2546
+ });
2547
+ };
2548
+ }
2274
2549
  isPythonProjectModule(ref, receiver) {
2275
- for (const imp of this.context.getImportMappings(ref.filePath, ref.language)) {
2550
+ const imports = this.context.getImportMappings(ref.filePath, ref.language);
2551
+ if (!imports.some((imp) => imp.localName === receiver))
2552
+ return false;
2553
+ const local = (0, name_matcher_1.pythonFunctionModuleAlias)(receiver, ref, this.context);
2554
+ if (local)
2555
+ return (0, import_resolver_1.resolveImportPath)(local, ref.filePath, ref.language, this.context) !== null;
2556
+ for (const imp of (0, import_resolver_1.pythonImportsInScope)(ref, imports, this.context)) {
2276
2557
  if (imp.localName !== receiver)
2277
2558
  continue;
2278
- // `import pkg.mod` / `import pkg.mod as m` binds the module `source`
2279
- // names. `from pkg import mod` binds `pkg.mod`, and `from . import mod`
2280
- // binds `.mod` — join without doubling the dot that makes `.` mean the
2281
- // current package.
2282
2559
  const specifier = imp.isNamespace
2283
2560
  ? imp.source
2284
2561
  : imp.source.endsWith('.')
@@ -2290,61 +2567,66 @@ class ReferenceResolver {
2290
2567
  }
2291
2568
  return false;
2292
2569
  }
2293
- /**
2294
- * Check if reference is to a built-in or external symbol
2295
- */
2570
+ isPythonBuiltinNamedMethodCall(ref) {
2571
+ if (ref.language !== 'python' || ref.referenceKind !== 'calls')
2572
+ return false;
2573
+ const dot = ref.referenceName.indexOf('.');
2574
+ return dot > 0 && PYTHON_BUILT_IN_METHODS.has(ref.referenceName.slice(dot + 1)) &&
2575
+ !PYTHON_BUILT_IN_TYPES.has(ref.referenceName.slice(0, dot));
2576
+ }
2577
+ pythonFileBindings = null;
2578
+ isUnboundPythonBuiltin(ref) {
2579
+ const line = (this.context.getFileLines?.(ref.filePath) ?? this.context.readFile(ref.filePath)?.split(/\r?\n/))?.[ref.line - 1];
2580
+ if (line === undefined || !line.startsWith(ref.referenceName, ref.column) || /\.\s*$/.test(line.slice(0, ref.column)))
2581
+ return false;
2582
+ let file = this.pythonFileBindings;
2583
+ if (file?.filePath !== ref.filePath) {
2584
+ const names = new Set(this.context.getNodesInFile(ref.filePath).map((n) => n.name));
2585
+ for (const m of this.context.getImportMappings(ref.filePath, 'python'))
2586
+ names.add(m.localName);
2587
+ const star = /^[ \t]*from[ \t]+[\w.]+[ \t]+import[ \t(]*\*/m.test(this.context.readFile(ref.filePath) ?? '');
2588
+ this.pythonFileBindings = file = { filePath: ref.filePath, names, star };
2589
+ }
2590
+ return !file.star && !file.names.has(ref.referenceName);
2591
+ }
2592
+ isGoProjectPackage(ref, qualifier) {
2593
+ return this.context
2594
+ .getImportMappings(ref.filePath, ref.language)
2595
+ .some((imp) => imp.localName === qualifier && this.context.getGoPackageDir?.(imp.source, ref.filePath) != null);
2596
+ }
2296
2597
  isBuiltInOrExternal(ref) {
2297
2598
  const name = ref.referenceName;
2298
2599
  const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
2299
2600
  || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts'
2300
2601
  || ref.language === 'vue' || ref.language === 'svelte' || ref.language === 'astro';
2301
- // JavaScript/TypeScript built-ins — unless the file imports its own
2302
- // binding of that name (`import Map from './Map.svelte'`).
2303
2602
  if (isJsTs && js_builtins_1.JS_BUILT_INS.has(name) &&
2304
2603
  !this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === name)) {
2305
2604
  return true;
2306
2605
  }
2307
- // ArkTS resource-reference intrinsics — `$r('app.string.x')` /
2308
- // `$rawfile('x.png')` are framework-provided and appear dozens of times
2309
- // per UI file; without this they can resolve to a stray same-named
2310
- // symbol (e.g. a checked-in hvigor wrapper's `$r`).
2311
2606
  if (ref.language === 'arkts' && (name === '$r' || name === '$rawfile')) {
2312
2607
  return true;
2313
2608
  }
2314
- // Common JS/TS library calls (console.log, Math.floor, JSON.parse)
2315
2609
  if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
2316
2610
  return true;
2317
2611
  }
2318
- // React hooks from React itself
2319
2612
  if (isJsTs && REACT_HOOKS.has(name)) {
2320
2613
  return true;
2321
2614
  }
2322
- // Python built-ins (bare calls only — dotted calls like console.print are method calls)
2323
2615
  if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
2324
2616
  return true;
2325
2617
  }
2326
- // Python built-in method calls (e.g., list.extend, dict.update)
2618
+ if (ref.language === 'python' && PYTHON_BUILTIN_NAMES.has(name) && this.isUnboundPythonBuiltin(ref)) {
2619
+ return true;
2620
+ }
2327
2621
  if (ref.language === 'python') {
2328
2622
  const dotIdx = name.indexOf('.');
2329
2623
  if (dotIdx > 0) {
2330
2624
  const receiver = name.substring(0, dotIdx);
2331
2625
  const method = name.substring(dotIdx + 1);
2332
- // Filter calls on built-in types (list.append, dict.update, etc.)
2333
2626
  if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
2334
2627
  return true;
2335
2628
  }
2336
- // Filter built-in methods on non-class receivers
2337
- // (e.g., items.append where items is a local list variable)
2338
- // But allow if the capitalized receiver matches a known codebase class,
2339
- // OR the receiver is itself an imported project module — a module can
2340
- // export a top-level function sharing a common collection-method name
2341
- // (`ledger.append`, `from . import ledger`), and that call is a real
2342
- // project dependency, not `list.append` (#1681). Without this, the
2343
- // qualified ref never reaches resolveViaImport / resolvePythonModuleMember.
2344
2629
  if (PYTHON_BUILT_IN_METHODS.has(method)) {
2345
- // A module-scope collection binding is stronger evidence than a
2346
- // coincidentally matching class name (#1652). Only use this file's
2347
- // binding: an unrelated module may reuse the receiver for a collection.
2348
2630
  const isCollection = this.context.getNodesByName(receiver).some((node) => node.language === 'python' && node.filePath === ref.filePath &&
2349
2631
  (node.kind === 'variable' || node.kind === 'constant') &&
2350
2632
  node.qualifiedName === receiver &&
@@ -2360,21 +2642,16 @@ class ReferenceResolver {
2360
2642
  }
2361
2643
  }
2362
2644
  }
2363
- // A bare name colliding with a builtin method (index, get, update, count…)
2364
- // is only a builtin when NOTHING in the codebase declares it. A declared
2365
- // symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
2366
- // `def get()` — is a real reference target. Without this guard, every
2367
- // handler named after a builtin method silently loses its route→handler edge.
2368
2645
  if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
2369
2646
  return true;
2370
2647
  }
2371
2648
  }
2372
- // Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
2373
2649
  if (ref.language === 'go') {
2374
2650
  const dotIdx = name.indexOf('.');
2375
- if (dotIdx > 0) {
2651
+ if (dotIdx > 0 && !this.isGoProjectPackage(ref, name.substring(0, dotIdx))) {
2376
2652
  const pkg = name.substring(0, dotIdx);
2377
- if (GO_STDLIB_PACKAGES.has(pkg)) {
2653
+ if (name_matcher_1.GO_STDLIB_PACKAGES.has(pkg) && !(0, name_matcher_1.isGoAssertedLocal)(pkg, ref, this.context) &&
2654
+ !(0, name_matcher_1.isGoProjectLocalCall)(ref, this.context)) {
2378
2655
  return true;
2379
2656
  }
2380
2657
  }
@@ -2382,54 +2659,33 @@ class ReferenceResolver {
2382
2659
  return true;
2383
2660
  }
2384
2661
  }
2385
- // Pascal/Delphi built-ins and standard library units
2386
2662
  if (ref.language === 'pascal') {
2387
- if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
2663
+ const lower = name.toLowerCase();
2664
+ if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p)) || lower.startsWith('system.')) {
2388
2665
  return true;
2389
2666
  }
2390
- if (PASCAL_BUILT_INS.has(name)) {
2667
+ if (PASCAL_BUILT_INS.has(lower)) {
2391
2668
  return true;
2392
2669
  }
2393
2670
  }
2394
- // C/C++ standard library symbols (printf, malloc, std::vector, etc.).
2395
- // Names that collide with user-defined symbols are NOT filtered —
2396
- // C and C++ projects routinely shadow stdlib names (custom allocators
2397
- // define `malloc`/`free`, stream wrappers define `read`/`write`/`open`,
2398
- // containers define `move`/`swap`, logging libs wrap `printf`). Killing
2399
- // those resolutions makes the graph wrong, not cleaner. We only filter
2400
- // when there's no user node with this name — then name-matching would
2401
- // produce zero edges anyway and the filter just short-circuits work.
2402
2671
  if (ref.language === 'c' || ref.language === 'cpp') {
2403
- // C++ std:: namespace prefix — safe to filter unconditionally,
2404
- // since `std::foo` is never a user-defined qualified name in
2405
- // tree-sitter output.
2406
- if (name.startsWith('std::'))
2672
+ const scoped = name.startsWith('::') ? name.slice(2) : name;
2673
+ if (scoped.startsWith('std::'))
2407
2674
  return true;
2408
- if (C_BUILT_INS.has(name) || CPP_BUILT_INS.has(name)) {
2409
- return !this.hasAnyPossibleMatch(name);
2675
+ if (C_BUILT_INS.has(scoped) || CPP_BUILT_INS.has(scoped)) {
2676
+ return !this.hasAnyPossibleMatch(scoped);
2410
2677
  }
2411
2678
  }
2412
2679
  return false;
2413
2680
  }
2414
- /**
2415
- * Get file path from node ID
2416
- */
2417
2681
  getFilePathFromNodeId(nodeId) {
2418
2682
  const node = this.nodeById(nodeId);
2419
2683
  return node?.filePath || '';
2420
2684
  }
2421
- /**
2422
- * Get language from node ID
2423
- */
2424
2685
  getLanguageFromNodeId(nodeId) {
2425
2686
  const node = this.nodeById(nodeId);
2426
2687
  return node?.language || 'unknown';
2427
2688
  }
2428
- /**
2429
- * Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
2430
- * own `@using` directives plus every `_Imports.razor` from the file's folder up
2431
- * to the project root (Razor `_Imports` cascade). Cached per file.
2432
- */
2433
2689
  getRazorUsings(filePath) {
2434
2690
  const cached = this.razorUsingsCache.get(filePath);
2435
2691
  if (cached)
@@ -2443,7 +2699,6 @@ class ReferenceResolver {
2443
2699
  };
2444
2700
  addFrom(this.context.readFile(filePath));
2445
2701
  let dir = filePath.includes('/') ? filePath.slice(0, filePath.lastIndexOf('/')) : '';
2446
- // Walk up to the project root, reading each level's _Imports.razor.
2447
2702
  for (;;) {
2448
2703
  addFrom(this.context.readFile(dir ? `${dir}/_Imports.razor` : '_Imports.razor'));
2449
2704
  if (!dir)
@@ -2455,13 +2710,6 @@ class ReferenceResolver {
2455
2710
  this.razorUsingsCache.set(filePath, arr);
2456
2711
  return arr;
2457
2712
  }
2458
- /**
2459
- * Resolve a Razor/Blazor simple type ref through the file's `@using`
2460
- * namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose
2461
- * qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the
2462
- * `@using` set yields exactly ONE type (otherwise it stays ambiguous and falls
2463
- * through to name-matching).
2464
- */
2465
2713
  resolveRazorUsing(ref) {
2466
2714
  if (ref.referenceName.includes('.') || ref.referenceName.includes('::'))
2467
2715
  return null;
@@ -2479,37 +2727,12 @@ class ReferenceResolver {
2479
2727
  const target = found.values().next().value;
2480
2728
  return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
2481
2729
  }
2482
- /**
2483
- * Resolve a CFML inheritance reference written as a component path (#1152).
2484
- * Two forms exist in real code:
2485
- *
2486
- * - Dotted: `extends="coldbox.system.web.Controller"` — dots are directory
2487
- * separators from the webroot or a CFML mapping. Mappings live in server
2488
- * config / Application.cfc, so the leading segments may not exist in the
2489
- * repo at all (in the coldbox repo itself the path is `system/web/
2490
- * Controller.cfc` — the `coldbox.` root IS the repo). Matched by final
2491
- * segment (the class), corroborated right-to-left against the candidate's
2492
- * parent directories.
2493
- * - Relative: `extends="../base"` / `extends="./base"` (the FW/1 style) —
2494
- * resolved against the referencing file's own directory.
2495
- *
2496
- * Conservative by design: a candidate needs at least one corroborating
2497
- * directory segment (a dotted path whose only same-named class sits in an
2498
- * unrelated directory is almost always an out-of-repo library supertype —
2499
- * mxunit/testbox/coldbox-as-dependency), and a corroboration tie yields no
2500
- * edge. Directory comparison is case-insensitive (CFML path resolution is);
2501
- * the class segment itself is matched exactly, which real code satisfies —
2502
- * dotted paths are written to match the on-disk file name.
2503
- */
2504
2730
  resolveCfmlComponentPath(ref) {
2505
2731
  const cfmlCandidates = (name) => this.context
2506
2732
  .getNodesByName(name)
2507
2733
  .filter((n) => (n.kind === 'class' || n.kind === 'interface') &&
2508
2734
  (n.language === 'cfml' || n.language === 'cfscript'));
2509
2735
  const norm = (p) => p.replace(/\\/g, '/').toLowerCase();
2510
- // Relative-path form: `../base`, `./base`, `sub/thing` — resolve against
2511
- // the referencing file's directory and require an exact (case-insensitive)
2512
- // file match.
2513
2736
  if (ref.referenceName.includes('/')) {
2514
2737
  const rel = ref.referenceName.replace(/\.cfc$/i, '');
2515
2738
  const fromDir = ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
@@ -2519,7 +2742,7 @@ class ReferenceResolver {
2519
2742
  continue;
2520
2743
  if (seg === '..') {
2521
2744
  if (parts.length === 0)
2522
- return null; // escapes the project root
2745
+ return null;
2523
2746
  parts.pop();
2524
2747
  }
2525
2748
  else {
@@ -2535,20 +2758,18 @@ class ReferenceResolver {
2535
2758
  ? { original: ref, targetNodeId: target.id, confidence: 0.95, resolvedBy: 'file-path' }
2536
2759
  : null;
2537
2760
  }
2538
- // Dotted form.
2539
2761
  const segments = ref.referenceName.split('.').map((s) => s.trim()).filter(Boolean);
2540
2762
  if (segments.length < 2)
2541
2763
  return null;
2542
2764
  const className = segments[segments.length - 1];
2543
2765
  const dirSegments = segments.slice(0, -1);
2544
- let best = null;
2766
+ const fromTest = (0, query_utils_1.isTestPath)(ref.filePath);
2545
2767
  let bestScore = 0;
2546
- let tie = false;
2768
+ let tied = [];
2547
2769
  for (const cand of cfmlCandidates(className)) {
2770
+ if (!fromTest && (0, name_matcher_1.isTestSuitePath)(cand.filePath))
2771
+ continue;
2548
2772
  const dirs = cand.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
2549
- // Count matching directory segments right-to-left: for
2550
- // `coldbox.system.web.Controller` vs `system/web/Controller.cfc`,
2551
- // `web` and `system` match, then the repo root ends the run → score 2.
2552
2773
  let score = 0;
2553
2774
  while (score < dirSegments.length &&
2554
2775
  score < dirs.length &&
@@ -2556,38 +2777,99 @@ class ReferenceResolver {
2556
2777
  dirs[dirs.length - 1 - score].toLowerCase()) {
2557
2778
  score++;
2558
2779
  }
2780
+ if (score === 0 && dirs.length === 0 && dirSegments.length === 1 &&
2781
+ cand.filePath.replace(/\.cfc$/i, '').toLowerCase() === className.toLowerCase()) {
2782
+ score = 0.5;
2783
+ }
2559
2784
  if (score > bestScore) {
2560
- best = cand;
2561
2785
  bestScore = score;
2562
- tie = false;
2786
+ tied = [cand];
2563
2787
  }
2564
2788
  else if (score === bestScore && score > 0) {
2565
- tie = true;
2789
+ tied.push(cand);
2566
2790
  }
2567
2791
  }
2568
- if (!best || bestScore === 0 || tie)
2792
+ if (tied.length > 1)
2793
+ tied = tied.filter((c) => !(0, name_matcher_1.isTestSuitePath)(c.filePath));
2794
+ if (bestScore === 0 || tied.length !== 1)
2795
+ return null;
2796
+ return { original: ref, targetNodeId: tied[0].id, confidence: bestScore >= 1 ? 0.9 : 0.8, resolvedBy: 'qualified-name' };
2797
+ }
2798
+ resolveCfmlConstructedCall(ref) {
2799
+ const match = CFML_CONSTRUCTED_CALL.exec(ref.referenceName);
2800
+ if (!match)
2569
2801
  return null;
2570
- return { original: ref, targetNodeId: best.id, confidence: 0.9, resolvedBy: 'qualified-name' };
2571
- }
2572
- /**
2573
- * Resolve a `this.<member>` function-as-value reference (#756/#808) to the
2574
- * ENCLOSING CLASS's own member — never a same-named symbol elsewhere. The
2575
- * registration idiom (`btn.on('click', this.handleClick)`) names a member
2576
- * of the class being defined, so the only valid target shares the
2577
- * from-symbol's qualified-name scope. Function/method targets only — a
2578
- * property (a data field, post-#808 classification) yields no edge — same
2579
- * file required, no fallback of any kind.
2580
- */
2802
+ const component = match[1];
2803
+ const cls = component.includes('.')
2804
+ ? this.nodeById(this.resolveCfmlComponentPath({ ...ref, referenceName: component, referenceKind: 'instantiates' })?.targetNodeId ?? '')
2805
+ : this.cfmlComponentByName(component, ref.filePath);
2806
+ const method = cls ? this.cfmlMethodOf(cls, match[2].toLowerCase(), new Set()) : undefined;
2807
+ return method ? { original: ref, targetNodeId: method.id, confidence: 0.9, resolvedBy: 'instance-method' } : null;
2808
+ }
2809
+ cfmlComponentByName(name, fromFile) {
2810
+ const components = this.context
2811
+ .getNodesByLowerName(name.toLowerCase())
2812
+ .filter((n) => (n.kind === 'class' || n.kind === 'interface') && (n.language === 'cfml' || n.language === 'cfscript'));
2813
+ const dirOf = (p) => p.slice(0, p.lastIndexOf('/') + 1);
2814
+ const beside = components.filter((n) => dirOf(n.filePath) === dirOf(fromFile));
2815
+ if (beside.length === 1)
2816
+ return beside[0];
2817
+ return components.length === 1 ? components[0] : undefined;
2818
+ }
2819
+ cfmlMethodOf(cls, lowerName, seen) {
2820
+ if (seen.has(cls.id) || seen.size >= 8)
2821
+ return undefined;
2822
+ seen.add(cls.id);
2823
+ const own = this.context.getNodesInFile(cls.filePath).find((n) => n.kind === 'method' &&
2824
+ n.name.toLowerCase() === lowerName &&
2825
+ n.qualifiedName.toLowerCase() === `${cls.name}::${n.name}`.toLowerCase() &&
2826
+ n.startLine >= cls.startLine && n.endLine <= cls.endLine);
2827
+ if (own)
2828
+ return own;
2829
+ for (const supertype of this.context.getSupertypeNodes?.(cls.id) ?? []) {
2830
+ const inherited = this.cfmlMethodOf(supertype, lowerName, seen);
2831
+ if (inherited)
2832
+ return inherited;
2833
+ }
2834
+ return undefined;
2835
+ }
2836
+ resolveCfmlIncludePath(ref) {
2837
+ const written = ref.referenceName.trim().replace(/\\/g, '/');
2838
+ const fromRoot = written.startsWith('/');
2839
+ const parts = fromRoot ? [] : ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
2840
+ for (const seg of written.split('/')) {
2841
+ if (seg === '' || seg === '.')
2842
+ continue;
2843
+ if (seg === '..') {
2844
+ if (parts.length === 0)
2845
+ return null;
2846
+ parts.pop();
2847
+ }
2848
+ else {
2849
+ parts.push(seg);
2850
+ }
2851
+ }
2852
+ const fileName = parts[parts.length - 1];
2853
+ if (!fileName)
2854
+ return null;
2855
+ const wanted = parts.join('/');
2856
+ const files = this.context.getNodesByLowerName(fileName.toLowerCase()).filter((n) => n.kind === 'file');
2857
+ const exact = files.find((n) => n.filePath === wanted);
2858
+ if (exact)
2859
+ return { original: ref, targetNodeId: exact.id, confidence: fromRoot ? 0.85 : 0.95, resolvedBy: 'file-path' };
2860
+ const folded = files.filter((n) => n.filePath.toLowerCase() === wanted.toLowerCase());
2861
+ return folded.length === 1
2862
+ ? { original: ref, targetNodeId: folded[0].id, confidence: fromRoot ? 0.8 : 0.9, resolvedBy: 'file-path' }
2863
+ : null;
2864
+ }
2581
2865
  resolveThisMemberFnRef(ref) {
2582
2866
  const member = ref.referenceName.slice('this.'.length);
2583
2867
  if (!member)
2584
2868
  return null;
2585
- const fromNode = this.nodeById(ref.fromNodeId);
2586
- if (!fromNode)
2869
+ const written = this.nodeById(ref.fromNodeId);
2870
+ if (!written)
2587
2871
  return null;
2588
- // A hook declared at class-body level (Ruby `before_action :authenticate`)
2589
- // attributes to the CLASS node itself — its qualified name IS the scope.
2590
- // For members, strip the member segment.
2872
+ const fromNode = (0, name_matcher_1.thisScopeCaller)(written, this.context);
2591
2873
  let classPrefix;
2592
2874
  if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
2593
2875
  classPrefix = fromNode.qualifiedName;
@@ -2595,7 +2877,7 @@ class ReferenceResolver {
2595
2877
  else {
2596
2878
  const sep = fromNode.qualifiedName.lastIndexOf('::');
2597
2879
  if (sep <= 0)
2598
- return null; // not inside a class scope
2880
+ return null;
2599
2881
  classPrefix = fromNode.qualifiedName.slice(0, sep);
2600
2882
  }
2601
2883
  const candidates = this.context
@@ -2604,9 +2886,6 @@ class ReferenceResolver {
2604
2886
  n.filePath === ref.filePath &&
2605
2887
  n.id !== ref.fromNodeId);
2606
2888
  if (candidates.length === 0) {
2607
- // Not on the class itself — possibly INHERITED. implements/extends
2608
- // edges don't exist yet in this pass, so retry in the supertype pass
2609
- // (resolveDeferredThisMemberRefs) instead of giving up.
2610
2889
  this.deferReference(ref, this.deferredThisMemberRefs);
2611
2890
  return null;
2612
2891
  }
@@ -2618,29 +2897,14 @@ class ReferenceResolver {
2618
2897
  resolvedBy: 'function-ref',
2619
2898
  };
2620
2899
  }
2621
- /**
2622
- * Second pass for `this.<member>` refs whose member wasn't on the enclosing
2623
- * class itself (#808): once implements/extends edges exist, walk the
2624
- * class's supertypes (transitively, depth-capped) and resolve the member on
2625
- * the nearest one that declares it — `this.handleSubmit` registered in a
2626
- * subclass resolves to `FormBase::handleSubmit`. Validated targets only
2627
- * (function/method kind, same language family); no match → no edge.
2628
- * Mirrors resolveChainedCallsViaConformance's lifecycle. Returns the number
2629
- * of newly-created edges.
2630
- */
2631
2900
  async resolveDeferredThisMemberRefs() {
2632
2901
  const deferred = this.deferredThisMemberRefs;
2633
2902
  this.deferredThisMemberRefs = [];
2634
2903
  if (deferred.length === 0)
2635
2904
  return 0;
2636
2905
  this.clearCaches();
2637
- // Synchronous main-thread post-pass with a per-ref supertype BFS — yield
2638
- // periodically so the #850 liveness watchdog heartbeat can fire (#1091).
2639
2906
  const maybeYield = (0, cooperative_yield_1.createYielder)();
2640
2907
  const resolved = [];
2641
- // Refs share supertypes (every `this.dispose` walks the same chain), and
2642
- // nothing is written until the loop ends: read each type's supertype
2643
- // edges, and each supertype's callable members by name, once.
2644
2908
  const supertypeEdges = new Map();
2645
2909
  const callableMembers = new Map();
2646
2910
  const supertypesOf = (id) => {
@@ -2672,10 +2936,10 @@ class ReferenceResolver {
2672
2936
  for (const ref of deferred) {
2673
2937
  await maybeYield();
2674
2938
  const member = ref.referenceName.slice('this.'.length);
2675
- const fromNode = this.nodeById(ref.fromNodeId);
2676
- if (!fromNode || !member)
2939
+ const written = this.nodeById(ref.fromNodeId);
2940
+ if (!written || !member)
2677
2941
  continue;
2678
- // Class-body-level hooks (Ruby) attribute to the CLASS node itself.
2942
+ const fromNode = (0, name_matcher_1.thisScopeCaller)(written, this.context);
2679
2943
  let className;
2680
2944
  if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
2681
2945
  className = fromNode.name;
@@ -2689,19 +2953,11 @@ class ReferenceResolver {
2689
2953
  ? classPrefix.slice(classPrefix.lastIndexOf('::') + 2)
2690
2954
  : classPrefix;
2691
2955
  }
2692
- // NODE-anchored BFS up the supertype graph: start from the class node
2693
- // in the ref's own file (never a same-named class elsewhere — rails has
2694
- // a dozen `Engine`s), follow implements/extends EDGES to supertype
2695
- // NODES, and look members up through `contains` edges. No name-based
2696
- // unions anywhere — a name-keyed getSupertypes('Engine') merged every
2697
- // Engine's parents and produced a cross-class wrong edge on rails.
2698
2956
  let frontierNodes = this.context
2699
2957
  .getNodesByName(className)
2700
2958
  .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
2701
2959
  n.filePath === ref.filePath);
2702
2960
  if (frontierNodes.length === 0) {
2703
- // The class itself may be declared in another file (partial/reopened
2704
- // classes); fall back to same-family nodes of that name.
2705
2961
  frontierNodes = this.context
2706
2962
  .getNodesByName(className)
2707
2963
  .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
@@ -2719,7 +2975,6 @@ class ReferenceResolver {
2719
2975
  seenNodes.add(superNode.id);
2720
2976
  if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
2721
2977
  continue;
2722
- // Member lookup anchored on the supertype's contains edges.
2723
2978
  target =
2724
2979
  callableMembersOf(superNode.id)
2725
2980
  .get(member)
@@ -2744,53 +2999,44 @@ class ReferenceResolver {
2744
2999
  }
2745
3000
  return this.persistDeferredReferences(deferred, resolved);
2746
3001
  }
2747
- /**
2748
- * Drop a resolution whose target cannot be what the reference names.
2749
- * Applied at the `resolveOne` seam so it covers every strategy uniformly —
2750
- * framework, import, name-match, chain, CFML component path.
2751
- *
2752
- * For `imports`: the target must be importable. A member that only exists
2753
- * inside a type never is.
2754
- *
2755
- * For `extends`/`implements`, it cannot be describing a real supertype when:
2756
- *
2757
- * 1. The target's kind can never be a supertype (an enum member, a method,
2758
- * a variable). `matchByExactName` additionally narrows its candidate
2759
- * pool by the same set, so a legitimate supertype outranks a same-named
2760
- * non-type rather than merely losing its edge.
2761
- * 2. The name is imported from outside the repo, so NO local node is the
2762
- * referent. Without this, filtering by kind alone just relocates the
2763
- * false edge onto the next same-named local type.
2764
- *
2765
- * One exception to (1): a TypeScript VALUE that shares its name with a type
2766
- * in the same file. `export const IFoo = createDecorator<IFoo>('foo')` beside
2767
- * `export interface IFoo` is how VS Code declares every service, and an
2768
- * import of `IFoo` resolves to the file with both — a strategy that takes the
2769
- * first export of that name gets the value. The strategy found the right
2770
- * file and name; the type declared there is the supertype, so the edge moves
2771
- * to it rather than being dropped (dropping it lost ~900 `implements` edges
2772
- * on vscode).
2773
- *
2774
- * Otherwise this only ever REMOVES an edge, never adds one. A dropped ref
2775
- * stays in `unresolved_refs` as `failed`, which is the honest record for a
2776
- * supertype that lives outside the repo — silent beats wrong.
2777
- */
2778
3002
  gateTargetKind(result, ref) {
2779
3003
  if (!result)
2780
3004
  return result;
2781
- // A `#define` is a value, never a callee (#1838): a macro defined only in
2782
- // an unrelated file is not what `NAME(x)` here expands to either.
3005
+ if (ref.language === 'go' && (ref.referenceKind === 'calls' || ref.referenceKind === 'function_ref') &&
3006
+ (0, name_matcher_1.isGoBareName)(ref, this.context) && (0, name_matcher_1.isGoLocallyBound)(ref, this.context))
3007
+ return null;
2783
3008
  if (ref.referenceKind === 'calls') {
2784
3009
  const target = this.nodeById(result.targetNodeId);
2785
3010
  if (target?.kind === 'constant' && types_1.CPP_DEFINE_SIGNATURE.test(target.signature ?? ''))
2786
3011
  return null;
3012
+ if (target && ref.language === 'go' && name_matcher_1.GO_TYPE_KINDS.has(target.kind) &&
3013
+ !ref.referenceName.includes('.') && !(0, name_matcher_1.isGoBareName)(ref, this.context))
3014
+ return null;
3015
+ if (target && (0, name_matcher_5.isLexicalBindingOfJsThisCall)(target, ref, this.context))
3016
+ return null;
3017
+ }
3018
+ if ((ref.referenceKind === 'calls' || ref.referenceKind === 'instantiates') && import_resolver_1.ESM_IMPORT_LANGUAGES.has(ref.language)) {
3019
+ const target = this.nodeById(result.targetNodeId);
3020
+ if (target && (target.kind === 'interface' || target.kind === 'type_alias')) {
3021
+ const value = this.sameNamedValueOfType(target);
3022
+ if (!value)
3023
+ return null;
3024
+ result = { ...result, targetNodeId: value.id };
3025
+ }
2787
3026
  }
2788
- // An `imports` reference names something importable — never a member that
2789
- // only exists inside a type.
2790
3027
  if (ref.referenceKind === 'imports') {
2791
3028
  const target = this.nodeById(result.targetNodeId);
3029
+ if (target?.kind === 'import' && target.filePath === ref.filePath)
3030
+ return null;
2792
3031
  return target && !(0, types_1.isImportableKind)(target.kind) ? null : result;
2793
3032
  }
3033
+ if (ref.language === 'go' && ref.referenceKind === 'references' &&
3034
+ name_matcher_1.GO_TYPE_KINDS.has(this.nodeById(ref.fromNodeId)?.kind ?? '') && (0, name_matcher_1.isGoUnknownQualified)(ref, this.context))
3035
+ return null;
3036
+ if (ref.language === 'go' && (ref.referenceKind === 'instantiates' ||
3037
+ (ref.referenceKind === 'references' && this.nodeById(ref.fromNodeId)?.kind !== 'route'))) {
3038
+ return (0, name_matcher_1.goTypePositionTarget)(result, ref, this.context);
3039
+ }
2794
3040
  if (!(0, types_1.isInheritanceRef)(ref))
2795
3041
  return result;
2796
3042
  const target = this.nodeById(result.targetNodeId);
@@ -2800,24 +3046,19 @@ class ReferenceResolver {
2800
3046
  return null;
2801
3047
  result = { ...result, targetNodeId: type.id };
2802
3048
  }
2803
- if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context))
3049
+ if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context, target))
2804
3050
  return null;
3051
+ if (ref.language === 'go' && (0, name_matcher_1.isGoUnknownQualified)(ref, this.context))
3052
+ return null;
3053
+ if (ref.language === 'go')
3054
+ return (0, name_matcher_1.goDotImportedSupertype)(result, ref, this.context);
2805
3055
  return result;
2806
3056
  }
2807
- /**
2808
- * `super.didMoveToWindow()` inside an override of `didMoveToWindow` calls
2809
- * the PARENT's implementation, never the method making the call. Extraction
2810
- * keeps a `super` call under the bare method name, so every strategy found
2811
- * the enclosing method itself: one expo-camera view had eleven of its
2812
- * overrides "calling" themselves. The parent's method is usually a
2813
- * framework's (UIKit, Android, React); a self-edge is never it. Real
2814
- * recursion keeps its edge — only a call written through `super` / `base`
2815
- * (C#) / `[super …]` (Objective-C) / `parent::` (PHP) / `super().` (Python)
2816
- * is declined.
2817
- */
2818
3057
  gateSuperSelfCall(result, ref) {
2819
3058
  if (!result || ref.referenceKind !== 'calls' || result.targetNodeId !== ref.fromNodeId)
2820
3059
  return result;
3060
+ if ((0, js_super_calls_1.isJsSuperCallLanguage)(ref.language))
3061
+ return (0, js_super_calls_1.isJsSuperCallSite)(ref, this.context) ? null : result;
2821
3062
  const name = ref.referenceName.slice(Math.max(ref.referenceName.lastIndexOf('.'), ref.referenceName.lastIndexOf(':')) + 1);
2822
3063
  if (!/^[A-Za-z_$][\w$]*$/.test(name))
2823
3064
  return result;
@@ -2828,29 +3069,227 @@ class ReferenceResolver {
2828
3069
  const viaSuper = new RegExp(String.raw `(?:\b(?:super|base)\s*(?:\(\s*(?:[\w.]+\s*,\s*\w+)?\s*\))?\s*\??\.\s*|\[\s*super\s+|\bparent\s*::\s*)` + escaped + String.raw `\b`);
2829
3070
  return viaSuper.test(line) ? null : result;
2830
3071
  }
2831
- /**
2832
- * A bare Rust name reaches only what is in scope — every strategy's result,
2833
- * a framework resolver's `Ok(x)` → `struct Ok` construction included (see
2834
- * isRustNameInScope).
2835
- */
2836
3072
  gateRustScope(result, ref) {
2837
- if (!result || ref.language !== 'rust' || !/^[A-Za-z_]\w*$/.test(ref.referenceName))
3073
+ if (!result || ref.language !== 'rust')
3074
+ return result;
3075
+ const bare = /^[A-Za-z_]\w*$/.test(ref.referenceName);
3076
+ if (!bare && ref.referenceKind !== 'calls')
2838
3077
  return result;
2839
3078
  const target = this.nodeById(result.targetNodeId);
2840
- return target && !(0, name_matcher_1.isRustNameInScope)(target, ref, this.context) ? null : result;
3079
+ if (!target)
3080
+ return result;
3081
+ if (bare && !(0, name_matcher_1.isRustNameInScope)(target, ref, this.context))
3082
+ return null;
3083
+ if (ref.referenceKind !== 'calls')
3084
+ return result;
3085
+ if (!bare && !(0, name_matcher_1.isRustPathCallReachable)(target, ref, this.context))
3086
+ return null;
3087
+ const guessed = result.byName === true || result.resolvedBy === 'exact-match' || result.resolvedBy === 'fuzzy';
3088
+ if ((0, name_matcher_1.isRustCallUnreachable)(target, ref, guessed, this.context))
3089
+ return null;
3090
+ return (0, name_matcher_1.isRustForeignImplCallable)(target, ref, this.context) ? result : null;
3091
+ }
3092
+ mocklessContextFor(ref, base) {
3093
+ if ((0, query_utils_1.isTestPath)(ref.filePath))
3094
+ return null;
3095
+ const mocks = this.manualMockNames();
3096
+ if (!mocks)
3097
+ return null;
3098
+ if (this.mocklessContext && this.mocklessBase === base)
3099
+ return this.mocklessContext;
3100
+ const isMock = (n) => (0, name_matcher_1.isManualMockPath)(n.filePath);
3101
+ const real = (nodes) => (nodes.some(isMock) ? nodes.filter((n) => !isMock(n)) : nodes);
3102
+ const byName = new Map();
3103
+ const byLowerName = new Map();
3104
+ const byKind = new Map();
3105
+ const getMethodMatches = base.getMethodMatches;
3106
+ const iterateNodesByKind = base.iterateNodesByKind;
3107
+ this.mocklessBase = base;
3108
+ this.mocklessContext = {
3109
+ ...base,
3110
+ getNodesByName: (name) => {
3111
+ if (!mocks.names.has(name))
3112
+ return base.getNodesByName(name);
3113
+ let nodes = byName.get(name);
3114
+ if (!nodes)
3115
+ byName.set(name, (nodes = real(base.getNodesByName(name))));
3116
+ return nodes;
3117
+ },
3118
+ getNodesByLowerName: (lowerName) => {
3119
+ if (!mocks.lowerNames.has(lowerName))
3120
+ return base.getNodesByLowerName(lowerName);
3121
+ let nodes = byLowerName.get(lowerName);
3122
+ if (!nodes)
3123
+ byLowerName.set(lowerName, (nodes = real(base.getNodesByLowerName(lowerName))));
3124
+ return nodes;
3125
+ },
3126
+ getNodesByQualifiedName: (qualifiedName) => real(base.getNodesByQualifiedName(qualifiedName)),
3127
+ getNodesByKind: (kind) => {
3128
+ let nodes = byKind.get(kind);
3129
+ if (!nodes)
3130
+ byKind.set(kind, (nodes = real(base.getNodesByKind(kind))));
3131
+ return nodes;
3132
+ },
3133
+ getMethodMatches: getMethodMatches
3134
+ ? (typeName, methodName, language) => {
3135
+ const nodes = getMethodMatches(typeName, methodName, language);
3136
+ return mocks.names.has(methodName) ? real(nodes) : nodes;
3137
+ }
3138
+ : undefined,
3139
+ iterateNodesByKind: iterateNodesByKind
3140
+ ? function* (kind) {
3141
+ for (const n of iterateNodesByKind(kind))
3142
+ if (!isMock(n))
3143
+ yield n;
3144
+ }
3145
+ : undefined,
3146
+ };
3147
+ return this.mocklessContext;
3148
+ }
3149
+ mocklessContext = null;
3150
+ mocklessBase = null;
3151
+ manualMocks;
3152
+ manualMockNames() {
3153
+ if (this.manualMocks !== undefined)
3154
+ return this.manualMocks;
3155
+ const files = [...(this.knownFiles ?? this.queries.getAllFilePaths())].filter(name_matcher_1.isManualMockPath);
3156
+ const names = new Set();
3157
+ const lowerNames = new Set();
3158
+ if (files.length > 0) {
3159
+ for (const n of this.queries.getNodesByFiles(files)) {
3160
+ names.add(n.name);
3161
+ lowerNames.add(n.name.toLowerCase());
3162
+ }
3163
+ }
3164
+ this.manualMocks = names.size > 0 ? { names, lowerNames } : null;
3165
+ return this.manualMocks;
3166
+ }
3167
+ classExpressionFreeContextFor(ref, base) {
3168
+ if (!js_class_expressions_1.CLASS_EXPRESSION_REF_LANGUAGES.has(ref.language))
3169
+ return null;
3170
+ const expressions = this.classExpressions();
3171
+ if (!expressions)
3172
+ return null;
3173
+ const dot = ref.referenceName.indexOf('.');
3174
+ const named = expressions.byName.get(dot > 0 ? ref.referenceName.slice(0, dot) : ref.referenceName);
3175
+ const inside = expressions.byFile.get(ref.filePath)?.some((n) => (0, js_class_expressions_1.writtenIn)(n, ref)) ?? false;
3176
+ if (inside && !(named && !named.some((n) => (0, js_class_expressions_1.writtenIn)(n, ref))))
3177
+ return null;
3178
+ let view = this.classExpressionFreeViews.get(base);
3179
+ if (!view) {
3180
+ view = this.classExpressionFreeView(base);
3181
+ this.classExpressionFreeViews.set(base, view);
3182
+ this.classExpressionFreeBases.set(view, base);
3183
+ }
3184
+ return view;
3185
+ }
3186
+ classExpressionFreeView(base) {
3187
+ const { hiddenIds } = this.classExpressions();
3188
+ const hidden = (n) => hiddenIds.has(n.id);
3189
+ const keep = (nodes) => (nodes.some(hidden) ? nodes.filter((n) => !hidden(n)) : nodes);
3190
+ const byKind = new Map();
3191
+ const getMethodMatches = base.getMethodMatches;
3192
+ const iterateNodesByKind = base.iterateNodesByKind;
3193
+ const { files } = this.classExpressions();
3194
+ return {
3195
+ ...base,
3196
+ getNodesByName: (name) => keep(base.getNodesByName(name)),
3197
+ getNodesByLowerName: (lowerName) => keep(base.getNodesByLowerName(lowerName)),
3198
+ getNodesByQualifiedName: (qualifiedName) => keep(base.getNodesByQualifiedName(qualifiedName)),
3199
+ getNodesInFile: (filePath) => (files.has(filePath) ? keep(base.getNodesInFile(filePath)) : base.getNodesInFile(filePath)),
3200
+ getNodesByKind: (kind) => {
3201
+ let nodes = byKind.get(kind);
3202
+ if (!nodes)
3203
+ byKind.set(kind, (nodes = keep(base.getNodesByKind(kind))));
3204
+ return nodes;
3205
+ },
3206
+ getMethodMatches: getMethodMatches
3207
+ ? (typeName, methodName, language) => keep(getMethodMatches(typeName, methodName, language))
3208
+ : undefined,
3209
+ iterateNodesByKind: iterateNodesByKind
3210
+ ? function* (kind) {
3211
+ for (const n of iterateNodesByKind(kind))
3212
+ if (!hidden(n))
3213
+ yield n;
3214
+ }
3215
+ : undefined,
3216
+ };
3217
+ }
3218
+ classExpressionFreeViews = new WeakMap();
3219
+ classExpressionFreeBases = new WeakMap();
3220
+ classExpressionOnlyNames() {
3221
+ if (this.classExpressionOnlyNameSet)
3222
+ return this.classExpressionOnlyNameSet;
3223
+ const only = new Set();
3224
+ const expressions = this.classExpressions();
3225
+ if (expressions) {
3226
+ const names = new Set();
3227
+ for (const id of expressions.hiddenIds) {
3228
+ const n = this.nodeById(id);
3229
+ if (n)
3230
+ names.add(n.name);
3231
+ }
3232
+ for (const name of names) {
3233
+ if (!this.queries.getNodesByName(name).some((n) => !expressions.hiddenIds.has(n.id)))
3234
+ only.add(name);
3235
+ }
3236
+ }
3237
+ this.classExpressionOnlyNameSet = only;
3238
+ return only;
3239
+ }
3240
+ classExpressionOnlyNameSet = null;
3241
+ classExpressionIndex;
3242
+ classExpressions() {
3243
+ if (this.classExpressionIndex !== undefined)
3244
+ return this.classExpressionIndex;
3245
+ const byName = new Map();
3246
+ const byFile = new Map();
3247
+ const byKey = new Map();
3248
+ const files = new Set();
3249
+ const hiddenIds = new Set();
3250
+ const linesOf = (file) => this.context.getFileLines?.(file) ?? this.context.readFile(file)?.split(/\r?\n/) ?? [];
3251
+ for (const n of this.queries.getNodesByKind('class')) {
3252
+ if (!(0, js_class_expressions_1.isJsClassExpression)(n) || (0, js_class_expressions_1.isCommonJsExportedClass)(n, linesOf(n.filePath)))
3253
+ continue;
3254
+ const named = byName.get(n.name);
3255
+ if (named)
3256
+ named.push(n);
3257
+ else
3258
+ byName.set(n.name, [n]);
3259
+ const inFile = byFile.get(n.filePath);
3260
+ if (inFile)
3261
+ inFile.push(n);
3262
+ else
3263
+ byFile.set(n.filePath, [n]);
3264
+ byKey.set(`${n.filePath}\0${n.qualifiedName}`, n);
3265
+ files.add(n.filePath);
3266
+ hiddenIds.add(n.id);
3267
+ }
3268
+ const ownerOf = (member) => {
3269
+ const cut = member.qualifiedName.lastIndexOf('::');
3270
+ return cut > 0 ? byKey.get(`${member.filePath}\0${member.qualifiedName.slice(0, cut)}`) : undefined;
3271
+ };
3272
+ if (files.size > 0) {
3273
+ for (const n of this.queries.getNodesByFiles([...files])) {
3274
+ if ((n.kind === 'method' || n.kind === 'property' || n.kind === 'field') && ownerOf(n))
3275
+ hiddenIds.add(n.id);
3276
+ }
3277
+ }
3278
+ this.classExpressionIndex = byName.size > 0 ? { byName, byFile, files, hiddenIds, ownerOf } : null;
3279
+ return this.classExpressionIndex;
3280
+ }
3281
+ isIndexedFile(filePath) {
3282
+ const normalized = filePath.replace(/\\/g, '/');
3283
+ return this.knownFiles ? this.knownFiles.has(normalized) : this.queries.getFileByPath(normalized) !== null;
2841
3284
  }
2842
- /** The repository's own package name, from its root package.json; null without one. */
2843
- /** Per directory: the package names its package.json and every enclosing one own and depend on. */
2844
3285
  manifestScopes = new Map();
2845
- /**
2846
- * Is `source` a package from outside the repository? Only when the importing
2847
- * file's package.json (or an enclosing one) declares it, or it is a Node
2848
- * built-in or a runtime's virtual module. A specifier nothing declares is
2849
- * an alias this resolver does not know — SvelteKit's `$lib/…`, Nuxt's
2850
- * `~/…`, a nested app's own `@/…` — and stays the project's.
2851
- */
3286
+ installedPackages = new Map();
3287
+ directoryListings = new Map();
3288
+ searchedModules = new Map();
3289
+ realModulesDirs = new Map();
3290
+ ownPackageNames = null;
3291
+ installedNames = new Map();
2852
3292
  isDeclaredOutsidePackage(source, fromFile) {
2853
- // Deno's standard library is `@std/…` from JSR.
2854
3293
  if (/^(?:node|bun|jsr|npm|https?):/.test(source) || source.startsWith('@std/') || NODE_BUILTINS.has(source))
2855
3294
  return true;
2856
3295
  const name = source.startsWith('@') ? source.split('/').slice(0, 2).join('/') : source.split('/')[0];
@@ -2860,11 +3299,128 @@ class ReferenceResolver {
2860
3299
  return false;
2861
3300
  if (scope.deps.has(name))
2862
3301
  return true;
2863
- // SvelteKit's `$app/…` and Astro's `astro:…` belong to the framework —
2864
- // unless this repository is that framework.
2865
3302
  const provider = source.startsWith('astro:') ? 'astro' : /^\$(?:app|env|service-worker)(?:\/|$)/.test(source) ? '@sveltejs/kit' : null;
2866
3303
  return provider !== null && !scope.own.has(provider) && !this.context.getWorkspacePackages?.()?.byName.has(provider);
2867
3304
  }
3305
+ isInstalledPackage(source, fromFile) {
3306
+ const segments = source.split('/');
3307
+ const name = source.startsWith('@') ? segments.slice(0, 2).join('/') : segments[0];
3308
+ if (!/^(?:@[A-Za-z0-9][\w.~-]*\/)?[A-Za-z0-9][\w.~-]*$/.test(name))
3309
+ return false;
3310
+ const normalized = fromFile.replace(/\\/g, '/');
3311
+ const fromDir = normalized.includes('/') ? normalized.slice(0, normalized.lastIndexOf('/')) : '';
3312
+ const scope = this.manifestScope(fromDir);
3313
+ if (scope.own.has(name) || this.context.getWorkspacePackages?.()?.byName.has(name))
3314
+ return false;
3315
+ for (const modules of this.modulesSearchedFrom(fromDir)) {
3316
+ if (this.listing(modules) === null)
3317
+ continue;
3318
+ const copy = this.isRegistryCopy(modules, name);
3319
+ if (copy !== undefined)
3320
+ return copy && !this.isProjectPackageCopy(modules, name);
3321
+ }
3322
+ return false;
3323
+ }
3324
+ isProjectPackageCopy(modules, name) {
3325
+ const own = this.projectPackageNames();
3326
+ if (own.has(name))
3327
+ return true;
3328
+ const key = modules + '\0' + name;
3329
+ let installedAs = this.installedNames.get(key);
3330
+ if (installedAs === undefined) {
3331
+ const json = readPackageJson(path.join(modules, name, 'package.json'));
3332
+ installedAs = typeof json?.name === 'string' ? json.name : '';
3333
+ this.installedNames.set(key, installedAs);
3334
+ }
3335
+ return installedAs !== '' && own.has(installedAs);
3336
+ }
3337
+ projectPackageNames() {
3338
+ if (this.ownPackageNames)
3339
+ return this.ownPackageNames;
3340
+ const names = new Set();
3341
+ const dirs = new Set();
3342
+ for (const file of this.knownFiles ?? this.queries.getAllFilePaths()) {
3343
+ let dir = file.replace(/\\/g, '/');
3344
+ do {
3345
+ dir = dir.includes('/') ? dir.slice(0, dir.lastIndexOf('/')) : '';
3346
+ if (dirs.has(dir))
3347
+ break;
3348
+ dirs.add(dir);
3349
+ } while (dir !== '');
3350
+ }
3351
+ for (const dir of dirs) {
3352
+ const json = readPackageJson(path.join(this.projectRoot, dir, 'package.json'));
3353
+ if (!json)
3354
+ continue;
3355
+ if (typeof json.name === 'string')
3356
+ names.add(json.name);
3357
+ for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
3358
+ const deps = json[field];
3359
+ if (!deps || typeof deps !== 'object')
3360
+ continue;
3361
+ for (const [dep, version] of Object.entries(deps)) {
3362
+ if (typeof version === 'string' && LOCAL_DEPENDENCY_SPEC.test(version))
3363
+ names.add(dep);
3364
+ }
3365
+ }
3366
+ }
3367
+ this.ownPackageNames = names;
3368
+ return names;
3369
+ }
3370
+ modulesSearchedFrom(dir) {
3371
+ const memo = this.searchedModules.get(dir);
3372
+ if (memo)
3373
+ return memo;
3374
+ let real = path.resolve(this.projectRoot, dir);
3375
+ try {
3376
+ real = fs.realpathSync(real);
3377
+ }
3378
+ catch { }
3379
+ const found = [];
3380
+ for (let at = real;; at = path.dirname(at)) {
3381
+ if (path.basename(at) !== 'node_modules')
3382
+ found.push(path.join(at, 'node_modules'));
3383
+ if (path.dirname(at) === at)
3384
+ break;
3385
+ }
3386
+ this.searchedModules.set(dir, found);
3387
+ return found;
3388
+ }
3389
+ isRegistryCopy(modules, name) {
3390
+ const key = modules + '\0' + name;
3391
+ if (this.installedPackages.has(key))
3392
+ return this.installedPackages.get(key);
3393
+ let answer;
3394
+ const scope = name.startsWith('@') ? name.slice(0, name.indexOf('/')) : null;
3395
+ const listed = scope
3396
+ ? this.listing(modules)?.has(scope) && this.listing(path.join(modules, scope))?.has(name.slice(scope.length + 1))
3397
+ : this.listing(modules)?.has(name);
3398
+ if (listed) {
3399
+ try {
3400
+ let realModules = this.realModulesDirs.get(modules);
3401
+ if (realModules === undefined) {
3402
+ realModules = fs.realpathSync(modules);
3403
+ this.realModulesDirs.set(modules, realModules);
3404
+ }
3405
+ const rel = path.relative(path.dirname(realModules), fs.realpathSync(path.join(modules, name)));
3406
+ answer = rel.split(path.sep).includes('node_modules');
3407
+ }
3408
+ catch { }
3409
+ }
3410
+ this.installedPackages.set(key, answer);
3411
+ return answer;
3412
+ }
3413
+ listing(dir) {
3414
+ if (this.directoryListings.has(dir))
3415
+ return this.directoryListings.get(dir);
3416
+ let names = null;
3417
+ try {
3418
+ names = new Set(fs.readdirSync(dir));
3419
+ }
3420
+ catch { }
3421
+ this.directoryListings.set(dir, names);
3422
+ return names;
3423
+ }
2868
3424
  manifestScope(dir) {
2869
3425
  const memo = this.manifestScopes.get(dir);
2870
3426
  if (memo)
@@ -2882,7 +3438,6 @@ class ReferenceResolver {
2882
3438
  if (!deps || typeof deps !== 'object')
2883
3439
  continue;
2884
3440
  for (const [dep, version] of Object.entries(deps)) {
2885
- // `workspace:*`, `file:../shared`, `link:…`: a package in this repository.
2886
3441
  if (typeof version === 'string' && /^(?:workspace|file|link|portal):/.test(version))
2887
3442
  scope.own.add(dep);
2888
3443
  else
@@ -2891,9 +3446,7 @@ class ReferenceResolver {
2891
3446
  }
2892
3447
  }
2893
3448
  }
2894
- catch { /* no or unreadable package.json */ }
2895
- // A Deno import map names packages the same way — an entry that maps to a
2896
- // registry or a URL, not one that maps to a path in the repository.
3449
+ catch { }
2897
3450
  for (const file of ['deno.json', 'deno.jsonc']) {
2898
3451
  const raw = this.context.readFile(dir ? `${dir}/${file}` : file);
2899
3452
  if (!raw)
@@ -2913,7 +3466,12 @@ class ReferenceResolver {
2913
3466
  this.manifestScopes.set(dir, scope);
2914
3467
  return scope;
2915
3468
  }
2916
- /** The one supertype-kind node a TypeScript value shares its name and file with. */
3469
+ sameNamedValueOfType(type) {
3470
+ return this.context
3471
+ .getNodesInFile(type.filePath)
3472
+ .filter((n) => n.name === type.name && TYPE_COMPANION_VALUE_KINDS.has(n.kind))
3473
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0] ?? null;
3474
+ }
2917
3475
  sameNamedTypeOfValue(value) {
2918
3476
  if (value.kind !== 'constant' && value.kind !== 'variable')
2919
3477
  return null;
@@ -2929,18 +3487,12 @@ class ReferenceResolver {
2929
3487
  return result;
2930
3488
  return (0, name_matcher_1.gateLanguageMatch)(result, ref, this.context);
2931
3489
  }
2932
- /**
2933
- * Framework calls carry bridge evidence (RN/Expo JS → native). Other
2934
- * framework results obey the same code-family boundary as name matches;
2935
- * markup/config transitions remain open.
2936
- */
2937
3490
  gateFrameworkLanguage(result, ref) {
2938
3491
  if (!result)
2939
3492
  return result;
2940
3493
  if (ref.referenceKind === 'calls')
2941
3494
  return result;
2942
3495
  const tgt = this.getLanguageFromNodeId(result.targetNodeId);
2943
- // Package imports cannot target prose found by a framework's name lookup.
2944
3496
  if (ref.referenceKind === 'imports' && tgt === 'markdown' && ref.language !== 'markdown')
2945
3497
  return null;
2946
3498
  if (tgt && ref.language && (0, name_matcher_1.crossesCodeBoundary)(tgt, ref.language))
@@ -2949,9 +3501,19 @@ class ReferenceResolver {
2949
3501
  }
2950
3502
  }
2951
3503
  exports.ReferenceResolver = ReferenceResolver;
2952
- /**
2953
- * Create a reference resolver instance
2954
- */
3504
+ function isCfmlTemplatePath(name) {
3505
+ return !name.includes(':') && (name.includes('/') || name.includes('\\') || /\.(?:cfml?|cfc|cfs)$/i.test(name.trim()));
3506
+ }
3507
+ function goDirOf(p) {
3508
+ const dir = path.posix.dirname(p.replace(/\\/g, '/'));
3509
+ return dir === '.' || dir === '/' ? '' : dir;
3510
+ }
3511
+ function changedRoutes(before, after) {
3512
+ const key = (route) => `${route.filePath}\0${route.name}`;
3513
+ const beforeKeys = new Set(before.map(key));
3514
+ const afterKeys = new Set(after.map(key));
3515
+ return [...before.filter((route) => !afterKeys.has(key(route))), ...after.filter((route) => !beforeKeys.has(key(route)))];
3516
+ }
2955
3517
  function createResolver(projectRoot, queries) {
2956
3518
  const resolver = new ReferenceResolver(projectRoot, queries);
2957
3519
  resolver.initialize();