@md-code/follow-architecture 0.3.0 → 0.3.2

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 (387) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1310 -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 +132 -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} +98 -61
  14. package/dist/code-entities/project.d.ts +21 -0
  15. package/dist/code-entities/project.js +259 -0
  16. package/dist/code-entities/walk.d.ts +31 -0
  17. package/dist/code-entities/walk.js +105 -0
  18. package/dist/config-options.d.ts +23 -0
  19. package/dist/config-options.js +18 -1
  20. package/dist/config-project.js +27 -9
  21. package/dist/config-report.d.ts +1 -1
  22. package/dist/config-report.js +37 -10
  23. package/dist/config-rule.d.ts +25 -0
  24. package/dist/config-rule.js +106 -13
  25. package/dist/config-state.d.ts +14 -3
  26. package/dist/config-state.js +197 -24
  27. package/dist/config.d.ts +25 -0
  28. package/dist/css/index.d.ts +11 -7
  29. package/dist/css/index.js +141 -30
  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 +18 -8
  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 +21 -9
  37. package/dist/css/syntax/scss/index.d.ts +2 -2
  38. package/dist/css/syntax/scss/index.js +18 -8
  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 +34 -14
  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 +32 -15
  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 +21 -11
  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 +148 -37
  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 +10 -8
  133. package/dist/entities/location/where.js +89 -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 +89 -19
  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 +112 -51
  154. package/dist/entities/tree/entries.d.ts +4 -4
  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 +26 -12
  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 +242 -0
  164. package/dist/fa-store.d.ts +22 -0
  165. package/dist/fa-store.js +232 -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 +297 -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 +25 -11
  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 +62 -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 +219 -0
  190. package/dist/main.d.ts +5 -2
  191. package/dist/main.js +223 -41
  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 +64 -11
  196. package/dist/nodes/finally/emit.d.ts +4 -4
  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 +78 -56
  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 +64 -62
  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.d.ts +1 -1
  226. package/dist/pipeline.js +19 -64
  227. package/dist/release-file.d.ts +3 -0
  228. package/dist/release-file.js +13 -0
  229. package/dist/report/asks.d.ts +3 -3
  230. package/dist/report/asks.js +16 -6
  231. package/dist/report/configErrors.d.ts +55 -27
  232. package/dist/report/configErrors.js +81 -35
  233. package/dist/report/errorTypes/codes/structure.d.ts +1 -1
  234. package/dist/report/errorTypes/codes/structure.js +9 -9
  235. package/dist/report/errorTypes/decision-maker.d.ts +5 -5
  236. package/dist/report/errorTypes/decision-maker.js +21 -11
  237. package/dist/report/errorTypes/destinations.d.ts +5 -5
  238. package/dist/report/errorTypes/destinations.js +52 -34
  239. package/dist/report/errorTypes/finding-type.d.ts +3 -3
  240. package/dist/report/errorTypes/index.d.ts +1 -1
  241. package/dist/report/errorTypes/index.js +17 -7
  242. package/dist/report/errorTypes/types/fileContents.d.ts +4 -4
  243. package/dist/report/errorTypes/types/fileContents.js +11 -5
  244. package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
  245. package/dist/report/errorTypes/types/{unknownRole.js → unknownEntity.js} +12 -7
  246. package/dist/report/errorTypes/types/wrongAction.d.ts +5 -5
  247. package/dist/report/errorTypes/types/wrongAction.js +18 -13
  248. package/dist/report/errorTypes/types/wrongPlacement.d.ts +4 -4
  249. package/dist/report/errorTypes/types/wrongPlacement.js +19 -9
  250. package/dist/report/errorTypes/vocabulary/ids.d.ts +2 -2
  251. package/dist/report/errorTypes/vocabulary/ids.js +3 -3
  252. package/dist/report/errorTypes/vocabulary/phrases.d.ts +2 -2
  253. package/dist/report/errorTypes/vocabulary/phrases.js +39 -26
  254. package/dist/report/errorTypes/vocabulary/places.d.ts +3 -3
  255. package/dist/report/errorTypes/vocabulary/places.js +13 -13
  256. package/dist/report/finding-from.d.ts +3 -3
  257. package/dist/report/finding-from.js +14 -9
  258. package/dist/report/notices.d.ts +6 -1
  259. package/dist/report/notices.js +46 -20
  260. package/dist/report/observed.d.ts +19 -0
  261. package/dist/report/observed.js +87 -0
  262. package/dist/report/render-report.d.ts +1 -1
  263. package/dist/report/render-report.js +33 -30
  264. package/dist/report/user-report/build/bundle.js +26 -7
  265. package/dist/report/user-report/build/bundle.prebuilt.js +799 -297
  266. package/dist/report/user-report/data/collect.d.ts +2 -2
  267. package/dist/report/user-report/data/collect.js +32 -19
  268. package/dist/report/user-report/data/entities.d.ts +7 -0
  269. package/dist/report/user-report/data/{roles.js → entities.js} +27 -22
  270. package/dist/report/user-report/data/{role-examples.d.ts → entity-examples.d.ts} +3 -3
  271. package/dist/report/user-report/data/entity-examples.js +136 -0
  272. package/dist/report/user-report/data/{role-filters.d.ts → entity-filters.d.ts} +2 -2
  273. package/dist/report/user-report/data/{role-filters.js → entity-filters.js} +7 -7
  274. package/dist/report/user-report/data/entity-marks.d.ts +5 -0
  275. package/dist/report/user-report/data/{role-marks.js → entity-marks.js} +11 -11
  276. package/dist/report/user-report/data/file-tree.d.ts +3 -3
  277. package/dist/report/user-report/data/file-tree.js +13 -5
  278. package/dist/report/user-report/data/finding-boundary.d.ts +4 -4
  279. package/dist/report/user-report/data/finding-boundary.js +2 -2
  280. package/dist/report/user-report/data/finding-plan.d.ts +5 -5
  281. package/dist/report/user-report/data/finding-plan.js +10 -10
  282. package/dist/report/user-report/data/finding-title.d.ts +2 -2
  283. package/dist/report/user-report/data/finding-title.js +8 -8
  284. package/dist/report/user-report/data/findings.d.ts +4 -4
  285. package/dist/report/user-report/data/findings.js +30 -20
  286. package/dist/report/user-report/data/graph-edges.d.ts +4 -4
  287. package/dist/report/user-report/data/graph-edges.js +19 -19
  288. package/dist/report/user-report/data/graph-entities.d.ts +6 -0
  289. package/dist/report/user-report/data/graph-entities.js +158 -0
  290. package/dist/report/user-report/data/graph-helpers.d.ts +5 -5
  291. package/dist/report/user-report/data/graph-helpers.js +15 -15
  292. package/dist/report/user-report/data/graph.d.ts +5 -4
  293. package/dist/report/user-report/data/graph.js +28 -21
  294. package/dist/report/user-report/data/nodes.d.ts +2 -2
  295. package/dist/report/user-report/data/nodes.js +33 -23
  296. package/dist/report/user-report/data/rules.d.ts +7 -0
  297. package/dist/report/user-report/data/{invariants.js → rules.js} +13 -13
  298. package/dist/report/user-report/data/scan.d.ts +1 -1
  299. package/dist/report/user-report/data/scan.js +19 -9
  300. package/dist/report/user-report/html/shell.d.ts +1 -1
  301. package/dist/report/user-report/html/shell.js +1 -1
  302. package/dist/report/user-report/index.d.ts +1 -1
  303. package/dist/report/user-report/index.js +17 -7
  304. package/dist/report/user-report/shared/describe.d.ts +1 -1
  305. package/dist/report/user-report/shared/describe.js +6 -6
  306. package/dist/rules/index.d.ts +7 -0
  307. package/dist/{invariants → rules}/index.js +85 -57
  308. package/dist/{invariants → rules}/list-vars.d.ts +2 -2
  309. package/dist/{invariants → rules}/list-vars.js +9 -3
  310. package/dist/{invariants → rules}/name.js +2 -2
  311. package/dist/rules/normalize.d.ts +5 -0
  312. package/dist/rules/normalize.js +108 -0
  313. package/dist/{invariants → rules}/vars.d.ts +9 -7
  314. package/dist/{invariants → rules}/vars.js +5 -5
  315. package/dist/scan-run.d.ts +20 -0
  316. package/dist/scan-run.js +130 -0
  317. package/dist/scripts/audit-report.js +19 -9
  318. package/dist/usage-index.d.ts +4 -0
  319. package/dist/usage-index.js +282 -0
  320. package/dist/usage-mode.d.ts +7 -0
  321. package/dist/usage-mode.js +16 -0
  322. package/dist/usage-pass.d.ts +19 -0
  323. package/dist/usage-pass.js +136 -0
  324. package/dist/usage-prepare.d.ts +2 -0
  325. package/dist/usage-prepare.js +22 -0
  326. package/dist/usage-sweep.d.ts +10 -0
  327. package/dist/usage-sweep.js +264 -0
  328. package/dist/utils/aliases.d.ts +22 -0
  329. package/dist/utils/aliases.js +173 -0
  330. package/dist/utils/classify.d.ts +2 -2
  331. package/dist/utils/classify.js +4 -4
  332. package/dist/utils/configs.js +17 -7
  333. package/dist/utils/distinct.js +4 -2
  334. package/dist/utils/files.js +41 -37
  335. package/dist/utils/fixpoint.js +2 -2
  336. package/dist/utils/host.d.ts +1 -1
  337. package/dist/utils/host.js +4 -1
  338. package/dist/utils/imports.js +83 -19
  339. package/dist/utils/keyed.js +2 -2
  340. package/dist/utils/map-record.js +2 -2
  341. package/dist/utils/packages.d.ts +15 -0
  342. package/dist/utils/packages.js +207 -0
  343. package/dist/utils/path-label.js +3 -1
  344. package/dist/utils/pattern.d.ts +5 -4
  345. package/dist/utils/pattern.js +55 -15
  346. package/dist/utils/permission.d.ts +3 -3
  347. package/dist/utils/permission.js +4 -2
  348. package/dist/utils/plural.js +2 -2
  349. package/dist/utils/qualified.js +4 -4
  350. package/dist/utils/rank.js +2 -2
  351. package/dist/utils/record.js +1 -1
  352. package/dist/utils/search.js +7 -2
  353. package/dist/utils/speak.js +1 -1
  354. package/dist/utils/split.js +14 -1
  355. package/dist/utils/template.d.ts +1 -1
  356. package/dist/utils/template.js +1 -1
  357. package/dist/utils/tokenize.js +6 -1
  358. package/dist/utils/typed-field.js +2 -2
  359. package/dist/utils/verdicts.js +1 -1
  360. package/entities/operators.ts +1 -1
  361. package/package.json +101 -90
  362. package/report/errorTypes/vocabulary/ids.ts +7 -2
  363. package/report/errorTypes/vocabulary/phrases.ts +47 -27
  364. package/report/errorTypes/vocabulary/places.ts +21 -16
  365. package/report/user-report/shared/describe.ts +7 -7
  366. package/dist/code-roles/classify.d.ts +0 -11
  367. package/dist/code-roles/classify.js +0 -43
  368. package/dist/code-roles/connector.d.ts +0 -5
  369. package/dist/code-roles/connector.js +0 -114
  370. package/dist/code-roles/project.d.ts +0 -12
  371. package/dist/code-roles/project.js +0 -122
  372. package/dist/code-roles/roles.d.ts +0 -8
  373. package/dist/invariants/index.d.ts +0 -6
  374. package/dist/invariants/normalize.d.ts +0 -4
  375. package/dist/invariants/normalize.js +0 -95
  376. package/dist/nodes/child-roles.d.ts +0 -3
  377. package/dist/nodes/child-roles.js +0 -12
  378. package/dist/nodes/finally/roles.d.ts +0 -13
  379. package/dist/nodes/finally/roles.js +0 -41
  380. package/dist/report/errorTypes/types/unknownRole.d.ts +0 -9
  381. package/dist/report/user-report/data/graph-roles.d.ts +0 -5
  382. package/dist/report/user-report/data/graph-roles.js +0 -71
  383. package/dist/report/user-report/data/invariants.d.ts +0 -7
  384. package/dist/report/user-report/data/role-examples.js +0 -94
  385. package/dist/report/user-report/data/role-marks.d.ts +0 -5
  386. package/dist/report/user-report/data/roles.d.ts +0 -7
  387. /package/dist/{invariants → rules}/name.d.ts +0 -0
@@ -15,16 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.declaredActions = exports.changesState = exports.CHANGES_STATE = exports.EDGE_FACTS = exports.FACT_KINDS = exports.VIA = exports.RELATION = void 0;
27
- const configError = __importStar(require("../report/configErrors"));
37
+ const configError = __importStar(require("@md-code/follow-architecture/report/configErrors"));
28
38
  // THE VOCABULARY, as an enum: one name per relation, one spelling everywhere.
29
39
  const RELATION = Object.freeze({
30
40
  IMPORT: "import",
@@ -47,15 +57,15 @@ const CHANGES_STATE = new Set([RELATION.MUTATE, RELATION.ASSIGN]);
47
57
  exports.CHANGES_STATE = CHANGES_STATE;
48
58
  const changesState = (relation) => CHANGES_STATE.has(relation);
49
59
  exports.changesState = changesState;
50
- // The role of the piece of code a fact belongs to, by the piece's name.
51
- const roleOfPiece = (facts, piece) => (piece ? ((facts.candidates ?? []).find((c) => c.name === piece && c.role)?.role ?? null) : null);
60
+ // The entity of the piece of code a fact belongs to, by the piece's name.
61
+ const entityOfPiece = (facts, piece) => piece ? ((facts.candidates ?? []).find((c) => c.name === piece && c.entity)?.entity ?? null) : null;
52
62
  // Is a module path a FILE of this repo?
53
63
  const isRepoModule = (facts, module) => Boolean(module) && (facts.repoFiles ?? []).includes(module ?? "");
54
64
  // The line a candidate starts on.
55
65
  const lineOf = (c) => c.lines?.[0] ?? 1;
56
66
  // The shape EVERY edge has: the target, the piece it belongs to and whether the
57
67
  // target is a library, plus the structured `fact` and its sentence.
58
- const edgeOf = (facts, edge) => ({ ...edge, role: roleOfPiece(facts, edge.piece) });
68
+ const edgeOf = (facts, edge) => ({ ...edge, entity: entityOfPiece(facts, edge.piece) });
59
69
  const callsOf = (facts) => (facts.candidates ?? []).flatMap((c) => (c.calls ?? [])
60
70
  .filter((call) => call.module && !call.receiverOnly)
61
71
  .map((call) => ({
@@ -84,16 +94,22 @@ const writeWhat = ({ target, module, method, onThis, mutate }) => {
84
94
  const writePath = (facts, a, mutate) => {
85
95
  if (!mutate)
86
96
  return facts.location.path;
87
- return a.onThis ? facts.location.path : a.module ?? null;
97
+ return a.onThis ? facts.location.path : (a.module ?? null);
88
98
  };
89
- const writeExternal = (facts, a, mutate) => (mutate && !a.onThis ? !isRepoModule(facts, a.module) : false);
99
+ const writeExternal = (facts, a, mutate) => mutate && !a.onThis ? !isRepoModule(facts, a.module) : false;
90
100
  const assignmentEdge = (facts, c, a, mutate) => edgeOf(facts, {
91
101
  path: writePath(facts, a, mutate),
92
102
  line: a.line ?? lineOf(c),
93
103
  piece: c.name ?? null,
94
104
  external: writeExternal(facts, a, mutate),
95
105
  // THE FACT — what the code did, as data.
96
- fact: { kind: mutate ? RELATION.MUTATE : RELATION.ASSIGN, target: a.target ?? null, module: a.module ?? null, method: a.method ?? null, onThis: Boolean(a.onThis) },
106
+ fact: {
107
+ kind: mutate ? RELATION.MUTATE : RELATION.ASSIGN,
108
+ target: a.target ?? null,
109
+ module: a.module ?? null,
110
+ method: a.method ?? null,
111
+ onThis: Boolean(a.onThis),
112
+ },
97
113
  what: writeWhat({ target: a.target, module: a.module, method: a.method, onThis: Boolean(a.onThis), mutate }),
98
114
  });
99
115
  const assignmentsOf = (facts, { mutate }) => (facts.candidates ?? []).flatMap((c) => (c.assignments ?? [])
@@ -123,10 +139,55 @@ const exportPiece = (facts, exp, names) => {
123
139
  return null;
124
140
  return (facts.candidates ?? []).some((c) => c.name === names[0]) ? names[0] : null;
125
141
  };
126
- const exportFromEdges = (facts) => (facts.exports ?? []).map((exp) => {
142
+ // The file each re-exported name is declared in (a barrel re-exported by a
143
+ // facade hides the same declaring file as the import it stands for).
144
+ const exportGroups = (exp, names) => {
145
+ const groups = new Map();
146
+ if (!exp.from)
147
+ return groups;
148
+ names.forEach((name, at) => {
149
+ const file = exp.declaring?.[at] ?? null;
150
+ if (!file || file === exp.from)
151
+ return;
152
+ const group = groups.get(file) ?? [];
153
+ group.push(name);
154
+ groups.set(file, group);
155
+ });
156
+ return groups;
157
+ };
158
+ const exportFromEdges = (facts) => (facts.exports ?? []).flatMap((exp) => {
127
159
  const names = exp.named ?? [];
128
- const fact = { kind: "export", form: exp.form ?? "named", names, name: exp.name ?? null, source: exp.source ?? null, resolved: exp.from ?? null, reExport: Boolean(exp.from) };
129
- return edgeOf(facts, { path: exp.from ?? facts.location.path, line: exp.line ?? 1, piece: exportPiece(facts, exp, names), external: exp.from ? !isRepoModule(facts, exp.from) : false, fact, what: exportWhat(exp, names) });
160
+ const groups = exportGroups(exp, names);
161
+ const stayed = names.filter((_, at) => {
162
+ const file = exp.declaring?.[at] ?? null;
163
+ return !file || file === exp.from;
164
+ });
165
+ const fact = (resolved) => ({
166
+ kind: "export",
167
+ form: exp.form ?? "named",
168
+ names: stayed,
169
+ name: exp.name ?? null,
170
+ source: exp.source ?? null,
171
+ resolved,
172
+ reExport: Boolean(exp.from),
173
+ });
174
+ const moduleEdge = edgeOf(facts, {
175
+ path: exp.from ?? facts.location.path,
176
+ line: exp.line ?? 1,
177
+ piece: exportPiece(facts, exp, names),
178
+ external: exp.from ? !isRepoModule(facts, exp.from) : false,
179
+ fact: fact(exp.from ?? null),
180
+ what: exportWhat(exp, exp.from && groups.size ? stayed : names),
181
+ });
182
+ const declaredEdges = [...groups].map(([file, grouped]) => edgeOf(facts, {
183
+ path: file,
184
+ line: exp.line ?? 1,
185
+ piece: null,
186
+ external: !isRepoModule(facts, file),
187
+ fact: { ...fact(file), names: grouped, resolved: file },
188
+ what: `re-exports \`${grouped.join("`, `")}\` of \`${file}\``,
189
+ }));
190
+ return [...(groups.size && !stayed.length ? [] : [moduleEdge]), ...declaredEdges];
130
191
  });
131
192
  const declaredExportEdges = (facts) => (facts.candidates ?? [])
132
193
  .filter((c) => c.exported)
@@ -135,7 +196,14 @@ const declaredExportEdges = (facts) => (facts.candidates ?? [])
135
196
  line: lineOf(c),
136
197
  piece: c.name ?? null,
137
198
  external: false,
138
- fact: { kind: "export", form: "declared", names: c.name ? [c.name] : [], name: c.name ?? null, source: null, reExport: false },
199
+ fact: {
200
+ kind: "export",
201
+ form: "declared",
202
+ names: c.name ? [c.name] : [],
203
+ name: c.name ?? null,
204
+ source: null,
205
+ reExport: false,
206
+ },
139
207
  what: "is exported",
140
208
  }));
141
209
  // A declaration that only RENAMES another module's value (`const a = b.c`).
@@ -156,29 +224,72 @@ const declareEdge = (facts, c) => {
156
224
  what: renames ? `re-declares \`${renames.action}\` of \`${renames.module}\`` : "is declared here",
157
225
  });
158
226
  };
227
+ // A named import asks the module to PASS A NAME ON; the law names the file that
228
+ // declares it. Grouping the names by declaring file keeps one edge per target,
229
+ // and a name the chain could not follow stays on the module file.
230
+ const declaredGroups = (imp) => {
231
+ const groups = new Map();
232
+ const module = imp.resolved ?? "";
233
+ (imp.named ?? []).forEach((name, at) => {
234
+ const file = imp.declaring?.[at] ?? null;
235
+ if (!file || file === module)
236
+ return;
237
+ const names = groups.get(file) ?? [];
238
+ names.push(imp.imported?.[at] ?? name);
239
+ groups.set(file, names);
240
+ });
241
+ return groups;
242
+ };
243
+ // The imported TEXT of one target: the module form is unchanged, a declaring
244
+ // file is named with the symbols the file asked it for.
245
+ const importWhat = (imp, file, names) => {
246
+ if (!names?.length || !file)
247
+ return imp.form === "statement" ? `imports \`${imp.resolved}\`` : `requires \`${imp.source}\``;
248
+ return `imports \`${names.join("`, `")}\` of \`${file}\``;
249
+ };
250
+ // Everything a named import touches: the module it wrote (for the names that
251
+ // stayed) plus the file each group of names is declared in.
252
+ const importEdges = (facts, imp, kind) => {
253
+ const groups = declaredGroups(imp);
254
+ const base = { line: imp.line ?? 1, piece: imp.piece ?? null };
255
+ // The plain edge keeps the fact it always had: a target and no symbols.
256
+ const factOf = (file, names) => {
257
+ const base = kind === RELATION.IMPORT
258
+ ? { kind, form: imp.form ?? null, source: imp.source ?? null, resolved: file }
259
+ : { kind, source: imp.source ?? null, resolved: file };
260
+ return names?.length ? { ...base, names } : base;
261
+ };
262
+ const edges = [];
263
+ const stayed = (imp.named ?? []).filter((_, at) => !groups.size || !(imp.declaring?.[at] && imp.declaring[at] !== imp.resolved));
264
+ if (stayed.length || !groups.size) {
265
+ edges.push(edgeOf(facts, {
266
+ path: imp.resolved ?? null,
267
+ ...base,
268
+ external: !isRepoModule(facts, imp.resolved),
269
+ fact: factOf(imp.resolved ?? null, groups.size ? stayed : null),
270
+ what: importWhat(imp, null, null),
271
+ }));
272
+ }
273
+ for (const [file, names] of groups) {
274
+ edges.push(edgeOf(facts, {
275
+ path: file,
276
+ ...base,
277
+ external: !isRepoModule(facts, file),
278
+ fact: factOf(file, names),
279
+ what: importWhat(imp, file, names),
280
+ }));
281
+ }
282
+ return edges;
283
+ };
159
284
  const EDGE_FACTS = {
160
285
  // `import … from "x"` — a resolved static import.
161
286
  [RELATION.IMPORT]: (facts) => (facts.imports ?? [])
162
287
  .filter((imp) => imp.resolved && !imp.typeOnly)
163
- .map((imp) => edgeOf(facts, {
164
- path: imp.resolved ?? null,
165
- line: imp.line ?? 1,
166
- piece: imp.piece ?? null,
167
- external: !isRepoModule(facts, imp.resolved),
168
- fact: { kind: "import", form: imp.form ?? null, source: imp.source ?? null, resolved: imp.resolved ?? null },
169
- what: imp.form === "statement" ? `imports \`${imp.resolved}\`` : `requires \`${imp.source}\``,
170
- })),
288
+ .flatMap((imp) => importEdges(facts, imp, RELATION.IMPORT)),
171
289
  // `import type … from "x"` — a TYPE dependency.
172
290
  [RELATION.TYPE_IMPORT]: (facts) => (facts.imports ?? [])
173
291
  .filter((imp) => imp.resolved && imp.typeOnly)
174
- .map((imp) => edgeOf(facts, {
175
- path: imp.resolved ?? null,
176
- line: imp.line ?? 1,
177
- piece: imp.piece ?? null,
178
- external: !isRepoModule(facts, imp.resolved),
179
- fact: { kind: "typeImport", source: imp.source ?? null, resolved: imp.resolved ?? null },
180
- what: `names a type of \`${imp.resolved}\``,
181
- })),
292
+ .flatMap((imp) => importEdges(facts, imp, RELATION.TYPE_IMPORT)),
182
293
  // EVERY way code leaves the module, whatever the spelling.
183
294
  [RELATION.EXPORT]: (facts) => [...exportFromEdges(facts), ...declaredExportEdges(facts)],
184
295
  // EVERY declaration: `const`/`let`/`var`, `function`, `class`, and a
@@ -194,11 +305,11 @@ const EDGE_FACTS = {
194
305
  [RELATION.READ]: readsOf,
195
306
  };
196
307
  exports.EDGE_FACTS = EDGE_FACTS;
197
- // Which roles declare an ACTION for each relation: `Map<factKind, Map<roleSlug,
308
+ // Which entities declare an ACTION for each relation: `Map<factKind, Map<entitySlug,
198
309
  // action>>`.
199
310
  const declaredActions = (arch) => {
200
311
  const byFact = new Map();
201
- for (const [slug, def] of Object.entries(arch.codeRoles ?? {})) {
312
+ for (const [slug, def] of Object.entries(arch.entities ?? {})) {
202
313
  for (const [key, action] of Object.entries(def.actions ?? {})) {
203
314
  const factKind = action.of ?? key;
204
315
  if (!byFact.has(factKind))
@@ -209,7 +320,7 @@ const declaredActions = (arch) => {
209
320
  return byFact;
210
321
  };
211
322
  exports.declaredActions = declaredActions;
212
- // A role may only say `of: <kind>` for a relation the engine can see, and every
323
+ // An entity may only say `of: <kind>` for a relation the engine can see, and every
213
324
  // declared kind must have a producer. Checked at load, so a typo fails loudly.
214
325
  for (const kind of FACT_KINDS) {
215
326
  if (!EDGE_FACTS[kind])
@@ -1,5 +1,5 @@
1
- import type { Arch, RoleHome } from "../architecture";
2
- declare const homesOf: (arch: Arch, role: string) => RoleHome[];
1
+ import type { Arch, EntityHome } from "@md-code/follow-architecture/entities/architecture";
2
+ declare const homesOf: (arch: Arch, entity: string) => EntityHome[];
3
3
  type Destination = {
4
4
  slug: string | null;
5
5
  path: string | null;
@@ -12,17 +12,17 @@ type Place = {
12
12
  folder: boolean;
13
13
  };
14
14
  declare const sharedPrefix: (template: string, rel: string | null) => number;
15
- declare const destinationsIn: (arch: Arch, role: string, rel: string) => Destination[];
16
- declare const destinationOf: (arch: Arch, role: string, rel: string) => Destination | null;
17
- declare const placeFor: (arch: Arch, role: string, rel: string) => Place | null;
18
- declare const roleFitsAt: (arch: Arch, role: string, rel: string | null | undefined) => boolean;
19
- declare const rolesAtPath: (arch: Arch, path: string | null | undefined) => string[];
20
- declare const homeForRole: (arch: Arch, role: string, rel: string) => {
21
- role: string;
15
+ declare const destinationsIn: (arch: Arch, entity: string, rel: string) => Destination[];
16
+ declare const destinationOf: (arch: Arch, entity: string, rel: string) => Destination | null;
17
+ declare const placeFor: (arch: Arch, entity: string, rel: string) => Place | null;
18
+ declare const entityFitsAt: (arch: Arch, entity: string, rel: string | null | undefined) => boolean;
19
+ declare const entitiesAtPath: (arch: Arch, path: string | null | undefined) => string[];
20
+ declare const homeForEntity: (arch: Arch, entity: string, rel: string) => {
21
+ entity: string;
22
22
  path: string;
23
23
  folder: boolean;
24
24
  concrete: boolean;
25
25
  node: string | null;
26
26
  } | null;
27
- export { homesOf, sharedPrefix, destinationsIn, destinationOf, placeFor, roleFitsAt, rolesAtPath, homeForRole };
27
+ export { homesOf, sharedPrefix, destinationsIn, destinationOf, placeFor, entityFitsAt, entitiesAtPath, homeForEntity };
28
28
  export type { Destination, Place };
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.homeForRole = exports.rolesAtPath = exports.roleFitsAt = exports.placeFor = exports.destinationOf = exports.destinationsIn = exports.sharedPrefix = exports.homesOf = void 0;
4
- // THE ROLE → PLACE ANSWER. "Where does code of this role live" is the SAME
3
+ exports.homeForEntity = exports.entitiesAtPath = exports.entityFitsAt = exports.placeFor = exports.destinationOf = exports.destinationsIn = exports.sharedPrefix = exports.homesOf = void 0;
4
+ // THE ENTITY → PLACE ANSWER. "Where does code of this entity live" is the SAME
5
5
  // question as "what does this place entry resolve to", so this module owns both
6
6
  // the declared homes and the concrete place-for-this-file answer.
7
7
  //
8
- // homesOf(arch, role) — the path templates that role may occupy
9
- // placeFor(arch, role, rel) — where this role's code belongs FOR THIS FILE
10
- // destinationOf(arch, role, rel) — the concrete, hostable place, or null
8
+ // homesOf(arch, entity) — the path templates that entity may occupy
9
+ // placeFor(arch, entity, rel) — where this entity's code belongs FOR THIS FILE
10
+ // destinationOf(arch, entity, rel) — the concrete, hostable place, or null
11
11
  //
12
- // Nothing here is stored on the codeRole: a role knows what code IS, never which
12
+ // Nothing here is stored on the entity: an entity knows what code IS, never which
13
13
  // folder it is in. Anything that needs a location asks the tree.
14
- const match_1 = require("../tree/match");
14
+ const match_1 = require("@md-code/follow-architecture/entities/tree/match");
15
15
  const where_1 = require("./where");
16
16
  const place_1 = require("./place");
17
- const rank_1 = require("../../utils/rank");
18
- // Every path the tree gives this role, in the order the config declares them.
19
- const homesOf = (arch, role) => arch.nodes.roleHomes[role] ?? [];
17
+ const rank_1 = require("@md-code/follow-architecture/utils/rank");
18
+ // Every path the tree gives this entity, in the order the config declares them.
19
+ const homesOf = (arch, entity) => arch.nodes.entityHomes[entity] ?? [];
20
20
  exports.homesOf = homesOf;
21
21
  // How much of the template's start this file shares. Used only to pick which
22
22
  // branch of a repeating node the file belongs to — never to allow or deny.
@@ -39,7 +39,9 @@ const sharedPrefix = (template, rel) => {
39
39
  exports.sharedPrefix = sharedPrefix;
40
40
  // The directory a home names: a file child contributes its parent folder.
41
41
  const homeDir = (template) => {
42
- const segs = String(template).split("/").filter((s) => s !== "**");
42
+ const segs = String(template)
43
+ .split("/")
44
+ .filter((s) => s !== "**");
43
45
  return /\.[A-Za-z0-9]+$/.test(segs[segs.length - 1] ?? "") ? segs.slice(0, -1) : segs;
44
46
  };
45
47
  // The folder OF A FILE as segments.
@@ -55,28 +57,43 @@ const sameBranch = (home, dir) => {
55
57
  // Whether this home is in the file's branch. A home that names ONE FILE only
56
58
  // answers for files of exactly that folder; a FOLDER home may sit in a general
57
59
  // branch (`packages/utils`) that still applies.
58
- const branchFor = (fileHome, home, dir) => (fileHome ? home.length === dir.length && sameBranch(home, dir) : sameBranch(home, dir));
60
+ const branchFor = (fileHome, home, dir) => fileHome ? home.length === dir.length && sameBranch(home, dir) : sameBranch(home, dir);
59
61
  const scoreEntry = (entry, i, dir, rel) => {
60
62
  const home = homeDir(entry.template);
61
- const last = String(entry.template).split("/").filter((seg) => seg !== "**").pop() ?? "";
63
+ const last = String(entry.template)
64
+ .split("/")
65
+ .filter((seg) => seg !== "**")
66
+ .pop() ?? "";
62
67
  const fileHome = /\.[A-Za-z0-9]+$/.test(last);
63
68
  const branch = branchFor(fileHome, home, dir);
64
69
  return { entry, i, keep: branch || !fileHome, branch, score: sharedPrefix(entry.template, rel) };
65
70
  };
66
- // The concrete places a role's code may go FOR THIS FILE, best first. The
71
+ // The concrete places an entity's code may go FOR THIS FILE, best first. The
67
72
  // score-keep-rank walk is the shared `rankedOffers` core — the same one the
68
73
  // folder lookalikes use; the scoring policy (branch, prefix, declared order)
69
74
  // is this module's own.
70
- const destinationsIn = (arch, role, rel) => {
71
- const entries = homesOf(arch, role);
75
+ const destinationsIn = (arch, entity, rel) => {
76
+ const entries = homesOf(arch, entity);
72
77
  if (!entries.length)
73
78
  return [];
74
- // A role with ONE declared place has no branch question to answer.
79
+ // An entity with ONE declared place has no branch question to answer.
75
80
  if (entries.length === 1 && !/\*\*\s*$/.test(entries[0].template)) {
76
- return [{ slug: entries[0].node, path: (0, where_1.fillTemplate)(entries[0].template, rel), folder: false, template: entries[0].template }];
81
+ return [
82
+ {
83
+ slug: entries[0].node,
84
+ path: (0, where_1.fillTemplate)(entries[0].template, rel),
85
+ folder: false,
86
+ template: entries[0].template,
87
+ },
88
+ ];
77
89
  }
78
90
  const dir = fileDir(rel);
79
- const destinationOfEntry = (entry) => ({ slug: entry.node, path: (0, where_1.fillTemplate)(entry.template, rel), folder: /\*\*\s*$/.test(entry.template), template: entry.template });
91
+ const destinationOfEntry = (entry) => ({
92
+ slug: entry.node,
93
+ path: (0, where_1.fillTemplate)(entry.template, rel),
94
+ folder: /\*\*\s*$/.test(entry.template),
95
+ template: entry.template,
96
+ });
80
97
  const kept = (0, rank_1.rankedOffers)(entries.map((entry, i) => ({ entry, i })), ({ entry, i }) => {
81
98
  const scored = scoreEntry(entry, i, dir, rel);
82
99
  return scored.keep ? { ...destinationOfEntry(entry), branch: scored.branch, score: scored.score, i } : null;
@@ -84,7 +101,7 @@ const destinationsIn = (arch, role, rel) => {
84
101
  return kept.map(({ slug, path, folder, template }) => ({ slug, path, folder, template }));
85
102
  };
86
103
  exports.destinationsIn = destinationsIn;
87
- // The place a role's code belongs FOR THIS FILE, and only when that place can
104
+ // The place an entity's code belongs FOR THIS FILE, and only when that place can
88
105
  // exist: the FOLDER has to be a real node instance, while a home that names a
89
106
  // FILE may still be created — its parent being an instance is enough.
90
107
  // Does the node that owns the folder own it for THIS destination (the node
@@ -93,13 +110,13 @@ const ownsDest = (arch, hit, dest) => {
93
110
  const parent = arch.nodes.bySlug[dest.slug ?? ""]?.parents[0] ?? null;
94
111
  return hit.slug === dest.slug || (parent != null && hit.slug === parent);
95
112
  };
96
- const hostFolder = (dest) => (dest.folder ? dest.path ?? "" : (0, place_1.dirOf)(dest.path ?? ""));
113
+ const hostFolder = (dest) => (dest.folder ? (dest.path ?? "") : (0, place_1.dirOf)(dest.path ?? ""));
97
114
  const nodeOk = (arch, dest) => {
98
115
  const destNode = arch.nodes.bySlug[dest.slug ?? ""];
99
116
  return !destNode || (0, match_1.ancestorsAreReal)(destNode, dest.path ?? "", arch);
100
117
  };
101
- const destinationOf = (arch, role, rel) => {
102
- for (const dest of destinationsIn(arch, role, rel)) {
118
+ const destinationOf = (arch, entity, rel) => {
119
+ for (const dest of destinationsIn(arch, entity, rel)) {
103
120
  if (!dest?.slug || !dest.path)
104
121
  continue;
105
122
  if (!nodeOk(arch, dest))
@@ -114,19 +131,22 @@ const destinationOf = (arch, role, rel) => {
114
131
  return null;
115
132
  };
116
133
  exports.destinationOf = destinationOf;
117
- // WHERE a role's code belongs FOR THIS FILE — the ONE answer every caller uses.
118
- const placeFor = (arch, role, rel) => {
119
- const dest = destinationOf(arch, role, rel);
134
+ // WHERE an entity's code belongs FOR THIS FILE — the ONE answer every caller uses.
135
+ const placeFor = (arch, entity, rel) => {
136
+ const dest = destinationOf(arch, entity, rel);
120
137
  if (dest?.path)
121
138
  return { path: dest.path, concrete: true, folder: Boolean(dest.folder) };
122
- const homes = homesOf(arch, role).map((h) => h.template);
123
- // A role with SEVERAL homes and none of them hostable here has no answer for
139
+ const homes = homesOf(arch, entity).map((h) => h.template);
140
+ // An entity with SEVERAL homes and none of them hostable here has no answer for
124
141
  // this file: picking one would be a guess dressed as advice.
125
142
  if (homes.length !== 1) {
126
- const nearest = destinationsIn(arch, role, rel)[0];
143
+ const nearest = destinationsIn(arch, entity, rel)[0];
127
144
  if (!nearest?.template)
128
145
  return null;
129
- const last = nearest.template.split("/").filter((seg) => seg !== "**").pop() ?? "";
146
+ const last = nearest.template
147
+ .split("/")
148
+ .filter((seg) => seg !== "**")
149
+ .pop() ?? "";
130
150
  const folder = /\*\*\s*$/.test(nearest.template) || !/\.[A-Za-z0-9]+$/.test(last);
131
151
  return { path: nearest.template.replace(/\/\*\*$/, ""), concrete: false, folder };
132
152
  }
@@ -136,34 +156,40 @@ const placeFor = (arch, role, rel) => {
136
156
  return { path: only.replace(/\/\*\*$/, ""), concrete: false, folder: true };
137
157
  };
138
158
  exports.placeFor = placeFor;
139
- // Does this file sit inside one of the role's homes, asked THROUGH the tree?
140
- const roleFitsAt = (arch, role, rel) => {
159
+ // Does this file sit inside one of the entity's homes, asked THROUGH the tree?
160
+ const entityFitsAt = (arch, entity, rel) => {
141
161
  if (!rel)
142
162
  return false;
143
- return (arch.nodes.roleHomes[role] ?? []).some((h) => (0, where_1.matchesWhere)({ type: "template", template: h.template }, rel, arch, null, null));
163
+ return (arch.nodes.entityHomes[entity] ?? []).some((h) => (0, where_1.matchesWhere)({ type: "template", template: h.template }, rel, arch, null, null));
144
164
  };
145
- exports.roleFitsAt = roleFitsAt;
146
- // The roles whose declared home covers this path — MOST SPECIFIC FIRST.
147
- const rolesAtPath = (arch, path) => {
165
+ exports.entityFitsAt = entityFitsAt;
166
+ // The entities whose declared home covers this path — MOST SPECIFIC FIRST.
167
+ const entitiesAtPath = (arch, path) => {
148
168
  if (!path)
149
169
  return [];
150
- return Object.keys(arch.nodes.roleHomes)
151
- .filter((role) => roleFitsAt(arch, role, path))
152
- .map((role, i) => ({
153
- role,
170
+ return Object.keys(arch.nodes.entityHomes)
171
+ .filter((entity) => entityFitsAt(arch, entity, path))
172
+ .map((entity, i) => ({
173
+ entity,
154
174
  i,
155
- depth: Math.max(0, ...homesOf(arch, role).map((h) => sharedPrefix(h.template, path))),
175
+ depth: Math.max(0, ...homesOf(arch, entity).map((h) => sharedPrefix(h.template, path))),
156
176
  }))
157
177
  .sort((a, b) => b.depth - a.depth || a.i - b.i)
158
- .map((x) => x.role);
178
+ .map((x) => x.entity);
159
179
  };
160
- exports.rolesAtPath = rolesAtPath;
161
- // Where a role's code belongs FOR THIS FILE, as the BOX and the PATH together.
162
- const homeForRole = (arch, role, rel) => {
163
- const place = placeFor(arch, role, rel);
180
+ exports.entitiesAtPath = entitiesAtPath;
181
+ // Where an entity's code belongs FOR THIS FILE, as the BOX and the PATH together.
182
+ const homeForEntity = (arch, entity, rel) => {
183
+ const place = placeFor(arch, entity, rel);
164
184
  if (!place?.path)
165
185
  return null;
166
186
  const folder = place.folder ? place.path : (0, place_1.dirOf)(place.path);
167
- return { role, path: place.path, folder: place.folder, concrete: Boolean(place.concrete), node: (0, match_1.folderOwner)(arch, folder)?.slug ?? null };
187
+ return {
188
+ entity,
189
+ path: place.path,
190
+ folder: place.folder,
191
+ concrete: Boolean(place.concrete),
192
+ node: (0, match_1.folderOwner)(arch, folder)?.slug ?? null,
193
+ };
168
194
  };
169
- exports.homeForRole = homeForRole;
195
+ exports.homeForEntity = homeForEntity;
@@ -1,4 +1,4 @@
1
- import type { Leaf, Place } from "../facts";
1
+ import type { Leaf, Place } from "@md-code/follow-architecture/entities/facts";
2
2
  declare const wordsIn: (name: string | null | undefined) => string[];
3
3
  declare const nameOnly: (name: string | null | undefined) => string;
4
4
  declare const segmentsOf: (rel: string | null | undefined) => string[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dirOf = exports.placeholdersOf = exports.placeOf = exports.leafOf = exports.parentOf = exports.segmentsOf = exports.nameOnly = exports.wordsIn = void 0;
4
- const split_1 = require("../../utils/split");
4
+ const split_1 = require("@md-code/follow-architecture/utils/split");
5
5
  const wordsIn = (name) => String(name ?? "")
6
6
  // camelCase and ALLCAPS runs: `fileName` → file name, `HTMLParser` → HTML Parser
7
7
  .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
@@ -32,7 +32,13 @@ const leafOf = (rel) => {
32
32
  const name = segments[segments.length - 1] ?? "";
33
33
  const fileName = nameOnly(name);
34
34
  // `x.spec.ts` → [".spec", ".ts"]; `.env` is a name, not an extension.
35
- const exts = fileName === name ? [] : name.slice(fileName.length).split(".").filter(Boolean).map((e) => `.${e}`);
35
+ const exts = fileName === name
36
+ ? []
37
+ : name
38
+ .slice(fileName.length)
39
+ .split(".")
40
+ .filter(Boolean)
41
+ .map((e) => `.${e}`);
36
42
  return { path, segments, exts, fileName, words: wordsIn(fileName) };
37
43
  };
38
44
  exports.leafOf = leafOf;
@@ -46,7 +52,8 @@ const placeOf = (rel, repoFiles = []) => {
46
52
  exports.placeOf = placeOf;
47
53
  // The placeholders a template still has (`{kebab-case}`), for a sentence that
48
54
  // tells the reader what to fill in.
49
- const placeholdersOf = (template) => [...new Set(String(template ?? "").match(/\{[^}]+\}/g) ?? [])].map((p) => `\`${p}\``).join(", ") || "its placeholders";
55
+ const placeholdersOf = (template) => [...new Set(String(template ?? "").match(/\{[^}]+\}/g) ?? [])].map((p) => `\`${p}\``).join(", ") ||
56
+ "its placeholders";
50
57
  exports.placeholdersOf = placeholdersOf;
51
58
  // The folder of a path: a file contributes its parent, a folder is itself.
52
59
  const dirOf = (path) => {
@@ -1,17 +1,19 @@
1
- import { toList, type FieldValue } from "../../utils/field";
2
- import type { Arch, WhereEntry } from "../architecture";
3
- import type { FileFacts } from "../facts";
1
+ import { type Aliases } from "@md-code/follow-architecture/utils/aliases";
2
+ import { toList, type FieldValue } from "@md-code/follow-architecture/utils/field";
3
+ import type { Arch, WhereEntry } from "@md-code/follow-architecture/entities/architecture";
4
+ import type { FileFacts } from "@md-code/follow-architecture/entities/facts";
4
5
  type Caps = Record<string, string | undefined>;
5
- declare const parseWhereEntry: (entry: FieldValue, roles?: Set<string> | null) => WhereEntry;
6
- declare const parseWhere: (value: FieldValue | null | undefined, roles?: Set<string> | null) => WhereEntry[];
7
- declare const matchesWhere: (entry: WhereEntry, rel: string, arch: Arch, facts: FileFacts, targetCaps?: Caps) => boolean;
8
- declare const checkWhere: (entries: WhereEntry[], rel: string, arch: Arch, facts: FileFacts, targetCaps?: Caps) => boolean;
6
+ declare const parseWhereEntry: (entry: FieldValue, entities?: Set<string> | null, aliases?: Aliases | null) => WhereEntry;
7
+ declare const parseWhere: (value: FieldValue | null | undefined, entities?: Set<string> | null, aliases?: Aliases | null) => WhereEntry[];
8
+ declare const matchesWhere: (...args: [entry: WhereEntry | null | undefined, rel: string, arch: Arch, facts: FileFacts | null | undefined, targetCaps?: Caps | null]) => boolean;
9
+ declare const checkWhere: (...args: [entries: WhereEntry[] | null | undefined, rel: string, arch: Arch, facts: FileFacts | null | undefined, targetCaps?: Caps | null]) => boolean;
9
10
  declare const accessorLabel: (e: {
10
11
  scope?: string | null;
11
12
  segments?: string[] | null;
13
+ type?: string | null;
12
14
  } | null | undefined) => string;
13
15
  declare const labelOf: (entry: WhereEntry | null | undefined) => string;
14
16
  declare const fillTemplate: (template: string | null | undefined, rel?: string | null, caps?: Caps | null) => string | null;
15
17
  declare const entryKey: (entry: WhereEntry, rel: string, arch: Arch, facts: FileFacts | null | undefined) => string | null;
16
- export { toList, parseWhereEntry, parseWhere, matchesWhere, checkWhere, accessorLabel, labelOf, fillTemplate, entryKey };
18
+ export { toList, parseWhereEntry, parseWhere, matchesWhere, checkWhere, accessorLabel, labelOf, fillTemplate, entryKey, };
17
19
  export type { Caps };