@nielspeter/eess-ts 0.2.1 → 0.5.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 (467) hide show
  1. package/README.md +61 -35
  2. package/dist/builders/call-rule-builder.d.ts +66 -26
  3. package/dist/builders/call-rule-builder.d.ts.map +1 -1
  4. package/dist/builders/call-rule-builder.js +75 -32
  5. package/dist/builders/call-rule-builder.js.map +1 -1
  6. package/dist/builders/class-rule-builder.d.ts +125 -26
  7. package/dist/builders/class-rule-builder.d.ts.map +1 -1
  8. package/dist/builders/class-rule-builder.js +141 -55
  9. package/dist/builders/class-rule-builder.js.map +1 -1
  10. package/dist/builders/correspondence-builder.d.ts +287 -0
  11. package/dist/builders/correspondence-builder.d.ts.map +1 -0
  12. package/dist/builders/correspondence-builder.js +385 -0
  13. package/dist/builders/correspondence-builder.js.map +1 -0
  14. package/dist/builders/correspondence-findings.d.ts +104 -0
  15. package/dist/builders/correspondence-findings.d.ts.map +1 -0
  16. package/dist/builders/correspondence-findings.js +301 -0
  17. package/dist/builders/correspondence-findings.js.map +1 -0
  18. package/dist/builders/cross-layer-builder.d.ts +99 -16
  19. package/dist/builders/cross-layer-builder.d.ts.map +1 -1
  20. package/dist/builders/cross-layer-builder.js +182 -35
  21. package/dist/builders/cross-layer-builder.js.map +1 -1
  22. package/dist/builders/function-rule-builder.d.ts +144 -25
  23. package/dist/builders/function-rule-builder.d.ts.map +1 -1
  24. package/dist/builders/function-rule-builder.js +177 -39
  25. package/dist/builders/function-rule-builder.js.map +1 -1
  26. package/dist/builders/jsx-rule-builder.d.ts +70 -14
  27. package/dist/builders/jsx-rule-builder.d.ts.map +1 -1
  28. package/dist/builders/jsx-rule-builder.js +73 -14
  29. package/dist/builders/jsx-rule-builder.js.map +1 -1
  30. package/dist/builders/module-rule-builder.d.ts +2 -2
  31. package/dist/builders/module-rule-builder.d.ts.map +1 -1
  32. package/dist/builders/module-rule-builder.js +16 -19
  33. package/dist/builders/module-rule-builder.js.map +1 -1
  34. package/dist/builders/scoped-function-rule-builder.d.ts +11 -0
  35. package/dist/builders/scoped-function-rule-builder.d.ts.map +1 -1
  36. package/dist/builders/scoped-function-rule-builder.js +12 -0
  37. package/dist/builders/scoped-function-rule-builder.js.map +1 -1
  38. package/dist/builders/slice-discovery-message.d.ts +36 -0
  39. package/dist/builders/slice-discovery-message.d.ts.map +1 -0
  40. package/dist/builders/slice-discovery-message.js +181 -0
  41. package/dist/builders/slice-discovery-message.js.map +1 -0
  42. package/dist/builders/slice-rule-builder.d.ts +151 -12
  43. package/dist/builders/slice-rule-builder.d.ts.map +1 -1
  44. package/dist/builders/slice-rule-builder.js +243 -35
  45. package/dist/builders/slice-rule-builder.js.map +1 -1
  46. package/dist/builders/type-rule-builder.d.ts +95 -24
  47. package/dist/builders/type-rule-builder.d.ts.map +1 -1
  48. package/dist/builders/type-rule-builder.js +109 -42
  49. package/dist/builders/type-rule-builder.js.map +1 -1
  50. package/dist/{helpers → builders}/within.d.ts +2 -2
  51. package/dist/builders/within.d.ts.map +1 -0
  52. package/dist/{helpers → builders}/within.js +1 -1
  53. package/dist/builders/within.js.map +1 -0
  54. package/dist/cli/commands/baseline.d.ts +8 -3
  55. package/dist/cli/commands/baseline.d.ts.map +1 -1
  56. package/dist/cli/commands/baseline.js +111 -7
  57. package/dist/cli/commands/baseline.js.map +1 -1
  58. package/dist/cli/commands/check.d.ts +7 -2
  59. package/dist/cli/commands/check.d.ts.map +1 -1
  60. package/dist/cli/commands/check.js +385 -47
  61. package/dist/cli/commands/check.js.map +1 -1
  62. package/dist/cli/commands/doctor.d.ts +29 -0
  63. package/dist/cli/commands/doctor.d.ts.map +1 -0
  64. package/dist/cli/commands/doctor.js +224 -0
  65. package/dist/cli/commands/doctor.js.map +1 -0
  66. package/dist/cli/commands/explain.d.ts +2 -1
  67. package/dist/cli/commands/explain.d.ts.map +1 -1
  68. package/dist/cli/commands/explain.js +19 -10
  69. package/dist/cli/commands/explain.js.map +1 -1
  70. package/dist/cli/commands/init.d.ts +9 -3
  71. package/dist/cli/commands/init.d.ts.map +1 -1
  72. package/dist/cli/commands/init.js +162 -137
  73. package/dist/cli/commands/init.js.map +1 -1
  74. package/dist/cli/import-rule-module.d.ts +29 -0
  75. package/dist/cli/import-rule-module.d.ts.map +1 -0
  76. package/dist/cli/import-rule-module.js +47 -0
  77. package/dist/cli/import-rule-module.js.map +1 -0
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +101 -43
  81. package/dist/cli/index.js.map +1 -1
  82. package/dist/cli/load-rules.d.ts +6 -11
  83. package/dist/cli/load-rules.d.ts.map +1 -1
  84. package/dist/cli/load-rules.js +25 -32
  85. package/dist/cli/load-rules.js.map +1 -1
  86. package/dist/cli/resolve-config.d.ts +0 -8
  87. package/dist/cli/resolve-config.d.ts.map +1 -1
  88. package/dist/cli/resolve-config.js +25 -55
  89. package/dist/cli/resolve-config.js.map +1 -1
  90. package/dist/cli/rule-file-findings.d.ts +178 -0
  91. package/dist/cli/rule-file-findings.d.ts.map +1 -0
  92. package/dist/cli/rule-file-findings.js +351 -0
  93. package/dist/cli/rule-file-findings.js.map +1 -0
  94. package/dist/cli/watch.d.ts +17 -34
  95. package/dist/cli/watch.d.ts.map +1 -1
  96. package/dist/cli/watch.js +14 -129
  97. package/dist/cli/watch.js.map +1 -1
  98. package/dist/conditions/body-analysis-function.d.ts.map +1 -1
  99. package/dist/conditions/body-analysis-function.js +16 -7
  100. package/dist/conditions/body-analysis-function.js.map +1 -1
  101. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  102. package/dist/conditions/body-analysis-module.js +14 -9
  103. package/dist/conditions/body-analysis-module.js.map +1 -1
  104. package/dist/conditions/body-analysis.d.ts.map +1 -1
  105. package/dist/conditions/body-analysis.js +16 -7
  106. package/dist/conditions/body-analysis.js.map +1 -1
  107. package/dist/conditions/call.d.ts.map +1 -1
  108. package/dist/conditions/call.js +41 -19
  109. package/dist/conditions/call.js.map +1 -1
  110. package/dist/conditions/catch-analysis.d.ts +2 -1
  111. package/dist/conditions/catch-analysis.d.ts.map +1 -1
  112. package/dist/conditions/catch-analysis.js.map +1 -1
  113. package/dist/conditions/cross-layer.d.ts +2 -10
  114. package/dist/conditions/cross-layer.d.ts.map +1 -1
  115. package/dist/conditions/cross-layer.js +227 -23
  116. package/dist/conditions/cross-layer.js.map +1 -1
  117. package/dist/conditions/dependency.d.ts +35 -6
  118. package/dist/conditions/dependency.d.ts.map +1 -1
  119. package/dist/conditions/dependency.js +299 -45
  120. package/dist/conditions/dependency.js.map +1 -1
  121. package/dist/conditions/exports.d.ts.map +1 -1
  122. package/dist/conditions/exports.js +41 -37
  123. package/dist/conditions/exports.js.map +1 -1
  124. package/dist/conditions/function.d.ts.map +1 -1
  125. package/dist/conditions/function.js +19 -5
  126. package/dist/conditions/function.js.map +1 -1
  127. package/dist/conditions/helpers.d.ts +2 -1
  128. package/dist/conditions/helpers.d.ts.map +1 -1
  129. package/dist/conditions/helpers.js +4 -1
  130. package/dist/conditions/helpers.js.map +1 -1
  131. package/dist/conditions/jsx.d.ts.map +1 -1
  132. package/dist/conditions/jsx.js +7 -2
  133. package/dist/conditions/jsx.js.map +1 -1
  134. package/dist/conditions/match-identity.d.ts +43 -0
  135. package/dist/conditions/match-identity.d.ts.map +1 -0
  136. package/dist/conditions/match-identity.js +43 -0
  137. package/dist/conditions/match-identity.js.map +1 -0
  138. package/dist/conditions/members.d.ts.map +1 -1
  139. package/dist/conditions/members.js +20 -6
  140. package/dist/conditions/members.js.map +1 -1
  141. package/dist/conditions/reverse-dependency.d.ts +18 -5
  142. package/dist/conditions/reverse-dependency.d.ts.map +1 -1
  143. package/dist/conditions/reverse-dependency.js +155 -93
  144. package/dist/conditions/reverse-dependency.js.map +1 -1
  145. package/dist/conditions/slice.d.ts +86 -2
  146. package/dist/conditions/slice.d.ts.map +1 -1
  147. package/dist/conditions/slice.js +234 -53
  148. package/dist/conditions/slice.js.map +1 -1
  149. package/dist/conditions/structural.d.ts.map +1 -1
  150. package/dist/conditions/structural.js +16 -4
  151. package/dist/conditions/structural.js.map +1 -1
  152. package/dist/core/check-all.d.ts +19 -0
  153. package/dist/core/check-all.d.ts.map +1 -0
  154. package/dist/core/check-all.js +150 -0
  155. package/dist/core/check-all.js.map +1 -0
  156. package/dist/core/combinators.d.ts +48 -0
  157. package/dist/core/combinators.d.ts.map +1 -0
  158. package/dist/core/combinators.js +49 -0
  159. package/dist/core/combinators.js.map +1 -0
  160. package/dist/core/descendant-cache.d.ts +36 -0
  161. package/dist/core/descendant-cache.d.ts.map +1 -0
  162. package/dist/core/descendant-cache.js +117 -0
  163. package/dist/core/descendant-cache.js.map +1 -0
  164. package/dist/core/diagnose.d.ts +234 -0
  165. package/dist/core/diagnose.d.ts.map +1 -0
  166. package/dist/core/diagnose.js +390 -0
  167. package/dist/core/diagnose.js.map +1 -0
  168. package/dist/core/disk-set.d.ts +48 -0
  169. package/dist/core/disk-set.d.ts.map +1 -0
  170. package/dist/core/disk-set.js +218 -0
  171. package/dist/core/disk-set.js.map +1 -0
  172. package/dist/core/element-cache.d.ts +75 -0
  173. package/dist/core/element-cache.d.ts.map +1 -0
  174. package/dist/core/element-cache.js +32 -0
  175. package/dist/core/element-cache.js.map +1 -0
  176. package/dist/core/empty-project-advice.d.ts +75 -0
  177. package/dist/core/empty-project-advice.d.ts.map +1 -0
  178. package/dist/core/empty-project-advice.js +61 -0
  179. package/dist/core/empty-project-advice.js.map +1 -0
  180. package/dist/core/exclusion-comments.d.ts +19 -0
  181. package/dist/core/exclusion-comments.d.ts.map +1 -0
  182. package/dist/core/exclusion-comments.js +7 -0
  183. package/dist/core/exclusion-comments.js.map +1 -0
  184. package/dist/core/execute-rule.d.ts +158 -0
  185. package/dist/core/execute-rule.d.ts.map +1 -0
  186. package/dist/core/execute-rule.js +666 -0
  187. package/dist/core/execute-rule.js.map +1 -0
  188. package/dist/core/glob-diagnosis.d.ts +78 -0
  189. package/dist/core/glob-diagnosis.d.ts.map +1 -0
  190. package/dist/core/glob-diagnosis.js +134 -0
  191. package/dist/core/glob-diagnosis.js.map +1 -0
  192. package/dist/core/glob-evaluator.d.ts +48 -0
  193. package/dist/core/glob-evaluator.d.ts.map +1 -0
  194. package/dist/core/glob-evaluator.js +89 -0
  195. package/dist/core/glob-evaluator.js.map +1 -0
  196. package/dist/core/import-candidates.d.ts +60 -0
  197. package/dist/core/import-candidates.d.ts.map +1 -0
  198. package/dist/core/import-candidates.js +93 -0
  199. package/dist/core/import-candidates.js.map +1 -0
  200. package/dist/core/import-options.d.ts +55 -2
  201. package/dist/core/import-options.d.ts.map +1 -1
  202. package/dist/core/import-options.js +64 -0
  203. package/dist/core/import-options.js.map +1 -1
  204. package/dist/core/invalidate-on-modify.d.ts +20 -0
  205. package/dist/core/invalidate-on-modify.d.ts.map +1 -0
  206. package/dist/core/invalidate-on-modify.js +26 -0
  207. package/dist/core/invalidate-on-modify.js.map +1 -0
  208. package/dist/core/line-index.d.ts +3 -0
  209. package/dist/core/line-index.d.ts.map +1 -0
  210. package/dist/core/line-index.js +227 -0
  211. package/dist/core/line-index.js.map +1 -0
  212. package/dist/core/metric-violation.d.ts +86 -0
  213. package/dist/core/metric-violation.d.ts.map +1 -0
  214. package/dist/core/metric-violation.js +132 -0
  215. package/dist/core/metric-violation.js.map +1 -0
  216. package/dist/core/module-edges.d.ts +361 -0
  217. package/dist/core/module-edges.d.ts.map +1 -0
  218. package/dist/core/module-edges.js +593 -0
  219. package/dist/core/module-edges.js.map +1 -0
  220. package/dist/core/object-literal-functions.d.ts +42 -0
  221. package/dist/core/object-literal-functions.d.ts.map +1 -0
  222. package/dist/core/object-literal-functions.js +75 -0
  223. package/dist/core/object-literal-functions.js.map +1 -0
  224. package/dist/core/orphan-exclusions.d.ts +44 -0
  225. package/dist/core/orphan-exclusions.d.ts.map +1 -0
  226. package/dist/core/orphan-exclusions.js +224 -0
  227. package/dist/core/orphan-exclusions.js.map +1 -0
  228. package/dist/core/pair-condition.d.ts +32 -3
  229. package/dist/core/pair-condition.d.ts.map +1 -1
  230. package/dist/core/path-universe.d.ts +22 -0
  231. package/dist/core/path-universe.d.ts.map +1 -0
  232. package/dist/core/path-universe.js +45 -0
  233. package/dist/core/path-universe.js.map +1 -0
  234. package/dist/core/per-root-compiler-options.d.ts +20 -0
  235. package/dist/core/per-root-compiler-options.d.ts.map +1 -0
  236. package/dist/core/per-root-compiler-options.js +57 -0
  237. package/dist/core/per-root-compiler-options.js.map +1 -0
  238. package/dist/core/project-relative.d.ts +98 -0
  239. package/dist/core/project-relative.d.ts.map +1 -0
  240. package/dist/core/project-relative.js +185 -0
  241. package/dist/core/project-relative.js.map +1 -0
  242. package/dist/core/project.d.ts +7 -1
  243. package/dist/core/project.d.ts.map +1 -1
  244. package/dist/core/project.js +29 -4
  245. package/dist/core/project.js.map +1 -1
  246. package/dist/core/rule-builder.d.ts +303 -0
  247. package/dist/core/rule-builder.d.ts.map +1 -0
  248. package/dist/core/rule-builder.js +463 -0
  249. package/dist/core/rule-builder.js.map +1 -0
  250. package/dist/core/rule-declaration.d.ts +32 -0
  251. package/dist/core/rule-declaration.d.ts.map +1 -0
  252. package/dist/core/rule-declaration.js +88 -0
  253. package/dist/core/rule-declaration.js.map +1 -0
  254. package/dist/core/terminal-builder.d.ts +629 -0
  255. package/dist/core/terminal-builder.d.ts.map +1 -0
  256. package/dist/core/terminal-builder.js +807 -0
  257. package/dist/core/terminal-builder.js.map +1 -0
  258. package/dist/core/terminal-execution.d.ts +39 -0
  259. package/dist/core/terminal-execution.d.ts.map +1 -0
  260. package/dist/core/terminal-execution.js +103 -0
  261. package/dist/core/terminal-execution.js.map +1 -0
  262. package/dist/core/ts-comment-mask.d.ts +2 -0
  263. package/dist/core/ts-comment-mask.d.ts.map +1 -0
  264. package/dist/core/ts-comment-mask.js +102 -0
  265. package/dist/core/ts-comment-mask.js.map +1 -0
  266. package/dist/core/vacuity-diagnosis.d.ts +103 -0
  267. package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
  268. package/dist/core/vacuity-diagnosis.js +415 -0
  269. package/dist/core/vacuity-diagnosis.js.map +1 -0
  270. package/dist/core/violation.d.ts +16 -11
  271. package/dist/core/violation.d.ts.map +1 -1
  272. package/dist/core/violation.js +33 -13
  273. package/dist/core/violation.js.map +1 -1
  274. package/dist/graphql/graphql-rule-builder.d.ts +95 -0
  275. package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
  276. package/dist/graphql/graphql-rule-builder.js +127 -0
  277. package/dist/graphql/graphql-rule-builder.js.map +1 -0
  278. package/dist/graphql/index.d.ts +1 -0
  279. package/dist/graphql/index.d.ts.map +1 -1
  280. package/dist/graphql/index.js +2 -1
  281. package/dist/graphql/index.js.map +1 -1
  282. package/dist/graphql/resolver-rule-builder.d.ts +44 -23
  283. package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
  284. package/dist/graphql/resolver-rule-builder.js +80 -72
  285. package/dist/graphql/resolver-rule-builder.js.map +1 -1
  286. package/dist/graphql/schema-loader.d.ts +21 -0
  287. package/dist/graphql/schema-loader.d.ts.map +1 -1
  288. package/dist/graphql/schema-loader.js +82 -12
  289. package/dist/graphql/schema-loader.js.map +1 -1
  290. package/dist/graphql/schema-predicates.d.ts.map +1 -1
  291. package/dist/graphql/schema-predicates.js +17 -12
  292. package/dist/graphql/schema-predicates.js.map +1 -1
  293. package/dist/graphql/schema-rule-builder.d.ts +15 -24
  294. package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
  295. package/dist/graphql/schema-rule-builder.js +39 -77
  296. package/dist/graphql/schema-rule-builder.js.map +1 -1
  297. package/dist/helpers/baseline-diagnostics.d.ts +45 -0
  298. package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
  299. package/dist/helpers/baseline-diagnostics.js +168 -0
  300. package/dist/helpers/baseline-diagnostics.js.map +1 -0
  301. package/dist/helpers/baseline-generator.d.ts +28 -0
  302. package/dist/helpers/baseline-generator.d.ts.map +1 -0
  303. package/dist/helpers/baseline-generator.js +27 -0
  304. package/dist/helpers/baseline-generator.js.map +1 -0
  305. package/dist/helpers/baseline.d.ts +336 -0
  306. package/dist/helpers/baseline.d.ts.map +1 -0
  307. package/dist/helpers/baseline.js +664 -0
  308. package/dist/helpers/baseline.js.map +1 -0
  309. package/dist/helpers/body-traversal.d.ts +27 -2
  310. package/dist/helpers/body-traversal.d.ts.map +1 -1
  311. package/dist/helpers/body-traversal.js +135 -16
  312. package/dist/helpers/body-traversal.js.map +1 -1
  313. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  314. package/dist/helpers/callback-extractor.js +53 -84
  315. package/dist/helpers/callback-extractor.js.map +1 -1
  316. package/dist/helpers/complexity.d.ts +13 -5
  317. package/dist/helpers/complexity.d.ts.map +1 -1
  318. package/dist/helpers/complexity.js +15 -6
  319. package/dist/helpers/complexity.js.map +1 -1
  320. package/dist/helpers/diff-aware.d.ts +16 -0
  321. package/dist/helpers/diff-aware.d.ts.map +1 -0
  322. package/dist/helpers/diff-aware.js +16 -0
  323. package/dist/helpers/diff-aware.js.map +1 -0
  324. package/dist/helpers/matchers.d.ts +68 -7
  325. package/dist/helpers/matchers.d.ts.map +1 -1
  326. package/dist/helpers/matchers.js +164 -86
  327. package/dist/helpers/matchers.js.map +1 -1
  328. package/dist/helpers/slice-graph.d.ts +100 -8
  329. package/dist/helpers/slice-graph.d.ts.map +1 -1
  330. package/dist/helpers/slice-graph.js +126 -34
  331. package/dist/helpers/slice-graph.js.map +1 -1
  332. package/dist/helpers/tarjan.d.ts +0 -14
  333. package/dist/helpers/tarjan.d.ts.map +1 -1
  334. package/dist/helpers/tarjan.js +29 -16
  335. package/dist/helpers/tarjan.js.map +1 -1
  336. package/dist/index.d.ts +55 -19
  337. package/dist/index.d.ts.map +1 -1
  338. package/dist/index.js +67 -15
  339. package/dist/index.js.map +1 -1
  340. package/dist/models/arch-call.d.ts +3 -2
  341. package/dist/models/arch-call.d.ts.map +1 -1
  342. package/dist/models/arch-call.js.map +1 -1
  343. package/dist/models/arch-function.d.ts +54 -8
  344. package/dist/models/arch-function.d.ts.map +1 -1
  345. package/dist/models/arch-function.js +145 -8
  346. package/dist/models/arch-function.js.map +1 -1
  347. package/dist/models/arch-jsx-element.d.ts.map +1 -1
  348. package/dist/models/arch-jsx-element.js +18 -19
  349. package/dist/models/arch-jsx-element.js.map +1 -1
  350. package/dist/models/slice.d.ts +33 -9
  351. package/dist/models/slice.d.ts.map +1 -1
  352. package/dist/models/slice.js +129 -19
  353. package/dist/models/slice.js.map +1 -1
  354. package/dist/predicates/call.d.ts.map +1 -1
  355. package/dist/predicates/call.js +5 -0
  356. package/dist/predicates/call.js.map +1 -1
  357. package/dist/predicates/identity.d.ts +21 -0
  358. package/dist/predicates/identity.d.ts.map +1 -1
  359. package/dist/predicates/identity.js +75 -3
  360. package/dist/predicates/identity.js.map +1 -1
  361. package/dist/predicates/index.d.ts +1 -1
  362. package/dist/predicates/index.d.ts.map +1 -1
  363. package/dist/predicates/index.js +1 -1
  364. package/dist/predicates/index.js.map +1 -1
  365. package/dist/predicates/jsx.d.ts.map +1 -1
  366. package/dist/predicates/jsx.js +2 -1
  367. package/dist/predicates/jsx.js.map +1 -1
  368. package/dist/predicates/metrics.d.ts +4 -2
  369. package/dist/predicates/metrics.d.ts.map +1 -1
  370. package/dist/predicates/metrics.js +4 -2
  371. package/dist/predicates/metrics.js.map +1 -1
  372. package/dist/predicates/module.d.ts +4 -12
  373. package/dist/predicates/module.d.ts.map +1 -1
  374. package/dist/predicates/module.js +57 -37
  375. package/dist/predicates/module.js.map +1 -1
  376. package/dist/presets/agent-guardrails.d.ts +49 -16
  377. package/dist/presets/agent-guardrails.d.ts.map +1 -1
  378. package/dist/presets/agent-guardrails.js +308 -19
  379. package/dist/presets/agent-guardrails.js.map +1 -1
  380. package/dist/presets/boundaries.d.ts +46 -3
  381. package/dist/presets/boundaries.d.ts.map +1 -1
  382. package/dist/presets/boundaries.js +132 -23
  383. package/dist/presets/boundaries.js.map +1 -1
  384. package/dist/presets/data-layer.d.ts +23 -3
  385. package/dist/presets/data-layer.d.ts.map +1 -1
  386. package/dist/presets/data-layer.js +58 -16
  387. package/dist/presets/data-layer.js.map +1 -1
  388. package/dist/presets/index.d.ts +10 -5
  389. package/dist/presets/index.d.ts.map +1 -1
  390. package/dist/presets/index.js +19 -3
  391. package/dist/presets/index.js.map +1 -1
  392. package/dist/presets/layered.d.ts +47 -3
  393. package/dist/presets/layered.d.ts.map +1 -1
  394. package/dist/presets/layered.js +66 -29
  395. package/dist/presets/layered.js.map +1 -1
  396. package/dist/presets/recommended.d.ts +81 -10
  397. package/dist/presets/recommended.d.ts.map +1 -1
  398. package/dist/presets/recommended.js +25 -23
  399. package/dist/presets/recommended.js.map +1 -1
  400. package/dist/presets/shared.d.ts +267 -2
  401. package/dist/presets/shared.d.ts.map +1 -1
  402. package/dist/presets/shared.js +367 -4
  403. package/dist/presets/shared.js.map +1 -1
  404. package/dist/rules/code-quality.d.ts.map +1 -1
  405. package/dist/rules/code-quality.js +15 -6
  406. package/dist/rules/code-quality.js.map +1 -1
  407. package/dist/rules/hygiene.d.ts +1 -1
  408. package/dist/rules/hygiene.js +1 -1
  409. package/dist/rules/metrics-function.d.ts +2 -1
  410. package/dist/rules/metrics-function.d.ts.map +1 -1
  411. package/dist/rules/metrics-function.js +63 -39
  412. package/dist/rules/metrics-function.js.map +1 -1
  413. package/dist/rules/metrics.d.ts +2 -1
  414. package/dist/rules/metrics.d.ts.map +1 -1
  415. package/dist/rules/metrics.js +80 -47
  416. package/dist/rules/metrics.js.map +1 -1
  417. package/dist/smells/clusters.d.ts +78 -0
  418. package/dist/smells/clusters.d.ts.map +1 -0
  419. package/dist/smells/clusters.js +124 -0
  420. package/dist/smells/clusters.js.map +1 -0
  421. package/dist/smells/duplicate-bodies.d.ts +92 -5
  422. package/dist/smells/duplicate-bodies.d.ts.map +1 -1
  423. package/dist/smells/duplicate-bodies.js +203 -73
  424. package/dist/smells/duplicate-bodies.js.map +1 -1
  425. package/dist/smells/duplicate-report.d.ts +90 -0
  426. package/dist/smells/duplicate-report.d.ts.map +1 -0
  427. package/dist/smells/duplicate-report.js +344 -0
  428. package/dist/smells/duplicate-report.js.map +1 -0
  429. package/dist/smells/fingerprint.d.ts +20 -1
  430. package/dist/smells/fingerprint.d.ts.map +1 -1
  431. package/dist/smells/fingerprint.js +27 -3
  432. package/dist/smells/fingerprint.js.map +1 -1
  433. package/dist/smells/inconsistent-siblings.d.ts +128 -7
  434. package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
  435. package/dist/smells/inconsistent-siblings.js +288 -86
  436. package/dist/smells/inconsistent-siblings.js.map +1 -1
  437. package/dist/smells/sibling-files.d.ts +47 -0
  438. package/dist/smells/sibling-files.d.ts.map +1 -0
  439. package/dist/smells/sibling-files.js +104 -0
  440. package/dist/smells/sibling-files.js.map +1 -0
  441. package/dist/smells/similar-pairs.d.ts +28 -0
  442. package/dist/smells/similar-pairs.d.ts.map +1 -0
  443. package/dist/smells/similar-pairs.js +134 -0
  444. package/dist/smells/similar-pairs.js.map +1 -0
  445. package/dist/smells/smell-builder.d.ts +57 -12
  446. package/dist/smells/smell-builder.d.ts.map +1 -1
  447. package/dist/smells/smell-builder.js +112 -14
  448. package/dist/smells/smell-builder.js.map +1 -1
  449. package/dist/smells/variation.d.ts +47 -0
  450. package/dist/smells/variation.d.ts.map +1 -0
  451. package/dist/smells/variation.js +90 -0
  452. package/dist/smells/variation.js.map +1 -0
  453. package/dist/tsconfig/index.d.ts +19 -0
  454. package/dist/tsconfig/index.d.ts.map +1 -0
  455. package/dist/tsconfig/index.js +20 -0
  456. package/dist/tsconfig/index.js.map +1 -0
  457. package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
  458. package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
  459. package/dist/tsconfig/tsconfig-builder.js +65 -16
  460. package/dist/tsconfig/tsconfig-builder.js.map +1 -1
  461. package/package.json +4 -2
  462. package/dist/core/module-dependencies.d.ts +0 -28
  463. package/dist/core/module-dependencies.d.ts.map +0 -1
  464. package/dist/core/module-dependencies.js +0 -35
  465. package/dist/core/module-dependencies.js.map +0 -1
  466. package/dist/helpers/within.d.ts.map +0 -1
  467. package/dist/helpers/within.js.map +0 -1
@@ -0,0 +1,150 @@
1
+ import { ArchRuleError, EMITTER_PASS_WITHOUT_EVIDENCE, finishPreset, mergeCollectResults, } from '@nielspeter/eess';
2
+ import { UNSUPPRESSABLE } from '@nielspeter/eess/internal';
3
+ import { callerAggregates, writeReport } from './execute-rule.js';
4
+ import { dedupeConfigFindings } from '@nielspeter/eess/internal';
5
+ import { suppressionNotice } from '@nielspeter/eess/internal';
6
+ import { writeStderr } from '@nielspeter/eess/internal';
7
+ import { edgeCoverageNotice, resetEdgeCoverage, untestedRules } from '@nielspeter/eess/internal';
8
+ import { commentSuppressionNotice, resetCommentSuppression } from '@nielspeter/eess/internal';
9
+ /**
10
+ * Run an array of rules (e.g. a spread preset) and throw one aggregated
11
+ * `ArchRuleError` if any **error-severity** violation is found. Warn-severity
12
+ * violations are reported but never throw — the same severity contract as the
13
+ * CLI `check`. This is the test-file terminal for the returning form:
14
+ *
15
+ * ```ts
16
+ * checkAll(layeredArchitecture(p, opts))
17
+ * checkAll([...recommended(p), ...layeredArchitecture(p, opts)])
18
+ * ```
19
+ *
20
+ * Each builder's `.violations()` already carries its stamped severity
21
+ * (via `.asSeverity()`), so aggregation and severity are preserved across the
22
+ * whole array — one readable error listing every error-severity violation.
23
+ */
24
+ export function checkAll(rules, options) {
25
+ // Per run, like `runCheck` — a second `checkAll` in one vitest file must
26
+ // not inherit the first's rules.
27
+ resetEdgeCoverage();
28
+ resetCommentSuppression();
29
+ // **The receipt survives the aggregation** — plan 0263 Phase 2, and the reason
30
+ // ADR-014's row for this door stayed `pending` after plan 0235 shipped the
31
+ // contract. This line used to be `rules.flatMap((rule) => rule.violations())`,
32
+ // and a `flatMap` over receipts yields a bare array: every `examined` on the
33
+ // floor, and the evidence gate never reached. Measured before the change,
34
+ // `checkAll([{ violations: () => [] }])` returned silently — a rule file
35
+ // exporting an evidence-free builder passed through this door without a word,
36
+ // which is bug 0206's shape at a different seam.
37
+ //
38
+ // `mergeCollectResults` is the kernel's one merge (ADR-014 §7) and is
39
+ // fail-closed **per member**, so one evidence-free builder among twenty is
40
+ // named rather than absorbed by the others' counts.
41
+ // **The empty array answers for itself, because the kernel's message cannot.**
42
+ // `mergeCollectResults([])` is zero examined and undeclared, so the gate below
43
+ // fires `emitter/pass-without-evidence` — correct. But that finding's remedy
44
+ // names `expectEmpty: true` in a preset's report options and `.expectEmpty()`
45
+ // on a builder, and at THIS door there is no preset and no builder to call it
46
+ // on: `CheckOptions` carries `baseline`, `diff` and `format` only. A finding
47
+ // whose every stated remedy is unreachable is ADR-009 rule 2's failure, and
48
+ // `emitter-findings.ts` records that this exact message was once rewritten for
49
+ // exactly that reason. Four reviewers caught it being recreated here.
50
+ //
51
+ // So this door states the remedy a `checkAll` caller can actually act on. The
52
+ // finding stays unsuppressable and error-severity like its sibling; only the
53
+ // text is this door's.
54
+ if (rules.length === 0) {
55
+ throw new ArchRuleError([
56
+ {
57
+ rule: EMITTER_PASS_WITHOUT_EVIDENCE,
58
+ ruleId: EMITTER_PASS_WITHOUT_EVIDENCE,
59
+ element: EMITTER_PASS_WITHOUT_EVIDENCE,
60
+ file: '',
61
+ line: 0,
62
+ message: 'checkAll() was called with no rules, so this run examined nothing and cannot ' +
63
+ 'report a pass. Pass the rules you meant to check. If the array is computed — ' +
64
+ "a preset in `report: 'builders'` mode, say — the emptiness is upstream, and " +
65
+ 'the preset is where it has to be declared or fixed; there is no declaration ' +
66
+ 'form at this door.',
67
+ suggestion: 'Pass the rules you meant to check. If the array is computed and legitimately ' +
68
+ 'empty, declare that where it is built — skipping the checkAll() call instead ' +
69
+ 'removes the check rather than satisfying it. ' +
70
+ UNSUPPRESSABLE,
71
+ bypassFilters: true,
72
+ },
73
+ ]);
74
+ }
75
+ const receipt = mergeCollectResults(rules.map((rule) => rule.violations()));
76
+ // ADR-008: this function owns its reporting below, so the gate runs under
77
+ // `report: 'return'` and hands the findings back instead of emitting them.
78
+ // An emitter finding carries `bypassFilters`, so it survives both the baseline
79
+ // (`packages/core/src/baseline.ts:283`) and the diff filter, and it is
80
+ // error-severity, so it rides the throw at the bottom.
81
+ //
82
+ // One option, one finding (plan 0074). A preset fans a single bad option out
83
+ // across every generated rule, and only an aggregation point can see that.
84
+ let violations = dedupeConfigFindings(finishPreset(receipt, { report: 'return' }));
85
+ if (options?.baseline) {
86
+ violations = options.baseline.filterNew(violations);
87
+ }
88
+ // `checkAll` filters once for the whole array, so like the CLI it can state
89
+ // the real number (plan 0071). The per-rule terminals cannot — see
90
+ // `core/diff-disclosure.ts`.
91
+ let notice;
92
+ if (options?.diff) {
93
+ const before = violations.length;
94
+ violations = options.diff.filterToChanged(violations);
95
+ notice = suppressionNotice(before - violations.length, options.diff.size, options.diff.baseBranch);
96
+ if (notice !== undefined)
97
+ writeStderr(notice);
98
+ }
99
+ // `reason` is rendered as each violation's "Why:" line on the terminal path
100
+ // (`format.ts`: `v.because ?? reason`), so a RUN-level notice must not travel
101
+ // that way — it would appear as the justification for an unrelated finding.
102
+ // `summary.reason` in JSON is genuinely run-level, so it goes there, and
103
+ // stderr carries it for every other format. Found by sabotage: removing the
104
+ // `writeStderr` call left the tests green because the notice was reaching
105
+ // stderr through the "Why:" line instead.
106
+ // Bug 0203 — the third emitter, and the same contract `executeCheck` and
107
+ // `deliver()` now honour. A `checkAll()` at module scope used to print its
108
+ // findings before an aggregating caller saw them, and the caller then reported
109
+ // the same violations again off the throw below.
110
+ //
111
+ // **Suppress exactly what rides the throw, and nothing else** — ADR-008's
112
+ // amendment, and this function is the case that gives it teeth. The throw at the
113
+ // bottom carries only the ERROR-severity subset, so warn-severity findings ride
114
+ // nothing. Suppressing them too is not "the caller will report it", it is
115
+ // deleting them: measured, four warn findings produced and discarded under
116
+ // `✓ eess-ts — 4 rules across 1 file · 0 failing`, exit 0. A fake green through
117
+ // this package's own CLI. The first version of this guard did exactly that.
118
+ //
119
+ // The flag defaults to `false`, so `checkAll()` in a test file — where nobody
120
+ // aggregates — still prints everything, exactly as before.
121
+ const ridesTheThrow = (v) => (v.severity ?? 'error') === 'error';
122
+ const toWrite = callerAggregates() ? violations.filter((v) => !ridesTheThrow(v)) : violations;
123
+ if (toWrite.length > 0 || (!callerAggregates() && options?.format === 'json')) {
124
+ writeReport(toWrite, options?.format, options?.format === 'json' ? notice : undefined, untestedRules());
125
+ }
126
+ // Bug 0015 reaches the in-test path too. `checkAll` is the vitest-side
127
+ // equivalent of `runCheck`, and a disclosure the recommended runner never
128
+ // shows is a disclosure that does not exist — the same argument that got
129
+ // `diagnose()` exported for the vitest half of the audience. The residual,
130
+ // stated: a bare `.check()` per rule has no run boundary to reset or report
131
+ // at, so it still shows nothing.
132
+ if (options?.format !== 'json') {
133
+ const coverage = edgeCoverageNotice();
134
+ if (coverage !== undefined)
135
+ writeStderr(`${coverage}\n`);
136
+ }
137
+ // Inline exclusion comments, same footnote position and the same reason. Kept
138
+ // out of the JSON prose for the same reason coverage is: a consumer parsing
139
+ // that document gets the identities structurally, not as a sentence to grep.
140
+ if (options?.format !== 'json') {
141
+ const suppressed = commentSuppressionNotice();
142
+ if (suppressed !== undefined)
143
+ writeStderr(`${suppressed}\n`);
144
+ }
145
+ const errors = violations.filter(ridesTheThrow);
146
+ if (errors.length > 0) {
147
+ throw new ArchRuleError(errors);
148
+ }
149
+ }
150
+ //# sourceMappingURL=check-all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-all.js","sourceRoot":"","sources":["../../src/core/check-all.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,YAAY,EACZ,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAA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AAC,CAAA;IAC9D,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;IAC/C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { Predicate } from '@nielspeter/eess';
2
+ import type { TypeMatcher } from './type-matcher.js';
3
+ /**
4
+ * Negates a predicate or type matcher.
5
+ *
6
+ * Accepts both `Predicate<T>` objects (used in `.that()` chains) and
7
+ * `TypeMatcher` functions (used in `.should()` condition arguments).
8
+ *
9
+ * @example
10
+ * // Negate a predicate:
11
+ * functions(p).that().satisfy(not(areAsync())).should()...
12
+ *
13
+ * // Negate a type matcher:
14
+ * .should().haveReturnTypeMatching(not(matching(/void/)))
15
+ */
16
+ export declare function not<T>(input: Predicate<T>): Predicate<T>;
17
+ export declare function not(input: TypeMatcher): TypeMatcher;
18
+ /**
19
+ * Combines predicates or type matchers with AND logic.
20
+ *
21
+ * All inputs must be the same kind: either all `Predicate<T>` or all
22
+ * `TypeMatcher`. Requires at least one argument.
23
+ *
24
+ * @example
25
+ * // Combine predicates:
26
+ * functions(p).that().satisfy(and(areAsync(), areExported())).should()...
27
+ *
28
+ * // Combine type matchers:
29
+ * .should().haveReturnTypeMatching(and(matching(/Promise/), not(matching(/void/))))
30
+ */
31
+ export declare function and<T>(...predicates: Predicate<T>[]): Predicate<T>;
32
+ export declare function and(...matchers: TypeMatcher[]): TypeMatcher;
33
+ /**
34
+ * Combines predicates or type matchers with OR logic.
35
+ *
36
+ * All inputs must be the same kind: either all `Predicate<T>` or all
37
+ * `TypeMatcher`. Requires at least one argument.
38
+ *
39
+ * @example
40
+ * // Combine predicates:
41
+ * functions(p).that().satisfy(or(areAsync(), areExported())).should()...
42
+ *
43
+ * // Combine type matchers:
44
+ * .should().haveReturnTypeMatching(or(matching(/Promise/), matching(/Collection/)))
45
+ */
46
+ export declare function or<T>(...predicates: Predicate<T>[]): Predicate<T>;
47
+ export declare function or(...matchers: TypeMatcher[]): TypeMatcher;
48
+ //# sourceMappingURL=combinators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../src/core/combinators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAOpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AACzD,wBAAgB,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAA;AAsBpD;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AACnE,wBAAgB,GAAG,CAAC,GAAG,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;AAK5D;;;;;;;;;;;;GAYG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAClE,wBAAgB,EAAE,CAAC,GAAG,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { combineGlobs, negateGlobs, assertHomogeneous as kernelAssertHomogeneous, } from '@nielspeter/eess/internal';
2
+ export function not(input) {
3
+ if (typeof input === 'function') {
4
+ return (type) => !input(type);
5
+ }
6
+ return {
7
+ description: `not (${input.description})`,
8
+ test: (element) => !input.test(element),
9
+ // Negation-normal-form push-down: `op` inverts as well as `polarity`.
10
+ // `not(unsatisfiable)` selects everything, so a negated site is
11
+ // over-selection rather than vacuity and can never be a fault — but a
12
+ // `not` nested inside the subtree flips it back, which is why this cannot
13
+ // just flip polarity. See `negateGlobs`.
14
+ globs: input.globs && negateGlobs(input.globs),
15
+ };
16
+ }
17
+ /** The kernel's, with this dialect's noun for the function kind. */
18
+ function assertHomogeneous(inputs) {
19
+ kernelAssertHomogeneous(inputs, 'TypeMatcher');
20
+ }
21
+ export function and(...inputs) {
22
+ return combine(inputs, 'all');
23
+ }
24
+ export function or(...inputs) {
25
+ return combine(inputs, 'any');
26
+ }
27
+ /**
28
+ * The body `and()` and `or()` share — see the kernel's `combine()`, which this
29
+ * mirrors for `TypeMatcher`. Three choices must agree (quantifier, joining
30
+ * word, glob node) and deriving all three from `op` is what makes a mismatch
31
+ * unreachable: pairing `some` with an `'all'` glob node reports a live selector
32
+ * as dead.
33
+ */
34
+ function combine(inputs, op) {
35
+ assertHomogeneous(inputs);
36
+ const holds = (xs, f) => op === 'all' ? xs.every(f) : xs.some(f);
37
+ if (typeof inputs[0] === 'function') {
38
+ const matchers = inputs.filter((input) => typeof input === 'function');
39
+ const fn = (type) => holds(matchers, (m) => m(type));
40
+ return fn;
41
+ }
42
+ const predicates = inputs.filter((input) => typeof input !== 'function');
43
+ return {
44
+ description: predicates.map((p) => p.description).join(op === 'all' ? ' and ' : ' or '),
45
+ test: (element) => holds(predicates, (p) => p.test(element)),
46
+ globs: combineGlobs(op, predicates.map((p) => p.globs)),
47
+ };
48
+ }
49
+ //# sourceMappingURL=combinators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combinators.js","sourceRoot":"","sources":["../../src/core/combinators.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,IAAI,uBAAuB,GAC7C,MAAM,2BAA2B,CAAA;AAiBlC,MAAM,UAAU,GAAG,CAAI,KAAiC;IACtD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC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QAC5F,MAAM,EAAE,GAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QACjE,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAyB,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAA;IAC/F,OAAO;QACL,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACvF,IAAI,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/D,KAAK,EAAE,YAAY,CACjB,EAAE,EACF,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAC/B;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { Node, SyntaxKind } from 'ts-morph';
2
+ /**
3
+ * Every descendant of `node` with the given kind, walked once per file version.
4
+ *
5
+ * A drop-in replacement for `node.getDescendantsOfKind(kind)`. Returns
6
+ * `readonly` because the array is shared: a caller that sorted or spliced it
7
+ * would corrupt every later matcher over the same body.
8
+ */
9
+ export declare function descendantsOfKind(node: Node, kind: SyntaxKind): readonly Node[];
10
+ /**
11
+ * Every descendant of `node`, walked once per file version.
12
+ *
13
+ * The kind-independent twin of {@link descendantsOfKind}, for `findMatchesBroad`
14
+ * — the strategy `expression()` and `comment()` take, having no `syntaxKinds` to
15
+ * narrow by.
16
+ *
17
+ * **Measured** on this repository, 1,698 function bodies / 117,949 descendants,
18
+ * ts-morph's wrapper cache already warm:
19
+ *
20
+ * getDescendants() 49 ms <- what this removes
21
+ * + getText() on each 71 ms
22
+ * + regex test on each 68 ms
23
+ *
24
+ * The walk is roughly three quarters of a broad matcher's cost; the filter is the
25
+ * rest and is not shareable — `expression()`'s regex differs per matcher.
26
+ * (`comment()`'s dedup state was the other half of this until bug 0034 removed
27
+ * it; the filter is still per-matcher.) End to end, six successive broad
28
+ * rules over the same bodies: **~57 ms each becomes ~17 ms each.**
29
+ *
30
+ * The memory objection — that this retains every wrapper in every body rather
31
+ * than one kind's worth — does not survive checking. ts-morph's own
32
+ * `ForgetfulNodeCache` already holds every wrapper it creates for the lifetime of
33
+ * the `SourceFile`, so the array adds N references, not N objects.
34
+ */
35
+ export declare function allDescendants(node: Node): readonly Node[];
36
+ //# sourceMappingURL=descendant-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descendant-cache.d.ts","sourceRoot":"","sources":["../../src/core/descendant-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,UAAU,CAAA;AA0I5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS,IAAI,EAAE,CA0B/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,IAAI,EAAE,CAe1D"}
@@ -0,0 +1,117 @@
1
+ import { registerCacheReset } from '@nielspeter/eess/internal';
2
+ import { invalidateOnModify } from './invalidate-on-modify.js';
3
+ let byFile = new WeakMap();
4
+ /** The kind-independent walk, in the same per-file lifetime as {@link byFile}. */
5
+ let allByFile = new WeakMap();
6
+ const watched = new WeakSet();
7
+ registerCacheReset(() => {
8
+ byFile = new WeakMap();
9
+ allByFile = new WeakMap();
10
+ });
11
+ /**
12
+ * Register the invalidation listener for a file, once.
13
+ *
14
+ * Not once per cache miss: a watch session that re-evaluates rules would
15
+ * otherwise accumulate one listener per rule execution. Both maps are dropped
16
+ * together, because the same event invalidates both.
17
+ *
18
+ * The closure reads `byFile` / `allByFile` as **live bindings** rather than
19
+ * capturing them, which is what keeps invalidation working after
20
+ * `registerCacheReset` replaces the maps. Capturing by value made a post-reset
21
+ * edit invisible and passed the entire suite — there is a test named for it.
22
+ */
23
+ function watchOnce(sourceFile) {
24
+ invalidateOnModify(sourceFile, watched, (file) => {
25
+ byFile.delete(file);
26
+ allByFile.delete(file);
27
+ });
28
+ }
29
+ /**
30
+ * Whether a cached list can still be read.
31
+ *
32
+ * Endpoints only, and that is not a heuristic: ts-morph's
33
+ * `ForgetfulNodeCache.forgetLastPoint` forgets a whole created-in-block set at
34
+ * once, so a partially-forgotten list is not a shape the mechanism produces.
35
+ * Walking the full list on every hit would cost what this module exists to save.
36
+ */
37
+ function usable(nodes) {
38
+ const first = nodes[0];
39
+ if (first === undefined)
40
+ return true;
41
+ const last = nodes[nodes.length - 1];
42
+ return !first.wasForgotten() && last !== undefined && !last.wasForgotten();
43
+ }
44
+ /**
45
+ * Every descendant of `node` with the given kind, walked once per file version.
46
+ *
47
+ * A drop-in replacement for `node.getDescendantsOfKind(kind)`. Returns
48
+ * `readonly` because the array is shared: a caller that sorted or spliced it
49
+ * would corrupt every later matcher over the same body.
50
+ */
51
+ export function descendantsOfKind(node, kind) {
52
+ const sourceFile = node.getSourceFile();
53
+ let perNode = byFile.get(sourceFile);
54
+ if (perNode === undefined) {
55
+ perNode = new Map();
56
+ byFile.set(sourceFile, perNode);
57
+ }
58
+ watchOnce(sourceFile);
59
+ let byKind = perNode.get(node);
60
+ if (byKind === undefined) {
61
+ byKind = new Map();
62
+ perNode.set(node, byKind);
63
+ }
64
+ const hit = byKind.get(kind);
65
+ // `usable`, not just `!== undefined`. A forget point forgets the walked
66
+ // DESCENDANTS while the key node stays live and unforgotten, so serving the
67
+ // cached list makes the next read throw where an uncached walk succeeded.
68
+ // Measured as a regression against `main`, through the rule path: 1 violation
69
+ // before, `InvalidOperationError` after. Re-walking is the correct answer —
70
+ // the nodes are gone, so the list is simply wrong.
71
+ if (hit !== undefined && usable(hit))
72
+ return hit;
73
+ const walked = node.getDescendantsOfKind(kind);
74
+ byKind.set(kind, walked);
75
+ return walked;
76
+ }
77
+ /**
78
+ * Every descendant of `node`, walked once per file version.
79
+ *
80
+ * The kind-independent twin of {@link descendantsOfKind}, for `findMatchesBroad`
81
+ * — the strategy `expression()` and `comment()` take, having no `syntaxKinds` to
82
+ * narrow by.
83
+ *
84
+ * **Measured** on this repository, 1,698 function bodies / 117,949 descendants,
85
+ * ts-morph's wrapper cache already warm:
86
+ *
87
+ * getDescendants() 49 ms <- what this removes
88
+ * + getText() on each 71 ms
89
+ * + regex test on each 68 ms
90
+ *
91
+ * The walk is roughly three quarters of a broad matcher's cost; the filter is the
92
+ * rest and is not shareable — `expression()`'s regex differs per matcher.
93
+ * (`comment()`'s dedup state was the other half of this until bug 0034 removed
94
+ * it; the filter is still per-matcher.) End to end, six successive broad
95
+ * rules over the same bodies: **~57 ms each becomes ~17 ms each.**
96
+ *
97
+ * The memory objection — that this retains every wrapper in every body rather
98
+ * than one kind's worth — does not survive checking. ts-morph's own
99
+ * `ForgetfulNodeCache` already holds every wrapper it creates for the lifetime of
100
+ * the `SourceFile`, so the array adds N references, not N objects.
101
+ */
102
+ export function allDescendants(node) {
103
+ const sourceFile = node.getSourceFile();
104
+ let perNode = allByFile.get(sourceFile);
105
+ if (perNode === undefined) {
106
+ perNode = new Map();
107
+ allByFile.set(sourceFile, perNode);
108
+ }
109
+ watchOnce(sourceFile);
110
+ const hit = perNode.get(node);
111
+ if (hit !== undefined && usable(hit))
112
+ return hit;
113
+ const walked = node.getDescendants();
114
+ perNode.set(node, walked);
115
+ return walked;
116
+ }
117
+ //# sourceMappingURL=descendant-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descendant-cache.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