@md-code/follow-architecture 0.3.0 → 0.3.3

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 (382) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1341 -472
  3. package/dist/args.d.ts +4 -0
  4. package/dist/args.js +18 -1
  5. package/dist/bin/follow-architecture.js +3 -3
  6. package/dist/closure-project.d.ts +4 -0
  7. package/dist/closure-project.js +122 -0
  8. package/dist/code-entities/classify.d.ts +11 -0
  9. package/dist/code-entities/classify.js +45 -0
  10. package/dist/code-entities/connector.d.ts +8 -0
  11. package/dist/code-entities/connector.js +119 -0
  12. package/dist/code-entities/entities.d.ts +9 -0
  13. package/dist/{code-roles/roles.js → code-entities/entities.js} +81 -54
  14. package/dist/code-entities/project.d.ts +21 -0
  15. package/dist/code-entities/project.js +249 -0
  16. package/dist/code-entities/walk.d.ts +31 -0
  17. package/dist/code-entities/walk.js +95 -0
  18. package/dist/config-options.d.ts +23 -0
  19. package/dist/config-options.js +18 -1
  20. package/dist/config-project.js +10 -2
  21. package/dist/config-report.d.ts +1 -1
  22. package/dist/config-report.js +20 -3
  23. package/dist/config-rule.d.ts +25 -0
  24. package/dist/config-rule.js +89 -6
  25. package/dist/config-state.d.ts +14 -3
  26. package/dist/config-state.js +180 -17
  27. package/dist/config.d.ts +25 -0
  28. package/dist/css/index.d.ts +11 -7
  29. package/dist/css/index.js +124 -23
  30. package/dist/css/syntax/css/gate.js +5 -5
  31. package/dist/css/syntax/css/index.d.ts +1 -1
  32. package/dist/css/syntax/css/index.js +1 -1
  33. package/dist/css/syntax/css/reference.d.ts +1 -1
  34. package/dist/css/syntax/css/reference.js +15 -3
  35. package/dist/css/syntax/language.d.ts +1 -1
  36. package/dist/css/syntax/language.js +4 -2
  37. package/dist/css/syntax/scss/index.d.ts +2 -2
  38. package/dist/css/syntax/scss/index.js +1 -1
  39. package/dist/css/syntax/scss/reference.d.ts +1 -1
  40. package/dist/css/syntax/scss/reference.js +7 -1
  41. package/dist/css/syntax/styled/document.d.ts +3 -3
  42. package/dist/css/syntax/styled/document.js +17 -7
  43. package/dist/css/syntax/styled/markup.d.ts +1 -1
  44. package/dist/css/syntax/styled/markup.js +22 -14
  45. package/dist/css/syntax/styled/tags.d.ts +2 -0
  46. package/dist/css/syntax/styled/tags.js +22 -0
  47. package/dist/css/syntax/styled/template.js +10 -4
  48. package/dist/css/syntax/tailwind/tailwind.js +4 -4
  49. package/dist/css/value/check.d.ts +1 -1
  50. package/dist/css/value/check.js +1 -1
  51. package/dist/css/value/expression/arithmetic.d.ts +2 -2
  52. package/dist/css/value/expression/arithmetic.js +7 -3
  53. package/dist/css/value/expression/block.d.ts +2 -2
  54. package/dist/css/value/expression/block.js +4 -3
  55. package/dist/css/value/expression/conditional.d.ts +2 -2
  56. package/dist/css/value/expression/conditional.js +1 -1
  57. package/dist/css/value/expression/index.d.ts +2 -2
  58. package/dist/css/value/expression/index.js +10 -6
  59. package/dist/css/value/expression/map.d.ts +2 -2
  60. package/dist/css/value/expression/map.js +2 -2
  61. package/dist/css/value/object/index.d.ts +2 -2
  62. package/dist/css/value/object/index.js +14 -4
  63. package/dist/css/value/object/members.d.ts +2 -2
  64. package/dist/css/value/object/node.js +9 -4
  65. package/dist/css/value/object/path.d.ts +3 -3
  66. package/dist/css/value/object/path.js +10 -4
  67. package/dist/css/value/pieces.d.ts +3 -3
  68. package/dist/css/value/pieces.js +14 -4
  69. package/dist/css/value/resolve.js +15 -5
  70. package/dist/css/value/scope.d.ts +3 -2
  71. package/dist/css/value/scope.js +25 -7
  72. package/dist/css/value/substitute.js +43 -11
  73. package/dist/entities/architecture.d.ts +28 -25
  74. package/dist/entities/ast/assignments-raw.d.ts +1 -1
  75. package/dist/entities/ast/assignments-raw.js +61 -8
  76. package/dist/entities/ast/assignments-tagged.d.ts +1 -1
  77. package/dist/entities/ast/assignments-tagged.js +22 -7
  78. package/dist/entities/ast/assignments.d.ts +1 -1
  79. package/dist/entities/ast/assignments.js +6 -4
  80. package/dist/entities/ast/branches.d.ts +1 -1
  81. package/dist/entities/ast/calls.d.ts +1 -1
  82. package/dist/entities/ast/calls.js +19 -3
  83. package/dist/entities/ast/classes.d.ts +1 -1
  84. package/dist/entities/ast/classes.js +5 -1
  85. package/dist/entities/ast/comments.d.ts +3 -2
  86. package/dist/entities/ast/comments.js +47 -17
  87. package/dist/entities/ast/declaration.d.ts +1 -1
  88. package/dist/entities/ast/depth.d.ts +2 -2
  89. package/dist/entities/ast/depth.js +15 -8
  90. package/dist/entities/ast/enums.d.ts +1 -1
  91. package/dist/entities/ast/export-chain.d.ts +15 -0
  92. package/dist/entities/ast/export-chain.js +171 -0
  93. package/dist/entities/ast/file-exports.d.ts +1 -1
  94. package/dist/entities/ast/file-exports.js +26 -3
  95. package/dist/entities/ast/file-facts.d.ts +6 -3
  96. package/dist/entities/ast/file-facts.js +33 -4
  97. package/dist/entities/ast/file-imports.d.ts +1 -1
  98. package/dist/entities/ast/file-imports.js +26 -3
  99. package/dist/entities/ast/file.d.ts +2 -2
  100. package/dist/entities/ast/file.js +2 -1
  101. package/dist/entities/ast/functions.d.ts +1 -1
  102. package/dist/entities/ast/functions.js +13 -4
  103. package/dist/entities/ast/heritage.d.ts +1 -1
  104. package/dist/entities/ast/heritage.js +9 -1
  105. package/dist/entities/ast/index.d.ts +6 -3
  106. package/dist/entities/ast/index.js +82 -26
  107. package/dist/entities/ast/kind.d.ts +1 -1
  108. package/dist/entities/ast/kind.js +7 -1
  109. package/dist/entities/ast/modifiers.d.ts +1 -1
  110. package/dist/entities/ast/modifiers.js +4 -4
  111. package/dist/entities/ast/project.js +33 -2
  112. package/dist/entities/ast/properties.d.ts +1 -1
  113. package/dist/entities/ast/properties.js +10 -5
  114. package/dist/entities/ast/resolve.d.ts +1 -1
  115. package/dist/entities/ast/resolve.js +4 -4
  116. package/dist/entities/ast/tree.d.ts +4 -2
  117. package/dist/entities/ast/tree.js +184 -17
  118. package/dist/entities/ast/types.d.ts +1 -1
  119. package/dist/entities/ast/types.js +2 -1
  120. package/dist/entities/ast/usage.d.ts +1 -1
  121. package/dist/entities/ast/usage.js +1 -1
  122. package/dist/entities/ast/variables.d.ts +1 -1
  123. package/dist/entities/context.d.ts +4 -4
  124. package/dist/entities/facts.d.ts +36 -13
  125. package/dist/entities/findings.d.ts +3 -3
  126. package/dist/entities/kinds.d.ts +1 -1
  127. package/dist/entities/kinds.js +131 -30
  128. package/dist/entities/location/homes.d.ts +10 -10
  129. package/dist/entities/location/homes.js +74 -48
  130. package/dist/entities/location/place.d.ts +1 -1
  131. package/dist/entities/location/place.js +10 -3
  132. package/dist/entities/location/where.d.ts +8 -6
  133. package/dist/entities/location/where.js +79 -30
  134. package/dist/entities/location.d.ts +3 -3
  135. package/dist/entities/location.js +17 -17
  136. package/dist/entities/operators.js +1 -1
  137. package/dist/entities/overview/data.d.ts +6 -6
  138. package/dist/entities/overview/decision.d.ts +11 -11
  139. package/dist/entities/overview/finding.d.ts +10 -10
  140. package/dist/entities/overview/graph.d.ts +28 -11
  141. package/dist/entities/overview/input.d.ts +2 -2
  142. package/dist/entities/overview/summaries.d.ts +17 -15
  143. package/dist/entities/queries.d.ts +1 -1
  144. package/dist/entities/queries.js +72 -12
  145. package/dist/entities/repair.d.ts +1 -1
  146. package/dist/entities/repair.js +8 -2
  147. package/dist/entities/schema.d.ts +17 -3
  148. package/dist/entities/schema.js +74 -16
  149. package/dist/entities/story.d.ts +5 -5
  150. package/dist/entities/structure-facts.d.ts +1 -1
  151. package/dist/entities/token.d.ts +4 -4
  152. package/dist/entities/tree/build.d.ts +4 -3
  153. package/dist/entities/tree/build.js +95 -44
  154. package/dist/entities/tree/entries.d.ts +3 -3
  155. package/dist/entities/tree/entries.js +41 -16
  156. package/dist/entities/tree/index.d.ts +2 -2
  157. package/dist/entities/tree/index.js +1 -1
  158. package/dist/entities/tree/match.d.ts +2 -2
  159. package/dist/entities/tree/match.js +9 -5
  160. package/dist/fa-index.d.ts +16 -0
  161. package/dist/fa-index.js +165 -0
  162. package/dist/fa-open.d.ts +51 -0
  163. package/dist/fa-open.js +232 -0
  164. package/dist/fa-store.d.ts +22 -0
  165. package/dist/fa-store.js +222 -0
  166. package/dist/fa-values.d.ts +37 -0
  167. package/dist/fa-values.js +104 -0
  168. package/dist/facts-record.d.ts +45 -0
  169. package/dist/facts-record.js +287 -0
  170. package/dist/frameworks/angular/index.d.ts +2 -2
  171. package/dist/frameworks/angular/index.js +2 -1
  172. package/dist/frameworks/facet.d.ts +3 -1
  173. package/dist/frameworks/facet.js +13 -0
  174. package/dist/frameworks/index.d.ts +1 -1
  175. package/dist/frameworks/index.js +8 -4
  176. package/dist/frameworks/react/index.d.ts +2 -2
  177. package/dist/frameworks/react/index.js +33 -10
  178. package/dist/frameworks/test/index.d.ts +6 -0
  179. package/dist/frameworks/test/index.js +157 -0
  180. package/dist/frameworks/vue/index.d.ts +2 -2
  181. package/dist/frameworks/vue/index.js +2 -1
  182. package/dist/ignore.d.ts +3 -0
  183. package/dist/ignore.js +48 -0
  184. package/dist/index-file.d.ts +43 -0
  185. package/dist/index-file.js +218 -0
  186. package/dist/index-run.d.ts +39 -0
  187. package/dist/index-run.js +217 -0
  188. package/dist/index-zone.d.ts +25 -0
  189. package/dist/index-zone.js +209 -0
  190. package/dist/main.d.ts +5 -2
  191. package/dist/main.js +207 -34
  192. package/dist/nodes/child-entities.d.ts +3 -0
  193. package/dist/nodes/child-entities.js +12 -0
  194. package/dist/nodes/children.d.ts +4 -4
  195. package/dist/nodes/children.js +54 -11
  196. package/dist/nodes/finally/emit.d.ts +3 -3
  197. package/dist/nodes/finally/emit.js +26 -10
  198. package/dist/nodes/finally/entities.d.ts +13 -0
  199. package/dist/nodes/finally/entities.js +42 -0
  200. package/dist/nodes/finally/index.d.ts +6 -6
  201. package/dist/nodes/finally/index.js +8 -8
  202. package/dist/nodes/finally/queries.d.ts +2 -2
  203. package/dist/nodes/finally/queries.js +7 -4
  204. package/dist/nodes/finally/relations-access.d.ts +2 -2
  205. package/dist/nodes/finally/relations-access.js +22 -18
  206. package/dist/nodes/finally/relations-edge.d.ts +5 -5
  207. package/dist/nodes/finally/relations-edge.js +67 -44
  208. package/dist/nodes/finally/relations-group.d.ts +7 -7
  209. package/dist/nodes/finally/relations-group.js +28 -25
  210. package/dist/nodes/finally/relations.d.ts +2 -2
  211. package/dist/nodes/finally/relations.js +16 -12
  212. package/dist/nodes/finally/required.d.ts +3 -3
  213. package/dist/nodes/finally/required.js +9 -7
  214. package/dist/nodes/finally/violation.d.ts +2 -2
  215. package/dist/nodes/similar.d.ts +3 -3
  216. package/dist/nodes/similar.js +61 -49
  217. package/dist/piece-forms.d.ts +9 -0
  218. package/dist/piece-forms.js +68 -0
  219. package/dist/{pipeline-roles.d.ts → pipeline-entities.d.ts} +2 -2
  220. package/dist/{pipeline-roles.js → pipeline-entities.js} +32 -28
  221. package/dist/pipeline-facts.d.ts +4 -3
  222. package/dist/pipeline-facts.js +47 -55
  223. package/dist/{pipeline-unroled.d.ts → pipeline-unclassified.d.ts} +2 -2
  224. package/dist/{pipeline-unroled.js → pipeline-unclassified.js} +58 -63
  225. package/dist/pipeline.js +19 -64
  226. package/dist/release-file.d.ts +3 -0
  227. package/dist/release-file.js +13 -0
  228. package/dist/report/asks.d.ts +3 -3
  229. package/dist/report/asks.js +16 -6
  230. package/dist/report/configErrors.d.ts +55 -27
  231. package/dist/report/configErrors.js +81 -35
  232. package/dist/report/errorTypes/codes/structure.d.ts +1 -1
  233. package/dist/report/errorTypes/codes/structure.js +9 -9
  234. package/dist/report/errorTypes/decision-maker.d.ts +5 -5
  235. package/dist/report/errorTypes/decision-maker.js +4 -4
  236. package/dist/report/errorTypes/destinations.d.ts +5 -5
  237. package/dist/report/errorTypes/destinations.js +52 -34
  238. package/dist/report/errorTypes/finding-type.d.ts +3 -3
  239. package/dist/report/errorTypes/index.d.ts +1 -1
  240. package/dist/report/errorTypes/types/fileContents.d.ts +4 -4
  241. package/dist/report/errorTypes/types/fileContents.js +11 -5
  242. package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
  243. package/dist/report/errorTypes/types/{unknownRole.js → unknownEntity.js} +12 -7
  244. package/dist/report/errorTypes/types/wrongAction.d.ts +5 -5
  245. package/dist/report/errorTypes/types/wrongAction.js +18 -13
  246. package/dist/report/errorTypes/types/wrongPlacement.d.ts +4 -4
  247. package/dist/report/errorTypes/types/wrongPlacement.js +19 -9
  248. package/dist/report/errorTypes/vocabulary/ids.d.ts +2 -2
  249. package/dist/report/errorTypes/vocabulary/ids.js +3 -3
  250. package/dist/report/errorTypes/vocabulary/phrases.d.ts +2 -2
  251. package/dist/report/errorTypes/vocabulary/phrases.js +39 -26
  252. package/dist/report/errorTypes/vocabulary/places.d.ts +3 -3
  253. package/dist/report/errorTypes/vocabulary/places.js +13 -13
  254. package/dist/report/finding-from.d.ts +3 -3
  255. package/dist/report/finding-from.js +14 -9
  256. package/dist/report/notices.d.ts +6 -1
  257. package/dist/report/notices.js +46 -20
  258. package/dist/report/observed.d.ts +19 -0
  259. package/dist/report/observed.js +87 -0
  260. package/dist/report/render-report.d.ts +1 -1
  261. package/dist/report/render-report.js +33 -30
  262. package/dist/report/user-report/build/bundle.js +9 -0
  263. package/dist/report/user-report/build/bundle.prebuilt.js +799 -297
  264. package/dist/report/user-report/data/collect.d.ts +2 -2
  265. package/dist/report/user-report/data/collect.js +15 -12
  266. package/dist/report/user-report/data/entities.d.ts +7 -0
  267. package/dist/report/user-report/data/{roles.js → entities.js} +27 -22
  268. package/dist/report/user-report/data/{role-examples.d.ts → entity-examples.d.ts} +3 -3
  269. package/dist/report/user-report/data/entity-examples.js +126 -0
  270. package/dist/report/user-report/data/{role-filters.d.ts → entity-filters.d.ts} +2 -2
  271. package/dist/report/user-report/data/{role-filters.js → entity-filters.js} +7 -7
  272. package/dist/report/user-report/data/entity-marks.d.ts +5 -0
  273. package/dist/report/user-report/data/{role-marks.js → entity-marks.js} +11 -11
  274. package/dist/report/user-report/data/file-tree.d.ts +3 -3
  275. package/dist/report/user-report/data/file-tree.js +13 -5
  276. package/dist/report/user-report/data/finding-boundary.d.ts +4 -4
  277. package/dist/report/user-report/data/finding-boundary.js +2 -2
  278. package/dist/report/user-report/data/finding-plan.d.ts +5 -5
  279. package/dist/report/user-report/data/finding-plan.js +10 -10
  280. package/dist/report/user-report/data/finding-title.d.ts +2 -2
  281. package/dist/report/user-report/data/finding-title.js +8 -8
  282. package/dist/report/user-report/data/findings.d.ts +4 -4
  283. package/dist/report/user-report/data/findings.js +30 -20
  284. package/dist/report/user-report/data/graph-edges.d.ts +4 -4
  285. package/dist/report/user-report/data/graph-edges.js +19 -19
  286. package/dist/report/user-report/data/graph-entities.d.ts +6 -0
  287. package/dist/report/user-report/data/graph-entities.js +158 -0
  288. package/dist/report/user-report/data/graph-helpers.d.ts +5 -5
  289. package/dist/report/user-report/data/graph-helpers.js +15 -15
  290. package/dist/report/user-report/data/graph.d.ts +5 -4
  291. package/dist/report/user-report/data/graph.js +28 -21
  292. package/dist/report/user-report/data/nodes.d.ts +2 -2
  293. package/dist/report/user-report/data/nodes.js +16 -16
  294. package/dist/report/user-report/data/rules.d.ts +7 -0
  295. package/dist/report/user-report/data/{invariants.js → rules.js} +13 -13
  296. package/dist/report/user-report/data/scan.d.ts +1 -1
  297. package/dist/report/user-report/data/scan.js +2 -2
  298. package/dist/report/user-report/html/shell.d.ts +1 -1
  299. package/dist/report/user-report/html/shell.js +1 -1
  300. package/dist/report/user-report/index.d.ts +1 -1
  301. package/dist/report/user-report/shared/describe.d.ts +1 -1
  302. package/dist/report/user-report/shared/describe.js +6 -6
  303. package/dist/rules/index.d.ts +7 -0
  304. package/dist/{invariants → rules}/index.js +85 -57
  305. package/dist/{invariants → rules}/list-vars.d.ts +2 -2
  306. package/dist/{invariants → rules}/list-vars.js +9 -3
  307. package/dist/{invariants → rules}/name.js +2 -2
  308. package/dist/rules/normalize.d.ts +5 -0
  309. package/dist/{invariants → rules}/normalize.js +35 -32
  310. package/dist/{invariants → rules}/vars.d.ts +9 -7
  311. package/dist/{invariants → rules}/vars.js +5 -5
  312. package/dist/scan-run.d.ts +20 -0
  313. package/dist/scan-run.js +130 -0
  314. package/dist/scripts/audit-report.js +2 -2
  315. package/dist/usage-index.d.ts +4 -0
  316. package/dist/usage-index.js +272 -0
  317. package/dist/usage-mode.d.ts +7 -0
  318. package/dist/usage-mode.js +16 -0
  319. package/dist/usage-pass.d.ts +19 -0
  320. package/dist/usage-pass.js +136 -0
  321. package/dist/usage-prepare.d.ts +2 -0
  322. package/dist/usage-prepare.js +22 -0
  323. package/dist/usage-sweep.d.ts +10 -0
  324. package/dist/usage-sweep.js +254 -0
  325. package/dist/utils/aliases.d.ts +22 -0
  326. package/dist/utils/aliases.js +163 -0
  327. package/dist/utils/classify.d.ts +2 -2
  328. package/dist/utils/classify.js +4 -4
  329. package/dist/utils/distinct.js +4 -2
  330. package/dist/utils/files.js +24 -30
  331. package/dist/utils/fixpoint.js +2 -2
  332. package/dist/utils/host.d.ts +1 -1
  333. package/dist/utils/host.js +4 -1
  334. package/dist/utils/imports.js +66 -12
  335. package/dist/utils/keyed.js +2 -2
  336. package/dist/utils/map-record.js +2 -2
  337. package/dist/utils/packages.d.ts +15 -0
  338. package/dist/utils/packages.js +197 -0
  339. package/dist/utils/path-label.js +3 -1
  340. package/dist/utils/pattern.d.ts +5 -4
  341. package/dist/utils/pattern.js +38 -8
  342. package/dist/utils/permission.d.ts +3 -3
  343. package/dist/utils/permission.js +4 -2
  344. package/dist/utils/plural.js +2 -2
  345. package/dist/utils/qualified.js +4 -4
  346. package/dist/utils/rank.js +2 -2
  347. package/dist/utils/record.js +1 -1
  348. package/dist/utils/search.js +7 -2
  349. package/dist/utils/speak.js +1 -1
  350. package/dist/utils/split.js +14 -1
  351. package/dist/utils/template.d.ts +1 -1
  352. package/dist/utils/template.js +1 -1
  353. package/dist/utils/tokenize.js +6 -1
  354. package/dist/utils/typed-field.js +2 -2
  355. package/dist/utils/verdicts.js +1 -1
  356. package/entities/operators.ts +1 -1
  357. package/package.json +101 -90
  358. package/report/errorTypes/vocabulary/ids.ts +7 -2
  359. package/report/errorTypes/vocabulary/phrases.ts +47 -27
  360. package/report/errorTypes/vocabulary/places.ts +21 -16
  361. package/report/user-report/shared/describe.ts +7 -7
  362. package/dist/code-roles/classify.d.ts +0 -11
  363. package/dist/code-roles/classify.js +0 -43
  364. package/dist/code-roles/connector.d.ts +0 -5
  365. package/dist/code-roles/connector.js +0 -114
  366. package/dist/code-roles/project.d.ts +0 -12
  367. package/dist/code-roles/project.js +0 -122
  368. package/dist/code-roles/roles.d.ts +0 -8
  369. package/dist/invariants/index.d.ts +0 -6
  370. package/dist/invariants/normalize.d.ts +0 -4
  371. package/dist/nodes/child-roles.d.ts +0 -3
  372. package/dist/nodes/child-roles.js +0 -12
  373. package/dist/nodes/finally/roles.d.ts +0 -13
  374. package/dist/nodes/finally/roles.js +0 -41
  375. package/dist/report/errorTypes/types/unknownRole.d.ts +0 -9
  376. package/dist/report/user-report/data/graph-roles.d.ts +0 -5
  377. package/dist/report/user-report/data/graph-roles.js +0 -71
  378. package/dist/report/user-report/data/invariants.d.ts +0 -7
  379. package/dist/report/user-report/data/role-examples.js +0 -94
  380. package/dist/report/user-report/data/role-marks.d.ts +0 -5
  381. package/dist/report/user-report/data/roles.d.ts +0 -7
  382. /package/dist/{invariants → rules}/name.d.ts +0 -0
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.fileObjects = exports.objectsFor = exports.entityScope = exports.projectEntitiesByFile = exports.projectEntityIndex = void 0;
27
+ // THE PROJECT-WIDE CLASSIFY PASS. A query scope may name any code entity
28
+ // (`entity.<slug>`) and read the pieces that carry it ACROSS the repo — a
29
+ // entity's object literals, for instance, live in files other than the one the
30
+ // rule is judging. Classification is per piece and per file, so the pass
31
+ // runs the SAME per-file walk (`collectCandidates` + facets + `classifyEntities`)
32
+ // over every source file and indexes the results by entity.
33
+ //
34
+ // Nothing here knows an entity name: the index is `slug → candidates`, and the
35
+ // literals are the object-literal initializers of an entity's candidates. Cached per
36
+ // project (rebuilt when the project grows), so the whole scan happens once per
37
+ // run, not once per file.
38
+ const fs = __importStar(require("node:fs"));
39
+ const ts_morph_1 = require("ts-morph");
40
+ const imports_1 = require("@md-code/follow-architecture/utils/imports");
41
+ const index_1 = require("@md-code/follow-architecture/entities/ast/index");
42
+ const group_1 = require("@md-code/follow-architecture/utils/group");
43
+ const walk_1 = require("./walk");
44
+ const scan_run_1 = require("@md-code/follow-architecture/scan-run");
45
+ const release_file_1 = require("@md-code/follow-architecture/release-file");
46
+ const emptyIndex = () => ({
47
+ bySlug: new Map(),
48
+ objectsBySlug: new Map(),
49
+ entitiesByFile: new Map(),
50
+ });
51
+ // Strip the wrappers that do not change a value: `(x)`, `x as T`, `x satisfies T`,
52
+ // `x!`. A literal written as `{…} satisfies SomeInterface` carries its members on
53
+ // the wrapped literal, so this is where the object node is found.
54
+ const unwrapToLiteral = (node) => {
55
+ let current = node;
56
+ for (;;) {
57
+ if (ts_morph_1.Node.isParenthesizedExpression(current) ||
58
+ ts_morph_1.Node.isAsExpression(current) ||
59
+ ts_morph_1.Node.isSatisfiesExpression(current) ||
60
+ ts_morph_1.Node.isNonNullExpression(current) ||
61
+ ts_morph_1.Node.isTypeAssertion(current)) {
62
+ current = current.getExpression();
63
+ continue;
64
+ }
65
+ return ts_morph_1.Node.isObjectLiteralExpression(current) ? current : null;
66
+ }
67
+ };
68
+ // The classified candidate a declaration's initializer belongs to: the same name
69
+ // and start line. A variable holding an object literal has one candidate whose
70
+ // `kind.initializer` is that literal, so name+line is unambiguous here.
71
+ const candidateAt = (classified, name, line) => classified.find((c) => c.name === name && c.lines?.[0] === line) ?? null;
72
+ // Push an entity's object literal when the declaration's initializer is one.
73
+ // Exported default (`export default {…}`) is a declaration with the name
74
+ // `default`, so both spellings read the same way.
75
+ const addObject = (entry) => {
76
+ const entity = candidateAt(entry.classified, entry.name, entry.line)?.entity;
77
+ if (!entity)
78
+ return;
79
+ const node = entry.node;
80
+ entry.out.push({ entity, name: entry.name, path: node.getSourceFile().getFilePath(), start: node.getStart() });
81
+ };
82
+ // The object-literal initializers of one file's classified candidates — the ONE
83
+ // walk both the project index and a file's record read.
84
+ const objectEntries = (sf, classified) => {
85
+ const out = [];
86
+ for (const declaration of sf.getVariableDeclarations()) {
87
+ const initializer = declaration.getInitializer();
88
+ const nameNode = declaration.getNameNode();
89
+ if (!initializer || !ts_morph_1.Node.isIdentifier(nameNode))
90
+ continue;
91
+ const literal = unwrapToLiteral(initializer);
92
+ if (literal)
93
+ addObject({ out, classified, name: nameNode.getText(), line: declaration.getStartLineNumber(), node: literal });
94
+ }
95
+ for (const assignment of sf.getExportAssignments()) {
96
+ const literal = unwrapToLiteral(assignment.getExpression());
97
+ if (literal)
98
+ addObject({ out, classified, name: "default", line: assignment.getStartLineNumber(), node: literal });
99
+ }
100
+ return out;
101
+ };
102
+ // The object-literal initializers of one file's classified candidates.
103
+ const collectObjects = (sf, classified, objectsBySlug) => {
104
+ for (const object of objectEntries(sf, classified)) {
105
+ (0, group_1.pushGroup)(objectsBySlug, object.entity, { name: object.name, path: object.path, start: object.start });
106
+ }
107
+ };
108
+ // One file's literals as its RECORD keeps them: entity, name, position. A record
109
+ // must be data only, so the path (the same for every entry) is not repeated.
110
+ const fileObjects = (sf, classified) => sf === null ? [] : objectEntries(sf, classified).map(({ entity, name, start }) => ({ entity, name, start }));
111
+ exports.fileObjects = fileObjects;
112
+ // One file's classified candidates, with the facets an entity may be recognised
113
+ // by. The facets are attached exactly as the per-file pipeline attaches them,
114
+ // so an entity classifies the same way here and there.
115
+ // A per-file classify walk; it is not the depth walk's `read`.
116
+ const classifyFile = (sf, run) => {
117
+ const repoRoot = run.arch.repoRoot ?? ".";
118
+ const rel = (0, imports_1.toRel)(repoRoot, sf.getFilePath());
119
+ // These candidates outlive the file's syntax (the index is read long after the
120
+ // template was), and nothing resolves a rule against them: record mode keeps
121
+ // the template's position and registers no capability.
122
+ const walked = (0, walk_1.walkFile)({
123
+ rel,
124
+ arch: run.arch,
125
+ repoRoot,
126
+ repoFiles: run.repoFiles,
127
+ aliases: run.arch.aliases ?? {},
128
+ sf,
129
+ usage: false,
130
+ record: true,
131
+ });
132
+ return { rel, candidates: walked.classified.candidates, present: walked.classified.present };
133
+ };
134
+ // The project index, built once per run. The cache is keyed by the scanned file list
135
+ // itself, so its entry dies with the run that produced it — an index that
136
+ // outlived its run would hold the run's syntax alive (the candidates carry the
137
+ // literals they were read from).
138
+ const PROJECT_INDEX = new WeakMap();
139
+ const projectEntityIndex = (arch, repoFiles) => {
140
+ const files = (0, scan_run_1.scannedFiles)();
141
+ const known = PROJECT_INDEX.get(files);
142
+ if (known)
143
+ return known;
144
+ // A run that read its facts back from the index has the same index already:
145
+ // the per-file answers were classified when the records were written, so the
146
+ // pass over every file's syntax must not happen a second time.
147
+ const adopted = (0, scan_run_1.adoptedEntityIndex)() ?? (0, scan_run_1.sourcedRegistry)();
148
+ if (adopted) {
149
+ PROJECT_INDEX.set(files, adopted);
150
+ return adopted;
151
+ }
152
+ const index = emptyIndex();
153
+ const project = (0, scan_run_1.wholeRepoProject)();
154
+ for (const abs of files) {
155
+ const sf = project.getSourceFile(abs);
156
+ if (!sf)
157
+ continue;
158
+ const { rel, candidates: classified, present } = classifyFile(sf, { arch, repoFiles });
159
+ for (const candidate of classified) {
160
+ if (!candidate.entity)
161
+ continue;
162
+ (0, group_1.pushGroup)(index.bySlug, candidate.entity, candidate);
163
+ }
164
+ index.entitiesByFile.set(rel, new Set(present));
165
+ collectObjects(sf, classified, index.objectsBySlug);
166
+ // This file is measured: the index keeps only plain facts, so the syntax it
167
+ // needed is given back instead of being held until the run ends.
168
+ (0, release_file_1.releaseFile)(sf);
169
+ }
170
+ PROJECT_INDEX.set(files, index);
171
+ return index;
172
+ };
173
+ exports.projectEntityIndex = projectEntityIndex;
174
+ // The `entity` scope object: entity slug → the project-wide pieces carrying it.
175
+ // A plain record so the filter engine can navigate it (`entity.<slug>`).
176
+ const entityScope = (index) => Object.fromEntries(index.bySlug);
177
+ exports.entityScope = entityScope;
178
+ // The node behind an indexed place, materialised once: a lookup walks the file's
179
+ // tree, so asking per rule (the same literal is offered to every rule and every
180
+ // file) would pay that walk again and again.
181
+ const OBJECT_NODES = new WeakMap();
182
+ // Where those nodes come from. A run that already opened the whole repo (the scan,
183
+ // the CLI) keeps reading it — the answer is the one the run has always given. A
184
+ // rule on ONE file has that project open for nothing else, and building it (1812
185
+ // files) is the seconds the first check after an edit used to take; the literals it
186
+ // may be asked for live in a handful of files, so those are loaded one by one into
187
+ // a project of their own, read from disk exactly as the whole-repo project read
188
+ // them. Nothing else is ever added to it: no file being judged, no buffer.
189
+ const OBJECT_PROJECTS = new Map();
190
+ const objectProject = (arch) => {
191
+ const repoRoot = arch.repoRoot ?? ".";
192
+ const known = OBJECT_PROJECTS.get(repoRoot);
193
+ if (known !== undefined)
194
+ return known;
195
+ const project = (0, index_1.createTsProject)({ repoRoot, aliases: arch.aliases });
196
+ OBJECT_PROJECTS.set(repoRoot, project);
197
+ return project;
198
+ };
199
+ const objectFile = (project, abs) => {
200
+ const known = project.getSourceFile(abs);
201
+ if (known !== undefined)
202
+ return known;
203
+ try {
204
+ return (0, index_1.loadSourceFile)(project, abs, fs.readFileSync(abs, "utf8"));
205
+ }
206
+ catch {
207
+ // A literal whose file cannot be read is not offered, exactly as it is not
208
+ // offered by a project that could not read it either.
209
+ return null;
210
+ }
211
+ };
212
+ const materialise = (object, arch) => {
213
+ const known = OBJECT_NODES.get(object);
214
+ if (known)
215
+ return known;
216
+ const project = (0, scan_run_1.openWholeRepoProject)() ?? objectProject(arch);
217
+ const node = objectFile(project, object.path)?.getDescendantAtPos(object.start);
218
+ if (!node || !ts_morph_1.Node.isObjectLiteralExpression(node))
219
+ return null;
220
+ const literal = { name: object.name, node };
221
+ OBJECT_NODES.set(object, literal);
222
+ return literal;
223
+ };
224
+ // The object literals a set of entity slugs offers, de-duplicated by literal.
225
+ // The index keeps places, so each node is materialised from a project that still
226
+ // holds the file the place points into — the whole-repo one when the run has it,
227
+ // a project of the asked files otherwise.
228
+ const objectsFor = (index, slugs, arch) => {
229
+ const seen = new Set();
230
+ const out = [];
231
+ for (const slug of slugs) {
232
+ for (const object of index.objectsBySlug.get(slug) ?? []) {
233
+ if (seen.has(object))
234
+ continue;
235
+ seen.add(object);
236
+ const literal = materialise(object, arch);
237
+ if (literal)
238
+ out.push(literal);
239
+ }
240
+ }
241
+ return out;
242
+ };
243
+ exports.objectsFor = objectsFor;
244
+ // The per-file entity sets of a run whose index is ALREADY built, or null before
245
+ // that: a question about a folder asks here first and parses the folder itself
246
+ // only when the index does not exist yet (a config that never needs the index
247
+ // must not be made to pay for it).
248
+ const projectEntitiesByFile = () => PROJECT_INDEX.get((0, scan_run_1.scannedFiles)())?.entitiesByFile ?? null;
249
+ exports.projectEntitiesByFile = projectEntitiesByFile;
@@ -0,0 +1,31 @@
1
+ import type { Project, SourceFile } from "ts-morph";
2
+ import type { Arch } from "../entities/architecture";
3
+ import type { Candidate, FileFacts } from "../entities/facts";
4
+ type WalkFile = {
5
+ rel: string;
6
+ arch: Arch;
7
+ repoRoot: string;
8
+ repoFiles: string[];
9
+ aliases?: Readonly<Record<string, string>>;
10
+ project?: Project;
11
+ sf?: SourceFile;
12
+ text?: string;
13
+ usage?: boolean;
14
+ record?: boolean;
15
+ depth?: boolean;
16
+ };
17
+ type WalkedFile = {
18
+ rel: string;
19
+ text: string;
20
+ sf: SourceFile;
21
+ importMap: ReadonlyMap<string, string>;
22
+ candidates: Candidate[];
23
+ fileFacts: FileFacts;
24
+ classified: {
25
+ candidates: Candidate[];
26
+ present: string[];
27
+ };
28
+ };
29
+ declare const walkFile: (file: WalkFile) => WalkedFile;
30
+ export type { WalkFile, WalkedFile };
31
+ export { walkFile };
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.walkFile = void 0;
27
+ // ONE walk over ONE file: load its syntax, collect the candidates, attach every
28
+ // facet a law or an entity may be recognised by, read the file's own facts, and
29
+ // classify. Three consumers need exactly this — the CLI pipeline, the editor/ESLint
30
+ // project index, and the report's entity cards — and each of them used to assemble
31
+ // the steps by hand: a different order, a different subset of the knobs, and so a
32
+ // different answer to the same question. (The cards, for one, never handed the
33
+ // framework facet an import map, so a molecule that renders its own atoms had no
34
+ // `links` and classified as an atom; the index attached no call depth.) The steps
35
+ // are the engine's, so they live here: a consumer states its file and its mode,
36
+ // never the sequence.
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
39
+ const ast_1 = require("../entities/ast");
40
+ const css_1 = require("../css");
41
+ const values_1 = require("../css/value/values");
42
+ const frameworks_1 = require("../frameworks");
43
+ const depth_1 = require("../entities/ast/depth");
44
+ const classify_1 = require("./classify");
45
+ const classifyMembers = (members) => {
46
+ for (const member of members ?? []) {
47
+ if (typeof member.value === "string")
48
+ member.css = (0, values_1.classifyValue)(member.value, member.line ?? null);
49
+ classifyMembers(member.members);
50
+ }
51
+ };
52
+ const absOf = (file) => path.isAbsolute(file.rel) ? file.rel : path.join(file.repoRoot, file.rel);
53
+ // Load → candidates → facets → file facts → classification. The file's facts are
54
+ // read BEFORE classification — an entity may be recognised by what the file
55
+ // depends on (`file.imports`), not only by the candidate's own shape — and every
56
+ // candidate holds the same facts object, so `infer` sees everything the file
57
+ // offers, not a hand-picked subset.
58
+ const walkFile = (file) => {
59
+ const abs = absOf(file);
60
+ const text = file.text ?? fs.readFileSync(abs, "utf8");
61
+ const sf = file.sf ?? (0, ast_1.loadSourceFile)(file.project, abs, text);
62
+ const repoRoot = file.arch.repoRoot ?? file.repoRoot;
63
+ const importMap = (0, ast_1.importNameModules)(sf, file.repoRoot, file.aliases, file.repoFiles);
64
+ const candidates = (0, ast_1.collectCandidates)(sf, importMap, file.rel, file.repoRoot, { usage: file.usage ?? false });
65
+ if ((file.depth ?? true) && file.project) {
66
+ (0, depth_1.attachCallDepth)(candidates, {
67
+ rel: file.rel,
68
+ project: file.project,
69
+ repoRoot,
70
+ aliases: file.aliases,
71
+ repoFiles: file.repoFiles,
72
+ cache: (file.arch.depthCache ??= { memo: new Map(), files: new Map() }),
73
+ });
74
+ }
75
+ (0, frameworks_1.enrich)(candidates, { rel: file.rel, sf, text, repoRoot, importMap });
76
+ (0, css_1.attachToCandidates)(candidates, { sf, record: file.record ?? false });
77
+ for (const candidate of candidates)
78
+ classifyMembers(candidate.kind?.initializer?.members);
79
+ const fileFacts = (0, ast_1.collectFileFacts)(sf, {
80
+ rel: file.rel,
81
+ repoFiles: file.repoFiles,
82
+ aliases: file.aliases,
83
+ repoRoot: file.repoRoot,
84
+ candidates: [],
85
+ project: file.project,
86
+ barrelDepth: file.arch.barrelDepth,
87
+ });
88
+ // The file's own facts travel with the pieces: a piece's laws read the imports
89
+ // of the file it lives in, and a place question is the file's place.
90
+ for (const candidate of candidates)
91
+ candidate.file = fileFacts;
92
+ const classified = (0, classify_1.classifyEntities)(candidates, file.arch.entities ?? {}, file.arch, fileFacts);
93
+ return { rel: file.rel, text, sf, importMap, candidates, fileFacts, classified };
94
+ };
95
+ exports.walkFile = walkFile;
@@ -5,9 +5,13 @@ type RuleOptions = Partial<RawArch> & {
5
5
  include?: string[];
6
6
  exts?: string[];
7
7
  similarity?: number;
8
+ barrelDepth?: number;
8
9
  ignoreDirs?: string[];
9
10
  ignores?: string[];
10
11
  exportPath?: string | false;
12
+ indexPath?: string | false;
13
+ usage?: "checker" | "index";
14
+ warmIndex?: boolean;
11
15
  };
12
16
  declare const RULE_SCHEMA: {
13
17
  anyOf: ({
@@ -32,6 +36,11 @@ declare const RULE_SCHEMA: {
32
36
  similarity: {
33
37
  type: string;
34
38
  };
39
+ barrelDepth: {
40
+ type: string;
41
+ minimum: number;
42
+ description: string;
43
+ };
35
44
  ignoreDirs: {
36
45
  type: string;
37
46
  };
@@ -44,6 +53,20 @@ declare const RULE_SCHEMA: {
44
53
  }[];
45
54
  description: string;
46
55
  };
56
+ indexPath: {
57
+ anyOf: {
58
+ type: string;
59
+ }[];
60
+ description: string;
61
+ };
62
+ usage: {
63
+ enum: string[];
64
+ description: string;
65
+ };
66
+ warmIndex: {
67
+ type: string;
68
+ description: string;
69
+ };
47
70
  };
48
71
  additionalProperties: boolean;
49
72
  })[];
@@ -17,12 +17,29 @@ const RULE_SCHEMA = [
17
17
  include: { type: "array" },
18
18
  exts: { type: "array" },
19
19
  similarity: { type: "number" },
20
+ barrelDepth: {
21
+ type: "integer",
22
+ minimum: 1,
23
+ description: "How many barrels a name may pass through while the rule looks for the file that declares it. Default 8; a deeper chain stops at the module, as before this walk existed.",
24
+ },
20
25
  ignoreDirs: { type: "array" },
21
26
  ignores: { type: "array" },
22
27
  exportPath: {
23
28
  anyOf: [{ type: "string" }, { type: "boolean" }],
24
29
  description: "Where the HTML overview is written, relative to the repo root. Default `reports/architecture-overview.html`. `false` turns it off.",
25
30
  },
31
+ indexPath: {
32
+ anyOf: [{ type: "string" }, { type: "boolean" }],
33
+ description: "Where the shared repo index lives, relative to the repo root. Default `.turbo/md-code/file-index.jsonl`. `false` turns the index off.",
34
+ },
35
+ usage: {
36
+ enum: ["checker", "index"],
37
+ description: "Who answers `references`: `checker` (default) asks the type checker on a project over the whole repository — exact; `index` counts identifier occurrences in the repo's text — faster and smaller, and wrong where two modules share a name.",
38
+ },
39
+ warmIndex: {
40
+ type: "boolean",
41
+ description: "Whether a cold index may start the one background warm of this workspace (`pnpm index:warm`). Default `true`; `false` never spawns a run.",
42
+ },
26
43
  },
27
44
  additionalProperties: false,
28
45
  },
@@ -31,5 +48,5 @@ const RULE_SCHEMA = [
31
48
  ];
32
49
  exports.RULE_SCHEMA = RULE_SCHEMA;
33
50
  // The option as written: a bare string is a config path.
34
- const optionsOf = (raw) => (typeof raw === "string" ? { config: raw } : (raw ?? {}));
51
+ const optionsOf = (raw) => typeof raw === "string" ? { config: raw } : (raw ?? {});
35
52
  exports.optionsOf = optionsOf;
@@ -42,11 +42,19 @@ const REPORTED_LOAD_FAILURES = 10;
42
42
  // The load failures a run states: the first few by name, the rest as a count.
43
43
  // A run with no failures states nothing — the notice is the failures' own.
44
44
  const failureText = (failed) => {
45
- const shown = failed.slice(0, REPORTED_LOAD_FAILURES).map((f) => `\n ${f}`).join("");
45
+ const shown = failed
46
+ .slice(0, REPORTED_LOAD_FAILURES)
47
+ .map((f) => `\n ${f}`)
48
+ .join("");
46
49
  const rest = failed.length - REPORTED_LOAD_FAILURES;
47
50
  return `${shown}${rest > 0 ? `\n … and ${rest} more` : ""}`;
48
51
  };
49
- const failureNotice = (failed) => failed.length ? { subject: `${failed.length} file(s) are not part of the project, so no repo-wide answer (who calls a name, what a type is) includes them`, reason: failureText(failed) } : null;
52
+ const failureNotice = (failed) => failed.length
53
+ ? {
54
+ subject: `${failed.length} file(s) are not part of the project, so no repo-wide answer (who calls a name, what a type is) includes them`,
55
+ reason: failureText(failed),
56
+ }
57
+ : null;
50
58
  const reportLoadFailures = (failed) => {
51
59
  const stated = failureNotice(failed);
52
60
  if (stated)
@@ -10,7 +10,7 @@ type ReportBucket = {
10
10
  timer: ReturnType<typeof setTimeout> | null;
11
11
  dirty: boolean;
12
12
  arch: Arch;
13
- project: Project;
13
+ project: () => Project;
14
14
  repoFiles: string[];
15
15
  architecturePath: string | null;
16
16
  };
@@ -35,7 +35,9 @@ exports.recordFindings = exports.reportFor = exports.DEFAULT_EXPORT_PATH = void
35
35
  // The report is the SAME self-contained HTML the CLI's `--overview` writes —
36
36
  // the readable one with the tree, the graph and every finding.
37
37
  const path = __importStar(require("node:path"));
38
+ const fs = __importStar(require("node:fs"));
38
39
  const notices_1 = require("./report/notices");
40
+ const scan_run_1 = require("./scan-run");
39
41
  const reason_1 = require("./utils/reason");
40
42
  const field_1 = require("./utils/field");
41
43
  const user_report_1 = require("./report/user-report");
@@ -61,9 +63,14 @@ const writeBucket = (bucket) => {
61
63
  repoFiles: bucket.repoFiles,
62
64
  repoRoot: bucket.repoRoot,
63
65
  architecturePath: bucket.architecturePath,
64
- project: bucket.project,
66
+ project: bucket.project(),
65
67
  });
66
- writeOverview(data, bucket.outPath);
68
+ // Written to a temp file in the same folder and renamed into place: a reader
69
+ // opening the page mid-write, or a second run replacing it, never sees half a
70
+ // document.
71
+ const temp = `${bucket.outPath}.tmp`;
72
+ writeOverview(data, temp);
73
+ fs.renameSync(temp, bucket.outPath);
67
74
  bucket.dirty = false;
68
75
  };
69
76
  const flushReports = () => {
@@ -97,7 +104,17 @@ const installExitHook = () => {
97
104
  };
98
105
  // A new bucket for one (repoRoot, outPath) pair, remembered for the next lint.
99
106
  const newBucket = (repoRoot, outPath, state, architecturePath) => {
100
- const bucket = { repoRoot, outPath, files: new Map(), timer: null, dirty: false, arch: state.arch, project: state.project, repoFiles: state.repoFiles, architecturePath };
107
+ const bucket = {
108
+ repoRoot,
109
+ outPath,
110
+ files: new Map(),
111
+ timer: null,
112
+ dirty: false,
113
+ arch: state.arch,
114
+ project: scan_run_1.wholeRepoProject,
115
+ repoFiles: state.repoFiles,
116
+ architecturePath,
117
+ };
101
118
  reportBuckets.set(`${repoRoot}\u0000${outPath}`, bucket);
102
119
  installExitHook();
103
120
  return bucket;
@@ -3,6 +3,12 @@ type RuleContext = {
3
3
  options: (string | RuleOptions)[];
4
4
  filename?: string;
5
5
  getFilename: () => string;
6
+ sourceCode?: {
7
+ text?: string;
8
+ };
9
+ getSourceCode?: () => {
10
+ text?: string;
11
+ } | undefined;
6
12
  report: (descriptor: {
7
13
  node?: FieldValueNode;
8
14
  message: string;
@@ -48,6 +54,11 @@ declare const rule: {
48
54
  similarity: {
49
55
  type: string;
50
56
  };
57
+ barrelDepth: {
58
+ type: string;
59
+ minimum: number;
60
+ description: string;
61
+ };
51
62
  ignoreDirs: {
52
63
  type: string;
53
64
  };
@@ -60,6 +71,20 @@ declare const rule: {
60
71
  }[];
61
72
  description: string;
62
73
  };
74
+ indexPath: {
75
+ anyOf: {
76
+ type: string;
77
+ }[];
78
+ description: string;
79
+ };
80
+ usage: {
81
+ enum: string[];
82
+ description: string;
83
+ };
84
+ warmIndex: {
85
+ type: string;
86
+ description: string;
87
+ };
63
88
  };
64
89
  additionalProperties: boolean;
65
90
  })[];