spec-controller 0.1.81 → 0.1.83
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 +70 -23
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -12872,24 +12872,29 @@ function pastQuote(text, from, quote) {
|
|
|
12872
12872
|
const end = text.indexOf(quote, from);
|
|
12873
12873
|
return end === -1 ? text.length : end + 1;
|
|
12874
12874
|
}
|
|
12875
|
-
function
|
|
12875
|
+
function pastQuoted(text, at) {
|
|
12876
|
+
const char = text.charAt(at);
|
|
12877
|
+
if (char === "\\")
|
|
12878
|
+
return at + 2;
|
|
12879
|
+
if (char === "'" || char === "`")
|
|
12880
|
+
return pastQuote(text, at + 1, char);
|
|
12881
|
+
return char === '"' ? doubleQuoted(text, at + 1)[1] : void 0;
|
|
12882
|
+
}
|
|
12883
|
+
function pastBalanced(text, from, open, close, commands = false) {
|
|
12876
12884
|
let depth = 1;
|
|
12877
12885
|
let at = from;
|
|
12886
|
+
const bodies = [];
|
|
12887
|
+
const pastPart = commands ? pastCommandPart : pastNoCommand;
|
|
12878
12888
|
while (at < text.length && depth > 0) {
|
|
12879
12889
|
const char = text[at];
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
else if (char === "'" || char === "`")
|
|
12883
|
-
at = pastQuote(text, at + 1, char);
|
|
12884
|
-
else if (char === '"')
|
|
12885
|
-
at = doubleQuoted(text, at + 1)[1];
|
|
12886
|
-
else {
|
|
12890
|
+
const skipped = pastPart(text, at, bodies) ?? pastQuoted(text, at);
|
|
12891
|
+
if (skipped === void 0) {
|
|
12887
12892
|
if (char === open)
|
|
12888
12893
|
depth += 1;
|
|
12889
12894
|
if (char === close)
|
|
12890
12895
|
depth -= 1;
|
|
12891
|
-
at += 1;
|
|
12892
12896
|
}
|
|
12897
|
+
at = skipped ?? at + 1;
|
|
12893
12898
|
}
|
|
12894
12899
|
return Math.min(at, text.length);
|
|
12895
12900
|
}
|
|
@@ -12900,7 +12905,8 @@ function expansionEnd(text, at, openers) {
|
|
|
12900
12905
|
if (opener === void 0)
|
|
12901
12906
|
return void 0;
|
|
12902
12907
|
const open = opener.slice(-1);
|
|
12903
|
-
|
|
12908
|
+
const commands = open === "(" && !text.startsWith("$((", at);
|
|
12909
|
+
return pastBalanced(text, at + opener.length, open, open === "{" ? "}" : ")", commands);
|
|
12904
12910
|
}
|
|
12905
12911
|
function doubleQuotedPart(text, at) {
|
|
12906
12912
|
const char = text.charAt(at);
|
|
@@ -12934,10 +12940,42 @@ function nextToken(text, at, word) {
|
|
|
12934
12940
|
}
|
|
12935
12941
|
return plain(text, at);
|
|
12936
12942
|
}
|
|
12937
|
-
function pastBody(text, from, { delimiter, tabs }) {
|
|
12938
|
-
|
|
12939
|
-
const
|
|
12940
|
-
|
|
12943
|
+
function pastBody(text, from, { delimiter, tabs }, inSubstitution = false) {
|
|
12944
|
+
let start = from;
|
|
12945
|
+
for (const line of text.slice(from).split("\n")) {
|
|
12946
|
+
const stripped = tabs ? line.replace(/^\t*/, "") : line;
|
|
12947
|
+
if (stripped === delimiter)
|
|
12948
|
+
return start + line.length;
|
|
12949
|
+
if (inSubstitution && stripped.startsWith(delimiter) && stripped.includes(")", delimiter.length)) {
|
|
12950
|
+
return start + line.length - stripped.length + delimiter.length;
|
|
12951
|
+
}
|
|
12952
|
+
start += line.length + 1;
|
|
12953
|
+
}
|
|
12954
|
+
return text.length;
|
|
12955
|
+
}
|
|
12956
|
+
function delimiterWord(text, from) {
|
|
12957
|
+
let at = from;
|
|
12958
|
+
while (blank(text, at, void 0) !== void 0)
|
|
12959
|
+
at += 1;
|
|
12960
|
+
let word = "";
|
|
12961
|
+
for (let token = nextToken(text, at, word); token.kind === "part"; token = nextToken(text, at, word)) {
|
|
12962
|
+
word += token.value;
|
|
12963
|
+
at = token.end;
|
|
12964
|
+
}
|
|
12965
|
+
return [word, at];
|
|
12966
|
+
}
|
|
12967
|
+
function pastCommandPart(text, at, bodies) {
|
|
12968
|
+
if (text.startsWith("$((", at))
|
|
12969
|
+
return pastBalanced(text, at + 2, "(", ")");
|
|
12970
|
+
if (text[at] === "\n" && bodies.length > 0) {
|
|
12971
|
+
return bodies.splice(0).reduce((from, body) => pastBody(text, from, body, true), at + 1);
|
|
12972
|
+
}
|
|
12973
|
+
const token = redirection(text, at, void 0);
|
|
12974
|
+
if (token?.kind !== "heredoc")
|
|
12975
|
+
return token?.end;
|
|
12976
|
+
const [delimiter, end] = delimiterWord(text, token.end);
|
|
12977
|
+
bodies.push({ delimiter, tabs: token.tabs, quoted: false });
|
|
12978
|
+
return end;
|
|
12941
12979
|
}
|
|
12942
12980
|
function commandList() {
|
|
12943
12981
|
const commands = [];
|
|
@@ -12955,8 +12993,15 @@ function commandList() {
|
|
|
12955
12993
|
};
|
|
12956
12994
|
return { commands, push: (command) => commands.push(command), read };
|
|
12957
12995
|
}
|
|
12996
|
+
function commentLineEnd(text, source, at, word) {
|
|
12997
|
+
if (comment(source, at, word) === void 0)
|
|
12998
|
+
return source;
|
|
12999
|
+
const end = text.indexOf("\n", at);
|
|
13000
|
+
return source[end] === text[end] ? source : `${source.slice(0, end)}
|
|
13001
|
+
${source.slice(end + 1)}`;
|
|
13002
|
+
}
|
|
12958
13003
|
function simpleCommands(text) {
|
|
12959
|
-
|
|
13004
|
+
let source = text.replace(JOINED_LINE, (joined, pairs) => pairs.padEnd(joined.length));
|
|
12960
13005
|
const { commands, push, read } = commandList();
|
|
12961
13006
|
const bodies = [];
|
|
12962
13007
|
let words = [];
|
|
@@ -12964,13 +13009,13 @@ function simpleCommands(text) {
|
|
|
12964
13009
|
let quoted = false;
|
|
12965
13010
|
let target;
|
|
12966
13011
|
const endWord = () => {
|
|
12967
|
-
if (word
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
target
|
|
12973
|
-
|
|
13012
|
+
if (word === void 0)
|
|
13013
|
+
return;
|
|
13014
|
+
if (target === void 0)
|
|
13015
|
+
words.push(word);
|
|
13016
|
+
else if (target.kind === "heredoc")
|
|
13017
|
+
bodies.push({ delimiter: word, tabs: target.tabs, quoted });
|
|
13018
|
+
target = void 0;
|
|
12974
13019
|
word = void 0;
|
|
12975
13020
|
quoted = false;
|
|
12976
13021
|
};
|
|
@@ -12982,6 +13027,7 @@ function simpleCommands(text) {
|
|
|
12982
13027
|
words = [];
|
|
12983
13028
|
};
|
|
12984
13029
|
for (let at = 0; at < source.length; ) {
|
|
13030
|
+
source = commentLineEnd(text, source, at, word);
|
|
12985
13031
|
const token = nextToken(source, at, word);
|
|
12986
13032
|
if (token.kind === "part") {
|
|
12987
13033
|
word = (word ?? "") + token.value;
|
|
@@ -13061,7 +13107,7 @@ function runsBy(reading) {
|
|
|
13061
13107
|
return words.join(" ") !== "" && runs(command, words, scripts, SCRIPT_CHAIN_DEPTH, reading);
|
|
13062
13108
|
};
|
|
13063
13109
|
}
|
|
13064
|
-
var SCRIPT_CHAIN_DEPTH, ASSIGNMENT, launcher, runsNext, YARN_FOREACH, SHELL_WORDS, COMMAND_PREFIXES, LAUNCHERS, SCRIPT_INVOCATIONS, opensAt, opensWith, namedOnLine, pastAssignments, JOINED_LINE, SEPARATORS, REDIRECTION, FILE_DESCRIPTOR, PLAIN, ESCAPED_IN_DOUBLE_QUOTES, EXPANSIONS, EXPANSIONS_IN_DOUBLE_QUOTES, part, blank, comment, escaped, singleQuoted, doubleQuotedWord, expansion, redirection, separator, READS, isOneOf, headsOf, lastStageHeadsOf, anywhere, asCommand, commandRuns, shellReading;
|
|
13110
|
+
var SCRIPT_CHAIN_DEPTH, ASSIGNMENT, launcher, runsNext, YARN_FOREACH, SHELL_WORDS, COMMAND_PREFIXES, LAUNCHERS, SCRIPT_INVOCATIONS, opensAt, opensWith, namedOnLine, pastAssignments, JOINED_LINE, SEPARATORS, REDIRECTION, FILE_DESCRIPTOR, PLAIN, ESCAPED_IN_DOUBLE_QUOTES, EXPANSIONS, EXPANSIONS_IN_DOUBLE_QUOTES, pastNoCommand, part, blank, comment, escaped, singleQuoted, doubleQuotedWord, expansion, redirection, separator, READS, isOneOf, headsOf, lastStageHeadsOf, anywhere, asCommand, commandRuns, shellReading;
|
|
13065
13111
|
var init_commandRuns = __esm({
|
|
13066
13112
|
"../core/dist/parse/commandRuns.js"() {
|
|
13067
13113
|
"use strict";
|
|
@@ -13165,6 +13211,7 @@ var init_commandRuns = __esm({
|
|
|
13165
13211
|
ESCAPED_IN_DOUBLE_QUOTES = '"\\$`';
|
|
13166
13212
|
EXPANSIONS = ["$(", "${", "<(", ">("];
|
|
13167
13213
|
EXPANSIONS_IN_DOUBLE_QUOTES = ["$(", "${"];
|
|
13214
|
+
pastNoCommand = () => void 0;
|
|
13168
13215
|
part = (value, quoted, end) => ({ kind: "part", value, quoted, end });
|
|
13169
13216
|
blank = (text, at) => {
|
|
13170
13217
|
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.83",
|
|
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.83"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|