@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,297 @@
|
|
|
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.namesCodeEntity = exports.slimmable = exports.needsUsage = exports.checkLive = exports.checkRecord = exports.extractFileFacts = void 0;
|
|
37
|
+
// A FILE'S FACTS AS A RECORD. `extractFileFacts` is the only producer: it reads
|
|
38
|
+
// one file through the AST and returns DATA — numbers, strings, `{rel,start,
|
|
39
|
+
// end,line}` positions — plus the file's dependency list. Nothing in the record
|
|
40
|
+
// points back at a ts-morph node, a SourceFile, a Project or a closure, so the
|
|
41
|
+
// record survives a JSON round-trip and a run can hold one file's facts without
|
|
42
|
+
// holding its syntax.
|
|
43
|
+
//
|
|
44
|
+
// `checkRecord` is the other half: the checks (entity homes, unclassified,
|
|
45
|
+
// tree, rules) run on the record, not on the AST. Everything that can be
|
|
46
|
+
// answered from the data is answered here; the two questions that need the
|
|
47
|
+
// PROJECT are named at the point they are asked:
|
|
48
|
+
// • `resolution` of a CSS template — it reads the expressions the template
|
|
49
|
+
// quoted, so the template's node is restored by position (`restoreResolution`);
|
|
50
|
+
// • the object literals a rule resolves against — materialised by position
|
|
51
|
+
// (`objectsFor`), never held in the record.
|
|
52
|
+
// `references` / `implementations` are the CHECKER's answers, and they are
|
|
53
|
+
// DATA — but they are also the only answers that are statements about EVERY
|
|
54
|
+
// file, so they cannot be asked where the project holds one chunk. The extraction
|
|
55
|
+
// leaves them null; a pass of its own opens one project over the whole repo, asks
|
|
56
|
+
// them once per published name and stores the answers in the index (`fa-usage`);
|
|
57
|
+
// the checks then read a number instead of opening a project.
|
|
58
|
+
const path = __importStar(require("node:path"));
|
|
59
|
+
const node_crypto_1 = require("node:crypto");
|
|
60
|
+
const pipeline_facts_1 = require("./pipeline-facts");
|
|
61
|
+
Object.defineProperty(exports, "needsUsage", { enumerable: true, get: function () { return pipeline_facts_1.needsUsage; } });
|
|
62
|
+
const usage_pass_1 = require("./usage-pass");
|
|
63
|
+
const usage_mode_1 = require("./usage-mode");
|
|
64
|
+
const classify_1 = require("./code-entities/classify");
|
|
65
|
+
const project_1 = require("./code-entities/project");
|
|
66
|
+
const tree_1 = require("./entities/tree");
|
|
67
|
+
const finally_1 = require("./nodes/finally");
|
|
68
|
+
const rules_1 = require("./rules");
|
|
69
|
+
const cli_report_1 = require("./report/cli-report");
|
|
70
|
+
const pipeline_entities_1 = require("./pipeline-entities");
|
|
71
|
+
const pipeline_unclassified_1 = require("./pipeline-unclassified");
|
|
72
|
+
const index_1 = require("./css/index");
|
|
73
|
+
const notices_1 = require("./report/notices");
|
|
74
|
+
const observed_1 = require("./report/observed");
|
|
75
|
+
const fa_values_1 = require("./fa-values");
|
|
76
|
+
// Does any filter name the project-wide `entity` scope (as a field or a
|
|
77
|
+
// `$entity.…` reference)? Only then is the project-wide classify pass worth
|
|
78
|
+
// running — a config that never asks for it pays nothing.
|
|
79
|
+
const filterNamesCodeEntity = (filter) => {
|
|
80
|
+
if (typeof filter === "string")
|
|
81
|
+
return filter.includes("$entity");
|
|
82
|
+
if (Array.isArray(filter))
|
|
83
|
+
return filter.some(filterNamesCodeEntity);
|
|
84
|
+
if (filter === null || typeof filter !== "object")
|
|
85
|
+
return false;
|
|
86
|
+
return Object.entries(filter).some(([key, value]) => key === "entity" || filterNamesCodeEntity(value));
|
|
87
|
+
};
|
|
88
|
+
const ruleNamesCodeEntity = (inv) => inv.when !== null && filterNamesCodeEntity(inv.when)
|
|
89
|
+
? true
|
|
90
|
+
: inv.infer.some(filterNamesCodeEntity) || inv.children.some(ruleNamesCodeEntity);
|
|
91
|
+
const namesCodeEntity = (invs) => invs.some(ruleNamesCodeEntity);
|
|
92
|
+
exports.namesCodeEntity = namesCodeEntity;
|
|
93
|
+
// The lazy `entity` scope: entity slug → the project-wide classified pieces.
|
|
94
|
+
// Defined as a getter so the whole-project scan runs only when a filter reads
|
|
95
|
+
// it, and memoised in the closure so it runs once per file.
|
|
96
|
+
const defineCodeEntity = (facts, build) => {
|
|
97
|
+
if (!facts)
|
|
98
|
+
return;
|
|
99
|
+
let cached = null;
|
|
100
|
+
Object.defineProperty(facts, "entity", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
configurable: true,
|
|
103
|
+
get: () => (cached ??= build()),
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
// The files this one depends on: every import that resolved INSIDE the repo.
|
|
107
|
+
// An import of a library package resolves to nothing, which is exactly right —
|
|
108
|
+
// a library cannot change between two runs of this repo.
|
|
109
|
+
// Every in-repo module this file reads FROM: what it imports, and what it
|
|
110
|
+
// re-exports. A barrel's `export { x } from "./x"` is a real read — a change
|
|
111
|
+
// behind it changes this file, and a file that starts to use the barrel changes
|
|
112
|
+
// the files behind it. Without the re-export edges a dependency chain stops at
|
|
113
|
+
// the barrel and a reverse walk cannot reach what the barrel hides.
|
|
114
|
+
const depsOf = (facts, repoFiles) => {
|
|
115
|
+
const known = new Set(repoFiles);
|
|
116
|
+
// Only a resolved repo path is a dependency: an export's `from` also carries a
|
|
117
|
+
// bare module name when resolution failed, and a name is not a file to watch.
|
|
118
|
+
const links = [...facts.imports.map((entry) => entry.resolved), ...facts.exports.map((entry) => entry.from)];
|
|
119
|
+
const inside = links.filter((link) => typeof link === "string" && known.has(link));
|
|
120
|
+
return [...new Set(inside)].sort();
|
|
121
|
+
};
|
|
122
|
+
const hashOf = (text) => (0, node_crypto_1.createHash)("sha256").update(text).digest("hex");
|
|
123
|
+
// One file → its record. The AST is read once (the same collection the checks
|
|
124
|
+
// used to do inline); the file's syntax is released by `checkFile` after the
|
|
125
|
+
// checks, so a run holds facts, not trees.
|
|
126
|
+
// A record is DATA: it may carry the file's facts, never a candidate's shortcut back
|
|
127
|
+
// to them. `checkRecord` puts `c.file` back from `record.facts` when the checks run.
|
|
128
|
+
const withoutFile = (candidates) => candidates.map((c) => {
|
|
129
|
+
const { file: _file, ...rest } = c;
|
|
130
|
+
return rest;
|
|
131
|
+
});
|
|
132
|
+
const extractFileFacts = (abs, run) => {
|
|
133
|
+
// A record is read FOR a file and outlives its syntax: a CSS template keeps the
|
|
134
|
+
// position it was found at, and the check restores what it needs by position.
|
|
135
|
+
const { arch, project, repoFiles } = run;
|
|
136
|
+
const capture = (0, notices_1.beginNotices)();
|
|
137
|
+
// In `usage: checker` the answers are NOT asked for here: the run's usage pass
|
|
138
|
+
// asks them, and `checkRecord` puts them back (`applyUsage`). In `usage: index`
|
|
139
|
+
// they come from the occurrence index, which needs no project — so they are
|
|
140
|
+
// asked right here, and the run needs no usage pass at all.
|
|
141
|
+
const { ctx, candidates, fileFacts, text } = (0, pipeline_facts_1.collectFacts)(abs, arch, project, repoFiles, (0, usage_mode_1.usageMode)() === "index", true, run.text);
|
|
142
|
+
return {
|
|
143
|
+
rel: ctx.rel,
|
|
144
|
+
hash: hashOf(text),
|
|
145
|
+
deps: depsOf(fileFacts, repoFiles),
|
|
146
|
+
notices: capture.end(),
|
|
147
|
+
facts: fileFacts,
|
|
148
|
+
candidates: withoutFile(candidates),
|
|
149
|
+
objects: [],
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
exports.extractFileFacts = extractFileFacts;
|
|
153
|
+
// The context a check layer needs, built from the record alone. `sf` is absent
|
|
154
|
+
// on purpose: a check that reached for the syntax would be a second reading of
|
|
155
|
+
// the file, not a reading of its facts.
|
|
156
|
+
const recordContext = (record, run) => {
|
|
157
|
+
const repoRoot = run.arch.repoRoot ?? ".";
|
|
158
|
+
const rel = record.rel;
|
|
159
|
+
return {
|
|
160
|
+
abs: path.resolve(repoRoot, rel),
|
|
161
|
+
rel,
|
|
162
|
+
dir: path.posix.dirname(rel),
|
|
163
|
+
basename: path.posix.basename(rel),
|
|
164
|
+
repoRoot,
|
|
165
|
+
aliases: run.arch.aliases ?? {},
|
|
166
|
+
arch: run.arch,
|
|
167
|
+
entities: [],
|
|
168
|
+
entityCtx: null,
|
|
169
|
+
facts: null,
|
|
170
|
+
repoFiles: run.repoFiles,
|
|
171
|
+
dedupe: run.dedupe,
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
// A record's css templates are data: the expressions they quoted are the
|
|
175
|
+
// template node's, found by the position the fact kept.
|
|
176
|
+
const restoreTemplates = (candidates, rel, project) => {
|
|
177
|
+
for (const candidate of candidates) {
|
|
178
|
+
for (const template of candidate.framework?.css?.templates ?? [])
|
|
179
|
+
(0, index_1.restoreResolution)(template, rel, project);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
// The checks themselves, in the order the pipeline runs them. Both entry points
|
|
183
|
+
// below end here: the record path hands over data, the live reference path hands
|
|
184
|
+
// over the context `collectFacts` built. A difference between the two is then a
|
|
185
|
+
// difference in the translation to data, never in the checks.
|
|
186
|
+
const runChecks = (ctx, withEntities, run) => {
|
|
187
|
+
const { arch, project, repoFiles, dedupe, present, live, parts } = run;
|
|
188
|
+
const { before, nodes, after } = parts;
|
|
189
|
+
// WHAT THE SCAN SEES: the judged relations are the graph's arrows, so this
|
|
190
|
+
// file's answer is recorded while the checks run and committed when they end.
|
|
191
|
+
(0, observed_1.beginObserved)(ctx.rel, ctx.repoRoot ?? "");
|
|
192
|
+
// The project-wide entity index serves two things, both lazy: the `entity`
|
|
193
|
+
// scope a filter can navigate, and the objects resolution resolves against.
|
|
194
|
+
if (namesCodeEntity(arch.rules))
|
|
195
|
+
defineCodeEntity(ctx.facts, () => (0, project_1.entityScope)((0, project_1.projectEntityIndex)(arch, repoFiles)));
|
|
196
|
+
// The literals themselves live in the record as positions; a rule that names
|
|
197
|
+
// an object entity is the one asking for the nodes, so only then is the
|
|
198
|
+
// project consulted. A record read back from the index carries the resolution
|
|
199
|
+
// it was written with — there is no project to re-resolve against, and a rule's
|
|
200
|
+
// resolution step must then leave the stored answer alone.
|
|
201
|
+
if (project) {
|
|
202
|
+
ctx.objectsFor = (slugs) => (0, project_1.objectsFor)((0, project_1.projectEntityIndex)(arch, repoFiles), slugs, arch);
|
|
203
|
+
// A record's css templates are data: the expressions they quoted are the
|
|
204
|
+
// template node's, found by the position the fact kept. The live path read
|
|
205
|
+
// the template from its node, so its resolution is already registered.
|
|
206
|
+
if (!live)
|
|
207
|
+
restoreTemplates(withEntities, ctx.rel, project);
|
|
208
|
+
}
|
|
209
|
+
// ENTITY HOMES: every candidate must fit its entity's declared home.
|
|
210
|
+
(0, pipeline_entities_1.checkEntityHomes)(withEntities, ctx, arch, before);
|
|
211
|
+
// UNCLASSIFIED: the pieces no entity describes, and the file nothing
|
|
212
|
+
// describes. The lookalike question is about folders other than this file's,
|
|
213
|
+
// so it needs a project that holds every scanned file.
|
|
214
|
+
if (project)
|
|
215
|
+
(0, pipeline_unclassified_1.checkUnclassified)(withEntities, { present, ctx, arch, project, repoFiles, out: nodes });
|
|
216
|
+
// STRUCTURE: the node tree, then the built-in structure rule (kind +
|
|
217
|
+
// declaration), then the rules.
|
|
218
|
+
(0, tree_1.checkTree)(ctx.rel, arch, after, cli_report_1.findingFrom, ctx.facts, ctx.repoFiles);
|
|
219
|
+
(0, finally_1.checkFinally)(ctx, arch, after, cli_report_1.findingFrom);
|
|
220
|
+
(0, rules_1.checkRules)(arch.rules, ctx, after, cli_report_1.findingFrom, dedupe);
|
|
221
|
+
// The rules are the only reader of a template's capability; the readings they
|
|
222
|
+
// materialised are written on the facts, so the closures (and the live source
|
|
223
|
+
// they hold) go now rather than at the end of the process.
|
|
224
|
+
(0, index_1.forgetResolutions)(withEntities);
|
|
225
|
+
(0, observed_1.endObserved)(ctx.rel);
|
|
226
|
+
};
|
|
227
|
+
// Classify the candidates and fill the context the checks read: the step both
|
|
228
|
+
// entry points share.
|
|
229
|
+
const classifyInto = (ctx, candidates, fileFacts, run) => {
|
|
230
|
+
const { arch, repoFiles } = run;
|
|
231
|
+
const { present, entityCtx, candidates: withEntities, } = (0, classify_1.classifyEntities)(candidates, arch.entities ?? {}, arch, fileFacts);
|
|
232
|
+
ctx.entities = present;
|
|
233
|
+
ctx.entityCtx = entityCtx;
|
|
234
|
+
fileFacts.entities = [...new Set(present)];
|
|
235
|
+
// File facts (candidates attached) — the rules' filter target.
|
|
236
|
+
ctx.facts = { ...fileFacts, candidates: withEntities, entities: [...new Set(present)], repoFiles: [...repoFiles] };
|
|
237
|
+
return { present, withEntities };
|
|
238
|
+
};
|
|
239
|
+
// The record's checks. `project` is passed only to the two questions that need
|
|
240
|
+
// it (CSS resolution, the object literals a rule resolves against) and to the
|
|
241
|
+
// lookalike scan, which asks about OTHER files; `null` answers the rule layer
|
|
242
|
+
// from the record alone.
|
|
243
|
+
const checkRecord = (record, run) => {
|
|
244
|
+
const { arch, project, repoFiles, dedupe } = run;
|
|
245
|
+
const ctx = recordContext(record, { arch, repoFiles, dedupe });
|
|
246
|
+
// `c.file` is the snapshot every candidate carries — one shared object, put
|
|
247
|
+
// back here so a record that went through JSON keeps the same answers.
|
|
248
|
+
for (const candidate of record.candidates)
|
|
249
|
+
candidate.file = record.facts;
|
|
250
|
+
// The checker's answers are data now: put them back before anything reads a
|
|
251
|
+
// candidate, so every layer below sees the facts a live run would. A caller that
|
|
252
|
+
// holds this file's syntax and has no stored answer (the one-file path) has them
|
|
253
|
+
// asked right here: that is cheap for one file, and the indexed run never does it.
|
|
254
|
+
const usage = run.usage ?? (run.sf ? (0, usage_pass_1.usageFor)(run.sf, record.candidates, arch.repoRoot ?? ".") : null);
|
|
255
|
+
(0, fa_values_1.applyUsage)(record.candidates, usage);
|
|
256
|
+
const { present, withEntities } = classifyInto(ctx, record.candidates, record.facts, { arch, repoFiles });
|
|
257
|
+
// The record keeps the CLASSIFIED pieces: they are what the project-wide index
|
|
258
|
+
// groups by entity, so a run that reads the record back needs no classify pass.
|
|
259
|
+
record.candidates = withEntities;
|
|
260
|
+
if (run.sf)
|
|
261
|
+
record.objects = (0, project_1.fileObjects)(run.sf, withEntities);
|
|
262
|
+
const parts = { before: [], nodes: [], after: [] };
|
|
263
|
+
const capture = (0, notices_1.beginNotices)();
|
|
264
|
+
runChecks(ctx, withEntities, { arch, project, repoFiles, dedupe, present, live: false, parts });
|
|
265
|
+
record.notices = [...(record.notices ?? []), ...capture.end()];
|
|
266
|
+
// The report is the same whether this file was read now or in an earlier run:
|
|
267
|
+
// its lines are repeated here, in the order the reading produced them — the
|
|
268
|
+
// usage pass, which ran after the extraction, last.
|
|
269
|
+
(0, notices_1.replayNotices)(record.notices);
|
|
270
|
+
(0, notices_1.replayNotices)(usage?.notices ?? []);
|
|
271
|
+
return parts;
|
|
272
|
+
};
|
|
273
|
+
exports.checkRecord = checkRecord;
|
|
274
|
+
// The REFERENCE path: the same checks on the context `collectFacts` built, with
|
|
275
|
+
// no record in between. It exists so a parity run can compare the two
|
|
276
|
+
// (`FA_CHECKS=live`); nothing else calls it.
|
|
277
|
+
const checkLive = (abs, run) => {
|
|
278
|
+
const { arch, project, repoFiles, dedupe } = run;
|
|
279
|
+
const { ctx, candidates, fileFacts } = (0, pipeline_facts_1.collectFacts)(abs, arch, project, repoFiles, (0, pipeline_facts_1.needsUsage)(arch), false);
|
|
280
|
+
for (const candidate of candidates)
|
|
281
|
+
candidate.file = fileFacts;
|
|
282
|
+
const { present, withEntities } = classifyInto(ctx, candidates, fileFacts, { arch, repoFiles });
|
|
283
|
+
const parts = { before: [], nodes: [], after: [] };
|
|
284
|
+
runChecks(ctx, withEntities, { arch, project, repoFiles, dedupe, present, live: true, parts });
|
|
285
|
+
return parts;
|
|
286
|
+
};
|
|
287
|
+
exports.checkLive = checkLive;
|
|
288
|
+
// The record as the index keeps it: data only. The one field a run must not write
|
|
289
|
+
// is the shared facts snapshot every candidate points at (it is re-attached on
|
|
290
|
+
// read), and the file's own copy of its candidates is the `candidates` list.
|
|
291
|
+
const slimmable = (record) => {
|
|
292
|
+
for (const candidate of record.candidates)
|
|
293
|
+
delete candidate.file;
|
|
294
|
+
record.facts.candidates = [];
|
|
295
|
+
return record;
|
|
296
|
+
};
|
|
297
|
+
exports.slimmable = slimmable;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
2
|
+
import { type FacetContext } from "@md-code/follow-architecture/frameworks/facet";
|
|
3
|
+
declare const id = "angular";
|
|
4
|
+
declare const enrich: (candidates: Candidate[]) => Candidate[];
|
|
5
|
+
declare const applies: ({ rel, text }: FacetContext) => boolean;
|
|
6
|
+
declare const classAttributes: string[];
|
|
7
|
+
export { id, applies, classAttributes, enrich };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enrich = exports.classAttributes = exports.applies = exports.id = void 0;
|
|
4
|
+
const facet_1 = require("@md-code/follow-architecture/frameworks/facet");
|
|
5
|
+
const id = "angular";
|
|
6
|
+
exports.id = id;
|
|
7
|
+
const enrich = (candidates) => {
|
|
8
|
+
for (const candidate of candidates) {
|
|
9
|
+
(0, facet_1.attach)(candidate, { id, component: false, props: [], forwarded: [] });
|
|
10
|
+
}
|
|
11
|
+
return candidates;
|
|
12
|
+
};
|
|
13
|
+
exports.enrich = enrich;
|
|
14
|
+
// A template writes the class list into `class`, like HTML does.
|
|
15
|
+
const applies = ({ rel, text }) => /\.component\.ts$/i.test(String(rel ?? "")) || /@Component\s*\(/.test(String(text ?? ""));
|
|
16
|
+
exports.applies = applies;
|
|
17
|
+
const classAttributes = ["class"];
|
|
18
|
+
exports.classAttributes = classAttributes;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SourceFile } from "ts-morph";
|
|
2
|
+
import type { Candidate, FrameworkFacts } from "@md-code/follow-architecture/entities/facts";
|
|
3
|
+
type FacetContext = {
|
|
4
|
+
rel?: string | null;
|
|
5
|
+
sf?: SourceFile;
|
|
6
|
+
text?: string | null;
|
|
7
|
+
repoRoot?: string | null;
|
|
8
|
+
importMap?: ReadonlyMap<string, string>;
|
|
9
|
+
};
|
|
10
|
+
interface FrameworkFacet {
|
|
11
|
+
id: string;
|
|
12
|
+
applies: (ctx: FacetContext) => boolean;
|
|
13
|
+
enrich: (candidates: Candidate[], ctx: FacetContext) => Candidate[];
|
|
14
|
+
classAttributes?: string[];
|
|
15
|
+
}
|
|
16
|
+
declare const attach: (candidate: Candidate, facts: FrameworkFacts) => FrameworkFacts;
|
|
17
|
+
export { attach };
|
|
18
|
+
export type { FacetContext, FrameworkFacet };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attach = void 0;
|
|
4
|
+
// Writing the namespace: MERGE, never replace. `framework` is one home with a
|
|
5
|
+
// branch per reader, and several readers may read the same file — react's
|
|
6
|
+
// components, the test reader's runner, the style facet's templates. A reader that
|
|
7
|
+
// assigned the whole object would erase what another had already found (that is
|
|
8
|
+
// how a `.tsx` test would lose its component reading), so every writer goes
|
|
9
|
+
// through here and names only the fields it read.
|
|
10
|
+
const attach = (candidate, facts) => {
|
|
11
|
+
const merged = { ...(candidate.framework ?? {}), ...facts };
|
|
12
|
+
candidate.framework = merged;
|
|
13
|
+
return merged;
|
|
14
|
+
};
|
|
15
|
+
exports.attach = attach;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
2
|
+
import type { FacetContext, FrameworkFacet } from "./facet";
|
|
3
|
+
declare const REGISTRY: Record<string, () => FrameworkFacet>;
|
|
4
|
+
declare const facets: () => FrameworkFacet[];
|
|
5
|
+
declare const enrich: (candidates: Candidate[], ctx: FacetContext) => Candidate[];
|
|
6
|
+
declare const classAttributes: () => Set<string>;
|
|
7
|
+
declare const resetFacets: () => void;
|
|
8
|
+
export { enrich, facets, classAttributes, resetFacets, REGISTRY };
|
|
9
|
+
export type { FacetContext, FrameworkFacet };
|
|
@@ -0,0 +1,134 @@
|
|
|
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.REGISTRY = exports.resetFacets = exports.classAttributes = exports.facets = exports.enrich = void 0;
|
|
37
|
+
// Framework registry — a READING of the AST, never a change to it.
|
|
38
|
+
//
|
|
39
|
+
// The engine knows TypeScript; it does not know React, Vue or Angular. A facet is
|
|
40
|
+
// a separate module that attaches its own namespace to the candidates it
|
|
41
|
+
// understands (`framework.jsx`, `framework.forwarded`, …), so the rules read it
|
|
42
|
+
// exactly like any other fact and the core stays framework-free. This is the same
|
|
43
|
+
// shape the sibling tools use (`entities-uniqueness/frameworks`): a module per
|
|
44
|
+
// framework, `applies` as the cheap gate, enrichment as the only side effect.
|
|
45
|
+
//
|
|
46
|
+
// Facets never edit core facts. A facet that throws is isolated and reported — a
|
|
47
|
+
// broken reader must not take the analysis of a file down with it.
|
|
48
|
+
const notices_1 = require("@md-code/follow-architecture/report/notices");
|
|
49
|
+
const reason_1 = require("@md-code/follow-architecture/utils/reason");
|
|
50
|
+
const react = __importStar(require("./react"));
|
|
51
|
+
const vue = __importStar(require("./vue"));
|
|
52
|
+
const angular = __importStar(require("./angular"));
|
|
53
|
+
const test = __importStar(require("./test"));
|
|
54
|
+
// The built-in facets, by id. Adding a framework is a module plus an entry here —
|
|
55
|
+
// the engine never changes. `test` is a reader like the others: it reads the same
|
|
56
|
+
// file for a different question, and the order is what makes `id` deterministic
|
|
57
|
+
// (a component reading wins over the test reading on the same candidate).
|
|
58
|
+
const REGISTRY = {
|
|
59
|
+
react: () => react,
|
|
60
|
+
vue: () => vue,
|
|
61
|
+
angular: () => angular,
|
|
62
|
+
test: () => test,
|
|
63
|
+
};
|
|
64
|
+
exports.REGISTRY = REGISTRY;
|
|
65
|
+
let cache = null;
|
|
66
|
+
const warned = new Set();
|
|
67
|
+
const isFacet = (facet) => Boolean(facet.id) && typeof facet.applies === "function" && typeof facet.enrich === "function";
|
|
68
|
+
const facets = () => {
|
|
69
|
+
if (cache)
|
|
70
|
+
return cache;
|
|
71
|
+
cache = [];
|
|
72
|
+
for (const [id, load] of Object.entries(REGISTRY)) {
|
|
73
|
+
try {
|
|
74
|
+
const facet = load();
|
|
75
|
+
if (isFacet(facet))
|
|
76
|
+
cache.push(facet);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const e = error;
|
|
80
|
+
(0, notices_1.notice)(`framework \`${id}\` could not be loaded`, (0, reason_1.reasonOf)(e));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return cache;
|
|
84
|
+
};
|
|
85
|
+
exports.facets = facets;
|
|
86
|
+
// `ctx` is the run context a facet may ask about: the file, its path, its text.
|
|
87
|
+
// Enrichment happens once per file, before classification, so a code entity can be
|
|
88
|
+
// defined on a framework fact just like on `kind`.
|
|
89
|
+
const enrich = (candidates, ctx) => {
|
|
90
|
+
for (const facet of facets()) {
|
|
91
|
+
let applies = false;
|
|
92
|
+
try {
|
|
93
|
+
applies = facet.applies(ctx);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
applies = false;
|
|
97
|
+
}
|
|
98
|
+
if (!applies)
|
|
99
|
+
continue;
|
|
100
|
+
try {
|
|
101
|
+
facet.enrich(candidates, ctx);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const key = `${facet.id}:${ctx.rel}`;
|
|
105
|
+
if (warned.has(key))
|
|
106
|
+
continue;
|
|
107
|
+
warned.add(key);
|
|
108
|
+
const e = error;
|
|
109
|
+
(0, notices_1.notice)(`${facet.id} facts are incomplete for ${ctx.rel}`, (0, reason_1.reasonOf)(e));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return candidates;
|
|
113
|
+
};
|
|
114
|
+
exports.enrich = enrich;
|
|
115
|
+
// THE ATTRIBUTE A CLASS LIST IS WRITTEN INTO. The vocabulary belongs to the
|
|
116
|
+
// facet that knows the framework (`className` is React's word, `class` is the
|
|
117
|
+
// template word); this is only the union, so the css facet can read a class list
|
|
118
|
+
// without ever spelling a framework's attribute name itself.
|
|
119
|
+
const classAttributes = () => {
|
|
120
|
+
const names = new Set();
|
|
121
|
+
for (const facet of facets()) {
|
|
122
|
+
for (const name of facet.classAttributes ?? [])
|
|
123
|
+
names.add(String(name));
|
|
124
|
+
}
|
|
125
|
+
return names;
|
|
126
|
+
};
|
|
127
|
+
exports.classAttributes = classAttributes;
|
|
128
|
+
// Test hook: the registry is memoised, and a test that stubs a facet needs a
|
|
129
|
+
// clean read.
|
|
130
|
+
const resetFacets = () => {
|
|
131
|
+
cache = null;
|
|
132
|
+
warned.clear();
|
|
133
|
+
};
|
|
134
|
+
exports.resetFacets = resetFacets;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
2
|
+
import { type FacetContext } from "@md-code/follow-architecture/frameworks/facet";
|
|
3
|
+
declare const id = "react";
|
|
4
|
+
declare const enrich: (candidates: Candidate[], ctx: FacetContext) => Candidate[];
|
|
5
|
+
declare const applies: ({ rel, sf }: FacetContext) => boolean;
|
|
6
|
+
declare const classAttributes: string[];
|
|
7
|
+
export { id, applies, classAttributes, enrich };
|