@opencodehub/ingestion 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (563) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +69 -0
  3. package/dist/extract/index.d.ts +8 -0
  4. package/dist/extract/index.d.ts.map +1 -0
  5. package/dist/extract/index.js +6 -0
  6. package/dist/extract/index.js.map +1 -0
  7. package/dist/extract/orm-detector.d.ts +19 -0
  8. package/dist/extract/orm-detector.d.ts.map +1 -0
  9. package/dist/extract/orm-detector.js +209 -0
  10. package/dist/extract/orm-detector.js.map +1 -0
  11. package/dist/extract/property-access.d.ts +76 -0
  12. package/dist/extract/property-access.d.ts.map +1 -0
  13. package/dist/extract/property-access.js +260 -0
  14. package/dist/extract/property-access.js.map +1 -0
  15. package/dist/extract/receiver-resolver.d.ts +86 -0
  16. package/dist/extract/receiver-resolver.d.ts.map +1 -0
  17. package/dist/extract/receiver-resolver.js +77 -0
  18. package/dist/extract/receiver-resolver.js.map +1 -0
  19. package/dist/extract/route-detector-java.d.ts +29 -0
  20. package/dist/extract/route-detector-java.d.ts.map +1 -0
  21. package/dist/extract/route-detector-java.js +190 -0
  22. package/dist/extract/route-detector-java.js.map +1 -0
  23. package/dist/extract/route-detector-nestjs.d.ts +30 -0
  24. package/dist/extract/route-detector-nestjs.d.ts.map +1 -0
  25. package/dist/extract/route-detector-nestjs.js +134 -0
  26. package/dist/extract/route-detector-nestjs.js.map +1 -0
  27. package/dist/extract/route-detector-python.d.ts +28 -0
  28. package/dist/extract/route-detector-python.d.ts.map +1 -0
  29. package/dist/extract/route-detector-python.js +100 -0
  30. package/dist/extract/route-detector-python.js.map +1 -0
  31. package/dist/extract/route-detector-rails.d.ts +28 -0
  32. package/dist/extract/route-detector-rails.d.ts.map +1 -0
  33. package/dist/extract/route-detector-rails.js +162 -0
  34. package/dist/extract/route-detector-rails.js.map +1 -0
  35. package/dist/extract/route-detector.d.ts +45 -0
  36. package/dist/extract/route-detector.d.ts.map +1 -0
  37. package/dist/extract/route-detector.js +467 -0
  38. package/dist/extract/route-detector.js.map +1 -0
  39. package/dist/extract/tool-detector.d.ts +26 -0
  40. package/dist/extract/tool-detector.d.ts.map +1 -0
  41. package/dist/extract/tool-detector.js +364 -0
  42. package/dist/extract/tool-detector.js.map +1 -0
  43. package/dist/extract/types.d.ts +89 -0
  44. package/dist/extract/types.d.ts.map +1 -0
  45. package/dist/extract/types.js +11 -0
  46. package/dist/extract/types.js.map +1 -0
  47. package/dist/index.d.ts +10 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +10 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/parse/cobol-regex.d.ts +85 -0
  52. package/dist/parse/cobol-regex.d.ts.map +1 -0
  53. package/dist/parse/cobol-regex.js +355 -0
  54. package/dist/parse/cobol-regex.js.map +1 -0
  55. package/dist/parse/grammar-registry.d.ts +115 -0
  56. package/dist/parse/grammar-registry.d.ts.map +1 -0
  57. package/dist/parse/grammar-registry.js +278 -0
  58. package/dist/parse/grammar-registry.js.map +1 -0
  59. package/dist/parse/index.d.ts +14 -0
  60. package/dist/parse/index.d.ts.map +1 -0
  61. package/dist/parse/index.js +10 -0
  62. package/dist/parse/index.js.map +1 -0
  63. package/dist/parse/language-detector.d.ts +17 -0
  64. package/dist/parse/language-detector.d.ts.map +1 -0
  65. package/dist/parse/language-detector.js +104 -0
  66. package/dist/parse/language-detector.js.map +1 -0
  67. package/dist/parse/parse-worker.d.ts +24 -0
  68. package/dist/parse/parse-worker.d.ts.map +1 -0
  69. package/dist/parse/parse-worker.js +230 -0
  70. package/dist/parse/parse-worker.js.map +1 -0
  71. package/dist/parse/types.d.ts +49 -0
  72. package/dist/parse/types.d.ts.map +1 -0
  73. package/dist/parse/types.js +11 -0
  74. package/dist/parse/types.js.map +1 -0
  75. package/dist/parse/unified-queries.d.ts +37 -0
  76. package/dist/parse/unified-queries.d.ts.map +1 -0
  77. package/dist/parse/unified-queries.js +623 -0
  78. package/dist/parse/unified-queries.js.map +1 -0
  79. package/dist/parse/wasm-fallback.d.ts +88 -0
  80. package/dist/parse/wasm-fallback.d.ts.map +1 -0
  81. package/dist/parse/wasm-fallback.js +258 -0
  82. package/dist/parse/wasm-fallback.js.map +1 -0
  83. package/dist/parse/worker-pool.d.ts +48 -0
  84. package/dist/parse/worker-pool.d.ts.map +1 -0
  85. package/dist/parse/worker-pool.js +97 -0
  86. package/dist/parse/worker-pool.js.map +1 -0
  87. package/dist/pipeline/dep-parsers/go.d.ts +25 -0
  88. package/dist/pipeline/dep-parsers/go.d.ts.map +1 -0
  89. package/dist/pipeline/dep-parsers/go.js +146 -0
  90. package/dist/pipeline/dep-parsers/go.js.map +1 -0
  91. package/dist/pipeline/dep-parsers/index.d.ts +17 -0
  92. package/dist/pipeline/dep-parsers/index.d.ts.map +1 -0
  93. package/dist/pipeline/dep-parsers/index.js +16 -0
  94. package/dist/pipeline/dep-parsers/index.js.map +1 -0
  95. package/dist/pipeline/dep-parsers/maven.d.ts +24 -0
  96. package/dist/pipeline/dep-parsers/maven.d.ts.map +1 -0
  97. package/dist/pipeline/dep-parsers/maven.js +131 -0
  98. package/dist/pipeline/dep-parsers/maven.js.map +1 -0
  99. package/dist/pipeline/dep-parsers/npm.d.ts +30 -0
  100. package/dist/pipeline/dep-parsers/npm.d.ts.map +1 -0
  101. package/dist/pipeline/dep-parsers/npm.js +309 -0
  102. package/dist/pipeline/dep-parsers/npm.js.map +1 -0
  103. package/dist/pipeline/dep-parsers/nuget.d.ts +24 -0
  104. package/dist/pipeline/dep-parsers/nuget.d.ts.map +1 -0
  105. package/dist/pipeline/dep-parsers/nuget.js +178 -0
  106. package/dist/pipeline/dep-parsers/nuget.js.map +1 -0
  107. package/dist/pipeline/dep-parsers/python.d.ts +21 -0
  108. package/dist/pipeline/dep-parsers/python.d.ts.map +1 -0
  109. package/dist/pipeline/dep-parsers/python.js +369 -0
  110. package/dist/pipeline/dep-parsers/python.js.map +1 -0
  111. package/dist/pipeline/dep-parsers/rust.d.ts +18 -0
  112. package/dist/pipeline/dep-parsers/rust.d.ts.map +1 -0
  113. package/dist/pipeline/dep-parsers/rust.js +134 -0
  114. package/dist/pipeline/dep-parsers/rust.js.map +1 -0
  115. package/dist/pipeline/dep-parsers/spdx-normalize.d.ts +15 -0
  116. package/dist/pipeline/dep-parsers/spdx-normalize.d.ts.map +1 -0
  117. package/dist/pipeline/dep-parsers/spdx-normalize.js +31 -0
  118. package/dist/pipeline/dep-parsers/spdx-normalize.js.map +1 -0
  119. package/dist/pipeline/dep-parsers/types.d.ts +63 -0
  120. package/dist/pipeline/dep-parsers/types.d.ts.map +1 -0
  121. package/dist/pipeline/dep-parsers/types.js +56 -0
  122. package/dist/pipeline/dep-parsers/types.js.map +1 -0
  123. package/dist/pipeline/gitignore-stack.d.ts +44 -0
  124. package/dist/pipeline/gitignore-stack.d.ts.map +1 -0
  125. package/dist/pipeline/gitignore-stack.js +69 -0
  126. package/dist/pipeline/gitignore-stack.js.map +1 -0
  127. package/dist/pipeline/gitignore.d.ts +67 -0
  128. package/dist/pipeline/gitignore.d.ts.map +1 -0
  129. package/dist/pipeline/gitignore.js +210 -0
  130. package/dist/pipeline/gitignore.js.map +1 -0
  131. package/dist/pipeline/index.d.ts +53 -0
  132. package/dist/pipeline/index.d.ts.map +1 -0
  133. package/dist/pipeline/index.js +29 -0
  134. package/dist/pipeline/index.js.map +1 -0
  135. package/dist/pipeline/orchestrator.d.ts +105 -0
  136. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  137. package/dist/pipeline/orchestrator.js +175 -0
  138. package/dist/pipeline/orchestrator.js.map +1 -0
  139. package/dist/pipeline/ownership-helpers/drift.d.ts +41 -0
  140. package/dist/pipeline/ownership-helpers/drift.d.ts.map +1 -0
  141. package/dist/pipeline/ownership-helpers/drift.js +122 -0
  142. package/dist/pipeline/ownership-helpers/drift.js.map +1 -0
  143. package/dist/pipeline/ownership-helpers/gini-community.d.ts +24 -0
  144. package/dist/pipeline/ownership-helpers/gini-community.d.ts.map +1 -0
  145. package/dist/pipeline/ownership-helpers/gini-community.js +32 -0
  146. package/dist/pipeline/ownership-helpers/gini-community.js.map +1 -0
  147. package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts +71 -0
  148. package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts.map +1 -0
  149. package/dist/pipeline/ownership-helpers/git-blame-batcher.js +178 -0
  150. package/dist/pipeline/ownership-helpers/git-blame-batcher.js.map +1 -0
  151. package/dist/pipeline/ownership-helpers/line-overlap.d.ts +35 -0
  152. package/dist/pipeline/ownership-helpers/line-overlap.d.ts.map +1 -0
  153. package/dist/pipeline/ownership-helpers/line-overlap.js +62 -0
  154. package/dist/pipeline/ownership-helpers/line-overlap.js.map +1 -0
  155. package/dist/pipeline/ownership-helpers/orphan.d.ts +73 -0
  156. package/dist/pipeline/ownership-helpers/orphan.d.ts.map +1 -0
  157. package/dist/pipeline/ownership-helpers/orphan.js +117 -0
  158. package/dist/pipeline/ownership-helpers/orphan.js.map +1 -0
  159. package/dist/pipeline/phases/accesses.d.ts +44 -0
  160. package/dist/pipeline/phases/accesses.d.ts.map +1 -0
  161. package/dist/pipeline/phases/accesses.js +194 -0
  162. package/dist/pipeline/phases/accesses.js.map +1 -0
  163. package/dist/pipeline/phases/annotate.d.ts +28 -0
  164. package/dist/pipeline/phases/annotate.d.ts.map +1 -0
  165. package/dist/pipeline/phases/annotate.js +60 -0
  166. package/dist/pipeline/phases/annotate.js.map +1 -0
  167. package/dist/pipeline/phases/cochange.d.ts +42 -0
  168. package/dist/pipeline/phases/cochange.d.ts.map +1 -0
  169. package/dist/pipeline/phases/cochange.js +0 -0
  170. package/dist/pipeline/phases/cochange.js.map +1 -0
  171. package/dist/pipeline/phases/communities.d.ts +34 -0
  172. package/dist/pipeline/phases/communities.d.ts.map +1 -0
  173. package/dist/pipeline/phases/communities.js +412 -0
  174. package/dist/pipeline/phases/communities.js.map +1 -0
  175. package/dist/pipeline/phases/complexity.d.ts +50 -0
  176. package/dist/pipeline/phases/complexity.d.ts.map +1 -0
  177. package/dist/pipeline/phases/complexity.js +794 -0
  178. package/dist/pipeline/phases/complexity.js.map +1 -0
  179. package/dist/pipeline/phases/confidence-demote.d.ts +23 -0
  180. package/dist/pipeline/phases/confidence-demote.d.ts.map +1 -0
  181. package/dist/pipeline/phases/confidence-demote.js +113 -0
  182. package/dist/pipeline/phases/confidence-demote.js.map +1 -0
  183. package/dist/pipeline/phases/content-cache.d.ts +166 -0
  184. package/dist/pipeline/phases/content-cache.d.ts.map +1 -0
  185. package/dist/pipeline/phases/content-cache.js +323 -0
  186. package/dist/pipeline/phases/content-cache.js.map +1 -0
  187. package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts +25 -0
  188. package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts.map +1 -0
  189. package/dist/pipeline/phases/coverage-parsers/cobertura.js +139 -0
  190. package/dist/pipeline/phases/coverage-parsers/cobertura.js.map +1 -0
  191. package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts +25 -0
  192. package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts.map +1 -0
  193. package/dist/pipeline/phases/coverage-parsers/coverage-py.js +51 -0
  194. package/dist/pipeline/phases/coverage-parsers/coverage-py.js.map +1 -0
  195. package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts +32 -0
  196. package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts.map +1 -0
  197. package/dist/pipeline/phases/coverage-parsers/jacoco.js +98 -0
  198. package/dist/pipeline/phases/coverage-parsers/jacoco.js.map +1 -0
  199. package/dist/pipeline/phases/coverage-parsers/lcov.d.ts +21 -0
  200. package/dist/pipeline/phases/coverage-parsers/lcov.d.ts.map +1 -0
  201. package/dist/pipeline/phases/coverage-parsers/lcov.js +104 -0
  202. package/dist/pipeline/phases/coverage-parsers/lcov.js.map +1 -0
  203. package/dist/pipeline/phases/coverage-parsers/types.d.ts +27 -0
  204. package/dist/pipeline/phases/coverage-parsers/types.d.ts.map +1 -0
  205. package/dist/pipeline/phases/coverage-parsers/types.js +39 -0
  206. package/dist/pipeline/phases/coverage-parsers/types.js.map +1 -0
  207. package/dist/pipeline/phases/coverage.d.ts +39 -0
  208. package/dist/pipeline/phases/coverage.d.ts.map +1 -0
  209. package/dist/pipeline/phases/coverage.js +154 -0
  210. package/dist/pipeline/phases/coverage.js.map +1 -0
  211. package/dist/pipeline/phases/cross-file.d.ts +40 -0
  212. package/dist/pipeline/phases/cross-file.d.ts.map +1 -0
  213. package/dist/pipeline/phases/cross-file.js +411 -0
  214. package/dist/pipeline/phases/cross-file.js.map +1 -0
  215. package/dist/pipeline/phases/dead-code.d.ts +28 -0
  216. package/dist/pipeline/phases/dead-code.d.ts.map +1 -0
  217. package/dist/pipeline/phases/dead-code.js +157 -0
  218. package/dist/pipeline/phases/dead-code.js.map +1 -0
  219. package/dist/pipeline/phases/default-set.d.ts +24 -0
  220. package/dist/pipeline/phases/default-set.d.ts.map +1 -0
  221. package/dist/pipeline/phases/default-set.js +133 -0
  222. package/dist/pipeline/phases/default-set.js.map +1 -0
  223. package/dist/pipeline/phases/dependencies.d.ts +59 -0
  224. package/dist/pipeline/phases/dependencies.d.ts.map +1 -0
  225. package/dist/pipeline/phases/dependencies.js +281 -0
  226. package/dist/pipeline/phases/dependencies.js.map +1 -0
  227. package/dist/pipeline/phases/embedder-pool.d.ts +31 -0
  228. package/dist/pipeline/phases/embedder-pool.d.ts.map +1 -0
  229. package/dist/pipeline/phases/embedder-pool.js +79 -0
  230. package/dist/pipeline/phases/embedder-pool.js.map +1 -0
  231. package/dist/pipeline/phases/embedder-worker.d.ts +28 -0
  232. package/dist/pipeline/phases/embedder-worker.d.ts.map +1 -0
  233. package/dist/pipeline/phases/embedder-worker.js +43 -0
  234. package/dist/pipeline/phases/embedder-worker.js.map +1 -0
  235. package/dist/pipeline/phases/embeddings.d.ts +117 -0
  236. package/dist/pipeline/phases/embeddings.d.ts.map +1 -0
  237. package/dist/pipeline/phases/embeddings.js +697 -0
  238. package/dist/pipeline/phases/embeddings.js.map +1 -0
  239. package/dist/pipeline/phases/fetches.d.ts +47 -0
  240. package/dist/pipeline/phases/fetches.d.ts.map +1 -0
  241. package/dist/pipeline/phases/fetches.js +207 -0
  242. package/dist/pipeline/phases/fetches.js.map +1 -0
  243. package/dist/pipeline/phases/incremental-helper.d.ts +96 -0
  244. package/dist/pipeline/phases/incremental-helper.d.ts.map +1 -0
  245. package/dist/pipeline/phases/incremental-helper.js +125 -0
  246. package/dist/pipeline/phases/incremental-helper.js.map +1 -0
  247. package/dist/pipeline/phases/incremental-scope.d.ts +67 -0
  248. package/dist/pipeline/phases/incremental-scope.d.ts.map +1 -0
  249. package/dist/pipeline/phases/incremental-scope.js +225 -0
  250. package/dist/pipeline/phases/incremental-scope.js.map +1 -0
  251. package/dist/pipeline/phases/markdown.d.ts +29 -0
  252. package/dist/pipeline/phases/markdown.d.ts.map +1 -0
  253. package/dist/pipeline/phases/markdown.js +298 -0
  254. package/dist/pipeline/phases/markdown.js.map +1 -0
  255. package/dist/pipeline/phases/mro.d.ts +24 -0
  256. package/dist/pipeline/phases/mro.d.ts.map +1 -0
  257. package/dist/pipeline/phases/mro.js +303 -0
  258. package/dist/pipeline/phases/mro.js.map +1 -0
  259. package/dist/pipeline/phases/openapi.d.ts +52 -0
  260. package/dist/pipeline/phases/openapi.d.ts.map +1 -0
  261. package/dist/pipeline/phases/openapi.js +285 -0
  262. package/dist/pipeline/phases/openapi.js.map +1 -0
  263. package/dist/pipeline/phases/orm.d.ts +26 -0
  264. package/dist/pipeline/phases/orm.d.ts.map +1 -0
  265. package/dist/pipeline/phases/orm.js +183 -0
  266. package/dist/pipeline/phases/orm.js.map +1 -0
  267. package/dist/pipeline/phases/ownership.d.ts +88 -0
  268. package/dist/pipeline/phases/ownership.d.ts.map +1 -0
  269. package/dist/pipeline/phases/ownership.js +479 -0
  270. package/dist/pipeline/phases/ownership.js.map +1 -0
  271. package/dist/pipeline/phases/parse.d.ts +63 -0
  272. package/dist/pipeline/phases/parse.d.ts.map +1 -0
  273. package/dist/pipeline/phases/parse.js +994 -0
  274. package/dist/pipeline/phases/parse.js.map +1 -0
  275. package/dist/pipeline/phases/processes.d.ts +47 -0
  276. package/dist/pipeline/phases/processes.d.ts.map +1 -0
  277. package/dist/pipeline/phases/processes.js +620 -0
  278. package/dist/pipeline/phases/processes.js.map +1 -0
  279. package/dist/pipeline/phases/profile.d.ts +33 -0
  280. package/dist/pipeline/phases/profile.d.ts.map +1 -0
  281. package/dist/pipeline/phases/profile.js +91 -0
  282. package/dist/pipeline/phases/profile.js.map +1 -0
  283. package/dist/pipeline/phases/repo-node.d.ts +112 -0
  284. package/dist/pipeline/phases/repo-node.d.ts.map +1 -0
  285. package/dist/pipeline/phases/repo-node.js +272 -0
  286. package/dist/pipeline/phases/repo-node.js.map +1 -0
  287. package/dist/pipeline/phases/risk-snapshot.d.ts +34 -0
  288. package/dist/pipeline/phases/risk-snapshot.d.ts.map +1 -0
  289. package/dist/pipeline/phases/risk-snapshot.js +63 -0
  290. package/dist/pipeline/phases/risk-snapshot.js.map +1 -0
  291. package/dist/pipeline/phases/routes.d.ts +31 -0
  292. package/dist/pipeline/phases/routes.d.ts.map +1 -0
  293. package/dist/pipeline/phases/routes.js +262 -0
  294. package/dist/pipeline/phases/routes.js.map +1 -0
  295. package/dist/pipeline/phases/sbom.d.ts +45 -0
  296. package/dist/pipeline/phases/sbom.d.ts.map +1 -0
  297. package/dist/pipeline/phases/sbom.js +289 -0
  298. package/dist/pipeline/phases/sbom.js.map +1 -0
  299. package/dist/pipeline/phases/scan.d.ts +54 -0
  300. package/dist/pipeline/phases/scan.d.ts.map +1 -0
  301. package/dist/pipeline/phases/scan.js +340 -0
  302. package/dist/pipeline/phases/scan.js.map +1 -0
  303. package/dist/pipeline/phases/scip-index.d.ts +54 -0
  304. package/dist/pipeline/phases/scip-index.d.ts.map +1 -0
  305. package/dist/pipeline/phases/scip-index.js +469 -0
  306. package/dist/pipeline/phases/scip-index.js.map +1 -0
  307. package/dist/pipeline/phases/structure.d.ts +21 -0
  308. package/dist/pipeline/phases/structure.d.ts.map +1 -0
  309. package/dist/pipeline/phases/structure.js +115 -0
  310. package/dist/pipeline/phases/structure.js.map +1 -0
  311. package/dist/pipeline/phases/summarize.d.ts +126 -0
  312. package/dist/pipeline/phases/summarize.d.ts.map +1 -0
  313. package/dist/pipeline/phases/summarize.js +401 -0
  314. package/dist/pipeline/phases/summarize.js.map +1 -0
  315. package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts +42 -0
  316. package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts.map +1 -0
  317. package/dist/pipeline/phases/temporal-helpers/branch-divergence.js +96 -0
  318. package/dist/pipeline/phases/temporal-helpers/branch-divergence.js.map +1 -0
  319. package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts +22 -0
  320. package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts.map +1 -0
  321. package/dist/pipeline/phases/temporal-helpers/churn-decay.js +32 -0
  322. package/dist/pipeline/phases/temporal-helpers/churn-decay.js.map +1 -0
  323. package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts +21 -0
  324. package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts.map +1 -0
  325. package/dist/pipeline/phases/temporal-helpers/conventional-commits.js +37 -0
  326. package/dist/pipeline/phases/temporal-helpers/conventional-commits.js.map +1 -0
  327. package/dist/pipeline/phases/temporal-helpers/gini.d.ts +32 -0
  328. package/dist/pipeline/phases/temporal-helpers/gini.d.ts.map +1 -0
  329. package/dist/pipeline/phases/temporal-helpers/gini.js +78 -0
  330. package/dist/pipeline/phases/temporal-helpers/gini.js.map +1 -0
  331. package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts +14 -0
  332. package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts.map +1 -0
  333. package/dist/pipeline/phases/temporal-helpers/revert-detect.js +25 -0
  334. package/dist/pipeline/phases/temporal-helpers/revert-detect.js.map +1 -0
  335. package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts +18 -0
  336. package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts.map +1 -0
  337. package/dist/pipeline/phases/temporal-helpers/test-pair.js +119 -0
  338. package/dist/pipeline/phases/temporal-helpers/test-pair.js.map +1 -0
  339. package/dist/pipeline/phases/temporal.d.ts +65 -0
  340. package/dist/pipeline/phases/temporal.d.ts.map +1 -0
  341. package/dist/pipeline/phases/temporal.js +621 -0
  342. package/dist/pipeline/phases/temporal.js.map +1 -0
  343. package/dist/pipeline/phases/tools.d.ts +21 -0
  344. package/dist/pipeline/phases/tools.d.ts.map +1 -0
  345. package/dist/pipeline/phases/tools.js +118 -0
  346. package/dist/pipeline/phases/tools.js.map +1 -0
  347. package/dist/pipeline/profile-detectors/api-contracts.d.ts +18 -0
  348. package/dist/pipeline/profile-detectors/api-contracts.d.ts.map +1 -0
  349. package/dist/pipeline/profile-detectors/api-contracts.js +78 -0
  350. package/dist/pipeline/profile-detectors/api-contracts.js.map +1 -0
  351. package/dist/pipeline/profile-detectors/framework-detector.d.ts +11 -0
  352. package/dist/pipeline/profile-detectors/framework-detector.d.ts.map +1 -0
  353. package/dist/pipeline/profile-detectors/framework-detector.js +11 -0
  354. package/dist/pipeline/profile-detectors/framework-detector.js.map +1 -0
  355. package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts +7 -0
  356. package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts.map +1 -0
  357. package/dist/pipeline/profile-detectors/frameworks-catalog.js +7 -0
  358. package/dist/pipeline/profile-detectors/frameworks-catalog.js.map +1 -0
  359. package/dist/pipeline/profile-detectors/frameworks.d.ts +7 -0
  360. package/dist/pipeline/profile-detectors/frameworks.d.ts.map +1 -0
  361. package/dist/pipeline/profile-detectors/frameworks.js +7 -0
  362. package/dist/pipeline/profile-detectors/frameworks.js.map +1 -0
  363. package/dist/pipeline/profile-detectors/iac.d.ts +22 -0
  364. package/dist/pipeline/profile-detectors/iac.d.ts.map +1 -0
  365. package/dist/pipeline/profile-detectors/iac.js +97 -0
  366. package/dist/pipeline/profile-detectors/iac.js.map +1 -0
  367. package/dist/pipeline/profile-detectors/languages.d.ts +18 -0
  368. package/dist/pipeline/profile-detectors/languages.d.ts.map +1 -0
  369. package/dist/pipeline/profile-detectors/languages.js +60 -0
  370. package/dist/pipeline/profile-detectors/languages.js.map +1 -0
  371. package/dist/pipeline/profile-detectors/manifests.d.ts +7 -0
  372. package/dist/pipeline/profile-detectors/manifests.d.ts.map +1 -0
  373. package/dist/pipeline/profile-detectors/manifests.js +7 -0
  374. package/dist/pipeline/profile-detectors/manifests.js.map +1 -0
  375. package/dist/pipeline/profile-detectors/src-dirs.d.ts +17 -0
  376. package/dist/pipeline/profile-detectors/src-dirs.d.ts.map +1 -0
  377. package/dist/pipeline/profile-detectors/src-dirs.js +89 -0
  378. package/dist/pipeline/profile-detectors/src-dirs.js.map +1 -0
  379. package/dist/pipeline/profile-detectors/variant-detectors.d.ts +7 -0
  380. package/dist/pipeline/profile-detectors/variant-detectors.d.ts.map +1 -0
  381. package/dist/pipeline/profile-detectors/variant-detectors.js +7 -0
  382. package/dist/pipeline/profile-detectors/variant-detectors.js.map +1 -0
  383. package/dist/pipeline/runner.d.ts +54 -0
  384. package/dist/pipeline/runner.d.ts.map +1 -0
  385. package/dist/pipeline/runner.js +247 -0
  386. package/dist/pipeline/runner.js.map +1 -0
  387. package/dist/pipeline/types.d.ts +235 -0
  388. package/dist/pipeline/types.d.ts.map +1 -0
  389. package/dist/pipeline/types.js +15 -0
  390. package/dist/pipeline/types.js.map +1 -0
  391. package/dist/providers/c.d.ts +3 -0
  392. package/dist/providers/c.d.ts.map +1 -0
  393. package/dist/providers/c.js +162 -0
  394. package/dist/providers/c.js.map +1 -0
  395. package/dist/providers/cobol.d.ts +19 -0
  396. package/dist/providers/cobol.d.ts.map +1 -0
  397. package/dist/providers/cobol.js +44 -0
  398. package/dist/providers/cobol.js.map +1 -0
  399. package/dist/providers/cpp.d.ts +3 -0
  400. package/dist/providers/cpp.d.ts.map +1 -0
  401. package/dist/providers/cpp.js +200 -0
  402. package/dist/providers/cpp.js.map +1 -0
  403. package/dist/providers/csharp.d.ts +3 -0
  404. package/dist/providers/csharp.d.ts.map +1 -0
  405. package/dist/providers/csharp.js +292 -0
  406. package/dist/providers/csharp.js.map +1 -0
  407. package/dist/providers/dart.d.ts +3 -0
  408. package/dist/providers/dart.d.ts.map +1 -0
  409. package/dist/providers/dart.js +214 -0
  410. package/dist/providers/dart.js.map +1 -0
  411. package/dist/providers/definition-ids.d.ts +18 -0
  412. package/dist/providers/definition-ids.d.ts.map +1 -0
  413. package/dist/providers/definition-ids.js +23 -0
  414. package/dist/providers/definition-ids.js.map +1 -0
  415. package/dist/providers/extract-helpers.d.ts +60 -0
  416. package/dist/providers/extract-helpers.d.ts.map +1 -0
  417. package/dist/providers/extract-helpers.js +296 -0
  418. package/dist/providers/extract-helpers.js.map +1 -0
  419. package/dist/providers/extraction-types.d.ts +85 -0
  420. package/dist/providers/extraction-types.d.ts.map +1 -0
  421. package/dist/providers/extraction-types.js +13 -0
  422. package/dist/providers/extraction-types.js.map +1 -0
  423. package/dist/providers/go.d.ts +3 -0
  424. package/dist/providers/go.d.ts.map +1 -0
  425. package/dist/providers/go.js +359 -0
  426. package/dist/providers/go.js.map +1 -0
  427. package/dist/providers/http-detect.d.ts +44 -0
  428. package/dist/providers/http-detect.d.ts.map +1 -0
  429. package/dist/providers/http-detect.js +307 -0
  430. package/dist/providers/http-detect.js.map +1 -0
  431. package/dist/providers/index.d.ts +38 -0
  432. package/dist/providers/index.d.ts.map +1 -0
  433. package/dist/providers/index.js +33 -0
  434. package/dist/providers/index.js.map +1 -0
  435. package/dist/providers/java.d.ts +3 -0
  436. package/dist/providers/java.d.ts.map +1 -0
  437. package/dist/providers/java.js +259 -0
  438. package/dist/providers/java.js.map +1 -0
  439. package/dist/providers/javascript.d.ts +3 -0
  440. package/dist/providers/javascript.d.ts.map +1 -0
  441. package/dist/providers/javascript.js +139 -0
  442. package/dist/providers/javascript.js.map +1 -0
  443. package/dist/providers/kotlin.d.ts +3 -0
  444. package/dist/providers/kotlin.d.ts.map +1 -0
  445. package/dist/providers/kotlin.js +175 -0
  446. package/dist/providers/kotlin.js.map +1 -0
  447. package/dist/providers/php.d.ts +3 -0
  448. package/dist/providers/php.d.ts.map +1 -0
  449. package/dist/providers/php.js +218 -0
  450. package/dist/providers/php.js.map +1 -0
  451. package/dist/providers/python-accesses.d.ts +9 -0
  452. package/dist/providers/python-accesses.d.ts.map +1 -0
  453. package/dist/providers/python-accesses.js +22 -0
  454. package/dist/providers/python-accesses.js.map +1 -0
  455. package/dist/providers/python.d.ts +3 -0
  456. package/dist/providers/python.d.ts.map +1 -0
  457. package/dist/providers/python.js +323 -0
  458. package/dist/providers/python.js.map +1 -0
  459. package/dist/providers/registry.d.ts +4 -0
  460. package/dist/providers/registry.d.ts.map +1 -0
  461. package/dist/providers/registry.js +46 -0
  462. package/dist/providers/registry.js.map +1 -0
  463. package/dist/providers/resolution/c3.d.ts +6 -0
  464. package/dist/providers/resolution/c3.d.ts.map +1 -0
  465. package/dist/providers/resolution/c3.js +76 -0
  466. package/dist/providers/resolution/c3.js.map +1 -0
  467. package/dist/providers/resolution/context.d.ts +38 -0
  468. package/dist/providers/resolution/context.d.ts.map +1 -0
  469. package/dist/providers/resolution/context.js +45 -0
  470. package/dist/providers/resolution/context.js.map +1 -0
  471. package/dist/providers/resolution/first-wins.d.ts +3 -0
  472. package/dist/providers/resolution/first-wins.d.ts.map +1 -0
  473. package/dist/providers/resolution/first-wins.js +27 -0
  474. package/dist/providers/resolution/first-wins.js.map +1 -0
  475. package/dist/providers/resolution/mro.d.ts +16 -0
  476. package/dist/providers/resolution/mro.d.ts.map +1 -0
  477. package/dist/providers/resolution/mro.js +14 -0
  478. package/dist/providers/resolution/mro.js.map +1 -0
  479. package/dist/providers/resolution/none.d.ts +3 -0
  480. package/dist/providers/resolution/none.d.ts.map +1 -0
  481. package/dist/providers/resolution/none.js +11 -0
  482. package/dist/providers/resolution/none.js.map +1 -0
  483. package/dist/providers/resolution/python-all-filter.d.ts +25 -0
  484. package/dist/providers/resolution/python-all-filter.d.ts.map +1 -0
  485. package/dist/providers/resolution/python-all-filter.js +64 -0
  486. package/dist/providers/resolution/python-all-filter.js.map +1 -0
  487. package/dist/providers/resolution/resolver-strategy.d.ts +42 -0
  488. package/dist/providers/resolution/resolver-strategy.d.ts.map +1 -0
  489. package/dist/providers/resolution/resolver-strategy.js +50 -0
  490. package/dist/providers/resolution/resolver-strategy.js.map +1 -0
  491. package/dist/providers/resolution/single-inheritance.d.ts +3 -0
  492. package/dist/providers/resolution/single-inheritance.d.ts.map +1 -0
  493. package/dist/providers/resolution/single-inheritance.js +21 -0
  494. package/dist/providers/resolution/single-inheritance.js.map +1 -0
  495. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts +16 -0
  496. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts.map +1 -0
  497. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js +50 -0
  498. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js.map +1 -0
  499. package/dist/providers/resolution/stack-graphs/glue.d.ts +15 -0
  500. package/dist/providers/resolution/stack-graphs/glue.d.ts.map +1 -0
  501. package/dist/providers/resolution/stack-graphs/glue.js +44 -0
  502. package/dist/providers/resolution/stack-graphs/glue.js.map +1 -0
  503. package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts +30 -0
  504. package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts.map +1 -0
  505. package/dist/providers/resolution/stack-graphs/node-edge-builder.js +366 -0
  506. package/dist/providers/resolution/stack-graphs/node-edge-builder.js.map +1 -0
  507. package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts +9 -0
  508. package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts.map +1 -0
  509. package/dist/providers/resolution/stack-graphs/partial-path-engine.js +152 -0
  510. package/dist/providers/resolution/stack-graphs/partial-path-engine.js.map +1 -0
  511. package/dist/providers/resolution/stack-graphs/rule-parser.d.ts +11 -0
  512. package/dist/providers/resolution/stack-graphs/rule-parser.d.ts.map +1 -0
  513. package/dist/providers/resolution/stack-graphs/rule-parser.js +247 -0
  514. package/dist/providers/resolution/stack-graphs/rule-parser.js.map +1 -0
  515. package/dist/providers/resolution/stack-graphs/types.d.ts +93 -0
  516. package/dist/providers/resolution/stack-graphs/types.d.ts.map +1 -0
  517. package/dist/providers/resolution/stack-graphs/types.js +11 -0
  518. package/dist/providers/resolution/stack-graphs/types.js.map +1 -0
  519. package/dist/providers/resolution/stack-graphs-python.d.ts +27 -0
  520. package/dist/providers/resolution/stack-graphs-python.d.ts.map +1 -0
  521. package/dist/providers/resolution/stack-graphs-python.js +104 -0
  522. package/dist/providers/resolution/stack-graphs-python.js.map +1 -0
  523. package/dist/providers/resolution/stack-graphs-ts.d.ts +134 -0
  524. package/dist/providers/resolution/stack-graphs-ts.d.ts.map +1 -0
  525. package/dist/providers/resolution/stack-graphs-ts.js +372 -0
  526. package/dist/providers/resolution/stack-graphs-ts.js.map +1 -0
  527. package/dist/providers/ruby.d.ts +3 -0
  528. package/dist/providers/ruby.d.ts.map +1 -0
  529. package/dist/providers/ruby.js +259 -0
  530. package/dist/providers/ruby.js.map +1 -0
  531. package/dist/providers/rust.d.ts +3 -0
  532. package/dist/providers/rust.d.ts.map +1 -0
  533. package/dist/providers/rust.js +318 -0
  534. package/dist/providers/rust.js.map +1 -0
  535. package/dist/providers/swift.d.ts +3 -0
  536. package/dist/providers/swift.d.ts.map +1 -0
  537. package/dist/providers/swift.js +177 -0
  538. package/dist/providers/swift.js.map +1 -0
  539. package/dist/providers/test-helpers.d.ts +24 -0
  540. package/dist/providers/test-helpers.d.ts.map +1 -0
  541. package/dist/providers/test-helpers.js +33 -0
  542. package/dist/providers/test-helpers.js.map +1 -0
  543. package/dist/providers/ts-shared.d.ts +30 -0
  544. package/dist/providers/ts-shared.d.ts.map +1 -0
  545. package/dist/providers/ts-shared.js +328 -0
  546. package/dist/providers/ts-shared.js.map +1 -0
  547. package/dist/providers/tsx.d.ts +7 -0
  548. package/dist/providers/tsx.d.ts.map +1 -0
  549. package/dist/providers/tsx.js +79 -0
  550. package/dist/providers/tsx.js.map +1 -0
  551. package/dist/providers/types.d.ts +166 -0
  552. package/dist/providers/types.d.ts.map +1 -0
  553. package/dist/providers/types.js +7 -0
  554. package/dist/providers/types.js.map +1 -0
  555. package/dist/providers/typescript-family-accesses.d.ts +14 -0
  556. package/dist/providers/typescript-family-accesses.d.ts.map +1 -0
  557. package/dist/providers/typescript-family-accesses.js +27 -0
  558. package/dist/providers/typescript-family-accesses.js.map +1 -0
  559. package/dist/providers/typescript.d.ts +9 -0
  560. package/dist/providers/typescript.d.ts.map +1 -0
  561. package/dist/providers/typescript.js +84 -0
  562. package/dist/providers/typescript.js.map +1 -0
  563. package/package.json +108 -0
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Shared property-access walker powering the ACCESSES-edge emitter.
3
+ *
4
+ * Per-function/method body, we scan the source text between `startLine` and
5
+ * `endLine` (inclusive, 1-indexed) and look for:
6
+ * - Member expressions (`a.b`) → read
7
+ * - Assignment targets (`a.b = ...`) → write
8
+ * - Subscript accesses (`a["b"]`) → read (also "b" when LHS)
9
+ *
10
+ * We deliberately do not consume the tree-sitter parse tree: the unified
11
+ * query does not surface member/attribute/assignment/subscript nodes. A
12
+ * source-text walker that first strips comments + string literals via
13
+ * {@link stripComments} is deterministic, language-agnostic, and avoids a
14
+ * round-trip through the worker pool.
15
+ *
16
+ * Per-language providers pass a {@link PropertyAccessConfig} selecting which
17
+ * flavour of assignment operators to treat as writes (Python augments include
18
+ * `:=`; some languages use `=` only). The walker is careful to:
19
+ * - Skip property names that collide with keywords (`this`, `self`, `if`...).
20
+ * - Skip chained receivers (`a.b.c` → only the last segment is treated as
21
+ * a property read anchored to the *most recent* identifier).
22
+ * - Skip function-call members (`a.foo()` is a call, not a property read).
23
+ * - Skip optional chaining (`a?.b`) is kept (TS/JS-only; detected).
24
+ *
25
+ * Flat property names only (v2 scope): `user.address.street` yields reads
26
+ * on `address` (for `user`) and `street` (for `address`). Qualified paths
27
+ * are a future extension.
28
+ */
29
+ import { stripComments } from "../providers/extract-helpers.js";
30
+ export const TS_ACCESS_CONFIG = {
31
+ commentStripped: true,
32
+ memberSeparator: ".",
33
+ // Per spec (ECMAScript + TS): `=`, `+=`, `-=`, `*=`, `/=`, `%=`, `**=`,
34
+ // `<<=`, `>>=`, `>>>=`, `&=`, `|=`, `^=`, `&&=`, `||=`, `??=`.
35
+ assignmentOperators: [
36
+ "=",
37
+ "+=",
38
+ "-=",
39
+ "*=",
40
+ "/=",
41
+ "%=",
42
+ "**=",
43
+ "<<=",
44
+ ">>=",
45
+ ">>>=",
46
+ "&=",
47
+ "|=",
48
+ "^=",
49
+ "&&=",
50
+ "||=",
51
+ "??=",
52
+ ],
53
+ };
54
+ export const PYTHON_ACCESS_CONFIG = {
55
+ commentStripped: true,
56
+ memberSeparator: ".",
57
+ // Python augmented assignment ops + walrus.
58
+ assignmentOperators: [
59
+ "=",
60
+ "+=",
61
+ "-=",
62
+ "*=",
63
+ "/=",
64
+ "//=",
65
+ "%=",
66
+ "**=",
67
+ "&=",
68
+ "|=",
69
+ "^=",
70
+ ">>=",
71
+ "<<=",
72
+ ":=",
73
+ ],
74
+ };
75
+ /** Language keywords that may appear before a `.` but are not real receivers. */
76
+ const KEYWORD_RECEIVERS = new Set([
77
+ "if",
78
+ "else",
79
+ "for",
80
+ "while",
81
+ "return",
82
+ "yield",
83
+ "await",
84
+ "throw",
85
+ "new",
86
+ "delete",
87
+ "typeof",
88
+ "void",
89
+ "in",
90
+ "of",
91
+ "from",
92
+ "as",
93
+ "is",
94
+ "and",
95
+ "or",
96
+ "not",
97
+ "class",
98
+ "function",
99
+ "def",
100
+ "lambda",
101
+ "import",
102
+ "export",
103
+ "const",
104
+ "let",
105
+ "var",
106
+ "true",
107
+ "false",
108
+ "null",
109
+ "None",
110
+ "True",
111
+ "False",
112
+ "undefined",
113
+ ]);
114
+ /**
115
+ * Extract every property access inside the given function/method bodies.
116
+ *
117
+ * `enclosingDefs` is a filtered view of `definitions` (Function / Method /
118
+ * Constructor kinds only) with pre-resolved `NodeId`s so the walker doesn't
119
+ * re-derive them.
120
+ */
121
+ export function extractPropertyAccesses(filePath, sourceText, enclosingDefs, config) {
122
+ if (enclosingDefs.length === 0)
123
+ return [];
124
+ const src = config.commentStripped === true ? stripComments(sourceText) : sourceText;
125
+ const lines = src.split("\n");
126
+ const out = [];
127
+ // Sort by innermost-first: when a method sits inside a class declaration
128
+ // (which itself might not be a Function/Method/Constructor), `findInnermost`
129
+ // picks the tightest containing span.
130
+ const sortedDefs = [...enclosingDefs].sort((a, b) => {
131
+ const spanA = a.endLine - a.startLine;
132
+ const spanB = b.endLine - b.startLine;
133
+ return spanA - spanB;
134
+ });
135
+ const sep = escapeRegExp(config.memberSeparator);
136
+ // Match `<receiver><sep><name>` where `<name>` is the bare identifier we
137
+ // attribute the access to. `<receiver>` captures everything up to the
138
+ // final separator so we can reject keyword-prefixed matches and chained
139
+ // calls (`obj.foo().bar` should not yield a `foo` read — we detect the
140
+ // `(` after `foo` below).
141
+ //
142
+ // `(?<![A-Za-z_$\w])` anchors the receiver to a fresh identifier start.
143
+ // Named-capture groups chosen to read naturally at the use site.
144
+ // Note the `[\w$]` lookbehind: `\w` already covers `[A-Za-z0-9_]`, so
145
+ // adding `A-Z`/`a-z` to the class would create the suspicious-overlapping
146
+ // ranges that triggered js/overly-large-range. The `$` is the only
147
+ // identifier character `\w` doesn't include in JS regex semantics.
148
+ const memberRe = new RegExp(`(?<![\\w$])(?<receiver>[A-Za-z_$][\\w$]*)\\s*\\??${sep}(?<name>[A-Za-z_$][\\w$]*)`, "g");
149
+ const subscriptRe = /(?<![\w$])(?<receiver>[A-Za-z_$][\w$]*)\s*\[\s*(?<quote>['"])(?<name>[A-Za-z_$][\w$]*)\k<quote>\s*\]/g;
150
+ // Pre-compile a regex that decides if the substring AFTER a member match
151
+ // begins with an assignment operator. Longest-match-first so `+=` wins
152
+ // over `=`.
153
+ const opsByLength = [...config.assignmentOperators].sort((a, b) => b.length - a.length);
154
+ const assignHead = new RegExp(`^\\s*(${opsByLength.map(escapeRegExp).join("|")})(?![<>=])`);
155
+ for (let i = 0; i < lines.length; i += 1) {
156
+ const lineNo = i + 1;
157
+ const enclosing = findInnermost(sortedDefs, lineNo);
158
+ if (enclosing === undefined)
159
+ continue;
160
+ const line = lines[i] ?? "";
161
+ // --- Member expressions (`a.b`, `a?.b`, `a.b = ...`). -------------------
162
+ for (const m of line.matchAll(memberRe)) {
163
+ const receiver = m.groups?.["receiver"];
164
+ const name = m.groups?.["name"];
165
+ if (receiver === undefined || name === undefined)
166
+ continue;
167
+ if (KEYWORD_RECEIVERS.has(receiver))
168
+ continue;
169
+ const matchEnd = (m.index ?? 0) + m[0].length;
170
+ const tail = line.slice(matchEnd);
171
+ // Skip calls: `a.b(` or `a.b<Type>(` (TS generics). We want to keep
172
+ // `a.b` as a property access ONLY when it is not the callee of a
173
+ // function call. Method invocations are already modelled by CALLS.
174
+ if (isCallTail(tail))
175
+ continue;
176
+ const reason = isAssignmentTail(tail, assignHead) ? "write" : "read";
177
+ out.push({
178
+ enclosingSymbolId: enclosing.id,
179
+ propertyName: name,
180
+ reason,
181
+ startLine: lineNo,
182
+ endLine: lineNo,
183
+ filePath,
184
+ });
185
+ }
186
+ // --- Subscript with string literal (`a["b"]`, `a['b'] = ...`). ---------
187
+ for (const m of line.matchAll(subscriptRe)) {
188
+ const receiver = m.groups?.["receiver"];
189
+ const name = m.groups?.["name"];
190
+ if (receiver === undefined || name === undefined)
191
+ continue;
192
+ if (KEYWORD_RECEIVERS.has(receiver))
193
+ continue;
194
+ const matchEnd = (m.index ?? 0) + m[0].length;
195
+ const tail = line.slice(matchEnd);
196
+ const reason = isAssignmentTail(tail, assignHead) ? "write" : "read";
197
+ out.push({
198
+ enclosingSymbolId: enclosing.id,
199
+ propertyName: name,
200
+ reason,
201
+ startLine: lineNo,
202
+ endLine: lineNo,
203
+ filePath,
204
+ });
205
+ }
206
+ }
207
+ return sortAccesses(out);
208
+ }
209
+ /** Stable ordering: (enclosingSymbolId, propertyName, startLine, reason). */
210
+ export function sortAccesses(accesses) {
211
+ return [...accesses].sort((a, b) => {
212
+ if (a.enclosingSymbolId !== b.enclosingSymbolId) {
213
+ return a.enclosingSymbolId < b.enclosingSymbolId ? -1 : 1;
214
+ }
215
+ if (a.propertyName !== b.propertyName) {
216
+ return a.propertyName < b.propertyName ? -1 : 1;
217
+ }
218
+ if (a.startLine !== b.startLine)
219
+ return a.startLine - b.startLine;
220
+ if (a.reason !== b.reason)
221
+ return a.reason < b.reason ? -1 : 1;
222
+ return 0;
223
+ });
224
+ }
225
+ /** True when the character tail begins with `(` or `<...>(` (generic call). */
226
+ function isCallTail(tail) {
227
+ // Direct call: `foo(` possibly with whitespace.
228
+ if (/^\s*\(/.test(tail))
229
+ return true;
230
+ // TS generic call: `foo<A, B>(` — approximate, we only look for `<` then
231
+ // bounded scan for `>(`.
232
+ if (/^\s*</.test(tail)) {
233
+ const close = tail.indexOf(">");
234
+ if (close !== -1 && /^\s*\(/.test(tail.slice(close + 1)))
235
+ return true;
236
+ }
237
+ return false;
238
+ }
239
+ function isAssignmentTail(tail, assignHead) {
240
+ return assignHead.test(tail);
241
+ }
242
+ function findInnermost(sortedDefs, line) {
243
+ for (const d of sortedDefs) {
244
+ if (line >= d.startLine && line <= d.endLine)
245
+ return d;
246
+ }
247
+ return undefined;
248
+ }
249
+ function escapeRegExp(s) {
250
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
251
+ }
252
+ /**
253
+ * Convenience filter — providers call this to narrow the `ExtractedDefinition`
254
+ * list down to callable owners, then hand each through `idForDefinition` from
255
+ * the parse phase before invoking {@link extractPropertyAccesses}.
256
+ */
257
+ export function callableDefs(defs) {
258
+ return defs.filter((d) => d.kind === "Function" || d.kind === "Method" || d.kind === "Constructor");
259
+ }
260
+ //# sourceMappingURL=property-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-access.js","sourceRoot":"","sources":["../../src/extract/property-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAyBhE,MAAM,CAAC,MAAM,gBAAgB,GAAyB;IACpD,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,GAAG;IACpB,wEAAwE;IACxE,+DAA+D;IAC/D,mBAAmB,EAAE;QACnB,GAAG;QACH,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;KACN;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAyB;IACxD,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,GAAG;IACpB,4CAA4C;IAC5C,mBAAmB,EAAE;QACnB,GAAG;QACH,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,IAAI;QACJ,KAAK;QACL,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,IAAI;KACL;CACF,CAAC;AAEF,iFAAiF;AACjF,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IACrD,IAAI;IACJ,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAA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,yEAAyE;IACzE,yBAAyB;IACzB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IACxE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,UAAkB;IACxD,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,aAAa,CACpB,UAAmC,EACnC,IAAY;IAEZ,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,CAAC,OAAO;YAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAoC;IAC/D,OAAO,IAAI,CAAC,MAAM,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CAChF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Receiver resolver — shared helper used by the ORM and route detectors to
3
+ * confirm that a receiver identifier (e.g. `app.get(...)`, `prisma.user.findMany`)
4
+ * actually originates from a specific npm module before a detector emits an
5
+ * edge. Two paths are wired:
6
+ *
7
+ * 1. **Import-graph path** (fast, always available). Walks the per-file
8
+ * `ExtractedImport[]` list populated by the parse phase and returns the
9
+ * matched module when the identifier is declared as the `localAlias`
10
+ * of, or is one of the `importedNames` of, an import declaration.
11
+ *
12
+ * 2. **Type-check path** (optional, opt-in). Only invoked when the
13
+ * import-graph path misses AND a `ts-morph` project was passed in via
14
+ * {@link TsMorphProject}. Uses
15
+ * `getApparentType()` → `getSymbol()` → `getDeclarations()[0].getSourceFile()`
16
+ * to recover the declaring source file for the receiver's inferred
17
+ * type. If that file's path sits under a known `node_modules/<pkg>/`
18
+ * segment the module is returned.
19
+ *
20
+ * The ts-morph dependency is declared as an `optionalDependencies` entry on
21
+ * `@opencodehub/ingestion` so repos that don't need type-check precision
22
+ * never pay for it. When ts-morph isn't wired — or when any step in its
23
+ * chain throws — the helper silently degrades to "no resolution" and the
24
+ * caller decides whether to emit heuristically or skip.
25
+ *
26
+ * The helper makes no filesystem calls and no network calls. It is pure
27
+ * over its inputs.
28
+ */
29
+ import type { ExtractedImport } from "../providers/extraction-types.js";
30
+ /**
31
+ * Per-symbol import record the resolver accepts. This is a structural
32
+ * subset of {@link ExtractedImport} so test fixtures can pass in plain
33
+ * objects without reaching for the full provider types.
34
+ */
35
+ export interface ImportedSymbol {
36
+ /** Raw module specifier as written in source (e.g. `@prisma/client`). */
37
+ readonly source: string;
38
+ /** Names introduced by a named import, or `undefined` for default / namespace imports. */
39
+ readonly importedNames?: readonly string[];
40
+ /** Local alias (default / namespace import, or aliased named import). */
41
+ readonly localAlias?: string;
42
+ }
43
+ /**
44
+ * Light wrapper over a `ts-morph` project handle. We deliberately keep the
45
+ * shape structural so the resolver avoids a hard dependency on the ts-morph
46
+ * type surface — callers pass any object that can resolve a symbol at a
47
+ * `(filePath, identifier)` pair back to its declaring source file.
48
+ */
49
+ export interface TsMorphProject {
50
+ /**
51
+ * Return the resolved module specifier (e.g. `@prisma/client`) for the
52
+ * identifier's apparent type, or `null` when ts-morph cannot figure it out
53
+ * (missing file, unresolved import, type alias to `any`, etc.).
54
+ */
55
+ resolveReceiverModule(filePath: string, identifier: string): ResolvedTypeInfo | null;
56
+ }
57
+ /** Output of {@link TsMorphProject.resolveReceiverModule}. */
58
+ export interface ResolvedTypeInfo {
59
+ /** Module specifier recovered from the declaring source file's path. */
60
+ readonly moduleName: string;
61
+ /** Symbol name of the apparent type (e.g. `PrismaClient`). */
62
+ readonly typeName?: string;
63
+ }
64
+ /** The resolution outcome returned by {@link resolveReceiver}. */
65
+ export interface ReceiverOrigin {
66
+ readonly identifier: string;
67
+ /** Module specifier the identifier is imported from, when known. */
68
+ readonly moduleName?: string;
69
+ /** Resolved type symbol name (ts-morph path only). */
70
+ readonly resolvedType?: string;
71
+ /** Which resolution path succeeded. */
72
+ readonly source: "import-graph" | "type-check";
73
+ }
74
+ /**
75
+ * Resolve the origin of `identifier` as used inside `filePath`. Returns
76
+ * `null` when neither the import-graph nor the ts-morph path produced a
77
+ * match.
78
+ */
79
+ export declare function resolveReceiver(identifier: string, filePath: string, importsByFile: ReadonlyMap<string, readonly ImportedSymbol[]> | undefined, tsMorphProject?: TsMorphProject): ReceiverOrigin | null;
80
+ /**
81
+ * Adapt a `ReadonlyMap<string, readonly ExtractedImport[]>` (the shape the
82
+ * parse phase actually populates) into the structural {@link ImportedSymbol}
83
+ * shape the resolver wants. This is a zero-cost view — no copies are made.
84
+ */
85
+ export declare function importsMapFromExtracted(importsByFile: ReadonlyMap<string, readonly ExtractedImport[]>): ReadonlyMap<string, readonly ImportedSymbol[]>;
86
+ //# sourceMappingURL=receiver-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiver-resolver.d.ts","sourceRoot":"","sources":["../../src/extract/receiver-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,yEAAy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/**
2
+ * Receiver resolver — shared helper used by the ORM and route detectors to
3
+ * confirm that a receiver identifier (e.g. `app.get(...)`, `prisma.user.findMany`)
4
+ * actually originates from a specific npm module before a detector emits an
5
+ * edge. Two paths are wired:
6
+ *
7
+ * 1. **Import-graph path** (fast, always available). Walks the per-file
8
+ * `ExtractedImport[]` list populated by the parse phase and returns the
9
+ * matched module when the identifier is declared as the `localAlias`
10
+ * of, or is one of the `importedNames` of, an import declaration.
11
+ *
12
+ * 2. **Type-check path** (optional, opt-in). Only invoked when the
13
+ * import-graph path misses AND a `ts-morph` project was passed in via
14
+ * {@link TsMorphProject}. Uses
15
+ * `getApparentType()` → `getSymbol()` → `getDeclarations()[0].getSourceFile()`
16
+ * to recover the declaring source file for the receiver's inferred
17
+ * type. If that file's path sits under a known `node_modules/<pkg>/`
18
+ * segment the module is returned.
19
+ *
20
+ * The ts-morph dependency is declared as an `optionalDependencies` entry on
21
+ * `@opencodehub/ingestion` so repos that don't need type-check precision
22
+ * never pay for it. When ts-morph isn't wired — or when any step in its
23
+ * chain throws — the helper silently degrades to "no resolution" and the
24
+ * caller decides whether to emit heuristically or skip.
25
+ *
26
+ * The helper makes no filesystem calls and no network calls. It is pure
27
+ * over its inputs.
28
+ */
29
+ /**
30
+ * Resolve the origin of `identifier` as used inside `filePath`. Returns
31
+ * `null` when neither the import-graph nor the ts-morph path produced a
32
+ * match.
33
+ */
34
+ export function resolveReceiver(identifier, filePath, importsByFile, tsMorphProject) {
35
+ // ---- Path 1: import graph --------------------------------------------
36
+ const imports = importsByFile?.get(filePath);
37
+ if (imports !== undefined) {
38
+ for (const imp of imports) {
39
+ if (imp.localAlias !== undefined && imp.localAlias === identifier) {
40
+ return { identifier, moduleName: imp.source, source: "import-graph" };
41
+ }
42
+ if (imp.importedNames?.includes(identifier)) {
43
+ return { identifier, moduleName: imp.source, source: "import-graph" };
44
+ }
45
+ }
46
+ }
47
+ // ---- Path 2: ts-morph type check -------------------------------------
48
+ if (tsMorphProject !== undefined) {
49
+ try {
50
+ const info = tsMorphProject.resolveReceiverModule(filePath, identifier);
51
+ if (info !== null) {
52
+ return {
53
+ identifier,
54
+ moduleName: info.moduleName,
55
+ ...(info.typeName !== undefined ? { resolvedType: info.typeName } : {}),
56
+ source: "type-check",
57
+ };
58
+ }
59
+ }
60
+ catch {
61
+ // DET-UN-001 — ts-morph may throw on a corrupt tsconfig / missing
62
+ // file / internal invariant. Silent degradation: the caller treats
63
+ // a `null` return as "unknown" and the strict-detectors flag decides
64
+ // whether to emit heuristically.
65
+ }
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * Adapt a `ReadonlyMap<string, readonly ExtractedImport[]>` (the shape the
71
+ * parse phase actually populates) into the structural {@link ImportedSymbol}
72
+ * shape the resolver wants. This is a zero-cost view — no copies are made.
73
+ */
74
+ export function importsMapFromExtracted(importsByFile) {
75
+ return importsByFile;
76
+ }
77
+ //# sourceMappingURL=receiver-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiver-resolver.js","sourceRoot":"","sources":["../../src/extract/receiver-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAoDH;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkB,EAClB,QAAgB,EAChB,aAAyE,EACzE,cAA+B;IAE/B,yEAAyE;IACzE,MAAM,OAAO,GAAG,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,GAAG,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;gBAClE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;YACxE,CAAC;YACD,IAAI,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;YACxE,CAAC;QACH,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,cAAc,CAAC,qBAAqB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACxE,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAClB,OAAO;oBACL,UAAU;oBACV,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvE,MAAM,EAAE,YAAY;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;YAClE,mEAAmE;YACnE,qEAAqE;YACrE,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAA8D;IAE9D,OAAO,aAA+D,CAAC;AACzE,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Spring MVC / Spring WebFlux route detector.
3
+ *
4
+ * Covers the canonical annotation shapes:
5
+ *
6
+ * @RequestMapping("/users") // class / method
7
+ * @RequestMapping(value = "/users", method = RequestMethod.GET)
8
+ * @GetMapping("/users/{id}")
9
+ * @PostMapping("/users")
10
+ * @PutMapping("/users/{id}")
11
+ * @DeleteMapping("/users/{id}")
12
+ * @PatchMapping("/users/{id}")
13
+ *
14
+ * Class-level `@RequestMapping` prefixes are concatenated with method-
15
+ * level prefixes when both are present on the same class declaration.
16
+ * WebFlux uses the same annotations; there is no separate dispatch.
17
+ *
18
+ * Profile-gated: route phase only dispatches when `java` participates
19
+ * and `spring-boot` (or any `spring-*` variant) is on the detected
20
+ * frameworks list.
21
+ */
22
+ import type { ExtractedRoute, ExtractInput } from "./types.js";
23
+ /**
24
+ * Detect Spring routes in a single Java file. Returns one entry per
25
+ * method-level mapping; class-level `@RequestMapping` path prefixes are
26
+ * prepended to each method's URL.
27
+ */
28
+ export declare function detectSpringRoutes(input: ExtractInput): readonly ExtractedRoute[];
29
+ //# sourceMappingURL=route-detector-java.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-detector-java.d.ts","sourceRoot":"","sources":["../../src/extract/route-detector-java.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,cAAc,EAAE,CA6DjF"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Spring MVC / Spring WebFlux route detector.
3
+ *
4
+ * Covers the canonical annotation shapes:
5
+ *
6
+ * @RequestMapping("/users") // class / method
7
+ * @RequestMapping(value = "/users", method = RequestMethod.GET)
8
+ * @GetMapping("/users/{id}")
9
+ * @PostMapping("/users")
10
+ * @PutMapping("/users/{id}")
11
+ * @DeleteMapping("/users/{id}")
12
+ * @PatchMapping("/users/{id}")
13
+ *
14
+ * Class-level `@RequestMapping` prefixes are concatenated with method-
15
+ * level prefixes when both are present on the same class declaration.
16
+ * WebFlux uses the same annotations; there is no separate dispatch.
17
+ *
18
+ * Profile-gated: route phase only dispatches when `java` participates
19
+ * and `spring-boot` (or any `spring-*` variant) is on the detected
20
+ * frameworks list.
21
+ */
22
+ const METHOD_RE = /@\s*(GetMapping|PostMapping|PutMapping|DeleteMapping|PatchMapping)\s*(?:\(\s*(?:value\s*=\s*)?(?:"([^"]*)"|\{\s*"([^"]*)"\s*\}))?/g;
23
+ const REQUEST_MAPPING_RE = /@\s*RequestMapping\s*\(([\s\S]*?)\)/g;
24
+ const CLASS_DECL_RE = /\bclass\s+([A-Za-z_][\w]*)/g;
25
+ /**
26
+ * Detect Spring routes in a single Java file. Returns one entry per
27
+ * method-level mapping; class-level `@RequestMapping` path prefixes are
28
+ * prepended to each method's URL.
29
+ */
30
+ export function detectSpringRoutes(input) {
31
+ const { filePath, content } = input;
32
+ const out = [];
33
+ // Collect class declarations + their class-level @RequestMapping prefix.
34
+ const classRanges = collectClassRanges(content);
35
+ // Method-specific shorthand annotations.
36
+ METHOD_RE.lastIndex = 0;
37
+ let m = METHOD_RE.exec(content);
38
+ while (m !== null) {
39
+ const verb = annotationToVerb(m[1]);
40
+ const url = normalizeUrl(m[2] ?? m[3] ?? "");
41
+ const atIdx = m.index;
42
+ m = METHOD_RE.exec(content);
43
+ if (verb === undefined)
44
+ continue;
45
+ const enclosing = findEnclosingClass(atIdx, classRanges);
46
+ const finalUrl = composeUrl(enclosing?.baseUrl ?? "", url);
47
+ out.push({
48
+ url: finalUrl,
49
+ method: verb,
50
+ handlerFile: filePath,
51
+ framework: "spring",
52
+ });
53
+ }
54
+ // Generic @RequestMapping — may carry `method = RequestMethod.GET` or a
55
+ // list `method = { RequestMethod.GET, RequestMethod.POST }`.
56
+ REQUEST_MAPPING_RE.lastIndex = 0;
57
+ let rm = REQUEST_MAPPING_RE.exec(content);
58
+ while (rm !== null) {
59
+ const body = rm[1] ?? "";
60
+ const atIdx = rm.index;
61
+ rm = REQUEST_MAPPING_RE.exec(content);
62
+ const url = readRequestMappingUrl(body);
63
+ const methods = readRequestMappingMethods(body);
64
+ if (url === undefined)
65
+ continue;
66
+ const enclosing = findEnclosingClass(atIdx, classRanges);
67
+ const finalUrl = composeUrl(enclosing?.baseUrl ?? "", normalizeUrl(url));
68
+ if (methods.length === 0) {
69
+ // No method filter — class-level mapping or a catch-all. Emit
70
+ // without `method` so the downstream phase stores `ANY`.
71
+ out.push({
72
+ url: finalUrl,
73
+ handlerFile: filePath,
74
+ framework: "spring",
75
+ });
76
+ }
77
+ else {
78
+ for (const verb of methods) {
79
+ out.push({
80
+ url: finalUrl,
81
+ method: verb,
82
+ handlerFile: filePath,
83
+ framework: "spring",
84
+ });
85
+ }
86
+ }
87
+ }
88
+ return out;
89
+ }
90
+ /**
91
+ * Walk every `class Foo` declaration in the file and associate the
92
+ * character range `[startIdx, nextClass | eof)` with the class-level
93
+ * `@RequestMapping` path prefix that sits immediately above the class
94
+ * declaration. Classes without a class-level mapping get `baseUrl = ""`.
95
+ */
96
+ function collectClassRanges(content) {
97
+ const ranges = [];
98
+ CLASS_DECL_RE.lastIndex = 0;
99
+ let m = CLASS_DECL_RE.exec(content);
100
+ while (m !== null) {
101
+ ranges.push({ startIdx: m.index, name: m[1] });
102
+ m = CLASS_DECL_RE.exec(content);
103
+ }
104
+ const out = [];
105
+ for (let i = 0; i < ranges.length; i++) {
106
+ const r = ranges[i];
107
+ if (r === undefined)
108
+ continue;
109
+ const endIdx = i + 1 < ranges.length ? (ranges[i + 1]?.startIdx ?? content.length) : content.length;
110
+ const baseUrl = readClassRequestMappingAbove(content, r.startIdx);
111
+ out.push({ startIdx: r.startIdx, endIdx, baseUrl });
112
+ }
113
+ return out;
114
+ }
115
+ function findEnclosingClass(idx, ranges) {
116
+ for (const r of ranges) {
117
+ if (idx >= r.startIdx && idx < r.endIdx)
118
+ return r;
119
+ }
120
+ return undefined;
121
+ }
122
+ /**
123
+ * Scan backwards from `classStart` looking for a `@RequestMapping(…)`
124
+ * annotation within the last ~400 characters (enough for the annotation
125
+ * block; Spring conventions keep class-level mappings terse).
126
+ */
127
+ function readClassRequestMappingAbove(content, classStart) {
128
+ const from = Math.max(0, classStart - 400);
129
+ const window = content.slice(from, classStart);
130
+ const re = /@\s*RequestMapping\s*\(([\s\S]*?)\)/g;
131
+ let best = "";
132
+ let m = re.exec(window);
133
+ while (m !== null) {
134
+ const url = readRequestMappingUrl(m[1] ?? "");
135
+ if (url !== undefined)
136
+ best = normalizeUrl(url);
137
+ m = re.exec(window);
138
+ }
139
+ return best;
140
+ }
141
+ function readRequestMappingUrl(body) {
142
+ // `value = "/x"` or bare `"/x"` or `path = "/x"` or `{ "/a", "/b" }`.
143
+ const valueKw = /(?:value|path)\s*=\s*(?:"([^"]*)"|\{\s*"([^"]*)"\s*\})/.exec(body);
144
+ if (valueKw !== null)
145
+ return valueKw[1] ?? valueKw[2];
146
+ const first = /(?:^|[,\s(])(?:"([^"]*)"|\{\s*"([^"]*)"\s*\})/.exec(body);
147
+ return first?.[1] ?? first?.[2];
148
+ }
149
+ function readRequestMappingMethods(body) {
150
+ // `method = RequestMethod.GET` or `method = { RequestMethod.GET, ... }`.
151
+ const methodSection = /method\s*=\s*(?:\{([^}]*)\}|([^,)\s]+))/.exec(body);
152
+ if (methodSection === null)
153
+ return [];
154
+ const raw = methodSection[1] ?? methodSection[2] ?? "";
155
+ const out = [];
156
+ for (const m of raw.matchAll(/RequestMethod\.([A-Z]+)/g)) {
157
+ out.push(m[1]);
158
+ }
159
+ return out;
160
+ }
161
+ function annotationToVerb(annotation) {
162
+ switch (annotation) {
163
+ case "GetMapping":
164
+ return "GET";
165
+ case "PostMapping":
166
+ return "POST";
167
+ case "PutMapping":
168
+ return "PUT";
169
+ case "DeleteMapping":
170
+ return "DELETE";
171
+ case "PatchMapping":
172
+ return "PATCH";
173
+ default:
174
+ return undefined;
175
+ }
176
+ }
177
+ function normalizeUrl(u) {
178
+ if (u === "")
179
+ return "/";
180
+ return u.startsWith("/") ? u : `/${u}`;
181
+ }
182
+ function composeUrl(base, path) {
183
+ if (base === "")
184
+ return path;
185
+ const b = base.endsWith("/") ? base.slice(0, -1) : base;
186
+ const p = path === "/" ? "" : path;
187
+ const joined = `${b}${p}`;
188
+ return joined === "" ? "/" : joined;
189
+ }
190
+ //# sourceMappingURL=route-detector-java.js.map