@lzehrung/codegraph 2.3.20 → 2.3.22

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 (1386) hide show
  1. package/README.md +6 -5
  2. package/THIRD_PARTY_NOTICES +4 -4
  3. package/codegraph-skill/codegraph/SKILL.md +97 -281
  4. package/dist/agent/call-hierarchy.d.ts +28 -0
  5. package/dist/agent/call-hierarchy.d.ts.map +1 -0
  6. package/dist/agent/call-hierarchy.js +82 -0
  7. package/dist/agent/call-hierarchy.js.map +1 -0
  8. package/dist/agent/candidate-tests.d.ts +12 -0
  9. package/dist/agent/candidate-tests.d.ts.map +1 -0
  10. package/dist/agent/candidate-tests.js +17 -0
  11. package/dist/agent/candidate-tests.js.map +1 -0
  12. package/dist/agent/explain.d.ts +8 -2
  13. package/dist/agent/explain.d.ts.map +1 -1
  14. package/dist/agent/explain.js +17 -3
  15. package/dist/agent/explain.js.map +1 -1
  16. package/dist/agent/explore.d.ts +3 -3
  17. package/dist/agent/explore.d.ts.map +1 -1
  18. package/dist/agent/explore.js +2 -2
  19. package/dist/agent/explore.js.map +1 -1
  20. package/dist/agent/file-view.d.ts +55 -0
  21. package/dist/agent/file-view.d.ts.map +1 -0
  22. package/dist/agent/file-view.js +521 -0
  23. package/dist/agent/file-view.js.map +1 -0
  24. package/dist/agent/follow-ups.d.ts +10 -0
  25. package/dist/agent/follow-ups.d.ts.map +1 -0
  26. package/dist/agent/follow-ups.js +175 -0
  27. package/dist/agent/follow-ups.js.map +1 -0
  28. package/dist/agent/normalize.d.ts +1 -1
  29. package/dist/agent/normalize.d.ts.map +1 -1
  30. package/dist/agent/normalize.js +2 -2
  31. package/dist/agent/normalize.js.map +1 -1
  32. package/dist/agent/orient.d.ts +1 -1
  33. package/dist/agent/orient.d.ts.map +1 -1
  34. package/dist/agent/orient.js +2 -2
  35. package/dist/agent/orient.js.map +1 -1
  36. package/dist/agent/packet.d.ts +1 -1
  37. package/dist/agent/packet.d.ts.map +1 -1
  38. package/dist/agent/packet.js +1 -1
  39. package/dist/agent/packet.js.map +1 -1
  40. package/dist/agent/query-index/candidates.d.ts +8 -2
  41. package/dist/agent/query-index/candidates.d.ts.map +1 -1
  42. package/dist/agent/query-index/candidates.js +12 -5
  43. package/dist/agent/query-index/candidates.js.map +1 -1
  44. package/dist/agent/query-index/content.js +2 -2
  45. package/dist/agent/query-index/content.js.map +1 -1
  46. package/dist/agent/query-index/query-index-worker.d.ts +8 -0
  47. package/dist/agent/query-index/query-index-worker.d.ts.map +1 -0
  48. package/dist/agent/query-index/query-index-worker.js +11 -0
  49. package/dist/agent/query-index/query-index-worker.js.map +1 -0
  50. package/dist/agent/query-index/session-store.d.ts +5 -0
  51. package/dist/agent/query-index/session-store.d.ts.map +1 -0
  52. package/dist/agent/query-index/session-store.js +69 -0
  53. package/dist/agent/query-index/session-store.js.map +1 -0
  54. package/dist/agent/query-index/source-identity.d.ts +3 -0
  55. package/dist/agent/query-index/source-identity.d.ts.map +1 -0
  56. package/dist/agent/query-index/source-identity.js +12 -0
  57. package/dist/agent/query-index/source-identity.js.map +1 -0
  58. package/dist/agent/query-index/store.d.ts +5 -1
  59. package/dist/agent/query-index/store.d.ts.map +1 -1
  60. package/dist/agent/query-index/store.js +98 -31
  61. package/dist/agent/query-index/store.js.map +1 -1
  62. package/dist/agent/query-index/update.js +3 -3
  63. package/dist/agent/query-index/update.js.map +1 -1
  64. package/dist/agent/query-index/worker-pool.d.ts +27 -0
  65. package/dist/agent/query-index/worker-pool.d.ts.map +1 -0
  66. package/dist/agent/query-index/worker-pool.js +114 -0
  67. package/dist/agent/query-index/worker-pool.js.map +1 -0
  68. package/dist/agent/refactor-plan.d.ts +40 -0
  69. package/dist/agent/refactor-plan.d.ts.map +1 -0
  70. package/dist/agent/refactor-plan.js +226 -0
  71. package/dist/agent/refactor-plan.js.map +1 -0
  72. package/dist/agent/rename-preview.d.ts +57 -0
  73. package/dist/agent/rename-preview.d.ts.map +1 -0
  74. package/dist/agent/rename-preview.js +1062 -0
  75. package/dist/agent/rename-preview.js.map +1 -0
  76. package/dist/agent/search.d.ts +8 -2
  77. package/dist/agent/search.d.ts.map +1 -1
  78. package/dist/agent/search.js +26 -9
  79. package/dist/agent/search.js.map +1 -1
  80. package/dist/agent/semantic-symbols.d.ts +16 -0
  81. package/dist/agent/semantic-symbols.d.ts.map +1 -0
  82. package/dist/agent/semantic-symbols.js +97 -0
  83. package/dist/agent/semantic-symbols.js.map +1 -0
  84. package/dist/agent/semantic.d.ts +1 -1
  85. package/dist/agent/semantic.d.ts.map +1 -1
  86. package/dist/agent/session-lifecycle.d.ts +5 -0
  87. package/dist/agent/session-lifecycle.d.ts.map +1 -0
  88. package/dist/agent/session-lifecycle.js +18 -0
  89. package/dist/agent/session-lifecycle.js.map +1 -0
  90. package/dist/agent/session.d.ts +3 -3
  91. package/dist/agent/session.d.ts.map +1 -1
  92. package/dist/agent/session.js +73 -26
  93. package/dist/agent/session.js.map +1 -1
  94. package/dist/agent/symbol-lookup.d.ts +12 -0
  95. package/dist/agent/symbol-lookup.d.ts.map +1 -0
  96. package/dist/agent/symbol-lookup.js +26 -0
  97. package/dist/agent/symbol-lookup.js.map +1 -0
  98. package/dist/agent/type-hierarchy.d.ts +39 -0
  99. package/dist/agent/type-hierarchy.d.ts.map +1 -0
  100. package/dist/agent/type-hierarchy.js +125 -0
  101. package/dist/agent/type-hierarchy.js.map +1 -0
  102. package/dist/agent/workspace-symbols.d.ts +18 -0
  103. package/dist/agent/workspace-symbols.d.ts.map +1 -0
  104. package/dist/agent/workspace-symbols.js +75 -0
  105. package/dist/agent/workspace-symbols.js.map +1 -0
  106. package/dist/agent-tools.d.ts +6 -6
  107. package/dist/agent-tools.d.ts.map +1 -1
  108. package/dist/agent-tools.js +6 -6
  109. package/dist/agent-tools.js.map +1 -1
  110. package/dist/agent.d.ts +18 -18
  111. package/dist/agent.d.ts.map +1 -1
  112. package/dist/agent.js +10 -10
  113. package/dist/agent.js.map +1 -1
  114. package/dist/analysis-summary.d.ts +19 -0
  115. package/dist/analysis-summary.d.ts.map +1 -0
  116. package/dist/analysis-summary.js +80 -0
  117. package/dist/analysis-summary.js.map +1 -0
  118. package/dist/bin/cli.js +37347 -36812
  119. package/dist/bin/query-index-worker.js +4382 -0
  120. package/dist/bin/raw-query-worker.js +383 -0
  121. package/dist/bootstrap/tree-sitter-languages.d.ts +5 -0
  122. package/dist/bootstrap/tree-sitter-languages.d.ts.map +1 -0
  123. package/dist/bootstrap/tree-sitter-languages.js +41 -0
  124. package/dist/bootstrap/tree-sitter-languages.js.map +1 -0
  125. package/dist/chunking/chunk-blocks.d.ts +9 -0
  126. package/dist/chunking/chunk-blocks.d.ts.map +1 -0
  127. package/dist/chunking/chunk-blocks.js +60 -0
  128. package/dist/chunking/chunk-blocks.js.map +1 -0
  129. package/dist/chunking/chunk-file.d.ts +39 -0
  130. package/dist/chunking/chunk-file.d.ts.map +1 -0
  131. package/dist/chunking/chunk-file.js +152 -0
  132. package/dist/chunking/chunk-file.js.map +1 -0
  133. package/dist/chunking/chunk-id.d.ts +7 -0
  134. package/dist/chunking/chunk-id.d.ts.map +1 -0
  135. package/dist/chunking/chunk-id.js +30 -0
  136. package/dist/chunking/chunk-id.js.map +1 -0
  137. package/dist/chunking/chunk-matches.d.ts +4 -0
  138. package/dist/chunking/chunk-matches.d.ts.map +1 -0
  139. package/dist/chunking/chunk-matches.js +65 -0
  140. package/dist/chunking/chunk-matches.js.map +1 -0
  141. package/dist/chunking/chunk-merge.d.ts +4 -0
  142. package/dist/chunking/chunk-merge.d.ts.map +1 -0
  143. package/dist/chunking/chunk-merge.js +144 -0
  144. package/dist/chunking/chunk-merge.js.map +1 -0
  145. package/dist/chunking/chunk-sfc.d.ts +18 -0
  146. package/dist/chunking/chunk-sfc.d.ts.map +1 -0
  147. package/dist/chunking/chunk-sfc.js +165 -0
  148. package/dist/chunking/chunk-sfc.js.map +1 -0
  149. package/dist/chunking/chunk-split.d.ts +6 -0
  150. package/dist/chunking/chunk-split.d.ts.map +1 -0
  151. package/dist/chunking/chunk-split.js +155 -0
  152. package/dist/chunking/chunk-split.js.map +1 -0
  153. package/dist/chunking/chunk-text-file.d.ts +28 -0
  154. package/dist/chunking/chunk-text-file.d.ts.map +1 -0
  155. package/dist/chunking/chunk-text-file.js +107 -0
  156. package/dist/chunking/chunk-text-file.js.map +1 -0
  157. package/dist/chunking/language-config.d.ts +35 -0
  158. package/dist/chunking/language-config.d.ts.map +1 -0
  159. package/dist/chunking/language-config.js +24 -0
  160. package/dist/chunking/language-config.js.map +1 -0
  161. package/dist/cli/affected.js +1 -1
  162. package/dist/cli/affected.js.map +1 -1
  163. package/dist/cli/call-hierarchy.d.ts +6 -0
  164. package/dist/cli/call-hierarchy.d.ts.map +1 -0
  165. package/dist/cli/call-hierarchy.js +72 -0
  166. package/dist/cli/call-hierarchy.js.map +1 -0
  167. package/dist/cli/chunk.js +5 -5
  168. package/dist/cli/chunk.js.map +1 -1
  169. package/dist/cli/command-catalog.d.ts +14 -0
  170. package/dist/cli/command-catalog.d.ts.map +1 -0
  171. package/dist/cli/command-catalog.js +118 -0
  172. package/dist/cli/command-catalog.js.map +1 -0
  173. package/dist/cli/command-table.d.ts +16 -0
  174. package/dist/cli/command-table.d.ts.map +1 -0
  175. package/dist/cli/command-table.js +758 -0
  176. package/dist/cli/command-table.js.map +1 -0
  177. package/dist/cli/compile-cache.d.ts +22 -0
  178. package/dist/cli/compile-cache.d.ts.map +1 -0
  179. package/dist/cli/compile-cache.js +81 -0
  180. package/dist/cli/compile-cache.js.map +1 -0
  181. package/dist/cli/discovery-globs.d.ts +11 -0
  182. package/dist/cli/discovery-globs.d.ts.map +1 -0
  183. package/dist/cli/discovery-globs.js +74 -0
  184. package/dist/cli/discovery-globs.js.map +1 -0
  185. package/dist/cli/doctor.d.ts +1 -1
  186. package/dist/cli/doctor.d.ts.map +1 -1
  187. package/dist/cli/doctor.js +3 -3
  188. package/dist/cli/doctor.js.map +1 -1
  189. package/dist/cli/drift.d.ts +1 -1
  190. package/dist/cli/drift.d.ts.map +1 -1
  191. package/dist/cli/duplicate-similarity.d.ts +10 -0
  192. package/dist/cli/duplicate-similarity.d.ts.map +1 -0
  193. package/dist/cli/duplicate-similarity.js +20 -0
  194. package/dist/cli/duplicate-similarity.js.map +1 -0
  195. package/dist/cli/file.js +2 -2
  196. package/dist/cli/file.js.map +1 -1
  197. package/dist/cli/graph-delta.d.ts +25 -0
  198. package/dist/cli/graph-delta.d.ts.map +1 -0
  199. package/dist/cli/graph-delta.js +80 -0
  200. package/dist/cli/graph-delta.js.map +1 -0
  201. package/dist/cli/graph-queries.d.ts +23 -0
  202. package/dist/cli/graph-queries.d.ts.map +1 -0
  203. package/dist/cli/graph-queries.js +265 -0
  204. package/dist/cli/graph-queries.js.map +1 -0
  205. package/dist/cli/graph.d.ts +2 -2
  206. package/dist/cli/graph.d.ts.map +1 -1
  207. package/dist/cli/graph.js +2 -2
  208. package/dist/cli/graph.js.map +1 -1
  209. package/dist/cli/grep.d.ts +1 -1
  210. package/dist/cli/grep.d.ts.map +1 -1
  211. package/dist/cli/grep.js +1 -1
  212. package/dist/cli/grep.js.map +1 -1
  213. package/dist/cli/help.d.ts +1 -1
  214. package/dist/cli/help.d.ts.map +1 -1
  215. package/dist/cli/help.js +2 -2
  216. package/dist/cli/help.js.map +1 -1
  217. package/dist/cli/impact.d.ts +2 -2
  218. package/dist/cli/impact.d.ts.map +1 -1
  219. package/dist/cli/impact.js +4 -4
  220. package/dist/cli/impact.js.map +1 -1
  221. package/dist/cli/index-policy.d.ts +36 -0
  222. package/dist/cli/index-policy.d.ts.map +1 -0
  223. package/dist/cli/index-policy.js +169 -0
  224. package/dist/cli/index-policy.js.map +1 -0
  225. package/dist/cli/index.d.ts +2 -2
  226. package/dist/cli/index.d.ts.map +1 -1
  227. package/dist/cli/index.js +1 -1
  228. package/dist/cli/index.js.map +1 -1
  229. package/dist/cli/inspect.d.ts +2 -2
  230. package/dist/cli/inspect.d.ts.map +1 -1
  231. package/dist/cli/inspect.js +2 -2
  232. package/dist/cli/inspect.js.map +1 -1
  233. package/dist/cli/invocation-context.d.ts +77 -0
  234. package/dist/cli/invocation-context.d.ts.map +1 -0
  235. package/dist/cli/invocation-context.js +423 -0
  236. package/dist/cli/invocation-context.js.map +1 -0
  237. package/dist/cli/links.d.ts +2 -2
  238. package/dist/cli/links.d.ts.map +1 -1
  239. package/dist/cli/links.js +1 -1
  240. package/dist/cli/links.js.map +1 -1
  241. package/dist/cli/location.d.ts +1 -1
  242. package/dist/cli/location.d.ts.map +1 -1
  243. package/dist/cli/location.js +1 -1
  244. package/dist/cli/location.js.map +1 -1
  245. package/dist/cli/navigation.d.ts +2 -2
  246. package/dist/cli/navigation.d.ts.map +1 -1
  247. package/dist/cli/navigation.js +2 -2
  248. package/dist/cli/navigation.js.map +1 -1
  249. package/dist/cli/packet.js +1 -1
  250. package/dist/cli/packet.js.map +1 -1
  251. package/dist/cli/project-file.d.ts +13 -0
  252. package/dist/cli/project-file.d.ts.map +1 -0
  253. package/dist/cli/project-file.js +23 -0
  254. package/dist/cli/project-file.js.map +1 -0
  255. package/dist/cli/refactor-plan.d.ts +6 -0
  256. package/dist/cli/refactor-plan.d.ts.map +1 -0
  257. package/dist/cli/refactor-plan.js +84 -0
  258. package/dist/cli/refactor-plan.js.map +1 -0
  259. package/dist/cli/rename-preview.d.ts +4 -0
  260. package/dist/cli/rename-preview.d.ts.map +1 -0
  261. package/dist/cli/rename-preview.js +92 -0
  262. package/dist/cli/rename-preview.js.map +1 -0
  263. package/dist/cli/review.d.ts +2 -2
  264. package/dist/cli/review.d.ts.map +1 -1
  265. package/dist/cli/review.js +4 -4
  266. package/dist/cli/review.js.map +1 -1
  267. package/dist/cli/root-policy.d.ts +53 -0
  268. package/dist/cli/root-policy.d.ts.map +1 -0
  269. package/dist/cli/root-policy.js +221 -0
  270. package/dist/cli/root-policy.js.map +1 -0
  271. package/dist/cli/server.js +5 -5
  272. package/dist/cli/server.js.map +1 -1
  273. package/dist/cli/skill.js +1 -1
  274. package/dist/cli/skill.js.map +1 -1
  275. package/dist/cli/symbols.js +1 -1
  276. package/dist/cli/symbols.js.map +1 -1
  277. package/dist/cli/type-hierarchy.d.ts +6 -0
  278. package/dist/cli/type-hierarchy.d.ts.map +1 -0
  279. package/dist/cli/type-hierarchy.js +90 -0
  280. package/dist/cli/type-hierarchy.js.map +1 -0
  281. package/dist/cli/viewer.js +2 -2
  282. package/dist/cli/viewer.js.map +1 -1
  283. package/dist/cli-bootstrap.d.ts +3 -0
  284. package/dist/cli-bootstrap.d.ts.map +1 -0
  285. package/dist/cli-bootstrap.js +10 -0
  286. package/dist/cli-bootstrap.js.map +1 -0
  287. package/dist/cli.d.ts +1 -1
  288. package/dist/cli.d.ts.map +1 -1
  289. package/dist/cli.js +5 -5
  290. package/dist/cli.js.map +1 -1
  291. package/dist/config.d.ts +1 -1
  292. package/dist/config.d.ts.map +1 -1
  293. package/dist/config.js +0 -1
  294. package/dist/config.js.map +1 -1
  295. package/dist/document-links/asciidoc.d.ts.map +1 -0
  296. package/dist/document-links/asciidoc.js.map +1 -0
  297. package/dist/document-links/check.d.ts +32 -0
  298. package/dist/document-links/check.d.ts.map +1 -0
  299. package/dist/document-links/check.js +286 -0
  300. package/dist/document-links/check.js.map +1 -0
  301. package/dist/document-links/html.d.ts.map +1 -0
  302. package/dist/document-links/html.js.map +1 -0
  303. package/dist/document-links/markdown.d.ts.map +1 -0
  304. package/dist/document-links/markdown.js.map +1 -0
  305. package/dist/document-links/rst.d.ts.map +1 -0
  306. package/dist/document-links/rst.js.map +1 -0
  307. package/dist/document-links/sfc.d.ts.map +1 -0
  308. package/dist/document-links/sfc.js.map +1 -0
  309. package/dist/document-links/shared.d.ts.map +1 -0
  310. package/dist/document-links/shared.js.map +1 -0
  311. package/dist/document-links.d.ts +12 -0
  312. package/dist/document-links.d.ts.map +1 -0
  313. package/dist/document-links.js +49 -0
  314. package/dist/document-links.js.map +1 -0
  315. package/dist/drift/snapshot.js +2 -2
  316. package/dist/drift/snapshot.js.map +1 -1
  317. package/dist/drift/types.d.ts +2 -2
  318. package/dist/drift/types.d.ts.map +1 -1
  319. package/dist/duplicates/unit-cache.d.ts +46 -0
  320. package/dist/duplicates/unit-cache.d.ts.map +1 -0
  321. package/dist/duplicates/unit-cache.js +512 -0
  322. package/dist/duplicates/unit-cache.js.map +1 -0
  323. package/dist/duplicates/units.d.ts +1 -1
  324. package/dist/duplicates/units.d.ts.map +1 -1
  325. package/dist/duplicates/units.js +6 -6
  326. package/dist/duplicates/units.js.map +1 -1
  327. package/dist/duplicates-leads.d.ts +39 -0
  328. package/dist/duplicates-leads.d.ts.map +1 -0
  329. package/dist/duplicates-leads.js +112 -0
  330. package/dist/duplicates-leads.js.map +1 -0
  331. package/dist/duplicates.d.ts +1 -1
  332. package/dist/duplicates.d.ts.map +1 -1
  333. package/dist/duplicates.js +2 -2
  334. package/dist/duplicates.js.map +1 -1
  335. package/dist/graph-builder.d.ts +1 -1
  336. package/dist/graph-builder.d.ts.map +1 -1
  337. package/dist/graph-builder.js +4 -4
  338. package/dist/graph-builder.js.map +1 -1
  339. package/dist/graph-edge-collector.d.ts +3 -3
  340. package/dist/graph-edge-collector.d.ts.map +1 -1
  341. package/dist/graph-edge-collector.js +6 -6
  342. package/dist/graph-edge-collector.js.map +1 -1
  343. package/dist/graphs/cycles.js +1 -1
  344. package/dist/graphs/cycles.js.map +1 -1
  345. package/dist/graphs/edge-resolution.d.ts +25 -0
  346. package/dist/graphs/edge-resolution.d.ts.map +1 -0
  347. package/dist/graphs/edge-resolution.js +97 -0
  348. package/dist/graphs/edge-resolution.js.map +1 -0
  349. package/dist/graphs/grep.d.ts +1 -1
  350. package/dist/graphs/grep.d.ts.map +1 -1
  351. package/dist/graphs/grep.js +4 -4
  352. package/dist/graphs/grep.js.map +1 -1
  353. package/dist/graphs/specifiers.d.ts +1 -1
  354. package/dist/graphs/specifiers.d.ts.map +1 -1
  355. package/dist/graphs/specifiers.js +5 -5
  356. package/dist/graphs/specifiers.js.map +1 -1
  357. package/dist/graphs/symbol-graph-detailed/ast.d.ts +0 -1
  358. package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
  359. package/dist/graphs/symbol-graph-detailed/ast.js +1 -8
  360. package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
  361. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +35 -0
  362. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -0
  363. package/dist/graphs/symbol-graph-detailed/edge-passes.js +676 -0
  364. package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -0
  365. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +10 -0
  366. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -0
  367. package/dist/graphs/symbol-graph-detailed/import-aliases.js +44 -0
  368. package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -0
  369. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +17 -0
  370. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -0
  371. package/dist/graphs/symbol-graph-detailed/member-chains.js +30 -0
  372. package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -0
  373. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +69 -0
  374. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -0
  375. package/dist/graphs/symbol-graph-detailed/receiver-calls.js +408 -0
  376. package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -0
  377. package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
  378. package/dist/graphs/symbol-graph-detailed.js +22 -12
  379. package/dist/graphs/symbol-graph-detailed.js.map +1 -1
  380. package/dist/graphs/types.d.ts +1 -1
  381. package/dist/graphs/types.d.ts.map +1 -1
  382. package/dist/graphs/unresolved.js +1 -1
  383. package/dist/graphs/unresolved.js.map +1 -1
  384. package/dist/impact/analyzer.js +4 -4
  385. package/dist/impact/analyzer.js.map +1 -1
  386. package/dist/impact/call-compatibility/text-scanner.d.ts +23 -0
  387. package/dist/impact/call-compatibility/text-scanner.d.ts.map +1 -0
  388. package/dist/impact/call-compatibility/text-scanner.js +615 -0
  389. package/dist/impact/call-compatibility/text-scanner.js.map +1 -0
  390. package/dist/impact/call-compatibility.d.ts +24 -0
  391. package/dist/impact/call-compatibility.d.ts.map +1 -0
  392. package/dist/impact/call-compatibility.js +1023 -0
  393. package/dist/impact/call-compatibility.js.map +1 -0
  394. package/dist/impact/context.js +1 -1
  395. package/dist/impact/context.js.map +1 -1
  396. package/dist/impact/direct.d.ts +1 -1
  397. package/dist/impact/direct.d.ts.map +1 -1
  398. package/dist/impact/index.d.ts +1 -1
  399. package/dist/impact/index.d.ts.map +1 -1
  400. package/dist/impact/index.js +1 -1
  401. package/dist/impact/index.js.map +1 -1
  402. package/dist/impact/map.js +1 -1
  403. package/dist/impact/map.js.map +1 -1
  404. package/dist/impact/member-resolution-coverage.d.ts +14 -0
  405. package/dist/impact/member-resolution-coverage.d.ts.map +1 -0
  406. package/dist/impact/member-resolution-coverage.js +42 -0
  407. package/dist/impact/member-resolution-coverage.js.map +1 -0
  408. package/dist/impact/reference-cache.d.ts +12 -0
  409. package/dist/impact/reference-cache.d.ts.map +1 -0
  410. package/dist/impact/reference-cache.js +101 -0
  411. package/dist/impact/reference-cache.js.map +1 -0
  412. package/dist/impact/report-compact.d.ts +8 -0
  413. package/dist/impact/report-compact.d.ts.map +1 -0
  414. package/dist/impact/report-compact.js +153 -0
  415. package/dist/impact/report-compact.js.map +1 -0
  416. package/dist/impact/report-full.d.ts +10 -0
  417. package/dist/impact/report-full.d.ts.map +1 -0
  418. package/dist/impact/report-full.js +67 -0
  419. package/dist/impact/report-full.js.map +1 -0
  420. package/dist/impact/report-parts.d.ts +51 -0
  421. package/dist/impact/report-parts.d.ts.map +1 -0
  422. package/dist/impact/report-parts.js +2 -0
  423. package/dist/impact/report-parts.js.map +1 -0
  424. package/dist/impact/report-shared.d.ts +76 -0
  425. package/dist/impact/report-shared.d.ts.map +1 -0
  426. package/dist/impact/report-shared.js +130 -0
  427. package/dist/impact/report-shared.js.map +1 -0
  428. package/dist/impact/report-suggestions.js +2 -2
  429. package/dist/impact/report-suggestions.js.map +1 -1
  430. package/dist/impact/report.js +5 -5
  431. package/dist/impact/report.js.map +1 -1
  432. package/dist/impact/streaming.d.ts +1 -1
  433. package/dist/impact/streaming.d.ts.map +1 -1
  434. package/dist/impact/streaming.js +2 -2
  435. package/dist/impact/streaming.js.map +1 -1
  436. package/dist/impact/test-patterns.d.ts +6 -0
  437. package/dist/impact/test-patterns.d.ts.map +1 -0
  438. package/dist/impact/test-patterns.js +65 -0
  439. package/dist/impact/test-patterns.js.map +1 -0
  440. package/dist/impact/transitive.js +1 -1
  441. package/dist/impact/transitive.js.map +1 -1
  442. package/dist/impact/types.d.ts +3 -3
  443. package/dist/impact/types.d.ts.map +1 -1
  444. package/dist/impact/types.js +1 -1
  445. package/dist/impact/types.js.map +1 -1
  446. package/dist/index.d.ts +10 -10
  447. package/dist/index.d.ts.map +1 -1
  448. package/dist/index.js +9 -9
  449. package/dist/index.js.map +1 -1
  450. package/dist/indexer/build-cache/manifest.d.ts +4 -4
  451. package/dist/indexer/build-cache/manifest.d.ts.map +1 -1
  452. package/dist/indexer/build-cache/manifest.js +9 -34
  453. package/dist/indexer/build-cache/manifest.js.map +1 -1
  454. package/dist/indexer/build-cache/module-cache.d.ts +1 -1
  455. package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
  456. package/dist/indexer/build-cache/module-cache.js +4 -4
  457. package/dist/indexer/build-cache/module-cache.js.map +1 -1
  458. package/dist/indexer/build-cache/options.d.ts +6 -4
  459. package/dist/indexer/build-cache/options.d.ts.map +1 -1
  460. package/dist/indexer/build-cache/options.js +9 -7
  461. package/dist/indexer/build-cache/options.js.map +1 -1
  462. package/dist/indexer/build-cache/project-snapshot.d.ts +1 -1
  463. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  464. package/dist/indexer/build-cache/project-snapshot.js +16 -19
  465. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  466. package/dist/indexer/build-cache/reports.js +1 -1
  467. package/dist/indexer/build-cache/reports.js.map +1 -1
  468. package/dist/indexer/build-cache/resolver-environment.d.ts +6 -2
  469. package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
  470. package/dist/indexer/build-cache/resolver-environment.js +41 -5
  471. package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
  472. package/dist/indexer/build-index.d.ts.map +1 -1
  473. package/dist/indexer/build-index.js +63 -29
  474. package/dist/indexer/build-index.js.map +1 -1
  475. package/dist/indexer/build-manifest.d.ts +3 -0
  476. package/dist/indexer/build-manifest.d.ts.map +1 -1
  477. package/dist/indexer/build-manifest.js +1 -1
  478. package/dist/indexer/build-manifest.js.map +1 -1
  479. package/dist/indexer/build-workers.d.ts +1 -1
  480. package/dist/indexer/build-workers.d.ts.map +1 -1
  481. package/dist/indexer/build-workers.js +6 -6
  482. package/dist/indexer/build-workers.js.map +1 -1
  483. package/dist/indexer/finalize.d.ts +3 -2
  484. package/dist/indexer/finalize.d.ts.map +1 -1
  485. package/dist/indexer/finalize.js +2 -1
  486. package/dist/indexer/finalize.js.map +1 -1
  487. package/dist/indexer/imports/graph-only.d.ts +13 -0
  488. package/dist/indexer/imports/graph-only.d.ts.map +1 -0
  489. package/dist/indexer/imports/graph-only.js +40 -0
  490. package/dist/indexer/imports/graph-only.js.map +1 -0
  491. package/dist/indexer/imports/js-text-imports.d.ts +9 -0
  492. package/dist/indexer/imports/js-text-imports.d.ts.map +1 -0
  493. package/dist/indexer/imports/js-text-imports.js +181 -0
  494. package/dist/indexer/imports/js-text-imports.js.map +1 -0
  495. package/dist/indexer/imports/language-specific.d.ts +26 -0
  496. package/dist/indexer/imports/language-specific.d.ts.map +1 -0
  497. package/dist/indexer/imports/language-specific.js +449 -0
  498. package/dist/indexer/imports/language-specific.js.map +1 -0
  499. package/dist/indexer/imports/native-captures.d.ts +16 -0
  500. package/dist/indexer/imports/native-captures.d.ts.map +1 -0
  501. package/dist/indexer/imports/native-captures.js +142 -0
  502. package/dist/indexer/imports/native-captures.js.map +1 -0
  503. package/dist/indexer/imports.d.ts +1 -1
  504. package/dist/indexer/imports.d.ts.map +1 -1
  505. package/dist/indexer/imports.js +7 -7
  506. package/dist/indexer/imports.js.map +1 -1
  507. package/dist/indexer/incremental-plan.d.ts +4 -3
  508. package/dist/indexer/incremental-plan.d.ts.map +1 -1
  509. package/dist/indexer/incremental-plan.js +9 -5
  510. package/dist/indexer/incremental-plan.js.map +1 -1
  511. package/dist/indexer/locals-and-exports.d.ts +1 -1
  512. package/dist/indexer/locals-and-exports.d.ts.map +1 -1
  513. package/dist/indexer/locals-and-exports.js +5 -5
  514. package/dist/indexer/locals-and-exports.js.map +1 -1
  515. package/dist/indexer/navigation-goto.js +1 -1
  516. package/dist/indexer/navigation-goto.js.map +1 -1
  517. package/dist/indexer/navigation-local.d.ts +2 -1
  518. package/dist/indexer/navigation-local.d.ts.map +1 -1
  519. package/dist/indexer/navigation-local.js +26 -21
  520. package/dist/indexer/navigation-local.js.map +1 -1
  521. package/dist/indexer/navigation.js +1 -1
  522. package/dist/indexer/navigation.js.map +1 -1
  523. package/dist/indexer/parse-context.d.ts +2 -2
  524. package/dist/indexer/parse-context.d.ts.map +1 -1
  525. package/dist/indexer/parse-context.js +5 -5
  526. package/dist/indexer/parse-context.js.map +1 -1
  527. package/dist/indexer/scope.d.ts +1 -1
  528. package/dist/indexer/scope.d.ts.map +1 -1
  529. package/dist/indexer/scope.js +2 -2
  530. package/dist/indexer/scope.js.map +1 -1
  531. package/dist/indexer/shared.d.ts +1 -1
  532. package/dist/indexer/shared.d.ts.map +1 -1
  533. package/dist/indexer/shared.js +1 -1
  534. package/dist/indexer/shared.js.map +1 -1
  535. package/dist/indexer/symbols.js +1 -1
  536. package/dist/indexer/symbols.js.map +1 -1
  537. package/dist/indexer/types.d.ts +4 -2
  538. package/dist/indexer/types.d.ts.map +1 -1
  539. package/dist/indexer.d.ts +2 -2
  540. package/dist/indexer.d.ts.map +1 -1
  541. package/dist/installer/locks.js +1 -1
  542. package/dist/installer/locks.js.map +1 -1
  543. package/dist/installer/registry.js +1 -1
  544. package/dist/installer/registry.js.map +1 -1
  545. package/dist/languages/definitions/adoc.js +1 -1
  546. package/dist/languages/definitions/adoc.js.map +1 -1
  547. package/dist/languages/definitions/astro.js +1 -1
  548. package/dist/languages/definitions/astro.js.map +1 -1
  549. package/dist/languages/definitions/c-family.d.ts +34 -0
  550. package/dist/languages/definitions/c-family.d.ts.map +1 -0
  551. package/dist/languages/definitions/c-family.js +177 -0
  552. package/dist/languages/definitions/c-family.js.map +1 -0
  553. package/dist/languages/definitions/c.js +1 -1
  554. package/dist/languages/definitions/c.js.map +1 -1
  555. package/dist/languages/definitions/cpp.js +1 -1
  556. package/dist/languages/definitions/cpp.js.map +1 -1
  557. package/dist/languages/definitions/css-like.d.ts +5 -0
  558. package/dist/languages/definitions/css-like.d.ts.map +1 -0
  559. package/dist/languages/definitions/css-like.js +32 -0
  560. package/dist/languages/definitions/css-like.js.map +1 -0
  561. package/dist/languages/definitions/css.js +1 -1
  562. package/dist/languages/definitions/css.js.map +1 -1
  563. package/dist/languages/definitions/hbs.js +1 -1
  564. package/dist/languages/definitions/hbs.js.map +1 -1
  565. package/dist/languages/definitions/html-stub.d.ts +18 -0
  566. package/dist/languages/definitions/html-stub.d.ts.map +1 -0
  567. package/dist/languages/definitions/html-stub.js +36 -0
  568. package/dist/languages/definitions/html-stub.js.map +1 -0
  569. package/dist/languages/definitions/javascript.js +1 -1
  570. package/dist/languages/definitions/javascript.js.map +1 -1
  571. package/dist/languages/definitions/js-family.d.ts +5 -0
  572. package/dist/languages/definitions/js-family.d.ts.map +1 -0
  573. package/dist/languages/definitions/js-family.js +75 -0
  574. package/dist/languages/definitions/js-family.js.map +1 -0
  575. package/dist/languages/definitions/less.js +1 -1
  576. package/dist/languages/definitions/less.js.map +1 -1
  577. package/dist/languages/definitions/markdown.js +1 -1
  578. package/dist/languages/definitions/markdown.js.map +1 -1
  579. package/dist/languages/definitions/mdx.js +1 -1
  580. package/dist/languages/definitions/mdx.js.map +1 -1
  581. package/dist/languages/definitions/rst.js +1 -1
  582. package/dist/languages/definitions/rst.js.map +1 -1
  583. package/dist/languages/definitions/typescript.js +1 -1
  584. package/dist/languages/definitions/typescript.js.map +1 -1
  585. package/dist/languages/file-prep.d.ts +36 -0
  586. package/dist/languages/file-prep.d.ts.map +1 -0
  587. package/dist/languages/file-prep.js +76 -0
  588. package/dist/languages/file-prep.js.map +1 -0
  589. package/dist/languages/import-statement-parsers.d.ts +57 -0
  590. package/dist/languages/import-statement-parsers.d.ts.map +1 -0
  591. package/dist/languages/import-statement-parsers.js +383 -0
  592. package/dist/languages/import-statement-parsers.js.map +1 -0
  593. package/dist/languages/query-generator.d.ts +6 -0
  594. package/dist/languages/query-generator.d.ts.map +1 -0
  595. package/dist/languages/query-generator.js +46 -0
  596. package/dist/languages/query-generator.js.map +1 -0
  597. package/dist/lifecycle/manifest.d.ts +1 -1
  598. package/dist/lifecycle/manifest.d.ts.map +1 -1
  599. package/dist/lifecycle/manifest.js +6 -4
  600. package/dist/lifecycle/manifest.js.map +1 -1
  601. package/dist/mcp/handlers.d.ts +7 -7
  602. package/dist/mcp/handlers.d.ts.map +1 -1
  603. package/dist/mcp/handlers.js +12 -15
  604. package/dist/mcp/handlers.js.map +1 -1
  605. package/dist/mcp/http-transport.d.ts +14 -0
  606. package/dist/mcp/http-transport.d.ts.map +1 -0
  607. package/dist/mcp/http-transport.js +185 -0
  608. package/dist/mcp/http-transport.js.map +1 -0
  609. package/dist/mcp/legacy-sessions.d.ts +38 -0
  610. package/dist/mcp/legacy-sessions.d.ts.map +1 -0
  611. package/dist/mcp/legacy-sessions.js +264 -0
  612. package/dist/mcp/legacy-sessions.js.map +1 -0
  613. package/dist/mcp/lifecycle-health.d.ts +12 -0
  614. package/dist/mcp/lifecycle-health.d.ts.map +1 -0
  615. package/dist/mcp/lifecycle-health.js +37 -0
  616. package/dist/mcp/lifecycle-health.js.map +1 -0
  617. package/dist/mcp/protocol.d.ts +1 -1
  618. package/dist/mcp/protocol.d.ts.map +1 -1
  619. package/dist/mcp/protocol.js +3 -3
  620. package/dist/mcp/protocol.js.map +1 -1
  621. package/dist/mcp/security.js +1 -1
  622. package/dist/mcp/security.js.map +1 -1
  623. package/dist/mcp/server.d.ts +4 -4
  624. package/dist/mcp/server.d.ts.map +1 -1
  625. package/dist/mcp/server.js +6 -6
  626. package/dist/mcp/server.js.map +1 -1
  627. package/dist/mcp/sqlite-guard.d.ts +3 -0
  628. package/dist/mcp/sqlite-guard.d.ts.map +1 -0
  629. package/dist/mcp/sqlite-guard.js +35 -0
  630. package/dist/mcp/sqlite-guard.js.map +1 -0
  631. package/dist/mcp/stdio-lifecycle.d.ts +23 -0
  632. package/dist/mcp/stdio-lifecycle.d.ts.map +1 -0
  633. package/dist/mcp/stdio-lifecycle.js +83 -0
  634. package/dist/mcp/stdio-lifecycle.js.map +1 -0
  635. package/dist/mcp/tools.js +2 -2
  636. package/dist/mcp/tools.js.map +1 -1
  637. package/dist/native/binding-loader.d.ts +51 -0
  638. package/dist/native/binding-loader.d.ts.map +1 -0
  639. package/dist/native/binding-loader.js +223 -0
  640. package/dist/native/binding-loader.js.map +1 -0
  641. package/dist/native/byte-index.d.ts +26 -0
  642. package/dist/native/byte-index.d.ts.map +1 -0
  643. package/dist/native/byte-index.js +70 -0
  644. package/dist/native/byte-index.js.map +1 -0
  645. package/dist/native/execution.js +1 -1
  646. package/dist/native/execution.js.map +1 -1
  647. package/dist/native/js-bridge.d.ts +7 -0
  648. package/dist/native/js-bridge.d.ts.map +1 -0
  649. package/dist/native/js-bridge.js +20 -0
  650. package/dist/native/js-bridge.js.map +1 -0
  651. package/dist/native/native-backend-report.d.ts +22 -0
  652. package/dist/native/native-backend-report.d.ts.map +1 -0
  653. package/dist/native/native-backend-report.js +102 -0
  654. package/dist/native/native-backend-report.js.map +1 -0
  655. package/dist/native/projected-tree.d.ts +53 -0
  656. package/dist/native/projected-tree.d.ts.map +1 -0
  657. package/dist/native/projected-tree.js +180 -0
  658. package/dist/native/projected-tree.js.map +1 -0
  659. package/dist/native/query-results.d.ts +12 -0
  660. package/dist/native/query-results.d.ts.map +1 -0
  661. package/dist/native/query-results.js +34 -0
  662. package/dist/native/query-results.js.map +1 -0
  663. package/dist/native/runtime-cache.d.ts +128 -0
  664. package/dist/native/runtime-cache.d.ts.map +1 -0
  665. package/dist/native/runtime-cache.js +667 -0
  666. package/dist/native/runtime-cache.js.map +1 -0
  667. package/dist/native/runtime.js +3 -3
  668. package/dist/native/runtime.js.map +1 -1
  669. package/dist/native/tree-shape.d.ts +21 -0
  670. package/dist/native/tree-shape.d.ts.map +1 -0
  671. package/dist/native/tree-shape.js +28 -0
  672. package/dist/native/tree-shape.js.map +1 -0
  673. package/dist/native/tree-sitter-native.d.ts +6 -0
  674. package/dist/native/tree-sitter-native.d.ts.map +1 -0
  675. package/dist/native/tree-sitter-native.js +5 -0
  676. package/dist/native/tree-sitter-native.js.map +1 -0
  677. package/dist/review/deleted.js +2 -2
  678. package/dist/review/deleted.js.map +1 -1
  679. package/dist/review/report.d.ts +3 -3
  680. package/dist/review/report.d.ts.map +1 -1
  681. package/dist/review/report.js +2 -2
  682. package/dist/review/report.js.map +1 -1
  683. package/dist/review/summaries.js +3 -3
  684. package/dist/review/summaries.js.map +1 -1
  685. package/dist/review/types.d.ts +3 -3
  686. package/dist/review/types.d.ts.map +1 -1
  687. package/dist/review.js +3 -3
  688. package/dist/review.js.map +1 -1
  689. package/dist/runtime-identity.d.ts +27 -0
  690. package/dist/runtime-identity.d.ts.map +1 -0
  691. package/dist/runtime-identity.js +75 -0
  692. package/dist/runtime-identity.js.map +1 -0
  693. package/dist/session.js +1 -1
  694. package/dist/session.js.map +1 -1
  695. package/dist/sql/classify-sql-file.d.ts +3 -0
  696. package/dist/sql/classify-sql-file.d.ts.map +1 -0
  697. package/dist/sql/classify-sql-file.js +42 -0
  698. package/dist/sql/classify-sql-file.js.map +1 -0
  699. package/dist/sql/extract-facts.d.ts +4 -0
  700. package/dist/sql/extract-facts.d.ts.map +1 -0
  701. package/dist/sql/extract-facts.js +511 -0
  702. package/dist/sql/extract-facts.js.map +1 -0
  703. package/dist/sql/graph.js +1 -1
  704. package/dist/sql/graph.js.map +1 -1
  705. package/dist/sql/index.d.ts +2 -2
  706. package/dist/sql/index.d.ts.map +1 -1
  707. package/dist/sql/index.js +2 -2
  708. package/dist/sql/index.js.map +1 -1
  709. package/dist/sql/navigation.js +1 -1
  710. package/dist/sql/navigation.js.map +1 -1
  711. package/dist/sql/review.js +2 -2
  712. package/dist/sql/review.js.map +1 -1
  713. package/dist/sql/source-graph.d.ts +19 -0
  714. package/dist/sql/source-graph.d.ts.map +1 -0
  715. package/dist/sql/source-graph.js +195 -0
  716. package/dist/sql/source-graph.js.map +1 -0
  717. package/dist/sqlite/query.d.ts +2 -2
  718. package/dist/sqlite/query.d.ts.map +1 -1
  719. package/dist/sqlite/query.js +3 -3
  720. package/dist/sqlite/query.js.map +1 -1
  721. package/dist/sqlite/raw-query-worker-pool.d.ts +66 -0
  722. package/dist/sqlite/raw-query-worker-pool.d.ts.map +1 -0
  723. package/dist/sqlite/raw-query-worker-pool.js +146 -0
  724. package/dist/sqlite/raw-query-worker-pool.js.map +1 -0
  725. package/dist/sqlite/raw-query-worker.d.ts +22 -0
  726. package/dist/sqlite/raw-query-worker.d.ts.map +1 -0
  727. package/dist/sqlite/raw-query-worker.js +31 -0
  728. package/dist/sqlite/raw-query-worker.js.map +1 -0
  729. package/dist/sqlite/row-bounds.d.ts +24 -0
  730. package/dist/sqlite/row-bounds.d.ts.map +1 -0
  731. package/dist/sqlite/row-bounds.js +95 -0
  732. package/dist/sqlite/row-bounds.js.map +1 -0
  733. package/dist/sqlite-driver.js +1 -1
  734. package/dist/sqlite-driver.js.map +1 -1
  735. package/dist/util/bloom-filter.d.ts +100 -0
  736. package/dist/util/bloom-filter.d.ts.map +1 -0
  737. package/dist/util/bloom-filter.js +206 -0
  738. package/dist/util/bloom-filter.js.map +1 -0
  739. package/dist/util/confined-file.d.ts +48 -0
  740. package/dist/util/confined-file.d.ts.map +1 -0
  741. package/dist/util/confined-file.js +164 -0
  742. package/dist/util/confined-file.js.map +1 -0
  743. package/dist/util/discovery-path.d.ts +3 -0
  744. package/dist/util/discovery-path.d.ts.map +1 -0
  745. package/dist/util/discovery-path.js +19 -0
  746. package/dist/util/discovery-path.js.map +1 -0
  747. package/dist/util/git.d.ts +13 -10
  748. package/dist/util/git.d.ts.map +1 -1
  749. package/dist/util/git.js +29 -25
  750. package/dist/util/git.js.map +1 -1
  751. package/dist/util/graph-edges.d.ts +5 -0
  752. package/dist/util/graph-edges.d.ts.map +1 -0
  753. package/dist/util/graph-edges.js +42 -0
  754. package/dist/util/graph-edges.js.map +1 -0
  755. package/dist/util/graph-only-extensions.d.ts +5 -0
  756. package/dist/util/graph-only-extensions.d.ts.map +1 -0
  757. package/dist/util/graph-only-extensions.js +12 -0
  758. package/dist/util/graph-only-extensions.js.map +1 -0
  759. package/dist/util/include-roots.d.ts +6 -0
  760. package/dist/util/include-roots.d.ts.map +1 -0
  761. package/dist/util/include-roots.js +53 -0
  762. package/dist/util/include-roots.js.map +1 -0
  763. package/dist/util/lazy-symbols.d.ts +166 -0
  764. package/dist/util/lazy-symbols.d.ts.map +1 -0
  765. package/dist/util/lazy-symbols.js +365 -0
  766. package/dist/util/lazy-symbols.js.map +1 -0
  767. package/dist/util/lru-map.d.ts +3 -0
  768. package/dist/util/lru-map.d.ts.map +1 -0
  769. package/dist/util/lru-map.js +22 -0
  770. package/dist/util/lru-map.js.map +1 -0
  771. package/dist/util/member-access.d.ts +26 -0
  772. package/dist/util/member-access.d.ts.map +1 -0
  773. package/dist/util/member-access.js +185 -0
  774. package/dist/util/member-access.js.map +1 -0
  775. package/dist/util/package-exports.d.ts +25 -0
  776. package/dist/util/package-exports.d.ts.map +1 -0
  777. package/dist/util/package-exports.js +79 -0
  778. package/dist/util/package-exports.js.map +1 -0
  779. package/dist/util/package-info.d.ts +12 -0
  780. package/dist/util/package-info.d.ts.map +1 -0
  781. package/dist/util/package-info.js +57 -0
  782. package/dist/util/package-info.js.map +1 -0
  783. package/dist/util/partial-results.d.ts +81 -0
  784. package/dist/util/partial-results.d.ts.map +1 -0
  785. package/dist/util/partial-results.js +290 -0
  786. package/dist/util/partial-results.js.map +1 -0
  787. package/dist/util/project-files/definitions.d.ts +40 -0
  788. package/dist/util/project-files/definitions.d.ts.map +1 -0
  789. package/dist/util/project-files/definitions.js.map +1 -0
  790. package/dist/util/project-files/parsers.d.ts.map +1 -0
  791. package/dist/util/project-files/parsers.js.map +1 -0
  792. package/dist/util/project-files.d.ts +153 -0
  793. package/dist/util/project-files.d.ts.map +1 -0
  794. package/dist/util/project-files.js +1460 -0
  795. package/dist/util/project-files.js.map +1 -0
  796. package/dist/util/resolution/find-first-existing.d.ts +2 -0
  797. package/dist/util/resolution/find-first-existing.d.ts.map +1 -0
  798. package/dist/util/resolution/find-first-existing.js +13 -0
  799. package/dist/util/resolution/find-first-existing.js.map +1 -0
  800. package/dist/util/resolution/jvm.js +1 -1
  801. package/dist/util/resolution/jvm.js.map +1 -1
  802. package/dist/util/resolution/node.d.ts +1 -1
  803. package/dist/util/resolution/node.d.ts.map +1 -1
  804. package/dist/util/resolution/node.js +2 -2
  805. package/dist/util/resolution/node.js.map +1 -1
  806. package/dist/util/resolution/php-composer.d.ts +17 -0
  807. package/dist/util/resolution/php-composer.d.ts.map +1 -0
  808. package/dist/util/resolution/php-composer.js +269 -0
  809. package/dist/util/resolution/php-composer.js.map +1 -0
  810. package/dist/util/resolution/php.d.ts +1 -1
  811. package/dist/util/resolution/php.d.ts.map +1 -1
  812. package/dist/util/resolution/php.js +4 -4
  813. package/dist/util/resolution/php.js.map +1 -1
  814. package/dist/util/resolution/project-symbols.d.ts +14 -0
  815. package/dist/util/resolution/project-symbols.d.ts.map +1 -0
  816. package/dist/util/resolution/project-symbols.js +70 -0
  817. package/dist/util/resolution/project-symbols.js.map +1 -0
  818. package/dist/util/resolution/tsconfig.d.ts +7 -0
  819. package/dist/util/resolution/tsconfig.d.ts.map +1 -1
  820. package/dist/util/resolution/tsconfig.js +23 -8
  821. package/dist/util/resolution/tsconfig.js.map +1 -1
  822. package/dist/util/resolution-candidates.d.ts +5 -0
  823. package/dist/util/resolution-candidates.d.ts.map +1 -0
  824. package/dist/util/resolution-candidates.js +70 -0
  825. package/dist/util/resolution-candidates.js.map +1 -0
  826. package/dist/util/resolution.d.ts +2 -2
  827. package/dist/util/resolution.d.ts.map +1 -1
  828. package/dist/util/resolution.js +6 -6
  829. package/dist/util/resolution.js.map +1 -1
  830. package/dist/util/rust-test-modules.d.ts +3 -0
  831. package/dist/util/rust-test-modules.d.ts.map +1 -0
  832. package/dist/util/rust-test-modules.js +71 -0
  833. package/dist/util/rust-test-modules.js.map +1 -0
  834. package/dist/util/source-location.d.ts +8 -0
  835. package/dist/util/source-location.d.ts.map +1 -0
  836. package/dist/util/source-location.js +19 -0
  837. package/dist/util/source-location.js.map +1 -0
  838. package/dist/util/sqlite-schema.d.ts +28 -0
  839. package/dist/util/sqlite-schema.d.ts.map +1 -0
  840. package/dist/util/sqlite-schema.js +75 -0
  841. package/dist/util/sqlite-schema.js.map +1 -0
  842. package/dist/util/symbol-hash.d.ts +59 -0
  843. package/dist/util/symbol-hash.d.ts.map +1 -0
  844. package/dist/util/symbol-hash.js +84 -0
  845. package/dist/util/symbol-hash.js.map +1 -0
  846. package/dist/util/windows-process-drain.d.ts +23 -0
  847. package/dist/util/windows-process-drain.d.ts.map +1 -0
  848. package/dist/util/windows-process-drain.js +51 -0
  849. package/dist/util/windows-process-drain.js.map +1 -0
  850. package/dist/util/worker-threads.d.ts +12 -0
  851. package/dist/util/worker-threads.d.ts.map +1 -0
  852. package/dist/util/worker-threads.js +19 -0
  853. package/dist/util/worker-threads.js.map +1 -0
  854. package/dist/util/workspace.d.ts +1 -1
  855. package/dist/util/workspace.d.ts.map +1 -1
  856. package/dist/util/workspace.js +2 -2
  857. package/dist/util/workspace.js.map +1 -1
  858. package/dist/util.d.ts +2 -2
  859. package/dist/util.d.ts.map +1 -1
  860. package/dist/util.js +1 -1
  861. package/dist/util.js.map +1 -1
  862. package/dist/worker/native-extract-worker.d.ts +77 -0
  863. package/dist/worker/native-extract-worker.d.ts.map +1 -0
  864. package/dist/worker/native-extract-worker.js +272 -0
  865. package/dist/worker/native-extract-worker.js.map +1 -0
  866. package/dist/worker/native-worker-pool.d.ts +16 -0
  867. package/dist/worker/native-worker-pool.d.ts.map +1 -0
  868. package/dist/worker/native-worker-pool.js +54 -0
  869. package/dist/worker/native-worker-pool.js.map +1 -0
  870. package/docs/mcp.md +2 -2
  871. package/package.json +4 -4
  872. package/dist/agent/callHierarchy.d.ts +0 -28
  873. package/dist/agent/callHierarchy.d.ts.map +0 -1
  874. package/dist/agent/callHierarchy.js +0 -82
  875. package/dist/agent/callHierarchy.js.map +0 -1
  876. package/dist/agent/candidateTests.d.ts +0 -12
  877. package/dist/agent/candidateTests.d.ts.map +0 -1
  878. package/dist/agent/candidateTests.js +0 -17
  879. package/dist/agent/candidateTests.js.map +0 -1
  880. package/dist/agent/fileView.d.ts +0 -55
  881. package/dist/agent/fileView.d.ts.map +0 -1
  882. package/dist/agent/fileView.js +0 -521
  883. package/dist/agent/fileView.js.map +0 -1
  884. package/dist/agent/followUps.d.ts +0 -10
  885. package/dist/agent/followUps.d.ts.map +0 -1
  886. package/dist/agent/followUps.js +0 -175
  887. package/dist/agent/followUps.js.map +0 -1
  888. package/dist/agent/query-index/queryIndexWorker.d.ts +0 -8
  889. package/dist/agent/query-index/queryIndexWorker.d.ts.map +0 -1
  890. package/dist/agent/query-index/queryIndexWorker.js +0 -11
  891. package/dist/agent/query-index/queryIndexWorker.js.map +0 -1
  892. package/dist/agent/query-index/sessionStore.d.ts +0 -5
  893. package/dist/agent/query-index/sessionStore.d.ts.map +0 -1
  894. package/dist/agent/query-index/sessionStore.js +0 -69
  895. package/dist/agent/query-index/sessionStore.js.map +0 -1
  896. package/dist/agent/query-index/sourceIdentity.d.ts +0 -3
  897. package/dist/agent/query-index/sourceIdentity.d.ts.map +0 -1
  898. package/dist/agent/query-index/sourceIdentity.js +0 -12
  899. package/dist/agent/query-index/sourceIdentity.js.map +0 -1
  900. package/dist/agent/query-index/workerPool.d.ts +0 -27
  901. package/dist/agent/query-index/workerPool.d.ts.map +0 -1
  902. package/dist/agent/query-index/workerPool.js +0 -114
  903. package/dist/agent/query-index/workerPool.js.map +0 -1
  904. package/dist/agent/refactorPlan.d.ts +0 -40
  905. package/dist/agent/refactorPlan.d.ts.map +0 -1
  906. package/dist/agent/refactorPlan.js +0 -226
  907. package/dist/agent/refactorPlan.js.map +0 -1
  908. package/dist/agent/renamePreview.d.ts +0 -57
  909. package/dist/agent/renamePreview.d.ts.map +0 -1
  910. package/dist/agent/renamePreview.js +0 -1062
  911. package/dist/agent/renamePreview.js.map +0 -1
  912. package/dist/agent/semanticSymbols.d.ts +0 -16
  913. package/dist/agent/semanticSymbols.d.ts.map +0 -1
  914. package/dist/agent/semanticSymbols.js +0 -97
  915. package/dist/agent/semanticSymbols.js.map +0 -1
  916. package/dist/agent/sessionLifecycle.d.ts +0 -5
  917. package/dist/agent/sessionLifecycle.d.ts.map +0 -1
  918. package/dist/agent/sessionLifecycle.js +0 -18
  919. package/dist/agent/sessionLifecycle.js.map +0 -1
  920. package/dist/agent/symbolLookup.d.ts +0 -12
  921. package/dist/agent/symbolLookup.d.ts.map +0 -1
  922. package/dist/agent/symbolLookup.js +0 -26
  923. package/dist/agent/symbolLookup.js.map +0 -1
  924. package/dist/agent/typeHierarchy.d.ts +0 -39
  925. package/dist/agent/typeHierarchy.d.ts.map +0 -1
  926. package/dist/agent/typeHierarchy.js +0 -125
  927. package/dist/agent/typeHierarchy.js.map +0 -1
  928. package/dist/agent/workspaceSymbols.d.ts +0 -18
  929. package/dist/agent/workspaceSymbols.d.ts.map +0 -1
  930. package/dist/agent/workspaceSymbols.js +0 -75
  931. package/dist/agent/workspaceSymbols.js.map +0 -1
  932. package/dist/analysisSummary.d.ts +0 -19
  933. package/dist/analysisSummary.d.ts.map +0 -1
  934. package/dist/analysisSummary.js +0 -80
  935. package/dist/analysisSummary.js.map +0 -1
  936. package/dist/bin/queryIndexWorker.js +0 -4382
  937. package/dist/bin/rawQueryWorker.js +0 -383
  938. package/dist/bootstrap/treeSitterLanguages.d.ts +0 -5
  939. package/dist/bootstrap/treeSitterLanguages.d.ts.map +0 -1
  940. package/dist/bootstrap/treeSitterLanguages.js +0 -41
  941. package/dist/bootstrap/treeSitterLanguages.js.map +0 -1
  942. package/dist/chunking/chunkBlocks.d.ts +0 -9
  943. package/dist/chunking/chunkBlocks.d.ts.map +0 -1
  944. package/dist/chunking/chunkBlocks.js +0 -60
  945. package/dist/chunking/chunkBlocks.js.map +0 -1
  946. package/dist/chunking/chunkFile.d.ts +0 -39
  947. package/dist/chunking/chunkFile.d.ts.map +0 -1
  948. package/dist/chunking/chunkFile.js +0 -152
  949. package/dist/chunking/chunkFile.js.map +0 -1
  950. package/dist/chunking/chunkId.d.ts +0 -7
  951. package/dist/chunking/chunkId.d.ts.map +0 -1
  952. package/dist/chunking/chunkId.js +0 -30
  953. package/dist/chunking/chunkId.js.map +0 -1
  954. package/dist/chunking/chunkMatches.d.ts +0 -4
  955. package/dist/chunking/chunkMatches.d.ts.map +0 -1
  956. package/dist/chunking/chunkMatches.js +0 -65
  957. package/dist/chunking/chunkMatches.js.map +0 -1
  958. package/dist/chunking/chunkMerge.d.ts +0 -4
  959. package/dist/chunking/chunkMerge.d.ts.map +0 -1
  960. package/dist/chunking/chunkMerge.js +0 -144
  961. package/dist/chunking/chunkMerge.js.map +0 -1
  962. package/dist/chunking/chunkSFC.d.ts +0 -18
  963. package/dist/chunking/chunkSFC.d.ts.map +0 -1
  964. package/dist/chunking/chunkSFC.js +0 -165
  965. package/dist/chunking/chunkSFC.js.map +0 -1
  966. package/dist/chunking/chunkSplit.d.ts +0 -6
  967. package/dist/chunking/chunkSplit.d.ts.map +0 -1
  968. package/dist/chunking/chunkSplit.js +0 -155
  969. package/dist/chunking/chunkSplit.js.map +0 -1
  970. package/dist/chunking/chunkTextFile.d.ts +0 -28
  971. package/dist/chunking/chunkTextFile.d.ts.map +0 -1
  972. package/dist/chunking/chunkTextFile.js +0 -107
  973. package/dist/chunking/chunkTextFile.js.map +0 -1
  974. package/dist/chunking/languageConfig.d.ts +0 -35
  975. package/dist/chunking/languageConfig.d.ts.map +0 -1
  976. package/dist/chunking/languageConfig.js +0 -24
  977. package/dist/chunking/languageConfig.js.map +0 -1
  978. package/dist/cli/callHierarchy.d.ts +0 -6
  979. package/dist/cli/callHierarchy.d.ts.map +0 -1
  980. package/dist/cli/callHierarchy.js +0 -72
  981. package/dist/cli/callHierarchy.js.map +0 -1
  982. package/dist/cli/commandCatalog.d.ts +0 -14
  983. package/dist/cli/commandCatalog.d.ts.map +0 -1
  984. package/dist/cli/commandCatalog.js +0 -118
  985. package/dist/cli/commandCatalog.js.map +0 -1
  986. package/dist/cli/commandTable.d.ts +0 -16
  987. package/dist/cli/commandTable.d.ts.map +0 -1
  988. package/dist/cli/commandTable.js +0 -758
  989. package/dist/cli/commandTable.js.map +0 -1
  990. package/dist/cli/compileCache.d.ts +0 -22
  991. package/dist/cli/compileCache.d.ts.map +0 -1
  992. package/dist/cli/compileCache.js +0 -81
  993. package/dist/cli/compileCache.js.map +0 -1
  994. package/dist/cli/discoveryGlobs.d.ts +0 -11
  995. package/dist/cli/discoveryGlobs.d.ts.map +0 -1
  996. package/dist/cli/discoveryGlobs.js +0 -74
  997. package/dist/cli/discoveryGlobs.js.map +0 -1
  998. package/dist/cli/duplicateSimilarity.d.ts +0 -10
  999. package/dist/cli/duplicateSimilarity.d.ts.map +0 -1
  1000. package/dist/cli/duplicateSimilarity.js +0 -20
  1001. package/dist/cli/duplicateSimilarity.js.map +0 -1
  1002. package/dist/cli/graphDelta.d.ts +0 -25
  1003. package/dist/cli/graphDelta.d.ts.map +0 -1
  1004. package/dist/cli/graphDelta.js +0 -80
  1005. package/dist/cli/graphDelta.js.map +0 -1
  1006. package/dist/cli/graphQueries.d.ts +0 -23
  1007. package/dist/cli/graphQueries.d.ts.map +0 -1
  1008. package/dist/cli/graphQueries.js +0 -265
  1009. package/dist/cli/graphQueries.js.map +0 -1
  1010. package/dist/cli/indexPolicy.d.ts +0 -36
  1011. package/dist/cli/indexPolicy.d.ts.map +0 -1
  1012. package/dist/cli/indexPolicy.js +0 -169
  1013. package/dist/cli/indexPolicy.js.map +0 -1
  1014. package/dist/cli/invocationContext.d.ts +0 -77
  1015. package/dist/cli/invocationContext.d.ts.map +0 -1
  1016. package/dist/cli/invocationContext.js +0 -423
  1017. package/dist/cli/invocationContext.js.map +0 -1
  1018. package/dist/cli/projectFile.d.ts +0 -13
  1019. package/dist/cli/projectFile.d.ts.map +0 -1
  1020. package/dist/cli/projectFile.js +0 -23
  1021. package/dist/cli/projectFile.js.map +0 -1
  1022. package/dist/cli/refactorPlan.d.ts +0 -6
  1023. package/dist/cli/refactorPlan.d.ts.map +0 -1
  1024. package/dist/cli/refactorPlan.js +0 -84
  1025. package/dist/cli/refactorPlan.js.map +0 -1
  1026. package/dist/cli/renamePreview.d.ts +0 -4
  1027. package/dist/cli/renamePreview.d.ts.map +0 -1
  1028. package/dist/cli/renamePreview.js +0 -92
  1029. package/dist/cli/renamePreview.js.map +0 -1
  1030. package/dist/cli/rootPolicy.d.ts +0 -53
  1031. package/dist/cli/rootPolicy.d.ts.map +0 -1
  1032. package/dist/cli/rootPolicy.js +0 -221
  1033. package/dist/cli/rootPolicy.js.map +0 -1
  1034. package/dist/cli/typeHierarchy.d.ts +0 -6
  1035. package/dist/cli/typeHierarchy.d.ts.map +0 -1
  1036. package/dist/cli/typeHierarchy.js +0 -90
  1037. package/dist/cli/typeHierarchy.js.map +0 -1
  1038. package/dist/cliBootstrap.d.ts +0 -3
  1039. package/dist/cliBootstrap.d.ts.map +0 -1
  1040. package/dist/cliBootstrap.js +0 -10
  1041. package/dist/cliBootstrap.js.map +0 -1
  1042. package/dist/documentLinks/asciidoc.d.ts.map +0 -1
  1043. package/dist/documentLinks/asciidoc.js.map +0 -1
  1044. package/dist/documentLinks/check.d.ts +0 -32
  1045. package/dist/documentLinks/check.d.ts.map +0 -1
  1046. package/dist/documentLinks/check.js +0 -286
  1047. package/dist/documentLinks/check.js.map +0 -1
  1048. package/dist/documentLinks/html.d.ts.map +0 -1
  1049. package/dist/documentLinks/html.js.map +0 -1
  1050. package/dist/documentLinks/markdown.d.ts.map +0 -1
  1051. package/dist/documentLinks/markdown.js.map +0 -1
  1052. package/dist/documentLinks/rst.d.ts.map +0 -1
  1053. package/dist/documentLinks/rst.js.map +0 -1
  1054. package/dist/documentLinks/sfc.d.ts.map +0 -1
  1055. package/dist/documentLinks/sfc.js.map +0 -1
  1056. package/dist/documentLinks/shared.d.ts.map +0 -1
  1057. package/dist/documentLinks/shared.js.map +0 -1
  1058. package/dist/documentLinks.d.ts +0 -12
  1059. package/dist/documentLinks.d.ts.map +0 -1
  1060. package/dist/documentLinks.js +0 -49
  1061. package/dist/documentLinks.js.map +0 -1
  1062. package/dist/duplicates/unitCache.d.ts +0 -46
  1063. package/dist/duplicates/unitCache.d.ts.map +0 -1
  1064. package/dist/duplicates/unitCache.js +0 -512
  1065. package/dist/duplicates/unitCache.js.map +0 -1
  1066. package/dist/duplicatesLeads.d.ts +0 -39
  1067. package/dist/duplicatesLeads.d.ts.map +0 -1
  1068. package/dist/duplicatesLeads.js +0 -112
  1069. package/dist/duplicatesLeads.js.map +0 -1
  1070. package/dist/graphs/edgeResolution.d.ts +0 -25
  1071. package/dist/graphs/edgeResolution.d.ts.map +0 -1
  1072. package/dist/graphs/edgeResolution.js +0 -97
  1073. package/dist/graphs/edgeResolution.js.map +0 -1
  1074. package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts +0 -35
  1075. package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts.map +0 -1
  1076. package/dist/graphs/symbol-graph-detailed/edgePasses.js +0 -586
  1077. package/dist/graphs/symbol-graph-detailed/edgePasses.js.map +0 -1
  1078. package/dist/graphs/symbol-graph-detailed/importAliases.d.ts +0 -10
  1079. package/dist/graphs/symbol-graph-detailed/importAliases.d.ts.map +0 -1
  1080. package/dist/graphs/symbol-graph-detailed/importAliases.js +0 -44
  1081. package/dist/graphs/symbol-graph-detailed/importAliases.js.map +0 -1
  1082. package/dist/graphs/symbol-graph-detailed/memberChains.d.ts +0 -17
  1083. package/dist/graphs/symbol-graph-detailed/memberChains.d.ts.map +0 -1
  1084. package/dist/graphs/symbol-graph-detailed/memberChains.js +0 -30
  1085. package/dist/graphs/symbol-graph-detailed/memberChains.js.map +0 -1
  1086. package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts +0 -69
  1087. package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts.map +0 -1
  1088. package/dist/graphs/symbol-graph-detailed/receiverCalls.js +0 -408
  1089. package/dist/graphs/symbol-graph-detailed/receiverCalls.js.map +0 -1
  1090. package/dist/impact/call-compatibility/textScanner.d.ts +0 -23
  1091. package/dist/impact/call-compatibility/textScanner.d.ts.map +0 -1
  1092. package/dist/impact/call-compatibility/textScanner.js +0 -615
  1093. package/dist/impact/call-compatibility/textScanner.js.map +0 -1
  1094. package/dist/impact/callCompatibility.d.ts +0 -24
  1095. package/dist/impact/callCompatibility.d.ts.map +0 -1
  1096. package/dist/impact/callCompatibility.js +0 -1023
  1097. package/dist/impact/callCompatibility.js.map +0 -1
  1098. package/dist/impact/memberResolutionCoverage.d.ts +0 -14
  1099. package/dist/impact/memberResolutionCoverage.d.ts.map +0 -1
  1100. package/dist/impact/memberResolutionCoverage.js +0 -42
  1101. package/dist/impact/memberResolutionCoverage.js.map +0 -1
  1102. package/dist/impact/referenceCache.d.ts +0 -12
  1103. package/dist/impact/referenceCache.d.ts.map +0 -1
  1104. package/dist/impact/referenceCache.js +0 -101
  1105. package/dist/impact/referenceCache.js.map +0 -1
  1106. package/dist/impact/reportCompact.d.ts +0 -8
  1107. package/dist/impact/reportCompact.d.ts.map +0 -1
  1108. package/dist/impact/reportCompact.js +0 -153
  1109. package/dist/impact/reportCompact.js.map +0 -1
  1110. package/dist/impact/reportFull.d.ts +0 -10
  1111. package/dist/impact/reportFull.d.ts.map +0 -1
  1112. package/dist/impact/reportFull.js +0 -67
  1113. package/dist/impact/reportFull.js.map +0 -1
  1114. package/dist/impact/reportParts.d.ts +0 -51
  1115. package/dist/impact/reportParts.d.ts.map +0 -1
  1116. package/dist/impact/reportParts.js +0 -2
  1117. package/dist/impact/reportParts.js.map +0 -1
  1118. package/dist/impact/reportShared.d.ts +0 -76
  1119. package/dist/impact/reportShared.d.ts.map +0 -1
  1120. package/dist/impact/reportShared.js +0 -130
  1121. package/dist/impact/reportShared.js.map +0 -1
  1122. package/dist/impact/testPatterns.d.ts +0 -6
  1123. package/dist/impact/testPatterns.d.ts.map +0 -1
  1124. package/dist/impact/testPatterns.js +0 -65
  1125. package/dist/impact/testPatterns.js.map +0 -1
  1126. package/dist/indexer/imports/graphOnly.d.ts +0 -13
  1127. package/dist/indexer/imports/graphOnly.d.ts.map +0 -1
  1128. package/dist/indexer/imports/graphOnly.js +0 -40
  1129. package/dist/indexer/imports/graphOnly.js.map +0 -1
  1130. package/dist/indexer/imports/jsTextImports.d.ts +0 -9
  1131. package/dist/indexer/imports/jsTextImports.d.ts.map +0 -1
  1132. package/dist/indexer/imports/jsTextImports.js +0 -181
  1133. package/dist/indexer/imports/jsTextImports.js.map +0 -1
  1134. package/dist/indexer/imports/languageSpecific.d.ts +0 -26
  1135. package/dist/indexer/imports/languageSpecific.d.ts.map +0 -1
  1136. package/dist/indexer/imports/languageSpecific.js +0 -449
  1137. package/dist/indexer/imports/languageSpecific.js.map +0 -1
  1138. package/dist/indexer/imports/nativeCaptures.d.ts +0 -16
  1139. package/dist/indexer/imports/nativeCaptures.d.ts.map +0 -1
  1140. package/dist/indexer/imports/nativeCaptures.js +0 -142
  1141. package/dist/indexer/imports/nativeCaptures.js.map +0 -1
  1142. package/dist/languages/definitions/cFamily.d.ts +0 -34
  1143. package/dist/languages/definitions/cFamily.d.ts.map +0 -1
  1144. package/dist/languages/definitions/cFamily.js +0 -177
  1145. package/dist/languages/definitions/cFamily.js.map +0 -1
  1146. package/dist/languages/definitions/cssLike.d.ts +0 -5
  1147. package/dist/languages/definitions/cssLike.d.ts.map +0 -1
  1148. package/dist/languages/definitions/cssLike.js +0 -32
  1149. package/dist/languages/definitions/cssLike.js.map +0 -1
  1150. package/dist/languages/definitions/htmlStub.d.ts +0 -18
  1151. package/dist/languages/definitions/htmlStub.d.ts.map +0 -1
  1152. package/dist/languages/definitions/htmlStub.js +0 -36
  1153. package/dist/languages/definitions/htmlStub.js.map +0 -1
  1154. package/dist/languages/definitions/jsFamily.d.ts +0 -5
  1155. package/dist/languages/definitions/jsFamily.d.ts.map +0 -1
  1156. package/dist/languages/definitions/jsFamily.js +0 -75
  1157. package/dist/languages/definitions/jsFamily.js.map +0 -1
  1158. package/dist/languages/filePrep.d.ts +0 -36
  1159. package/dist/languages/filePrep.d.ts.map +0 -1
  1160. package/dist/languages/filePrep.js +0 -76
  1161. package/dist/languages/filePrep.js.map +0 -1
  1162. package/dist/languages/importStatementParsers.d.ts +0 -57
  1163. package/dist/languages/importStatementParsers.d.ts.map +0 -1
  1164. package/dist/languages/importStatementParsers.js +0 -383
  1165. package/dist/languages/importStatementParsers.js.map +0 -1
  1166. package/dist/languages/queryGenerator.d.ts +0 -6
  1167. package/dist/languages/queryGenerator.d.ts.map +0 -1
  1168. package/dist/languages/queryGenerator.js +0 -46
  1169. package/dist/languages/queryGenerator.js.map +0 -1
  1170. package/dist/mcp/httpTransport.d.ts +0 -14
  1171. package/dist/mcp/httpTransport.d.ts.map +0 -1
  1172. package/dist/mcp/httpTransport.js +0 -185
  1173. package/dist/mcp/httpTransport.js.map +0 -1
  1174. package/dist/mcp/legacySessions.d.ts +0 -38
  1175. package/dist/mcp/legacySessions.d.ts.map +0 -1
  1176. package/dist/mcp/legacySessions.js +0 -264
  1177. package/dist/mcp/legacySessions.js.map +0 -1
  1178. package/dist/mcp/lifecycleHealth.d.ts +0 -12
  1179. package/dist/mcp/lifecycleHealth.d.ts.map +0 -1
  1180. package/dist/mcp/lifecycleHealth.js +0 -37
  1181. package/dist/mcp/lifecycleHealth.js.map +0 -1
  1182. package/dist/mcp/sqliteGuard.d.ts +0 -3
  1183. package/dist/mcp/sqliteGuard.d.ts.map +0 -1
  1184. package/dist/mcp/sqliteGuard.js +0 -35
  1185. package/dist/mcp/sqliteGuard.js.map +0 -1
  1186. package/dist/mcp/stdioLifecycle.d.ts +0 -23
  1187. package/dist/mcp/stdioLifecycle.d.ts.map +0 -1
  1188. package/dist/mcp/stdioLifecycle.js +0 -83
  1189. package/dist/mcp/stdioLifecycle.js.map +0 -1
  1190. package/dist/native/bindingLoader.d.ts +0 -51
  1191. package/dist/native/bindingLoader.d.ts.map +0 -1
  1192. package/dist/native/bindingLoader.js +0 -223
  1193. package/dist/native/bindingLoader.js.map +0 -1
  1194. package/dist/native/byteIndex.d.ts +0 -26
  1195. package/dist/native/byteIndex.d.ts.map +0 -1
  1196. package/dist/native/byteIndex.js +0 -70
  1197. package/dist/native/byteIndex.js.map +0 -1
  1198. package/dist/native/jsBridge.d.ts +0 -7
  1199. package/dist/native/jsBridge.d.ts.map +0 -1
  1200. package/dist/native/jsBridge.js +0 -25
  1201. package/dist/native/jsBridge.js.map +0 -1
  1202. package/dist/native/nativeBackendReport.d.ts +0 -22
  1203. package/dist/native/nativeBackendReport.d.ts.map +0 -1
  1204. package/dist/native/nativeBackendReport.js +0 -102
  1205. package/dist/native/nativeBackendReport.js.map +0 -1
  1206. package/dist/native/projectedTree.d.ts +0 -53
  1207. package/dist/native/projectedTree.d.ts.map +0 -1
  1208. package/dist/native/projectedTree.js +0 -180
  1209. package/dist/native/projectedTree.js.map +0 -1
  1210. package/dist/native/queryResults.d.ts +0 -12
  1211. package/dist/native/queryResults.d.ts.map +0 -1
  1212. package/dist/native/queryResults.js +0 -34
  1213. package/dist/native/queryResults.js.map +0 -1
  1214. package/dist/native/runtimeCache.d.ts +0 -128
  1215. package/dist/native/runtimeCache.d.ts.map +0 -1
  1216. package/dist/native/runtimeCache.js +0 -667
  1217. package/dist/native/runtimeCache.js.map +0 -1
  1218. package/dist/native/treeShape.d.ts +0 -21
  1219. package/dist/native/treeShape.d.ts.map +0 -1
  1220. package/dist/native/treeShape.js +0 -28
  1221. package/dist/native/treeShape.js.map +0 -1
  1222. package/dist/native/treeSitterNative.d.ts +0 -6
  1223. package/dist/native/treeSitterNative.d.ts.map +0 -1
  1224. package/dist/native/treeSitterNative.js +0 -5
  1225. package/dist/native/treeSitterNative.js.map +0 -1
  1226. package/dist/runtimeIdentity.d.ts +0 -27
  1227. package/dist/runtimeIdentity.d.ts.map +0 -1
  1228. package/dist/runtimeIdentity.js +0 -75
  1229. package/dist/runtimeIdentity.js.map +0 -1
  1230. package/dist/sql/classifySqlFile.d.ts +0 -3
  1231. package/dist/sql/classifySqlFile.d.ts.map +0 -1
  1232. package/dist/sql/classifySqlFile.js +0 -42
  1233. package/dist/sql/classifySqlFile.js.map +0 -1
  1234. package/dist/sql/extractFacts.d.ts +0 -4
  1235. package/dist/sql/extractFacts.d.ts.map +0 -1
  1236. package/dist/sql/extractFacts.js +0 -511
  1237. package/dist/sql/extractFacts.js.map +0 -1
  1238. package/dist/sql/sourceGraph.d.ts +0 -19
  1239. package/dist/sql/sourceGraph.d.ts.map +0 -1
  1240. package/dist/sql/sourceGraph.js +0 -195
  1241. package/dist/sql/sourceGraph.js.map +0 -1
  1242. package/dist/sqlite/rawQueryWorker.d.ts +0 -22
  1243. package/dist/sqlite/rawQueryWorker.d.ts.map +0 -1
  1244. package/dist/sqlite/rawQueryWorker.js +0 -31
  1245. package/dist/sqlite/rawQueryWorker.js.map +0 -1
  1246. package/dist/sqlite/rawQueryWorkerPool.d.ts +0 -66
  1247. package/dist/sqlite/rawQueryWorkerPool.d.ts.map +0 -1
  1248. package/dist/sqlite/rawQueryWorkerPool.js +0 -146
  1249. package/dist/sqlite/rawQueryWorkerPool.js.map +0 -1
  1250. package/dist/sqlite/rowBounds.d.ts +0 -24
  1251. package/dist/sqlite/rowBounds.d.ts.map +0 -1
  1252. package/dist/sqlite/rowBounds.js +0 -95
  1253. package/dist/sqlite/rowBounds.js.map +0 -1
  1254. package/dist/util/bloomFilter.d.ts +0 -100
  1255. package/dist/util/bloomFilter.d.ts.map +0 -1
  1256. package/dist/util/bloomFilter.js +0 -206
  1257. package/dist/util/bloomFilter.js.map +0 -1
  1258. package/dist/util/confinedFile.d.ts +0 -48
  1259. package/dist/util/confinedFile.d.ts.map +0 -1
  1260. package/dist/util/confinedFile.js +0 -164
  1261. package/dist/util/confinedFile.js.map +0 -1
  1262. package/dist/util/discoveryPath.d.ts +0 -3
  1263. package/dist/util/discoveryPath.d.ts.map +0 -1
  1264. package/dist/util/discoveryPath.js +0 -19
  1265. package/dist/util/discoveryPath.js.map +0 -1
  1266. package/dist/util/graphEdges.d.ts +0 -5
  1267. package/dist/util/graphEdges.d.ts.map +0 -1
  1268. package/dist/util/graphEdges.js +0 -42
  1269. package/dist/util/graphEdges.js.map +0 -1
  1270. package/dist/util/graphOnlyExtensions.d.ts +0 -5
  1271. package/dist/util/graphOnlyExtensions.d.ts.map +0 -1
  1272. package/dist/util/graphOnlyExtensions.js +0 -12
  1273. package/dist/util/graphOnlyExtensions.js.map +0 -1
  1274. package/dist/util/includeRoots.d.ts +0 -6
  1275. package/dist/util/includeRoots.d.ts.map +0 -1
  1276. package/dist/util/includeRoots.js +0 -53
  1277. package/dist/util/includeRoots.js.map +0 -1
  1278. package/dist/util/lazySymbols.d.ts +0 -166
  1279. package/dist/util/lazySymbols.d.ts.map +0 -1
  1280. package/dist/util/lazySymbols.js +0 -365
  1281. package/dist/util/lazySymbols.js.map +0 -1
  1282. package/dist/util/lruMap.d.ts +0 -3
  1283. package/dist/util/lruMap.d.ts.map +0 -1
  1284. package/dist/util/lruMap.js +0 -22
  1285. package/dist/util/lruMap.js.map +0 -1
  1286. package/dist/util/memberAccess.d.ts +0 -26
  1287. package/dist/util/memberAccess.d.ts.map +0 -1
  1288. package/dist/util/memberAccess.js +0 -185
  1289. package/dist/util/memberAccess.js.map +0 -1
  1290. package/dist/util/packageExports.d.ts +0 -25
  1291. package/dist/util/packageExports.d.ts.map +0 -1
  1292. package/dist/util/packageExports.js +0 -79
  1293. package/dist/util/packageExports.js.map +0 -1
  1294. package/dist/util/packageInfo.d.ts +0 -12
  1295. package/dist/util/packageInfo.d.ts.map +0 -1
  1296. package/dist/util/packageInfo.js +0 -57
  1297. package/dist/util/packageInfo.js.map +0 -1
  1298. package/dist/util/partialResults.d.ts +0 -81
  1299. package/dist/util/partialResults.d.ts.map +0 -1
  1300. package/dist/util/partialResults.js +0 -290
  1301. package/dist/util/partialResults.js.map +0 -1
  1302. package/dist/util/projectFiles/definitions.d.ts +0 -21
  1303. package/dist/util/projectFiles/definitions.d.ts.map +0 -1
  1304. package/dist/util/projectFiles/definitions.js.map +0 -1
  1305. package/dist/util/projectFiles/parsers.d.ts.map +0 -1
  1306. package/dist/util/projectFiles/parsers.js.map +0 -1
  1307. package/dist/util/projectFiles.d.ts +0 -102
  1308. package/dist/util/projectFiles.d.ts.map +0 -1
  1309. package/dist/util/projectFiles.js +0 -1209
  1310. package/dist/util/projectFiles.js.map +0 -1
  1311. package/dist/util/resolution/findFirstExisting.d.ts +0 -2
  1312. package/dist/util/resolution/findFirstExisting.d.ts.map +0 -1
  1313. package/dist/util/resolution/findFirstExisting.js +0 -13
  1314. package/dist/util/resolution/findFirstExisting.js.map +0 -1
  1315. package/dist/util/resolution/phpComposer.d.ts +0 -17
  1316. package/dist/util/resolution/phpComposer.d.ts.map +0 -1
  1317. package/dist/util/resolution/phpComposer.js +0 -269
  1318. package/dist/util/resolution/phpComposer.js.map +0 -1
  1319. package/dist/util/resolution/projectSymbols.d.ts +0 -14
  1320. package/dist/util/resolution/projectSymbols.d.ts.map +0 -1
  1321. package/dist/util/resolution/projectSymbols.js +0 -70
  1322. package/dist/util/resolution/projectSymbols.js.map +0 -1
  1323. package/dist/util/resolutionCandidates.d.ts +0 -5
  1324. package/dist/util/resolutionCandidates.d.ts.map +0 -1
  1325. package/dist/util/resolutionCandidates.js +0 -70
  1326. package/dist/util/resolutionCandidates.js.map +0 -1
  1327. package/dist/util/rustTestModules.d.ts +0 -3
  1328. package/dist/util/rustTestModules.d.ts.map +0 -1
  1329. package/dist/util/rustTestModules.js +0 -71
  1330. package/dist/util/rustTestModules.js.map +0 -1
  1331. package/dist/util/sourceLocation.d.ts +0 -8
  1332. package/dist/util/sourceLocation.d.ts.map +0 -1
  1333. package/dist/util/sourceLocation.js +0 -19
  1334. package/dist/util/sourceLocation.js.map +0 -1
  1335. package/dist/util/sqliteSchema.d.ts +0 -28
  1336. package/dist/util/sqliteSchema.d.ts.map +0 -1
  1337. package/dist/util/sqliteSchema.js +0 -75
  1338. package/dist/util/sqliteSchema.js.map +0 -1
  1339. package/dist/util/symbolHash.d.ts +0 -59
  1340. package/dist/util/symbolHash.d.ts.map +0 -1
  1341. package/dist/util/symbolHash.js +0 -84
  1342. package/dist/util/symbolHash.js.map +0 -1
  1343. package/dist/util/windowsProcessDrain.d.ts +0 -23
  1344. package/dist/util/windowsProcessDrain.d.ts.map +0 -1
  1345. package/dist/util/windowsProcessDrain.js +0 -51
  1346. package/dist/util/windowsProcessDrain.js.map +0 -1
  1347. package/dist/util/workerThreads.d.ts +0 -12
  1348. package/dist/util/workerThreads.d.ts.map +0 -1
  1349. package/dist/util/workerThreads.js +0 -16
  1350. package/dist/util/workerThreads.js.map +0 -1
  1351. package/dist/worker/nativeExtractWorker.d.ts +0 -77
  1352. package/dist/worker/nativeExtractWorker.d.ts.map +0 -1
  1353. package/dist/worker/nativeExtractWorker.js +0 -272
  1354. package/dist/worker/nativeExtractWorker.js.map +0 -1
  1355. package/dist/worker/nativeWorkerPool.d.ts +0 -16
  1356. package/dist/worker/nativeWorkerPool.d.ts.map +0 -1
  1357. package/dist/worker/nativeWorkerPool.js +0 -54
  1358. package/dist/worker/nativeWorkerPool.js.map +0 -1
  1359. package/docs/graph-visualization/viewer-selected-node.webp +0 -0
  1360. /package/dist/{documentLinks → document-links}/asciidoc.d.ts +0 -0
  1361. /package/dist/{documentLinks → document-links}/asciidoc.js +0 -0
  1362. /package/dist/{documentLinks → document-links}/html.d.ts +0 -0
  1363. /package/dist/{documentLinks → document-links}/html.js +0 -0
  1364. /package/dist/{documentLinks → document-links}/markdown.d.ts +0 -0
  1365. /package/dist/{documentLinks → document-links}/markdown.js +0 -0
  1366. /package/dist/{documentLinks → document-links}/rst.d.ts +0 -0
  1367. /package/dist/{documentLinks → document-links}/rst.js +0 -0
  1368. /package/dist/{documentLinks → document-links}/sfc.d.ts +0 -0
  1369. /package/dist/{documentLinks → document-links}/sfc.js +0 -0
  1370. /package/dist/{documentLinks → document-links}/shared.d.ts +0 -0
  1371. /package/dist/{documentLinks → document-links}/shared.js +0 -0
  1372. /package/dist/util/{projectFiles → project-files}/definitions.js +0 -0
  1373. /package/dist/util/{projectFiles → project-files}/parsers.d.ts +0 -0
  1374. /package/dist/util/{projectFiles → project-files}/parsers.js +0 -0
  1375. /package/{docs/graph-visualization → src/viewer}/app.js +0 -0
  1376. /package/{docs/graph-visualization → src/viewer}/file-tree-filters.js +0 -0
  1377. /package/{docs/graph-visualization → src/viewer}/file-tree-model.js +0 -0
  1378. /package/{docs/graph-visualization → src/viewer}/graph-builder.js +0 -0
  1379. /package/{docs/graph-visualization → src/viewer}/index.html +0 -0
  1380. /package/{docs/graph-visualization → src/viewer}/styles.css +0 -0
  1381. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology-layout-forceatlas2.txt +0 -0
  1382. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology.txt +0 -0
  1383. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.sigma.txt +0 -0
  1384. /package/{docs/graph-visualization → src/viewer}/vendor/graphology-layout-forceatlas2.js +0 -0
  1385. /package/{docs/graph-visualization → src/viewer}/vendor/graphology.js +0 -0
  1386. /package/{docs/graph-visualization → src/viewer}/vendor/sigma.js +0 -0
@@ -1,4382 +0,0 @@
1
- import { createRequire as __codegraphCreateRequire } from 'node:module';
2
- const require = __codegraphCreateRequire(import.meta.url);
3
-
4
-
5
- // dist/agent/query-index/content.js
6
- import fs6 from "node:fs/promises";
7
- import { brotliCompressSync, constants as zlibConstants } from "node:zlib";
8
-
9
- // dist/languages/queryGenerator.js
10
- function generateChunkingQuery(def) {
11
- const parts = [];
12
- if (def.structure.comments.length) {
13
- parts.push(`;; ----- Comments -----`);
14
- for (const type of def.structure.comments) {
15
- parts.push(`(${type}) @chunk.comment`);
16
- }
17
- parts.push("");
18
- }
19
- if (def.structure.blocks.length) {
20
- parts.push(`;; ----- Blocks -----`);
21
- for (const block of def.structure.blocks) {
22
- let query = `(${block.type}`;
23
- if (block.nameQuery) {
24
- query += ` ${block.nameQuery}`;
25
- }
26
- const isBlockCapture = block.isBlock ?? true;
27
- if (isBlockCapture) {
28
- query += `) @chunk.block.${block.captureId || block.type}`;
29
- } else {
30
- query += `)`;
31
- }
32
- if (block.parentType) {
33
- query = `(${block.parentType} ${query})`;
34
- }
35
- parts.push(query);
36
- }
37
- parts.push("");
38
- }
39
- if (def.structure.splitPoints.length) {
40
- parts.push(`;; ----- Split Points -----`);
41
- for (const type of def.structure.splitPoints) {
42
- parts.push(`(${type}) @chunk.block.inner`);
43
- }
44
- parts.push("");
45
- }
46
- return parts.join("\n");
47
- }
48
-
49
- // dist/chunking/languageConfig.js
50
- function makeLanguageConfig(def, publicId = def.id) {
51
- const queryText = generateChunkingQuery(def);
52
- return {
53
- id: publicId,
54
- supportId: def.id,
55
- queryText,
56
- definition: def,
57
- captures: {
58
- name: "chunk.name",
59
- blockPrefix: "chunk.block.",
60
- innerBlock: "chunk.block.inner",
61
- comments: ["chunk.comment", "chunk.docstring"]
62
- }
63
- };
64
- }
65
-
66
- // dist/languages/registry.js
67
- var registry = /* @__PURE__ */ new Map();
68
- function registerLanguage(def) {
69
- registry.set(def.id, def);
70
- }
71
- function getAllLanguages() {
72
- return Array.from(registry.values());
73
- }
74
- function getLanguageById(id) {
75
- return registry.get(id);
76
- }
77
-
78
- // dist/languages/definitions/jsFamily.js
79
- var ECMASCRIPT_CONTROL_SPLIT_POINTS = [
80
- "if_statement",
81
- "else_clause",
82
- "switch_statement",
83
- "for_statement",
84
- "for_in_statement",
85
- "while_statement",
86
- "do_statement",
87
- "try_statement",
88
- "catch_clause",
89
- "finally_clause"
90
- ];
91
- var ECMASCRIPT_CORE_FUNCTION_BLOCKS = [
92
- {
93
- type: "class_declaration",
94
- nameQuery: "name: (identifier) @chunk.name",
95
- captureId: "class"
96
- },
97
- {
98
- type: "function_declaration",
99
- nameQuery: "name: (identifier) @chunk.name",
100
- captureId: "function"
101
- },
102
- {
103
- type: "generator_function_declaration",
104
- nameQuery: "name: (identifier) @chunk.name",
105
- captureId: "function"
106
- },
107
- {
108
- type: "method_definition",
109
- nameQuery: "name: (_) @chunk.name body: (statement_block) @chunk.block.method",
110
- captureId: "method"
111
- },
112
- {
113
- type: "lexical_declaration",
114
- nameQuery: `(variable_declarator name: (identifier) @chunk.name value: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ])`,
115
- captureId: "function"
116
- },
117
- {
118
- type: "variable_declaration",
119
- nameQuery: `(variable_declarator name: (identifier) @chunk.name value: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ])`,
120
- captureId: "function"
121
- },
122
- {
123
- type: "assignment_expression",
124
- nameQuery: `left: (_) @chunk.name right: [ (function_expression body: (statement_block) @chunk.block.function) (arrow_function body: (statement_block) @chunk.block.function) ]`,
125
- captureId: "function"
126
- },
127
- {
128
- type: "arrow_function",
129
- nameQuery: "body: (statement_block) @chunk.block.function",
130
- captureId: "function"
131
- },
132
- {
133
- type: "function_expression",
134
- nameQuery: "body: (statement_block) @chunk.block.function",
135
- captureId: "function"
136
- }
137
- ];
138
- var ECMASCRIPT_MODULE_VAR_BLOCKS = [
139
- { type: "import_statement", captureId: "imports" },
140
- {
141
- type: "lexical_declaration",
142
- nameQuery: `(variable_declarator name: (identifier) @chunk.name)`,
143
- captureId: "module_var",
144
- parentType: "program"
145
- },
146
- {
147
- type: "variable_declaration",
148
- nameQuery: `(variable_declarator name: (identifier) @chunk.name)`,
149
- captureId: "module_var",
150
- parentType: "program"
151
- }
152
- ];
153
-
154
- // dist/languages/definitions/typescript.js
155
- function normalizeTypeScriptNativeQuery(kind, query) {
156
- let normalized = query.replace(/\(class_declaration name: \(identifier\) @/g, "(class_declaration name: (type_identifier) @");
157
- if (kind !== "exports") {
158
- return normalized;
159
- }
160
- normalized = normalized.replace(/^\s*\(export_assignment \(identifier\) @ts_export_assign\)\s*$/gm, "");
161
- return normalized;
162
- }
163
- var TYPESCRIPT_CLASS_BLOCK = {
164
- type: "class_declaration",
165
- nameQuery: "name: (type_identifier) @chunk.name",
166
- captureId: "class"
167
- };
168
- var BASE_STRUCTURE = {
169
- blocks: [
170
- TYPESCRIPT_CLASS_BLOCK,
171
- ...ECMASCRIPT_CORE_FUNCTION_BLOCKS.filter((block) => block.type !== "class_declaration"),
172
- // TS Specifics
173
- {
174
- type: "interface_declaration",
175
- nameQuery: "name: (type_identifier) @chunk.name",
176
- captureId: "interface"
177
- },
178
- {
179
- type: "enum_declaration",
180
- nameQuery: "name: [ (identifier) (type_identifier) ] @chunk.name",
181
- captureId: "enum"
182
- },
183
- {
184
- type: "type_alias_declaration",
185
- nameQuery: "name: (type_identifier) @chunk.name",
186
- captureId: "type_alias"
187
- },
188
- {
189
- type: "internal_module",
190
- nameQuery: "name: (identifier) @chunk.name body: (statement_block) @chunk.block.namespace",
191
- captureId: "namespace"
192
- },
193
- {
194
- type: "module",
195
- nameQuery: "name: (identifier) @chunk.name body: (statement_block) @chunk.block.namespace",
196
- captureId: "namespace"
197
- },
198
- // Data
199
- { type: "object", captureId: "data" },
200
- // Top level vars
201
- ...ECMASCRIPT_MODULE_VAR_BLOCKS.map((block) => block.type === "import_statement" ? { ...block, parentType: "program" } : block)
202
- ],
203
- splitPoints: [...ECMASCRIPT_CONTROL_SPLIT_POINTS, "switch_case", "switch_default"],
204
- comments: ["comment"]
205
- };
206
- var BASE_GRAPH = {
207
- imports: `
208
- (import_statement (string) @mod) @stmt
209
- ;; import x = require("...") is represented via import_require_clause
210
- (import_statement (import_require_clause (string) @mod)) @stmt
211
- (export_statement (string) @mod) @stmt
212
- (call_expression function: (import) arguments: (arguments (string) @mod)) @stmt
213
- ;; declare module "foo" {} \u2014 ambient module augmentations create a type-only
214
- ;; dependency on the named module and must appear in the file graph so that
215
- ;; changes to "foo" propagate to augmenting files (and vice-versa).
216
- ;; The inner node type is "module" (not "module_declaration"); its string
217
- ;; child uses field-name "name".
218
- (ambient_declaration (module name: (string) @mod)) @stmt
219
- `,
220
- exports: `
221
- (export_statement) @stmt
222
- (export_statement declaration: (function_declaration name: (identifier) @name)) @stmt
223
- (export_statement declaration: (generator_function_declaration name: (identifier) @name)) @stmt
224
- (export_statement declaration: (class_declaration name: (type_identifier) @name)) @stmt
225
- (export_statement declaration: (abstract_class_declaration name: (type_identifier) @name)) @stmt
226
- (export_statement declaration: (enum_declaration name: [ (identifier) (type_identifier) ] @name)) @stmt
227
- (export_statement declaration: (function_declaration) @anon_default) @stmt
228
- (export_statement declaration: (generator_function_declaration) @anon_default) @stmt
229
- (export_statement declaration: (class_declaration) @anon_default) @stmt
230
- (export_statement declaration: (abstract_class_declaration) @anon_default) @stmt
231
- (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name))) @stmt
232
- (export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)) (string) @from) @stmt
233
- (export_statement (export_clause (export_specifier name: (identifier) @src !alias)) (string) @from) @stmt
234
- (export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias))) @stmt
235
- (export_statement (export_clause (export_specifier name: (identifier) @src !alias))) @stmt
236
- (export_statement (string) @from) @stmt
237
- (export_assignment (identifier) @ts_export_assign)
238
- `,
239
- locals: `
240
- (function_declaration name: (identifier) @name)
241
- (generator_function_declaration name: (identifier) @name)
242
- (method_definition name: (property_identifier) @name)
243
- (method_signature name: (property_identifier) @name)
244
- (abstract_method_signature name: (property_identifier) @name)
245
- (class_declaration name: (type_identifier) @name)
246
- (abstract_class_declaration name: (type_identifier) @name)
247
- (variable_declarator name: (identifier) @name)
248
- (interface_declaration name: (type_identifier) @name)
249
- (type_alias_declaration name: (type_identifier) @name)
250
- (enum_declaration name: [ (identifier) (type_identifier) ] @name)
251
- `,
252
- importBindings: `
253
- (import_statement) @stmt
254
- (import_statement (string) @from) @stmt
255
- (import_statement (import_require_clause (identifier) @def (string) @from)) @stmt
256
- (import_statement (import_clause (identifier) @def) (string) @from) @stmt
257
- (import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname alias: (identifier) @alias))) (string) @from) @stmt
258
- (import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname))) (string) @from) @stmt
259
- (import_statement (import_clause (namespace_import (identifier) @ns)) (string) @from) @stmt
260
- `
261
- };
262
- var BASE_HELPERS = {
263
- nodeTypes: {
264
- identifier: ["identifier", "type_identifier"],
265
- propertyIdentifier: ["property_identifier"],
266
- shorthandPropertyIdentifier: ["shorthand_property_identifier", "shorthand_property_identifier_pattern"],
267
- memberExpression: "member_expression"
268
- },
269
- classifyDefinition: (n) => {
270
- const t = n.parent?.type;
271
- if (t === "function_declaration")
272
- return "function";
273
- if (t === "generator_function_declaration")
274
- return "function";
275
- if (t === "method_definition")
276
- return "function";
277
- if (t === "method_signature")
278
- return "function";
279
- if (t === "abstract_method_signature")
280
- return "function";
281
- if (t === "class_declaration")
282
- return "class";
283
- if (t === "abstract_class_declaration")
284
- return "class";
285
- if (t === "interface_declaration")
286
- return "interface";
287
- if (t === "type_alias_declaration")
288
- return "type";
289
- if (t === "enum_declaration")
290
- return "type";
291
- return "variable";
292
- },
293
- isDeclarationName: (node) => {
294
- const p = node.parent?.type;
295
- return !!p && [
296
- "generator_function_declaration",
297
- "function_declaration",
298
- "class_declaration",
299
- "abstract_class_declaration",
300
- "variable_declarator",
301
- "interface_declaration",
302
- "type_alias_declaration",
303
- "enum_declaration",
304
- "import_specifier",
305
- "namespace_import",
306
- "import_clause",
307
- "import_equals_declaration",
308
- // Method names in classes and abstract method signatures: needed so
309
- // that editing a method name is classified as a definition change.
310
- "method_definition",
311
- "method_signature",
312
- "abstract_method_signature"
313
- ].includes(p);
314
- },
315
- createsBlockScope: (n) => n.type === "program" || n.type === "block" || n.type === "class_body",
316
- createsFunctionScope: (n) => n.type === "generator_function_declaration" || n.type === "function_declaration" || n.type === "function" || n.type === "function_expression" || n.type === "arrow_function" || n.type === "method_definition",
317
- membersAreImplicitlyInScope: false,
318
- supportsCrossModuleSymbols: true
319
- };
320
- var TYPESCRIPT_DEF = {
321
- id: "ts",
322
- extensions: [".ts", ".mts", ".cts"],
323
- structure: BASE_STRUCTURE,
324
- graph: BASE_GRAPH,
325
- supportsExportFromReferences: true,
326
- ...BASE_HELPERS,
327
- isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
328
- native: {
329
- normalizeQuery: normalizeTypeScriptNativeQuery,
330
- authoritativeKinds: ["exports"],
331
- notes: ["drops unsupported TypeScript export-assignment nodes while keeping native export results authoritative"]
332
- }
333
- };
334
- registerLanguage(TYPESCRIPT_DEF);
335
- var TSX_DEF = {
336
- id: "tsx",
337
- extensions: [".tsx"],
338
- structure: {
339
- ...BASE_STRUCTURE,
340
- blocks: [
341
- ...BASE_STRUCTURE.blocks,
342
- { type: "jsx_element", captureId: "jsx" },
343
- { type: "jsx_self_closing_element", captureId: "jsx" }
344
- ]
345
- },
346
- graph: BASE_GRAPH,
347
- supportsExportFromReferences: true,
348
- ...BASE_HELPERS,
349
- isTypeOnly: (stmtText) => /\b(import|export)\s+type\b/.test(stmtText),
350
- native: {
351
- normalizeQuery: normalizeTypeScriptNativeQuery,
352
- authoritativeKinds: ["exports"],
353
- notes: ["drops unsupported TypeScript export-assignment nodes while keeping native export results authoritative"]
354
- }
355
- };
356
- registerLanguage(TSX_DEF);
357
-
358
- // dist/languages/definitions/javascript.js
359
- var JS_OBJECT_METHOD_EXPORT_PATTERN = `
360
- ;; CJS: module.exports = { helper () {} }
361
- (expression_statement (assignment_expression
362
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
363
- right: (object (pair key: (property_identifier) @cjs_export_name value: (function_declaration) @cjs_fn))))
364
- (#eq? @mod "module") (#eq? @prop "exports")
365
- `;
366
- var JS_OBJECT_METHOD_EXPORT_NATIVE_PATTERN = `
367
- ;; CJS: module.exports = { helper () {} }
368
- (expression_statement (assignment_expression
369
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
370
- right: (object (method_definition name: (property_identifier) @cjs_export_name) @cjs_fn)))
371
- (#eq? @mod "module") (#eq? @prop "exports")
372
- `;
373
- var JAVASCRIPT_DEF = {
374
- id: "js",
375
- extensions: [".js", ".jsx", ".mjs", ".cjs"],
376
- supportsExportFromReferences: true,
377
- structure: {
378
- blocks: [...ECMASCRIPT_CORE_FUNCTION_BLOCKS, ...ECMASCRIPT_MODULE_VAR_BLOCKS],
379
- splitPoints: [...ECMASCRIPT_CONTROL_SPLIT_POINTS],
380
- comments: ["comment"]
381
- },
382
- graph: {
383
- imports: `
384
- (import_statement (string) @mod) @stmt
385
- (export_statement (string) @mod) @stmt
386
- (call_expression function: (import) arguments: (arguments (string) @mod)) @stmt
387
- ((call_expression function: (identifier) @fn arguments: (arguments (string) @mod)) @stmt
388
- (#eq? @fn "require"))
389
- `,
390
- exports: `
391
- (export_statement) @stmt
392
- (export_statement declaration: (function_declaration name: (identifier) @name)) @stmt
393
- (export_statement declaration: (generator_function_declaration name: (identifier) @name)) @stmt
394
- (export_statement declaration: (class_declaration name: (identifier) @name)) @stmt
395
- (export_statement declaration: (function_declaration) @anon_default) @stmt
396
- (export_statement declaration: (generator_function_declaration) @anon_default) @stmt
397
- (export_statement declaration: (class_declaration) @anon_default) @stmt
398
- (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name))) @stmt
399
- (export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)) (string) @from)
400
- (export_statement (export_clause (export_specifier name: (identifier) @src !alias)) (string) @from)
401
- (export_statement (export_clause (export_specifier name: (identifier) @src alias: (identifier) @alias)))
402
- (export_statement (export_clause (export_specifier name: (identifier) @src !alias)))
403
- (export_statement (string) @from)
404
- (expression_statement (assignment_expression
405
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
406
- right: (object (shorthand_property_identifier) @cjs_shorthand)))
407
- (#eq? @mod "module") (#eq? @prop "exports")
408
- ;; CJS spread export: module.exports = { ...base }
409
- ((expression_statement (assignment_expression
410
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
411
- right: (object (spread_element (identifier) @cjs_spread))) @stmt)
412
- (#eq? @mod "module") (#eq? @prop "exports"))
413
- (expression_statement (assignment_expression
414
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
415
- right: (object (pair key: (property_identifier) @cjs_export_name value: (identifier) @cjs_local))))
416
- (#eq? @mod "module") (#eq? @prop "exports")
417
- (expression_statement (assignment_expression
418
- left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
419
- right: (identifier) @cjs_local))
420
- (#eq? @mod "module") (#eq? @prop "exports")
421
- (expression_statement (assignment_expression
422
- left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
423
- right: (identifier) @cjs_local))
424
- (#eq? @exp "exports")
425
- ;; CJS function/arrow direct exports
426
- (expression_statement (assignment_expression
427
- left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
428
- right: (function) @cjs_fn))
429
- (#eq? @mod "module") (#eq? @prop "exports")
430
- (expression_statement (assignment_expression
431
- left: (member_expression object: (member_expression object: (identifier) @mod property: (property_identifier) @prop) property: (property_identifier) @cjs_export_name)
432
- right: (arrow_function) @cjs_fn))
433
- (#eq? @mod "module") (#eq? @prop "exports")
434
- (expression_statement (assignment_expression
435
- left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
436
- right: (function) @cjs_fn))
437
- (#eq? @exp "exports")
438
- (expression_statement (assignment_expression
439
- left: (member_expression object: (identifier) @exp property: (property_identifier) @cjs_export_name)
440
- right: (arrow_function) @cjs_fn))
441
- (#eq? @exp "exports")
442
- ;; CJS object export with function value
443
- (expression_statement (assignment_expression
444
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
445
- right: (object (pair key: (property_identifier) @cjs_export_name value: (function) @cjs_fn))))
446
- (#eq? @mod "module") (#eq? @prop "exports")
447
- (expression_statement (assignment_expression
448
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
449
- right: (object (pair key: (property_identifier) @cjs_export_name value: (arrow_function) @cjs_fn))))
450
- (#eq? @mod "module") (#eq? @prop "exports")
451
- ;; CJS: module.exports = { helper () {} }
452
- (expression_statement (assignment_expression
453
- left: (member_expression object: (identifier) @mod property: (property_identifier) @prop)
454
- right: (object (pair key: (property_identifier) @cjs_export_name value: (function_declaration) @cjs_fn))))
455
- (#eq? @mod "module") (#eq? @prop "exports")
456
- `,
457
- locals: `
458
- (function_declaration name: (identifier) @name)
459
- (generator_function_declaration name: (identifier) @name)
460
- (method_definition name: (property_identifier) @name)
461
- (class_declaration name: (identifier) @name)
462
- (variable_declarator name: (identifier) @name)
463
- `,
464
- importBindings: `
465
- (import_statement) @stmt
466
- (import_statement (string) @from) @stmt
467
- (import_statement (import_clause (identifier) @def) (string) @from) @stmt
468
- (import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname alias: (identifier) @alias))) (string) @from) @stmt
469
- (import_statement (import_clause (named_imports (import_specifier name: (identifier) @iname))) (string) @from) @stmt
470
- (import_statement (import_clause (namespace_import (identifier) @ns)) (string) @from) @stmt
471
- (lexical_declaration (variable_declarator name:(identifier) @def value: (call_expression (identifier) @req arguments: (arguments (string) @from)))) (#eq? @req "require")
472
- (lexical_declaration (variable_declarator (object_pattern) @pattern value: (call_expression (identifier) @req arguments: (arguments (string) @from)))) (#eq? @req "require")
473
- `
474
- },
475
- nodeTypes: {
476
- identifier: ["identifier"],
477
- propertyIdentifier: ["property_identifier"],
478
- shorthandPropertyIdentifier: ["shorthand_property_identifier", "shorthand_property_identifier_pattern"],
479
- memberExpression: "member_expression"
480
- },
481
- classifyDefinition: (n) => {
482
- const t = n.parent?.type;
483
- if (t === "function_declaration")
484
- return "function";
485
- if (t === "generator_function_declaration")
486
- return "function";
487
- if (t === "method_definition")
488
- return "function";
489
- if (t === "class_declaration")
490
- return "class";
491
- return "variable";
492
- },
493
- isDeclarationName: (node) => {
494
- const p = node.parent?.type;
495
- return !!p && [
496
- "function_declaration",
497
- "generator_function_declaration",
498
- "class_declaration",
499
- "variable_declarator",
500
- "import_specifier",
501
- "namespace_import",
502
- "import_clause",
503
- // Method names in classes: needed so that editing a method name is
504
- // classified as a definition change, not an unrecognised node.
505
- "method_definition"
506
- ].includes(p);
507
- },
508
- createsBlockScope: (n) => n.type === "program" || n.type === "block" || n.type === "class_body",
509
- createsFunctionScope: (n) => n.type === "function_declaration" || n.type === "generator_function_declaration" || n.type === "function" || n.type === "function_expression" || n.type === "arrow_function" || n.type === "method_definition",
510
- membersAreImplicitlyInScope: false,
511
- supportsCrossModuleSymbols: true,
512
- native: {
513
- normalizeQuery: (_kind, query) => query.replace(/\(function\)/g, "(function_expression)").replace(JS_OBJECT_METHOD_EXPORT_PATTERN, JS_OBJECT_METHOD_EXPORT_NATIVE_PATTERN),
514
- authoritativeKinds: ["exports"],
515
- notes: ["normalizes function node compatibility for native javascript grammar"]
516
- }
517
- };
518
- registerLanguage(JAVASCRIPT_DEF);
519
-
520
- // dist/util/identifiers.js
521
- function hasNonAsciiCodePoint(value, includeC0Controls = false) {
522
- for (const character of value) {
523
- const codePoint = character.codePointAt(0);
524
- if (codePoint > 127 || includeC0Controls && codePoint <= 31)
525
- return true;
526
- }
527
- return false;
528
- }
529
- var ECMASCRIPT_IDENTIFIER_SOURCE = String.raw`[$_\p{ID_Start}](?:[$_\p{ID_Continue}]|\u200c|\u200d)*`;
530
- var BLOOM_FILTER_IDENTIFIER_SOURCE = String.raw`[A-Za-z0-9_$\u0000-\u0008\u000E-\u001B\u007F-\u009F\u200C\u200D\u0080-\u{10FFFF}]+`;
531
- var XID_IDENTIFIER_SOURCE = String.raw`[_\p{XID_Start}][_\p{XID_Continue}]*`;
532
- var PHP_IDENTIFIER_SOURCE = String.raw`[A-Za-z_\u{80}-\u{10FFFF}][A-Za-z0-9_\u{80}-\u{10FFFF}]*`;
533
- var JAVA_IDENTIFIER_IGNORABLE_SOURCE = String.raw`\p{Cf}\u0000-\u0008\u000E-\u001B\u007F-\u009F`;
534
- var CSHARP_IDENTIFIER_FORMAT_SOURCE = String.raw`\p{Cf}`;
535
- var JAVA_IDENTIFIER_SOURCE = String.raw`[\p{L}\p{Nl}\p{Sc}\p{Pc}][\p{L}\p{Nl}\p{Sc}\p{Pc}\p{Nd}\p{Mn}\p{Mc}${JAVA_IDENTIFIER_IGNORABLE_SOURCE}]*`;
536
- var CSHARP_IDENTIFIER_SOURCE = String.raw`@?[\p{L}\p{Nl}_][\p{L}\p{Nl}_\p{Nd}\p{Pc}\p{Mn}\p{Mc}${CSHARP_IDENTIFIER_FORMAT_SOURCE}]*`;
537
- var GO_IDENTIFIER_SOURCE = String.raw`[\p{L}_][\p{L}\p{Nd}_]*`;
538
- var KOTLIN_IDENTIFIER_SOURCE = String.raw`[\p{L}_][\p{L}\p{Nd}_]*`;
539
-
540
- // dist/languages/definitions/python.js
541
- var PYTHON_DEF = {
542
- id: "python",
543
- extensions: [".py", ".pyi"],
544
- usesQueryDrivenLocals: true,
545
- structure: {
546
- blocks: [
547
- {
548
- type: "class_definition",
549
- nameQuery: "name: (identifier) @chunk.name",
550
- captureId: "class"
551
- },
552
- {
553
- type: "function_definition",
554
- nameQuery: "name: (identifier) @chunk.name",
555
- captureId: "function"
556
- },
557
- // Docstrings - only capture top-level module docstrings as standalone chunks
558
- {
559
- type: "expression_statement",
560
- nameQuery: "(string) @chunk.docstring",
561
- isBlock: false,
562
- parentType: "module"
563
- },
564
- // Top level assignments
565
- {
566
- type: "assignment",
567
- nameQuery: "left: (identifier) @chunk.name",
568
- captureId: "module_var"
569
- },
570
- // Imports
571
- { type: "import_statement", captureId: "imports" },
572
- { type: "import_from_statement", captureId: "imports" }
573
- ],
574
- splitPoints: [
575
- "if_statement",
576
- "for_statement",
577
- "while_statement",
578
- "try_statement",
579
- "with_statement",
580
- "match_statement"
581
- ],
582
- comments: ["comment"]
583
- },
584
- graph: {
585
- imports: `
586
- (import_statement) @stmt
587
- (import_from_statement) @stmt
588
- (future_import_statement) @stmt
589
- `,
590
- // NOTE: These __all__ queries only capture module-level assignments.
591
- // Dynamic __all__ definitions inside functions, conditionals, or loops
592
- // (e.g., `if PY3: __all__ = [...]`) are not detected by these patterns.
593
- // This is a known limitation - such patterns are rare in practice.
594
- exports: `
595
- ;; __all__ = ["a", "b"] - simple list assignment
596
- (assignment left: (identifier) @left right: (list (string)+ @all_item)) @stmt
597
- ;; __all__ = ("a", "b") - tuple assignment
598
- (assignment left: (identifier) @left right: (tuple (string)+ @all_item)) @stmt
599
- ;; __all__ = ["a"] + ["b"] - concatenation (captures strings in both sides)
600
- (assignment left: (identifier) @left right: (binary_operator (list (string)+ @all_item))) @stmt
601
- (assignment left: (identifier) @left right: (binary_operator right: (list (string)+ @all_item))) @stmt
602
- ;; __all__.extend(["a"]) - extend pattern
603
- (expression_statement (call function: (attribute object: (identifier) @left attribute: (identifier) @method) arguments: (argument_list (list (string)+ @all_item)))) @stmt
604
- ;; __all__.append("a") - append pattern
605
- (expression_statement (call function: (attribute object: (identifier) @left attribute: (identifier) @method) arguments: (argument_list (string) @all_item))) @stmt
606
- ;; __all__ += ["a"] - augmented assignment
607
- (augmented_assignment left: (identifier) @left right: (list (string)+ @all_item)) @stmt
608
- (function_definition name: (identifier) @name)
609
- (class_definition name: (identifier) @name)
610
- (assignment left: (identifier) @name)
611
- `,
612
- locals: `
613
- (function_definition name: (identifier) @name)
614
- (class_definition name: (identifier) @name)
615
- (assignment left: (identifier) @name)
616
- ;; \`case Point(x=x, y=y):\` binds the right-hand identifier of a keyword
617
- ;; pattern as a new local, distinct from the left-hand attribute name it
618
- ;; matches against.
619
- ;; A bare identifier in a case pattern is represented as a single-name
620
- ;; dotted_name inside a case_pattern. Nested tuple/list/or patterns
621
- ;; preserve this shape for each capture.
622
- (case_pattern (dotted_name (identifier) @name))
623
- ;; \`case value as alias:\` binds the direct identifier child as its alias.
624
- (as_pattern (identifier) @name)
625
- ;; \`case [head, *tail]:\` binds the capture after the splat.
626
- (splat_pattern (identifier) @name)
627
- `,
628
- importBindings: `
629
- (import_statement) @stmt
630
- (import_from_statement) @stmt
631
- (future_import_statement) @stmt
632
- `
633
- },
634
- nodeTypes: {
635
- identifier: ["identifier"],
636
- propertyIdentifier: ["identifier"],
637
- memberExpression: "attribute"
638
- },
639
- classifyDefinition: (n) => {
640
- const t = n.parent?.type;
641
- if (t === "function_definition")
642
- return "function";
643
- if (t === "class_definition")
644
- return "class";
645
- return "variable";
646
- },
647
- scopeDeclarationNames: (node) => {
648
- const parentType = node.parent?.type;
649
- return parentType === "case_pattern" || parentType === "as_pattern" || parentType === "splat_pattern" || parentType === "dotted_name";
650
- },
651
- isDeclarationName: (node) => {
652
- const parent = node.parent;
653
- const t = parent?.type;
654
- if (t === "dotted_name" && parent && parent.namedChildren.length === 1 && (parent.parent?.type === "keyword_pattern" || parent.parent?.type === "case_pattern"))
655
- return true;
656
- if (parent?.type === "as_pattern")
657
- return true;
658
- if (t === "splat_pattern")
659
- return true;
660
- return !!t && ["function_definition", "class_definition", "assignment", "aliased_import"].includes(t);
661
- },
662
- createsBlockScope: (n) => n.type === "module" || n.type === "block",
663
- createsFunctionScope: (n) => n.type === "function_definition" || n.type === "lambda",
664
- membersAreImplicitlyInScope: false,
665
- supportsCrossModuleSymbols: true,
666
- normalizeIdentifier: (name) => hasNonAsciiCodePoint(name) ? name.normalize("NFKC") : name
667
- };
668
- registerLanguage(PYTHON_DEF);
669
-
670
- // dist/languages/definitions/php.js
671
- var PHP_DEF = {
672
- id: "php",
673
- extensions: [".php"],
674
- usesQueryDrivenLocals: true,
675
- structure: {
676
- blocks: [
677
- {
678
- type: "namespace_definition",
679
- nameQuery: "name: (namespace_name) @chunk.name",
680
- captureId: "namespace"
681
- },
682
- {
683
- type: "class_declaration",
684
- nameQuery: "name: (name) @chunk.name",
685
- captureId: "class"
686
- },
687
- {
688
- type: "interface_declaration",
689
- nameQuery: "name: (name) @chunk.name",
690
- captureId: "interface"
691
- },
692
- {
693
- type: "trait_declaration",
694
- nameQuery: "name: (name) @chunk.name",
695
- captureId: "trait"
696
- },
697
- {
698
- type: "enum_declaration",
699
- nameQuery: "name: (name) @chunk.name",
700
- captureId: "enum"
701
- },
702
- {
703
- type: "function_definition",
704
- nameQuery: "name: (name) @chunk.name",
705
- captureId: "function"
706
- },
707
- {
708
- type: "method_declaration",
709
- nameQuery: "name: (name) @chunk.name",
710
- captureId: "method"
711
- },
712
- {
713
- type: "const_declaration",
714
- nameQuery: "(const_element (name) @chunk.name)",
715
- captureId: "const"
716
- }
717
- ],
718
- splitPoints: [
719
- "if_statement",
720
- "switch_statement",
721
- "for_statement",
722
- "foreach_statement",
723
- "while_statement",
724
- "do_statement",
725
- "try_statement",
726
- "match_expression"
727
- ],
728
- comments: ["comment"]
729
- },
730
- graph: {
731
- imports: `
732
- (require_expression) @stmt
733
- (include_expression) @stmt
734
- (require_once_expression) @stmt
735
- (include_once_expression) @stmt
736
- (namespace_use_declaration) @stmt
737
- `,
738
- exports: `
739
- (namespace_definition name: (namespace_name) @name)
740
- (class_declaration name: (name) @name)
741
- (interface_declaration name: (name) @name)
742
- (trait_declaration name: (name) @name)
743
- (enum_declaration name: (name) @name)
744
- (enum_case name: (name) @name)
745
- (function_definition name: (name) @name)
746
- (const_declaration (const_element (name) @name))
747
- `,
748
- locals: `
749
- (class_declaration name: (name) @name)
750
- (interface_declaration name: (name) @name)
751
- (trait_declaration name: (name) @name)
752
- (enum_declaration name: (name) @name)
753
- (enum_case name: (name) @name)
754
- (function_definition name: (name) @name)
755
- (method_declaration name: (name) @name)
756
- (const_declaration (const_element (name) @name))
757
- (property_element (variable_name) @name)
758
- `,
759
- importBindings: `
760
- (require_expression) @stmt
761
- (include_expression) @stmt
762
- (require_once_expression) @stmt
763
- (include_once_expression) @stmt
764
- (namespace_use_declaration) @stmt
765
- `
766
- },
767
- nodeTypes: {
768
- identifier: ["name", "variable_name", "namespace_name", "qualified_name", "relative_name"],
769
- propertyIdentifier: ["name"],
770
- memberExpression: "member_access_expression"
771
- },
772
- classifyDefinition: (node) => {
773
- const parentType = node.parent?.type;
774
- if (parentType === "class_declaration")
775
- return "class";
776
- if (parentType === "interface_declaration")
777
- return "interface";
778
- if (parentType === "trait_declaration")
779
- return "trait";
780
- if (parentType === "enum_declaration")
781
- return "type";
782
- if (parentType === "enum_case")
783
- return "constant";
784
- if (parentType === "function_definition")
785
- return "function";
786
- if (parentType === "method_declaration")
787
- return "method";
788
- if (parentType === "namespace_definition")
789
- return "namespace";
790
- if (parentType === "const_element" || parentType === "const_declaration") {
791
- return "constant";
792
- }
793
- return "variable";
794
- },
795
- normalizeIdentifier: (name) => name.replace(/^\$/, ""),
796
- isDeclarationName: (node) => {
797
- const parent = node.parent;
798
- if (!parent)
799
- return false;
800
- const nameFieldOwnerTypes = /* @__PURE__ */ new Set([
801
- "namespace_definition",
802
- "class_declaration",
803
- "interface_declaration",
804
- "trait_declaration",
805
- "enum_declaration",
806
- "enum_case",
807
- "function_definition",
808
- "method_declaration"
809
- ]);
810
- if (nameFieldOwnerTypes.has(parent.type)) {
811
- return parent.childForFieldName("name")?.id === node.id;
812
- }
813
- if (parent.type === "property_element" && node.type === "variable_name")
814
- return true;
815
- return parent.type === "const_element" && parent.namedChildren.some((child) => child.id === node.id && child.type === "name");
816
- },
817
- scopeDeclarationNames: (node) => node.type === "variable_name" && node.parent?.type === "property_element",
818
- createsFunctionScope: (node) => node.type === "function_definition" || node.type === "method_declaration",
819
- membersAreImplicitlyInScope: false,
820
- supportsCrossModuleSymbols: true
821
- };
822
- registerLanguage(PHP_DEF);
823
-
824
- // dist/languages/definitions/html.js
825
- var HTML_DEF = {
826
- id: "html",
827
- extensions: [".html", ".htm"],
828
- structure: {
829
- blocks: [
830
- {
831
- type: "element",
832
- nameQuery: `(start_tag (attribute (attribute_name) @attr (#eq? @attr "id") (quoted_attribute_value (attribute_value) @chunk.name)))`,
833
- captureId: "element"
834
- },
835
- { type: "script_element", captureId: "script" },
836
- { type: "style_element", captureId: "style" }
837
- ],
838
- splitPoints: ["element"],
839
- comments: ["comment"]
840
- },
841
- graph: {
842
- imports: `
843
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
844
- (element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#match? @tag "^(link|a)$")
845
- (element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#match? @tag "^(link|a)$")
846
- (element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#eq? @tag "img")
847
- (element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt (#eq? @tag "img")
848
- `,
849
- exports: "",
850
- locals: `
851
- (attribute (attribute_name) @attr (#eq? @attr "id") (quoted_attribute_value (attribute_value) @name))
852
- `,
853
- importBindings: `
854
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
855
- (element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @from)))) @stmt (#match? @tag "^(link|a)$")
856
- (element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "href") (quoted_attribute_value (attribute_value) @from)))) @stmt (#match? @tag "^(link|a)$")
857
- (element (start_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt (#eq? @tag "img")
858
- (element (self_closing_tag (tag_name) @tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt (#eq? @tag "img")
859
- `
860
- },
861
- nodeTypes: {
862
- identifier: ["attribute_value", "tag_name"]
863
- }
864
- };
865
- registerLanguage(HTML_DEF);
866
-
867
- // dist/languages/definitions/htmlStub.js
868
- function htmlStubLanguage(id, extensions) {
869
- return {
870
- id,
871
- extensions,
872
- structure: {
873
- blocks: [],
874
- splitPoints: [],
875
- comments: []
876
- },
877
- graph: {
878
- imports: "",
879
- exports: "",
880
- locals: "",
881
- importBindings: ""
882
- },
883
- nodeTypes: {
884
- identifier: []
885
- }
886
- };
887
- }
888
-
889
- // dist/languages/definitions/astro.js
890
- var ASTRO_DEF = htmlStubLanguage("astro", [".astro"]);
891
- registerLanguage(ASTRO_DEF);
892
-
893
- // dist/languages/definitions/hbs.js
894
- var HBS_DEF = htmlStubLanguage("hbs", [".hbs", ".handlebars"]);
895
- registerLanguage(HBS_DEF);
896
-
897
- // dist/languages/definitions/markdown.js
898
- var MARKDOWN_DEF = htmlStubLanguage("markdown", [".md"]);
899
- registerLanguage(MARKDOWN_DEF);
900
-
901
- // dist/languages/definitions/mdx.js
902
- var MDX_DEF = htmlStubLanguage("mdx", [".mdx"]);
903
- registerLanguage(MDX_DEF);
904
-
905
- // dist/languages/definitions/rst.js
906
- var RST_DEF = htmlStubLanguage("rst", [".rst"]);
907
- registerLanguage(RST_DEF);
908
-
909
- // dist/languages/definitions/adoc.js
910
- var ADOC_DEF = htmlStubLanguage("adoc", [".adoc", ".asciidoc"]);
911
- registerLanguage(ADOC_DEF);
912
-
913
- // dist/languages/definitions/cssLike.js
914
- function cssLikeStructure() {
915
- return {
916
- blocks: [
917
- { type: "rule_set", captureId: "rule" },
918
- { type: "media_statement", captureId: "media" },
919
- { type: "keyframes_statement", captureId: "keyframes" }
920
- ],
921
- splitPoints: ["rule_set"],
922
- comments: ["comment", "js_comment"]
923
- };
924
- }
925
- function cssLikeGraph() {
926
- return {
927
- imports: `
928
- (import_statement (string_value) @mod) @stmt
929
- `,
930
- exports: "",
931
- locals: `
932
- (class_selector (class_name) @name)
933
- (id_selector (id_name) @name)
934
- `,
935
- importBindings: `
936
- (import_statement (string_value) @from) @stmt
937
- `
938
- };
939
- }
940
- function cssLikeNodeTypes() {
941
- return {
942
- identifier: ["class_name", "id_name"]
943
- };
944
- }
945
-
946
- // dist/languages/definitions/css.js
947
- var CSS_DEF = {
948
- id: "css",
949
- extensions: [".css"],
950
- structure: cssLikeStructure(),
951
- graph: cssLikeGraph(),
952
- nodeTypes: cssLikeNodeTypes()
953
- };
954
- registerLanguage(CSS_DEF);
955
-
956
- // dist/languages/definitions/scss.js
957
- var SCSS_SYMBOL_QUERY_PATTERNS = [
958
- "(mixin_statement (name) @name)",
959
- "(function_statement (name) @name)",
960
- "(variable_declaration (variable) @name)",
961
- "(class_selector (class_name) @name)",
962
- "(id_selector (id_name) @name)"
963
- ];
964
- var SCSS_DEF = {
965
- id: "scss",
966
- extensions: [".scss"],
967
- structure: {
968
- blocks: [
969
- { type: "rule_set", captureId: "rule" },
970
- { type: "mixin_statement", captureId: "mixin" },
971
- { type: "function_statement", captureId: "function" },
972
- { type: "media_statement", captureId: "media" },
973
- { type: "keyframes_statement", captureId: "keyframes" }
974
- ],
975
- splitPoints: ["rule_set", "mixin_statement", "function_statement"],
976
- comments: ["comment", "js_comment"]
977
- },
978
- graph: {
979
- imports: `
980
- (import_statement (string_value) @mod) @stmt
981
- (use_statement (string_value) @mod) @stmt
982
- (forward_statement (string_value) @mod) @stmt
983
- `,
984
- exports: `
985
- (mixin_statement (name) @name)
986
- (function_statement (name) @name)
987
- (variable_declaration (variable) @name)
988
- `,
989
- locals: `
990
- (mixin_statement (name) @name)
991
- (function_statement (name) @name)
992
- (variable_declaration (variable) @name)
993
- (class_selector (class_name) @name)
994
- (id_selector (id_name) @name)
995
- `,
996
- importBindings: `
997
- (import_statement (string_value) @from) @stmt
998
- (use_statement (string_value) @from) @stmt
999
- (forward_statement (string_value) @from) @stmt
1000
- `
1001
- },
1002
- nodeTypes: {
1003
- identifier: ["name", "variable", "class_name", "id_name"]
1004
- },
1005
- native: {
1006
- normalizeQuery: (_kind, query) => SCSS_SYMBOL_QUERY_PATTERNS.some((pattern) => query.includes(pattern)) ? "" : query,
1007
- notes: ["skips unsupported SCSS symbol queries in the native runtime"]
1008
- }
1009
- };
1010
- registerLanguage(SCSS_DEF);
1011
-
1012
- // dist/languages/definitions/less.js
1013
- var LESS_DEF = {
1014
- id: "less",
1015
- extensions: [".less"],
1016
- structure: cssLikeStructure(),
1017
- graph: cssLikeGraph(),
1018
- nodeTypes: cssLikeNodeTypes()
1019
- };
1020
- registerLanguage(LESS_DEF);
1021
-
1022
- // dist/languages/definitions/vue.js
1023
- var VUE_DEF = {
1024
- id: "vue",
1025
- extensions: [".vue"],
1026
- structure: {
1027
- blocks: [
1028
- { type: "template_element", captureId: "template" },
1029
- { type: "script_element", captureId: "script" },
1030
- { type: "style_element", captureId: "style" }
1031
- ],
1032
- splitPoints: ["template_element", "script_element", "style_element"],
1033
- comments: ["comment"]
1034
- },
1035
- graph: {
1036
- imports: `
1037
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
1038
- `,
1039
- exports: "",
1040
- locals: "",
1041
- importBindings: `
1042
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
1043
- `
1044
- },
1045
- nodeTypes: {
1046
- identifier: ["attribute_value"]
1047
- }
1048
- };
1049
- registerLanguage(VUE_DEF);
1050
-
1051
- // dist/languages/definitions/svelte.js
1052
- var SVELTE_DEF = {
1053
- id: "svelte",
1054
- extensions: [".svelte"],
1055
- structure: {
1056
- blocks: [
1057
- { type: "script_element", captureId: "script" },
1058
- { type: "style_element", captureId: "style" },
1059
- { type: "element", captureId: "element" }
1060
- ],
1061
- splitPoints: ["script_element", "style_element"],
1062
- comments: ["comment"]
1063
- },
1064
- graph: {
1065
- imports: `
1066
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @mod)))) @stmt
1067
- `,
1068
- exports: "",
1069
- locals: "",
1070
- importBindings: `
1071
- (script_element (start_tag (attribute (attribute_name) @attr (#eq? @attr "src") (quoted_attribute_value (attribute_value) @from)))) @stmt
1072
- `
1073
- },
1074
- nodeTypes: {
1075
- identifier: ["attribute_value"]
1076
- }
1077
- };
1078
- registerLanguage(SVELTE_DEF);
1079
-
1080
- // dist/languages/definitions/ruby.js
1081
- var RUBY_DEF = {
1082
- id: "ruby",
1083
- extensions: [".rb"],
1084
- structure: {
1085
- blocks: [
1086
- {
1087
- type: "class",
1088
- nameQuery: "name: (constant) @chunk.name",
1089
- captureId: "class"
1090
- },
1091
- {
1092
- type: "module",
1093
- nameQuery: "name: (constant) @chunk.name",
1094
- captureId: "module"
1095
- },
1096
- {
1097
- type: "method",
1098
- nameQuery: "name: (identifier) @chunk.name",
1099
- captureId: "method"
1100
- },
1101
- {
1102
- type: "singleton_method",
1103
- nameQuery: "name: (identifier) @chunk.name",
1104
- captureId: "method"
1105
- }
1106
- ],
1107
- splitPoints: ["if", "unless", "case", "while", "until", "for", "begin"],
1108
- comments: ["comment"]
1109
- },
1110
- graph: {
1111
- imports: `
1112
- (call method: (identifier) @method arguments: (argument_list (string (string_content) @mod)) (#match? @method "^(require|require_relative)$")) @stmt
1113
- `,
1114
- exports: `
1115
- (class name: (constant) @name)
1116
- (module name: (constant) @name)
1117
- (method name: (identifier) @name)
1118
- (assignment left: (constant) @name)
1119
- `,
1120
- locals: `
1121
- (class name: (constant) @name)
1122
- (module name: (constant) @name)
1123
- (method name: (identifier) @name)
1124
- (assignment left: (identifier) @name)
1125
- (assignment left: (constant) @name)
1126
- `,
1127
- importBindings: `
1128
- ((call method: (identifier) @method arguments: (argument_list (string (string_content) @from))) @stmt (#match? @method "^(require|require_relative)$"))
1129
- `
1130
- },
1131
- nodeTypes: {
1132
- identifier: ["identifier", "constant"],
1133
- memberExpression: "call"
1134
- },
1135
- supportsCrossModuleSymbols: true,
1136
- classifyDefinition: (node) => {
1137
- const assignment = node.parent;
1138
- const value = assignment?.childForFieldName("right");
1139
- if (assignment?.type === "assignment" && assignment.childForFieldName("left")?.id === node.id && value?.type === "call" && value.childForFieldName("receiver")?.text === "Struct" && value.childForFieldName("method")?.text === "new") {
1140
- return "class";
1141
- }
1142
- return "variable";
1143
- },
1144
- scopeDeclarationNames: (node) => node.type === "constant" && node.parent?.type === "assignment",
1145
- createsFunctionScope: (node) => node.type === "method" || node.type === "singleton_method",
1146
- createsBlockScope: (node) => node.type === "do_block" || node.type === "block",
1147
- isDeclarationName: (node) => {
1148
- const p = node.parent;
1149
- if (!p)
1150
- return false;
1151
- if (p.type === "class" && p.childForFieldName("name")?.id === node.id)
1152
- return true;
1153
- if (p.type === "module" && p.childForFieldName("name")?.id === node.id)
1154
- return true;
1155
- if (p.type === "method" && p.childForFieldName("name")?.id === node.id)
1156
- return true;
1157
- if (p.type === "singleton_method" && p.childForFieldName("name")?.id === node.id)
1158
- return true;
1159
- if (p.type === "assignment" && p.childForFieldName("left")?.id === node.id)
1160
- return true;
1161
- return false;
1162
- }
1163
- };
1164
- registerLanguage(RUBY_DEF);
1165
-
1166
- // dist/languages/definitions/go.js
1167
- var GO_DEF = {
1168
- id: "go",
1169
- extensions: [".go"],
1170
- usesQueryDrivenLocals: true,
1171
- structure: {
1172
- blocks: [
1173
- {
1174
- type: "function_declaration",
1175
- nameQuery: "name: (identifier) @chunk.name",
1176
- captureId: "function"
1177
- },
1178
- {
1179
- type: "method_declaration",
1180
- nameQuery: "name: (field_identifier) @chunk.name",
1181
- captureId: "method"
1182
- },
1183
- {
1184
- type: "type_declaration",
1185
- nameQuery: "(type_spec name: (type_identifier) @chunk.name)",
1186
- captureId: "type"
1187
- }
1188
- ],
1189
- splitPoints: [
1190
- "if_statement",
1191
- "for_statement",
1192
- "expression_switch_statement",
1193
- "type_switch_statement",
1194
- "select_statement"
1195
- ],
1196
- comments: ["comment"]
1197
- },
1198
- graph: {
1199
- imports: `
1200
- (import_spec path: (interpreted_string_literal) @mod) @stmt
1201
- `,
1202
- exports: `
1203
- (function_declaration name: (identifier) @name)
1204
- (method_declaration name: (field_identifier) @name)
1205
- (type_spec name: (type_identifier) @name)
1206
- (const_spec name: (identifier) @name)
1207
- (var_spec name: (identifier) @name)
1208
- `,
1209
- locals: `
1210
- (function_declaration name: (identifier) @name)
1211
- (method_declaration name: (field_identifier) @name)
1212
- (type_spec name: (type_identifier) @name)
1213
- (parameter_declaration name: (identifier) @name)
1214
- (variadic_parameter_declaration name: (identifier) @name)
1215
- (short_var_declaration left: (expression_list (identifier) @name))
1216
- (var_spec name: (identifier) @name)
1217
- (const_spec name: (identifier) @name)
1218
- (type_spec type: (struct_type (field_declaration_list (field_declaration name: (field_identifier) @name))))
1219
- (range_clause left: (expression_list (identifier) @name) (#not-eq? @name "_"))
1220
- `,
1221
- importBindings: `
1222
- (import_spec name: (package_identifier) @alias path: (interpreted_string_literal) @from) @stmt
1223
- (import_spec path: (interpreted_string_literal) @from) @stmt
1224
- `
1225
- },
1226
- nodeTypes: {
1227
- identifier: ["identifier", "field_identifier", "type_identifier", "package_identifier"],
1228
- memberExpression: "selector_expression"
1229
- },
1230
- supportsCrossModuleSymbols: true,
1231
- classifyDefinition: (node) => {
1232
- const parent = node.parent;
1233
- if (!parent)
1234
- return "variable";
1235
- if (parent.type === "function_declaration" || parent.type === "method_declaration")
1236
- return "function";
1237
- if (parent.type === "type_spec" && parent.childForFieldName("name")?.id === node.id)
1238
- return "type";
1239
- return "variable";
1240
- },
1241
- createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "method_declaration" || node.type === "func_literal",
1242
- createsBlockScope: (node) => node.type === "block" || node.type === "for_statement",
1243
- membersAreImplicitlyInScope: false,
1244
- isDeclarationName: (node) => {
1245
- const p = node.parent;
1246
- if (!p)
1247
- return false;
1248
- if (p.type === "function_declaration" && p.childForFieldName("name")?.id === node.id)
1249
- return true;
1250
- if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
1251
- return true;
1252
- if (p.type === "type_spec" && p.childForFieldName("name")?.id === node.id)
1253
- return true;
1254
- if (p.type === "var_spec" && p.childForFieldName("name")?.id === node.id)
1255
- return true;
1256
- if (p.type === "const_spec" && p.childForFieldName("name")?.id === node.id)
1257
- return true;
1258
- if (p.type === "expression_list" && p.parent?.type === "short_var_declaration")
1259
- return node.type === "identifier";
1260
- if (p.type === "expression_list" && p.parent?.type === "range_clause")
1261
- return node.type === "identifier" && node.text !== "_";
1262
- if (p.type === "parameter_declaration" || p.type === "variadic_parameter_declaration") {
1263
- return node.type === "identifier";
1264
- }
1265
- if (p.type === "field_declaration" && node.type === "field_identifier")
1266
- return true;
1267
- return false;
1268
- },
1269
- scopeDeclarationNames: (node) => node.type === "field_identifier" && node.parent?.type === "field_declaration" || node.type === "identifier" && node.parent?.type === "expression_list" && node.parent.parent?.type === "range_clause"
1270
- };
1271
- registerLanguage(GO_DEF);
1272
-
1273
- // dist/languages/definitions/java.js
1274
- var JAVA_IDENTIFIER_IGNORABLE_PATTERN = new RegExp(`[${JAVA_IDENTIFIER_IGNORABLE_SOURCE}]`, "gu");
1275
- var JAVA_DEF = {
1276
- id: "java",
1277
- extensions: [".java"],
1278
- usesQueryDrivenLocals: true,
1279
- structure: {
1280
- blocks: [
1281
- {
1282
- type: "class_declaration",
1283
- nameQuery: "name: (identifier) @chunk.name",
1284
- captureId: "class"
1285
- },
1286
- {
1287
- type: "record_declaration",
1288
- nameQuery: "name: (identifier) @chunk.name",
1289
- captureId: "class"
1290
- },
1291
- {
1292
- type: "interface_declaration",
1293
- nameQuery: "name: (identifier) @chunk.name",
1294
- captureId: "interface"
1295
- },
1296
- {
1297
- type: "enum_declaration",
1298
- nameQuery: "name: (identifier) @chunk.name",
1299
- captureId: "enum"
1300
- },
1301
- {
1302
- type: "annotation_type_declaration",
1303
- nameQuery: "name: (identifier) @chunk.name",
1304
- captureId: "interface"
1305
- },
1306
- {
1307
- type: "method_declaration",
1308
- nameQuery: "name: (identifier) @chunk.name",
1309
- captureId: "method"
1310
- },
1311
- {
1312
- type: "constructor_declaration",
1313
- nameQuery: "name: (identifier) @chunk.name",
1314
- captureId: "method"
1315
- }
1316
- ],
1317
- splitPoints: ["if_statement", "for_statement", "while_statement", "try_statement", "switch_expression"],
1318
- comments: ["line_comment", "block_comment"]
1319
- },
1320
- graph: {
1321
- imports: `
1322
- (import_declaration . (_) @mod) @stmt
1323
- `,
1324
- exports: `
1325
- (class_declaration name: (identifier) @name)
1326
- (record_declaration name: (identifier) @name)
1327
- (interface_declaration name: (identifier) @name)
1328
- (enum_declaration name: (identifier) @name)
1329
- (annotation_type_declaration name: (identifier) @name)
1330
- (enum_constant name: (identifier) @name)
1331
- (method_declaration name: (identifier) @name)
1332
- (field_declaration (variable_declarator name: (identifier) @name))
1333
- `,
1334
- locals: `
1335
- (class_declaration name: (identifier) @name)
1336
- (record_declaration name: (identifier) @name)
1337
- (interface_declaration name: (identifier) @name)
1338
- (enum_declaration name: (identifier) @name)
1339
- (annotation_type_declaration name: (identifier) @name)
1340
- (enum_constant name: (identifier) @name)
1341
- (method_declaration name: (identifier) @name)
1342
- (variable_declarator name: (identifier) @name)
1343
- `,
1344
- importBindings: `
1345
- (import_declaration . (_) @from) @stmt
1346
- `
1347
- },
1348
- nodeTypes: {
1349
- identifier: ["identifier", "type_identifier"],
1350
- memberExpression: "field_access"
1351
- },
1352
- supportsCrossModuleSymbols: true,
1353
- classifyDefinition: (node) => {
1354
- const parent = node.parent;
1355
- if (!parent)
1356
- return "variable";
1357
- if (parent.type === "method_declaration" || parent.type === "constructor_declaration")
1358
- return "method";
1359
- if (parent.type === "class_declaration" || parent.type === "record_declaration")
1360
- return "class";
1361
- if (parent.type === "interface_declaration" || parent.type === "annotation_type_declaration")
1362
- return "interface";
1363
- if (parent.type === "enum_declaration")
1364
- return "type";
1365
- return "variable";
1366
- },
1367
- createsFunctionScope: (node) => node.type === "method_declaration" || node.type === "constructor_declaration",
1368
- createsBlockScope: (node) => node.type === "block" || node.type === "class_body",
1369
- isDeclarationName: (node) => {
1370
- const p = node.parent;
1371
- if (!p)
1372
- return false;
1373
- if (p.type === "class_declaration" && p.childForFieldName("name")?.id === node.id)
1374
- return true;
1375
- if (p.type === "record_declaration" && p.childForFieldName("name")?.id === node.id)
1376
- return true;
1377
- if (p.type === "interface_declaration" && p.childForFieldName("name")?.id === node.id)
1378
- return true;
1379
- if (p.type === "annotation_type_declaration" && p.childForFieldName("name")?.id === node.id)
1380
- return true;
1381
- if (p.type === "enum_declaration" && p.childForFieldName("name")?.id === node.id)
1382
- return true;
1383
- if (p.type === "enum_constant" && p.childForFieldName("name")?.id === node.id)
1384
- return true;
1385
- if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
1386
- return true;
1387
- if (p.type === "variable_declarator" && p.childForFieldName("name")?.id === node.id)
1388
- return true;
1389
- if (p.type === "formal_parameter" && p.childForFieldName("name")?.id === node.id)
1390
- return true;
1391
- return false;
1392
- },
1393
- normalizeIdentifier: (name) => hasNonAsciiCodePoint(name, true) ? name.replace(JAVA_IDENTIFIER_IGNORABLE_PATTERN, "") : name
1394
- };
1395
- registerLanguage(JAVA_DEF);
1396
-
1397
- // dist/languages/definitions/csharp.js
1398
- var CSHARP_IDENTIFIER_FORMAT_PATTERN = new RegExp(`[${CSHARP_IDENTIFIER_FORMAT_SOURCE}]`, "gu");
1399
- var CSHARP_DEF = {
1400
- id: "csharp",
1401
- extensions: [".cs"],
1402
- usesQueryDrivenLocals: true,
1403
- structure: {
1404
- blocks: [
1405
- {
1406
- type: "class_declaration",
1407
- nameQuery: "name: (identifier) @chunk.name",
1408
- captureId: "class"
1409
- },
1410
- {
1411
- type: "record_declaration",
1412
- nameQuery: "name: (identifier) @chunk.name",
1413
- captureId: "class"
1414
- },
1415
- {
1416
- type: "interface_declaration",
1417
- nameQuery: "name: (identifier) @chunk.name",
1418
- captureId: "interface"
1419
- },
1420
- {
1421
- type: "enum_declaration",
1422
- nameQuery: "name: (identifier) @chunk.name",
1423
- captureId: "enum"
1424
- },
1425
- {
1426
- type: "method_declaration",
1427
- nameQuery: "name: (identifier) @chunk.name",
1428
- captureId: "method"
1429
- },
1430
- {
1431
- type: "namespace_declaration",
1432
- nameQuery: "name: (identifier) @chunk.name",
1433
- captureId: "namespace"
1434
- }
1435
- ],
1436
- splitPoints: [
1437
- "if_statement",
1438
- "for_statement",
1439
- "foreach_statement",
1440
- "while_statement",
1441
- "switch_statement",
1442
- "try_statement"
1443
- ],
1444
- comments: ["comment"]
1445
- },
1446
- graph: {
1447
- imports: `
1448
- (using_directive . (_) @mod) @stmt
1449
- `,
1450
- exports: `
1451
- (class_declaration name: (identifier) @name)
1452
- (record_declaration name: (identifier) @name)
1453
- (interface_declaration name: (identifier) @name)
1454
- (enum_declaration name: (identifier) @name)
1455
- (enum_member_declaration name: (identifier) @name)
1456
- (method_declaration name: (identifier) @name)
1457
- (property_declaration name: (identifier) @name)
1458
- `,
1459
- locals: `
1460
- (class_declaration name: (identifier) @name)
1461
- (record_declaration name: (identifier) @name)
1462
- (interface_declaration name: (identifier) @name)
1463
- (enum_declaration name: (identifier) @name)
1464
- (enum_member_declaration name: (identifier) @name)
1465
- (method_declaration name: (identifier) @name)
1466
- (variable_declarator (identifier) @name)
1467
- (declaration_pattern name: (identifier) @name)
1468
- `,
1469
- importBindings: `
1470
- (using_directive name: (identifier) @alias . (_) @from) @stmt
1471
- (using_directive . (_) @from) @stmt
1472
- `
1473
- },
1474
- nodeTypes: {
1475
- identifier: ["identifier"],
1476
- memberExpression: "member_access_expression"
1477
- },
1478
- supportsCrossModuleSymbols: true,
1479
- classifyDefinition: (node) => {
1480
- const parent = node.parent;
1481
- if (!parent)
1482
- return "variable";
1483
- if (parent.type === "method_declaration" || parent.type === "constructor_declaration")
1484
- return "method";
1485
- if (parent.type === "class_declaration" || parent.type === "record_declaration")
1486
- return "class";
1487
- if (parent.type === "interface_declaration")
1488
- return "interface";
1489
- if (parent.type === "enum_declaration")
1490
- return "type";
1491
- return "variable";
1492
- },
1493
- createsFunctionScope: (node) => node.type === "method_declaration" || node.type === "constructor_declaration",
1494
- createsBlockScope: (node) => node.type === "block" || node.type === "declaration_list",
1495
- isDeclarationName: (node) => {
1496
- const p = node.parent;
1497
- if (!p)
1498
- return false;
1499
- if (p.type === "class_declaration" && p.childForFieldName("name")?.id === node.id)
1500
- return true;
1501
- if (p.type === "record_declaration" && p.childForFieldName("name")?.id === node.id)
1502
- return true;
1503
- if (p.type === "interface_declaration" && p.childForFieldName("name")?.id === node.id)
1504
- return true;
1505
- if (p.type === "enum_declaration" && p.childForFieldName("name")?.id === node.id)
1506
- return true;
1507
- if (p.type === "enum_member_declaration" && p.childForFieldName("name")?.id === node.id)
1508
- return true;
1509
- if (p.type === "method_declaration" && p.childForFieldName("name")?.id === node.id)
1510
- return true;
1511
- if (p.type === "variable_declarator" && p.child(0)?.id === node.id)
1512
- return true;
1513
- if (p.type === "parameter" && p.childForFieldName("name")?.id === node.id)
1514
- return true;
1515
- if (p.type === "declaration_pattern" && p.childForFieldName("name")?.id === node.id)
1516
- return true;
1517
- return false;
1518
- },
1519
- normalizeIdentifier: (name) => {
1520
- const withoutVerbatimPrefix = name.startsWith("@") ? name.slice(1) : name;
1521
- return hasNonAsciiCodePoint(withoutVerbatimPrefix) ? withoutVerbatimPrefix.replace(CSHARP_IDENTIFIER_FORMAT_PATTERN, "") : withoutVerbatimPrefix;
1522
- }
1523
- };
1524
- registerLanguage(CSHARP_DEF);
1525
-
1526
- // dist/languages/definitions/rust.js
1527
- var RUST_DEF = {
1528
- id: "rust",
1529
- extensions: [".rs"],
1530
- usesQueryDrivenLocals: true,
1531
- structure: {
1532
- blocks: [
1533
- {
1534
- type: "function_item",
1535
- nameQuery: "name: (identifier) @chunk.name",
1536
- captureId: "function"
1537
- },
1538
- {
1539
- type: "struct_item",
1540
- nameQuery: "name: (type_identifier) @chunk.name",
1541
- captureId: "struct"
1542
- },
1543
- {
1544
- type: "enum_item",
1545
- nameQuery: "name: (type_identifier) @chunk.name",
1546
- captureId: "enum"
1547
- },
1548
- {
1549
- type: "impl_item",
1550
- nameQuery: "type: (type_identifier) @chunk.name",
1551
- captureId: "impl"
1552
- },
1553
- {
1554
- type: "mod_item",
1555
- nameQuery: "name: (identifier) @chunk.name",
1556
- captureId: "module"
1557
- },
1558
- {
1559
- type: "macro_definition",
1560
- nameQuery: "name: (identifier) @chunk.name",
1561
- captureId: "macro"
1562
- }
1563
- ],
1564
- splitPoints: ["if_expression", "for_expression", "while_expression", "loop_expression", "match_expression"],
1565
- comments: ["line_comment", "block_comment"]
1566
- },
1567
- graph: {
1568
- imports: `
1569
- (mod_item name: (identifier) @mod) @stmt
1570
- (extern_crate_declaration name: (identifier) @mod) @stmt
1571
- (use_declaration argument: (_) @mod) @stmt
1572
- `,
1573
- exports: `
1574
- (function_item name: (identifier) @name) @stmt
1575
- (struct_item name: (type_identifier) @name) @stmt
1576
- (trait_item name: (type_identifier) @name) @stmt
1577
- (enum_item name: (type_identifier) @name) @stmt
1578
- (enum_variant name: (identifier) @name) @stmt
1579
- (const_item name: (identifier) @name) @stmt
1580
- (static_item name: (identifier) @name) @stmt
1581
- (macro_definition name: (identifier) @name) @stmt
1582
- (use_declaration argument: (scoped_identifier path: (_) @from name: (identifier) @src)) @stmt
1583
- (use_declaration argument: (identifier) @src) @stmt
1584
- ;; Grouped imports: \`use foo::{Bar, Baz};\` (and scoped forms like
1585
- ;; \`use crate::foo::{Bar, Baz};\`) - emit one export per named member
1586
- ;; so each is a resolvable target, matching the plain scoped_identifier
1587
- ;; form above. The shared path may itself be scoped, so it is captured
1588
- ;; generically rather than requiring a single bare identifier segment.
1589
- (use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (identifier) @src))) @stmt
1590
- ;; Aliased members inside a group (\`use foo::{Bar as Baz}\`) export
1591
- ;; under their alias, matching how a single aliased import behaves.
1592
- (use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (use_as_clause alias: (identifier) @src)))) @stmt
1593
- `,
1594
- locals: `
1595
- (function_item name: (identifier) @name)
1596
- (struct_item name: (type_identifier) @name)
1597
- (trait_item name: (type_identifier) @name)
1598
- (enum_item name: (type_identifier) @name)
1599
- (enum_variant name: (identifier) @name)
1600
- (const_item name: (identifier) @name)
1601
- (static_item name: (identifier) @name)
1602
- (macro_definition name: (identifier) @name)
1603
- (let_declaration pattern: (identifier) @name)
1604
- (parameter pattern: (identifier) @name)
1605
- `,
1606
- importBindings: `
1607
- (mod_item name: (identifier) @from) @stmt
1608
- (extern_crate_declaration name: (identifier) @from) @stmt
1609
- (extern_crate_declaration name: (identifier) @from alias: (identifier) @alias) @stmt
1610
- (use_declaration argument: (use_as_clause path: (identifier) @from alias: (identifier) @alias)) @stmt
1611
- (use_declaration argument: (use_as_clause path: (scoped_identifier path: (_) @from name: (identifier) @iname) alias: (identifier) @alias)) @stmt
1612
- (use_declaration argument: (scoped_identifier path: (_) @from name: (identifier) @iname)) @stmt
1613
- (use_declaration argument: (identifier) @from) @stmt
1614
- (use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (identifier) @iname))) @stmt
1615
- ;; Aliased members inside a group (\`use foo::{Bar as Baz}\`): import
1616
- ;; the original name under its local alias.
1617
- (use_declaration argument: (scoped_use_list path: (_) @from list: (use_list (use_as_clause path: (identifier) @iname alias: (identifier) @alias)))) @stmt
1618
- `
1619
- },
1620
- nodeTypes: {
1621
- identifier: ["identifier", "type_identifier"],
1622
- memberExpression: "field_expression"
1623
- },
1624
- supportsCrossModuleSymbols: true,
1625
- scopeDeclarationNames: (node) => node.parent?.type === "macro_definition",
1626
- classifyDefinition: (node) => {
1627
- const parent = node.parent;
1628
- if (!parent)
1629
- return "variable";
1630
- if (parent.type === "function_item" || parent.type === "macro_definition")
1631
- return "function";
1632
- if (parent.type === "enum_item")
1633
- return "type";
1634
- if (parent.type === "struct_item" || parent.type === "trait_item")
1635
- return "class";
1636
- return "variable";
1637
- },
1638
- createsFunctionScope: (node) => node.type === "function_item",
1639
- createsBlockScope: (node) => node.type === "block",
1640
- membersAreImplicitlyInScope: false,
1641
- isDeclarationName: (node) => {
1642
- const p = node.parent;
1643
- if (!p)
1644
- return false;
1645
- if (p.type === "function_item" && p.childForFieldName("name")?.id === node.id)
1646
- return true;
1647
- if (p.type === "struct_item" && p.childForFieldName("name")?.id === node.id)
1648
- return true;
1649
- if (p.type === "trait_item" && p.childForFieldName("name")?.id === node.id)
1650
- return true;
1651
- if (p.type === "enum_item" && p.childForFieldName("name")?.id === node.id)
1652
- return true;
1653
- if (p.type === "enum_variant" && p.childForFieldName("name")?.id === node.id)
1654
- return true;
1655
- if (p.type === "const_item" && p.childForFieldName("name")?.id === node.id)
1656
- return true;
1657
- if (p.type === "static_item" && p.childForFieldName("name")?.id === node.id)
1658
- return true;
1659
- if (p.type === "macro_definition" && p.childForFieldName("name")?.id === node.id)
1660
- return true;
1661
- if (p.type === "let_declaration" && p.childForFieldName("pattern")?.id === node.id)
1662
- return true;
1663
- if (p.type === "parameter" && p.childForFieldName("pattern")?.id === node.id)
1664
- return true;
1665
- return false;
1666
- },
1667
- normalizeIdentifier: (name) => hasNonAsciiCodePoint(name) ? name.normalize("NFC") : name
1668
- };
1669
- registerLanguage(RUST_DEF);
1670
-
1671
- // dist/languages/definitions/cFamily.js
1672
- var cFamilyContainerTypes = /* @__PURE__ */ new Set([
1673
- "function_definition",
1674
- "declaration",
1675
- "parameter_declaration",
1676
- "field_declaration",
1677
- "type_definition",
1678
- "init_declarator"
1679
- ]);
1680
- var cFamilyControlSplitPoints = [
1681
- "if_statement",
1682
- "for_statement",
1683
- "while_statement",
1684
- "do_statement",
1685
- "switch_statement",
1686
- "case_statement"
1687
- ];
1688
- var cFamilyIncludeImportsQuery = `
1689
- (preproc_include path: (string_literal) @mod) @stmt
1690
- (preproc_include path: (system_lib_string) @mod) @stmt
1691
- (preproc_include path: (identifier) @mod) @stmt
1692
- `;
1693
- var cFamilyIncludeBindingsQuery = `
1694
- (preproc_include path: (string_literal) @from) @stmt
1695
- (preproc_include path: (system_lib_string) @from) @stmt
1696
- (preproc_include path: (identifier) @from) @stmt
1697
- `;
1698
- var cFamilyParameterListTypes = /* @__PURE__ */ new Set(["parameter_declaration", "parameter_list"]);
1699
- function cFunctionNameQuery(captureName, includeFieldIdentifier) {
1700
- const identifierTypes = includeFieldIdentifier ? ["identifier", "field_identifier"] : ["identifier"];
1701
- const patterns = [];
1702
- for (const identifierType of identifierTypes) {
1703
- patterns.push(`(function_declarator declarator: (${identifierType}) @${captureName})`);
1704
- patterns.push(`(function_declarator declarator: (pointer_declarator declarator: (${identifierType}) @${captureName}))`);
1705
- patterns.push(`(pointer_declarator declarator: (function_declarator declarator: (${identifierType}) @${captureName}))`);
1706
- patterns.push(`(function_declarator declarator: (parenthesized_declarator (pointer_declarator declarator: (${identifierType}) @${captureName})))`);
1707
- }
1708
- return `
1709
- declarator: [
1710
- ${patterns.join("\n ")}
1711
- ]
1712
- `;
1713
- }
1714
- function cFamilyCoreExportQueries(functionNameQuery) {
1715
- return [
1716
- `(function_definition ${functionNameQuery})`,
1717
- `(declaration ${functionNameQuery})`,
1718
- `(struct_specifier name: (type_identifier) @name)`,
1719
- `(enum_specifier name: (type_identifier) @name)`,
1720
- `(type_definition declarator: (type_identifier) @name)`,
1721
- `(declaration declarator: (identifier) @name)`,
1722
- `(declaration declarator: (init_declarator declarator: (identifier) @name))`
1723
- ];
1724
- }
1725
- function cFamilyCoreLocalQueries(functionNameQuery) {
1726
- return [
1727
- `(function_definition ${functionNameQuery})`,
1728
- `(struct_specifier name: (type_identifier) @name)`,
1729
- `(enum_specifier name: (type_identifier) @name)`,
1730
- `(type_definition declarator: (type_identifier) @name)`,
1731
- `(declaration declarator: (identifier) @name)`,
1732
- `(declaration declarator: (init_declarator declarator: (identifier) @name))`,
1733
- `(parameter_declaration declarator: (identifier) @name)`,
1734
- `(field_declaration declarator: (field_identifier) @name)`
1735
- ];
1736
- }
1737
- function joinQueryPatterns(patterns) {
1738
- return `
1739
- ${patterns.join("\n ")}
1740
- `;
1741
- }
1742
- function cFamilyBlock(type, nameQuery, captureId) {
1743
- return {
1744
- type,
1745
- nameQuery,
1746
- captureId
1747
- };
1748
- }
1749
- function cFamilyFunctionBlock(functionNameQuery) {
1750
- return cFamilyBlock("function_definition", functionNameQuery, "function");
1751
- }
1752
- function cFamilyTypeIdentifierBlock(type, captureId) {
1753
- return cFamilyBlock(type, "name: (type_identifier) @chunk.name", captureId);
1754
- }
1755
- function createCFamilyLanguageDefinition(options) {
1756
- const functionNameQuery = cFunctionNameQuery("chunk.name", options.includeFieldIdentifier);
1757
- const graphFunctionNameQuery = cFunctionNameQuery("name", options.includeFieldIdentifier);
1758
- return {
1759
- id: options.id,
1760
- extensions: [...options.extensions],
1761
- structure: {
1762
- blocks: options.blocks(functionNameQuery),
1763
- splitPoints: [...options.splitPoints ?? cFamilyControlSplitPoints],
1764
- comments: ["comment"]
1765
- },
1766
- graph: {
1767
- imports: cFamilyIncludeImportsQuery,
1768
- exports: joinQueryPatterns([
1769
- ...cFamilyCoreExportQueries(graphFunctionNameQuery),
1770
- ...options.extraExportQueries ?? []
1771
- ]),
1772
- locals: joinQueryPatterns([
1773
- ...cFamilyCoreLocalQueries(graphFunctionNameQuery),
1774
- ...options.extraLocalQueries ?? []
1775
- ]),
1776
- importBindings: cFamilyIncludeBindingsQuery
1777
- },
1778
- nodeTypes: options.nodeTypes,
1779
- classifyDefinition: options.classifyDefinition,
1780
- isDeclarationName: options.isDeclarationName,
1781
- scopeDeclarationNames: "all",
1782
- createsFunctionScope: options.createsFunctionScope,
1783
- createsBlockScope: (node) => node.type === "compound_statement",
1784
- supportsCrossModuleSymbols: true,
1785
- usesQueryDrivenLocals: options.usesQueryDrivenLocals || false
1786
- };
1787
- }
1788
- function isWithin(node, ancestor) {
1789
- let current = node;
1790
- while (current) {
1791
- if (ancestor && current.id === ancestor.id)
1792
- return true;
1793
- current = current.parent;
1794
- }
1795
- return false;
1796
- }
1797
- function isInField(node, parent, field) {
1798
- return isWithin(node, parent.childForFieldName(field));
1799
- }
1800
- function findAncestor(node, types) {
1801
- let current = node.parent;
1802
- while (current) {
1803
- if (types.has(current.type))
1804
- return current;
1805
- current = current.parent;
1806
- }
1807
- return null;
1808
- }
1809
- function isInParameterList(node) {
1810
- return !!findAncestor(node, cFamilyParameterListTypes);
1811
- }
1812
- function resolveDeclaratorRoot(ancestor) {
1813
- let declaratorNode = ancestor.childForFieldName("declarator");
1814
- if (!declaratorNode)
1815
- return null;
1816
- if (declaratorNode.type === "init_declarator") {
1817
- const inner = declaratorNode.childForFieldName("declarator");
1818
- if (inner)
1819
- declaratorNode = inner;
1820
- }
1821
- if (declaratorNode.type === "function_declarator") {
1822
- const inner = declaratorNode.childForFieldName("declarator");
1823
- if (inner)
1824
- declaratorNode = inner;
1825
- }
1826
- return declaratorNode;
1827
- }
1828
- function isInAncestorDeclarator(node, ancestorTypes) {
1829
- const ancestor = findAncestor(node, ancestorTypes);
1830
- if (!ancestor)
1831
- return false;
1832
- const declaratorNode = resolveDeclaratorRoot(ancestor);
1833
- if (!declaratorNode)
1834
- return false;
1835
- return isWithin(node, declaratorNode);
1836
- }
1837
- function isFunctionDeclarator(node) {
1838
- let current = node.parent;
1839
- while (current) {
1840
- if (current.type === "function_declarator")
1841
- return true;
1842
- if (cFamilyContainerTypes.has(current.type))
1843
- return false;
1844
- current = current.parent;
1845
- }
1846
- return false;
1847
- }
1848
-
1849
- // dist/languages/definitions/c.js
1850
- var C_DEF = createCFamilyLanguageDefinition({
1851
- id: "c",
1852
- extensions: [".c", ".h", ".i"],
1853
- includeFieldIdentifier: false,
1854
- blocks: (functionNameQuery) => [
1855
- cFamilyFunctionBlock(functionNameQuery),
1856
- cFamilyTypeIdentifierBlock("struct_specifier", "struct"),
1857
- cFamilyTypeIdentifierBlock("union_specifier", "union"),
1858
- cFamilyTypeIdentifierBlock("enum_specifier", "enum"),
1859
- cFamilyBlock("type_definition", "declarator: (type_identifier) @chunk.name", "type"),
1860
- cFamilyBlock("preproc_def", "name: (identifier) @chunk.name", "macro"),
1861
- cFamilyBlock("preproc_function_def", "name: (identifier) @chunk.name", "macro")
1862
- ],
1863
- extraExportQueries: [
1864
- `(union_specifier name: (type_identifier) @name)`,
1865
- `(enumerator name: (identifier) @name)`,
1866
- `(preproc_def name: (identifier) @name)`,
1867
- `(preproc_function_def name: (identifier) @name)`
1868
- ],
1869
- extraLocalQueries: [
1870
- `(union_specifier name: (type_identifier) @name)`,
1871
- `(enumerator name: (identifier) @name)`,
1872
- `(preproc_def name: (identifier) @name)`,
1873
- `(preproc_function_def name: (identifier) @name)`
1874
- ],
1875
- nodeTypes: {
1876
- identifier: ["identifier", "field_identifier", "type_identifier"],
1877
- propertyIdentifier: ["field_identifier"],
1878
- memberExpression: "field_expression"
1879
- },
1880
- classifyDefinition: (node) => {
1881
- const parent = node.parent;
1882
- if (!parent)
1883
- return "variable";
1884
- if (parent.type === "enum_specifier")
1885
- return "type";
1886
- if (parent.type === "struct_specifier" || parent.type === "union_specifier")
1887
- return "class";
1888
- if (parent.type === "type_definition" && isInField(node, parent, "declarator"))
1889
- return "type";
1890
- const container = findAncestor(node, cFamilyContainerTypes);
1891
- if (container?.type === "function_definition")
1892
- return "function";
1893
- if (container?.type === "declaration" && isFunctionDeclarator(node))
1894
- return "function";
1895
- return "variable";
1896
- },
1897
- isDeclarationName: (node) => {
1898
- const parent = node.parent;
1899
- if (!parent)
1900
- return false;
1901
- if ((parent.type === "struct_specifier" || parent.type === "union_specifier" || parent.type === "enum_specifier") && isInField(node, parent, "name"))
1902
- return true;
1903
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["parameter_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["field_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["init_declarator"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["type_definition"])))
1904
- return true;
1905
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["function_definition"])) && !isInParameterList(node))
1906
- return true;
1907
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["declaration"])) && !isInParameterList(node))
1908
- return true;
1909
- if (parent.type === "enumerator" && isInField(node, parent, "name"))
1910
- return true;
1911
- if (parent.type === "preproc_def" && isInField(node, parent, "name"))
1912
- return true;
1913
- if (parent.type === "preproc_function_def" && isInField(node, parent, "name"))
1914
- return true;
1915
- return false;
1916
- },
1917
- createsFunctionScope: (node) => node.type === "function_definition"
1918
- });
1919
- registerLanguage(C_DEF);
1920
-
1921
- // dist/languages/definitions/cpp.js
1922
- var CPP_DEF = createCFamilyLanguageDefinition({
1923
- id: "cpp",
1924
- extensions: [".cc", ".cpp", ".cxx", ".c++", ".hpp", ".hh", ".hxx", ".ipp", ".tpp", ".inl"],
1925
- includeFieldIdentifier: true,
1926
- usesQueryDrivenLocals: true,
1927
- blocks: (functionNameQuery) => [
1928
- cFamilyFunctionBlock(functionNameQuery),
1929
- cFamilyTypeIdentifierBlock("class_specifier", "class"),
1930
- cFamilyTypeIdentifierBlock("struct_specifier", "struct"),
1931
- cFamilyTypeIdentifierBlock("enum_specifier", "enum"),
1932
- cFamilyBlock("namespace_definition", "name: (namespace_identifier) @chunk.name", "namespace"),
1933
- cFamilyTypeIdentifierBlock("alias_declaration", "type"),
1934
- cFamilyBlock("type_definition", "declarator: (type_identifier) @chunk.name", "type")
1935
- ],
1936
- splitPoints: [...cFamilyControlSplitPoints, "try_statement", "catch_clause"],
1937
- extraExportQueries: [
1938
- `(class_specifier name: (type_identifier) @name)`,
1939
- `(enumerator name: (identifier) @name)`,
1940
- `(namespace_definition name: (namespace_identifier) @name)`,
1941
- `(alias_declaration name: (type_identifier) @name)`,
1942
- `(using_declaration (qualified_identifier name: (identifier) @name))`
1943
- ],
1944
- extraLocalQueries: [
1945
- `(class_specifier name: (type_identifier) @name)`,
1946
- `(enumerator name: (identifier) @name)`,
1947
- `(namespace_definition name: (namespace_identifier) @name)`,
1948
- `(alias_declaration name: (type_identifier) @name)`
1949
- ],
1950
- nodeTypes: {
1951
- identifier: ["identifier", "field_identifier", "type_identifier", "namespace_identifier"],
1952
- propertyIdentifier: ["field_identifier", "identifier"],
1953
- memberExpression: "field_expression"
1954
- },
1955
- classifyDefinition: (node) => {
1956
- const parent = node.parent;
1957
- if (!parent)
1958
- return "variable";
1959
- if (parent.type === "enum_specifier")
1960
- return "type";
1961
- if (parent.type === "class_specifier" || parent.type === "struct_specifier" || parent.type === "namespace_definition")
1962
- return "class";
1963
- if (parent.type === "alias_declaration" || parent.type === "type_definition" && isInField(node, parent, "declarator"))
1964
- return "type";
1965
- const container = findAncestor(node, cFamilyContainerTypes);
1966
- if (container?.type === "function_definition")
1967
- return "function";
1968
- if (container?.type === "declaration" && isFunctionDeclarator(node))
1969
- return "function";
1970
- return "variable";
1971
- },
1972
- isDeclarationName: (node) => {
1973
- const parent = node.parent;
1974
- if (!parent)
1975
- return false;
1976
- if ((parent.type === "class_specifier" || parent.type === "struct_specifier" || parent.type === "enum_specifier") && isInField(node, parent, "name"))
1977
- return true;
1978
- if (parent.type === "namespace_definition" && isInField(node, parent, "name"))
1979
- return true;
1980
- if (parent.type === "alias_declaration" && isInField(node, parent, "name"))
1981
- return true;
1982
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["parameter_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["field_declaration"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["init_declarator"])) || isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["type_definition"])))
1983
- return true;
1984
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["function_definition"])) && !isInParameterList(node))
1985
- return true;
1986
- if (isInAncestorDeclarator(node, /* @__PURE__ */ new Set(["declaration"])) && !isInParameterList(node))
1987
- return true;
1988
- if (parent.type === "qualified_identifier" && parent.parent?.type === "using_declaration" && isInField(node, parent, "name"))
1989
- return true;
1990
- if (parent.type === "enumerator" && isInField(node, parent, "name"))
1991
- return true;
1992
- return false;
1993
- },
1994
- createsFunctionScope: (node) => node.type === "function_definition" || node.type === "lambda_expression"
1995
- });
1996
- registerLanguage(CPP_DEF);
1997
-
1998
- // dist/languages/definitions/kotlin.js
1999
- function normalizeKotlinNativeQuery(kind, query) {
2000
- if (kind === "imports") {
2001
- return `
2002
- (import (qualified_identifier) @mod) @stmt
2003
- `;
2004
- }
2005
- if (kind === "importBindings") {
2006
- return `
2007
- (import (qualified_identifier) @from (identifier) @alias) @stmt
2008
- (import (qualified_identifier) @from "*" @wild) @stmt
2009
- (import (qualified_identifier) @from) @stmt
2010
- `;
2011
- }
2012
- const normalized = query.replace(/\bimport_header\b/g, "import").replace(/\bsimple_identifier\b/g, "identifier").replace(/\btype_identifier\b/g, "identifier");
2013
- return normalized;
2014
- }
2015
- var KOTLIN_DEF = {
2016
- id: "kotlin",
2017
- extensions: [".kt", ".kts"],
2018
- usesQueryDrivenLocals: true,
2019
- structure: {
2020
- blocks: [
2021
- {
2022
- type: "class_declaration",
2023
- nameQuery: "(type_identifier) @chunk.name",
2024
- captureId: "class"
2025
- },
2026
- {
2027
- type: "object_declaration",
2028
- nameQuery: "(type_identifier) @chunk.name",
2029
- captureId: "object"
2030
- },
2031
- {
2032
- type: "function_declaration",
2033
- nameQuery: "(simple_identifier) @chunk.name",
2034
- captureId: "function"
2035
- },
2036
- {
2037
- type: "property_declaration",
2038
- nameQuery: "(variable_declaration (simple_identifier) @chunk.name)",
2039
- captureId: "property"
2040
- },
2041
- {
2042
- type: "type_alias",
2043
- nameQuery: "(type_identifier) @chunk.name",
2044
- captureId: "type"
2045
- }
2046
- ],
2047
- splitPoints: [
2048
- "if_expression",
2049
- "when_expression",
2050
- "for_statement",
2051
- "while_statement",
2052
- "do_while_statement",
2053
- "try_expression",
2054
- "catch_block",
2055
- "finally_block"
2056
- ],
2057
- comments: ["line_comment", "block_comment"]
2058
- },
2059
- graph: {
2060
- imports: `
2061
- (import_header (identifier) @mod) @stmt
2062
- `,
2063
- exports: `
2064
- (class_declaration (type_identifier) @name)
2065
- (object_declaration (type_identifier) @name)
2066
- (function_declaration (simple_identifier) @name)
2067
- (property_declaration (variable_declaration (simple_identifier) @name))
2068
- (type_alias (type_identifier) @name)
2069
- (enum_entry (simple_identifier) @name)
2070
- `,
2071
- locals: `
2072
- (class_declaration (type_identifier) @name)
2073
- (object_declaration (type_identifier) @name)
2074
- (function_declaration (simple_identifier) @name)
2075
- (property_declaration (variable_declaration (simple_identifier) @name))
2076
- (type_alias (type_identifier) @name)
2077
- (enum_entry (simple_identifier) @name)
2078
- (parameter (simple_identifier) @name)
2079
- (class_parameter (simple_identifier) @name)
2080
- (type_parameter (type_identifier) @name)
2081
- `,
2082
- importBindings: `
2083
- (import_header (identifier) @from (import_alias (type_identifier) @alias)) @stmt
2084
- (import_header (identifier) @from (wildcard_import) @wild) @stmt
2085
- (import_header (identifier) @from) @stmt
2086
- `
2087
- },
2088
- nodeTypes: {
2089
- identifier: ["identifier", "interpolated_identifier", "simple_identifier", "type_identifier"],
2090
- propertyIdentifier: ["simple_identifier", "type_identifier"],
2091
- memberExpression: "navigation_expression"
2092
- },
2093
- classifyDefinition: (node) => {
2094
- const parent = node.parent;
2095
- if (!parent)
2096
- return "variable";
2097
- if (parent.type === "class_declaration" || parent.type === "object_declaration")
2098
- return "class";
2099
- if (parent.type === "function_declaration")
2100
- return "function";
2101
- if (parent.type === "type_alias")
2102
- return "type";
2103
- return "variable";
2104
- },
2105
- isDeclarationName: (node) => {
2106
- const parent = node.parent;
2107
- if (!parent)
2108
- return false;
2109
- if (parent.type === "class_declaration" && node.type === "type_identifier")
2110
- return true;
2111
- if (parent.type === "object_declaration" && node.type === "type_identifier")
2112
- return true;
2113
- if (parent.type === "function_declaration" && (node.type === "simple_identifier" || node.type === "identifier"))
2114
- return true;
2115
- if (parent.type === "type_alias" && node.type === "type_identifier")
2116
- return true;
2117
- if (parent.type === "variable_declaration" && node.type === "simple_identifier")
2118
- return true;
2119
- if (parent.type === "parameter" && (node.type === "simple_identifier" || node.type === "identifier"))
2120
- return true;
2121
- if (parent.type === "class_parameter" && (node.type === "simple_identifier" || node.type === "identifier"))
2122
- return true;
2123
- if (parent.type === "enum_entry" && (node.type === "simple_identifier" || node.type === "identifier"))
2124
- return true;
2125
- if (parent.type === "type_parameter" && node.type === "type_identifier")
2126
- return true;
2127
- return false;
2128
- },
2129
- scopeDeclarationNames: "all",
2130
- createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "anonymous_function" || node.type === "lambda_literal",
2131
- createsBlockScope: (node) => node.type === "function_body" || node.type === "class_body" || node.type === "control_structure_body" || node.type === "catch_block" || node.type === "finally_block",
2132
- supportsCrossModuleSymbols: true,
2133
- native: {
2134
- normalizeQuery: normalizeKotlinNativeQuery,
2135
- authoritativeKinds: ["imports", "importBindings", "exports", "locals"],
2136
- notes: ["normalizes kotlin import and identifier node names for the native grammar"]
2137
- }
2138
- };
2139
- registerLanguage(KOTLIN_DEF);
2140
-
2141
- // dist/languages/definitions/swift.js
2142
- var SWIFT_DEF = {
2143
- id: "swift",
2144
- extensions: [".swift"],
2145
- usesQueryDrivenLocals: true,
2146
- structure: {
2147
- blocks: [
2148
- {
2149
- type: "class_declaration",
2150
- nameQuery: 'declaration_kind: "class" name: (_) @chunk.name',
2151
- captureId: "class"
2152
- },
2153
- {
2154
- type: "class_declaration",
2155
- nameQuery: 'declaration_kind: "struct" name: (_) @chunk.name',
2156
- captureId: "struct"
2157
- },
2158
- {
2159
- type: "class_declaration",
2160
- nameQuery: 'declaration_kind: "enum" name: (_) @chunk.name',
2161
- captureId: "enum"
2162
- },
2163
- {
2164
- type: "class_declaration",
2165
- nameQuery: 'declaration_kind: "extension" name: (user_type (type_identifier) @chunk.name)',
2166
- captureId: "extension"
2167
- },
2168
- {
2169
- type: "class_declaration",
2170
- nameQuery: 'declaration_kind: "actor" name: (_) @chunk.name',
2171
- captureId: "actor"
2172
- },
2173
- {
2174
- type: "protocol_declaration",
2175
- nameQuery: "name: (type_identifier) @chunk.name",
2176
- captureId: "protocol"
2177
- },
2178
- {
2179
- type: "function_declaration",
2180
- nameQuery: "name: (simple_identifier) @chunk.name",
2181
- captureId: "function"
2182
- },
2183
- {
2184
- type: "property_declaration",
2185
- nameQuery: "name: (pattern bound_identifier: (simple_identifier) @chunk.name)",
2186
- captureId: "property"
2187
- },
2188
- {
2189
- type: "typealias_declaration",
2190
- nameQuery: "name: (type_identifier) @chunk.name",
2191
- captureId: "type"
2192
- },
2193
- {
2194
- type: "init_declaration",
2195
- captureId: "initializer"
2196
- },
2197
- {
2198
- type: "deinit_declaration",
2199
- captureId: "deinitializer"
2200
- },
2201
- {
2202
- type: "subscript_declaration",
2203
- captureId: "subscript"
2204
- }
2205
- ],
2206
- splitPoints: [
2207
- "if_statement",
2208
- "guard_statement",
2209
- "for_statement",
2210
- "while_statement",
2211
- "repeat_while_statement",
2212
- "switch_statement",
2213
- "do_statement",
2214
- "catch_block"
2215
- ],
2216
- comments: ["comment", "multiline_comment"]
2217
- },
2218
- graph: {
2219
- imports: `
2220
- (import_declaration (identifier) @mod) @stmt
2221
- `,
2222
- exports: `
2223
- (class_declaration declaration_kind: "class" name: (_) @name)
2224
- (class_declaration declaration_kind: "struct" name: (_) @name)
2225
- (class_declaration declaration_kind: "enum" name: (_) @name)
2226
- (class_declaration declaration_kind: "extension" name: (user_type (type_identifier) @name))
2227
- (class_declaration declaration_kind: "actor" name: (_) @name)
2228
- (enum_entry name: (simple_identifier) @name)
2229
- (protocol_declaration name: (type_identifier) @name)
2230
- (function_declaration name: (simple_identifier) @name)
2231
- (typealias_declaration name: (type_identifier) @name)
2232
- (property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
2233
- (protocol_function_declaration name: (simple_identifier) @name)
2234
- (protocol_property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
2235
- `,
2236
- locals: `
2237
- (class_declaration declaration_kind: "class" name: (_) @name)
2238
- (class_declaration declaration_kind: "struct" name: (_) @name)
2239
- (class_declaration declaration_kind: "enum" name: (_) @name)
2240
- (class_declaration declaration_kind: "extension" name: (user_type (type_identifier) @name))
2241
- (class_declaration declaration_kind: "actor" name: (_) @name)
2242
- (enum_entry name: (simple_identifier) @name)
2243
- (protocol_declaration name: (type_identifier) @name)
2244
- (function_declaration name: (simple_identifier) @name)
2245
- (typealias_declaration name: (type_identifier) @name)
2246
- (property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
2247
- (parameter name: (simple_identifier) @name)
2248
- (protocol_function_declaration name: (simple_identifier) @name)
2249
- (protocol_property_declaration name: (pattern bound_identifier: (simple_identifier) @name))
2250
- `,
2251
- importBindings: `
2252
- (import_declaration (identifier) @from) @stmt
2253
- `
2254
- },
2255
- nodeTypes: {
2256
- identifier: ["identifier", "simple_identifier", "type_identifier"],
2257
- propertyIdentifier: ["simple_identifier", "type_identifier"],
2258
- memberExpression: "navigation_expression"
2259
- },
2260
- classifyDefinition: (node) => {
2261
- const parent = node.parent;
2262
- if (!parent)
2263
- return "variable";
2264
- if (parent.type === "function_declaration")
2265
- return "function";
2266
- if (parent.type === "protocol_function_declaration")
2267
- return "function";
2268
- if (parent.type === "class_declaration") {
2269
- const declarationKind = parent.childForFieldName("declaration_kind")?.text;
2270
- if (declarationKind === "enum")
2271
- return "type";
2272
- return "class";
2273
- }
2274
- if (parent.type === "user_type" && parent.parent?.type === "class_declaration")
2275
- return "class";
2276
- if (parent.type === "protocol_declaration" || parent.type === "typealias_declaration")
2277
- return "type";
2278
- return "variable";
2279
- },
2280
- isDeclarationName: (node) => {
2281
- const parent = node.parent;
2282
- if (!parent)
2283
- return false;
2284
- if (parent.type === "class_declaration" && parent.childForFieldName("name")?.id === node.id)
2285
- return true;
2286
- if (parent.type === "user_type" && parent.parent?.type === "class_declaration" && parent.parent.childForFieldName("name")?.id === parent.id)
2287
- return true;
2288
- if (parent.type === "protocol_declaration" && parent.childForFieldName("name")?.id === node.id)
2289
- return true;
2290
- if (parent.type === "enum_entry" && parent.childForFieldName("name")?.id === node.id)
2291
- return true;
2292
- if (parent.type === "function_declaration" && parent.childForFieldName("name")?.id === node.id)
2293
- return true;
2294
- if (parent.type === "typealias_declaration" && parent.childForFieldName("name")?.id === node.id)
2295
- return true;
2296
- if (parent.type === "parameter" && parent.childForFieldName("name")?.id === node.id)
2297
- return true;
2298
- if (parent.type === "protocol_function_declaration" && parent.childForFieldName("name")?.id === node.id)
2299
- return true;
2300
- if (parent.type === "protocol_property_declaration" && parent.childForFieldName("name")?.id === node.id)
2301
- return true;
2302
- if (parent.type === "pattern" && parent.childForFieldName("bound_identifier")?.id === node.id && (parent.parent?.type === "property_declaration" || parent.parent?.type === "protocol_property_declaration"))
2303
- return true;
2304
- return false;
2305
- },
2306
- scopeDeclarationNames: "all",
2307
- createsFunctionScope: (node) => node.type === "function_declaration" || node.type === "init_declaration" || node.type === "deinit_declaration" || node.type === "subscript_declaration",
2308
- createsBlockScope: (node) => node.type === "function_body" || node.type === "class_body" || node.type === "protocol_body" || node.type === "enum_class_body" || node.type === "catch_block" || node.type === "willset_didset_block",
2309
- supportsCrossModuleSymbols: true
2310
- };
2311
- registerLanguage(SWIFT_DEF);
2312
-
2313
- // dist/languages/definitions/sql.js
2314
- var SQL_DEF = {
2315
- id: "sql",
2316
- extensions: [".sql"],
2317
- structure: {
2318
- blocks: [
2319
- { type: "statement", nameQuery: "(create_table)", captureId: "create" },
2320
- { type: "statement", nameQuery: "(create_view)", captureId: "create" },
2321
- { type: "statement", nameQuery: "(create_materialized_view)", captureId: "create" },
2322
- { type: "statement", nameQuery: "(create_index)", captureId: "create" },
2323
- { type: "statement", nameQuery: "(create_function)", captureId: "routine" },
2324
- { type: "statement", nameQuery: "(create_trigger)", captureId: "routine" },
2325
- { type: "statement", nameQuery: "(alter_table)", captureId: "alter" },
2326
- { type: "statement", nameQuery: "(drop_table)", captureId: "drop" },
2327
- { type: "statement", nameQuery: "(drop_view)", captureId: "drop" },
2328
- { type: "statement", nameQuery: "(drop_index)", captureId: "drop" },
2329
- { type: "statement", nameQuery: "(insert)", captureId: "write" },
2330
- { type: "statement", nameQuery: "(update)", captureId: "write" },
2331
- { type: "statement", nameQuery: "(delete)", captureId: "write" },
2332
- { type: "statement", nameQuery: "(select)", captureId: "select" }
2333
- ],
2334
- splitPoints: [],
2335
- comments: ["comment"]
2336
- },
2337
- graph: {
2338
- imports: "(statement) @stmt",
2339
- exports: "",
2340
- locals: "",
2341
- importBindings: ""
2342
- },
2343
- supportsCrossModuleSymbols: false
2344
- };
2345
- registerLanguage(SQL_DEF);
2346
-
2347
- // dist/languages/definitions/zig.js
2348
- var ZIG_TYPE_INITIALIZER_TYPES = /* @__PURE__ */ new Set([
2349
- "builtin_type",
2350
- "struct_declaration",
2351
- "enum_declaration",
2352
- "union_declaration",
2353
- "opaque_declaration",
2354
- "error_set_declaration"
2355
- ]);
2356
- var ZIG_DEF = {
2357
- id: "zig",
2358
- extensions: [".zig"],
2359
- usesQueryDrivenLocals: true,
2360
- structure: {
2361
- blocks: [
2362
- { type: "function_declaration", nameQuery: "name: (identifier) @chunk.name", captureId: "function" },
2363
- { type: "test_declaration", nameQuery: "(string) @chunk.name", captureId: "test" }
2364
- ],
2365
- splitPoints: ["if_expression", "for_expression", "while_expression", "switch_expression"],
2366
- comments: ["line_comment", "doc_comment"]
2367
- },
2368
- graph: {
2369
- imports: '(builtin_function (builtin_identifier) @fn (arguments (string) @mod) (#eq? @fn "@import")) @stmt',
2370
- exports: `
2371
- (function_declaration name: (identifier) @name)
2372
- (variable_declaration (identifier) @name)
2373
- `,
2374
- locals: `
2375
- (function_declaration name: (identifier) @name)
2376
- (parameter (identifier) @name)
2377
- (variable_declaration (identifier) @name)
2378
- `,
2379
- importBindings: `
2380
- (variable_declaration
2381
- (identifier) @alias
2382
- (builtin_function (builtin_identifier) @fn (arguments (string) @from) (#eq? @fn "@import"))
2383
- ) @stmt
2384
- `
2385
- },
2386
- nodeTypes: {
2387
- identifier: ["identifier"],
2388
- memberExpression: "field_expression"
2389
- },
2390
- supportsCrossModuleSymbols: true,
2391
- classifyDefinition: (node) => {
2392
- const parent = node.parent;
2393
- if (!parent)
2394
- return "variable";
2395
- if (parent.type === "function_declaration")
2396
- return "function";
2397
- if (parent.type !== "variable_declaration")
2398
- return "variable";
2399
- const declaredName = parent.namedChildren.find((child) => child.type === "identifier");
2400
- if (declaredName?.id !== node.id)
2401
- return "variable";
2402
- const initializer = parent.namedChildren.find((child) => child.id !== node.id);
2403
- if (initializer && ZIG_TYPE_INITIALIZER_TYPES.has(initializer.type))
2404
- return "type";
2405
- return "variable";
2406
- },
2407
- createsFunctionScope: (node) => node.type === "function_declaration",
2408
- createsBlockScope: (node) => node.type === "block",
2409
- isDeclarationName: (node) => {
2410
- const parent = node.parent;
2411
- if (!parent)
2412
- return false;
2413
- if (parent.type === "function_declaration" && parent.childForFieldName("name")?.id === node.id)
2414
- return true;
2415
- return parent.type === "variable_declaration";
2416
- }
2417
- };
2418
- registerLanguage(ZIG_DEF);
2419
-
2420
- // dist/bootstrap/treeSitterLanguages.js
2421
- var idToConfigKey = {
2422
- js: "javascript",
2423
- ts: "typescript",
2424
- tsx: "tsx",
2425
- python: "python",
2426
- php: "php",
2427
- html: "html",
2428
- css: "css",
2429
- scss: "scss",
2430
- less: "less",
2431
- ruby: "ruby",
2432
- go: "go",
2433
- java: "java",
2434
- csharp: "csharp",
2435
- rust: "rust",
2436
- c: "c",
2437
- cpp: "cpp",
2438
- kotlin: "kotlin",
2439
- swift: "swift",
2440
- zig: "zig"
2441
- };
2442
- var LANG_CONFIGS = {};
2443
- for (const lang of getAllLanguages()) {
2444
- const key = idToConfigKey[lang.id] || lang.id;
2445
- if (lang.id === "vue" || lang.id === "svelte" || lang.id === "markdown" || lang.id === "mdx" || lang.id === "astro" || lang.id === "hbs" || lang.id === "rst" || lang.id === "adoc") {
2446
- continue;
2447
- }
2448
- LANG_CONFIGS[key] = makeLanguageConfig(lang, key);
2449
- }
2450
-
2451
- // dist/chunking/chunkBlocks.js
2452
- function collectChunkBlockGroups(language, matches) {
2453
- const mainBlocks = [];
2454
- const innerBlocks = [];
2455
- const comments = [];
2456
- for (const match of matches) {
2457
- let nameCapture;
2458
- let blockCapture;
2459
- let innerCapture;
2460
- let blockKind;
2461
- for (const capture of match.captures) {
2462
- const { name } = capture;
2463
- if (name === language.captures.name) {
2464
- nameCapture = capture;
2465
- }
2466
- if (language.captures.comments.includes(name)) {
2467
- comments.push({
2468
- kind: name === "chunk.docstring" ? "docstring" : "comment",
2469
- startByte: capture.startByte,
2470
- endByte: capture.endByte,
2471
- startLine: capture.startLine,
2472
- endLine: capture.endLine
2473
- });
2474
- }
2475
- if (name === language.captures.innerBlock) {
2476
- innerCapture = capture;
2477
- }
2478
- if (name.startsWith(language.captures.blockPrefix) && name !== language.captures.innerBlock) {
2479
- blockCapture = capture;
2480
- blockKind = name.slice(language.captures.blockPrefix.length) || capture.nodeType;
2481
- }
2482
- }
2483
- if (innerCapture) {
2484
- innerBlocks.push({
2485
- kind: "inner",
2486
- startByte: innerCapture.startByte,
2487
- endByte: innerCapture.endByte,
2488
- startLine: innerCapture.startLine,
2489
- endLine: innerCapture.endLine
2490
- });
2491
- }
2492
- if (blockCapture) {
2493
- const candidate = {
2494
- kind: blockKind ?? "block",
2495
- startByte: blockCapture.startByte,
2496
- endByte: blockCapture.endByte,
2497
- startLine: blockCapture.startLine,
2498
- endLine: blockCapture.endLine
2499
- };
2500
- if (nameCapture) {
2501
- candidate.name = nameCapture.text;
2502
- }
2503
- mainBlocks.push(candidate);
2504
- }
2505
- }
2506
- mainBlocks.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
2507
- innerBlocks.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
2508
- comments.sort((a, b) => a.startByte - b.startByte || a.endByte - b.endByte);
2509
- return { mainBlocks, innerBlocks, comments };
2510
- }
2511
-
2512
- // dist/chunking/chunkMatches.js
2513
- import { Buffer as Buffer2 } from "node:buffer";
2514
-
2515
- // dist/languages.js
2516
- import fs from "node:fs";
2517
- import path from "node:path";
2518
- function adaptDefinition(def) {
2519
- return {
2520
- id: def.id,
2521
- matchExts: def.extensions,
2522
- nodeTypes: def.nodeTypes || { identifier: ["identifier"] },
2523
- queries: def.graph,
2524
- classifyDefinition: def.classifyDefinition || (() => "variable"),
2525
- isDeclarationName: def.isDeclarationName || (() => false),
2526
- scopeDeclarationNames: def.scopeDeclarationNames === "all" ? () => true : def.scopeDeclarationNames ?? (() => false),
2527
- createsBlockScope: def.createsBlockScope || (() => false),
2528
- createsFunctionScope: def.createsFunctionScope || (() => false),
2529
- membersAreImplicitlyInScope: def.membersAreImplicitlyInScope ?? true,
2530
- supportsCrossModuleSymbols: def.supportsCrossModuleSymbols || false,
2531
- isTypeOnly: def.isTypeOnly || (() => false),
2532
- supportsExportFromReferences: def.supportsExportFromReferences ?? false,
2533
- usesQueryDrivenLocals: def.usesQueryDrivenLocals || false,
2534
- normalizeIdentifier: def.normalizeIdentifier || ((name) => name),
2535
- ...def.native ? { native: def.native } : {}
2536
- };
2537
- }
2538
- var TS_SUPPORT = adaptDefinition(getLanguageById("ts"));
2539
- var TSX_SUPPORT = adaptDefinition(getLanguageById("tsx"));
2540
- var JS_SUPPORT = adaptDefinition(getLanguageById("js"));
2541
- var PY_SUPPORT = adaptDefinition(getLanguageById("python"));
2542
- var PHP_SUPPORT = adaptDefinition(getLanguageById("php"));
2543
- var HTML_SUPPORT = adaptDefinition(getLanguageById("html"));
2544
- var CSS_SUPPORT = adaptDefinition(getLanguageById("css"));
2545
- var SCSS_SUPPORT = adaptDefinition(getLanguageById("scss"));
2546
- var LESS_SUPPORT = adaptDefinition(getLanguageById("less"));
2547
- var VUE_SUPPORT = adaptDefinition(getLanguageById("vue"));
2548
- var SVELTE_SUPPORT = adaptDefinition(getLanguageById("svelte"));
2549
- var RUBY_SUPPORT = adaptDefinition(getLanguageById("ruby"));
2550
- var GO_SUPPORT = adaptDefinition(getLanguageById("go"));
2551
- var JAVA_SUPPORT = adaptDefinition(getLanguageById("java"));
2552
- var CSHARP_SUPPORT = adaptDefinition(getLanguageById("csharp"));
2553
- var RUST_SUPPORT = adaptDefinition(getLanguageById("rust"));
2554
- var C_SUPPORT = adaptDefinition(getLanguageById("c"));
2555
- var CPP_SUPPORT = adaptDefinition(getLanguageById("cpp"));
2556
- var KOTLIN_SUPPORT = adaptDefinition(getLanguageById("kotlin"));
2557
- var SWIFT_SUPPORT = adaptDefinition(getLanguageById("swift"));
2558
- var ZIG_SUPPORT = adaptDefinition(getLanguageById("zig"));
2559
- var SQL_SUPPORT = adaptDefinition(getLanguageById("sql"));
2560
- var LANGUAGE_SUPPORTS = getAllLanguages().map(adaptDefinition);
2561
- var LANGUAGE_EXTENSION_KEY_PATTERN = /^\.[a-z0-9][a-z0-9._+-]*$/;
2562
- var NON_REMAPPABLE_EXTENSIONS = /* @__PURE__ */ new Set([".vue", ".svelte"]);
2563
- function isLiteralLanguageExtension(extension) {
2564
- return LANGUAGE_EXTENSION_KEY_PATTERN.test(extension.trim().toLowerCase());
2565
- }
2566
- function isRemappableLanguageExtension(extension) {
2567
- return !NON_REMAPPABLE_EXTENSIONS.has(extension.trim().toLowerCase());
2568
- }
2569
- function normalizeLanguageExtensions(extensions) {
2570
- const entries = Object.entries(extensions ?? {}).map(([extension, languageId]) => [extension.trim().toLowerCase(), languageId.trim().toLowerCase()]).filter(([extension, languageId]) => isLiteralLanguageExtension(extension) && isRemappableLanguageExtension(extension) && !!supportById(languageId)).sort((left, right) => left[0].localeCompare(right[0]));
2571
- if (!entries.length)
2572
- return void 0;
2573
- return Object.fromEntries(entries);
2574
- }
2575
- function mappedSupportForFile(filename, extensionMap) {
2576
- if (!extensionMap)
2577
- return void 0;
2578
- const mappings = Object.entries(normalizeLanguageExtensions(extensionMap) ?? {}).sort((left, right) => right[0].length - left[0].length || left[0].localeCompare(right[0]));
2579
- const lowerFilename = filename.toLowerCase();
2580
- for (const [extension, languageId] of mappings) {
2581
- if (!lowerFilename.endsWith(extension))
2582
- continue;
2583
- return supportById(languageId);
2584
- }
2585
- return void 0;
2586
- }
2587
- function supportForFileWithoutHeaderSample(filename, extensionMap) {
2588
- const mapped = mappedSupportForFile(filename, extensionMap);
2589
- if (mapped)
2590
- return mapped;
2591
- const ext = path.extname(filename).toLowerCase();
2592
- return LANGUAGE_SUPPORTS.find((s) => s.matchExts.includes(ext));
2593
- }
2594
- function supportForFile(filename, extensionMap) {
2595
- if (path.extname(filename).toLowerCase() !== ".h") {
2596
- return supportForFileWithoutHeaderSample(filename, extensionMap);
2597
- }
2598
- const mapped = mappedSupportForFile(filename, extensionMap);
2599
- if (mapped)
2600
- return mapped;
2601
- const sample = readFileSample(filename);
2602
- if (sample && isLikelyCppHeader(sample))
2603
- return CPP_SUPPORT;
2604
- return C_SUPPORT;
2605
- }
2606
- function supportForFileWithSource(filename, source, extensionMap) {
2607
- if (path.extname(filename).toLowerCase() !== ".h") {
2608
- return supportForFileWithoutHeaderSample(filename, extensionMap);
2609
- }
2610
- const mapped = mappedSupportForFile(filename, extensionMap);
2611
- if (mapped)
2612
- return mapped;
2613
- if (isLikelyCppHeader(source.slice(0, HEADER_SAMPLE_SIZE)))
2614
- return CPP_SUPPORT;
2615
- return C_SUPPORT;
2616
- }
2617
- function supportById(id) {
2618
- return LANGUAGE_SUPPORTS.find((s) => s.id === id);
2619
- }
2620
- var HEADER_SAMPLE_SIZE = 8e3;
2621
- var CPP_HEADER_HINT = /\b(class|namespace|template|typename|constexpr|operator|using\s+namespace)\b|::/;
2622
- function readFileSample(filePath) {
2623
- try {
2624
- const contents = fs.readFileSync(filePath, "utf8");
2625
- return contents.slice(0, HEADER_SAMPLE_SIZE);
2626
- } catch {
2627
- return null;
2628
- }
2629
- }
2630
- function isLikelyCppHeader(sample) {
2631
- return CPP_HEADER_HINT.test(sample);
2632
- }
2633
-
2634
- // dist/native/runtime.js
2635
- import fs5 from "node:fs";
2636
- import path5 from "node:path";
2637
- import { createRequire } from "node:module";
2638
- import { fileURLToPath } from "node:url";
2639
-
2640
- // dist/util/ast.js
2641
- function stringifyUnknown(value) {
2642
- if (value instanceof Error)
2643
- return value.message;
2644
- if (typeof value === "string")
2645
- return value;
2646
- if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
2647
- return String(value);
2648
- }
2649
- if (value === null || value === void 0) {
2650
- return String(value);
2651
- }
2652
- if (typeof value === "object") {
2653
- try {
2654
- return JSON.stringify(value);
2655
- } catch {
2656
- return "[Object]";
2657
- }
2658
- }
2659
- if (typeof value === "symbol")
2660
- return value.toString();
2661
- if (typeof value === "function") {
2662
- return `[Function: ${value.name || "anonymous"}]`;
2663
- }
2664
- return "unknown";
2665
- }
2666
-
2667
- // dist/native/bindingLoader.js
2668
- import fs4 from "node:fs";
2669
- import path4 from "node:path";
2670
-
2671
- // dist/util/paths.js
2672
- import fs2, {} from "node:fs";
2673
- import fsp from "node:fs/promises";
2674
- import path2 from "node:path";
2675
-
2676
- // dist/util/errors.js
2677
- function errorMessage(error) {
2678
- if (error instanceof Error)
2679
- return error.message;
2680
- if (typeof error === "string")
2681
- return error;
2682
- if (error === null || error === void 0)
2683
- return String(error);
2684
- if (typeof error === "object") {
2685
- try {
2686
- const serialized = JSON.stringify(error);
2687
- if (serialized)
2688
- return serialized;
2689
- } catch {
2690
- return String(error);
2691
- }
2692
- }
2693
- return String(error);
2694
- }
2695
-
2696
- // dist/util/paths.js
2697
- function normalizePath(p) {
2698
- return typeof p === "string" ? p.replace(/\\/g, "/") : "";
2699
- }
2700
- function normalizeWindowsComparablePath(filePath) {
2701
- return normalizePath(filePath).replace(/^([A-Za-z]):/, (_, driveLetter) => `${driveLetter.toUpperCase()}:`);
2702
- }
2703
- var defaultCaseInsensitiveFileIdentity = process.platform === "win32" || process.platform === "darwin";
2704
- var caseInsensitiveFileIdentity = defaultCaseInsensitiveFileIdentity;
2705
- var fileIdentityCaseSensitivityFrozen = false;
2706
- function fileIdentityKey(filePath) {
2707
- fileIdentityCaseSensitivityFrozen = true;
2708
- const normalized = normalizeWindowsComparablePath(filePath);
2709
- return caseInsensitiveFileIdentity ? normalized.toLowerCase() : normalized;
2710
- }
2711
- function isWindowsQualifiedAbsolutePath(filePath) {
2712
- const normalizedPath = normalizePath(filePath);
2713
- return /^[A-Za-z]:\//.test(normalizedPath) || normalizedPath.startsWith("//");
2714
- }
2715
- function isPosixQualifiedAbsolutePath(filePath) {
2716
- const normalizedPath = normalizePath(filePath);
2717
- return path2.posix.isAbsolute(normalizedPath) && !isWindowsQualifiedAbsolutePath(normalizedPath);
2718
- }
2719
- function isAbsoluteFilePath(filePath) {
2720
- return path2.posix.isAbsolute(filePath) || path2.win32.isAbsolute(filePath);
2721
- }
2722
- function resolveFilePathFromRoot(projectRoot, filePath) {
2723
- if (isAbsoluteFilePath(filePath)) {
2724
- return filePath;
2725
- }
2726
- if (isWindowsQualifiedAbsolutePath(projectRoot)) {
2727
- return path2.win32.resolve(projectRoot, filePath);
2728
- }
2729
- if (isPosixQualifiedAbsolutePath(projectRoot)) {
2730
- return path2.posix.resolve(normalizePath(projectRoot), normalizePath(filePath));
2731
- }
2732
- return path2.resolve(projectRoot, filePath);
2733
- }
2734
- function resolveComparableProjectRoot(projectRoot) {
2735
- if (isAbsoluteFilePath(projectRoot)) {
2736
- return projectRoot;
2737
- }
2738
- return path2.resolve(projectRoot);
2739
- }
2740
- function isRelativeToRoot(normalizedRoot, normalizedFile) {
2741
- const rootIsWindowsPath = isWindowsQualifiedAbsolutePath(normalizedRoot);
2742
- const fileIsWindowsPath = isWindowsQualifiedAbsolutePath(normalizedFile);
2743
- const rootIsPosixPath = isPosixQualifiedAbsolutePath(normalizedRoot);
2744
- const fileIsPosixPath = isPosixQualifiedAbsolutePath(normalizedFile);
2745
- const comparableRoot = rootIsWindowsPath ? normalizeWindowsComparablePath(normalizedRoot) : normalizedRoot;
2746
- const comparableFile = fileIsWindowsPath ? normalizeWindowsComparablePath(normalizedFile) : normalizedFile;
2747
- if (rootIsWindowsPath && fileIsWindowsPath) {
2748
- if (comparableFile === comparableRoot) {
2749
- return true;
2750
- }
2751
- const relativePath2 = normalizePath(path2.win32.relative(comparableRoot, comparableFile));
2752
- return !!relativePath2.length && !relativePath2.startsWith("..") && !path2.win32.isAbsolute(relativePath2);
2753
- }
2754
- if (rootIsWindowsPath || fileIsWindowsPath) {
2755
- return false;
2756
- }
2757
- if (rootIsPosixPath && fileIsPosixPath) {
2758
- if (comparableFile === comparableRoot) {
2759
- return true;
2760
- }
2761
- const relativePath2 = path2.posix.relative(comparableRoot, comparableFile);
2762
- return !!relativePath2.length && !relativePath2.startsWith("..") && !path2.posix.isAbsolute(relativePath2);
2763
- }
2764
- if (rootIsPosixPath || fileIsPosixPath) {
2765
- return false;
2766
- }
2767
- if (comparableFile === comparableRoot) {
2768
- return true;
2769
- }
2770
- const relativePath = path2.relative(comparableRoot, comparableFile);
2771
- return !!relativePath.length && !relativePath.startsWith("..") && !path2.isAbsolute(relativePath);
2772
- }
2773
- function isFilePathWithinRoot(projectRoot, filePath, realpathMemo) {
2774
- const normalizedRoot = normalizePath(resolveComparableProjectRoot(projectRoot));
2775
- const normalizedFile = normalizePath(resolveFilePathFromRoot(normalizedRoot, filePath));
2776
- if (isRelativeToRoot(normalizedRoot, normalizedFile))
2777
- return true;
2778
- return windowsAliasRelativePath(normalizedRoot, normalizedFile, realpathMemo) !== null;
2779
- }
2780
- function assertFilePathWithinRoot(projectRoot, filePath, label = "File") {
2781
- const normalizedRoot = normalizePath(resolveComparableProjectRoot(projectRoot));
2782
- const normalizedFile = normalizePath(resolveFilePathFromRoot(normalizedRoot, filePath));
2783
- if (!isFilePathWithinRoot(normalizedRoot, normalizedFile)) {
2784
- throw new Error(`${label} is outside project root: ${normalizedFile} (root: ${normalizedRoot})`);
2785
- }
2786
- return normalizedFile;
2787
- }
2788
- function resolveWindowsRealpath(filePath, realpathMemo) {
2789
- if (!realpathMemo)
2790
- return fs2.realpathSync.native(filePath);
2791
- const key = fileIdentityKey(filePath);
2792
- const cached = realpathMemo.get(key);
2793
- if (cached !== void 0)
2794
- return cached;
2795
- const resolved = fs2.realpathSync.native(filePath);
2796
- realpathMemo.set(key, resolved);
2797
- return resolved;
2798
- }
2799
- function windowsAliasRelativePath(normalizedRoot, normalizedFile, realpathMemo) {
2800
- if (process.platform !== "win32")
2801
- return null;
2802
- if (!isWindowsQualifiedAbsolutePath(normalizedRoot) || !isWindowsQualifiedAbsolutePath(normalizedFile)) {
2803
- return null;
2804
- }
2805
- try {
2806
- const realRoot = resolveWindowsRealpath(normalizedRoot, realpathMemo);
2807
- const realFile = resolveWindowsRealpath(normalizedFile, realpathMemo);
2808
- const directRelativePath = path2.win32.relative(realRoot, realFile);
2809
- if (!directRelativePath.startsWith("..") && !path2.win32.isAbsolute(directRelativePath)) {
2810
- return normalizePath(directRelativePath);
2811
- }
2812
- const rootHasNoReparsePoint = fileIdentityKey(realRoot) === fileIdentityKey(normalizedRoot);
2813
- const fileHasNoReparsePoint = fileIdentityKey(realFile) === fileIdentityKey(normalizedFile);
2814
- if (rootHasNoReparsePoint && fileHasNoReparsePoint) {
2815
- return null;
2816
- }
2817
- const rootStat = fs2.statSync(realRoot, { bigint: true });
2818
- let ancestorPath = realFile;
2819
- while (true) {
2820
- const ancestorStat = fs2.statSync(ancestorPath, { bigint: true });
2821
- if (sameWindowsDirectoryIdentity(rootStat, ancestorStat)) {
2822
- return normalizePath(path2.win32.relative(ancestorPath, realFile));
2823
- }
2824
- const parentPath = path2.dirname(ancestorPath);
2825
- if (parentPath === ancestorPath)
2826
- return null;
2827
- ancestorPath = parentPath;
2828
- }
2829
- } catch {
2830
- return null;
2831
- }
2832
- }
2833
- function sameWindowsDirectoryIdentity(left, right) {
2834
- return left.ino !== 0n && left.dev === right.dev && left.ino === right.ino && left.birthtimeNs === right.birthtimeNs;
2835
- }
2836
-
2837
- // dist/native/runtimeCache.js
2838
- import { createHash, randomBytes } from "node:crypto";
2839
- import fs3 from "node:fs";
2840
- import path3 from "node:path";
2841
- var CACHE_SCHEMA_VERSION = 1;
2842
- var HASH_BUFFER_SIZE = 1024 * 1024;
2843
- var IDENTITY_FILE_PREFIX = "identity-";
2844
- var IDENTITY_FILE_SUFFIX = ".json";
2845
- var IDENTITY_VERSION = 1;
2846
- var IDENTITY_REVERIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
2847
- var ABANDONED_ENTRY_RETENTION_MS = 30 * 24 * 60 * 60 * 1e3;
2848
- function asError(error) {
2849
- return error instanceof Error ? error : new Error(String(error));
2850
- }
2851
- function isWithinDirectory(filePath, directoryPath) {
2852
- const relative = path3.relative(directoryPath, filePath);
2853
- return !relative || !relative.startsWith("..") && !path3.isAbsolute(relative);
2854
- }
2855
- function assertSafeCacheSegment(value, label) {
2856
- if (!value || value === "." || value === ".." || path3.basename(value) !== value) {
2857
- throw new Error(`invalid native cache ${label}: ${value}`);
2858
- }
2859
- if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
2860
- throw new Error(`invalid native cache ${label}: ${value}`);
2861
- }
2862
- }
2863
- function assertSafePathComponent(componentPath) {
2864
- const stats = fs3.lstatSync(componentPath);
2865
- if (!stats.isDirectory() || stats.isSymbolicLink()) {
2866
- throw new Error(`unsafe native cache path component: ${componentPath}`);
2867
- }
2868
- }
2869
- function prepareSafeDirectory(directoryPath, create = true) {
2870
- const absolute = path3.resolve(directoryPath);
2871
- const parsed = path3.parse(absolute);
2872
- let current = parsed.root;
2873
- assertSafePathComponent(current);
2874
- const relativeParts = absolute.slice(parsed.root.length).split(path3.sep).filter(Boolean);
2875
- for (const part of relativeParts) {
2876
- current = path3.join(current, part);
2877
- try {
2878
- assertSafePathComponent(current);
2879
- } catch (error) {
2880
- if (error.code !== "ENOENT" || !create) {
2881
- throw error;
2882
- }
2883
- try {
2884
- fs3.mkdirSync(current);
2885
- } catch (mkdirError) {
2886
- if (mkdirError.code !== "EEXIST")
2887
- throw mkdirError;
2888
- }
2889
- assertSafePathComponent(current);
2890
- }
2891
- }
2892
- return fs3.realpathSync.native(absolute);
2893
- }
2894
- function findProductionCacheRoot() {
2895
- const localAppData = process.env.LOCALAPPDATA;
2896
- if (!localAppData)
2897
- return null;
2898
- return path3.join(localAppData, "codegraph", "native-cache", `v${CACHE_SCHEMA_VERSION}`);
2899
- }
2900
- function resolveProductionCacheRoot() {
2901
- const cacheRoot = findProductionCacheRoot();
2902
- if (!cacheRoot) {
2903
- throw new Error("LOCALAPPDATA is unavailable; cannot prepare the Windows native runtime cache");
2904
- }
2905
- return cacheRoot;
2906
- }
2907
- function hashFileStreaming(filePath, onChunk) {
2908
- const before = fs3.statSync(filePath);
2909
- if (!before.isFile() || before.size <= 0) {
2910
- throw new Error(`native binary is not a non-empty regular file: ${filePath}`);
2911
- }
2912
- const hash = createHash("sha256");
2913
- const buffer = Buffer.allocUnsafe(HASH_BUFFER_SIZE);
2914
- const descriptor = fs3.openSync(filePath, "r");
2915
- let size = 0;
2916
- try {
2917
- while (true) {
2918
- const bytesRead = fs3.readSync(descriptor, buffer, 0, buffer.length, null);
2919
- if (!bytesRead)
2920
- break;
2921
- hash.update(buffer.subarray(0, bytesRead));
2922
- size += bytesRead;
2923
- onChunk?.(bytesRead);
2924
- }
2925
- } finally {
2926
- fs3.closeSync(descriptor);
2927
- }
2928
- const after = fs3.statSync(filePath);
2929
- if (!after.isFile() || size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
2930
- throw new Error(`native binary changed while hashing: ${filePath}`);
2931
- }
2932
- return { sha256: hash.digest("hex"), size, mtimeMs: before.mtimeMs };
2933
- }
2934
- function randomSuffix() {
2935
- return `${process.pid}.${randomBytes(8).toString("hex")}`;
2936
- }
2937
- function copyFileExclusive(sourcePath, destinationPath) {
2938
- const source = fs3.openSync(sourcePath, "r");
2939
- let destination;
2940
- const buffer = Buffer.allocUnsafe(HASH_BUFFER_SIZE);
2941
- try {
2942
- destination = fs3.openSync(destinationPath, "wx");
2943
- while (true) {
2944
- const bytesRead = fs3.readSync(source, buffer, 0, buffer.length, null);
2945
- if (!bytesRead)
2946
- break;
2947
- let written = 0;
2948
- while (written < bytesRead) {
2949
- written += fs3.writeSync(destination, buffer, written, bytesRead - written);
2950
- }
2951
- }
2952
- fs3.fsyncSync(destination);
2953
- } finally {
2954
- if (destination !== void 0)
2955
- fs3.closeSync(destination);
2956
- fs3.closeSync(source);
2957
- }
2958
- }
2959
- function removeRegularTemporaryFile(filePath) {
2960
- try {
2961
- const stats = fs3.lstatSync(filePath);
2962
- if (stats.isFile() && !stats.isSymbolicLink())
2963
- fs3.unlinkSync(filePath);
2964
- } catch {
2965
- }
2966
- }
2967
- function verifyFile(filePath, expected) {
2968
- try {
2969
- const actual = hashFileStreaming(filePath);
2970
- return actual.size === expected.size && actual.sha256 === expected.sha256 ? actual : null;
2971
- } catch {
2972
- return null;
2973
- }
2974
- }
2975
- function publishExclusive(temporaryPath, finalPath) {
2976
- try {
2977
- fs3.linkSync(temporaryPath, finalPath);
2978
- return true;
2979
- } catch (error) {
2980
- if (error.code === "EEXIST")
2981
- return false;
2982
- throw error;
2983
- } finally {
2984
- removeRegularTemporaryFile(temporaryPath);
2985
- }
2986
- }
2987
- function populateBinary(sourcePath, finalPath, expected) {
2988
- const temporaryPath = `${finalPath}.${randomSuffix()}.tmp`;
2989
- try {
2990
- copyFileExclusive(sourcePath, temporaryPath);
2991
- if (!verifyFile(temporaryPath, expected)) {
2992
- throw new Error("native cache temporary file failed integrity verification");
2993
- }
2994
- return publishExclusive(temporaryPath, finalPath);
2995
- } catch (error) {
2996
- removeRegularTemporaryFile(temporaryPath);
2997
- throw error;
2998
- }
2999
- }
3000
- function recoverCorruptFinal(finalPath) {
3001
- const recoveryPath = `${finalPath}.corrupt.${randomSuffix()}`;
3002
- fs3.renameSync(finalPath, recoveryPath);
3003
- }
3004
- function writeManifest(entryPath, manifest) {
3005
- const finalPath = path3.join(entryPath, "manifest.json");
3006
- if (fs3.existsSync(finalPath))
3007
- return;
3008
- const temporaryPath = `${finalPath}.${randomSuffix()}.tmp`;
3009
- try {
3010
- const descriptor = fs3.openSync(temporaryPath, "wx");
3011
- try {
3012
- fs3.writeFileSync(descriptor, `${JSON.stringify(manifest, null, 2)}
3013
- `, "utf8");
3014
- fs3.fsyncSync(descriptor);
3015
- } finally {
3016
- fs3.closeSync(descriptor);
3017
- }
3018
- publishExclusive(temporaryPath, finalPath);
3019
- } catch (error) {
3020
- removeRegularTemporaryFile(temporaryPath);
3021
- throw error;
3022
- }
3023
- }
3024
- function currentRuntimeStamp() {
3025
- return { abi: process.versions.modules, platform: process.platform, arch: process.arch };
3026
- }
3027
- function identityFilePath(entryPath, sourcePath) {
3028
- const sourceKey = createHash("sha256").update(sourcePath).digest("hex");
3029
- return path3.join(entryPath, `${IDENTITY_FILE_PREFIX}${sourceKey}${IDENTITY_FILE_SUFFIX}`);
3030
- }
3031
- function isIdentityFileName(fileName) {
3032
- return /^identity-[a-f0-9]{64}\.json$/.test(fileName);
3033
- }
3034
- function readCacheIdentityFile(filePath) {
3035
- let parsed;
3036
- try {
3037
- parsed = JSON.parse(fs3.readFileSync(filePath, "utf8"));
3038
- } catch {
3039
- return null;
3040
- }
3041
- if (!parsed || typeof parsed !== "object")
3042
- return null;
3043
- const candidate = parsed;
3044
- if (candidate.version !== IDENTITY_VERSION)
3045
- return null;
3046
- const numbers = [candidate.sourceSize, candidate.sourceMtimeMs, candidate.cachedSize, candidate.cachedMtimeMs];
3047
- if (numbers.some((value) => typeof value !== "number" || !Number.isFinite(value)))
3048
- return null;
3049
- const strings = [
3050
- candidate.sha256,
3051
- candidate.cacheKey,
3052
- candidate.sourcePath,
3053
- candidate.loadedPath,
3054
- candidate.verifiedAt
3055
- ];
3056
- if (strings.some((value) => typeof value !== "string" || !value))
3057
- return null;
3058
- if (!Array.isArray(candidate.supportedLanguageIds))
3059
- return null;
3060
- if (candidate.supportedLanguageIds.some((value) => typeof value !== "string"))
3061
- return null;
3062
- const origin = candidate.origin;
3063
- if (!origin || typeof origin !== "object" || origin.mode !== "cache" || typeof origin.packageName !== "string") {
3064
- return null;
3065
- }
3066
- const runtime = candidate.runtime;
3067
- if (!runtime || typeof runtime !== "object")
3068
- return null;
3069
- if (typeof runtime.abi !== "string" || typeof runtime.platform !== "string" || typeof runtime.arch !== "string") {
3070
- return null;
3071
- }
3072
- return candidate;
3073
- }
3074
- function readCacheIdentity(entryPath, sourcePath) {
3075
- return readCacheIdentityFile(identityFilePath(entryPath, sourcePath));
3076
- }
3077
- function latestCacheIdentityVerifiedAt(entryPath, now) {
3078
- let fileNames;
3079
- try {
3080
- fileNames = fs3.readdirSync(entryPath);
3081
- } catch {
3082
- return Number.NaN;
3083
- }
3084
- let latest = Number.NaN;
3085
- for (const fileName of fileNames) {
3086
- if (!isIdentityFileName(fileName))
3087
- continue;
3088
- const identity = readCacheIdentityFile(path3.join(entryPath, fileName));
3089
- const verifiedAt = identity ? Date.parse(identity.verifiedAt) : Number.NaN;
3090
- if (!Number.isFinite(verifiedAt) || verifiedAt > now)
3091
- continue;
3092
- if (!Number.isFinite(latest) || verifiedAt > latest)
3093
- latest = verifiedAt;
3094
- }
3095
- return latest;
3096
- }
3097
- function statOrNull(filePath) {
3098
- try {
3099
- const stats = fs3.statSync(filePath);
3100
- return stats.isFile() ? stats : null;
3101
- } catch {
3102
- return null;
3103
- }
3104
- }
3105
- function lstatRegularFileOrNull(filePath) {
3106
- try {
3107
- const stats = fs3.lstatSync(filePath);
3108
- return stats.isFile() && !stats.isSymbolicLink() ? stats : null;
3109
- } catch {
3110
- return null;
3111
- }
3112
- }
3113
- function isSafeExistingDirectory(directoryPath) {
3114
- try {
3115
- prepareSafeDirectory(directoryPath, false);
3116
- return true;
3117
- } catch {
3118
- return false;
3119
- }
3120
- }
3121
- function pathsResolveEqual(left, right) {
3122
- return path3.resolve(left) === path3.resolve(right);
3123
- }
3124
- function lookupNativeRuntimeCacheEntry(request) {
3125
- try {
3126
- assertSafeCacheSegment(request.target, "target");
3127
- assertSafeCacheSegment(request.packageVersion, "package version");
3128
- const cacheRoot = request.cacheRoot ?? findProductionCacheRoot();
3129
- if (!cacheRoot)
3130
- return null;
3131
- const sourceRealPath = fs3.realpathSync.native(request.sourcePath);
3132
- const sourceStats = statOrNull(sourceRealPath);
3133
- if (!sourceStats)
3134
- return null;
3135
- const runtime = currentRuntimeStamp();
3136
- const resolvedCacheRoot = path3.resolve(cacheRoot);
3137
- const targetPath = path3.join(resolvedCacheRoot, request.target);
3138
- if (!isSafeExistingDirectory(resolvedCacheRoot) || !isSafeExistingDirectory(targetPath))
3139
- return null;
3140
- const prefix = `${request.packageVersion}-`;
3141
- let entryNames;
3142
- try {
3143
- entryNames = fs3.readdirSync(targetPath);
3144
- } catch {
3145
- return null;
3146
- }
3147
- const now = request.now ?? Date.now();
3148
- for (const entryName of entryNames) {
3149
- if (!entryName.startsWith(prefix))
3150
- continue;
3151
- const entryPath = path3.join(targetPath, entryName);
3152
- if (!isSafeExistingDirectory(entryPath))
3153
- continue;
3154
- const identity = readCacheIdentity(entryPath, sourceRealPath);
3155
- if (!identity)
3156
- continue;
3157
- const expectedEntryName = `${request.packageVersion}-${identity.sha256}`;
3158
- const expectedCacheKey = `${request.packageName}@${request.packageVersion}:${request.target}:${identity.sha256}`;
3159
- const loadedPath = path3.resolve(identity.loadedPath);
3160
- if (entryName !== expectedEntryName || identity.cacheKey !== expectedCacheKey || identity.loadedPath !== loadedPath || path3.dirname(loadedPath) !== entryPath || path3.basename(loadedPath) !== path3.basename(sourceRealPath)) {
3161
- continue;
3162
- }
3163
- if (identity.sourcePath !== sourceRealPath)
3164
- continue;
3165
- if (identity.sourceSize !== sourceStats.size || identity.sourceMtimeMs !== sourceStats.mtimeMs)
3166
- continue;
3167
- if (identity.origin.packageName !== request.packageName || identity.origin.packageVersion !== request.packageVersion || identity.origin.target !== request.target || identity.origin.sourcePath === void 0 || identity.origin.loadedPath === void 0 || !pathsResolveEqual(identity.origin.sourcePath, sourceRealPath) || !pathsResolveEqual(identity.origin.loadedPath, identity.loadedPath) || identity.origin.cacheKey !== identity.cacheKey || identity.origin.sha256 !== identity.sha256) {
3168
- continue;
3169
- }
3170
- if (identity.runtime.abi !== runtime.abi || identity.runtime.platform !== runtime.platform || identity.runtime.arch !== runtime.arch) {
3171
- continue;
3172
- }
3173
- const cachedStats = lstatRegularFileOrNull(identity.loadedPath);
3174
- if (!cachedStats)
3175
- continue;
3176
- if (identity.cachedSize !== cachedStats.size || identity.cachedMtimeMs !== cachedStats.mtimeMs)
3177
- continue;
3178
- const verifiedAt = Date.parse(identity.verifiedAt);
3179
- if (!Number.isFinite(verifiedAt) || verifiedAt > now || now - verifiedAt >= IDENTITY_REVERIFY_INTERVAL_MS) {
3180
- continue;
3181
- }
3182
- if (!isWithinDirectory(identity.loadedPath, resolvedCacheRoot))
3183
- continue;
3184
- return { entryPath, identity, revalidateAt: verifiedAt + IDENTITY_REVERIFY_INTERVAL_MS };
3185
- }
3186
- return null;
3187
- } catch {
3188
- return null;
3189
- }
3190
- }
3191
- function recordNativeRuntimeCacheIdentity(identity) {
3192
- try {
3193
- const sourceStats = statOrNull(identity.sourcePath);
3194
- const cachedStats = lstatRegularFileOrNull(identity.loadedPath);
3195
- if (!sourceStats || !cachedStats || sourceStats.size !== identity.sourceSize || sourceStats.mtimeMs !== identity.sourceMtimeMs || cachedStats.size !== identity.cachedSize || cachedStats.mtimeMs !== identity.cachedMtimeMs) {
3196
- return;
3197
- }
3198
- const entryPath = path3.dirname(identity.loadedPath);
3199
- const record = {
3200
- version: IDENTITY_VERSION,
3201
- runtime: currentRuntimeStamp(),
3202
- ...identity
3203
- };
3204
- const finalPath = identityFilePath(entryPath, identity.sourcePath);
3205
- const temporaryPath = `${finalPath}.${randomSuffix()}.tmp`;
3206
- try {
3207
- const descriptor = fs3.openSync(temporaryPath, "wx");
3208
- try {
3209
- fs3.writeFileSync(descriptor, `${JSON.stringify(record, null, 2)}
3210
- `, "utf8");
3211
- fs3.fsyncSync(descriptor);
3212
- } finally {
3213
- fs3.closeSync(descriptor);
3214
- }
3215
- fs3.renameSync(temporaryPath, finalPath);
3216
- } catch {
3217
- removeRegularTemporaryFile(temporaryPath);
3218
- }
3219
- } catch {
3220
- }
3221
- }
3222
- function readEntrySummary(entryPath, now) {
3223
- let packageVersion = null;
3224
- let sourceFileName = null;
3225
- let cachedAtMs = null;
3226
- try {
3227
- const parsed = JSON.parse(fs3.readFileSync(path3.join(entryPath, "manifest.json"), "utf8"));
3228
- if (parsed && typeof parsed === "object") {
3229
- const manifest = parsed;
3230
- if (typeof manifest.packageVersion === "string" && manifest.packageVersion) {
3231
- packageVersion = manifest.packageVersion;
3232
- }
3233
- if (typeof manifest.sourceFileName === "string" && manifest.sourceFileName && path3.basename(manifest.sourceFileName) === manifest.sourceFileName) {
3234
- sourceFileName = manifest.sourceFileName;
3235
- }
3236
- const cachedAt = typeof manifest.cachedAt === "string" ? Date.parse(manifest.cachedAt) : Number.NaN;
3237
- if (Number.isFinite(cachedAt))
3238
- cachedAtMs = cachedAt;
3239
- }
3240
- } catch {
3241
- return null;
3242
- }
3243
- if (!packageVersion || !sourceFileName)
3244
- return null;
3245
- const verifiedAt = latestCacheIdentityVerifiedAt(entryPath, now);
3246
- const lastUsedMs = Number.isFinite(verifiedAt) ? verifiedAt : cachedAtMs;
3247
- if (lastUsedMs === null)
3248
- return null;
3249
- return { packageVersion, lastUsedMs, sourceFileName };
3250
- }
3251
- function removeAbandonedEntry(entryPath, sourceFileName) {
3252
- const cachedBinaryPath = path3.join(entryPath, sourceFileName);
3253
- if (!isWithinDirectory(cachedBinaryPath, entryPath) || path3.dirname(cachedBinaryPath) !== entryPath) {
3254
- throw new Error("invalid native cache binary path");
3255
- }
3256
- const stats = fs3.lstatSync(cachedBinaryPath);
3257
- if (!stats.isFile() || stats.isSymbolicLink())
3258
- throw new Error("unsafe native cache binary");
3259
- fs3.unlinkSync(cachedBinaryPath);
3260
- fs3.rmSync(entryPath, { recursive: true, force: true });
3261
- }
3262
- function pruneAbandonedEntries(targetPath, cacheRoot, keepEntryPath, keepVersion, now) {
3263
- let entryNames;
3264
- try {
3265
- entryNames = fs3.readdirSync(targetPath);
3266
- } catch {
3267
- return;
3268
- }
3269
- for (const entryName of entryNames) {
3270
- const entryPath = path3.join(targetPath, entryName);
3271
- if (entryPath === keepEntryPath)
3272
- continue;
3273
- if (!isWithinDirectory(entryPath, cacheRoot))
3274
- continue;
3275
- try {
3276
- if (!fs3.lstatSync(entryPath).isDirectory())
3277
- continue;
3278
- } catch {
3279
- continue;
3280
- }
3281
- const summary = readEntrySummary(entryPath, now);
3282
- if (!summary || summary.packageVersion === keepVersion)
3283
- continue;
3284
- if (now - summary.lastUsedMs < ABANDONED_ENTRY_RETENTION_MS)
3285
- continue;
3286
- try {
3287
- removeAbandonedEntry(entryPath, summary.sourceFileName);
3288
- } catch {
3289
- }
3290
- }
3291
- }
3292
- function prepareNativeRuntimeCache(request) {
3293
- const sourcePath = path3.resolve(request.sourcePath);
3294
- try {
3295
- assertSafeCacheSegment(request.target, "target");
3296
- assertSafeCacheSegment(request.packageVersion, "package version");
3297
- const hit = lookupNativeRuntimeCacheEntry({
3298
- sourcePath,
3299
- packageName: request.packageName,
3300
- packageVersion: request.packageVersion,
3301
- target: request.target,
3302
- ...request.cacheRoot !== void 0 ? { cacheRoot: request.cacheRoot } : {},
3303
- ...request.now !== void 0 ? { now: request.now } : {}
3304
- });
3305
- if (hit) {
3306
- return {
3307
- status: "reused",
3308
- sourcePath: hit.identity.sourcePath,
3309
- loadedPath: hit.identity.loadedPath,
3310
- cacheKey: hit.identity.cacheKey,
3311
- sha256: hit.identity.sha256,
3312
- sourceSize: hit.identity.sourceSize,
3313
- sourceMtimeMs: hit.identity.sourceMtimeMs,
3314
- cachedSize: hit.identity.cachedSize,
3315
- cachedMtimeMs: hit.identity.cachedMtimeMs,
3316
- verified: false
3317
- };
3318
- }
3319
- const sourceRealPath = fs3.realpathSync.native(sourcePath);
3320
- const source = hashFileStreaming(sourceRealPath);
3321
- const cacheRoot = prepareSafeDirectory(request.cacheRoot ?? resolveProductionCacheRoot());
3322
- const targetPath = prepareSafeDirectory(path3.join(cacheRoot, request.target));
3323
- if (!isWithinDirectory(targetPath, cacheRoot)) {
3324
- throw new Error("native cache target escaped the cache root");
3325
- }
3326
- const cacheKey = `${request.packageName}@${request.packageVersion}:${request.target}:${source.sha256}`;
3327
- const entryPath = prepareSafeDirectory(path3.join(targetPath, `${request.packageVersion}-${source.sha256}`));
3328
- if (!isWithinDirectory(entryPath, cacheRoot)) {
3329
- throw new Error("native cache entry escaped the cache root");
3330
- }
3331
- const sourceFileName = path3.basename(sourceRealPath);
3332
- const finalPath = path3.join(entryPath, sourceFileName);
3333
- let status = "reused";
3334
- let cached = fs3.existsSync(finalPath) ? verifyFile(finalPath, source) : null;
3335
- if (!cached) {
3336
- if (fs3.existsSync(finalPath))
3337
- recoverCorruptFinal(finalPath);
3338
- status = populateBinary(sourceRealPath, finalPath, source) ? "cached" : "reused";
3339
- cached = verifyFile(finalPath, source);
3340
- if (!cached) {
3341
- throw new Error("native cache winner failed integrity verification");
3342
- }
3343
- }
3344
- writeManifest(entryPath, {
3345
- schemaVersion: CACHE_SCHEMA_VERSION,
3346
- packageName: request.packageName,
3347
- packageVersion: request.packageVersion,
3348
- target: request.target,
3349
- sourceFileName,
3350
- sourceSize: source.size,
3351
- sourceSha256: source.sha256,
3352
- cachedAt: (/* @__PURE__ */ new Date()).toISOString()
3353
- });
3354
- pruneAbandonedEntries(targetPath, cacheRoot, entryPath, request.packageVersion, request.now ?? Date.now());
3355
- return {
3356
- status,
3357
- sourcePath: sourceRealPath,
3358
- loadedPath: finalPath,
3359
- cacheKey,
3360
- sha256: source.sha256,
3361
- sourceSize: source.size,
3362
- sourceMtimeMs: source.mtimeMs,
3363
- cachedSize: cached.size,
3364
- cachedMtimeMs: cached.mtimeMs,
3365
- verified: true
3366
- };
3367
- } catch (error) {
3368
- return { status: "unavailable", sourcePath, error: asError(error) };
3369
- }
3370
- }
3371
-
3372
- // dist/native/bindingLoader.js
3373
- function isMuslRuntime() {
3374
- if (process.platform !== "linux")
3375
- return false;
3376
- const report = process.report?.getReport();
3377
- const header = report && typeof report === "object" && "header" in report ? report.header : null;
3378
- const glibcVersionRuntime = header && typeof header === "object" && "glibcVersionRuntime" in header ? header.glibcVersionRuntime : null;
3379
- if (typeof glibcVersionRuntime === "string" && glibcVersionRuntime)
3380
- return false;
3381
- return true;
3382
- }
3383
- function nativeTargetSuffixFor(platform, arch) {
3384
- if (platform === "win32") {
3385
- if (arch === "x64")
3386
- return "win32-x64-msvc";
3387
- if (arch === "arm64")
3388
- return "win32-arm64-msvc";
3389
- }
3390
- if (platform === "darwin") {
3391
- if (arch === "x64")
3392
- return "darwin-x64";
3393
- if (arch === "arm64")
3394
- return "darwin-arm64";
3395
- }
3396
- if (platform === "linux") {
3397
- const abi = isMuslRuntime() ? "musl" : "gnu";
3398
- if (arch === "x64")
3399
- return `linux-x64-${abi}`;
3400
- if (arch === "arm64")
3401
- return `linux-arm64-${abi}`;
3402
- }
3403
- return null;
3404
- }
3405
- function currentNativeTargetSuffix() {
3406
- return nativeTargetSuffixFor(process.platform, process.arch);
3407
- }
3408
- function normalizePathForComparison(filePath) {
3409
- const resolved = path4.resolve(filePath);
3410
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
3411
- }
3412
- function isWithinDirectory2(filePath, directoryPath) {
3413
- const normalizedFile = normalizePathForComparison(filePath);
3414
- const normalizedDir = normalizePathForComparison(directoryPath);
3415
- return normalizedFile === normalizedDir || normalizedFile.startsWith(`${normalizedDir}${path4.sep}`);
3416
- }
3417
- function findLocalNativeBinary(packageRoot) {
3418
- const suffix = currentNativeTargetSuffix();
3419
- if (!suffix) {
3420
- return null;
3421
- }
3422
- const expectedName = `index.${suffix}.node`;
3423
- try {
3424
- const entries = fs4.readdirSync(packageRoot, { withFileTypes: true });
3425
- const binary = entries.find((entry) => entry.isFile() && entry.name === expectedName);
3426
- return binary ? path4.join(packageRoot, binary.name) : null;
3427
- } catch {
3428
- return null;
3429
- }
3430
- }
3431
- function readPlatformPackage(packageName, target, resolveFn) {
3432
- const platformPackageName = `${packageName}-${target}`;
3433
- const resolvedEntry = resolveFn(platformPackageName);
3434
- const expectedFileName = `index.${target}.node`;
3435
- if (path4.basename(resolvedEntry) !== expectedFileName) {
3436
- throw new Error(`unexpected native platform entry for ${platformPackageName}: ${resolvedEntry}`);
3437
- }
3438
- const sourcePath = fs4.realpathSync.native(resolvedEntry);
3439
- const stats = fs4.statSync(sourcePath);
3440
- if (!stats.isFile() || stats.size <= 0) {
3441
- throw new Error(`native platform entry is not a non-empty regular file: ${sourcePath}`);
3442
- }
3443
- const packageJsonPath = path4.join(path4.dirname(sourcePath), "package.json");
3444
- const parsed = JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
3445
- if (parsed.name !== platformPackageName || !parsed.version) {
3446
- throw new Error(`invalid native platform package metadata: ${packageJsonPath}`);
3447
- }
3448
- return { sourcePath, packageVersion: parsed.version };
3449
- }
3450
- function loadNativeBinding(options) {
3451
- const localBinary = findLocalNativeBinary(options.localPackageRoot);
3452
- const localTarget = currentNativeTargetSuffix();
3453
- let lastError;
3454
- if (localBinary) {
3455
- try {
3456
- return {
3457
- binding: options.requireFn(localBinary),
3458
- origin: {
3459
- mode: "workspace",
3460
- packageName: options.packageName,
3461
- ...localTarget ? { target: localTarget } : {},
3462
- sourcePath: normalizePath(localBinary),
3463
- loadedPath: normalizePath(localBinary)
3464
- }
3465
- };
3466
- } catch (error) {
3467
- lastError = error;
3468
- }
3469
- }
3470
- const packageEntry = (() => {
3471
- if (!options.resolveFn)
3472
- return null;
3473
- try {
3474
- return options.resolveFn(options.packageName);
3475
- } catch {
3476
- return null;
3477
- }
3478
- })();
3479
- if (packageEntry && isWithinDirectory2(packageEntry, options.localPackageRoot)) {
3480
- return {
3481
- binding: null,
3482
- error: lastError ?? new Error("local workspace native addon is not built; run `npm run build:native`"),
3483
- origin: {
3484
- mode: "workspace",
3485
- packageName: options.packageName,
3486
- ...localTarget ? { target: localTarget } : {}
3487
- }
3488
- };
3489
- }
3490
- const platform = options.platform ?? process.platform;
3491
- const arch = options.arch ?? process.arch;
3492
- const target = nativeTargetSuffixFor(platform, arch);
3493
- let installedSourcePath;
3494
- let installedPackageVersion;
3495
- let cacheError;
3496
- if (target && options.resolveFn) {
3497
- try {
3498
- const platformPackage = readPlatformPackage(options.packageName, target, options.resolveFn);
3499
- installedSourcePath = platformPackage.sourcePath;
3500
- installedPackageVersion = platformPackage.packageVersion;
3501
- } catch (error) {
3502
- if (platform === "win32") {
3503
- cacheError = errorMessage(error);
3504
- }
3505
- }
3506
- }
3507
- if (platform === "win32" && target && installedSourcePath && installedPackageVersion) {
3508
- const cached = prepareNativeRuntimeCache({
3509
- sourcePath: installedSourcePath,
3510
- packageName: `${options.packageName}-${target}`,
3511
- packageVersion: installedPackageVersion,
3512
- target,
3513
- cacheRoot: options.cacheRoot
3514
- });
3515
- if (cached.status === "unavailable") {
3516
- cacheError = cached.error.message;
3517
- } else {
3518
- try {
3519
- return {
3520
- binding: options.requireFn(cached.loadedPath),
3521
- origin: {
3522
- mode: "cache",
3523
- packageName: `${options.packageName}-${target}`,
3524
- packageVersion: installedPackageVersion,
3525
- target,
3526
- sourcePath: normalizePath(cached.sourcePath),
3527
- loadedPath: normalizePath(cached.loadedPath),
3528
- cacheKey: cached.cacheKey,
3529
- sha256: cached.sha256
3530
- },
3531
- cacheEntry: {
3532
- sourcePath: cached.sourcePath,
3533
- loadedPath: cached.loadedPath,
3534
- cacheKey: cached.cacheKey,
3535
- sha256: cached.sha256,
3536
- sourceSize: cached.sourceSize,
3537
- sourceMtimeMs: cached.sourceMtimeMs,
3538
- cachedSize: cached.cachedSize,
3539
- cachedMtimeMs: cached.cachedMtimeMs,
3540
- verified: cached.verified
3541
- }
3542
- };
3543
- } catch (error) {
3544
- cacheError = `cached native addon failed to load: ${errorMessage(error)}`;
3545
- lastError = error;
3546
- }
3547
- }
3548
- }
3549
- let originPackageName = options.packageName;
3550
- let originLoadedPath = packageEntry;
3551
- if (target && installedSourcePath && installedPackageVersion) {
3552
- originPackageName = `${options.packageName}-${target}`;
3553
- originLoadedPath = installedSourcePath;
3554
- }
3555
- const packageOrigin = {
3556
- mode: "package",
3557
- packageName: originPackageName,
3558
- ...installedPackageVersion ? { packageVersion: installedPackageVersion } : {},
3559
- ...target ? { target } : {},
3560
- ...installedSourcePath ? { sourcePath: normalizePath(installedSourcePath) } : {},
3561
- ...originLoadedPath ? { loadedPath: normalizePath(originLoadedPath) } : {},
3562
- ...cacheError ? { cacheError } : {}
3563
- };
3564
- try {
3565
- return {
3566
- binding: options.requireFn(options.packageName),
3567
- origin: packageOrigin
3568
- };
3569
- } catch (error) {
3570
- return {
3571
- binding: null,
3572
- error: error ?? lastError,
3573
- origin: packageOrigin
3574
- };
3575
- }
3576
- }
3577
-
3578
- // dist/util/windowsProcessDrain.js
3579
- var WINDOWS_LIBUV_EXIT_DRAIN_MS = 100;
3580
- var drainRequired = false;
3581
- var beforeExitListener;
3582
- function markWindowsProcessDrainRequired() {
3583
- drainRequired = true;
3584
- ensureWindowsProcessDrainHook();
3585
- }
3586
- function delay(ms) {
3587
- return new Promise((resolve) => {
3588
- setTimeout(resolve, ms);
3589
- });
3590
- }
3591
- function ensureWindowsProcessDrainHook() {
3592
- if (process.platform !== "win32" || beforeExitListener)
3593
- return;
3594
- beforeExitListener = () => {
3595
- void drainWindowsProcessHandles();
3596
- };
3597
- process.once("beforeExit", beforeExitListener);
3598
- }
3599
- async function drainWindowsProcessHandles(options) {
3600
- const platform = options?.platform ?? process.platform;
3601
- const required = options?.required ?? drainRequired;
3602
- if (platform !== "win32" || !required)
3603
- return;
3604
- await (options?.wait ?? delay)(WINDOWS_LIBUV_EXIT_DRAIN_MS);
3605
- }
3606
-
3607
- // dist/native/runtime.js
3608
- var require2 = createRequire(import.meta.url);
3609
- var localNativePackageRoot = path5.resolve(path5.dirname(fileURLToPath(import.meta.url)), "../../packages/codegraph-native");
3610
- var NATIVE_REQUIRED_ERROR_PREFIX = "native tree-sitter required by explicit option but unavailable";
3611
- var bindingState;
3612
- var cachedRuntimeFingerprints = /* @__PURE__ */ new Map();
3613
- function isNativeTreeSitterDisabledByEnv(env = process.env) {
3614
- const rawValue = env.CODEGRAPH_DISABLE_NATIVE;
3615
- if (typeof rawValue !== "string") {
3616
- return false;
3617
- }
3618
- const normalized = rawValue.trim().toLowerCase();
3619
- return normalized === "1" || normalized === "true" || normalized === "yes";
3620
- }
3621
- function normalizeNativeRuntimeMode(mode) {
3622
- return mode ?? "auto";
3623
- }
3624
- function loadBinding() {
3625
- if (bindingState)
3626
- return bindingState;
3627
- cachedRuntimeFingerprints.clear();
3628
- const loaded = loadNativeBinding({
3629
- packageName: "@lzehrung/codegraph-native",
3630
- localPackageRoot: localNativePackageRoot,
3631
- requireFn: require2,
3632
- resolveFn: require2.resolve
3633
- });
3634
- if (loaded.binding) {
3635
- const supportedLanguageIds = new Set(loaded.binding.supportedLanguageIds());
3636
- markWindowsProcessDrainRequired();
3637
- bindingState = {
3638
- loaded: true,
3639
- binding: loaded.binding,
3640
- supportedLanguageIds,
3641
- origin: loaded.origin
3642
- };
3643
- if (loaded.cacheEntry?.verified) {
3644
- recordNativeRuntimeCacheIdentity({
3645
- sourcePath: loaded.cacheEntry.sourcePath,
3646
- loadedPath: loaded.cacheEntry.loadedPath,
3647
- cacheKey: loaded.cacheEntry.cacheKey,
3648
- sha256: loaded.cacheEntry.sha256,
3649
- sourceSize: loaded.cacheEntry.sourceSize,
3650
- sourceMtimeMs: loaded.cacheEntry.sourceMtimeMs,
3651
- cachedSize: loaded.cacheEntry.cachedSize,
3652
- cachedMtimeMs: loaded.cacheEntry.cachedMtimeMs,
3653
- verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
3654
- supportedLanguageIds: Array.from(supportedLanguageIds).sort(),
3655
- origin: loaded.origin
3656
- });
3657
- }
3658
- return bindingState;
3659
- }
3660
- bindingState = {
3661
- loaded: false,
3662
- error: loaded.error,
3663
- ...loaded.origin ? { origin: loaded.origin } : {}
3664
- };
3665
- return bindingState;
3666
- }
3667
- function resolveNativeBindingState(mode, env = process.env) {
3668
- const normalizedMode = normalizeNativeRuntimeMode(mode);
3669
- if (normalizedMode === "off") {
3670
- return {
3671
- loaded: false,
3672
- error: new Error("native tree-sitter disabled by explicit option")
3673
- };
3674
- }
3675
- if (normalizedMode === "auto" && isNativeTreeSitterDisabledByEnv(env)) {
3676
- return {
3677
- loaded: false,
3678
- error: new Error("native tree-sitter disabled by CODEGRAPH_DISABLE_NATIVE")
3679
- };
3680
- }
3681
- return loadBinding();
3682
- }
3683
- function throwIfNativeRequiredUnavailable(mode, state) {
3684
- if (normalizeNativeRuntimeMode(mode) !== "on" || state.loaded)
3685
- return;
3686
- const suffix = state.error ? `: ${stringifyUnknown(state.error)}` : "";
3687
- throw new Error(`${NATIVE_REQUIRED_ERROR_PREFIX}${suffix}`);
3688
- }
3689
-
3690
- // dist/native/queries.js
3691
- function normalizeNativeQueryForSupport(support, kind, queryText) {
3692
- return support.native?.normalizeQuery?.(kind, queryText) ?? queryText;
3693
- }
3694
-
3695
- // dist/native/execution.js
3696
- function getNativeSingleQueryExecution(source, support, queryText, mode) {
3697
- const state = resolveNativeBindingState(mode);
3698
- throwIfNativeRequiredUnavailable(mode, state);
3699
- if (!state.loaded) {
3700
- return unavailableSingleQueryExecution(state);
3701
- }
3702
- if (!state.supportedLanguageIds.has(support.id)) {
3703
- return { matches: null, fallbackReason: "unsupportedLanguage" };
3704
- }
3705
- if (!state.binding.runQuery) {
3706
- return {
3707
- matches: null,
3708
- fallbackReason: "unavailable",
3709
- error: "native binding does not expose runQuery"
3710
- };
3711
- }
3712
- const normalizedQuery = normalizeNativeQueryForSupport(support, "adHoc", queryText);
3713
- try {
3714
- return {
3715
- matches: state.binding.runQuery(source, support.id, normalizedQuery).matches
3716
- };
3717
- } catch (error) {
3718
- return {
3719
- matches: null,
3720
- fallbackReason: "queryFailure",
3721
- error: errorMessage(error)
3722
- };
3723
- }
3724
- }
3725
- function unavailableSingleQueryExecution(state) {
3726
- return {
3727
- matches: null,
3728
- ...unavailableNativeFailure(state)
3729
- };
3730
- }
3731
- function unavailableNativeFailure(state) {
3732
- if (!state.error) {
3733
- return { fallbackReason: "unavailable" };
3734
- }
3735
- if (state.error instanceof Error) {
3736
- return { fallbackReason: "unavailable", error: state.error.message };
3737
- }
3738
- return { fallbackReason: "unavailable", error: stringifyUnknown(state.error) };
3739
- }
3740
-
3741
- // dist/chunking/chunkMatches.js
3742
- function getChunkMatches(language, source, _filePath) {
3743
- const support = supportById(language.supportId);
3744
- if (support) {
3745
- const nativeExecution = getNativeSingleQueryExecution(source, support, language.queryText);
3746
- if (nativeExecution.matches) {
3747
- const toStringIndex = createUtf8ByteToStringIndex(source);
3748
- return nativeExecution.matches.map((match) => toChunkMatchFromNative(match, toStringIndex));
3749
- }
3750
- }
3751
- return [];
3752
- }
3753
- function toChunkMatchFromNative(match, toStringIndex) {
3754
- return {
3755
- captures: match.captures.map((capture) => ({
3756
- name: capture.name,
3757
- text: capture.text,
3758
- startByte: toStringIndex(capture.start.index),
3759
- endByte: toStringIndex(capture.end.index),
3760
- startLine: capture.start.row + 1,
3761
- endLine: capture.end.row + 1,
3762
- nodeType: capture.nodeType
3763
- }))
3764
- };
3765
- }
3766
- function createUtf8ByteToStringIndex(source) {
3767
- const utf8Length = Buffer2.byteLength(source, "utf8");
3768
- if (utf8Length === source.length) {
3769
- return (byteOffset2) => Math.max(0, Math.min(byteOffset2, source.length));
3770
- }
3771
- const byteToStringIndex = new Uint32Array(utf8Length + 1);
3772
- let byteOffset = 0;
3773
- let stringIndex = 0;
3774
- while (stringIndex < source.length) {
3775
- const codePoint = source.codePointAt(stringIndex);
3776
- if (codePoint === void 0)
3777
- break;
3778
- const charStringLength = codePoint > 65535 ? 2 : 1;
3779
- const charByteLength = utf8ByteLengthForCodePoint(codePoint);
3780
- for (let offset = 1; offset < charByteLength; offset += 1) {
3781
- byteToStringIndex[byteOffset + offset] = stringIndex;
3782
- }
3783
- byteOffset += charByteLength;
3784
- stringIndex += charStringLength;
3785
- byteToStringIndex[byteOffset] = stringIndex;
3786
- }
3787
- byteToStringIndex[byteOffset] = source.length;
3788
- return (index) => {
3789
- const bounded = Math.max(0, Math.min(index, byteToStringIndex.length - 1));
3790
- return byteToStringIndex[bounded] ?? source.length;
3791
- };
3792
- }
3793
- function utf8ByteLengthForCodePoint(codePoint) {
3794
- if (codePoint <= 127)
3795
- return 1;
3796
- if (codePoint <= 2047)
3797
- return 2;
3798
- if (codePoint <= 65535)
3799
- return 3;
3800
- return 4;
3801
- }
3802
-
3803
- // dist/chunking/chunkId.js
3804
- import { createHash as createHash2 } from "node:crypto";
3805
- function withStableChunkIds(chunks, languageId, filePath) {
3806
- const occurrences = /* @__PURE__ */ new Map();
3807
- const scopedPath = filePath ?? "unknown";
3808
- return chunks.map((chunk) => {
3809
- const digest = createHash2("sha256").update("codegraph-chunk-id-v1\0").update(languageId).update("\0").update(scopedPath).update("\0").update(chunk.type).update("\0").update(chunk.name ?? "").update("\0").update(chunk.text).digest("hex");
3810
- const occurrence = occurrences.get(digest) ?? 0;
3811
- occurrences.set(digest, occurrence + 1);
3812
- const id = occurrence === 0 ? `${languageId}:${scopedPath}:${digest}` : `${languageId}:${scopedPath}:${digest}:${occurrence}`;
3813
- return { ...chunk, id };
3814
- });
3815
- }
3816
-
3817
- // dist/chunking/chunkSplit.js
3818
- function splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath) {
3819
- let currentStart = -1;
3820
- let currentEnd = -1;
3821
- let currentStartLine = block.startLine;
3822
- let currentTokens = 0;
3823
- const flush = () => {
3824
- if (currentStart === -1)
3825
- return;
3826
- emitRangeWithinBudget(block, source, currentStart, currentEnd, currentStartLine, tokenizer, maxTokens, out, languageId, filePath);
3827
- currentStart = -1;
3828
- currentEnd = -1;
3829
- currentTokens = 0;
3830
- };
3831
- for (const line of lineRanges(source, block.startByte, block.endByte, block.startLine)) {
3832
- const lineText = source.slice(line.start, line.end);
3833
- const lineTokens = tokenizer(lineText);
3834
- if (lineTokens > maxTokens) {
3835
- flush();
3836
- emitRangeWithinBudget(block, source, line.start, line.end, line.startLine, tokenizer, maxTokens, out, languageId, filePath);
3837
- continue;
3838
- }
3839
- if (currentStart !== -1 && currentTokens + lineTokens > maxTokens) {
3840
- flush();
3841
- }
3842
- if (currentStart === -1) {
3843
- currentStart = line.start;
3844
- currentStartLine = line.startLine;
3845
- }
3846
- currentEnd = line.end;
3847
- currentTokens += lineTokens;
3848
- }
3849
- flush();
3850
- }
3851
- function splitLargeBlockUsingInnerBlocks(block, _innerBlocks, source, tokenizer, maxTokens, out, languageId, _newlineOffsets, filePath) {
3852
- splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
3853
- }
3854
- function splitTextWithinTokenBudget(text, tokenizer, maxTokens) {
3855
- if (!text.length)
3856
- return [];
3857
- if (tokenizer(text) <= maxTokens)
3858
- return [text];
3859
- const segments = [];
3860
- let start = 0;
3861
- while (start < text.length) {
3862
- if (tokenizer(text.slice(start)) <= maxTokens) {
3863
- segments.push(text.slice(start));
3864
- break;
3865
- }
3866
- let low = nextCodePointBoundary(text, start);
3867
- let high = text.length;
3868
- let end = start;
3869
- while (low <= high) {
3870
- const candidate = previousCodePointBoundary(text, low + (high - low >>> 1));
3871
- if (candidate <= start) {
3872
- low = nextCodePointBoundary(text, start);
3873
- continue;
3874
- }
3875
- if (tokenizer(text.slice(start, candidate)) <= maxTokens) {
3876
- end = candidate;
3877
- low = candidate + 1;
3878
- } else {
3879
- high = candidate - 1;
3880
- }
3881
- }
3882
- if (end === start) {
3883
- const next = nextCodePointBoundary(text, start);
3884
- const singleCodePoint = text.slice(start, next);
3885
- if (tokenizer(singleCodePoint) > maxTokens) {
3886
- throw new RangeError("maxTokens is smaller than the configured tokenizer's smallest unit");
3887
- }
3888
- end = next;
3889
- }
3890
- segments.push(text.slice(start, end));
3891
- start = end;
3892
- }
3893
- return segments;
3894
- }
3895
- function emitRangeWithinBudget(block, source, start, end, startLine, tokenizer, maxTokens, out, languageId, filePath) {
3896
- const text = source.slice(start, end);
3897
- const tokenCount = tokenizer(text);
3898
- if (tokenCount <= maxTokens) {
3899
- pushRangedChunk(out, block, languageId, filePath, start, end, startLine, endLineForText(startLine, text), text, tokenCount);
3900
- return;
3901
- }
3902
- let segmentStart = start;
3903
- let segmentStartLine = startLine;
3904
- for (const segment of splitTextWithinTokenBudget(text, tokenizer, maxTokens)) {
3905
- const segmentEnd = segmentStart + segment.length;
3906
- pushRangedChunk(out, block, languageId, filePath, segmentStart, segmentEnd, segmentStartLine, endLineForText(segmentStartLine, segment), segment, tokenizer(segment));
3907
- segmentStartLine += countLineBreaks(segment);
3908
- segmentStart = segmentEnd;
3909
- }
3910
- }
3911
- function pushRangedChunk(out, block, languageId, filePath, sourceStart, sourceEnd, startLine, endLine, text, tokenCount) {
3912
- out.push({
3913
- id: "",
3914
- languageId,
3915
- type: block.kind,
3916
- startLine,
3917
- endLine,
3918
- text,
3919
- tokenCount,
3920
- sourceStart,
3921
- sourceEnd,
3922
- ...filePath !== void 0 ? { filePath } : {},
3923
- ...block.name !== void 0 ? { name: block.name } : {}
3924
- });
3925
- }
3926
- function lineRanges(source, start, end, startLine) {
3927
- const ranges = [];
3928
- let rangeStart = start;
3929
- let line = startLine;
3930
- for (let offset = start; offset < end; offset++) {
3931
- if (source[offset] !== "\n")
3932
- continue;
3933
- ranges.push({ start: rangeStart, end: offset + 1, startLine: line });
3934
- rangeStart = offset + 1;
3935
- line++;
3936
- }
3937
- if (rangeStart < end) {
3938
- ranges.push({ start: rangeStart, end, startLine: line });
3939
- }
3940
- return ranges;
3941
- }
3942
- function countLineBreaks(text) {
3943
- let count = 0;
3944
- for (let index = 0; index < text.length; index++) {
3945
- if (text[index] === "\n")
3946
- count++;
3947
- }
3948
- return count;
3949
- }
3950
- function endLineForText(startLine, text) {
3951
- const lineBreaks = countLineBreaks(text);
3952
- return startLine + lineBreaks - (text.endsWith("\n") ? 1 : 0);
3953
- }
3954
- function nextCodePointBoundary(text, index) {
3955
- if (index >= text.length)
3956
- return text.length;
3957
- const codePoint = text.codePointAt(index);
3958
- return index + (codePoint !== void 0 && codePoint > 65535 ? 2 : 1);
3959
- }
3960
- function previousCodePointBoundary(text, index) {
3961
- if (index <= 0 || index >= text.length || text.charCodeAt(index) < 56320 || text.charCodeAt(index) > 57343) {
3962
- return index;
3963
- }
3964
- return index - 1;
3965
- }
3966
-
3967
- // dist/chunking/chunkMerge.js
3968
- function mergeSmallChunks(chunks, minTokens, maxTokens, tokenizer) {
3969
- if (!chunks.length)
3970
- return [];
3971
- const merged = [];
3972
- let index = 0;
3973
- while (index < chunks.length) {
3974
- let current = { ...chunks[index] };
3975
- index++;
3976
- while (current.tokenCount < minTokens && index < chunks.length) {
3977
- if (current.type === "misc" && current.tokenCount === 0)
3978
- break;
3979
- const next = chunks[index];
3980
- if (next.sourceStart < current.sourceEnd)
3981
- break;
3982
- if (next.sourceStart !== current.sourceEnd)
3983
- break;
3984
- const combinedText = `${current.text}${next.text}`;
3985
- const combinedTokens = tokenizer(combinedText);
3986
- if (combinedTokens > maxTokens)
3987
- break;
3988
- const resolvedName = current.name ?? next.name;
3989
- let type = current.type;
3990
- if (current.type === "misc" && current.tokenCount === 0) {
3991
- type = next.type;
3992
- } else if (next.type === "misc" && next.tokenCount === 0) {
3993
- type = current.type;
3994
- } else if (current.type !== next.type) {
3995
- type = `${current.type}+${next.type}`;
3996
- }
3997
- current = {
3998
- ...current,
3999
- endLine: next.endLine,
4000
- sourceEnd: next.sourceEnd,
4001
- text: combinedText,
4002
- tokenCount: combinedTokens,
4003
- type,
4004
- ...resolvedName !== void 0 ? { name: resolvedName } : {}
4005
- };
4006
- index++;
4007
- }
4008
- merged.push(current);
4009
- }
4010
- return merged;
4011
- }
4012
- function fillGapsWithMiscChunks(chunks, source, languageId, filePath, tokenizer, minTokens, maxTokens, newlineOffsets) {
4013
- if (!source.length)
4014
- return [];
4015
- const result = [];
4016
- let currentOffset = 0;
4017
- const sortedChunks = [...chunks].sort((left, right) => left.sourceStart - right.sourceStart || right.sourceEnd - left.sourceEnd);
4018
- for (const chunk of sortedChunks) {
4019
- if (chunk.sourceStart > currentOffset) {
4020
- const appendedToPrevious = appendTriviaGap(result, source, currentOffset, chunk.sourceStart, tokenizer, maxTokens, newlineOffsets);
4021
- if (!appendedToPrevious) {
4022
- pushMiscRange(result, source, currentOffset, chunk.sourceStart, languageId, filePath, tokenizer, maxTokens, newlineOffsets);
4023
- }
4024
- }
4025
- result.push(chunk);
4026
- currentOffset = Math.max(currentOffset, chunk.sourceEnd);
4027
- }
4028
- if (currentOffset < source.length) {
4029
- const appendedToPrevious = appendTriviaGap(result, source, currentOffset, source.length, tokenizer, maxTokens, newlineOffsets);
4030
- if (!appendedToPrevious) {
4031
- pushMiscRange(result, source, currentOffset, source.length, languageId, filePath, tokenizer, maxTokens, newlineOffsets);
4032
- }
4033
- }
4034
- return mergeSmallChunks(result, minTokens, maxTokens, tokenizer);
4035
- }
4036
- function appendTriviaGap(chunks, source, start, end, tokenizer, maxTokens, newlineOffsets) {
4037
- if (!chunks.length || end <= start)
4038
- return false;
4039
- const previous = chunks[chunks.length - 1];
4040
- if (previous.sourceEnd !== start)
4041
- return false;
4042
- const text = source.slice(start, end);
4043
- if (!/^[\s;]+$/u.test(text))
4044
- return false;
4045
- const combinedText = `${previous.text}${text}`;
4046
- const tokenCount = tokenizer(combinedText);
4047
- if (tokenCount > maxTokens)
4048
- return false;
4049
- const [endRow] = locateLineFromOffset(newlineOffsets, Math.max(start, end - 1));
4050
- chunks[chunks.length - 1] = {
4051
- ...previous,
4052
- endLine: endRow + 1,
4053
- sourceEnd: end,
4054
- text: combinedText,
4055
- tokenCount
4056
- };
4057
- return true;
4058
- }
4059
- function pushMiscRange(out, source, start, end, languageId, filePath, tokenizer, maxTokens, newlineOffsets) {
4060
- if (end <= start)
4061
- return;
4062
- const [startRow] = locateLineFromOffset(newlineOffsets, start);
4063
- const [endRow] = locateLineFromOffset(newlineOffsets, Math.max(start, end - 1));
4064
- const block = {
4065
- kind: "misc",
4066
- startByte: start,
4067
- endByte: end,
4068
- startLine: startRow + 1,
4069
- endLine: endRow + 1
4070
- };
4071
- const text = source.slice(start, end);
4072
- const tokenCount = tokenizer(text);
4073
- if (tokenCount <= maxTokens) {
4074
- out.push({
4075
- id: "",
4076
- languageId,
4077
- type: "misc",
4078
- startLine: block.startLine,
4079
- endLine: block.endLine,
4080
- text,
4081
- tokenCount,
4082
- sourceStart: start,
4083
- sourceEnd: end,
4084
- ...filePath !== void 0 ? { filePath } : {}
4085
- });
4086
- return;
4087
- }
4088
- splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
4089
- }
4090
- function locateLineFromOffset(newlineOffsets, offset) {
4091
- let low = 0;
4092
- let high = newlineOffsets.length;
4093
- while (low < high) {
4094
- const mid = low + high >>> 1;
4095
- if (newlineOffsets[mid] < offset)
4096
- low = mid + 1;
4097
- else
4098
- high = mid;
4099
- }
4100
- const previousNewline = low > 0 ? newlineOffsets[low - 1] : -1;
4101
- return [low, offset - previousNewline - 1];
4102
- }
4103
-
4104
- // dist/chunking/tokenizer.js
4105
- function countWhitespaceTokens(text) {
4106
- if (!text.trim())
4107
- return 0;
4108
- return text.trim().split(/\s+/).length;
4109
- }
4110
-
4111
- // dist/chunking/chunkFile.js
4112
- function chunkFileWithSymbols(opts) {
4113
- const { language, source, filePath, minTokens = 150, maxTokens = 400, tokenizer = countWhitespaceTokens } = opts;
4114
- const matches = getChunkMatches(language, source, filePath);
4115
- const newlineOffsets = collectNewlineOffsets(source);
4116
- const { mainBlocks, innerBlocks, comments } = collectChunkBlockGroups(language, matches);
4117
- const selectedBlocks = selectMainBlocks(mainBlocks);
4118
- const preliminaryChunks = [];
4119
- const sortedInnerBlocks = [...innerBlocks].sort((left, right) => left.startByte - right.startByte || left.endByte - right.endByte);
4120
- for (const block of selectedBlocks) {
4121
- appendBlockChunks(block, sortedInnerBlocks, source, tokenizer, maxTokens, preliminaryChunks, language.id, newlineOffsets, filePath);
4122
- }
4123
- for (const comment of selectStandaloneComments(comments, selectedBlocks)) {
4124
- appendBlockChunks(comment, [], source, tokenizer, maxTokens, preliminaryChunks, language.id, newlineOffsets, filePath);
4125
- }
4126
- preliminaryChunks.sort((left, right) => left.sourceStart - right.sourceStart || right.sourceEnd - left.sourceEnd);
4127
- if (minTokens <= 1) {
4128
- const completeChunks2 = fillGapsWithMiscChunks(preliminaryChunks, source, language.id, filePath, tokenizer, 1, maxTokens, newlineOffsets);
4129
- const chunks2 = withStableChunkIds(completeChunks2.map(({ sourceStart: _sourceStart, sourceEnd: _sourceEnd, ...chunk }) => chunk), language.id, filePath);
4130
- return { chunks: chunks2, symbolChunks: chunks2 };
4131
- }
4132
- const completeSymbolChunks = fillGapsWithMiscChunks(preliminaryChunks, source, language.id, filePath, tokenizer, 1, maxTokens, newlineOffsets);
4133
- const symbolChunks = withStableChunkIds(completeSymbolChunks.map(({ sourceStart: _sourceStart, sourceEnd: _sourceEnd, ...chunk }) => chunk), language.id, filePath);
4134
- const mergedChunks = mergeSmallChunks([...preliminaryChunks], minTokens, maxTokens, tokenizer);
4135
- const completeChunks = fillGapsWithMiscChunks(mergedChunks, source, language.id, filePath, tokenizer, minTokens, maxTokens, newlineOffsets);
4136
- const chunks = withStableChunkIds(completeChunks.map(({ sourceStart: _sourceStart, sourceEnd: _sourceEnd, ...chunk }) => chunk), language.id, filePath);
4137
- return { chunks, symbolChunks };
4138
- }
4139
- function chunkFile(opts) {
4140
- return chunkFileWithSymbols(opts).chunks;
4141
- }
4142
- function appendBlockChunks(block, innerBlocks, source, tokenizer, maxTokens, out, languageId, newlineOffsets, filePath) {
4143
- const text = source.slice(block.startByte, block.endByte);
4144
- const tokens = tokenizer(text);
4145
- if (tokens <= maxTokens) {
4146
- out.push({
4147
- id: "",
4148
- languageId,
4149
- type: block.kind,
4150
- startLine: block.startLine,
4151
- endLine: block.endLine,
4152
- text,
4153
- tokenCount: tokens,
4154
- sourceStart: block.startByte,
4155
- sourceEnd: block.endByte,
4156
- ...filePath !== void 0 ? { filePath } : {},
4157
- ...block.name !== void 0 ? { name: block.name } : {}
4158
- });
4159
- return;
4160
- }
4161
- const innerInRange = collectContainedInnerBlocks(innerBlocks, block);
4162
- if (!innerInRange.length) {
4163
- splitLargeBlockSimple(block, source, tokenizer, maxTokens, out, languageId, filePath);
4164
- return;
4165
- }
4166
- splitLargeBlockUsingInnerBlocks(block, innerInRange, source, tokenizer, maxTokens, out, languageId, newlineOffsets, filePath);
4167
- }
4168
- function collectContainedInnerBlocks(sortedInnerBlocks, block) {
4169
- let low = 0;
4170
- let high = sortedInnerBlocks.length;
4171
- while (low < high) {
4172
- const mid = low + high >> 1;
4173
- if (sortedInnerBlocks[mid].startByte <= block.startByte)
4174
- low = mid + 1;
4175
- else
4176
- high = mid;
4177
- }
4178
- const innerInRange = [];
4179
- for (let index = low; index < sortedInnerBlocks.length; index++) {
4180
- const innerBlock = sortedInnerBlocks[index];
4181
- if (innerBlock.startByte >= block.endByte)
4182
- break;
4183
- if (innerBlock.endByte < block.endByte)
4184
- innerInRange.push(innerBlock);
4185
- }
4186
- return innerInRange;
4187
- }
4188
- function selectMainBlocks(mainBlocks) {
4189
- const nodes = buildBlockTree(mainBlocks);
4190
- const selected = [];
4191
- const visit = (node) => {
4192
- selected.push(node.block);
4193
- for (const child of node.children) {
4194
- visit(child);
4195
- }
4196
- };
4197
- for (const node of nodes) {
4198
- visit(node);
4199
- }
4200
- return selected;
4201
- }
4202
- function buildBlockTree(mainBlocks) {
4203
- const sortedBlocks = deduplicateBlocks(mainBlocks).sort((left, right) => left.startByte - right.startByte || right.endByte - left.endByte);
4204
- const roots = [];
4205
- const stack = [];
4206
- for (const block of sortedBlocks) {
4207
- while (stack.length && stack[stack.length - 1].block.endByte <= block.startByte) {
4208
- stack.pop();
4209
- }
4210
- const parent = stack[stack.length - 1];
4211
- const node = { block, children: [] };
4212
- if (parent && block.endByte <= parent.block.endByte) {
4213
- parent.children.push(node);
4214
- stack.push(node);
4215
- continue;
4216
- }
4217
- if (parent && block.startByte < parent.block.endByte) {
4218
- continue;
4219
- }
4220
- roots.push(node);
4221
- stack.push(node);
4222
- }
4223
- return roots;
4224
- }
4225
- function deduplicateBlocks(blocks) {
4226
- const byRange = /* @__PURE__ */ new Map();
4227
- for (const block of blocks) {
4228
- const key = `${block.startByte}:${block.endByte}`;
4229
- const existing = byRange.get(key);
4230
- if (!existing || !existing.name && block.name || existing.name === block.name && block.kind < existing.kind) {
4231
- byRange.set(key, block);
4232
- }
4233
- }
4234
- return [...byRange.values()];
4235
- }
4236
- function selectStandaloneComments(comments, selectedBlocks) {
4237
- const selectedComments = [];
4238
- for (const comment of deduplicateBlocks(comments)) {
4239
- if (selectedBlocks.some((block) => block.startByte <= comment.startByte && comment.endByte <= block.endByte)) {
4240
- continue;
4241
- }
4242
- const previous = selectedComments[selectedComments.length - 1];
4243
- if (previous && comment.startByte < previous.endByte)
4244
- continue;
4245
- selectedComments.push(comment);
4246
- }
4247
- return selectedComments;
4248
- }
4249
- function collectNewlineOffsets(source) {
4250
- const newlineOffsets = [];
4251
- for (let index = 0; index < source.length; index++) {
4252
- if (source[index] === "\n")
4253
- newlineOffsets.push(index);
4254
- }
4255
- return newlineOffsets;
4256
- }
4257
-
4258
- // dist/agent/query-index/content.js
4259
- var MAX_QUERY_INDEX_TEXT_BYTES = 3e5;
4260
- var CHUNK_LANGUAGE_ALIASES = {
4261
- js: "javascript",
4262
- ts: "typescript"
4263
- };
4264
- function compressQueryText(text) {
4265
- const compressed = brotliCompressSync(text, {
4266
- params: { [zlibConstants.BROTLI_PARAM_QUALITY]: 4 }
4267
- });
4268
- return new Uint8Array(compressed.buffer, compressed.byteOffset, compressed.byteLength);
4269
- }
4270
- function normalizeQuerySearchText(input) {
4271
- return input.replace(/([\p{Ll}\p{Nd}])(\p{Lu})/gu, "$1 $2").replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu, "$1 $2").toLowerCase().replace(/[^\p{L}\p{N}\p{M}_]+/gu, " ").trim();
4272
- }
4273
- function detectQueryIndexSurface(relativePath) {
4274
- const lower = relativePath.toLowerCase();
4275
- if (lower === "readme.md" || lower.startsWith("docs/") || lower.endsWith(".md") || lower.endsWith(".mdx") || lower.endsWith(".rst") || lower.endsWith(".adoc") || lower.endsWith(".txt")) {
4276
- return "docs";
4277
- }
4278
- if (lower.endsWith(".json") || lower.endsWith(".yaml") || lower.endsWith(".yml") || lower.endsWith(".toml") || lower.endsWith(".ini") || lower.endsWith(".env") || lower === "dockerfile" || lower.startsWith(".github/")) {
4279
- return "config";
4280
- }
4281
- return "code";
4282
- }
4283
- function chunkQueryText(file, text, support) {
4284
- const languageId = support ? CHUNK_LANGUAGE_ALIASES[support.id] ?? support.id : void 0;
4285
- const language = languageId ? LANG_CONFIGS[languageId] : void 0;
4286
- if (language) {
4287
- try {
4288
- const chunks = chunkFile({
4289
- language,
4290
- source: text,
4291
- filePath: file,
4292
- minTokens: 1,
4293
- maxTokens: 120
4294
- });
4295
- if (chunks.length) {
4296
- return chunks.map((chunk, ordinal) => ({
4297
- ordinal,
4298
- kind: chunk.type,
4299
- ...chunk.name ? { name: chunk.name } : {},
4300
- text: chunk.text,
4301
- normalizedText: normalizeQuerySearchText([chunk.name, chunk.text].filter(Boolean).join(" ")),
4302
- startLine: chunk.startLine,
4303
- endLine: chunk.endLine
4304
- }));
4305
- }
4306
- } catch {
4307
- }
4308
- }
4309
- return text.split(/\r?\n/).map((line, ordinal) => ({
4310
- ordinal,
4311
- kind: "line",
4312
- text: line,
4313
- normalizedText: normalizeQuerySearchText(line),
4314
- startLine: ordinal + 1,
4315
- endLine: ordinal + 1
4316
- }));
4317
- }
4318
- async function prepareQueryIndexFile(input) {
4319
- try {
4320
- const stat = await fs6.stat(input.absolutePath);
4321
- if (stat.size > MAX_QUERY_INDEX_TEXT_BYTES) {
4322
- const support2 = supportForFile(input.absolutePath);
4323
- return {
4324
- path: input.path,
4325
- sourceIdentity: input.sourceIdentity,
4326
- surface: detectQueryIndexSurface(input.path),
4327
- ...support2 ? { language: support2.id } : {},
4328
- byteLength: stat.size,
4329
- lineCount: 0,
4330
- normalizedText: compressQueryText(""),
4331
- chunks: [],
4332
- sourceRead: false
4333
- };
4334
- }
4335
- const text = await fs6.readFile(input.absolutePath, "utf8");
4336
- const support = supportForFileWithSource(input.absolutePath, text);
4337
- return {
4338
- path: input.path,
4339
- sourceIdentity: input.sourceIdentity,
4340
- surface: detectQueryIndexSurface(input.path),
4341
- ...support ? { language: support.id } : {},
4342
- byteLength: stat.size,
4343
- lineCount: text ? text.split(/\r?\n/).length : 0,
4344
- normalizedText: compressQueryText(normalizeQuerySearchText(text)),
4345
- chunks: chunkQueryText(input.absolutePath, text, support).map((chunk) => ({
4346
- ...chunk,
4347
- text: compressQueryText(chunk.text)
4348
- })),
4349
- sourceRead: true
4350
- };
4351
- } catch {
4352
- return null;
4353
- }
4354
- }
4355
-
4356
- // dist/agent/query-index/paths.js
4357
- import { createHash as createHash3 } from "node:crypto";
4358
- import path6 from "node:path";
4359
- function resolveQueryIndexSourcePath(projectRoot, relativePath) {
4360
- if (relativePath.includes("\0") || isAbsoluteFilePath(relativePath)) {
4361
- throw new Error(`Invalid query index relative path: ${relativePath}`);
4362
- }
4363
- const normalized = normalizePath(relativePath);
4364
- const segments = normalized.split("/");
4365
- if (!normalized || normalized === "." || isAbsoluteFilePath(normalized) || segments.includes("..")) {
4366
- throw new Error(`Invalid query index relative path: ${relativePath}`);
4367
- }
4368
- return assertFilePathWithinRoot(projectRoot, path6.resolve(projectRoot, ...segments), "Query index row");
4369
- }
4370
-
4371
- // dist/agent/query-index/queryIndexWorker.js
4372
- async function prepareQueryIndexWorkerTask(task) {
4373
- const absolutePath = resolveQueryIndexSourcePath(task.projectRoot, task.relativePath);
4374
- return await prepareQueryIndexFile({
4375
- absolutePath,
4376
- path: task.relativePath,
4377
- sourceIdentity: task.sourceIdentity
4378
- });
4379
- }
4380
- export {
4381
- prepareQueryIndexWorkerTask as default
4382
- };