@swmansion/argent 0.20.1-next.5 → 0.20.1-next.6
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/tool-server.cjs +67 -26
- package/package.json +1 -1
package/dist/tool-server.cjs
CHANGED
|
@@ -142717,6 +142717,12 @@ function selectorTree(sel) {
|
|
|
142717
142717
|
walk(sel);
|
|
142718
142718
|
return out;
|
|
142719
142719
|
}
|
|
142720
|
+
function blockSteps(step) {
|
|
142721
|
+
return isBlockStep(step) ? step.steps : void 0;
|
|
142722
|
+
}
|
|
142723
|
+
function isBlockStep(step) {
|
|
142724
|
+
return isBlockDirectiveKey(step.kind);
|
|
142725
|
+
}
|
|
142720
142726
|
function isE2eFlow(flow) {
|
|
142721
142727
|
const first = flow.steps.find((s) => s.kind !== "echo");
|
|
142722
142728
|
return first?.kind === "launch";
|
|
@@ -143381,6 +143387,10 @@ var STEP_DIRECTIVE_KEYS = [
|
|
|
143381
143387
|
"rotate",
|
|
143382
143388
|
"snapshot"
|
|
143383
143389
|
];
|
|
143390
|
+
var BLOCK_DIRECTIVE_KEYS = ["when"];
|
|
143391
|
+
function isBlockDirectiveKey(key2) {
|
|
143392
|
+
return BLOCK_DIRECTIVE_KEYS.includes(key2);
|
|
143393
|
+
}
|
|
143384
143394
|
function parseTapTimes(raw, entry) {
|
|
143385
143395
|
if (raw === void 0) return void 0;
|
|
143386
143396
|
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 10) {
|
|
@@ -143573,14 +143583,26 @@ function parseWhenCondition(raw) {
|
|
|
143573
143583
|
}
|
|
143574
143584
|
return { kind: "ui", ...cond };
|
|
143575
143585
|
}
|
|
143576
|
-
var
|
|
143577
|
-
function
|
|
143578
|
-
if (depth >=
|
|
143586
|
+
var MAX_BLOCK_DEPTH = 20;
|
|
143587
|
+
function assertBlockDepth(raw, depth) {
|
|
143588
|
+
if (depth >= MAX_BLOCK_DEPTH) {
|
|
143589
|
+
const directives = BLOCK_DIRECTIVE_KEYS.map((key2) => `\`${key2}:\``).join("/");
|
|
143579
143590
|
badEntry(
|
|
143580
143591
|
raw,
|
|
143581
|
-
|
|
143592
|
+
`${directives} blocks nest deeper than ${MAX_BLOCK_DEPTH} levels \u2014 check for a cyclic YAML alias (\`steps: &s \u2026 steps: *s\`)`
|
|
143582
143593
|
);
|
|
143583
143594
|
}
|
|
143595
|
+
}
|
|
143596
|
+
function parseBlockSteps(raw, depth, emptyDetail) {
|
|
143597
|
+
assertBlockDepth(raw, depth);
|
|
143598
|
+
if (!Array.isArray(raw.steps) || raw.steps.length === 0) badEntry(raw, emptyDetail);
|
|
143599
|
+
return raw.steps.map((s) => {
|
|
143600
|
+
if (s !== null && typeof s === "object") return fromYamlStep(s, depth + 1);
|
|
143601
|
+
return badEntry(s, "step must be an object");
|
|
143602
|
+
});
|
|
143603
|
+
}
|
|
143604
|
+
function parseWhenStep(raw, depth) {
|
|
143605
|
+
assertBlockDepth(raw, depth);
|
|
143584
143606
|
if ("else" in raw) {
|
|
143585
143607
|
badEntry(
|
|
143586
143608
|
raw,
|
|
@@ -143591,13 +143613,7 @@ function parseWhenStep(raw, depth) {
|
|
|
143591
143613
|
badEntry(raw, "a when step takes exactly { when: <condition>, steps: [...] }");
|
|
143592
143614
|
}
|
|
143593
143615
|
const condition = parseWhenCondition(raw.when);
|
|
143594
|
-
|
|
143595
|
-
badEntry(raw, "when needs a non-empty steps list to guard");
|
|
143596
|
-
}
|
|
143597
|
-
const steps = raw.steps.map((s) => {
|
|
143598
|
-
if (s !== null && typeof s === "object") return fromYamlStep(s, depth + 1);
|
|
143599
|
-
return badEntry(s, "step must be an object");
|
|
143600
|
-
});
|
|
143616
|
+
const steps = parseBlockSteps(raw, depth, "when needs a non-empty steps list to guard");
|
|
143601
143617
|
return { kind: "when", condition, steps };
|
|
143602
143618
|
}
|
|
143603
143619
|
function runTargetName(target) {
|
|
@@ -143636,7 +143652,7 @@ function completeRunExtension(value) {
|
|
|
143636
143652
|
const candidate = `${value}.yaml`;
|
|
143637
143653
|
return FLOW_FILE_NAME_PATTERN.test(path31.posix.basename(candidate)) ? candidate : value;
|
|
143638
143654
|
}
|
|
143639
|
-
function fromYamlStep(raw,
|
|
143655
|
+
function fromYamlStep(raw, blockDepth = 0) {
|
|
143640
143656
|
const entry = raw;
|
|
143641
143657
|
if ("optional" in raw) {
|
|
143642
143658
|
badEntry(
|
|
@@ -143659,7 +143675,7 @@ function fromYamlStep(raw, whenDepth = 0) {
|
|
|
143659
143675
|
);
|
|
143660
143676
|
}
|
|
143661
143677
|
const kind = kinds[0];
|
|
143662
|
-
if (kind
|
|
143678
|
+
if (!isBlockDirectiveKey(kind)) {
|
|
143663
143679
|
const siblings = kind === "tool" ? ["tool", "args", "delayMs"] : [kind];
|
|
143664
143680
|
const extras = Object.keys(entry).filter((k) => !siblings.includes(k));
|
|
143665
143681
|
if (extras.length > 0) {
|
|
@@ -143672,7 +143688,7 @@ function fromYamlStep(raw, whenDepth = 0) {
|
|
|
143672
143688
|
if ("echo" in raw) return { kind: "echo", message: String(raw.echo) };
|
|
143673
143689
|
if ("launch" in raw) return { kind: "launch", app: parseLaunch(raw.launch) };
|
|
143674
143690
|
if ("run" in raw) return { kind: "run", flow: parseRunTarget(raw, raw.run) };
|
|
143675
|
-
if ("when" in raw) return parseWhenStep(entry,
|
|
143691
|
+
if ("when" in raw) return parseWhenStep(entry, blockDepth);
|
|
143676
143692
|
if ("tap" in raw) return parseTap(raw.tap, raw);
|
|
143677
143693
|
if ("long-press" in raw) {
|
|
143678
143694
|
return parseLongPress(raw["long-press"], raw);
|
|
@@ -144388,11 +144404,13 @@ function stepRequiresDevice(registry2, step) {
|
|
|
144388
144404
|
}
|
|
144389
144405
|
}
|
|
144390
144406
|
function flowRequiresDevice(registry2, steps) {
|
|
144391
|
-
return steps.some(
|
|
144407
|
+
return steps.some(
|
|
144408
|
+
(step) => stepRequiresDevice(registry2, step) || flowRequiresDevice(registry2, blockSteps(step) ?? [])
|
|
144409
|
+
);
|
|
144392
144410
|
}
|
|
144393
144411
|
function flowScopesDevice(registry2, steps) {
|
|
144394
144412
|
return steps.some(
|
|
144395
|
-
(step) => step.kind === "tool" && declaresAny(registry2, step.name, DEVICE_BIND_LIST_KEYS)
|
|
144413
|
+
(step) => step.kind === "tool" && declaresAny(registry2, step.name, DEVICE_BIND_LIST_KEYS) || flowScopesDevice(registry2, blockSteps(step) ?? [])
|
|
144396
144414
|
);
|
|
144397
144415
|
}
|
|
144398
144416
|
function toolRequiresDevice(registry2, toolName) {
|
|
@@ -148662,7 +148680,8 @@ function displayFlowName(params) {
|
|
|
148662
148680
|
function* walkSteps(steps) {
|
|
148663
148681
|
for (const step of steps) {
|
|
148664
148682
|
yield step;
|
|
148665
|
-
|
|
148683
|
+
const inner = blockSteps(step);
|
|
148684
|
+
if (inner) yield* walkSteps(inner);
|
|
148666
148685
|
}
|
|
148667
148686
|
}
|
|
148668
148687
|
function assertUploadSelfContained(flow) {
|
|
@@ -149063,8 +149082,18 @@ function stepTarget(step) {
|
|
|
149063
149082
|
return step.cropOn ? `"${step.name}" cropOn ${selectorLabel2(step.cropOn)}` : `"${step.name}"`;
|
|
149064
149083
|
case "run":
|
|
149065
149084
|
return step.flow;
|
|
149066
|
-
|
|
149085
|
+
case "echo":
|
|
149086
|
+
case "tool":
|
|
149087
|
+
return void 0;
|
|
149088
|
+
case "launch":
|
|
149089
|
+
return void 0;
|
|
149090
|
+
case "wait":
|
|
149091
|
+
return void 0;
|
|
149092
|
+
default: {
|
|
149093
|
+
const unclassified = step;
|
|
149094
|
+
void unclassified;
|
|
149067
149095
|
return void 0;
|
|
149096
|
+
}
|
|
149068
149097
|
}
|
|
149069
149098
|
}
|
|
149070
149099
|
function scopeFlow(scope) {
|
|
@@ -149106,7 +149135,8 @@ async function execSteps(state3, steps, scope) {
|
|
|
149106
149135
|
// line rather than vanishing — matching reportBlockSkipped.
|
|
149107
149136
|
...step.kind === "echo" ? { message: step.message } : {}
|
|
149108
149137
|
});
|
|
149109
|
-
|
|
149138
|
+
const inner = blockSteps(step);
|
|
149139
|
+
if (inner) reportBlockSkipped(state3, inner, childScope(scope));
|
|
149110
149140
|
continue;
|
|
149111
149141
|
}
|
|
149112
149142
|
if (!state3.device && stepRequiresDevice(state3.registry, step)) {
|
|
@@ -149120,7 +149150,8 @@ async function execSteps(state3, steps, scope) {
|
|
|
149120
149150
|
...depthOf(scope),
|
|
149121
149151
|
reason: `step needs a device but the flow was resolved as device-free \u2014 pass an explicit device`
|
|
149122
149152
|
});
|
|
149123
|
-
|
|
149153
|
+
const inner = blockSteps(step);
|
|
149154
|
+
if (inner) reportBlockSkipped(state3, inner, childScope(scope));
|
|
149124
149155
|
continue;
|
|
149125
149156
|
}
|
|
149126
149157
|
if (state3.signal?.aborted) {
|
|
@@ -149135,17 +149166,16 @@ async function execSteps(state3, steps, scope) {
|
|
|
149135
149166
|
...depthOf(scope),
|
|
149136
149167
|
...step.kind === "echo" ? { message: step.message } : {}
|
|
149137
149168
|
});
|
|
149138
|
-
|
|
149139
|
-
|
|
149140
|
-
}
|
|
149169
|
+
const inner = blockSteps(step);
|
|
149170
|
+
if (inner) reportBlockSkipped(state3, inner, childScope(scope), "run aborted");
|
|
149141
149171
|
continue;
|
|
149142
149172
|
}
|
|
149143
149173
|
if (step.kind === "run") {
|
|
149144
149174
|
await execRunStep(state3, step, scope);
|
|
149145
149175
|
continue;
|
|
149146
149176
|
}
|
|
149147
|
-
if (step
|
|
149148
|
-
await
|
|
149177
|
+
if (isBlockStep(step)) {
|
|
149178
|
+
await execBlockStep(state3, step, scope);
|
|
149149
149179
|
continue;
|
|
149150
149180
|
}
|
|
149151
149181
|
const report = await execLeafStep(state3, step, index, scope);
|
|
@@ -149169,7 +149199,18 @@ function reportBlockSkipped(state3, steps, scope, reason) {
|
|
|
149169
149199
|
...depthOf(scope),
|
|
149170
149200
|
...step.kind === "echo" ? { message: step.message } : {}
|
|
149171
149201
|
});
|
|
149172
|
-
|
|
149202
|
+
const inner = blockSteps(step);
|
|
149203
|
+
if (inner) reportBlockSkipped(state3, inner, childScope(scope), reason);
|
|
149204
|
+
}
|
|
149205
|
+
}
|
|
149206
|
+
async function execBlockStep(state3, step, scope) {
|
|
149207
|
+
switch (step.kind) {
|
|
149208
|
+
case "when":
|
|
149209
|
+
return execWhenStep(state3, step, scope);
|
|
149210
|
+
default: {
|
|
149211
|
+
const unhandled = step.kind;
|
|
149212
|
+
void unhandled;
|
|
149213
|
+
}
|
|
149173
149214
|
}
|
|
149174
149215
|
}
|
|
149175
149216
|
async function execWhenStep(state3, step, scope) {
|
package/package.json
CHANGED