@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.
Files changed (149) hide show
  1. package/dist/src/alias-chain.js +2 -2
  2. package/dist/src/analysis.js +43 -38
  3. package/dist/src/commands/read.js +6 -7
  4. package/dist/src/conformance-record.js +1 -1
  5. package/dist/src/consumers.js +4 -2
  6. package/dist/src/contract/config.generated.js +1 -1
  7. package/dist/src/contract/contract.generated.js +120 -2
  8. package/dist/src/dependencies.js +81 -49
  9. package/dist/src/entries/build-scripts.js +222 -0
  10. package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
  11. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  12. package/dist/src/entries/conventions.js +739 -0
  13. package/dist/src/{html-entries.js → entries/html-entries.js} +3 -3
  14. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
  15. package/dist/src/entries/run-directories.js +77 -0
  16. package/dist/src/entries/sources.js +144 -0
  17. package/dist/src/entries/static-module.js +669 -0
  18. package/dist/src/entries/test-runners.js +684 -0
  19. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  20. package/dist/src/extensions.js +37 -0
  21. package/dist/src/facts.js +38 -0
  22. package/dist/src/file-facts.js +1 -1
  23. package/dist/src/findings/emitters.js +5 -8
  24. package/dist/src/findings/self-check.js +36 -20
  25. package/dist/src/findings-pass.js +5 -6
  26. package/dist/src/framework-lifecycle.js +1 -1
  27. package/dist/src/fs/manifest.js +15 -20
  28. package/dist/src/generated-file.js +172 -29
  29. package/dist/src/graph.js +2 -5
  30. package/dist/src/index.js +1 -1
  31. package/dist/src/injection-container.js +1 -1
  32. package/dist/src/inventory/commonjs.js +507 -0
  33. package/dist/src/inventory/enumerate.js +167 -0
  34. package/dist/src/inventory/syntax.js +236 -0
  35. package/dist/src/inventory.js +305 -705
  36. package/dist/src/javascript-file.js +26 -11
  37. package/dist/src/load/classify.js +28 -9
  38. package/dist/src/load/diagnostics.js +8 -1
  39. package/dist/src/load/discover.js +16 -8
  40. package/dist/src/load/package-scope.js +56 -0
  41. package/dist/src/load/plan.js +2 -2
  42. package/dist/src/load/synthesize.js +5 -5
  43. package/dist/src/load/workspace-manifests.js +1 -1
  44. package/dist/src/matrix.js +6 -13
  45. package/dist/src/outside-tests.js +1 -1
  46. package/dist/src/paths.js +16 -0
  47. package/dist/src/platform-calls.js +78 -0
  48. package/dist/src/platform-symbols.js +140 -0
  49. package/dist/src/position.js +41 -0
  50. package/dist/src/ref.js +11 -20
  51. package/dist/src/references.js +281 -50
  52. package/dist/src/resolve.js +1 -1
  53. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -4
  54. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  55. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  56. package/dist/src/roots/published-reach.js +412 -0
  57. package/dist/src/roots/root-set.js +489 -0
  58. package/dist/src/roots/unseen-loads.js +208 -0
  59. package/dist/src/serialization-contract.js +1 -1
  60. package/dist/src/session.js +3 -0
  61. package/dist/src/source-files.js +5 -9
  62. package/dist/src/suppress-inline.js +33 -81
  63. package/dist/src/suppress.js +30 -32
  64. package/dist/src/test-support.js +4 -2
  65. package/dist/src/verbs/analyze.js +13 -1
  66. package/dist/src/verbs/describe.js +5 -3
  67. package/jsr.json +1 -1
  68. package/package.json +3 -3
  69. package/src/alias-chain.ts +2 -2
  70. package/src/analysis.ts +77 -53
  71. package/src/automatic-types.ts +1 -1
  72. package/src/commands/read.ts +6 -8
  73. package/src/conformance-record.ts +1 -1
  74. package/src/consumers.ts +5 -1
  75. package/src/contract/config.generated.ts +1 -1
  76. package/src/contract/contract.generated.ts +139 -2
  77. package/src/dependencies.ts +98 -50
  78. package/src/entries/build-scripts.ts +292 -0
  79. package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
  80. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  81. package/src/{conventions.ts → entries/conventions.ts} +347 -522
  82. package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
  83. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
  84. package/src/entries/run-directories.ts +108 -0
  85. package/src/entries/sources.ts +266 -0
  86. package/src/entries/static-module.ts +857 -0
  87. package/src/entries/test-runners.ts +868 -0
  88. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  89. package/src/exempt.ts +3 -2
  90. package/src/extensions.ts +45 -0
  91. package/src/facts.ts +44 -0
  92. package/src/file-facts.ts +2 -2
  93. package/src/findings/emitters.ts +14 -10
  94. package/src/findings/self-check.ts +41 -22
  95. package/src/findings/visibility-narrowing.ts +1 -1
  96. package/src/findings-pass.ts +5 -12
  97. package/src/framework-lifecycle.ts +1 -1
  98. package/src/fs/manifest.ts +25 -21
  99. package/src/generated-file.ts +240 -36
  100. package/src/graph.ts +3 -6
  101. package/src/index.ts +1 -1
  102. package/src/injection-container.ts +1 -1
  103. package/src/inventory/commonjs.ts +696 -0
  104. package/src/inventory/enumerate.ts +203 -0
  105. package/src/inventory/syntax.ts +311 -0
  106. package/src/inventory.ts +424 -878
  107. package/src/javascript-file.ts +29 -12
  108. package/src/load/classify.ts +49 -13
  109. package/src/load/diagnostics.ts +11 -1
  110. package/src/load/discover.ts +28 -12
  111. package/src/load/package-scope.ts +74 -0
  112. package/src/load/plan.ts +11 -2
  113. package/src/load/synthesize.ts +6 -6
  114. package/src/load/test-globals.ts +1 -1
  115. package/src/load/workspace-manifests.ts +1 -1
  116. package/src/load/workspace-run.ts +1 -1
  117. package/src/matrix.ts +7 -14
  118. package/src/outside-tests.ts +1 -1
  119. package/src/paths.ts +18 -0
  120. package/src/platform-calls.ts +119 -0
  121. package/src/platform-symbols.ts +205 -0
  122. package/src/position.ts +42 -0
  123. package/src/ref.ts +11 -20
  124. package/src/references.ts +383 -73
  125. package/src/report.ts +1 -1
  126. package/src/resolve.ts +1 -1
  127. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -7
  128. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  129. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  130. package/src/roots/published-reach.ts +481 -0
  131. package/src/{roots.ts → roots/root-set.ts} +203 -630
  132. package/src/roots/unseen-loads.ts +307 -0
  133. package/src/serialization-contract.ts +1 -1
  134. package/src/session.ts +17 -1
  135. package/src/source-files.ts +5 -10
  136. package/src/suppress-inline.ts +53 -89
  137. package/src/suppress.ts +48 -33
  138. package/src/test-support.ts +8 -3
  139. package/src/verbs/analyze.ts +17 -4
  140. package/src/verbs/describe.ts +5 -2
  141. package/src/verbs/explain.ts +1 -1
  142. package/dist/src/build-scripts.js +0 -418
  143. package/dist/src/conventions.js +0 -907
  144. package/dist/src/entry-points.js +0 -513
  145. package/dist/src/roots.js +0 -865
  146. package/dist/src/unseen-loads.js +0 -100
  147. package/src/build-scripts.ts +0 -536
  148. package/src/entry-points.ts +0 -661
  149. package/src/unseen-loads.ts +0 -134
@@ -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
- }