@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
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Tests for the fast (checker-free) parse path — parse-fast.ts.
3
+ *
4
+ * The fast parse must (a) build no ts.Program and construct no type
5
+ * checker, (b) populate parent pointers (setParentNodes), (c) surface
6
+ * syntactic diagnostics into parseErrors, and (d) parse .tsx as JSX.
7
+ */
8
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
9
+ import { tmpdir } from 'node:os';
10
+ import { join } from 'node:path';
11
+ import ts from 'typescript';
12
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
13
+ import { parseProjectFast } from '../parse-fast.js';
14
+ import { parseProject } from '../parse.js';
15
+ describe('parseProjectFast', () => {
16
+ let dir;
17
+ beforeEach(() => {
18
+ dir = mkdtempSync(join(tmpdir(), 'graph-ts-parsefast-'));
19
+ });
20
+ afterEach(() => {
21
+ rmSync(dir, { recursive: true, force: true });
22
+ });
23
+ it('produces a fast project (no ts.Program) with one source file per input', () => {
24
+ const a = join(dir, 'a.ts');
25
+ const b = join(dir, 'b.ts');
26
+ writeFileSync(a, 'export function foo() { return 1; }\n', 'utf8');
27
+ writeFileSync(b, 'export const bar = () => 2;\n', 'utf8');
28
+ const out = parseProjectFast({
29
+ projectDirAbs: dir,
30
+ files: [a, b],
31
+ resolutionMode: 'fast',
32
+ });
33
+ expect(out.project.kind).toBe('fast');
34
+ // No type checker / Program is ever constructed on this path.
35
+ expect('program' in out.project).toBe(false);
36
+ expect(out.project.sourceFiles.size).toBe(2);
37
+ expect(out.project.sourceFiles.has(a)).toBe(true);
38
+ expect(out.parseErrors).toEqual([]);
39
+ });
40
+ it('populates parent pointers (the cheap substitute for the checker)', () => {
41
+ const a = join(dir, 'a.ts');
42
+ writeFileSync(a, 'export function foo() { return 1; }\n', 'utf8');
43
+ const out = parseProjectFast({ projectDirAbs: dir, files: [a], resolutionMode: 'fast' });
44
+ const sf = out.project.sourceFiles.get(a);
45
+ expect(sf).toBeDefined();
46
+ // The first statement's parent must point back at the source file —
47
+ // proof setParentNodes ran without a binder/checker.
48
+ const firstStmt = sf.statements[0];
49
+ expect(firstStmt).toBeDefined();
50
+ expect(firstStmt.parent).toBe(sf);
51
+ });
52
+ it('surfaces syntactic diagnostics into parseErrors for an unparseable file', () => {
53
+ const broken = join(dir, 'broken.ts');
54
+ // Missing identifier + dangling tokens → parse diagnostics.
55
+ writeFileSync(broken, 'const = ;\nfunction (\n', 'utf8');
56
+ const out = parseProjectFast({ projectDirAbs: dir, files: [broken], resolutionMode: 'fast' });
57
+ expect(out.parseErrors.length).toBeGreaterThan(0);
58
+ expect(out.parseErrors[0]?.filePath).toBe('broken.ts');
59
+ // The (partial) tree is still retained for the walk stage.
60
+ expect(out.project.sourceFiles.size).toBe(1);
61
+ });
62
+ it('parses .tsx as JSX (ScriptKind derived from extension)', () => {
63
+ const tsx = join(dir, 'view.tsx');
64
+ writeFileSync(tsx, 'export const View = () => <div className="x">hi</div>;\n', 'utf8');
65
+ const out = parseProjectFast({ projectDirAbs: dir, files: [tsx], resolutionMode: 'fast' });
66
+ // JSX parses with no syntactic error, and a JSX node exists in the tree.
67
+ expect(out.parseErrors).toEqual([]);
68
+ const sf = out.project.sourceFiles.get(tsx);
69
+ let sawJsx = false;
70
+ const visit = (node) => {
71
+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node))
72
+ sawJsx = true;
73
+ ts.forEachChild(node, visit);
74
+ };
75
+ visit(sf);
76
+ expect(sawJsx).toBe(true);
77
+ });
78
+ it('parses .jsx as JSX and .js/.cjs/.mjs as plain JS (ScriptKind by extension)', () => {
79
+ const jsx = join(dir, 'view.jsx');
80
+ const js = join(dir, 'plain.js');
81
+ const cjs = join(dir, 'legacy.cjs');
82
+ const mjs = join(dir, 'modern.mjs');
83
+ writeFileSync(jsx, 'export const View = () => <span>x</span>;\n', 'utf8');
84
+ writeFileSync(js, 'export const a = 1;\n', 'utf8');
85
+ writeFileSync(cjs, 'module.exports = { b: 2 };\n', 'utf8');
86
+ writeFileSync(mjs, 'export const c = 3;\n', 'utf8');
87
+ const out = parseProjectFast({
88
+ projectDirAbs: dir,
89
+ files: [jsx, js, cjs, mjs],
90
+ resolutionMode: 'fast',
91
+ });
92
+ expect(out.parseErrors).toEqual([]);
93
+ expect(out.project.sourceFiles.size).toBe(4);
94
+ // The .jsx file parsed its JSX as JSX (a JSX node exists).
95
+ const jsxSf = out.project.sourceFiles.get(jsx);
96
+ let sawJsx = false;
97
+ const visit = (node) => {
98
+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node))
99
+ sawJsx = true;
100
+ ts.forEachChild(node, visit);
101
+ };
102
+ visit(jsxSf);
103
+ expect(sawJsx).toBe(true);
104
+ });
105
+ it('parseProject dispatches to the fast path when resolutionMode is fast', () => {
106
+ const a = join(dir, 'a.ts');
107
+ writeFileSync(a, 'export function foo() { return 1; }\n', 'utf8');
108
+ const fast = parseProject({ projectDirAbs: dir, files: [a], resolutionMode: 'fast' });
109
+ expect(fast.project.kind).toBe('fast');
110
+ const exact = parseProject({ projectDirAbs: dir, files: [a], resolutionMode: 'exact' });
111
+ expect(exact.project.kind).toBe('exact');
112
+ });
113
+ });
114
+ //# sourceMappingURL=parse-fast.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-fast.test.js","sourceRoot":"","sources":["../../src/__tests__/parse-fast.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,GAAW,CAAC;IAEhB,UAAU,CAAC,GAAG,EAAE;QACd,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IA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AElE,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;QACxF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared catalog/occurrence factories for the rule integration tests
3
+ * that exercise rules-against-real-or-synthetic catalogs from
4
+ * graph-typescript.
5
+ *
6
+ * Mirrors the engine-side _helpers.ts. Lives here so this graph-
7
+ * typescript test directory has no need to deep-import engine
8
+ * internals.
9
+ */
10
+ import type { CallEdge, Catalog, FunctionOccurrence } from '@opensip-cli/graph';
11
+ export interface OccOverride extends Partial<FunctionOccurrence> {
12
+ readonly bodyHash: string;
13
+ readonly simpleName: string;
14
+ }
15
+ export declare function occ(over: OccOverride): FunctionOccurrence;
16
+ export declare function edge(text: string, to?: readonly string[], discarded?: boolean): CallEdge;
17
+ export declare function makeCatalog(occs: readonly FunctionOccurrence[]): Catalog;
18
+ //# sourceMappingURL=_helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../../src/__tests__/rules/_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,kBAAkB,CAAC;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,kBAAkB,CAqBzD;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAE,SAAS,MAAM,EAAO,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAU5F;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAAG,OAAO,CAkBxE"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Shared catalog/occurrence factories for the rule integration tests
3
+ * that exercise rules-against-real-or-synthetic catalogs from
4
+ * graph-typescript.
5
+ *
6
+ * Mirrors the engine-side _helpers.ts. Lives here so this graph-
7
+ * typescript test directory has no need to deep-import engine
8
+ * internals.
9
+ */
10
+ export function occ(over) {
11
+ const base = {
12
+ bodyHash: over.bodyHash,
13
+ bodySize: 200,
14
+ simpleName: over.simpleName,
15
+ qualifiedName: over.qualifiedName ?? `src/a.${over.simpleName}`,
16
+ filePath: 'src/a.ts',
17
+ line: 1,
18
+ column: 0,
19
+ endLine: 5,
20
+ kind: 'function-declaration',
21
+ params: [],
22
+ returnType: null,
23
+ enclosingClass: null,
24
+ decorators: [],
25
+ visibility: 'module-local',
26
+ inTestFile: false,
27
+ definedInGenerated: false,
28
+ calls: [],
29
+ };
30
+ return { ...base, ...over };
31
+ }
32
+ export function edge(text, to = [], discarded) {
33
+ return {
34
+ to,
35
+ line: 2,
36
+ column: 4,
37
+ resolution: 'unknown',
38
+ confidence: 'low',
39
+ text,
40
+ discarded,
41
+ };
42
+ }
43
+ export function makeCatalog(occs) {
44
+ const functions = {};
45
+ for (const o of occs) {
46
+ let bucket = functions[o.simpleName];
47
+ if (!bucket) {
48
+ bucket = [];
49
+ functions[o.simpleName] = bucket;
50
+ }
51
+ bucket.push(o);
52
+ }
53
+ return {
54
+ version: '3.0',
55
+ tool: 'graph',
56
+ language: 'typescript',
57
+ builtAt: 'x',
58
+ cacheKey: 'ts-test-v3',
59
+ functions,
60
+ };
61
+ }
62
+ //# sourceMappingURL=_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../../src/__tests__/rules/_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,MAAM,UAAU,GAAG,CAAC,IAAiB;IACnC,MAAM,IAAI,GAAuB;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,SAAS,IAAI,CAAC,UAAU,EAAE;QAC/D,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,KAAK,EAAE,EAAE;KACV,CAAC;IACF,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,KAAwB,EAAE,EAAE,SAAmB;IAChF,OAAO;QACL,EAAE;QACF,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,KAAK;QACjB,IAAI;QACJ,SAAS;KACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAmC;IAC7D,MAAM,SAAS,GAAyC,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,EAAE,CAAC;YACZ,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,GAAG;QACZ,QAAQ,EAAE,YAAY;QACtB,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test the duplicated-function-body rule.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=duplicated-function-body.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicated-function-body.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/rules/duplicated-function-body.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Test the duplicated-function-body rule.
3
+ */
4
+ import { mkdtempSync, rmSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+ import { buildIndexes, duplicatedFunctionBodyRule } from '@opensip-cli/graph/internal';
8
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
9
+ import { runFixture, writeFixture } from '../acceptance/_fixture-runner.js';
10
+ describe('duplicated-function-body rule', () => {
11
+ const fixtureDir = mkdtempSync(join(tmpdir(), 'graph-dup-'));
12
+ afterAll(() => {
13
+ rmSync(fixtureDir, { recursive: true, force: true });
14
+ });
15
+ writeFixture(fixtureDir, {
16
+ 'a.ts': `export function calculate(a: number, b: number): number {\n if (a < 0) return 0;\n if (b < 0) return 0;\n const sum = a + b;\n return sum * 2;\n}\n`,
17
+ 'b.ts': `export function calculate(a: number, b: number): number {\n if (a < 0) return 0;\n if (b < 0) return 0;\n const sum = a + b;\n return sum * 2;\n}\n`,
18
+ 'c.ts': `export function unique(): number {\n return 1234;\n}\n`,
19
+ });
20
+ let signals;
21
+ beforeAll(async () => {
22
+ const catalog = await runFixture(fixtureDir);
23
+ // The fixture's `calculate` body is small (~100 normalized chars).
24
+ // Disable the wrapper-suppression threshold for this test so we are
25
+ // exercising the rule's core grouping behavior, not its anti-wrapper
26
+ // heuristic.
27
+ signals = duplicatedFunctionBodyRule.evaluate(catalog, buildIndexes(catalog), {
28
+ minDuplicateBodySize: 0,
29
+ });
30
+ });
31
+ it('flags duplicated bodies across files', () => {
32
+ expect(signals.length).toBeGreaterThanOrEqual(1);
33
+ expect(signals.some((s) => s.message.includes('calculate'))).toBe(true);
34
+ });
35
+ it('does not flag unique', () => {
36
+ expect(signals.some((s) => s.message.includes('unique'))).toBe(false);
37
+ });
38
+ });
39
+ //# sourceMappingURL=duplicated-function-body.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicated-function-body.test.js","sourceRoot":"","sources":["../../../src/__tests__/rules/duplicated-function-body.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAE5E,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,MAAM,UAAU,G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AC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Test the orphan-subtree rule against synthetic fixtures.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=orphan-subtree.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orphan-subtree.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/rules/orphan-subtree.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Test the orphan-subtree rule against synthetic fixtures.
3
+ */
4
+ import { mkdtempSync, rmSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+ import { buildIndexes, orphanSubtreeRule } from '@opensip-cli/graph/internal';
8
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
9
+ import { runFixture, writeFixture } from '../acceptance/_fixture-runner.js';
10
+ describe('orphan-subtree rule', () => {
11
+ const fixtureDir = mkdtempSync(join(tmpdir(), 'graph-orphan-rule-'));
12
+ afterAll(() => {
13
+ rmSync(fixtureDir, { recursive: true, force: true });
14
+ });
15
+ writeFixture(fixtureDir, {
16
+ 'index.ts': `function unusedHelper() { return 1; }\nexport function entry(): number {\n return helper();\n}\nfunction helper(): number { return 42; }\n`,
17
+ });
18
+ let signals;
19
+ beforeAll(async () => {
20
+ const catalog = await runFixture(fixtureDir);
21
+ signals = orphanSubtreeRule.evaluate(catalog, buildIndexes(catalog), {});
22
+ });
23
+ it('flags unusedHelper as orphan', () => {
24
+ const orphans = signals.map((s) => s.metadata.simpleName);
25
+ expect(orphans).toContain('unusedHelper');
26
+ });
27
+ it('does not flag helper (called by entry)', () => {
28
+ const orphans = signals.map((s) => s.metadata.simpleName);
29
+ expect(orphans).not.toContain('helper');
30
+ });
31
+ it('does not flag entry (exported with no caller — entry-point)', () => {
32
+ const orphans = signals.map((s) => s.metadata.simpleName);
33
+ expect(orphans).not.toContain('entry');
34
+ });
35
+ });
36
+ describe('orphan-subtree rule — exported recursive renderer (D2 + D3)', () => {
37
+ // End-to-end mirror of cli-ui/render-to-text.ts: an exported recursive
38
+ // function consumed only across a package boundary (so its only resolved
39
+ // in-project caller is its own self-edge), plus a file-local helper it
40
+ // calls. Before D2 the self-edge made `no-callers-exported` miss it, so it
41
+ // and its helper became false orphans. After D2 the renderer seeds as an
42
+ // entry point and the helper is reached transitively; D3 also suppresses
43
+ // the exported renderer directly.
44
+ const fixtureDir = mkdtempSync(join(tmpdir(), 'graph-orphan-recursive-'));
45
+ afterAll(() => {
46
+ rmSync(fixtureDir, { recursive: true, force: true });
47
+ });
48
+ writeFixture(fixtureDir, {
49
+ 'render.ts': [
50
+ 'function spansToText(parts: string[]): string {',
51
+ " return parts.join(' ');",
52
+ '}',
53
+ 'export function renderToText(node: { kind: string; parts: string[]; children: { kind: string; parts: string[]; children: never[] }[] }): string {',
54
+ " if (node.kind === 'group') {",
55
+ " return node.children.map(renderToText).join(' ');",
56
+ ' }',
57
+ ' return spansToText(node.parts);',
58
+ '}',
59
+ '',
60
+ ].join('\n'),
61
+ });
62
+ let orphans;
63
+ beforeAll(async () => {
64
+ const catalog = await runFixture(fixtureDir);
65
+ const signals = orphanSubtreeRule.evaluate(catalog, buildIndexes(catalog), {});
66
+ orphans = signals.map((s) => s.metadata.simpleName);
67
+ });
68
+ it('does not flag the exported recursive renderer', () => {
69
+ expect(orphans).not.toContain('renderToText');
70
+ });
71
+ it('does not flag the file-local helper reached only by the renderer', () => {
72
+ expect(orphans).not.toContain('spansToText');
73
+ });
74
+ });
75
+ //# sourceMappingURL=orphan-subtree.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orphan-subtree.test.js","sourceRoot":"","sources":["../../../src/__tests__/rules/orphan-subtree.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;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,CAAC;QAC7C,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/E,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Rule-hints integration tests — covers the F-1 audit fix.
3
+ *
4
+ * The `no-side-effect-path` and `always-throws-branch` rules consult
5
+ * the active adapter's `ruleHints.sideEffectPrimitives` and
6
+ * `ruleHints.throwSyntaxRegex` so per-language fidelity matches the
7
+ * promise in docs/public/40-graph/02-rules-and-gating.md.
8
+ *
9
+ * What these tests cover:
10
+ * - Python `print(...)` is detected as a side-effect when the Python
11
+ * hints are passed; without hints, the TS-shaped fallback would NOT
12
+ * detect it (regression preview of the audit's headline finding).
13
+ * - Rust `panic!(...)` matches the `always-throws-branch` regex when
14
+ * the Rust hints are passed; without hints, the TS-shaped fallback
15
+ * does NOT match it.
16
+ * - TypeScript adapter hints continue to work identically to the
17
+ * previous hardcoded regex (regression check).
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=rule-hints-integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-hints-integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/rules/rule-hints-integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}