@cplieger/deadset-ts 8.0.0-dev.1 → 8.0.0-dev.10
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 +1 -1
- package/dist/bin/mapper-connection.js +2 -1
- package/dist/bin/node-host.js +24 -5
- package/dist/src/analysis.js +181 -341
- package/dist/src/augmentations.js +106 -13
- package/dist/src/automatic-types.js +10 -29
- package/dist/src/build-scripts.js +425 -0
- package/dist/src/component-layer.js +4 -2
- package/dist/src/components.js +2 -3
- package/dist/src/config.js +6 -82
- package/dist/src/configuration-files.js +28 -176
- package/dist/src/configured-declarations.js +15 -20
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/consumers.js +3 -30
- package/dist/src/contextual-uses.js +56 -9
- package/dist/src/contract/config.generated.js +558 -0
- package/dist/src/contract/contract.generated.js +1244 -0
- package/dist/src/contract/report.generated.js +862 -0
- package/dist/src/convention-rows.js +73 -3
- package/dist/src/conventions.js +36 -66
- package/dist/src/dependencies.js +103 -40
- package/dist/src/edges.js +38 -122
- package/dist/src/element-access.js +4 -6
- package/dist/src/entry-point-gaps.js +2 -8
- package/dist/src/entry-points.js +11 -27
- package/dist/src/enum-group.js +3 -10
- package/dist/src/erased-stores.js +4 -6
- package/dist/src/exempt-classes.js +1 -63
- package/dist/src/exempt.js +21 -40
- package/dist/src/failure.js +36 -0
- package/dist/src/file-facts.js +2 -25
- package/dist/src/findings/completion.js +139 -72
- package/dist/src/findings/dependencies-and-module-machinery.js +4 -5
- package/dist/src/findings/emitters.js +5 -5
- package/dist/src/findings/interfaces.js +4 -5
- package/dist/src/findings/intra-function.js +13 -10
- package/dist/src/findings/non-code-artifacts.js +7 -8
- package/dist/src/findings/reads-and-writes.js +16 -13
- package/dist/src/findings/self-check.js +10 -12
- package/dist/src/findings/unused-declarations.js +41 -32
- package/dist/src/findings/visibility-narrowing.js +19 -16
- package/dist/src/findings-pass.js +8 -15
- package/dist/src/framework-lifecycle.js +7 -7
- package/dist/src/fs/document.js +52 -0
- package/dist/src/fs/manifest.js +72 -0
- package/dist/src/fs/tree.js +88 -0
- package/dist/src/generated-file.js +7 -4
- package/dist/src/git-ignore.js +39 -26
- package/dist/src/graph.js +5 -3
- package/dist/src/html-entries.js +6 -33
- package/dist/src/in-operands.js +2 -1
- package/dist/src/index.js +1 -1
- package/dist/src/injection-container.js +1 -1
- package/dist/src/intra-function-parts.js +63 -43
- package/dist/src/inventory.js +2 -21
- package/dist/src/javascript-file.js +33 -0
- package/dist/src/json-document.js +198 -67
- package/dist/src/keyof-comparisons.js +4 -6
- package/dist/src/kinds.js +3 -366
- package/dist/src/load/classify.js +270 -0
- package/dist/src/load/diagnostics.js +80 -0
- package/dist/src/load/discover.js +277 -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/plan.js +313 -0
- package/dist/src/load/specifiers.js +115 -0
- package/dist/src/load/synthesize.js +140 -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} +23 -65
- 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/manifest.js +49 -54
- package/dist/src/matrix.js +76 -4
- package/dist/src/mdx-entries.js +3 -26
- package/dist/src/outside-tests.js +1 -1
- package/dist/src/partial.js +2 -1
- package/dist/src/paths.js +26 -15
- package/dist/src/position.js +2 -1
- package/dist/src/print.js +11 -79
- package/dist/src/product.js +13 -0
- package/dist/src/query.js +1 -0
- package/dist/src/ref.js +1 -0
- package/dist/src/references.js +48 -30
- 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 +245 -729
- package/dist/src/roots.js +273 -87
- package/dist/src/run.js +66 -77
- package/dist/src/schema.js +320 -343
- package/dist/src/scope.js +38 -115
- package/dist/src/serialization-contract.js +595 -21
- package/dist/src/session.js +34 -29
- package/dist/src/source-files.js +1 -1
- package/dist/src/suppress-file.js +25 -28
- package/dist/src/suppress-inline.js +3 -2
- package/dist/src/suppress.js +33 -51
- package/dist/src/sweep.js +7 -9
- package/dist/src/symbol-keys.js +3 -5
- package/dist/src/template-field.js +9 -19
- package/dist/src/test-support.js +8 -11
- package/dist/src/text/compare.js +26 -0
- package/dist/src/text/glob.js +194 -0
- package/dist/src/text/named-files.js +54 -0
- package/dist/src/text/shell.js +159 -0
- package/dist/src/text/yaml.js +393 -0
- package/dist/src/type-errors.js +11 -232
- package/dist/src/unseen-loads.js +100 -0
- package/dist/src/unwrap.js +23 -0
- package/dist/src/usage.js +10 -0
- package/dist/src/verbs/analyze.js +166 -126
- package/dist/src/verbs/describe.js +9 -16
- package/dist/src/verbs/explain.js +10 -7
- 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 +4 -2
- 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/dist/src/workflow-steps.js +62 -64
- package/jsr.json +1 -1
- package/package.json +4 -3
- package/src/analysis.ts +245 -502
- package/src/augmentations.ts +135 -17
- package/src/automatic-types.ts +11 -29
- package/src/build-scripts.ts +543 -0
- package/src/component-layer.ts +4 -2
- package/src/components.ts +2 -4
- package/src/config.ts +31 -302
- package/src/configuration-files.ts +34 -179
- package/src/configured-declarations.ts +18 -23
- package/src/conformance-record.ts +1 -1
- package/src/consumers.ts +6 -57
- package/src/contextual-uses.ts +64 -12
- package/src/contract/config.generated.ts +818 -0
- package/src/contract/contract.generated.ts +1308 -0
- package/src/contract/report.generated.ts +1237 -0
- package/src/convention-rows.ts +85 -3
- package/src/conventions.ts +46 -84
- package/src/dependencies.ts +118 -46
- package/src/edges.ts +41 -140
- package/src/element-access.ts +4 -7
- package/src/entry-point-gaps.ts +3 -9
- package/src/entry-points.ts +12 -38
- package/src/enum-group.ts +2 -11
- package/src/erased-stores.ts +3 -7
- package/src/exempt-classes.ts +1 -75
- package/src/exempt.ts +36 -50
- package/src/failure.ts +63 -0
- package/src/file-facts.ts +9 -24
- package/src/finding.ts +14 -9
- package/src/findings/boundary.ts +2 -0
- package/src/findings/completion.ts +181 -84
- package/src/findings/dependencies-and-module-machinery.ts +4 -7
- package/src/findings/emitter.ts +8 -9
- package/src/findings/emitters.ts +7 -7
- package/src/findings/interfaces.ts +4 -6
- package/src/findings/intra-function.ts +13 -11
- package/src/findings/non-code-artifacts.ts +9 -11
- package/src/findings/reads-and-writes.ts +20 -16
- package/src/findings/self-check.ts +11 -17
- package/src/findings/unused-declarations.ts +45 -32
- package/src/findings/visibility-narrowing.ts +20 -17
- package/src/findings-pass.ts +10 -19
- package/src/framework-lifecycle.ts +7 -7
- package/src/fs/document.ts +70 -0
- package/src/fs/manifest.ts +92 -0
- package/src/fs/tree.ts +110 -0
- package/src/generated-file.ts +7 -4
- package/src/git-ignore.ts +50 -26
- package/src/graph.ts +5 -3
- package/src/host.ts +12 -5
- package/src/html-entries.ts +6 -33
- package/src/in-operands.ts +2 -1
- package/src/index.ts +1 -1
- package/src/injection-container.ts +1 -1
- package/src/intra-function-parts.ts +73 -44
- package/src/inventory.ts +2 -20
- package/src/javascript-file.ts +37 -0
- package/src/json-document.ts +241 -76
- package/src/keyof-comparisons.ts +3 -7
- package/src/kinds.ts +5 -413
- package/src/load/classify.ts +397 -0
- package/src/load/diagnostics.ts +144 -0
- package/src/load/discover.ts +455 -0
- package/src/{emit-map.ts → load/emit-map.ts} +1 -1
- package/src/load/expected-module.ts +188 -0
- package/src/load/load.ts +73 -0
- package/src/load/module-lookup.ts +50 -0
- package/src/load/plan.ts +504 -0
- package/src/load/specifiers.ts +168 -0
- package/src/load/synthesize.ts +211 -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} +33 -76
- package/src/{workspace-run.ts → load/workspace-run.ts} +18 -16
- package/src/{workspace.ts → load/workspace.ts} +90 -134
- package/src/manifest.ts +81 -75
- package/src/matrix.ts +122 -4
- package/src/mdx-entries.ts +3 -26
- package/src/outside-tests.ts +1 -1
- package/src/partial.ts +3 -2
- package/src/paths.ts +27 -15
- package/src/position.ts +2 -1
- package/src/print.ts +12 -92
- package/src/product.ts +18 -0
- package/src/query.ts +11 -0
- package/src/ref.ts +1 -0
- package/src/references.ts +52 -31
- package/src/report-schema.ts +68 -0
- package/src/report.ts +101 -224
- 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 +283 -1114
- package/src/roots.ts +339 -104
- package/src/run.ts +75 -91
- package/src/schema.ts +391 -388
- package/src/scope.ts +46 -138
- package/src/serialization-contract.ts +763 -22
- package/src/session.ts +70 -54
- package/src/source-files.ts +1 -1
- package/src/suppress-file.ts +24 -33
- package/src/suppress-inline.ts +2 -2
- package/src/suppress.ts +43 -58
- package/src/sweep.ts +23 -9
- package/src/symbol-keys.ts +2 -5
- package/src/template-field.ts +15 -25
- package/src/test-support.ts +17 -13
- package/src/text/compare.ts +27 -0
- package/src/text/glob.ts +210 -0
- package/src/text/named-files.inputs.json +1522 -0
- package/src/text/named-files.ts +68 -0
- package/src/text/shell.ts +161 -0
- package/src/text/yaml.ts +423 -0
- package/src/type-errors.ts +18 -288
- package/src/unseen-loads.ts +134 -0
- package/src/unwrap.ts +34 -0
- package/src/usage.ts +10 -0
- package/src/verbs/analyze.ts +224 -162
- package/src/verbs/describe.ts +14 -15
- package/src/verbs/explain.ts +10 -11
- package/src/verbs/print-config.ts +2 -1
- package/src/verbs/print-projects.ts +6 -4
- package/src/verbs/print-retained.ts +4 -2
- package/src/verbs/print-roots.ts +4 -2
- package/src/verbs/verb.ts +2 -8
- package/src/verbs/version.ts +15 -3
- package/src/workflow-steps.ts +74 -64
- package/dist/src/base-url.js +0 -18
- package/dist/src/discover.js +0 -468
- package/dist/src/glob.js +0 -65
- package/dist/src/pnpm-workspace.js +0 -120
- package/dist/src/setup-failure.js +0 -23
- package/dist/src/test-joins.js +0 -101
- package/dist/src/version.js +0 -7
- package/src/base-url.ts +0 -24
- package/src/discover.ts +0 -653
- package/src/glob.ts +0 -67
- package/src/pnpm-workspace.ts +0 -135
- package/src/setup-failure.ts +0 -39
- package/src/test-joins.ts +0 -120
- package/src/version.ts +0 -7
package/src/analysis.ts
CHANGED
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
* another project's checker, which holds only for views the session hands out.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { isStringLiteralLikeNode } from "@typescript/native/ast";
|
|
9
|
+
import { isStringLiteralLikeNode, type SourceFile } from "@typescript/native/ast";
|
|
10
10
|
import { lineOf, readComponent } from "./component-files.ts";
|
|
11
|
-
import { kindOf, type
|
|
12
|
-
import {
|
|
13
|
-
consumerLoads,
|
|
14
|
-
consumerReferences,
|
|
15
|
-
moduleIdentity,
|
|
16
|
-
type LoadedConsumer,
|
|
17
|
-
} from "./consumers.ts";
|
|
11
|
+
import { kindOf, type PartialConfig, type Provenance, type ResolvedConfig } from "./config.ts";
|
|
12
|
+
import { consumerReferences } from "./consumers.ts";
|
|
18
13
|
import {
|
|
19
14
|
configuredDeclarations,
|
|
20
15
|
configuredRef,
|
|
@@ -23,26 +18,10 @@ import {
|
|
|
23
18
|
import { decorator } from "./decorator.ts";
|
|
24
19
|
import { configurationNeeds, dependenciesOf, projectNeeds } from "./dependencies.ts";
|
|
25
20
|
import { deprecatedDeclarations, type Deprecation } from "./deprecation.ts";
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
MISSING_GLOBAL_TYPE,
|
|
31
|
-
projectErrors,
|
|
32
|
-
renderDiagnostic,
|
|
33
|
-
targetRelative,
|
|
34
|
-
withBaseUrlPaths,
|
|
35
|
-
type LocatedDiagnostic,
|
|
36
|
-
type NotBuilt,
|
|
37
|
-
} from "./discover.ts";
|
|
38
|
-
import {
|
|
39
|
-
conventionFailuresFor,
|
|
40
|
-
generatedFiles,
|
|
41
|
-
readConventions,
|
|
42
|
-
type AppliedConvention,
|
|
43
|
-
type ConventionManifest,
|
|
44
|
-
type Conventions,
|
|
45
|
-
} from "./conventions.ts";
|
|
21
|
+
import { moduleIdentity, type LoadedConsumer, type NotBuilt } from "./load/discover.ts";
|
|
22
|
+
import type { LibraryUnfound } from "./load/classify.ts";
|
|
23
|
+
import { loadRun, type LoadedRun } from "./load/load.ts";
|
|
24
|
+
import { generatedFiles, type AppliedConvention } from "./conventions.ts";
|
|
46
25
|
import { readEdgeSides } from "./edges.ts";
|
|
47
26
|
import { enumGroup } from "./enum-group.ts";
|
|
48
27
|
import { generatedFile, generatedFilesOf } from "./generated-file.ts";
|
|
@@ -56,12 +35,12 @@ import {
|
|
|
56
35
|
holdingWhile,
|
|
57
36
|
isUnansweredRecord,
|
|
58
37
|
retainedIn,
|
|
38
|
+
writtenRecords,
|
|
59
39
|
type Detector,
|
|
60
40
|
type Detectors,
|
|
61
41
|
} from "./exempt.ts";
|
|
62
42
|
import type { TSExemptionClass } from "./exempt-classes.ts";
|
|
63
43
|
import { heldByInclusion, sourcePaths, sourceTree } from "./file-facts.ts";
|
|
64
|
-
import { globExpression } from "./glob.ts";
|
|
65
44
|
import type { Finding } from "./finding.ts";
|
|
66
45
|
import { findingsPass, recordedFindings, rowKey, type PassResult } from "./findings-pass.ts";
|
|
67
46
|
import type { EmitterInput } from "./findings/emitter.ts";
|
|
@@ -73,7 +52,7 @@ import { injectionContainer } from "./injection-container.ts";
|
|
|
73
52
|
import { interfaceSatisfaction, settledSatisfaction } from "./interface-satisfaction.ts";
|
|
74
53
|
import { intraFunctionFacts, projectParts, type ProjectParts } from "./intra-function-parts.ts";
|
|
75
54
|
import { inventory, type Inventory, type InventorySymbol } from "./inventory.ts";
|
|
76
|
-
import {
|
|
55
|
+
import { readManifest, type ManifestEntry } from "./manifest.ts";
|
|
77
56
|
import {
|
|
78
57
|
liveFilesAt,
|
|
79
58
|
matrixOf,
|
|
@@ -84,53 +63,46 @@ import {
|
|
|
84
63
|
type SweepResult,
|
|
85
64
|
} from "./matrix.ts";
|
|
86
65
|
import {
|
|
66
|
+
ancestors,
|
|
87
67
|
dirnamePath,
|
|
88
68
|
extensionOf,
|
|
89
69
|
joinPath,
|
|
90
|
-
normalizePath,
|
|
91
70
|
relativePath,
|
|
92
71
|
resolvePath,
|
|
93
72
|
} from "./paths.ts";
|
|
94
73
|
import type { UnansweredQuestion } from "./query.ts";
|
|
95
74
|
import { byPosition, isComponentFile, type Position } from "./position.ts";
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
pathsOf,
|
|
100
|
-
readErrors,
|
|
101
|
-
skippedRoots,
|
|
102
|
-
skippedUnits,
|
|
103
|
-
type SkippedUnit,
|
|
104
|
-
} from "./type-errors.ts";
|
|
75
|
+
import type { TypeErrorSkip, UnansweredCount } from "./report.ts";
|
|
76
|
+
import { skippedRoots, skippedUnits, type SkippedUnit } from "./type-errors.ts";
|
|
105
77
|
import { reflectiveLookup } from "./reflective-lookup.ts";
|
|
106
78
|
import { references, testFileRulesOf, type Reference, type TestFileRule } from "./references.ts";
|
|
107
79
|
import {
|
|
108
80
|
roots,
|
|
109
81
|
unmatchedEverywhere,
|
|
82
|
+
type Root,
|
|
110
83
|
type RootKind,
|
|
111
|
-
type RootOptions,
|
|
112
84
|
type Roots,
|
|
85
|
+
type HeldScripts,
|
|
113
86
|
} from "./roots.ts";
|
|
114
87
|
import type { Scope } from "./scope.ts";
|
|
115
|
-
import { serializationContract } from "./serialization-contract.ts";
|
|
88
|
+
import { decodedMembers, serializationContract, type Decoded } from "./serialization-contract.ts";
|
|
116
89
|
import { outsideTestReferences, testFilesAt, type OutsideTest } from "./outside-tests.ts";
|
|
117
|
-
import {
|
|
90
|
+
import { mergedGlobalInterfaces } from "./augmentations.ts";
|
|
91
|
+
import { unseenLoadsOf, type UnseenLoad } from "./unseen-loads.ts";
|
|
92
|
+
import type { UnresolvedSpecifier } from "./load/specifiers.ts";
|
|
93
|
+
import type { UnreadInput } from "./load/plan.ts";
|
|
94
|
+
import { GLOBALS_RUNNER, namesTestGlobals } from "./load/test-globals.ts";
|
|
118
95
|
import { supportReferences, testSupportFiles, type TestEvidence } from "./test-support.ts";
|
|
119
|
-
import {
|
|
120
|
-
diagnosticsOf,
|
|
121
|
-
ownedAs,
|
|
122
|
-
runSession,
|
|
123
|
-
type Engine,
|
|
124
|
-
type OpenedFiles,
|
|
125
|
-
type ProjectView,
|
|
126
|
-
} from "./session.ts";
|
|
96
|
+
import type { Engine, ProjectView } from "./session.ts";
|
|
127
97
|
import { accessorsOf, storesOf } from "./stores.ts";
|
|
128
98
|
import { isPartKind, type SuppressionRecord, type Suppressions, type Verdict } from "./suppress.ts";
|
|
129
99
|
import { bindRows, readBaseline, readIgnoreFile, type Recorded } from "./suppress-file.ts";
|
|
130
100
|
import { inlineDirectives, inlineSuppressions, type InlineDirective } from "./suppress-inline.ts";
|
|
131
101
|
import type { Exemption, Mode, SweepInput } from "./sweep.ts";
|
|
132
102
|
import { readTemplates, templateField } from "./template-field.ts";
|
|
133
|
-
import {
|
|
103
|
+
import { bytewise } from "./text/compare.ts";
|
|
104
|
+
import { holdsManifest, manifestAt } from "./fs/manifest.ts";
|
|
105
|
+
import { globExpression } from "./text/glob.ts";
|
|
134
106
|
|
|
135
107
|
/** The setting whose source decides where a finding about a configured root sits. */
|
|
136
108
|
const ROOTS_SETTING = "roots.patterns";
|
|
@@ -187,14 +159,6 @@ function documentOf(
|
|
|
187
159
|
return relativePath(resolvePath(host.workingDirectory(), targetRoot), document) ?? "";
|
|
188
160
|
}
|
|
189
161
|
|
|
190
|
-
/** Two strings ordered bytewise. */
|
|
191
|
-
function compare(a: string, b: string): number {
|
|
192
|
-
if (a === b) {
|
|
193
|
-
return 0;
|
|
194
|
-
}
|
|
195
|
-
return a < b ? -1 : 1;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
162
|
/** What every stage after the root set reads of one project. */
|
|
199
163
|
interface ProjectRead {
|
|
200
164
|
readonly configuration: string;
|
|
@@ -224,329 +188,48 @@ interface OpenedProject {
|
|
|
224
188
|
readonly read: () => ProjectRead;
|
|
225
189
|
}
|
|
226
190
|
|
|
227
|
-
/** What a run
|
|
228
|
-
interface
|
|
229
|
-
|
|
230
|
-
readonly loaded: readonly LoadedConsumer[];
|
|
191
|
+
/** What reading a loaded run's projects answered. */
|
|
192
|
+
interface ProjectsRead<Answer> {
|
|
193
|
+
readonly answers: readonly Answer[];
|
|
231
194
|
/** Every reference a consumer makes to a declaration of the target, each once. */
|
|
232
195
|
readonly references: readonly Reference[];
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/** What a run read of its projects: each target project's answer, and its consumers. */
|
|
236
|
-
interface ReadProjects<Answer> {
|
|
237
|
-
readonly answers: readonly Answer[];
|
|
238
|
-
readonly consumers: ConsumerReads;
|
|
239
|
-
/** The derived configurations the run dropped, in the order it met them. */
|
|
240
|
-
readonly notBuilt: readonly NotBuilt[];
|
|
241
|
-
/** Every question the checker could not answer, each once. */
|
|
242
|
-
readonly unanswered: readonly UnansweredQuestion[];
|
|
243
|
-
/** Per configuration whose component files the run cannot read, the reason. */
|
|
244
|
-
readonly componentsUnread: readonly ComponentsUnread[];
|
|
245
|
-
/** Per analyzed configuration, each library it names that the compiler cannot find. */
|
|
246
|
-
readonly librariesUnfound: readonly LibraryUnfound[];
|
|
247
|
-
/** The convention rows the run applied. */
|
|
248
|
-
readonly conventionsApplied: readonly AppliedConvention[];
|
|
249
|
-
/** The dependencies the applied rows' short names use. */
|
|
250
|
-
readonly conventionUses: readonly string[];
|
|
251
|
-
/** The directory of every workspace member, absolute. */
|
|
252
|
-
readonly memberDirs: readonly string[];
|
|
253
|
-
/** The directory of every nested package, absolute. */
|
|
254
|
-
readonly nestedDirs: readonly string[];
|
|
255
196
|
/** The test files below the target root no project the run reads holds, parsed. */
|
|
256
197
|
readonly outsideTests: readonly OutsideTest[];
|
|
257
198
|
}
|
|
258
199
|
|
|
259
200
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
|
|
263
|
-
function conventionManifests(
|
|
264
|
-
host: Host,
|
|
265
|
-
targetRoot: string,
|
|
266
|
-
memberDirs: readonly string[],
|
|
267
|
-
nestedDirs: readonly string[],
|
|
268
|
-
): readonly ConventionManifest[] {
|
|
269
|
-
const found = new Map<string, ConventionManifest>();
|
|
270
|
-
if (host.kindOf(joinPath(targetRoot, "package.json")) === "file") {
|
|
271
|
-
found.set(targetRoot, { dir: targetRoot, path: "package.json" });
|
|
272
|
-
}
|
|
273
|
-
for (const [dirs, nested] of [
|
|
274
|
-
[memberDirs, false],
|
|
275
|
-
[nestedDirs, true],
|
|
276
|
-
] as const) {
|
|
277
|
-
for (const dir of dirs) {
|
|
278
|
-
const below = relativePath(targetRoot, dir);
|
|
279
|
-
if (below !== undefined && !found.has(dir)) {
|
|
280
|
-
found.set(dir, { dir, path: `${below}/package.json`, nested });
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return [...found.values()];
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The nested packages of a run: each directory below the target root, in no `node_modules`
|
|
289
|
-
* directory and none of `known`, that holds a `package.json` and lies at or above one of
|
|
290
|
-
* `files`, the program's source files and the compiler configuration files, in path order.
|
|
291
|
-
*/
|
|
292
|
-
function nestedPackageDirs(
|
|
293
|
-
host: Host,
|
|
294
|
-
targetRoot: string,
|
|
295
|
-
files: Iterable<string>,
|
|
296
|
-
known: ReadonlySet<string>,
|
|
297
|
-
): readonly string[] {
|
|
298
|
-
const seen = new Set<string>();
|
|
299
|
-
const found: string[] = [];
|
|
300
|
-
for (const file of files) {
|
|
301
|
-
for (
|
|
302
|
-
let dir = dirnamePath(file);
|
|
303
|
-
dir !== targetRoot && !seen.has(dir) && relativePath(targetRoot, dir) !== undefined;
|
|
304
|
-
dir = dirnamePath(dir)
|
|
305
|
-
) {
|
|
306
|
-
seen.add(dir);
|
|
307
|
-
const below = relativePath(targetRoot, dir) ?? "";
|
|
308
|
-
if (
|
|
309
|
-
!below.split("/").includes("node_modules") &&
|
|
310
|
-
!known.has(dir) &&
|
|
311
|
-
host.kindOf(joinPath(dir, "package.json")) === "file"
|
|
312
|
-
) {
|
|
313
|
-
found.push(dir);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return found.sort(compare);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Reads every project the scope discovers, and each declared consumer's, in one snapshot,
|
|
322
|
-
* each checked for errors first. `stage` is handed a target project and enumerates and roots
|
|
323
|
-
* it if it reads it; a consumer project is read for its references to the target. A type error
|
|
324
|
-
* in an own file skips the unit holding it. A guess that does not load or meets a setup failure
|
|
325
|
-
* is dropped into `notBuilt` (see {@link isGuess}); any other such project fails the run, as
|
|
326
|
-
* does a run whose every guess was dropped.
|
|
201
|
+
* Reads every project the load phase analyzes through `stage`, which enumerates and roots one
|
|
202
|
+
* if it reads it, and each declared consumer's project for its references to the target,
|
|
203
|
+
* in the same snapshot. A type error in an own file skips the unit holding it.
|
|
327
204
|
*/
|
|
328
205
|
function readProjects<Answer>(
|
|
329
206
|
engine: Engine,
|
|
330
207
|
host: Host,
|
|
331
208
|
scope: Scope,
|
|
332
|
-
config:
|
|
209
|
+
config: PartialConfig,
|
|
333
210
|
stage: <Brand>(project: ProjectView<Brand>, opened: OpenedProject) => Answer,
|
|
334
|
-
):
|
|
211
|
+
): LoadedRun<ProjectsRead<Answer>> {
|
|
335
212
|
const targetRoot = scope.target.path;
|
|
336
|
-
const discovered = discoverProjects(engine, host, scope, config.analysis.configurations);
|
|
337
|
-
if (discovered.configFiles.length === 0 && discovered.notBuilt.length === 0) {
|
|
338
|
-
throw new DiscoveryError(
|
|
339
|
-
`${targetRoot} holds no compiler configuration, so the run holds no program`,
|
|
340
|
-
[],
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
const ids = new Map(discovered.projects.map((project) => [project.configFile, project.id]));
|
|
344
|
-
const loads = consumerLoads(engine, host, scope, discovered.configFiles);
|
|
345
|
-
const consumerOf = new Map(
|
|
346
|
-
loads.flatMap((load) =>
|
|
347
|
-
load.configFiles.map((configFile) => [configFile, load.consumer] as const),
|
|
348
|
-
),
|
|
349
|
-
);
|
|
350
213
|
const absoluteRoot = resolvePath(host.workingDirectory(), targetRoot);
|
|
351
|
-
const
|
|
352
|
-
engine,
|
|
353
|
-
host,
|
|
354
|
-
absoluteRoot,
|
|
355
|
-
discovered.configFiles,
|
|
356
|
-
readManifest(host, targetRoot),
|
|
357
|
-
);
|
|
214
|
+
const testPatterns = config.ts.test_files.map(globExpression);
|
|
358
215
|
const parse = (fileName: string, text: string) => engine.parseSourceFile(fileName, text);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
let nestedDirs: readonly string[] = [];
|
|
363
|
-
let conventions = readConventions(host, parse, [], config.ts.disabledConventions);
|
|
364
|
-
let options: RootOptions & { readonly parse: typeof parse; readonly conventions: Conventions };
|
|
365
|
-
const readManifests = (opened: readonly OpenedFiles[]): void => {
|
|
366
|
-
nestedDirs = nestedPackageDirs(
|
|
367
|
-
host,
|
|
368
|
-
normalizePath(absoluteRoot),
|
|
369
|
-
opened
|
|
370
|
-
.filter((one) => !consumerOf.has(one.configFile))
|
|
371
|
-
.flatMap((one) => [one.configFile, ...one.fileNames()]),
|
|
372
|
-
new Set(memberDirs),
|
|
373
|
-
);
|
|
374
|
-
conventions = readConventions(
|
|
375
|
-
host,
|
|
376
|
-
parse,
|
|
377
|
-
conventionManifests(host, absoluteRoot, memberDirs, nestedDirs),
|
|
378
|
-
config.ts.disabledConventions,
|
|
379
|
-
);
|
|
380
|
-
options = {
|
|
216
|
+
return loadRun(engine, host, scope, config, ({ plan, classified, runFiles }) => {
|
|
217
|
+
const { packages, conventions } = plan;
|
|
218
|
+
const options = {
|
|
381
219
|
host,
|
|
382
|
-
manifest:
|
|
383
|
-
otherPackages:
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
],
|
|
387
|
-
patterns: config.rootPatterns,
|
|
388
|
-
entryFiles: config.ts.entryFiles,
|
|
220
|
+
manifest: packages.manifest,
|
|
221
|
+
otherPackages: packages.entries,
|
|
222
|
+
patterns: config.roots.patterns,
|
|
223
|
+
entryFiles: config.ts.entry_files,
|
|
389
224
|
conventions,
|
|
390
|
-
testFiles: config.ts.
|
|
225
|
+
testFiles: config.ts.test_files,
|
|
391
226
|
parse,
|
|
392
|
-
publishedAPI: config.
|
|
393
|
-
publishedMembers:
|
|
394
|
-
|
|
395
|
-
),
|
|
396
|
-
runFiles: new Set(
|
|
397
|
-
opened.flatMap((one) =>
|
|
398
|
-
one.fileNames().map((name) => resolvePath(host.workingDirectory(), name)),
|
|
399
|
-
),
|
|
400
|
-
),
|
|
227
|
+
publishedAPI: config.target.kind !== undefined && kindOf(config.target.kind) === "library",
|
|
228
|
+
publishedMembers: packages.published,
|
|
229
|
+
runFiles,
|
|
401
230
|
};
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
const dropped = (configFile: string, error: string): void => {
|
|
405
|
-
notBuilt.push({
|
|
406
|
-
id: ids.get(configFile) ?? configFile,
|
|
407
|
-
configFile,
|
|
408
|
-
error: targetRelative(error, absoluteRoot),
|
|
409
|
-
});
|
|
410
|
-
};
|
|
411
|
-
const failures: LocatedDiagnostic[] = [];
|
|
412
|
-
const unbuildable: SetupFailure[] = [];
|
|
413
|
-
const setupDropped: SetupFailure[] = [];
|
|
414
|
-
const librariesUnfound: LibraryUnfound[] = [];
|
|
415
|
-
const consumed = new Map<string, Reference>();
|
|
416
|
-
const heldFiles = new Set<string>();
|
|
417
|
-
let outsideTests: readonly OutsideTest[] = [];
|
|
418
|
-
const setupMet = (configFile: string, met: readonly SetupFailure[]): void => {
|
|
419
|
-
const [first] = met;
|
|
420
|
-
if (first !== undefined && isGuess(discovered, configFile)) {
|
|
421
|
-
dropped(configFile, setupLine(first));
|
|
422
|
-
setupDropped.push(...met);
|
|
423
|
-
} else {
|
|
424
|
-
unbuildable.push(...met);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
const testPatterns = config.ts.testFiles.map(globExpression);
|
|
428
|
-
const joins = discovered.derived
|
|
429
|
-
? joinedTestFiles(engine, host, absoluteRoot, discovered.configFiles, testPatterns)
|
|
430
|
-
: new Map<string, readonly string[]>();
|
|
431
|
-
const programs = withBaseUrlPaths(
|
|
432
|
-
engine,
|
|
433
|
-
host,
|
|
434
|
-
[...discovered.configFiles, ...consumerOf.keys()],
|
|
435
|
-
workspace?.programs ?? new Map(),
|
|
436
|
-
);
|
|
437
|
-
const session = runSession(
|
|
438
|
-
engine,
|
|
439
|
-
[...discovered.configFiles, ...consumerOf.keys()],
|
|
440
|
-
(opened) => {
|
|
441
|
-
const consumer = consumerOf.get(opened.configFile);
|
|
442
|
-
const setup = consumer === undefined ? workspace?.unbuildable(opened.configFile) : undefined;
|
|
443
|
-
if (setup !== undefined) {
|
|
444
|
-
setupMet(opened.configFile, [
|
|
445
|
-
{ setupClass: "workspace-member-without-source", detail: setup },
|
|
446
|
-
]);
|
|
447
|
-
return undefined;
|
|
448
|
-
}
|
|
449
|
-
const referenceOnly =
|
|
450
|
-
workspace === undefined || consumer !== undefined
|
|
451
|
-
? () => false
|
|
452
|
-
: workspace.referenceOnly(opened.configFile, opened.rootFiles);
|
|
453
|
-
const project =
|
|
454
|
-
workspace === undefined || consumer !== undefined
|
|
455
|
-
? opened
|
|
456
|
-
: ownedAs(opened, (file, fromExternalLibrary) =>
|
|
457
|
-
workspace.ownFile(file, fromExternalLibrary),
|
|
458
|
-
);
|
|
459
|
-
const raw = projectErrors(diagnosticsOf(project));
|
|
460
|
-
const errors = { load: raw.load, check: ownErrors(raw.check, referenceOnly) };
|
|
461
|
-
const [unloaded] = errors.load;
|
|
462
|
-
if (
|
|
463
|
-
unloaded !== undefined &&
|
|
464
|
-
consumer === undefined &&
|
|
465
|
-
isGuess(discovered, project.configFile)
|
|
466
|
-
) {
|
|
467
|
-
dropped(
|
|
468
|
-
project.configFile,
|
|
469
|
-
renderDiagnostic(unloaded, (path) => relativePath(absoluteRoot, path) ?? path),
|
|
470
|
-
);
|
|
471
|
-
return undefined;
|
|
472
|
-
}
|
|
473
|
-
if (errors.load.length > 0) {
|
|
474
|
-
failures.push(...errors.load);
|
|
475
|
-
return undefined;
|
|
476
|
-
}
|
|
477
|
-
const reading = readErrors(project, errors.check, {
|
|
478
|
-
host,
|
|
479
|
-
targetRoot:
|
|
480
|
-
consumer === undefined
|
|
481
|
-
? absoluteRoot
|
|
482
|
-
: resolvePath(host.workingDirectory(), consumer.path),
|
|
483
|
-
paths: pathsOf(engine, project.configFile),
|
|
484
|
-
});
|
|
485
|
-
if (consumer !== undefined && reading.missing.length > 0) {
|
|
486
|
-
unbuildable.push(
|
|
487
|
-
...reading.missing.map((one) => ({
|
|
488
|
-
setupClass: "missing-consumer" as const,
|
|
489
|
-
detail: `the consumer ${consumer.path} does not build, its dependencies not installed: ${one.detail}`,
|
|
490
|
-
})),
|
|
491
|
-
);
|
|
492
|
-
return undefined;
|
|
493
|
-
}
|
|
494
|
-
if (reading.missing.length > 0) {
|
|
495
|
-
setupMet(project.configFile, reading.missing);
|
|
496
|
-
return undefined;
|
|
497
|
-
}
|
|
498
|
-
const unconventional =
|
|
499
|
-
consumer === undefined
|
|
500
|
-
? conventionFailuresFor(
|
|
501
|
-
conventions,
|
|
502
|
-
project.configFile,
|
|
503
|
-
project.ownSourceFiles().map((file) => file.fileName),
|
|
504
|
-
)
|
|
505
|
-
: [];
|
|
506
|
-
if (unconventional.length > 0) {
|
|
507
|
-
setupMet(project.configFile, unconventional);
|
|
508
|
-
return undefined;
|
|
509
|
-
}
|
|
510
|
-
if (consumer !== undefined) {
|
|
511
|
-
for (const reference of consumerReferences(
|
|
512
|
-
project,
|
|
513
|
-
host,
|
|
514
|
-
targetRoot,
|
|
515
|
-
{
|
|
516
|
-
id: consumer.id,
|
|
517
|
-
root: consumer.path,
|
|
518
|
-
},
|
|
519
|
-
config,
|
|
520
|
-
)) {
|
|
521
|
-
consumed.set(referenceKey(reference), reference);
|
|
522
|
-
}
|
|
523
|
-
return undefined;
|
|
524
|
-
}
|
|
525
|
-
librariesUnfound.push(
|
|
526
|
-
...raw.unfound.map((one) => ({
|
|
527
|
-
configFile: project.configFile,
|
|
528
|
-
error: renderDiagnostic(one, (path) => relativePath(absoluteRoot, path) ?? path),
|
|
529
|
-
})),
|
|
530
|
-
);
|
|
531
|
-
const missingGlobal = raw.unfound.find(
|
|
532
|
-
({ diagnostic }) => diagnostic.code === MISSING_GLOBAL_TYPE,
|
|
533
|
-
);
|
|
534
|
-
const skips =
|
|
535
|
-
missingGlobal === undefined
|
|
536
|
-
? reading.skips
|
|
537
|
-
: [
|
|
538
|
-
...reading.skips,
|
|
539
|
-
...project.ownSourceFiles().map((file) => ({
|
|
540
|
-
record: {
|
|
541
|
-
path: relativePath(absoluteRoot, file.fileName) ?? file.fileName,
|
|
542
|
-
line: 1,
|
|
543
|
-
message: missingGlobal.diagnostic.text,
|
|
544
|
-
},
|
|
545
|
-
file,
|
|
546
|
-
unit: file,
|
|
547
|
-
})),
|
|
548
|
-
];
|
|
549
|
-
const configuration = ids.get(project.configFile) ?? project.configFile;
|
|
231
|
+
const heldFiles = new Set<string>();
|
|
232
|
+
const answers = classified.analyzed.map(({ plan: planned, project, skips, referenceOnly }) => {
|
|
550
233
|
const read = (): ProjectRead => {
|
|
551
234
|
const held = inventory(project, host, targetRoot);
|
|
552
235
|
const found = roots(project, held, targetRoot, options);
|
|
@@ -563,7 +246,7 @@ function readProjects<Answer>(
|
|
|
563
246
|
};
|
|
564
247
|
const own = sourceFilesOf(project, targetRoot);
|
|
565
248
|
return {
|
|
566
|
-
configuration,
|
|
249
|
+
configuration: planned.id,
|
|
567
250
|
configFile: project.configFile,
|
|
568
251
|
held,
|
|
569
252
|
rooted,
|
|
@@ -580,64 +263,25 @@ function readProjects<Answer>(
|
|
|
580
263
|
for (const file of project.ownSourceFiles()) {
|
|
581
264
|
heldFiles.add(relativePath(absoluteRoot, file.fileName) ?? file.fileName);
|
|
582
265
|
}
|
|
583
|
-
return stage(project, { configuration, read });
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
sourcePaths(host, targetRoot).filter(
|
|
592
|
-
(path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path)),
|
|
593
|
-
),
|
|
594
|
-
parse,
|
|
595
|
-
);
|
|
596
|
-
},
|
|
597
|
-
readManifests,
|
|
598
|
-
);
|
|
599
|
-
for (const configFile of session.unopened) {
|
|
600
|
-
if (consumerOf.has(configFile) || !isGuess(discovered, configFile)) {
|
|
601
|
-
throw new DiscoveryError(`${configFile} opened no project`, []);
|
|
266
|
+
return stage(project, { configuration: planned.id, read });
|
|
267
|
+
});
|
|
268
|
+
const consumed = new Map<string, Reference>();
|
|
269
|
+
for (const { project, consumer } of classified.consumed) {
|
|
270
|
+
const side = { id: consumer.id, root: consumer.path };
|
|
271
|
+
for (const reference of consumerReferences(project, host, targetRoot, side, config)) {
|
|
272
|
+
consumed.set(referenceKey(reference), reference);
|
|
273
|
+
}
|
|
602
274
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
`${String(failures.length)} error(s), so no answer was produced`,
|
|
611
|
-
failures,
|
|
612
|
-
);
|
|
613
|
-
}
|
|
614
|
-
const answers = session.projects.filter((answer): answer is Answer => answer !== undefined);
|
|
615
|
-
const [first] = notBuilt;
|
|
616
|
-
if (answers.length === 0 && setupDropped.length > 0) {
|
|
617
|
-
throw new SetupError(setupDropped);
|
|
618
|
-
}
|
|
619
|
-
if (answers.length === 0 && first !== undefined) {
|
|
620
|
-
throw new DiscoveryError(
|
|
621
|
-
`no configuration discovery derived could be built; ${first.id}: ${first.error}`,
|
|
622
|
-
[],
|
|
275
|
+
const outsideTests = testFilesAt(
|
|
276
|
+
host,
|
|
277
|
+
targetRoot,
|
|
278
|
+
sourcePaths(host, targetRoot).filter(
|
|
279
|
+
(path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path)),
|
|
280
|
+
),
|
|
281
|
+
parse,
|
|
623
282
|
);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
answers,
|
|
627
|
-
consumers: {
|
|
628
|
-
loaded: loads.map((load) => load.consumer),
|
|
629
|
-
references: [...consumed.values()],
|
|
630
|
-
},
|
|
631
|
-
notBuilt,
|
|
632
|
-
unanswered: session.unanswered,
|
|
633
|
-
componentsUnread: workspace?.componentsUnread ?? [],
|
|
634
|
-
librariesUnfound,
|
|
635
|
-
conventionsApplied: conventions.applied,
|
|
636
|
-
conventionUses: conventions.uses,
|
|
637
|
-
memberDirs,
|
|
638
|
-
nestedDirs,
|
|
639
|
-
outsideTests,
|
|
640
|
-
};
|
|
283
|
+
return { answers, references: [...consumed.values()], outsideTests };
|
|
284
|
+
});
|
|
641
285
|
}
|
|
642
286
|
|
|
643
287
|
/** The projects one run analyzes, and what reading them left out. */
|
|
@@ -655,7 +299,12 @@ interface RunProjects {
|
|
|
655
299
|
* for the errors and setup failures that decide whether it is analyzed, dropped or
|
|
656
300
|
* fails the run, exactly as the analysis reads them.
|
|
657
301
|
*/
|
|
658
|
-
export function runProjects(
|
|
302
|
+
export function runProjects(
|
|
303
|
+
engine: Engine,
|
|
304
|
+
host: Host,
|
|
305
|
+
scope: Scope,
|
|
306
|
+
config: PartialConfig,
|
|
307
|
+
): RunProjects {
|
|
659
308
|
const read = readProjects(
|
|
660
309
|
engine,
|
|
661
310
|
host,
|
|
@@ -663,7 +312,11 @@ export function runProjects(engine: Engine, host: Host, scope: Scope, config: Co
|
|
|
663
312
|
config,
|
|
664
313
|
(_project, opened) => opened.configuration,
|
|
665
314
|
);
|
|
666
|
-
return {
|
|
315
|
+
return {
|
|
316
|
+
configurations: read.result.answers,
|
|
317
|
+
notBuilt: read.classified.notBuilt,
|
|
318
|
+
unanswered: read.unanswered,
|
|
319
|
+
};
|
|
667
320
|
}
|
|
668
321
|
|
|
669
322
|
/**
|
|
@@ -676,12 +329,12 @@ export function runRoots(
|
|
|
676
329
|
engine: Engine,
|
|
677
330
|
host: Host,
|
|
678
331
|
scope: Scope,
|
|
679
|
-
config:
|
|
332
|
+
config: ResolvedConfig,
|
|
680
333
|
provenance: Provenance,
|
|
681
334
|
): RunRoots {
|
|
682
335
|
const targetRoot = scope.target.path;
|
|
683
336
|
const read = readProjects(engine, host, scope, config, (_project, opened) => opened.read());
|
|
684
|
-
const projects = read.answers;
|
|
337
|
+
const projects = read.result.answers;
|
|
685
338
|
|
|
686
339
|
const configurations: string[] = [];
|
|
687
340
|
const merged = new Map<string, Omit<RunRoot, "configurations"> & { configurations: string[] }>();
|
|
@@ -712,10 +365,12 @@ export function runRoots(
|
|
|
712
365
|
|
|
713
366
|
const ordered = [...merged.values()].sort(
|
|
714
367
|
(a, b) =>
|
|
715
|
-
byPosition(a.position, b.position) ||
|
|
368
|
+
byPosition(a.position, b.position) ||
|
|
369
|
+
bytewise(a.kind, b.kind) ||
|
|
370
|
+
bytewise(a.source, b.source),
|
|
716
371
|
);
|
|
717
372
|
const unmatched = unmatchedEverywhere(
|
|
718
|
-
config.
|
|
373
|
+
config.roots.patterns,
|
|
719
374
|
projects.map((answer) => answer.rooted),
|
|
720
375
|
);
|
|
721
376
|
return {
|
|
@@ -725,7 +380,7 @@ export function runRoots(
|
|
|
725
380
|
unmatched,
|
|
726
381
|
documentOf(host, provenance, ROOTS_SETTING, targetRoot),
|
|
727
382
|
),
|
|
728
|
-
notBuilt: read.notBuilt,
|
|
383
|
+
notBuilt: read.classified.notBuilt,
|
|
729
384
|
unanswered: read.unanswered,
|
|
730
385
|
};
|
|
731
386
|
}
|
|
@@ -757,7 +412,7 @@ export interface RunSweep {
|
|
|
757
412
|
}
|
|
758
413
|
|
|
759
414
|
/** One `<script` start tag of a component file the run read no block for. */
|
|
760
|
-
|
|
415
|
+
interface ComponentWarning {
|
|
761
416
|
/** The file, below the target root. */
|
|
762
417
|
readonly path: string;
|
|
763
418
|
readonly line: number;
|
|
@@ -784,6 +439,8 @@ interface SweptProject<Extra> {
|
|
|
784
439
|
readonly exempt: readonly Exemption[];
|
|
785
440
|
/** The declarations of the project an unanswered question could have kept live. */
|
|
786
441
|
readonly unanswered: readonly string[];
|
|
442
|
+
/** The data members a generic declared outside the analysis fills, which it may read. */
|
|
443
|
+
readonly filledOutside: readonly string[];
|
|
787
444
|
readonly typeErrorSkips: readonly TypeErrorSkip[];
|
|
788
445
|
readonly skipped: readonly SkippedUnit[];
|
|
789
446
|
/** The component files the project holds of its own, by path below the target root. */
|
|
@@ -791,6 +448,7 @@ interface SweptProject<Extra> {
|
|
|
791
448
|
readonly componentWarnings: readonly ComponentWarning[];
|
|
792
449
|
/** The manifest entries the project reads back to no file of its own. */
|
|
793
450
|
readonly unmappedEntries: readonly ManifestEntry[];
|
|
451
|
+
readonly heldScripts: readonly HeldScripts[];
|
|
794
452
|
readonly extra: Extra;
|
|
795
453
|
}
|
|
796
454
|
|
|
@@ -804,6 +462,10 @@ interface ReadProject<Extra> {
|
|
|
804
462
|
readonly componentWarnings: readonly ComponentWarning[];
|
|
805
463
|
/** Per own file below the target root, the module specifiers its imports write. */
|
|
806
464
|
readonly imports: ReadonlyMap<string, readonly string[]>;
|
|
465
|
+
/** The global augmentations a declaration outside the project names. */
|
|
466
|
+
readonly augmented: readonly Root[];
|
|
467
|
+
/** The data members its production code decodes into. */
|
|
468
|
+
readonly decoded: Decoded;
|
|
807
469
|
readonly extra: Extra;
|
|
808
470
|
}
|
|
809
471
|
|
|
@@ -824,6 +486,10 @@ interface ReadRun<Extra> {
|
|
|
824
486
|
readonly componentsUnread: readonly ComponentsUnread[];
|
|
825
487
|
/** Per analyzed configuration, each library it names that the compiler cannot find. */
|
|
826
488
|
readonly librariesUnfound: readonly LibraryUnfound[];
|
|
489
|
+
/** The relative specifiers of the run's unchecked JavaScript files that resolve to no file. */
|
|
490
|
+
readonly unresolvedSpecifiers: readonly UnresolvedSpecifier[];
|
|
491
|
+
/** The inputs the run could not read. */
|
|
492
|
+
readonly unread: readonly UnreadInput[];
|
|
827
493
|
/** The convention rows the run applied. */
|
|
828
494
|
readonly conventionsApplied: readonly AppliedConvention[];
|
|
829
495
|
/** The dependencies the applied rows' short names use. */
|
|
@@ -855,20 +521,9 @@ function testEvidence(
|
|
|
855
521
|
}
|
|
856
522
|
}
|
|
857
523
|
const manifests = new Map<string, Readonly<Record<string, unknown>> | undefined>();
|
|
858
|
-
const
|
|
524
|
+
const manifestIn = (dir: string): Readonly<Record<string, unknown>> | undefined => {
|
|
859
525
|
if (!manifests.has(dir)) {
|
|
860
|
-
|
|
861
|
-
try {
|
|
862
|
-
value = JSON.parse(host.readFile(joinPath(dir, "package.json")));
|
|
863
|
-
} catch {
|
|
864
|
-
value = undefined;
|
|
865
|
-
}
|
|
866
|
-
manifests.set(
|
|
867
|
-
dir,
|
|
868
|
-
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
869
|
-
? (value as Record<string, unknown>)
|
|
870
|
-
: undefined,
|
|
871
|
-
);
|
|
526
|
+
manifests.set(dir, manifestAt(host, dir));
|
|
872
527
|
}
|
|
873
528
|
return manifests.get(dir);
|
|
874
529
|
};
|
|
@@ -878,16 +533,14 @@ function testEvidence(
|
|
|
878
533
|
return {
|
|
879
534
|
imports,
|
|
880
535
|
devDependency: (path, name) => {
|
|
881
|
-
for (
|
|
882
|
-
const manifest =
|
|
536
|
+
for (const dir of ancestors(dirnamePath(joinPath(root, path)), root)) {
|
|
537
|
+
const manifest = manifestIn(dir);
|
|
883
538
|
const other = OTHER_SECTIONS.some((one) => declares(manifest?.[one], name));
|
|
884
539
|
if (declares(manifest?.[DEV_SECTION], name) || other) {
|
|
885
540
|
return !other;
|
|
886
541
|
}
|
|
887
|
-
if (normalizePath(dir) === normalizePath(root) || dirnamePath(dir) === dir) {
|
|
888
|
-
return false;
|
|
889
|
-
}
|
|
890
542
|
}
|
|
543
|
+
return false;
|
|
891
544
|
},
|
|
892
545
|
};
|
|
893
546
|
}
|
|
@@ -902,7 +555,7 @@ function readRun<Extra>(
|
|
|
902
555
|
engine: Engine,
|
|
903
556
|
host: Host,
|
|
904
557
|
scope: Scope,
|
|
905
|
-
config:
|
|
558
|
+
config: ResolvedConfig,
|
|
906
559
|
mode: Mode,
|
|
907
560
|
detectors: Detectors,
|
|
908
561
|
extra: <Brand>(
|
|
@@ -915,13 +568,13 @@ function readRun<Extra>(
|
|
|
915
568
|
const targetRoot = scope.target.path;
|
|
916
569
|
const disabled = disabledClasses(config);
|
|
917
570
|
const templates = disabled.has("template-field")
|
|
918
|
-
? { delimiters: config.analysis.
|
|
571
|
+
? { delimiters: config.analysis.template_delimiters, files: [] }
|
|
919
572
|
: readTemplates(host, targetRoot, config.analysis);
|
|
920
573
|
const consumers = scope.consumers.map((consumer) => consumer.path);
|
|
921
574
|
const read = readProjects<ReadProject<Extra>>(engine, host, scope, config, (project, opened) => {
|
|
922
575
|
const projectRead = opened.read();
|
|
923
576
|
const resolved = references(project, projectRead.held, targetRoot, {
|
|
924
|
-
testFiles: config.ts.
|
|
577
|
+
testFiles: config.ts.test_files,
|
|
925
578
|
testFileNames: projectRead.testFileNames,
|
|
926
579
|
});
|
|
927
580
|
const evidence = evidenceRecords(
|
|
@@ -932,7 +585,7 @@ function readRun<Extra>(
|
|
|
932
585
|
templates,
|
|
933
586
|
ts: config.ts,
|
|
934
587
|
consumers,
|
|
935
|
-
...(config.analysis.
|
|
588
|
+
...(config.analysis.generated_files === "include"
|
|
936
589
|
? {}
|
|
937
590
|
: { generated: projectRead.generated }),
|
|
938
591
|
},
|
|
@@ -940,6 +593,9 @@ function readRun<Extra>(
|
|
|
940
593
|
disabled,
|
|
941
594
|
);
|
|
942
595
|
const components = project.ownSourceFiles().filter(isComponentFile);
|
|
596
|
+
const injected = project.program
|
|
597
|
+
.getSourceFileNames()
|
|
598
|
+
.some((name) => name.endsWith(`/node_modules/${GLOBALS_RUNNER}/globals.d.ts`));
|
|
943
599
|
const pathOf = (file: (typeof components)[number]): string =>
|
|
944
600
|
relativePath(targetRoot, file.fileName) ?? file.fileName;
|
|
945
601
|
return {
|
|
@@ -948,12 +604,27 @@ function readRun<Extra>(
|
|
|
948
604
|
testFiles: resolved.testFilePaths,
|
|
949
605
|
evidence,
|
|
950
606
|
componentFiles: components.map(pathOf),
|
|
607
|
+
augmented: mergedGlobalInterfaces(
|
|
608
|
+
project,
|
|
609
|
+
projectRead.held,
|
|
610
|
+
sourceFilesOf(project, targetRoot),
|
|
611
|
+
).map((id): Root => ({ id, kind: "global-augmentation", source: "" })),
|
|
951
612
|
imports: new Map(
|
|
952
613
|
project.ownSourceFiles().flatMap((file) => {
|
|
953
614
|
const path = relativePath(targetRoot, file.fileName);
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
615
|
+
if (path === undefined) {
|
|
616
|
+
return [];
|
|
617
|
+
}
|
|
618
|
+
const specifiers = file.imports.filter(isStringLiteralLikeNode).map((one) => one.text);
|
|
619
|
+
// A file calling the globals a program declares is written for their runner.
|
|
620
|
+
return [
|
|
621
|
+
[
|
|
622
|
+
path,
|
|
623
|
+
injected && namesTestGlobals(project, file)
|
|
624
|
+
? [...specifiers, GLOBALS_RUNNER]
|
|
625
|
+
: specifiers,
|
|
626
|
+
],
|
|
627
|
+
];
|
|
957
628
|
}),
|
|
958
629
|
),
|
|
959
630
|
componentWarnings: components.flatMap((file) =>
|
|
@@ -963,49 +634,76 @@ function readRun<Extra>(
|
|
|
963
634
|
reason: warning.reason,
|
|
964
635
|
})),
|
|
965
636
|
),
|
|
637
|
+
decoded: decodedMembers(
|
|
638
|
+
project,
|
|
639
|
+
projectRead.held,
|
|
640
|
+
productionFiles(project, targetRoot, resolved.testFilePaths),
|
|
641
|
+
consumers,
|
|
642
|
+
),
|
|
966
643
|
extra: extra(project, projectRead, resolved.references, resolved.testFilePaths),
|
|
967
644
|
};
|
|
968
645
|
});
|
|
969
|
-
const outsidePaths = read.outsideTests.map((one) => one.path);
|
|
970
|
-
const withOutside = read.answers.map((one) => ({
|
|
646
|
+
const outsidePaths = read.result.outsideTests.map((one) => one.path);
|
|
647
|
+
const withOutside = read.result.answers.map((one) => ({
|
|
971
648
|
...one,
|
|
972
649
|
references: [
|
|
973
650
|
...one.references,
|
|
974
|
-
...outsideTestReferences(read.outsideTests, one.projectRead.held, targetRoot),
|
|
651
|
+
...outsideTestReferences(read.result.outsideTests, one.projectRead.held, targetRoot),
|
|
975
652
|
],
|
|
976
653
|
testFiles: [...one.testFiles, ...outsidePaths],
|
|
977
654
|
}));
|
|
978
655
|
// Test-support code is code only test code imports in any configuration of the run: a
|
|
979
656
|
// configuration that holds no test file says nothing about what the tests import.
|
|
980
|
-
const support = testSupportFiles(
|
|
657
|
+
const { support, testUsed } = testSupportFiles(
|
|
981
658
|
withOutside.flatMap((one) => one.projectRead.held.symbols),
|
|
982
659
|
withOutside.flatMap((one) => one.references),
|
|
983
660
|
withOutside.flatMap((one) => one.projectRead.rooted.liveUnderReachability),
|
|
984
661
|
withOutside.flatMap((one) => one.testFiles),
|
|
985
662
|
testEvidence(host, targetRoot, withOutside),
|
|
986
663
|
);
|
|
664
|
+
// A member a decode fills or a copy carries is written: a value decoded and sent again carries it on.
|
|
665
|
+
const written = new Set([
|
|
666
|
+
...countedWrites(
|
|
667
|
+
[...withOutside.flatMap((one) => one.references), ...read.result.references],
|
|
668
|
+
support,
|
|
669
|
+
mode,
|
|
670
|
+
),
|
|
671
|
+
...withOutside.flatMap((one) => [
|
|
672
|
+
...one.decoded.filled,
|
|
673
|
+
...one.decoded.parsed,
|
|
674
|
+
...one.decoded.copied,
|
|
675
|
+
]),
|
|
676
|
+
]);
|
|
677
|
+
const evidence = withOutside.map((one) => writtenRecords(one.evidence, written));
|
|
987
678
|
const settled = settledSatisfaction(
|
|
988
|
-
withOutside.map((one) => ({
|
|
989
|
-
|
|
679
|
+
withOutside.map((one, index) => ({
|
|
680
|
+
evidence: evidence[index] ?? [],
|
|
681
|
+
held: one.projectRead.held,
|
|
682
|
+
})),
|
|
683
|
+
[...withOutside.flatMap((one) => one.references), ...read.result.references],
|
|
990
684
|
);
|
|
991
685
|
const answers = withOutside.map((one, index): SweptProject<Extra> => {
|
|
992
686
|
const { projectRead } = one;
|
|
993
687
|
const satisfied = settled[index];
|
|
994
|
-
const detected = heldRecords(satisfied?.evidence ??
|
|
688
|
+
const detected = heldRecords(satisfied?.evidence ?? evidence[index] ?? [], {
|
|
995
689
|
mode,
|
|
996
690
|
testFiles: new Set([...one.testFiles, ...support]),
|
|
997
691
|
});
|
|
998
692
|
const exempt = detected.records;
|
|
999
693
|
const made = supportReferences([...one.references, ...(satisfied?.references ?? [])], support);
|
|
1000
694
|
const held = new Set(projectRead.held.symbols.map((symbol) => symbol.position.path));
|
|
1001
|
-
const supportFiles = [...support].filter((path) => held.has(path)).sort();
|
|
695
|
+
const supportFiles = [...support].filter((path) => held.has(path)).sort(bytewise);
|
|
696
|
+
const testUsedFiles = [...testUsed].filter((path) => held.has(path)).sort(bytewise);
|
|
1002
697
|
const configured: Configured = {
|
|
1003
698
|
configuration: projectRead.configuration,
|
|
1004
699
|
symbols: projectRead.held.symbols,
|
|
1005
700
|
references: [...made, ...evidenceReferences(projectRead.held.symbols, detected.inTestFiles)],
|
|
1006
|
-
|
|
701
|
+
// The augmentations are rooted after test support is read: an outside declaration
|
|
702
|
+
// naming one calls nothing of its file.
|
|
703
|
+
roots: [...projectRead.rooted.liveUnderReachability, ...one.augmented],
|
|
1007
704
|
testFiles: [...one.testFiles, ...supportFiles],
|
|
1008
705
|
...(supportFiles.length === 0 ? {} : { supportFiles }),
|
|
706
|
+
...(testUsedFiles.length === 0 ? {} : { testUsedFiles }),
|
|
1009
707
|
...(projectRead.held.ambient.size === 0 ? {} : { ambient: projectRead.held.ambient }),
|
|
1010
708
|
...(projectRead.referenceOnly.length === 0
|
|
1011
709
|
? {}
|
|
@@ -1025,16 +723,19 @@ function readRun<Extra>(
|
|
|
1025
723
|
.filter((reference) => reference.resolution === "by-name")
|
|
1026
724
|
.map((reference) => reference.to),
|
|
1027
725
|
...exempt.filter(isUnansweredRecord).map((record) => record.id),
|
|
726
|
+
...one.decoded.unanswered,
|
|
1028
727
|
],
|
|
728
|
+
filledOutside: one.decoded.filled,
|
|
1029
729
|
typeErrorSkips: projectRead.typeErrorSkips,
|
|
1030
730
|
unmappedEntries: projectRead.rooted.unmappedEntries,
|
|
731
|
+
heldScripts: projectRead.rooted.heldScripts,
|
|
1031
732
|
skipped: projectRead.skipped,
|
|
1032
733
|
componentFiles: one.componentFiles,
|
|
1033
734
|
componentWarnings: one.componentWarnings,
|
|
1034
735
|
extra: one.extra,
|
|
1035
736
|
};
|
|
1036
737
|
});
|
|
1037
|
-
const consumed = read.
|
|
738
|
+
const consumed = read.result.references;
|
|
1038
739
|
const projects = answers.map((one) =>
|
|
1039
740
|
consumed.length === 0
|
|
1040
741
|
? one
|
|
@@ -1056,15 +757,17 @@ function readRun<Extra>(
|
|
|
1056
757
|
]),
|
|
1057
758
|
],
|
|
1058
759
|
projects,
|
|
1059
|
-
consumers: read.consumers
|
|
1060
|
-
notBuilt: read.notBuilt,
|
|
760
|
+
consumers: read.plan.discovery.consumers,
|
|
761
|
+
notBuilt: read.classified.notBuilt,
|
|
1061
762
|
unanswered: read.unanswered,
|
|
1062
|
-
componentsUnread: read.componentsUnread,
|
|
1063
|
-
librariesUnfound: read.librariesUnfound,
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
763
|
+
componentsUnread: read.plan.workspace?.componentsUnread ?? [],
|
|
764
|
+
librariesUnfound: read.classified.librariesUnfound,
|
|
765
|
+
unresolvedSpecifiers: read.classified.unresolvedSpecifiers,
|
|
766
|
+
unread: read.plan.unread,
|
|
767
|
+
conventionsApplied: read.plan.conventions.applied,
|
|
768
|
+
conventionUses: read.plan.conventions.uses,
|
|
769
|
+
memberDirs: read.plan.packages.members,
|
|
770
|
+
nestedDirs: read.plan.packages.nested,
|
|
1068
771
|
};
|
|
1069
772
|
}
|
|
1070
773
|
|
|
@@ -1128,6 +831,22 @@ function evidenceReferences(
|
|
|
1128
831
|
});
|
|
1129
832
|
}
|
|
1130
833
|
|
|
834
|
+
/**
|
|
835
|
+
* The declarations a write the mode counts stores into, a write a test-support file
|
|
836
|
+
* makes being a test's.
|
|
837
|
+
*/
|
|
838
|
+
function countedWrites(
|
|
839
|
+
references: readonly Reference[],
|
|
840
|
+
support: ReadonlySet<string>,
|
|
841
|
+
mode: Mode,
|
|
842
|
+
): ReadonlySet<string> {
|
|
843
|
+
return new Set(
|
|
844
|
+
supportReferences(references, support).flatMap((reference) =>
|
|
845
|
+
reference.use === "write" && !(mode.production && reference.test) ? [reference.to] : [],
|
|
846
|
+
),
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
|
|
1131
850
|
/**
|
|
1132
851
|
* The declarations every reference the mode counts stores into, a loaded consumer's
|
|
1133
852
|
* reference counting as a read: what the write-only kind would report but for a record.
|
|
@@ -1205,7 +924,7 @@ function sweptOf<Extra>(
|
|
|
1205
924
|
unanswered: read.unanswered,
|
|
1206
925
|
heldByUnanswered: [...held],
|
|
1207
926
|
skipped: read.projects.flatMap((one) => one.skipped),
|
|
1208
|
-
componentFiles: [...new Set(read.projects.flatMap((one) => one.componentFiles))].sort(
|
|
927
|
+
componentFiles: [...new Set(read.projects.flatMap((one) => one.componentFiles))].sort(bytewise),
|
|
1209
928
|
};
|
|
1210
929
|
}
|
|
1211
930
|
|
|
@@ -1221,7 +940,7 @@ export function runSweep(
|
|
|
1221
940
|
engine: Engine,
|
|
1222
941
|
host: Host,
|
|
1223
942
|
scope: Scope,
|
|
1224
|
-
config:
|
|
943
|
+
config: ResolvedConfig,
|
|
1225
944
|
input: Pick<SweepInput, "marked" | "mode">,
|
|
1226
945
|
detectors: Detectors = DETECTORS,
|
|
1227
946
|
): RunSweep {
|
|
@@ -1244,6 +963,19 @@ interface EmitterExtra {
|
|
|
1244
963
|
readonly directives: readonly InlineDirective[];
|
|
1245
964
|
readonly declarationsNamed: readonly boolean[];
|
|
1246
965
|
readonly parts: ProjectParts;
|
|
966
|
+
readonly unseenLoads: readonly UnseenLoad[];
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** The project's own files below the target root that are no test file. */
|
|
970
|
+
function productionFiles<Brand>(
|
|
971
|
+
project: ProjectView<Brand>,
|
|
972
|
+
targetRoot: string,
|
|
973
|
+
testFiles: readonly string[],
|
|
974
|
+
): readonly SourceFile[] {
|
|
975
|
+
const tests = new Set(testFiles);
|
|
976
|
+
return [...sourceFilesOf(project, targetRoot).byPath].flatMap(([path, file]) =>
|
|
977
|
+
tests.has(path) ? [] : [file],
|
|
978
|
+
);
|
|
1247
979
|
}
|
|
1248
980
|
|
|
1249
981
|
/** Reads a run's projects with every per-project fact an emitter reads. */
|
|
@@ -1251,7 +983,7 @@ export function readEmitterRun(
|
|
|
1251
983
|
engine: Engine,
|
|
1252
984
|
host: Host,
|
|
1253
985
|
scope: Scope,
|
|
1254
|
-
config:
|
|
986
|
+
config: ResolvedConfig,
|
|
1255
987
|
mode: Mode,
|
|
1256
988
|
detectors: Detectors,
|
|
1257
989
|
): ReadRun<EmitterExtra> {
|
|
@@ -1279,9 +1011,10 @@ export function readEmitterRun(
|
|
|
1279
1011
|
),
|
|
1280
1012
|
declarationsNamed: declarationsNamed(project, read.held, configuredDeclarations(config)),
|
|
1281
1013
|
parts: projectParts(project, read.held, references, targetRoot),
|
|
1014
|
+
unseenLoads: unseenLoadsOf(project, read.configuration, targetRoot, testFiles),
|
|
1282
1015
|
}),
|
|
1283
1016
|
);
|
|
1284
|
-
// Whether a declaration carries the marker decides its code, so one whose
|
|
1017
|
+
// Whether a declaration carries the marker decides its code, so one whose answer went
|
|
1285
1018
|
// unread is reported by nothing.
|
|
1286
1019
|
const unread = run.projects.flatMap((one) => one.extra.deprecation.unanswered);
|
|
1287
1020
|
return unread.length === 0
|
|
@@ -1333,22 +1066,17 @@ function judgedMembers(
|
|
|
1333
1066
|
|
|
1334
1067
|
/** The directory of the nearest `package.json` at or above a file, inside `root`, else `root`. */
|
|
1335
1068
|
function nearestManifestDir(host: Host, root: string, file: string): string {
|
|
1336
|
-
|
|
1337
|
-
if (host.kindOf(joinPath(dir, "package.json")) === "file") {
|
|
1338
|
-
return dir;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
return root;
|
|
1069
|
+
return ancestors(dirnamePath(file), root).find((dir) => holdsManifest(host, dir)) ?? root;
|
|
1342
1070
|
}
|
|
1343
1071
|
|
|
1344
1072
|
/**
|
|
1345
1073
|
* The input every emitter reads over one sweep of a read run: the facts beside the sweep
|
|
1346
|
-
* each
|
|
1074
|
+
* each emitter reads, every per-project one read in the same session as the sweep.
|
|
1347
1075
|
*/
|
|
1348
1076
|
export function emitterInputOver(
|
|
1349
1077
|
host: Host,
|
|
1350
1078
|
scope: Scope,
|
|
1351
|
-
config:
|
|
1079
|
+
config: ResolvedConfig,
|
|
1352
1080
|
read: ReadRun<EmitterExtra>,
|
|
1353
1081
|
input: Pick<SweepInput, "marked" | "mode">,
|
|
1354
1082
|
selfCheck: SelfCheckFacts,
|
|
@@ -1384,6 +1112,7 @@ export function emitterInputOver(
|
|
|
1384
1112
|
heldByInclusion: new Set(projects.flatMap((one) => one.extra.heldByInclusion)),
|
|
1385
1113
|
generated: new Set(projects.flatMap((one) => one.extra.generated)),
|
|
1386
1114
|
inOperands: new Set(projects.flatMap((one) => one.extra.inOperands)),
|
|
1115
|
+
unseenLoads: projects.flatMap((one) => one.extra.unseenLoads),
|
|
1387
1116
|
},
|
|
1388
1117
|
boundary: {
|
|
1389
1118
|
consumers: {
|
|
@@ -1392,6 +1121,7 @@ export function emitterInputOver(
|
|
|
1392
1121
|
},
|
|
1393
1122
|
encapsulated: readManifest(host, targetRoot).declaresExports,
|
|
1394
1123
|
edges: readEdgeSides(host, targetRoot),
|
|
1124
|
+
filledOutside: new Set(projects.flatMap((one) => one.filledOutside)),
|
|
1395
1125
|
},
|
|
1396
1126
|
selfCheck,
|
|
1397
1127
|
intraFunction: intraFunctionFacts(
|
|
@@ -1427,14 +1157,14 @@ interface AnalysisReader {
|
|
|
1427
1157
|
* directives, the ignore file's entries and the baseline's rows are bound before any
|
|
1428
1158
|
* sweep, and the run is swept once under every bound record's mark and once under none,
|
|
1429
1159
|
* so a record is decided against the finding its code would have produced. The
|
|
1430
|
-
*
|
|
1160
|
+
* configuration family reports the refused suppressions and the roots that named nothing.
|
|
1431
1161
|
* Beside the inputs it answers the projects and test-file rules a report names.
|
|
1432
1162
|
*/
|
|
1433
1163
|
function readAnalysis(
|
|
1434
1164
|
engine: Engine,
|
|
1435
1165
|
host: Host,
|
|
1436
1166
|
scope: Scope,
|
|
1437
|
-
config:
|
|
1167
|
+
config: ResolvedConfig,
|
|
1438
1168
|
provenance: Provenance,
|
|
1439
1169
|
mode: Mode,
|
|
1440
1170
|
detectors: Detectors,
|
|
@@ -1455,7 +1185,7 @@ function readAnalysis(
|
|
|
1455
1185
|
configFile: one.configFile,
|
|
1456
1186
|
})),
|
|
1457
1187
|
testFileRules: testFileRulesOf(
|
|
1458
|
-
config.ts.
|
|
1188
|
+
config.ts.test_files,
|
|
1459
1189
|
read.projects.flatMap((one) => one.configured.testFiles),
|
|
1460
1190
|
read.projects.flatMap((one) => one.configured.supportFiles ?? []),
|
|
1461
1191
|
),
|
|
@@ -1472,8 +1202,14 @@ function readAnalysis(
|
|
|
1472
1202
|
unanswered: read.unanswered,
|
|
1473
1203
|
componentsUnread: read.componentsUnread,
|
|
1474
1204
|
librariesUnfound: read.librariesUnfound,
|
|
1205
|
+
unresolvedSpecifiers: read.unresolvedSpecifiers,
|
|
1206
|
+
unread: read.unread,
|
|
1475
1207
|
conventionsApplied: read.conventionsApplied,
|
|
1476
1208
|
unmappedEntries: unmappedEverywhere(read.projects),
|
|
1209
|
+
heldScripts: read.projects.flatMap((one) =>
|
|
1210
|
+
one.heldScripts.map((held) => ({ ...held, configFile: one.configFile })),
|
|
1211
|
+
),
|
|
1212
|
+
unseenLoads: read.projects.flatMap((one) => one.extra.unseenLoads),
|
|
1477
1213
|
},
|
|
1478
1214
|
configured: read.projects.map((one) => one.configured),
|
|
1479
1215
|
symbols,
|
|
@@ -1485,7 +1221,7 @@ function readAnalysis(
|
|
|
1485
1221
|
function inputsOver(
|
|
1486
1222
|
host: Host,
|
|
1487
1223
|
scope: Scope,
|
|
1488
|
-
config:
|
|
1224
|
+
config: ResolvedConfig,
|
|
1489
1225
|
provenance: Provenance,
|
|
1490
1226
|
mode: Mode,
|
|
1491
1227
|
read: ReadRun<EmitterExtra>,
|
|
@@ -1499,7 +1235,7 @@ function inputsOver(
|
|
|
1499
1235
|
const facts: SelfCheckFacts = {
|
|
1500
1236
|
refusals: suppressions.refusals,
|
|
1501
1237
|
unmatchedRoots: unmatchedEverywhere(
|
|
1502
|
-
config.
|
|
1238
|
+
config.roots.patterns,
|
|
1503
1239
|
read.projects.map((one) => one.extra.rooted),
|
|
1504
1240
|
),
|
|
1505
1241
|
rootsDocument: documentOf(host, provenance, ROOTS_SETTING, targetRoot),
|
|
@@ -1568,10 +1304,18 @@ interface RunFacts {
|
|
|
1568
1304
|
readonly componentsUnread: readonly ComponentsUnread[];
|
|
1569
1305
|
/** Per analyzed configuration, each library it names that the compiler cannot find. */
|
|
1570
1306
|
readonly librariesUnfound: readonly LibraryUnfound[];
|
|
1307
|
+
/** The relative specifiers of the run's unchecked JavaScript files that resolve to no file. */
|
|
1308
|
+
readonly unresolvedSpecifiers: readonly UnresolvedSpecifier[];
|
|
1309
|
+
/** The inputs the run could not read. */
|
|
1310
|
+
readonly unread: readonly UnreadInput[];
|
|
1571
1311
|
/** The convention rows the run applied. */
|
|
1572
1312
|
readonly conventionsApplied: readonly AppliedConvention[];
|
|
1573
1313
|
/** The manifest entries no project of the run reads back to a file, each once. */
|
|
1574
1314
|
readonly unmappedEntries: readonly ManifestEntry[];
|
|
1315
|
+
/** Per project, by its compiler configuration file, each package whose command strings name files it holds. */
|
|
1316
|
+
readonly heldScripts: readonly (HeldScripts & { readonly configFile: string })[];
|
|
1317
|
+
/** The loads of production files whose target the run cannot resolve, per configuration. */
|
|
1318
|
+
readonly unseenLoads: readonly UnseenLoad[];
|
|
1575
1319
|
}
|
|
1576
1320
|
|
|
1577
1321
|
/** One configuration whose component files a run cannot read. */
|
|
@@ -1580,13 +1324,6 @@ interface ComponentsUnread {
|
|
|
1580
1324
|
readonly reason: string;
|
|
1581
1325
|
}
|
|
1582
1326
|
|
|
1583
|
-
/** One library an analyzed configuration names that the compiler cannot find. */
|
|
1584
|
-
interface LibraryUnfound {
|
|
1585
|
-
readonly configFile: string;
|
|
1586
|
-
/** The compiler's error, rendered as a dropped configuration's is. */
|
|
1587
|
-
readonly error: string;
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
1327
|
/** The findings of one run, beside what a report states about the run itself. */
|
|
1591
1328
|
export interface RunAnalysis {
|
|
1592
1329
|
readonly result: PassResult;
|
|
@@ -1599,7 +1336,7 @@ export interface RunAnalysis {
|
|
|
1599
1336
|
|
|
1600
1337
|
/**
|
|
1601
1338
|
* The analysis of the run the scope and the configuration describe: the run read with its
|
|
1602
|
-
* suppressions bound, every
|
|
1339
|
+
* suppressions bound, every emitter's findings with the suppressions applied and the
|
|
1603
1340
|
* declared edges evaluated, the projects and test-file rules the report names, and the sweep
|
|
1604
1341
|
* an explanation reads.
|
|
1605
1342
|
*/
|
|
@@ -1607,7 +1344,7 @@ export function runAnalysis(
|
|
|
1607
1344
|
engine: Engine,
|
|
1608
1345
|
host: Host,
|
|
1609
1346
|
scope: Scope,
|
|
1610
|
-
config:
|
|
1347
|
+
config: ResolvedConfig,
|
|
1611
1348
|
provenance: Provenance,
|
|
1612
1349
|
mode: Mode,
|
|
1613
1350
|
detectors: Detectors = DETECTORS,
|
|
@@ -1619,14 +1356,20 @@ export function runAnalysis(
|
|
|
1619
1356
|
|
|
1620
1357
|
/**
|
|
1621
1358
|
* One count per configuration of the run in which the checker left a question unanswered:
|
|
1622
|
-
* the questions asked in its project,
|
|
1359
|
+
* the questions asked in its project, a formed program's manifest that does not parse or cannot
|
|
1360
|
+
* be read and a package whose command strings name files the project holds each counted as one, and the
|
|
1361
|
+
* declarations of its own the run holds for them.
|
|
1623
1362
|
*/
|
|
1624
1363
|
export function unansweredCounts(analysis: RunAnalysis): readonly UnansweredCount[] {
|
|
1625
1364
|
const held = new Set(analysis.swept.heldByUnanswered);
|
|
1626
1365
|
return analysis.run.projects.flatMap((project) => {
|
|
1627
|
-
const questions =
|
|
1628
|
-
(one) => one.configFile === project.configFile
|
|
1629
|
-
|
|
1366
|
+
const questions =
|
|
1367
|
+
analysis.run.unanswered.filter((one) => one.configFile === project.configFile).length +
|
|
1368
|
+
analysis.run.unread.filter(
|
|
1369
|
+
(one) => one.kind === "manifest" && one.configFile === project.configFile,
|
|
1370
|
+
).length +
|
|
1371
|
+
analysis.run.heldScripts.filter((one) => one.configFile === project.configFile).length;
|
|
1372
|
+
|
|
1630
1373
|
if (questions === 0) {
|
|
1631
1374
|
return [];
|
|
1632
1375
|
}
|
|
@@ -1663,7 +1406,7 @@ export function runBaselineWrite(
|
|
|
1663
1406
|
engine: Engine,
|
|
1664
1407
|
host: Host,
|
|
1665
1408
|
scope: Scope,
|
|
1666
|
-
config:
|
|
1409
|
+
config: ResolvedConfig,
|
|
1667
1410
|
provenance: Provenance,
|
|
1668
1411
|
mode: Mode,
|
|
1669
1412
|
reason: string,
|