@cplieger/deadset-ts 8.0.0-dev.2 → 8.0.0-dev.21
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/README.md +3 -1
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/bin/mapper-connection.js +2 -1
- package/dist/bin/node-host.js +24 -5
- package/dist/src/alias-chain.js +35 -9
- package/dist/src/amd.js +81 -0
- package/dist/src/analysis.js +274 -496
- package/dist/src/augmentations.js +64 -3
- package/dist/src/automatic-types.js +10 -29
- package/dist/src/bindings.js +382 -0
- package/dist/src/commands/held.js +499 -0
- package/dist/src/commands/read.js +161 -0
- package/dist/src/commands/shell.js +169 -0
- package/dist/src/commands/tools.js +1847 -0
- package/dist/src/component-files.js +3 -2
- package/dist/src/component-layer.js +4 -2
- package/dist/src/config.js +6 -82
- package/dist/src/conformance-record.js +2 -2
- package/dist/src/consumers.js +10 -38
- package/dist/src/contextual-uses.js +57 -26
- package/dist/src/contract/config.generated.js +561 -0
- package/dist/src/contract/contract.generated.js +1370 -0
- package/dist/src/contract/report.generated.js +866 -0
- package/dist/src/dependencies.js +165 -122
- package/dist/src/destructuring.js +1 -19
- package/dist/src/edges.js +38 -122
- package/dist/src/element-access.js +181 -168
- package/dist/src/entries/build-scripts.js +222 -0
- package/dist/src/{configuration-files.js → entries/configuration-files.js} +52 -256
- package/dist/src/{convention-rows.js → entries/convention-rows.js} +170 -30
- package/dist/src/entries/conventions.js +740 -0
- package/dist/src/{html-entries.js → entries/html-entries.js} +12 -42
- package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +5 -28
- package/dist/src/entries/run-directories.js +77 -0
- package/dist/src/entries/sources.js +144 -0
- package/dist/src/entries/static-module.js +670 -0
- package/dist/src/entries/test-runners.js +650 -0
- package/dist/src/entries/workflow-steps.js +345 -0
- package/dist/src/exemptions/argument-places.js +131 -0
- package/dist/src/exemptions/calls.js +338 -0
- package/dist/src/exemptions/classes.js +13 -0
- package/dist/src/{decorator.js → exemptions/decorator.js} +19 -30
- package/dist/src/exemptions/detectors.js +48 -0
- package/dist/src/{enum-group.js → exemptions/enum-group.js} +9 -16
- package/dist/src/{erased-stores.js → exemptions/erased-stores.js} +7 -11
- package/dist/src/{framework-lifecycle.js → exemptions/framework-lifecycle.js} +76 -54
- package/dist/src/exemptions/generated-file.js +241 -0
- package/dist/src/{injection-container.js → exemptions/injection-container.js} +20 -26
- package/dist/src/exemptions/installed-globals.js +173 -0
- package/dist/src/{interface-satisfaction.js → exemptions/interface-satisfaction.js} +52 -121
- package/dist/src/exemptions/lifecycle.js +150 -0
- package/dist/src/{reflective-lookup.js → exemptions/reflective-lookup.js} +3 -3
- package/dist/src/exemptions/serialization-contract.js +1276 -0
- package/dist/src/exemptions/sites.js +182 -0
- package/dist/src/{template-field.js → exemptions/template-field.js} +13 -23
- package/dist/src/{value-reach.js → exemptions/value-reach.js} +14 -7
- package/dist/src/exposure.js +400 -0
- package/dist/src/extensions.js +37 -0
- package/dist/src/facts.js +38 -0
- package/dist/src/failure.js +36 -0
- package/dist/src/file-facts.js +3 -26
- package/dist/src/findings/completion.js +109 -56
- package/dist/src/findings/dependencies-and-module-machinery.js +4 -5
- package/dist/src/findings/emitters.js +27 -41
- package/dist/src/{implementations.js → findings/implementations.js} +3 -3
- package/dist/src/{in-operands.js → findings/in-operands.js} +3 -2
- package/dist/src/findings/interfaces.js +4 -5
- package/dist/src/findings/intra-function.js +16 -13
- package/dist/src/findings/non-code-artifacts.js +17 -12
- package/dist/src/findings/reads-and-writes.js +86 -27
- package/dist/src/findings/self-check.js +44 -30
- package/dist/src/findings/unused-declarations.js +29 -45
- package/dist/src/findings/visibility-narrowing.js +23 -31
- package/dist/src/findings-pass.js +13 -21
- package/dist/src/fs/document.js +52 -0
- package/dist/src/fs/manifest.js +67 -0
- package/dist/src/fs/tree.js +88 -0
- package/dist/src/git-ignore.js +39 -26
- package/dist/src/import-bindings.js +73 -28
- package/dist/src/index/sites.js +557 -0
- package/dist/src/index/values.js +124 -0
- package/dist/src/index.js +2 -2
- package/dist/src/indexed-access.js +523 -478
- package/dist/src/intra-function-parts.js +63 -43
- package/dist/src/inventory/commonjs.js +507 -0
- package/dist/src/inventory/enumerate.js +167 -0
- package/dist/src/inventory/syntax.js +236 -0
- package/dist/src/inventory.js +323 -724
- package/dist/src/javascript-file.js +48 -0
- package/dist/src/json-document.js +198 -67
- package/dist/src/keyof-comparisons.js +126 -107
- package/dist/src/kinds.js +3 -366
- package/dist/src/{components.js → liveness/components.js} +2 -3
- package/dist/src/{graph.js → liveness/graph.js} +52 -28
- package/dist/src/liveness/matrix.js +99 -0
- package/dist/src/liveness/sweep.js +558 -0
- package/dist/src/load/classify.js +289 -0
- package/dist/src/load/diagnostics.js +87 -0
- package/dist/src/load/discover.js +285 -0
- package/dist/src/{emit-map.js → load/emit-map.js} +1 -1
- package/dist/src/load/expected-module.js +136 -0
- package/dist/src/load/load.js +27 -0
- package/dist/src/load/module-lookup.js +37 -0
- package/dist/src/load/package-scope.js +56 -0
- package/dist/src/load/plan.js +313 -0
- package/dist/src/load/specifiers.js +113 -0
- package/dist/src/load/synthesize.js +152 -0
- package/dist/src/load/test-globals.js +207 -0
- package/dist/src/load/test-joins.js +82 -0
- package/dist/src/{workspace-manifests.js → load/workspace-manifests.js} +4 -4
- package/dist/src/{workspace-programs.js → load/workspace-programs.js} +89 -66
- package/dist/src/{workspace-resolution.js → load/workspace-resolution.js} +24 -66
- package/dist/src/{workspace-run.js → load/workspace-run.js} +7 -7
- package/dist/src/{workspace.js → load/workspace.js} +62 -124
- package/dist/src/module-declarations.js +70 -85
- package/dist/src/overrides.js +134 -112
- package/dist/src/partial.js +2 -1
- package/dist/src/paths.js +82 -16
- package/dist/src/platform-calls.js +78 -0
- package/dist/src/platform-symbols.js +134 -0
- package/dist/src/position.js +43 -1
- package/dist/src/print.js +11 -79
- package/dist/src/product.js +13 -0
- package/dist/src/query.js +95 -0
- package/dist/src/ref.js +12 -20
- package/dist/src/references/read-rule.js +1 -0
- package/dist/src/references/read-rules.js +48 -0
- package/dist/src/references/sink.js +237 -0
- package/dist/src/references/sources.js +450 -0
- package/dist/src/references.js +117 -1074
- package/dist/src/report-schema.js +51 -0
- package/dist/src/report.js +57 -41
- package/dist/src/reporters/annotations.js +15 -8
- package/dist/src/reporters/sarif.js +16 -10
- package/dist/src/reporters/template.js +4 -19
- package/dist/src/resolve.js +246 -730
- package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +22 -24
- package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +6 -15
- package/dist/src/roots/manifest.js +216 -0
- package/dist/src/roots/published-reach.js +412 -0
- package/dist/src/roots/root-set.js +487 -0
- package/dist/src/roots/unseen-loads.js +236 -0
- package/dist/src/run.js +66 -77
- package/dist/src/schema.js +320 -343
- package/dist/src/scope.js +38 -115
- package/dist/src/session.js +37 -29
- package/dist/src/source-files.js +6 -10
- package/dist/src/stores.js +4 -2
- package/dist/src/suppress-file.js +25 -28
- package/dist/src/suppress-inline.js +36 -83
- package/dist/src/suppress.js +50 -71
- package/dist/src/symbol-keys.js +92 -88
- package/dist/src/tests/file-class.js +76 -0
- package/dist/src/{outside-tests.js → tests/outside.js} +7 -7
- package/dist/src/{test-support.js → tests/support.js} +5 -12
- package/dist/src/text/compare.js +26 -0
- package/dist/src/text/glob.js +194 -0
- package/dist/src/text/named-files.js +298 -0
- package/dist/src/text/yaml.js +684 -0
- package/dist/src/type-errors.js +11 -232
- package/dist/src/type-parameter-reads.js +178 -139
- package/dist/src/unimplemented-callees.js +262 -242
- package/dist/src/unwrap.js +23 -0
- package/dist/src/usage.js +10 -0
- package/dist/src/vendor/unbash/ansi-c.js +132 -0
- package/dist/src/vendor/unbash/arithmetic-parts.js +37 -0
- package/dist/src/vendor/unbash/arithmetic.js +591 -0
- package/dist/src/vendor/unbash/assignment.js +131 -0
- package/dist/src/vendor/unbash/chars.js +48 -0
- package/dist/src/vendor/unbash/command.js +41 -0
- package/dist/src/vendor/unbash/expansion.js +80 -0
- package/dist/src/vendor/unbash/glob.js +268 -0
- package/dist/src/vendor/unbash/heredoc.js +27 -0
- package/dist/src/vendor/unbash/internal-types.js +1 -0
- package/dist/src/vendor/unbash/lexer.js +4274 -0
- package/dist/src/vendor/unbash/limits.js +3 -0
- package/dist/src/vendor/unbash/parser.js +1366 -0
- package/dist/src/vendor/unbash/parts.js +57 -0
- package/dist/src/vendor/unbash/substitution-context.js +8 -0
- package/dist/src/vendor/unbash/traversal.js +212 -0
- package/dist/src/vendor/unbash/types.js +1 -0
- package/dist/src/vendor/unbash/word-value.js +61 -0
- package/dist/src/vendor/unbash/word.js +40 -0
- package/dist/src/verbs/analyze.js +194 -127
- package/dist/src/verbs/describe.js +13 -18
- package/dist/src/verbs/explain.js +85 -139
- package/dist/src/verbs/print-config.js +2 -1
- package/dist/src/verbs/print-projects.js +6 -4
- package/dist/src/verbs/print-retained.js +30 -6
- package/dist/src/verbs/print-roots.js +4 -2
- package/dist/src/verbs/verb.js +1 -5
- package/dist/src/verbs/version.js +14 -3
- package/jsr.json +2 -1
- package/package.json +14 -8
- package/src/alias-chain.ts +40 -11
- package/src/amd.ts +130 -0
- package/src/analysis.ts +426 -733
- package/src/augmentations.ts +93 -4
- package/src/automatic-types.ts +12 -30
- package/src/bindings.ts +460 -0
- package/src/commands/held.ts +632 -0
- package/src/commands/read.ts +242 -0
- package/src/commands/shell.ts +228 -0
- package/src/commands/tools.ts +2382 -0
- package/src/component-files.ts +4 -2
- package/src/component-layer.ts +4 -2
- package/src/config.ts +31 -302
- package/src/conformance-record.ts +2 -2
- package/src/consumers.ts +16 -66
- package/src/contextual-uses.ts +66 -34
- package/src/contract/config.generated.ts +821 -0
- package/src/contract/contract.generated.ts +1453 -0
- package/src/contract/report.generated.ts +1241 -0
- package/src/dependencies.ts +223 -128
- package/src/destructuring.ts +1 -31
- package/src/edges.ts +41 -140
- package/src/element-access.ts +190 -187
- package/src/entries/build-scripts.ts +292 -0
- package/src/{configuration-files.ts → entries/configuration-files.ts} +68 -278
- package/src/{convention-rows.ts → entries/convention-rows.ts} +227 -31
- package/src/{conventions.ts → entries/conventions.ts} +367 -583
- package/src/{html-entries.ts → entries/html-entries.ts} +22 -48
- package/src/{mdx-entries.ts → entries/mdx-entries.ts} +7 -30
- package/src/entries/run-directories.ts +108 -0
- package/src/entries/sources.ts +266 -0
- package/src/entries/static-module.ts +858 -0
- package/src/entries/test-runners.ts +835 -0
- package/src/entries/workflow-steps.ts +432 -0
- package/src/exemptions/argument-places.ts +198 -0
- package/src/exemptions/calls.ts +483 -0
- package/src/exemptions/classes.ts +49 -0
- package/src/exemptions/decorator.ts +56 -0
- package/src/exemptions/detectors.ts +75 -0
- package/src/{enum-group.ts → exemptions/enum-group.ts} +10 -19
- package/src/{erased-stores.ts → exemptions/erased-stores.ts} +7 -14
- package/src/{framework-lifecycle.ts → exemptions/framework-lifecycle.ts} +85 -66
- package/src/exemptions/generated-file.ts +318 -0
- package/src/{injection-container.ts → exemptions/injection-container.ts} +29 -34
- package/src/exemptions/installed-globals.ts +255 -0
- package/src/{interface-satisfaction.ts → exemptions/interface-satisfaction.ts} +69 -160
- package/src/exemptions/lifecycle.ts +286 -0
- package/src/{reflective-lookup.ts → exemptions/reflective-lookup.ts} +5 -5
- package/src/exemptions/serialization-contract.ts +1729 -0
- package/src/exemptions/sites.ts +293 -0
- package/src/{template-field.ts → exemptions/template-field.ts} +22 -32
- package/src/{value-reach.ts → exemptions/value-reach.ts} +16 -8
- package/src/exposure.ts +492 -0
- package/src/extensions.ts +45 -0
- package/src/facts.ts +46 -0
- package/src/failure.ts +63 -0
- package/src/file-facts.ts +15 -25
- package/src/finding.ts +10 -10
- package/src/findings/boundary.ts +11 -0
- package/src/findings/completion.ts +133 -64
- package/src/findings/dependencies-and-module-machinery.ts +4 -7
- package/src/findings/emitter.ts +9 -10
- package/src/findings/emitters.ts +38 -52
- package/src/{implementations.ts → findings/implementations.ts} +4 -4
- package/src/{in-operands.ts → findings/in-operands.ts} +4 -3
- package/src/findings/interfaces.ts +7 -9
- package/src/findings/intra-function.ts +16 -14
- package/src/findings/non-code-artifacts.ts +24 -15
- package/src/findings/reads-and-writes.ts +118 -41
- package/src/findings/self-check.ts +51 -38
- package/src/findings/unused-declarations.ts +31 -49
- package/src/findings/visibility-narrowing.ts +36 -40
- package/src/findings-pass.ts +15 -31
- package/src/fs/document.ts +70 -0
- package/src/fs/manifest.ts +96 -0
- package/src/fs/tree.ts +110 -0
- package/src/git-ignore.ts +50 -26
- package/src/host.ts +12 -5
- package/src/import-bindings.ts +98 -29
- package/src/index/sites.ts +781 -0
- package/src/index/values.ts +170 -0
- package/src/index.ts +2 -2
- package/src/indexed-access.ts +570 -527
- package/src/intra-function-parts.ts +73 -44
- package/src/inventory/commonjs.ts +696 -0
- package/src/inventory/enumerate.ts +203 -0
- package/src/inventory/syntax.ts +311 -0
- package/src/inventory.ts +442 -895
- package/src/javascript-file.ts +54 -0
- package/src/json-document.ts +241 -76
- package/src/keyof-comparisons.ts +133 -122
- package/src/kinds.ts +5 -413
- package/src/{components.ts → liveness/components.ts} +4 -6
- package/src/{graph.ts → liveness/graph.ts} +100 -35
- package/src/liveness/matrix.ts +162 -0
- package/src/liveness/sweep.ts +855 -0
- package/src/load/classify.ts +433 -0
- package/src/load/diagnostics.ts +154 -0
- package/src/load/discover.ts +471 -0
- package/src/{emit-map.ts → load/emit-map.ts} +1 -1
- package/src/load/expected-module.ts +194 -0
- package/src/load/load.ts +73 -0
- package/src/load/module-lookup.ts +50 -0
- package/src/load/package-scope.ts +74 -0
- package/src/load/plan.ts +513 -0
- package/src/load/specifiers.ts +171 -0
- package/src/load/synthesize.ts +230 -0
- package/src/load/test-globals.ts +251 -0
- package/src/load/test-joins.ts +98 -0
- package/src/{workspace-manifests.ts → load/workspace-manifests.ts} +5 -5
- package/src/{workspace-programs.ts → load/workspace-programs.ts} +128 -85
- package/src/{workspace-resolution.ts → load/workspace-resolution.ts} +41 -77
- package/src/{workspace-run.ts → load/workspace-run.ts} +18 -16
- package/src/{workspace.ts → load/workspace.ts} +90 -134
- package/src/module-declarations.ts +74 -98
- package/src/overrides.ts +162 -134
- package/src/partial.ts +3 -2
- package/src/paths.ts +92 -16
- package/src/platform-calls.ts +119 -0
- package/src/platform-symbols.ts +189 -0
- package/src/position.ts +44 -1
- package/src/print.ts +12 -92
- package/src/product.ts +18 -0
- package/src/query.ts +201 -10
- package/src/ref.ts +12 -20
- package/src/references/read-rule.ts +60 -0
- package/src/references/read-rules.ts +55 -0
- package/src/references/sink.ts +314 -0
- package/src/references/sources.ts +632 -0
- package/src/references.ts +187 -1450
- package/src/report-schema.ts +68 -0
- package/src/report.ts +103 -226
- package/src/reporters/annotations.ts +22 -11
- package/src/reporters/json.ts +1 -1
- package/src/reporters/reporter.ts +2 -4
- package/src/reporters/reporters.ts +1 -1
- package/src/reporters/sarif.ts +29 -16
- package/src/reporters/template.ts +4 -20
- package/src/reporters/text.ts +3 -3
- package/src/resolve.ts +284 -1115
- package/src/{configured-declarations.ts → roots/configured-declarations.ts} +26 -29
- package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +7 -16
- package/src/roots/manifest.ts +303 -0
- package/src/roots/published-reach.ts +486 -0
- package/src/{roots.ts → roots/root-set.ts} +286 -469
- package/src/roots/unseen-loads.ts +345 -0
- package/src/run.ts +75 -91
- package/src/schema.ts +391 -388
- package/src/scope.ts +46 -138
- package/src/session.ts +87 -55
- package/src/source-files.ts +6 -11
- package/src/stores.ts +15 -3
- package/src/suppress-file.ts +24 -33
- package/src/suppress-inline.ts +55 -91
- package/src/suppress.ts +78 -79
- package/src/symbol-keys.ts +104 -107
- package/src/tests/file-class.ts +135 -0
- package/src/{outside-tests.ts → tests/outside.ts} +16 -10
- package/src/{test-support.ts → tests/support.ts} +15 -21
- package/src/text/compare.ts +27 -0
- package/src/text/glob.ts +210 -0
- package/src/text/named-files.ts +388 -0
- package/src/text/yaml.ts +747 -0
- package/src/type-errors.ts +18 -288
- package/src/type-parameter-reads.ts +187 -158
- package/src/unimplemented-callees.ts +297 -280
- package/src/unwrap.ts +34 -0
- package/src/usage.ts +10 -0
- package/src/vendor/unbash/LICENSE +15 -0
- package/src/vendor/unbash/VENDORED.md +16 -0
- package/src/vendor/unbash/ansi-c.ts +132 -0
- package/src/vendor/unbash/arithmetic-parts.ts +53 -0
- package/src/vendor/unbash/arithmetic.ts +641 -0
- package/src/vendor/unbash/assignment.ts +163 -0
- package/src/vendor/unbash/chars.ts +48 -0
- package/src/vendor/unbash/command.ts +47 -0
- package/src/vendor/unbash/expansion.ts +144 -0
- package/src/vendor/unbash/glob.ts +284 -0
- package/src/vendor/unbash/heredoc.ts +34 -0
- package/src/vendor/unbash/internal-types.ts +94 -0
- package/src/vendor/unbash/lexer.ts +4352 -0
- package/src/vendor/unbash/limits.ts +3 -0
- package/src/vendor/unbash/parser.ts +1612 -0
- package/src/vendor/unbash/parts.ts +96 -0
- package/src/vendor/unbash/substitution-context.ts +20 -0
- package/src/vendor/unbash/traversal.ts +182 -0
- package/src/vendor/unbash/types.ts +660 -0
- package/src/vendor/unbash/word-value.ts +64 -0
- package/src/vendor/unbash/word.ts +50 -0
- package/src/verbs/analyze.ts +255 -164
- package/src/verbs/describe.ts +19 -17
- package/src/verbs/explain.ts +93 -169
- package/src/verbs/print-config.ts +2 -1
- package/src/verbs/print-projects.ts +6 -4
- package/src/verbs/print-retained.ts +36 -6
- package/src/verbs/print-roots.ts +4 -2
- package/src/verbs/verb.ts +2 -8
- package/src/verbs/version.ts +15 -3
- package/dist/src/base-url.js +0 -18
- package/dist/src/calls.js +0 -155
- package/dist/src/conventions.js +0 -937
- package/dist/src/discover.js +0 -468
- package/dist/src/entry-points.js +0 -529
- package/dist/src/exempt-classes.js +0 -75
- package/dist/src/exempt.js +0 -209
- package/dist/src/generated-file.js +0 -95
- package/dist/src/glob.js +0 -65
- package/dist/src/manifest.js +0 -165
- package/dist/src/matrix.js +0 -246
- package/dist/src/pnpm-workspace.js +0 -120
- package/dist/src/roots.js +0 -672
- package/dist/src/serialization-contract.js +0 -611
- package/dist/src/setup-failure.js +0 -23
- package/dist/src/sweep.js +0 -224
- package/dist/src/test-joins.js +0 -101
- package/dist/src/value-flow.js +0 -74
- package/dist/src/version.js +0 -7
- package/dist/src/workflow-steps.js +0 -185
- package/src/base-url.ts +0 -24
- package/src/calls.ts +0 -225
- package/src/decorator.ts +0 -78
- package/src/discover.ts +0 -653
- package/src/entry-points.ts +0 -687
- package/src/exempt-classes.ts +0 -123
- package/src/exempt.ts +0 -323
- package/src/generated-file.ts +0 -111
- package/src/glob.ts +0 -67
- package/src/manifest.ts +0 -234
- package/src/matrix.ts +0 -423
- package/src/pnpm-workspace.ts +0 -135
- package/src/serialization-contract.ts +0 -849
- package/src/setup-failure.ts +0 -39
- package/src/sweep.ts +0 -347
- package/src/test-joins.ts +0 -120
- package/src/value-flow.ts +0 -104
- package/src/version.ts +0 -7
- package/src/workflow-steps.ts +0 -216
package/dist/src/analysis.js
CHANGED
|
@@ -8,50 +8,51 @@
|
|
|
8
8
|
import { isStringLiteralLikeNode } from "@typescript/native/ast";
|
|
9
9
|
import { lineOf, readComponent } from "./component-files.js";
|
|
10
10
|
import { kindOf } from "./config.js";
|
|
11
|
-
import {
|
|
12
|
-
import { configuredDeclarations, configuredRef, declarationsNamed, } from "./configured-declarations.js";
|
|
13
|
-
import { decorator } from "./decorator.js";
|
|
11
|
+
import { consumerReferences } from "./consumers.js";
|
|
12
|
+
import { configuredDeclarations, configuredRef, declarationsNamed, } from "./roots/configured-declarations.js";
|
|
14
13
|
import { configurationNeeds, dependenciesOf, projectNeeds } from "./dependencies.js";
|
|
14
|
+
import { carriersOf, NO_CARRIERS } from "./exposure.js";
|
|
15
15
|
import { deprecatedDeclarations } from "./deprecation.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { moduleIdentity } from "./load/discover.js";
|
|
17
|
+
import { loadRun } from "./load/load.js";
|
|
18
|
+
import { readSources } from "./entries/sources.js";
|
|
19
|
+
import { readWorkflows } from "./entries/workflow-steps.js";
|
|
18
20
|
import { readEdgeSides } from "./edges.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { inOperandNames } from "./in-operands.js";
|
|
21
|
+
import { bindingsOf, distinctBindings } from "./bindings.js";
|
|
22
|
+
import { generatedFilesOf } from "./exemptions/generated-file.js";
|
|
23
|
+
import { inOperandNames } from "./findings/in-operands.js";
|
|
22
24
|
import { sourceFilesOf } from "./source-files.js";
|
|
23
|
-
import {
|
|
25
|
+
import { DETECTORS, detection } from "./exemptions/detectors.js";
|
|
26
|
+
import { exemptionsOf, settle } from "./exemptions/lifecycle.js";
|
|
24
27
|
import { heldByInclusion, sourcePaths, sourceTree } from "./file-facts.js";
|
|
25
|
-
import { globExpression } from "./glob.js";
|
|
26
28
|
import { findingsPass, recordedFindings, rowKey } from "./findings-pass.js";
|
|
27
29
|
import { unmatchedRootFindings } from "./findings/self-check.js";
|
|
28
|
-
import {
|
|
29
|
-
import { implementations, mergeImplementations } from "./implementations.js";
|
|
30
|
-
import { injectionContainer } from "./injection-container.js";
|
|
31
|
-
import { interfaceSatisfaction, settledSatisfaction } from "./interface-satisfaction.js";
|
|
30
|
+
import { implementations, mergeImplementations } from "./findings/implementations.js";
|
|
32
31
|
import { intraFunctionFacts, projectParts } from "./intra-function-parts.js";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
32
|
+
import {} from "./inventory.js";
|
|
33
|
+
import { inventory } from "./inventory/enumerate.js";
|
|
34
|
+
import { readManifest } from "./roots/manifest.js";
|
|
35
|
+
import { matrixOf, referenceKey } from "./liveness/matrix.js";
|
|
36
|
+
import { ancestors, dirnamePath, extensionOf, joinPath, relativePath, resolvePath, } from "./paths.js";
|
|
37
37
|
import { byPosition, isComponentFile } from "./position.js";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import { supportReferences, testSupportFiles } from "./test-support.js";
|
|
48
|
-
import { diagnosticsOf, ownedAs, runSession, } from "./session.js";
|
|
38
|
+
import { skippedUnits } from "./type-errors.js";
|
|
39
|
+
import { references } from "./references.js";
|
|
40
|
+
import { rootSet, unmatchedEverywhere, } from "./roots/root-set.js";
|
|
41
|
+
import { decodedMembers } from "./exemptions/serialization-contract.js";
|
|
42
|
+
import { outsideTestReferences, testFilesAt } from "./tests/outside.js";
|
|
43
|
+
import { formedForNode } from "./load/synthesize.js";
|
|
44
|
+
import { GLOBALS_RUNNER, namesTestGlobals } from "./load/test-globals.js";
|
|
45
|
+
import { targetTestFile, testFilePaths, testFileRulesOf, withheldBy, } from "./tests/file-class.js";
|
|
46
|
+
import { testSupportFiles } from "./tests/support.js";
|
|
49
47
|
import { accessorsOf, storesOf } from "./stores.js";
|
|
50
48
|
import { isPartKind } from "./suppress.js";
|
|
51
49
|
import { bindRows, readBaseline, readIgnoreFile } from "./suppress-file.js";
|
|
52
50
|
import { inlineDirectives, inlineSuppressions } from "./suppress-inline.js";
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
51
|
+
import { sweep } from "./liveness/sweep.js";
|
|
52
|
+
import { bytewise } from "./text/compare.js";
|
|
53
|
+
import { holdsManifest, manifestAt } from "./fs/manifest.js";
|
|
54
|
+
import { runDirectories } from "./entries/run-directories.js";
|
|
55
|
+
import { globExpression } from "./text/glob.js";
|
|
55
56
|
/** The setting whose source decides where a finding about a configured root sits. */
|
|
56
57
|
const ROOTS_SETTING = "roots.patterns";
|
|
57
58
|
/**
|
|
@@ -68,288 +69,91 @@ function documentOf(host, provenance, setting, targetRoot) {
|
|
|
68
69
|
const document = resolvePath(host.workingDirectory(), origin.label);
|
|
69
70
|
return relativePath(resolvePath(host.workingDirectory(), targetRoot), document) ?? "";
|
|
70
71
|
}
|
|
71
|
-
/** Two strings ordered bytewise. */
|
|
72
|
-
function compare(a, b) {
|
|
73
|
-
if (a === b) {
|
|
74
|
-
return 0;
|
|
75
|
-
}
|
|
76
|
-
return a < b ? -1 : 1;
|
|
77
|
-
}
|
|
78
72
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
function conventionManifests(host, targetRoot, memberDirs, nestedDirs) {
|
|
83
|
-
const found = new Map();
|
|
84
|
-
if (host.kindOf(joinPath(targetRoot, "package.json")) === "file") {
|
|
85
|
-
found.set(targetRoot, { dir: targetRoot, path: "package.json" });
|
|
86
|
-
}
|
|
87
|
-
for (const [dirs, nested] of [
|
|
88
|
-
[memberDirs, false],
|
|
89
|
-
[nestedDirs, true],
|
|
90
|
-
]) {
|
|
91
|
-
for (const dir of dirs) {
|
|
92
|
-
const below = relativePath(targetRoot, dir);
|
|
93
|
-
if (below !== undefined && !found.has(dir)) {
|
|
94
|
-
found.set(dir, { dir, path: `${below}/package.json`, nested });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return [...found.values()];
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* The nested packages of a run: each directory below the target root, in no `node_modules`
|
|
102
|
-
* directory and none of `known`, that holds a `package.json` and lies at or above one of
|
|
103
|
-
* `files`, the program's source files and the compiler configuration files, in path order.
|
|
104
|
-
*/
|
|
105
|
-
function nestedPackageDirs(host, targetRoot, files, known) {
|
|
106
|
-
const seen = new Set();
|
|
107
|
-
const found = [];
|
|
108
|
-
for (const file of files) {
|
|
109
|
-
for (let dir = dirnamePath(file); dir !== targetRoot && !seen.has(dir) && relativePath(targetRoot, dir) !== undefined; dir = dirnamePath(dir)) {
|
|
110
|
-
seen.add(dir);
|
|
111
|
-
const below = relativePath(targetRoot, dir) ?? "";
|
|
112
|
-
if (!below.split("/").includes("node_modules") &&
|
|
113
|
-
!known.has(dir) &&
|
|
114
|
-
host.kindOf(joinPath(dir, "package.json")) === "file") {
|
|
115
|
-
found.push(dir);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return found.sort(compare);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Reads every project the scope discovers, and each declared consumer's, in one snapshot,
|
|
123
|
-
* each checked for errors first. `stage` is handed a target project and enumerates and roots
|
|
124
|
-
* it if it reads it; a consumer project is read for its references to the target. A type error
|
|
125
|
-
* in an own file skips the unit holding it. A guess that does not load or meets a setup failure
|
|
126
|
-
* is dropped into `notBuilt` (see {@link isGuess}); any other such project fails the run, as
|
|
127
|
-
* does a run whose every guess was dropped.
|
|
73
|
+
* Reads every project the load phase analyzes through `stage`, which enumerates and roots one
|
|
74
|
+
* if it reads it, and each declared consumer's project for its references to the target,
|
|
75
|
+
* in the same snapshot. A type error in an own file skips the unit holding it.
|
|
128
76
|
*/
|
|
129
77
|
function readProjects(engine, host, scope, config, stage) {
|
|
130
78
|
const targetRoot = scope.target.path;
|
|
131
|
-
const discovered = discoverProjects(engine, host, scope, config.analysis.configurations);
|
|
132
|
-
if (discovered.configFiles.length === 0 && discovered.notBuilt.length === 0) {
|
|
133
|
-
throw new DiscoveryError(`${targetRoot} holds no compiler configuration, so the run holds no program`, []);
|
|
134
|
-
}
|
|
135
|
-
const ids = new Map(discovered.projects.map((project) => [project.configFile, project.id]));
|
|
136
|
-
const loads = consumerLoads(engine, host, scope, discovered.configFiles);
|
|
137
|
-
const consumerOf = new Map(loads.flatMap((load) => load.configFiles.map((configFile) => [configFile, load.consumer])));
|
|
138
79
|
const absoluteRoot = resolvePath(host.workingDirectory(), targetRoot);
|
|
139
|
-
const
|
|
80
|
+
const testPatterns = config.ts.test_files.map(globExpression);
|
|
140
81
|
const parse = (fileName, text) => engine.parseSourceFile(fileName, text);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
let conventions = readConventions(host, parse, [], config.ts.disabledConventions);
|
|
146
|
-
let options;
|
|
147
|
-
const readManifests = (opened) => {
|
|
148
|
-
nestedDirs = nestedPackageDirs(host, normalizePath(absoluteRoot), opened
|
|
149
|
-
.filter((one) => !consumerOf.has(one.configFile))
|
|
150
|
-
.flatMap((one) => [one.configFile, ...one.fileNames()]), new Set(memberDirs));
|
|
151
|
-
conventions = readConventions(host, parse, conventionManifests(host, absoluteRoot, memberDirs, nestedDirs), config.ts.disabledConventions);
|
|
152
|
-
options = {
|
|
82
|
+
return loadRun(engine, host, scope, config, ({ plan, classified, runFiles }) => {
|
|
83
|
+
const { packages, conventions } = plan;
|
|
84
|
+
const workflows = readWorkflows(host, targetRoot);
|
|
85
|
+
const options = {
|
|
153
86
|
host,
|
|
154
|
-
manifest:
|
|
155
|
-
otherPackages:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
],
|
|
159
|
-
patterns: config.rootPatterns,
|
|
160
|
-
entryFiles: config.ts.entryFiles,
|
|
161
|
-
conventions,
|
|
162
|
-
testFiles: config.ts.testFiles,
|
|
87
|
+
manifest: packages.manifest,
|
|
88
|
+
otherPackages: packages.entries,
|
|
89
|
+
patterns: config.roots.patterns,
|
|
90
|
+
entryFiles: config.ts.entry_files,
|
|
163
91
|
parse,
|
|
164
|
-
publishedAPI: config.
|
|
165
|
-
publishedMembers:
|
|
166
|
-
runFiles
|
|
92
|
+
publishedAPI: config.target.kind !== undefined && kindOf(config.target.kind) === "library",
|
|
93
|
+
publishedMembers: packages.published,
|
|
94
|
+
runFiles,
|
|
167
95
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
const referenceOnly = workspace === undefined || consumer !== undefined
|
|
209
|
-
? () => false
|
|
210
|
-
: workspace.referenceOnly(opened.configFile, opened.rootFiles);
|
|
211
|
-
const project = workspace === undefined || consumer !== undefined
|
|
212
|
-
? opened
|
|
213
|
-
: ownedAs(opened, (file, fromExternalLibrary) => workspace.ownFile(file, fromExternalLibrary));
|
|
214
|
-
const raw = projectErrors(diagnosticsOf(project));
|
|
215
|
-
const errors = { load: raw.load, check: ownErrors(raw.check, referenceOnly) };
|
|
216
|
-
const [unloaded] = errors.load;
|
|
217
|
-
if (unloaded !== undefined &&
|
|
218
|
-
consumer === undefined &&
|
|
219
|
-
isGuess(discovered, project.configFile)) {
|
|
220
|
-
dropped(project.configFile, renderDiagnostic(unloaded, (path) => relativePath(absoluteRoot, path) ?? path));
|
|
221
|
-
return undefined;
|
|
222
|
-
}
|
|
223
|
-
if (errors.load.length > 0) {
|
|
224
|
-
failures.push(...errors.load);
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
const reading = readErrors(project, errors.check, {
|
|
228
|
-
host,
|
|
229
|
-
targetRoot: consumer === undefined
|
|
230
|
-
? absoluteRoot
|
|
231
|
-
: resolvePath(host.workingDirectory(), consumer.path),
|
|
232
|
-
paths: pathsOf(engine, project.configFile),
|
|
96
|
+
const heldFiles = new Set();
|
|
97
|
+
const answers = classified.analyzed.map(({ plan: planned, project, skips, referenceOnly }) => {
|
|
98
|
+
const read = () => {
|
|
99
|
+
const held = inventory(project, host, targetRoot);
|
|
100
|
+
const own = sourceFilesOf(project, targetRoot);
|
|
101
|
+
const sources = readSources({
|
|
102
|
+
host,
|
|
103
|
+
targetRoot,
|
|
104
|
+
files: own,
|
|
105
|
+
parse,
|
|
106
|
+
testFiles: config.ts.test_files,
|
|
107
|
+
conventions,
|
|
108
|
+
workflows,
|
|
109
|
+
});
|
|
110
|
+
const rooted = rootSet(project, held, targetRoot, { ...options, sources, skips });
|
|
111
|
+
const generated = generatedFilesOf(own, sources.generated);
|
|
112
|
+
return {
|
|
113
|
+
configuration: planned.id,
|
|
114
|
+
configFile: project.configFile,
|
|
115
|
+
held,
|
|
116
|
+
rooted,
|
|
117
|
+
typeErrorSkips: skips.map((one) => one.record),
|
|
118
|
+
skipped: skippedUnits(skips, absoluteRoot),
|
|
119
|
+
referenceOnly: project
|
|
120
|
+
.ownSourceFiles()
|
|
121
|
+
.filter((file) => referenceOnly(file.fileName))
|
|
122
|
+
.flatMap((file) => relativePath(absoluteRoot, file.fileName) ?? []),
|
|
123
|
+
generated,
|
|
124
|
+
bindings: bindingsOf(own.byPath, generated, new Map(held.symbols
|
|
125
|
+
.filter((one) => one.kind === "file")
|
|
126
|
+
.map((one) => [one.position.path, one.ref]))),
|
|
127
|
+
sources,
|
|
128
|
+
formedForNode: formedForNode(planned),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
for (const file of project.ownSourceFiles()) {
|
|
132
|
+
heldFiles.add(relativePath(absoluteRoot, file.fileName) ?? file.fileName);
|
|
133
|
+
}
|
|
134
|
+
return stage(project, { configuration: planned.id, read });
|
|
233
135
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
if (reading.missing.length > 0) {
|
|
242
|
-
setupMet(project.configFile, reading.missing);
|
|
243
|
-
return undefined;
|
|
244
|
-
}
|
|
245
|
-
const unconventional = consumer === undefined
|
|
246
|
-
? conventionFailuresFor(conventions, project.configFile, project.ownSourceFiles().map((file) => file.fileName))
|
|
247
|
-
: [];
|
|
248
|
-
if (unconventional.length > 0) {
|
|
249
|
-
setupMet(project.configFile, unconventional);
|
|
250
|
-
return undefined;
|
|
251
|
-
}
|
|
252
|
-
if (consumer !== undefined) {
|
|
253
|
-
for (const reference of consumerReferences(project, host, targetRoot, {
|
|
254
|
-
id: consumer.id,
|
|
255
|
-
root: consumer.path,
|
|
256
|
-
}, config)) {
|
|
136
|
+
const consumed = new Map();
|
|
137
|
+
const consumerHeld = new Set();
|
|
138
|
+
for (const { project, consumer } of classified.consumed) {
|
|
139
|
+
const side = { id: consumer.id, root: consumer.path };
|
|
140
|
+
const read = consumerReferences(project, host, targetRoot, side, config, parse);
|
|
141
|
+
for (const reference of read.references) {
|
|
257
142
|
consumed.set(referenceKey(reference), reference);
|
|
258
143
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
configFile: project.configFile,
|
|
263
|
-
error: renderDiagnostic(one, (path) => relativePath(absoluteRoot, path) ?? path),
|
|
264
|
-
})));
|
|
265
|
-
const missingGlobal = raw.unfound.find(({ diagnostic }) => diagnostic.code === MISSING_GLOBAL_TYPE);
|
|
266
|
-
const skips = missingGlobal === undefined
|
|
267
|
-
? reading.skips
|
|
268
|
-
: [
|
|
269
|
-
...reading.skips,
|
|
270
|
-
...project.ownSourceFiles().map((file) => ({
|
|
271
|
-
record: {
|
|
272
|
-
path: relativePath(absoluteRoot, file.fileName) ?? file.fileName,
|
|
273
|
-
line: 1,
|
|
274
|
-
message: missingGlobal.diagnostic.text,
|
|
275
|
-
},
|
|
276
|
-
file,
|
|
277
|
-
unit: file,
|
|
278
|
-
})),
|
|
279
|
-
];
|
|
280
|
-
const configuration = ids.get(project.configFile) ?? project.configFile;
|
|
281
|
-
const read = () => {
|
|
282
|
-
const held = inventory(project, host, targetRoot);
|
|
283
|
-
const found = roots(project, held, targetRoot, options);
|
|
284
|
-
const kept = skippedRoots(project, held, skips);
|
|
285
|
-
const rooted = kept.length === 0
|
|
286
|
-
? found
|
|
287
|
-
: {
|
|
288
|
-
...found,
|
|
289
|
-
liveUnderReachability: [
|
|
290
|
-
...found.liveUnderReachability,
|
|
291
|
-
...kept.map((id) => ({ id, kind: "type-error", source: "" })),
|
|
292
|
-
],
|
|
293
|
-
};
|
|
294
|
-
const own = sourceFilesOf(project, targetRoot);
|
|
295
|
-
return {
|
|
296
|
-
configuration,
|
|
297
|
-
configFile: project.configFile,
|
|
298
|
-
held,
|
|
299
|
-
rooted,
|
|
300
|
-
typeErrorSkips: skips.map((one) => one.record),
|
|
301
|
-
skipped: skippedUnits(skips, absoluteRoot),
|
|
302
|
-
referenceOnly: project
|
|
303
|
-
.ownSourceFiles()
|
|
304
|
-
.filter((file) => referenceOnly(file.fileName))
|
|
305
|
-
.flatMap((file) => relativePath(absoluteRoot, file.fileName) ?? []),
|
|
306
|
-
generated: generatedFilesOf(own, generatedFiles(conventions, own)),
|
|
307
|
-
testFileNames: conventions.testFiles,
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
for (const file of project.ownSourceFiles()) {
|
|
311
|
-
heldFiles.add(relativePath(absoluteRoot, file.fileName) ?? file.fileName);
|
|
312
|
-
}
|
|
313
|
-
return stage(project, { configuration, read });
|
|
314
|
-
}, discovered.derived ? "record" : "refuse", joins.size === 0 ? programs : withJoinedTests(engine, host, programs, joins), () => {
|
|
315
|
-
outsideTests = testFilesAt(host, targetRoot, sourcePaths(host, targetRoot).filter((path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path))), parse);
|
|
316
|
-
}, readManifests);
|
|
317
|
-
for (const configFile of session.unopened) {
|
|
318
|
-
if (consumerOf.has(configFile) || !isGuess(discovered, configFile)) {
|
|
319
|
-
throw new DiscoveryError(`${configFile} opened no project`, []);
|
|
144
|
+
for (const id of read.held) {
|
|
145
|
+
consumerHeld.add(id);
|
|
146
|
+
}
|
|
320
147
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
throw new SetupError(unbuildable);
|
|
325
|
-
}
|
|
326
|
-
if (failures.length > 0) {
|
|
327
|
-
throw new DiscoveryError(`${String(failures.length)} error(s), so no answer was produced`, failures);
|
|
328
|
-
}
|
|
329
|
-
const answers = session.projects.filter((answer) => answer !== undefined);
|
|
330
|
-
const [first] = notBuilt;
|
|
331
|
-
if (answers.length === 0 && setupDropped.length > 0) {
|
|
332
|
-
throw new SetupError(setupDropped);
|
|
333
|
-
}
|
|
334
|
-
if (answers.length === 0 && first !== undefined) {
|
|
335
|
-
throw new DiscoveryError(`no configuration discovery derived could be built; ${first.id}: ${first.error}`, []);
|
|
336
|
-
}
|
|
337
|
-
return {
|
|
338
|
-
answers,
|
|
339
|
-
consumers: {
|
|
340
|
-
loaded: loads.map((load) => load.consumer),
|
|
148
|
+
const outsideTests = testFilesAt(host, targetRoot, sourcePaths(host, targetRoot).filter((path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path))), parse);
|
|
149
|
+
return {
|
|
150
|
+
answers,
|
|
341
151
|
references: [...consumed.values()],
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
conventionsApplied: conventions.applied,
|
|
348
|
-
conventionUses: conventions.uses,
|
|
349
|
-
memberDirs,
|
|
350
|
-
nestedDirs,
|
|
351
|
-
outsideTests,
|
|
352
|
-
};
|
|
152
|
+
consumerHeld: [...consumerHeld],
|
|
153
|
+
outsideTests,
|
|
154
|
+
workflows,
|
|
155
|
+
};
|
|
156
|
+
});
|
|
353
157
|
}
|
|
354
158
|
/**
|
|
355
159
|
* The projects the run the scope and the configuration describe analyzes, each read
|
|
@@ -358,7 +162,11 @@ function readProjects(engine, host, scope, config, stage) {
|
|
|
358
162
|
*/
|
|
359
163
|
export function runProjects(engine, host, scope, config) {
|
|
360
164
|
const read = readProjects(engine, host, scope, config, (_project, opened) => opened.configuration);
|
|
361
|
-
return {
|
|
165
|
+
return {
|
|
166
|
+
configurations: read.result.answers,
|
|
167
|
+
notBuilt: read.classified.notBuilt,
|
|
168
|
+
unanswered: read.unanswered,
|
|
169
|
+
};
|
|
362
170
|
}
|
|
363
171
|
/**
|
|
364
172
|
* The root set of the run the scope and the configuration describe.
|
|
@@ -369,7 +177,7 @@ export function runProjects(engine, host, scope, config) {
|
|
|
369
177
|
export function runRoots(engine, host, scope, config, provenance) {
|
|
370
178
|
const targetRoot = scope.target.path;
|
|
371
179
|
const read = readProjects(engine, host, scope, config, (_project, opened) => opened.read());
|
|
372
|
-
const projects = read.answers;
|
|
180
|
+
const projects = read.result.answers;
|
|
373
181
|
const configurations = [];
|
|
374
182
|
const merged = new Map();
|
|
375
183
|
for (const answer of projects) {
|
|
@@ -397,28 +205,25 @@ export function runRoots(engine, host, scope, config, provenance) {
|
|
|
397
205
|
}
|
|
398
206
|
}
|
|
399
207
|
}
|
|
400
|
-
const ordered = [...merged.values()].sort((a, b) => byPosition(a.position, b.position) ||
|
|
401
|
-
|
|
208
|
+
const ordered = [...merged.values()].sort((a, b) => byPosition(a.position, b.position) ||
|
|
209
|
+
bytewise(a.kind, b.kind) ||
|
|
210
|
+
bytewise(a.source, b.source));
|
|
211
|
+
const unmatched = unmatchedEverywhere(config.roots.patterns, projects.map((answer) => answer.rooted));
|
|
402
212
|
return {
|
|
403
213
|
configurations,
|
|
404
214
|
roots: ordered,
|
|
405
215
|
findings: unmatchedRootFindings(unmatched, documentOf(host, provenance, ROOTS_SETTING, targetRoot)),
|
|
406
|
-
notBuilt: read.notBuilt,
|
|
216
|
+
notBuilt: read.classified.notBuilt,
|
|
407
217
|
unanswered: read.unanswered,
|
|
408
218
|
};
|
|
409
219
|
}
|
|
410
|
-
/** The
|
|
411
|
-
export
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
["decorator", decorator],
|
|
418
|
-
["injection-container", injectionContainer],
|
|
419
|
-
["framework-lifecycle", frameworkLifecycle],
|
|
420
|
-
["serialization-contract", serializationContract],
|
|
421
|
-
]);
|
|
220
|
+
/** The production mode a configuration sets: a consumer's test reference is classed as `analysis.consumer_tests` says. */
|
|
221
|
+
export function productionMode(config) {
|
|
222
|
+
return {
|
|
223
|
+
production: true,
|
|
224
|
+
consumerTestsProduction: config.analysis.consumer_tests === "production",
|
|
225
|
+
};
|
|
226
|
+
}
|
|
422
227
|
/** The manifest section of a package test evidence counts, and the sections that keep one out of it. */
|
|
423
228
|
const DEV_SECTION = "devDependencies";
|
|
424
229
|
const OTHER_SECTIONS = ["dependencies", "peerDependencies", "optionalDependencies"];
|
|
@@ -435,18 +240,9 @@ function testEvidence(host, targetRoot, projects) {
|
|
|
435
240
|
}
|
|
436
241
|
}
|
|
437
242
|
const manifests = new Map();
|
|
438
|
-
const
|
|
243
|
+
const manifestIn = (dir) => {
|
|
439
244
|
if (!manifests.has(dir)) {
|
|
440
|
-
|
|
441
|
-
try {
|
|
442
|
-
value = JSON.parse(host.readFile(joinPath(dir, "package.json")));
|
|
443
|
-
}
|
|
444
|
-
catch {
|
|
445
|
-
value = undefined;
|
|
446
|
-
}
|
|
447
|
-
manifests.set(dir, typeof value === "object" && value !== null && !Array.isArray(value)
|
|
448
|
-
? value
|
|
449
|
-
: undefined);
|
|
245
|
+
manifests.set(dir, manifestAt(host, dir));
|
|
450
246
|
}
|
|
451
247
|
return manifests.get(dir);
|
|
452
248
|
};
|
|
@@ -455,16 +251,14 @@ function testEvidence(host, targetRoot, projects) {
|
|
|
455
251
|
return {
|
|
456
252
|
imports,
|
|
457
253
|
devDependency: (path, name) => {
|
|
458
|
-
for (
|
|
459
|
-
const manifest =
|
|
254
|
+
for (const dir of ancestors(dirnamePath(joinPath(root, path)), root)) {
|
|
255
|
+
const manifest = manifestIn(dir);
|
|
460
256
|
const other = OTHER_SECTIONS.some((one) => declares(manifest?.[one], name));
|
|
461
257
|
if (declares(manifest?.[DEV_SECTION], name) || other) {
|
|
462
258
|
return !other;
|
|
463
259
|
}
|
|
464
|
-
if (normalizePath(dir) === normalizePath(root) || dirnamePath(dir) === dir) {
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
260
|
}
|
|
261
|
+
return false;
|
|
468
262
|
},
|
|
469
263
|
};
|
|
470
264
|
}
|
|
@@ -476,79 +270,103 @@ function testEvidence(host, targetRoot, projects) {
|
|
|
476
270
|
*/
|
|
477
271
|
function readRun(engine, host, scope, config, mode, detectors, extra) {
|
|
478
272
|
const targetRoot = scope.target.path;
|
|
479
|
-
const disabled = disabledClasses(config);
|
|
480
|
-
const templates = disabled.has("template-field")
|
|
481
|
-
? { delimiters: config.analysis.templateDelimiters, files: [] }
|
|
482
|
-
: readTemplates(host, targetRoot, config.analysis);
|
|
483
273
|
const consumers = scope.consumers.map((consumer) => consumer.path);
|
|
274
|
+
const detect = detection(host, targetRoot, config, consumers, detectors);
|
|
275
|
+
const directories = runDirectories(host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text));
|
|
484
276
|
const read = readProjects(engine, host, scope, config, (project, opened) => {
|
|
485
277
|
const projectRead = opened.read();
|
|
278
|
+
const testFile = targetTestFile(projectRead.sources.testFiles);
|
|
486
279
|
const resolved = references(project, projectRead.held, targetRoot, {
|
|
487
|
-
|
|
488
|
-
|
|
280
|
+
testFile,
|
|
281
|
+
directories,
|
|
282
|
+
formedForNode: projectRead.formedForNode,
|
|
489
283
|
});
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
held: projectRead.held,
|
|
493
|
-
targetRoot,
|
|
494
|
-
templates,
|
|
495
|
-
ts: config.ts,
|
|
496
|
-
consumers,
|
|
497
|
-
...(config.analysis.generatedFiles === "include"
|
|
498
|
-
? {}
|
|
499
|
-
: { generated: projectRead.generated }),
|
|
500
|
-
}, detectors, disabled);
|
|
284
|
+
const testFiles = testFilePaths(project, targetRoot, testFile);
|
|
285
|
+
const evidence = detect({ project, held: projectRead.held, generated: projectRead.generated });
|
|
501
286
|
const components = project.ownSourceFiles().filter(isComponentFile);
|
|
287
|
+
const injected = project.program
|
|
288
|
+
.getSourceFileNames()
|
|
289
|
+
.some((name) => name.endsWith(`/node_modules/${GLOBALS_RUNNER}/globals.d.ts`));
|
|
502
290
|
const pathOf = (file) => relativePath(targetRoot, file.fileName) ?? file.fileName;
|
|
503
291
|
return {
|
|
504
292
|
projectRead,
|
|
505
293
|
references: resolved.references,
|
|
506
|
-
|
|
294
|
+
held: resolved.held,
|
|
295
|
+
possiblyLoaded: resolved.possiblyLoaded,
|
|
296
|
+
testFiles,
|
|
507
297
|
evidence,
|
|
508
298
|
componentFiles: components.map(pathOf),
|
|
509
299
|
imports: new Map(project.ownSourceFiles().flatMap((file) => {
|
|
510
300
|
const path = relativePath(targetRoot, file.fileName);
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
301
|
+
if (path === undefined) {
|
|
302
|
+
return [];
|
|
303
|
+
}
|
|
304
|
+
const specifiers = file.imports.filter(isStringLiteralLikeNode).map((one) => one.text);
|
|
305
|
+
// A file calling the globals a program declares is written for their runner.
|
|
306
|
+
return [
|
|
307
|
+
[
|
|
308
|
+
path,
|
|
309
|
+
injected && namesTestGlobals(project, file)
|
|
310
|
+
? [...specifiers, GLOBALS_RUNNER]
|
|
311
|
+
: specifiers,
|
|
312
|
+
],
|
|
313
|
+
];
|
|
514
314
|
})),
|
|
515
315
|
componentWarnings: components.flatMap((file) => readComponent(file.originalText, extensionOf(file.fileName)).warnings.map((warning) => ({
|
|
516
316
|
path: pathOf(file),
|
|
517
317
|
line: lineOf(file.originalText, warning.offset),
|
|
518
318
|
reason: warning.reason,
|
|
519
319
|
}))),
|
|
520
|
-
|
|
320
|
+
decoded: decodedMembers(project, projectRead.held, productionFiles(project, targetRoot, testFiles), consumers),
|
|
321
|
+
extra: extra(project, projectRead, resolved.references, testFiles, resolved.unseenLoads.map((position) => ({
|
|
322
|
+
configuration: projectRead.configuration,
|
|
323
|
+
position,
|
|
324
|
+
}))),
|
|
521
325
|
};
|
|
522
326
|
});
|
|
523
|
-
const outsidePaths = read.outsideTests.map((one) => one.path);
|
|
524
|
-
const withOutside = read.answers.map((one) => ({
|
|
327
|
+
const outsidePaths = read.result.outsideTests.map((one) => one.path);
|
|
328
|
+
const withOutside = read.result.answers.map((one) => ({
|
|
525
329
|
...one,
|
|
526
330
|
references: [
|
|
527
331
|
...one.references,
|
|
528
|
-
...outsideTestReferences(read.outsideTests, one.projectRead.held, targetRoot),
|
|
332
|
+
...outsideTestReferences(read.result.outsideTests, one.projectRead.held, targetRoot),
|
|
529
333
|
],
|
|
530
334
|
testFiles: [...one.testFiles, ...outsidePaths],
|
|
531
335
|
}));
|
|
532
336
|
// Test-support code is code only test code imports in any configuration of the run: a
|
|
533
337
|
// configuration that holds no test file says nothing about what the tests import.
|
|
534
|
-
const { support, testUsed } = testSupportFiles(withOutside.flatMap((one) => one.projectRead.held.symbols), withOutside.flatMap((one) => one.references),
|
|
535
|
-
|
|
338
|
+
const { support, testUsed } = testSupportFiles(withOutside.flatMap((one) => one.projectRead.held.symbols), withOutside.flatMap((one) => one.references),
|
|
339
|
+
// An outside declaration naming a global augmentation calls nothing of its file.
|
|
340
|
+
withOutside.flatMap((one) => one.projectRead.rooted.liveUnderReachability.filter((root) => root.kind !== "global-augmentation")), withOutside.flatMap((one) => one.testFiles), testEvidence(host, targetRoot, withOutside));
|
|
341
|
+
// A member a decode fills or a copy carries is written: a value decoded and sent again carries it on.
|
|
342
|
+
const written = new Set([
|
|
343
|
+
...countedWrites([...withOutside.flatMap((one) => one.references), ...read.result.references], support, mode),
|
|
344
|
+
...withOutside.flatMap((one) => [
|
|
345
|
+
...one.decoded.filled,
|
|
346
|
+
...one.decoded.parsed,
|
|
347
|
+
...one.decoded.copied,
|
|
348
|
+
]),
|
|
349
|
+
]);
|
|
350
|
+
const settled = settle(withOutside.map((one) => ({
|
|
351
|
+
records: one.evidence,
|
|
352
|
+
held: one.projectRead.held,
|
|
353
|
+
testFiles: new Set([...one.testFiles, ...support]),
|
|
354
|
+
})), {
|
|
355
|
+
references: [...withOutside.flatMap((one) => one.references), ...read.result.references],
|
|
356
|
+
written,
|
|
357
|
+
mode,
|
|
358
|
+
});
|
|
536
359
|
const answers = withOutside.map((one, index) => {
|
|
537
360
|
const { projectRead } = one;
|
|
538
|
-
const
|
|
539
|
-
const
|
|
540
|
-
mode,
|
|
541
|
-
testFiles: new Set([...one.testFiles, ...support]),
|
|
542
|
-
});
|
|
543
|
-
const exempt = detected.records;
|
|
544
|
-
const made = supportReferences([...one.references, ...(satisfied?.references ?? [])], support);
|
|
361
|
+
const exempt = settled[index]?.records ?? [];
|
|
362
|
+
const made = [...one.references, ...(settled[index]?.references ?? [])];
|
|
545
363
|
const held = new Set(projectRead.held.symbols.map((symbol) => symbol.position.path));
|
|
546
|
-
const supportFiles = [...support].filter((path) => held.has(path)).sort();
|
|
547
|
-
const testUsedFiles = [...testUsed].filter((path) => held.has(path)).sort();
|
|
364
|
+
const supportFiles = [...support].filter((path) => held.has(path)).sort(bytewise);
|
|
365
|
+
const testUsedFiles = [...testUsed].filter((path) => held.has(path)).sort(bytewise);
|
|
548
366
|
const configured = {
|
|
549
367
|
configuration: projectRead.configuration,
|
|
550
368
|
symbols: projectRead.held.symbols,
|
|
551
|
-
references:
|
|
369
|
+
references: made,
|
|
552
370
|
roots: projectRead.rooted.liveUnderReachability,
|
|
553
371
|
testFiles: [...one.testFiles, ...supportFiles],
|
|
554
372
|
...(supportFiles.length === 0 ? {} : { supportFiles }),
|
|
@@ -568,20 +386,23 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
|
|
|
568
386
|
unanswered: [
|
|
569
387
|
...projectRead.held.unanswered,
|
|
570
388
|
...projectRead.rooted.unanswered,
|
|
571
|
-
...made
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
...
|
|
389
|
+
...made.filter((reference) => reference.guessed === true).map((reference) => reference.to),
|
|
390
|
+
...one.held,
|
|
391
|
+
...exempt.filter((record) => record.unanswered === true).map((record) => record.id),
|
|
392
|
+
...one.decoded.unanswered,
|
|
575
393
|
],
|
|
394
|
+
filledOutside: one.decoded.filled,
|
|
395
|
+
possiblyLoaded: one.possiblyLoaded,
|
|
576
396
|
typeErrorSkips: projectRead.typeErrorSkips,
|
|
577
397
|
unmappedEntries: projectRead.rooted.unmappedEntries,
|
|
398
|
+
heldScripts: projectRead.rooted.heldScripts,
|
|
578
399
|
skipped: projectRead.skipped,
|
|
579
400
|
componentFiles: one.componentFiles,
|
|
580
401
|
componentWarnings: one.componentWarnings,
|
|
581
402
|
extra: one.extra,
|
|
582
403
|
};
|
|
583
404
|
});
|
|
584
|
-
const consumed = read.
|
|
405
|
+
const consumed = read.result.references;
|
|
585
406
|
const projects = answers.map((one) => consumed.length === 0
|
|
586
407
|
? one
|
|
587
408
|
: {
|
|
@@ -597,70 +418,32 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
|
|
|
597
418
|
unansweredHeld: [
|
|
598
419
|
...new Set([
|
|
599
420
|
...answers.flatMap((one) => one.unanswered),
|
|
600
|
-
...consumed.filter((one) => one.
|
|
421
|
+
...consumed.filter((one) => one.guessed === true).map((one) => one.to),
|
|
422
|
+
...read.result.consumerHeld,
|
|
601
423
|
]),
|
|
602
424
|
],
|
|
603
425
|
projects,
|
|
604
|
-
consumers: read.consumers
|
|
605
|
-
|
|
426
|
+
consumers: read.plan.discovery.consumers,
|
|
427
|
+
declaresConsumers: scope.consumers.length > 0,
|
|
428
|
+
notBuilt: read.classified.notBuilt,
|
|
606
429
|
unanswered: read.unanswered,
|
|
607
|
-
componentsUnread: read.componentsUnread,
|
|
608
|
-
librariesUnfound: read.librariesUnfound,
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
430
|
+
componentsUnread: read.plan.workspace?.componentsUnread ?? [],
|
|
431
|
+
librariesUnfound: read.classified.librariesUnfound,
|
|
432
|
+
unresolvedSpecifiers: read.classified.unresolvedSpecifiers,
|
|
433
|
+
unread: read.plan.unread,
|
|
434
|
+
conventionsApplied: read.plan.conventions.applied,
|
|
435
|
+
conventionUses: read.plan.conventions.uses,
|
|
436
|
+
memberDirs: read.plan.packages.members,
|
|
437
|
+
nestedDirs: read.plan.packages.nested,
|
|
438
|
+
workflows: read.result.workflows,
|
|
613
439
|
};
|
|
614
440
|
}
|
|
615
441
|
/**
|
|
616
|
-
* The
|
|
617
|
-
*
|
|
618
|
-
* keeps the file live, so each file's markup joins only once a sweep without it finds the
|
|
619
|
-
* file live, until a sweep finds no further file live.
|
|
620
|
-
*/
|
|
621
|
-
function holdingSweep(read, input) {
|
|
622
|
-
const paths = new Set(read.exempt.flatMap((record) => record.whileLive ?? []));
|
|
623
|
-
let live = new Set();
|
|
624
|
-
for (;;) {
|
|
625
|
-
const swept = {
|
|
626
|
-
...input,
|
|
627
|
-
exempt: holdingWhile(read.exempt, live),
|
|
628
|
-
unanswered: read.unansweredHeld,
|
|
629
|
-
};
|
|
630
|
-
const result = sweepMatrix(read.matrix, swept);
|
|
631
|
-
const next = new Set(liveFilesAt(read.matrix, result, paths).map((one) => one.position.path));
|
|
632
|
-
if (next.size === live.size) {
|
|
633
|
-
return { swept, result };
|
|
634
|
-
}
|
|
635
|
-
live = next;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* The test references exemption evidence written in a test file makes: each is a read of
|
|
640
|
-
* the declaration it would retain, made by the test file at the evidence's site.
|
|
442
|
+
* The declarations a write the mode counts stores into, a write a test-support file
|
|
443
|
+
* makes being a test's.
|
|
641
444
|
*/
|
|
642
|
-
function
|
|
643
|
-
|
|
644
|
-
return [];
|
|
645
|
-
}
|
|
646
|
-
const files = new Map(symbols
|
|
647
|
-
.filter((symbol) => symbol.kind === "file")
|
|
648
|
-
.map((symbol) => [symbol.position.path, symbol.id]));
|
|
649
|
-
return inTestFiles.flatMap((record) => {
|
|
650
|
-
const from = files.get(record.site.path);
|
|
651
|
-
return from === undefined
|
|
652
|
-
? []
|
|
653
|
-
: [
|
|
654
|
-
{
|
|
655
|
-
from,
|
|
656
|
-
to: record.id,
|
|
657
|
-
position: record.site,
|
|
658
|
-
use: "read",
|
|
659
|
-
resolution: "syntax",
|
|
660
|
-
test: true,
|
|
661
|
-
},
|
|
662
|
-
];
|
|
663
|
-
});
|
|
445
|
+
function countedWrites(references, support, mode) {
|
|
446
|
+
return new Set(references.flatMap((reference) => reference.use === "write" && !withheldBy(mode, reference, support) ? [reference.to] : []));
|
|
664
447
|
}
|
|
665
448
|
/**
|
|
666
449
|
* The declarations every reference the mode counts stores into, a loaded consumer's
|
|
@@ -670,8 +453,9 @@ function writtenOnly(read, mode) {
|
|
|
670
453
|
const written = new Set();
|
|
671
454
|
const readSome = new Set();
|
|
672
455
|
for (const { configured } of read.projects) {
|
|
456
|
+
const support = new Set(configured.supportFiles ?? []);
|
|
673
457
|
for (const reference of configured.references) {
|
|
674
|
-
if (mode
|
|
458
|
+
if (withheldBy(mode, reference, support)) {
|
|
675
459
|
continue;
|
|
676
460
|
}
|
|
677
461
|
if (reference.use === "write" && reference.consumer === undefined) {
|
|
@@ -684,55 +468,22 @@ function writtenOnly(read, mode) {
|
|
|
684
468
|
}
|
|
685
469
|
return new Set([...written].filter((id) => !readSome.has(id)));
|
|
686
470
|
}
|
|
687
|
-
/**
|
|
688
|
-
* The sweep of a run read once, under one set of marks. Where a question went unanswered,
|
|
689
|
-
* the run is swept once more without what that question could have kept live and without
|
|
690
|
-
* the references that stood in for its answer, and every declaration that sweep judges
|
|
691
|
-
* dead and this one judges live, or dead by another rule, is held by the gap too, as is
|
|
692
|
-
* every declaration that makes such a reference.
|
|
693
|
-
*/
|
|
471
|
+
/** The sweep of a run read once, under one set of marks. */
|
|
694
472
|
function sweptOf(read, input) {
|
|
695
|
-
const
|
|
696
|
-
const exempt = swept.exempt ?? [];
|
|
697
|
-
const held = new Set(read.unansweredHeld);
|
|
698
|
-
if (held.size > 0) {
|
|
699
|
-
// What a declaration reads where the checker did not answer is unknown, so a rule
|
|
700
|
-
// over what it reads, the test of dead code among them, cannot judge it.
|
|
701
|
-
for (const { configured } of read.projects) {
|
|
702
|
-
for (const reference of configured.references) {
|
|
703
|
-
if (reference.resolution === "by-name") {
|
|
704
|
-
held.add(reference.from);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
const dead = new Map(result.candidates.map((candidate) => [candidate.id, candidate]));
|
|
709
|
-
const answered = matrixOf(read.projects.map(({ configured }) => ({
|
|
710
|
-
...configured,
|
|
711
|
-
references: configured.references.filter((one) => one.resolution !== "by-name"),
|
|
712
|
-
})));
|
|
713
|
-
const bare = {
|
|
714
|
-
...swept,
|
|
715
|
-
exempt: exempt.filter((record) => !isUnansweredRecord(record)),
|
|
716
|
-
unanswered: [],
|
|
717
|
-
};
|
|
718
|
-
for (const candidate of sweepMatrix(answered, bare).candidates) {
|
|
719
|
-
const kept = dead.get(candidate.id);
|
|
720
|
-
if (kept?.testOfDeadCode !== candidate.testOfDeadCode ||
|
|
721
|
-
kept.relation !== candidate.relation) {
|
|
722
|
-
held.add(candidate.id);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
473
|
+
const componentFiles = [...new Set(read.projects.flatMap((one) => one.componentFiles))].sort(bytewise);
|
|
726
474
|
return {
|
|
727
475
|
matrix: read.matrix,
|
|
728
|
-
sweep:
|
|
729
|
-
|
|
730
|
-
|
|
476
|
+
sweep: sweep(read.matrix, {
|
|
477
|
+
...input,
|
|
478
|
+
exempt: read.exempt,
|
|
479
|
+
unanswered: read.unansweredHeld,
|
|
480
|
+
componentFiles,
|
|
481
|
+
unseenCallers: !read.declaresConsumers,
|
|
482
|
+
writeOnly: writtenOnly(read, input.mode),
|
|
483
|
+
}),
|
|
731
484
|
notBuilt: read.notBuilt,
|
|
732
485
|
unanswered: read.unanswered,
|
|
733
|
-
heldByUnanswered: [...held],
|
|
734
486
|
skipped: read.projects.flatMap((one) => one.skipped),
|
|
735
|
-
componentFiles: [...new Set(read.projects.flatMap((one) => one.componentFiles))].sort(compare),
|
|
736
487
|
};
|
|
737
488
|
}
|
|
738
489
|
/**
|
|
@@ -746,23 +497,32 @@ function sweptOf(read, input) {
|
|
|
746
497
|
export function runSweep(engine, host, scope, config, input, detectors = DETECTORS) {
|
|
747
498
|
return sweptOf(readRun(engine, host, scope, config, input.mode, detectors, () => undefined), input);
|
|
748
499
|
}
|
|
500
|
+
/** The project's own files below the target root that are no test file. */
|
|
501
|
+
function productionFiles(project, targetRoot, testFiles) {
|
|
502
|
+
const tests = new Set(testFiles);
|
|
503
|
+
return [...sourceFilesOf(project, targetRoot).byPath].flatMap(([path, file]) => tests.has(path) ? [] : [file]);
|
|
504
|
+
}
|
|
749
505
|
/** Reads a run's projects with every per-project fact an emitter reads. */
|
|
750
506
|
export function readEmitterRun(engine, host, scope, config, mode, detectors) {
|
|
751
507
|
const targetRoot = scope.target.path;
|
|
752
|
-
const run = readRun(engine, host, scope, config, mode, detectors, (project, read, references, testFiles) => ({
|
|
508
|
+
const run = readRun(engine, host, scope, config, mode, detectors, (project, read, references, testFiles, unseenLoads) => ({
|
|
753
509
|
deprecation: deprecatedDeclarations(project, read.held),
|
|
754
510
|
accessors: accessorsOf(project, read.held),
|
|
755
|
-
needs: projectNeeds(project, read.held, host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text)),
|
|
511
|
+
needs: projectNeeds(project, read.held, host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text), read.sources.configuration, read.sources.workflows),
|
|
756
512
|
implementations: implementations(project, read.held),
|
|
757
513
|
heldByInclusion: heldByInclusion(project, targetRoot),
|
|
758
|
-
generated:
|
|
514
|
+
generated: read.generated,
|
|
515
|
+
bindings: read.bindings,
|
|
759
516
|
inOperands: inOperandNames(project, targetRoot, testFiles),
|
|
760
517
|
rooted: read.rooted,
|
|
761
518
|
directives: inlineDirectives(project, read.held, targetRoot).filter((directive) => !read.referenceOnly.includes(directive.site.path)),
|
|
762
519
|
declarationsNamed: declarationsNamed(project, read.held, configuredDeclarations(config)),
|
|
763
520
|
parts: projectParts(project, read.held, references, targetRoot),
|
|
521
|
+
unseenLoads,
|
|
522
|
+
// Only a closed world reports an unnecessary export, which is all the carriers decide.
|
|
523
|
+
carriers: config.consumers.complete ? carriersOf(project, read.held) : NO_CARRIERS,
|
|
764
524
|
}));
|
|
765
|
-
// Whether a declaration carries the marker decides its code, so one whose
|
|
525
|
+
// Whether a declaration carries the marker decides its code, so one whose answer went
|
|
766
526
|
// unread is reported by nothing.
|
|
767
527
|
const unread = run.projects.flatMap((one) => one.extra.deprecation.unanswered);
|
|
768
528
|
return unread.length === 0
|
|
@@ -805,16 +565,11 @@ function judgedMembers(host, targetRoot, read) {
|
|
|
805
565
|
}
|
|
806
566
|
/** The directory of the nearest `package.json` at or above a file, inside `root`, else `root`. */
|
|
807
567
|
function nearestManifestDir(host, root, file) {
|
|
808
|
-
|
|
809
|
-
if (host.kindOf(joinPath(dir, "package.json")) === "file") {
|
|
810
|
-
return dir;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
return root;
|
|
568
|
+
return ancestors(dirnamePath(file), root).find((dir) => holdsManifest(host, dir)) ?? root;
|
|
814
569
|
}
|
|
815
570
|
/**
|
|
816
571
|
* The input every emitter reads over one sweep of a read run: the facts beside the sweep
|
|
817
|
-
* each
|
|
572
|
+
* each emitter reads, every per-project one read in the same session as the sweep.
|
|
818
573
|
*/
|
|
819
574
|
export function emitterInputOver(host, scope, config, read, input, selfCheck) {
|
|
820
575
|
const targetRoot = scope.target.path;
|
|
@@ -827,15 +582,20 @@ export function emitterInputOver(host, scope, config, read, input, selfCheck) {
|
|
|
827
582
|
deprecated: new Set(projects.flatMap((one) => one.extra.deprecation.deprecated)),
|
|
828
583
|
stores: storesOf(projects.map((one) => ({
|
|
829
584
|
references: one.configured.references,
|
|
585
|
+
support: new Set(one.configured.supportFiles ?? []),
|
|
830
586
|
accessors: one.extra.accessors,
|
|
831
|
-
})), swept.exempt, input.mode),
|
|
832
|
-
dependencies: dependenciesOf(host, targetRoot, [...projects.map((one) => one.extra.needs), configurationNeeds(read.conventionUses)], swept.sweep.candidates.map((candidate) => candidate.id), members.read, members.unbuilt, read.nestedDirs),
|
|
587
|
+
})), swept.sweep.exempt, input.mode),
|
|
588
|
+
dependencies: dependenciesOf(host, targetRoot, read.workflows, [...projects.map((one) => one.extra.needs), configurationNeeds(read.conventionUses)], swept.sweep.candidates.map((candidate) => candidate.id), members.read, members.unbuilt, read.nestedDirs),
|
|
833
589
|
implementations: mergeImplementations(projects.map((one) => one.extra.implementations)),
|
|
834
590
|
files: {
|
|
835
591
|
tree: sourceTree(host, targetRoot),
|
|
836
592
|
heldByInclusion: new Set(projects.flatMap((one) => one.extra.heldByInclusion)),
|
|
837
|
-
generated: new Set(projects.flatMap((one) => one.extra.generated)),
|
|
593
|
+
generated: new Set(projects.flatMap((one) => [...one.extra.generated.keys()])),
|
|
838
594
|
inOperands: new Set(projects.flatMap((one) => one.extra.inOperands)),
|
|
595
|
+
unseenLoads: projects.flatMap((one) => one.extra.unseenLoads),
|
|
596
|
+
unwrittenRuns: new Set(projects.flatMap((one) => one.heldScripts
|
|
597
|
+
.filter((held) => held.unwritten)
|
|
598
|
+
.map((held) => relativePath(resolvePath(host.workingDirectory(), targetRoot), held.dir) ?? "."))),
|
|
839
599
|
},
|
|
840
600
|
boundary: {
|
|
841
601
|
consumers: {
|
|
@@ -844,9 +604,17 @@ export function emitterInputOver(host, scope, config, read, input, selfCheck) {
|
|
|
844
604
|
},
|
|
845
605
|
encapsulated: readManifest(host, targetRoot).declaresExports,
|
|
846
606
|
edges: readEdgeSides(host, targetRoot),
|
|
607
|
+
filledOutside: new Set(projects.flatMap((one) => one.filledOutside)),
|
|
608
|
+
possiblyLoaded: new Set(projects.flatMap((one) => one.possiblyLoaded)),
|
|
609
|
+
carriers: {
|
|
610
|
+
named: new Map([
|
|
611
|
+
...Map.groupBy(projects.flatMap((one) => [...one.extra.carriers.named]), ([id]) => id),
|
|
612
|
+
].map(([id, entries]) => [id, [...new Set(entries.flatMap(([, named]) => named))]])),
|
|
613
|
+
unread: new Set(projects.flatMap((one) => [...one.extra.carriers.unread])),
|
|
614
|
+
},
|
|
847
615
|
},
|
|
848
616
|
selfCheck,
|
|
849
|
-
intraFunction: intraFunctionFacts(projects.map((one) => one.extra.parts), projects.flatMap((one) => one.configured.references), new Set([...swept.exempt.map((one) => one.id), ...swept.
|
|
617
|
+
intraFunction: intraFunctionFacts(projects.map((one) => one.extra.parts), projects.flatMap((one) => one.configured.references), new Set([...swept.sweep.exempt.map((one) => one.id), ...swept.sweep.held])),
|
|
850
618
|
};
|
|
851
619
|
}
|
|
852
620
|
/**
|
|
@@ -854,7 +622,7 @@ export function emitterInputOver(host, scope, config, read, input, selfCheck) {
|
|
|
854
622
|
* directives, the ignore file's entries and the baseline's rows are bound before any
|
|
855
623
|
* sweep, and the run is swept once under every bound record's mark and once under none,
|
|
856
624
|
* so a record is decided against the finding its code would have produced. The
|
|
857
|
-
*
|
|
625
|
+
* configuration family reports the refused suppressions and the roots that named nothing.
|
|
858
626
|
* Beside the inputs it answers the projects and test-file rules a report names.
|
|
859
627
|
*/
|
|
860
628
|
function readAnalysis(engine, host, scope, config, provenance, mode, detectors) {
|
|
@@ -872,7 +640,7 @@ function readAnalysis(engine, host, scope, config, provenance, mode, detectors)
|
|
|
872
640
|
id: one.configured.configuration,
|
|
873
641
|
configFile: one.configFile,
|
|
874
642
|
})),
|
|
875
|
-
testFileRules: testFileRulesOf(config.ts.
|
|
643
|
+
testFileRules: testFileRulesOf(config.ts.test_files, read.projects.flatMap((one) => one.configured.testFiles), read.projects.flatMap((one) => one.configured.supportFiles ?? [])),
|
|
876
644
|
typeErrorSkips: read.projects.flatMap((one) => one.typeErrorSkips),
|
|
877
645
|
componentWarnings: [
|
|
878
646
|
...new Map(read.projects
|
|
@@ -884,8 +652,14 @@ function readAnalysis(engine, host, scope, config, provenance, mode, detectors)
|
|
|
884
652
|
unanswered: read.unanswered,
|
|
885
653
|
componentsUnread: read.componentsUnread,
|
|
886
654
|
librariesUnfound: read.librariesUnfound,
|
|
655
|
+
unresolvedSpecifiers: read.unresolvedSpecifiers,
|
|
656
|
+
unread: read.unread,
|
|
887
657
|
conventionsApplied: read.conventionsApplied,
|
|
888
658
|
unmappedEntries: unmappedEverywhere(read.projects),
|
|
659
|
+
heldScripts: read.projects.flatMap((one) => one.heldScripts.map((held) => ({ ...held, configFile: one.configFile }))),
|
|
660
|
+
unseenLoads: read.projects.flatMap((one) => one.extra.unseenLoads),
|
|
661
|
+
generated: new Map(read.projects.flatMap((one) => [...one.extra.generated])),
|
|
662
|
+
bindings: distinctBindings(read.projects.flatMap((one) => one.extra.bindings)),
|
|
889
663
|
},
|
|
890
664
|
configured: read.projects.map((one) => one.configured),
|
|
891
665
|
symbols,
|
|
@@ -901,7 +675,7 @@ function inputsOver(host, scope, config, provenance, mode, read, documents) {
|
|
|
901
675
|
};
|
|
902
676
|
const facts = {
|
|
903
677
|
refusals: suppressions.refusals,
|
|
904
|
-
unmatchedRoots: unmatchedEverywhere(config.
|
|
678
|
+
unmatchedRoots: unmatchedEverywhere(config.roots.patterns, read.projects.map((one) => one.extra.rooted)),
|
|
905
679
|
rootsDocument: documentOf(host, provenance, ROOTS_SETTING, targetRoot),
|
|
906
680
|
unmatchedDeclarations: configuredDeclarations(config)
|
|
907
681
|
.filter((_, at) => !read.projects.some((one) => one.extra.declarationsNamed[at] === true))
|
|
@@ -937,7 +711,7 @@ function unmappedEverywhere(projects) {
|
|
|
937
711
|
}
|
|
938
712
|
/**
|
|
939
713
|
* The analysis of the run the scope and the configuration describe: the run read with its
|
|
940
|
-
* suppressions bound, every
|
|
714
|
+
* suppressions bound, every emitter's findings with the suppressions applied and the
|
|
941
715
|
* declared edges evaluated, the projects and test-file rules the report names, and the sweep
|
|
942
716
|
* an explanation reads.
|
|
943
717
|
*/
|
|
@@ -948,12 +722,16 @@ export function runAnalysis(engine, host, scope, config, provenance, mode, detec
|
|
|
948
722
|
}
|
|
949
723
|
/**
|
|
950
724
|
* One count per configuration of the run in which the checker left a question unanswered:
|
|
951
|
-
* the questions asked in its project,
|
|
725
|
+
* the questions asked in its project, a formed program's manifest that does not parse or cannot
|
|
726
|
+
* be read and a package whose command strings name files the project holds each counted as one, and the
|
|
727
|
+
* declarations of its own the run holds for them.
|
|
952
728
|
*/
|
|
953
729
|
export function unansweredCounts(analysis) {
|
|
954
|
-
const held = new Set(analysis.swept.
|
|
730
|
+
const held = new Set(analysis.swept.sweep.held);
|
|
955
731
|
return analysis.run.projects.flatMap((project) => {
|
|
956
|
-
const questions = analysis.run.unanswered.filter((one) => one.configFile === project.configFile).length
|
|
732
|
+
const questions = analysis.run.unanswered.filter((one) => one.configFile === project.configFile).length +
|
|
733
|
+
analysis.run.unread.filter((one) => one.kind === "manifest" && one.configFile === project.configFile).length +
|
|
734
|
+
analysis.run.heldScripts.filter((one) => one.configFile === project.configFile && one.files.length > 0).length;
|
|
957
735
|
if (questions === 0) {
|
|
958
736
|
return [];
|
|
959
737
|
}
|