@cplieger/deadset-ts 8.0.0-dev.6 → 8.0.0-dev.7

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 (158) hide show
  1. package/dist/bin/mapper-connection.js +2 -1
  2. package/dist/bin/node-host.js +3 -2
  3. package/dist/src/analysis.js +25 -43
  4. package/dist/src/automatic-types.js +10 -29
  5. package/dist/src/build-scripts.js +17 -29
  6. package/dist/src/component-layer.js +4 -2
  7. package/dist/src/components.js +2 -3
  8. package/dist/src/config.js +2 -1
  9. package/dist/src/configuration-files.js +27 -168
  10. package/dist/src/contract/contract.generated.js +13 -0
  11. package/dist/src/conventions.js +20 -60
  12. package/dist/src/dependencies.js +25 -43
  13. package/dist/src/discover.js +13 -39
  14. package/dist/src/edges.js +7 -15
  15. package/dist/src/element-access.js +4 -6
  16. package/dist/src/entry-point-gaps.js +2 -8
  17. package/dist/src/entry-points.js +3 -10
  18. package/dist/src/enum-group.js +3 -10
  19. package/dist/src/erased-stores.js +4 -6
  20. package/dist/src/exempt-classes.js +2 -4
  21. package/dist/src/exempt.js +6 -22
  22. package/dist/src/file-facts.js +2 -25
  23. package/dist/src/findings/reads-and-writes.js +2 -1
  24. package/dist/src/findings/self-check.js +3 -2
  25. package/dist/src/findings-pass.js +6 -11
  26. package/dist/src/fs/manifest.js +43 -0
  27. package/dist/src/fs/tree.js +88 -0
  28. package/dist/src/git-ignore.js +34 -25
  29. package/dist/src/html-entries.js +6 -33
  30. package/dist/src/in-operands.js +2 -1
  31. package/dist/src/intra-function-parts.js +10 -13
  32. package/dist/src/inventory.js +2 -21
  33. package/dist/src/json-document.js +4 -0
  34. package/dist/src/keyof-comparisons.js +4 -6
  35. package/dist/src/manifest.js +5 -43
  36. package/dist/src/mdx-entries.js +3 -26
  37. package/dist/src/partial.js +2 -1
  38. package/dist/src/paths.js +26 -15
  39. package/dist/src/position.js +2 -1
  40. package/dist/src/print.js +3 -2
  41. package/dist/src/product.js +13 -0
  42. package/dist/src/references.js +14 -27
  43. package/dist/src/report-schema.js +15 -16
  44. package/dist/src/report.js +22 -31
  45. package/dist/src/reporters/sarif.js +4 -2
  46. package/dist/src/reporters/template.js +4 -19
  47. package/dist/src/resolve.js +11 -20
  48. package/dist/src/roots.js +7 -17
  49. package/dist/src/run.js +8 -7
  50. package/dist/src/schema.js +4 -3
  51. package/dist/src/scope.js +4 -5
  52. package/dist/src/serialization-contract.js +4 -8
  53. package/dist/src/session.js +2 -1
  54. package/dist/src/suppress-file.js +8 -10
  55. package/dist/src/symbol-keys.js +3 -5
  56. package/dist/src/template-field.js +5 -15
  57. package/dist/src/test-globals.js +6 -28
  58. package/dist/src/test-joins.js +6 -6
  59. package/dist/src/text/compare.js +26 -0
  60. package/dist/src/text/glob.js +194 -0
  61. package/dist/src/text/shell.js +159 -0
  62. package/dist/src/{yaml-document.js → text/yaml.js} +38 -0
  63. package/dist/src/type-errors.js +14 -38
  64. package/dist/src/unseen-loads.js +2 -9
  65. package/dist/src/unwrap.js +23 -0
  66. package/dist/src/verbs/analyze.js +15 -13
  67. package/dist/src/verbs/describe.js +4 -4
  68. package/dist/src/verbs/explain.js +5 -3
  69. package/dist/src/verbs/print-projects.js +2 -1
  70. package/dist/src/verbs/print-retained.js +2 -1
  71. package/dist/src/verbs/print-roots.js +2 -1
  72. package/dist/src/verbs/version.js +2 -1
  73. package/dist/src/workflow-steps.js +9 -46
  74. package/dist/src/workspace-manifests.js +2 -2
  75. package/dist/src/workspace-programs.js +5 -3
  76. package/dist/src/workspace-resolution.js +13 -17
  77. package/dist/src/workspace.js +28 -116
  78. package/jsr.json +1 -1
  79. package/package.json +1 -1
  80. package/src/analysis.ts +26 -51
  81. package/src/automatic-types.ts +11 -29
  82. package/src/build-scripts.ts +17 -38
  83. package/src/component-layer.ts +4 -2
  84. package/src/components.ts +2 -4
  85. package/src/config.ts +4 -2
  86. package/src/configuration-files.ts +27 -170
  87. package/src/contract/contract.generated.ts +25 -0
  88. package/src/conventions.ts +26 -74
  89. package/src/dependencies.ts +32 -50
  90. package/src/discover.ts +14 -39
  91. package/src/edges.ts +7 -21
  92. package/src/element-access.ts +4 -7
  93. package/src/entry-point-gaps.ts +3 -9
  94. package/src/entry-points.ts +2 -13
  95. package/src/enum-group.ts +2 -11
  96. package/src/erased-stores.ts +3 -7
  97. package/src/exempt-classes.ts +4 -4
  98. package/src/exempt.ts +5 -27
  99. package/src/file-facts.ts +6 -24
  100. package/src/findings/reads-and-writes.ts +2 -1
  101. package/src/findings/self-check.ts +3 -2
  102. package/src/findings-pass.ts +6 -12
  103. package/src/fs/manifest.ts +52 -0
  104. package/src/fs/tree.ts +110 -0
  105. package/src/git-ignore.ts +38 -25
  106. package/src/html-entries.ts +6 -33
  107. package/src/in-operands.ts +2 -1
  108. package/src/intra-function-parts.ts +10 -14
  109. package/src/inventory.ts +2 -20
  110. package/src/json-document.ts +5 -0
  111. package/src/keyof-comparisons.ts +3 -7
  112. package/src/manifest.ts +5 -46
  113. package/src/mdx-entries.ts +3 -26
  114. package/src/partial.ts +2 -1
  115. package/src/paths.ts +27 -15
  116. package/src/position.ts +2 -1
  117. package/src/print.ts +3 -2
  118. package/src/product.ts +18 -0
  119. package/src/references.ts +14 -29
  120. package/src/report-schema.ts +15 -17
  121. package/src/report.ts +24 -34
  122. package/src/reporters/sarif.ts +4 -4
  123. package/src/reporters/template.ts +4 -20
  124. package/src/resolve.ts +20 -27
  125. package/src/roots.ts +7 -20
  126. package/src/run.ts +8 -13
  127. package/src/schema.ts +4 -3
  128. package/src/scope.ts +4 -10
  129. package/src/serialization-contract.ts +4 -9
  130. package/src/session.ts +2 -1
  131. package/src/suppress-file.ts +8 -11
  132. package/src/symbol-keys.ts +2 -5
  133. package/src/template-field.ts +5 -18
  134. package/src/test-globals.ts +9 -27
  135. package/src/test-joins.ts +6 -8
  136. package/src/text/compare.ts +27 -0
  137. package/src/text/glob.ts +210 -0
  138. package/src/text/shell.ts +161 -0
  139. package/src/{yaml-document.ts → text/yaml.ts} +46 -0
  140. package/src/type-errors.ts +25 -36
  141. package/src/unseen-loads.ts +1 -12
  142. package/src/unwrap.ts +34 -0
  143. package/src/verbs/analyze.ts +22 -21
  144. package/src/verbs/describe.ts +4 -4
  145. package/src/verbs/explain.ts +5 -3
  146. package/src/verbs/print-projects.ts +2 -1
  147. package/src/verbs/print-retained.ts +2 -1
  148. package/src/verbs/print-roots.ts +2 -1
  149. package/src/verbs/version.ts +2 -1
  150. package/src/workflow-steps.ts +9 -44
  151. package/src/workspace-manifests.ts +2 -2
  152. package/src/workspace-programs.ts +5 -3
  153. package/src/workspace-resolution.ts +21 -17
  154. package/src/workspace.ts +35 -121
  155. package/dist/src/glob.js +0 -65
  156. package/dist/src/pnpm-workspace.js +0 -120
  157. package/src/glob.ts +0 -67
  158. package/src/pnpm-workspace.ts +0 -135
package/src/glob.ts DELETED
@@ -1,67 +0,0 @@
1
- /**
2
- * Glob patterns over the paths of the target's own files, as the configuration
3
- * writes them. Both `ts.test_files` and `ts.entry_files` name files this way, and
4
- * one grammar answers for both.
5
- *
6
- * A configured root is not written in this grammar. It names a symbol reference
7
- * rather than a path, `*` there spans the solidus and a brace list means nothing,
8
- * so that rule is written where it is read.
9
- */
10
-
11
- /**
12
- * One literal run of a pattern, with every character the expression syntax claims
13
- * escaped.
14
- *
15
- * The set is the syntax characters and the solidus, and it is closed: an escape of any
16
- * other character is refused outright by the expression syntax under the unicode flag,
17
- * so escaping a hyphen, which needs none outside a character class, would refuse every
18
- * pattern that names a hyphenated path.
19
- */
20
- function quoted(text: string): string {
21
- return text.replaceAll(/[.*+?^${}()|[\]\\/]/gu, (character) => `\\${character}`);
22
- }
23
-
24
- /**
25
- * The expression one glob pattern denotes. `**` spans path separators while `*` and `?`
26
- * do not, a brace list is an alternation of its members, and every other character
27
- * stands for itself.
28
- */
29
- export function globExpression(pattern: string): RegExp {
30
- let source = "^";
31
- let at = 0;
32
- while (at < pattern.length) {
33
- const rest = pattern.slice(at);
34
- if (rest.startsWith("**/")) {
35
- source += "(?:[^/]*/)*";
36
- at += 3;
37
- continue;
38
- }
39
- if (rest.startsWith("**")) {
40
- source += ".*";
41
- at += 2;
42
- continue;
43
- }
44
- const character = pattern[at] ?? "";
45
- at += 1;
46
- if (character === "*") {
47
- source += "[^/]*";
48
- continue;
49
- }
50
- if (character === "?") {
51
- source += "[^/]";
52
- continue;
53
- }
54
- if (character === "{") {
55
- const close = pattern.indexOf("}", at);
56
- if (close < 0) {
57
- source += "\\{";
58
- continue;
59
- }
60
- source += `(?:${pattern.slice(at, close).split(",").map(quoted).join("|")})`;
61
- at = close + 1;
62
- continue;
63
- }
64
- source += quoted(character);
65
- }
66
- return new RegExp(`${source}$`, "u");
67
- }
@@ -1,135 +0,0 @@
1
- /**
2
- * The `packages` list of a `pnpm-workspace.yaml`. The document is read as far as that
3
- * one key needs and no further: a top-level `packages` key holding a block sequence or
4
- * a one-line flow sequence of plain or quoted strings. Any other value of the key is
5
- * refused rather than guessed at, because a list read wrong names the wrong packages.
6
- */
7
-
8
- /** What the document says about `packages`. */
9
- type PnpmPackages =
10
- | { readonly kind: "listed"; readonly patterns: readonly string[] }
11
- /** The document declares no `packages` key. */
12
- | { readonly kind: "absent" }
13
- /** The key holds something this reader does not read, with what it holds. */
14
- | { readonly kind: "refused"; readonly reason: string };
15
-
16
- /** The characters a plain scalar may not start with. */
17
- const INDICATORS = new Set(["[", "]", "{", "}", ",", "&", "*", "!", "|", ">", "%", "@", "`", "#"]);
18
-
19
- /** One line with its comment removed, a `#` inside quotes kept. */
20
- function uncommented(line: string): string {
21
- let quote: string | undefined;
22
- for (let at = 0; at < line.length; at += 1) {
23
- const character = line[at];
24
- if (quote !== undefined) {
25
- if (character === quote) {
26
- quote = undefined;
27
- }
28
- continue;
29
- }
30
- if (character === "'" || character === '"') {
31
- quote = character;
32
- } else if (character === "#" && (at === 0 || /\s/u.test(line[at - 1] ?? ""))) {
33
- return line.slice(0, at).trimEnd();
34
- }
35
- }
36
- return line.trimEnd();
37
- }
38
-
39
- /** One scalar as written, or `undefined` where it is not a string this reader reads. */
40
- function scalarOf(text: string): string | undefined {
41
- const value = text.trim();
42
- if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
43
- const inner = value.slice(1, -1);
44
- return /'(?!')/u.test(inner.replaceAll("''", "")) ? undefined : inner.replaceAll("''", "'");
45
- }
46
- if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
47
- const inner = value.slice(1, -1);
48
- return inner.includes("\\") || inner.includes('"') ? undefined : inner;
49
- }
50
- if (
51
- value === "" ||
52
- INDICATORS.has(value[0] ?? "") ||
53
- value.startsWith("'") ||
54
- value.startsWith('"')
55
- ) {
56
- return undefined;
57
- }
58
- if (value.startsWith("- ") || value.startsWith("? ") || /:(?:\s|$)/u.test(value)) {
59
- return undefined;
60
- }
61
- return value;
62
- }
63
-
64
- /** The entries of a one-line flow sequence, or `undefined` where one does not read. */
65
- function flowOf(text: string): readonly string[] | undefined {
66
- const inner = text.slice(1, -1).trim();
67
- if (inner === "") {
68
- return [];
69
- }
70
- const entries = inner.split(",");
71
- if (entries.length > 1 && entries.at(-1)?.trim() === "") {
72
- entries.pop();
73
- }
74
- const found: string[] = [];
75
- for (const entry of entries) {
76
- const value = scalarOf(entry);
77
- if (value === undefined) {
78
- return undefined;
79
- }
80
- found.push(value);
81
- }
82
- return found;
83
- }
84
-
85
- const KEY = /^(?:packages|'packages'|"packages")\s*:(?:\s(.*))?$/u;
86
-
87
- /** The `packages` list one `pnpm-workspace.yaml` text declares. */
88
- export function pnpmPackages(text: string): PnpmPackages {
89
- const lines = text.split(/\r?\n/u).map(uncommented);
90
- const keys = lines.flatMap((line, at) => (KEY.test(line) ? [at] : []));
91
- const [at] = keys;
92
- if (at === undefined) {
93
- return { kind: "absent" };
94
- }
95
- if (keys.length > 1) {
96
- return { kind: "refused", reason: "the packages key is declared more than once" };
97
- }
98
- const rest = (KEY.exec(lines[at] ?? "")?.[1] ?? "").trim();
99
- if (rest !== "") {
100
- const listed = rest.startsWith("[") && rest.endsWith("]") ? flowOf(rest) : undefined;
101
- return listed === undefined
102
- ? {
103
- kind: "refused",
104
- reason: `packages holds ${JSON.stringify(rest)}, not a sequence of strings`,
105
- }
106
- : { kind: "listed", patterns: listed };
107
- }
108
- const patterns: string[] = [];
109
- for (const line of lines.slice(at + 1)) {
110
- if (line.trim() === "") {
111
- continue;
112
- }
113
- const item = /^(\s*)-(?:\s+(.*))?$/u.exec(line);
114
- if (item === null) {
115
- if (/^\s/u.test(line)) {
116
- return {
117
- kind: "refused",
118
- reason: `packages holds ${JSON.stringify(line.trim())}, not a sequence item`,
119
- };
120
- }
121
- break;
122
- }
123
- const value = scalarOf(item[2] ?? "");
124
- if (value === undefined) {
125
- return {
126
- kind: "refused",
127
- reason: `the packages item ${JSON.stringify(line.trim())} is not a plain or quoted string`,
128
- };
129
- }
130
- patterns.push(value);
131
- }
132
- return patterns.length === 0
133
- ? { kind: "refused", reason: "packages holds no sequence" }
134
- : { kind: "listed", patterns };
135
- }