@cplieger/deadset-ts 8.0.0-dev.15 → 8.0.0-dev.17
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/dist/src/alias-chain.js +0 -5
- package/dist/src/amd.js +81 -0
- package/dist/src/analysis.js +94 -54
- package/dist/src/augmentations.js +23 -24
- package/dist/src/bindings.js +382 -0
- package/dist/src/calls.js +25 -8
- package/dist/src/commands/read.js +6 -7
- package/dist/src/commands/tools.js +5 -9
- package/dist/src/component-files.js +3 -2
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/consumers.js +9 -10
- package/dist/src/contextual-uses.js +1 -17
- package/dist/src/contract/config.generated.js +5 -2
- package/dist/src/contract/contract.generated.js +119 -2
- package/dist/src/contract/report.generated.js +6 -2
- package/dist/src/dependencies.js +98 -71
- package/dist/src/destructuring.js +1 -19
- package/dist/src/element-access.js +179 -164
- package/dist/src/entries/build-scripts.js +222 -0
- package/dist/src/{configuration-files.js → entries/configuration-files.js} +22 -64
- package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
- package/dist/src/entries/conventions.js +739 -0
- package/dist/src/{html-entries.js → entries/html-entries.js} +9 -12
- package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +3 -3
- 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 +684 -0
- package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
- package/dist/src/extensions.js +37 -0
- package/dist/src/facts.js +38 -0
- package/dist/src/findings/completion.js +40 -4
- package/dist/src/findings/emitters.js +5 -8
- package/dist/src/{implementations.js → findings/implementations.js} +3 -3
- package/dist/src/{in-operands.js → findings/in-operands.js} +2 -2
- package/dist/src/findings/self-check.js +36 -20
- package/dist/src/findings-pass.js +5 -6
- package/dist/src/framework-lifecycle.js +42 -15
- package/dist/src/fs/manifest.js +15 -20
- package/dist/src/generated-file.js +172 -29
- package/dist/src/graph.js +14 -8
- package/dist/src/import-bindings.js +73 -28
- package/dist/src/index/sites.js +557 -0
- package/dist/src/index.js +1 -1
- package/dist/src/indexed-access.js +523 -478
- package/dist/src/injection-container.js +1 -1
- package/dist/src/interface-satisfaction.js +1 -1
- package/dist/src/inventory/commonjs.js +62 -17
- package/dist/src/inventory/enumerate.js +2 -1
- package/dist/src/javascript-file.js +26 -11
- package/dist/src/keyof-comparisons.js +124 -103
- package/dist/src/load/classify.js +28 -9
- package/dist/src/load/diagnostics.js +8 -1
- package/dist/src/load/discover.js +15 -7
- package/dist/src/load/expected-module.js +2 -2
- package/dist/src/load/plan.js +2 -2
- package/dist/src/load/specifiers.js +2 -4
- package/dist/src/load/synthesize.js +10 -5
- package/dist/src/load/workspace-manifests.js +1 -1
- package/dist/src/load/workspace-resolution.js +2 -2
- package/dist/src/matrix.js +12 -17
- package/dist/src/module-declarations.js +70 -85
- package/dist/src/overrides.js +134 -112
- package/dist/src/paths.js +56 -1
- package/dist/src/platform-calls.js +78 -0
- package/dist/src/platform-symbols.js +134 -0
- package/dist/src/references/read-rule.js +1 -0
- package/dist/src/references/read-rules.js +48 -0
- package/dist/src/references/sink.js +151 -0
- package/dist/src/references/sources.js +450 -0
- package/dist/src/references.js +111 -1116
- package/dist/src/resolve.js +1 -1
- package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +7 -4
- package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
- package/dist/src/{manifest.js → roots/manifest.js} +4 -4
- package/dist/src/roots/published-reach.js +412 -0
- package/dist/src/roots/root-set.js +489 -0
- package/dist/src/roots/unseen-loads.js +236 -0
- package/dist/src/serialization-contract.js +9 -4
- package/dist/src/source-files.js +5 -9
- package/dist/src/stores.js +4 -2
- package/dist/src/suppress.js +30 -32
- package/dist/src/sweep.js +25 -13
- package/dist/src/symbol-keys.js +89 -83
- 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/type-parameter-reads.js +178 -139
- package/dist/src/unimplemented-callees.js +262 -242
- package/dist/src/verbs/analyze.js +15 -3
- package/dist/src/verbs/describe.js +5 -3
- package/dist/src/verbs/explain.js +50 -28
- package/dist/src/verbs/print-retained.js +2 -2
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/alias-chain.ts +0 -7
- package/src/amd.ts +130 -0
- package/src/analysis.ts +156 -70
- package/src/augmentations.ts +41 -27
- package/src/automatic-types.ts +1 -1
- package/src/bindings.ts +460 -0
- package/src/calls.ts +25 -7
- package/src/commands/read.ts +6 -8
- package/src/commands/tools.ts +5 -11
- package/src/component-files.ts +4 -2
- package/src/conformance-record.ts +1 -1
- package/src/consumers.ts +12 -11
- package/src/contextual-uses.ts +2 -22
- package/src/contract/config.generated.ts +5 -2
- package/src/contract/contract.generated.ts +138 -2
- package/src/contract/report.generated.ts +6 -2
- package/src/dependencies.ts +117 -71
- package/src/destructuring.ts +1 -31
- package/src/element-access.ts +188 -182
- package/src/entries/build-scripts.ts +292 -0
- package/src/{configuration-files.ts → entries/configuration-files.ts} +33 -82
- package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
- package/src/{conventions.ts → entries/conventions.ts} +349 -523
- package/src/{html-entries.ts → entries/html-entries.ts} +19 -18
- package/src/{mdx-entries.ts → entries/mdx-entries.ts} +5 -5
- 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 +868 -0
- package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
- package/src/exempt.ts +3 -2
- package/src/extensions.ts +45 -0
- package/src/facts.ts +46 -0
- package/src/file-facts.ts +1 -1
- package/src/findings/boundary.ts +2 -0
- package/src/findings/completion.ts +43 -4
- package/src/findings/emitter.ts +1 -1
- package/src/findings/emitters.ts +14 -10
- package/src/{implementations.ts → findings/implementations.ts} +4 -4
- package/src/{in-operands.ts → findings/in-operands.ts} +3 -3
- package/src/findings/self-check.ts +41 -22
- package/src/findings/visibility-narrowing.ts +1 -1
- package/src/findings-pass.ts +5 -12
- package/src/framework-lifecycle.ts +43 -15
- package/src/fs/manifest.ts +25 -21
- package/src/generated-file.ts +240 -36
- package/src/graph.ts +27 -11
- package/src/import-bindings.ts +98 -29
- package/src/index/sites.ts +781 -0
- package/src/index.ts +1 -1
- package/src/indexed-access.ts +570 -527
- package/src/injection-container.ts +1 -1
- package/src/interface-satisfaction.ts +1 -1
- package/src/inventory/commonjs.ts +102 -17
- package/src/inventory/enumerate.ts +2 -1
- package/src/javascript-file.ts +29 -12
- package/src/keyof-comparisons.ts +131 -116
- package/src/load/classify.ts +49 -13
- package/src/load/diagnostics.ts +11 -1
- package/src/load/discover.ts +27 -11
- package/src/load/expected-module.ts +8 -2
- package/src/load/plan.ts +11 -2
- package/src/load/specifiers.ts +8 -5
- package/src/load/synthesize.ts +12 -6
- package/src/load/test-globals.ts +1 -1
- package/src/load/workspace-manifests.ts +1 -1
- package/src/load/workspace-resolution.ts +9 -2
- package/src/load/workspace-run.ts +1 -1
- package/src/matrix.ts +13 -17
- package/src/module-declarations.ts +74 -98
- package/src/overrides.ts +162 -134
- package/src/paths.ts +65 -1
- package/src/platform-calls.ts +119 -0
- package/src/platform-symbols.ts +189 -0
- package/src/references/read-rule.ts +60 -0
- package/src/references/read-rules.ts +55 -0
- package/src/references/sink.ts +213 -0
- package/src/references/sources.ts +632 -0
- package/src/references.ts +174 -1492
- package/src/report.ts +2 -2
- package/src/resolve.ts +1 -1
- package/src/{configured-declarations.ts → roots/configured-declarations.ts} +10 -7
- package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
- package/src/{manifest.ts → roots/manifest.ts} +5 -5
- package/src/roots/published-reach.ts +481 -0
- package/src/{roots.ts → roots/root-set.ts} +203 -630
- package/src/roots/unseen-loads.ts +345 -0
- package/src/serialization-contract.ts +9 -4
- package/src/source-files.ts +5 -10
- package/src/stores.ts +13 -2
- package/src/suppress.ts +48 -33
- package/src/sweep.ts +37 -14
- package/src/symbol-keys.ts +102 -102
- package/src/tests/file-class.ts +118 -0
- package/src/{outside-tests.ts → tests/outside.ts} +16 -10
- package/src/{test-support.ts → tests/support.ts} +15 -21
- package/src/type-parameter-reads.ts +187 -158
- package/src/unimplemented-callees.ts +297 -280
- package/src/verbs/analyze.ts +19 -5
- package/src/verbs/describe.ts +5 -2
- package/src/verbs/explain.ts +75 -32
- package/src/verbs/print-retained.ts +2 -2
- package/dist/src/build-scripts.js +0 -418
- package/dist/src/conventions.js +0 -907
- package/dist/src/entry-points.js +0 -444
- package/dist/src/own-body.js +0 -28
- package/dist/src/roots.js +0 -865
- package/dist/src/unseen-loads.js +0 -189
- package/src/build-scripts.ts +0 -536
- package/src/entry-points.ts +0 -584
- package/src/own-body.ts +0 -42
- package/src/unseen-loads.ts +0 -282
package/src/load/classify.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SourceFile } from "@typescript/native/ast";
|
|
2
|
-
import { conventionFailuresFor } from "../conventions.ts";
|
|
2
|
+
import { conventionFailuresFor } from "../entries/conventions.ts";
|
|
3
3
|
import type { Host } from "../host.ts";
|
|
4
4
|
import { relativePath, resolvePath } from "../paths.ts";
|
|
5
5
|
import { diagnosticsOf, ownedAs, type Engine, type ProjectView } from "../session.ts";
|
|
@@ -11,7 +11,13 @@ import {
|
|
|
11
11
|
renderDiagnostic,
|
|
12
12
|
type LocatedDiagnostic,
|
|
13
13
|
} from "./diagnostics.ts";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
targetRelative,
|
|
16
|
+
unreadableDetail,
|
|
17
|
+
type LoadedConsumer,
|
|
18
|
+
type NotBuilt,
|
|
19
|
+
type Origin,
|
|
20
|
+
} from "./discover.ts";
|
|
15
21
|
import { missingModule, pathsOf, type ModuleContext } from "./expected-module.ts";
|
|
16
22
|
import { FailureExit, failureLine, type Failure } from "../failure.ts";
|
|
17
23
|
import type { ProgramPlan, RunPlan } from "./plan.ts";
|
|
@@ -21,8 +27,12 @@ import { ownErrors } from "./workspace-run.ts";
|
|
|
21
27
|
|
|
22
28
|
/** What keeps one configuration from being analyzed. */
|
|
23
29
|
type Failed =
|
|
24
|
-
/** Its project carries an error that leaves it unloaded. */
|
|
25
|
-
| {
|
|
30
|
+
/** Its project carries an error that leaves it unloaded, its configuration unreadable or not. */
|
|
31
|
+
| {
|
|
32
|
+
readonly kind: "load";
|
|
33
|
+
readonly errors: readonly [LocatedDiagnostic, ...LocatedDiagnostic[]];
|
|
34
|
+
readonly unreadable: boolean;
|
|
35
|
+
}
|
|
26
36
|
| { readonly kind: "setup"; readonly failures: readonly [Failure, ...Failure[]] }
|
|
27
37
|
/** The snapshot opened no project for it. */
|
|
28
38
|
| { readonly kind: "unopened" };
|
|
@@ -162,7 +172,7 @@ function classifyTarget<Brand>(
|
|
|
162
172
|
const raw = projectErrors(diagnosticsOf(project));
|
|
163
173
|
const load = nonEmpty(raw.load);
|
|
164
174
|
if (load !== undefined) {
|
|
165
|
-
return { kind: "load", errors: load };
|
|
175
|
+
return { kind: "load", errors: load, unreadable: raw.unreadable };
|
|
166
176
|
}
|
|
167
177
|
const reading = readErrors(project, plan, ownErrors(raw.check, referenceOnly), {
|
|
168
178
|
host,
|
|
@@ -236,7 +246,7 @@ function classifyConsumer<Brand>(
|
|
|
236
246
|
const raw = projectErrors(diagnosticsOf(project));
|
|
237
247
|
const load = nonEmpty(raw.load);
|
|
238
248
|
if (load !== undefined) {
|
|
239
|
-
return { kind: "load", errors: load };
|
|
249
|
+
return { kind: "load", errors: load, unreadable: raw.unreadable };
|
|
240
250
|
}
|
|
241
251
|
let faulted: string | undefined;
|
|
242
252
|
const reading = readErrors(project, plan, raw.check, {
|
|
@@ -283,7 +293,8 @@ function ending(plan: ProgramPlan, failed: Failed, root: string): readonly Failu
|
|
|
283
293
|
return plan.consumer === undefined
|
|
284
294
|
? [
|
|
285
295
|
{
|
|
286
|
-
failureClass:
|
|
296
|
+
failureClass:
|
|
297
|
+
failed.kind === "load" && failed.unreadable ? "unreadable-configuration" : "no-program",
|
|
287
298
|
detail: `${what}: correct the configuration, or name the configurations to analyze`,
|
|
288
299
|
},
|
|
289
300
|
]
|
|
@@ -295,6 +306,30 @@ function ending(plan: ProgramPlan, failed: Failed, root: string): readonly Failu
|
|
|
295
306
|
];
|
|
296
307
|
}
|
|
297
308
|
|
|
309
|
+
/** The setup failures a dropped derived configuration counts as, where it counts as any. */
|
|
310
|
+
function droppedFailures(
|
|
311
|
+
failed: Failed,
|
|
312
|
+
plan: ProgramPlan,
|
|
313
|
+
root: string,
|
|
314
|
+
): { readonly failures?: readonly [Failure, ...Failure[]] } {
|
|
315
|
+
if (failed.kind === "setup") {
|
|
316
|
+
return { failures: failed.failures };
|
|
317
|
+
}
|
|
318
|
+
return failed.kind === "load" && failed.unreadable
|
|
319
|
+
? {
|
|
320
|
+
failures: [
|
|
321
|
+
{
|
|
322
|
+
failureClass: "unreadable-configuration",
|
|
323
|
+
detail: unreadableDetail(
|
|
324
|
+
plan.id,
|
|
325
|
+
`cannot be read as a compiler configuration: ${droppedBy(failed, root)}`,
|
|
326
|
+
),
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
}
|
|
330
|
+
: {};
|
|
331
|
+
}
|
|
332
|
+
|
|
298
333
|
/** The first line of the error that drops one derived configuration. */
|
|
299
334
|
function droppedBy(failed: Failed, root: string): string {
|
|
300
335
|
return failed.kind === "load"
|
|
@@ -326,7 +361,6 @@ export function classify(
|
|
|
326
361
|
const analyzed: Analyzed<unknown>[] = [];
|
|
327
362
|
const consumed: Consumed<unknown>[] = [];
|
|
328
363
|
const ended = new Map<Failed["kind"], { plan: ProgramPlan; failed: Failed }[]>();
|
|
329
|
-
const dropped: Failed[] = [];
|
|
330
364
|
const unopened = run.plans.filter((plan) => !views.has(plan.configFile));
|
|
331
365
|
const outcomes = [
|
|
332
366
|
...run.plans.flatMap((plan) => {
|
|
@@ -355,8 +389,12 @@ export function classify(
|
|
|
355
389
|
} else if (POLICY[plan.origin][outcome.kind] === "end") {
|
|
356
390
|
ended.set(outcome.kind, [...(ended.get(outcome.kind) ?? []), { plan, failed: outcome }]);
|
|
357
391
|
} else {
|
|
358
|
-
|
|
359
|
-
|
|
392
|
+
notBuilt.push({
|
|
393
|
+
id: plan.id,
|
|
394
|
+
configFile: plan.configFile,
|
|
395
|
+
error: droppedBy(outcome, root),
|
|
396
|
+
...droppedFailures(outcome, plan, root),
|
|
397
|
+
});
|
|
360
398
|
}
|
|
361
399
|
}
|
|
362
400
|
for (const kind of ["unopened", "setup", "load"] as const) {
|
|
@@ -369,9 +407,7 @@ export function classify(
|
|
|
369
407
|
);
|
|
370
408
|
}
|
|
371
409
|
}
|
|
372
|
-
const setupDropped = nonEmpty(
|
|
373
|
-
dropped.flatMap((one) => (one.kind === "setup" ? one.failures : [])),
|
|
374
|
-
);
|
|
410
|
+
const setupDropped = nonEmpty(notBuilt.flatMap((one) => one.failures ?? []));
|
|
375
411
|
const [first] = notBuilt;
|
|
376
412
|
if (analyzed.length === 0 && first !== undefined) {
|
|
377
413
|
throw new FailureExit(
|
package/src/load/diagnostics.ts
CHANGED
|
@@ -121,10 +121,18 @@ export function diagnosticErrors(sets: {
|
|
|
121
121
|
return [...sets.configParsing, ...sets.syntactic, ...sets.semantic].filter(isError);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* The code of a configuration whose only parse error is that its inputs name no file: it reads
|
|
126
|
+
* as written and holds no program.
|
|
127
|
+
*/
|
|
128
|
+
const NO_INPUTS = 18003;
|
|
129
|
+
|
|
124
130
|
/** Why one open project cannot be analyzed as it stands, split by whether it loaded at all. */
|
|
125
131
|
interface ProjectErrors {
|
|
126
132
|
/** The configuration's own errors and the errors in no file the table reads as a load failure. */
|
|
127
133
|
readonly load: readonly LocatedDiagnostic[];
|
|
134
|
+
/** Whether the compiler cannot read the configuration: a parse error other than {@link NO_INPUTS}. */
|
|
135
|
+
readonly unreadable: boolean;
|
|
128
136
|
/** The errors in the files of a project that loaded. */
|
|
129
137
|
readonly check: readonly LocatedDiagnostic[];
|
|
130
138
|
/** The libraries the configuration names that the compiler cannot find, of a project that loaded. */
|
|
@@ -135,9 +143,11 @@ interface ProjectErrors {
|
|
|
135
143
|
export function projectErrors(sets: ProjectDiagnostics): ProjectErrors {
|
|
136
144
|
const unplaced = (kind: DiagnosticClass): readonly Diagnostic[] =>
|
|
137
145
|
sets.unplaced.filter((diagnostic) => classOf(diagnostic, false) === kind);
|
|
138
|
-
const
|
|
146
|
+
const parsing = sets.configParsing.filter(isError);
|
|
147
|
+
const load = [...parsing, ...unplaced("load")];
|
|
139
148
|
return {
|
|
140
149
|
load: locatedIn(load, sets.locate),
|
|
150
|
+
unreadable: parsing.some(({ code }) => code !== NO_INPUTS),
|
|
141
151
|
check: load.length > 0 ? [] : locatedIn(diagnosticErrors(sets), sets.locate),
|
|
142
152
|
unfound: load.length > 0 ? [] : locatedIn(unplaced("unfound-library"), sets.locate),
|
|
143
153
|
};
|
package/src/load/discover.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { LANGUAGE, message } from "../product.ts";
|
|
|
8
8
|
import type { Module, Scope } from "../scope.ts";
|
|
9
9
|
import type { Engine } from "../session.ts";
|
|
10
10
|
import { globExpression } from "../text/glob.ts";
|
|
11
|
-
import { failureExit, type FailureExit } from "../failure.ts";
|
|
11
|
+
import { failureExit, type Failure, type FailureExit } from "../failure.ts";
|
|
12
12
|
import { MANIFEST } from "../fs/manifest.ts";
|
|
13
13
|
|
|
14
14
|
/** The names of the files a program of the language is read from. */
|
|
@@ -72,6 +72,8 @@ export interface NotBuilt {
|
|
|
72
72
|
readonly configFile: string;
|
|
73
73
|
/** The error's first line, every path below the target root spelled relative to it. */
|
|
74
74
|
readonly error: string;
|
|
75
|
+
/** The setup failures that dropped it, where one did. */
|
|
76
|
+
readonly failures?: readonly [Failure, ...Failure[]];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -165,11 +167,9 @@ function readConfiguration(
|
|
|
165
167
|
try {
|
|
166
168
|
const parsed = engine.parseConfigFile(configFile);
|
|
167
169
|
const circular = parsed.errors.find(({ code }) => code === CIRCULAR_EXTENDS);
|
|
168
|
-
// The compiler leaves the message's `{0}` unfilled:
|
|
169
|
-
// https://github.com/microsoft/TypeScript/pull/64755
|
|
170
170
|
return circular === undefined
|
|
171
171
|
? { parsed }
|
|
172
|
-
: { reason: `TS${String(circular.code)}: ${circular.text
|
|
172
|
+
: { reason: `TS${String(circular.code)}: ${circular.text}` };
|
|
173
173
|
} catch (error: unknown) {
|
|
174
174
|
return { reason: message(error) };
|
|
175
175
|
}
|
|
@@ -274,11 +274,17 @@ export function targetWithoutSources(target: string): FailureExit {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
/** A target configuration a matrix or the invocation names that cannot be built, ending the run. */
|
|
277
|
-
function unbuilt(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
function unbuilt(
|
|
278
|
+
named: string,
|
|
279
|
+
reason: string,
|
|
280
|
+
failureClass: Failure["failureClass"] = "no-program",
|
|
281
|
+
): never {
|
|
282
|
+
throw failureExit(failureClass, unreadableDetail(named, reason));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** What fails and the fix, for a configuration `named` that `reason` keeps from being built. */
|
|
286
|
+
export function unreadableDetail(named: string, reason: string): string {
|
|
287
|
+
return `${named} ${reason}: correct the configuration, or name the configurations to analyze`;
|
|
282
288
|
}
|
|
283
289
|
|
|
284
290
|
/**
|
|
@@ -321,7 +327,11 @@ function declaredProjects(
|
|
|
321
327
|
}
|
|
322
328
|
const read = readConfiguration(engine, configFile);
|
|
323
329
|
if ("reason" in read) {
|
|
324
|
-
unbuilt(
|
|
330
|
+
unbuilt(
|
|
331
|
+
named,
|
|
332
|
+
`cannot be read as a compiler configuration: ${read.reason}`,
|
|
333
|
+
"unreadable-configuration",
|
|
334
|
+
);
|
|
325
335
|
}
|
|
326
336
|
references.set(configFile, referencesOf(read.parsed));
|
|
327
337
|
const configuration: Configuration = {
|
|
@@ -377,13 +387,19 @@ function derivedProjects(
|
|
|
377
387
|
[...fromScope, ...configFilesUnder(host, targetRoot)],
|
|
378
388
|
(reference) => relativePath(rootDir, reference) !== undefined,
|
|
379
389
|
(configFile, reason) => {
|
|
390
|
+
const why = `cannot be read as a compiler configuration: ${reason}`;
|
|
380
391
|
if (fromScope.includes(configFile)) {
|
|
381
|
-
unbuilt(configFile,
|
|
392
|
+
unbuilt(configFile, why, "unreadable-configuration");
|
|
382
393
|
}
|
|
394
|
+
const failure: Failure = {
|
|
395
|
+
failureClass: "unreadable-configuration",
|
|
396
|
+
detail: targetRelative(unreadableDetail(idOf(configFile), why), absoluteRoot),
|
|
397
|
+
};
|
|
383
398
|
notBuilt.push({
|
|
384
399
|
id: idOf(configFile),
|
|
385
400
|
configFile,
|
|
386
401
|
error: targetRelative(reason, absoluteRoot),
|
|
402
|
+
failures: [failure],
|
|
387
403
|
});
|
|
388
404
|
},
|
|
389
405
|
);
|
|
@@ -8,7 +8,13 @@ import { packageOfSpecifier } from "../dependencies.ts";
|
|
|
8
8
|
import { MANIFEST } from "../fs/manifest.ts";
|
|
9
9
|
import { entriesOf } from "../fs/tree.ts";
|
|
10
10
|
import type { Host } from "../host.ts";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
cannotStartPackageName,
|
|
13
|
+
dirnamePath,
|
|
14
|
+
joinPath,
|
|
15
|
+
relativePath,
|
|
16
|
+
resolvePath,
|
|
17
|
+
} from "../paths.ts";
|
|
12
18
|
import { dependencySpecifiers, installedPackage, manifestsAbove } from "./module-lookup.ts";
|
|
13
19
|
import type { CompilerOptions } from "./plan.ts";
|
|
14
20
|
|
|
@@ -119,7 +125,7 @@ function expectedModule(
|
|
|
119
125
|
): string | undefined {
|
|
120
126
|
const { host, targetRoot } = context;
|
|
121
127
|
const fix = "run the generator or the build that writes it";
|
|
122
|
-
if (
|
|
128
|
+
if (cannotStartPackageName(specifier)) {
|
|
123
129
|
return provided(host, resolvePath(dirnamePath(importer), specifier), false)
|
|
124
130
|
? undefined
|
|
125
131
|
: `which names no file of the target: ${fix}`;
|
package/src/load/plan.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { CreateSnapshotProgramParams } from "@typescript/native/sync";
|
|
2
2
|
import type { PartialConfig } from "../config.ts";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
readConventions,
|
|
5
|
+
type ConventionManifest,
|
|
6
|
+
type Conventions,
|
|
7
|
+
} from "../entries/conventions.ts";
|
|
4
8
|
import { holdsManifest, inInstalledPackages, MANIFEST, readManifestAt } from "../fs/manifest.ts";
|
|
5
9
|
import { gitIgnored } from "../git-ignore.ts";
|
|
6
10
|
import type { Host } from "../host.ts";
|
|
7
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
packageEntries,
|
|
13
|
+
readManifest,
|
|
14
|
+
type Manifest,
|
|
15
|
+
type ManifestEntry,
|
|
16
|
+
} from "../roots/manifest.ts";
|
|
8
17
|
import {
|
|
9
18
|
ancestors,
|
|
10
19
|
dirnamePath,
|
package/src/load/specifiers.ts
CHANGED
|
@@ -23,14 +23,17 @@ import type { Failure } from "../failure.ts";
|
|
|
23
23
|
import { readManifestAt } from "../fs/manifest.ts";
|
|
24
24
|
import type { Host } from "../host.ts";
|
|
25
25
|
import { JAVASCRIPT_FILE } from "../javascript-file.ts";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
ancestors,
|
|
28
|
+
dirnamePath,
|
|
29
|
+
isRelativeSpecifier,
|
|
30
|
+
relativePath,
|
|
31
|
+
resolvePath,
|
|
32
|
+
} from "../paths.ts";
|
|
27
33
|
import { renderPosition, type Position } from "../position.ts";
|
|
28
34
|
import { batched, type Engine, type ProjectView } from "../session.ts";
|
|
29
35
|
import { dependencySpecifiers } from "./module-lookup.ts";
|
|
30
36
|
|
|
31
|
-
/** A relative specifier: `.`, `..`, or one starting `./` or `../`. */
|
|
32
|
-
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
33
|
-
|
|
34
37
|
/** One relative specifier of a JavaScript file that resolves to no file. */
|
|
35
38
|
export interface UnresolvedSpecifier {
|
|
36
39
|
readonly specifier: string;
|
|
@@ -141,7 +144,7 @@ export function readSpecifiers<Brand>(
|
|
|
141
144
|
const resolved = (answers[at]?.resolvedFileName ?? "") !== "";
|
|
142
145
|
const specifier = usage.node.text;
|
|
143
146
|
const name = packageOfSpecifier(specifier);
|
|
144
|
-
if (
|
|
147
|
+
if (isRelativeSpecifier(specifier)) {
|
|
145
148
|
const named = resolvePath(dirnamePath(usage.file.fileName), specifier);
|
|
146
149
|
if (!resolved && !outputs.some((dir) => relativePath(dir, named) !== undefined)) {
|
|
147
150
|
unresolved.push({
|
package/src/load/synthesize.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { readCommands } from "../commands/read.ts";
|
|
9
|
-
import { CONVENTION_ROWS } from "../convention-rows.ts";
|
|
10
|
-
import type { Conventions } from "../conventions.ts";
|
|
9
|
+
import { CONVENTION_ROWS } from "../entries/convention-rows.ts";
|
|
10
|
+
import type { Conventions } from "../entries/conventions.ts";
|
|
11
11
|
import { holdsManifest, MANIFEST, readManifestAt, type ManifestRead } from "../fs/manifest.ts";
|
|
12
12
|
import { filesBelow } from "../fs/tree.ts";
|
|
13
13
|
import type { Host } from "../host.ts";
|
|
14
|
-
import { JAVASCRIPT_FILE,
|
|
14
|
+
import { JAVASCRIPT_FILE, minifiedBy, minifiedByName } from "../javascript-file.ts";
|
|
15
15
|
import { isRecord } from "../json-document.ts";
|
|
16
|
-
import { manifestCommands } from "../manifest.ts";
|
|
16
|
+
import { manifestCommands } from "../roots/manifest.ts";
|
|
17
17
|
import { ancestors, dirnamePath, joinPath, relativePath } from "../paths.ts";
|
|
18
18
|
import type { Engine } from "../session.ts";
|
|
19
19
|
import { bytewise } from "../text/compare.ts";
|
|
@@ -50,11 +50,11 @@ interface CandidateContext {
|
|
|
50
50
|
|
|
51
51
|
/** Whether one file is minified build output; one that cannot be read is left to the compiler. */
|
|
52
52
|
function minifiedFile(host: Host, file: string): boolean {
|
|
53
|
-
if (minifiedByName(file)) {
|
|
53
|
+
if (minifiedByName(file) !== undefined) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
try {
|
|
57
|
-
return
|
|
57
|
+
return minifiedBy(file, host.readFile(file)) !== undefined;
|
|
58
58
|
} catch {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
@@ -132,6 +132,12 @@ const RUNTIME_OPTIONS = {
|
|
|
132
132
|
node: { module: "nodenext", moduleResolution: "nodenext" },
|
|
133
133
|
} as const satisfies Record<Runtime, Readonly<Record<string, string>>>;
|
|
134
134
|
|
|
135
|
+
/** Whether one configuration is a program the run formed to resolve its modules as Node does. */
|
|
136
|
+
export function formedForNode(configuration: Configuration): boolean {
|
|
137
|
+
const options = configuration.written?.["compilerOptions"];
|
|
138
|
+
return isRecord(options) && options["moduleResolution"] === RUNTIME_OPTIONS.node.moduleResolution;
|
|
139
|
+
}
|
|
140
|
+
|
|
135
141
|
/** The manifest members that say a package is written for Node. */
|
|
136
142
|
const NODE_MEMBERS = ["main", "exports", "bin", "type"] as const;
|
|
137
143
|
|
package/src/load/test-globals.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type Node,
|
|
24
24
|
type SourceFile,
|
|
25
25
|
} from "@typescript/native/ast";
|
|
26
|
-
import type { ParseFile } from "../configuration-files.ts";
|
|
26
|
+
import type { ParseFile } from "../entries/configuration-files.ts";
|
|
27
27
|
import type { Host } from "../host.ts";
|
|
28
28
|
import { isRecord } from "../json-document.ts";
|
|
29
29
|
import { ancestors, dirnamePath, joinPath } from "../paths.ts";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { emittedFrom } from "./emit-map.ts";
|
|
10
10
|
import type { Host } from "../host.ts";
|
|
11
|
-
import { readManifest, type Manifest, type ManifestEntry } from "../manifest.ts";
|
|
11
|
+
import { readManifest, type Manifest, type ManifestEntry } from "../roots/manifest.ts";
|
|
12
12
|
import { joinPath, relativePath } from "../paths.ts";
|
|
13
13
|
import type { WorkspaceMember } from "./workspace.ts";
|
|
14
14
|
import type { WorkspaceResolver } from "./workspace-resolution.ts";
|
|
@@ -10,7 +10,14 @@ import { emittedFrom } from "./emit-map.ts";
|
|
|
10
10
|
import { packageOfSpecifier } from "../dependencies.ts";
|
|
11
11
|
import { gitIgnored } from "../git-ignore.ts";
|
|
12
12
|
import type { Host } from "../host.ts";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
ancestors,
|
|
15
|
+
cannotStartPackageName,
|
|
16
|
+
dirnamePath,
|
|
17
|
+
joinPath,
|
|
18
|
+
relativePath,
|
|
19
|
+
resolvePath,
|
|
20
|
+
} from "../paths.ts";
|
|
14
21
|
import { satisfies } from "../version-range.ts";
|
|
15
22
|
import type { Workspace, WorkspaceMember } from "./workspace.ts";
|
|
16
23
|
import { isRecord } from "../json-document.ts";
|
|
@@ -140,7 +147,7 @@ function dependsOn(specifier: string, member: WorkspaceMember, fromDir: string):
|
|
|
140
147
|
member.version !== undefined && satisfies(member.version, range);
|
|
141
148
|
if (specifier.startsWith("workspace:")) {
|
|
142
149
|
const rest = specifier.slice("workspace:".length);
|
|
143
|
-
if (
|
|
150
|
+
if (cannotStartPackageName(rest)) {
|
|
144
151
|
return atPath(rest);
|
|
145
152
|
}
|
|
146
153
|
const alias = /^((?:@[^/@]+\/)?[^/@]+)@(.*)$/u.exec(rest);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { Host } from "../host.ts";
|
|
9
|
-
import type { Manifest, ManifestEntry } from "../manifest.ts";
|
|
9
|
+
import type { Manifest, ManifestEntry } from "../roots/manifest.ts";
|
|
10
10
|
import { relativePath } from "../paths.ts";
|
|
11
11
|
import type { Engine } from "../session.ts";
|
|
12
12
|
import type { LocatedDiagnostic } from "./diagnostics.ts";
|
package/src/matrix.ts
CHANGED
|
@@ -9,9 +9,11 @@ import { graphOf, OUTSIDE, type Graph } from "./graph.ts";
|
|
|
9
9
|
import type { InventorySymbol } from "./inventory.ts";
|
|
10
10
|
import { byPosition } from "./position.ts";
|
|
11
11
|
import type { Reference } from "./references.ts";
|
|
12
|
-
import type { Root } from "./roots.ts";
|
|
12
|
+
import type { Root } from "./roots/root-set.ts";
|
|
13
|
+
import { edgeWithheldBy } from "./tests/file-class.ts";
|
|
13
14
|
import {
|
|
14
15
|
reachedWithTheTests,
|
|
16
|
+
splitRefs,
|
|
15
17
|
sweep,
|
|
16
18
|
type Candidate,
|
|
17
19
|
type Liveness,
|
|
@@ -198,19 +200,12 @@ export function matrixOf(per: readonly Configured[]): Matrix {
|
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* reference under one configuration is a reference, so what one project uses is never
|
|
208
|
-
* reported, and a configuration that does not hold a declaration says nothing about it.
|
|
209
|
-
* The candidate's relation is reference counting where every configuration found it so,
|
|
210
|
-
* and reachability otherwise; its counts are the union's, one per reference.
|
|
211
|
-
*
|
|
212
|
-
* The components are computed once, over the union and the intersected dead set, so one
|
|
213
|
-
* dead component is one entry of the run with one identifier.
|
|
203
|
+
* Which declarations of the run are dead in every configuration that holds them. Each
|
|
204
|
+
* configuration is swept on its own graph, since a file it does not compile references nothing
|
|
205
|
+
* there and a root it does not hold seeds nothing. A declaration is a candidate when every
|
|
206
|
+
* configuration holding it judged it one; its relation is reference counting where every one
|
|
207
|
+
* found it so, else reachability, and its counts are the union's. Components are computed once,
|
|
208
|
+
* over the union and the intersected dead set, so one dead component has one identifier.
|
|
214
209
|
*/
|
|
215
210
|
export function sweepMatrix(matrix: Matrix, input: SweepInput): SweepResult {
|
|
216
211
|
const per = matrix.graphs.map((graph) => sweep(graph, input));
|
|
@@ -277,13 +272,14 @@ export function sweepMatrix(matrix: Matrix, input: SweepInput): SweepResult {
|
|
|
277
272
|
}
|
|
278
273
|
const held = matrix.heldIn[at] ?? [];
|
|
279
274
|
const admitted = admittedAt(at);
|
|
280
|
-
const
|
|
275
|
+
const split = splitRefs(union.made[at], input.mode);
|
|
276
|
+
const testRefs = split.test;
|
|
281
277
|
const heldByTests =
|
|
282
278
|
heldBy[union.parent[at] ?? OUTSIDE] ??
|
|
283
279
|
(union.support[at] === true && testRefs > 0 && !admitted ? symbol.id : undefined);
|
|
284
280
|
const unreferenced = union.test[at] === true && !admitted && testReached[at] !== true;
|
|
285
281
|
heldBy[at] = heldByTests;
|
|
286
|
-
const productionRefs =
|
|
282
|
+
const productionRefs = split.production;
|
|
287
283
|
const counted = all.every((candidate) => candidate.relation === "reference-counting");
|
|
288
284
|
candidates.push({
|
|
289
285
|
id: symbol.id,
|
|
@@ -332,7 +328,7 @@ function compiledReferences(
|
|
|
332
328
|
}
|
|
333
329
|
for (const edge of edges) {
|
|
334
330
|
const to = graph.symbols[edge.to]?.id ?? "";
|
|
335
|
-
if ((
|
|
331
|
+
if (!edgeWithheldBy(mode, edge) && dead.has(to) && !kept.has(to)) {
|
|
336
332
|
kept.add(to);
|
|
337
333
|
changed = true;
|
|
338
334
|
}
|