@cplieger/deadset-ts 8.0.0-dev.14 → 8.0.0-dev.16
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 +2 -2
- package/dist/src/analysis.js +43 -38
- package/dist/src/commands/read.js +6 -7
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/consumers.js +4 -2
- package/dist/src/contract/config.generated.js +1 -1
- package/dist/src/contract/contract.generated.js +120 -2
- package/dist/src/dependencies.js +81 -49
- package/dist/src/entries/build-scripts.js +222 -0
- package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
- 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} +3 -3
- package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
- package/dist/src/entries/run-directories.js +77 -0
- package/dist/src/entries/sources.js +144 -0
- package/dist/src/entries/static-module.js +669 -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/file-facts.js +1 -1
- package/dist/src/findings/emitters.js +5 -8
- package/dist/src/findings/self-check.js +36 -20
- package/dist/src/findings-pass.js +5 -6
- package/dist/src/framework-lifecycle.js +1 -1
- package/dist/src/fs/manifest.js +15 -20
- package/dist/src/generated-file.js +172 -29
- package/dist/src/graph.js +2 -5
- package/dist/src/index.js +1 -1
- package/dist/src/injection-container.js +1 -1
- package/dist/src/inventory/commonjs.js +507 -0
- package/dist/src/inventory/enumerate.js +167 -0
- package/dist/src/inventory/syntax.js +236 -0
- package/dist/src/inventory.js +305 -705
- package/dist/src/javascript-file.js +26 -11
- package/dist/src/load/classify.js +28 -9
- package/dist/src/load/diagnostics.js +8 -1
- package/dist/src/load/discover.js +16 -8
- package/dist/src/load/package-scope.js +56 -0
- package/dist/src/load/plan.js +2 -2
- package/dist/src/load/synthesize.js +5 -5
- package/dist/src/load/workspace-manifests.js +1 -1
- package/dist/src/matrix.js +6 -13
- package/dist/src/outside-tests.js +1 -1
- package/dist/src/paths.js +16 -0
- package/dist/src/platform-calls.js +78 -0
- package/dist/src/platform-symbols.js +140 -0
- package/dist/src/position.js +41 -0
- package/dist/src/ref.js +11 -20
- package/dist/src/references.js +281 -50
- package/dist/src/resolve.js +1 -1
- package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -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 +208 -0
- package/dist/src/serialization-contract.js +1 -1
- package/dist/src/session.js +3 -0
- package/dist/src/source-files.js +5 -9
- package/dist/src/suppress-inline.js +33 -81
- package/dist/src/suppress.js +30 -32
- package/dist/src/test-support.js +4 -2
- package/dist/src/verbs/analyze.js +13 -1
- package/dist/src/verbs/describe.js +5 -3
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/alias-chain.ts +2 -2
- package/src/analysis.ts +77 -53
- package/src/automatic-types.ts +1 -1
- package/src/commands/read.ts +6 -8
- package/src/conformance-record.ts +1 -1
- package/src/consumers.ts +5 -1
- package/src/contract/config.generated.ts +1 -1
- package/src/contract/contract.generated.ts +139 -2
- package/src/dependencies.ts +98 -50
- package/src/entries/build-scripts.ts +292 -0
- package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
- package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
- package/src/{conventions.ts → entries/conventions.ts} +347 -522
- package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
- package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
- package/src/entries/run-directories.ts +108 -0
- package/src/entries/sources.ts +266 -0
- package/src/entries/static-module.ts +857 -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 +44 -0
- package/src/file-facts.ts +2 -2
- package/src/findings/emitters.ts +14 -10
- 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 +1 -1
- package/src/fs/manifest.ts +25 -21
- package/src/generated-file.ts +240 -36
- package/src/graph.ts +3 -6
- package/src/index.ts +1 -1
- package/src/injection-container.ts +1 -1
- package/src/inventory/commonjs.ts +696 -0
- package/src/inventory/enumerate.ts +203 -0
- package/src/inventory/syntax.ts +311 -0
- package/src/inventory.ts +424 -878
- package/src/javascript-file.ts +29 -12
- package/src/load/classify.ts +49 -13
- package/src/load/diagnostics.ts +11 -1
- package/src/load/discover.ts +28 -12
- package/src/load/package-scope.ts +74 -0
- package/src/load/plan.ts +11 -2
- package/src/load/synthesize.ts +6 -6
- package/src/load/test-globals.ts +1 -1
- package/src/load/workspace-manifests.ts +1 -1
- package/src/load/workspace-run.ts +1 -1
- package/src/matrix.ts +7 -14
- package/src/outside-tests.ts +1 -1
- package/src/paths.ts +18 -0
- package/src/platform-calls.ts +119 -0
- package/src/platform-symbols.ts +205 -0
- package/src/position.ts +42 -0
- package/src/ref.ts +11 -20
- package/src/references.ts +383 -73
- package/src/report.ts +1 -1
- package/src/resolve.ts +1 -1
- package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -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 +307 -0
- package/src/serialization-contract.ts +1 -1
- package/src/session.ts +17 -1
- package/src/source-files.ts +5 -10
- package/src/suppress-inline.ts +53 -89
- package/src/suppress.ts +48 -33
- package/src/test-support.ts +8 -3
- package/src/verbs/analyze.ts +17 -4
- package/src/verbs/describe.ts +5 -2
- package/src/verbs/explain.ts +1 -1
- package/dist/src/build-scripts.js +0 -418
- package/dist/src/conventions.js +0 -907
- package/dist/src/entry-points.js +0 -513
- package/dist/src/roots.js +0 -865
- package/dist/src/unseen-loads.js +0 -100
- package/src/build-scripts.ts +0 -536
- package/src/entry-points.ts +0 -661
- package/src/unseen-loads.ts +0 -134
package/src/unseen-loads.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The loads of a project's production files whose target the analysis cannot resolve: an
|
|
3
|
-
* `import()` or `require()` call whose path is computed and starts with no relative literal
|
|
4
|
-
* naming a directory below the calling file's. The files such a load runs are roots the
|
|
5
|
-
* analysis does not see, so the configuration's roots are never complete.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
isBinaryExpression,
|
|
10
|
-
isCallExpression,
|
|
11
|
-
isIdentifier,
|
|
12
|
-
isNoSubstitutionTemplateLiteral,
|
|
13
|
-
isStringLiteral,
|
|
14
|
-
isTemplateExpression,
|
|
15
|
-
SyntaxKind,
|
|
16
|
-
type Node,
|
|
17
|
-
} from "@typescript/native/ast";
|
|
18
|
-
import { dirnamePath, relativePath, resolvePath } from "./paths.ts";
|
|
19
|
-
import { renderPosition, type Position } from "./position.ts";
|
|
20
|
-
import { UNANSWERED } from "./query.ts";
|
|
21
|
-
import type { ProjectView } from "./session.ts";
|
|
22
|
-
import { sourceFilesOf } from "./source-files.ts";
|
|
23
|
-
import { unwrapped } from "./unwrap.ts";
|
|
24
|
-
|
|
25
|
-
/** One load the analysis cannot resolve, in the configuration whose production file writes it. */
|
|
26
|
-
export interface UnseenLoad {
|
|
27
|
-
readonly configuration: string;
|
|
28
|
-
/** The position of the call. */
|
|
29
|
-
readonly position: Position;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** The literal text a computed path starts with: a template's head, or a concatenation's first literal. */
|
|
33
|
-
export function leadingLiteral(node: Node): string | undefined {
|
|
34
|
-
const at = unwrapped(node);
|
|
35
|
-
if (isTemplateExpression(at)) {
|
|
36
|
-
return at.head.text;
|
|
37
|
-
}
|
|
38
|
-
if (isBinaryExpression(at) && at.operatorToken.kind === SyntaxKind.PlusToken) {
|
|
39
|
-
const left = unwrapped(at.left);
|
|
40
|
-
return isStringLiteral(left) || isNoSubstitutionTemplateLiteral(left)
|
|
41
|
-
? left.text
|
|
42
|
-
: leadingLiteral(at.left);
|
|
43
|
-
}
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The directory below `dir` a computed load's leading literal names, which the entry
|
|
49
|
-
* rules root every file of, or none where it names a package, `dir` itself or a
|
|
50
|
-
* directory holding it, each of which would name files no rule roots.
|
|
51
|
-
*/
|
|
52
|
-
export function computedLoadDirectory(dir: string, prefix: string): string | undefined {
|
|
53
|
-
if (!(prefix.startsWith("./") || prefix.startsWith("../")) || !prefix.endsWith("/")) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
const target = resolvePath(dir, prefix);
|
|
57
|
-
return target === dir || relativePath(target, dir) !== undefined ? undefined : target;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Whether a computed path's leading literal names a package, whose files are none of the target's. */
|
|
61
|
-
function namesPackage(prefix: string | undefined): boolean {
|
|
62
|
-
return (
|
|
63
|
-
prefix !== undefined &&
|
|
64
|
-
prefix !== "" &&
|
|
65
|
-
!prefix.startsWith(".") &&
|
|
66
|
-
!prefix.startsWith("/") &&
|
|
67
|
-
!/^[A-Za-z][A-Za-z\d+.-]*:/u.test(prefix)
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Every unresolved load the project's production files write, in file then source order.
|
|
73
|
-
* `testFiles` holds the test files by their path below the target root. A `require` call
|
|
74
|
-
* loads a module only where the name resolves to no declaration of the project's own
|
|
75
|
-
* files: one the project declares is its own function.
|
|
76
|
-
*/
|
|
77
|
-
export function unseenLoadsOf<Brand>(
|
|
78
|
-
project: ProjectView<Brand>,
|
|
79
|
-
configuration: string,
|
|
80
|
-
targetRoot: string,
|
|
81
|
-
testFiles: readonly string[],
|
|
82
|
-
): readonly UnseenLoad[] {
|
|
83
|
-
const tests = new Set(testFiles);
|
|
84
|
-
const sites: { readonly position: Position; readonly require: Node | undefined }[] = [];
|
|
85
|
-
for (const [path, file] of sourceFilesOf(project, targetRoot).byPath) {
|
|
86
|
-
if (tests.has(path) || file.isDeclarationFile) {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const dir = dirnamePath(file.fileName);
|
|
90
|
-
const visit = (node: Node): void => {
|
|
91
|
-
if (isCallExpression(node)) {
|
|
92
|
-
const callee = node.expression;
|
|
93
|
-
const required = isIdentifier(callee) && callee.text === "require";
|
|
94
|
-
const [first] = node.arguments;
|
|
95
|
-
const argument = first === undefined ? undefined : unwrapped(first);
|
|
96
|
-
if (
|
|
97
|
-
(callee.kind === SyntaxKind.ImportKeyword || required) &&
|
|
98
|
-
argument !== undefined &&
|
|
99
|
-
!isStringLiteral(argument) &&
|
|
100
|
-
!isNoSubstitutionTemplateLiteral(argument)
|
|
101
|
-
) {
|
|
102
|
-
const prefix = leadingLiteral(argument);
|
|
103
|
-
const seen =
|
|
104
|
-
namesPackage(prefix) ||
|
|
105
|
-
(prefix !== undefined && computedLoadDirectory(dir, prefix) !== undefined);
|
|
106
|
-
if (!seen) {
|
|
107
|
-
sites.push({
|
|
108
|
-
position: renderPosition(file, targetRoot, node.getStart()),
|
|
109
|
-
require: required ? callee : undefined,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
node.forEachChild(visit);
|
|
115
|
-
};
|
|
116
|
-
file.forEachChild(visit);
|
|
117
|
-
}
|
|
118
|
-
const requires = sites.flatMap((site) => (site.require === undefined ? [] : [site.require]));
|
|
119
|
-
const own = project.ownPaths();
|
|
120
|
-
const local = new Set<Node>();
|
|
121
|
-
project.symbolsAt(requires.map((node) => project.handle(node))).forEach((symbol, at) => {
|
|
122
|
-
const node = requires[at];
|
|
123
|
-
if (
|
|
124
|
-
node !== undefined &&
|
|
125
|
-
symbol !== UNANSWERED &&
|
|
126
|
-
symbol?.declarations.some((handle) => own.has(handle.path)) === true
|
|
127
|
-
) {
|
|
128
|
-
local.add(node);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return sites
|
|
132
|
-
.filter((site) => site.require === undefined || !local.has(site.require))
|
|
133
|
-
.map((site) => ({ configuration, position: site.position }));
|
|
134
|
-
}
|