@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.
- package/README.md +2 -0
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/src/build-scripts.js +6 -13
- package/dist/src/commands/read.js +156 -0
- package/dist/src/commands/shell.js +75 -0
- package/dist/src/commands/tools.js +460 -0
- package/dist/src/configuration-files.js +11 -25
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/dependencies.js +67 -115
- package/dist/src/load/synthesize.js +12 -5
- package/dist/src/manifest.js +27 -14
- package/dist/src/roots.js +18 -11
- package/dist/src/text/named-files.js +24 -3
- package/dist/src/text/yaml.js +464 -173
- package/dist/src/vendor/unbash/ansi-c.js +132 -0
- package/dist/src/vendor/unbash/arithmetic-parts.js +37 -0
- package/dist/src/vendor/unbash/arithmetic.js +591 -0
- package/dist/src/vendor/unbash/assignment.js +131 -0
- package/dist/src/vendor/unbash/chars.js +48 -0
- package/dist/src/vendor/unbash/command.js +41 -0
- package/dist/src/vendor/unbash/expansion.js +80 -0
- package/dist/src/vendor/unbash/glob.js +268 -0
- package/dist/src/vendor/unbash/heredoc.js +27 -0
- package/dist/src/vendor/unbash/internal-types.js +1 -0
- package/dist/src/vendor/unbash/lexer.js +4274 -0
- package/dist/src/vendor/unbash/limits.js +3 -0
- package/dist/src/vendor/unbash/parser.js +1366 -0
- package/dist/src/vendor/unbash/parts.js +57 -0
- package/dist/src/vendor/unbash/substitution-context.js +8 -0
- package/dist/src/vendor/unbash/traversal.js +212 -0
- package/dist/src/vendor/unbash/types.js +1 -0
- package/dist/src/vendor/unbash/word-value.js +61 -0
- package/dist/src/vendor/unbash/word.js +40 -0
- package/dist/src/workflow-steps.js +111 -133
- package/jsr.json +2 -1
- package/package.json +4 -2
- package/src/build-scripts.ts +6 -13
- package/src/commands/read.ts +230 -0
- package/src/commands/shell.ts +126 -0
- package/src/commands/tools.ts +618 -0
- package/src/configuration-files.ts +10 -26
- package/src/conformance-record.ts +1 -1
- package/src/dependencies.ts +99 -123
- package/src/load/synthesize.ts +18 -5
- package/src/manifest.ts +43 -25
- package/src/roots.ts +20 -13
- package/src/text/named-files.ts +26 -3
- package/src/text/yaml.ts +503 -179
- package/src/vendor/unbash/LICENSE +15 -0
- package/src/vendor/unbash/VENDORED.md +16 -0
- package/src/vendor/unbash/ansi-c.ts +132 -0
- package/src/vendor/unbash/arithmetic-parts.ts +53 -0
- package/src/vendor/unbash/arithmetic.ts +641 -0
- package/src/vendor/unbash/assignment.ts +163 -0
- package/src/vendor/unbash/chars.ts +48 -0
- package/src/vendor/unbash/command.ts +47 -0
- package/src/vendor/unbash/expansion.ts +144 -0
- package/src/vendor/unbash/glob.ts +284 -0
- package/src/vendor/unbash/heredoc.ts +34 -0
- package/src/vendor/unbash/internal-types.ts +94 -0
- package/src/vendor/unbash/lexer.ts +4352 -0
- package/src/vendor/unbash/limits.ts +3 -0
- package/src/vendor/unbash/parser.ts +1612 -0
- package/src/vendor/unbash/parts.ts +96 -0
- package/src/vendor/unbash/substitution-context.ts +20 -0
- package/src/vendor/unbash/traversal.ts +182 -0
- package/src/vendor/unbash/types.ts +660 -0
- package/src/vendor/unbash/word-value.ts +64 -0
- package/src/vendor/unbash/word.ts +50 -0
- package/src/workflow-steps.ts +153 -154
- package/dist/src/text/shell.js +0 -159
- package/src/text/named-files.inputs.json +0 -1522
- package/src/text/shell.ts +0 -161
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Lars Kappert
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# unbash, vendored
|
|
2
|
+
|
|
3
|
+
- Upstream: <https://github.com/webpro-nl/unbash>
|
|
4
|
+
- Release: 6.0.0, commit `968c14992a43dc06ce29c9f51858abd4a87851ea`
|
|
5
|
+
- License: ISC, in `LICENSE` beside this file
|
|
6
|
+
|
|
7
|
+
`scripts/vendor-unbash.ts` writes this directory from a checkout of that commit: `npm run vendor -- <checkout>`. It copies `src/parser.ts` and every file it reaches through relative imports, which is every file of upstream's `src/` except `printer.ts`, and upstream's `LICENSE`.
|
|
8
|
+
|
|
9
|
+
## Edits
|
|
10
|
+
|
|
11
|
+
Each copied file is upstream's text with two lines put before it, and nothing else changed:
|
|
12
|
+
|
|
13
|
+
1. `// Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c149…). DO NOT EDIT.`, so the dead-code self-check retains the copy as generated code.
|
|
14
|
+
2. `// @ts-nocheck`, because upstream compiles under its own strict settings, which do not enable `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes` or `noPropertyAccessFromIndexSignature`; under this repository's settings 96 of upstream's lines fail them.
|
|
15
|
+
|
|
16
|
+
The directory is left out of ESLint (`eslint.config.mjs`), of Prettier (`.prettierignore`, which leaves out the generated contract modules too) and of the mutation targets (`stryker.config.json`, which leaves out the generated `src/conformance-record.ts` too). The repository measures no coverage, so nothing is left out of it.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c14992a43dc06ce29c9f51858abd4a87851ea). DO NOT EDIT.
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
function isOctal(code: number): boolean {
|
|
4
|
+
return code >= 48 && code <= 55;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isHex(code: number): boolean {
|
|
8
|
+
return (code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function codePoint(value: number, fallback: string): string {
|
|
12
|
+
try {
|
|
13
|
+
return String.fromCodePoint(value);
|
|
14
|
+
} catch {
|
|
15
|
+
return fallback;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function decodeAnsiCQuoted(source: string, start: number, limit: number) {
|
|
20
|
+
let pos = start;
|
|
21
|
+
let value = "";
|
|
22
|
+
|
|
23
|
+
while (pos < limit && source.charCodeAt(pos) !== 39) {
|
|
24
|
+
if (source.charCodeAt(pos) !== 92 || pos + 1 >= limit) {
|
|
25
|
+
const runStart = pos;
|
|
26
|
+
while (pos < limit) {
|
|
27
|
+
const code = source.charCodeAt(pos);
|
|
28
|
+
// A backslash at the end of input has nothing to escape; consume it as a
|
|
29
|
+
// literal so the loop always advances.
|
|
30
|
+
if (code === 39 || (code === 92 && pos + 1 < limit)) break;
|
|
31
|
+
pos++;
|
|
32
|
+
}
|
|
33
|
+
value += source.slice(runStart, pos);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const escapeStart = pos++;
|
|
38
|
+
const escaped = source[pos++];
|
|
39
|
+
switch (escaped) {
|
|
40
|
+
case "a":
|
|
41
|
+
value += "\x07";
|
|
42
|
+
break;
|
|
43
|
+
case "b":
|
|
44
|
+
value += "\b";
|
|
45
|
+
break;
|
|
46
|
+
case "e":
|
|
47
|
+
case "E":
|
|
48
|
+
value += "\x1B";
|
|
49
|
+
break;
|
|
50
|
+
case "f":
|
|
51
|
+
value += "\f";
|
|
52
|
+
break;
|
|
53
|
+
case "n":
|
|
54
|
+
value += "\n";
|
|
55
|
+
break;
|
|
56
|
+
case "r":
|
|
57
|
+
value += "\r";
|
|
58
|
+
break;
|
|
59
|
+
case "t":
|
|
60
|
+
value += "\t";
|
|
61
|
+
break;
|
|
62
|
+
case "v":
|
|
63
|
+
value += "\v";
|
|
64
|
+
break;
|
|
65
|
+
case "\\":
|
|
66
|
+
value += "\\";
|
|
67
|
+
break;
|
|
68
|
+
case "'":
|
|
69
|
+
value += "'";
|
|
70
|
+
break;
|
|
71
|
+
case '"':
|
|
72
|
+
value += '"';
|
|
73
|
+
break;
|
|
74
|
+
case "?":
|
|
75
|
+
value += "?";
|
|
76
|
+
break;
|
|
77
|
+
case "\n":
|
|
78
|
+
break;
|
|
79
|
+
case "c": {
|
|
80
|
+
// The closing quote (or end of input) is not an operand: \c stays literal.
|
|
81
|
+
const code = pos < limit ? source.charCodeAt(pos) : 39;
|
|
82
|
+
if (code === 39) {
|
|
83
|
+
value += source.slice(escapeStart, pos);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
pos++;
|
|
87
|
+
if (code === 92) {
|
|
88
|
+
// Bash writes a backslash operand as the pair \c\\; a lone backslash
|
|
89
|
+
// still decodes and leaves the character it escaped as a literal.
|
|
90
|
+
const pair = pos < limit && source.charCodeAt(pos) === 92;
|
|
91
|
+
if (pair) pos++;
|
|
92
|
+
value += "\x1c";
|
|
93
|
+
if (!pair && pos < limit) {
|
|
94
|
+
value += source[pos];
|
|
95
|
+
pos++;
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
value += String.fromCharCode(code === 63 ? 127 : code & 31);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case "x":
|
|
103
|
+
case "u":
|
|
104
|
+
case "U": {
|
|
105
|
+
const digitsStart = pos;
|
|
106
|
+
const maxDigits = escaped === "x" ? 2 : escaped === "u" ? 4 : 8;
|
|
107
|
+
while (pos < limit && pos - digitsStart < maxDigits && isHex(source.charCodeAt(pos))) pos++;
|
|
108
|
+
if (pos === digitsStart) {
|
|
109
|
+
value += `\\${escaped}`;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
const raw = source.slice(escapeStart, pos);
|
|
113
|
+
value += codePoint(Number.parseInt(source.slice(digitsStart, pos), 16), raw);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
default: {
|
|
117
|
+
const escapedCode = escaped.charCodeAt(0);
|
|
118
|
+
if (!isOctal(escapedCode)) {
|
|
119
|
+
value += `\\${escaped}`;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
while (pos < limit && pos - escapeStart - 1 < 3 && isOctal(source.charCodeAt(pos))) pos++;
|
|
123
|
+
value += String.fromCharCode(Number.parseInt(source.slice(escapeStart + 1, pos), 8) & 0xff);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const closed = pos < limit;
|
|
130
|
+
if (closed) pos++;
|
|
131
|
+
return { value, end: pos, closed };
|
|
132
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Code generated by scripts/vendor-unbash.ts from unbash 6.0.0 (968c14992a43dc06ce29c9f51858abd4a87851ea). DO NOT EDIT.
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { parseArithmeticExpression } from "./arithmetic.ts";
|
|
4
|
+
import { hasEmbeddedWordStructure, Lexer } from "./lexer.ts";
|
|
5
|
+
import { computeEmbeddedWordParts } from "./parts.ts";
|
|
6
|
+
import { ScriptExpansionImpl } from "./expansion.ts";
|
|
7
|
+
import { MAX_SYNTAX_NESTING } from "./limits.ts";
|
|
8
|
+
import type { ArithmeticExpression, ArithmeticWord } from "./internal-types.ts";
|
|
9
|
+
import type { SubstitutionContext } from "./substitution-context.ts";
|
|
10
|
+
|
|
11
|
+
export function parseArithmeticWithParts(
|
|
12
|
+
body: string,
|
|
13
|
+
offset: number,
|
|
14
|
+
source: string,
|
|
15
|
+
depth: number,
|
|
16
|
+
context: SubstitutionContext,
|
|
17
|
+
embeddedDepth = depth,
|
|
18
|
+
): ArithmeticExpression | undefined {
|
|
19
|
+
if (!hasEmbeddedWordStructure(source, offset, offset + body.length)) {
|
|
20
|
+
return parseArithmeticExpression(body, offset, undefined, depth) ?? undefined;
|
|
21
|
+
}
|
|
22
|
+
const embeddedWords: ArithmeticWord[] = [];
|
|
23
|
+
const lexer = new Lexer(source, 0, source.length, false, context);
|
|
24
|
+
lexer._nestingDepth = depth;
|
|
25
|
+
const expression =
|
|
26
|
+
parseArithmeticExpression(
|
|
27
|
+
body,
|
|
28
|
+
offset,
|
|
29
|
+
{
|
|
30
|
+
embeddedWords,
|
|
31
|
+
commandExpansion: (pos, end, text) =>
|
|
32
|
+
new ScriptExpansionImpl("ArithmeticCommandExpansion", pos, end, text, {
|
|
33
|
+
source,
|
|
34
|
+
start: pos + 2,
|
|
35
|
+
end: end - 1,
|
|
36
|
+
depth: depth + 1,
|
|
37
|
+
parenBoundary: true,
|
|
38
|
+
context,
|
|
39
|
+
}),
|
|
40
|
+
findClosingBracket: (start, end) => lexer.findClosingBracket(start, end),
|
|
41
|
+
findClosingBrace: (start, end) => lexer.findClosingBrace(start, end),
|
|
42
|
+
findClosingParenthesis: (start, end) => lexer.findClosingParenthesis(start, end),
|
|
43
|
+
findArithmeticExpansionEnd: (start, end) => lexer.findArithmeticExpansionEnd(start, end),
|
|
44
|
+
findArithmeticWordEnd: (start, end) => lexer.findArithmeticWordEnd(start, end),
|
|
45
|
+
},
|
|
46
|
+
depth,
|
|
47
|
+
) ?? undefined;
|
|
48
|
+
// Past the nesting budget an embedded word keeps its text without parts.
|
|
49
|
+
if (embeddedDepth <= MAX_SYNTAX_NESTING) {
|
|
50
|
+
for (const node of embeddedWords) node.parts = computeEmbeddedWordParts(source, node, embeddedDepth, context, true);
|
|
51
|
+
}
|
|
52
|
+
return expression;
|
|
53
|
+
}
|