@cplieger/deadset-ts 8.0.0-dev.12 → 8.0.0-dev.14

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 (73) hide show
  1. package/README.md +2 -0
  2. package/THIRD_PARTY_NOTICES.md +27 -0
  3. package/dist/src/build-scripts.js +6 -13
  4. package/dist/src/commands/read.js +156 -0
  5. package/dist/src/commands/shell.js +75 -0
  6. package/dist/src/commands/tools.js +460 -0
  7. package/dist/src/configuration-files.js +11 -25
  8. package/dist/src/conformance-record.js +1 -1
  9. package/dist/src/dependencies.js +67 -115
  10. package/dist/src/load/synthesize.js +12 -5
  11. package/dist/src/manifest.js +27 -14
  12. package/dist/src/roots.js +18 -11
  13. package/dist/src/text/named-files.js +24 -3
  14. package/dist/src/text/yaml.js +464 -173
  15. package/dist/src/vendor/unbash/ansi-c.js +132 -0
  16. package/dist/src/vendor/unbash/arithmetic-parts.js +37 -0
  17. package/dist/src/vendor/unbash/arithmetic.js +591 -0
  18. package/dist/src/vendor/unbash/assignment.js +131 -0
  19. package/dist/src/vendor/unbash/chars.js +48 -0
  20. package/dist/src/vendor/unbash/command.js +41 -0
  21. package/dist/src/vendor/unbash/expansion.js +80 -0
  22. package/dist/src/vendor/unbash/glob.js +268 -0
  23. package/dist/src/vendor/unbash/heredoc.js +27 -0
  24. package/dist/src/vendor/unbash/internal-types.js +1 -0
  25. package/dist/src/vendor/unbash/lexer.js +4274 -0
  26. package/dist/src/vendor/unbash/limits.js +3 -0
  27. package/dist/src/vendor/unbash/parser.js +1366 -0
  28. package/dist/src/vendor/unbash/parts.js +57 -0
  29. package/dist/src/vendor/unbash/substitution-context.js +8 -0
  30. package/dist/src/vendor/unbash/traversal.js +212 -0
  31. package/dist/src/vendor/unbash/types.js +1 -0
  32. package/dist/src/vendor/unbash/word-value.js +61 -0
  33. package/dist/src/vendor/unbash/word.js +40 -0
  34. package/dist/src/workflow-steps.js +111 -133
  35. package/jsr.json +2 -1
  36. package/package.json +4 -2
  37. package/src/build-scripts.ts +6 -13
  38. package/src/commands/read.ts +230 -0
  39. package/src/commands/shell.ts +126 -0
  40. package/src/commands/tools.ts +618 -0
  41. package/src/configuration-files.ts +10 -26
  42. package/src/conformance-record.ts +1 -1
  43. package/src/dependencies.ts +99 -123
  44. package/src/load/synthesize.ts +18 -5
  45. package/src/manifest.ts +43 -25
  46. package/src/roots.ts +20 -13
  47. package/src/text/named-files.ts +26 -3
  48. package/src/text/yaml.ts +503 -179
  49. package/src/vendor/unbash/LICENSE +15 -0
  50. package/src/vendor/unbash/VENDORED.md +16 -0
  51. package/src/vendor/unbash/ansi-c.ts +132 -0
  52. package/src/vendor/unbash/arithmetic-parts.ts +53 -0
  53. package/src/vendor/unbash/arithmetic.ts +641 -0
  54. package/src/vendor/unbash/assignment.ts +163 -0
  55. package/src/vendor/unbash/chars.ts +48 -0
  56. package/src/vendor/unbash/command.ts +47 -0
  57. package/src/vendor/unbash/expansion.ts +144 -0
  58. package/src/vendor/unbash/glob.ts +284 -0
  59. package/src/vendor/unbash/heredoc.ts +34 -0
  60. package/src/vendor/unbash/internal-types.ts +94 -0
  61. package/src/vendor/unbash/lexer.ts +4352 -0
  62. package/src/vendor/unbash/limits.ts +3 -0
  63. package/src/vendor/unbash/parser.ts +1612 -0
  64. package/src/vendor/unbash/parts.ts +96 -0
  65. package/src/vendor/unbash/substitution-context.ts +20 -0
  66. package/src/vendor/unbash/traversal.ts +182 -0
  67. package/src/vendor/unbash/types.ts +660 -0
  68. package/src/vendor/unbash/word-value.ts +64 -0
  69. package/src/vendor/unbash/word.ts +50 -0
  70. package/src/workflow-steps.ts +153 -154
  71. package/dist/src/text/shell.js +0 -159
  72. package/src/text/named-files.inputs.json +0 -1522
  73. package/src/text/shell.ts +0 -161
@@ -0,0 +1,96 @@
1
+ // Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c14992a43dc06ce29c9f51858abd4a87851ea). DO NOT EDIT.
2
+ // @ts-nocheck
3
+ import type { Word, WordPart } from "./internal-types.ts";
4
+ import { hasEmbeddedWordStructure, Lexer } from "./lexer.ts";
5
+ import type { PartsResolver } from "./word.ts";
6
+ import { createSubstitutionContext, type SubstitutionContext } from "./substitution-context.ts";
7
+ import { hasGlobCharacters, parseGlobParts } from "./glob.ts";
8
+
9
+ export const computeBareWordParts: PartsResolver = (_source, word) =>
10
+ hasGlobCharacters(word.text) ? parseGlobParts(word.text, 0, word.text.length, undefined, word.pos) : undefined;
11
+
12
+ export function wordPartsResolver(context: SubstitutionContext): PartsResolver {
13
+ return (
14
+ context.wordParts ?? (context.wordParts = (source, word, depth) => computeWordParts(source, word, depth, context))
15
+ );
16
+ }
17
+
18
+ export function embeddedPartsResolver(context: SubstitutionContext): PartsResolver {
19
+ return (
20
+ context.embeddedParts ??
21
+ (context.embeddedParts = (source, word, depth) => computeEmbeddedWordParts(source, word, depth, context))
22
+ );
23
+ }
24
+
25
+ export function arrayPartsResolver(context: SubstitutionContext): PartsResolver {
26
+ return (
27
+ context.arrayParts ??
28
+ (context.arrayParts = (source, word, depth) => computeArrayElementParts(source, word, depth, context))
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Compute the structural parts of a word by re-scanning the source.
34
+ * This is the "cold path" — only called when consumers actually need parts.
35
+ *
36
+ * Returns undefined for simple words (no quotes, expansions, or special structure).
37
+ */
38
+ export function computeWordParts(
39
+ source: string,
40
+ word: Pick<Word, "pos" | "end">,
41
+ depth = 0,
42
+ context: SubstitutionContext = createSubstitutionContext(),
43
+ ): WordPart[] | undefined {
44
+ // Bound the re-lex to the word's span. A word inside a substitution script carries the
45
+ // whole original as its source, so an unbounded scan would overrun the word into an
46
+ // adjacent delimiter (e.g. a backtick or `)` immediately after it). For top-level words
47
+ // word.end is the natural boundary, so the bound is a no-op.
48
+ const lexer = new Lexer(source, word.pos, word.end, false, context);
49
+ lexer._nestingDepth = depth;
50
+ const parts = lexer.buildWordParts(word.pos);
51
+ return parts ?? undefined;
52
+ }
53
+
54
+ /** Compute structural parts for a word-like span that may contain shell operators or whitespace. */
55
+ export function computeEmbeddedWordParts(
56
+ source: string,
57
+ word: Pick<Word, "pos" | "end">,
58
+ depth = 0,
59
+ context: SubstitutionContext,
60
+ arithmetic = false,
61
+ ): WordPart[] | undefined {
62
+ if (!hasEmbeddedWordStructure(source, word.pos, word.end)) return undefined;
63
+ const lexer = new Lexer(source, word.pos, word.end, false, context);
64
+ lexer._nestingDepth = depth;
65
+ const parts = lexer.buildEmbeddedWordParts(word.pos, arithmetic);
66
+ return parts ?? undefined;
67
+ }
68
+
69
+ export function computeArrayElementParts(
70
+ source: string,
71
+ word: Word,
72
+ depth = 0,
73
+ context: SubstitutionContext,
74
+ ): WordPart[] | undefined {
75
+ const lexer = new Lexer(source, word.pos, word.end, false, context);
76
+ lexer._nestingDepth = depth;
77
+ const parts = lexer.buildArrayElementParts(word.pos);
78
+ return parts ?? undefined;
79
+ }
80
+
81
+ /**
82
+ * Compute parts for an unquoted heredoc body.
83
+ * Heredoc bodies use different scanning rules than shell words: newlines are
84
+ * literal and single/double quotes have no special meaning.
85
+ */
86
+ export function computeHereDocBodyParts(
87
+ source: string,
88
+ word: Pick<Word, "pos" | "end">,
89
+ depth = 0,
90
+ context: SubstitutionContext,
91
+ ): WordPart[] | undefined {
92
+ const lexer = new Lexer(source, word.pos, word.end, false, context);
93
+ lexer._nestingDepth = depth;
94
+ const parts = lexer.buildHereDocParts(word.pos, word.end);
95
+ return parts ?? undefined;
96
+ }
@@ -0,0 +1,20 @@
1
+ // Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c14992a43dc06ce29c9f51858abd4a87851ea). DO NOT EDIT.
2
+ // @ts-nocheck
3
+ import type { PartsResolver } from "./word.ts";
4
+
5
+ export interface SubstitutionContext {
6
+ boundaries: Map<number, number> | undefined;
7
+ wordParts: PartsResolver | undefined;
8
+ embeddedParts: PartsResolver | undefined;
9
+ arrayParts: PartsResolver | undefined;
10
+ }
11
+
12
+ // A nested script shares its parent's boundary cache, allocated on first use.
13
+ export function createSubstitutionContext(parent?: SubstitutionContext): SubstitutionContext {
14
+ const boundaries = parent === undefined ? undefined : substitutionBoundaries(parent);
15
+ return { boundaries, wordParts: undefined, embeddedParts: undefined, arrayParts: undefined };
16
+ }
17
+
18
+ export function substitutionBoundaries(context: SubstitutionContext): Map<number, number> {
19
+ return context.boundaries ?? (context.boundaries = new Map());
20
+ }
@@ -0,0 +1,182 @@
1
+ // Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c14992a43dc06ce29c9f51858abd4a87851ea). DO NOT EDIT.
2
+ // @ts-nocheck
3
+ import type { SyntaxNode } from "./types.ts";
4
+
5
+ export function forEachChild(node: SyntaxNode, callback: (child: SyntaxNode) => void): void {
6
+ switch (node.type) {
7
+ case "Script":
8
+ case "CompoundList":
9
+ case "AndOr":
10
+ for (const command of node.commands) callback(command);
11
+ return;
12
+ case "Statement":
13
+ callback(node.command);
14
+ return;
15
+ case "Command":
16
+ for (const child of node.prefix) callback(child);
17
+ if (node.name) callback(node.name);
18
+ for (const child of node.suffix) callback(child);
19
+ return;
20
+ case "Pipeline":
21
+ for (const prefix of node.prefixes) callback(prefix);
22
+ for (const command of node.commands) callback(command);
23
+ return;
24
+ case "Redirected":
25
+ callback(node.command);
26
+ for (const redirect of node.redirects) callback(redirect);
27
+ return;
28
+ case "If":
29
+ callback(node.clause);
30
+ callback(node.then);
31
+ for (const branch of node.elif) callback(branch);
32
+ if (node.else) callback(node.else);
33
+ return;
34
+ case "Elif":
35
+ callback(node.clause);
36
+ callback(node.then);
37
+ return;
38
+ case "For":
39
+ case "Select":
40
+ callback(node.name);
41
+ if (node.wordlist) for (const word of node.wordlist) callback(word);
42
+ callback(node.body);
43
+ return;
44
+ case "While":
45
+ callback(node.clause);
46
+ callback(node.body);
47
+ return;
48
+ case "Function":
49
+ case "Coproc":
50
+ if (node.name) callback(node.name);
51
+ callback(node.body);
52
+ return;
53
+ case "Subshell":
54
+ case "BraceGroup":
55
+ callback(node.body);
56
+ return;
57
+ case "Case":
58
+ callback(node.word);
59
+ for (const item of node.items) callback(item);
60
+ return;
61
+ case "CaseItem":
62
+ for (const pattern of node.pattern) callback(pattern);
63
+ callback(node.body);
64
+ return;
65
+ case "ArithmeticFor": {
66
+ const initialize = node.initialize;
67
+ if (initialize) callback(initialize);
68
+ const test = node.test;
69
+ if (test) callback(test);
70
+ const update = node.update;
71
+ if (update) callback(update);
72
+ callback(node.body);
73
+ return;
74
+ }
75
+ case "Word":
76
+ case "Glob":
77
+ case "ArithmeticWord":
78
+ case "HereDocBody":
79
+ case "BraceExpansion":
80
+ case "ExtendedGlob": {
81
+ const parts = node.parts;
82
+ if (parts) for (const part of parts) callback(part);
83
+ return;
84
+ }
85
+ case "DoubleQuoted":
86
+ case "LocaleString":
87
+ for (const part of node.parts) callback(part);
88
+ return;
89
+ case "ParameterExpansion":
90
+ if (node.index) callback(node.index);
91
+ if (node.operation) callback(node.operation);
92
+ return;
93
+ case "Default":
94
+ case "Remove":
95
+ case "Transform":
96
+ callback(node.operand);
97
+ return;
98
+ case "CaseModification":
99
+ if (node.operand) callback(node.operand);
100
+ return;
101
+ case "Replace":
102
+ callback(node.pattern);
103
+ callback(node.replacement);
104
+ return;
105
+ case "Slice":
106
+ callback(node.offset);
107
+ if (node.length) callback(node.length);
108
+ return;
109
+ case "Assignment": {
110
+ const index = node.index;
111
+ if (index) callback(index);
112
+ callback(node.value);
113
+ return;
114
+ }
115
+ case "ArrayValue":
116
+ for (const element of node.elements) callback(element);
117
+ return;
118
+ case "Redirect":
119
+ case "HereString":
120
+ if (node.descriptor) callback(node.descriptor);
121
+ if (node.target) callback(node.target);
122
+ return;
123
+ case "HereDoc":
124
+ if (node.descriptor) callback(node.descriptor);
125
+ if (node.delimiter) callback(node.delimiter);
126
+ callback(node.body);
127
+ return;
128
+ case "CommandExpansion":
129
+ case "ProcessSubstitution":
130
+ case "ArithmeticCommandExpansion": {
131
+ const script = node.script;
132
+ if (script) callback(script);
133
+ return;
134
+ }
135
+ case "ArithmeticExpansion":
136
+ case "ArithmeticCommand":
137
+ case "ArithmeticGroup":
138
+ case "TestCommand":
139
+ case "TestGroup": {
140
+ const expression = node.expression;
141
+ if (expression) callback(expression);
142
+ return;
143
+ }
144
+ case "ArithmeticBinary":
145
+ case "TestBinary":
146
+ callback(node.left);
147
+ callback(node.right);
148
+ return;
149
+ case "ArithmeticUnary":
150
+ case "TestUnary":
151
+ callback(node.operand);
152
+ return;
153
+ case "ArithmeticTernary":
154
+ callback(node.test);
155
+ callback(node.consequent);
156
+ callback(node.alternate);
157
+ return;
158
+ case "TestLogical":
159
+ for (const operand of node.operands) callback(operand);
160
+ return;
161
+ case "TestNot":
162
+ for (const negation of node.negations) callback(negation);
163
+ callback(node.operand);
164
+ return;
165
+ case "Literal":
166
+ case "SingleQuoted":
167
+ case "AnsiCQuoted":
168
+ case "SimpleExpansion":
169
+ case "Names":
170
+ case "Unknown":
171
+ case "FileDescriptor":
172
+ case "FileDescriptorVariable":
173
+ case "HereDocDelimiter":
174
+ case "Time":
175
+ case "Negation":
176
+ return;
177
+ default: {
178
+ const exhaustive: never = node;
179
+ throw new TypeError(`Unexpected syntax node: ${exhaustive}`);
180
+ }
181
+ }
182
+ }