spec-controller 0.1.80 → 0.1.81
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/cli.js +43 -15
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -12934,31 +12934,54 @@ function nextToken(text, at, word) {
|
|
|
12934
12934
|
}
|
|
12935
12935
|
return plain(text, at);
|
|
12936
12936
|
}
|
|
12937
|
-
function
|
|
12938
|
-
const
|
|
12937
|
+
function pastBody(text, from, { delimiter, tabs }) {
|
|
12938
|
+
const lines = text.slice(from).split("\n");
|
|
12939
|
+
const last = lines.findIndex((line) => (tabs ? line.replace(/^\t*/, "") : line) === delimiter);
|
|
12940
|
+
return last === -1 ? text.length : from + lines.slice(0, last + 1).join("\n").length;
|
|
12941
|
+
}
|
|
12942
|
+
function commandList() {
|
|
12939
12943
|
const commands = [];
|
|
12944
|
+
const opens = [];
|
|
12945
|
+
let closed;
|
|
12946
|
+
const read = (token, char) => {
|
|
12947
|
+
if (token.kind === "break")
|
|
12948
|
+
return;
|
|
12949
|
+
if (token.kind === "separator" && token.pipe && closed !== void 0) {
|
|
12950
|
+
commands.splice(closed, Infinity, ...commands.slice(closed).map((command) => ({ ...command, piped: true })));
|
|
12951
|
+
}
|
|
12952
|
+
if (char === "(")
|
|
12953
|
+
opens.push(commands.length);
|
|
12954
|
+
closed = char === ")" ? opens.pop() : void 0;
|
|
12955
|
+
};
|
|
12956
|
+
return { commands, push: (command) => commands.push(command), read };
|
|
12957
|
+
}
|
|
12958
|
+
function simpleCommands(text) {
|
|
12959
|
+
const source = text.replace(JOINED_LINE, (joined, pairs) => pairs.padEnd(joined.length));
|
|
12960
|
+
const { commands, push, read } = commandList();
|
|
12961
|
+
const bodies = [];
|
|
12940
12962
|
let words = [];
|
|
12941
12963
|
let word;
|
|
12942
12964
|
let quoted = false;
|
|
12943
|
-
let target
|
|
12965
|
+
let target;
|
|
12944
12966
|
const endWord = () => {
|
|
12945
12967
|
if (word !== void 0) {
|
|
12946
|
-
if (
|
|
12968
|
+
if (target === void 0)
|
|
12947
12969
|
words.push(word);
|
|
12948
|
-
target
|
|
12970
|
+
else if (target.kind === "heredoc")
|
|
12971
|
+
bodies.push({ delimiter: word, tabs: target.tabs, quoted });
|
|
12972
|
+
target = void 0;
|
|
12949
12973
|
}
|
|
12950
12974
|
word = void 0;
|
|
12951
12975
|
quoted = false;
|
|
12952
12976
|
};
|
|
12953
12977
|
const endCommand = (piped) => {
|
|
12954
12978
|
endWord();
|
|
12955
|
-
target =
|
|
12979
|
+
target = void 0;
|
|
12956
12980
|
if (words.length > 0)
|
|
12957
|
-
|
|
12981
|
+
push({ words, piped });
|
|
12958
12982
|
words = [];
|
|
12959
12983
|
};
|
|
12960
|
-
let at = 0;
|
|
12961
|
-
while (at < source.length) {
|
|
12984
|
+
for (let at = 0; at < source.length; ) {
|
|
12962
12985
|
const token = nextToken(source, at, word);
|
|
12963
12986
|
if (token.kind === "part") {
|
|
12964
12987
|
word = (word ?? "") + token.value;
|
|
@@ -12966,12 +12989,14 @@ function simpleCommands(text) {
|
|
|
12966
12989
|
} else if (token.kind === "separator")
|
|
12967
12990
|
endCommand(token.pipe);
|
|
12968
12991
|
else {
|
|
12969
|
-
if (token.kind
|
|
12992
|
+
if (token.kind !== "break" && !quoted && FILE_DESCRIPTOR.test(word ?? ""))
|
|
12970
12993
|
word = void 0;
|
|
12971
12994
|
endWord();
|
|
12972
|
-
|
|
12995
|
+
if (token.kind !== "break")
|
|
12996
|
+
target = token;
|
|
12973
12997
|
}
|
|
12974
|
-
|
|
12998
|
+
read(token, source.charAt(at));
|
|
12999
|
+
at = source[at] === "\n" ? bodies.splice(0).reduce((from, body) => pastBody(body.quoted ? text : source, from, body), token.end) : token.end;
|
|
12975
13000
|
}
|
|
12976
13001
|
endCommand(false);
|
|
12977
13002
|
return commands;
|
|
@@ -13132,9 +13157,9 @@ var init_commandRuns = __esm({
|
|
|
13132
13157
|
return words.some((_, at) => opensAt(words, invocation, at));
|
|
13133
13158
|
};
|
|
13134
13159
|
pastAssignments = (words) => words.slice(words.findIndex((word) => !ASSIGNMENT.test(word)));
|
|
13135
|
-
JOINED_LINE =
|
|
13160
|
+
JOINED_LINE = /(?<!\\)((?:\\\\)*)\\\r?\n/g;
|
|
13136
13161
|
SEPARATORS = "&|;()\n";
|
|
13137
|
-
REDIRECTION =
|
|
13162
|
+
REDIRECTION = /<<<|<<-?|&>|[<>]&|>>|[<>]/y;
|
|
13138
13163
|
FILE_DESCRIPTOR = /^\d+$/;
|
|
13139
13164
|
PLAIN = /[^\s&|;()<>'"\\`$]+/y;
|
|
13140
13165
|
ESCAPED_IN_DOUBLE_QUOTES = '"\\$`';
|
|
@@ -13172,7 +13197,10 @@ var init_commandRuns = __esm({
|
|
|
13172
13197
|
redirection = (text, at) => {
|
|
13173
13198
|
REDIRECTION.lastIndex = at;
|
|
13174
13199
|
const operator = REDIRECTION.exec(text)?.[0];
|
|
13175
|
-
|
|
13200
|
+
if (operator === void 0)
|
|
13201
|
+
return void 0;
|
|
13202
|
+
const end = at + operator.length;
|
|
13203
|
+
return operator === "<<" || operator === "<<-" ? { kind: "heredoc", tabs: operator === "<<-", end } : { kind: "redirection", end };
|
|
13176
13204
|
};
|
|
13177
13205
|
separator = (text, at) => {
|
|
13178
13206
|
const char = text.charAt(at);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-controller",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reconciliation",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"esbuild": "0.28.1",
|
|
26
26
|
"fast-xml-parser": "^5.11.2",
|
|
27
27
|
"yaml": "^2.9.0",
|
|
28
|
-
"@3f-consulting/spec-controller-core": "0.1.
|
|
28
|
+
"@3f-consulting/spec-controller-core": "0.1.81"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|