@md-code/follow-architecture 0.1.1 → 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.
- package/CHANGELOG.md +37 -0
- package/LICENSE +202 -0
- package/README.md +1420 -139
- package/dist/aliases.d.ts +3 -0
- package/dist/aliases.js +12 -0
- package/dist/args.d.ts +18 -0
- package/dist/args.js +94 -0
- package/dist/bin/follow-architecture.d.ts +2 -0
- package/dist/bin/follow-architecture.js +23 -0
- package/dist/closure-project.d.ts +4 -0
- package/dist/closure-project.js +132 -0
- package/dist/code-entities/classify.d.ts +11 -0
- package/dist/code-entities/classify.js +45 -0
- package/dist/code-entities/connector.d.ts +8 -0
- package/dist/code-entities/connector.js +119 -0
- package/dist/code-entities/entities.d.ts +9 -0
- package/dist/code-entities/entities.js +227 -0
- package/dist/code-entities/project.d.ts +21 -0
- package/dist/code-entities/project.js +259 -0
- package/dist/code-entities/walk.d.ts +31 -0
- package/dist/code-entities/walk.js +105 -0
- package/dist/config-options.d.ts +76 -0
- package/dist/config-options.js +52 -0
- package/dist/config-project.d.ts +4 -0
- package/dist/config-project.js +92 -0
- package/dist/config-report.d.ts +19 -0
- package/dist/config-report.js +161 -0
- package/dist/config-rule.d.ts +95 -0
- package/dist/config-rule.js +211 -0
- package/dist/config-state.d.ts +25 -0
- package/dist/config-state.js +269 -0
- package/dist/config.d.ts +107 -0
- package/dist/config.js +38 -0
- package/dist/css/index.d.ts +31 -0
- package/dist/css/index.js +251 -0
- package/dist/css/syntax/css/gate.d.ts +2 -0
- package/dist/css/syntax/css/gate.js +69 -0
- package/dist/css/syntax/css/index.d.ts +7 -0
- package/dist/css/syntax/css/index.js +51 -0
- package/dist/css/syntax/css/reference.d.ts +3 -0
- package/dist/css/syntax/css/reference.js +36 -0
- package/dist/css/syntax/language.d.ts +25 -0
- package/dist/css/syntax/language.js +81 -0
- package/dist/css/syntax/scss/index.d.ts +25 -0
- package/dist/css/syntax/scss/index.js +95 -0
- package/dist/css/syntax/scss/reference.d.ts +3 -0
- package/dist/css/syntax/scss/reference.js +17 -0
- package/dist/css/syntax/styled/document.d.ts +68 -0
- package/dist/css/syntax/styled/document.js +261 -0
- package/dist/css/syntax/styled/markup.d.ts +6 -0
- package/dist/css/syntax/styled/markup.js +84 -0
- package/dist/css/syntax/styled/tags.d.ts +2 -0
- package/dist/css/syntax/styled/tags.js +22 -0
- package/dist/css/syntax/styled/template.d.ts +23 -0
- package/dist/css/syntax/styled/template.js +67 -0
- package/dist/css/syntax/tailwind/tailwind-engine.d.ts +23 -0
- package/dist/css/syntax/tailwind/tailwind-engine.js +37 -0
- package/dist/css/syntax/tailwind/tailwind.d.ts +26 -0
- package/dist/css/syntax/tailwind/tailwind.js +118 -0
- package/dist/css/value/check.d.ts +86 -0
- package/dist/css/value/check.js +122 -0
- package/dist/css/value/expression/arithmetic.d.ts +7 -0
- package/dist/css/value/expression/arithmetic.js +73 -0
- package/dist/css/value/expression/block.d.ts +9 -0
- package/dist/css/value/expression/block.js +92 -0
- package/dist/css/value/expression/conditional.d.ts +8 -0
- package/dist/css/value/expression/conditional.js +53 -0
- package/dist/css/value/expression/index.d.ts +5 -0
- package/dist/css/value/expression/index.js +73 -0
- package/dist/css/value/expression/map.d.ts +7 -0
- package/dist/css/value/expression/map.js +113 -0
- package/dist/css/value/object/index.d.ts +5 -0
- package/dist/css/value/object/index.js +113 -0
- package/dist/css/value/object/members.d.ts +7 -0
- package/dist/css/value/object/members.js +103 -0
- package/dist/css/value/object/node.d.ts +8 -0
- package/dist/css/value/object/node.js +134 -0
- package/dist/css/value/object/path.d.ts +10 -0
- package/dist/css/value/object/path.js +152 -0
- package/dist/css/value/pieces.d.ts +61 -0
- package/dist/css/value/pieces.js +65 -0
- package/dist/css/value/resolve.d.ts +33 -0
- package/dist/css/value/resolve.js +104 -0
- package/dist/css/value/scope.d.ts +28 -0
- package/dist/css/value/scope.js +205 -0
- package/dist/css/value/substitute.d.ts +10 -0
- package/dist/css/value/substitute.js +145 -0
- package/dist/css/value/values.d.ts +23 -0
- package/dist/css/value/values.js +131 -0
- package/dist/entities/architecture.d.ts +165 -0
- package/dist/entities/architecture.js +2 -0
- package/dist/entities/ast/assignments-nodes.d.ts +10 -0
- package/dist/entities/ast/assignments-nodes.js +64 -0
- package/dist/entities/ast/assignments-raw.d.ts +6 -0
- package/dist/entities/ast/assignments-raw.js +139 -0
- package/dist/entities/ast/assignments-tagged.d.ts +5 -0
- package/dist/entities/ast/assignments-tagged.js +195 -0
- package/dist/entities/ast/assignments.d.ts +9 -0
- package/dist/entities/ast/assignments.js +80 -0
- package/dist/entities/ast/branches.d.ts +4 -0
- package/dist/entities/ast/branches.js +32 -0
- package/dist/entities/ast/calls.d.ts +6 -0
- package/dist/entities/ast/calls.js +150 -0
- package/dist/entities/ast/classes.d.ts +5 -0
- package/dist/entities/ast/classes.js +61 -0
- package/dist/entities/ast/climb.d.ts +12 -0
- package/dist/entities/ast/climb.js +17 -0
- package/dist/entities/ast/comments.d.ts +5 -0
- package/dist/entities/ast/comments.js +130 -0
- package/dist/entities/ast/declaration.d.ts +4 -0
- package/dist/entities/ast/declaration.js +26 -0
- package/dist/entities/ast/depth.d.ts +17 -0
- package/dist/entities/ast/depth.js +166 -0
- package/dist/entities/ast/enums.d.ts +6 -0
- package/dist/entities/ast/enums.js +17 -0
- package/dist/entities/ast/export-chain.d.ts +15 -0
- package/dist/entities/ast/export-chain.js +171 -0
- package/dist/entities/ast/file-exports.d.ts +7 -0
- package/dist/entities/ast/file-exports.js +101 -0
- package/dist/entities/ast/file-facts.d.ts +16 -0
- package/dist/entities/ast/file-facts.js +64 -0
- package/dist/entities/ast/file-imports.d.ts +5 -0
- package/dist/entities/ast/file-imports.js +100 -0
- package/dist/entities/ast/file.d.ts +5 -0
- package/dist/entities/ast/file.js +23 -0
- package/dist/entities/ast/functions.d.ts +8 -0
- package/dist/entities/ast/functions.js +111 -0
- package/dist/entities/ast/heritage.d.ts +4 -0
- package/dist/entities/ast/heritage.js +44 -0
- package/dist/entities/ast/index.d.ts +9 -0
- package/dist/entities/ast/index.js +181 -0
- package/dist/entities/ast/kind.d.ts +5 -0
- package/dist/entities/ast/kind.js +34 -0
- package/dist/entities/ast/loose.d.ts +37 -0
- package/dist/entities/ast/loose.js +2 -0
- package/dist/entities/ast/modifiers.d.ts +5 -0
- package/dist/entities/ast/modifiers.js +32 -0
- package/dist/entities/ast/project.d.ts +9 -0
- package/dist/entities/ast/project.js +106 -0
- package/dist/entities/ast/properties.d.ts +11 -0
- package/dist/entities/ast/properties.js +176 -0
- package/dist/entities/ast/resolve.d.ts +16 -0
- package/dist/entities/ast/resolve.js +317 -0
- package/dist/entities/ast/tree.d.ts +31 -0
- package/dist/entities/ast/tree.js +518 -0
- package/dist/entities/ast/types.d.ts +6 -0
- package/dist/entities/ast/types.js +46 -0
- package/dist/entities/ast/usage.d.ts +11 -0
- package/dist/entities/ast/usage.js +81 -0
- package/dist/entities/ast/variables.d.ts +8 -0
- package/dist/entities/ast/variables.js +91 -0
- package/dist/entities/context.d.ts +29 -0
- package/dist/entities/context.js +2 -0
- package/dist/entities/facts.d.ts +284 -0
- package/dist/entities/facts.js +2 -0
- package/dist/entities/findings.d.ts +19 -0
- package/dist/entities/findings.js +2 -0
- package/dist/entities/kinds.d.ts +40 -0
- package/dist/entities/kinds.js +332 -0
- package/dist/entities/location/homes.d.ts +28 -0
- package/dist/entities/location/homes.js +195 -0
- package/dist/entities/location/place.d.ts +10 -0
- package/dist/entities/location/place.js +63 -0
- package/dist/entities/location/where.d.ts +19 -0
- package/dist/entities/location/where.js +277 -0
- package/dist/entities/location.d.ts +16 -0
- package/dist/entities/location.js +140 -0
- package/dist/entities/operators.d.ts +14 -0
- package/dist/entities/operators.js +30 -0
- package/dist/entities/overview/data.d.ts +43 -0
- package/dist/entities/overview/data.js +2 -0
- package/dist/entities/overview/decision.d.ts +60 -0
- package/dist/entities/overview/decision.js +2 -0
- package/dist/entities/overview/file-tree.d.ts +10 -0
- package/dist/entities/overview/file-tree.js +2 -0
- package/dist/entities/overview/finding.d.ts +58 -0
- package/dist/entities/overview/finding.js +2 -0
- package/dist/entities/overview/graph.d.ts +82 -0
- package/dist/entities/overview/graph.js +2 -0
- package/dist/entities/overview/input.d.ts +15 -0
- package/dist/entities/overview/input.js +2 -0
- package/dist/entities/overview/summaries.d.ts +81 -0
- package/dist/entities/overview/summaries.js +2 -0
- package/dist/entities/place.d.ts +5 -0
- package/dist/entities/place.js +2 -0
- package/dist/entities/queries.d.ts +9 -0
- package/dist/entities/queries.js +375 -0
- package/dist/entities/repair.d.ts +16 -0
- package/dist/entities/repair.js +29 -0
- package/dist/entities/schema.d.ts +22 -0
- package/dist/entities/schema.js +81 -0
- package/dist/entities/story.d.ts +47 -0
- package/dist/entities/story.js +2 -0
- package/dist/entities/structure-facts.d.ts +11 -0
- package/dist/entities/structure-facts.js +2 -0
- package/dist/entities/token.d.ts +23 -0
- package/dist/entities/token.js +2 -0
- package/dist/entities/tree/build.d.ts +6 -0
- package/dist/entities/tree/build.js +313 -0
- package/dist/entities/tree/entries.d.ts +7 -0
- package/dist/entities/tree/entries.js +145 -0
- package/dist/entities/tree/index.d.ts +6 -0
- package/dist/entities/tree/index.js +21 -0
- package/dist/entities/tree/match.d.ts +17 -0
- package/dist/entities/tree/match.js +190 -0
- package/dist/fa-index.d.ts +16 -0
- package/dist/fa-index.js +165 -0
- package/dist/fa-open.d.ts +51 -0
- package/dist/fa-open.js +242 -0
- package/dist/fa-store.d.ts +22 -0
- package/dist/fa-store.js +232 -0
- package/dist/fa-values.d.ts +37 -0
- package/dist/fa-values.js +104 -0
- package/dist/facts-record.d.ts +45 -0
- package/dist/facts-record.js +297 -0
- package/dist/frameworks/angular/index.d.ts +7 -0
- package/dist/frameworks/angular/index.js +18 -0
- package/dist/frameworks/facet.d.ts +18 -0
- package/dist/frameworks/facet.js +15 -0
- package/dist/frameworks/index.d.ts +9 -0
- package/dist/frameworks/index.js +134 -0
- package/dist/frameworks/react/index.d.ts +7 -0
- package/dist/frameworks/react/index.js +237 -0
- package/dist/frameworks/test/index.d.ts +6 -0
- package/dist/frameworks/test/index.js +157 -0
- package/dist/frameworks/vue/index.d.ts +7 -0
- package/dist/frameworks/vue/index.js +18 -0
- package/dist/ignore.d.ts +3 -0
- package/dist/ignore.js +62 -0
- package/dist/index-file.d.ts +43 -0
- package/dist/index-file.js +218 -0
- package/dist/index-run.d.ts +39 -0
- package/dist/index-run.js +217 -0
- package/dist/index-zone.d.ts +25 -0
- package/dist/index-zone.js +219 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.js +411 -0
- package/dist/nodes/child-entities.d.ts +3 -0
- package/dist/nodes/child-entities.js +12 -0
- package/dist/nodes/children.d.ts +25 -0
- package/dist/nodes/children.js +165 -0
- package/dist/nodes/finally/emit.d.ts +6 -0
- package/dist/nodes/finally/emit.js +71 -0
- package/dist/nodes/finally/entities.d.ts +13 -0
- package/dist/nodes/finally/entities.js +42 -0
- package/dist/nodes/finally/index.d.ts +8 -0
- package/dist/nodes/finally/index.js +35 -0
- package/dist/nodes/finally/queries.d.ts +5 -0
- package/dist/nodes/finally/queries.js +25 -0
- package/dist/nodes/finally/relations-access.d.ts +5 -0
- package/dist/nodes/finally/relations-access.js +50 -0
- package/dist/nodes/finally/relations-edge.d.ts +29 -0
- package/dist/nodes/finally/relations-edge.js +148 -0
- package/dist/nodes/finally/relations-group.d.ts +31 -0
- package/dist/nodes/finally/relations-group.js +106 -0
- package/dist/nodes/finally/relations.d.ts +5 -0
- package/dist/nodes/finally/relations.js +85 -0
- package/dist/nodes/finally/required.d.ts +5 -0
- package/dist/nodes/finally/required.js +92 -0
- package/dist/nodes/finally/violation.d.ts +17 -0
- package/dist/nodes/finally/violation.js +2 -0
- package/dist/nodes/similar.d.ts +21 -0
- package/dist/nodes/similar.js +178 -0
- package/dist/piece-forms.d.ts +9 -0
- package/dist/piece-forms.js +68 -0
- package/dist/pipeline-entities.d.ts +6 -0
- package/dist/pipeline-entities.js +79 -0
- package/dist/pipeline-facts.d.ts +12 -0
- package/dist/pipeline-facts.js +114 -0
- package/dist/pipeline-unclassified.d.ts +14 -0
- package/dist/pipeline-unclassified.js +188 -0
- package/dist/pipeline.d.ts +7 -0
- package/dist/pipeline.js +28 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +3 -0
- package/dist/release-file.d.ts +3 -0
- package/dist/release-file.js +13 -0
- package/dist/report/asks.d.ts +55 -0
- package/dist/report/asks.js +60 -0
- package/dist/report/cli-report.d.ts +2 -0
- package/dist/report/cli-report.js +13 -0
- package/dist/report/config-error-guard.d.ts +8 -0
- package/dist/report/config-error-guard.js +5 -0
- package/dist/report/configErrors.d.ts +126 -0
- package/dist/report/configErrors.js +121 -0
- package/dist/report/errorTypes/codes/structure.d.ts +15 -0
- package/dist/report/errorTypes/codes/structure.js +76 -0
- package/dist/report/errorTypes/decision-maker.d.ts +23 -0
- package/dist/report/errorTypes/decision-maker.js +109 -0
- package/dist/report/errorTypes/destinations.d.ts +38 -0
- package/dist/report/errorTypes/destinations.js +165 -0
- package/dist/report/errorTypes/finding-type.d.ts +11 -0
- package/dist/report/errorTypes/finding-type.js +2 -0
- package/dist/report/errorTypes/index.d.ts +15 -0
- package/dist/report/errorTypes/index.js +55 -0
- package/dist/report/errorTypes/types/fileContents.d.ts +9 -0
- package/dist/report/errorTypes/types/fileContents.js +40 -0
- package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
- package/dist/report/errorTypes/types/unknownEntity.js +27 -0
- package/dist/report/errorTypes/types/wrongAction.d.ts +22 -0
- package/dist/report/errorTypes/types/wrongAction.js +140 -0
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +9 -0
- package/dist/report/errorTypes/types/wrongPlacement.js +67 -0
- package/dist/report/errorTypes/vocabulary/ids.d.ts +5 -0
- package/dist/report/errorTypes/vocabulary/ids.js +16 -0
- package/dist/report/errorTypes/vocabulary/phrases.d.ts +10 -0
- package/dist/report/errorTypes/vocabulary/phrases.js +187 -0
- package/dist/report/errorTypes/vocabulary/places.d.ts +8 -0
- package/dist/report/errorTypes/vocabulary/places.js +36 -0
- package/dist/report/errorTypes/vocabulary/verbs.d.ts +7 -0
- package/dist/report/errorTypes/vocabulary/verbs.js +30 -0
- package/dist/report/finding-from.d.ts +9 -0
- package/dist/report/finding-from.js +108 -0
- package/dist/report/notices.d.ts +9 -0
- package/dist/report/notices.js +57 -0
- package/dist/report/observed.d.ts +19 -0
- package/dist/report/observed.js +87 -0
- package/dist/report/render-report.d.ts +12 -0
- package/dist/report/render-report.js +145 -0
- package/dist/report/user-report/build/bundle.d.ts +3 -0
- package/dist/report/user-report/build/bundle.js +188 -0
- package/dist/report/user-report/build/bundle.prebuilt.js +1262 -0
- package/dist/report/user-report/data/collect.d.ts +4 -0
- package/dist/report/user-report/data/collect.js +93 -0
- package/dist/report/user-report/data/entities.d.ts +7 -0
- package/dist/report/user-report/data/entities.js +88 -0
- package/dist/report/user-report/data/entity-examples.d.ts +16 -0
- package/dist/report/user-report/data/entity-examples.js +136 -0
- package/dist/report/user-report/data/entity-filters.d.ts +15 -0
- package/dist/report/user-report/data/entity-filters.js +79 -0
- package/dist/report/user-report/data/entity-marks.d.ts +5 -0
- package/dist/report/user-report/data/entity-marks.js +79 -0
- package/dist/report/user-report/data/file-tree.d.ts +9 -0
- package/dist/report/user-report/data/file-tree.js +80 -0
- package/dist/report/user-report/data/finding-boundary.d.ts +9 -0
- package/dist/report/user-report/data/finding-boundary.js +21 -0
- package/dist/report/user-report/data/finding-plan.d.ts +16 -0
- package/dist/report/user-report/data/finding-plan.js +45 -0
- package/dist/report/user-report/data/finding-title.d.ts +12 -0
- package/dist/report/user-report/data/finding-title.js +36 -0
- package/dist/report/user-report/data/findings.d.ts +10 -0
- package/dist/report/user-report/data/findings.js +181 -0
- package/dist/report/user-report/data/graph-edges.d.ts +19 -0
- package/dist/report/user-report/data/graph-edges.js +109 -0
- package/dist/report/user-report/data/graph-entities.d.ts +6 -0
- package/dist/report/user-report/data/graph-entities.js +158 -0
- package/dist/report/user-report/data/graph-helpers.d.ts +7 -0
- package/dist/report/user-report/data/graph-helpers.js +67 -0
- package/dist/report/user-report/data/graph.d.ts +12 -0
- package/dist/report/user-report/data/graph.js +97 -0
- package/dist/report/user-report/data/nodes.d.ts +11 -0
- package/dist/report/user-report/data/nodes.js +116 -0
- package/dist/report/user-report/data/rules.d.ts +7 -0
- package/dist/report/user-report/data/rules.js +62 -0
- package/dist/report/user-report/data/scan.d.ts +8 -0
- package/dist/report/user-report/data/scan.js +69 -0
- package/dist/report/user-report/html/shell.d.ts +3 -0
- package/dist/report/user-report/html/shell.js +27 -0
- package/dist/report/user-report/index.d.ts +8 -0
- package/dist/report/user-report/index.js +58 -0
- package/dist/report/user-report/shared/describe.d.ts +7 -0
- package/dist/report/user-report/shared/describe.js +86 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.js +327 -0
- package/dist/rules/list-vars.d.ts +5 -0
- package/dist/rules/list-vars.js +149 -0
- package/dist/rules/name.d.ts +16 -0
- package/dist/rules/name.js +18 -0
- package/dist/rules/normalize.d.ts +5 -0
- package/dist/rules/normalize.js +108 -0
- package/dist/rules/vars.d.ts +22 -0
- package/dist/rules/vars.js +117 -0
- package/dist/scan-run.d.ts +20 -0
- package/dist/scan-run.js +130 -0
- package/dist/scripts/audit-report.d.ts +2 -0
- package/dist/scripts/audit-report.js +157 -0
- package/dist/usage-index.d.ts +4 -0
- package/dist/usage-index.js +282 -0
- package/dist/usage-mode.d.ts +7 -0
- package/dist/usage-mode.js +16 -0
- package/dist/usage-pass.d.ts +19 -0
- package/dist/usage-pass.js +136 -0
- package/dist/usage-prepare.d.ts +2 -0
- package/dist/usage-prepare.js +22 -0
- package/dist/usage-sweep.d.ts +10 -0
- package/dist/usage-sweep.js +264 -0
- package/dist/utils/accumulate.d.ts +6 -0
- package/dist/utils/accumulate.js +18 -0
- package/dist/utils/aliases.d.ts +22 -0
- package/dist/utils/aliases.js +173 -0
- package/dist/utils/article.d.ts +2 -0
- package/dist/utils/article.js +12 -0
- package/dist/utils/classify.d.ts +12 -0
- package/dist/utils/classify.js +25 -0
- package/dist/utils/configs.d.ts +25 -0
- package/dist/utils/configs.js +97 -0
- package/dist/utils/count.d.ts +7 -0
- package/dist/utils/count.js +13 -0
- package/dist/utils/dispatch.d.ts +2 -0
- package/dist/utils/dispatch.js +27 -0
- package/dist/utils/distinct.d.ts +2 -0
- package/dist/utils/distinct.js +14 -0
- package/dist/utils/field.d.ts +14 -0
- package/dist/utils/field.js +60 -0
- package/dist/utils/file-name.d.ts +2 -0
- package/dist/utils/file-name.js +11 -0
- package/dist/utils/files.d.ts +7 -0
- package/dist/utils/files.js +77 -0
- package/dist/utils/fixpoint.d.ts +2 -0
- package/dist/utils/fixpoint.js +19 -0
- package/dist/utils/gate.d.ts +2 -0
- package/dist/utils/gate.js +12 -0
- package/dist/utils/group.d.ts +3 -0
- package/dist/utils/group.js +33 -0
- package/dist/utils/host.d.ts +3 -0
- package/dist/utils/host.js +16 -0
- package/dist/utils/imports.d.ts +12 -0
- package/dist/utils/imports.js +185 -0
- package/dist/utils/judged.d.ts +5 -0
- package/dist/utils/judged.js +19 -0
- package/dist/utils/keyed.d.ts +2 -0
- package/dist/utils/keyed.js +23 -0
- package/dist/utils/map-record.d.ts +2 -0
- package/dist/utils/map-record.js +11 -0
- package/dist/utils/packages.d.ts +15 -0
- package/dist/utils/packages.js +207 -0
- package/dist/utils/path-label.d.ts +6 -0
- package/dist/utils/path-label.js +37 -0
- package/dist/utils/pattern.d.ts +19 -0
- package/dist/utils/pattern.js +231 -0
- package/dist/utils/permission.d.ts +16 -0
- package/dist/utils/permission.js +18 -0
- package/dist/utils/plural.d.ts +2 -0
- package/dist/utils/plural.js +9 -0
- package/dist/utils/qualified.d.ts +2 -0
- package/dist/utils/qualified.js +21 -0
- package/dist/utils/rank.d.ts +2 -0
- package/dist/utils/rank.js +24 -0
- package/dist/utils/read-field.d.ts +12 -0
- package/dist/utils/read-field.js +50 -0
- package/dist/utils/read-when.d.ts +2 -0
- package/dist/utils/read-when.js +17 -0
- package/dist/utils/reason.d.ts +4 -0
- package/dist/utils/reason.js +9 -0
- package/dist/utils/record.d.ts +3 -0
- package/dist/utils/record.js +21 -0
- package/dist/utils/resolve.d.ts +2 -0
- package/dist/utils/resolve.js +24 -0
- package/dist/utils/search.d.ts +2 -0
- package/dist/utils/search.js +21 -0
- package/dist/utils/seen.d.ts +6 -0
- package/dist/utils/seen.js +27 -0
- package/dist/utils/span.d.ts +5 -0
- package/dist/utils/span.js +2 -0
- package/dist/utils/speak.d.ts +2 -0
- package/dist/utils/speak.js +18 -0
- package/dist/utils/split.d.ts +8 -0
- package/dist/utils/split.js +21 -0
- package/dist/utils/template.d.ts +5 -0
- package/dist/utils/template.js +5 -0
- package/dist/utils/text.d.ts +4 -0
- package/dist/utils/text.js +42 -0
- package/dist/utils/tokenize.d.ts +2 -0
- package/dist/utils/tokenize.js +18 -0
- package/dist/utils/try-read.d.ts +4 -0
- package/dist/utils/try-read.js +24 -0
- package/dist/utils/typed-field.d.ts +3 -0
- package/dist/utils/typed-field.js +16 -0
- package/dist/utils/verdicts.d.ts +4 -0
- package/dist/utils/verdicts.js +20 -0
- package/entities/operators.ts +31 -0
- package/package.json +101 -47
- package/report/errorTypes/vocabulary/ids.ts +17 -0
- package/report/errorTypes/vocabulary/phrases.ts +181 -0
- package/report/errorTypes/vocabulary/places.ts +51 -0
- package/report/errorTypes/vocabulary/verbs.ts +31 -0
- package/report/user-report/shared/describe.ts +107 -0
- package/ast.js +0 -107
- package/bin/follow-architecture.js +0 -6
- package/config.js +0 -101
- package/entities/aliases.js +0 -10
- package/entities/invariants.js +0 -134
- package/entities/nodes.js +0 -112
- package/main.js +0 -96
- package/plugin.js +0 -5
- package/report.js +0 -73
- package/utils.js +0 -104
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.countBy = void 0;
|
|
4
|
+
// Count `items` by `keyOf`, most frequent first (ties keep first-seen order).
|
|
5
|
+
const countBy = (items, keyOf) => {
|
|
6
|
+
const map = new Map();
|
|
7
|
+
for (const item of items) {
|
|
8
|
+
const key = keyOf(item);
|
|
9
|
+
map.set(key, (map.get(key) ?? 0) + 1);
|
|
10
|
+
}
|
|
11
|
+
return [...map.entries()].sort((a, b) => b[1] - a[1]).map(([key, count]) => ({ key, count }));
|
|
12
|
+
};
|
|
13
|
+
exports.countBy = countBy;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const dispatchOn: <Subject, Discriminant extends string | number, Answer>(subject: Subject | null | undefined, discriminantOf: (subject: Subject) => Discriminant | null | undefined, readers: ReadonlyMap<Discriminant, (subject: Subject) => Answer>, fallback: (subject: Subject | null | undefined) => Answer) => Answer;
|
|
2
|
+
export { dispatchOn };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dispatchOn = void 0;
|
|
4
|
+
// A DISPATCH is one mechanism: a subject carries a discriminant, a table says
|
|
5
|
+
// which reader answers which case, and anything unclaimed falls to one default
|
|
6
|
+
// reading. A function-like node dispatches on the parser's kind to find its name
|
|
7
|
+
// (a named kind answers its own, anything else asks its parent —
|
|
8
|
+
// `entities/ast/functions`); a class attribute's initializer dispatches on the
|
|
9
|
+
// parser's kind to read its text (a literal, a `{expr}` — `css/markup`). The walk
|
|
10
|
+
// is the same — read the discriminant, ask the claiming reader, otherwise the
|
|
11
|
+
// default — so it lives here once. What the cases ARE and how each is read is the
|
|
12
|
+
// caller's own; nothing here knows functions or JSX.
|
|
13
|
+
// Answer `subject` by its discriminant: the claiming reader's answer when a
|
|
14
|
+
// reader claims the case, the default reading otherwise (including a missing
|
|
15
|
+
// subject or discriminant — an absent thing is nobody's case). The fallback is
|
|
16
|
+
// LAZY: a claiming reader's own answer (even null) is final and never overridden,
|
|
17
|
+
// and the default is computed only when no reader claims the case.
|
|
18
|
+
const dispatchOn = (subject, discriminantOf, readers, fallback) => {
|
|
19
|
+
if (subject == null)
|
|
20
|
+
return fallback(subject);
|
|
21
|
+
const discriminant = discriminantOf(subject);
|
|
22
|
+
const reader = discriminant == null ? undefined : readers.get(discriminant);
|
|
23
|
+
if (!reader)
|
|
24
|
+
return fallback(subject);
|
|
25
|
+
return reader(subject);
|
|
26
|
+
};
|
|
27
|
+
exports.dispatchOn = dispatchOn;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.distinctFlat = void 0;
|
|
4
|
+
// A DISTINCT COLLECT is one mechanism: every item of a list contributes names
|
|
5
|
+
// (zero, one, or many), and the answer is the names in first-seen order, each
|
|
6
|
+
// once. A component's props are the distinct names its parameters contribute
|
|
7
|
+
// (`frameworks/react`); an entity's shape is the distinct entities its children
|
|
8
|
+
// declare (`nodes/similar`). The walk is the same — flatMap the contributions,
|
|
9
|
+
// keep the first of each — so it lives here once. What a name IS and where it
|
|
10
|
+
// comes from is the caller's own.
|
|
11
|
+
const distinctFlat = (items, namesOf) => [
|
|
12
|
+
...new Set(items.flatMap(namesOf)),
|
|
13
|
+
];
|
|
14
|
+
exports.distinctFlat = distinctFlat;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type FieldValue = string | number | boolean | null | undefined | readonly FieldValue[] | {
|
|
2
|
+
readonly [key: string]: FieldValue;
|
|
3
|
+
};
|
|
4
|
+
declare const isList: <V>(v: V) => v is V & readonly FieldValue[];
|
|
5
|
+
declare const isObj: <V>(v: V) => v is V & {
|
|
6
|
+
readonly [key: string]: FieldValue;
|
|
7
|
+
};
|
|
8
|
+
declare const isRecordValue: (v: FieldValue) => v is {
|
|
9
|
+
readonly [key: string]: FieldValue;
|
|
10
|
+
};
|
|
11
|
+
declare const toList: (v: FieldValue) => FieldValue[];
|
|
12
|
+
declare const fieldOf: (item: FieldValue, key: string) => FieldValue;
|
|
13
|
+
export { fieldOf, isObj, isRecordValue, isList, toList };
|
|
14
|
+
export type { FieldValue };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toList = exports.isList = exports.isRecordValue = exports.isObj = exports.fieldOf = void 0;
|
|
4
|
+
// The generic narrowing guards: they keep the caller's own type (`V`) while
|
|
5
|
+
// adding the list/record view, so a typed fact stays typed through the walk.
|
|
6
|
+
// `isObj` is the ONE record guard — every "is this a record" question reads it.
|
|
7
|
+
const isList = (v) => Array.isArray(v);
|
|
8
|
+
exports.isList = isList;
|
|
9
|
+
const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
10
|
+
exports.isObj = isObj;
|
|
11
|
+
// A record view of a plain value (never an array): the typed specialisation of
|
|
12
|
+
// `isObj` for the `FieldValue` model, used where a key would otherwise collide
|
|
13
|
+
// with an Array method (`filter`, `length`, …).
|
|
14
|
+
const isRecordValue = (v) => isObj(v);
|
|
15
|
+
exports.isRecordValue = isRecordValue;
|
|
16
|
+
// A value as a list: null/undefined → nothing, a list → its items, a scalar → one
|
|
17
|
+
// item. The ONE spelling of "list-or-single", shared by every `where`/`infer` reader.
|
|
18
|
+
const toList = (v) => {
|
|
19
|
+
if (v == null)
|
|
20
|
+
return [];
|
|
21
|
+
if (isList(v))
|
|
22
|
+
return [...v];
|
|
23
|
+
return [v];
|
|
24
|
+
};
|
|
25
|
+
exports.toList = toList;
|
|
26
|
+
const ARRAY_INDEX = /^\d+$/;
|
|
27
|
+
// Read ONE key off a value: a list answers `length` and its own indices, an
|
|
28
|
+
// object answers its keys, anything else answers nothing.
|
|
29
|
+
const readOne = (acc, k) => {
|
|
30
|
+
if (isList(acc)) {
|
|
31
|
+
if (k === "length")
|
|
32
|
+
return acc.length;
|
|
33
|
+
return ARRAY_INDEX.test(k) && Number(k) < acc.length ? acc[Number(k)] : undefined;
|
|
34
|
+
}
|
|
35
|
+
return isRecordValue(acc) ? acc[k] : undefined;
|
|
36
|
+
};
|
|
37
|
+
// The value of a key that is NOT present on a list: what the segment names in
|
|
38
|
+
// every element, flattened one level. `fieldOf` already answers `undefined` for a
|
|
39
|
+
// null element, and `toList` turns that into nothing — so the walk is one call.
|
|
40
|
+
const acrossList = (acc, k) => acc.flatMap((entry) => toList(fieldOf(entry, k)));
|
|
41
|
+
const fieldOf = (item, key) => {
|
|
42
|
+
if (item == null)
|
|
43
|
+
return undefined;
|
|
44
|
+
if (!String(key).includes("."))
|
|
45
|
+
return readOne(item, key);
|
|
46
|
+
return String(key)
|
|
47
|
+
.split(".")
|
|
48
|
+
.reduce((acc, k) => {
|
|
49
|
+
if (acc == null)
|
|
50
|
+
return undefined;
|
|
51
|
+
// A segment a list ITSELF answers (`length`, an index) is read; any other
|
|
52
|
+
// segment is collected across the list.
|
|
53
|
+
if (isList(acc) && (k === "length" || (ARRAY_INDEX.test(k) && Number(k) < acc.length)))
|
|
54
|
+
return readOne(acc, k);
|
|
55
|
+
if (isList(acc))
|
|
56
|
+
return acrossList(acc, k);
|
|
57
|
+
return readOne(acc, k);
|
|
58
|
+
}, item);
|
|
59
|
+
};
|
|
60
|
+
exports.fieldOf = fieldOf;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fileName = void 0;
|
|
4
|
+
// A FILE NAME is one mechanism: the last segment of a path. The browser names a
|
|
5
|
+
// place-box by its file (`graph/representation/fileContents`); any consumer that
|
|
6
|
+
// reads a path's leaf asks the same question. The split is the shared `partsOf`
|
|
7
|
+
// core; nothing here knows what the path MEANS.
|
|
8
|
+
const split_1 = require("./split");
|
|
9
|
+
// The last segment of a path (`a/b/c.ts` → `c.ts`); an empty path names nothing.
|
|
10
|
+
const fileName = (p) => (p ? (0, split_1.partsOf)(p, "/").last : "");
|
|
11
|
+
exports.fileName = fileName;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 () {
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.collectFiles = void 0;
|
|
37
|
+
// The ONE directory walk: which files of a repo the tool looks at. Scan scope is
|
|
38
|
+
// the tool's (extensions, skipped folders, skipped globs), never the
|
|
39
|
+
// architecture's — so there is one walker and two callers. The recursion itself
|
|
40
|
+
// is the shared one (`@md-code/utils/node/files`): this file only states FA's
|
|
41
|
+
// scan scope on top of it.
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
|
+
const minimatch_1 = require("minimatch");
|
|
44
|
+
const files_1 = require("@md-code/utils/node/files");
|
|
45
|
+
const imports_1 = require("./imports");
|
|
46
|
+
const notices_1 = require("@md-code/follow-architecture/report/notices");
|
|
47
|
+
// Absolute paths of every scanned file under `repoRoot`.
|
|
48
|
+
const collectFiles = (repoRoot, { exts, ignoreDirs, ignoreGlobs = [] }) => {
|
|
49
|
+
const extSet = new Set(exts);
|
|
50
|
+
// `dot: true` because the walk below visits dot folders and dot files
|
|
51
|
+
// (`.prettierrc.js`, `apps/.tmp-ssr/…`): an ignore glob that cannot name them is
|
|
52
|
+
// not a scope, and `apps/**` would silently keep the dotted half of the tree.
|
|
53
|
+
const ignored = (rel) => ignoreGlobs.some((g) => (0, minimatch_1.minimatch)(rel, g, { dot: true }));
|
|
54
|
+
// The shared walk tests extensions by suffix, FA by the extension itself:
|
|
55
|
+
// the suffix pre-filter may keep a `x.mts` for `.ts`, the filter below drops
|
|
56
|
+
// it again, so the file list is exactly the one FA always had.
|
|
57
|
+
const files = (0, files_1.walk)(repoRoot, exts, ignoreDirs, {
|
|
58
|
+
// A dot directory is scan scope like any other here: FA has always
|
|
59
|
+
// visited `.github`, `.changeset` and friends unless listed as ignored.
|
|
60
|
+
dot: true,
|
|
61
|
+
// An unreadable folder is not a scan error: the file list just does not
|
|
62
|
+
// include it (folder facts degrade, the rule still runs). The reason is
|
|
63
|
+
// reported, so a short list never looks like a complete one.
|
|
64
|
+
onUnreadable: (dir, error) => {
|
|
65
|
+
(0, notices_1.notice)(`the folder ${dir} could not be read`, error instanceof Error ? error.message : String(error));
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const out = files.filter((abs) => extSet.has(path.extname(abs)) && !ignored((0, imports_1.toRel)(repoRoot, abs)));
|
|
69
|
+
// SORTED, always: `readdirSync` returns whatever order the filesystem
|
|
70
|
+
// happens to keep (hashed on btrfs, insertion on ext4), so without this the
|
|
71
|
+
// same tree produced a different report from one machine — or one run — to
|
|
72
|
+
// the next. The order is not cosmetic: a `dedupeBy` finding is reported for
|
|
73
|
+
// the FIRST file that reaches a place, so an unstable list moves the
|
|
74
|
+
// finding between files.
|
|
75
|
+
return out.sort();
|
|
76
|
+
};
|
|
77
|
+
exports.collectFiles = collectFiles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.untilStable = void 0;
|
|
4
|
+
// A FIXPOINT is one mechanism: a step changes state and reports whether it did,
|
|
5
|
+
// and the walk repeats until a step changes nothing (or a stated pass limit is
|
|
6
|
+
// reached). Entity assignment and call-target resolution feed each other — a
|
|
7
|
+
// entity may be inferred from the entities of the callees, while a callee's entity is
|
|
8
|
+
// what classification resolves — so the passes repeat until nothing moves.
|
|
9
|
+
// The walk is the same for any mutually-feeding enrichment; what a step DOES
|
|
10
|
+
// is the caller's own.
|
|
11
|
+
// Run `step` until it reports no change, at most `maxPasses` times. The first
|
|
12
|
+
// pass always runs; the step's own verdict decides every next one.
|
|
13
|
+
const untilStable = (step, maxPasses) => {
|
|
14
|
+
for (let pass = 0; pass < maxPasses; pass += 1) {
|
|
15
|
+
if (!step())
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.untilStable = untilStable;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.admitsWhenNoneReject = void 0;
|
|
4
|
+
// A GATE is one mechanism: a subject is admitted when NONE of the rejection
|
|
5
|
+
// verdicts fires. The CSS content gate rejects a document with no structure, a
|
|
6
|
+
// data-format selector, or no grammar-known property (`css/syntax/css`); the AST
|
|
7
|
+
// read gate rejects a member access that is an inner hop, a write target or an
|
|
8
|
+
// operand (`entities/ast/properties`). The decision is the same — run every
|
|
9
|
+
// verdict, admit only when all pass — so it lives here once. What counts as a
|
|
10
|
+
// rejection is the caller's own policy; nothing here knows CSS or the AST.
|
|
11
|
+
const admitsWhenNoneReject = (subject, rejects) => !rejects.some((reject) => reject(subject));
|
|
12
|
+
exports.admitsWhenNoneReject = admitsWhenNoneReject;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushGroup = exports.groupBy = void 0;
|
|
4
|
+
// A GROUPED LIST is one mechanism: items arrive with a key, and the answer is
|
|
5
|
+
// the buckets in first-seen order, each holding its items. The browser groups
|
|
6
|
+
// edges / findings by a key (`utils/format`); any consumer that folds a list
|
|
7
|
+
// into ordered buckets asks the same question. The walk lives here once; what
|
|
8
|
+
// the key MEANS is the caller's own.
|
|
9
|
+
// Group `items` by `keyOf`, preserving first-seen bucket order.
|
|
10
|
+
const groupBy = (items, keyOf) => {
|
|
11
|
+
const map = new Map();
|
|
12
|
+
for (const item of items) {
|
|
13
|
+
const key = keyOf(item);
|
|
14
|
+
const bucket = map.get(key);
|
|
15
|
+
if (bucket)
|
|
16
|
+
bucket.push(item);
|
|
17
|
+
else
|
|
18
|
+
map.set(key, [item]);
|
|
19
|
+
}
|
|
20
|
+
return [...map.entries()];
|
|
21
|
+
};
|
|
22
|
+
exports.groupBy = groupBy;
|
|
23
|
+
// Push ONE item into the bucket `key` names, creating the bucket on first use —
|
|
24
|
+
// the in-place counterpart of `groupBy` for a map built across several calls
|
|
25
|
+
// (a provider set, a scope's variables). One spelling of get-or-create.
|
|
26
|
+
const pushGroup = (map, key, item) => {
|
|
27
|
+
const bucket = map.get(key);
|
|
28
|
+
if (bucket)
|
|
29
|
+
bucket.push(item);
|
|
30
|
+
else
|
|
31
|
+
map.set(key, [item]);
|
|
32
|
+
};
|
|
33
|
+
exports.pushGroup = pushGroup;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hostOf = void 0;
|
|
4
|
+
const spansLine = (candidate, line) => Array.isArray(candidate.lines) &&
|
|
5
|
+
candidate.lines.length > 0 &&
|
|
6
|
+
candidate.lines[0] <= line &&
|
|
7
|
+
line <= candidate.lines[candidate.lines.length - 1];
|
|
8
|
+
const isLater = (a, b, list) => list.indexOf(b) - list.indexOf(a);
|
|
9
|
+
const hostOf = (candidates, line) => {
|
|
10
|
+
if (line === null)
|
|
11
|
+
return undefined;
|
|
12
|
+
return [...candidates]
|
|
13
|
+
.filter((candidate) => spansLine(candidate, line))
|
|
14
|
+
.sort((a, b) => (a.lines?.length ?? 0) - (b.lines?.length ?? 0) || isLater(a, b, candidates))[0];
|
|
15
|
+
};
|
|
16
|
+
exports.hostOf = hostOf;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SourceFile } from "ts-morph";
|
|
2
|
+
type Aliases = Record<string, string>;
|
|
3
|
+
declare const toRel: (repoRoot: string, filePath: string) => string;
|
|
4
|
+
declare const pathsOf: (aliases?: Aliases) => Record<string, string[]>;
|
|
5
|
+
interface ResolveContext {
|
|
6
|
+
repoRoot: string;
|
|
7
|
+
aliases?: Aliases;
|
|
8
|
+
repoFiles?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
declare const resolveImport: (sf: SourceFile, source: string, { repoRoot, aliases, repoFiles }: ResolveContext) => string | null;
|
|
11
|
+
export { resolveImport, toRel, pathsOf };
|
|
12
|
+
export type { ResolveContext };
|
|
@@ -0,0 +1,185 @@
|
|
|
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 () {
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.pathsOf = exports.toRel = exports.resolveImport = void 0;
|
|
37
|
+
// Import resolution — the one mechanism by which any entity points at another
|
|
38
|
+
// file. A reference is either an alias (see the `aliases` entity) or a relative
|
|
39
|
+
// module path.
|
|
40
|
+
//
|
|
41
|
+
// The lookup itself is TypeScript's (`resolveModuleName` with the aliases
|
|
42
|
+
// injected as `paths`), so the engine never keeps its own list of extensions or
|
|
43
|
+
// index files — the compiler that parses the code decides where an import
|
|
44
|
+
// points. The files it may find are the ones the tool actually scans
|
|
45
|
+
// (`repoFiles`) plus whatever the project has loaded, so a resolution never
|
|
46
|
+
// escapes the architecture's own file set.
|
|
47
|
+
const path = __importStar(require("node:path"));
|
|
48
|
+
const ts_morph_1 = require("ts-morph");
|
|
49
|
+
const notices_1 = require("@md-code/follow-architecture/report/notices");
|
|
50
|
+
const resolve_1 = require("./resolve");
|
|
51
|
+
const aliases_1 = require("./aliases");
|
|
52
|
+
const packages_1 = require("./packages");
|
|
53
|
+
const norm = (p) => String(p).replace(/\\/g, "/");
|
|
54
|
+
const toRel = (repoRoot, filePath) => norm(path.relative(repoRoot, filePath));
|
|
55
|
+
exports.toRel = toRel;
|
|
56
|
+
// The YAML `aliases` map says `alias → folder or entry file`, which is exactly
|
|
57
|
+
// what TypeScript's `paths` expresses in two entries: the alias itself and its
|
|
58
|
+
// subpaths (`alias/x` → `folder/x`).
|
|
59
|
+
//
|
|
60
|
+
// An alias that names a FILE (`"@md/styles": packages/styles/index.ts`) is the
|
|
61
|
+
// common case, and its subpaths go through that file's DIRECTORY: `index.ts/*`
|
|
62
|
+
// names a folder that cannot exist, so `@md/styles/themes/viking` never resolved
|
|
63
|
+
// and the checker failed on it later. Where a target sits is the alias module's
|
|
64
|
+
// answer (`folderOf`), not a second reading of it here.
|
|
65
|
+
const pathsOf = (aliases) => {
|
|
66
|
+
const paths = {};
|
|
67
|
+
for (const [alias, target] of Object.entries(aliases ?? {})) {
|
|
68
|
+
paths[alias] = [target];
|
|
69
|
+
paths[`${alias}/*`] = [`${(0, packages_1.folderOf)(target)}/*`];
|
|
70
|
+
}
|
|
71
|
+
return paths;
|
|
72
|
+
};
|
|
73
|
+
exports.pathsOf = pathsOf;
|
|
74
|
+
// The folders the scanned files live in, derived once per file list: the
|
|
75
|
+
// resolver asks "does this folder exist" far more often than it asks anything
|
|
76
|
+
// else, and a folder exists here when the architecture has a file in it.
|
|
77
|
+
const foldersCache = new WeakMap();
|
|
78
|
+
const foldersOf = (repoFiles) => {
|
|
79
|
+
let folders = foldersCache.get(repoFiles);
|
|
80
|
+
if (!folders) {
|
|
81
|
+
folders = new Set([""]);
|
|
82
|
+
for (const file of repoFiles ?? []) {
|
|
83
|
+
const parts = file.split("/");
|
|
84
|
+
for (let i = 1; i < parts.length; i += 1)
|
|
85
|
+
folders.add(parts.slice(0, i).join("/"));
|
|
86
|
+
}
|
|
87
|
+
foldersCache.set(repoFiles, folders);
|
|
88
|
+
}
|
|
89
|
+
return folders;
|
|
90
|
+
};
|
|
91
|
+
// Where the resolver may look: the scanned file list, plus the project's own
|
|
92
|
+
// file system (a real project reads the disk, a test project reads memory).
|
|
93
|
+
const resolutionHost = (project, repoRoot, repoFiles) => {
|
|
94
|
+
const files = project.getFileSystem();
|
|
95
|
+
const scanned = new Set(repoFiles ?? []);
|
|
96
|
+
const folders = foldersOf(repoFiles ?? []);
|
|
97
|
+
return {
|
|
98
|
+
fileExists: (p) => scanned.has(toRel(repoRoot, p)) || files.fileExistsSync(p),
|
|
99
|
+
readFile: (p) => {
|
|
100
|
+
try {
|
|
101
|
+
return files.readFileSync(p);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const e = error;
|
|
105
|
+
// The resolver PROBES paths, so a missing file is an answer, not a
|
|
106
|
+
// failure. Any other reason is reported: that file exists and is
|
|
107
|
+
// unreadable, which changes what the analysis knows.
|
|
108
|
+
if (e.code !== "ENOENT")
|
|
109
|
+
(0, notices_1.notice)(`the file ${p} could not be read`, e.message ?? String(e));
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
directoryExists: (p) => folders.has(toRel(repoRoot, p)) || files.directoryExistsSync(p),
|
|
114
|
+
// `node_modules` walks are not a relation the architecture can describe:
|
|
115
|
+
// anything resolved outside the scanned set is dropped below anyway.
|
|
116
|
+
getDirectories: () => [],
|
|
117
|
+
realpath: (p) => p,
|
|
118
|
+
useCaseSensitiveFileNames: () => true,
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
const setups = new WeakMap();
|
|
122
|
+
// The setup is keyed by the ARRAY the caller passes: the same reference means the
|
|
123
|
+
// same scanned set (the caller must not mutate an array it handed in). A default
|
|
124
|
+
// `[]` would be a fresh reference per call and would miss the cache every time,
|
|
125
|
+
// so the empty case has one constant.
|
|
126
|
+
const NO_FILES = [];
|
|
127
|
+
const setupOf = (project, repoRoot, aliases, repoFiles = NO_FILES) => {
|
|
128
|
+
const cached = setups.get(project);
|
|
129
|
+
if (cached && cached.repoFiles === repoFiles && cached.repoRoot === repoRoot && cached.aliases === aliases)
|
|
130
|
+
return cached;
|
|
131
|
+
const setup = {
|
|
132
|
+
repoRoot,
|
|
133
|
+
repoFiles,
|
|
134
|
+
aliases,
|
|
135
|
+
scanned: new Set(repoFiles),
|
|
136
|
+
options: {
|
|
137
|
+
baseUrl: repoRoot,
|
|
138
|
+
paths: pathsOf(aliases),
|
|
139
|
+
moduleResolution: ts_morph_1.ts.ModuleResolutionKind.Node10,
|
|
140
|
+
allowJs: true,
|
|
141
|
+
},
|
|
142
|
+
host: resolutionHost(project, repoRoot, repoFiles),
|
|
143
|
+
};
|
|
144
|
+
setups.set(project, setup);
|
|
145
|
+
return setup;
|
|
146
|
+
};
|
|
147
|
+
// Resolve an import source (relative path or alias) to a repo-relative file.
|
|
148
|
+
// A resolution that lands outside the scanned set (a `.d.ts`, a file in an
|
|
149
|
+
// ignored folder) is not a relation the architecture can talk about → null.
|
|
150
|
+
//
|
|
151
|
+
// The compiler answers for folders, entry files and plain module paths. A package
|
|
152
|
+
// that publishes SUBPATHS has neither a root file nor a folder per subpath —
|
|
153
|
+
// `"./chip"` is `dist/types/atoms/Chip/index.d.ts`, built from
|
|
154
|
+
// `atoms/Chip/index.tsx` — so those subpaths are asked of the package's own
|
|
155
|
+
// `exports`, through the ONE alias reader (`utils/aliases`), never a second one.
|
|
156
|
+
const aliasedSource = (specifier, setup) => {
|
|
157
|
+
const alias = (0, aliases_1.splitAlias)(setup.aliases, specifier);
|
|
158
|
+
if (!alias || !setup.repoFiles.length)
|
|
159
|
+
return null;
|
|
160
|
+
const place = (0, aliases_1.locateAlias)(setup.aliases, alias.name, alias.rest, {
|
|
161
|
+
repoRoot: setup.repoRoot,
|
|
162
|
+
repoFiles: setup.repoFiles,
|
|
163
|
+
});
|
|
164
|
+
for (const file of place?.files ?? [])
|
|
165
|
+
if (setup.scanned.has(file))
|
|
166
|
+
return file;
|
|
167
|
+
return null;
|
|
168
|
+
};
|
|
169
|
+
const resolveImport = (sf, source, { repoRoot, aliases, repoFiles }) => {
|
|
170
|
+
const setup = setupOf(sf.getProject(), repoRoot, aliases, repoFiles);
|
|
171
|
+
return (0, resolve_1.resolveReference)(source || null, (specifier) => {
|
|
172
|
+
const hit = ts_morph_1.ts.resolveModuleName(specifier, sf.getFilePath(), setup.options, setup.host).resolvedModule;
|
|
173
|
+
const rel = hit ? toRel(repoRoot, hit.resolvedFileName) : null;
|
|
174
|
+
// The compiler's answer IS the relation — unless it lands outside the
|
|
175
|
+
// scanned set (a built mirror of a published subpath) or nowhere at all.
|
|
176
|
+
if (rel != null && (!repoFiles || setup.scanned.has(rel)))
|
|
177
|
+
return rel;
|
|
178
|
+
// Without a scanned set there is nothing to check an answer against: the
|
|
179
|
+
// compiler's own answer stands, as it always did.
|
|
180
|
+
if (!repoFiles)
|
|
181
|
+
return rel;
|
|
182
|
+
return aliasedSource(specifier, setup);
|
|
183
|
+
}, (rel) => rel);
|
|
184
|
+
};
|
|
185
|
+
exports.resolveImport = resolveImport;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.judgedItems = void 0;
|
|
4
|
+
// A JUDGED ITEM is one mechanism: a list of items is walked, each is judged,
|
|
5
|
+
// and only the ones that earn a verdict are kept — the rest are silent. The
|
|
6
|
+
// relation check judges every edge of a fact kind and groups the refusals
|
|
7
|
+
// (`nodes/finally/relations`); any consumer that filters a list by a verdict
|
|
8
|
+
// asks the same question. The walk is the same — judge, keep the answered —
|
|
9
|
+
// so it lives here once. What a verdict IS is the caller's own.
|
|
10
|
+
const judgedItems = (items, judge) => {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const item of items) {
|
|
13
|
+
const verdict = judge(item);
|
|
14
|
+
if (verdict != null)
|
|
15
|
+
out.push({ item, verdict });
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
};
|
|
19
|
+
exports.judgedItems = judgedItems;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyedDefs = void 0;
|
|
4
|
+
// A KEYED SECTION is one mechanism: the YAML may write a section as a LIST of
|
|
5
|
+
// `{ slug, … }` entries or as a MAP keyed by slug, and both spellings describe
|
|
6
|
+
// the same defs. The nodes section reads it one way (`entities/tree/build`),
|
|
7
|
+
// the entities section the same way (`code-entities/entities`) — so the walk lives
|
|
8
|
+
// here once: a list is itself; a map's entries take their key as the slug when
|
|
9
|
+
// the entry does not name one. What a def IS and what is validated afterwards
|
|
10
|
+
// is the caller's own; nothing here knows nodes or entities.
|
|
11
|
+
const field_1 = require("./field");
|
|
12
|
+
// The defs a list-or-map section declares, in declared order. The caller's def
|
|
13
|
+
// type `T` flows through untouched; a map value that is not a record is kept
|
|
14
|
+
// as-is (null) — the caller's validation names it.
|
|
15
|
+
const isListSection = (section) => Array.isArray(section);
|
|
16
|
+
const keyedDefs = (section) => {
|
|
17
|
+
if (section == null)
|
|
18
|
+
return [];
|
|
19
|
+
if (isListSection(section))
|
|
20
|
+
return [...section];
|
|
21
|
+
return Object.entries(section).map(([k, v]) => ((0, field_1.isObj)(v) ? { ...v, slug: v.slug ?? k } : null));
|
|
22
|
+
};
|
|
23
|
+
exports.keyedDefs = keyedDefs;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapRecord = void 0;
|
|
4
|
+
// A MAPPED RECORD is one mechanism: a record's entries are each read into a
|
|
5
|
+
// value, and the answers are collected under the same keys. The aliases
|
|
6
|
+
// section maps each name to a normalized path (`aliases`); an entity's actions
|
|
7
|
+
// map each kind to its normalized action (`code-entities/entities`). The walk is the
|
|
8
|
+
// same — read each entry, keep the key — so it lives here once. What an entry
|
|
9
|
+
// IS and how it is read is the caller's own.
|
|
10
|
+
const mapRecord = (record, read) => Object.fromEntries(Object.entries(record).map(([k, v]) => [k, read(k, v)]));
|
|
11
|
+
exports.mapRecord = mapRecord;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
declare const ENTRY_FILE: RegExp;
|
|
3
|
+
declare const norm: (p: string | null | undefined) => string;
|
|
4
|
+
declare const isFile: (p: string) => boolean;
|
|
5
|
+
declare const folderOf: (target: string) => string;
|
|
6
|
+
type Manifest = {
|
|
7
|
+
exports?: FieldValue;
|
|
8
|
+
typesVersions?: FieldValue;
|
|
9
|
+
};
|
|
10
|
+
declare const manifestOf: (repoRoot: string | null | undefined, folder: string) => Manifest | null;
|
|
11
|
+
declare const exportsPath: (manifest: Manifest | null, rest: string) => string | null;
|
|
12
|
+
declare const typesVersionPath: (manifest: Manifest | null, rest: string) => string | null;
|
|
13
|
+
declare const sourceOf: (folder: string, artifact: string, repoFiles: readonly string[]) => string | null;
|
|
14
|
+
declare const publicSources: (folder: string, manifest: Manifest | null, repoFiles: readonly string[]) => string[];
|
|
15
|
+
export { ENTRY_FILE, norm, isFile, folderOf, manifestOf, exportsPath, typesVersionPath, sourceOf, publicSources, type Manifest, };
|