@md-code/follow-architecture 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +1310 -472
- package/dist/args.d.ts +4 -0
- package/dist/args.js +18 -1
- package/dist/bin/follow-architecture.js +3 -3
- 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-roles/roles.js → code-entities/entities.js} +98 -61
- 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 +23 -0
- package/dist/config-options.js +18 -1
- package/dist/config-project.js +27 -9
- package/dist/config-report.d.ts +1 -1
- package/dist/config-report.js +37 -10
- package/dist/config-rule.d.ts +25 -0
- package/dist/config-rule.js +106 -13
- package/dist/config-state.d.ts +14 -3
- package/dist/config-state.js +197 -24
- package/dist/config.d.ts +25 -0
- package/dist/css/index.d.ts +11 -7
- package/dist/css/index.js +141 -30
- package/dist/css/syntax/css/gate.js +5 -5
- package/dist/css/syntax/css/index.d.ts +1 -1
- package/dist/css/syntax/css/index.js +18 -8
- package/dist/css/syntax/css/reference.d.ts +1 -1
- package/dist/css/syntax/css/reference.js +15 -3
- package/dist/css/syntax/language.d.ts +1 -1
- package/dist/css/syntax/language.js +21 -9
- package/dist/css/syntax/scss/index.d.ts +2 -2
- package/dist/css/syntax/scss/index.js +18 -8
- package/dist/css/syntax/scss/reference.d.ts +1 -1
- package/dist/css/syntax/scss/reference.js +7 -1
- package/dist/css/syntax/styled/document.d.ts +3 -3
- package/dist/css/syntax/styled/document.js +34 -14
- package/dist/css/syntax/styled/markup.d.ts +1 -1
- package/dist/css/syntax/styled/markup.js +22 -14
- 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.js +10 -4
- package/dist/css/syntax/tailwind/tailwind.js +4 -4
- package/dist/css/value/check.d.ts +1 -1
- package/dist/css/value/check.js +1 -1
- package/dist/css/value/expression/arithmetic.d.ts +2 -2
- package/dist/css/value/expression/arithmetic.js +7 -3
- package/dist/css/value/expression/block.d.ts +2 -2
- package/dist/css/value/expression/block.js +4 -3
- package/dist/css/value/expression/conditional.d.ts +2 -2
- package/dist/css/value/expression/conditional.js +1 -1
- package/dist/css/value/expression/index.d.ts +2 -2
- package/dist/css/value/expression/index.js +10 -6
- package/dist/css/value/expression/map.d.ts +2 -2
- package/dist/css/value/expression/map.js +2 -2
- package/dist/css/value/object/index.d.ts +2 -2
- package/dist/css/value/object/index.js +14 -4
- package/dist/css/value/object/members.d.ts +2 -2
- package/dist/css/value/object/node.js +9 -4
- package/dist/css/value/object/path.d.ts +3 -3
- package/dist/css/value/object/path.js +10 -4
- package/dist/css/value/pieces.d.ts +3 -3
- package/dist/css/value/pieces.js +14 -4
- package/dist/css/value/resolve.js +15 -5
- package/dist/css/value/scope.d.ts +3 -2
- package/dist/css/value/scope.js +25 -7
- package/dist/css/value/substitute.js +43 -11
- package/dist/entities/architecture.d.ts +28 -25
- package/dist/entities/ast/assignments-raw.d.ts +1 -1
- package/dist/entities/ast/assignments-raw.js +61 -8
- package/dist/entities/ast/assignments-tagged.d.ts +1 -1
- package/dist/entities/ast/assignments-tagged.js +22 -7
- package/dist/entities/ast/assignments.d.ts +1 -1
- package/dist/entities/ast/assignments.js +6 -4
- package/dist/entities/ast/branches.d.ts +1 -1
- package/dist/entities/ast/calls.d.ts +1 -1
- package/dist/entities/ast/calls.js +19 -3
- package/dist/entities/ast/classes.d.ts +1 -1
- package/dist/entities/ast/classes.js +5 -1
- package/dist/entities/ast/comments.d.ts +3 -2
- package/dist/entities/ast/comments.js +47 -17
- package/dist/entities/ast/declaration.d.ts +1 -1
- package/dist/entities/ast/depth.d.ts +2 -2
- package/dist/entities/ast/depth.js +32 -15
- package/dist/entities/ast/enums.d.ts +1 -1
- 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 +1 -1
- package/dist/entities/ast/file-exports.js +26 -3
- package/dist/entities/ast/file-facts.d.ts +6 -3
- package/dist/entities/ast/file-facts.js +33 -4
- package/dist/entities/ast/file-imports.d.ts +1 -1
- package/dist/entities/ast/file-imports.js +26 -3
- package/dist/entities/ast/file.d.ts +2 -2
- package/dist/entities/ast/file.js +2 -1
- package/dist/entities/ast/functions.d.ts +1 -1
- package/dist/entities/ast/functions.js +13 -4
- package/dist/entities/ast/heritage.d.ts +1 -1
- package/dist/entities/ast/heritage.js +9 -1
- package/dist/entities/ast/index.d.ts +6 -3
- package/dist/entities/ast/index.js +82 -26
- package/dist/entities/ast/kind.d.ts +1 -1
- package/dist/entities/ast/kind.js +7 -1
- package/dist/entities/ast/modifiers.d.ts +1 -1
- package/dist/entities/ast/modifiers.js +4 -4
- package/dist/entities/ast/project.js +33 -2
- package/dist/entities/ast/properties.d.ts +1 -1
- package/dist/entities/ast/properties.js +10 -5
- package/dist/entities/ast/resolve.d.ts +1 -1
- package/dist/entities/ast/resolve.js +21 -11
- package/dist/entities/ast/tree.d.ts +4 -2
- package/dist/entities/ast/tree.js +184 -17
- package/dist/entities/ast/types.d.ts +1 -1
- package/dist/entities/ast/types.js +2 -1
- package/dist/entities/ast/usage.d.ts +1 -1
- package/dist/entities/ast/usage.js +1 -1
- package/dist/entities/ast/variables.d.ts +1 -1
- package/dist/entities/context.d.ts +4 -4
- package/dist/entities/facts.d.ts +36 -13
- package/dist/entities/findings.d.ts +3 -3
- package/dist/entities/kinds.d.ts +1 -1
- package/dist/entities/kinds.js +148 -37
- package/dist/entities/location/homes.d.ts +10 -10
- package/dist/entities/location/homes.js +74 -48
- package/dist/entities/location/place.d.ts +1 -1
- package/dist/entities/location/place.js +10 -3
- package/dist/entities/location/where.d.ts +10 -8
- package/dist/entities/location/where.js +89 -30
- package/dist/entities/location.d.ts +3 -3
- package/dist/entities/location.js +17 -17
- package/dist/entities/operators.js +1 -1
- package/dist/entities/overview/data.d.ts +6 -6
- package/dist/entities/overview/decision.d.ts +11 -11
- package/dist/entities/overview/finding.d.ts +10 -10
- package/dist/entities/overview/graph.d.ts +28 -11
- package/dist/entities/overview/input.d.ts +2 -2
- package/dist/entities/overview/summaries.d.ts +17 -15
- package/dist/entities/queries.d.ts +1 -1
- package/dist/entities/queries.js +89 -19
- package/dist/entities/repair.d.ts +1 -1
- package/dist/entities/repair.js +8 -2
- package/dist/entities/schema.d.ts +17 -3
- package/dist/entities/schema.js +74 -16
- package/dist/entities/story.d.ts +5 -5
- package/dist/entities/structure-facts.d.ts +1 -1
- package/dist/entities/token.d.ts +4 -4
- package/dist/entities/tree/build.d.ts +4 -3
- package/dist/entities/tree/build.js +112 -51
- package/dist/entities/tree/entries.d.ts +4 -4
- package/dist/entities/tree/entries.js +41 -16
- package/dist/entities/tree/index.d.ts +2 -2
- package/dist/entities/tree/index.js +1 -1
- package/dist/entities/tree/match.d.ts +2 -2
- package/dist/entities/tree/match.js +26 -12
- 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 +2 -2
- package/dist/frameworks/angular/index.js +2 -1
- package/dist/frameworks/facet.d.ts +3 -1
- package/dist/frameworks/facet.js +13 -0
- package/dist/frameworks/index.d.ts +1 -1
- package/dist/frameworks/index.js +25 -11
- package/dist/frameworks/react/index.d.ts +2 -2
- package/dist/frameworks/react/index.js +33 -10
- package/dist/frameworks/test/index.d.ts +6 -0
- package/dist/frameworks/test/index.js +157 -0
- package/dist/frameworks/vue/index.d.ts +2 -2
- package/dist/frameworks/vue/index.js +2 -1
- 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 +5 -2
- package/dist/main.js +223 -41
- package/dist/nodes/child-entities.d.ts +3 -0
- package/dist/nodes/child-entities.js +12 -0
- package/dist/nodes/children.d.ts +4 -4
- package/dist/nodes/children.js +64 -11
- package/dist/nodes/finally/emit.d.ts +4 -4
- package/dist/nodes/finally/emit.js +26 -10
- package/dist/nodes/finally/entities.d.ts +13 -0
- package/dist/nodes/finally/entities.js +42 -0
- package/dist/nodes/finally/index.d.ts +6 -6
- package/dist/nodes/finally/index.js +8 -8
- package/dist/nodes/finally/queries.d.ts +2 -2
- package/dist/nodes/finally/queries.js +7 -4
- package/dist/nodes/finally/relations-access.d.ts +2 -2
- package/dist/nodes/finally/relations-access.js +22 -18
- package/dist/nodes/finally/relations-edge.d.ts +5 -5
- package/dist/nodes/finally/relations-edge.js +67 -44
- package/dist/nodes/finally/relations-group.d.ts +7 -7
- package/dist/nodes/finally/relations-group.js +28 -25
- package/dist/nodes/finally/relations.d.ts +2 -2
- package/dist/nodes/finally/relations.js +16 -12
- package/dist/nodes/finally/required.d.ts +3 -3
- package/dist/nodes/finally/required.js +9 -7
- package/dist/nodes/finally/violation.d.ts +2 -2
- package/dist/nodes/similar.d.ts +3 -3
- package/dist/nodes/similar.js +78 -56
- package/dist/piece-forms.d.ts +9 -0
- package/dist/piece-forms.js +68 -0
- package/dist/{pipeline-roles.d.ts → pipeline-entities.d.ts} +2 -2
- package/dist/{pipeline-roles.js → pipeline-entities.js} +32 -28
- package/dist/pipeline-facts.d.ts +4 -3
- package/dist/pipeline-facts.js +64 -62
- package/dist/{pipeline-unroled.d.ts → pipeline-unclassified.d.ts} +2 -2
- package/dist/{pipeline-unroled.js → pipeline-unclassified.js} +58 -63
- package/dist/pipeline.d.ts +1 -1
- package/dist/pipeline.js +19 -64
- package/dist/release-file.d.ts +3 -0
- package/dist/release-file.js +13 -0
- package/dist/report/asks.d.ts +3 -3
- package/dist/report/asks.js +16 -6
- package/dist/report/configErrors.d.ts +55 -27
- package/dist/report/configErrors.js +81 -35
- package/dist/report/errorTypes/codes/structure.d.ts +1 -1
- package/dist/report/errorTypes/codes/structure.js +9 -9
- package/dist/report/errorTypes/decision-maker.d.ts +5 -5
- package/dist/report/errorTypes/decision-maker.js +21 -11
- package/dist/report/errorTypes/destinations.d.ts +5 -5
- package/dist/report/errorTypes/destinations.js +52 -34
- package/dist/report/errorTypes/finding-type.d.ts +3 -3
- package/dist/report/errorTypes/index.d.ts +1 -1
- package/dist/report/errorTypes/index.js +17 -7
- package/dist/report/errorTypes/types/fileContents.d.ts +4 -4
- package/dist/report/errorTypes/types/fileContents.js +11 -5
- package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
- package/dist/report/errorTypes/types/{unknownRole.js → unknownEntity.js} +12 -7
- package/dist/report/errorTypes/types/wrongAction.d.ts +5 -5
- package/dist/report/errorTypes/types/wrongAction.js +18 -13
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +4 -4
- package/dist/report/errorTypes/types/wrongPlacement.js +19 -9
- package/dist/report/errorTypes/vocabulary/ids.d.ts +2 -2
- package/dist/report/errorTypes/vocabulary/ids.js +3 -3
- package/dist/report/errorTypes/vocabulary/phrases.d.ts +2 -2
- package/dist/report/errorTypes/vocabulary/phrases.js +39 -26
- package/dist/report/errorTypes/vocabulary/places.d.ts +3 -3
- package/dist/report/errorTypes/vocabulary/places.js +13 -13
- package/dist/report/finding-from.d.ts +3 -3
- package/dist/report/finding-from.js +14 -9
- package/dist/report/notices.d.ts +6 -1
- package/dist/report/notices.js +46 -20
- package/dist/report/observed.d.ts +19 -0
- package/dist/report/observed.js +87 -0
- package/dist/report/render-report.d.ts +1 -1
- package/dist/report/render-report.js +33 -30
- package/dist/report/user-report/build/bundle.js +26 -7
- package/dist/report/user-report/build/bundle.prebuilt.js +799 -297
- package/dist/report/user-report/data/collect.d.ts +2 -2
- package/dist/report/user-report/data/collect.js +32 -19
- package/dist/report/user-report/data/entities.d.ts +7 -0
- package/dist/report/user-report/data/{roles.js → entities.js} +27 -22
- package/dist/report/user-report/data/{role-examples.d.ts → entity-examples.d.ts} +3 -3
- package/dist/report/user-report/data/entity-examples.js +136 -0
- package/dist/report/user-report/data/{role-filters.d.ts → entity-filters.d.ts} +2 -2
- package/dist/report/user-report/data/{role-filters.js → entity-filters.js} +7 -7
- package/dist/report/user-report/data/entity-marks.d.ts +5 -0
- package/dist/report/user-report/data/{role-marks.js → entity-marks.js} +11 -11
- package/dist/report/user-report/data/file-tree.d.ts +3 -3
- package/dist/report/user-report/data/file-tree.js +13 -5
- package/dist/report/user-report/data/finding-boundary.d.ts +4 -4
- package/dist/report/user-report/data/finding-boundary.js +2 -2
- package/dist/report/user-report/data/finding-plan.d.ts +5 -5
- package/dist/report/user-report/data/finding-plan.js +10 -10
- package/dist/report/user-report/data/finding-title.d.ts +2 -2
- package/dist/report/user-report/data/finding-title.js +8 -8
- package/dist/report/user-report/data/findings.d.ts +4 -4
- package/dist/report/user-report/data/findings.js +30 -20
- package/dist/report/user-report/data/graph-edges.d.ts +4 -4
- package/dist/report/user-report/data/graph-edges.js +19 -19
- 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 +5 -5
- package/dist/report/user-report/data/graph-helpers.js +15 -15
- package/dist/report/user-report/data/graph.d.ts +5 -4
- package/dist/report/user-report/data/graph.js +28 -21
- package/dist/report/user-report/data/nodes.d.ts +2 -2
- package/dist/report/user-report/data/nodes.js +33 -23
- package/dist/report/user-report/data/rules.d.ts +7 -0
- package/dist/report/user-report/data/{invariants.js → rules.js} +13 -13
- package/dist/report/user-report/data/scan.d.ts +1 -1
- package/dist/report/user-report/data/scan.js +19 -9
- package/dist/report/user-report/html/shell.d.ts +1 -1
- package/dist/report/user-report/html/shell.js +1 -1
- package/dist/report/user-report/index.d.ts +1 -1
- package/dist/report/user-report/index.js +17 -7
- package/dist/report/user-report/shared/describe.d.ts +1 -1
- package/dist/report/user-report/shared/describe.js +6 -6
- package/dist/rules/index.d.ts +7 -0
- package/dist/{invariants → rules}/index.js +85 -57
- package/dist/{invariants → rules}/list-vars.d.ts +2 -2
- package/dist/{invariants → rules}/list-vars.js +9 -3
- package/dist/{invariants → rules}/name.js +2 -2
- package/dist/rules/normalize.d.ts +5 -0
- package/dist/rules/normalize.js +108 -0
- package/dist/{invariants → rules}/vars.d.ts +9 -7
- package/dist/{invariants → rules}/vars.js +5 -5
- package/dist/scan-run.d.ts +20 -0
- package/dist/scan-run.js +130 -0
- package/dist/scripts/audit-report.js +19 -9
- 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/aliases.d.ts +22 -0
- package/dist/utils/aliases.js +173 -0
- package/dist/utils/classify.d.ts +2 -2
- package/dist/utils/classify.js +4 -4
- package/dist/utils/configs.js +17 -7
- package/dist/utils/distinct.js +4 -2
- package/dist/utils/files.js +41 -37
- package/dist/utils/fixpoint.js +2 -2
- package/dist/utils/host.d.ts +1 -1
- package/dist/utils/host.js +4 -1
- package/dist/utils/imports.js +83 -19
- package/dist/utils/keyed.js +2 -2
- package/dist/utils/map-record.js +2 -2
- package/dist/utils/packages.d.ts +15 -0
- package/dist/utils/packages.js +207 -0
- package/dist/utils/path-label.js +3 -1
- package/dist/utils/pattern.d.ts +5 -4
- package/dist/utils/pattern.js +55 -15
- package/dist/utils/permission.d.ts +3 -3
- package/dist/utils/permission.js +4 -2
- package/dist/utils/plural.js +2 -2
- package/dist/utils/qualified.js +4 -4
- package/dist/utils/rank.js +2 -2
- package/dist/utils/record.js +1 -1
- package/dist/utils/search.js +7 -2
- package/dist/utils/speak.js +1 -1
- package/dist/utils/split.js +14 -1
- package/dist/utils/template.d.ts +1 -1
- package/dist/utils/template.js +1 -1
- package/dist/utils/tokenize.js +6 -1
- package/dist/utils/typed-field.js +2 -2
- package/dist/utils/verdicts.js +1 -1
- package/entities/operators.ts +1 -1
- package/package.json +101 -90
- package/report/errorTypes/vocabulary/ids.ts +7 -2
- package/report/errorTypes/vocabulary/phrases.ts +47 -27
- package/report/errorTypes/vocabulary/places.ts +21 -16
- package/report/user-report/shared/describe.ts +7 -7
- package/dist/code-roles/classify.d.ts +0 -11
- package/dist/code-roles/classify.js +0 -43
- package/dist/code-roles/connector.d.ts +0 -5
- package/dist/code-roles/connector.js +0 -114
- package/dist/code-roles/project.d.ts +0 -12
- package/dist/code-roles/project.js +0 -122
- package/dist/code-roles/roles.d.ts +0 -8
- package/dist/invariants/index.d.ts +0 -6
- package/dist/invariants/normalize.d.ts +0 -4
- package/dist/invariants/normalize.js +0 -95
- package/dist/nodes/child-roles.d.ts +0 -3
- package/dist/nodes/child-roles.js +0 -12
- package/dist/nodes/finally/roles.d.ts +0 -13
- package/dist/nodes/finally/roles.js +0 -41
- package/dist/report/errorTypes/types/unknownRole.d.ts +0 -9
- package/dist/report/user-report/data/graph-roles.d.ts +0 -5
- package/dist/report/user-report/data/graph-roles.js +0 -71
- package/dist/report/user-report/data/invariants.d.ts +0 -7
- package/dist/report/user-report/data/role-examples.js +0 -94
- package/dist/report/user-report/data/role-marks.d.ts +0 -5
- package/dist/report/user-report/data/roles.d.ts +0 -7
- /package/dist/{invariants → rules}/name.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.checkUnclassified = void 0;
|
|
4
4
|
const tree_1 = require("./entities/tree");
|
|
5
5
|
const location_1 = require("./entities/location");
|
|
6
6
|
const similar_1 = require("./nodes/similar");
|
|
@@ -9,32 +9,37 @@ const asks_1 = require("./report/asks");
|
|
|
9
9
|
const cli_report_1 = require("./report/cli-report");
|
|
10
10
|
const speak_1 = require("./utils/speak");
|
|
11
11
|
const field_1 = require("./utils/field");
|
|
12
|
-
const
|
|
12
|
+
const child_entities_1 = require("./nodes/child-entities");
|
|
13
|
+
const piece_forms_1 = require("./piece-forms");
|
|
13
14
|
// The child whose PATTERN this file matches — `store.ts` literally,
|
|
14
15
|
// `{kebab-case}.ts` by the convention it is written in. One rule, the same one
|
|
15
16
|
// the tree uses.
|
|
16
17
|
const ownChildOf = (kids, basename) => kids.find((k) => !k.folder && k.re.test(basename)) ?? null;
|
|
17
|
-
// The
|
|
18
|
+
// The entities this place declares: the child whose pattern the file matches,
|
|
18
19
|
// else — for a file NODE (`apps/backend/{kebab-case}/controller.ts` is a node
|
|
19
|
-
// of its own) — the node's own
|
|
20
|
-
// its own
|
|
21
|
-
// `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
// of its own) — the node's own entities. Nothing lists a file node as a child, so
|
|
21
|
+
// its own entities are what applies here. The child's entities are the shared
|
|
22
|
+
// `entitiesOfChild` reading.
|
|
23
|
+
// The place holds its own KINDS when it is a file NODE (nothing lists a file
|
|
24
|
+
// node as a child) or when it names no children at all — a node with `entity:`
|
|
25
|
+
// and no `children:` closes kinds, not file names. Both are the same reading the
|
|
26
|
+
// tree's `reportUndeclared` uses; the node's own list is what applies.
|
|
27
|
+
const declaredByNode = (match) => (match?.node?.variants ?? []).some((v) => v.isFile) || (match?.node?.children ?? []).length === 0;
|
|
28
|
+
const declaredEntitiesOf = (match, own, arch) => {
|
|
29
|
+
const childEntities = (0, child_entities_1.entitiesOfChild)(arch, own);
|
|
30
|
+
if (childEntities.length)
|
|
31
|
+
return childEntities;
|
|
32
|
+
return declaredByNode(match) ? (match?.node?.entities ?? []) : [];
|
|
28
33
|
};
|
|
29
34
|
const declarationOf = (ctx, arch) => {
|
|
30
35
|
const match = (0, tree_1.deepestMatch)(ctx.rel, arch);
|
|
31
36
|
const owner = match?.node?.slug ?? null;
|
|
32
37
|
const kids = owner ? (arch.nodes.bySlug[owner]?.children ?? []) : [];
|
|
33
38
|
const own = ownChildOf(kids, ctx.basename ?? "");
|
|
34
|
-
return { owner, declaredHere:
|
|
39
|
+
return { owner, declaredHere: declaredEntitiesOf(match, own, arch) };
|
|
35
40
|
};
|
|
36
|
-
// The
|
|
37
|
-
const listOf = (
|
|
41
|
+
// The entities a place declares, in the reader's words.
|
|
42
|
+
const listOf = (entities) => entities.map((r) => `\`${r}\``).join(" / ");
|
|
38
43
|
// The piece's own words for what it IS: a local alias, a wrapper, a write, the
|
|
39
44
|
// declaration's text — each fact answers before the generic fallback.
|
|
40
45
|
const aliasShape = (c) => {
|
|
@@ -71,11 +76,11 @@ const shapeOf = (c) => {
|
|
|
71
76
|
return specific;
|
|
72
77
|
return (c.kind?.own?.is ?? "") === "VariableDeclaration" ? "a plain variable" : "a plain function";
|
|
73
78
|
};
|
|
74
|
-
// The reason a piece has no
|
|
79
|
+
// The reason a piece has no entity: what the place declares (and what the piece
|
|
75
80
|
// is), or that nothing declares this file, or that it is outside the tree.
|
|
76
|
-
const
|
|
81
|
+
const whyUnclassified = (ctx, decl, piece, offered) => {
|
|
77
82
|
const shape = shapeOf(piece);
|
|
78
|
-
const what2 = shape ? `this is ${shape} — not code
|
|
83
|
+
const what2 = shape ? `this is ${shape} — not code an entity describes` : "this is something else";
|
|
79
84
|
if (decl.declaredHere.length)
|
|
80
85
|
return `only ${listOf(decl.declaredHere)} is declared here, and ${what2}.${offered}`;
|
|
81
86
|
if (decl.owner)
|
|
@@ -84,83 +89,64 @@ const whyUnroled = (ctx, decl, piece, offered) => {
|
|
|
84
89
|
};
|
|
85
90
|
// What the folder looks like, in the reader's words: the entities it resembles
|
|
86
91
|
// and how much of each it holds.
|
|
87
|
-
const lookalikeText = (like) =>
|
|
92
|
+
const lookalikeText = (like) => like.length ? ` It looks like ${like.map((n) => `\`${n.path ?? n.slug}\` (${n.hit}/${n.total})`).join(" or ")}.` : "";
|
|
88
93
|
// "Nothing describes this code" — one of the four demands in report/asks, so
|
|
89
94
|
// the sentence and the repair read the same here as anywhere else. Moving is
|
|
90
95
|
// offered only where the folder really resembles something — the destination
|
|
91
96
|
// is the entity's own words, and there may be several.
|
|
92
|
-
const
|
|
93
|
-
const demand = asks_1.asks.
|
|
97
|
+
const noEntity = (what, piece, view) => {
|
|
98
|
+
const demand = asks_1.asks.entity({
|
|
99
|
+
what: `\`${what}\``,
|
|
100
|
+
why: whyUnclassified(view.ctx, view.decl, piece, lookalikeText(view.like)),
|
|
101
|
+
});
|
|
94
102
|
if (!view.like.length)
|
|
95
103
|
return demand;
|
|
96
104
|
demand.fix = `Move \`${what}\` into ${view.like.map((n) => `\`${n.path ?? n.slug}\``).join(" or ")} — this folder already has ${view.like[0].hit} of the ${view.like[0].total} things that entity declares.`;
|
|
97
105
|
return demand;
|
|
98
106
|
};
|
|
99
|
-
// A PIECE is a candidate that can carry a role. Every candidate the AST layer
|
|
100
|
-
// collects is one, except two structural cases: a variable declared INSIDE a
|
|
101
|
-
// function (the function answers for it) and an anonymous function handed
|
|
102
|
-
// straight to a call — that is the call's ARGUMENT (`.map(x => …)`), not code
|
|
103
|
-
// with a life of its own. A `const` is a piece only at MODULE scope.
|
|
104
|
-
const isPiece = (c) => {
|
|
105
|
-
if ((c.kind?.own?.is ?? null) === "VariableDeclaration")
|
|
106
|
-
return !c.location?.nested;
|
|
107
|
-
return c.name != null || c.kind?.parent?.is !== "CallExpression";
|
|
108
|
-
};
|
|
109
107
|
// The edges the file's facts produce — every relation, once.
|
|
110
108
|
const edgesOf = (facts) => Object.values(kinds_1.EDGE_FACTS).flatMap((produce) => produce(facts));
|
|
111
|
-
// The pieces that touch something: a piece that touches nothing needs no
|
|
109
|
+
// The pieces that touch something: a piece that touches nothing needs no entity
|
|
112
110
|
// — "nothing is allowed from it" is not a statement about code that does not
|
|
113
111
|
// reach anything. Silence for those is not permission — it is the absence of a
|
|
114
112
|
// question.
|
|
115
113
|
const piecesWithEdges = (edges) => new Set(edges.map((e) => e.piece).filter((p) => Boolean(p)));
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const governedByValues = (c) => VALUE_INITIALIZERS.has(c.kind?.initializer?.is ?? "");
|
|
123
|
-
// Is this candidate an unroled PIECE that touches something? One piece may be
|
|
124
|
-
// described by two candidates — a `const` holding an arrow is the same code
|
|
125
|
-
// seen twice; when one of them got a role, the piece is described. A piece
|
|
126
|
-
// carrying css TEMPLATES, or whose whole value is DATA, is governed by the
|
|
127
|
-
// css-fact invariants, not by a role.
|
|
128
|
-
const isRoled = (c, roledLines) => Boolean(c.role) || roledLines.has(c.lines?.[0] ?? 1);
|
|
129
|
-
const governedByValuesOrCss = (c) => Boolean(c.css?.templates?.length) || governedByValues(c);
|
|
130
|
-
const unroledPiece = (c, roledLines, touching) => !isRoled(c, roledLines) && isPiece(c) && Boolean(c.name) && touching.has(c.name ?? "") && !governedByValuesOrCss(c);
|
|
131
|
-
// One unroled piece's finding, once per piece.
|
|
132
|
-
const unroledFindings = (withRoles, scene, out) => {
|
|
133
|
-
const roledLines = new Set(withRoles.filter((x) => x.role).map((x) => x.lines?.[0] ?? 1));
|
|
114
|
+
// One unclassified piece's finding, once per piece.
|
|
115
|
+
const unclassifiedFindings = (withEntities, scene, out) => {
|
|
116
|
+
const described = {
|
|
117
|
+
lines: new Set(withEntities.filter((x) => x.entity).map((x) => x.lines?.[0] ?? 1)),
|
|
118
|
+
names: new Set(withEntities.filter((x) => x.entity && x.name).map((x) => x.name ?? "")),
|
|
119
|
+
};
|
|
134
120
|
const touching = piecesWithEdges(scene.edges);
|
|
135
121
|
const seenPieces = new Set();
|
|
136
|
-
const pieces =
|
|
122
|
+
const pieces = withEntities.filter((c) => (0, piece_forms_1.unclassifiedPiece)(c, described, touching));
|
|
137
123
|
for (const c of pieces) {
|
|
138
124
|
const what = c.name ?? `the anonymous function at line ${c.lines?.[0] ?? 1}`;
|
|
139
125
|
if (!(0, speak_1.speakOnce)(seenPieces, what))
|
|
140
126
|
continue;
|
|
141
|
-
out.push((0, cli_report_1.findingFrom)({ ...
|
|
127
|
+
out.push((0, cli_report_1.findingFrom)({ ...noEntity(what, c, scene), line: c.lines?.[0] ?? 1 }, "nodes", scene.decl.owner ?? scene.ctx.rel, `unclassified:${scene.decl.owner ?? "tree"}:${what}`, { path: scene.ctx.rel, what }));
|
|
142
128
|
}
|
|
143
129
|
return seenPieces.size;
|
|
144
130
|
};
|
|
145
|
-
// A file NOTHING describes: no
|
|
131
|
+
// A file NOTHING describes: no entity present and no piece to say it about (a
|
|
146
132
|
// file of re-exports, a file of imports). Said once, for the file — and only
|
|
147
133
|
// when the file actually does something. A BARREL (every export re-exports
|
|
148
|
-
// another module) holds no code of its own, so it is not a thing to
|
|
149
|
-
// re-exports are governed by `no-re-exports`'s place list, not by
|
|
134
|
+
// another module) holds no code of its own, so it is not a thing to entity: its
|
|
135
|
+
// re-exports are governed by `no-re-exports`'s place list, not by an entity.
|
|
150
136
|
const reexportOnly = (scene) => {
|
|
151
137
|
const exports = scene.ctx.facts?.exports ?? [];
|
|
152
138
|
return exports.length > 0 && exports.every((entry) => Boolean(entry.from));
|
|
153
139
|
};
|
|
154
140
|
// A file whose every piece is DATA or a style fragment holds no behaviour to
|
|
155
|
-
//
|
|
156
|
-
const isValuePiece = (c) => governedByValues(c) || Boolean(c.
|
|
141
|
+
// entity: its values are judged by the css-fact rules.
|
|
142
|
+
const isValuePiece = (c) => (0, piece_forms_1.governedByValues)(c) || Boolean(c.entity) || Boolean(c.framework?.css?.templates?.length);
|
|
157
143
|
const onlyValuePieces = (candidates) => candidates.length > 0 && candidates.every(isValuePiece);
|
|
158
144
|
const fileFinding = (scene, out) => {
|
|
159
145
|
if (!scene.edges.some((e) => e.path !== scene.ctx.rel))
|
|
160
146
|
return;
|
|
161
147
|
if (reexportOnly(scene) || onlyValuePieces(scene.ctx.facts?.candidates ?? []))
|
|
162
148
|
return;
|
|
163
|
-
out.push((0, cli_report_1.findingFrom)({ ...
|
|
149
|
+
out.push((0, cli_report_1.findingFrom)({ ...noEntity(scene.ctx.rel, null, scene) }, "nodes", scene.decl.owner ?? scene.ctx.rel, `unclassified:${scene.decl.owner ?? "tree"}:file`, { path: scene.ctx.rel, what: scene.ctx.rel }));
|
|
164
150
|
};
|
|
165
151
|
// The scan view the lookalike question needs: the project, the repo anchor,
|
|
166
152
|
// the aliases, the file list, and the run's similarity cache.
|
|
@@ -175,10 +161,19 @@ const similarScanOf = (ctx, arch, project, repoFiles) => ({
|
|
|
175
161
|
// The pipeline fills `ctx.facts` before this phase runs; the fallback keeps
|
|
176
162
|
// the producers total for a context that carries none.
|
|
177
163
|
const factsOf = (ctx, repoFiles) => {
|
|
178
|
-
const empty = {
|
|
164
|
+
const empty = {
|
|
165
|
+
lines: [],
|
|
166
|
+
imports: [],
|
|
167
|
+
exports: [],
|
|
168
|
+
location: (0, location_1.placeOf)(ctx.rel),
|
|
169
|
+
reads: [],
|
|
170
|
+
kind: { own: { is: "SourceFile" }, descendants: [] },
|
|
171
|
+
candidates: [],
|
|
172
|
+
entities: [],
|
|
173
|
+
};
|
|
179
174
|
return { ...(ctx.facts ?? empty), repoFiles };
|
|
180
175
|
};
|
|
181
|
-
const
|
|
176
|
+
const checkUnclassified = (withEntities, run) => {
|
|
182
177
|
const { present, ctx, arch, project, repoFiles, out } = run;
|
|
183
178
|
const decl = declarationOf(ctx, arch);
|
|
184
179
|
// What this folder LOOKS LIKE, if anything: every declared entity whose shape
|
|
@@ -186,8 +181,8 @@ const checkUnroled = (withRoles, run) => {
|
|
|
186
181
|
// place — a folder may be 80% a feature and 66% a type home, and both are offered.
|
|
187
182
|
const like = (0, similar_1.similarNodes)(arch, (0, location_1.dirOf)(ctx.rel), similarScanOf(ctx, arch, project, repoFiles));
|
|
188
183
|
const edges = edgesOf(factsOf(ctx, repoFiles));
|
|
189
|
-
const
|
|
190
|
-
if (!present.length && !
|
|
184
|
+
const unclassified = unclassifiedFindings(withEntities, { ctx, decl, like, edges }, out);
|
|
185
|
+
if (!present.length && !unclassified)
|
|
191
186
|
fileFinding({ ctx, decl, like, edges }, out);
|
|
192
187
|
};
|
|
193
|
-
exports.
|
|
188
|
+
exports.checkUnclassified = checkUnclassified;
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { createTsProject } from "./entities/ast";
|
|
|
3
3
|
import type { Arch } from "./entities/architecture";
|
|
4
4
|
import type { Finding } from "./entities/findings";
|
|
5
5
|
import type { SeenStore } from "./utils/seen";
|
|
6
|
-
declare const checkFile: (abs: string, arch: Arch, project: Project, repoFiles: string[], dedupe: SeenStore) => Finding[];
|
|
6
|
+
declare const checkFile: (...args: [abs: string, arch: Arch, project: Project, repoFiles: string[], dedupe: SeenStore]) => Finding[];
|
|
7
7
|
export { checkFile, createTsProject };
|
package/dist/pipeline.js
CHANGED
|
@@ -3,71 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createTsProject = exports.checkFile = void 0;
|
|
4
4
|
const ast_1 = require("./entities/ast");
|
|
5
5
|
Object.defineProperty(exports, "createTsProject", { enumerable: true, get: function () { return ast_1.createTsProject; } });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const tree_1 = require("./entities/tree");
|
|
9
|
-
const finally_1 = require("./nodes/finally");
|
|
10
|
-
const invariants_1 = require("./invariants");
|
|
11
|
-
const cli_report_1 = require("./report/cli-report");
|
|
12
|
-
const pipeline_facts_1 = require("./pipeline-facts");
|
|
13
|
-
const pipeline_roles_1 = require("./pipeline-roles");
|
|
14
|
-
const pipeline_unroled_1 = require("./pipeline-unroled");
|
|
15
|
-
// Does any filter name the project-wide `codeRole` scope (as a field or a
|
|
16
|
-
// `$codeRole.…` reference)? Only then is the project-wide classify pass worth
|
|
17
|
-
// running — a config that never asks for it pays nothing.
|
|
18
|
-
const filterNamesCodeRole = (filter) => {
|
|
19
|
-
if (typeof filter === "string")
|
|
20
|
-
return filter.includes("$codeRole");
|
|
21
|
-
if (Array.isArray(filter))
|
|
22
|
-
return filter.some(filterNamesCodeRole);
|
|
23
|
-
if (filter === null || typeof filter !== "object")
|
|
24
|
-
return false;
|
|
25
|
-
return Object.entries(filter).some(([key, value]) => key === "codeRole" || filterNamesCodeRole(value));
|
|
26
|
-
};
|
|
27
|
-
const invariantNamesCodeRole = (inv) => inv.when !== null && filterNamesCodeRole(inv.when) ? true : inv.infer.some(filterNamesCodeRole) || inv.children.some(invariantNamesCodeRole);
|
|
28
|
-
const namesCodeRole = (invs) => invs.some(invariantNamesCodeRole);
|
|
29
|
-
// The lazy `codeRole` scope: role slug → the project-wide classified pieces.
|
|
30
|
-
// Defined as a getter so the whole-project scan runs only when a filter reads
|
|
31
|
-
// it, and memoised in the closure so it runs once per file.
|
|
32
|
-
const defineCodeRole = (facts, build) => {
|
|
33
|
-
let cached = null;
|
|
34
|
-
Object.defineProperty(facts, "codeRole", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
get: () => (cached ??= build()),
|
|
38
|
-
});
|
|
39
|
-
};
|
|
6
|
+
const facts_record_1 = require("./facts-record");
|
|
7
|
+
const release_file_1 = require("./release-file");
|
|
40
8
|
const checkFile = (...args) => {
|
|
41
9
|
const [abs, arch, project, repoFiles, dedupe] = args;
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
defineCodeRole(ctx.facts, () => (0, project_1.codeRoleScope)((0, project_1.projectRoleIndex)(project, arch, repoFiles)));
|
|
60
|
-
ctx.objectsFor = (slugs) => (0, project_1.objectsFor)((0, project_1.projectRoleIndex)(project, arch, repoFiles), slugs);
|
|
61
|
-
const out = [];
|
|
62
|
-
// 3. ROLE HOMES: every candidate must fit its role's declared home.
|
|
63
|
-
(0, pipeline_roles_1.checkRoleHomes)(withRoles, ctx, arch, out);
|
|
64
|
-
// 4. UNROLED: the pieces no role describes, and the file nothing describes.
|
|
65
|
-
(0, pipeline_unroled_1.checkUnroled)(withRoles, { present, ctx, arch, project, repoFiles, out });
|
|
66
|
-
// 5. STRUCTURE: the node tree, then the built-in structure rule (kind +
|
|
67
|
-
// declaration), then the invariants.
|
|
68
|
-
(0, tree_1.checkTree)(ctx.rel, arch, out, cli_report_1.findingFrom, ctx.facts, ctx.repoFiles);
|
|
69
|
-
(0, finally_1.checkFinally)(ctx, arch, out, cli_report_1.findingFrom);
|
|
70
|
-
(0, invariants_1.checkInvariants)(arch.invariants, ctx, out, cli_report_1.findingFrom, dedupe);
|
|
71
|
-
return out;
|
|
10
|
+
// `FA_CHECKS=live` runs the checks on the facts as they were collected, with no
|
|
11
|
+
// record in between — the reference a parity run compares the record path to.
|
|
12
|
+
const sf = project.getSourceFile(abs);
|
|
13
|
+
let parts;
|
|
14
|
+
if (process.env.FA_CHECKS === "live") {
|
|
15
|
+
parts = (0, facts_record_1.checkLive)(abs, { arch, project, repoFiles, dedupe });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
// The checker's answers are asked by the record path itself, on this file's
|
|
19
|
+
// syntax: a plain run has no index to store them in and no pass to ask them in.
|
|
20
|
+
parts = (0, facts_record_1.checkRecord)((0, facts_record_1.extractFileFacts)(abs, { arch, project, repoFiles }), { arch, project, repoFiles, dedupe, sf });
|
|
21
|
+
}
|
|
22
|
+
// The file is measured and its findings are plain data: the syntax memoised for
|
|
23
|
+
// it is given back here, so a run holds one file's tree instead of every file's.
|
|
24
|
+
if (sf)
|
|
25
|
+
(0, release_file_1.releaseFile)(sf);
|
|
26
|
+
return [...parts.before, ...parts.nodes, ...parts.after];
|
|
72
27
|
};
|
|
73
28
|
exports.checkFile = checkFile;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.releaseFile = void 0;
|
|
4
|
+
const ast_1 = require("./entities/ast");
|
|
5
|
+
const scope_1 = require("./css/value/scope");
|
|
6
|
+
// Forget everything the run remembers about one file's syntax. The compiler AST
|
|
7
|
+
// is untouched (ts-morph recreates wrappers on demand), so a caller may still
|
|
8
|
+
// ask the file for text — only the memoised walk products are gone.
|
|
9
|
+
const releaseFile = (sf) => {
|
|
10
|
+
(0, ast_1.releaseFile)(sf);
|
|
11
|
+
(0, scope_1.releaseSourceScope)(sf);
|
|
12
|
+
};
|
|
13
|
+
exports.releaseFile = releaseFile;
|
package/dist/report/asks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StatedRepair } from "
|
|
2
|
-
import type { ReportObject } from "
|
|
1
|
+
import type { StatedRepair } from "@md-code/follow-architecture/entities/repair";
|
|
2
|
+
import type { ReportObject } from "@md-code/follow-architecture/entities/architecture";
|
|
3
3
|
declare const q: (text: string) => string;
|
|
4
4
|
declare const names: (list: readonly string[]) => string;
|
|
5
5
|
declare const repair: (spec: {
|
|
@@ -33,7 +33,7 @@ declare const __exported_asks: {
|
|
|
33
33
|
message: string;
|
|
34
34
|
fix: string;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
entity: (args: {
|
|
37
37
|
what: string;
|
|
38
38
|
why: string;
|
|
39
39
|
}) => {
|
package/dist/report/asks.js
CHANGED
|
@@ -9,14 +9,24 @@ exports.names = names;
|
|
|
9
9
|
// The repair — the ONE shape a finding offers (`entities/repair`). A sentence
|
|
10
10
|
// alone is not a repair: it cannot be drawn. Every producer builds ONE of these,
|
|
11
11
|
// and the text is the last field of it — never the other way round.
|
|
12
|
-
const repair = (spec, place = {}) => spec.fix
|
|
12
|
+
const repair = (spec, place = {}) => spec.fix
|
|
13
|
+
? {
|
|
14
|
+
code: spec.code ?? spec.ask ?? "rules",
|
|
15
|
+
to: place.to ?? [],
|
|
16
|
+
from: place.from ?? null,
|
|
17
|
+
path: place.path ?? null,
|
|
18
|
+
text: spec.fix,
|
|
19
|
+
}
|
|
20
|
+
: null;
|
|
13
21
|
exports.repair = repair;
|
|
14
22
|
const moveMessage = (what, to, why, plural) => {
|
|
15
23
|
const belongs = plural ? "belong" : "belongs";
|
|
16
24
|
const where = to ? `in ${to}` : "somewhere else";
|
|
17
25
|
return `${what} ${belongs} ${where}.${why ? ` ${why}` : ""}`;
|
|
18
26
|
};
|
|
19
|
-
const moveFix = (what, to, name) => to
|
|
27
|
+
const moveFix = (what, to, name) => to
|
|
28
|
+
? `Move ${name ?? what} to ${to}.`
|
|
29
|
+
: `Delete ${name ?? what}: this architecture holds no place for that kind of code, so there is nowhere to move it to.`;
|
|
20
30
|
const moveBoxes = (to, node) => (to && node ? [node] : []);
|
|
21
31
|
const move = (args) => {
|
|
22
32
|
const { what, to = null, why = null, plural = false, name = null, node = null, path: place = null } = args;
|
|
@@ -34,10 +44,10 @@ const remove = (args) => ({
|
|
|
34
44
|
message: `${args.what}${args.what_is ? ` ${args.what_is}` : ""}, but ${args.why}.`,
|
|
35
45
|
fix: `Delete it.`,
|
|
36
46
|
});
|
|
37
|
-
const
|
|
38
|
-
ask: "
|
|
47
|
+
const entity = (args) => ({
|
|
48
|
+
ask: "entity",
|
|
39
49
|
to: [],
|
|
40
|
-
message: `${args.what} has no
|
|
50
|
+
message: `${args.what} has no entity: ${args.why}`,
|
|
41
51
|
fix: `Delete ${args.what}, or move it to a place whose code the architecture describes.`,
|
|
42
52
|
});
|
|
43
53
|
const add = (args) => ({
|
|
@@ -46,5 +56,5 @@ const add = (args) => ({
|
|
|
46
56
|
message: `${args.what} is missing: ${args.why}`,
|
|
47
57
|
fix: `Create ${args.what}.`,
|
|
48
58
|
});
|
|
49
|
-
const __exported_asks = { move, remove,
|
|
59
|
+
const __exported_asks = { move, remove, entity, add };
|
|
50
60
|
exports.asks = __exported_asks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldValue } from "
|
|
1
|
+
import type { FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
2
|
type ConfigError = Error & {
|
|
3
3
|
isConfigError: boolean;
|
|
4
4
|
};
|
|
@@ -9,38 +9,48 @@ declare const unparseable: ({ reason }: {
|
|
|
9
9
|
reason: string;
|
|
10
10
|
}) => ConfigError;
|
|
11
11
|
declare const notAnObject: () => ConfigError;
|
|
12
|
+
declare const unknownTopKey: ({ key }: {
|
|
13
|
+
key: string;
|
|
14
|
+
}) => ConfigError;
|
|
15
|
+
declare const legacyRoleKey: () => ConfigError;
|
|
16
|
+
declare const legacyFilterKey: () => ConfigError;
|
|
17
|
+
declare const legacyReference: ({ ref }: {
|
|
18
|
+
ref: string;
|
|
19
|
+
}) => ConfigError;
|
|
20
|
+
declare const limitNotPositiveInteger: ({ key, value }: {
|
|
21
|
+
key: string;
|
|
22
|
+
value: FieldValue;
|
|
23
|
+
}) => ConfigError;
|
|
12
24
|
declare const withoutNodes: () => ConfigError;
|
|
13
|
-
declare const
|
|
14
|
-
declare const
|
|
15
|
-
declare const
|
|
16
|
-
declare const
|
|
17
|
-
declare const
|
|
18
|
-
|
|
25
|
+
declare const duplicateRuleIds: (ids: readonly string[]) => ConfigError;
|
|
26
|
+
declare const nodeEntityUnknown: (entity: string) => ConfigError;
|
|
27
|
+
declare const entityNotAnObject: () => ConfigError;
|
|
28
|
+
declare const entityWithoutSlug: () => ConfigError;
|
|
29
|
+
declare const entityInfersUnknown: ({ entity, entry }: {
|
|
30
|
+
entity: FieldValue;
|
|
19
31
|
entry: string;
|
|
20
32
|
}) => ConfigError;
|
|
21
|
-
declare const
|
|
22
|
-
|
|
33
|
+
declare const entityInfersItself: ({ entity }: {
|
|
34
|
+
entity: FieldValue;
|
|
23
35
|
}) => ConfigError;
|
|
24
|
-
declare const
|
|
25
|
-
|
|
36
|
+
declare const unknownEntityKey: ({ entity, key }: {
|
|
37
|
+
entity: FieldValue;
|
|
26
38
|
key: string;
|
|
27
|
-
allowed: readonly string[];
|
|
28
39
|
}) => ConfigError;
|
|
29
|
-
declare const
|
|
30
|
-
|
|
40
|
+
declare const entityWhereNotAllowed: ({ entity }: {
|
|
41
|
+
entity: FieldValue;
|
|
31
42
|
}) => ConfigError;
|
|
32
|
-
declare const actionNotAnObject: ({
|
|
33
|
-
|
|
43
|
+
declare const actionNotAnObject: ({ entity, action }: {
|
|
44
|
+
entity: FieldValue;
|
|
34
45
|
action: string;
|
|
35
46
|
}) => ConfigError;
|
|
36
|
-
declare const actionWithoutWhere: ({
|
|
37
|
-
|
|
47
|
+
declare const actionWithoutWhere: ({ entity, action }: {
|
|
48
|
+
entity: FieldValue;
|
|
38
49
|
action: string;
|
|
39
50
|
}) => ConfigError;
|
|
40
|
-
declare const unknownActionKey: ({ name, key
|
|
51
|
+
declare const unknownActionKey: ({ name, key }: {
|
|
41
52
|
name: string;
|
|
42
53
|
key: string;
|
|
43
|
-
allowed: readonly string[];
|
|
44
54
|
}) => ConfigError;
|
|
45
55
|
declare const unknownActionFact: ({ value, known }: {
|
|
46
56
|
value: FieldValue;
|
|
@@ -53,10 +63,16 @@ declare const scopeNotOneOf: ({ got, allowed }: {
|
|
|
53
63
|
declare const emptyAccessorSegments: ({ scope }: {
|
|
54
64
|
scope: string;
|
|
55
65
|
}) => ConfigError;
|
|
56
|
-
declare const
|
|
66
|
+
declare const accessorTypeUnqualified: ({ got }: {
|
|
67
|
+
got: string;
|
|
68
|
+
}) => ConfigError;
|
|
69
|
+
declare const unknownNodeKey: ({ node, key }: {
|
|
70
|
+
node: string;
|
|
71
|
+
key: string;
|
|
72
|
+
}) => ConfigError;
|
|
73
|
+
declare const unknownChildKey: ({ node, key }: {
|
|
57
74
|
node: string;
|
|
58
75
|
key: string;
|
|
59
|
-
allowed: readonly string[];
|
|
60
76
|
}) => ConfigError;
|
|
61
77
|
declare const unknownNodeParent: ({ node, parent }: {
|
|
62
78
|
node: string;
|
|
@@ -66,12 +82,23 @@ declare const unknownNodeChild: ({ node, child }: {
|
|
|
66
82
|
node: string;
|
|
67
83
|
child: string;
|
|
68
84
|
}) => ConfigError;
|
|
69
|
-
declare const
|
|
70
|
-
|
|
71
|
-
|
|
85
|
+
declare const unknownAlias: ({ specifier, known }: {
|
|
86
|
+
specifier: string;
|
|
87
|
+
known: readonly string[];
|
|
88
|
+
}) => ConfigError;
|
|
89
|
+
declare const aliasOutsideNode: ({ node, child, place }: {
|
|
90
|
+
node: string;
|
|
91
|
+
child: string;
|
|
92
|
+
place: string;
|
|
93
|
+
}) => ConfigError;
|
|
94
|
+
declare const unknownWhereKey: ({ key }: {
|
|
95
|
+
key: string;
|
|
96
|
+
}) => ConfigError;
|
|
97
|
+
declare const ruleNotAnObject: () => ConfigError;
|
|
98
|
+
declare const ruleWithoutId: () => ConfigError;
|
|
99
|
+
declare const unknownRuleKey: ({ id, key }: {
|
|
72
100
|
id: FieldValue;
|
|
73
101
|
key: string;
|
|
74
|
-
allowed: readonly string[];
|
|
75
102
|
}) => ConfigError;
|
|
76
103
|
declare const dedupeByNotAPlace: ({ value }: {
|
|
77
104
|
value: string;
|
|
@@ -95,4 +122,5 @@ declare const invalidPattern: ({ where, pattern, reason }: {
|
|
|
95
122
|
pattern: string;
|
|
96
123
|
reason: string;
|
|
97
124
|
}) => ConfigError;
|
|
98
|
-
export { unreadable, unparseable, notAnObject, withoutNodes,
|
|
125
|
+
export { unreadable, unparseable, notAnObject, unknownTopKey, legacyRoleKey, legacyFilterKey, legacyReference, withoutNodes, duplicateRuleIds, nodeEntityUnknown, entityNotAnObject, entityWithoutSlug, entityInfersUnknown, entityInfersItself, unknownEntityKey, entityWhereNotAllowed, actionNotAnObject, actionWithoutWhere, unknownActionKey, unknownActionFact, scopeNotOneOf, emptyAccessorSegments, accessorTypeUnqualified, unknownNodeKey, unknownChildKey, unknownNodeParent, unknownNodeChild, unknownAlias, aliasOutsideNode, unknownWhereKey, ruleNotAnObject, ruleWithoutId, unknownRuleKey, dedupeByNotAPlace, relationWithoutProducer, undeclaredRelation, styleLanguageIncomplete, limitNotPositiveInteger, unknownOperator, unknownListOperator, atWithoutIndex, invalidPattern, };
|
|
126
|
+
export type { ConfigError };
|