@md-code/follow-architecture 0.1.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/LICENSE +202 -0
- package/README.md +1420 -139
- package/dist/aliases.d.ts +3 -0
- package/dist/aliases.js +12 -0
- package/dist/args.d.ts +18 -0
- package/dist/args.js +94 -0
- package/dist/bin/follow-architecture.d.ts +2 -0
- package/dist/bin/follow-architecture.js +23 -0
- package/dist/closure-project.d.ts +4 -0
- package/dist/closure-project.js +132 -0
- package/dist/code-entities/classify.d.ts +11 -0
- package/dist/code-entities/classify.js +45 -0
- package/dist/code-entities/connector.d.ts +8 -0
- package/dist/code-entities/connector.js +119 -0
- package/dist/code-entities/entities.d.ts +9 -0
- package/dist/code-entities/entities.js +227 -0
- package/dist/code-entities/project.d.ts +21 -0
- package/dist/code-entities/project.js +259 -0
- package/dist/code-entities/walk.d.ts +31 -0
- package/dist/code-entities/walk.js +105 -0
- package/dist/config-options.d.ts +76 -0
- package/dist/config-options.js +52 -0
- package/dist/config-project.d.ts +4 -0
- package/dist/config-project.js +92 -0
- package/dist/config-report.d.ts +19 -0
- package/dist/config-report.js +161 -0
- package/dist/config-rule.d.ts +95 -0
- package/dist/config-rule.js +211 -0
- package/dist/config-state.d.ts +25 -0
- package/dist/config-state.js +269 -0
- package/dist/config.d.ts +107 -0
- package/dist/config.js +38 -0
- package/dist/css/index.d.ts +31 -0
- package/dist/css/index.js +251 -0
- package/dist/css/syntax/css/gate.d.ts +2 -0
- package/dist/css/syntax/css/gate.js +69 -0
- package/dist/css/syntax/css/index.d.ts +7 -0
- package/dist/css/syntax/css/index.js +51 -0
- package/dist/css/syntax/css/reference.d.ts +3 -0
- package/dist/css/syntax/css/reference.js +36 -0
- package/dist/css/syntax/language.d.ts +25 -0
- package/dist/css/syntax/language.js +81 -0
- package/dist/css/syntax/scss/index.d.ts +25 -0
- package/dist/css/syntax/scss/index.js +95 -0
- package/dist/css/syntax/scss/reference.d.ts +3 -0
- package/dist/css/syntax/scss/reference.js +17 -0
- package/dist/css/syntax/styled/document.d.ts +68 -0
- package/dist/css/syntax/styled/document.js +261 -0
- package/dist/css/syntax/styled/markup.d.ts +6 -0
- package/dist/css/syntax/styled/markup.js +84 -0
- package/dist/css/syntax/styled/tags.d.ts +2 -0
- package/dist/css/syntax/styled/tags.js +22 -0
- package/dist/css/syntax/styled/template.d.ts +23 -0
- package/dist/css/syntax/styled/template.js +67 -0
- package/dist/css/syntax/tailwind/tailwind-engine.d.ts +23 -0
- package/dist/css/syntax/tailwind/tailwind-engine.js +37 -0
- package/dist/css/syntax/tailwind/tailwind.d.ts +26 -0
- package/dist/css/syntax/tailwind/tailwind.js +118 -0
- package/dist/css/value/check.d.ts +86 -0
- package/dist/css/value/check.js +122 -0
- package/dist/css/value/expression/arithmetic.d.ts +7 -0
- package/dist/css/value/expression/arithmetic.js +73 -0
- package/dist/css/value/expression/block.d.ts +9 -0
- package/dist/css/value/expression/block.js +92 -0
- package/dist/css/value/expression/conditional.d.ts +8 -0
- package/dist/css/value/expression/conditional.js +53 -0
- package/dist/css/value/expression/index.d.ts +5 -0
- package/dist/css/value/expression/index.js +73 -0
- package/dist/css/value/expression/map.d.ts +7 -0
- package/dist/css/value/expression/map.js +113 -0
- package/dist/css/value/object/index.d.ts +5 -0
- package/dist/css/value/object/index.js +113 -0
- package/dist/css/value/object/members.d.ts +7 -0
- package/dist/css/value/object/members.js +103 -0
- package/dist/css/value/object/node.d.ts +8 -0
- package/dist/css/value/object/node.js +134 -0
- package/dist/css/value/object/path.d.ts +10 -0
- package/dist/css/value/object/path.js +152 -0
- package/dist/css/value/pieces.d.ts +61 -0
- package/dist/css/value/pieces.js +65 -0
- package/dist/css/value/resolve.d.ts +33 -0
- package/dist/css/value/resolve.js +104 -0
- package/dist/css/value/scope.d.ts +28 -0
- package/dist/css/value/scope.js +205 -0
- package/dist/css/value/substitute.d.ts +10 -0
- package/dist/css/value/substitute.js +145 -0
- package/dist/css/value/values.d.ts +23 -0
- package/dist/css/value/values.js +131 -0
- package/dist/entities/architecture.d.ts +165 -0
- package/dist/entities/architecture.js +2 -0
- package/dist/entities/ast/assignments-nodes.d.ts +10 -0
- package/dist/entities/ast/assignments-nodes.js +64 -0
- package/dist/entities/ast/assignments-raw.d.ts +6 -0
- package/dist/entities/ast/assignments-raw.js +139 -0
- package/dist/entities/ast/assignments-tagged.d.ts +5 -0
- package/dist/entities/ast/assignments-tagged.js +195 -0
- package/dist/entities/ast/assignments.d.ts +9 -0
- package/dist/entities/ast/assignments.js +80 -0
- package/dist/entities/ast/branches.d.ts +4 -0
- package/dist/entities/ast/branches.js +32 -0
- package/dist/entities/ast/calls.d.ts +6 -0
- package/dist/entities/ast/calls.js +150 -0
- package/dist/entities/ast/classes.d.ts +5 -0
- package/dist/entities/ast/classes.js +61 -0
- package/dist/entities/ast/climb.d.ts +12 -0
- package/dist/entities/ast/climb.js +17 -0
- package/dist/entities/ast/comments.d.ts +5 -0
- package/dist/entities/ast/comments.js +130 -0
- package/dist/entities/ast/declaration.d.ts +4 -0
- package/dist/entities/ast/declaration.js +26 -0
- package/dist/entities/ast/depth.d.ts +17 -0
- package/dist/entities/ast/depth.js +166 -0
- package/dist/entities/ast/enums.d.ts +6 -0
- package/dist/entities/ast/enums.js +17 -0
- package/dist/entities/ast/export-chain.d.ts +15 -0
- package/dist/entities/ast/export-chain.js +171 -0
- package/dist/entities/ast/file-exports.d.ts +7 -0
- package/dist/entities/ast/file-exports.js +101 -0
- package/dist/entities/ast/file-facts.d.ts +16 -0
- package/dist/entities/ast/file-facts.js +64 -0
- package/dist/entities/ast/file-imports.d.ts +5 -0
- package/dist/entities/ast/file-imports.js +100 -0
- package/dist/entities/ast/file.d.ts +5 -0
- package/dist/entities/ast/file.js +23 -0
- package/dist/entities/ast/functions.d.ts +8 -0
- package/dist/entities/ast/functions.js +111 -0
- package/dist/entities/ast/heritage.d.ts +4 -0
- package/dist/entities/ast/heritage.js +44 -0
- package/dist/entities/ast/index.d.ts +9 -0
- package/dist/entities/ast/index.js +181 -0
- package/dist/entities/ast/kind.d.ts +5 -0
- package/dist/entities/ast/kind.js +34 -0
- package/dist/entities/ast/loose.d.ts +37 -0
- package/dist/entities/ast/loose.js +2 -0
- package/dist/entities/ast/modifiers.d.ts +5 -0
- package/dist/entities/ast/modifiers.js +32 -0
- package/dist/entities/ast/project.d.ts +9 -0
- package/dist/entities/ast/project.js +106 -0
- package/dist/entities/ast/properties.d.ts +11 -0
- package/dist/entities/ast/properties.js +176 -0
- package/dist/entities/ast/resolve.d.ts +16 -0
- package/dist/entities/ast/resolve.js +317 -0
- package/dist/entities/ast/tree.d.ts +31 -0
- package/dist/entities/ast/tree.js +518 -0
- package/dist/entities/ast/types.d.ts +6 -0
- package/dist/entities/ast/types.js +46 -0
- package/dist/entities/ast/usage.d.ts +11 -0
- package/dist/entities/ast/usage.js +81 -0
- package/dist/entities/ast/variables.d.ts +8 -0
- package/dist/entities/ast/variables.js +91 -0
- package/dist/entities/context.d.ts +29 -0
- package/dist/entities/context.js +2 -0
- package/dist/entities/facts.d.ts +284 -0
- package/dist/entities/facts.js +2 -0
- package/dist/entities/findings.d.ts +19 -0
- package/dist/entities/findings.js +2 -0
- package/dist/entities/kinds.d.ts +40 -0
- package/dist/entities/kinds.js +332 -0
- package/dist/entities/location/homes.d.ts +28 -0
- package/dist/entities/location/homes.js +195 -0
- package/dist/entities/location/place.d.ts +10 -0
- package/dist/entities/location/place.js +63 -0
- package/dist/entities/location/where.d.ts +19 -0
- package/dist/entities/location/where.js +277 -0
- package/dist/entities/location.d.ts +16 -0
- package/dist/entities/location.js +140 -0
- package/dist/entities/operators.d.ts +14 -0
- package/dist/entities/operators.js +30 -0
- package/dist/entities/overview/data.d.ts +43 -0
- package/dist/entities/overview/data.js +2 -0
- package/dist/entities/overview/decision.d.ts +60 -0
- package/dist/entities/overview/decision.js +2 -0
- package/dist/entities/overview/file-tree.d.ts +10 -0
- package/dist/entities/overview/file-tree.js +2 -0
- package/dist/entities/overview/finding.d.ts +58 -0
- package/dist/entities/overview/finding.js +2 -0
- package/dist/entities/overview/graph.d.ts +82 -0
- package/dist/entities/overview/graph.js +2 -0
- package/dist/entities/overview/input.d.ts +15 -0
- package/dist/entities/overview/input.js +2 -0
- package/dist/entities/overview/summaries.d.ts +81 -0
- package/dist/entities/overview/summaries.js +2 -0
- package/dist/entities/place.d.ts +5 -0
- package/dist/entities/place.js +2 -0
- package/dist/entities/queries.d.ts +9 -0
- package/dist/entities/queries.js +375 -0
- package/dist/entities/repair.d.ts +16 -0
- package/dist/entities/repair.js +29 -0
- package/dist/entities/schema.d.ts +22 -0
- package/dist/entities/schema.js +81 -0
- package/dist/entities/story.d.ts +47 -0
- package/dist/entities/story.js +2 -0
- package/dist/entities/structure-facts.d.ts +11 -0
- package/dist/entities/structure-facts.js +2 -0
- package/dist/entities/token.d.ts +23 -0
- package/dist/entities/token.js +2 -0
- package/dist/entities/tree/build.d.ts +6 -0
- package/dist/entities/tree/build.js +313 -0
- package/dist/entities/tree/entries.d.ts +7 -0
- package/dist/entities/tree/entries.js +145 -0
- package/dist/entities/tree/index.d.ts +6 -0
- package/dist/entities/tree/index.js +21 -0
- package/dist/entities/tree/match.d.ts +17 -0
- package/dist/entities/tree/match.js +190 -0
- package/dist/fa-index.d.ts +16 -0
- package/dist/fa-index.js +165 -0
- package/dist/fa-open.d.ts +51 -0
- package/dist/fa-open.js +242 -0
- package/dist/fa-store.d.ts +22 -0
- package/dist/fa-store.js +232 -0
- package/dist/fa-values.d.ts +37 -0
- package/dist/fa-values.js +104 -0
- package/dist/facts-record.d.ts +45 -0
- package/dist/facts-record.js +297 -0
- package/dist/frameworks/angular/index.d.ts +7 -0
- package/dist/frameworks/angular/index.js +18 -0
- package/dist/frameworks/facet.d.ts +18 -0
- package/dist/frameworks/facet.js +15 -0
- package/dist/frameworks/index.d.ts +9 -0
- package/dist/frameworks/index.js +134 -0
- package/dist/frameworks/react/index.d.ts +7 -0
- package/dist/frameworks/react/index.js +237 -0
- package/dist/frameworks/test/index.d.ts +6 -0
- package/dist/frameworks/test/index.js +157 -0
- package/dist/frameworks/vue/index.d.ts +7 -0
- package/dist/frameworks/vue/index.js +18 -0
- package/dist/ignore.d.ts +3 -0
- package/dist/ignore.js +62 -0
- package/dist/index-file.d.ts +43 -0
- package/dist/index-file.js +218 -0
- package/dist/index-run.d.ts +39 -0
- package/dist/index-run.js +217 -0
- package/dist/index-zone.d.ts +25 -0
- package/dist/index-zone.js +219 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.js +411 -0
- package/dist/nodes/child-entities.d.ts +3 -0
- package/dist/nodes/child-entities.js +12 -0
- package/dist/nodes/children.d.ts +25 -0
- package/dist/nodes/children.js +165 -0
- package/dist/nodes/finally/emit.d.ts +6 -0
- package/dist/nodes/finally/emit.js +71 -0
- package/dist/nodes/finally/entities.d.ts +13 -0
- package/dist/nodes/finally/entities.js +42 -0
- package/dist/nodes/finally/index.d.ts +8 -0
- package/dist/nodes/finally/index.js +35 -0
- package/dist/nodes/finally/queries.d.ts +5 -0
- package/dist/nodes/finally/queries.js +25 -0
- package/dist/nodes/finally/relations-access.d.ts +5 -0
- package/dist/nodes/finally/relations-access.js +50 -0
- package/dist/nodes/finally/relations-edge.d.ts +29 -0
- package/dist/nodes/finally/relations-edge.js +148 -0
- package/dist/nodes/finally/relations-group.d.ts +31 -0
- package/dist/nodes/finally/relations-group.js +106 -0
- package/dist/nodes/finally/relations.d.ts +5 -0
- package/dist/nodes/finally/relations.js +85 -0
- package/dist/nodes/finally/required.d.ts +5 -0
- package/dist/nodes/finally/required.js +92 -0
- package/dist/nodes/finally/violation.d.ts +17 -0
- package/dist/nodes/finally/violation.js +2 -0
- package/dist/nodes/similar.d.ts +21 -0
- package/dist/nodes/similar.js +178 -0
- package/dist/piece-forms.d.ts +9 -0
- package/dist/piece-forms.js +68 -0
- package/dist/pipeline-entities.d.ts +6 -0
- package/dist/pipeline-entities.js +79 -0
- package/dist/pipeline-facts.d.ts +12 -0
- package/dist/pipeline-facts.js +114 -0
- package/dist/pipeline-unclassified.d.ts +14 -0
- package/dist/pipeline-unclassified.js +188 -0
- package/dist/pipeline.d.ts +7 -0
- package/dist/pipeline.js +28 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +3 -0
- package/dist/release-file.d.ts +3 -0
- package/dist/release-file.js +13 -0
- package/dist/report/asks.d.ts +55 -0
- package/dist/report/asks.js +60 -0
- package/dist/report/cli-report.d.ts +2 -0
- package/dist/report/cli-report.js +13 -0
- package/dist/report/config-error-guard.d.ts +8 -0
- package/dist/report/config-error-guard.js +5 -0
- package/dist/report/configErrors.d.ts +126 -0
- package/dist/report/configErrors.js +121 -0
- package/dist/report/errorTypes/codes/structure.d.ts +15 -0
- package/dist/report/errorTypes/codes/structure.js +76 -0
- package/dist/report/errorTypes/decision-maker.d.ts +23 -0
- package/dist/report/errorTypes/decision-maker.js +109 -0
- package/dist/report/errorTypes/destinations.d.ts +38 -0
- package/dist/report/errorTypes/destinations.js +165 -0
- package/dist/report/errorTypes/finding-type.d.ts +11 -0
- package/dist/report/errorTypes/finding-type.js +2 -0
- package/dist/report/errorTypes/index.d.ts +15 -0
- package/dist/report/errorTypes/index.js +55 -0
- package/dist/report/errorTypes/types/fileContents.d.ts +9 -0
- package/dist/report/errorTypes/types/fileContents.js +40 -0
- package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
- package/dist/report/errorTypes/types/unknownEntity.js +27 -0
- package/dist/report/errorTypes/types/wrongAction.d.ts +22 -0
- package/dist/report/errorTypes/types/wrongAction.js +140 -0
- package/dist/report/errorTypes/types/wrongPlacement.d.ts +9 -0
- package/dist/report/errorTypes/types/wrongPlacement.js +67 -0
- package/dist/report/errorTypes/vocabulary/ids.d.ts +5 -0
- package/dist/report/errorTypes/vocabulary/ids.js +16 -0
- package/dist/report/errorTypes/vocabulary/phrases.d.ts +10 -0
- package/dist/report/errorTypes/vocabulary/phrases.js +187 -0
- package/dist/report/errorTypes/vocabulary/places.d.ts +8 -0
- package/dist/report/errorTypes/vocabulary/places.js +36 -0
- package/dist/report/errorTypes/vocabulary/verbs.d.ts +7 -0
- package/dist/report/errorTypes/vocabulary/verbs.js +30 -0
- package/dist/report/finding-from.d.ts +9 -0
- package/dist/report/finding-from.js +108 -0
- package/dist/report/notices.d.ts +9 -0
- package/dist/report/notices.js +57 -0
- package/dist/report/observed.d.ts +19 -0
- package/dist/report/observed.js +87 -0
- package/dist/report/render-report.d.ts +12 -0
- package/dist/report/render-report.js +145 -0
- package/dist/report/user-report/build/bundle.d.ts +3 -0
- package/dist/report/user-report/build/bundle.js +188 -0
- package/dist/report/user-report/build/bundle.prebuilt.js +1262 -0
- package/dist/report/user-report/data/collect.d.ts +4 -0
- package/dist/report/user-report/data/collect.js +93 -0
- package/dist/report/user-report/data/entities.d.ts +7 -0
- package/dist/report/user-report/data/entities.js +88 -0
- package/dist/report/user-report/data/entity-examples.d.ts +16 -0
- package/dist/report/user-report/data/entity-examples.js +136 -0
- package/dist/report/user-report/data/entity-filters.d.ts +15 -0
- package/dist/report/user-report/data/entity-filters.js +79 -0
- package/dist/report/user-report/data/entity-marks.d.ts +5 -0
- package/dist/report/user-report/data/entity-marks.js +79 -0
- package/dist/report/user-report/data/file-tree.d.ts +9 -0
- package/dist/report/user-report/data/file-tree.js +80 -0
- package/dist/report/user-report/data/finding-boundary.d.ts +9 -0
- package/dist/report/user-report/data/finding-boundary.js +21 -0
- package/dist/report/user-report/data/finding-plan.d.ts +16 -0
- package/dist/report/user-report/data/finding-plan.js +45 -0
- package/dist/report/user-report/data/finding-title.d.ts +12 -0
- package/dist/report/user-report/data/finding-title.js +36 -0
- package/dist/report/user-report/data/findings.d.ts +10 -0
- package/dist/report/user-report/data/findings.js +181 -0
- package/dist/report/user-report/data/graph-edges.d.ts +19 -0
- package/dist/report/user-report/data/graph-edges.js +109 -0
- package/dist/report/user-report/data/graph-entities.d.ts +6 -0
- package/dist/report/user-report/data/graph-entities.js +158 -0
- package/dist/report/user-report/data/graph-helpers.d.ts +7 -0
- package/dist/report/user-report/data/graph-helpers.js +67 -0
- package/dist/report/user-report/data/graph.d.ts +12 -0
- package/dist/report/user-report/data/graph.js +97 -0
- package/dist/report/user-report/data/nodes.d.ts +11 -0
- package/dist/report/user-report/data/nodes.js +116 -0
- package/dist/report/user-report/data/rules.d.ts +7 -0
- package/dist/report/user-report/data/rules.js +62 -0
- package/dist/report/user-report/data/scan.d.ts +8 -0
- package/dist/report/user-report/data/scan.js +69 -0
- package/dist/report/user-report/html/shell.d.ts +3 -0
- package/dist/report/user-report/html/shell.js +27 -0
- package/dist/report/user-report/index.d.ts +8 -0
- package/dist/report/user-report/index.js +58 -0
- package/dist/report/user-report/shared/describe.d.ts +7 -0
- package/dist/report/user-report/shared/describe.js +86 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.js +327 -0
- package/dist/rules/list-vars.d.ts +5 -0
- package/dist/rules/list-vars.js +149 -0
- package/dist/rules/name.d.ts +16 -0
- package/dist/rules/name.js +18 -0
- package/dist/rules/normalize.d.ts +5 -0
- package/dist/rules/normalize.js +108 -0
- package/dist/rules/vars.d.ts +22 -0
- package/dist/rules/vars.js +117 -0
- package/dist/scan-run.d.ts +20 -0
- package/dist/scan-run.js +130 -0
- package/dist/scripts/audit-report.d.ts +2 -0
- package/dist/scripts/audit-report.js +157 -0
- package/dist/usage-index.d.ts +4 -0
- package/dist/usage-index.js +282 -0
- package/dist/usage-mode.d.ts +7 -0
- package/dist/usage-mode.js +16 -0
- package/dist/usage-pass.d.ts +19 -0
- package/dist/usage-pass.js +136 -0
- package/dist/usage-prepare.d.ts +2 -0
- package/dist/usage-prepare.js +22 -0
- package/dist/usage-sweep.d.ts +10 -0
- package/dist/usage-sweep.js +264 -0
- package/dist/utils/accumulate.d.ts +6 -0
- package/dist/utils/accumulate.js +18 -0
- package/dist/utils/aliases.d.ts +22 -0
- package/dist/utils/aliases.js +173 -0
- package/dist/utils/article.d.ts +2 -0
- package/dist/utils/article.js +12 -0
- package/dist/utils/classify.d.ts +12 -0
- package/dist/utils/classify.js +25 -0
- package/dist/utils/configs.d.ts +25 -0
- package/dist/utils/configs.js +97 -0
- package/dist/utils/count.d.ts +7 -0
- package/dist/utils/count.js +13 -0
- package/dist/utils/dispatch.d.ts +2 -0
- package/dist/utils/dispatch.js +27 -0
- package/dist/utils/distinct.d.ts +2 -0
- package/dist/utils/distinct.js +14 -0
- package/dist/utils/field.d.ts +14 -0
- package/dist/utils/field.js +60 -0
- package/dist/utils/file-name.d.ts +2 -0
- package/dist/utils/file-name.js +11 -0
- package/dist/utils/files.d.ts +7 -0
- package/dist/utils/files.js +77 -0
- package/dist/utils/fixpoint.d.ts +2 -0
- package/dist/utils/fixpoint.js +19 -0
- package/dist/utils/gate.d.ts +2 -0
- package/dist/utils/gate.js +12 -0
- package/dist/utils/group.d.ts +3 -0
- package/dist/utils/group.js +33 -0
- package/dist/utils/host.d.ts +3 -0
- package/dist/utils/host.js +16 -0
- package/dist/utils/imports.d.ts +12 -0
- package/dist/utils/imports.js +185 -0
- package/dist/utils/judged.d.ts +5 -0
- package/dist/utils/judged.js +19 -0
- package/dist/utils/keyed.d.ts +2 -0
- package/dist/utils/keyed.js +23 -0
- package/dist/utils/map-record.d.ts +2 -0
- package/dist/utils/map-record.js +11 -0
- package/dist/utils/packages.d.ts +15 -0
- package/dist/utils/packages.js +207 -0
- package/dist/utils/path-label.d.ts +6 -0
- package/dist/utils/path-label.js +37 -0
- package/dist/utils/pattern.d.ts +19 -0
- package/dist/utils/pattern.js +231 -0
- package/dist/utils/permission.d.ts +16 -0
- package/dist/utils/permission.js +18 -0
- package/dist/utils/plural.d.ts +2 -0
- package/dist/utils/plural.js +9 -0
- package/dist/utils/qualified.d.ts +2 -0
- package/dist/utils/qualified.js +21 -0
- package/dist/utils/rank.d.ts +2 -0
- package/dist/utils/rank.js +24 -0
- package/dist/utils/read-field.d.ts +12 -0
- package/dist/utils/read-field.js +50 -0
- package/dist/utils/read-when.d.ts +2 -0
- package/dist/utils/read-when.js +17 -0
- package/dist/utils/reason.d.ts +4 -0
- package/dist/utils/reason.js +9 -0
- package/dist/utils/record.d.ts +3 -0
- package/dist/utils/record.js +21 -0
- package/dist/utils/resolve.d.ts +2 -0
- package/dist/utils/resolve.js +24 -0
- package/dist/utils/search.d.ts +2 -0
- package/dist/utils/search.js +21 -0
- package/dist/utils/seen.d.ts +6 -0
- package/dist/utils/seen.js +27 -0
- package/dist/utils/span.d.ts +5 -0
- package/dist/utils/span.js +2 -0
- package/dist/utils/speak.d.ts +2 -0
- package/dist/utils/speak.js +18 -0
- package/dist/utils/split.d.ts +8 -0
- package/dist/utils/split.js +21 -0
- package/dist/utils/template.d.ts +5 -0
- package/dist/utils/template.js +5 -0
- package/dist/utils/text.d.ts +4 -0
- package/dist/utils/text.js +42 -0
- package/dist/utils/tokenize.d.ts +2 -0
- package/dist/utils/tokenize.js +18 -0
- package/dist/utils/try-read.d.ts +4 -0
- package/dist/utils/try-read.js +24 -0
- package/dist/utils/typed-field.d.ts +3 -0
- package/dist/utils/typed-field.js +16 -0
- package/dist/utils/verdicts.d.ts +4 -0
- package/dist/utils/verdicts.js +20 -0
- package/entities/operators.ts +31 -0
- package/package.json +101 -47
- package/report/errorTypes/vocabulary/ids.ts +17 -0
- package/report/errorTypes/vocabulary/phrases.ts +181 -0
- package/report/errorTypes/vocabulary/places.ts +51 -0
- package/report/errorTypes/vocabulary/verbs.ts +31 -0
- package/report/user-report/shared/describe.ts +107 -0
- package/ast.js +0 -107
- package/bin/follow-architecture.js +0 -6
- package/config.js +0 -101
- package/entities/aliases.js +0 -10
- package/entities/invariants.js +0 -134
- package/entities/nodes.js +0 -112
- package/main.js +0 -96
- package/plugin.js +0 -5
- package/report.js +0 -73
- package/utils.js +0 -104
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registryFromIndex = exports.checkIndexed = exports.checkOne = exports.recordFor = exports.readOne = exports.addPieces = exports.addSummary = exports.emptyRegistry = void 0;
|
|
4
|
+
// ONE FILE, AS THE INDEXED RUN NEEDS IT: the project-wide index a summary feeds,
|
|
5
|
+
// the record of a file this run has to read again, and the check that turns that
|
|
6
|
+
// record into the verdicts stored in the light section. Nothing here opens or
|
|
7
|
+
// drives the index — `index-run.ts` decides what is read and in which order.
|
|
8
|
+
const facts_record_1 = require("./facts-record");
|
|
9
|
+
const classify_1 = require("./code-entities/classify");
|
|
10
|
+
const project_1 = require("./code-entities/project");
|
|
11
|
+
const fa_index_1 = require("./fa-index");
|
|
12
|
+
const rules_1 = require("./rules");
|
|
13
|
+
const notices_1 = require("./report/notices");
|
|
14
|
+
const release_file_1 = require("./release-file");
|
|
15
|
+
const scan_run_1 = require("./scan-run");
|
|
16
|
+
const closure_project_1 = require("./closure-project");
|
|
17
|
+
const ast_1 = require("./entities/ast");
|
|
18
|
+
const group_1 = require("./utils/group");
|
|
19
|
+
const fa_values_1 = require("./fa-values");
|
|
20
|
+
// The project-wide index, rebuilt from summaries. Every piece here was produced by
|
|
21
|
+
// the same per-file classification the AST pass runs, so the answers are the ones
|
|
22
|
+
// that pass would give — without reading a single record.
|
|
23
|
+
const emptyRegistry = () => ({
|
|
24
|
+
bySlug: new Map(),
|
|
25
|
+
objectsBySlug: new Map(),
|
|
26
|
+
entitiesByFile: new Map(),
|
|
27
|
+
});
|
|
28
|
+
exports.emptyRegistry = emptyRegistry;
|
|
29
|
+
// One file's summary, handed to the registry: no parse, only grouping. The pieces
|
|
30
|
+
// are not in a summary (they are the bulk of the index), so `bySlug` stays empty
|
|
31
|
+
// until `addPieces` is called — which a run does only when a rule names a code
|
|
32
|
+
// entity, the same condition that makes the checks ask for `entityScope`.
|
|
33
|
+
const addSummary = (index, abs, rel, summary) => {
|
|
34
|
+
for (const object of summary.objects)
|
|
35
|
+
(0, group_1.pushGroup)(index.objectsBySlug, object.entity, { ...object, path: abs });
|
|
36
|
+
index.entitiesByFile.set(rel, new Set(summary.entities));
|
|
37
|
+
};
|
|
38
|
+
exports.addSummary = addSummary;
|
|
39
|
+
// One file's classified pieces, for the `entity` scope: the owners of names, keyed
|
|
40
|
+
// by entity, exactly the grouping the unfiled pass builds from the same list.
|
|
41
|
+
const addPieces = (index, candidates) => {
|
|
42
|
+
for (const candidate of candidates) {
|
|
43
|
+
if (candidate.entity)
|
|
44
|
+
(0, group_1.pushGroup)(index.bySlug, candidate.entity, candidate);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.addPieces = addPieces;
|
|
48
|
+
// The project-wide index as the INDEX holds it: every file's summary, plus the
|
|
49
|
+
// pieces when a rule names a code entity — the same two sections a scan reads
|
|
50
|
+
// before its checks. The rule path asks about one file at a time and never walks
|
|
51
|
+
// the tree, so this is where its `entity` scope and its objects come from; the run
|
|
52
|
+
// caches the answer by its file list, so a lint session reads these sections once.
|
|
53
|
+
const registryFromIndex = (index, arch, absFiles, repoFiles) => {
|
|
54
|
+
const light = (0, fa_index_1.readLight)(index, absFiles);
|
|
55
|
+
const registry = emptyRegistry();
|
|
56
|
+
for (let at = 0; at < absFiles.length; at += 1) {
|
|
57
|
+
const entry = light.get(absFiles[at]);
|
|
58
|
+
if (entry !== undefined)
|
|
59
|
+
addSummary(registry, absFiles[at], repoFiles[at], entry.summary);
|
|
60
|
+
}
|
|
61
|
+
if ((0, facts_record_1.namesCodeEntity)(arch.rules)) {
|
|
62
|
+
for (const list of (0, fa_index_1.readPeers)(index, (0, fa_index_1.pieceFiles)(light, (0, rules_1.namedEntitySlugs)(arch.rules))).values())
|
|
63
|
+
addPieces(registry, list);
|
|
64
|
+
}
|
|
65
|
+
return registry;
|
|
66
|
+
};
|
|
67
|
+
exports.registryFromIndex = registryFromIndex;
|
|
68
|
+
// One file's record as a run needs it before checking: facts, classified pieces,
|
|
69
|
+
// the literals' places. The syntax is released on the way out — facts, objects and
|
|
70
|
+
// the templates' positions are what a check needs, never the tree.
|
|
71
|
+
const readOne = (abs, run, project) => {
|
|
72
|
+
const record = (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles });
|
|
73
|
+
// Classify NOW, not in the scan pass: the project-wide index is rebuilt from
|
|
74
|
+
// these values before any file is checked, and it is the entity of a piece that
|
|
75
|
+
// decides which entity owns which object literal.
|
|
76
|
+
const classified = (0, classify_1.classifyEntities)(record.candidates, run.arch.entities, run.arch, record.facts);
|
|
77
|
+
record.candidates = classified.candidates;
|
|
78
|
+
record.facts.entities = [...new Set(classified.present)];
|
|
79
|
+
const sf = project.getSourceFile(abs) ?? null;
|
|
80
|
+
record.objects = (0, project_1.fileObjects)(sf, classified.candidates);
|
|
81
|
+
if (sf !== null)
|
|
82
|
+
(0, release_file_1.releaseFile)(sf);
|
|
83
|
+
return record;
|
|
84
|
+
};
|
|
85
|
+
exports.readOne = readOne;
|
|
86
|
+
// The record this check reads: read again by this run, stored by an earlier one, or
|
|
87
|
+
// — when the index may not be written — still held by the extraction. A record that
|
|
88
|
+
// cannot be read back at all is read again here rather than losing the answer.
|
|
89
|
+
const recordFor = (args, abs) => args.kept.get(abs) ?? (0, fa_index_1.recordAt)(args.index, abs) ?? readOne(abs, args.run, (0, scan_run_1.wholeRepoProject)());
|
|
90
|
+
exports.recordFor = recordFor;
|
|
91
|
+
// The live project answers the lookalike layer, and only about a file this run
|
|
92
|
+
// read again: a stored record was checked against the syntax of its own run.
|
|
93
|
+
// The lookalike nodes are the one answer this run may not be able to ask for:
|
|
94
|
+
// without a project they come from the verdicts stored with the record.
|
|
95
|
+
const nodesOf = (project, parts, stored) => project === null ? stored : parts.nodes;
|
|
96
|
+
// The verdicts, stored where the next run reads them: the light section.
|
|
97
|
+
const storeVerdict = (args, file, record, parts) => {
|
|
98
|
+
const summary = file.entry?.summary ?? (0, fa_values_1.summaryOf)(record);
|
|
99
|
+
const verdict = { findings: parts, notices: [...record.notices], summary };
|
|
100
|
+
args.light.set(file.abs, verdict);
|
|
101
|
+
return (0, fa_index_1.keepVerdict)(args.index, file.abs, verdict);
|
|
102
|
+
};
|
|
103
|
+
// Check one file against the state of this run. The record is dropped with the
|
|
104
|
+
// chunk it was read in: a check reads its OWN record and the registry (`bySlug`,
|
|
105
|
+
// objects, entities per file), never another file's facts.
|
|
106
|
+
const checkOne = (args, file, findings) => {
|
|
107
|
+
const { run, projectOpen, index } = args;
|
|
108
|
+
const record = recordFor(args, file.abs);
|
|
109
|
+
const project = projectOpen ? (0, scan_run_1.wholeRepoProject)() : null;
|
|
110
|
+
// The file's record already carries its literals' places, and its checker
|
|
111
|
+
// answers come from the run's usage pass: nothing here needs this file's syntax.
|
|
112
|
+
const usage = index === null ? null : (0, fa_index_1.usageAt)(index, file.abs);
|
|
113
|
+
const stored = file.entry?.findings?.nodes ?? [];
|
|
114
|
+
const parts = (0, facts_record_1.checkRecord)(record, {
|
|
115
|
+
arch: run.arch,
|
|
116
|
+
project,
|
|
117
|
+
repoFiles: run.repoFiles,
|
|
118
|
+
dedupe: run.dedupe,
|
|
119
|
+
sf: null,
|
|
120
|
+
usage,
|
|
121
|
+
});
|
|
122
|
+
findings.push(...parts.before, ...nodesOf(project, parts, stored), ...parts.after);
|
|
123
|
+
return storeVerdict(args, file, record, parts);
|
|
124
|
+
};
|
|
125
|
+
exports.checkOne = checkOne;
|
|
126
|
+
// The buffer's own syntax, in a project of its own: the run's project holds the
|
|
127
|
+
// files as they are on disk, and rewriting one of them would answer for the others
|
|
128
|
+
// with text nobody saved.
|
|
129
|
+
const bufferProject = (abs, text, arch) => {
|
|
130
|
+
const project = (0, ast_1.createTsProject)({ repoRoot: arch.repoRoot ?? ".", aliases: arch.aliases });
|
|
131
|
+
(0, ast_1.loadSourceFile)(project, abs, text);
|
|
132
|
+
return project;
|
|
133
|
+
};
|
|
134
|
+
// The file's own syntax, in a project of its own: `buffer` is text the index has
|
|
135
|
+
// never seen, and rewriting the run's project would answer for the others with it.
|
|
136
|
+
const fromBuffer = (abs, text, run) => {
|
|
137
|
+
const project = bufferProject(abs, text, run.arch);
|
|
138
|
+
return {
|
|
139
|
+
record: (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles, text }),
|
|
140
|
+
project,
|
|
141
|
+
source: project.getSourceFile(abs) ?? null,
|
|
142
|
+
fromDisk: false,
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
// The project a file without a record is read in. A run that already opened the
|
|
146
|
+
// whole repo (the scan, or the lookalike question) reuses it — the CLI pays
|
|
147
|
+
// nothing new. A rule on one file builds that file's own closure instead: the
|
|
148
|
+
// files its syntax reaches, which is what its css values and its parameter types
|
|
149
|
+
// are answered from, without the repo-wide parse that made the first check after
|
|
150
|
+
// an edit take seconds. With no index at all the checker's own answers (who calls
|
|
151
|
+
// a name) have to come from a project holding the repo — a closure would answer
|
|
152
|
+
// "nobody" for a helper the rest of the repo calls — so the whole one opens, as
|
|
153
|
+
// it always did.
|
|
154
|
+
const projectFor = (abs, run) => {
|
|
155
|
+
const open = (0, scan_run_1.openWholeRepoProject)();
|
|
156
|
+
if (open !== null)
|
|
157
|
+
return open;
|
|
158
|
+
if (run.index === null)
|
|
159
|
+
return (0, scan_run_1.wholeRepoProject)();
|
|
160
|
+
return (0, closure_project_1.openClosure)(abs, run.arch, run.repoFiles);
|
|
161
|
+
};
|
|
162
|
+
const loadOne = (abs, run, buffer) => {
|
|
163
|
+
if (buffer !== undefined && buffer !== null)
|
|
164
|
+
return fromBuffer(abs, buffer, run);
|
|
165
|
+
const fromIndex = run.index === null ? null : (0, fa_index_1.recordAt)(run.index, abs);
|
|
166
|
+
// The record answers on its own; only a file this index cannot answer for is
|
|
167
|
+
// read, and in a project of its own closure.
|
|
168
|
+
if (fromIndex !== null)
|
|
169
|
+
return { record: fromIndex, project: null, source: null, fromDisk: true };
|
|
170
|
+
const project = projectFor(abs, run);
|
|
171
|
+
return {
|
|
172
|
+
record: (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles }),
|
|
173
|
+
project,
|
|
174
|
+
source: project.getSourceFile(abs) ?? null,
|
|
175
|
+
fromDisk: true,
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
// THE ONE-FILE PATH (the ESLint rule): the answer for THIS file, from a record when
|
|
179
|
+
// the index has a fresh one and from its syntax when it does not. `sf` is that
|
|
180
|
+
// syntax, handed in by the caller because the rule may hold the editor's buffer
|
|
181
|
+
// instead of the file on disk; the checker's answers are asked here, on it, when
|
|
182
|
+
// the index has none stored.
|
|
183
|
+
// THE RULE ONLY READS. A record derived here answers for the project it was derived
|
|
184
|
+
// in — a file's closure, or the editor's buffer — and the CLI's warm run must never
|
|
185
|
+
// replay such an answer as if the whole repo had given it: `off` would stop matching
|
|
186
|
+
// `warm` depending on what was edited in which order. Writing the index stays the
|
|
187
|
+
// CLI's alone, so the file the CLI wrote is the file every reader meets.
|
|
188
|
+
// The scan already answered this file, and the index still holds that answer:
|
|
189
|
+
// the verdict IS the answer. Re-deriving it here would ask the questions that
|
|
190
|
+
// needed the project (the lookalike folder, an object literal's resolution)
|
|
191
|
+
// again — without one, the answer would quietly be a different one.
|
|
192
|
+
const replayed = (abs, run, buffer) => {
|
|
193
|
+
if (buffer !== undefined && buffer !== null)
|
|
194
|
+
return null;
|
|
195
|
+
const stored = run.index === null ? null : (0, fa_index_1.lightAt)(run.index, abs);
|
|
196
|
+
if (stored === null || stored.findings === null)
|
|
197
|
+
return null;
|
|
198
|
+
(0, notices_1.replayNotices)(stored.notices);
|
|
199
|
+
return [...stored.findings.before, ...stored.findings.nodes, ...stored.findings.after];
|
|
200
|
+
};
|
|
201
|
+
const checkIndexed = (abs, run, buffer) => {
|
|
202
|
+
const answer = replayed(abs, run, buffer);
|
|
203
|
+
if (answer !== null)
|
|
204
|
+
return answer;
|
|
205
|
+
const loaded = loadOne(abs, run, buffer);
|
|
206
|
+
const parts = (0, facts_record_1.checkRecord)(loaded.record, {
|
|
207
|
+
arch: run.arch,
|
|
208
|
+
project: loaded.project,
|
|
209
|
+
repoFiles: run.repoFiles,
|
|
210
|
+
dedupe: run.dedupe,
|
|
211
|
+
sf: loaded.source,
|
|
212
|
+
usage: run.index === null ? null : (0, fa_index_1.usageAt)(run.index, abs),
|
|
213
|
+
});
|
|
214
|
+
if (!loaded.fromDisk && loaded.source !== null)
|
|
215
|
+
(0, release_file_1.releaseFile)(loaded.source);
|
|
216
|
+
return [...parts.before, ...parts.nodes, ...parts.after];
|
|
217
|
+
};
|
|
218
|
+
exports.checkIndexed = checkIndexed;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ScanScope } from "./fa-index";
|
|
2
|
+
import type { Arch } from "./entities/architecture";
|
|
3
|
+
import type { Finding } from "./entities/findings";
|
|
4
|
+
import type { SeenStore } from "./utils/seen";
|
|
5
|
+
type RunArgs = {
|
|
6
|
+
arch: Arch;
|
|
7
|
+
repoFiles: string[];
|
|
8
|
+
absFiles: readonly string[];
|
|
9
|
+
scope: ScanScope;
|
|
10
|
+
option: string | boolean | null | undefined;
|
|
11
|
+
dedupe: SeenStore;
|
|
12
|
+
shouldCheck?: ((abs: string) => boolean) | null;
|
|
13
|
+
usage?: string;
|
|
14
|
+
};
|
|
15
|
+
type RunStats = {
|
|
16
|
+
mode: "warm" | "hybrid" | "cold";
|
|
17
|
+
stale: number;
|
|
18
|
+
zone: number;
|
|
19
|
+
extracted: number;
|
|
20
|
+
written: number;
|
|
21
|
+
bytes: number;
|
|
22
|
+
chunks: number;
|
|
23
|
+
compactions: number;
|
|
24
|
+
pruned: number;
|
|
25
|
+
warning: string | null;
|
|
26
|
+
compactionWarning: string | null;
|
|
27
|
+
usageFiles: number;
|
|
28
|
+
usageNames: number;
|
|
29
|
+
projectsOpened: number;
|
|
30
|
+
checksProjects: number;
|
|
31
|
+
};
|
|
32
|
+
type RunOut = {
|
|
33
|
+
findings: Finding[];
|
|
34
|
+
stats: RunStats;
|
|
35
|
+
};
|
|
36
|
+
declare const runIndexed: (run: RunArgs) => RunOut | null;
|
|
37
|
+
export { runIndexed };
|
|
38
|
+
export { checkIndexed, registryFromIndex } from "./index-file";
|
|
39
|
+
export type { RunArgs, RunOut, RunStats };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registryFromIndex = exports.checkIndexed = exports.runIndexed = void 0;
|
|
4
|
+
// A SCAN THAT READS ITS OWN PAST: what a run can answer from the file index, what
|
|
5
|
+
// it has to ask the syntax again, and how the two are stitched back into one
|
|
6
|
+
// answer.
|
|
7
|
+
//
|
|
8
|
+
// THE ORDER OF A RUN (any mode):
|
|
9
|
+
// 1. read the LIGHT section (`fa-out`) of every scanned file: the summary — the
|
|
10
|
+
// classified pieces, the literals' places, the entities, the deps — and the
|
|
11
|
+
// verdicts an earlier run derived. Small (a few MB over a whole repo) and
|
|
12
|
+
// the only thing a warm run reads;
|
|
13
|
+
// 2. the zone is what must be read again — see `index-zone.ts` for what makes a
|
|
14
|
+
// summary stale and how far a change reaches;
|
|
15
|
+
// 3. the project-wide entity index is rebuilt from the SUMMARIES: every summary
|
|
16
|
+
// carries the classified pieces and the object-literal places of its file, so
|
|
17
|
+
// the pass over every file's syntax does not happen at all;
|
|
18
|
+
// 4. the zone is read again and written back in chunks: its record goes to `fa`,
|
|
19
|
+
// its summary to `fa-out`, and the objects are dropped as each chunk lands —
|
|
20
|
+
// a cold run never holds the records of the files it has already read;
|
|
21
|
+
// 5. one pass in scan order answers every file: a file whose verdicts are stored
|
|
22
|
+
// and whose facts did not change is REPLAYED from `fa-out` (nothing is read
|
|
23
|
+
// twice), a file in the zone is read back from `fa`, checked, and its verdicts
|
|
24
|
+
// written into `fa-out` alone — the record it was checked from is dropped as
|
|
25
|
+
// its chunk goes by.
|
|
26
|
+
//
|
|
27
|
+
// WHY THE VERDICTS ARE STORED: everything except the lookalike question is a pure
|
|
28
|
+
// function of one record plus the run's shared state, so replaying it from the
|
|
29
|
+
// index would replay findings that were deduped per PLACE (`dedupeBy`) against a
|
|
30
|
+
// population that no longer exists — the first file of a place wins, and editing a
|
|
31
|
+
// file can change the winner. That is why a file whose facts changed is checked
|
|
32
|
+
// together with everything the change can reach (the zone): a stored verdict is
|
|
33
|
+
// the answer its own facts gave, and the zone is the boundary of what a change
|
|
34
|
+
// invalidates.
|
|
35
|
+
const fa_index_1 = require("./fa-index");
|
|
36
|
+
const rules_1 = require("./rules");
|
|
37
|
+
const facts_record_1 = require("./facts-record");
|
|
38
|
+
const scan_run_1 = require("./scan-run");
|
|
39
|
+
const notices_1 = require("./report/notices");
|
|
40
|
+
const index_zone_1 = require("./index-zone");
|
|
41
|
+
const usage_pass_1 = require("./usage-pass");
|
|
42
|
+
const usage_prepare_1 = require("./usage-prepare");
|
|
43
|
+
const index_file_1 = require("./index-file");
|
|
44
|
+
const fa_values_1 = require("./fa-values");
|
|
45
|
+
// A record is read on the SAME project the checks use — the whole repo. Every
|
|
46
|
+
// fact that depends on type resolution (`parameters[].type`, an assignment's
|
|
47
|
+
// presence, a call's resolved module) has one answer per program, and a project
|
|
48
|
+
// holding only part of the repo gives a different one: `--index off` would then
|
|
49
|
+
// report findings the index cannot reproduce. The chunked project this run used
|
|
50
|
+
// before is gone for that reason.
|
|
51
|
+
const extractZone = (args, zone) => {
|
|
52
|
+
const { run, index, light, kept, registry, pieces } = args;
|
|
53
|
+
let extracted = 0;
|
|
54
|
+
for (const rel of zone) {
|
|
55
|
+
const abs = args.absOf.get(rel);
|
|
56
|
+
if (abs === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
const record = (0, facts_record_1.slimmable)((0, index_file_1.readOne)(abs, run, (0, scan_run_1.wholeRepoProject)()));
|
|
59
|
+
extracted += 1;
|
|
60
|
+
const summary = (0, fa_values_1.summaryOf)(record);
|
|
61
|
+
(0, index_file_1.addSummary)(registry, abs, record.rel, summary);
|
|
62
|
+
if (pieces)
|
|
63
|
+
(0, index_file_1.addPieces)(registry, record.candidates);
|
|
64
|
+
const fresh = { findings: null, notices: [...record.notices], summary };
|
|
65
|
+
// The lookalike answer of a fresh file is asked live in the scan pass; the
|
|
66
|
+
// verdicts are written there, once they exist.
|
|
67
|
+
if (!(0, fa_index_1.keepFacts)(index, abs, record, fresh))
|
|
68
|
+
kept.set(abs, record);
|
|
69
|
+
light.set(abs, fresh);
|
|
70
|
+
}
|
|
71
|
+
return extracted;
|
|
72
|
+
};
|
|
73
|
+
// Nothing to recompute: the verdicts of this file were derived from these very
|
|
74
|
+
// facts in an earlier run, and the zone says no change reached it.
|
|
75
|
+
const replayStored = (entry, findings) => {
|
|
76
|
+
if (entry === undefined || entry.findings === null)
|
|
77
|
+
return false;
|
|
78
|
+
(0, notices_1.replayNotices)(entry.notices);
|
|
79
|
+
findings.push(...entry.findings.before, ...entry.findings.nodes, ...entry.findings.after);
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
// One file, checked and — when this run read it again or its verdicts are missing
|
|
83
|
+
// — written back at once.
|
|
84
|
+
const scanOne = (args, at, findings) => {
|
|
85
|
+
const { run, light, absFiles, live } = args;
|
|
86
|
+
const abs = absFiles[at];
|
|
87
|
+
const entry = light.get(abs);
|
|
88
|
+
// A file outside `--files` is not checked, but what its READING could not read
|
|
89
|
+
// is still part of the report — the light value carries those lines.
|
|
90
|
+
if (run.shouldCheck && !run.shouldCheck(abs)) {
|
|
91
|
+
(0, notices_1.replayNotices)(entry?.notices ?? []);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const fresh = live.has(run.repoFiles[at]);
|
|
95
|
+
if (!fresh && replayStored(entry, findings))
|
|
96
|
+
return false;
|
|
97
|
+
return (0, index_file_1.checkOne)(args, { abs, entry, fresh }, findings);
|
|
98
|
+
};
|
|
99
|
+
// The scan itself: one pass in scan order, so the dedupe store, the folder
|
|
100
|
+
// counters and the entity scope see every file in the order a cold run saw them —
|
|
101
|
+
// and the index is opened once per chunk of files, not once per file.
|
|
102
|
+
const scanAll = (args) => {
|
|
103
|
+
const findings = [];
|
|
104
|
+
let written = 0;
|
|
105
|
+
(0, fa_index_1.scanChunks)(args.index, args.absFiles, (from, to) => {
|
|
106
|
+
for (let at = from; at < to; at += 1)
|
|
107
|
+
if (scanOne(args, at, findings))
|
|
108
|
+
written += 1;
|
|
109
|
+
});
|
|
110
|
+
return { findings, written };
|
|
111
|
+
};
|
|
112
|
+
const modeOf = (stale, zone, total) => {
|
|
113
|
+
if (stale === 0)
|
|
114
|
+
return "warm";
|
|
115
|
+
return zone >= total ? "cold" : "hybrid";
|
|
116
|
+
};
|
|
117
|
+
// The project-wide index, from the summaries: the answers a check gives about
|
|
118
|
+
// OTHER files. The `entity` scope is the one question about other files' PIECES:
|
|
119
|
+
// asked for by the same predicate that makes the checks read them, so a config
|
|
120
|
+
// that never names a code entity never decodes a file it does not check — and a
|
|
121
|
+
// config that names one decodes only the files that have it.
|
|
122
|
+
const lightIndex = (args) => {
|
|
123
|
+
const { index, light, absFiles, repoFiles, arch } = args;
|
|
124
|
+
const registry = (0, index_file_1.emptyRegistry)();
|
|
125
|
+
for (let at = 0; at < absFiles.length; at += 1) {
|
|
126
|
+
const entry = light.get(absFiles[at]);
|
|
127
|
+
if (entry !== undefined)
|
|
128
|
+
(0, index_file_1.addSummary)(registry, absFiles[at], repoFiles[at], entry.summary);
|
|
129
|
+
}
|
|
130
|
+
const pieces = (0, facts_record_1.namesCodeEntity)(arch.rules);
|
|
131
|
+
if (pieces) {
|
|
132
|
+
for (const list of (0, fa_index_1.readPeers)(index, (0, fa_index_1.pieceFiles)(light, (0, rules_1.namedEntitySlugs)(arch.rules))).values())
|
|
133
|
+
(0, index_file_1.addPieces)(registry, list);
|
|
134
|
+
}
|
|
135
|
+
return { registry, pieces, kept: new Map(), known: new Set(light.keys()), depsOf: (abs) => light.get(abs)?.summary.deps ?? [] };
|
|
136
|
+
};
|
|
137
|
+
// null means "this run may not use an index" — the caller then takes the plain
|
|
138
|
+
// path, which remembers nothing and reads every file.
|
|
139
|
+
const runIndexed = (run) => {
|
|
140
|
+
const root = run.arch.repoRoot ?? ".";
|
|
141
|
+
(0, usage_prepare_1.prepareUsage)(run.usage, root, run.repoFiles);
|
|
142
|
+
const index = (0, fa_index_1.openFactsIndex)({ root, option: run.option, arch: run.arch, scope: run.scope });
|
|
143
|
+
if (index === null)
|
|
144
|
+
return null;
|
|
145
|
+
// THE LIGHT PASS: every file's summary and stored verdicts, one decode each. No
|
|
146
|
+
// record is touched, so what a run holds from here on is a few MB, not the repo.
|
|
147
|
+
const light = (0, fa_index_1.readLight)(index, run.absFiles);
|
|
148
|
+
const absOf = new Map(run.repoFiles.map((rel, at) => [rel, run.absFiles[at]]));
|
|
149
|
+
const { zone, stale } = (0, index_zone_1.zoneOf)({ index, light, absFiles: run.absFiles, repoFiles: run.repoFiles, root });
|
|
150
|
+
const { registry, pieces, kept, known, depsOf } = lightIndex({ index, light, absFiles: run.absFiles, repoFiles: run.repoFiles, arch: run.arch });
|
|
151
|
+
const zoneArgs = { run, index, light, pieces, kept, registry, absOf };
|
|
152
|
+
let extracted = extractZone(zoneArgs, zone);
|
|
153
|
+
extracted += (0, index_zone_1.extendZone)({ zone, known, depsOf, absOf, repoFiles: run.repoFiles }, (paths) => extractZone(zoneArgs, paths));
|
|
154
|
+
// The depth cache answers a question about a file's TEXT, and every answer is
|
|
155
|
+
// already in a record: dropped here, so the scan pass does not keep the
|
|
156
|
+
// candidates of every file the extraction happened to look at.
|
|
157
|
+
delete run.arch.depthCache;
|
|
158
|
+
// Everything extracted is on disk before the checks read it back.
|
|
159
|
+
(0, fa_index_1.settle)(index);
|
|
160
|
+
// THE CHECKER'S ANSWERS, asked once: one project over the whole repo, the zone's
|
|
161
|
+
// published names only. The records in the zone carry no answer yet; every later
|
|
162
|
+
// check of them reads one from the index instead of opening a project.
|
|
163
|
+
const usage = (0, usage_pass_1.runUsagePass)({ run, index, zone, absOf });
|
|
164
|
+
// The answers are on disk before the first check reads one: a chunk that reads
|
|
165
|
+
// the section would otherwise see a value still queued in this process.
|
|
166
|
+
(0, fa_index_1.settle)(index);
|
|
167
|
+
// A file whose facts are stored but whose verdicts never landed (a run that
|
|
168
|
+
// stopped between the two) is checked without being read again.
|
|
169
|
+
const partial = [...light.values()].some((entry) => entry.findings === null);
|
|
170
|
+
(0, scan_run_1.adoptEntityIndex)(registry);
|
|
171
|
+
// Counted from here: a project built AFTER this point would be a second parse of
|
|
172
|
+
// the repo for a question the pass has already answered.
|
|
173
|
+
const beforeChecks = (0, scan_run_1.projectsOpened)();
|
|
174
|
+
const scanned = scanAll({
|
|
175
|
+
run,
|
|
176
|
+
index,
|
|
177
|
+
light,
|
|
178
|
+
kept,
|
|
179
|
+
absFiles: run.absFiles,
|
|
180
|
+
live: zone,
|
|
181
|
+
// The lookalike question and the css templates a re-read file carries are the
|
|
182
|
+
// two things that still need syntax in the checks; the checker's answers are
|
|
183
|
+
// already stored and read as data.
|
|
184
|
+
projectOpen: zone.size > 0 || partial,
|
|
185
|
+
});
|
|
186
|
+
const done = (0, fa_index_1.finish)(index);
|
|
187
|
+
// A run that has the whole file list is the one that can tombstone the rest.
|
|
188
|
+
const pruned = (0, fa_index_1.prune)(index, run.absFiles);
|
|
189
|
+
(0, scan_run_1.adoptEntityIndex)(null);
|
|
190
|
+
return {
|
|
191
|
+
findings: scanned.findings,
|
|
192
|
+
stats: {
|
|
193
|
+
mode: modeOf(stale, zone.size, run.repoFiles.length),
|
|
194
|
+
stale,
|
|
195
|
+
zone: zone.size,
|
|
196
|
+
extracted,
|
|
197
|
+
written: scanned.written,
|
|
198
|
+
bytes: done.bytes,
|
|
199
|
+
chunks: done.chunks,
|
|
200
|
+
compactions: done.compactions,
|
|
201
|
+
pruned: pruned.dropped,
|
|
202
|
+
warning: done.warning,
|
|
203
|
+
// The names the usage pass stored an answer for, and those that are not null.
|
|
204
|
+
usageFiles: usage.files,
|
|
205
|
+
usageNames: usage.answered,
|
|
206
|
+
// Whole-repo projects this run built, and how many of them the checks built.
|
|
207
|
+
projectsOpened: (0, scan_run_1.projectsOpened)(),
|
|
208
|
+
checksProjects: (0, scan_run_1.projectsOpened)() - beforeChecks,
|
|
209
|
+
// Read after the prune: a flush there can be the one that deferred.
|
|
210
|
+
compactionWarning: index.compactionWarning,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
exports.runIndexed = runIndexed;
|
|
215
|
+
var index_file_2 = require("./index-file");
|
|
216
|
+
Object.defineProperty(exports, "checkIndexed", { enumerable: true, get: function () { return index_file_2.checkIndexed; } });
|
|
217
|
+
Object.defineProperty(exports, "registryFromIndex", { enumerable: true, get: function () { return index_file_2.registryFromIndex; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Index, type Light } from "./fa-index";
|
|
2
|
+
declare const MAX_ZONE = 200;
|
|
3
|
+
declare const MAX_FOLDER = 400;
|
|
4
|
+
declare const importersOf: (light: Map<string, Light>, relOf: ReadonlyMap<string, string>) => Map<string, string[]>;
|
|
5
|
+
declare const closureOf: (seeds: readonly string[], edges: readonly ((rel: string) => readonly string[])[], limit: number) => Set<string>;
|
|
6
|
+
declare const extendZone: (args: {
|
|
7
|
+
zone: Set<string>;
|
|
8
|
+
known: ReadonlySet<string>;
|
|
9
|
+
depsOf: (abs: string) => readonly string[];
|
|
10
|
+
absOf: ReadonlyMap<string, string>;
|
|
11
|
+
repoFiles: readonly string[];
|
|
12
|
+
}, extract: (paths: ReadonlySet<string>) => number) => number;
|
|
13
|
+
type ZoneArgs = {
|
|
14
|
+
index: Index;
|
|
15
|
+
light: Map<string, Light>;
|
|
16
|
+
absFiles: readonly string[];
|
|
17
|
+
repoFiles: readonly string[];
|
|
18
|
+
root: string;
|
|
19
|
+
};
|
|
20
|
+
declare const zoneOf: (args: ZoneArgs) => {
|
|
21
|
+
zone: Set<string>;
|
|
22
|
+
stale: number;
|
|
23
|
+
};
|
|
24
|
+
export { zoneOf, importersOf, closureOf, extendZone, MAX_ZONE, MAX_FOLDER };
|
|
25
|
+
export type { ZoneArgs };
|