@opensip-cli/graph-typescript 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 (344) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/_pipeline.d.ts +40 -0
  5. package/dist/__tests__/_pipeline.d.ts.map +1 -0
  6. package/dist/__tests__/_pipeline.js +67 -0
  7. package/dist/__tests__/_pipeline.js.map +1 -0
  8. package/dist/__tests__/acceptance/_fixture-runner.d.ts +13 -0
  9. package/dist/__tests__/acceptance/_fixture-runner.d.ts.map +1 -0
  10. package/dist/__tests__/acceptance/_fixture-runner.js +55 -0
  11. package/dist/__tests__/acceptance/_fixture-runner.js.map +1 -0
  12. package/dist/__tests__/acceptance/alias-resolution.test.d.ts +8 -0
  13. package/dist/__tests__/acceptance/alias-resolution.test.d.ts.map +1 -0
  14. package/dist/__tests__/acceptance/alias-resolution.test.js +39 -0
  15. package/dist/__tests__/acceptance/alias-resolution.test.js.map +1 -0
  16. package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts +8 -0
  17. package/dist/__tests__/acceptance/arrow-callback-resolution.test.d.ts.map +1 -0
  18. package/dist/__tests__/acceptance/arrow-callback-resolution.test.js +33 -0
  19. package/dist/__tests__/acceptance/arrow-callback-resolution.test.js.map +1 -0
  20. package/dist/__tests__/acceptance/constructor-calls.test.d.ts +7 -0
  21. package/dist/__tests__/acceptance/constructor-calls.test.d.ts.map +1 -0
  22. package/dist/__tests__/acceptance/constructor-calls.test.js +36 -0
  23. package/dist/__tests__/acceptance/constructor-calls.test.js.map +1 -0
  24. package/dist/__tests__/acceptance/interface-dispatch.test.d.ts +8 -0
  25. package/dist/__tests__/acceptance/interface-dispatch.test.d.ts.map +1 -0
  26. package/dist/__tests__/acceptance/interface-dispatch.test.js +44 -0
  27. package/dist/__tests__/acceptance/interface-dispatch.test.js.map +1 -0
  28. package/dist/__tests__/acceptance/inventory-completeness.test.d.ts +9 -0
  29. package/dist/__tests__/acceptance/inventory-completeness.test.d.ts.map +1 -0
  30. package/dist/__tests__/acceptance/inventory-completeness.test.js +72 -0
  31. package/dist/__tests__/acceptance/inventory-completeness.test.js.map +1 -0
  32. package/dist/__tests__/acceptance/jsx-resolution.test.d.ts +7 -0
  33. package/dist/__tests__/acceptance/jsx-resolution.test.d.ts.map +1 -0
  34. package/dist/__tests__/acceptance/jsx-resolution.test.js +46 -0
  35. package/dist/__tests__/acceptance/jsx-resolution.test.js.map +1 -0
  36. package/dist/__tests__/acceptance/module-init.test.d.ts +10 -0
  37. package/dist/__tests__/acceptance/module-init.test.d.ts.map +1 -0
  38. package/dist/__tests__/acceptance/module-init.test.js +40 -0
  39. package/dist/__tests__/acceptance/module-init.test.js.map +1 -0
  40. package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts +7 -0
  41. package/dist/__tests__/acceptance/projectdir-normalization.test.d.ts.map +1 -0
  42. package/dist/__tests__/acceptance/projectdir-normalization.test.js +51 -0
  43. package/dist/__tests__/acceptance/projectdir-normalization.test.js.map +1 -0
  44. package/dist/__tests__/body-twin-edges.test.d.ts +12 -0
  45. package/dist/__tests__/body-twin-edges.test.d.ts.map +1 -0
  46. package/dist/__tests__/body-twin-edges.test.js +85 -0
  47. package/dist/__tests__/body-twin-edges.test.js.map +1 -0
  48. package/dist/__tests__/cache-key.test.d.ts +8 -0
  49. package/dist/__tests__/cache-key.test.d.ts.map +1 -0
  50. package/dist/__tests__/cache-key.test.js +86 -0
  51. package/dist/__tests__/cache-key.test.js.map +1 -0
  52. package/dist/__tests__/depends-on-emission.test.d.ts +19 -0
  53. package/dist/__tests__/depends-on-emission.test.d.ts.map +1 -0
  54. package/dist/__tests__/depends-on-emission.test.js +165 -0
  55. package/dist/__tests__/depends-on-emission.test.js.map +1 -0
  56. package/dist/__tests__/discover.test.d.ts +9 -0
  57. package/dist/__tests__/discover.test.d.ts.map +1 -0
  58. package/dist/__tests__/discover.test.js +72 -0
  59. package/dist/__tests__/discover.test.js.map +1 -0
  60. package/dist/__tests__/edge-helpers/method-target.test.d.ts +8 -0
  61. package/dist/__tests__/edge-helpers/method-target.test.d.ts.map +1 -0
  62. package/dist/__tests__/edge-helpers/method-target.test.js +96 -0
  63. package/dist/__tests__/edge-helpers/method-target.test.js.map +1 -0
  64. package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts +13 -0
  65. package/dist/__tests__/edge-helpers/resolve-decl.test.d.ts.map +1 -0
  66. package/dist/__tests__/edge-helpers/resolve-decl.test.js +176 -0
  67. package/dist/__tests__/edge-helpers/resolve-decl.test.js.map +1 -0
  68. package/dist/__tests__/edge-resolvers/branches.test.d.ts +11 -0
  69. package/dist/__tests__/edge-resolvers/branches.test.d.ts.map +1 -0
  70. package/dist/__tests__/edge-resolvers/branches.test.js +305 -0
  71. package/dist/__tests__/edge-resolvers/branches.test.js.map +1 -0
  72. package/dist/__tests__/edge-resolvers/contract.test.d.ts +8 -0
  73. package/dist/__tests__/edge-resolvers/contract.test.d.ts.map +1 -0
  74. package/dist/__tests__/edge-resolvers/contract.test.js +30 -0
  75. package/dist/__tests__/edge-resolvers/contract.test.js.map +1 -0
  76. package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts +17 -0
  77. package/dist/__tests__/edge-resolvers/resolver-units.test.d.ts.map +1 -0
  78. package/dist/__tests__/edge-resolvers/resolver-units.test.js +286 -0
  79. package/dist/__tests__/edge-resolvers/resolver-units.test.js.map +1 -0
  80. package/dist/__tests__/fast-vs-exact.test.d.ts +16 -0
  81. package/dist/__tests__/fast-vs-exact.test.d.ts.map +1 -0
  82. package/dist/__tests__/fast-vs-exact.test.js +116 -0
  83. package/dist/__tests__/fast-vs-exact.test.js.map +1 -0
  84. package/dist/__tests__/graph-cli.test.d.ts +9 -0
  85. package/dist/__tests__/graph-cli.test.d.ts.map +1 -0
  86. package/dist/__tests__/graph-cli.test.js +417 -0
  87. package/dist/__tests__/graph-cli.test.js.map +1 -0
  88. package/dist/__tests__/heap-preflight.test.d.ts +10 -0
  89. package/dist/__tests__/heap-preflight.test.d.ts.map +1 -0
  90. package/dist/__tests__/heap-preflight.test.js +166 -0
  91. package/dist/__tests__/heap-preflight.test.js.map +1 -0
  92. package/dist/__tests__/inventory-differential.test.d.ts +15 -0
  93. package/dist/__tests__/inventory-differential.test.d.ts.map +1 -0
  94. package/dist/__tests__/inventory-differential.test.js +319 -0
  95. package/dist/__tests__/inventory-differential.test.js.map +1 -0
  96. package/dist/__tests__/inventory-helpers/hash-body.test.d.ts +11 -0
  97. package/dist/__tests__/inventory-helpers/hash-body.test.d.ts.map +1 -0
  98. package/dist/__tests__/inventory-helpers/hash-body.test.js +34 -0
  99. package/dist/__tests__/inventory-helpers/hash-body.test.js.map +1 -0
  100. package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts +9 -0
  101. package/dist/__tests__/inventory-helpers/synthesize-name.test.d.ts.map +1 -0
  102. package/dist/__tests__/inventory-helpers/synthesize-name.test.js +30 -0
  103. package/dist/__tests__/inventory-helpers/synthesize-name.test.js.map +1 -0
  104. package/dist/__tests__/inventory-property-tests.test.d.ts +24 -0
  105. package/dist/__tests__/inventory-property-tests.test.d.ts.map +1 -0
  106. package/dist/__tests__/inventory-property-tests.test.js +521 -0
  107. package/dist/__tests__/inventory-property-tests.test.js.map +1 -0
  108. package/dist/__tests__/inventory-shape-coverage.test.d.ts +16 -0
  109. package/dist/__tests__/inventory-shape-coverage.test.d.ts.map +1 -0
  110. package/dist/__tests__/inventory-shape-coverage.test.js +586 -0
  111. package/dist/__tests__/inventory-shape-coverage.test.js.map +1 -0
  112. package/dist/__tests__/inventory-visitors/contract.test.d.ts +9 -0
  113. package/dist/__tests__/inventory-visitors/contract.test.d.ts.map +1 -0
  114. package/dist/__tests__/inventory-visitors/contract.test.js +33 -0
  115. package/dist/__tests__/inventory-visitors/contract.test.js.map +1 -0
  116. package/dist/__tests__/lang-adapter-contract.test.d.ts +19 -0
  117. package/dist/__tests__/lang-adapter-contract.test.d.ts.map +1 -0
  118. package/dist/__tests__/lang-adapter-contract.test.js +880 -0
  119. package/dist/__tests__/lang-adapter-contract.test.js.map +1 -0
  120. package/dist/__tests__/lang-adapter-registry.test.d.ts +10 -0
  121. package/dist/__tests__/lang-adapter-registry.test.d.ts.map +1 -0
  122. package/dist/__tests__/lang-adapter-registry.test.js +151 -0
  123. package/dist/__tests__/lang-adapter-registry.test.js.map +1 -0
  124. package/dist/__tests__/normalize-project-dir.test.d.ts +5 -0
  125. package/dist/__tests__/normalize-project-dir.test.d.ts.map +1 -0
  126. package/dist/__tests__/normalize-project-dir.test.js +47 -0
  127. package/dist/__tests__/normalize-project-dir.test.js.map +1 -0
  128. package/dist/__tests__/orchestrate.test.d.ts +8 -0
  129. package/dist/__tests__/orchestrate.test.d.ts.map +1 -0
  130. package/dist/__tests__/orchestrate.test.js +213 -0
  131. package/dist/__tests__/orchestrate.test.js.map +1 -0
  132. package/dist/__tests__/parse-fast.test.d.ts +9 -0
  133. package/dist/__tests__/parse-fast.test.d.ts.map +1 -0
  134. package/dist/__tests__/parse-fast.test.js +114 -0
  135. package/dist/__tests__/parse-fast.test.js.map +1 -0
  136. package/dist/__tests__/rules/_helpers.d.ts +18 -0
  137. package/dist/__tests__/rules/_helpers.d.ts.map +1 -0
  138. package/dist/__tests__/rules/_helpers.js +62 -0
  139. package/dist/__tests__/rules/_helpers.js.map +1 -0
  140. package/dist/__tests__/rules/duplicated-function-body.test.d.ts +5 -0
  141. package/dist/__tests__/rules/duplicated-function-body.test.d.ts.map +1 -0
  142. package/dist/__tests__/rules/duplicated-function-body.test.js +39 -0
  143. package/dist/__tests__/rules/duplicated-function-body.test.js.map +1 -0
  144. package/dist/__tests__/rules/orphan-subtree.test.d.ts +5 -0
  145. package/dist/__tests__/rules/orphan-subtree.test.d.ts.map +1 -0
  146. package/dist/__tests__/rules/orphan-subtree.test.js +75 -0
  147. package/dist/__tests__/rules/orphan-subtree.test.js.map +1 -0
  148. package/dist/__tests__/rules/rule-hints-integration.test.d.ts +20 -0
  149. package/dist/__tests__/rules/rule-hints-integration.test.d.ts.map +1 -0
  150. package/dist/__tests__/rules/rule-hints-integration.test.js +279 -0
  151. package/dist/__tests__/rules/rule-hints-integration.test.js.map +1 -0
  152. package/dist/__tests__/tool-register.test.d.ts +16 -0
  153. package/dist/__tests__/tool-register.test.d.ts.map +1 -0
  154. package/dist/__tests__/tool-register.test.js +210 -0
  155. package/dist/__tests__/tool-register.test.js.map +1 -0
  156. package/dist/__tests__/value-reference-unit.test.d.ts +13 -0
  157. package/dist/__tests__/value-reference-unit.test.d.ts.map +1 -0
  158. package/dist/__tests__/value-reference-unit.test.js +226 -0
  159. package/dist/__tests__/value-reference-unit.test.js.map +1 -0
  160. package/dist/__tests__/value-reference.test.d.ts +15 -0
  161. package/dist/__tests__/value-reference.test.d.ts.map +1 -0
  162. package/dist/__tests__/value-reference.test.js +115 -0
  163. package/dist/__tests__/value-reference.test.js.map +1 -0
  164. package/dist/__tests__/walk-fast.test.d.ts +8 -0
  165. package/dist/__tests__/walk-fast.test.d.ts.map +1 -0
  166. package/dist/__tests__/walk-fast.test.js +51 -0
  167. package/dist/__tests__/walk-fast.test.js.map +1 -0
  168. package/dist/__tests__/walk-reexports.test.d.ts +7 -0
  169. package/dist/__tests__/walk-reexports.test.d.ts.map +1 -0
  170. package/dist/__tests__/walk-reexports.test.js +79 -0
  171. package/dist/__tests__/walk-reexports.test.js.map +1 -0
  172. package/dist/cache-key.d.ts +41 -0
  173. package/dist/cache-key.d.ts.map +1 -0
  174. package/dist/cache-key.js +94 -0
  175. package/dist/cache-key.js.map +1 -0
  176. package/dist/discover.d.ts +25 -0
  177. package/dist/discover.d.ts.map +1 -0
  178. package/dist/discover.js +124 -0
  179. package/dist/discover.js.map +1 -0
  180. package/dist/edge-helpers/cross-package-context.d.ts +34 -0
  181. package/dist/edge-helpers/cross-package-context.d.ts.map +1 -0
  182. package/dist/edge-helpers/cross-package-context.js +97 -0
  183. package/dist/edge-helpers/cross-package-context.js.map +1 -0
  184. package/dist/edge-helpers/declaration-to-node.d.ts +58 -0
  185. package/dist/edge-helpers/declaration-to-node.d.ts.map +1 -0
  186. package/dist/edge-helpers/declaration-to-node.js +93 -0
  187. package/dist/edge-helpers/declaration-to-node.js.map +1 -0
  188. package/dist/edge-helpers/find-catalog-entry.d.ts +24 -0
  189. package/dist/edge-helpers/find-catalog-entry.d.ts.map +1 -0
  190. package/dist/edge-helpers/find-catalog-entry.js +45 -0
  191. package/dist/edge-helpers/find-catalog-entry.js.map +1 -0
  192. package/dist/edge-helpers/method-target.d.ts +22 -0
  193. package/dist/edge-helpers/method-target.d.ts.map +1 -0
  194. package/dist/edge-helpers/method-target.js +46 -0
  195. package/dist/edge-helpers/method-target.js.map +1 -0
  196. package/dist/edge-helpers/resolution-trace.d.ts +24 -0
  197. package/dist/edge-helpers/resolution-trace.d.ts.map +1 -0
  198. package/dist/edge-helpers/resolution-trace.js +38 -0
  199. package/dist/edge-helpers/resolution-trace.js.map +1 -0
  200. package/dist/edge-helpers/resolve-decl.d.ts +44 -0
  201. package/dist/edge-helpers/resolve-decl.d.ts.map +1 -0
  202. package/dist/edge-helpers/resolve-decl.js +170 -0
  203. package/dist/edge-helpers/resolve-decl.js.map +1 -0
  204. package/dist/edge-helpers/unalias-symbol.d.ts +10 -0
  205. package/dist/edge-helpers/unalias-symbol.d.ts.map +1 -0
  206. package/dist/edge-helpers/unalias-symbol.js +29 -0
  207. package/dist/edge-helpers/unalias-symbol.js.map +1 -0
  208. package/dist/edge-resolvers/__tests__/boundary.test.d.ts +15 -0
  209. package/dist/edge-resolvers/__tests__/boundary.test.d.ts.map +1 -0
  210. package/dist/edge-resolvers/__tests__/boundary.test.js +227 -0
  211. package/dist/edge-resolvers/__tests__/boundary.test.js.map +1 -0
  212. package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts +10 -0
  213. package/dist/edge-resolvers/__tests__/callee-anchor.test.d.ts.map +1 -0
  214. package/dist/edge-resolvers/__tests__/callee-anchor.test.js +63 -0
  215. package/dist/edge-resolvers/__tests__/callee-anchor.test.js.map +1 -0
  216. package/dist/edge-resolvers/__tests__/syntactic.test.d.ts +12 -0
  217. package/dist/edge-resolvers/__tests__/syntactic.test.d.ts.map +1 -0
  218. package/dist/edge-resolvers/__tests__/syntactic.test.js +215 -0
  219. package/dist/edge-resolvers/__tests__/syntactic.test.js.map +1 -0
  220. package/dist/edge-resolvers/boundary.d.ts +41 -0
  221. package/dist/edge-resolvers/boundary.d.ts.map +1 -0
  222. package/dist/edge-resolvers/boundary.js +130 -0
  223. package/dist/edge-resolvers/boundary.js.map +1 -0
  224. package/dist/edge-resolvers/catalog-fallback.d.ts +13 -0
  225. package/dist/edge-resolvers/catalog-fallback.d.ts.map +1 -0
  226. package/dist/edge-resolvers/catalog-fallback.js +30 -0
  227. package/dist/edge-resolvers/catalog-fallback.js.map +1 -0
  228. package/dist/edge-resolvers/direct-call.d.ts +10 -0
  229. package/dist/edge-resolvers/direct-call.d.ts.map +1 -0
  230. package/dist/edge-resolvers/direct-call.js +45 -0
  231. package/dist/edge-resolvers/direct-call.js.map +1 -0
  232. package/dist/edge-resolvers/jsx-element.d.ts +16 -0
  233. package/dist/edge-resolvers/jsx-element.d.ts.map +1 -0
  234. package/dist/edge-resolvers/jsx-element.js +67 -0
  235. package/dist/edge-resolvers/jsx-element.js.map +1 -0
  236. package/dist/edge-resolvers/new-expression.d.ts +11 -0
  237. package/dist/edge-resolvers/new-expression.d.ts.map +1 -0
  238. package/dist/edge-resolvers/new-expression.js +56 -0
  239. package/dist/edge-resolvers/new-expression.js.map +1 -0
  240. package/dist/edge-resolvers/polymorphic.d.ts +8 -0
  241. package/dist/edge-resolvers/polymorphic.d.ts.map +1 -0
  242. package/dist/edge-resolvers/polymorphic.js +57 -0
  243. package/dist/edge-resolvers/polymorphic.js.map +1 -0
  244. package/dist/edge-resolvers/property-access.d.ts +10 -0
  245. package/dist/edge-resolvers/property-access.d.ts.map +1 -0
  246. package/dist/edge-resolvers/property-access.js +56 -0
  247. package/dist/edge-resolvers/property-access.js.map +1 -0
  248. package/dist/edge-resolvers/syntactic.d.ts +105 -0
  249. package/dist/edge-resolvers/syntactic.d.ts.map +1 -0
  250. package/dist/edge-resolvers/syntactic.js +294 -0
  251. package/dist/edge-resolvers/syntactic.js.map +1 -0
  252. package/dist/edge-resolvers/types.d.ts +37 -0
  253. package/dist/edge-resolvers/types.d.ts.map +1 -0
  254. package/dist/edge-resolvers/types.js +10 -0
  255. package/dist/edge-resolvers/types.js.map +1 -0
  256. package/dist/edges-value-reference.d.ts +26 -0
  257. package/dist/edges-value-reference.d.ts.map +1 -0
  258. package/dist/edges-value-reference.js +138 -0
  259. package/dist/edges-value-reference.js.map +1 -0
  260. package/dist/edges.d.ts +65 -0
  261. package/dist/edges.d.ts.map +1 -0
  262. package/dist/edges.js +392 -0
  263. package/dist/edges.js.map +1 -0
  264. package/dist/index.d.ts +47 -0
  265. package/dist/index.d.ts.map +1 -0
  266. package/dist/index.js +346 -0
  267. package/dist/index.js.map +1 -0
  268. package/dist/inventory-helpers/classify-visibility.d.ts +13 -0
  269. package/dist/inventory-helpers/classify-visibility.d.ts.map +1 -0
  270. package/dist/inventory-helpers/classify-visibility.js +56 -0
  271. package/dist/inventory-helpers/classify-visibility.js.map +1 -0
  272. package/dist/inventory-helpers/extract-decorators.d.ts +6 -0
  273. package/dist/inventory-helpers/extract-decorators.d.ts.map +1 -0
  274. package/dist/inventory-helpers/extract-decorators.js +33 -0
  275. package/dist/inventory-helpers/extract-decorators.js.map +1 -0
  276. package/dist/inventory-helpers/extract-params.d.ts +7 -0
  277. package/dist/inventory-helpers/extract-params.d.ts.map +1 -0
  278. package/dist/inventory-helpers/extract-params.js +28 -0
  279. package/dist/inventory-helpers/extract-params.js.map +1 -0
  280. package/dist/inventory-helpers/hash-body.d.ts +43 -0
  281. package/dist/inventory-helpers/hash-body.d.ts.map +1 -0
  282. package/dist/inventory-helpers/hash-body.js +52 -0
  283. package/dist/inventory-helpers/hash-body.js.map +1 -0
  284. package/dist/inventory-helpers/synthesize-name.d.ts +16 -0
  285. package/dist/inventory-helpers/synthesize-name.d.ts.map +1 -0
  286. package/dist/inventory-helpers/synthesize-name.js +17 -0
  287. package/dist/inventory-helpers/synthesize-name.js.map +1 -0
  288. package/dist/inventory-visitors/arrow-function.d.ts +8 -0
  289. package/dist/inventory-visitors/arrow-function.d.ts.map +1 -0
  290. package/dist/inventory-visitors/arrow-function.js +55 -0
  291. package/dist/inventory-visitors/arrow-function.js.map +1 -0
  292. package/dist/inventory-visitors/class-static-init.d.ts +17 -0
  293. package/dist/inventory-visitors/class-static-init.d.ts.map +1 -0
  294. package/dist/inventory-visitors/class-static-init.js +45 -0
  295. package/dist/inventory-visitors/class-static-init.js.map +1 -0
  296. package/dist/inventory-visitors/constructor-declaration.d.ts +7 -0
  297. package/dist/inventory-visitors/constructor-declaration.d.ts.map +1 -0
  298. package/dist/inventory-visitors/constructor-declaration.js +47 -0
  299. package/dist/inventory-visitors/constructor-declaration.js.map +1 -0
  300. package/dist/inventory-visitors/function-declaration.d.ts +7 -0
  301. package/dist/inventory-visitors/function-declaration.d.ts.map +1 -0
  302. package/dist/inventory-visitors/function-declaration.js +59 -0
  303. package/dist/inventory-visitors/function-declaration.js.map +1 -0
  304. package/dist/inventory-visitors/function-expression.d.ts +7 -0
  305. package/dist/inventory-visitors/function-expression.d.ts.map +1 -0
  306. package/dist/inventory-visitors/function-expression.js +56 -0
  307. package/dist/inventory-visitors/function-expression.js.map +1 -0
  308. package/dist/inventory-visitors/getter-setter.d.ts +7 -0
  309. package/dist/inventory-visitors/getter-setter.d.ts.map +1 -0
  310. package/dist/inventory-visitors/getter-setter.js +63 -0
  311. package/dist/inventory-visitors/getter-setter.js.map +1 -0
  312. package/dist/inventory-visitors/method-declaration.d.ts +7 -0
  313. package/dist/inventory-visitors/method-declaration.d.ts.map +1 -0
  314. package/dist/inventory-visitors/method-declaration.js +75 -0
  315. package/dist/inventory-visitors/method-declaration.js.map +1 -0
  316. package/dist/inventory-visitors/module-init.d.ts +15 -0
  317. package/dist/inventory-visitors/module-init.d.ts.map +1 -0
  318. package/dist/inventory-visitors/module-init.js +40 -0
  319. package/dist/inventory-visitors/module-init.js.map +1 -0
  320. package/dist/inventory-visitors/types.d.ts +26 -0
  321. package/dist/inventory-visitors/types.d.ts.map +1 -0
  322. package/dist/inventory-visitors/types.js +14 -0
  323. package/dist/inventory-visitors/types.js.map +1 -0
  324. package/dist/normalize-project-dir.d.ts +14 -0
  325. package/dist/normalize-project-dir.d.ts.map +1 -0
  326. package/dist/normalize-project-dir.js +36 -0
  327. package/dist/normalize-project-dir.js.map +1 -0
  328. package/dist/parse-fast.d.ts +41 -0
  329. package/dist/parse-fast.d.ts.map +1 -0
  330. package/dist/parse-fast.js +91 -0
  331. package/dist/parse-fast.js.map +1 -0
  332. package/dist/parse.d.ts +42 -0
  333. package/dist/parse.d.ts.map +1 -0
  334. package/dist/parse.js +75 -0
  335. package/dist/parse.js.map +1 -0
  336. package/dist/test-file.d.ts +7 -0
  337. package/dist/test-file.d.ts.map +1 -0
  338. package/dist/test-file.js +42 -0
  339. package/dist/test-file.js.map +1 -0
  340. package/dist/walk.d.ts +125 -0
  341. package/dist/walk.d.ts.map +1 -0
  342. package/dist/walk.js +393 -0
  343. package/dist/walk.js.map +1 -0
  344. package/package.json +57 -0
package/dist/index.js ADDED
@@ -0,0 +1,346 @@
1
+ // @fitness-ignore-file unbounded-memory -- reads single source files for parsing; per-file memory bounded by source size
2
+ /**
3
+ * @opensip-cli/graph — TypeScript language adapter.
4
+ *
5
+ * Lands in PR 3 of plan docs/plans/10-graph-language-pluggability.md.
6
+ * Exposes `typescriptGraphAdapter`, the GraphLanguageAdapter
7
+ * implementation that wraps the existing TypeScript-specific
8
+ * walk/discover/edges machinery into the contract surface defined
9
+ * by `lang-adapter/types.ts`.
10
+ *
11
+ * The contract surface is intentionally small (six methods); each
12
+ * one delegates to the TypeScript-specific implementation and
13
+ * translates I/O shapes:
14
+ *
15
+ * discoverFiles → ./discover.ts:discoverFiles
16
+ * parseProject → ./parse.ts:parseProject
17
+ * walkProject → ./walk.ts:walkProgram, with CallSiteRecord
18
+ * translation (node/sourceFile → nodeRef/sourceFileRef)
19
+ * resolveCallSites → ./edges.ts:resolveEdgesFromRecords
20
+ * cacheKey → ./cache-key.ts:cacheKey
21
+ * ruleHints → starter list of side-effect primitives + the
22
+ * `isTestFile` predicate previously inlined in walk.ts
23
+ *
24
+ * Files outside this subtree are forbidden from importing the
25
+ * TypeScript compiler API directly; the dep-cruiser rule
26
+ * `graph-no-typescript-import-outside-lang-typescript` enforces it.
27
+ */
28
+ import { relative, sep } from 'node:path';
29
+ import { ownerEdgeKey } from '@opensip-cli/graph';
30
+ import ts from 'typescript';
31
+ import { cacheKey as typescriptCacheKey } from './cache-key.js';
32
+ import { discoverFiles as discoverTypescriptFiles } from './discover.js';
33
+ import { methodTargetFile } from './edge-helpers/method-target.js';
34
+ import { extractBoundaryCalls } from './edge-resolvers/boundary.js';
35
+ import { resolveEdgesFromRecords, resolveEdgesSyntactic } from './edges.js';
36
+ import { parseProject as parseTypescriptProject } from './parse.js';
37
+ import { isTypescriptTestFile } from './test-file.js';
38
+ import { walkProgram } from './walk.js';
39
+ /**
40
+ * Starter list of well-known side-effect primitives for the
41
+ * no-side-effect-path rule. Names are textual prefixes a developer
42
+ * would actually write (e.g. `console.log(`).
43
+ *
44
+ * Conservative: high-precision, low-recall. Adapter authors may
45
+ * extend over time as the rule shows false negatives in practice.
46
+ */
47
+ const TYPESCRIPT_SIDE_EFFECT_PRIMITIVES = [
48
+ 'console.log',
49
+ 'console.error',
50
+ 'console.warn',
51
+ 'console.info',
52
+ 'console.debug',
53
+ 'fs.writeFileSync',
54
+ 'fs.appendFileSync',
55
+ 'fs.unlinkSync',
56
+ 'fs.mkdirSync',
57
+ 'fs.rmSync',
58
+ 'fs.renameSync',
59
+ 'process.exit',
60
+ 'process.kill',
61
+ 'process.stdout.write',
62
+ 'process.stderr.write',
63
+ 'Math.random',
64
+ 'Date.now',
65
+ ];
66
+ const THROW_SYNTAX_REGEX = /\bthrow\s+(?:new\s+)?[A-Za-z_$]/;
67
+ // ── Adapter façade ─────────────────────────────────────────────────
68
+ function discoverFilesAdapter(input) {
69
+ const result = discoverTypescriptFiles({
70
+ projectDir: input.cwd,
71
+ tsConfigPath: input.configPathOverride,
72
+ });
73
+ return {
74
+ projectDirAbs: result.projectDirAbs,
75
+ files: result.files,
76
+ configPathAbs: result.tsConfigPathAbs,
77
+ compilerOptions: result.compilerOptions,
78
+ };
79
+ }
80
+ /**
81
+ * Yield the project's source files from either parsed-project tier. The
82
+ * walk is structural and mode-agnostic, so it consumes whichever shape
83
+ * the parse stage produced: exact mode pulls them from the `ts.Program`;
84
+ * fast mode pulls them from the standalone source-file map.
85
+ */
86
+ function sourceFilesOf(project) {
87
+ return project.kind === 'fast' ? project.sourceFiles.values() : project.program.getSourceFiles();
88
+ }
89
+ function walkProjectAdapter(input) {
90
+ const walked = walkProgram({
91
+ sourceFiles: sourceFilesOf(input.project),
92
+ files: input.files,
93
+ projectDirAbs: input.projectDirAbs,
94
+ });
95
+ // Translate the TS-internal CallSiteRecord (node/sourceFile) into the
96
+ // contract's opaque shape (nodeRef/sourceFileRef). No data loss —
97
+ // the same handles flow back into resolveCallSites unchanged.
98
+ const callSites = walked.callSites.map((r) => ({
99
+ nodeRef: r.node,
100
+ sourceFileRef: r.sourceFile,
101
+ ownerHash: r.ownerHash,
102
+ kind: r.kind,
103
+ childHash: r.childHash,
104
+ }));
105
+ const dependencySites = walked.dependencySites.map((r) => ({
106
+ nodeRef: r.node,
107
+ sourceFileRef: r.sourceFile,
108
+ ownerHash: r.ownerHash,
109
+ specifier: r.specifier,
110
+ line: r.line,
111
+ column: r.column,
112
+ }));
113
+ return {
114
+ occurrences: walked.functions,
115
+ callSites,
116
+ dependencySites,
117
+ // Re-export facts are pure data (no AST handles) — passed straight through.
118
+ reExports: walked.reExports,
119
+ parseErrors: walked.parseErrors,
120
+ };
121
+ }
122
+ /**
123
+ * Translate the contract's opaque CallSiteRecord (nodeRef/sourceFileRef)
124
+ * back into the TS-internal shape (real ts.Node / ts.SourceFile handles)
125
+ * that the resolvers and the boundary extractor consume.
126
+ */
127
+ function toTsCallSites(callSites) {
128
+ return callSites.map((r) => ({
129
+ node: r.nodeRef,
130
+ sourceFile: r.sourceFileRef,
131
+ ownerHash: r.ownerHash,
132
+ kind: r.kind,
133
+ childHash: r.childHash,
134
+ }));
135
+ }
136
+ async function resolveCallSitesAdapter(input) {
137
+ // Branch on the parsed-project tier BEFORE touching the checker. The
138
+ // fast tier has no `ts.Program`, so the exact (checker-backed) resolver
139
+ // cannot run on it.
140
+ const base = input.project.kind === 'fast'
141
+ ? await resolveCallSitesFast(input, input.project)
142
+ : await resolveCallSitesExact(input, input.project);
143
+ // Sharded build: also emit cross-boundary descriptors for calls that
144
+ // didn't land within this shard's own occurrences. Syntactic and
145
+ // mode-independent, so it runs identically for both tiers.
146
+ if (input.emitBoundaryCalls !== true)
147
+ return base;
148
+ // Cross-package METHOD calls need a TYPE-attested target file — supply a
149
+ // checker-backed resolver on the exact tier. The fast tier has no `ts.Program`,
150
+ // so method boundary calls are exact-tier only (the equivalence gate runs in
151
+ // exact mode); imported-function boundary calls stay tier-independent.
152
+ let resolveMethodTarget;
153
+ if (input.project.kind !== 'fast') {
154
+ const checker = input.project.program.getTypeChecker();
155
+ resolveMethodTarget = (node) => methodTargetFile(node, checker, input.projectDirAbs);
156
+ }
157
+ const boundaryCalls = extractBoundaryCalls(toTsCallSites(input.callSites), base.edgesByOwner, input.projectDirAbs, resolveMethodTarget);
158
+ return { ...base, boundaryCalls };
159
+ }
160
+ async function resolveCallSitesExact(input, project) {
161
+ const tsCallSites = toTsCallSites(input.callSites);
162
+ const result = await resolveEdgesFromRecords({
163
+ catalog: input.catalog,
164
+ program: project.program,
165
+ projectDirAbs: input.projectDirAbs,
166
+ callSites: tsCallSites,
167
+ });
168
+ // Phase 4 (DEC-498): resolve dependency sites if any. Translate
169
+ // back to the TS-specific shape (with real ts.Node handles) and
170
+ // run module resolution.
171
+ const dependenciesByOwner = input.dependencySites && input.dependencySites.length > 0
172
+ ? resolveDependencies(input.dependencySites.map((r) => ({
173
+ node: r.nodeRef,
174
+ sourceFile: r.sourceFileRef,
175
+ ownerHash: r.ownerHash,
176
+ specifier: r.specifier,
177
+ line: r.line,
178
+ column: r.column,
179
+ })), input.catalog, project.program, input.projectDirAbs)
180
+ : undefined;
181
+ return {
182
+ edgesByOwner: collectByOwner(result.catalog),
183
+ dependenciesByOwner,
184
+ stats: result.resolutionStats,
185
+ };
186
+ }
187
+ /**
188
+ * Fast-tier resolution entry. Resolves call edges syntactically — from
189
+ * callee names and the file's import graph — with NO type checker. The
190
+ * fast parse produced standalone source files (no `ts.Program`), so the
191
+ * semantic resolvers cannot run; `resolveEdgesSyntactic` works purely off
192
+ * the walked records and the catalog.
193
+ *
194
+ * Dependency (module-level import) edges are not emitted in fast mode —
195
+ * they remain an exact-tier feature, so `dependenciesByOwner` is omitted
196
+ * (the contract treats absence as "not emitted by this tier").
197
+ */
198
+ async function resolveCallSitesFast(input, _project) {
199
+ const tsCallSites = toTsCallSites(input.callSites);
200
+ const result = await resolveEdgesSyntactic({
201
+ catalog: input.catalog,
202
+ projectDirAbs: input.projectDirAbs,
203
+ callSites: tsCallSites,
204
+ });
205
+ return {
206
+ edgesByOwner: collectByOwner(result.catalog),
207
+ stats: result.resolutionStats,
208
+ };
209
+ }
210
+ /**
211
+ * Build filePath → module-init bodyHash map from the catalog. Catalog
212
+ * occurrences carry project-relative filePath; only `module-init` kind
213
+ * occurrences participate (they're the receiver of import edges).
214
+ */
215
+ function buildModuleInitIndex(catalog) {
216
+ const index = new Map();
217
+ for (const occs of Object.values(catalog.functions)) {
218
+ if (!occs)
219
+ continue;
220
+ for (const o of occs) {
221
+ if (o.kind === 'module-init') {
222
+ index.set(o.filePath, o.bodyHash);
223
+ }
224
+ }
225
+ }
226
+ return index;
227
+ }
228
+ /**
229
+ * Wrap `ts.sys` into a `ModuleResolutionHost`. Methods are bound
230
+ * through arrow functions to satisfy `@typescript-eslint/unbound-method`
231
+ * (arrow `this` is lexical / void). `useCaseSensitiveFileNames` is a
232
+ * boolean property on modern `ts.sys` — the function-vs-boolean branch
233
+ * in earlier code was unreachable dead-code (both branches returned the
234
+ * same value).
235
+ */
236
+ function createModuleResolutionHost() {
237
+ return {
238
+ fileExists: (fileName) => ts.sys.fileExists(fileName),
239
+ readFile: (fileName, encoding) => ts.sys.readFile(fileName, encoding),
240
+ directoryExists: (directoryName) => ts.sys.directoryExists(directoryName),
241
+ getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
242
+ getDirectories: (path) => ts.sys.getDirectories(path),
243
+ useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
244
+ };
245
+ }
246
+ /**
247
+ * Resolve a single import site to its target module-init bodyHash(es).
248
+ * Returns the empty array if the module resolves outside the catalog
249
+ * (e.g. external package, `.d.ts` declaration file) or fails to resolve
250
+ * at all — both treated as unresolved by downstream attribution.
251
+ */
252
+ function resolveSiteTargets(site, compilerOptions, moduleResolutionHost, projectDirAbs, moduleInitByFilePath) {
253
+ const resolution = ts.resolveModuleName(site.specifier, site.sourceFile.fileName, compilerOptions, moduleResolutionHost);
254
+ if (resolution.resolvedModule === undefined)
255
+ return [];
256
+ // Convert absolute resolved path → project-relative POSIX path
257
+ const projectRel = relative(projectDirAbs, resolution.resolvedModule.resolvedFileName)
258
+ .split(sep)
259
+ .join('/');
260
+ const targetHash = moduleInitByFilePath.get(projectRel);
261
+ return targetHash === undefined ? [] : [targetHash];
262
+ }
263
+ /**
264
+ * Resolve TS import sites to target module-init bodyHashes. Imports
265
+ * resolving to a same-project source file map to that file's
266
+ * module-init occurrence; imports resolving to an external package or
267
+ * a `.d.ts` declaration file (outside the catalog) produce unresolved
268
+ * `DependencyEdge` entries with `to: []` and the raw specifier carried
269
+ * in `specifier` for downstream attribution.
270
+ *
271
+ * Phase 4 of opensip's substrate consolidation (DEC-498).
272
+ */
273
+ function resolveDependencies(sites, catalog, program, projectDirAbs) {
274
+ const moduleInitByFilePath = buildModuleInitIndex(catalog);
275
+ const compilerOptions = program.getCompilerOptions();
276
+ const moduleResolutionHost = createModuleResolutionHost();
277
+ const out = new Map();
278
+ for (const site of sites) {
279
+ const to = resolveSiteTargets(site, compilerOptions, moduleResolutionHost, projectDirAbs, moduleInitByFilePath);
280
+ const edge = {
281
+ to,
282
+ line: site.line,
283
+ column: site.column,
284
+ specifier: site.specifier,
285
+ };
286
+ // Key per owner OCCURRENCE (module-init bodyHash + file) to match
287
+ // stitchEdges; module-init bodies can collide across trivial files.
288
+ const ownerKey = ownerEdgeKey(site.ownerHash, relative(projectDirAbs, site.sourceFile.fileName));
289
+ const existing = out.get(ownerKey);
290
+ if (existing === undefined) {
291
+ out.set(ownerKey, [edge]);
292
+ }
293
+ else {
294
+ existing.push(edge);
295
+ }
296
+ }
297
+ return out;
298
+ }
299
+ /**
300
+ * Build the `bodyHash → CallEdge[]` map the contract returns.
301
+ * `resolveEdgesFromRecords` writes edges onto a rebuilt catalog; the
302
+ * contract surface separates resolution from catalog mutation, so the
303
+ * orchestrator can stitch the edges into whatever catalog shape it owns.
304
+ */
305
+ function collectByOwner(catalog) {
306
+ const out = new Map();
307
+ for (const arr of Object.values(catalog.functions)) {
308
+ if (!arr)
309
+ continue;
310
+ for (const o of arr) {
311
+ if (o.calls.length === 0)
312
+ continue;
313
+ out.set(ownerEdgeKey(o.bodyHash, o.filePath), o.calls);
314
+ }
315
+ }
316
+ return out;
317
+ }
318
+ export const typescriptGraphAdapter = {
319
+ id: 'typescript',
320
+ fileExtensions: ['.ts', '.tsx'],
321
+ displayName: 'TypeScript',
322
+ discoverFiles: discoverFilesAdapter,
323
+ parseProject: (input) => parseTypescriptProject(input),
324
+ walkProject: walkProjectAdapter,
325
+ resolveCallSites: resolveCallSitesAdapter,
326
+ cacheKey: typescriptCacheKey,
327
+ ruleHints: {
328
+ isTestFile: isTypescriptTestFile,
329
+ sideEffectPrimitives: TYPESCRIPT_SIDE_EFFECT_PRIMITIVES,
330
+ throwSyntaxRegex: THROW_SYNTAX_REGEX,
331
+ },
332
+ };
333
+ /**
334
+ * Discovery contract: external adapter packs export `adapter` (the
335
+ * GraphLanguageAdapter) and `metadata` (a small descriptor used by
336
+ * the CLI for diagnostics). The CLI bootstrap registers `adapter` into
337
+ * the adapter registry after a successful `import()`.
338
+ */
339
+ export { typescriptGraphAdapter as adapter };
340
+ export const metadata = {
341
+ id: typescriptGraphAdapter.id,
342
+ displayName: typescriptGraphAdapter.displayName,
343
+ fileExtensions: typescriptGraphAdapter.fileExtensions,
344
+ };
345
+ export { isTypescriptTestFile } from './test-file.js';
346
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAA6B,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;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;CACF,CAAC;AAEF;;;;;GAKG;AACH,OAAO,EAAE,sBAAsB,IAAI,OAAO,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,EAAE,EAAE,sBAAsB,CAAC,EAAE;IAC7B,WAAW,EAAE,sBAAsB,CAAC,WAAW;IAC/C,cAAc,EAAE,sBAAsB,CAAC,cAAc;CAC7C,CAAC;AAQX,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Classify a function/method's visibility — exported, module-local, private.
3
+ */
4
+ import ts from 'typescript';
5
+ import type { Visibility } from '@opensip-cli/graph';
6
+ /**
7
+ * For a top-level function/variable: 'exported' if it has the export
8
+ * modifier (or is part of an export specifier); 'module-local'
9
+ * otherwise. Class members default to module-local unless explicitly
10
+ * private.
11
+ */
12
+ export declare function classifyVisibility(node: ts.Node): Visibility;
13
+ //# sourceMappingURL=classify-visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify-visibility.d.ts","sourceRoot":"","sources":["../../src/inventory-helpers/classify-visibility.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CAK5D"}
@@ -0,0 +1,56 @@
1
+ // @fitness-ignore-file batch-operation-limits -- iterates bounded collection (modifiers + export specifiers on a single declaration)
2
+ /**
3
+ * Classify a function/method's visibility — exported, module-local, private.
4
+ */
5
+ import ts from 'typescript';
6
+ /**
7
+ * For a top-level function/variable: 'exported' if it has the export
8
+ * modifier (or is part of an export specifier); 'module-local'
9
+ * otherwise. Class members default to module-local unless explicitly
10
+ * private.
11
+ */
12
+ export function classifyVisibility(node) {
13
+ const direct = directVisibility(node);
14
+ if (direct !== null)
15
+ return direct;
16
+ if (parentIsExportedVariableStatement(node))
17
+ return 'exported';
18
+ return 'module-local';
19
+ }
20
+ function directVisibility(node) {
21
+ /* v8 ignore next */
22
+ if (!ts.canHaveModifiers(node))
23
+ return null;
24
+ const modifiers = ts.getModifiers(node);
25
+ if (!modifiers)
26
+ return null;
27
+ for (const m of modifiers) {
28
+ if (m.kind === ts.SyntaxKind.PrivateKeyword)
29
+ return 'private';
30
+ if (m.kind === ts.SyntaxKind.ExportKeyword)
31
+ return 'exported';
32
+ }
33
+ return null;
34
+ }
35
+ function parentIsExportedVariableStatement(node) {
36
+ // Walk up to a VariableStatement and look for `export` modifier (handles
37
+ // `export const foo = () => {}`).
38
+ let parent = node.parent;
39
+ while (parent) {
40
+ if (ts.isVariableStatement(parent)) {
41
+ return hasExportModifier(parent);
42
+ }
43
+ // @fitness-ignore-next-line silent-early-returns -- boolean predicate (`parentIs…`): `false` IS the contract value meaning "no enclosing exported variable statement found"; the caller treats it as a normal classification result.
44
+ if (ts.isClassDeclaration(parent) || ts.isFunctionDeclaration(parent))
45
+ return false;
46
+ parent = parent.parent;
47
+ }
48
+ return false;
49
+ }
50
+ function hasExportModifier(node) {
51
+ const mods = ts.getModifiers(node);
52
+ if (!mods)
53
+ return false;
54
+ return mods.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
55
+ }
56
+ //# sourceMappingURL=classify-visibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify-visibility.js","sourceRoot":"","sources":["../../src/inventory-helpers/classify-visibility.ts"],"names":[],"mappings":"AAAA,qIAAqI;AACrI;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,iCAAiC,CAAC,IAA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,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract decorator names from a TS class-member or class node.
3
+ */
4
+ import ts from 'typescript';
5
+ export declare function extractDecorators(node: ts.Node): readonly string[];
6
+ //# sourceMappingURL=extract-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-decorators.d.ts","sourceRoot":"","sources":["../../src/inventory-helpers/extract-decorators.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,MAAM,EAAE,CAUlE"}
@@ -0,0 +1,33 @@
1
+ // @fitness-ignore-file batch-operation-limits -- iterates bounded collection (decorators on a single class member; small N by language spec)
2
+ /**
3
+ * Extract decorator names from a TS class-member or class node.
4
+ */
5
+ import ts from 'typescript';
6
+ /* v8 ignore start */
7
+ export function extractDecorators(node) {
8
+ const out = [];
9
+ // ts.canHaveDecorators is the modern accessor; fall back to legacy decorators on older AST shapes.
10
+ const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined;
11
+ if (decorators) {
12
+ for (const d of decorators) {
13
+ out.push(decoratorName(d));
14
+ }
15
+ }
16
+ return out;
17
+ }
18
+ function decoratorName(d) {
19
+ const expr = d.expression;
20
+ if (ts.isCallExpression(expr)) {
21
+ return expressionName(expr.expression);
22
+ }
23
+ return expressionName(expr);
24
+ }
25
+ function expressionName(expr) {
26
+ if (ts.isIdentifier(expr))
27
+ return expr.text;
28
+ if (ts.isPropertyAccessExpression(expr))
29
+ return expr.name.text;
30
+ return expr.getText();
31
+ }
32
+ /* v8 ignore stop */
33
+ //# sourceMappingURL=extract-decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-decorators.js","sourceRoot":"","sources":["../../src/inventory-helpers/extract-decorators.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,qBAAqB;AACrB,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,mGAAmG;IACnG,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,CAAe;IACpC,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC;IAC1B,IAAI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,cAAc,CAAC,IAAmB;IACzC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC5C,IAAI,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;AACxB,CAAC;AACD,oBAAoB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Extract Param[] from a TS function-shaped node.
3
+ */
4
+ import ts from 'typescript';
5
+ import type { Param } from '@opensip-cli/graph';
6
+ export declare function extractParams(node: ts.SignatureDeclaration | ts.FunctionLikeDeclaration): readonly Param[];
7
+ //# sourceMappingURL=extract-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-params.d.ts","sourceRoot":"","sources":["../../src/inventory-helpers/extract-params.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,oBAAoB,GAAG,EAAE,CAAC,uBAAuB,GACzD,SAAS,KAAK,EAAE,CAUlB"}
@@ -0,0 +1,28 @@
1
+ // @fitness-ignore-file batch-operation-limits -- iterates bounded collection (parameters on a single function declaration)
2
+ /**
3
+ * Extract Param[] from a TS function-shaped node.
4
+ */
5
+ import ts from 'typescript';
6
+ export function extractParams(node) {
7
+ const params = [];
8
+ for (const p of node.parameters) {
9
+ params.push({
10
+ name: extractName(p.name),
11
+ optional: p.questionToken !== undefined || p.initializer !== undefined,
12
+ rest: p.dotDotDotToken !== undefined,
13
+ });
14
+ }
15
+ return params;
16
+ }
17
+ /* v8 ignore start */
18
+ function extractName(name) {
19
+ if (ts.isIdentifier(name))
20
+ return name.text;
21
+ if (ts.isObjectBindingPattern(name))
22
+ return '{...}';
23
+ if (ts.isArrayBindingPattern(name))
24
+ return '[...]';
25
+ return '<param>';
26
+ }
27
+ /* v8 ignore stop */
28
+ //# sourceMappingURL=extract-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-params.js","sourceRoot":"","sources":["../../src/inventory-helpers/extract-params.ts"],"names":[],"mappings":"AAAA,2HAA2H;AAC3H;;GAEG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,MAAM,UAAU,aAAa,CAC3B,IAA0D;IAE1D,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;YACzB,QAAQ,EAAE,CAAC,CAAC,aAAa,KAAK,SAAS,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS;YACtE,IAAI,EAAE,CAAC,CAAC,cAAc,KAAK,SAAS;SACrC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qBAAqB;AACrB,SAAS,WAAW,CAAC,IAAoB;IACvC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC5C,IAAI,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IACpD,IAAI,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IACnD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,oBAAoB"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * hashFunctionBody — content-keyed identity for a function declaration.
3
+ *
4
+ * Used by stage 1 (catalog construction) and stage 2
5
+ * (find-catalog-entry) and cache invalidation. Per spec §2.2 / DRY-2:
6
+ * "same body in two files → same hash; body changed by one character →
7
+ * new hash."
8
+ */
9
+ import type ts from 'typescript';
10
+ /**
11
+ * Result of normalizing + hashing a function body. `size` is the
12
+ * length of the normalized text in characters; rules use it to skip
13
+ * trivial wrappers whose duplication is structural, not actionable.
14
+ */
15
+ export interface BodyDigest {
16
+ readonly hash: string;
17
+ readonly size: number;
18
+ }
19
+ /**
20
+ * Compute the bodyHash for a function-shaped node (declaration,
21
+ * expression, arrow, method, etc.). The text is normalized — comments
22
+ * stripped, whitespace collapsed — so cosmetic edits don't churn the
23
+ * hash.
24
+ */
25
+ export declare function hashFunctionBody(node: ts.Node, sourceFile: ts.SourceFile): string;
26
+ /**
27
+ * Like `hashFunctionBody`, but also returns the normalized size.
28
+ *
29
+ * Uses `sourceFile.text.slice(...)` instead of `node.getText(sourceFile)`
30
+ * to avoid the per-call AST walk that materializes a fresh string.
31
+ * V8 implements substring as a slice into the parent string when the
32
+ * source buffer is large, so this is also lower-allocation. The two
33
+ * paths produce identical content for the same node (both span from
34
+ * `getStart()` to `getEnd()`).
35
+ */
36
+ export declare function digestFunctionBody(node: ts.Node, sourceFile: ts.SourceFile): BodyDigest;
37
+ /**
38
+ * Hash a synthetic body string (used by module-init.ts which
39
+ * synthesizes a body from top-level statements).
40
+ */
41
+ export declare function hashSyntheticBody(input: string): string;
42
+ export declare function digestSyntheticBody(input: string): BodyDigest;
43
+ //# sourceMappingURL=hash-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-body.d.ts","sourceRoot":"","sources":["../../src/inventory-helpers/hash-body.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,MAAM,CAEjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,UAAU,CAIvF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAG7D"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * hashFunctionBody — content-keyed identity for a function declaration.
3
+ *
4
+ * Used by stage 1 (catalog construction) and stage 2
5
+ * (find-catalog-entry) and cache invalidation. Per spec §2.2 / DRY-2:
6
+ * "same body in two files → same hash; body changed by one character →
7
+ * new hash."
8
+ */
9
+ import { createHash } from 'node:crypto';
10
+ import { stripComments } from '@opensip-cli/lang-typescript';
11
+ /**
12
+ * Compute the bodyHash for a function-shaped node (declaration,
13
+ * expression, arrow, method, etc.). The text is normalized — comments
14
+ * stripped, whitespace collapsed — so cosmetic edits don't churn the
15
+ * hash.
16
+ */
17
+ export function hashFunctionBody(node, sourceFile) {
18
+ return digestFunctionBody(node, sourceFile).hash;
19
+ }
20
+ /**
21
+ * Like `hashFunctionBody`, but also returns the normalized size.
22
+ *
23
+ * Uses `sourceFile.text.slice(...)` instead of `node.getText(sourceFile)`
24
+ * to avoid the per-call AST walk that materializes a fresh string.
25
+ * V8 implements substring as a slice into the parent string when the
26
+ * source buffer is large, so this is also lower-allocation. The two
27
+ * paths produce identical content for the same node (both span from
28
+ * `getStart()` to `getEnd()`).
29
+ */
30
+ export function digestFunctionBody(node, sourceFile) {
31
+ const text = sourceFile.text.slice(node.getStart(sourceFile), node.getEnd());
32
+ const normalized = normalizeWhitespace(stripComments(text));
33
+ return { hash: sha256(normalized), size: normalized.length };
34
+ }
35
+ /**
36
+ * Hash a synthetic body string (used by module-init.ts which
37
+ * synthesizes a body from top-level statements).
38
+ */
39
+ export function hashSyntheticBody(input) {
40
+ return digestSyntheticBody(input).hash;
41
+ }
42
+ export function digestSyntheticBody(input) {
43
+ const normalized = normalizeWhitespace(stripComments(input));
44
+ return { hash: sha256(normalized), size: normalized.length };
45
+ }
46
+ function normalizeWhitespace(s) {
47
+ return s.replaceAll(/\s+/g, ' ').trim();
48
+ }
49
+ function sha256(s) {
50
+ return createHash('sha256').update(s, 'utf8').digest('hex');
51
+ }
52
+ //# sourceMappingURL=hash-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-body.js","sourceRoot":"","sources":["../../src/inventory-helpers/hash-body.ts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