@lzehrung/codegraph 2.3.31 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (596) hide show
  1. package/README.md +33 -141
  2. package/codegraph-skill/codegraph/SKILL.md +8 -6
  3. package/dist/agent/artifact.d.ts +2 -0
  4. package/dist/agent/artifact.d.ts.map +1 -1
  5. package/dist/agent/artifact.js.map +1 -1
  6. package/dist/agent/call-hierarchy.js +2 -4
  7. package/dist/agent/call-hierarchy.js.map +1 -1
  8. package/dist/agent/explore.d.ts +1 -1
  9. package/dist/agent/explore.d.ts.map +1 -1
  10. package/dist/agent/explore.js +3 -2
  11. package/dist/agent/explore.js.map +1 -1
  12. package/dist/agent/refactor-plan.js +2 -4
  13. package/dist/agent/refactor-plan.js.map +1 -1
  14. package/dist/agent/rename-preview.d.ts.map +1 -1
  15. package/dist/agent/rename-preview.js +4 -3
  16. package/dist/agent/rename-preview.js.map +1 -1
  17. package/dist/agent/search.d.ts.map +1 -1
  18. package/dist/agent/search.js +5 -3
  19. package/dist/agent/search.js.map +1 -1
  20. package/dist/agent/semantic-symbols.d.ts.map +1 -1
  21. package/dist/agent/semantic-symbols.js +2 -3
  22. package/dist/agent/semantic-symbols.js.map +1 -1
  23. package/dist/agent/session.d.ts +3 -0
  24. package/dist/agent/session.d.ts.map +1 -1
  25. package/dist/agent/session.js +10 -2
  26. package/dist/agent/session.js.map +1 -1
  27. package/dist/agent/type-hierarchy.js +2 -4
  28. package/dist/agent/type-hierarchy.js.map +1 -1
  29. package/dist/agent/workspace-symbols.d.ts.map +1 -1
  30. package/dist/agent/workspace-symbols.js +2 -3
  31. package/dist/agent/workspace-symbols.js.map +1 -1
  32. package/dist/agent-tools.d.ts +0 -4
  33. package/dist/agent-tools.d.ts.map +1 -1
  34. package/dist/agent-tools.js +3 -6
  35. package/dist/agent-tools.js.map +1 -1
  36. package/dist/analysis-summary.d.ts +8 -4
  37. package/dist/analysis-summary.d.ts.map +1 -1
  38. package/dist/analysis-summary.js +15 -66
  39. package/dist/analysis-summary.js.map +1 -1
  40. package/dist/bin/cli.js +51145 -41770
  41. package/dist/bin/query-index-worker.js +122 -82
  42. package/dist/cli/affected.d.ts.map +1 -1
  43. package/dist/cli/affected.js +4 -1
  44. package/dist/cli/affected.js.map +1 -1
  45. package/dist/cli/command-catalog.js +1 -1
  46. package/dist/cli/command-catalog.js.map +1 -1
  47. package/dist/cli/command-table.d.ts.map +1 -1
  48. package/dist/cli/command-table.js +9 -17
  49. package/dist/cli/command-table.js.map +1 -1
  50. package/dist/cli/context.js +10 -10
  51. package/dist/cli/context.js.map +1 -1
  52. package/dist/cli/drift.d.ts +0 -2
  53. package/dist/cli/drift.d.ts.map +1 -1
  54. package/dist/cli/drift.js +0 -1
  55. package/dist/cli/drift.js.map +1 -1
  56. package/dist/cli/graph-delta.d.ts +0 -2
  57. package/dist/cli/graph-delta.d.ts.map +1 -1
  58. package/dist/cli/graph-delta.js +0 -4
  59. package/dist/cli/graph-delta.js.map +1 -1
  60. package/dist/cli/graph-queries.d.ts.map +1 -1
  61. package/dist/cli/graph-queries.js +27 -1
  62. package/dist/cli/graph-queries.js.map +1 -1
  63. package/dist/cli/graph.d.ts +0 -3
  64. package/dist/cli/graph.d.ts.map +1 -1
  65. package/dist/cli/graph.js +4 -14
  66. package/dist/cli/graph.js.map +1 -1
  67. package/dist/cli/help.d.ts +34 -34
  68. package/dist/cli/help.d.ts.map +1 -1
  69. package/dist/cli/help.js +9 -14
  70. package/dist/cli/help.js.map +1 -1
  71. package/dist/cli/impact.d.ts +0 -2
  72. package/dist/cli/impact.d.ts.map +1 -1
  73. package/dist/cli/impact.js +0 -1
  74. package/dist/cli/impact.js.map +1 -1
  75. package/dist/cli/index.d.ts +0 -2
  76. package/dist/cli/index.d.ts.map +1 -1
  77. package/dist/cli/index.js +5 -6
  78. package/dist/cli/index.js.map +1 -1
  79. package/dist/cli/inspect.d.ts +0 -2
  80. package/dist/cli/inspect.d.ts.map +1 -1
  81. package/dist/cli/inspect.js +5 -8
  82. package/dist/cli/inspect.js.map +1 -1
  83. package/dist/cli/invocation-context.d.ts +0 -3
  84. package/dist/cli/invocation-context.d.ts.map +1 -1
  85. package/dist/cli/invocation-context.js +4 -16
  86. package/dist/cli/invocation-context.js.map +1 -1
  87. package/dist/cli/navigation.d.ts +0 -2
  88. package/dist/cli/navigation.d.ts.map +1 -1
  89. package/dist/cli/navigation.js +0 -1
  90. package/dist/cli/navigation.js.map +1 -1
  91. package/dist/cli/options.d.ts.map +1 -1
  92. package/dist/cli/options.js +4 -14
  93. package/dist/cli/options.js.map +1 -1
  94. package/dist/cli/review.d.ts +0 -2
  95. package/dist/cli/review.d.ts.map +1 -1
  96. package/dist/cli/review.js +0 -5
  97. package/dist/cli/review.js.map +1 -1
  98. package/dist/cli/root-policy.d.ts +0 -2
  99. package/dist/cli/root-policy.d.ts.map +1 -1
  100. package/dist/cli/root-policy.js +0 -8
  101. package/dist/cli/root-policy.js.map +1 -1
  102. package/dist/cli/server.d.ts.map +1 -1
  103. package/dist/cli/server.js +0 -2
  104. package/dist/cli/server.js.map +1 -1
  105. package/dist/drift/artifact.d.ts.map +1 -1
  106. package/dist/drift/artifact.js +15 -18
  107. package/dist/drift/artifact.js.map +1 -1
  108. package/dist/drift/compare.js +1 -1
  109. package/dist/drift/compare.js.map +1 -1
  110. package/dist/drift/git.d.ts.map +1 -1
  111. package/dist/drift/git.js +0 -1
  112. package/dist/drift/git.js.map +1 -1
  113. package/dist/drift/snapshot.d.ts.map +1 -1
  114. package/dist/drift/snapshot.js +5 -7
  115. package/dist/drift/snapshot.js.map +1 -1
  116. package/dist/drift/types.d.ts +2 -2
  117. package/dist/drift/types.d.ts.map +1 -1
  118. package/dist/drift/types.js.map +1 -1
  119. package/dist/duplicates/unit-cache.d.ts +0 -1
  120. package/dist/duplicates/unit-cache.d.ts.map +1 -1
  121. package/dist/duplicates/unit-cache.js +3 -11
  122. package/dist/duplicates/unit-cache.js.map +1 -1
  123. package/dist/duplicates/units.d.ts +5 -5
  124. package/dist/duplicates/units.d.ts.map +1 -1
  125. package/dist/duplicates/units.js +25 -88
  126. package/dist/duplicates/units.js.map +1 -1
  127. package/dist/graph-builder.d.ts +0 -6
  128. package/dist/graph-builder.d.ts.map +1 -1
  129. package/dist/graph-builder.js +6 -11
  130. package/dist/graph-builder.js.map +1 -1
  131. package/dist/graph-edge-collector.d.ts +4 -6
  132. package/dist/graph-edge-collector.d.ts.map +1 -1
  133. package/dist/graph-edge-collector.js +31 -26
  134. package/dist/graph-edge-collector.js.map +1 -1
  135. package/dist/graphs/angularjs.d.ts.map +1 -1
  136. package/dist/graphs/angularjs.js +2 -1
  137. package/dist/graphs/angularjs.js.map +1 -1
  138. package/dist/graphs/edge-resolution.d.ts +4 -1
  139. package/dist/graphs/edge-resolution.d.ts.map +1 -1
  140. package/dist/graphs/edge-resolution.js +24 -76
  141. package/dist/graphs/edge-resolution.js.map +1 -1
  142. package/dist/graphs/specifiers.d.ts +4 -13
  143. package/dist/graphs/specifiers.d.ts.map +1 -1
  144. package/dist/graphs/specifiers.js +80 -173
  145. package/dist/graphs/specifiers.js.map +1 -1
  146. package/dist/graphs/symbol-graph-detailed/ast.d.ts +20 -0
  147. package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
  148. package/dist/graphs/symbol-graph-detailed/ast.js +154 -15
  149. package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
  150. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +60 -8
  151. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -1
  152. package/dist/graphs/symbol-graph-detailed/edge-passes.js +997 -168
  153. package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -1
  154. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +2 -1
  155. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -1
  156. package/dist/graphs/symbol-graph-detailed/import-aliases.js +150 -7
  157. package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -1
  158. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +1 -0
  159. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -1
  160. package/dist/graphs/symbol-graph-detailed/member-chains.js +3 -1
  161. package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -1
  162. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +141 -25
  163. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -1
  164. package/dist/graphs/symbol-graph-detailed/receiver-calls.js +1015 -166
  165. package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -1
  166. package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
  167. package/dist/graphs/symbol-graph-detailed.js +449 -46
  168. package/dist/graphs/symbol-graph-detailed.js.map +1 -1
  169. package/dist/graphs/symbol-graph.d.ts +2 -0
  170. package/dist/graphs/symbol-graph.d.ts.map +1 -1
  171. package/dist/graphs/symbol-graph.js +34 -16
  172. package/dist/graphs/symbol-graph.js.map +1 -1
  173. package/dist/graphs/types.d.ts +0 -4
  174. package/dist/graphs/types.d.ts.map +1 -1
  175. package/dist/graphs.d.ts +1 -1
  176. package/dist/graphs.d.ts.map +1 -1
  177. package/dist/impact/call-compatibility/providers/index.d.ts +4 -4
  178. package/dist/impact/call-compatibility/providers/index.d.ts.map +1 -1
  179. package/dist/impact/call-compatibility/providers/index.js +6 -6
  180. package/dist/impact/call-compatibility/providers/index.js.map +1 -1
  181. package/dist/impact/call-compatibility/providers/types.d.ts +2 -0
  182. package/dist/impact/call-compatibility/providers/types.d.ts.map +1 -1
  183. package/dist/impact/call-compatibility/types.d.ts +6 -0
  184. package/dist/impact/call-compatibility/types.d.ts.map +1 -1
  185. package/dist/impact/call-compatibility.d.ts.map +1 -1
  186. package/dist/impact/call-compatibility.js +316 -526
  187. package/dist/impact/call-compatibility.js.map +1 -1
  188. package/dist/impact/map.js +1 -0
  189. package/dist/impact/map.js.map +1 -1
  190. package/dist/impact/reference-cache.d.ts.map +1 -1
  191. package/dist/impact/reference-cache.js +2 -2
  192. package/dist/impact/reference-cache.js.map +1 -1
  193. package/dist/index.d.ts +2 -2
  194. package/dist/index.d.ts.map +1 -1
  195. package/dist/index.js +1 -1
  196. package/dist/index.js.map +1 -1
  197. package/dist/indexer/ambiguous-resolution.d.ts +11 -0
  198. package/dist/indexer/ambiguous-resolution.d.ts.map +1 -0
  199. package/dist/indexer/ambiguous-resolution.js +19 -0
  200. package/dist/indexer/ambiguous-resolution.js.map +1 -0
  201. package/dist/indexer/build-cache/module-cache.d.ts +39 -1
  202. package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
  203. package/dist/indexer/build-cache/module-cache.js +218 -21
  204. package/dist/indexer/build-cache/module-cache.js.map +1 -1
  205. package/dist/indexer/build-cache/options.d.ts +30 -44
  206. package/dist/indexer/build-cache/options.d.ts.map +1 -1
  207. package/dist/indexer/build-cache/options.js +32 -71
  208. package/dist/indexer/build-cache/options.js.map +1 -1
  209. package/dist/indexer/build-cache/project-snapshot.d.ts +3 -3
  210. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  211. package/dist/indexer/build-cache/project-snapshot.js +164 -84
  212. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  213. package/dist/indexer/build-cache/reports.d.ts +0 -2
  214. package/dist/indexer/build-cache/reports.d.ts.map +1 -1
  215. package/dist/indexer/build-cache/reports.js +0 -97
  216. package/dist/indexer/build-cache/reports.js.map +1 -1
  217. package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
  218. package/dist/indexer/build-cache/resolver-environment.js +32 -2
  219. package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
  220. package/dist/indexer/build-cache.d.ts +2 -2
  221. package/dist/indexer/build-cache.d.ts.map +1 -1
  222. package/dist/indexer/build-cache.js +2 -2
  223. package/dist/indexer/build-cache.js.map +1 -1
  224. package/dist/indexer/build-index.d.ts.map +1 -1
  225. package/dist/indexer/build-index.js +656 -71
  226. package/dist/indexer/build-index.js.map +1 -1
  227. package/dist/indexer/build-workers.d.ts.map +1 -1
  228. package/dist/indexer/build-workers.js +9 -9
  229. package/dist/indexer/build-workers.js.map +1 -1
  230. package/dist/indexer/call-hierarchy.js +1 -1
  231. package/dist/indexer/call-hierarchy.js.map +1 -1
  232. package/dist/indexer/callable-identity.d.ts +24 -0
  233. package/dist/indexer/callable-identity.d.ts.map +1 -0
  234. package/dist/indexer/callable-identity.js +111 -0
  235. package/dist/indexer/callable-identity.js.map +1 -0
  236. package/dist/indexer/compilation-units.d.ts +103 -0
  237. package/dist/indexer/compilation-units.d.ts.map +1 -0
  238. package/dist/indexer/compilation-units.js +607 -0
  239. package/dist/indexer/compilation-units.js.map +1 -0
  240. package/dist/indexer/cpp-callables.d.ts +25 -0
  241. package/dist/indexer/cpp-callables.d.ts.map +1 -0
  242. package/dist/indexer/cpp-callables.js +562 -0
  243. package/dist/indexer/cpp-callables.js.map +1 -0
  244. package/dist/indexer/declaration-visibility.d.ts +43 -2
  245. package/dist/indexer/declaration-visibility.d.ts.map +1 -1
  246. package/dist/indexer/declaration-visibility.js +158 -2
  247. package/dist/indexer/declaration-visibility.js.map +1 -1
  248. package/dist/indexer/expand-star-imports.d.ts +6 -1
  249. package/dist/indexer/expand-star-imports.d.ts.map +1 -1
  250. package/dist/indexer/expand-star-imports.js +131 -37
  251. package/dist/indexer/expand-star-imports.js.map +1 -1
  252. package/dist/indexer/finalize.d.ts.map +1 -1
  253. package/dist/indexer/finalize.js +0 -1
  254. package/dist/indexer/finalize.js.map +1 -1
  255. package/dist/indexer/import-resolution-tables.d.ts +72 -0
  256. package/dist/indexer/import-resolution-tables.d.ts.map +1 -0
  257. package/dist/indexer/import-resolution-tables.js +137 -0
  258. package/dist/indexer/import-resolution-tables.js.map +1 -0
  259. package/dist/indexer/import-types.d.ts +54 -0
  260. package/dist/indexer/import-types.d.ts.map +1 -1
  261. package/dist/indexer/import-types.js +24 -1
  262. package/dist/indexer/import-types.js.map +1 -1
  263. package/dist/indexer/imports/context.d.ts +16 -1
  264. package/dist/indexer/imports/context.d.ts.map +1 -1
  265. package/dist/indexer/imports/import-binding-tables.d.ts +13 -1
  266. package/dist/indexer/imports/import-binding-tables.d.ts.map +1 -1
  267. package/dist/indexer/imports/import-binding-tables.js +149 -30
  268. package/dist/indexer/imports/import-binding-tables.js.map +1 -1
  269. package/dist/indexer/imports/js-text-imports.js +4 -4
  270. package/dist/indexer/imports/js-text-imports.js.map +1 -1
  271. package/dist/indexer/imports/native-captures.d.ts.map +1 -1
  272. package/dist/indexer/imports/native-captures.js +24 -6
  273. package/dist/indexer/imports/native-captures.js.map +1 -1
  274. package/dist/indexer/imports/python.d.ts +10 -2
  275. package/dist/indexer/imports/python.d.ts.map +1 -1
  276. package/dist/indexer/imports/python.js +128 -112
  277. package/dist/indexer/imports/python.js.map +1 -1
  278. package/dist/indexer/imports/text-import-extractors.d.ts.map +1 -1
  279. package/dist/indexer/imports/text-import-extractors.js +68 -19
  280. package/dist/indexer/imports/text-import-extractors.js.map +1 -1
  281. package/dist/indexer/imports.d.ts +3 -4
  282. package/dist/indexer/imports.d.ts.map +1 -1
  283. package/dist/indexer/imports.js +116 -72
  284. package/dist/indexer/imports.js.map +1 -1
  285. package/dist/indexer/incremental-plan.d.ts +33 -0
  286. package/dist/indexer/incremental-plan.d.ts.map +1 -1
  287. package/dist/indexer/incremental-plan.js +203 -1
  288. package/dist/indexer/incremental-plan.js.map +1 -1
  289. package/dist/indexer/locals-and-exports.d.ts +3 -2
  290. package/dist/indexer/locals-and-exports.d.ts.map +1 -1
  291. package/dist/indexer/locals-and-exports.js +659 -78
  292. package/dist/indexer/locals-and-exports.js.map +1 -1
  293. package/dist/indexer/member-selection.d.ts +46 -0
  294. package/dist/indexer/member-selection.d.ts.map +1 -0
  295. package/dist/indexer/member-selection.js +169 -0
  296. package/dist/indexer/member-selection.js.map +1 -0
  297. package/dist/indexer/name-lookup-policies/c-family.d.ts +7 -0
  298. package/dist/indexer/name-lookup-policies/c-family.d.ts.map +1 -0
  299. package/dist/indexer/name-lookup-policies/c-family.js +137 -0
  300. package/dist/indexer/name-lookup-policies/c-family.js.map +1 -0
  301. package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts +11 -0
  302. package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts.map +1 -0
  303. package/dist/indexer/name-lookup-policies/csharp-using-static.js +136 -0
  304. package/dist/indexer/name-lookup-policies/csharp-using-static.js.map +1 -0
  305. package/dist/indexer/name-lookup-policies/implicit-self.d.ts +10 -0
  306. package/dist/indexer/name-lookup-policies/implicit-self.d.ts.map +1 -0
  307. package/dist/indexer/name-lookup-policies/implicit-self.js +119 -0
  308. package/dist/indexer/name-lookup-policies/implicit-self.js.map +1 -0
  309. package/dist/indexer/name-lookup-policies/index.d.ts +3 -0
  310. package/dist/indexer/name-lookup-policies/index.d.ts.map +1 -0
  311. package/dist/indexer/name-lookup-policies/index.js +132 -0
  312. package/dist/indexer/name-lookup-policies/index.js.map +1 -0
  313. package/dist/indexer/name-lookup-policies/php.d.ts +3 -0
  314. package/dist/indexer/name-lookup-policies/php.d.ts.map +1 -0
  315. package/dist/indexer/name-lookup-policies/php.js +82 -0
  316. package/dist/indexer/name-lookup-policies/php.js.map +1 -0
  317. package/dist/indexer/name-resolution-types.d.ts +101 -0
  318. package/dist/indexer/name-resolution-types.d.ts.map +1 -0
  319. package/dist/indexer/name-resolution-types.js +2 -0
  320. package/dist/indexer/name-resolution-types.js.map +1 -0
  321. package/dist/indexer/name-resolution.d.ts +57 -0
  322. package/dist/indexer/name-resolution.d.ts.map +1 -0
  323. package/dist/indexer/name-resolution.js +204 -0
  324. package/dist/indexer/name-resolution.js.map +1 -0
  325. package/dist/indexer/navigation-cpp.d.ts +58 -0
  326. package/dist/indexer/navigation-cpp.d.ts.map +1 -0
  327. package/dist/indexer/navigation-cpp.js +935 -0
  328. package/dist/indexer/navigation-cpp.js.map +1 -0
  329. package/dist/indexer/navigation-goto.d.ts +115 -3
  330. package/dist/indexer/navigation-goto.d.ts.map +1 -1
  331. package/dist/indexer/navigation-goto.js +2469 -190
  332. package/dist/indexer/navigation-goto.js.map +1 -1
  333. package/dist/indexer/navigation-local.d.ts +21 -2
  334. package/dist/indexer/navigation-local.d.ts.map +1 -1
  335. package/dist/indexer/navigation-local.js +520 -63
  336. package/dist/indexer/navigation-local.js.map +1 -1
  337. package/dist/indexer/navigation-php.d.ts +66 -0
  338. package/dist/indexer/navigation-php.d.ts.map +1 -1
  339. package/dist/indexer/navigation-php.js +287 -4
  340. package/dist/indexer/navigation-php.js.map +1 -1
  341. package/dist/indexer/navigation-provenance.d.ts +1 -1
  342. package/dist/indexer/navigation-provenance.d.ts.map +1 -1
  343. package/dist/indexer/navigation-provenance.js +4 -13
  344. package/dist/indexer/navigation-provenance.js.map +1 -1
  345. package/dist/indexer/navigation-references.d.ts +73 -6
  346. package/dist/indexer/navigation-references.d.ts.map +1 -1
  347. package/dist/indexer/navigation-references.js +661 -67
  348. package/dist/indexer/navigation-references.js.map +1 -1
  349. package/dist/indexer/navigation-resolve.d.ts +46 -2
  350. package/dist/indexer/navigation-resolve.d.ts.map +1 -1
  351. package/dist/indexer/navigation-resolve.js +599 -193
  352. package/dist/indexer/navigation-resolve.js.map +1 -1
  353. package/dist/indexer/navigation.d.ts +29 -2
  354. package/dist/indexer/navigation.d.ts.map +1 -1
  355. package/dist/indexer/navigation.js +1092 -153
  356. package/dist/indexer/navigation.js.map +1 -1
  357. package/dist/indexer/parse-context.d.ts +2 -3
  358. package/dist/indexer/parse-context.d.ts.map +1 -1
  359. package/dist/indexer/parse-context.js +8 -21
  360. package/dist/indexer/parse-context.js.map +1 -1
  361. package/dist/indexer/php-namespace-symbols.d.ts +66 -0
  362. package/dist/indexer/php-namespace-symbols.d.ts.map +1 -0
  363. package/dist/indexer/php-namespace-symbols.js +342 -0
  364. package/dist/indexer/php-namespace-symbols.js.map +1 -0
  365. package/dist/indexer/reference-candidates.d.ts.map +1 -1
  366. package/dist/indexer/reference-candidates.js +13 -7
  367. package/dist/indexer/reference-candidates.js.map +1 -1
  368. package/dist/indexer/reference-context.d.ts +2 -0
  369. package/dist/indexer/reference-context.d.ts.map +1 -1
  370. package/dist/indexer/reference-context.js +4 -0
  371. package/dist/indexer/reference-context.js.map +1 -1
  372. package/dist/indexer/scope-nodes.d.ts +92 -13
  373. package/dist/indexer/scope-nodes.d.ts.map +1 -1
  374. package/dist/indexer/scope-nodes.js +212 -20
  375. package/dist/indexer/scope-nodes.js.map +1 -1
  376. package/dist/indexer/scope-types.d.ts +29 -1
  377. package/dist/indexer/scope-types.d.ts.map +1 -1
  378. package/dist/indexer/scope.d.ts +2 -3
  379. package/dist/indexer/scope.d.ts.map +1 -1
  380. package/dist/indexer/scope.js +968 -47
  381. package/dist/indexer/scope.js.map +1 -1
  382. package/dist/indexer/shared-owner-identity.d.ts +53 -0
  383. package/dist/indexer/shared-owner-identity.d.ts.map +1 -0
  384. package/dist/indexer/shared-owner-identity.js +460 -0
  385. package/dist/indexer/shared-owner-identity.js.map +1 -0
  386. package/dist/indexer/shared.d.ts +1 -1
  387. package/dist/indexer/shared.d.ts.map +1 -1
  388. package/dist/indexer/shared.js +1 -1
  389. package/dist/indexer/shared.js.map +1 -1
  390. package/dist/indexer/star-import-precedence.d.ts +113 -0
  391. package/dist/indexer/star-import-precedence.d.ts.map +1 -0
  392. package/dist/indexer/star-import-precedence.js +402 -0
  393. package/dist/indexer/star-import-precedence.js.map +1 -0
  394. package/dist/indexer/symbols.d.ts +3 -1
  395. package/dist/indexer/symbols.d.ts.map +1 -1
  396. package/dist/indexer/symbols.js +58 -18
  397. package/dist/indexer/symbols.js.map +1 -1
  398. package/dist/indexer/ts-callables.d.ts +42 -0
  399. package/dist/indexer/ts-callables.d.ts.map +1 -0
  400. package/dist/indexer/ts-callables.js +233 -0
  401. package/dist/indexer/ts-callables.js.map +1 -0
  402. package/dist/indexer/types.d.ts +41 -26
  403. package/dist/indexer/types.d.ts.map +1 -1
  404. package/dist/indexer/unused-exports.d.ts +13 -0
  405. package/dist/indexer/unused-exports.d.ts.map +1 -0
  406. package/dist/indexer/unused-exports.js +159 -0
  407. package/dist/indexer/unused-exports.js.map +1 -0
  408. package/dist/indexer/workspace-symbols.d.ts.map +1 -1
  409. package/dist/indexer/workspace-symbols.js +3 -2
  410. package/dist/indexer/workspace-symbols.js.map +1 -1
  411. package/dist/indexer.d.ts +3 -8
  412. package/dist/indexer.d.ts.map +1 -1
  413. package/dist/indexer.js +1 -1
  414. package/dist/indexer.js.map +1 -1
  415. package/dist/languages/callable-arity.d.ts +223 -0
  416. package/dist/languages/callable-arity.d.ts.map +1 -0
  417. package/dist/languages/callable-arity.js +1199 -0
  418. package/dist/languages/callable-arity.js.map +1 -0
  419. package/dist/languages/definitions/c-family.d.ts.map +1 -1
  420. package/dist/languages/definitions/c-family.js +30 -1
  421. package/dist/languages/definitions/c-family.js.map +1 -1
  422. package/dist/languages/definitions/c.d.ts +4 -0
  423. package/dist/languages/definitions/c.d.ts.map +1 -1
  424. package/dist/languages/definitions/c.js +19 -0
  425. package/dist/languages/definitions/c.js.map +1 -1
  426. package/dist/languages/definitions/cpp.d.ts.map +1 -1
  427. package/dist/languages/definitions/cpp.js +12 -0
  428. package/dist/languages/definitions/cpp.js.map +1 -1
  429. package/dist/languages/definitions/csharp.d.ts.map +1 -1
  430. package/dist/languages/definitions/csharp.js +2 -8
  431. package/dist/languages/definitions/csharp.js.map +1 -1
  432. package/dist/languages/definitions/go.d.ts.map +1 -1
  433. package/dist/languages/definitions/go.js +3 -0
  434. package/dist/languages/definitions/go.js.map +1 -1
  435. package/dist/languages/definitions/javascript.d.ts.map +1 -1
  436. package/dist/languages/definitions/javascript.js +10 -1
  437. package/dist/languages/definitions/javascript.js.map +1 -1
  438. package/dist/languages/definitions/js-family.d.ts +1 -1
  439. package/dist/languages/definitions/js-family.d.ts.map +1 -1
  440. package/dist/languages/definitions/js-family.js +7 -1
  441. package/dist/languages/definitions/js-family.js.map +1 -1
  442. package/dist/languages/definitions/php.d.ts.map +1 -1
  443. package/dist/languages/definitions/php.js +5 -1
  444. package/dist/languages/definitions/php.js.map +1 -1
  445. package/dist/languages/definitions/typescript.d.ts.map +1 -1
  446. package/dist/languages/definitions/typescript.js +8 -1
  447. package/dist/languages/definitions/typescript.js.map +1 -1
  448. package/dist/languages/definitions/zig.d.ts.map +1 -1
  449. package/dist/languages/definitions/zig.js +8 -0
  450. package/dist/languages/definitions/zig.js.map +1 -1
  451. package/dist/lifecycle/manifest.d.ts.map +1 -1
  452. package/dist/lifecycle/manifest.js +0 -1
  453. package/dist/lifecycle/manifest.js.map +1 -1
  454. package/dist/mcp/handlers.js +14 -7
  455. package/dist/mcp/handlers.js.map +1 -1
  456. package/dist/native/byte-index.d.ts +6 -0
  457. package/dist/native/byte-index.d.ts.map +1 -1
  458. package/dist/native/byte-index.js +11 -6
  459. package/dist/native/byte-index.js.map +1 -1
  460. package/dist/native/contracts.d.ts +2 -3
  461. package/dist/native/contracts.d.ts.map +1 -1
  462. package/dist/native/execution.d.ts +9 -9
  463. package/dist/native/execution.d.ts.map +1 -1
  464. package/dist/native/execution.js +37 -77
  465. package/dist/native/execution.js.map +1 -1
  466. package/dist/native/js-bridge.d.ts +2 -15
  467. package/dist/native/js-bridge.d.ts.map +1 -1
  468. package/dist/native/js-bridge.js +2 -15
  469. package/dist/native/js-bridge.js.map +1 -1
  470. package/dist/native/query-results.js +2 -2
  471. package/dist/native/query-results.js.map +1 -1
  472. package/dist/native/runtime.d.ts +12 -12
  473. package/dist/native/runtime.d.ts.map +1 -1
  474. package/dist/native/runtime.js +24 -69
  475. package/dist/native/runtime.js.map +1 -1
  476. package/dist/native/tree-sitter-native.d.ts +3 -3
  477. package/dist/native/tree-sitter-native.d.ts.map +1 -1
  478. package/dist/native/tree-sitter-native.js +2 -2
  479. package/dist/native/tree-sitter-native.js.map +1 -1
  480. package/dist/presets.d.ts.map +1 -1
  481. package/dist/presets.js +0 -4
  482. package/dist/presets.js.map +1 -1
  483. package/dist/review/candidates.d.ts.map +1 -1
  484. package/dist/review/candidates.js +1 -1
  485. package/dist/review/candidates.js.map +1 -1
  486. package/dist/review/deleted.d.ts +3 -3
  487. package/dist/review/deleted.d.ts.map +1 -1
  488. package/dist/review/deleted.js +82 -32
  489. package/dist/review/deleted.js.map +1 -1
  490. package/dist/review/report.d.ts +1 -0
  491. package/dist/review/report.d.ts.map +1 -1
  492. package/dist/review/report.js +1 -1
  493. package/dist/review/report.js.map +1 -1
  494. package/dist/review.d.ts.map +1 -1
  495. package/dist/review.js +3 -20
  496. package/dist/review.js.map +1 -1
  497. package/dist/session.d.ts.map +1 -1
  498. package/dist/session.js +0 -5
  499. package/dist/session.js.map +1 -1
  500. package/dist/sql/navigation.d.ts.map +1 -1
  501. package/dist/sql/navigation.js +2 -1
  502. package/dist/sql/navigation.js.map +1 -1
  503. package/dist/sql/source-graph.d.ts.map +1 -1
  504. package/dist/sql/source-graph.js +2 -2
  505. package/dist/sql/source-graph.js.map +1 -1
  506. package/dist/sqlite/schema.d.ts +1 -1
  507. package/dist/sqlite/schema.d.ts.map +1 -1
  508. package/dist/sqlite/schema.js +8 -2
  509. package/dist/sqlite/schema.js.map +1 -1
  510. package/dist/sqlite/write.js +2 -2
  511. package/dist/sqlite/write.js.map +1 -1
  512. package/dist/types.d.ts +2 -0
  513. package/dist/types.d.ts.map +1 -1
  514. package/dist/util/bloom-filter.d.ts +8 -1
  515. package/dist/util/bloom-filter.d.ts.map +1 -1
  516. package/dist/util/bloom-filter.js +15 -2
  517. package/dist/util/bloom-filter.js.map +1 -1
  518. package/dist/util/glob.d.ts +32 -0
  519. package/dist/util/glob.d.ts.map +1 -0
  520. package/dist/util/glob.js +137 -0
  521. package/dist/util/glob.js.map +1 -0
  522. package/dist/util/graph-edges.d.ts +19 -1
  523. package/dist/util/graph-edges.d.ts.map +1 -1
  524. package/dist/util/graph-edges.js +30 -4
  525. package/dist/util/graph-edges.js.map +1 -1
  526. package/dist/util/identifiers.d.ts +15 -0
  527. package/dist/util/identifiers.d.ts.map +1 -1
  528. package/dist/util/identifiers.js +35 -0
  529. package/dist/util/identifiers.js.map +1 -1
  530. package/dist/util/member-access-tables.d.ts +61 -4
  531. package/dist/util/member-access-tables.d.ts.map +1 -1
  532. package/dist/util/member-access-tables.js +139 -19
  533. package/dist/util/member-access-tables.js.map +1 -1
  534. package/dist/util/member-access.d.ts +17 -0
  535. package/dist/util/member-access.d.ts.map +1 -1
  536. package/dist/util/member-access.js +98 -3
  537. package/dist/util/member-access.js.map +1 -1
  538. package/dist/util/project-files.d.ts +2 -10
  539. package/dist/util/project-files.d.ts.map +1 -1
  540. package/dist/util/project-files.js +29 -51
  541. package/dist/util/project-files.js.map +1 -1
  542. package/dist/util/python-type-checking.d.ts +18 -0
  543. package/dist/util/python-type-checking.d.ts.map +1 -0
  544. package/dist/util/python-type-checking.js +160 -0
  545. package/dist/util/python-type-checking.js.map +1 -0
  546. package/dist/util/resolution/cargo-targets.d.ts +11 -0
  547. package/dist/util/resolution/cargo-targets.d.ts.map +1 -1
  548. package/dist/util/resolution/cargo-targets.js +174 -13
  549. package/dist/util/resolution/cargo-targets.js.map +1 -1
  550. package/dist/util/resolution/csharp.d.ts +33 -1
  551. package/dist/util/resolution/csharp.d.ts.map +1 -1
  552. package/dist/util/resolution/csharp.js +145 -30
  553. package/dist/util/resolution/csharp.js.map +1 -1
  554. package/dist/util/resolution/jvm.d.ts +7 -3
  555. package/dist/util/resolution/jvm.d.ts.map +1 -1
  556. package/dist/util/resolution/jvm.js +56 -38
  557. package/dist/util/resolution/jvm.js.map +1 -1
  558. package/dist/util/resolution/php.d.ts.map +1 -1
  559. package/dist/util/resolution/php.js +35 -8
  560. package/dist/util/resolution/php.js.map +1 -1
  561. package/dist/util/resolution/python.d.ts +9 -0
  562. package/dist/util/resolution/python.d.ts.map +1 -1
  563. package/dist/util/resolution/python.js +46 -0
  564. package/dist/util/resolution/python.js.map +1 -1
  565. package/dist/util/resolution/rust.d.ts +0 -1
  566. package/dist/util/resolution/rust.d.ts.map +1 -1
  567. package/dist/util/resolution/rust.js +95 -35
  568. package/dist/util/resolution/rust.js.map +1 -1
  569. package/dist/util/resolution/specifier-targets.d.ts +44 -0
  570. package/dist/util/resolution/specifier-targets.d.ts.map +1 -0
  571. package/dist/util/resolution/specifier-targets.js +152 -0
  572. package/dist/util/resolution/specifier-targets.js.map +1 -0
  573. package/dist/util/resolution-candidates.d.ts +5 -0
  574. package/dist/util/resolution-candidates.d.ts.map +1 -1
  575. package/dist/util/resolution-candidates.js +16 -3
  576. package/dist/util/resolution-candidates.js.map +1 -1
  577. package/dist/util/resolution.d.ts +2 -1
  578. package/dist/util/resolution.d.ts.map +1 -1
  579. package/dist/util/resolution.js +101 -15
  580. package/dist/util/resolution.js.map +1 -1
  581. package/dist/util/specifiers.d.ts +29 -1
  582. package/dist/util/specifiers.d.ts.map +1 -1
  583. package/dist/util/specifiers.js +56 -8
  584. package/dist/util/specifiers.js.map +1 -1
  585. package/dist/util/trivia.d.ts.map +1 -1
  586. package/dist/util/trivia.js +49 -30
  587. package/dist/util/trivia.js.map +1 -1
  588. package/dist/util/workspace.d.ts.map +1 -1
  589. package/dist/util/workspace.js +32 -4
  590. package/dist/util/workspace.js.map +1 -1
  591. package/docs/mcp.md +3 -2
  592. package/package.json +5 -7
  593. package/dist/impact/call-compatibility/providers/profiles.d.ts +0 -80
  594. package/dist/impact/call-compatibility/providers/profiles.d.ts.map +0 -1
  595. package/dist/impact/call-compatibility/providers/profiles.js +0 -164
  596. package/dist/impact/call-compatibility/providers/profiles.js.map +0 -1
@@ -4,12 +4,16 @@ import fsp from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { performance } from "node:perf_hooks";
6
6
  import { languageExtensionPatterns, supportForFile, supportForFileWithoutHeaderSample, } from "../languages.js";
7
+ import { DECLARATION_RESOLVED_IMPORT_LANGUAGES } from "./import-resolution-tables.js";
7
8
  import { isJsTsLanguage } from "../languages/js-family.js";
8
9
  import { loadWorkspaceConfig, resolveWorkspacePackage } from "../util/workspace.js";
9
10
  import { DEFAULT_PROJECT_PATTERNS, createProjectDiscoveryContext, discoverProjectFilesWithGitCandidates, listProjectFilesWithGitCandidates, } from "../util/project-files.js";
10
11
  import { getGitHead, isGitRepo, getGitBlobHashes, listChangedFiles } from "../util/git.js";
11
12
  import { clearResolutionCaches, loadNearestTsconfigFor, resolveSpecifier, } from "../util/resolution.js";
12
- import { collectCppDeclaredModules } from "../util/resolution/cpp.js";
13
+ import { collectCppDeclaredModules, isCppNamedModuleSpecifier } from "../util/resolution/cpp.js";
14
+ import { resolveJvmPackageImportPaths } from "../util/resolution/jvm.js";
15
+ import { loadTsconfigResolutionInputsFor } from "../util/resolution/tsconfig.js";
16
+ import { resolveModuleSpecifierEdges } from "../graphs/edge-resolution.js";
13
17
  import { fileIdentityKey, initializeFileIdentityCaseSensitivity, isFilePathWithinRoot, normalizePath, } from "../util/paths.js";
14
18
  import { mapLimit } from "../util/concurrency.js";
15
19
  import { readConfinedUtf8File } from "../util/confined-file.js";
@@ -28,9 +32,9 @@ import { compareEdges, edgeKey, toRelativeEdge } from "./shared.js";
28
32
  import { BloomFilter, buildBloomFilterFromSource } from "../util/bloom-filter.js";
29
33
  import { initNativeBackendReport } from "../native/native-backend-report.js";
30
34
  import { closeDuplicateUnitCacheDatabase } from "../duplicates.js";
31
- import { isNativeRequiredUnavailableError } from "../native/tree-sitter-native.js";
35
+ import { assertNativeRequiredAvailable, isNativeRequiredUnavailableError } from "../native/tree-sitter-native.js";
32
36
  import { isNodeSqliteUnavailableError } from "../sqlite-driver.js";
33
- import { buildBloomFilterForFile, cacheSignatureForFile, closeDiskCacheDatabase, diskModuleCacheExists, collectWorkspaceManifestDependencyEdges, computeConfigHash, createFallbackImportExtractionHandler, diffBuildOptions, fileSignature, fileSignatureFromSource, graphOptionsEqual, initFileReport, initManifestReport, loadManifest, normalizeGraphOptions, normalizeIndexedFileInputs, normalizeIndexedFileInputsWithinRoot, normalizeLanguageExtensions, projectSnapshotFilesSignature, recordConfigHashResult, recordFileFailure, sanitizeManifestEntriesForRoot, sanitizeManifestTransientFilesForRoot, tryLoadFromCache, tryLoadPersistedBloomFilters, tryLoadProjectIndexSnapshot, tryLoadProjectSnapshotModules, verifyManifestEntries, writeModulesToCache, writeProjectIndexSnapshot, } from "./build-cache.js";
37
+ import { buildBloomFilterForFile, cacheSignatureForFile, closeDiskCacheDatabase, diskModuleCacheExists, collectWorkspaceManifestDependencyEdges, computeConfigHash, diffBuildOptions, fileSignature, fileSignatureFromSource, graphOptionsEqual, initFileReport, initManifestReport, loadManifest, normalizeGraphOptions, normalizeIndexedFileInputs, normalizeIndexedFileInputsWithinRoot, normalizeLanguageExtensions, projectSnapshotFilesSignature, recordConfigHashResult, recordFileFailure, sanitizeManifestEntriesForRoot, sanitizeManifestTransientFilesForRoot, listDiskCachedModuleFiles, listMemoryCachedModuleFiles, loadModuleFromCache, memoryCacheEvictionSerial, memoryCacheLostPayloads, peekCachedModule, removeModulesFromCache, settleMemoryCacheEvictions, tryLoadFromCache, tryLoadPersistedBloomFilters, tryLoadProjectIndexSnapshot, tryLoadProjectSnapshotModules, verifyManifestEntries, writeModulesToCache, writeProjectIndexSnapshot, } from "./build-cache.js";
34
38
  import { computeResolverEnvironmentFingerprint } from "./build-cache/resolver-environment.js";
35
39
  import { cacheRoot } from "./build-cache/location.js";
36
40
  import { SymbolKind, } from "./types.js";
@@ -39,7 +43,7 @@ import { buildSqlFactCache, buildSqlModuleIndex, sqlCorpusSignature } from "../s
39
43
  import { finalizeProjectIndex } from "./finalize.js";
40
44
  import { toManifestFileEntry, writeIndexManifestSnapshot } from "./build-manifest.js";
41
45
  import { prepareFileContextForBuild, countNativeWorkerEligibleFiles, emptyWorkerPoolSetup, setupWorkerPool, teardownWorkerPool, } from "./build-workers.js";
42
- import { buildIncrementalGitDiffOptions, canUseIncrementalDiscoveryFastPath, buildTrackedFileReverseDependencies, collectDeletedTrackedFileDependents, collectTrackedFileDependents, isMissingGitRevisionError, listUntrackedProjectFiles, partitionTrackedManifestFiles, probePathExistence, } from "./incremental-plan.js";
46
+ import { buildIncrementalGitDiffOptions, canUseIncrementalDiscoveryFastPath, buildTrackedFileReverseDependencies, addedResolutionStems, collectDeletedTrackedFileDependents, collectTrackedFileDependents, collectSpecifierEdgeCandidates, collectPythonPackageImporters, pythonImportersOfPackageInits, externalSpecifierMatchesAddedStem, tsconfigAliasMappedTails, isMissingGitRevisionError, listUntrackedProjectFiles, partitionTrackedManifestFiles, probePathExistence, } from "./incremental-plan.js";
43
47
  import { parsedCacheMaxEntries, setParsedCacheEntry } from "./parsed-cache.js";
44
48
  function initParserBackendDegradationReport(report) {
45
49
  if (!report)
@@ -147,6 +151,114 @@ function manifestDeclaredContainerIndex(manifest) {
147
151
  return new Map();
148
152
  return new Map(Object.entries(entries));
149
153
  }
154
+ /**
155
+ * Declared C++ modules of added or changed files. The cache cannot supply them.
156
+ * A regex over the source finds them without a parse.
157
+ * Without them, a second file that declares an existing module name goes unnoticed,
158
+ * and the importer keeps its old target.
159
+ */
160
+ async function collectCppMissDeclaredContainers(files, concurrency, confined) {
161
+ const byName = new Map();
162
+ await mapLimit([...files], concurrency, async (file) => {
163
+ let source = confined?.trustedSources?.get(file);
164
+ if (source === undefined) {
165
+ try {
166
+ source =
167
+ confined?.confinedRoot && confined?.projectRoot
168
+ ? await readConfinedUtf8File(confined.confinedRoot, confined.projectRoot, file)
169
+ : await fsp.readFile(file, "utf8");
170
+ }
171
+ catch {
172
+ return;
173
+ }
174
+ }
175
+ for (const name of collectCppDeclaredModules(source)) {
176
+ let bucket = byName.get(name);
177
+ if (!bucket)
178
+ byName.set(name, (bucket = new Set()));
179
+ bucket.add(normalizePath(file));
180
+ }
181
+ });
182
+ const index = new Map();
183
+ for (const [name, declaringFiles] of byName) {
184
+ index.set(name, [...declaringFiles].sort((left, right) => left.localeCompare(right)));
185
+ }
186
+ return index;
187
+ }
188
+ /** Declared C++ modules in the previous rows of changed files, as module name to declaring files. */
189
+ function previousCppDeclaredContainers(previousModules) {
190
+ const byName = new Map();
191
+ for (const [file, mod] of previousModules)
192
+ mergeDeclaredContainers(byName, file, mod.declaredContainers);
193
+ return byName;
194
+ }
195
+ /** Fold one file's declared containers into name-to-declaring-files buckets. */
196
+ function mergeDeclaredContainers(byName, file, declared) {
197
+ if (!declared || !declared.length)
198
+ return;
199
+ const normalized = normalizePath(file);
200
+ for (const name of declared) {
201
+ let bucket = byName.get(name);
202
+ if (!bucket)
203
+ byName.set(name, (bucket = new Set()));
204
+ bucket.add(normalized);
205
+ }
206
+ }
207
+ /** Sort name-to-declaring-files buckets into the shape declaredContainerNamesChanged compares. */
208
+ function sortedDeclaredContainerIndex(byName) {
209
+ const index = new Map();
210
+ for (const [name, files] of byName) {
211
+ index.set(name, [...files].sort((left, right) => left.localeCompare(right)));
212
+ }
213
+ return index;
214
+ }
215
+ /** Whether a cached module has an import binding the previous build left unresolved. */
216
+ function cachedModuleHasExternalImport(mod) {
217
+ return mod.imports.some((binding) => typeof binding.resolved !== "string");
218
+ }
219
+ /**
220
+ * Declaration-language files that have a cached row, are not in the build, and no longer exist.
221
+ * A deleted file leaves no cache miss, so importers that it satisfied would stay stale.
222
+ * The existence probe separates deleted files from files outside the build scope.
223
+ * The manifest path does not need this: the manifest lists the previous files.
224
+ */
225
+ async function collectNoManifestDeletedDeclarationFiles(args) {
226
+ const live = new Set(args.files.map(fileIdentityKey));
227
+ const rows = new Map();
228
+ for (const file of listMemoryCachedModuleFiles(args.projectRoot))
229
+ rows.set(fileIdentityKey(file), file);
230
+ if ((args.opts?.cache ?? "off") === "disk") {
231
+ const diskFiles = listDiskCachedModuleFiles(args.projectRoot, args.opts);
232
+ if (diskFiles) {
233
+ for (const relative of diskFiles) {
234
+ const file = normalizePath(path.resolve(args.projectRoot, relative));
235
+ // A cache row is persisted data. Ignore a row that names a path outside the project.
236
+ if (!isFilePathWithinRoot(args.projectRoot, file))
237
+ continue;
238
+ if (!rows.has(fileIdentityKey(file)))
239
+ rows.set(fileIdentityKey(file), file);
240
+ }
241
+ }
242
+ }
243
+ const candidates = [];
244
+ for (const [key, file] of rows) {
245
+ if (live.has(key))
246
+ continue;
247
+ const languageId = supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id;
248
+ if (languageId && DECLARATION_RESOLVED_IMPORT_LANGUAGES.has(languageId))
249
+ candidates.push({ file, languageId });
250
+ }
251
+ if (!candidates.length)
252
+ return [];
253
+ const existence = await probePathExistence(candidates.map((candidate) => candidate.file), args.concurrency);
254
+ return candidates
255
+ .filter((candidate) => !existence.get(candidate.file))
256
+ .map((candidate) => ({
257
+ file: candidate.file,
258
+ languageId: candidate.languageId,
259
+ mod: peekCachedModule(args.projectRoot, candidate.file, args.opts)?.mod ?? null,
260
+ }));
261
+ }
150
262
  async function resolveCrossModuleSymbolExports(file, mod, support, projectRoot, graphOptions, workspaceConfig, matchPath) {
151
263
  if (!support.supportsCrossModuleSymbols || !isJsTsLanguage(support.id))
152
264
  return;
@@ -176,7 +288,7 @@ async function buildIndexedModuleForFile(args) {
176
288
  const prepared = await prepareFileContextForBuild(args.file, args.support, args.opts, args.workerSetup, args.report, args.confinedRoot, args.projectRoot, args.trustedSource, !!args.bloomFilterCache);
177
289
  const { source, sup, nativeQueries, embeddedBlocks } = prepared;
178
290
  let tree;
179
- const graphOnlyLanguage = isGraphOnlyLanguage(sup.id), nativeSourceLimitFallback = prepared.nativeFallbackReason === "sourceTooLarge";
291
+ const graphOnlyLanguage = isGraphOnlyLanguage(sup.id), nativeSourceLimitSkip = prepared.nativeFallbackReason === "sourceTooLarge";
180
292
  if (prepared.syntaxTree) {
181
293
  const parsedTree = new ProjectedSyntaxTree(source, prepared.syntaxTree);
182
294
  tree = parsedTree;
@@ -188,7 +300,7 @@ async function buildIndexedModuleForFile(args) {
188
300
  nativeQueries,
189
301
  }, args.parsedCacheMaxEntries);
190
302
  }
191
- else if (!nativeQueries && !graphOnlyLanguage && sup.id !== "sql" && !nativeSourceLimitFallback) {
303
+ else if (!nativeQueries && !graphOnlyLanguage && sup.id !== "sql" && !nativeSourceLimitSkip) {
192
304
  const parseAttempt = attemptParsePreparedFileContext(prepared);
193
305
  const parsed = parseAttempt.parsed;
194
306
  if (parsed) {
@@ -206,7 +318,7 @@ async function buildIndexedModuleForFile(args) {
206
318
  }
207
319
  }
208
320
  else if (nativeQueries && !graphOnlyLanguage && sup.id !== "sql") {
209
- // Worker returned queries without a tree (older path/fallback): reconstruct once.
321
+ // A native query without a transferred tree can still use the native syntax tree.
210
322
  const parseAttempt = attemptParsePreparedFileContext(prepared);
211
323
  const parsed = parseAttempt.parsed;
212
324
  if (parsed) {
@@ -214,8 +326,8 @@ async function buildIndexedModuleForFile(args) {
214
326
  setParsedCacheEntry(args.parsedMap, args.file, parsed, args.parsedCacheMaxEntries);
215
327
  }
216
328
  }
217
- const lacksParserContext = !nativeQueries && !tree;
218
- if (args.bloomFilterCache && !nativeSourceLimitFallback) {
329
+ const lacksParserContext = !graphOnlyLanguage && !nativeQueries;
330
+ if (args.bloomFilterCache && !nativeSourceLimitSkip) {
219
331
  const filter = prepared.workerBloomFilter
220
332
  ? BloomFilter.fromBuffer(Buffer.from(prepared.workerBloomFilter.bits), prepared.workerBloomFilter.size, prepared.workerBloomFilter.hashCount, prepared.workerBloomFilter.itemCount)
221
333
  : buildBloomFilterFromSource(source, sup);
@@ -227,12 +339,11 @@ async function buildIndexedModuleForFile(args) {
227
339
  graphOptions: args.graphOptions,
228
340
  ...(args.workspaceConfig ? { workspaceConfig: args.workspaceConfig } : {}),
229
341
  ...(args.matchPath ? { matchPath: args.matchPath } : {}),
230
- ...(args.opts?.native ? { native: args.opts.native } : {}),
231
342
  ...(args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {}),
232
343
  ...(args.opts?.languageExtensions ? { languageExtensions: args.opts.languageExtensions } : {}),
233
- ...(args.onFallbackImportExtraction ? { onFallbackImportExtraction: args.onFallbackImportExtraction } : {}),
344
+ ...(args.report ? { report: args.report } : {}),
234
345
  };
235
- const imports = nativeSourceLimitFallback || sup.id === "sql"
346
+ const imports = nativeSourceLimitSkip || sup.id === "sql"
236
347
  ? []
237
348
  : await collectImportsForFile(args.file, args.projectRoot, {
238
349
  source,
@@ -240,12 +351,14 @@ async function buildIndexedModuleForFile(args) {
240
351
  ...(nativeQueries !== undefined ? { nativeQueries } : {}),
241
352
  ...sharedImportOptions,
242
353
  });
243
- for (const block of embeddedBlocks ?? []) {
244
- imports.push(...(await collectImportsForFile(args.file, args.projectRoot, {
245
- source: block.source,
246
- sup: block.sup,
247
- ...sharedImportOptions,
248
- })));
354
+ if (!nativeSourceLimitSkip) {
355
+ for (const block of embeddedBlocks ?? []) {
356
+ imports.push(...(await collectImportsForFile(args.file, args.projectRoot, {
357
+ source: block.source,
358
+ sup: block.sup,
359
+ ...sharedImportOptions,
360
+ })));
361
+ }
249
362
  }
250
363
  collectJsonDependencies(imports, args.jsonDependencies);
251
364
  let mod;
@@ -259,7 +372,6 @@ async function buildIndexedModuleForFile(args) {
259
372
  mod = collectLocalsAndExportsFromSource(args.file, source, sup, imports, {
260
373
  ...(tree ? { tree } : {}),
261
374
  ...(nativeQueries !== undefined ? { nativeQueries } : {}),
262
- ...(args.opts?.native ? { nativeMode: args.opts.native } : {}),
263
375
  ...(args.opts?.logLevel ? { logLevel: args.opts.logLevel } : {}),
264
376
  });
265
377
  }
@@ -324,12 +436,105 @@ function ensureJsonModule(modules, filePath) {
324
436
  });
325
437
  }
326
438
  function graphEdgeKey(edge) {
327
- const from = fileIdentityKey(edge.from);
328
- const target = edge.to.type === "file" ? `file:${fileIdentityKey(edge.to.path)}` : `external:${edge.to.name}`;
329
- return `${from}::${target}::${edge.raw ?? ""}::${edge.typeOnly ? 1 : 0}`;
439
+ return edgeKey(edge, true, fileIdentityKey);
440
+ }
441
+ function externalEdgeTargetKey(to) {
442
+ return to.type === "file" ? `file:${fileIdentityKey(to.path)}` : `external:${to.name}`;
443
+ }
444
+ const PRECISE_SPECIFIER_RESOLUTION_LANGUAGES = {
445
+ c: true,
446
+ cpp: true,
447
+ js: true,
448
+ jsx: true,
449
+ python: true,
450
+ ts: true,
451
+ tsx: true,
452
+ };
453
+ async function specifierResolutionChanged(file, entry, projectRoot, workspaceConfig, graphOptions, languageExtensions, loadMatchPath, addedFiles, addedStemsForLanguage, loadTsconfigPaths) {
454
+ const support = supportForFileWithoutHeaderSample(file, languageExtensions);
455
+ if (!support)
456
+ return false;
457
+ // Declaration languages re-resolve through the extension rule in externalSpecifierMatchesAddedStem,
458
+ // so no filename stems are needed here.
459
+ const addedStems = addedStemsForLanguage(support.id);
460
+ const addedFileLanguageId = (file) => supportForFileWithoutHeaderSample(file, languageExtensions)?.id;
461
+ const specifierEdges = entry.edges;
462
+ if (!specifierEdges.length)
463
+ return false;
464
+ const specifierOf = (edge) => (edge.to.type === "external" ? edge.raw || edge.to.name : edge.raw);
465
+ const matching = [];
466
+ const needsAlias = [];
467
+ for (const edge of specifierEdges) {
468
+ const specifier = specifierOf(edge);
469
+ if (externalSpecifierMatchesAddedStem(specifier, support.id, addedStems, [], addedFiles, addedFileLanguageId)) {
470
+ matching.push(edge);
471
+ continue;
472
+ }
473
+ const relative = specifier.startsWith(".") || specifier.startsWith("/") || /^[A-Za-z]:[\\/]/.test(specifier);
474
+ if ((support.id === "ts" || support.id === "tsx") && specifier && !relative)
475
+ needsAlias.push(edge);
476
+ }
477
+ if (needsAlias.length) {
478
+ const paths = await loadTsconfigPaths(file);
479
+ if (paths && Object.keys(paths).length) {
480
+ for (const edge of needsAlias) {
481
+ const mapped = tsconfigAliasMappedTails(specifierOf(edge), paths);
482
+ if (mapped.length &&
483
+ externalSpecifierMatchesAddedStem(specifierOf(edge), support.id, addedStems, mapped, addedFiles, addedFileLanguageId)) {
484
+ matching.push(edge);
485
+ }
486
+ }
487
+ }
488
+ }
489
+ if (!matching.length)
490
+ return false;
491
+ // Stylesheet, document, and other unstored per-occurrence inputs cannot be
492
+ // re-resolved from the edge. The caller only reaches this on an add.
493
+ if (!PRECISE_SPECIFIER_RESOLUTION_LANGUAGES[support.id])
494
+ return true;
495
+ if ((support.id === "c" || support.id === "cpp") &&
496
+ matching.some((edge) => edge.includeForm === undefined && !isCppNamedModuleSpecifier(edge.raw))) {
497
+ return true;
498
+ }
499
+ const matchPath = support.id === "ts" || support.id === "tsx" ? await loadMatchPath(file) : undefined;
500
+ const groups = new Map();
501
+ for (const edge of matching) {
502
+ const key = `${edge.raw}\0${edge.includeForm ?? ""}\0${edge.typeOnly ? 1 : 0}`;
503
+ const group = groups.get(key);
504
+ if (group)
505
+ group.push(edge);
506
+ else
507
+ groups.set(key, [edge]);
508
+ }
509
+ for (const group of groups.values()) {
510
+ const sample = group[0];
511
+ const resolved = await resolveModuleSpecifierEdges({
512
+ spec: sample.raw,
513
+ ...(sample.typeOnly ? { typeOnly: true } : {}),
514
+ ...(sample.includeForm ? { includeForm: sample.includeForm } : {}),
515
+ }, {
516
+ support,
517
+ file,
518
+ projectRoot,
519
+ workspaceConfig,
520
+ matchPath,
521
+ resolveNodeModules: !!graphOptions.resolveNodeModules,
522
+ ...(graphOptions.resolutionHints ? { resolutionHints: graphOptions.resolutionHints } : {}),
523
+ ...(languageExtensions ? { languageExtensions } : {}),
524
+ });
525
+ const resolvedKeys = (resolved ?? []).map((item) => externalEdgeTargetKey(item.to)).sort();
526
+ const cachedKeys = group.map((edge) => externalEdgeTargetKey(edge.to)).sort();
527
+ if (resolvedKeys.length !== cachedKeys.length)
528
+ return true;
529
+ for (let index = 0; index < resolvedKeys.length; index += 1) {
530
+ if (resolvedKeys[index] !== cachedKeys[index])
531
+ return true;
532
+ }
533
+ }
534
+ return false;
330
535
  }
331
536
  async function moduleCacheSignatureForFile(file, sigInfo, opts, resolverEnvironmentFingerprint) {
332
- const baseSignature = await cacheSignatureForFile(file, sigInfo, opts);
537
+ const baseSignature = await cacheSignatureForFile(file, sigInfo);
333
538
  const normalizedExtensions = normalizeLanguageExtensions(opts?.languageExtensions);
334
539
  const normalizedGraphOptions = normalizeGraphOptions(opts?.graph);
335
540
  const resolveNodeModules = normalizedGraphOptions.resolveNodeModules;
@@ -393,7 +598,6 @@ function createIndexBuildRunState(projectRoot, opts, graphOptions = normalizeGra
393
598
  cacheMode,
394
599
  cacheEnabled: cacheMode !== "off",
395
600
  graphOptions,
396
- onFallbackImportExtraction: createFallbackImportExtractionHandler(report, opts),
397
601
  };
398
602
  }
399
603
  function emitIndexLifecycleProgress(opts, phase, mode, total, elapsedMs) {
@@ -551,10 +755,302 @@ async function prepareFileSignatures(args) {
551
755
  async function buildProjectIndexFromExport(projectRoot, opts, helperOpts) {
552
756
  return buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpts);
553
757
  }
758
+ /**
759
+ * Cached modules to extract again because something they depend on changed.
760
+ * A cached module is keyed by its own content, but its import bindings depend on other files.
761
+ * A module is stale when:
762
+ * - it changed;
763
+ * - an import or re-export target no longer exists;
764
+ * - an added file can satisfy one of its specifiers;
765
+ * - it resolves imports through namespace or package declarations, and a file it depends on changed.
766
+ *
767
+ * With a manifest, the manifest gives the previous files and edges.
768
+ * Without one (a memory cache, or a disk cache that no manifest-writing build has seen),
769
+ * the cached import bindings replace the edges.
770
+ */
771
+ async function collectStaleCachedModules(args) {
772
+ const { cachedModules, manifestFiles } = args;
773
+ if (!cachedModules.size)
774
+ return { stale: new Set(), deletedDeclarationFiles: [] };
775
+ const stale = await cachedModulesWithMissingTargets(cachedModules, args.concurrency);
776
+ const resolvesFromDeclarations = (file) => DECLARATION_RESOLVED_IMPORT_LANGUAGES.has(supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id ?? "");
777
+ const loadTsconfigPaths = (importer) => loadTsconfigResolutionInputsFor(importer, args.projectRoot, args.opts?.logLevel).then((inputs) => inputs?.paths);
778
+ // Deleted declaration files. Only the no-manifest path fills this list.
779
+ // The manifest path retires deletions when it rewrites the manifest.
780
+ const deletedDeclarationFiles = [];
781
+ if (manifestFiles) {
782
+ const currentKeys = new Set(args.files.map(fileIdentityKey));
783
+ // A cache miss proves a change, even when a non-strict manifest signature (mtime:size) matches.
784
+ const changed = new Set(args.cacheMisses.changed);
785
+ const added = [];
786
+ for (const file of args.files) {
787
+ const entry = manifestFiles[file];
788
+ if (!entry)
789
+ added.push(file);
790
+ const sigInfo = args.signatures.get(file);
791
+ if (!sigInfo)
792
+ continue;
793
+ const matchesGitSig = !!entry?.gitSig && !!sigInfo.gitSig && entry.gitSig === sigInfo.gitSig;
794
+ if (!entry || !(matchesGitSig || entry.sig === sigInfo.sig))
795
+ changed.add(file);
796
+ }
797
+ // Cache hits do not hold the declarations of added or changed files.
798
+ // Add the C++ module declarations of those files before the comparison.
799
+ // Otherwise a second file that declares an existing module name changes nothing,
800
+ // and the importer keeps its old target.
801
+ const nextDeclaredContainers = declaredContainerIndexFromModules([...cachedModules.values()].map((cached) => cached.mod));
802
+ const cppMisses = [...new Set([...added, ...changed])].filter((file) => supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id === "cpp");
803
+ if (cppMisses.length) {
804
+ const missDeclaredContainers = await collectCppMissDeclaredContainers(cppMisses, args.concurrency, {
805
+ ...(args.confinedRoot ? { confinedRoot: args.confinedRoot, projectRoot: args.projectRoot } : {}),
806
+ ...(args.trustedSources ? { trustedSources: args.trustedSources } : {}),
807
+ });
808
+ for (const [name, declaringFiles] of missDeclaredContainers) {
809
+ const merged = new Set([...(nextDeclaredContainers.get(name) ?? []), ...declaringFiles]);
810
+ nextDeclaredContainers.set(name, [...merged].sort((left, right) => left.localeCompare(right)));
811
+ }
812
+ }
813
+ const declaredContainerConsumers = collectDeclaredContainerConsumers(manifestFiles, declaredContainerNamesChanged(manifestDeclaredContainerIndex(args.manifest), nextDeclaredContainers));
814
+ const missingFromBuild = Object.keys(manifestFiles).filter((file) => !currentKeys.has(fileIdentityKey(file)));
815
+ const existence = await probePathExistence(missingFromBuild, args.concurrency);
816
+ const deleted = new Set(missingFromBuild.filter((file) => !existence.get(file)));
817
+ for (const file of [
818
+ ...changed,
819
+ ...collectDeletedTrackedFileDependents(manifestFiles, deleted),
820
+ ...declaredContainerConsumers,
821
+ ]) {
822
+ stale.add(file);
823
+ }
824
+ for (const file of collectTrackedFileDependents(manifestFiles, changed)) {
825
+ if (resolvesFromDeclarations(file))
826
+ stale.add(file);
827
+ }
828
+ // A changed or deleted declaration-language file can change which files declare a namespace
829
+ // or package that an importer names. A deleted duplicate can resolve an ambiguous import.
830
+ // Treat these files like added files.
831
+ const resolutionInputs = [...added, ...[...changed, ...deleted].filter((file) => resolvesFromDeclarations(file))];
832
+ if (resolutionInputs.length) {
833
+ const stemsByLanguage = new Map();
834
+ const addedStemsForLanguage = (languageId) => {
835
+ let stems = stemsByLanguage.get(languageId);
836
+ if (!stems)
837
+ stemsByLanguage.set(languageId, (stems = addedResolutionStems(resolutionInputs, languageId)));
838
+ return stems;
839
+ };
840
+ const candidates = [...collectSpecifierEdgeCandidates(manifestFiles, true)].filter((file) => cachedModules.has(file) && !stale.has(file));
841
+ const changedResolution = await mapLimit(candidates, args.concurrency, async (candidate) => specifierResolutionChanged(candidate, manifestFiles[candidate], args.projectRoot, args.workspaceConfig, args.graphOptions, args.opts?.languageExtensions, args.loadMatchPathForFile, resolutionInputs, addedStemsForLanguage, loadTsconfigPaths));
842
+ candidates.forEach((candidate, index) => {
843
+ if (changedResolution[index])
844
+ stale.add(candidate);
845
+ });
846
+ for (const importer of collectPythonPackageImporters(manifestFiles, added))
847
+ stale.add(importer);
848
+ }
849
+ }
850
+ else {
851
+ const added = [
852
+ ...args.cacheMisses.added,
853
+ ...args.cacheMisses.changed.filter((file) => resolvesFromDeclarations(file)),
854
+ ];
855
+ if (added.length) {
856
+ const stemsByLanguage = new Map();
857
+ for (const [file, { mod }] of cachedModules) {
858
+ if (stale.has(file))
859
+ continue;
860
+ const languageId = supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id ?? "default";
861
+ let stems = stemsByLanguage.get(languageId);
862
+ if (!stems)
863
+ stemsByLanguage.set(languageId, (stems = addedResolutionStems(added, languageId)));
864
+ const tsconfigPaths = languageId === "ts" || languageId === "tsx" ? await loadTsconfigPaths(file) : undefined;
865
+ const addedCanSatisfy = cachedModuleSpecifiers(mod).some((specifier) => externalSpecifierMatchesAddedStem(specifier, languageId, stems, tsconfigPaths ? tsconfigAliasMappedTails(specifier, tsconfigPaths) : [], added, (file) => supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id));
866
+ if (addedCanSatisfy)
867
+ stale.add(file);
868
+ }
869
+ // `from . import mod` targets `__init__.py`, so no specifier names an added `mod.py`.
870
+ // Find these importers through their cached targets.
871
+ const packageImporters = pythonImportersOfPackageInits(Array.from(cachedModules, ([file, { mod }]) => [file, cachedModuleTargets(mod)]), added);
872
+ for (const file of packageImporters)
873
+ stale.add(file);
874
+ }
875
+ // C++ module specifiers name declarations, not file stems. The stem check cannot see
876
+ // a second declarer, a file that stopped declaring a module, or a deleted declarer.
877
+ // A deleted file leaves no cache miss, so the rows of omitted files are scanned separately.
878
+ // Cache hits cancel out of the comparison. Only stale rows, deleted files, and misses change it.
879
+ const cppPrevious = previousCppDeclaredContainers(args.previousModules);
880
+ const unknownDeclarationLanguages = new Set();
881
+ for (const deleted of await collectNoManifestDeletedDeclarationFiles({
882
+ files: args.files,
883
+ projectRoot: args.projectRoot,
884
+ opts: args.opts,
885
+ concurrency: args.concurrency,
886
+ })) {
887
+ deletedDeclarationFiles.push(deleted.file);
888
+ if (deleted.languageId === "cpp" && deleted.mod && deleted.mod.declaredContainers) {
889
+ mergeDeclaredContainers(cppPrevious, deleted.file, deleted.mod.declaredContainers);
890
+ }
891
+ else {
892
+ unknownDeclarationLanguages.add(deleted.languageId);
893
+ }
894
+ }
895
+ // Some previous declarations are unknown when a payload was evicted,
896
+ // or when the old row of a changed file cannot be decoded.
897
+ // Re-resolve every cached importer of the affected languages.
898
+ // This is rare: eviction starts past the cache limit, where builds miss the cache anyway.
899
+ const unknownDeclarationHistory = new Set();
900
+ if ((args.opts?.cache ?? "off") === "memory" && memoryCacheLostPayloads(args.projectRoot)) {
901
+ for (const languageId of DECLARATION_RESOLVED_IMPORT_LANGUAGES)
902
+ unknownDeclarationHistory.add(languageId);
903
+ }
904
+ // An unmapped `.h` file is C or C++ by its content, so classify with `supportForFile`.
905
+ for (const file of args.previousUnavailable) {
906
+ const languageId = supportForFile(file, args.opts?.languageExtensions)?.id;
907
+ if (languageId && DECLARATION_RESOLVED_IMPORT_LANGUAGES.has(languageId)) {
908
+ unknownDeclarationHistory.add(languageId);
909
+ }
910
+ }
911
+ if (unknownDeclarationHistory.size) {
912
+ for (const [file, { mod }] of cachedModules) {
913
+ if (stale.has(file) || !mod.imports.length)
914
+ continue;
915
+ const languageId = supportForFile(file, args.opts?.languageExtensions)?.id ?? "";
916
+ if (unknownDeclarationHistory.has(languageId))
917
+ stale.add(file);
918
+ }
919
+ }
920
+ const cppAdded = added.filter((file) => supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id === "cpp");
921
+ const missDeclaredContainers = cppAdded.length
922
+ ? await collectCppMissDeclaredContainers(cppAdded, args.concurrency, {
923
+ ...(args.confinedRoot ? { confinedRoot: args.confinedRoot, projectRoot: args.projectRoot } : {}),
924
+ ...(args.trustedSources ? { trustedSources: args.trustedSources } : {}),
925
+ })
926
+ : new Map();
927
+ const changedContainers = declaredContainerNamesChanged(sortedDeclaredContainerIndex(cppPrevious), missDeclaredContainers);
928
+ if (changedContainers.size || unknownDeclarationLanguages.size) {
929
+ for (const [file, { mod }] of cachedModules) {
930
+ if (stale.has(file))
931
+ continue;
932
+ if (changedContainers.size &&
933
+ cachedModuleSpecifiers(mod).some((specifier) => changedContainers.has(specifier))) {
934
+ stale.add(file);
935
+ continue;
936
+ }
937
+ if (unknownDeclarationLanguages.size) {
938
+ const languageId = supportForFile(file, args.opts?.languageExtensions)?.id ?? "default";
939
+ if (unknownDeclarationLanguages.has(languageId) && cachedModuleHasExternalImport(mod))
940
+ stale.add(file);
941
+ }
942
+ }
943
+ }
944
+ // The cached modules' own targets are the reverse dependencies.
945
+ const reverseDependencies = new Map();
946
+ for (const [file, { mod }] of cachedModules) {
947
+ for (const target of cachedModuleTargets(mod)) {
948
+ const key = fileIdentityKey(target);
949
+ let dependents = reverseDependencies.get(key);
950
+ if (!dependents)
951
+ reverseDependencies.set(key, (dependents = new Set()));
952
+ dependents.add(file);
953
+ }
954
+ }
955
+ const queue = args.cacheMisses.changed.map(fileIdentityKey);
956
+ const enqueued = new Set(queue);
957
+ for (let head = 0; head < queue.length; head += 1) {
958
+ for (const dependent of reverseDependencies.get(queue[head]) ?? []) {
959
+ if (resolvesFromDeclarations(dependent))
960
+ stale.add(dependent);
961
+ const key = fileIdentityKey(dependent);
962
+ if (enqueued.has(key))
963
+ continue;
964
+ enqueued.add(key);
965
+ queue.push(key);
966
+ }
967
+ }
968
+ }
969
+ // A package star depends on every package file, not just its representative edge. A type
970
+ // wildcard (`import p.C.*` naming class `p.C`) turns into a package star once package `p.C` exists.
971
+ const isJvmFile = (file) => {
972
+ const languageId = supportForFileWithoutHeaderSample(file, args.opts?.languageExtensions)?.id;
973
+ return languageId === "java" || languageId === "kotlin";
974
+ };
975
+ const dependsOnJvmPackage = (imp) => imp.kind === "star" && (!!imp.jvmPackageFiles || !!imp.jvmTypeWildcardName || typeof imp.resolved !== "string");
976
+ if (args.cacheMisses.added.some(isJvmFile) || args.cacheMisses.changed.some(isJvmFile)) {
977
+ const packageImporters = [];
978
+ for (const [file, cached] of cachedModules) {
979
+ if (stale.has(file) || !isJvmFile(file))
980
+ continue;
981
+ if (cached.mod.imports.some(dependsOnJvmPackage))
982
+ packageImporters.push([file, cached.mod]);
983
+ }
984
+ const changed = await mapLimit(packageImporters, args.concurrency, async ([file, mod]) => {
985
+ for (const imp of mod.imports) {
986
+ if (imp.kind !== "star" || !dependsOnJvmPackage(imp))
987
+ continue;
988
+ const current = await resolveJvmPackageImportPaths(args.projectRoot, imp.from, file);
989
+ const previous = imp.jvmPackageFiles ?? [];
990
+ if (current.length !== previous.length ||
991
+ current.some((target, index) => fileIdentityKey(target) !== fileIdentityKey(previous[index]))) {
992
+ return true;
993
+ }
994
+ }
995
+ return false;
996
+ });
997
+ packageImporters.forEach(([file], index) => {
998
+ if (changed[index])
999
+ stale.add(file);
1000
+ });
1001
+ }
1002
+ return { stale, deletedDeclarationFiles };
1003
+ }
1004
+ /** Files a cached module depends on, including every JVM wildcard package file. */
1005
+ function cachedModuleTargets(mod) {
1006
+ const targets = [];
1007
+ for (const binding of mod.imports) {
1008
+ if (typeof binding.resolved === "string")
1009
+ targets.push(binding.resolved);
1010
+ if (binding.kind !== "star" || !binding.jvmPackageFiles)
1011
+ continue;
1012
+ for (const file of binding.jvmPackageFiles) {
1013
+ if (file !== binding.resolved)
1014
+ targets.push(file);
1015
+ }
1016
+ }
1017
+ for (const entry of mod.exports) {
1018
+ if (entry.type === "local" || !entry.moduleSpecifier || entry.fromModule === entry.moduleSpecifier)
1019
+ continue;
1020
+ targets.push(entry.fromModule);
1021
+ }
1022
+ return targets;
1023
+ }
1024
+ /** Specifiers a cached module wrote: import sources and re-export sources. */
1025
+ function cachedModuleSpecifiers(mod) {
1026
+ const specifiers = mod.imports.map((binding) => binding.from);
1027
+ for (const entry of mod.exports) {
1028
+ if (entry.type !== "local")
1029
+ specifiers.push(entry.moduleSpecifier ?? entry.fromModule);
1030
+ }
1031
+ return specifiers;
1032
+ }
1033
+ /** Cached modules with a resolved import or re-export target that no longer exists. */
1034
+ async function cachedModulesWithMissingTargets(cachedModules, concurrency) {
1035
+ const targetsByFile = new Map();
1036
+ for (const [file, { mod }] of cachedModules) {
1037
+ const targets = cachedModuleTargets(mod);
1038
+ if (targets.length)
1039
+ targetsByFile.set(file, targets);
1040
+ }
1041
+ const targetExistence = await probePathExistence([...new Set([...targetsByFile.values()].flat())], concurrency);
1042
+ const missing = new Set();
1043
+ for (const [file, targets] of targetsByFile) {
1044
+ if (targets.some((target) => !targetExistence.get(target)))
1045
+ missing.add(file);
1046
+ }
1047
+ return missing;
1048
+ }
554
1049
  async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperOpts) {
1050
+ assertNativeRequiredAvailable();
555
1051
  clearResolutionCaches();
556
1052
  await initializeFileIdentityCaseSensitivity(projectRoot);
557
- const { normalizedProjectRoot, report, timings, totalStart, cacheEnabled, graphOptions, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts);
1053
+ const { normalizedProjectRoot, report, timings, totalStart, cacheEnabled, graphOptions } = createIndexBuildRunState(projectRoot, opts);
558
1054
  const manifestMode = helperOpts?.manifestMode ?? "off";
559
1055
  const useManifest = manifestMode !== "off";
560
1056
  const shouldWriteManifest = manifestMode === "read-write";
@@ -629,6 +1125,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
629
1125
  ? createCountedCheckProgress(opts, "Checking file cache", normalizedFiles.length)
630
1126
  : () => undefined;
631
1127
  const cacheProbeStart = performance.now();
1128
+ const evictionSerialAtStart = memoryCacheEvictionSerial();
632
1129
  const gitAvailable = await isGitRepo(projectRoot, helperOpts?.discoveryContext?.git);
633
1130
  const needsPersistentSignatures = cacheEnabled || useManifest;
634
1131
  const useGitSignatures = gitAvailable && needsPersistentSignatures;
@@ -702,10 +1199,10 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
702
1199
  ? await moduleCacheSignatureForFile(file, sigInfo, opts, resolverEnvironmentFingerprint)
703
1200
  : sigInfo.cacheSig;
704
1201
  const canReuseModuleCache = cacheEnabled && (!graphOptions.resolveNodeModules || resolverEnvironmentFingerprint !== null);
705
- const mod = canReuseModuleCache
706
- ? tryLoadFromCache(projectRoot, file, cacheSig, opts, report, moduleCacheAvailable)
707
- : null;
708
- return [file, { sigInfo, mod }];
1202
+ const loaded = canReuseModuleCache
1203
+ ? loadModuleFromCache(projectRoot, file, cacheSig, opts, report, moduleCacheAvailable)
1204
+ : { mod: null, previouslyCached: false, staleMod: null };
1205
+ return [file, { sigInfo, ...loaded }];
709
1206
  }
710
1207
  catch (error) {
711
1208
  return [file, { error }];
@@ -719,6 +1216,70 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
719
1216
  timings.cacheProbeMs = cacheProbeMs;
720
1217
  recordBuildTimingStep(timings, { name: "cache-probe", ms: cacheProbeMs });
721
1218
  }
1219
+ const tsconfigMatchPathByDirectory = new Map();
1220
+ const loadMatchPathForFile = (file) => {
1221
+ const directory = path.dirname(file);
1222
+ let matchPath = tsconfigMatchPathByDirectory.get(directory);
1223
+ if (!matchPath) {
1224
+ matchPath = loadNearestTsconfigFor(file, projectRoot, opts?.logLevel).then((tsconfig) => tsconfig.matchPath);
1225
+ tsconfigMatchPathByDirectory.set(directory, matchPath);
1226
+ }
1227
+ return matchPath;
1228
+ };
1229
+ let retiredDeletionFiles = [];
1230
+ // Set when a stale importer row could not be deleted. The build then keeps its previous disk
1231
+ // state (manifest, snapshot, deletion evidence), so the next build finds the same staleness.
1232
+ let staleRowRemovalFailed = false;
1233
+ if (cacheEnabled) {
1234
+ const cachedModules = new Map();
1235
+ const cacheMissesByState = { changed: [], added: [] };
1236
+ // The stale rows of changed files hold the previous declarations.
1237
+ // Deleted files leave no miss. The build finds their rows separately.
1238
+ const previousModules = new Map();
1239
+ const previousUnavailable = [];
1240
+ for (const [file, probe] of cacheProbes) {
1241
+ if ("error" in probe)
1242
+ continue;
1243
+ if (probe.mod)
1244
+ cachedModules.set(file, { sigInfo: probe.sigInfo, mod: probe.mod });
1245
+ else if (probe.previouslyCached) {
1246
+ cacheMissesByState.changed.push(file);
1247
+ if (probe.staleMod)
1248
+ previousModules.set(file, probe.staleMod);
1249
+ else
1250
+ previousUnavailable.push(file);
1251
+ }
1252
+ else
1253
+ cacheMissesByState.added.push(file);
1254
+ }
1255
+ const { stale: staleCachedModules, deletedDeclarationFiles: retiredDeletions } = await collectStaleCachedModules({
1256
+ files: normalizedFiles,
1257
+ cachedModules,
1258
+ cacheMisses: cacheMissesByState,
1259
+ previousModules,
1260
+ previousUnavailable,
1261
+ signatures: new Map(Array.from(cacheProbes, ([file, probe]) => ("error" in probe ? null : [file, probe.sigInfo])).filter((entry) => entry !== null)),
1262
+ manifestFiles: manifest ? manifestFiles : null,
1263
+ manifest,
1264
+ projectRoot,
1265
+ workspaceConfig,
1266
+ graphOptions,
1267
+ opts,
1268
+ loadMatchPathForFile,
1269
+ concurrency: conc,
1270
+ ...(confinedRoot ? { confinedRoot, trustedSources } : {}),
1271
+ });
1272
+ retiredDeletionFiles = retiredDeletions;
1273
+ // A stale importer's row still matches its source signature.
1274
+ // If the rebuild or the cache write fails, a later build would reuse the row. Delete it now.
1275
+ staleRowRemovalFailed = !removeModulesFromCache(projectRoot, [...staleCachedModules].filter((file) => cachedModules.has(file)), opts);
1276
+ for (const file of staleCachedModules) {
1277
+ const probe = cacheProbes.get(file);
1278
+ if (probe && !("error" in probe))
1279
+ cacheProbes.set(file, { ...probe, mod: null });
1280
+ cachedGraphEntries?.delete(file);
1281
+ }
1282
+ }
722
1283
  const cacheMisses = Array.from(cacheProbes, ([file, probe]) => !("error" in probe) && !probe.mod ? file : null).filter((file) => file !== null);
723
1284
  const workerSetup = await setupWorkerPool(opts, countNativeWorkerEligibleFiles(cacheMisses, opts?.languageExtensions));
724
1285
  try {
@@ -730,16 +1291,6 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
730
1291
  ? await tryLoadPersistedBloomFilters(projectRoot, opts, report)
731
1292
  : null;
732
1293
  const parsedMap = new Map();
733
- const tsconfigMatchPathByDirectory = new Map();
734
- const loadMatchPathForFile = (file) => {
735
- const directory = path.dirname(file);
736
- let matchPath = tsconfigMatchPathByDirectory.get(directory);
737
- if (!matchPath) {
738
- matchPath = loadNearestTsconfigFor(file, projectRoot, opts?.logLevel).then((tsconfig) => tsconfig.matchPath);
739
- tsconfigMatchPathByDirectory.set(directory, matchPath);
740
- }
741
- return matchPath;
742
- };
743
1294
  const parseStart = performance.now();
744
1295
  const graph = { nodes: new Set(normalizedFiles), edges: [] };
745
1296
  const onFileEdges = manifestEntries
@@ -783,13 +1334,8 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
783
1334
  let edges = [];
784
1335
  if (mod && edgesCached) {
785
1336
  edges = await collectEdgesForFile(file, projectRoot, workspaceConfig, {
786
- fast: !!graphOptions.fast,
787
- ...(graphOptions.fastRegexDisabledLanguages
788
- ? { fastRegexDisabledLanguages: graphOptions.fastRegexDisabledLanguages }
789
- : {}),
790
1337
  resolveNodeModules: !!graphOptions.resolveNodeModules,
791
1338
  dynamicImportHeuristics: !!graphOptions.dynamicImportHeuristics,
792
- ...(opts?.native ? { native: opts.native } : {}),
793
1339
  ...(opts?.languageExtensions ? { languageExtensions: opts.languageExtensions } : {}),
794
1340
  ...(opts?.logLevel ? { logLevel: opts.logLevel } : {}),
795
1341
  ...(graphOptions.resolutionHints ? { resolutionHints: graphOptions.resolutionHints } : {}),
@@ -798,7 +1344,6 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
798
1344
  ...(cachedEdgesEntry ? { cachedFileEdges: cachedEdgesEntry } : {}),
799
1345
  ...(manifest?.projectRoot ? { cachedFileEdgesProjectRoot: manifest.projectRoot } : {}),
800
1346
  ...(onFileEdges ? { onFileEdges } : {}),
801
- ...(onFallbackImportExtraction ? { onFallbackImportExtraction } : {}),
802
1347
  allFiles: normalizedFiles,
803
1348
  ...(sqlFactCache ? { sqlFactCache } : {}),
804
1349
  });
@@ -840,7 +1385,6 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
840
1385
  parsedCacheMaxEntries: parsedCacheMaxEntries(opts),
841
1386
  jsonDependencies,
842
1387
  bloomFilterCache,
843
- onFallbackImportExtraction,
844
1388
  fileSignatures,
845
1389
  cacheEnabled,
846
1390
  ...(confinedRoot ? { confinedRoot, trustedSource: trustedSources?.get(file) } : {}),
@@ -854,13 +1398,8 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
854
1398
  }
855
1399
  edges = await collectEdgesForFile(file, projectRoot, workspaceConfig, {
856
1400
  ...(graphContext ? { parsed: graphContext } : {}),
857
- fast: !!graphOptions.fast,
858
- ...(graphOptions.fastRegexDisabledLanguages
859
- ? { fastRegexDisabledLanguages: graphOptions.fastRegexDisabledLanguages }
860
- : {}),
861
1401
  resolveNodeModules: !!graphOptions.resolveNodeModules,
862
1402
  dynamicImportHeuristics: !!graphOptions.dynamicImportHeuristics,
863
- ...(opts?.native ? { native: opts.native } : {}),
864
1403
  ...(opts?.languageExtensions ? { languageExtensions: opts.languageExtensions } : {}),
865
1404
  ...(opts?.logLevel ? { logLevel: opts.logLevel } : {}),
866
1405
  ...(graphOptions.resolutionHints ? { resolutionHints: graphOptions.resolutionHints } : {}),
@@ -869,7 +1408,6 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
869
1408
  ...(cachedEdgesEntry ? { cachedFileEdges: cachedEdgesEntry } : {}),
870
1409
  ...(manifest?.projectRoot ? { cachedFileEdgesProjectRoot: manifest.projectRoot } : {}),
871
1410
  ...(onFileEdges ? { onFileEdges } : {}),
872
- ...(onFallbackImportExtraction ? { onFallbackImportExtraction } : {}),
873
1411
  allFiles: normalizedFiles,
874
1412
  ...(sqlFactCache ? { sqlFactCache } : {}),
875
1413
  });
@@ -942,6 +1480,16 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
942
1480
  writeModulesToCache(projectRoot, pendingCacheWrites, opts);
943
1481
  }
944
1482
  }
1483
+ // A full-discovery build re-resolved every importer and wrote its modules back.
1484
+ // Clear the eviction state, unless another payload was evicted during the build.
1485
+ if (opts?.cache === "memory" && projectFiles !== undefined) {
1486
+ settleMemoryCacheEvictions(projectRoot, evictionSerialAtStart);
1487
+ }
1488
+ // Delete the rows of confirmed-deleted declaration files, so the next unchanged build is fully warm.
1489
+ // Only a full-discovery build does this. A build over a file list can omit importers that still need the deletion.
1490
+ if (!manifest && projectFiles !== undefined && retiredDeletionFiles.length && !staleRowRemovalFailed) {
1491
+ removeModulesFromCache(projectRoot, retiredDeletionFiles, opts);
1492
+ }
945
1493
  const workspaceManifestEdges = await timeIndexBuildPhase({
946
1494
  opts,
947
1495
  timings,
@@ -970,7 +1518,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
970
1518
  });
971
1519
  }
972
1520
  }
973
- if (manifestEntries) {
1521
+ if (manifestEntries && !staleRowRemovalFailed) {
974
1522
  await timeIndexBuildPhase({
975
1523
  opts,
976
1524
  timings,
@@ -1029,7 +1577,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
1029
1577
  const finalizeMs = discoveredInsideFinalize ? Math.max(0, elapsed - discoveryMs) : elapsed;
1030
1578
  recordBuildTimingStep(timings, { name: "finalize", ms: finalizeMs });
1031
1579
  }
1032
- if (manifestEntries) {
1580
+ if (manifestEntries && !staleRowRemovalFailed) {
1033
1581
  await timeIndexBuildPhase({
1034
1582
  opts,
1035
1583
  timings,
@@ -1056,6 +1604,7 @@ async function buildIndexFromFileListShared(projectRoot, rawFiles, opts, helperO
1056
1604
  }
1057
1605
  }
1058
1606
  async function buildProjectIndexWithManifestOptions(projectRoot, opts, helperOpts) {
1607
+ assertNativeRequiredAvailable();
1059
1608
  const timings = opts?.report ? (opts.report.timings ??= {}) : undefined;
1060
1609
  const discoveryContext = helperOpts?.discoveryContext;
1061
1610
  await initializeFileIdentityCaseSensitivity(projectRoot);
@@ -1178,6 +1727,7 @@ export async function buildProjectIndex(projectRoot, opts) {
1178
1727
  * under the project root.
1179
1728
  */
1180
1729
  export async function buildProjectIndexFromFiles(projectRoot, inputFiles, rawOpts) {
1730
+ assertNativeRequiredAvailable();
1181
1731
  // Discovery, manifest loading, and cache checks all precede file processing, so stamp the
1182
1732
  // operation origin here and let the completion event report the caller's whole wait.
1183
1733
  const opts = { ...rawOpts, progressStartedAt: rawOpts?.progressStartedAt ?? performance.now() };
@@ -1233,6 +1783,7 @@ async function buildDeclaredScopeIndex(projectRoot, scopeFiles, opts, helperOpts
1233
1783
  * sentinels for review-agent workflows that analyze uncommitted changes.
1234
1784
  */
1235
1785
  export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1786
+ assertNativeRequiredAvailable();
1236
1787
  const opts = {
1237
1788
  ...rawOpts,
1238
1789
  progressStartedAt: rawOpts?.progressStartedAt ?? performance.now(),
@@ -1245,10 +1796,7 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1245
1796
  clearResolutionCaches();
1246
1797
  });
1247
1798
  const graphOptions = normalizeGraphOptions(opts?.graph);
1248
- const strictIncremental = opts?.incrementalStrict ?? false;
1249
- if (strictIncremental && graphOptions.fast)
1250
- graphOptions.fast = false;
1251
- const { normalizedProjectRoot, report, timings, totalStart, cacheMode, cacheEnabled, onFallbackImportExtraction } = createIndexBuildRunState(projectRoot, opts, graphOptions);
1799
+ const { normalizedProjectRoot, report, timings, totalStart, cacheMode, cacheEnabled } = createIndexBuildRunState(projectRoot, opts, graphOptions);
1252
1800
  let checkProgressActive = false;
1253
1801
  const startCheckProgress = () => {
1254
1802
  if (checkProgressActive)
@@ -1580,7 +2128,6 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1580
2128
  modules: new Map(),
1581
2129
  byFile: new Map(),
1582
2130
  projectRoot: normalizedProjectRoot,
1583
- ...(opts?.native ? { nativeMode: opts.native } : {}),
1584
2131
  exportCache: new Map(),
1585
2132
  scopeCache: new Map(),
1586
2133
  parsed: new Map(),
@@ -1652,8 +2199,6 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1652
2199
  if (report) {
1653
2200
  if (snapshotLoad.analysisReport?.backend)
1654
2201
  report.backend = snapshotLoad.analysisReport.backend;
1655
- if (snapshotLoad.analysisReport?.graph)
1656
- report.graph = snapshotLoad.analysisReport.graph;
1657
2202
  if (!report.backend)
1658
2203
  initNativeBackendReport(report);
1659
2204
  snapshot.buildReport = report;
@@ -1740,6 +2285,7 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1740
2285
  const bloomFilterCache = useBloomFilters
1741
2286
  ? new (await import("../util/bloom-filter.js")).BloomFilterCache()
1742
2287
  : undefined;
2288
+ const addedFiles = [];
1743
2289
  for (const file of allFiles) {
1744
2290
  const sigInfo = fileSignatures.get(file);
1745
2291
  if (!sigInfo)
@@ -1747,6 +2293,8 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1747
2293
  const entry = trackedEntries[file];
1748
2294
  const hasMatchingGitSig = !!entry?.gitSig && !!sigInfo.gitSig && entry.gitSig === sigInfo.gitSig;
1749
2295
  const hasMatchingSig = entry?.sig === sigInfo.sig;
2296
+ if (!entry)
2297
+ addedFiles.push(file);
1750
2298
  if (!entry || !(hasMatchingGitSig || hasMatchingSig)) {
1751
2299
  changedFiles.add(file);
1752
2300
  }
@@ -1818,6 +2366,52 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1818
2366
  }
1819
2367
  }
1820
2368
  invalidateCachedDependents();
2369
+ // A deletion cannot make an unresolved specifier start resolving. Dependents of a
2370
+ // deleted file are already rebuilt by collectDeletedTrackedFileDependents. An added
2371
+ // file can: re-resolve only specifiers whose stem matches an added file. Edges that
2372
+ // cannot round-trip (unstored resolution kind, or a C/C++ include with no form) are
2373
+ // reparsed instead of guessed.
2374
+ if (addedFiles.length) {
2375
+ const reparseCachedFile = (candidate) => {
2376
+ const key = fileIdentityKey(candidate);
2377
+ if (modules.has(key)) {
2378
+ modules.delete(key);
2379
+ if (fileReport) {
2380
+ fileReport.cached = Math.max(0, (fileReport.cached ?? 0) - 1);
2381
+ }
2382
+ }
2383
+ markAsChanged(candidate);
2384
+ };
2385
+ const addedStemsByLanguage = new Map();
2386
+ const addedStemsForLanguage = (languageId) => {
2387
+ const existing = addedStemsByLanguage.get(languageId);
2388
+ if (existing)
2389
+ return existing;
2390
+ const stems = addedResolutionStems(addedFiles, languageId);
2391
+ addedStemsByLanguage.set(languageId, stems);
2392
+ return stems;
2393
+ };
2394
+ const specifierEdgeCandidates = collectSpecifierEdgeCandidates(trackedEntries, true);
2395
+ if (specifierEdgeCandidates.size) {
2396
+ const candidateFiles = Array.from(specifierEdgeCandidates);
2397
+ const staleResolutions = await mapLimit(candidateFiles, conc, async (candidate) => {
2398
+ if (!allFiles.has(candidate) || changedFiles.has(candidate))
2399
+ return false;
2400
+ const entry = trackedEntries[candidate];
2401
+ if (!entry)
2402
+ return false;
2403
+ return specifierResolutionChanged(candidate, entry, projectRoot, workspaceConfig, graphOptions, opts?.languageExtensions, loadMatchPathForFile, addedFiles, addedStemsForLanguage, (importer) => loadTsconfigResolutionInputsFor(importer, projectRoot, opts?.logLevel).then((inputs) => inputs?.paths));
2404
+ });
2405
+ for (let index = 0; index < candidateFiles.length; index += 1) {
2406
+ if (staleResolutions[index])
2407
+ reparseCachedFile(candidateFiles[index]);
2408
+ }
2409
+ }
2410
+ for (const importer of collectPythonPackageImporters(trackedEntries, addedFiles)) {
2411
+ if (allFiles.has(importer) && !changedFiles.has(importer))
2412
+ reparseCachedFile(importer);
2413
+ }
2414
+ }
1821
2415
  const changedList = Array.from(changedFiles);
1822
2416
  // Sized by the work that remains rather than the size of the project: an incremental build
1823
2417
  // touching a handful of files gets a handful of threads, or none.
@@ -1855,7 +2449,6 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1855
2449
  parsedCacheMaxEntries: parsedCacheMaxEntries(opts),
1856
2450
  jsonDependencies,
1857
2451
  bloomFilterCache,
1858
- onFallbackImportExtraction,
1859
2452
  fileSignatures,
1860
2453
  cacheEnabled,
1861
2454
  ...(resolverEnvironmentFingerprint !== undefined ? { resolverEnvironmentFingerprint } : {}),
@@ -1940,13 +2533,8 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1940
2533
  ? { nodes: new Set(baseGraph.nodes), edges: [...baseGraph.edges] }
1941
2534
  : await collectGraph(projectRoot, filesList, {
1942
2535
  parsed: parsedMap,
1943
- fast: !!graphOptions.fast,
1944
- ...(graphOptions.fastRegexDisabledLanguages
1945
- ? { fastRegexDisabledLanguages: graphOptions.fastRegexDisabledLanguages }
1946
- : {}),
1947
2536
  resolveNodeModules: !!graphOptions.resolveNodeModules,
1948
2537
  dynamicImportHeuristics: !!graphOptions.dynamicImportHeuristics,
1949
- ...(opts?.native ? { native: opts.native } : {}),
1950
2538
  ...(opts?.languageExtensions ? { languageExtensions: opts.languageExtensions } : {}),
1951
2539
  threads: conc,
1952
2540
  ...(opts?.logLevel ? { logLevel: opts.logLevel } : {}),
@@ -1954,7 +2542,6 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
1954
2542
  allFiles: Array.from(allFiles),
1955
2543
  fileSignatures,
1956
2544
  cachedFileEdges: cachedGraphEntries,
1957
- ...(onFallbackImportExtraction ? { onFallbackImportExtraction } : {}),
1958
2545
  ...(baseGraph ? { baseGraph } : {}),
1959
2546
  replaceFiles: new Set(changedFiles),
1960
2547
  onFileEdges: (file, entry) => {
@@ -2070,6 +2657,7 @@ export async function buildProjectIndexIncremental(projectRoot, rawOpts) {
2070
2657
  }
2071
2658
  }
2072
2659
  export async function buildGraphDelta(projectRoot, opts) {
2660
+ assertNativeRequiredAvailable();
2073
2661
  const manifest = await loadManifest(projectRoot, opts);
2074
2662
  const trackedEntries = sanitizeManifestEntriesForRoot(projectRoot, manifest?.files);
2075
2663
  const graphOptions = normalizeGraphOptions(opts?.graph);
@@ -2079,9 +2667,6 @@ export async function buildGraphDelta(projectRoot, opts) {
2079
2667
  ? diffBuildOptions(manifest.buildOptions, opts).includes("languageExtensions")
2080
2668
  : false;
2081
2669
  const languageSupportChangedForFile = (file) => supportForFile(file, previousLanguageExtensions)?.id !== supportForFile(file, currentLanguageExtensions)?.id;
2082
- const strictIncremental = opts?.incrementalStrict ?? false;
2083
- if (strictIncremental && graphOptions.fast)
2084
- graphOptions.fast = false;
2085
2670
  const explicitFiles = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.files ?? [], "Graph delta file");
2086
2671
  const additionalFiles = await normalizeIndexedFileInputsWithinRoot(projectRoot, opts?.additionalFiles ?? [], "Additional graph delta file");
2087
2672
  const needsGitScan = !!opts?.gitBase || !!opts?.changedSince;