@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,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kindFact = exports.descendantsOf = exports.descendantFact = exports.descriptor = exports.depthOf = exports.isMutable = exports.isExported = exports.rangeLines = exports.linesOf = exports.selfOf = exports.startLine = exports.isMeaningful = exports.memberFacts = exports.typeText = exports.unwrapParens = exports.inThisPiece = exports.isClassNode = exports.isCallNode = exports.isFunctionNode = exports.nodeText = exports.nameOfNode = exports.isImportDecl = exports.kindName = exports.SK = void 0;
|
|
3
|
+
exports.kindFact = exports.descendantsOf = exports.descendantFact = exports.descriptor = exports.depthOf = exports.isMutable = exports.isExported = exports.rangeLines = exports.linesOf = exports.selfOf = exports.startLine = exports.isMeaningful = exports.memberFacts = exports.typeText = exports.unwrapParens = exports.inThisPiece = exports.isClassNode = exports.isCallNode = exports.isFunctionNode = exports.nodeText = exports.nameOfNode = exports.isImportDecl = exports.releaseTree = exports.fileDescendants = exports.kindName = exports.SK = void 0;
|
|
4
4
|
// The syntax tree: what a node IS, what it is called, and where it sits.
|
|
5
|
-
// Everything here is a question about ONE node — never about a project,
|
|
5
|
+
// Everything here is a question about ONE node — never about a project, an entity
|
|
6
6
|
// or a folder. Names come from ts-morph itself (`getKindName`), so the engine
|
|
7
7
|
// speaks exactly the vocabulary of the parser.
|
|
8
8
|
const ts_morph_1 = require("ts-morph");
|
|
9
9
|
Object.defineProperty(exports, "SK", { enumerable: true, get: function () { return ts_morph_1.SyntaxKind; } });
|
|
10
|
-
const notices_1 = require("
|
|
10
|
+
const notices_1 = require("@md-code/follow-architecture/report/notices");
|
|
11
11
|
// Declarations that ARE an import: the parser's own names for the three forms.
|
|
12
12
|
// One list, because three passes ask the same question (`file.js` twice,
|
|
13
13
|
// `assignments.js` once) and an import is recognised the same way in all of them.
|
|
14
14
|
const IMPORT_DECL_KINDS = new Set(["ImportSpecifier", "ImportClause", "NamespaceImport"]);
|
|
15
15
|
const isImportDecl = (decl) => IMPORT_DECL_KINDS.has(decl?.getKindName?.());
|
|
16
16
|
exports.isImportDecl = isImportDecl;
|
|
17
|
-
// Function-like nodes — the candidates for any function-shaped
|
|
17
|
+
// Function-like nodes — the candidates for any function-shaped entity.
|
|
18
18
|
const FUNCTION_KINDS = new Set([
|
|
19
19
|
ts_morph_1.SyntaxKind.FunctionDeclaration,
|
|
20
20
|
ts_morph_1.SyntaxKind.FunctionExpression,
|
|
@@ -30,10 +30,117 @@ const CALL_KINDS = new Set([ts_morph_1.SyntaxKind.CallExpression, ts_morph_1.Syn
|
|
|
30
30
|
// The name of a node's kind, as the parser spells it ("FunctionDeclaration").
|
|
31
31
|
const kindName = (node) => node.getKindName();
|
|
32
32
|
exports.kindName = kindName;
|
|
33
|
+
// A parsed file's descendants, computed ONCE per SourceFile and shared by every
|
|
34
|
+
// per-file walk in a run (candidate collection, comment spans, docs). A re-parsed
|
|
35
|
+
// file can REUSE the same SourceFile wrapper with new text (ts-morph overwrites in
|
|
36
|
+
// place), so the cache is guarded by the file's current text — a changed file is a
|
|
37
|
+
// new list. `getFullText()` returns the compiler's own text string, so the guard
|
|
38
|
+
// compares references, not bytes. `getDescendants()` is the dominant cost of a
|
|
39
|
+
// scan, so walking the file once instead of once per consumer is what makes the
|
|
40
|
+
// whole-repo run tractable.
|
|
41
|
+
const FILE_DESCENDANTS = new WeakMap();
|
|
42
|
+
const fileDescendants = (sf) => {
|
|
43
|
+
const text = sf.getFullText();
|
|
44
|
+
const cached = FILE_DESCENDANTS.get(sf);
|
|
45
|
+
if (cached && cached.text === text)
|
|
46
|
+
return cached.list;
|
|
47
|
+
const list = sf.getDescendants();
|
|
48
|
+
FILE_DESCENDANTS.set(sf, { text, list });
|
|
49
|
+
return list;
|
|
50
|
+
};
|
|
51
|
+
exports.fileDescendants = fileDescendants;
|
|
52
|
+
// Give back everything this module remembers about ONE file, and hand back the
|
|
53
|
+
// nodes it remembered it for.
|
|
54
|
+
//
|
|
55
|
+
// The descendant list is the only STRONG reference to a file's node wrappers:
|
|
56
|
+
// while it lives, every wrapper stays reachable, and so does every value a
|
|
57
|
+
// node-keyed memo hangs off it (line, text, depth, and through them the
|
|
58
|
+
// candidate facts built for that file). A run that is done with a file's syntax
|
|
59
|
+
// — the project-wide index, once the file's facts are extracted — calls this, so
|
|
60
|
+
// a whole-repo pass holds one file's wrappers, not every file's. The compiler
|
|
61
|
+
// AST itself is untouched: re-reading the file re-creates wrappers on demand.
|
|
62
|
+
const releaseTree = (sf) => {
|
|
63
|
+
const cached = FILE_DESCENDANTS.get(sf);
|
|
64
|
+
FILE_DESCENDANTS.delete(sf);
|
|
65
|
+
FILE_MEMOS.delete(sf);
|
|
66
|
+
LINE_STARTS.delete(sf);
|
|
67
|
+
return cached?.list ?? [];
|
|
68
|
+
};
|
|
69
|
+
exports.releaseTree = releaseTree;
|
|
70
|
+
// The memos belong to the TEXT they were computed from, exactly like the line
|
|
71
|
+
// table below: a SourceFile wrapper is reused when the file is overwritten in
|
|
72
|
+
// place, and a memo answered for the previous text would be a stale number in a
|
|
73
|
+
// long-lived process (the ESLint server). The text is compared by reference with
|
|
74
|
+
// `getFullText()`, which returns the same string for an unchanged file.
|
|
75
|
+
const FILE_MEMOS = new WeakMap();
|
|
76
|
+
const memosOf = (node) => {
|
|
77
|
+
const sf = node.getSourceFile();
|
|
78
|
+
const text = sf.getFullText();
|
|
79
|
+
const known = FILE_MEMOS.get(sf);
|
|
80
|
+
if (known && known.text === text)
|
|
81
|
+
return known.memos;
|
|
82
|
+
const created = {
|
|
83
|
+
startLine: new Map(),
|
|
84
|
+
endLine: new Map(),
|
|
85
|
+
type: new Map(),
|
|
86
|
+
depth: new Map(),
|
|
87
|
+
};
|
|
88
|
+
FILE_MEMOS.set(sf, { text, memos: created });
|
|
89
|
+
return created;
|
|
90
|
+
};
|
|
91
|
+
// Where each line of a file begins, built ONCE per file. The parser's own
|
|
92
|
+
// position lookup (`getLineAndColumnAtPos`) walks the text from the start of the
|
|
93
|
+
// file for every question, twice — once for the line and once for the column —
|
|
94
|
+
// and a whole-repo pass asks it a million times. One scan per file plus a binary
|
|
95
|
+
// search answers the same numbers in a few steps.
|
|
96
|
+
//
|
|
97
|
+
// A file's record is keyed by the text it was built from: the SourceFile wrapper
|
|
98
|
+
// is REUSED when a file is overwritten in place, so a table outliving one version
|
|
99
|
+
// of the text would answer for another.
|
|
100
|
+
const LINE_STARTS = new WeakMap();
|
|
101
|
+
const lineStartsOf = (sf) => {
|
|
102
|
+
const text = sf.getFullText();
|
|
103
|
+
const known = LINE_STARTS.get(sf);
|
|
104
|
+
if (known && known.text === text)
|
|
105
|
+
return known.starts;
|
|
106
|
+
// The five line breaks the parser counts (and `getLineNumberAtPos` counts):
|
|
107
|
+
// `\n`, `\r`, `\r\n` as ONE break, U+2028 and U+2029. A table built from `\n`
|
|
108
|
+
// alone would number the lines of a CRLF file differently from every other
|
|
109
|
+
// reader of the same file.
|
|
110
|
+
const starts = [0];
|
|
111
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
112
|
+
const code = text.charCodeAt(i);
|
|
113
|
+
if (code === 13) {
|
|
114
|
+
const paired = text.charCodeAt(i + 1) === 10;
|
|
115
|
+
starts.push(paired ? i + 2 : i + 1);
|
|
116
|
+
if (paired)
|
|
117
|
+
i += 1;
|
|
118
|
+
}
|
|
119
|
+
else if (code === 10 || code === 0x2028 || code === 0x2029)
|
|
120
|
+
starts.push(i + 1);
|
|
121
|
+
}
|
|
122
|
+
const built = Int32Array.from(starts);
|
|
123
|
+
LINE_STARTS.set(sf, { text, starts: built });
|
|
124
|
+
return built;
|
|
125
|
+
};
|
|
126
|
+
// The 1-based line of a position — the same number the parser reports.
|
|
127
|
+
const lineAt = (sf, pos) => {
|
|
128
|
+
const starts = lineStartsOf(sf);
|
|
129
|
+
let low = 0;
|
|
130
|
+
let high = starts.length - 1;
|
|
131
|
+
while (low < high) {
|
|
132
|
+
const mid = (low + high + 1) >> 1;
|
|
133
|
+
if (starts[mid] <= pos)
|
|
134
|
+
low = mid;
|
|
135
|
+
else
|
|
136
|
+
high = mid - 1;
|
|
137
|
+
}
|
|
138
|
+
return low + 1;
|
|
139
|
+
};
|
|
33
140
|
// A node's text as an IDENTITY, not as formatting. A fact is compared to what
|
|
34
141
|
// the architecture writes by hand (`origin: { equals: "t.model" }`,
|
|
35
142
|
// `source: { equals: "./x" }`), so the source LAYOUT must not leak into it: a
|
|
36
|
-
// chain broken across lines is the same callee, and
|
|
143
|
+
// chain broken across lines is the same callee, and entities silently stopped
|
|
37
144
|
// matching the moment it was not.
|
|
38
145
|
//
|
|
39
146
|
// Two rules, one helper:
|
|
@@ -80,11 +187,20 @@ const unwrapParens = (node) => {
|
|
|
80
187
|
};
|
|
81
188
|
exports.unwrapParens = unwrapParens;
|
|
82
189
|
// ── One node: name, line, depth, members ────────────────────────────────────
|
|
83
|
-
// A type as the parser reads it, or "any".
|
|
190
|
+
// A type as the parser reads it, or "any". The CHECKER call (`getType`) is the
|
|
191
|
+
// single most expensive fact a scan produces, and the same member node is
|
|
192
|
+
// reached from more than one walk (a candidate's descendant list, its
|
|
193
|
+
// initializer's members), so the answer is memoised per node for the run.
|
|
84
194
|
const typeText = (node) => {
|
|
195
|
+
const memos = memosOf(node);
|
|
196
|
+
const cached = memos.type.get(node);
|
|
197
|
+
if (cached !== undefined)
|
|
198
|
+
return cached;
|
|
85
199
|
try {
|
|
86
200
|
const t = node.getType();
|
|
87
|
-
|
|
201
|
+
const text = t.isAny() ? "any" : t.getText();
|
|
202
|
+
memos.type.set(node, text);
|
|
203
|
+
return text;
|
|
88
204
|
}
|
|
89
205
|
catch (error) {
|
|
90
206
|
// The checker fails on an import it cannot resolve (a broken path, a package
|
|
@@ -94,6 +210,7 @@ const typeText = (node) => {
|
|
|
94
210
|
const file = node.getSourceFile?.()?.getFilePath?.() ?? "?";
|
|
95
211
|
const e = error;
|
|
96
212
|
(0, notices_1.notice)(`a type could not be read (${file})`, e.message ?? String(e));
|
|
213
|
+
memos.type.set(node, null);
|
|
97
214
|
return null;
|
|
98
215
|
}
|
|
99
216
|
};
|
|
@@ -144,7 +261,19 @@ const isMeaningful = (d) => {
|
|
|
144
261
|
return true;
|
|
145
262
|
};
|
|
146
263
|
exports.isMeaningful = isMeaningful;
|
|
147
|
-
const startLine = (n) =>
|
|
264
|
+
const startLine = (n) => {
|
|
265
|
+
// The SourceFile wrapper is REUSED when a file is overwritten in place, so its
|
|
266
|
+
// line span is not cached (its children are new wrappers and cache safely).
|
|
267
|
+
if (n.getKind() === ts_morph_1.SyntaxKind.SourceFile)
|
|
268
|
+
return lineAt(n.getSourceFile(), n.getStart());
|
|
269
|
+
const memos = memosOf(n);
|
|
270
|
+
const cached = memos.startLine.get(n);
|
|
271
|
+
if (cached !== undefined)
|
|
272
|
+
return cached;
|
|
273
|
+
const line = lineAt(n.getSourceFile(), n.getStart());
|
|
274
|
+
memos.startLine.set(n, line);
|
|
275
|
+
return line;
|
|
276
|
+
};
|
|
148
277
|
exports.startLine = startLine;
|
|
149
278
|
// A candidate's OWN IDENTITY: where it starts — file, line and column, as one
|
|
150
279
|
// comparable value. A name is not an identity (three files have a `run`), a line
|
|
@@ -152,7 +281,8 @@ exports.startLine = startLine;
|
|
|
152
281
|
// fact that points at a piece can point at this instead of at a name that
|
|
153
282
|
// aliases.
|
|
154
283
|
const selfOf = (rel, sf, pos) => {
|
|
155
|
-
const
|
|
284
|
+
const line = lineAt(sf, pos);
|
|
285
|
+
const column = pos - lineStartsOf(sf)[line - 1] + 1;
|
|
156
286
|
return `${rel ?? ""}:${line}:${column}`;
|
|
157
287
|
};
|
|
158
288
|
exports.selfOf = selfOf;
|
|
@@ -167,6 +297,20 @@ const depthOf = (n, root) => {
|
|
|
167
297
|
return depth;
|
|
168
298
|
};
|
|
169
299
|
exports.depthOf = depthOf;
|
|
300
|
+
// A node's absolute depth from the SourceFile (the SourceFile itself is 0),
|
|
301
|
+
// memoised per node. For a TRUE descendant of `root`, `depthOf` is the difference
|
|
302
|
+
// of two absolute depths — a subtraction instead of a fresh parent walk per
|
|
303
|
+
// descendant. Only used where the node is known to descend from the root.
|
|
304
|
+
const depthFromFile = (n) => {
|
|
305
|
+
const memos = memosOf(n);
|
|
306
|
+
const cached = memos.depth.get(n);
|
|
307
|
+
if (cached !== undefined)
|
|
308
|
+
return cached;
|
|
309
|
+
const parent = n.getParent();
|
|
310
|
+
const depth = parent ? depthFromFile(parent) + 1 : 0;
|
|
311
|
+
memos.depth.set(n, depth);
|
|
312
|
+
return depth;
|
|
313
|
+
};
|
|
170
314
|
// A node's own name. `getName()` throws on a destructured parameter
|
|
171
315
|
// (`({ a, b }) => …`): ts-morph's `getNameNode()` is undefined for a binding
|
|
172
316
|
// pattern, so the pattern's own text is what names it.
|
|
@@ -192,10 +336,7 @@ exports.descriptor = descriptor;
|
|
|
192
336
|
// candidate). `nested` is set on function-like / loop nodes: true when another
|
|
193
337
|
// function-like node sits between the node and `root`.
|
|
194
338
|
const descendantFact = (d, root, depth = 0) => {
|
|
195
|
-
const f = { ...descriptor(d), depth
|
|
196
|
-
// A short, reportable label: the node's name when it has one, otherwise its
|
|
197
|
-
// (trimmed) source text. Feeds the `{what}` / `{snippet}` report vars.
|
|
198
|
-
f.snippet = d.getText().trim().slice(0, 120);
|
|
339
|
+
const f = { ...descriptor(d), depth };
|
|
199
340
|
if (d.getKind() === ts_morph_1.SyntaxKind.AsExpression) {
|
|
200
341
|
// The cast target as written; "is it `unknown`?" is the rule's question.
|
|
201
342
|
f.type = d.getTypeNode()?.getText() ?? null;
|
|
@@ -221,7 +362,17 @@ const isNestedIn = (fn, candidate) => {
|
|
|
221
362
|
// The lines a node spans, as ONE fact: `lines[0]` is where it starts,
|
|
222
363
|
// `lines[lines.length - 1]` where it ends, and everything the node contains is
|
|
223
364
|
// between them. A line count is `lines.length` — there is no second field for it.
|
|
224
|
-
const endLine = (n) =>
|
|
365
|
+
const endLine = (n) => {
|
|
366
|
+
if (n.getKind() === ts_morph_1.SyntaxKind.SourceFile)
|
|
367
|
+
return lineAt(n.getSourceFile(), n.getEnd());
|
|
368
|
+
const memos = memosOf(n);
|
|
369
|
+
const cached = memos.endLine.get(n);
|
|
370
|
+
if (cached !== undefined)
|
|
371
|
+
return cached;
|
|
372
|
+
const line = lineAt(n.getSourceFile(), n.getEnd());
|
|
373
|
+
memos.endLine.set(n, line);
|
|
374
|
+
return line;
|
|
375
|
+
};
|
|
225
376
|
// The consecutive lines `first..last` inclusive, as a plain array — the one
|
|
226
377
|
// spelling of "a span of lines" shared by `linesOf` (a node) and `linesOfRange`
|
|
227
378
|
// (a comment's trivia range).
|
|
@@ -240,7 +391,8 @@ exports.linesOf = linesOf;
|
|
|
240
391
|
const isExported = (node) => {
|
|
241
392
|
let target = node;
|
|
242
393
|
while (target.getParent) {
|
|
243
|
-
if (typeof target.getModifiers === "function" &&
|
|
394
|
+
if (typeof target.getModifiers === "function" &&
|
|
395
|
+
target.getModifiers().some((m) => m.getKind() === ts_morph_1.SyntaxKind.ExportKeyword))
|
|
244
396
|
return true;
|
|
245
397
|
const parent = target.getParent();
|
|
246
398
|
if (!parent || parent.getKind() === ts_morph_1.SyntaxKind.Block || parent.getKind() === ts_morph_1.SyntaxKind.SourceFile)
|
|
@@ -308,8 +460,18 @@ const docsOf = (node) => {
|
|
|
308
460
|
// it. A doc block is a node like any other, so "what is written above this
|
|
309
461
|
// declaration" is a query over the same list, told apart by `is`.
|
|
310
462
|
const descendantsOf = (node) => {
|
|
463
|
+
const docs = docsOf(node);
|
|
464
|
+
const descendants = node.getDescendants();
|
|
465
|
+
// The common case has no attached docs, and `getDescendants()` already yields
|
|
466
|
+
// each node once — so no seen-set (and no per-node identity string) is built.
|
|
467
|
+
// Every node here is a true descendant of `node`, so its depth is the difference
|
|
468
|
+
// of the (memoised) depth-from-file, not a fresh parent walk.
|
|
469
|
+
if (docs.length === 0) {
|
|
470
|
+
const rootDepth = depthFromFile(node);
|
|
471
|
+
return descendants.filter(isMeaningful).map((d) => descendantFact(d, node, depthFromFile(d) - rootDepth - 1));
|
|
472
|
+
}
|
|
311
473
|
const seen = new Set();
|
|
312
|
-
const nodes = [...
|
|
474
|
+
const nodes = [...docs, ...descendants].filter((d) => {
|
|
313
475
|
// Identity is kind + span, not `getPos()`: several nodes start at the same
|
|
314
476
|
// position (a statement, its declaration list and its first keyword all
|
|
315
477
|
// begin together), and keying by position dropped the whole statement.
|
|
@@ -334,7 +496,12 @@ const ancestorsOf = (n) => {
|
|
|
334
496
|
const initializerFact = (initializer) => {
|
|
335
497
|
if (!initializer)
|
|
336
498
|
return null;
|
|
337
|
-
return {
|
|
499
|
+
return {
|
|
500
|
+
is: initializer.is,
|
|
501
|
+
origin: initializer.origin,
|
|
502
|
+
members: initializer.members ?? [],
|
|
503
|
+
...(initializer.value !== undefined ? { value: initializer.value } : {}),
|
|
504
|
+
};
|
|
338
505
|
};
|
|
339
506
|
const kindFact = (n, initializer = null) => {
|
|
340
507
|
const parent = n.getParent?.() ?? null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Node } from "ts-morph";
|
|
2
2
|
import type { LooseNode } from "./loose";
|
|
3
|
-
import type { Candidate } from "
|
|
3
|
+
import type { Candidate } from "@md-code/follow-architecture/entities/facts";
|
|
4
4
|
declare const isTypeNode: (n: Node) => boolean;
|
|
5
5
|
declare const typeFact: (node: LooseNode, rel: string) => Candidate;
|
|
6
6
|
export { typeFact, isTypeNode };
|
|
@@ -29,7 +29,8 @@ const membersOf = (node, depth = 0) => {
|
|
|
29
29
|
const members = typeof node.getMembers === "function" ? node.getMembers() : [];
|
|
30
30
|
return members.map((m) => {
|
|
31
31
|
const name = typeof m.getName === "function" ? (m.getName() ?? null) : null;
|
|
32
|
-
const typeNode = (typeof m.getReturnTypeNode === "function" ? m.getReturnTypeNode() : null) ??
|
|
32
|
+
const typeNode = (typeof m.getReturnTypeNode === "function" ? m.getReturnTypeNode() : null) ??
|
|
33
|
+
(typeof m.getTypeNode === "function" ? m.getTypeNode() : null);
|
|
33
34
|
const nested = depth < MAX_MEMBER_DEPTH && isInlineShape(typeNode);
|
|
34
35
|
return {
|
|
35
36
|
name,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SourceFile } from "ts-morph";
|
|
2
2
|
import type { LooseNode } from "./loose";
|
|
3
|
-
import type { ReferencesFact } from "
|
|
3
|
+
import type { ReferencesFact } from "@md-code/follow-architecture/entities/facts";
|
|
4
4
|
declare const usageFact: (node: LooseNode, sf: SourceFile, { exported, relOf }: {
|
|
5
5
|
exported: boolean;
|
|
6
6
|
relOf?: (p: string) => string;
|
|
@@ -5,7 +5,7 @@ exports.usageFact = void 0;
|
|
|
5
5
|
// implements a shape. Both are questions about the whole project, so they are
|
|
6
6
|
// asked once per named candidate and only where the answer can change a verdict:
|
|
7
7
|
// a name nothing outside its file mentions is a name nobody needs.
|
|
8
|
-
const notices_1 = require("
|
|
8
|
+
const notices_1 = require("@md-code/follow-architecture/report/notices");
|
|
9
9
|
const countReferences = (node, sf, relOf) => {
|
|
10
10
|
if (typeof node.findReferencesAsNodes !== "function")
|
|
11
11
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from "ts-morph";
|
|
2
2
|
import type { LooseNode } from "./loose";
|
|
3
|
-
import type { Initializer, Assertion } from "
|
|
3
|
+
import type { Initializer, Assertion } from "@md-code/follow-architecture/entities/facts";
|
|
4
4
|
declare const literalTextOf: (n: Node) => string | null;
|
|
5
5
|
declare const variableInitializer: (node: LooseNode) => Initializer | null;
|
|
6
6
|
declare const assertionOf: (node: LooseNode) => Assertion | null;
|
|
@@ -2,8 +2,8 @@ import type { Project, SourceFile } from "ts-morph";
|
|
|
2
2
|
import type { Arch } from "./architecture";
|
|
3
3
|
import type { FileFacts } from "./facts";
|
|
4
4
|
import type { Facts } from "./kinds";
|
|
5
|
-
import type { ResolveContext } from "
|
|
6
|
-
import type { ObjectLiteral } from "
|
|
5
|
+
import type { ResolveContext } from "@md-code/follow-architecture/utils/imports";
|
|
6
|
+
import type { ObjectLiteral } from "@md-code/follow-architecture/css/value/scope";
|
|
7
7
|
type FileContext = {
|
|
8
8
|
abs?: string;
|
|
9
9
|
rel: string;
|
|
@@ -13,8 +13,8 @@ type FileContext = {
|
|
|
13
13
|
repoRoot?: string;
|
|
14
14
|
aliases?: Record<string, string>;
|
|
15
15
|
arch?: Arch;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
entities?: string[];
|
|
17
|
+
entityCtx?: {
|
|
18
18
|
present: string[];
|
|
19
19
|
candidates: FileFacts["candidates"];
|
|
20
20
|
} | null;
|
package/dist/entities/facts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldValue } from "
|
|
2
|
-
import type { ClassFact } from "
|
|
1
|
+
import type { FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import type { ClassFact } from "@md-code/follow-architecture/css/syntax/tailwind/tailwind";
|
|
3
3
|
type Located = {
|
|
4
4
|
name?: string | null;
|
|
5
5
|
line?: number;
|
|
@@ -26,11 +26,15 @@ type AnyMember = Omit<Partial<MemberFact>, "members"> & {
|
|
|
26
26
|
};
|
|
27
27
|
type DescendantFact = Descriptor & {
|
|
28
28
|
depth: number;
|
|
29
|
-
snippet: string;
|
|
30
29
|
type?: string | null;
|
|
31
30
|
members?: MemberFact[];
|
|
32
31
|
nested?: boolean;
|
|
33
32
|
};
|
|
33
|
+
type RecordObject = {
|
|
34
|
+
entity: string;
|
|
35
|
+
name: string;
|
|
36
|
+
start: number;
|
|
37
|
+
};
|
|
34
38
|
type Initializer = Pick<MemberFact, "is" | "members"> & {
|
|
35
39
|
origin: string | null;
|
|
36
40
|
value?: string | number;
|
|
@@ -80,7 +84,7 @@ type CallFact = {
|
|
|
80
84
|
receiverOnly: boolean;
|
|
81
85
|
bare: boolean;
|
|
82
86
|
arguments: ArgumentFact[];
|
|
83
|
-
|
|
87
|
+
targetEntity?: string | null;
|
|
84
88
|
};
|
|
85
89
|
type ReturnFact = {
|
|
86
90
|
kind: string;
|
|
@@ -162,8 +166,19 @@ type CssClassFact = ClassFact & {
|
|
|
162
166
|
};
|
|
163
167
|
type CssFacts = {
|
|
164
168
|
templates?: CssTemplateFact[];
|
|
169
|
+
};
|
|
170
|
+
type TailwindFacts = {
|
|
165
171
|
classes?: CssClassFact[];
|
|
166
172
|
};
|
|
173
|
+
type TestFacts = {
|
|
174
|
+
runner?: string | null;
|
|
175
|
+
cases?: number;
|
|
176
|
+
asserts?: number;
|
|
177
|
+
hooks?: string[];
|
|
178
|
+
snapshots?: number;
|
|
179
|
+
mocks?: number;
|
|
180
|
+
readonly [key: string]: FieldValue;
|
|
181
|
+
};
|
|
167
182
|
type JsxElementFact = {
|
|
168
183
|
tag: string | null;
|
|
169
184
|
line: number | null;
|
|
@@ -178,13 +193,16 @@ type Link = {
|
|
|
178
193
|
module: string | null;
|
|
179
194
|
};
|
|
180
195
|
type FrameworkFacts = {
|
|
181
|
-
id
|
|
182
|
-
component
|
|
183
|
-
props
|
|
184
|
-
forwarded
|
|
196
|
+
id?: string | null;
|
|
197
|
+
component?: boolean;
|
|
198
|
+
props?: string[];
|
|
199
|
+
forwarded?: string[];
|
|
185
200
|
jsx?: JsxElementFact[];
|
|
186
201
|
links?: Link[];
|
|
187
202
|
handler?: boolean;
|
|
203
|
+
css?: CssFacts;
|
|
204
|
+
tailwind?: TailwindFacts;
|
|
205
|
+
test?: TestFacts;
|
|
188
206
|
};
|
|
189
207
|
type Candidate = {
|
|
190
208
|
name?: string | null;
|
|
@@ -198,6 +216,8 @@ type Candidate = {
|
|
|
198
216
|
parameters?: ParameterFact[];
|
|
199
217
|
exported?: boolean;
|
|
200
218
|
mutable?: boolean;
|
|
219
|
+
at?: number;
|
|
220
|
+
len?: number;
|
|
201
221
|
references?: ReferencesFact | null;
|
|
202
222
|
implementations?: number | null;
|
|
203
223
|
members?: AnyMember[];
|
|
@@ -207,9 +227,8 @@ type Candidate = {
|
|
|
207
227
|
constructorParams?: ConstructorParam[];
|
|
208
228
|
hasConstructor?: boolean;
|
|
209
229
|
text?: string;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
css?: CssFacts;
|
|
230
|
+
entity?: string | null;
|
|
231
|
+
parentEntity?: string | null;
|
|
213
232
|
framework?: FrameworkFacts;
|
|
214
233
|
file?: FileFacts;
|
|
215
234
|
};
|
|
@@ -229,6 +248,8 @@ type ImportFact = {
|
|
|
229
248
|
source: string | null;
|
|
230
249
|
typeOnly?: boolean;
|
|
231
250
|
named?: string[];
|
|
251
|
+
imported?: string[];
|
|
252
|
+
declaring?: (string | null)[];
|
|
232
253
|
line: number;
|
|
233
254
|
piece?: string | null;
|
|
234
255
|
resolved?: string | null;
|
|
@@ -238,6 +259,8 @@ type ImportFact = {
|
|
|
238
259
|
type ExportFact = Pick<ImportFact, "form" | "source" | "line" | "piece" | "named" | "typeOnly"> & {
|
|
239
260
|
from?: string | null;
|
|
240
261
|
name?: string | null;
|
|
262
|
+
original?: string[];
|
|
263
|
+
declaring?: (string | null)[];
|
|
241
264
|
};
|
|
242
265
|
type ReadFact = {
|
|
243
266
|
module: string;
|
|
@@ -256,6 +279,6 @@ type FileFacts = {
|
|
|
256
279
|
descendants: DescendantFact[];
|
|
257
280
|
};
|
|
258
281
|
candidates: Candidate[];
|
|
259
|
-
|
|
282
|
+
entities: string[];
|
|
260
283
|
};
|
|
261
|
-
export type { Located, Descriptor, MemberFact, AnyMember, DescendantFact, Initializer, Assertion, DecoratorFact, KindFact, ArgumentFact, CallFact, ReturnFact, BindingFact, ParameterFact, BranchFact, AssignmentFact, ReferencesFact, LocationFact, ConstructorParam, CssTemplateFact, CssClassFact, CssFacts, JsxElementFact, Link, FrameworkFacts, Candidate, Leaf, Place, ImportFact, ExportFact, ReadFact, FileFacts, };
|
|
284
|
+
export type { Located, Descriptor, MemberFact, AnyMember, DescendantFact, RecordObject, Initializer, Assertion, DecoratorFact, KindFact, ArgumentFact, CallFact, ReturnFact, BindingFact, ParameterFact, BranchFact, AssignmentFact, ReferencesFact, LocationFact, ConstructorParam, CssTemplateFact, CssClassFact, CssFacts, TailwindFacts, TestFacts, JsxElementFact, Link, FrameworkFacts, Candidate, Leaf, Place, ImportFact, ExportFact, ReadFact, FileFacts, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FieldValue } from "
|
|
2
|
-
import type { Span } from "
|
|
1
|
+
import type { FieldValue } from "@md-code/follow-architecture/utils/field";
|
|
2
|
+
import type { Span } from "@md-code/follow-architecture/utils/span";
|
|
3
3
|
import type { ReportObject } from "./architecture";
|
|
4
4
|
type Finding = Record<string, FieldValue>;
|
|
5
5
|
type FindingItem = {
|
|
@@ -9,7 +9,7 @@ type FindingItem = {
|
|
|
9
9
|
data?: FieldValue;
|
|
10
10
|
message?: string | null;
|
|
11
11
|
fix?: string | null;
|
|
12
|
-
|
|
12
|
+
entity?: string | null;
|
|
13
13
|
};
|
|
14
14
|
type FindingFrom = (...args: [item: FindingItem, rule: string, node: string, key: string, vars: Record<string, FieldValue>]) => Finding;
|
|
15
15
|
type FindingHighlight = Span & {
|