@cplieger/deadset-ts 6.0.0 → 6.1.0
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/src/configured-declarations.js +7 -5
- package/dist/src/conformance-record.js +2 -2
- package/dist/src/convention-rows.js +67 -1
- package/dist/src/conventions.js +51 -9
- package/dist/src/edges.js +19 -16
- package/dist/src/findings/completion.js +9 -4
- package/dist/src/findings/emitters.js +35 -34
- package/dist/src/findings/reads-and-writes.js +3 -2
- package/dist/src/findings/visibility-narrowing.js +2 -1
- package/dist/src/inventory.js +6 -1
- package/dist/src/module-declarations.js +3 -3
- package/dist/src/outside-tests.js +5 -11
- package/dist/src/overrides.js +22 -10
- package/dist/src/ref.js +18 -2
- package/dist/src/reporters/sarif.js +3 -1
- package/dist/src/suppress-file.js +3 -5
- package/dist/src/version.js +1 -1
- package/dist/src/workspace-programs.js +6 -31
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/configured-declarations.ts +7 -5
- package/src/conformance-record.ts +2 -2
- package/src/convention-rows.ts +84 -1
- package/src/conventions.ts +77 -9
- package/src/edges.ts +20 -17
- package/src/findings/completion.ts +11 -4
- package/src/findings/emitters.ts +38 -51
- package/src/findings/reads-and-writes.ts +7 -2
- package/src/findings/visibility-narrowing.ts +2 -1
- package/src/inventory.ts +6 -1
- package/src/module-declarations.ts +3 -3
- package/src/outside-tests.ts +5 -11
- package/src/overrides.ts +26 -11
- package/src/ref.ts +27 -4
- package/src/reporters/sarif.ts +5 -1
- package/src/suppress-file.ts +3 -6
- package/src/version.ts +1 -1
- package/src/workspace-programs.ts +6 -35
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
import { isStringLiteralLikeNode } from "@typescript/native/unstable/ast";
|
|
18
18
|
import type { StringLiteralLikeNode } from "@typescript/native/unstable/ast";
|
|
19
19
|
import type { Host } from "./host.ts";
|
|
20
|
-
import { dirnamePath,
|
|
20
|
+
import { dirnamePath, resolvePath } from "./paths.ts";
|
|
21
21
|
import type { Engine } from "./session.ts";
|
|
22
22
|
import type { WorkspaceResolver } from "./workspace-resolution.ts";
|
|
23
23
|
|
|
@@ -82,34 +82,6 @@ function analysisOptions(parsed: Parsed): CreateSnapshotProgramParams["compilerO
|
|
|
82
82
|
return composite === true ? { ...kept, declaration: true } : kept;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
/**
|
|
86
|
-
* The references a built program can carry: only where every referenced
|
|
87
|
-
* configuration reads and is composite with output, because the compiler reports a
|
|
88
|
-
* broken reference at syntax a built program does not have.
|
|
89
|
-
*/
|
|
90
|
-
function carriedReferences(
|
|
91
|
-
engine: Engine,
|
|
92
|
-
parsed: Parsed,
|
|
93
|
-
): NonNullable<Parsed["projectReferences"]> {
|
|
94
|
-
const references = parsed.projectReferences ?? [];
|
|
95
|
-
for (const reference of references) {
|
|
96
|
-
// A reference that names a directory names the `tsconfig.json` in it.
|
|
97
|
-
const configFile = reference.path.endsWith(".json")
|
|
98
|
-
? reference.path
|
|
99
|
-
: joinPath(reference.path, "tsconfig.json");
|
|
100
|
-
let options: Parsed["options"];
|
|
101
|
-
try {
|
|
102
|
-
options = engine.parseConfigFile(configFile).options;
|
|
103
|
-
} catch {
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
106
|
-
if (options.composite !== true || options.noEmit === true) {
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return references;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
85
|
/** The conditions an `exports` lookup under one configuration and one resolution mode reads. */
|
|
114
86
|
function conditionsOf(parsed: Parsed, mode: ResolutionMode | undefined): ReadonlySet<string> {
|
|
115
87
|
const resolution = parsed.options.moduleResolution;
|
|
@@ -132,7 +104,6 @@ function resolutionMode(kind: ModuleKind): ResolutionMode | undefined {
|
|
|
132
104
|
interface Reading {
|
|
133
105
|
readonly configFile: string;
|
|
134
106
|
readonly parsed: Parsed;
|
|
135
|
-
readonly references: NonNullable<Parsed["projectReferences"]>;
|
|
136
107
|
readonly entries: ModuleResolutionEntry[];
|
|
137
108
|
readonly seen: Set<string>;
|
|
138
109
|
/** Per member specifier, every file an import of it is read as. */
|
|
@@ -181,7 +152,7 @@ function configurationOf(
|
|
|
181
152
|
if (reason !== undefined) {
|
|
182
153
|
return { kind: "unread", reason };
|
|
183
154
|
}
|
|
184
|
-
const { options } = reading.parsed;
|
|
155
|
+
const { options, projectReferences: references = [] } = reading.parsed;
|
|
185
156
|
const raw: unknown = (options as Record<string, unknown>)["pathsBasePath"];
|
|
186
157
|
const base = typeof raw === "string" ? raw : dirnamePath(reading.configFile);
|
|
187
158
|
const paths: Record<string, string[]> = {};
|
|
@@ -204,8 +175,8 @@ function configurationOf(
|
|
|
204
175
|
...(options.composite === true ? { composite: false, declaration: true } : {}),
|
|
205
176
|
paths,
|
|
206
177
|
},
|
|
207
|
-
...(
|
|
208
|
-
? { references:
|
|
178
|
+
...(references.length > 0
|
|
179
|
+
? { references: references.map((reference) => ({ path: reference.path })) }
|
|
209
180
|
: {}),
|
|
210
181
|
...(exclude === undefined ? {} : { exclude }),
|
|
211
182
|
});
|
|
@@ -240,6 +211,7 @@ function programOf(
|
|
|
240
211
|
reading: Reading,
|
|
241
212
|
): { readonly params: CreateSnapshotProgramParams; readonly resolver: ModuleResolver } {
|
|
242
213
|
const compilerOptions = analysisOptions(reading.parsed);
|
|
214
|
+
const references = reading.parsed.projectReferences ?? [];
|
|
243
215
|
const resolver = engine.createModuleResolver(compilerOptions, reading.entries);
|
|
244
216
|
return {
|
|
245
217
|
resolver,
|
|
@@ -249,7 +221,7 @@ function programOf(
|
|
|
249
221
|
options: {
|
|
250
222
|
moduleResolver: resolver,
|
|
251
223
|
configFileParsingDiagnostics: reading.parsed.errors,
|
|
252
|
-
...(
|
|
224
|
+
...(references.length > 0 ? { projectReferences: references } : {}),
|
|
253
225
|
},
|
|
254
226
|
},
|
|
255
227
|
};
|
|
@@ -436,7 +408,6 @@ export function workspacePrograms(
|
|
|
436
408
|
{
|
|
437
409
|
configFile,
|
|
438
410
|
parsed,
|
|
439
|
-
references: carriedReferences(engine, parsed),
|
|
440
411
|
entries: [],
|
|
441
412
|
seen: new Set<string>(),
|
|
442
413
|
bound: new Map<string, Set<string>>(),
|