@cloud-cli/on 1.30.0 → 1.30.1
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/on.js +278 -276
- package/dist/workflows.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/on.js
CHANGED
|
@@ -2188,8 +2188,8 @@ F.parseExportAllDeclaration = function(e, t) {
|
|
|
2188
2188
|
}, F.isDirectiveCandidate = function(e) {
|
|
2189
2189
|
return this.options.ecmaVersion >= 5 && e.type === "ExpressionStatement" && e.expression.type === "Literal" && typeof e.expression.value == "string" && (this.input[e.start] === "\"" || this.input[e.start] === "'");
|
|
2190
2190
|
};
|
|
2191
|
-
var
|
|
2192
|
-
|
|
2191
|
+
var I = M.prototype;
|
|
2192
|
+
I.toAssignable = function(e, t, n) {
|
|
2193
2193
|
if (this.options.ecmaVersion >= 6 && e) switch (e.type) {
|
|
2194
2194
|
case "Identifier":
|
|
2195
2195
|
this.inAsync && e.name === "await" && this.raise(e.start, "Cannot use 'await' as identifier inside an async function");
|
|
@@ -2228,7 +2228,7 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2228
2228
|
}
|
|
2229
2229
|
else n && this.checkPatternErrors(n, !0);
|
|
2230
2230
|
return e;
|
|
2231
|
-
},
|
|
2231
|
+
}, I.toAssignableList = function(e, t) {
|
|
2232
2232
|
for (var n = e.length, r = 0; r < n; r++) {
|
|
2233
2233
|
var i = e[r];
|
|
2234
2234
|
i && this.toAssignable(i, t);
|
|
@@ -2238,13 +2238,13 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2238
2238
|
this.options.ecmaVersion === 6 && t && a && a.type === "RestElement" && a.argument.type !== "Identifier" && this.unexpected(a.argument.start);
|
|
2239
2239
|
}
|
|
2240
2240
|
return e;
|
|
2241
|
-
},
|
|
2241
|
+
}, I.parseSpread = function(e) {
|
|
2242
2242
|
var t = this.startNode();
|
|
2243
2243
|
return this.next(), t.argument = this.parseMaybeAssign(!1, e), this.finishNode(t, "SpreadElement");
|
|
2244
|
-
},
|
|
2244
|
+
}, I.parseRestBinding = function() {
|
|
2245
2245
|
var e = this.startNode();
|
|
2246
2246
|
return this.next(), this.options.ecmaVersion === 6 && this.type !== k.name && this.unexpected(), e.argument = this.parseBindingAtom(), this.finishNode(e, "RestElement");
|
|
2247
|
-
},
|
|
2247
|
+
}, I.parseBindingAtom = function() {
|
|
2248
2248
|
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
2249
2249
|
case k.bracketL:
|
|
2250
2250
|
var e = this.startNode();
|
|
@@ -2252,7 +2252,7 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2252
2252
|
case k.braceL: return this.parseObj(!0);
|
|
2253
2253
|
}
|
|
2254
2254
|
return this.parseIdent();
|
|
2255
|
-
},
|
|
2255
|
+
}, I.parseBindingList = function(e, t, n, r) {
|
|
2256
2256
|
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(k.comma), t && this.type === k.comma) i.push(null);
|
|
2257
2257
|
else if (n && this.afterTrailingComma(e)) break;
|
|
2258
2258
|
else if (this.type === k.ellipsis) {
|
|
@@ -2261,16 +2261,16 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2261
2261
|
break;
|
|
2262
2262
|
} else i.push(this.parseAssignableListItem(r));
|
|
2263
2263
|
return i;
|
|
2264
|
-
},
|
|
2264
|
+
}, I.parseAssignableListItem = function(e) {
|
|
2265
2265
|
var t = this.parseMaybeDefault(this.start, this.startLoc);
|
|
2266
2266
|
return this.parseBindingListItem(t), t;
|
|
2267
|
-
},
|
|
2267
|
+
}, I.parseBindingListItem = function(e) {
|
|
2268
2268
|
return e;
|
|
2269
|
-
},
|
|
2269
|
+
}, I.parseMaybeDefault = function(e, t, n) {
|
|
2270
2270
|
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(k.eq)) return n;
|
|
2271
2271
|
var r = this.startNodeAt(e, t);
|
|
2272
2272
|
return r.left = n, r.right = this.parseMaybeAssign(), this.finishNode(r, "AssignmentPattern");
|
|
2273
|
-
},
|
|
2273
|
+
}, I.checkLValSimple = function(e, t, n) {
|
|
2274
2274
|
t === void 0 && (t = Tt);
|
|
2275
2275
|
var r = t !== Tt;
|
|
2276
2276
|
switch (e.type) {
|
|
@@ -2286,7 +2286,7 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2286
2286
|
case "ParenthesizedExpression": return r && this.raiseRecoverable(e.start, "Binding parenthesized expression"), this.checkLValSimple(e.expression, t, n);
|
|
2287
2287
|
default: this.raise(e.start, (r ? "Binding" : "Assigning to") + " rvalue");
|
|
2288
2288
|
}
|
|
2289
|
-
},
|
|
2289
|
+
}, I.checkLValPattern = function(e, t, n) {
|
|
2290
2290
|
switch (t === void 0 && (t = Tt), e.type) {
|
|
2291
2291
|
case "ObjectPattern":
|
|
2292
2292
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
@@ -2302,7 +2302,7 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2302
2302
|
break;
|
|
2303
2303
|
default: this.checkLValSimple(e, t, n);
|
|
2304
2304
|
}
|
|
2305
|
-
},
|
|
2305
|
+
}, I.checkLValInnerPattern = function(e, t, n) {
|
|
2306
2306
|
switch (t === void 0 && (t = Tt), e.type) {
|
|
2307
2307
|
case "Property":
|
|
2308
2308
|
this.checkLValInnerPattern(e.value, t, n);
|
|
@@ -2316,39 +2316,39 @@ Vt.toAssignable = function(e, t, n) {
|
|
|
2316
2316
|
default: this.checkLValPattern(e, t, n);
|
|
2317
2317
|
}
|
|
2318
2318
|
};
|
|
2319
|
-
var
|
|
2319
|
+
var Vt = function(e, t, n, r, i) {
|
|
2320
2320
|
this.token = e, this.isExpr = !!t, this.preserveSpace = !!n, this.override = r, this.generator = !!i;
|
|
2321
|
-
},
|
|
2322
|
-
b_stat: new
|
|
2323
|
-
b_expr: new
|
|
2324
|
-
b_tmpl: new
|
|
2325
|
-
p_stat: new
|
|
2326
|
-
p_expr: new
|
|
2327
|
-
q_tmpl: new
|
|
2321
|
+
}, L = {
|
|
2322
|
+
b_stat: new Vt("{", !1),
|
|
2323
|
+
b_expr: new Vt("{", !0),
|
|
2324
|
+
b_tmpl: new Vt("${", !1),
|
|
2325
|
+
p_stat: new Vt("(", !1),
|
|
2326
|
+
p_expr: new Vt("(", !0),
|
|
2327
|
+
q_tmpl: new Vt("`", !0, !0, function(e) {
|
|
2328
2328
|
return e.tryReadTemplateToken();
|
|
2329
2329
|
}),
|
|
2330
|
-
f_stat: new
|
|
2331
|
-
f_expr: new
|
|
2332
|
-
f_expr_gen: new
|
|
2333
|
-
f_gen: new
|
|
2334
|
-
},
|
|
2335
|
-
|
|
2336
|
-
return [
|
|
2337
|
-
},
|
|
2330
|
+
f_stat: new Vt("function", !1),
|
|
2331
|
+
f_expr: new Vt("function", !0),
|
|
2332
|
+
f_expr_gen: new Vt("function", !0, !1, null, !0),
|
|
2333
|
+
f_gen: new Vt("function", !1, !1, null, !0)
|
|
2334
|
+
}, Ht = M.prototype;
|
|
2335
|
+
Ht.initialContext = function() {
|
|
2336
|
+
return [L.b_stat];
|
|
2337
|
+
}, Ht.curContext = function() {
|
|
2338
2338
|
return this.context[this.context.length - 1];
|
|
2339
|
-
},
|
|
2339
|
+
}, Ht.braceIsBlock = function(e) {
|
|
2340
2340
|
var t = this.curContext();
|
|
2341
|
-
return t ===
|
|
2342
|
-
},
|
|
2341
|
+
return t === L.f_expr || t === L.f_stat ? !0 : e === k.colon && (t === L.b_stat || t === L.b_expr) ? !t.isExpr : e === k._return || e === k.name && this.exprAllowed ? A.test(this.input.slice(this.lastTokEnd, this.start)) : e === k._else || e === k.semi || e === k.eof || e === k.parenR || e === k.arrow ? !0 : e === k.braceL ? t === L.b_stat : e === k._var || e === k._const || e === k.name ? !1 : !this.exprAllowed;
|
|
2342
|
+
}, Ht.inGeneratorContext = function() {
|
|
2343
2343
|
for (var e = this.context.length - 1; e >= 1; e--) {
|
|
2344
2344
|
var t = this.context[e];
|
|
2345
2345
|
if (t.token === "function") return t.generator;
|
|
2346
2346
|
}
|
|
2347
2347
|
return !1;
|
|
2348
|
-
},
|
|
2348
|
+
}, Ht.updateContext = function(e) {
|
|
2349
2349
|
var t, n = this.type;
|
|
2350
2350
|
n.keyword && e === k.dot ? this.exprAllowed = !1 : (t = n.updateContext) ? t.call(this, e) : this.exprAllowed = n.beforeExpr;
|
|
2351
|
-
},
|
|
2351
|
+
}, Ht.overrideContext = function(e) {
|
|
2352
2352
|
this.curContext() !== e && (this.context[this.context.length - 1] = e);
|
|
2353
2353
|
}, k.parenR.updateContext = k.braceR.updateContext = function() {
|
|
2354
2354
|
if (this.context.length === 1) {
|
|
@@ -2356,32 +2356,32 @@ Ut.initialContext = function() {
|
|
|
2356
2356
|
return;
|
|
2357
2357
|
}
|
|
2358
2358
|
var e = this.context.pop();
|
|
2359
|
-
e ===
|
|
2359
|
+
e === L.b_stat && this.curContext().token === "function" && (e = this.context.pop()), this.exprAllowed = !e.isExpr;
|
|
2360
2360
|
}, k.braceL.updateContext = function(e) {
|
|
2361
|
-
this.context.push(this.braceIsBlock(e) ?
|
|
2361
|
+
this.context.push(this.braceIsBlock(e) ? L.b_stat : L.b_expr), this.exprAllowed = !0;
|
|
2362
2362
|
}, k.dollarBraceL.updateContext = function() {
|
|
2363
|
-
this.context.push(
|
|
2363
|
+
this.context.push(L.b_tmpl), this.exprAllowed = !0;
|
|
2364
2364
|
}, k.parenL.updateContext = function(e) {
|
|
2365
2365
|
var t = e === k._if || e === k._for || e === k._with || e === k._while;
|
|
2366
|
-
this.context.push(t ?
|
|
2366
|
+
this.context.push(t ? L.p_stat : L.p_expr), this.exprAllowed = !0;
|
|
2367
2367
|
}, k.incDec.updateContext = function() {}, k._function.updateContext = k._class.updateContext = function(e) {
|
|
2368
|
-
e.beforeExpr && e !== k._else && (e !== k.semi || this.curContext() ===
|
|
2368
|
+
e.beforeExpr && e !== k._else && (e !== k.semi || this.curContext() === L.p_stat) && !(e === k._return && A.test(this.input.slice(this.lastTokEnd, this.start))) && (e !== k.colon && e !== k.braceL || this.curContext() !== L.b_stat) ? this.context.push(L.f_expr) : this.context.push(L.f_stat), this.exprAllowed = !1;
|
|
2369
2369
|
}, k.colon.updateContext = function() {
|
|
2370
2370
|
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
2371
2371
|
}, k.backQuote.updateContext = function() {
|
|
2372
|
-
this.curContext() ===
|
|
2372
|
+
this.curContext() === L.q_tmpl ? this.context.pop() : this.context.push(L.q_tmpl), this.exprAllowed = !1;
|
|
2373
2373
|
}, k.star.updateContext = function(e) {
|
|
2374
2374
|
if (e === k._function) {
|
|
2375
2375
|
var t = this.context.length - 1;
|
|
2376
|
-
this.context[t] ===
|
|
2376
|
+
this.context[t] === L.f_expr ? this.context[t] = L.f_expr_gen : this.context[t] = L.f_gen;
|
|
2377
2377
|
}
|
|
2378
2378
|
this.exprAllowed = !0;
|
|
2379
2379
|
}, k.name.updateContext = function(e) {
|
|
2380
2380
|
var t = !1;
|
|
2381
2381
|
this.options.ecmaVersion >= 6 && e !== k.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (t = !0), this.exprAllowed = t;
|
|
2382
2382
|
};
|
|
2383
|
-
var
|
|
2384
|
-
|
|
2383
|
+
var R = M.prototype;
|
|
2384
|
+
R.checkPropClash = function(e, t, n) {
|
|
2385
2385
|
if (!(this.options.ecmaVersion >= 9 && e.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (e.computed || e.method || e.shorthand))) {
|
|
2386
2386
|
var r = e.key, i;
|
|
2387
2387
|
switch (r.type) {
|
|
@@ -2406,7 +2406,7 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2406
2406
|
set: !1
|
|
2407
2407
|
}, o[a] = !0;
|
|
2408
2408
|
}
|
|
2409
|
-
},
|
|
2409
|
+
}, R.parseExpression = function(e, t) {
|
|
2410
2410
|
var n = this;
|
|
2411
2411
|
return this.catchStackOverflow(function() {
|
|
2412
2412
|
var r = n.start, i = n.startLoc, a = n.parseMaybeAssign(e, t);
|
|
@@ -2417,7 +2417,7 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2417
2417
|
}
|
|
2418
2418
|
return a;
|
|
2419
2419
|
});
|
|
2420
|
-
},
|
|
2420
|
+
}, R.parseMaybeAssign = function(e, t, n) {
|
|
2421
2421
|
if (this.isContextual("yield")) {
|
|
2422
2422
|
if (this.inGenerator) return this.parseYield(e);
|
|
2423
2423
|
this.exprAllowed = !1;
|
|
@@ -2432,7 +2432,7 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2432
2432
|
return u.operator = this.value, this.type === k.eq && (l = this.toAssignable(l, !1, t)), r || (t.parenthesizedAssign = t.trailingComma = t.doubleProto = -1), t.shorthandAssign >= l.start && (t.shorthandAssign = -1), this.type === k.eq ? this.checkLValPattern(l) : this.checkLValSimple(l), u.left = l, this.next(), u.right = this.parseMaybeAssign(e), o > -1 && (t.doubleProto = o), this.finishNode(u, "AssignmentExpression");
|
|
2433
2433
|
}
|
|
2434
2434
|
return r && this.checkExpressionErrors(t, !0), i > -1 && (t.parenthesizedAssign = i), a > -1 && (t.trailingComma = a), l;
|
|
2435
|
-
},
|
|
2435
|
+
}, R.parseMaybeConditional = function(e, t) {
|
|
2436
2436
|
var n = this.start, r = this.startLoc, i = this.parseExprOps(e, t);
|
|
2437
2437
|
if (this.checkExpressionErrors(t)) return i;
|
|
2438
2438
|
if ((i.type !== "ArrowFunctionExpression" || i.start !== n) && this.eat(k.question)) {
|
|
@@ -2440,10 +2440,10 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2440
2440
|
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(k.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
|
|
2441
2441
|
}
|
|
2442
2442
|
return i;
|
|
2443
|
-
},
|
|
2443
|
+
}, R.parseExprOps = function(e, t) {
|
|
2444
2444
|
var n = this.start, r = this.startLoc, i = this.parseMaybeUnary(t, !1, !1, e);
|
|
2445
2445
|
return this.checkExpressionErrors(t) || i.start === n && i.type === "ArrowFunctionExpression" ? i : this.parseExprOp(i, n, r, -1, e);
|
|
2446
|
-
},
|
|
2446
|
+
}, R.parseExprOp = function(e, t, n, r, i) {
|
|
2447
2447
|
var a = this.type.binop;
|
|
2448
2448
|
if (a != null && (!i || this.type !== k._in) && a > r) {
|
|
2449
2449
|
var o = this.type === k.logicalOR || this.type === k.logicalAND, s = this.type === k.coalesce;
|
|
@@ -2454,16 +2454,16 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2454
2454
|
return (o && this.type === k.coalesce || s && (this.type === k.logicalOR || this.type === k.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(f, t, n, r, i);
|
|
2455
2455
|
}
|
|
2456
2456
|
return e;
|
|
2457
|
-
},
|
|
2457
|
+
}, R.buildBinary = function(e, t, n, r, i, a) {
|
|
2458
2458
|
r.type === "PrivateIdentifier" && this.raise(r.start, "Private identifier can only be left side of binary expression");
|
|
2459
2459
|
var o = this.startNodeAt(e, t);
|
|
2460
2460
|
return o.left = n, o.operator = i, o.right = r, this.finishNode(o, a ? "LogicalExpression" : "BinaryExpression");
|
|
2461
|
-
},
|
|
2461
|
+
}, R.parseMaybeUnary = function(e, t, n, r) {
|
|
2462
2462
|
var i = this.start, a = this.startLoc, o;
|
|
2463
2463
|
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(r), t = !0;
|
|
2464
2464
|
else if (this.type.prefix) {
|
|
2465
2465
|
var s = this.startNode(), c = this.type === k.incDec;
|
|
2466
|
-
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" &&
|
|
2466
|
+
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" && Ut(s.argument) ? this.raiseRecoverable(s.start, "Deleting local variable in strict mode") : s.operator === "delete" && Wt(s.argument) ? this.raiseRecoverable(s.start, "Private fields can not be deleted") : t = !0, o = this.finishNode(s, c ? "UpdateExpression" : "UnaryExpression");
|
|
2467
2467
|
} else if (!t && this.type === k.privateId) (r || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), o = this.parsePrivateIdent(), this.type !== k._in && this.unexpected();
|
|
2468
2468
|
else {
|
|
2469
2469
|
if (o = this.parseExprSubscripts(e, r), this.checkExpressionErrors(e)) return o;
|
|
@@ -2477,18 +2477,18 @@ L.checkPropClash = function(e, t, n) {
|
|
|
2477
2477
|
else return this.buildBinary(i, a, o, this.parseMaybeUnary(null, !1, !1, r), "**", !1);
|
|
2478
2478
|
} else return o;
|
|
2479
2479
|
};
|
|
2480
|
-
function
|
|
2481
|
-
return e.type === "Identifier" || e.type === "ParenthesizedExpression" &&
|
|
2480
|
+
function Ut(e) {
|
|
2481
|
+
return e.type === "Identifier" || e.type === "ParenthesizedExpression" && Ut(e.expression);
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2484
|
-
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" &&
|
|
2483
|
+
function Wt(e) {
|
|
2484
|
+
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" && Wt(e.expression) || e.type === "ParenthesizedExpression" && Wt(e.expression);
|
|
2485
2485
|
}
|
|
2486
|
-
|
|
2486
|
+
R.parseExprSubscripts = function(e, t) {
|
|
2487
2487
|
var n = this.start, r = this.startLoc, i = this.parseExprAtom(e, t);
|
|
2488
2488
|
if (i.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return i;
|
|
2489
2489
|
var a = this.parseSubscripts(i, n, r, !1, t);
|
|
2490
2490
|
return e && a.type === "MemberExpression" && (e.parenthesizedAssign >= a.start && (e.parenthesizedAssign = -1), e.parenthesizedBind >= a.start && (e.parenthesizedBind = -1), e.trailingComma >= a.start && (e.trailingComma = -1)), a;
|
|
2491
|
-
},
|
|
2491
|
+
}, R.parseSubscripts = function(e, t, n, r, i) {
|
|
2492
2492
|
for (var a = this.options.ecmaVersion >= 8 && e.type === "Identifier" && e.name === "async" && this.lastTokEnd === e.end && !this.canInsertSemicolon() && e.end - e.start === 5 && this.potentialArrowAt === e.start, o = !1;;) {
|
|
2493
2493
|
var s = this.parseSubscript(e, t, n, r, a, o, i);
|
|
2494
2494
|
if (s.optional && (o = !0), s === e || s.type === "ArrowFunctionExpression") {
|
|
@@ -2500,11 +2500,11 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2500
2500
|
}
|
|
2501
2501
|
e = s;
|
|
2502
2502
|
}
|
|
2503
|
-
},
|
|
2503
|
+
}, R.shouldParseAsyncArrow = function() {
|
|
2504
2504
|
return !this.canInsertSemicolon() && this.eat(k.arrow);
|
|
2505
|
-
},
|
|
2505
|
+
}, R.parseSubscriptAsyncArrow = function(e, t, n, r) {
|
|
2506
2506
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !0, r);
|
|
2507
|
-
},
|
|
2507
|
+
}, R.parseSubscript = function(e, t, n, r, i, a, o) {
|
|
2508
2508
|
var s = this.options.ecmaVersion >= 11, c = s && this.eat(k.questionDot);
|
|
2509
2509
|
r && c && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
2510
2510
|
var l = this.eat(k.bracketL);
|
|
@@ -2525,7 +2525,7 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2525
2525
|
_.tag = e, _.quasi = this.parseTemplate({ isTagged: !0 }), e = this.finishNode(_, "TaggedTemplateExpression");
|
|
2526
2526
|
}
|
|
2527
2527
|
return e;
|
|
2528
|
-
},
|
|
2528
|
+
}, R.parseExprAtom = function(e, t, n) {
|
|
2529
2529
|
this.type === k.slash && this.readRegexp();
|
|
2530
2530
|
var r, i = this.potentialArrowAt === this.start;
|
|
2531
2531
|
switch (this.type) {
|
|
@@ -2533,7 +2533,7 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2533
2533
|
case k._this: return r = this.startNode(), this.next(), this.finishNode(r, "ThisExpression");
|
|
2534
2534
|
case k.name:
|
|
2535
2535
|
var a = this.start, o = this.startLoc, s = this.containsEsc, c = this.parseIdent(!1);
|
|
2536
|
-
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(k._function)) return this.overrideContext(
|
|
2536
|
+
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(k._function)) return this.overrideContext(L.f_expr), this.parseFunction(this.startNodeAt(a, o), 0, !1, !0, t);
|
|
2537
2537
|
if (i && !this.canInsertSemicolon()) {
|
|
2538
2538
|
if (this.eat(k.arrow)) return this.parseArrowExpression(this.startNodeAt(a, o), [c], !1, t);
|
|
2539
2539
|
if (this.options.ecmaVersion >= 8 && c.name === "async" && this.type === k.name && !s && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return c = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(k.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(a, o), [c], !0, t);
|
|
@@ -2554,7 +2554,7 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2554
2554
|
var u = this.start, d = this.parseParenAndDistinguishExpression(i, t);
|
|
2555
2555
|
return e && (e.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(d) && (e.parenthesizedAssign = u), e.parenthesizedBind < 0 && (e.parenthesizedBind = u)), d;
|
|
2556
2556
|
case k.bracketL: return r = this.startNode(), this.next(), r.elements = this.parseExprList(k.bracketR, !0, !0, e), this.finishNode(r, "ArrayExpression");
|
|
2557
|
-
case k.braceL: return this.overrideContext(
|
|
2557
|
+
case k.braceL: return this.overrideContext(L.b_expr), this.parseObj(!1, e);
|
|
2558
2558
|
case k._function: return r = this.startNode(), this.next(), this.parseFunction(r, 0);
|
|
2559
2559
|
case k._class: return this.parseClass(this.startNode(), !1);
|
|
2560
2560
|
case k._new: return this.parseNew();
|
|
@@ -2562,9 +2562,9 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2562
2562
|
case k._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(n) : this.unexpected();
|
|
2563
2563
|
default: return this.parseExprAtomDefault();
|
|
2564
2564
|
}
|
|
2565
|
-
},
|
|
2565
|
+
}, R.parseExprAtomDefault = function() {
|
|
2566
2566
|
this.unexpected();
|
|
2567
|
-
},
|
|
2567
|
+
}, R.parseExprImport = function(e) {
|
|
2568
2568
|
var t = this.startNode();
|
|
2569
2569
|
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === k.parenL && !e) return this.parseDynamicImport(t);
|
|
2570
2570
|
if (this.type === k.dot) {
|
|
@@ -2572,27 +2572,27 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2572
2572
|
return n.name = "import", t.meta = this.finishNode(n, "Identifier"), this.parseImportMeta(t);
|
|
2573
2573
|
}
|
|
2574
2574
|
this.unexpected();
|
|
2575
|
-
},
|
|
2575
|
+
}, R.parseDynamicImport = function(e) {
|
|
2576
2576
|
if (this.next(), e.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(k.parenR) ? e.options = null : (this.expect(k.comma), this.afterTrailingComma(k.parenR) ? e.options = null : (e.options = this.parseMaybeAssign(), this.eat(k.parenR) || (this.expect(k.comma), this.afterTrailingComma(k.parenR) || this.unexpected())));
|
|
2577
2577
|
else if (!this.eat(k.parenR)) {
|
|
2578
2578
|
var t = this.start;
|
|
2579
2579
|
this.eat(k.comma) && this.eat(k.parenR) ? this.raiseRecoverable(t, "Trailing comma is not allowed in import()") : this.unexpected(t);
|
|
2580
2580
|
}
|
|
2581
2581
|
return this.finishNode(e, "ImportExpression");
|
|
2582
|
-
},
|
|
2582
|
+
}, R.parseImportMeta = function(e) {
|
|
2583
2583
|
this.next();
|
|
2584
2584
|
var t = this.containsEsc;
|
|
2585
2585
|
return e.property = this.parseIdent(!0), e.property.name !== "meta" && this.raiseRecoverable(e.property.start, "The only valid meta property for import is 'import.meta'"), t && this.raiseRecoverable(e.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(e.start, "Cannot use 'import.meta' outside a module"), this.finishNode(e, "MetaProperty");
|
|
2586
|
-
},
|
|
2586
|
+
}, R.parseLiteral = function(e) {
|
|
2587
2587
|
var t = this.startNode();
|
|
2588
2588
|
return t.value = e, t.raw = this.input.slice(this.start, this.end), t.raw.charCodeAt(t.raw.length - 1) === 110 && (t.bigint = t.value == null ? t.raw.slice(0, -1).replace(/_/g, "") : t.value.toString()), this.next(), this.finishNode(t, "Literal");
|
|
2589
|
-
},
|
|
2589
|
+
}, R.parseParenExpression = function() {
|
|
2590
2590
|
this.expect(k.parenL);
|
|
2591
2591
|
var e = this.parseExpression();
|
|
2592
2592
|
return this.expect(k.parenR), e;
|
|
2593
|
-
},
|
|
2593
|
+
}, R.shouldParseArrow = function(e) {
|
|
2594
2594
|
return !this.canInsertSemicolon();
|
|
2595
|
-
},
|
|
2595
|
+
}, R.parseParenAndDistinguishExpression = function(e, t) {
|
|
2596
2596
|
var n = this.start, r = this.startLoc, i, a = this.options.ecmaVersion >= 8;
|
|
2597
2597
|
if (this.options.ecmaVersion >= 6) {
|
|
2598
2598
|
this.next();
|
|
@@ -2617,13 +2617,13 @@ L.parseExprSubscripts = function(e, t) {
|
|
|
2617
2617
|
return _.expression = i, this.finishNode(_, "ParenthesizedExpression");
|
|
2618
2618
|
}
|
|
2619
2619
|
return i;
|
|
2620
|
-
},
|
|
2620
|
+
}, R.parseParenItem = function(e) {
|
|
2621
2621
|
return e;
|
|
2622
|
-
},
|
|
2622
|
+
}, R.parseParenArrowList = function(e, t, n, r) {
|
|
2623
2623
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !1, r);
|
|
2624
2624
|
};
|
|
2625
|
-
var
|
|
2626
|
-
|
|
2625
|
+
var Gt = [];
|
|
2626
|
+
R.parseNew = function() {
|
|
2627
2627
|
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
2628
2628
|
var e = this.startNode();
|
|
2629
2629
|
if (this.next(), this.options.ecmaVersion >= 6 && this.type === k.dot) {
|
|
@@ -2633,8 +2633,8 @@ L.parseNew = function() {
|
|
|
2633
2633
|
return e.property = this.parseIdent(!0), e.property.name !== "target" && this.raiseRecoverable(e.property.start, "The only valid meta property for new is 'new.target'"), n && this.raiseRecoverable(e.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(e.start, "'new.target' can only be used in functions and class static block"), this.finishNode(e, "MetaProperty");
|
|
2634
2634
|
}
|
|
2635
2635
|
var r = this.start, i = this.startLoc;
|
|
2636
|
-
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), e.arguments = this.eat(k.parenL) ? this.parseExprList(k.parenR, this.options.ecmaVersion >= 8, !1) :
|
|
2637
|
-
},
|
|
2636
|
+
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), e.arguments = this.eat(k.parenL) ? this.parseExprList(k.parenR, this.options.ecmaVersion >= 8, !1) : Gt, this.finishNode(e, "NewExpression");
|
|
2637
|
+
}, R.parseTemplateElement = function(e) {
|
|
2638
2638
|
var t = e.isTagged, n = this.startNode();
|
|
2639
2639
|
return this.type === k.invalidTemplate ? (t || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), n.value = {
|
|
2640
2640
|
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
@@ -2643,7 +2643,7 @@ L.parseNew = function() {
|
|
|
2643
2643
|
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
|
2644
2644
|
cooked: this.value
|
|
2645
2645
|
}, this.next(), n.tail = this.type === k.backQuote, this.finishNode(n, "TemplateElement");
|
|
2646
|
-
},
|
|
2646
|
+
}, R.parseTemplate = function(e) {
|
|
2647
2647
|
e === void 0 && (e = {});
|
|
2648
2648
|
var t = e.isTagged;
|
|
2649
2649
|
t === void 0 && (t = !1);
|
|
@@ -2652,9 +2652,9 @@ L.parseNew = function() {
|
|
|
2652
2652
|
var r = this.parseTemplateElement({ isTagged: t });
|
|
2653
2653
|
for (n.quasis = [r]; !r.tail;) this.type === k.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(k.dollarBraceL), n.expressions.push(this.parseExpression()), this.expect(k.braceR), n.quasis.push(r = this.parseTemplateElement({ isTagged: t }));
|
|
2654
2654
|
return this.next(), this.finishNode(n, "TemplateLiteral");
|
|
2655
|
-
},
|
|
2655
|
+
}, R.isAsyncProp = function(e) {
|
|
2656
2656
|
return !e.computed && e.key.type === "Identifier" && e.key.name === "async" && (this.type === k.name || this.type === k.num || this.type === k.string || this.type === k.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === k.star) && !A.test(this.input.slice(this.lastTokEnd, this.start));
|
|
2657
|
-
},
|
|
2657
|
+
}, R.parseObj = function(e, t) {
|
|
2658
2658
|
var n = this.startNode(), r = !0, i = {};
|
|
2659
2659
|
for (n.properties = [], this.next(); !this.eat(k.braceR);) {
|
|
2660
2660
|
if (r) r = !1;
|
|
@@ -2663,13 +2663,13 @@ L.parseNew = function() {
|
|
|
2663
2663
|
e || this.checkPropClash(a, i, t), n.properties.push(a);
|
|
2664
2664
|
}
|
|
2665
2665
|
return this.finishNode(n, e ? "ObjectPattern" : "ObjectExpression");
|
|
2666
|
-
},
|
|
2666
|
+
}, R.parseProperty = function(e, t) {
|
|
2667
2667
|
var n = this.startNode(), r, i, a, o;
|
|
2668
2668
|
if (this.options.ecmaVersion >= 9 && this.eat(k.ellipsis)) return e ? (n.argument = this.parseIdent(!1), this.type === k.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(n, "RestElement")) : (n.argument = this.parseMaybeAssign(!1, t), this.type === k.comma && t && t.trailingComma < 0 && (t.trailingComma = this.start), this.finishNode(n, "SpreadElement"));
|
|
2669
2669
|
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(k.star)));
|
|
2670
2670
|
var s = this.containsEsc;
|
|
2671
2671
|
return this.parsePropertyName(n), !e && !s && this.options.ecmaVersion >= 8 && !r && this.isAsyncProp(n) ? (i = !0, r = this.options.ecmaVersion >= 9 && this.eat(k.star), this.parsePropertyName(n)) : i = !1, this.parsePropertyValue(n, e, r, i, a, o, t, s), this.finishNode(n, "Property");
|
|
2672
|
-
},
|
|
2672
|
+
}, R.parseGetterSetter = function(e) {
|
|
2673
2673
|
var t = e.key.name;
|
|
2674
2674
|
this.parsePropertyName(e), e.value = this.parseMethod(!1), e.kind = t;
|
|
2675
2675
|
var n = e.kind === "get" ? 0 : 1;
|
|
@@ -2677,23 +2677,23 @@ L.parseNew = function() {
|
|
|
2677
2677
|
var r = e.value.start;
|
|
2678
2678
|
e.kind === "get" ? this.raiseRecoverable(r, "getter should have no params") : this.raiseRecoverable(r, "setter should have exactly one param");
|
|
2679
2679
|
} else e.kind === "set" && e.value.params[0].type === "RestElement" && this.raiseRecoverable(e.value.params[0].start, "Setter cannot use rest params");
|
|
2680
|
-
},
|
|
2680
|
+
}, R.parsePropertyValue = function(e, t, n, r, i, a, o, s) {
|
|
2681
2681
|
(n || r) && this.type === k.colon && this.unexpected(), this.eat(k.colon) ? (e.value = t ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, o), e.kind = "init") : this.options.ecmaVersion >= 6 && this.type === k.parenL ? (t && this.unexpected(), e.method = !0, e.value = this.parseMethod(n, r), e.kind = "init") : !t && !s && this.options.ecmaVersion >= 5 && !e.computed && e.key.type === "Identifier" && (e.key.name === "get" || e.key.name === "set") && this.type !== k.comma && this.type !== k.braceR && this.type !== k.eq ? ((n || r) && this.unexpected(), this.parseGetterSetter(e)) : this.options.ecmaVersion >= 6 && !e.computed && e.key.type === "Identifier" ? ((n || r) && this.unexpected(), this.checkUnreserved(e.key), e.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = i), t ? e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key)) : this.type === k.eq && o ? (o.shorthandAssign < 0 && (o.shorthandAssign = this.start), e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key))) : e.value = this.copyNode(e.key), e.kind = "init", e.shorthand = !0) : this.unexpected();
|
|
2682
|
-
},
|
|
2682
|
+
}, R.parsePropertyName = function(e) {
|
|
2683
2683
|
if (this.options.ecmaVersion >= 6) {
|
|
2684
2684
|
if (this.eat(k.bracketL)) return e.computed = !0, e.key = this.parseMaybeAssign(), this.expect(k.bracketR), e.key;
|
|
2685
2685
|
e.computed = !1;
|
|
2686
2686
|
}
|
|
2687
2687
|
return e.key = this.type === k.num || this.type === k.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
2688
|
-
},
|
|
2688
|
+
}, R.initFunction = function(e) {
|
|
2689
2689
|
e.id = null, this.options.ecmaVersion >= 6 && (e.generator = e.expression = !1), this.options.ecmaVersion >= 8 && (e.async = !1);
|
|
2690
|
-
},
|
|
2690
|
+
}, R.parseMethod = function(e, t, n) {
|
|
2691
2691
|
var r = this.startNode(), i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2692
2692
|
return this.initFunction(r), this.options.ecmaVersion >= 6 && (r.generator = e), this.options.ecmaVersion >= 8 && (r.async = !!t), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(wt(t, r.generator) | vt | (n ? yt : 0)), this.expect(k.parenL), r.params = this.parseBindingList(k.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(r, !1, !0, !1), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(r, "FunctionExpression");
|
|
2693
|
-
},
|
|
2693
|
+
}, R.parseArrowExpression = function(e, t, n, r) {
|
|
2694
2694
|
var i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2695
2695
|
return this.enterScope(wt(n, !1) | gt), this.initFunction(e), this.options.ecmaVersion >= 8 && (e.async = !!n), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, e.params = this.toAssignableList(t, !0), this.parseFunctionBody(e, !0, !1, r), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(e, "ArrowFunctionExpression");
|
|
2696
|
-
},
|
|
2696
|
+
}, R.parseFunctionBody = function(e, t, n, r) {
|
|
2697
2697
|
var i = t && this.type !== k.braceL, a = this.strict, o = !1;
|
|
2698
2698
|
if (i) e.body = this.parseMaybeAssign(r), e.expression = !0, this.checkParams(e, !1);
|
|
2699
2699
|
else {
|
|
@@ -2703,15 +2703,15 @@ L.parseNew = function() {
|
|
|
2703
2703
|
this.labels = [], o && (this.strict = !0), this.checkParams(e, !a && !o && !t && !n && this.isSimpleParamList(e.params)), this.strict && e.id && this.checkLValSimple(e.id, At), e.body = this.parseBlock(!1, void 0, o && !a), e.expression = !1, this.adaptDirectivePrologue(e.body.body), this.labels = c;
|
|
2704
2704
|
}
|
|
2705
2705
|
this.exitScope();
|
|
2706
|
-
},
|
|
2706
|
+
}, R.isSimpleParamList = function(e) {
|
|
2707
2707
|
for (var t = 0, n = e; t < n.length; t += 1) if (n[t].type !== "Identifier") return !1;
|
|
2708
2708
|
return !0;
|
|
2709
|
-
},
|
|
2709
|
+
}, R.checkParams = function(e, t) {
|
|
2710
2710
|
for (var n = Object.create(null), r = 0, i = e.params; r < i.length; r += 1) {
|
|
2711
2711
|
var a = i[r];
|
|
2712
2712
|
this.checkLValInnerPattern(a, Et, t ? null : n);
|
|
2713
2713
|
}
|
|
2714
|
-
},
|
|
2714
|
+
}, R.parseExprList = function(e, t, n, r) {
|
|
2715
2715
|
for (var i = [], a = !0; !this.eat(e);) {
|
|
2716
2716
|
if (a) a = !1;
|
|
2717
2717
|
else if (this.expect(k.comma), t && this.afterTrailingComma(e)) break;
|
|
@@ -2719,46 +2719,46 @@ L.parseNew = function() {
|
|
|
2719
2719
|
n && this.type === k.comma ? o = null : this.type === k.ellipsis ? (o = this.parseSpread(r), r && this.type === k.comma && r.trailingComma < 0 && (r.trailingComma = this.start)) : o = this.parseMaybeAssign(!1, r), i.push(o);
|
|
2720
2720
|
}
|
|
2721
2721
|
return i;
|
|
2722
|
-
},
|
|
2722
|
+
}, R.checkUnreserved = function(e) {
|
|
2723
2723
|
var t = e.start, n = e.end, r = e.name;
|
|
2724
2724
|
this.inGenerator && r === "yield" && this.raiseRecoverable(t, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & Ct) && r === "arguments" && this.raiseRecoverable(t, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (r === "arguments" || r === "await") && this.raise(t, "Cannot use " + r + " in class static initialization block"), this.keywords.test(r) && this.raise(t, "Unexpected keyword '" + r + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(t, n).indexOf("\\") !== -1) && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(r) && (!this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(t, "The keyword '" + r + "' is reserved"));
|
|
2725
|
-
},
|
|
2725
|
+
}, R.parseIdent = function(e) {
|
|
2726
2726
|
var t = this.parseIdentNode();
|
|
2727
2727
|
return this.next(!!e), this.finishNode(t, "Identifier"), e || (this.checkUnreserved(t), t.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = t.start)), t;
|
|
2728
|
-
},
|
|
2728
|
+
}, R.parseIdentNode = function() {
|
|
2729
2729
|
var e = this.startNode();
|
|
2730
2730
|
return this.type === k.name ? e.name = this.value : this.type.keyword ? (e.name = this.type.keyword, (e.name === "class" || e.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = k.name) : this.unexpected(), e;
|
|
2731
|
-
},
|
|
2731
|
+
}, R.parsePrivateIdent = function() {
|
|
2732
2732
|
var e = this.startNode();
|
|
2733
2733
|
return this.type === k.privateId ? e.name = this.value : this.unexpected(), this.next(), this.finishNode(e, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(e.start, "Private field '#" + e.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(e)), e;
|
|
2734
|
-
},
|
|
2734
|
+
}, R.parseYield = function(e) {
|
|
2735
2735
|
this.yieldPos ||= this.start;
|
|
2736
2736
|
var t = this.startNode();
|
|
2737
2737
|
return this.next(), this.type === k.semi || this.canInsertSemicolon() || this.type !== k.star && !this.type.startsExpr ? (t.delegate = !1, t.argument = null) : (t.delegate = this.eat(k.star), t.argument = this.parseMaybeAssign(e)), this.finishNode(t, "YieldExpression");
|
|
2738
|
-
},
|
|
2738
|
+
}, R.parseAwait = function(e) {
|
|
2739
2739
|
this.awaitPos ||= this.start;
|
|
2740
2740
|
var t = this.startNode();
|
|
2741
2741
|
return this.next(), t.argument = this.parseMaybeUnary(null, !0, !1, e), this.finishNode(t, "AwaitExpression");
|
|
2742
2742
|
};
|
|
2743
|
-
var
|
|
2744
|
-
|
|
2743
|
+
var Kt = M.prototype;
|
|
2744
|
+
Kt.raise = function(e, t) {
|
|
2745
2745
|
var n = st(this.input, e);
|
|
2746
2746
|
t += " (" + n.line + ":" + n.column + ")", this.sourceFile && (t += " in " + this.sourceFile);
|
|
2747
2747
|
var r = SyntaxError(t);
|
|
2748
2748
|
throw r.pos = e, r.loc = n, r.raisedAt = this.pos, r;
|
|
2749
|
-
},
|
|
2749
|
+
}, Kt.raiseRecoverable = Kt.raise, Kt.curPosition = function() {
|
|
2750
2750
|
if (this.options.locations) return new at(this.curLine, this.pos - this.lineStart);
|
|
2751
2751
|
};
|
|
2752
|
-
var
|
|
2752
|
+
var qt = M.prototype, Jt = function(e) {
|
|
2753
2753
|
this.flags = e, this.var = [], this.lexical = [], this.functions = [];
|
|
2754
2754
|
};
|
|
2755
|
-
|
|
2756
|
-
this.scopeStack.push(new
|
|
2757
|
-
},
|
|
2755
|
+
qt.enterScope = function(e) {
|
|
2756
|
+
this.scopeStack.push(new Jt(e));
|
|
2757
|
+
}, qt.exitScope = function() {
|
|
2758
2758
|
this.scopeStack.pop();
|
|
2759
|
-
},
|
|
2759
|
+
}, qt.treatFunctionsAsVarInScope = function(e) {
|
|
2760
2760
|
return e.flags & pt || !this.inModule && e.flags & ft;
|
|
2761
|
-
},
|
|
2761
|
+
}, qt.declareName = function(e, t, n) {
|
|
2762
2762
|
var r = !1;
|
|
2763
2763
|
if (t === Dt) {
|
|
2764
2764
|
var i = this.currentScope();
|
|
@@ -2776,103 +2776,103 @@ Jt.enterScope = function(e) {
|
|
|
2776
2776
|
if (s.var.push(e), this.inModule && s.flags & ft && delete this.undefinedExports[e], s.flags & Ct) break;
|
|
2777
2777
|
}
|
|
2778
2778
|
r && this.raiseRecoverable(n, "Identifier '" + e + "' has already been declared");
|
|
2779
|
-
},
|
|
2779
|
+
}, qt.checkLocalExport = function(e) {
|
|
2780
2780
|
this.scopeStack[0].lexical.indexOf(e.name) === -1 && this.scopeStack[0].var.indexOf(e.name) === -1 && (this.undefinedExports[e.name] = e);
|
|
2781
|
-
},
|
|
2781
|
+
}, qt.currentScope = function() {
|
|
2782
2782
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
2783
|
-
},
|
|
2783
|
+
}, qt.currentVarScope = function() {
|
|
2784
2784
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2785
2785
|
var t = this.scopeStack[e];
|
|
2786
2786
|
if (t.flags & (Ct | xt | bt)) return t;
|
|
2787
2787
|
}
|
|
2788
|
-
},
|
|
2788
|
+
}, qt.currentThisScope = function() {
|
|
2789
2789
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2790
2790
|
var t = this.scopeStack[e];
|
|
2791
2791
|
if (t.flags & (Ct | xt | bt) && !(t.flags & gt)) return t;
|
|
2792
2792
|
}
|
|
2793
2793
|
};
|
|
2794
|
-
var
|
|
2794
|
+
var Yt = function(e, t, n) {
|
|
2795
2795
|
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new ot(e, n)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [t, 0]);
|
|
2796
|
-
},
|
|
2797
|
-
|
|
2798
|
-
return new
|
|
2799
|
-
},
|
|
2800
|
-
return new
|
|
2796
|
+
}, Xt = M.prototype;
|
|
2797
|
+
Xt.startNode = function() {
|
|
2798
|
+
return new Yt(this, this.start, this.startLoc);
|
|
2799
|
+
}, Xt.startNodeAt = function(e, t) {
|
|
2800
|
+
return new Yt(this, e, t);
|
|
2801
2801
|
};
|
|
2802
|
-
function
|
|
2802
|
+
function Zt(e, t, n, r) {
|
|
2803
2803
|
return e.type = t, e.end = n, this.options.locations && (e.loc.end = r), this.options.ranges && (e.range[1] = n), e;
|
|
2804
2804
|
}
|
|
2805
|
-
|
|
2806
|
-
return
|
|
2807
|
-
},
|
|
2808
|
-
return
|
|
2809
|
-
},
|
|
2810
|
-
var t = new
|
|
2805
|
+
Xt.finishNode = function(e, t) {
|
|
2806
|
+
return Zt.call(this, e, t, this.lastTokEnd, this.lastTokEndLoc);
|
|
2807
|
+
}, Xt.finishNodeAt = function(e, t, n, r) {
|
|
2808
|
+
return Zt.call(this, e, t, n, r);
|
|
2809
|
+
}, Xt.copyNode = function(e) {
|
|
2810
|
+
var t = new Yt(this, e.start, this.startLoc);
|
|
2811
2811
|
for (var n in e) t[n] = e[n];
|
|
2812
2812
|
return t;
|
|
2813
2813
|
};
|
|
2814
|
-
var
|
|
2815
|
-
9:
|
|
2816
|
-
10:
|
|
2817
|
-
11:
|
|
2818
|
-
12:
|
|
2819
|
-
13:
|
|
2820
|
-
14:
|
|
2821
|
-
},
|
|
2814
|
+
var Qt = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", $t = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", en = $t + " Extended_Pictographic", tn = en, nn = tn + " EBase EComp EMod EPres ExtPict", rn = nn, an = {
|
|
2815
|
+
9: $t,
|
|
2816
|
+
10: en,
|
|
2817
|
+
11: tn,
|
|
2818
|
+
12: nn,
|
|
2819
|
+
13: rn,
|
|
2820
|
+
14: rn
|
|
2821
|
+
}, on = {
|
|
2822
2822
|
9: "",
|
|
2823
2823
|
10: "",
|
|
2824
2824
|
11: "",
|
|
2825
2825
|
12: "",
|
|
2826
2826
|
13: "",
|
|
2827
2827
|
14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
|
|
2828
|
-
},
|
|
2829
|
-
9:
|
|
2830
|
-
10:
|
|
2831
|
-
11:
|
|
2832
|
-
12:
|
|
2833
|
-
13:
|
|
2834
|
-
14:
|
|
2835
|
-
},
|
|
2836
|
-
function
|
|
2837
|
-
var t =
|
|
2838
|
-
binary: nt(
|
|
2839
|
-
binaryOfStrings: nt(
|
|
2828
|
+
}, sn = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", cn = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", ln = cn + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", un = ln + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", dn = un + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", fn = dn + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", pn = {
|
|
2829
|
+
9: cn,
|
|
2830
|
+
10: ln,
|
|
2831
|
+
11: un,
|
|
2832
|
+
12: dn,
|
|
2833
|
+
13: fn,
|
|
2834
|
+
14: fn + " " + Qt
|
|
2835
|
+
}, mn = {};
|
|
2836
|
+
function hn(e) {
|
|
2837
|
+
var t = mn[e] = {
|
|
2838
|
+
binary: nt(an[e] + " " + sn),
|
|
2839
|
+
binaryOfStrings: nt(on[e]),
|
|
2840
2840
|
nonBinary: {
|
|
2841
|
-
General_Category: nt(
|
|
2842
|
-
Script: nt(
|
|
2841
|
+
General_Category: nt(sn),
|
|
2842
|
+
Script: nt(pn[e])
|
|
2843
2843
|
}
|
|
2844
2844
|
};
|
|
2845
2845
|
t.nonBinary.Script_Extensions = t.nonBinary.Script, t.nonBinary.gc = t.nonBinary.General_Category, t.nonBinary.sc = t.nonBinary.Script, t.nonBinary.scx = t.nonBinary.Script_Extensions;
|
|
2846
2846
|
}
|
|
2847
|
-
for (var
|
|
2847
|
+
for (var gn = 0, _n = [
|
|
2848
2848
|
9,
|
|
2849
2849
|
10,
|
|
2850
2850
|
11,
|
|
2851
2851
|
12,
|
|
2852
2852
|
13,
|
|
2853
2853
|
14
|
|
2854
|
-
];
|
|
2855
|
-
var
|
|
2856
|
-
|
|
2854
|
+
]; gn < _n.length; gn += 1) {
|
|
2855
|
+
var vn = _n[gn];
|
|
2856
|
+
hn(vn);
|
|
2857
2857
|
}
|
|
2858
|
-
var
|
|
2858
|
+
var z = M.prototype, yn = function(e, t) {
|
|
2859
2859
|
this.parent = e, this.base = t || this;
|
|
2860
2860
|
};
|
|
2861
|
-
|
|
2861
|
+
yn.prototype.separatedFrom = function(e) {
|
|
2862
2862
|
for (var t = this; t; t = t.parent) for (var n = e; n; n = n.parent) if (t.base === n.base && t !== n) return !0;
|
|
2863
2863
|
return !1;
|
|
2864
|
-
},
|
|
2865
|
-
return new
|
|
2864
|
+
}, yn.prototype.sibling = function() {
|
|
2865
|
+
return new yn(this.parent, this.base);
|
|
2866
2866
|
};
|
|
2867
|
-
var
|
|
2868
|
-
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties =
|
|
2867
|
+
var bn = function(e) {
|
|
2868
|
+
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = mn[e.options.ecmaVersion >= 14 ? 14 : e.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
2869
2869
|
};
|
|
2870
|
-
|
|
2870
|
+
bn.prototype.reset = function(e, t, n) {
|
|
2871
2871
|
var r = n.indexOf("v") !== -1, i = n.indexOf("u") !== -1;
|
|
2872
2872
|
this.start = e | 0, this.source = t + "", this.flags = n, r && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = i && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = i && this.parser.options.ecmaVersion >= 9);
|
|
2873
|
-
},
|
|
2873
|
+
}, bn.prototype.raise = function(e) {
|
|
2874
2874
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e);
|
|
2875
|
-
},
|
|
2875
|
+
}, bn.prototype.at = function(e, t) {
|
|
2876
2876
|
t === void 0 && (t = !1);
|
|
2877
2877
|
var n = this.source, r = n.length;
|
|
2878
2878
|
if (e >= r) return -1;
|
|
@@ -2880,21 +2880,21 @@ xn.prototype.reset = function(e, t, n) {
|
|
|
2880
2880
|
if (!(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r) return i;
|
|
2881
2881
|
var a = n.charCodeAt(e + 1);
|
|
2882
2882
|
return a >= 56320 && a <= 57343 ? (i << 10) + a - 56613888 : i;
|
|
2883
|
-
},
|
|
2883
|
+
}, bn.prototype.nextIndex = function(e, t) {
|
|
2884
2884
|
t === void 0 && (t = !1);
|
|
2885
2885
|
var n = this.source, r = n.length;
|
|
2886
2886
|
if (e >= r) return r;
|
|
2887
2887
|
var i = n.charCodeAt(e), a;
|
|
2888
2888
|
return !(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r || (a = n.charCodeAt(e + 1)) < 56320 || a > 57343 ? e + 1 : e + 2;
|
|
2889
|
-
},
|
|
2889
|
+
}, bn.prototype.current = function(e) {
|
|
2890
2890
|
return e === void 0 && (e = !1), this.at(this.pos, e);
|
|
2891
|
-
},
|
|
2891
|
+
}, bn.prototype.lookahead = function(e) {
|
|
2892
2892
|
return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e);
|
|
2893
|
-
},
|
|
2893
|
+
}, bn.prototype.advance = function(e) {
|
|
2894
2894
|
e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e);
|
|
2895
|
-
},
|
|
2895
|
+
}, bn.prototype.eat = function(e, t) {
|
|
2896
2896
|
return t === void 0 && (t = !1), this.current(t) === e && (this.advance(t), !0);
|
|
2897
|
-
},
|
|
2897
|
+
}, bn.prototype.eatChars = function(e, t) {
|
|
2898
2898
|
t === void 0 && (t = !1);
|
|
2899
2899
|
for (var n = this.pos, r = 0, i = e; r < i.length; r += 1) {
|
|
2900
2900
|
var a = i[r], o = this.at(n, t);
|
|
@@ -2902,34 +2902,34 @@ xn.prototype.reset = function(e, t, n) {
|
|
|
2902
2902
|
n = this.nextIndex(n, t);
|
|
2903
2903
|
}
|
|
2904
2904
|
return this.pos = n, !0;
|
|
2905
|
-
},
|
|
2905
|
+
}, z.validateRegExpFlags = function(e) {
|
|
2906
2906
|
for (var t = e.validFlags, n = e.flags, r = !1, i = !1, a = 0; a < n.length; a++) {
|
|
2907
2907
|
var o = n.charAt(a);
|
|
2908
2908
|
t.indexOf(o) === -1 && this.raise(e.start, "Invalid regular expression flag"), n.indexOf(o, a + 1) > -1 && this.raise(e.start, "Duplicate regular expression flag"), o === "u" && (r = !0), o === "v" && (i = !0);
|
|
2909
2909
|
}
|
|
2910
2910
|
this.options.ecmaVersion >= 15 && r && i && this.raise(e.start, "Invalid regular expression flag");
|
|
2911
2911
|
};
|
|
2912
|
-
function
|
|
2912
|
+
function xn(e) {
|
|
2913
2913
|
for (var t in e) return !0;
|
|
2914
2914
|
return !1;
|
|
2915
2915
|
}
|
|
2916
|
-
|
|
2917
|
-
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 &&
|
|
2918
|
-
},
|
|
2916
|
+
z.validateRegExpPattern = function(e) {
|
|
2917
|
+
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 && xn(e.groupNames) && (e.switchN = !0, this.regexp_pattern(e));
|
|
2918
|
+
}, z.regexp_pattern = function(e) {
|
|
2919
2919
|
e.pos = 0, e.lastIntValue = 0, e.lastStringValue = "", e.lastAssertionIsQuantifiable = !1, e.numCapturingParens = 0, e.maxBackReference = 0, e.groupNames = Object.create(null), e.backReferenceNames.length = 0, e.branchID = null, this.regexp_disjunction(e), e.pos !== e.source.length && (e.eat(41) && e.raise("Unmatched ')'"), (e.eat(93) || e.eat(125)) && e.raise("Lone quantifier brackets")), e.maxBackReference > e.numCapturingParens && e.raise("Invalid escape");
|
|
2920
2920
|
for (var t = 0, n = e.backReferenceNames; t < n.length; t += 1) {
|
|
2921
2921
|
var r = n[t];
|
|
2922
2922
|
e.groupNames[r] || e.raise("Invalid named capture referenced");
|
|
2923
2923
|
}
|
|
2924
|
-
},
|
|
2924
|
+
}, z.regexp_disjunction = function(e) {
|
|
2925
2925
|
var t = this.options.ecmaVersion >= 16;
|
|
2926
|
-
for (t && (e.branchID = new
|
|
2926
|
+
for (t && (e.branchID = new yn(e.branchID, null)), this.regexp_alternative(e); e.eat(124);) t && (e.branchID = e.branchID.sibling()), this.regexp_alternative(e);
|
|
2927
2927
|
t && (e.branchID = e.branchID.parent), this.regexp_eatQuantifier(e, !0) && e.raise("Nothing to repeat"), e.eat(123) && e.raise("Lone quantifier brackets");
|
|
2928
|
-
},
|
|
2928
|
+
}, z.regexp_alternative = function(e) {
|
|
2929
2929
|
for (; e.pos < e.source.length && this.regexp_eatTerm(e););
|
|
2930
|
-
},
|
|
2930
|
+
}, z.regexp_eatTerm = function(e) {
|
|
2931
2931
|
return this.regexp_eatAssertion(e) ? (e.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(e) && e.switchU && e.raise("Invalid quantifier"), !0) : (e.switchU ? this.regexp_eatAtom(e) : this.regexp_eatExtendedAtom(e)) ? (this.regexp_eatQuantifier(e), !0) : !1;
|
|
2932
|
-
},
|
|
2932
|
+
}, z.regexp_eatAssertion = function(e) {
|
|
2933
2933
|
var t = e.pos;
|
|
2934
2934
|
if (e.lastAssertionIsQuantifiable = !1, e.eat(94) || e.eat(36)) return !0;
|
|
2935
2935
|
if (e.eat(92)) {
|
|
@@ -2941,11 +2941,11 @@ R.validateRegExpPattern = function(e) {
|
|
|
2941
2941
|
if (this.options.ecmaVersion >= 9 && (n = e.eat(60)), e.eat(61) || e.eat(33)) return this.regexp_disjunction(e), e.eat(41) || e.raise("Unterminated group"), e.lastAssertionIsQuantifiable = !n, !0;
|
|
2942
2942
|
}
|
|
2943
2943
|
return e.pos = t, !1;
|
|
2944
|
-
},
|
|
2944
|
+
}, z.regexp_eatQuantifier = function(e, t) {
|
|
2945
2945
|
return t === void 0 && (t = !1), this.regexp_eatQuantifierPrefix(e, t) ? (e.eat(63), !0) : !1;
|
|
2946
|
-
},
|
|
2946
|
+
}, z.regexp_eatQuantifierPrefix = function(e, t) {
|
|
2947
2947
|
return e.eat(42) || e.eat(43) || e.eat(63) || this.regexp_eatBracedQuantifier(e, t);
|
|
2948
|
-
},
|
|
2948
|
+
}, z.regexp_eatBracedQuantifier = function(e, t) {
|
|
2949
2949
|
var n = e.pos;
|
|
2950
2950
|
if (e.eat(123)) {
|
|
2951
2951
|
var r = 0, i = -1;
|
|
@@ -2953,16 +2953,16 @@ R.validateRegExpPattern = function(e) {
|
|
|
2953
2953
|
e.switchU && !t && e.raise("Incomplete quantifier"), e.pos = n;
|
|
2954
2954
|
}
|
|
2955
2955
|
return !1;
|
|
2956
|
-
},
|
|
2956
|
+
}, z.regexp_eatAtom = function(e) {
|
|
2957
2957
|
return this.regexp_eatPatternCharacters(e) || e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e);
|
|
2958
|
-
},
|
|
2958
|
+
}, z.regexp_eatReverseSolidusAtomEscape = function(e) {
|
|
2959
2959
|
var t = e.pos;
|
|
2960
2960
|
if (e.eat(92)) {
|
|
2961
2961
|
if (this.regexp_eatAtomEscape(e)) return !0;
|
|
2962
2962
|
e.pos = t;
|
|
2963
2963
|
}
|
|
2964
2964
|
return !1;
|
|
2965
|
-
},
|
|
2965
|
+
}, z.regexp_eatUncapturingGroup = function(e) {
|
|
2966
2966
|
var t = e.pos;
|
|
2967
2967
|
if (e.eat(40)) {
|
|
2968
2968
|
if (e.eat(63)) {
|
|
@@ -2991,37 +2991,37 @@ R.validateRegExpPattern = function(e) {
|
|
|
2991
2991
|
e.pos = t;
|
|
2992
2992
|
}
|
|
2993
2993
|
return !1;
|
|
2994
|
-
},
|
|
2994
|
+
}, z.regexp_eatCapturingGroup = function(e) {
|
|
2995
2995
|
if (e.eat(40)) {
|
|
2996
2996
|
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(e) : e.current() === 63 && e.raise("Invalid group"), this.regexp_disjunction(e), e.eat(41)) return e.numCapturingParens += 1, !0;
|
|
2997
2997
|
e.raise("Unterminated group");
|
|
2998
2998
|
}
|
|
2999
2999
|
return !1;
|
|
3000
|
-
},
|
|
3001
|
-
for (var t = "", n = 0; (n = e.current()) !== -1 &&
|
|
3000
|
+
}, z.regexp_eatModifiers = function(e) {
|
|
3001
|
+
for (var t = "", n = 0; (n = e.current()) !== -1 && Sn(n);) t += rt(n), e.advance();
|
|
3002
3002
|
return t;
|
|
3003
3003
|
};
|
|
3004
|
-
function
|
|
3004
|
+
function Sn(e) {
|
|
3005
3005
|
return e === 105 || e === 109 || e === 115;
|
|
3006
3006
|
}
|
|
3007
|
-
|
|
3007
|
+
z.regexp_eatExtendedAtom = function(e) {
|
|
3008
3008
|
return e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e) || this.regexp_eatInvalidBracedQuantifier(e) || this.regexp_eatExtendedPatternCharacter(e);
|
|
3009
|
-
},
|
|
3009
|
+
}, z.regexp_eatInvalidBracedQuantifier = function(e) {
|
|
3010
3010
|
return this.regexp_eatBracedQuantifier(e, !0) && e.raise("Nothing to repeat"), !1;
|
|
3011
|
-
},
|
|
3011
|
+
}, z.regexp_eatSyntaxCharacter = function(e) {
|
|
3012
3012
|
var t = e.current();
|
|
3013
|
-
return
|
|
3013
|
+
return Cn(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3014
3014
|
};
|
|
3015
|
-
function
|
|
3015
|
+
function Cn(e) {
|
|
3016
3016
|
return e === 36 || e >= 40 && e <= 43 || e === 46 || e === 63 || e >= 91 && e <= 94 || e >= 123 && e <= 125;
|
|
3017
3017
|
}
|
|
3018
|
-
|
|
3019
|
-
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !
|
|
3018
|
+
z.regexp_eatPatternCharacters = function(e) {
|
|
3019
|
+
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !Cn(n);) e.advance();
|
|
3020
3020
|
return e.pos !== t;
|
|
3021
|
-
},
|
|
3021
|
+
}, z.regexp_eatExtendedPatternCharacter = function(e) {
|
|
3022
3022
|
var t = e.current();
|
|
3023
3023
|
return t !== -1 && t !== 36 && !(t >= 40 && t <= 43) && t !== 46 && t !== 63 && t !== 91 && t !== 94 && t !== 124 && (e.advance(), !0);
|
|
3024
|
-
},
|
|
3024
|
+
}, z.regexp_groupSpecifier = function(e) {
|
|
3025
3025
|
if (e.eat(63)) {
|
|
3026
3026
|
this.regexp_eatGroupName(e) || e.raise("Invalid group");
|
|
3027
3027
|
var t = this.options.ecmaVersion >= 16, n = e.groupNames[e.lastStringValue];
|
|
@@ -3031,35 +3031,35 @@ R.regexp_eatPatternCharacters = function(e) {
|
|
|
3031
3031
|
}
|
|
3032
3032
|
t ? (n || (e.groupNames[e.lastStringValue] = [])).push(e.branchID) : e.groupNames[e.lastStringValue] = !0;
|
|
3033
3033
|
}
|
|
3034
|
-
},
|
|
3034
|
+
}, z.regexp_eatGroupName = function(e) {
|
|
3035
3035
|
if (e.lastStringValue = "", e.eat(60)) {
|
|
3036
3036
|
if (this.regexp_eatRegExpIdentifierName(e) && e.eat(62)) return !0;
|
|
3037
3037
|
e.raise("Invalid capture group name");
|
|
3038
3038
|
}
|
|
3039
3039
|
return !1;
|
|
3040
|
-
},
|
|
3040
|
+
}, z.regexp_eatRegExpIdentifierName = function(e) {
|
|
3041
3041
|
if (e.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(e)) {
|
|
3042
3042
|
for (e.lastStringValue += rt(e.lastIntValue); this.regexp_eatRegExpIdentifierPart(e);) e.lastStringValue += rt(e.lastIntValue);
|
|
3043
3043
|
return !0;
|
|
3044
3044
|
}
|
|
3045
3045
|
return !1;
|
|
3046
|
-
},
|
|
3046
|
+
}, z.regexp_eatRegExpIdentifierStart = function(e) {
|
|
3047
3047
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3048
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
3048
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), wn(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3049
3049
|
};
|
|
3050
|
-
function
|
|
3050
|
+
function wn(e) {
|
|
3051
3051
|
return Ue(e, !0) || e === 36 || e === 95;
|
|
3052
3052
|
}
|
|
3053
|
-
|
|
3053
|
+
z.regexp_eatRegExpIdentifierPart = function(e) {
|
|
3054
3054
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3055
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
3055
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Tn(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3056
3056
|
};
|
|
3057
|
-
function
|
|
3057
|
+
function Tn(e) {
|
|
3058
3058
|
return We(e, !0) || e === 36 || e === 95 || e === 8204 || e === 8205;
|
|
3059
3059
|
}
|
|
3060
|
-
|
|
3060
|
+
z.regexp_eatAtomEscape = function(e) {
|
|
3061
3061
|
return this.regexp_eatBackReference(e) || this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e) || e.switchN && this.regexp_eatKGroupName(e) ? !0 : (e.switchU && (e.current() === 99 && e.raise("Invalid unicode escape"), e.raise("Invalid escape")), !1);
|
|
3062
|
-
},
|
|
3062
|
+
}, z.regexp_eatBackReference = function(e) {
|
|
3063
3063
|
var t = e.pos;
|
|
3064
3064
|
if (this.regexp_eatDecimalEscape(e)) {
|
|
3065
3065
|
var n = e.lastIntValue;
|
|
@@ -3068,34 +3068,34 @@ R.regexp_eatAtomEscape = function(e) {
|
|
|
3068
3068
|
e.pos = t;
|
|
3069
3069
|
}
|
|
3070
3070
|
return !1;
|
|
3071
|
-
},
|
|
3071
|
+
}, z.regexp_eatKGroupName = function(e) {
|
|
3072
3072
|
if (e.eat(107)) {
|
|
3073
3073
|
if (this.regexp_eatGroupName(e)) return e.backReferenceNames.push(e.lastStringValue), !0;
|
|
3074
3074
|
e.raise("Invalid named reference");
|
|
3075
3075
|
}
|
|
3076
3076
|
return !1;
|
|
3077
|
-
},
|
|
3077
|
+
}, z.regexp_eatCharacterEscape = function(e) {
|
|
3078
3078
|
return this.regexp_eatControlEscape(e) || this.regexp_eatCControlLetter(e) || this.regexp_eatZero(e) || this.regexp_eatHexEscapeSequence(e) || this.regexp_eatRegExpUnicodeEscapeSequence(e, !1) || !e.switchU && this.regexp_eatLegacyOctalEscapeSequence(e) || this.regexp_eatIdentityEscape(e);
|
|
3079
|
-
},
|
|
3079
|
+
}, z.regexp_eatCControlLetter = function(e) {
|
|
3080
3080
|
var t = e.pos;
|
|
3081
3081
|
if (e.eat(99)) {
|
|
3082
3082
|
if (this.regexp_eatControlLetter(e)) return !0;
|
|
3083
3083
|
e.pos = t;
|
|
3084
3084
|
}
|
|
3085
3085
|
return !1;
|
|
3086
|
-
},
|
|
3086
|
+
}, z.regexp_eatZero = function(e) {
|
|
3087
3087
|
return e.current() === 48 && !Ln(e.lookahead()) && (e.lastIntValue = 0, e.advance(), !0);
|
|
3088
|
-
},
|
|
3088
|
+
}, z.regexp_eatControlEscape = function(e) {
|
|
3089
3089
|
var t = e.current();
|
|
3090
3090
|
return t === 116 ? (e.lastIntValue = 9, e.advance(), !0) : t === 110 ? (e.lastIntValue = 10, e.advance(), !0) : t === 118 ? (e.lastIntValue = 11, e.advance(), !0) : t === 102 ? (e.lastIntValue = 12, e.advance(), !0) : t === 114 && (e.lastIntValue = 13, e.advance(), !0);
|
|
3091
|
-
},
|
|
3091
|
+
}, z.regexp_eatControlLetter = function(e) {
|
|
3092
3092
|
var t = e.current();
|
|
3093
|
-
return
|
|
3093
|
+
return En(t) ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
3094
3094
|
};
|
|
3095
|
-
function
|
|
3095
|
+
function En(e) {
|
|
3096
3096
|
return e >= 65 && e <= 90 || e >= 97 && e <= 122;
|
|
3097
3097
|
}
|
|
3098
|
-
|
|
3098
|
+
z.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
3099
3099
|
t === void 0 && (t = !1);
|
|
3100
3100
|
var n = e.pos, r = t || e.switchU;
|
|
3101
3101
|
if (e.eat(117)) {
|
|
@@ -3111,19 +3111,19 @@ R.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
|
3111
3111
|
}
|
|
3112
3112
|
return !0;
|
|
3113
3113
|
}
|
|
3114
|
-
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) &&
|
|
3114
|
+
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) && Dn(e.lastIntValue)) return !0;
|
|
3115
3115
|
r && e.raise("Invalid unicode escape"), e.pos = n;
|
|
3116
3116
|
}
|
|
3117
3117
|
return !1;
|
|
3118
3118
|
};
|
|
3119
|
-
function
|
|
3119
|
+
function Dn(e) {
|
|
3120
3120
|
return e >= 0 && e <= 1114111;
|
|
3121
3121
|
}
|
|
3122
|
-
|
|
3122
|
+
z.regexp_eatIdentityEscape = function(e) {
|
|
3123
3123
|
if (e.switchU) return this.regexp_eatSyntaxCharacter(e) ? !0 : e.eat(47) ? (e.lastIntValue = 47, !0) : !1;
|
|
3124
3124
|
var t = e.current();
|
|
3125
3125
|
return t !== 99 && (!e.switchN || t !== 107) && (e.lastIntValue = t, e.advance(), !0);
|
|
3126
|
-
},
|
|
3126
|
+
}, z.regexp_eatDecimalEscape = function(e) {
|
|
3127
3127
|
e.lastIntValue = 0;
|
|
3128
3128
|
var t = e.current();
|
|
3129
3129
|
if (t >= 49 && t <= 57) {
|
|
@@ -3134,51 +3134,51 @@ R.regexp_eatIdentityEscape = function(e) {
|
|
|
3134
3134
|
}
|
|
3135
3135
|
return !1;
|
|
3136
3136
|
};
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3137
|
+
var On = 0, kn = 1, An = 2;
|
|
3138
|
+
z.regexp_eatCharacterClassEscape = function(e) {
|
|
3139
3139
|
var t = e.current();
|
|
3140
|
-
if (jn(t)) return e.lastIntValue = -1, e.advance(),
|
|
3140
|
+
if (jn(t)) return e.lastIntValue = -1, e.advance(), kn;
|
|
3141
3141
|
var n = !1;
|
|
3142
3142
|
if (e.switchU && this.options.ecmaVersion >= 9 && ((n = t === 80) || t === 112)) {
|
|
3143
3143
|
e.lastIntValue = -1, e.advance();
|
|
3144
3144
|
var r;
|
|
3145
|
-
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r ===
|
|
3145
|
+
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r === An && e.raise("Invalid property name"), r;
|
|
3146
3146
|
e.raise("Invalid property name");
|
|
3147
3147
|
}
|
|
3148
|
-
return
|
|
3148
|
+
return On;
|
|
3149
3149
|
};
|
|
3150
3150
|
function jn(e) {
|
|
3151
3151
|
return e === 100 || e === 68 || e === 115 || e === 83 || e === 119 || e === 87;
|
|
3152
3152
|
}
|
|
3153
|
-
|
|
3153
|
+
z.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
3154
3154
|
var t = e.pos;
|
|
3155
3155
|
if (this.regexp_eatUnicodePropertyName(e) && e.eat(61)) {
|
|
3156
3156
|
var n = e.lastStringValue;
|
|
3157
3157
|
if (this.regexp_eatUnicodePropertyValue(e)) {
|
|
3158
3158
|
var r = e.lastStringValue;
|
|
3159
|
-
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r),
|
|
3159
|
+
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r), kn;
|
|
3160
3160
|
}
|
|
3161
3161
|
}
|
|
3162
3162
|
if (e.pos = t, this.regexp_eatLoneUnicodePropertyNameOrValue(e)) {
|
|
3163
3163
|
var i = e.lastStringValue;
|
|
3164
3164
|
return this.regexp_validateUnicodePropertyNameOrValue(e, i);
|
|
3165
3165
|
}
|
|
3166
|
-
return
|
|
3167
|
-
},
|
|
3166
|
+
return On;
|
|
3167
|
+
}, z.regexp_validateUnicodePropertyNameAndValue = function(e, t, n) {
|
|
3168
3168
|
$e(e.unicodeProperties.nonBinary, t) || e.raise("Invalid property name"), e.unicodeProperties.nonBinary[t].test(n) || e.raise("Invalid property value");
|
|
3169
|
-
},
|
|
3170
|
-
if (e.unicodeProperties.binary.test(t)) return
|
|
3171
|
-
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return
|
|
3169
|
+
}, z.regexp_validateUnicodePropertyNameOrValue = function(e, t) {
|
|
3170
|
+
if (e.unicodeProperties.binary.test(t)) return kn;
|
|
3171
|
+
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return An;
|
|
3172
3172
|
e.raise("Invalid property name");
|
|
3173
|
-
},
|
|
3173
|
+
}, z.regexp_eatUnicodePropertyName = function(e) {
|
|
3174
3174
|
var t = 0;
|
|
3175
3175
|
for (e.lastStringValue = ""; Mn(t = e.current());) e.lastStringValue += rt(t), e.advance();
|
|
3176
3176
|
return e.lastStringValue !== "";
|
|
3177
3177
|
};
|
|
3178
3178
|
function Mn(e) {
|
|
3179
|
-
return
|
|
3179
|
+
return En(e) || e === 95;
|
|
3180
3180
|
}
|
|
3181
|
-
|
|
3181
|
+
z.regexp_eatUnicodePropertyValue = function(e) {
|
|
3182
3182
|
var t = 0;
|
|
3183
3183
|
for (e.lastStringValue = ""; Nn(t = e.current());) e.lastStringValue += rt(t), e.advance();
|
|
3184
3184
|
return e.lastStringValue !== "";
|
|
@@ -3186,17 +3186,17 @@ R.regexp_eatUnicodePropertyValue = function(e) {
|
|
|
3186
3186
|
function Nn(e) {
|
|
3187
3187
|
return Mn(e) || Ln(e);
|
|
3188
3188
|
}
|
|
3189
|
-
|
|
3189
|
+
z.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
3190
3190
|
return this.regexp_eatUnicodePropertyValue(e);
|
|
3191
|
-
},
|
|
3191
|
+
}, z.regexp_eatCharacterClass = function(e) {
|
|
3192
3192
|
if (e.eat(91)) {
|
|
3193
3193
|
var t = e.eat(94), n = this.regexp_classContents(e);
|
|
3194
|
-
return e.eat(93) || e.raise("Unterminated character class"), t && n ===
|
|
3194
|
+
return e.eat(93) || e.raise("Unterminated character class"), t && n === An && e.raise("Negated character class may contain strings"), !0;
|
|
3195
3195
|
}
|
|
3196
3196
|
return !1;
|
|
3197
|
-
},
|
|
3198
|
-
return e.current() === 93 ?
|
|
3199
|
-
},
|
|
3197
|
+
}, z.regexp_classContents = function(e) {
|
|
3198
|
+
return e.current() === 93 ? kn : e.switchV ? this.regexp_classSetExpression(e) : (this.regexp_nonEmptyClassRanges(e), kn);
|
|
3199
|
+
}, z.regexp_nonEmptyClassRanges = function(e) {
|
|
3200
3200
|
for (; this.regexp_eatClassAtom(e);) {
|
|
3201
3201
|
var t = e.lastIntValue;
|
|
3202
3202
|
if (e.eat(45) && this.regexp_eatClassAtom(e)) {
|
|
@@ -3204,7 +3204,7 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3204
3204
|
e.switchU && (t === -1 || n === -1) && e.raise("Invalid character class"), t !== -1 && n !== -1 && t > n && e.raise("Range out of order in character class");
|
|
3205
3205
|
}
|
|
3206
3206
|
}
|
|
3207
|
-
},
|
|
3207
|
+
}, z.regexp_eatClassAtom = function(e) {
|
|
3208
3208
|
var t = e.pos;
|
|
3209
3209
|
if (e.eat(92)) {
|
|
3210
3210
|
if (this.regexp_eatClassEscape(e)) return !0;
|
|
@@ -3216,7 +3216,7 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3216
3216
|
}
|
|
3217
3217
|
var r = e.current();
|
|
3218
3218
|
return r !== 93 && (e.lastIntValue = r, e.advance(), !0);
|
|
3219
|
-
},
|
|
3219
|
+
}, z.regexp_eatClassEscape = function(e) {
|
|
3220
3220
|
var t = e.pos;
|
|
3221
3221
|
if (e.eat(98)) return e.lastIntValue = 8, !0;
|
|
3222
3222
|
if (e.switchU && e.eat(45)) return e.lastIntValue = 45, !0;
|
|
@@ -3225,14 +3225,14 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3225
3225
|
e.pos = t;
|
|
3226
3226
|
}
|
|
3227
3227
|
return this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e);
|
|
3228
|
-
},
|
|
3229
|
-
var t =
|
|
3228
|
+
}, z.regexp_classSetExpression = function(e) {
|
|
3229
|
+
var t = kn, n;
|
|
3230
3230
|
if (!this.regexp_eatClassSetRange(e)) {
|
|
3231
3231
|
if (n = this.regexp_eatClassSetOperand(e)) {
|
|
3232
|
-
n ===
|
|
3232
|
+
n === An && (t = An);
|
|
3233
3233
|
for (var r = e.pos; e.eatChars([38, 38]);) {
|
|
3234
3234
|
if (e.current() !== 38 && (n = this.regexp_eatClassSetOperand(e))) {
|
|
3235
|
-
n !==
|
|
3235
|
+
n !== An && (t = kn);
|
|
3236
3236
|
continue;
|
|
3237
3237
|
}
|
|
3238
3238
|
e.raise("Invalid character in character class");
|
|
@@ -3244,9 +3244,9 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3244
3244
|
}
|
|
3245
3245
|
for (;;) if (!this.regexp_eatClassSetRange(e)) {
|
|
3246
3246
|
if (n = this.regexp_eatClassSetOperand(e), !n) return t;
|
|
3247
|
-
n ===
|
|
3247
|
+
n === An && (t = An);
|
|
3248
3248
|
}
|
|
3249
|
-
},
|
|
3249
|
+
}, z.regexp_eatClassSetRange = function(e) {
|
|
3250
3250
|
var t = e.pos;
|
|
3251
3251
|
if (this.regexp_eatClassSetCharacter(e)) {
|
|
3252
3252
|
var n = e.lastIntValue;
|
|
@@ -3257,13 +3257,13 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3257
3257
|
e.pos = t;
|
|
3258
3258
|
}
|
|
3259
3259
|
return !1;
|
|
3260
|
-
},
|
|
3261
|
-
return this.regexp_eatClassSetCharacter(e) ?
|
|
3262
|
-
},
|
|
3260
|
+
}, z.regexp_eatClassSetOperand = function(e) {
|
|
3261
|
+
return this.regexp_eatClassSetCharacter(e) ? kn : this.regexp_eatClassStringDisjunction(e) || this.regexp_eatNestedClass(e);
|
|
3262
|
+
}, z.regexp_eatNestedClass = function(e) {
|
|
3263
3263
|
var t = e.pos;
|
|
3264
3264
|
if (e.eat(91)) {
|
|
3265
3265
|
var n = e.eat(94), r = this.regexp_classContents(e);
|
|
3266
|
-
if (e.eat(93)) return n && r ===
|
|
3266
|
+
if (e.eat(93)) return n && r === An && e.raise("Negated character class may contain strings"), r;
|
|
3267
3267
|
e.pos = t;
|
|
3268
3268
|
}
|
|
3269
3269
|
if (e.eat(92)) {
|
|
@@ -3272,7 +3272,7 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3272
3272
|
e.pos = t;
|
|
3273
3273
|
}
|
|
3274
3274
|
return null;
|
|
3275
|
-
},
|
|
3275
|
+
}, z.regexp_eatClassStringDisjunction = function(e) {
|
|
3276
3276
|
var t = e.pos;
|
|
3277
3277
|
if (e.eatChars([92, 113])) {
|
|
3278
3278
|
if (e.eat(123)) {
|
|
@@ -3282,13 +3282,13 @@ R.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3282
3282
|
e.pos = t;
|
|
3283
3283
|
}
|
|
3284
3284
|
return null;
|
|
3285
|
-
},
|
|
3286
|
-
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) ===
|
|
3285
|
+
}, z.regexp_classStringDisjunctionContents = function(e) {
|
|
3286
|
+
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) === An && (t = An);
|
|
3287
3287
|
return t;
|
|
3288
|
-
},
|
|
3288
|
+
}, z.regexp_classString = function(e) {
|
|
3289
3289
|
for (var t = 0; this.regexp_eatClassSetCharacter(e);) t++;
|
|
3290
|
-
return t === 1 ?
|
|
3291
|
-
},
|
|
3290
|
+
return t === 1 ? kn : An;
|
|
3291
|
+
}, z.regexp_eatClassSetCharacter = function(e) {
|
|
3292
3292
|
var t = e.pos;
|
|
3293
3293
|
if (e.eat(92)) return this.regexp_eatCharacterEscape(e) || this.regexp_eatClassSetReservedPunctuator(e) ? !0 : e.eat(98) ? (e.lastIntValue = 8, !0) : (e.pos = t, !1);
|
|
3294
3294
|
var n = e.current();
|
|
@@ -3300,24 +3300,24 @@ function Pn(e) {
|
|
|
3300
3300
|
function Fn(e) {
|
|
3301
3301
|
return e === 40 || e === 41 || e === 45 || e === 47 || e >= 91 && e <= 93 || e >= 123 && e <= 125;
|
|
3302
3302
|
}
|
|
3303
|
-
|
|
3303
|
+
z.regexp_eatClassSetReservedPunctuator = function(e) {
|
|
3304
3304
|
var t = e.current();
|
|
3305
3305
|
return In(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3306
3306
|
};
|
|
3307
3307
|
function In(e) {
|
|
3308
3308
|
return e === 33 || e === 35 || e === 37 || e === 38 || e === 44 || e === 45 || e >= 58 && e <= 62 || e === 64 || e === 96 || e === 126;
|
|
3309
3309
|
}
|
|
3310
|
-
|
|
3310
|
+
z.regexp_eatClassControlLetter = function(e) {
|
|
3311
3311
|
var t = e.current();
|
|
3312
3312
|
return Ln(t) || t === 95 ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
3313
|
-
},
|
|
3313
|
+
}, z.regexp_eatHexEscapeSequence = function(e) {
|
|
3314
3314
|
var t = e.pos;
|
|
3315
3315
|
if (e.eat(120)) {
|
|
3316
3316
|
if (this.regexp_eatFixedHexDigits(e, 2)) return !0;
|
|
3317
3317
|
e.switchU && e.raise("Invalid escape"), e.pos = t;
|
|
3318
3318
|
}
|
|
3319
3319
|
return !1;
|
|
3320
|
-
},
|
|
3320
|
+
}, z.regexp_eatDecimalDigits = function(e) {
|
|
3321
3321
|
var t = e.pos, n = 0;
|
|
3322
3322
|
for (e.lastIntValue = 0; Ln(n = e.current());) e.lastIntValue = 10 * e.lastIntValue + (n - 48), e.advance();
|
|
3323
3323
|
return e.pos !== t;
|
|
@@ -3325,7 +3325,7 @@ R.regexp_eatClassControlLetter = function(e) {
|
|
|
3325
3325
|
function Ln(e) {
|
|
3326
3326
|
return e >= 48 && e <= 57;
|
|
3327
3327
|
}
|
|
3328
|
-
|
|
3328
|
+
z.regexp_eatHexDigits = function(e) {
|
|
3329
3329
|
var t = e.pos, n = 0;
|
|
3330
3330
|
for (e.lastIntValue = 0; Rn(n = e.current());) e.lastIntValue = 16 * e.lastIntValue + zn(n), e.advance();
|
|
3331
3331
|
return e.pos !== t;
|
|
@@ -3336,7 +3336,7 @@ function Rn(e) {
|
|
|
3336
3336
|
function zn(e) {
|
|
3337
3337
|
return e >= 65 && e <= 70 ? 10 + (e - 65) : e >= 97 && e <= 102 ? 10 + (e - 97) : e - 48;
|
|
3338
3338
|
}
|
|
3339
|
-
|
|
3339
|
+
z.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
3340
3340
|
if (this.regexp_eatOctalDigit(e)) {
|
|
3341
3341
|
var t = e.lastIntValue;
|
|
3342
3342
|
if (this.regexp_eatOctalDigit(e)) {
|
|
@@ -3346,14 +3346,14 @@ R.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
|
3346
3346
|
return !0;
|
|
3347
3347
|
}
|
|
3348
3348
|
return !1;
|
|
3349
|
-
},
|
|
3349
|
+
}, z.regexp_eatOctalDigit = function(e) {
|
|
3350
3350
|
var t = e.current();
|
|
3351
3351
|
return Bn(t) ? (e.lastIntValue = t - 48, e.advance(), !0) : (e.lastIntValue = 0, !1);
|
|
3352
3352
|
};
|
|
3353
3353
|
function Bn(e) {
|
|
3354
3354
|
return e >= 48 && e <= 55;
|
|
3355
3355
|
}
|
|
3356
|
-
|
|
3356
|
+
z.regexp_eatFixedHexDigits = function(e, t) {
|
|
3357
3357
|
var n = e.pos;
|
|
3358
3358
|
e.lastIntValue = 0;
|
|
3359
3359
|
for (var r = 0; r < t; ++r) {
|
|
@@ -3543,7 +3543,7 @@ B.next = function(e) {
|
|
|
3543
3543
|
++this.pos;
|
|
3544
3544
|
var a = this.pos, o = this.readWord1();
|
|
3545
3545
|
this.containsEsc && this.unexpected(a);
|
|
3546
|
-
var s = this.regexpState ||= new
|
|
3546
|
+
var s = this.regexpState ||= new bn(this);
|
|
3547
3547
|
s.reset(n, i, o), this.validateRegExpFlags(s), this.validateRegExpPattern(s);
|
|
3548
3548
|
var c = null;
|
|
3549
3549
|
try {
|
|
@@ -3703,12 +3703,12 @@ B.tryReadTemplateToken = function() {
|
|
|
3703
3703
|
Position: at,
|
|
3704
3704
|
SourceLocation: ot,
|
|
3705
3705
|
getLineInfo: st,
|
|
3706
|
-
Node:
|
|
3706
|
+
Node: Yt,
|
|
3707
3707
|
TokenType: w,
|
|
3708
3708
|
tokTypes: k,
|
|
3709
3709
|
keywordTypes: Ge,
|
|
3710
|
-
TokContext:
|
|
3711
|
-
tokContexts:
|
|
3710
|
+
TokContext: Vt,
|
|
3711
|
+
tokContexts: L,
|
|
3712
3712
|
isIdentifierChar: We,
|
|
3713
3713
|
isIdentifierStart: Ue,
|
|
3714
3714
|
Token: Vn,
|
|
@@ -5470,7 +5470,7 @@ U.use = Ii, U.walkTokens = function(e, t) {
|
|
|
5470
5470
|
}, U.parseInline = Fi.parseInline, U.Parser = Ni, U.parser = Ni.parse, U.Renderer = ji, U.TextRenderer = Mi, U.Lexer = Ai, U.lexer = Ai.lex, U.Tokenizer = ki, U.Hooks = Pi, U.parse = U, U.options, U.setOptions, U.walkTokens, U.parseInline, Ni.parse, Ai.lex;
|
|
5471
5471
|
//#endregion
|
|
5472
5472
|
//#region docs/workflow-syntax.md?raw
|
|
5473
|
-
var Li = "# Workflow Documentation\n\nThis is the living documentation for workflow authors. It is organized using the four Diataxis modes:\n\n- **Tutorials** teach the shortest path to a working workflow.\n- **How-to guides** solve focused tasks.\n- **Reference** documents the accepted syntax.\n- **Explanation** describes execution and security decisions.\n\n## Tutorials\n\n### Your First Workflow\n\nCreate a draft in the authenticated workflow editor, or send the YAML to the API:\n\n```yaml\nname: Hello\n\non:\n generic: {}\n\nsteps:\n - id: greet\n name: Greet\n run: echo \"Hello ${inputs.name}\"\n```\n\nSave it, validate it, and publish it. Only published and enabled workflows receive webhook or scheduled events.\n\nThe `generic` provider accepts a JSON request body as `inputs`. For example:\n\n```bash\ncurl -X POST http://localhost:11235/webhooks/generic \\\n -H 'content-type: application/json' \\\n --data '{\"name\":\"Ada\"}'\n```\n\n### Build a GitHub Workflow\n\n```yaml\nname: Build\n\non:\n github:\n events: [push]\n owner: cloud-cli\n repo: on\n branches: [main]\n\nsteps:\n - id: checkout\n name: Checkout\n env:\n clone_url: ${inputs.clone_url}\n commit_sha: ${inputs.commit_sha}\n run: |\n git clone --depth 1 \"$clone_url\" .\n git checkout \"$commit_sha\"\n\n - id: test\n name: Test\n run: pnpm install && pnpm test\n```\n\nGitHub webhooks must be signed with the configured `GITHUB_WEBHOOK_SECRET`. The preprocessor exposes normalized inputs including `event`, `owner`, `repo`, `branch`, `tag`, `ref`, `full_name`, `clone_url`, `commit_sha`, `author`, `action`, `changes`, and the original `raw` body.\n\n## How-To Guides\n\n### Reference Another Environment Value\n\nEnvironment entries are evaluated from top to bottom. Earlier values are available through `env` to later values:\n\n```yaml\nenv:\n image: ${inputs.repo}\n image_tag: ${env.image}:latest\n artifact_name: ${env.image_tag}-${inputs.commit_sha}\n```\n\nWorkflow-level values are available to every step. Step-level `env` values are evaluated after workflow-level values and can override them for that step.\n\nUse `${inputs.name}`, `${env.NAME}`, `${secrets.NAME}`, and `${steps.step_id.outputs.value}` where the value is available. A value without `${...}` remains literal text.\n\n### Run a Container with a Host Volume\n\nUse `image` with `volumes`. A volume is passed directly to `docker run` as a `-v` mapping:\n\n```yaml\nsteps:\n - id: sign\n name: Sign release\n image: alpine:latest\n volumes:\n - /var/lib/runner/secrets-store:/secrets:ro\n run: |\n ./sign.sh /secrets/signing.key dist/release.tar.gz\n```\n\nThe source path is on the worker host. The destination path is inside the container. Use absolute host paths when a specific host directory is required. The workflow must be trusted because volume mappings can expose host data to a container.\n\nA single string is also accepted:\n\n```yaml\nvolumes: /var/lib/runner/secrets-store:/secrets:ro\n```\n\n### Pass Additional Docker Arguments\n\nUse `dockerArgs` for additional arguments to `docker run`, before the image name:\n\n```yaml\nsteps:\n - id: build\n image: docker:cli\n dockerArgs:\n - --network=host\n - --user=1000:1000\n run: docker build -t example:latest .\n```\n\nArguments are not interpreted or shell-expanded by the runner. They are passed as individual Docker CLI arguments.\n\n### Use a Matrix\n\nKeep the matrix in the workflow definition:\n\n```yaml\nname: Package\n\nmatrix:\n node: [18, 20]\n os: [ubuntu, alpine]\n\non:\n generic: {}\n\nenv:\n node_version: ${env.MATRIX_NODE}\n\nsteps:\n - id: package\n image: node:${env.MATRIX_NODE}\n run: npm pack\n```\n\nThe runner creates one job for every Cartesian combination. The example creates four jobs. Each variant receives `MATRIX_NODE` and `MATRIX_OS` environment variables.\n\n### Add a Scheduled Trigger\n\n```yaml\non:\n schedule:\n - id: nightly\n cron: '0 2 * * *'\n timezone: Europe/Berlin\n```\n\nCron expressions have five fields: minute, hour, day of month, month, and day of week. The scheduler uses the declared IANA timezone.\n\nSolar triggers use `sunrise` or `sunset` and geographic coordinates:\n\n```yaml\non:\n solar:\n - id: morning\n event: sunrise\n latitude: 52.52\n longitude: 13.405\n offset: +15m\n```\n\n### Use Secrets\n\nCreate a secret in the management UI or with the API, then reference it in environment values:\n\n```yaml\nsteps:\n - id: publish\n env:\n npm_token: ${secrets.NPM_TOKEN}\n run: npm publish\n```\n\nSecret values are delivered to a worker after it claims the job. Do not write them into reports or artifacts.\n\n## Reference\n\n### Top-Level Workflow Fields\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `name` | string | Required human-readable workflow name. It also supplies the ID when `id` is absent. |\n| `id` | string | Optional identifier. It is normalized to lowercase kebab case. |\n| `on` | object | Required trigger configuration. |\n| `env` | object | Workflow environment values, evaluated in declaration order. |\n| `matrix` | object | Matrix dimensions. Each value is an array of strings, numbers, or booleans. |\n| `concurrency` | object | Optional concurrency group and cancellation policy. |\n| `tags` | string[] | Worker capability tags required by the job. |\n| `steps` | object[] | Required non-empty ordered list of steps. |\n| `retries` | integer | Additional attempts for a failed step. Must be zero or greater. |\n\n`includes` and workflow-to-workflow imports are not supported. Workflow definitions are stored as complete database revisions. Reusable behavior should be implemented through the planned step reuse mechanism rather than filesystem imports.\n\n### Triggers\n\nThe first non-`schedule`/`solar` key in `on` is the provider trigger. Supported providers include `generic` and `github`.\n\n#### GitHub Trigger Filters\n\n| Field | Type | Behavior |\n| --- | --- | --- |\n| `events` | string[] | Exact event names such as `push` or `pull_request`. |\n| `owner` | string or string[] | Exact repository owner. |\n| `repo` | string or string[] | Exact repository name. |\n| `name` | string or string[] | Exact `owner/repo` name. |\n| `branches` | string or string[] | Glob patterns matching normalized branches or tags. |\n| `refs` | string or string[] | Alias for branch/ref matching. |\n| `tag` | boolean | Requires a tag push when true, a non-tag event when false. |\n| `tags` | string[] | Regular expressions matched against the tag value. |\n| `paths` | string[] | Glob patterns matched against changed files. |\n| `if` | string or string[] | Safe JavaScript condition evaluated after provider filters. |\n\nConfigured fields are combined with AND. Multiple values within a field are combined with OR. Negated `!value` entries are supported by exact-value filters.\n\n#### Schedule Trigger\n\n```yaml\nschedule:\n - id: hourly\n cron: '0 * * * *'\n timezone: UTC\n```\n\n#### Solar Trigger\n\n```yaml\nsolar:\n - id: sunrise-build\n event: sunrise\n latitude: 52.52\n longitude: 13.405\n timezone: Europe/Berlin\n offset: -15m\n```\n\n### Environment and Expressions\n\nInterpolated strings use standard JavaScript template expressions inside `${...}`. The safe evaluator supports literals, property access, arithmetic, comparisons, boolean operators, ternaries, arrays, objects, and these helpers:\n\n```text\nString(value)\nNumber(value)\nBoolean(value)\nJSON.parse(value)\nJSON.stringify(value)\n```\n\nAvailable context objects are:\n\n| Object | Available data |\n| --- | --- |\n| `inputs` | Trigger payload and normalized provider inputs. |\n| `env` | Runner environment plus earlier workflow or step environment entries. |\n| `secrets` | Decrypted job-scoped secrets. |\n| `steps` | Earlier step statuses, exit codes, and outputs. |\n| `files` | Workspace-scoped `exists`, `readFile`, and `join` helpers for `eval:` steps. |\n\nExpressions cannot access JavaScript constructors or prototypes. Shell commands are not expression-evaluated; only declared interpolation fields are evaluated.\n\n### Steps\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `id` | string | Stable identifier used by `steps.<id>`. |\n| `name` | string | Display name. Defaults to `id`. |\n| `run` | string | Shell command or script. Mutually exclusive with `eval`. |\n| `eval` | string | In-process safe expression. Mutually exclusive with `run`. |\n| `env` | object | Step environment, evaluated after workflow environment. |\n| `image` | string | Docker image. Selects container execution for the step. |\n| `volumes` | string or string[] | Docker `-v` mappings. |\n| `dockerArgs` | string[] | Additional raw arguments for `docker run`. |\n| `timeoutMs` | positive integer | Maximum step runtime. Defaults to 30 seconds. |\n| `if` | string | Safe condition. False conditions produce a skipped step. |\n\n`run` steps execute through the selected worker driver. With `image`, the command runs as `sh -c` inside Docker. Without `image`, it runs through the worker shell. `eval` steps run inside the worker process and can produce structured outputs for later steps.\n\n### Management and API\n\nWorkflow definitions are drafted, validated, published, enabled, and deleted through the authenticated management UI or these endpoints:\n\n```text\nPOST /api/workflows/validate\nGET /api/workflows\nGET /api/workflows/:id\nPUT /api/workflows/:id\nPOST /api/workflows/:id/publish\nDELETE /api/workflows/:id\n```\n\nOnly published workflows with `enabled: true` are matched for incoming triggers. Saving a workflow creates a new immutable revision. Existing jobs continue to use the revision recorded when they were created.\n\n## Explanation\n\n### Why Workflow YAML Lives in the Database\n\nThe server stores source YAML and normalized revisions in the database. Workers are stateless: they fetch the referenced revision when claiming a job and do not read workflow files from their local filesystem. This keeps every worker on the same definition and makes published revisions reproducible.\n\n### Why Matrix Expansion Happens at Trigger Time\n\nThe stored revision remains one canonical workflow. When a trigger matches, the server creates one queue job per matrix combination. The payload records the matrix context, and the worker resolves that same variant before execution. This avoids storing duplicate workflow revisions while keeping each job independently observable.\n\n### Docker Volumes and Trust\n\n`volumes` and `dockerArgs` are intentionally powerful options. A host volume can expose credentials or signing material, and Docker arguments can change networking, users, capabilities, or isolation. Only trusted administrators should publish workflows using these fields. The runner does not copy, inspect, or redact files mounted into containers.\n\n### Reuse and Imports\n\nFilesystem imports were removed because workers no longer load workflow files. Future step reuse should operate on database-owned definitions or explicit reusable step mechanisms, keeping revisioning and authorization visible to the control plane.\n", Ri = "\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M9.6 9a2.5 2.5 0 1 1 4.2 1.8c-1.2 1-1.8 1.4-1.8 2.7\"></path>\n <path d=\"M12 17h.01\"></path>\n </svg>", zi = "\n :root { color-scheme: dark; }\n * { box-sizing: border-box; }\n body { margin: 0; background: #030712; color: #e5e7eb; font-family: ui-sans-serif, system-ui, sans-serif; }\n main { max-width: 78rem; margin: 0 auto; padding: 2rem 1rem 5rem; }\n article { max-width: 54rem; margin: 0 auto; line-height: 1.7; }\n h1, h2, h3 { color: #f9fafb; line-height: 1.2; letter-spacing: -0.02em; }\n h1 { font-size: 2.25rem; margin: 0 0 1rem; }\n h2 { border-top: 1px solid #1f2937; margin-top: 3rem; padding-top: 1.5rem; font-size: 1.6rem; }\n h3 { margin-top: 2rem; font-size: 1.15rem; }\n p, li { color: #cbd5e1; }\n a { color: #93c5fd; }\n code { border-radius: .35rem; background: #111827; color: #bfdbfe; padding: .12rem .35rem; font-size: .9em; }\n pre { overflow-x: auto; border: 1px solid #1f2937; border-radius: .75rem; background: #0b1120; padding: 1rem; }\n pre code { background: transparent; padding: 0; color: #d1d5db; }\n table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; margin: 1rem 0; }\n th, td { border-bottom: 1px solid #1f2937; padding: .65rem .75rem; text-align: left; vertical-align: top; }\n th { color: #f9fafb; background: #111827; }\n blockquote { border-left: 3px solid #6366f1; margin-left: 0; padding-left: 1rem; color: #94a3b8; }\n .topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; max-width: 78rem; margin: 0 auto; padding: 1rem; }\n .back { display: inline-flex; align-items: center; gap: .45rem; color: #94a3b8; text-decoration: none; font-size: .85rem; }\n .back:hover, .back:focus-visible { color: #f9fafb; }\n @media (min-width: 640px) { main { padding: 3rem 1.5rem 6rem; } }\n";
|
|
5473
|
+
var Li = "# Workflow Documentation\n\nThis is the living documentation for workflow authors. It is organized using the four Diataxis modes:\n\n- **Tutorials** teach the shortest path to a working workflow.\n- **How-to guides** solve focused tasks.\n- **Reference** documents the accepted syntax.\n- **Explanation** describes execution and security decisions.\n\n## Tutorials\n\n### Your First Workflow\n\nCreate a draft in the authenticated workflow editor, or send the YAML to the API:\n\n```yaml\nname: Hello\n\non:\n generic: {}\n\nsteps:\n - id: greet\n name: Greet\n run: echo \"Hello ${inputs.name}\"\n```\n\nSave it, validate it, and publish it. Only published and enabled workflows receive webhook or scheduled events.\n\nThe `generic` provider accepts a JSON request body as `inputs`. For example:\n\n```bash\ncurl -X POST http://localhost:11235/webhooks/generic \\\n -H 'content-type: application/json' \\\n --data '{\"name\":\"Ada\"}'\n```\n\n### Build a GitHub Workflow\n\n```yaml\nname: Build\n\non:\n github:\n events: [push]\n owner: cloud-cli\n repo: on\n branches: [main]\n\nsteps:\n - id: checkout\n name: Checkout\n env:\n clone_url: ${inputs.clone_url}\n commit_sha: ${inputs.commit_sha}\n run: |\n git clone --depth 1 \"$clone_url\" .\n git checkout \"$commit_sha\"\n\n - id: test\n name: Test\n run: pnpm install && pnpm test\n```\n\nGitHub webhooks must be signed with the configured `GITHUB_WEBHOOK_SECRET`. The preprocessor exposes normalized inputs including `event`, `owner`, `repo`, `branch`, `tag`, `ref`, `full_name`, `clone_url`, `commit_sha`, `author`, `action`, `changes`, and the original `raw` body.\n\n## How-To Guides\n\n### Reference Another Environment Value\n\nEnvironment entries are evaluated from top to bottom. Earlier values are available through `env` to later values:\n\n```yaml\nenv:\n image: ${inputs.repo}\n image_tag: ${env.image}:latest\n artifact_name: ${env.image_tag}-${inputs.commit_sha}\n```\n\nWorkflow-level values are available to every step. Step-level `env` values are evaluated after workflow-level values and can override them for that step.\n\nUse `${inputs.name}`, `${env.NAME}`, `${secrets.NAME}`, and `${steps.step_id.outputs.value}` where the value is available. A value without `${...}` remains literal text.\n\n### Run a Container with a Host Volume\n\nUse `image` with `volumes`. A volume is passed directly to `docker run` as a `-v` mapping:\n\n```yaml\nsteps:\n - id: sign\n name: Sign release\n image: alpine:latest\n volumes:\n - /var/lib/runner/secrets-store:/secrets:ro\n run: |\n ./sign.sh /secrets/signing.key dist/release.tar.gz\n```\n\nThe source path is on the worker host. The destination path is inside the container. Use absolute host paths when a specific host directory is required. The workflow must be trusted because volume mappings can expose host data to a container.\n\nA single string is also accepted:\n\n```yaml\nvolumes: /var/lib/runner/secrets-store:/secrets:ro\n```\n\n### Pass Additional Docker Arguments\n\nUse `dockerArgs` for additional arguments to `docker run`, before the image name:\n\n```yaml\nsteps:\n - id: build\n image: docker:cli\n dockerArgs:\n - --network=host\n - --user=1000:1000\n run: docker build -t example:latest .\n```\n\nArguments are not interpreted or shell-expanded by the runner. They are passed as individual Docker CLI arguments.\n\n### Use a Matrix\n\nKeep the matrix in the workflow definition:\n\n```yaml\nname: Package\n\nmatrix:\n node: [18, 20]\n os: [ubuntu, alpine]\n\non:\n generic: {}\n\nenv:\n node_version: ${env.MATRIX_NODE}\n\nsteps:\n - id: package\n image: node:${env.MATRIX_NODE}\n run: npm pack\n```\n\nThe runner creates one job for every Cartesian combination. The example creates four jobs. Each variant receives `MATRIX_NODE` and `MATRIX_OS` environment variables.\n\n### Add a Scheduled Trigger\n\n```yaml\non:\n schedule:\n - id: nightly\n cron: '0 2 * * *'\n timezone: Europe/Berlin\n```\n\nCron expressions have five fields: minute, hour, day of month, month, and day of week. The scheduler uses the declared IANA timezone.\n\nSolar triggers use `sunrise` or `sunset` and geographic coordinates:\n\n```yaml\non:\n solar:\n - id: morning\n event: sunrise\n latitude: 52.52\n longitude: 13.405\n offset: +15m\n```\n\n### Use Secrets\n\nCreate a secret in the management UI or with the API, then reference it in environment values:\n\n```yaml\nsteps:\n - id: publish\n env:\n npm_token: ${secrets.NPM_TOKEN}\n run: npm publish\n```\n\nSecret values are delivered to a worker after it claims the job. Do not write them into reports or artifacts.\n\n## Reference\n\n### Top-Level Workflow Fields\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `name` | string | Required human-readable workflow name shown in the UI and reports. |\n| `id` | string | Optional identifier used when deriving an ID outside the management API. The management API ID is authoritative after creation. |\n| `on` | object | Required trigger configuration. |\n| `env` | object | Workflow environment values, evaluated in declaration order. |\n| `matrix` | object | Matrix dimensions. Each value is an array of strings, numbers, or booleans. |\n| `concurrency` | object | Optional concurrency group and cancellation policy. |\n| `tags` | string[] | Worker capability tags required by the job. |\n| `steps` | object[] | Required non-empty ordered list of steps. |\n| `retries` | integer | Additional attempts for a failed step. Must be zero or greater. |\n\n`includes` and workflow-to-workflow imports are not supported. Workflow definitions are stored as complete database revisions. Reusable behavior should be implemented through the planned step reuse mechanism rather than filesystem imports.\n\n### Triggers\n\nThe first non-`schedule`/`solar` key in `on` is the provider trigger. Supported providers include `generic` and `github`.\n\n#### GitHub Trigger Filters\n\n| Field | Type | Behavior |\n| --- | --- | --- |\n| `events` | string[] | Exact event names such as `push` or `pull_request`. |\n| `owner` | string or string[] | Exact repository owner. |\n| `repo` | string or string[] | Exact repository name. |\n| `name` | string or string[] | Exact `owner/repo` name. |\n| `branches` | string or string[] | Glob patterns matching normalized branches or tags. |\n| `refs` | string or string[] | Alias for branch/ref matching. |\n| `tag` | boolean | Requires a tag push when true, a non-tag event when false. |\n| `tags` | string[] | Regular expressions matched against the tag value. |\n| `paths` | string[] | Glob patterns matched against changed files. |\n| `if` | string or string[] | Safe JavaScript condition evaluated after provider filters. |\n\nConfigured fields are combined with AND. Multiple values within a field are combined with OR. Negated `!value` entries are supported by exact-value filters.\n\n#### Schedule Trigger\n\n```yaml\nschedule:\n - id: hourly\n cron: '0 * * * *'\n timezone: UTC\n```\n\n#### Solar Trigger\n\n```yaml\nsolar:\n - id: sunrise-build\n event: sunrise\n latitude: 52.52\n longitude: 13.405\n timezone: Europe/Berlin\n offset: -15m\n```\n\n### Environment and Expressions\n\nInterpolated strings use standard JavaScript template expressions inside `${...}`. The safe evaluator supports literals, property access, arithmetic, comparisons, boolean operators, ternaries, arrays, objects, and these helpers:\n\n```text\nString(value)\nNumber(value)\nBoolean(value)\nJSON.parse(value)\nJSON.stringify(value)\n```\n\nAvailable context objects are:\n\n| Object | Available data |\n| --- | --- |\n| `inputs` | Trigger payload and normalized provider inputs. |\n| `env` | Runner environment plus earlier workflow or step environment entries. |\n| `secrets` | Decrypted job-scoped secrets. |\n| `steps` | Earlier step statuses, exit codes, and outputs. |\n| `files` | Workspace-scoped `exists`, `readFile`, and `join` helpers for `eval:` steps. |\n\nExpressions cannot access JavaScript constructors or prototypes. Shell commands are not expression-evaluated; only declared interpolation fields are evaluated.\n\n### Steps\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `id` | string | Stable identifier used by `steps.<id>`. |\n| `name` | string | Display name. Defaults to `id`. |\n| `run` | string | Shell command or script. Mutually exclusive with `eval`. |\n| `eval` | string | In-process safe expression. Mutually exclusive with `run`. |\n| `env` | object | Step environment, evaluated after workflow environment. |\n| `image` | string | Docker image. Selects container execution for the step. |\n| `volumes` | string or string[] | Docker `-v` mappings. |\n| `dockerArgs` | string[] | Additional raw arguments for `docker run`. |\n| `timeoutMs` | positive integer | Maximum step runtime. Defaults to 30 seconds. |\n| `if` | string | Safe condition. False conditions produce a skipped step. |\n\n`run` steps execute through the selected worker driver. With `image`, the command runs as `sh -c` inside Docker. Without `image`, it runs through the worker shell. `eval` steps run inside the worker process and can produce structured outputs for later steps.\n\n### Management and API\n\nWorkflow definitions are drafted, validated, published, enabled, and deleted through the authenticated management UI or these endpoints:\n\n```text\nPOST /api/workflows/validate\nGET /api/workflows\nGET /api/workflows/:id\nPUT /api/workflows/:id\nPOST /api/workflows/:id/publish\nDELETE /api/workflows/:id\n```\n\nOnly published workflows with `enabled: true` are matched for incoming triggers. Saving a workflow creates a new immutable revision. Existing jobs continue to use the revision recorded when they were created.\n\n## Explanation\n\n### Why Workflow YAML Lives in the Database\n\nThe server stores source YAML and normalized revisions in the database. Workers are stateless: they fetch the referenced revision when claiming a job and do not read workflow files from their local filesystem. This keeps every worker on the same definition and makes published revisions reproducible.\n\n### Why Matrix Expansion Happens at Trigger Time\n\nThe stored revision remains one canonical workflow. When a trigger matches, the server creates one queue job per matrix combination. The payload records the matrix context, and the worker resolves that same variant before execution. This avoids storing duplicate workflow revisions while keeping each job independently observable.\n\n### Docker Volumes and Trust\n\n`volumes` and `dockerArgs` are intentionally powerful options. A host volume can expose credentials or signing material, and Docker arguments can change networking, users, capabilities, or isolation. Only trusted administrators should publish workflows using these fields. The runner does not copy, inspect, or redact files mounted into containers.\n\n### Reuse and Imports\n\nFilesystem imports were removed because workers no longer load workflow files. Future step reuse should operate on database-owned definitions or explicit reusable step mechanisms, keeping revisioning and authorization visible to the control plane.\n", Ri = "\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M9.6 9a2.5 2.5 0 1 1 4.2 1.8c-1.2 1-1.8 1.4-1.8 2.7\"></path>\n <path d=\"M12 17h.01\"></path>\n </svg>", zi = "\n :root { color-scheme: dark; }\n * { box-sizing: border-box; }\n body { margin: 0; background: #030712; color: #e5e7eb; font-family: ui-sans-serif, system-ui, sans-serif; }\n main { max-width: 78rem; margin: 0 auto; padding: 2rem 1rem 5rem; }\n article { max-width: 54rem; margin: 0 auto; line-height: 1.7; }\n h1, h2, h3 { color: #f9fafb; line-height: 1.2; letter-spacing: -0.02em; }\n h1 { font-size: 2.25rem; margin: 0 0 1rem; }\n h2 { border-top: 1px solid #1f2937; margin-top: 3rem; padding-top: 1.5rem; font-size: 1.6rem; }\n h3 { margin-top: 2rem; font-size: 1.15rem; }\n p, li { color: #cbd5e1; }\n a { color: #93c5fd; }\n code { border-radius: .35rem; background: #111827; color: #bfdbfe; padding: .12rem .35rem; font-size: .9em; }\n pre { overflow-x: auto; border: 1px solid #1f2937; border-radius: .75rem; background: #0b1120; padding: 1rem; }\n pre code { background: transparent; padding: 0; color: #d1d5db; }\n table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; margin: 1rem 0; }\n th, td { border-bottom: 1px solid #1f2937; padding: .65rem .75rem; text-align: left; vertical-align: top; }\n th { color: #f9fafb; background: #111827; }\n blockquote { border-left: 3px solid #6366f1; margin-left: 0; padding-left: 1rem; color: #94a3b8; }\n .topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; max-width: 78rem; margin: 0 auto; padding: 1rem; }\n .back { display: inline-flex; align-items: center; gap: .45rem; color: #94a3b8; text-decoration: none; font-size: .85rem; }\n .back:hover, .back:focus-visible { color: #f9fafb; }\n @media (min-width: 640px) { main { padding: 3rem 1.5rem 6rem; } }\n";
|
|
5474
5474
|
function Bi(e = !1) {
|
|
5475
5475
|
let t = U.parse(Li, { async: !1 });
|
|
5476
5476
|
return `<!doctype html>
|
|
@@ -5489,7 +5489,7 @@ function Bi(e = !1) {
|
|
|
5489
5489
|
}
|
|
5490
5490
|
//#endregion
|
|
5491
5491
|
//#region src/workflows-ui.html?raw
|
|
5492
|
-
var Vi = "<!doctype html>\n<html lang=\"en\" class=\"dark\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"theme-color\" content=\"#030712\" />\n <meta name=\"mobile-web-app-capable\" content=\"yes\" />\n <link rel=\"manifest\" href=\"/manifest.webmanifest\" />\n <link rel=\"icon\" href=\"/app-icon.svg\" type=\"image/svg+xml\" />\n <title>Runner Workflow Management</title>\n <script type=\"importmap\">\n { \"imports\": { \"@li3/\": \"https://cdn.li3.dev/@li3/\" } }\n <\/script>\n <style>\n body[data-page='list'] .editor-panel {\n display: none;\n }\n body[data-page='editor'] .workflow-list,\n body[data-page='editor'] .secrets-panel {\n display: none;\n }\n </style>\n </head>\n <body data-page=\"__WORKFLOW_PAGE__\" class=\"min-h-screen bg-gray-950 p-4 font-sans text-gray-100 md:p-6\">\n <link rel=\"component\" href=\"https://sodium.static.apphor.de/code-editor.html\" />\n <link rel=\"component\" href=\"https://sodium.static.apphor.de/lucide-icon.html\" />\n\n <template app>\n <main class=\"mx-auto max-w-6xl space-y-5\">\n <header class=\"flex flex-col gap-4 border-b border-gray-800 pb-5 sm:flex-row sm:items-end sm:justify-between\">\n <div class=\"flex items-start gap-3\">\n <a\n href=\"/runs\"\n aria-label=\"Back to dashboard\"\n class=\"mt-1 rounded-lg border border-gray-800 bg-gray-900 p-2 text-gray-400 transition hover:border-indigo-500/60 hover:text-indigo-300\"\n >\n <lucide-icon icon=\"arrow-left\" size=\"17\"></lucide-icon>\n </a>\n <div>\n <p class=\"text-xs font-semibold uppercase tracking-[0.18em] text-indigo-400\">Runner engine</p>\n <h1 class=\"mt-1 text-2xl font-bold tracking-tight text-white\">Workflow control room</h1>\n <p class=\"mt-1 text-sm text-gray-400\">Draft, validate, and publish revisioned YAML definitions.</p>\n </div>\n </div>\n <a\n href=\"/workflows/new\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg bg-indigo-500 px-4 py-2.5 text-sm font-semibold text-white shadow-lg shadow-indigo-950/40 transition hover:bg-indigo-400\"\n >\n <lucide-icon icon=\"plus\" size=\"16\"></lucide-icon>\n New workflow\n </a>\n <a href=\"/help\" class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-900 px-3 py-2.5 text-sm font-medium text-gray-300 outline-none transition hover:border-indigo-500/50 hover:text-indigo-200 focus-visible:ring-2 focus-visible:ring-indigo-400/60\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\"></circle><path d=\"M9.6 9a2.5 2.5 0 1 1 4.2 1.8c-1.2 1-1.8 1.4-1.8 2.7\"></path><path d=\"M12 17h.01\"></path></svg>\n Help\n </a>\n </header>\n\n <template if=\"notice\">\n <div\n role=\"status\"\n class=\"flex items-center gap-2 rounded-lg border px-3 py-2.5 text-sm\"\n bind-class=\"noticeError ? 'border-rose-500/40.bg-rose-500/10.text-rose-100' : 'border-emerald-500/40.bg-emerald-500/10.text-emerald-100'\"\n >\n <lucide-icon bind-icon=\"noticeError ? 'circle-alert' : 'circle-check'\" size=\"17\"></lucide-icon>\n <span>{{ notice }}</span>\n </div>\n </template>\n\n <section id=\"workflow-layout\" class=\"space-y-5\">\n <nav class=\"workflow-list rounded-2xl border border-gray-800 bg-gray-900/80 p-4 shadow-xl shadow-black/10\" aria-labelledby=\"workflow-list-title\">\n <div class=\"mb-4 flex items-end justify-between gap-3 border-b border-gray-800 pb-4\">\n <div>\n <p class=\"text-[11px] font-semibold uppercase tracking-[0.18em] text-indigo-400\">Definitions</p>\n <h2 id=\"workflow-list-title\" class=\"mt-1 text-lg font-semibold text-white\">Workflows</h2>\n </div>\n <span class=\"rounded-full border border-gray-700 bg-gray-950 px-2.5 py-1 text-xs font-mono text-gray-400\" aria-label=\"Workflow count\">\n {{ workflows.length }}\n </span>\n </div>\n <ul class=\"grid gap-2\" aria-label=\"Workflow definitions\">\n <template for=\"workflow of workflows\">\n <li>\n <a\n attr-href=\"'/workflows/' + workflow.id\"\n class=\"group flex min-h-16 items-center gap-3 rounded-xl border border-gray-800 bg-gray-950/50 px-3.5 py-3 text-left text-sm text-gray-300 outline-none transition hover:border-indigo-500/50 hover:bg-indigo-500/10 focus-visible:border-indigo-400 focus-visible:ring-2 focus-visible:ring-indigo-400/50\"\n >\n <span class=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-800 text-gray-400 transition group-hover:bg-indigo-500/15 group-hover:text-indigo-300\">\n <lucide-icon icon=\"workflow\" size=\"17\"></lucide-icon>\n </span>\n <span class=\"min-w-0 flex-1\">\n <span class=\"block truncate font-medium text-gray-100\">{{ workflow.name }}</span>\n <span class=\"mt-0.5 block truncate font-mono text-[11px] text-gray-500\">{{ workflow.id }}</span>\n </span>\n <span\n class=\"rounded-full border px-2 py-1 text-[10px] font-semibold uppercase tracking-wide\"\n bind-class=\"workflow.status === 'published' ? 'border-emerald-500/30.bg-emerald-500/10.text-emerald-300' : workflow.status === 'archived' ? 'border-gray-700.bg-gray-800.text-gray-500' : 'border-amber-500/30.bg-amber-500/10.text-amber-300'\"\n >{{ workflow.status }}</span>\n <lucide-icon icon=\"arrow-up-right\" size=\"16\" class=\"shrink-0 text-gray-600 transition group-hover:text-indigo-300\"></lucide-icon>\n </a>\n </li>\n </template>\n </ul>\n <div class=\"rounded-xl border border-dashed border-gray-700 px-4 py-8 text-center\" class-hidden=\"workflows.length > 0\">\n <lucide-icon icon=\"workflow\" size=\"22\" class=\"mx-auto text-gray-600\"></lucide-icon>\n <p class=\"mt-2 text-sm font-medium text-gray-300\">No workflows yet</p>\n <p class=\"mt-1 text-xs text-gray-500\">Create a definition to start automating jobs.</p>\n </div>\n </nav>\n\n <section\n class=\"editor-panel overflow-hidden rounded-xl border border-gray-800 bg-gray-900/80 shadow-xl shadow-black/10\"\n >\n <div class=\"border-b border-gray-800 px-4 pt-3 sm:px-5\">\n <a\n href=\"/workflows\"\n class=\"inline-flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium text-gray-400 outline-none transition hover:bg-gray-800 hover:text-gray-100 focus-visible:ring-2 focus-visible:ring-indigo-400/60\"\n >\n <lucide-icon icon=\"arrow-left\" size=\"14\"></lucide-icon>\n Back to workflows\n </a>\n </div>\n <div class=\"border-b border-gray-800 bg-gray-900 px-4 py-4 sm:px-5\">\n <div class=\"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between\">\n <label class=\"block max-w-xl flex-1 text-xs font-semibold uppercase tracking-wider text-gray-400\"\n >Workflow ID\n <input\n bind-value=\"workflowId\"\n on-input=\"setWorkflowId($event)\"\n class=\"mt-2 w-full rounded-lg border border-gray-700 bg-gray-950 px-3 py-2.5 font-mono text-sm normal-case tracking-normal text-white outline-none transition focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20\"\n placeholder=\"derived-from-workflow-name\"\n />\n </label>\n <label class=\"inline-flex items-center gap-2 text-sm text-gray-300\">\n <input\n type=\"checkbox\"\n bind-checked=\"enabled\"\n on-change=\"setEnabled($event)\"\n class=\"h-4 w-4 rounded border-gray-700 bg-gray-950 text-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n />\n Enabled\n </label>\n <div class=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n aria-label=\"Validate workflow\"\n title=\"Validate workflow\"\n on-click=\"validate()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-gray-700 px-3 py-2.5 text-sm font-medium text-gray-200 transition hover:border-gray-500 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"badge-check\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Validate</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Save workflow draft\"\n title=\"Save workflow draft\"\n on-click=\"save()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg bg-indigo-500 px-3 py-2.5 text-sm font-semibold text-white transition hover:bg-indigo-400 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"save\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Save draft</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Publish workflow\"\n title=\"Publish workflow\"\n on-click=\"publish()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-emerald-500/50 px-3 py-2.5 text-sm font-medium text-emerald-300 transition hover:bg-emerald-500/10 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"rocket\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Publish</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Delete workflow\"\n title=\"Delete workflow\"\n on-click=\"remove()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-rose-500/50 px-3 py-2.5 text-sm font-medium text-rose-300 transition hover:bg-rose-500/10 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"trash\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Delete</span>\n </button>\n </div>\n </div>\n </div>\n <div class=\"p-3 sm:p-5\">\n <div class=\"mb-2 flex items-center justify-between px-1 text-xs text-gray-500\">\n <span class=\"font-medium\">YAML definition</span>\n <span class=\"font-mono\">{{ source.length }} characters</span>\n </div>\n <code-editor\n id=\"source-yaml\"\n language=\"yaml\"\n theme=\"atom-one-dark\"\n nostatus=\"true\"\n class=\"block h-[calc(100vh-23rem)] min-h-[28rem] overflow-hidden rounded-lg border border-gray-700 bg-gray-950\"\n bind-value=\"source\"\n on-change=\"setSource($event.detail)\"\n ></code-editor>\n <details class=\"mt-4 overflow-hidden rounded-xl border border-gray-800 bg-gray-950/50\" on-toggle=\"loadHelp($event)\">\n <summary class=\"cursor-pointer list-none px-4 py-3 text-sm font-medium text-gray-300 outline-none transition hover:bg-gray-900 focus-visible:ring-2 focus-visible:ring-indigo-400/60\">\n <span class=\"inline-flex items-center gap-2\"><lucide-icon icon=\"circle-help\" size=\"16\"></lucide-icon>Workflow syntax help</span>\n <span class=\"ml-2 text-xs font-normal text-gray-500\">Reference, tutorials, and examples</span>\n </summary>\n <div ref=\"helpContent\" class=\"max-h-[38rem] overflow-y-auto border-t border-gray-800 bg-gray-950 px-4 py-5\" role=\"region\" aria-label=\"Workflow syntax help\" aria-live=\"polite\">\n <p class=\"text-sm text-gray-500\">Expand to load the workflow syntax reference.</p>\n </div>\n </details>\n </div>\n </section>\n </section>\n\n <section class=\"secrets-panel rounded-2xl border border-gray-800 bg-gray-900/80 p-4 shadow-xl shadow-black/10 sm:p-5\" aria-labelledby=\"secrets-title\">\n <div class=\"mb-5 flex items-start justify-between gap-3\">\n <div class=\"flex items-start gap-3\">\n <span class=\"rounded-lg bg-indigo-500/10 p-2 text-indigo-300\"><lucide-icon icon=\"key-round\" size=\"18\"></lucide-icon></span>\n <div>\n <h2 id=\"secrets-title\" class=\"text-lg font-semibold text-white\">Secrets</h2>\n <p class=\"mt-0.5 text-sm text-gray-400\">Write-only credentials available to workflows.</p>\n </div>\n </div>\n <span class=\"rounded-full border border-gray-700 bg-gray-950 px-2.5 py-1 text-xs font-mono text-gray-400\" aria-label=\"Secret count\">{{ secrets.length }}</span>\n </div>\n <div class=\"mb-5 rounded-xl border border-gray-800 bg-gray-950/50 p-3\">\n <p class=\"mb-3 text-xs text-gray-500\">Saving an existing name replaces its encrypted value.</p>\n <div class=\"grid gap-3 md:grid-cols-[14rem_1fr_auto_auto]\">\n <label class=\"sr-only\" for=\"secret-name\">Secret name</label>\n <input\n id=\"secret-name\"\n bind-value=\"secretName\"\n on-input=\"setSecretName($event)\"\n class=\"rounded-lg border border-gray-700 bg-gray-900 px-3 py-2.5 font-mono text-sm uppercase outline-none transition placeholder:text-gray-600 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n placeholder=\"NPM_TOKEN\"\n />\n <label class=\"sr-only\" for=\"secret-value\">Secret value</label>\n <input\n id=\"secret-value\"\n ref=\"secretValueInput\"\n bind-value=\"secretValue\"\n on-input=\"setSecretValue($event)\"\n type=\"password\"\n class=\"rounded-lg border border-gray-700 bg-gray-900 px-3 py-2.5 font-mono text-sm outline-none transition placeholder:text-gray-600 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n placeholder=\"New secret value\"\n />\n <button\n type=\"button\"\n aria-label=\"Save secret value\"\n title=\"Save secret value\"\n on-click=\"saveSecret()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-indigo-500/60 px-3 py-2.5 text-sm font-medium text-indigo-200 outline-none transition hover:bg-indigo-500/10 focus-visible:ring-2 focus-visible:ring-indigo-400/60 disabled:opacity-50\"\n >\n <lucide-icon icon=\"lock-keyhole\" size=\"16\"></lucide-icon><span class=\"hidden sm:inline\">Save</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Delete secret\"\n title=\"Delete secret\"\n on-click=\"removeSecret()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-rose-500/50 px-3 py-2.5 text-sm font-medium text-rose-300 outline-none transition hover:bg-rose-500/10 focus-visible:ring-2 focus-visible:ring-rose-400/60 disabled:opacity-50\"\n >\n <lucide-icon icon=\"trash\" size=\"16\"></lucide-icon><span class=\"hidden sm:inline\">Delete</span>\n </button>\n </div>\n </div>\n <ul class=\"grid gap-2\" aria-label=\"Saved secrets\">\n <template for=\"name of secrets\">\n <li>\n <button\n type=\"button\"\n on-click=\"selectSecret(name)\"\n class=\"group flex min-h-14 w-full items-center gap-3 rounded-xl border border-gray-800 bg-gray-950/50 px-3.5 py-3 text-left outline-none transition hover:border-indigo-500/50 hover:bg-indigo-500/10 focus-visible:border-indigo-400 focus-visible:ring-2 focus-visible:ring-indigo-400/50\"\n aria-label=\"Edit secret {{ name }}\"\n >\n <span class=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-800 text-gray-500 group-hover:text-indigo-300\"><lucide-icon icon=\"key-round\" size=\"15\"></lucide-icon></span>\n <span class=\"min-w-0 flex-1 truncate font-mono text-sm text-gray-200\">{{ name }}</span>\n <span class=\"text-xs text-gray-500\">Select</span>\n <lucide-icon icon=\"chevron-right\" size=\"16\" class=\"text-gray-600 transition group-hover:text-indigo-300\"></lucide-icon>\n </button>\n </li>\n </template>\n </ul>\n <div class=\"rounded-xl border border-dashed border-gray-700 px-4 py-8 text-center\" class-hidden=\"secrets.length > 0\">\n <lucide-icon icon=\"key-round\" size=\"22\" class=\"mx-auto text-gray-600\"></lucide-icon>\n <p class=\"mt-2 text-sm font-medium text-gray-300\">No secrets configured</p>\n <p class=\"mt-1 text-xs text-gray-500\">Add one above to make it available to a workflow.</p>\n </div>\n </section>\n </main>\n\n <script setup>\n import { onDestroy, onInit, ref, templateRef } from '@li3/web';\n\n export default function () {\n const page = document.body.dataset.page;\n const initialId = __WORKFLOW_ID__;\n const workflows = ref([]);\n const secrets = ref([]);\n const source = ref('');\n const savedSource = ref('');\n const workflowId = ref('');\n const enabled = ref(true);\n const savedEnabled = ref(true);\n const selectedId = ref('');\n const secretName = ref('');\n const secretValue = ref('');\n const notice = ref('');\n const noticeError = ref(false);\n const busy = ref(false);\n const secretValueInput = templateRef('secretValueInput');\n const helpContent = templateRef('helpContent');\n const helpLoaded = ref(false);\n const helpLoading = ref(false);\n let validationTimer;\n\n const showNotice = (message, error = false) => {\n notice.value = message;\n noticeError.value = error;\n };\n const api = async (url, options = {}) => {\n const response = await fetch(url, {\n headers: { accept: 'application/json', ...(options.body ? { 'content-type': 'application/json' } : {}) },\n ...options,\n });\n const body = response.status === 204 ? null : await response.json().catch(() => ({}));\n if (!response.ok) throw new Error(body.error || `Request failed: ${response.status}`);\n return body;\n };\n const derivedId = () =>\n source.value\n .match(/^\\s*(?:id:\\s*([^\\n]+)|name:\\s*([^\\n]+))/m)\n ?.slice(1)\n .find(Boolean)\n ?.trim()\n .toLowerCase()\n .replace(/[^a-z0-9]/g, '-')\n .replace(/(^-|-$)/g, '') || '';\n const run = async (action) => {\n if (busy.value) return;\n busy.value = true;\n try {\n await action();\n } catch (error) {\n showNotice(error.message, true);\n } finally {\n busy.value = false;\n }\n };\n const loadWorkflows = async () => {\n workflows.value = (await api('/api/workflows')).workflows;\n };\n const loadSecrets = async () => {\n secrets.value = (await api('/api/secrets')).secrets;\n };\n const openWorkflow = async (id) => {\n const workflow = await api(`/api/workflows/${id}`);\n selectedId.value = workflow.id;\n workflowId.value = workflow.id;\n source.value = workflow.sourceYaml;\n savedSource.value = workflow.sourceYaml;\n enabled.value = workflow.enabled;\n savedEnabled.value = workflow.enabled;\n };\n const validateSource = async () => {\n const sourceAtStart = source.value;\n const result = await api('/api/workflows/validate', {\n method: 'POST',\n body: JSON.stringify({ sourceYaml: sourceAtStart }),\n });\n if (sourceAtStart === source.value) showNotice(`Valid: ${result.workflows.length} workflow definition(s).`);\n };\n const validate = () => run(validateSource);\n const scheduleValidation = () => {\n if (page !== 'editor') return;\n clearTimeout(validationTimer);\n const sourceAtSchedule = source.value;\n validationTimer = setTimeout(() => {\n void validateSource().catch((error) => {\n if (sourceAtSchedule === source.value) showNotice(error.message, true);\n });\n }, 1000);\n };\n const save = () =>\n run(async () => {\n const id = workflowId.value.trim() || derivedId();\n if (!id) throw new Error('Set an ID or add a workflow name first.');\n if (initialId && id === selectedId.value && source.value === savedSource.value && enabled.value === savedEnabled.value) {\n showNotice('No changes to save.');\n return;\n }\n const workflow = await api(`/api/workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify({ sourceYaml: source.value, enabled: enabled.value }),\n });\n selectedId.value = workflow.id;\n workflowId.value = workflow.id;\n savedSource.value = source.value;\n savedEnabled.value = enabled.value;\n showNotice(`Saved ${workflow.id} as draft revision ${workflow.revision}.`);\n if (!initialId) history.replaceState(null, '', `/workflows/${workflow.id}`);\n });\n const publish = () =>\n run(async () => {\n const id = workflowId.value.trim() || selectedId.value;\n if (!id) throw new Error('Save a workflow before publishing it.');\n const workflow = await api(`/api/workflows/${id}/publish`, { method: 'POST' });\n selectedId.value = workflow.id;\n showNotice(`Published ${workflow.id} revision ${workflow.revision}.`);\n });\n const remove = () =>\n run(async () => {\n const id = workflowId.value.trim() || selectedId.value;\n if (!id || !confirm(`Delete ${id} and all of its revisions?`)) return;\n await api(`/api/workflows/${id}`, { method: 'DELETE' });\n window.location.href = '/workflows';\n });\n const saveSecret = () =>\n run(async () => {\n const name = secretName.value.trim();\n if (!name || !secretValue.value) throw new Error('Set a secret name and value first.');\n await api(`/api/secrets/${name}`, { method: 'PUT', body: JSON.stringify({ value: secretValue.value }) });\n secretValue.value = '';\n await loadSecrets();\n showNotice(`Saved ${name}.`);\n });\n const removeSecret = () =>\n run(async () => {\n const name = secretName.value.trim();\n if (!name || !confirm(`Delete ${name}?`)) return;\n await api(`/api/secrets/${name}`, { method: 'DELETE' });\n secretName.value = '';\n secretValue.value = '';\n await loadSecrets();\n showNotice(`Deleted ${name}.`);\n });\n const setSource = (value) => {\n source.value = value;\n scheduleValidation();\n };\n const setWorkflowId = (event) => {\n workflowId.value = event.target.value;\n };\n const setEnabled = (event) => {\n enabled.value = event.target.checked;\n };\n const setSecretName = (event) => {\n secretName.value = event.target.value;\n };\n const setSecretValue = (event) => {\n secretValue.value = event.target.value;\n };\n const selectSecret = (name) => {\n secretName.value = name;\n secretValueInput.value?.focus();\n };\n const visitWorkflow = (id) => {\n window.location.href = `/workflows/${id}`;\n };\n const loadHelp = async (event) => {\n if (!event.target.open || helpLoaded.value || helpLoading.value || !helpContent.value) return;\n helpLoading.value = true;\n helpContent.value.textContent = 'Loading workflow syntax help...';\n try {\n const response = await fetch('/help?embed=1', { headers: { accept: 'text/html' } });\n if (!response.ok) throw new Error(`Help request failed: ${response.status}`);\n const html = await response.text();\n const parsed = new DOMParser().parseFromString(html, 'text/html');\n const sourceNodes = [...Array.from(parsed.head.querySelectorAll('style')), ...Array.from(parsed.body.childNodes)];\n const nodes = sourceNodes.map((node) => document.importNode(node, true));\n helpContent.value.replaceChildren(...nodes);\n helpLoaded.value = true;\n } catch (error) {\n helpContent.value.textContent = 'Unable to load workflow syntax help.';\n console.error(error);\n } finally {\n helpLoading.value = false;\n }\n };\n\n onDestroy(() => clearTimeout(validationTimer));\n\n onInit(() => {\n const loadPage =\n page === 'editor'\n ? initialId\n ? openWorkflow(initialId)\n : Promise.resolve()\n : Promise.all([loadWorkflows(), loadSecrets()]);\n loadPage.catch((error) => showNotice(error.message, true));\n });\n return {\n workflows,\n secrets,\n source,\n workflowId,\n enabled,\n selectedId,\n secretName,\n secretValue,\n notice,\n noticeError,\n busy,\n validate,\n save,\n publish,\n remove,\n saveSecret,\n removeSecret,\n setSource,\n setWorkflowId,\n setEnabled,\n setSecretName,\n setSecretValue,\n selectSecret,\n visitWorkflow,\n loadHelp,\n };\n }\n <\/script>\n </template>\n\n <script type=\"module\">\n import '@li3/web';\n <\/script>\n <script src=\"https://cdn.tailwindcss.com\"><\/script>\n </body>\n</html>\n";
|
|
5492
|
+
var Vi = "<!doctype html>\n<html lang=\"en\" class=\"dark\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"theme-color\" content=\"#030712\" />\n <meta name=\"mobile-web-app-capable\" content=\"yes\" />\n <link rel=\"manifest\" href=\"/manifest.webmanifest\" />\n <link rel=\"icon\" href=\"/app-icon.svg\" type=\"image/svg+xml\" />\n <title>Runner Workflow Management</title>\n <script type=\"importmap\">\n { \"imports\": { \"@li3/\": \"https://cdn.li3.dev/@li3/\" } }\n <\/script>\n <style>\n body[data-page='list'] .editor-panel {\n display: none;\n }\n body[data-page='editor'] .workflow-list,\n body[data-page='editor'] .secrets-panel {\n display: none;\n }\n </style>\n </head>\n <body data-page=\"__WORKFLOW_PAGE__\" class=\"min-h-screen bg-gray-950 p-4 font-sans text-gray-100 md:p-6\">\n <link rel=\"component\" href=\"https://sodium.static.apphor.de/code-editor.html\" />\n <link rel=\"component\" href=\"https://sodium.static.apphor.de/lucide-icon.html\" />\n\n <template app>\n <main class=\"mx-auto max-w-6xl space-y-5\">\n <header class=\"flex flex-col gap-4 border-b border-gray-800 pb-5 sm:flex-row sm:items-end sm:justify-between\">\n <div class=\"flex items-start gap-3\">\n <a\n href=\"/runs\"\n aria-label=\"Back to dashboard\"\n class=\"mt-1 rounded-lg border border-gray-800 bg-gray-900 p-2 text-gray-400 transition hover:border-indigo-500/60 hover:text-indigo-300\"\n >\n <lucide-icon icon=\"arrow-left\" size=\"17\"></lucide-icon>\n </a>\n <div>\n <p class=\"text-xs font-semibold uppercase tracking-[0.18em] text-indigo-400\">Runner engine</p>\n <h1 class=\"mt-1 text-2xl font-bold tracking-tight text-white\">Workflow control room</h1>\n <p class=\"mt-1 text-sm text-gray-400\">Draft, validate, and publish revisioned YAML definitions.</p>\n </div>\n </div>\n <a\n href=\"/workflows/new\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg bg-indigo-500 px-4 py-2.5 text-sm font-semibold text-white shadow-lg shadow-indigo-950/40 transition hover:bg-indigo-400\"\n >\n <lucide-icon icon=\"plus\" size=\"16\"></lucide-icon>\n New workflow\n </a>\n <a href=\"/help\" class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-900 px-3 py-2.5 text-sm font-medium text-gray-300 outline-none transition hover:border-indigo-500/50 hover:text-indigo-200 focus-visible:ring-2 focus-visible:ring-indigo-400/60\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\"></circle><path d=\"M9.6 9a2.5 2.5 0 1 1 4.2 1.8c-1.2 1-1.8 1.4-1.8 2.7\"></path><path d=\"M12 17h.01\"></path></svg>\n Help\n </a>\n </header>\n\n <template if=\"notice\">\n <div\n role=\"status\"\n class=\"flex items-center gap-2 rounded-lg border px-3 py-2.5 text-sm\"\n bind-class=\"noticeError ? 'border-rose-500/40.bg-rose-500/10.text-rose-100' : 'border-emerald-500/40.bg-emerald-500/10.text-emerald-100'\"\n >\n <lucide-icon bind-icon=\"noticeError ? 'circle-alert' : 'circle-check'\" size=\"17\"></lucide-icon>\n <span>{{ notice }}</span>\n </div>\n </template>\n\n <section id=\"workflow-layout\" class=\"space-y-5\">\n <nav class=\"workflow-list rounded-2xl border border-gray-800 bg-gray-900/80 p-4 shadow-xl shadow-black/10\" aria-labelledby=\"workflow-list-title\">\n <div class=\"mb-4 flex items-end justify-between gap-3 border-b border-gray-800 pb-4\">\n <div>\n <p class=\"text-[11px] font-semibold uppercase tracking-[0.18em] text-indigo-400\">Definitions</p>\n <h2 id=\"workflow-list-title\" class=\"mt-1 text-lg font-semibold text-white\">Workflows</h2>\n </div>\n <span class=\"rounded-full border border-gray-700 bg-gray-950 px-2.5 py-1 text-xs font-mono text-gray-400\" aria-label=\"Workflow count\">\n {{ workflows.length }}\n </span>\n </div>\n <ul class=\"grid gap-2\" aria-label=\"Workflow definitions\">\n <template for=\"workflow of workflows\">\n <li>\n <a\n attr-href=\"'/workflows/' + workflow.id\"\n class=\"group flex min-h-16 items-center gap-3 rounded-xl border border-gray-800 bg-gray-950/50 px-3.5 py-3 text-left text-sm text-gray-300 outline-none transition hover:border-indigo-500/50 hover:bg-indigo-500/10 focus-visible:border-indigo-400 focus-visible:ring-2 focus-visible:ring-indigo-400/50\"\n >\n <span class=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-800 text-gray-400 transition group-hover:bg-indigo-500/15 group-hover:text-indigo-300\">\n <lucide-icon icon=\"workflow\" size=\"17\"></lucide-icon>\n </span>\n <span class=\"min-w-0 flex-1\">\n <span class=\"block truncate font-medium text-gray-100\">{{ workflow.name }}</span>\n <span class=\"mt-0.5 block truncate font-mono text-[11px] text-gray-500\">{{ workflow.id }}</span>\n </span>\n <span\n class=\"rounded-full border px-2 py-1 text-[10px] font-semibold uppercase tracking-wide\"\n bind-class=\"workflow.status === 'published' ? 'border-emerald-500/30.bg-emerald-500/10.text-emerald-300' : workflow.status === 'archived' ? 'border-gray-700.bg-gray-800.text-gray-500' : 'border-amber-500/30.bg-amber-500/10.text-amber-300'\"\n >{{ workflow.status }}</span>\n <lucide-icon icon=\"arrow-up-right\" size=\"16\" class=\"shrink-0 text-gray-600 transition group-hover:text-indigo-300\"></lucide-icon>\n </a>\n </li>\n </template>\n </ul>\n <div class=\"rounded-xl border border-dashed border-gray-700 px-4 py-8 text-center\" class-hidden=\"workflows.length > 0\">\n <lucide-icon icon=\"workflow\" size=\"22\" class=\"mx-auto text-gray-600\"></lucide-icon>\n <p class=\"mt-2 text-sm font-medium text-gray-300\">No workflows yet</p>\n <p class=\"mt-1 text-xs text-gray-500\">Create a definition to start automating jobs.</p>\n </div>\n </nav>\n\n <section\n class=\"editor-panel overflow-hidden rounded-xl border border-gray-800 bg-gray-900/80 shadow-xl shadow-black/10\"\n >\n <div class=\"border-b border-gray-800 px-4 pt-3 sm:px-5\">\n <a\n href=\"/workflows\"\n class=\"inline-flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium text-gray-400 outline-none transition hover:bg-gray-800 hover:text-gray-100 focus-visible:ring-2 focus-visible:ring-indigo-400/60\"\n >\n <lucide-icon icon=\"arrow-left\" size=\"14\"></lucide-icon>\n Back to workflows\n </a>\n </div>\n <div class=\"border-b border-gray-800 bg-gray-900 px-4 py-4 sm:px-5\">\n <div class=\"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between\">\n <label class=\"block max-w-xl flex-1 text-xs font-semibold uppercase tracking-wider text-gray-400\"\n >Workflow ID\n <input\n bind-value=\"workflowId\"\n on-input=\"setWorkflowId($event)\"\n bind-disabled=\"selectedId\"\n aria-describedby=\"workflow-id-help\"\n class=\"mt-2 w-full rounded-lg border border-gray-700 bg-gray-950 px-3 py-2.5 font-mono text-sm normal-case tracking-normal text-white outline-none transition focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20\"\n placeholder=\"derived-from-workflow-name\"\n />\n <span id=\"workflow-id-help\" class=\"mt-1 block text-[11px] font-normal normal-case tracking-normal text-gray-500\">The ID becomes permanent after the first save.</span>\n </label>\n <label class=\"inline-flex items-center gap-2 text-sm text-gray-300\">\n <input\n type=\"checkbox\"\n bind-checked=\"enabled\"\n on-change=\"setEnabled($event)\"\n class=\"h-4 w-4 rounded border-gray-700 bg-gray-950 text-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n />\n Enabled\n </label>\n <div class=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n aria-label=\"Validate workflow\"\n title=\"Validate workflow\"\n on-click=\"validate()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-gray-700 px-3 py-2.5 text-sm font-medium text-gray-200 transition hover:border-gray-500 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"badge-check\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Validate</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Save workflow draft\"\n title=\"Save workflow draft\"\n on-click=\"save()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg bg-indigo-500 px-3 py-2.5 text-sm font-semibold text-white transition hover:bg-indigo-400 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"save\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Save draft</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Publish workflow\"\n title=\"Publish workflow\"\n on-click=\"publish()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-emerald-500/50 px-3 py-2.5 text-sm font-medium text-emerald-300 transition hover:bg-emerald-500/10 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"rocket\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Publish</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Delete workflow\"\n title=\"Delete workflow\"\n on-click=\"remove()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center gap-2 rounded-lg border border-rose-500/50 px-3 py-2.5 text-sm font-medium text-rose-300 transition hover:bg-rose-500/10 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <lucide-icon icon=\"trash\" size=\"16\"></lucide-icon>\n <span class=\"hidden sm:inline\">Delete</span>\n </button>\n </div>\n </div>\n </div>\n <div class=\"p-3 sm:p-5\">\n <div class=\"mb-2 flex items-center justify-between px-1 text-xs text-gray-500\">\n <span class=\"font-medium\">YAML definition</span>\n <span class=\"font-mono\">{{ source.length }} characters</span>\n </div>\n <code-editor\n id=\"source-yaml\"\n language=\"yaml\"\n theme=\"atom-one-dark\"\n nostatus=\"true\"\n class=\"block h-[calc(100vh-23rem)] min-h-[28rem] overflow-hidden rounded-lg border border-gray-700 bg-gray-950\"\n bind-value=\"source\"\n on-change=\"setSource($event.detail)\"\n ></code-editor>\n <details class=\"mt-4 overflow-hidden rounded-xl border border-gray-800 bg-gray-950/50\" on-toggle=\"loadHelp($event)\">\n <summary class=\"cursor-pointer list-none px-4 py-3 text-sm font-medium text-gray-300 outline-none transition hover:bg-gray-900 focus-visible:ring-2 focus-visible:ring-indigo-400/60\">\n <span class=\"inline-flex items-center gap-2\"><lucide-icon icon=\"circle-help\" size=\"16\"></lucide-icon>Workflow syntax help</span>\n <span class=\"ml-2 text-xs font-normal text-gray-500\">Reference, tutorials, and examples</span>\n </summary>\n <div ref=\"helpContent\" class=\"max-h-[38rem] overflow-y-auto border-t border-gray-800 bg-gray-950 px-4 py-5\" role=\"region\" aria-label=\"Workflow syntax help\" aria-live=\"polite\">\n <p class=\"text-sm text-gray-500\">Expand to load the workflow syntax reference.</p>\n </div>\n </details>\n </div>\n </section>\n </section>\n\n <section class=\"secrets-panel rounded-2xl border border-gray-800 bg-gray-900/80 p-4 shadow-xl shadow-black/10 sm:p-5\" aria-labelledby=\"secrets-title\">\n <div class=\"mb-5 flex items-start justify-between gap-3\">\n <div class=\"flex items-start gap-3\">\n <span class=\"rounded-lg bg-indigo-500/10 p-2 text-indigo-300\"><lucide-icon icon=\"key-round\" size=\"18\"></lucide-icon></span>\n <div>\n <h2 id=\"secrets-title\" class=\"text-lg font-semibold text-white\">Secrets</h2>\n <p class=\"mt-0.5 text-sm text-gray-400\">Write-only credentials available to workflows.</p>\n </div>\n </div>\n <span class=\"rounded-full border border-gray-700 bg-gray-950 px-2.5 py-1 text-xs font-mono text-gray-400\" aria-label=\"Secret count\">{{ secrets.length }}</span>\n </div>\n <div class=\"mb-5 rounded-xl border border-gray-800 bg-gray-950/50 p-3\">\n <p class=\"mb-3 text-xs text-gray-500\">Saving an existing name replaces its encrypted value.</p>\n <div class=\"grid gap-3 md:grid-cols-[14rem_1fr_auto_auto]\">\n <label class=\"sr-only\" for=\"secret-name\">Secret name</label>\n <input\n id=\"secret-name\"\n bind-value=\"secretName\"\n on-input=\"setSecretName($event)\"\n class=\"rounded-lg border border-gray-700 bg-gray-900 px-3 py-2.5 font-mono text-sm uppercase outline-none transition placeholder:text-gray-600 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n placeholder=\"NPM_TOKEN\"\n />\n <label class=\"sr-only\" for=\"secret-value\">Secret value</label>\n <input\n id=\"secret-value\"\n ref=\"secretValueInput\"\n bind-value=\"secretValue\"\n on-input=\"setSecretValue($event)\"\n type=\"password\"\n class=\"rounded-lg border border-gray-700 bg-gray-900 px-3 py-2.5 font-mono text-sm outline-none transition placeholder:text-gray-600 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/30\"\n placeholder=\"New secret value\"\n />\n <button\n type=\"button\"\n aria-label=\"Save secret value\"\n title=\"Save secret value\"\n on-click=\"saveSecret()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-indigo-500/60 px-3 py-2.5 text-sm font-medium text-indigo-200 outline-none transition hover:bg-indigo-500/10 focus-visible:ring-2 focus-visible:ring-indigo-400/60 disabled:opacity-50\"\n >\n <lucide-icon icon=\"lock-keyhole\" size=\"16\"></lucide-icon><span class=\"hidden sm:inline\">Save</span>\n </button>\n <button\n type=\"button\"\n aria-label=\"Delete secret\"\n title=\"Delete secret\"\n on-click=\"removeSecret()\"\n bind-disabled=\"busy\"\n class=\"inline-flex items-center justify-center gap-2 rounded-lg border border-rose-500/50 px-3 py-2.5 text-sm font-medium text-rose-300 outline-none transition hover:bg-rose-500/10 focus-visible:ring-2 focus-visible:ring-rose-400/60 disabled:opacity-50\"\n >\n <lucide-icon icon=\"trash\" size=\"16\"></lucide-icon><span class=\"hidden sm:inline\">Delete</span>\n </button>\n </div>\n </div>\n <ul class=\"grid gap-2\" aria-label=\"Saved secrets\">\n <template for=\"name of secrets\">\n <li>\n <button\n type=\"button\"\n on-click=\"selectSecret(name)\"\n class=\"group flex min-h-14 w-full items-center gap-3 rounded-xl border border-gray-800 bg-gray-950/50 px-3.5 py-3 text-left outline-none transition hover:border-indigo-500/50 hover:bg-indigo-500/10 focus-visible:border-indigo-400 focus-visible:ring-2 focus-visible:ring-indigo-400/50\"\n aria-label=\"Edit secret {{ name }}\"\n >\n <span class=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-800 text-gray-500 group-hover:text-indigo-300\"><lucide-icon icon=\"key-round\" size=\"15\"></lucide-icon></span>\n <span class=\"min-w-0 flex-1 truncate font-mono text-sm text-gray-200\">{{ name }}</span>\n <span class=\"text-xs text-gray-500\">Select</span>\n <lucide-icon icon=\"chevron-right\" size=\"16\" class=\"text-gray-600 transition group-hover:text-indigo-300\"></lucide-icon>\n </button>\n </li>\n </template>\n </ul>\n <div class=\"rounded-xl border border-dashed border-gray-700 px-4 py-8 text-center\" class-hidden=\"secrets.length > 0\">\n <lucide-icon icon=\"key-round\" size=\"22\" class=\"mx-auto text-gray-600\"></lucide-icon>\n <p class=\"mt-2 text-sm font-medium text-gray-300\">No secrets configured</p>\n <p class=\"mt-1 text-xs text-gray-500\">Add one above to make it available to a workflow.</p>\n </div>\n </section>\n </main>\n\n <script setup>\n import { onDestroy, onInit, ref, templateRef } from '@li3/web';\n\n export default function () {\n const page = document.body.dataset.page;\n const initialId = __WORKFLOW_ID__;\n const workflows = ref([]);\n const secrets = ref([]);\n const source = ref('');\n const savedSource = ref('');\n const workflowId = ref('');\n const enabled = ref(true);\n const savedEnabled = ref(true);\n const selectedId = ref('');\n const secretName = ref('');\n const secretValue = ref('');\n const notice = ref('');\n const noticeError = ref(false);\n const busy = ref(false);\n const secretValueInput = templateRef('secretValueInput');\n const helpContent = templateRef('helpContent');\n const helpLoaded = ref(false);\n const helpLoading = ref(false);\n let validationTimer;\n\n const showNotice = (message, error = false) => {\n notice.value = message;\n noticeError.value = error;\n };\n const api = async (url, options = {}) => {\n const response = await fetch(url, {\n headers: { accept: 'application/json', ...(options.body ? { 'content-type': 'application/json' } : {}) },\n ...options,\n });\n const body = response.status === 204 ? null : await response.json().catch(() => ({}));\n if (!response.ok) throw new Error(body.error || `Request failed: ${response.status}`);\n return body;\n };\n const derivedId = () =>\n source.value\n .match(/^\\s*(?:id:\\s*([^\\n]+)|name:\\s*([^\\n]+))/m)\n ?.slice(1)\n .find(Boolean)\n ?.trim()\n .toLowerCase()\n .replace(/[^a-z0-9]/g, '-')\n .replace(/(^-|-$)/g, '') || '';\n const run = async (action) => {\n if (busy.value) return;\n busy.value = true;\n try {\n await action();\n } catch (error) {\n showNotice(error.message, true);\n } finally {\n busy.value = false;\n }\n };\n const loadWorkflows = async () => {\n workflows.value = (await api('/api/workflows')).workflows;\n };\n const loadSecrets = async () => {\n secrets.value = (await api('/api/secrets')).secrets;\n };\n const openWorkflow = async (id) => {\n const workflow = await api(`/api/workflows/${id}`);\n selectedId.value = workflow.id;\n workflowId.value = workflow.id;\n source.value = workflow.sourceYaml;\n savedSource.value = workflow.sourceYaml;\n enabled.value = workflow.enabled;\n savedEnabled.value = workflow.enabled;\n };\n const validateSource = async () => {\n const sourceAtStart = source.value;\n const result = await api('/api/workflows/validate', {\n method: 'POST',\n body: JSON.stringify({ sourceYaml: sourceAtStart }),\n });\n if (sourceAtStart === source.value) showNotice(`Valid: ${result.workflows.length} workflow definition(s).`);\n };\n const validate = () => run(validateSource);\n const scheduleValidation = () => {\n if (page !== 'editor') return;\n clearTimeout(validationTimer);\n const sourceAtSchedule = source.value;\n validationTimer = setTimeout(() => {\n void validateSource().catch((error) => {\n if (sourceAtSchedule === source.value) showNotice(error.message, true);\n });\n }, 1000);\n };\n const save = () =>\n run(async () => {\n const id = workflowId.value.trim() || derivedId();\n if (!id) throw new Error('Set an ID or add a workflow name first.');\n if (initialId && id === selectedId.value && source.value === savedSource.value && enabled.value === savedEnabled.value) {\n showNotice('No changes to save.');\n return;\n }\n const workflow = await api(`/api/workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify({ sourceYaml: source.value, enabled: enabled.value }),\n });\n selectedId.value = workflow.id;\n workflowId.value = workflow.id;\n savedSource.value = source.value;\n savedEnabled.value = enabled.value;\n showNotice(`Saved ${workflow.id} as draft revision ${workflow.revision}.`);\n if (!initialId) history.replaceState(null, '', `/workflows/${workflow.id}`);\n });\n const publish = () =>\n run(async () => {\n const id = workflowId.value.trim() || selectedId.value;\n if (!id) throw new Error('Save a workflow before publishing it.');\n const workflow = await api(`/api/workflows/${id}/publish`, { method: 'POST' });\n selectedId.value = workflow.id;\n showNotice(`Published ${workflow.id} revision ${workflow.revision}.`);\n });\n const remove = () =>\n run(async () => {\n const id = workflowId.value.trim() || selectedId.value;\n if (!id || !confirm(`Delete ${id} and all of its revisions?`)) return;\n await api(`/api/workflows/${id}`, { method: 'DELETE' });\n window.location.href = '/workflows';\n });\n const saveSecret = () =>\n run(async () => {\n const name = secretName.value.trim();\n if (!name || !secretValue.value) throw new Error('Set a secret name and value first.');\n await api(`/api/secrets/${name}`, { method: 'PUT', body: JSON.stringify({ value: secretValue.value }) });\n secretValue.value = '';\n await loadSecrets();\n showNotice(`Saved ${name}.`);\n });\n const removeSecret = () =>\n run(async () => {\n const name = secretName.value.trim();\n if (!name || !confirm(`Delete ${name}?`)) return;\n await api(`/api/secrets/${name}`, { method: 'DELETE' });\n secretName.value = '';\n secretValue.value = '';\n await loadSecrets();\n showNotice(`Deleted ${name}.`);\n });\n const setSource = (value) => {\n source.value = value;\n scheduleValidation();\n };\n const setWorkflowId = (event) => {\n workflowId.value = event.target.value;\n };\n const setEnabled = (event) => {\n enabled.value = event.target.checked;\n };\n const setSecretName = (event) => {\n secretName.value = event.target.value;\n };\n const setSecretValue = (event) => {\n secretValue.value = event.target.value;\n };\n const selectSecret = (name) => {\n secretName.value = name;\n secretValueInput.value?.focus();\n };\n const visitWorkflow = (id) => {\n window.location.href = `/workflows/${id}`;\n };\n const loadHelp = async (event) => {\n if (!event.target.open || helpLoaded.value || helpLoading.value || !helpContent.value) return;\n helpLoading.value = true;\n helpContent.value.textContent = 'Loading workflow syntax help...';\n try {\n const response = await fetch('/help?embed=1', { headers: { accept: 'text/html' } });\n if (!response.ok) throw new Error(`Help request failed: ${response.status}`);\n const html = await response.text();\n const parsed = new DOMParser().parseFromString(html, 'text/html');\n const sourceNodes = [...Array.from(parsed.head.querySelectorAll('style')), ...Array.from(parsed.body.childNodes)];\n const nodes = sourceNodes.map((node) => document.importNode(node, true));\n helpContent.value.replaceChildren(...nodes);\n helpLoaded.value = true;\n } catch (error) {\n helpContent.value.textContent = 'Unable to load workflow syntax help.';\n console.error(error);\n } finally {\n helpLoading.value = false;\n }\n };\n\n onDestroy(() => clearTimeout(validationTimer));\n\n onInit(() => {\n const loadPage =\n page === 'editor'\n ? initialId\n ? openWorkflow(initialId)\n : Promise.resolve()\n : Promise.all([loadWorkflows(), loadSecrets()]);\n loadPage.catch((error) => showNotice(error.message, true));\n });\n return {\n workflows,\n secrets,\n source,\n workflowId,\n enabled,\n selectedId,\n secretName,\n secretValue,\n notice,\n noticeError,\n busy,\n validate,\n save,\n publish,\n remove,\n saveSecret,\n removeSecret,\n setSource,\n setWorkflowId,\n setEnabled,\n setSecretName,\n setSecretValue,\n selectSecret,\n visitWorkflow,\n loadHelp,\n };\n }\n <\/script>\n </template>\n\n <script type=\"module\">\n import '@li3/web';\n <\/script>\n <script src=\"https://cdn.tailwindcss.com\"><\/script>\n </body>\n</html>\n";
|
|
5493
5493
|
//#endregion
|
|
5494
5494
|
//#region src/workflows-ui.ts
|
|
5495
5495
|
function Hi(e, t = "") {
|
|
@@ -9853,23 +9853,25 @@ var qc = class {
|
|
|
9853
9853
|
}
|
|
9854
9854
|
async saveDraft(e, t, n = !0) {
|
|
9855
9855
|
let r = this.validate(t);
|
|
9856
|
-
if (r.length !== 1
|
|
9857
|
-
let i =
|
|
9856
|
+
if (r.length !== 1) throw Error("Workflow must contain exactly one definition");
|
|
9857
|
+
let i = Gc(e);
|
|
9858
|
+
r[0].id = i;
|
|
9859
|
+
let a = await C.get("SELECT COALESCE(MAX(revision), 0) AS revision FROM workflow_revisions WHERE workflow_id = ?", [i]), o = Number(a?.revision || 0) + 1;
|
|
9858
9860
|
return await C.run("INSERT INTO workflows (id, name, source_yaml, status, enabled) VALUES (?, ?, ?, 'draft', ?)\n ON CONFLICT(id) DO UPDATE SET name = excluded.name, source_yaml = excluded.source_yaml, status = 'draft', enabled = excluded.enabled, updated_at = CURRENT_TIMESTAMP", [
|
|
9859
|
-
|
|
9861
|
+
i,
|
|
9860
9862
|
r[0].name,
|
|
9861
9863
|
t,
|
|
9862
9864
|
+!!n
|
|
9863
9865
|
]), await C.run("INSERT INTO workflow_revisions (workflow_id, revision, source_yaml, normalized_json) VALUES (?, ?, ?, ?)", [
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
+
i,
|
|
9867
|
+
o,
|
|
9866
9868
|
t,
|
|
9867
9869
|
JSON.stringify(r[0])
|
|
9868
9870
|
]), {
|
|
9869
|
-
id:
|
|
9871
|
+
id: i,
|
|
9870
9872
|
name: r[0].name,
|
|
9871
9873
|
sourceYaml: t,
|
|
9872
|
-
revision:
|
|
9874
|
+
revision: o,
|
|
9873
9875
|
status: "draft",
|
|
9874
9876
|
enabled: n
|
|
9875
9877
|
};
|