@cloudflare/vite-plugin 2.0.0-beta.sha-c82c3efb3 → 2.0.0-beta.sha-be282d7ee
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/index.d.mts +3 -3
- package/dist/index.mjs +824 -868
- package/dist/index.mjs.map +1 -1
- package/dist/{package-Bn19BDvR.mjs → package-Ci21HGBv.mjs} +3 -3
- package/dist/package-Ci21HGBv.mjs.map +1 -0
- package/dist/workers/asset-worker/index.js +189 -20
- package/package.json +9 -9
- package/dist/package-Bn19BDvR.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -129,7 +129,7 @@ function createFatalError(message, isJson, options) {
|
|
|
129
129
|
__name$4(createFatalError, "createFatalError");
|
|
130
130
|
|
|
131
131
|
//#endregion
|
|
132
|
-
//#region ../workers-utils/dist/chunk-
|
|
132
|
+
//#region ../workers-utils/dist/chunk-RCTEOKOW.mjs
|
|
133
133
|
function hasKnownExportType(entry) {
|
|
134
134
|
const type = entry?.type;
|
|
135
135
|
return type === "durable-object" || type === "worker";
|
|
@@ -1433,114 +1433,7 @@ function applyEdits(text, edits) {
|
|
|
1433
1433
|
return text;
|
|
1434
1434
|
}
|
|
1435
1435
|
__name$4(applyEdits, "applyEdits");
|
|
1436
|
-
|
|
1437
|
-
let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1438
|
-
return [lines.length, lines.pop().length + 1];
|
|
1439
|
-
}
|
|
1440
|
-
__name$4(getLineColFromPtr$1, "getLineColFromPtr");
|
|
1441
|
-
function makeCodeBlock$1(string$3, line, column) {
|
|
1442
|
-
let lines = string$3.split(/\r\n|\n|\r/g);
|
|
1443
|
-
let codeblock = "";
|
|
1444
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1445
|
-
for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
|
|
1446
|
-
let l = lines[i$1 - 1];
|
|
1447
|
-
if (!l) continue;
|
|
1448
|
-
codeblock += i$1.toString().padEnd(numberLen, " ");
|
|
1449
|
-
codeblock += ": ";
|
|
1450
|
-
codeblock += l;
|
|
1451
|
-
codeblock += "\n";
|
|
1452
|
-
if (i$1 === line) {
|
|
1453
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
1454
|
-
codeblock += "^\n";
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
return codeblock;
|
|
1458
|
-
}
|
|
1459
|
-
__name$4(makeCodeBlock$1, "makeCodeBlock");
|
|
1460
|
-
var TomlError$1 = class extends Error {
|
|
1461
|
-
static {
|
|
1462
|
-
__name$4(this, "TomlError");
|
|
1463
|
-
}
|
|
1464
|
-
line;
|
|
1465
|
-
column;
|
|
1466
|
-
codeblock;
|
|
1467
|
-
constructor(message, options) {
|
|
1468
|
-
const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
|
|
1469
|
-
const codeblock = makeCodeBlock$1(options.toml, line, column);
|
|
1470
|
-
super(`Invalid TOML document: ${message}
|
|
1471
|
-
|
|
1472
|
-
${codeblock}`, options);
|
|
1473
|
-
this.line = line;
|
|
1474
|
-
this.column = column;
|
|
1475
|
-
this.codeblock = codeblock;
|
|
1476
|
-
}
|
|
1477
|
-
};
|
|
1478
|
-
function isEscaped$1(str, ptr) {
|
|
1479
|
-
let i$1 = 0;
|
|
1480
|
-
while (str[ptr - ++i$1] === "\\");
|
|
1481
|
-
return --i$1 && i$1 % 2;
|
|
1482
|
-
}
|
|
1483
|
-
__name$4(isEscaped$1, "isEscaped");
|
|
1484
|
-
function indexOfNewline$1(str, start = 0, end = str.length) {
|
|
1485
|
-
let idx = str.indexOf("\n", start);
|
|
1486
|
-
if (str[idx - 1] === "\r") idx--;
|
|
1487
|
-
return idx <= end ? idx : -1;
|
|
1488
|
-
}
|
|
1489
|
-
__name$4(indexOfNewline$1, "indexOfNewline");
|
|
1490
|
-
function skipComment$1(str, ptr) {
|
|
1491
|
-
for (let i$1 = ptr; i$1 < str.length; i$1++) {
|
|
1492
|
-
let c$1 = str[i$1];
|
|
1493
|
-
if (c$1 === "\n") return i$1;
|
|
1494
|
-
if (c$1 === "\r" && str[i$1 + 1] === "\n") return i$1 + 1;
|
|
1495
|
-
if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError$1("control characters are not allowed in comments", {
|
|
1496
|
-
toml: str,
|
|
1497
|
-
ptr
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
return str.length;
|
|
1501
|
-
}
|
|
1502
|
-
__name$4(skipComment$1, "skipComment");
|
|
1503
|
-
function skipVoid$1(str, ptr, banNewLines, banComments) {
|
|
1504
|
-
let c$1;
|
|
1505
|
-
while ((c$1 = str[ptr]) === " " || c$1 === " " || !banNewLines && (c$1 === "\n" || c$1 === "\r" && str[ptr + 1] === "\n")) ptr++;
|
|
1506
|
-
return banComments || c$1 !== "#" ? ptr : skipVoid$1(str, skipComment$1(str, ptr), banNewLines);
|
|
1507
|
-
}
|
|
1508
|
-
__name$4(skipVoid$1, "skipVoid");
|
|
1509
|
-
function skipUntil$1(str, ptr, sep, end, banNewLines = false) {
|
|
1510
|
-
if (!end) {
|
|
1511
|
-
ptr = indexOfNewline$1(str, ptr);
|
|
1512
|
-
return ptr < 0 ? str.length : ptr;
|
|
1513
|
-
}
|
|
1514
|
-
for (let i$1 = ptr; i$1 < str.length; i$1++) {
|
|
1515
|
-
let c$1 = str[i$1];
|
|
1516
|
-
if (c$1 === "#") i$1 = indexOfNewline$1(str, i$1);
|
|
1517
|
-
else if (c$1 === sep) return i$1 + 1;
|
|
1518
|
-
else if (c$1 === end || banNewLines && (c$1 === "\n" || c$1 === "\r" && str[i$1 + 1] === "\n")) return i$1;
|
|
1519
|
-
}
|
|
1520
|
-
throw new TomlError$1("cannot find end of structure", {
|
|
1521
|
-
toml: str,
|
|
1522
|
-
ptr
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
__name$4(skipUntil$1, "skipUntil");
|
|
1526
|
-
function getStringEnd$1(str, seek) {
|
|
1527
|
-
let first = str[seek];
|
|
1528
|
-
let target$1 = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
1529
|
-
seek += target$1.length - 1;
|
|
1530
|
-
do
|
|
1531
|
-
seek = str.indexOf(target$1, ++seek);
|
|
1532
|
-
while (seek > -1 && first !== "'" && isEscaped$1(str, seek));
|
|
1533
|
-
if (seek > -1) {
|
|
1534
|
-
seek += target$1.length;
|
|
1535
|
-
if (target$1.length > 1) {
|
|
1536
|
-
if (str[seek] === first) seek++;
|
|
1537
|
-
if (str[seek] === first) seek++;
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
return seek;
|
|
1541
|
-
}
|
|
1542
|
-
__name$4(getStringEnd$1, "getStringEnd");
|
|
1543
|
-
var DATE_TIME_RE$1 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1436
|
+
var DATE_TIME_RE$1 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1544
1437
|
var TomlDate$1 = class _TomlDate extends Date {
|
|
1545
1438
|
static {
|
|
1546
1439
|
__name$4(this, "TomlDate");
|
|
@@ -1624,305 +1517,380 @@ var TomlDate$1 = class _TomlDate extends Date {
|
|
|
1624
1517
|
return date$3;
|
|
1625
1518
|
}
|
|
1626
1519
|
};
|
|
1520
|
+
function getLineColFromPtr$1(string$3, ptr) {
|
|
1521
|
+
let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1522
|
+
return [lines.length, lines.pop().length + 1];
|
|
1523
|
+
}
|
|
1524
|
+
__name$4(getLineColFromPtr$1, "getLineColFromPtr");
|
|
1525
|
+
function makeCodeBlock$1(string$3, line, column) {
|
|
1526
|
+
let lines = string$3.split(/\r\n|\n|\r/g);
|
|
1527
|
+
let codeblock = "";
|
|
1528
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1529
|
+
for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
|
|
1530
|
+
let l = lines[i$1 - 1];
|
|
1531
|
+
if (!l) continue;
|
|
1532
|
+
codeblock += i$1.toString().padEnd(numberLen, " ");
|
|
1533
|
+
codeblock += ": ";
|
|
1534
|
+
codeblock += l;
|
|
1535
|
+
codeblock += "\n";
|
|
1536
|
+
if (i$1 === line) {
|
|
1537
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
1538
|
+
codeblock += "^\n";
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
return codeblock;
|
|
1542
|
+
}
|
|
1543
|
+
__name$4(makeCodeBlock$1, "makeCodeBlock");
|
|
1544
|
+
var TomlError$1 = class extends Error {
|
|
1545
|
+
static {
|
|
1546
|
+
__name$4(this, "TomlError");
|
|
1547
|
+
}
|
|
1548
|
+
line;
|
|
1549
|
+
column;
|
|
1550
|
+
codeblock;
|
|
1551
|
+
constructor(message, options) {
|
|
1552
|
+
const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
|
|
1553
|
+
const codeblock = makeCodeBlock$1(options.toml, line, column);
|
|
1554
|
+
super(`Invalid TOML document: ${message}
|
|
1555
|
+
|
|
1556
|
+
${codeblock}`, options);
|
|
1557
|
+
this.line = line;
|
|
1558
|
+
this.column = column;
|
|
1559
|
+
this.codeblock = codeblock;
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
function indexOfNewline$1(str, start = 0) {
|
|
1563
|
+
let idx = str.indexOf("\n", start);
|
|
1564
|
+
if (str.charCodeAt(idx - 1) === 13) idx--;
|
|
1565
|
+
return idx;
|
|
1566
|
+
}
|
|
1567
|
+
__name$4(indexOfNewline$1, "indexOfNewline");
|
|
1568
|
+
function skipComment$1(ctx) {
|
|
1569
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1570
|
+
let c$1 = ctx.s.charCodeAt(ctx.p);
|
|
1571
|
+
if (c$1 === 10) break;
|
|
1572
|
+
if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
1573
|
+
ctx.p++;
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1576
|
+
if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in comments", {
|
|
1577
|
+
toml: ctx.s,
|
|
1578
|
+
ptr: ctx.p
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
__name$4(skipComment$1, "skipComment");
|
|
1583
|
+
function skipVoid$1(ctx, banNewLines, banComments) {
|
|
1584
|
+
let c$1;
|
|
1585
|
+
while (1) {
|
|
1586
|
+
while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
|
|
1587
|
+
if (banComments || c$1 !== 35) break;
|
|
1588
|
+
skipComment$1(ctx);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
__name$4(skipVoid$1, "skipVoid");
|
|
1592
|
+
function skipUntil$1(ctx, sep, end) {
|
|
1593
|
+
let ptr = ctx.p;
|
|
1594
|
+
if (!end) {
|
|
1595
|
+
ptr = indexOfNewline$1(ctx.s, ptr);
|
|
1596
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1600
|
+
let c$1 = ctx.s.charCodeAt(ctx.p);
|
|
1601
|
+
if (c$1 === 35) skipComment$1(ctx);
|
|
1602
|
+
else if (c$1 === end || c$1 === sep) return;
|
|
1603
|
+
}
|
|
1604
|
+
throw new TomlError$1("cannot find end of structure", {
|
|
1605
|
+
toml: ctx.s,
|
|
1606
|
+
ptr
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
__name$4(skipUntil$1, "skipUntil");
|
|
1627
1610
|
var INT_REGEX$1 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
1628
1611
|
var FLOAT_REGEX$1 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
1629
1612
|
var LEADING_ZERO$1 = /^[+-]?0[0-9_]/;
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
r: "\r",
|
|
1637
|
-
"\"": "\"",
|
|
1638
|
-
"\\": "\\"
|
|
1639
|
-
};
|
|
1640
|
-
function parseString$1(str, ptr = 0, endPtr = str.length) {
|
|
1641
|
-
let isLiteral = str[ptr] === "'";
|
|
1642
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
1613
|
+
function parseString$1(ctx) {
|
|
1614
|
+
let start = ctx.p;
|
|
1615
|
+
let c$1 = ctx.s.charCodeAt(ctx.p++);
|
|
1616
|
+
let first = c$1;
|
|
1617
|
+
let isLiteral = c$1 === 39;
|
|
1618
|
+
let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
|
|
1643
1619
|
if (isMultiline) {
|
|
1644
|
-
|
|
1645
|
-
if (
|
|
1646
|
-
if (str[ptr] === "\n") ptr++;
|
|
1620
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
|
|
1621
|
+
else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
|
|
1647
1622
|
}
|
|
1648
|
-
let tmp = 0;
|
|
1649
|
-
let isEscape;
|
|
1650
1623
|
let parsed = "";
|
|
1651
|
-
let sliceStart =
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
} else if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError$1("control characters are not allowed in strings", {
|
|
1660
|
-
toml: str,
|
|
1661
|
-
ptr: ptr - 1
|
|
1624
|
+
let sliceStart = ctx.p;
|
|
1625
|
+
let state = 0;
|
|
1626
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1627
|
+
c$1 = ctx.s.charCodeAt(ctx.p);
|
|
1628
|
+
if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
|
|
1629
|
+
else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in strings", {
|
|
1630
|
+
toml: ctx.s,
|
|
1631
|
+
ptr: ctx.p
|
|
1662
1632
|
});
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1633
|
+
else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
1634
|
+
if (isMultiline) {
|
|
1635
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
|
|
1636
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
|
|
1637
|
+
}
|
|
1638
|
+
if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
1639
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
1640
|
+
return parsed;
|
|
1641
|
+
} else if (!state) {
|
|
1642
|
+
if (!isLiteral && c$1 === 92) {
|
|
1643
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
1644
|
+
state = 1;
|
|
1645
|
+
}
|
|
1646
|
+
} else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
|
|
1647
|
+
let value = 0;
|
|
1648
|
+
let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
|
|
1649
|
+
for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
|
|
1650
|
+
let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
|
|
1651
|
+
let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
|
|
1652
|
+
if (digit < 0) throw new TomlError$1("invalid non-hex character in unicode escape", {
|
|
1653
|
+
toml: ctx.s,
|
|
1654
|
+
ptr: ctx.p + 1
|
|
1670
1655
|
});
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1656
|
+
value = value << 4 | digit;
|
|
1657
|
+
}
|
|
1658
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError$1("invalid unicode escape", {
|
|
1659
|
+
toml: ctx.s,
|
|
1660
|
+
ptr: ctx.p
|
|
1661
|
+
});
|
|
1662
|
+
parsed += String.fromCodePoint(value);
|
|
1663
|
+
sliceStart = ctx.p + 1;
|
|
1664
|
+
state = 0;
|
|
1665
|
+
} else if (c$1 === 32 || c$1 === 9) state = 2;
|
|
1666
|
+
else {
|
|
1667
|
+
if (c$1 === 98) parsed += "\b";
|
|
1668
|
+
else if (c$1 === 116) parsed += " ";
|
|
1669
|
+
else if (c$1 === 110) parsed += "\n";
|
|
1670
|
+
else if (c$1 === 102) parsed += "\f";
|
|
1671
|
+
else if (c$1 === 114) parsed += "\r";
|
|
1672
|
+
else if (c$1 === 101) parsed += "\x1B";
|
|
1673
|
+
else if (c$1 === 34) parsed += "\"";
|
|
1674
|
+
else if (c$1 === 92) parsed += "\\";
|
|
1687
1675
|
else throw new TomlError$1("unrecognized escape sequence", {
|
|
1688
|
-
toml:
|
|
1689
|
-
ptr:
|
|
1676
|
+
toml: ctx.s,
|
|
1677
|
+
ptr: ctx.p
|
|
1690
1678
|
});
|
|
1691
|
-
sliceStart =
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1679
|
+
sliceStart = ctx.p + 1;
|
|
1680
|
+
state = 0;
|
|
1681
|
+
}
|
|
1682
|
+
else if (c$1 !== 32 && c$1 !== 9) {
|
|
1683
|
+
if (state === 2) throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
|
|
1684
|
+
toml: ctx.s,
|
|
1685
|
+
ptr: sliceStart
|
|
1686
|
+
});
|
|
1687
|
+
state = !isLiteral && c$1 === 92 ? 1 : 0;
|
|
1688
|
+
sliceStart = ctx.p;
|
|
1696
1689
|
}
|
|
1697
1690
|
}
|
|
1698
|
-
|
|
1691
|
+
throw new TomlError$1("unfinished string", {
|
|
1692
|
+
toml: ctx.s,
|
|
1693
|
+
ptr: start
|
|
1694
|
+
});
|
|
1699
1695
|
}
|
|
1700
1696
|
__name$4(parseString$1, "parseString");
|
|
1701
|
-
function
|
|
1702
|
-
|
|
1703
|
-
|
|
1697
|
+
function sliceAndTrimEndOf$1(ctx, start, end) {
|
|
1698
|
+
let value = ctx.s.slice(start, end);
|
|
1699
|
+
let commentIdx = value.indexOf("#");
|
|
1700
|
+
if (commentIdx > 0) {
|
|
1701
|
+
skipComment$1({
|
|
1702
|
+
s: value,
|
|
1703
|
+
p: commentIdx
|
|
1704
|
+
});
|
|
1705
|
+
value = value.slice(0, commentIdx);
|
|
1706
|
+
}
|
|
1707
|
+
return value.trimEnd();
|
|
1708
|
+
}
|
|
1709
|
+
__name$4(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
|
|
1710
|
+
function parseValue$1(ctx, integersAsBigInt, end) {
|
|
1711
|
+
let ptr = ctx.p;
|
|
1712
|
+
let err = {
|
|
1713
|
+
toml: ctx.s,
|
|
1714
|
+
ptr
|
|
1715
|
+
};
|
|
1716
|
+
skipUntil$1(ctx, 44, end);
|
|
1717
|
+
let value = sliceAndTrimEndOf$1(ctx, ptr, ctx.p);
|
|
1718
|
+
if (!value) throw new TomlError$1("incomplete declaration: value expected", err);
|
|
1704
1719
|
if (value === "-inf") return -Infinity;
|
|
1705
1720
|
if (value === "inf" || value === "+inf") return Infinity;
|
|
1706
1721
|
if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
|
|
1707
1722
|
if (value === "-0") return integersAsBigInt ? 0n : 0;
|
|
1708
1723
|
let isInt = INT_REGEX$1.test(value);
|
|
1709
1724
|
if (isInt || FLOAT_REGEX$1.test(value)) {
|
|
1710
|
-
if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed",
|
|
1711
|
-
toml,
|
|
1712
|
-
ptr
|
|
1713
|
-
});
|
|
1725
|
+
if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", err);
|
|
1714
1726
|
value = value.replace(/_/g, "");
|
|
1715
1727
|
let numeric$1 = +value;
|
|
1716
|
-
if (isNaN(numeric$1)) throw new TomlError$1("invalid number",
|
|
1717
|
-
toml,
|
|
1718
|
-
ptr
|
|
1719
|
-
});
|
|
1728
|
+
if (isNaN(numeric$1)) throw new TomlError$1("invalid number", err);
|
|
1720
1729
|
if (isInt) {
|
|
1721
|
-
if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly",
|
|
1722
|
-
toml,
|
|
1723
|
-
ptr
|
|
1724
|
-
});
|
|
1730
|
+
if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", err);
|
|
1725
1731
|
if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
|
|
1726
1732
|
}
|
|
1727
1733
|
return numeric$1;
|
|
1728
1734
|
}
|
|
1729
1735
|
const date$3 = new TomlDate$1(value);
|
|
1730
|
-
if (!date$3.isValid()) throw new TomlError$1("invalid value",
|
|
1731
|
-
toml,
|
|
1732
|
-
ptr
|
|
1733
|
-
});
|
|
1736
|
+
if (!date$3.isValid()) throw new TomlError$1("invalid value", err);
|
|
1734
1737
|
return date$3;
|
|
1735
1738
|
}
|
|
1736
1739
|
__name$4(parseValue$1, "parseValue");
|
|
1737
|
-
function
|
|
1738
|
-
let
|
|
1739
|
-
let
|
|
1740
|
-
if (
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
let trimmed = value.trimEnd();
|
|
1745
|
-
if (!allowNewLines) {
|
|
1746
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
1747
|
-
if (newlineIdx > -1) throw new TomlError$1("newlines are not allowed in inline tables", {
|
|
1748
|
-
toml: str,
|
|
1749
|
-
ptr: startPtr + newlineIdx
|
|
1740
|
+
function extractValue$1(ctx, end, integersAsBigInt) {
|
|
1741
|
+
let ptr = ctx.p;
|
|
1742
|
+
let c$1 = ctx.s.charCodeAt(ptr);
|
|
1743
|
+
if (c$1 === 91 || c$1 === 123) {
|
|
1744
|
+
if (!ctx.d--) throw new TomlError$1("document contains excessively nested structures. aborting.", {
|
|
1745
|
+
toml: ctx.s,
|
|
1746
|
+
ptr
|
|
1750
1747
|
});
|
|
1748
|
+
let value = c$1 === 91 ? parseArray$1(ctx, integersAsBigInt) : parseInlineTable$1(ctx, integersAsBigInt);
|
|
1749
|
+
ctx.d++;
|
|
1750
|
+
return value;
|
|
1751
1751
|
}
|
|
1752
|
-
return
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
let c$1 = str[ptr];
|
|
1761
|
-
if (c$1 === "[" || c$1 === "{") {
|
|
1762
|
-
let [value, endPtr2] = c$1 === "[" ? parseArray$1(str, ptr, depth, integersAsBigInt) : parseInlineTable$1(str, ptr, depth, integersAsBigInt);
|
|
1763
|
-
let newPtr = end ? skipUntil$1(str, endPtr2, ",", end) : endPtr2;
|
|
1764
|
-
if (endPtr2 - newPtr && end === "}") {
|
|
1765
|
-
let nextNewLine = indexOfNewline$1(str, endPtr2, newPtr);
|
|
1766
|
-
if (nextNewLine > -1) throw new TomlError$1("newlines are not allowed in inline tables", {
|
|
1767
|
-
toml: str,
|
|
1768
|
-
ptr: nextNewLine
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
return [value, newPtr];
|
|
1772
|
-
}
|
|
1773
|
-
let endPtr;
|
|
1774
|
-
if (c$1 === "\"" || c$1 === "'") {
|
|
1775
|
-
endPtr = getStringEnd$1(str, ptr);
|
|
1776
|
-
let parsed = parseString$1(str, ptr, endPtr);
|
|
1777
|
-
if (end) {
|
|
1778
|
-
endPtr = skipVoid$1(str, endPtr, end !== "]");
|
|
1779
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") throw new TomlError$1("unexpected character encountered", {
|
|
1780
|
-
toml: str,
|
|
1781
|
-
ptr: endPtr
|
|
1782
|
-
});
|
|
1783
|
-
endPtr += +(str[endPtr] === ",");
|
|
1784
|
-
}
|
|
1785
|
-
return [parsed, endPtr];
|
|
1752
|
+
if (c$1 === 34 || c$1 === 39) return parseString$1(ctx);
|
|
1753
|
+
if (c$1 === 116) {
|
|
1754
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError$1("invalid value", {
|
|
1755
|
+
toml: ctx.s,
|
|
1756
|
+
ptr
|
|
1757
|
+
});
|
|
1758
|
+
ctx.p++;
|
|
1759
|
+
return true;
|
|
1786
1760
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
endPtr = skipVoid$1(str, ptr + slice[1]);
|
|
1795
|
-
endPtr += +(str[endPtr] === ",");
|
|
1761
|
+
if (c$1 === 102) {
|
|
1762
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError$1("invalid value", {
|
|
1763
|
+
toml: ctx.s,
|
|
1764
|
+
ptr
|
|
1765
|
+
});
|
|
1766
|
+
ctx.p++;
|
|
1767
|
+
return false;
|
|
1796
1768
|
}
|
|
1797
|
-
return
|
|
1769
|
+
return parseValue$1(ctx, integersAsBigInt, end);
|
|
1798
1770
|
}
|
|
1799
1771
|
__name$4(extractValue$1, "extractValue");
|
|
1800
1772
|
var KEY_PART_RE$1 = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
1801
|
-
function parseKey$1(
|
|
1802
|
-
let
|
|
1773
|
+
function parseKey$1(ctx, end = "=") {
|
|
1774
|
+
let start = ctx.p;
|
|
1775
|
+
let dot = start - 1;
|
|
1803
1776
|
let parsed = [];
|
|
1804
|
-
let endPtr =
|
|
1777
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
1805
1778
|
if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
|
|
1806
|
-
toml:
|
|
1807
|
-
ptr
|
|
1779
|
+
toml: ctx.s,
|
|
1780
|
+
ptr: start
|
|
1808
1781
|
});
|
|
1809
1782
|
do {
|
|
1810
|
-
let c$1 =
|
|
1811
|
-
if (c$1 !==
|
|
1812
|
-
if (c$1 ===
|
|
1813
|
-
toml:
|
|
1814
|
-
ptr
|
|
1815
|
-
});
|
|
1816
|
-
let eos = getStringEnd$1(str, ptr);
|
|
1817
|
-
if (eos < 0) throw new TomlError$1("unfinished string encountered", {
|
|
1818
|
-
toml: str,
|
|
1819
|
-
ptr
|
|
1783
|
+
let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
1784
|
+
if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
|
|
1785
|
+
if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError$1("multiline strings are not allowed in keys", {
|
|
1786
|
+
toml: ctx.s,
|
|
1787
|
+
ptr: ctx.p
|
|
1820
1788
|
});
|
|
1821
|
-
|
|
1822
|
-
|
|
1789
|
+
let part = parseString$1(ctx);
|
|
1790
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
1791
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
1823
1792
|
let newLine = indexOfNewline$1(strEnd);
|
|
1824
1793
|
if (newLine > -1) throw new TomlError$1("newlines are not allowed in keys", {
|
|
1825
|
-
toml:
|
|
1826
|
-
ptr:
|
|
1794
|
+
toml: ctx.s,
|
|
1795
|
+
ptr: newLine
|
|
1827
1796
|
});
|
|
1828
1797
|
if (strEnd.trimStart()) throw new TomlError$1("found extra tokens after the string part", {
|
|
1829
|
-
toml:
|
|
1830
|
-
ptr:
|
|
1798
|
+
toml: ctx.s,
|
|
1799
|
+
ptr: ctx.p
|
|
1831
1800
|
});
|
|
1832
|
-
if (endPtr <
|
|
1833
|
-
endPtr =
|
|
1801
|
+
if (endPtr < ctx.p) {
|
|
1802
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
1834
1803
|
if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
|
|
1835
|
-
toml:
|
|
1836
|
-
ptr
|
|
1804
|
+
toml: ctx.s,
|
|
1805
|
+
ptr: start
|
|
1837
1806
|
});
|
|
1838
1807
|
}
|
|
1839
|
-
parsed.push(
|
|
1808
|
+
parsed.push(part);
|
|
1840
1809
|
} else {
|
|
1841
|
-
dot =
|
|
1842
|
-
let part =
|
|
1810
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
1811
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
1843
1812
|
if (!KEY_PART_RE$1.test(part)) throw new TomlError$1("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
1844
|
-
toml:
|
|
1845
|
-
ptr
|
|
1813
|
+
toml: ctx.s,
|
|
1814
|
+
ptr: ctx.p
|
|
1846
1815
|
});
|
|
1847
1816
|
parsed.push(part.trimEnd());
|
|
1848
1817
|
}
|
|
1849
1818
|
} while (dot + 1 && dot < endPtr);
|
|
1850
|
-
|
|
1819
|
+
ctx.p = endPtr + 1;
|
|
1820
|
+
skipVoid$1(ctx, true, true);
|
|
1821
|
+
return parsed;
|
|
1851
1822
|
}
|
|
1852
1823
|
__name$4(parseKey$1, "parseKey");
|
|
1853
|
-
function parseInlineTable$1(
|
|
1824
|
+
function parseInlineTable$1(ctx, integersAsBigInt) {
|
|
1854
1825
|
let res = {};
|
|
1855
1826
|
let seen = /* @__PURE__ */ new Set();
|
|
1856
1827
|
let c$1;
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
enumerable: true,
|
|
1881
|
-
configurable: true,
|
|
1882
|
-
writable: true
|
|
1883
|
-
});
|
|
1884
|
-
}
|
|
1885
|
-
if (hasOwn$1) throw new TomlError$1("trying to redefine an already defined value", {
|
|
1886
|
-
toml: str,
|
|
1887
|
-
ptr
|
|
1828
|
+
ctx.p++;
|
|
1829
|
+
while (ctx.p < ctx.s.length) {
|
|
1830
|
+
skipVoid$1(ctx);
|
|
1831
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
1832
|
+
ctx.p++;
|
|
1833
|
+
return res;
|
|
1834
|
+
}
|
|
1835
|
+
let k;
|
|
1836
|
+
let t$2 = res;
|
|
1837
|
+
let hasOwn$1 = false;
|
|
1838
|
+
let p$2 = ctx.p;
|
|
1839
|
+
let key = parseKey$1(ctx);
|
|
1840
|
+
for (let i$1 = 0; i$1 < key.length; i$1++) {
|
|
1841
|
+
if (i$1) t$2 = hasOwn$1 ? t$2[k] : t$2[k] = {};
|
|
1842
|
+
k = key[i$1];
|
|
1843
|
+
if ((hasOwn$1 = Object.hasOwn(t$2, k)) && (typeof t$2[k] !== "object" || seen.has(t$2[k]))) throw new TomlError$1("trying to redefine an already defined value", {
|
|
1844
|
+
toml: ctx.s,
|
|
1845
|
+
ptr: p$2
|
|
1846
|
+
});
|
|
1847
|
+
if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$2, k, {
|
|
1848
|
+
enumerable: true,
|
|
1849
|
+
configurable: true,
|
|
1850
|
+
writable: true
|
|
1888
1851
|
});
|
|
1889
|
-
let [value, valueEndPtr] = extractValue$1(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
1890
|
-
seen.add(value);
|
|
1891
|
-
t$2[k] = value;
|
|
1892
|
-
ptr = valueEndPtr;
|
|
1893
|
-
comma$1 = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
1894
1852
|
}
|
|
1853
|
+
if (hasOwn$1) throw new TomlError$1("trying to redefine an already defined value", {
|
|
1854
|
+
toml: ctx.s,
|
|
1855
|
+
ptr: ctx.p
|
|
1856
|
+
});
|
|
1857
|
+
let value = extractValue$1(ctx, 125, integersAsBigInt);
|
|
1858
|
+
seen.add(t$2[k] = value);
|
|
1859
|
+
skipVoid$1(ctx);
|
|
1860
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
|
|
1861
|
+
if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
|
|
1862
|
+
toml: ctx.s,
|
|
1863
|
+
ptr: ctx.p - 1
|
|
1864
|
+
});
|
|
1895
1865
|
}
|
|
1896
|
-
|
|
1897
|
-
toml:
|
|
1898
|
-
ptr:
|
|
1899
|
-
});
|
|
1900
|
-
if (!c$1) throw new TomlError$1("unfinished table encountered", {
|
|
1901
|
-
toml: str,
|
|
1902
|
-
ptr
|
|
1866
|
+
throw new TomlError$1("unfinished table encountered", {
|
|
1867
|
+
toml: ctx.s,
|
|
1868
|
+
ptr: ctx.p
|
|
1903
1869
|
});
|
|
1904
|
-
return [res, ptr];
|
|
1905
1870
|
}
|
|
1906
1871
|
__name$4(parseInlineTable$1, "parseInlineTable");
|
|
1907
|
-
function parseArray$1(
|
|
1872
|
+
function parseArray$1(ctx, integersAsBigInt) {
|
|
1908
1873
|
let res = [];
|
|
1909
1874
|
let c$1;
|
|
1910
|
-
|
|
1911
|
-
while (
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1875
|
+
ctx.p++;
|
|
1876
|
+
while (ctx.p < ctx.s.length) {
|
|
1877
|
+
skipVoid$1(ctx);
|
|
1878
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
1879
|
+
ctx.p++;
|
|
1880
|
+
return res;
|
|
1881
|
+
}
|
|
1882
|
+
res.push(extractValue$1(ctx, 93, integersAsBigInt));
|
|
1883
|
+
skipVoid$1(ctx);
|
|
1884
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
|
|
1885
|
+
if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
|
|
1886
|
+
toml: ctx.s,
|
|
1887
|
+
ptr: ctx.p - 1
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
throw new TomlError$1("unfinished array encountered", {
|
|
1891
|
+
toml: ctx.s,
|
|
1892
|
+
ptr: ctx.p
|
|
1924
1893
|
});
|
|
1925
|
-
return [res, ptr];
|
|
1926
1894
|
}
|
|
1927
1895
|
__name$4(parseArray$1, "parseArray");
|
|
1928
1896
|
function peekTable$1(key, table, meta$3, type) {
|
|
@@ -1992,46 +1960,51 @@ function peekTable$1(key, table, meta$3, type) {
|
|
|
1992
1960
|
}
|
|
1993
1961
|
__name$4(peekTable$1, "peekTable");
|
|
1994
1962
|
function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
1963
|
+
let ctx = {
|
|
1964
|
+
s: toml,
|
|
1965
|
+
p: 0,
|
|
1966
|
+
d: maxDepth
|
|
1967
|
+
};
|
|
1995
1968
|
let res = {};
|
|
1996
1969
|
let meta$3 = {};
|
|
1970
|
+
let tmp;
|
|
1997
1971
|
let tbl = res;
|
|
1998
1972
|
let m = meta$3;
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
let
|
|
1973
|
+
skipVoid$1(ctx);
|
|
1974
|
+
while (ctx.p < toml.length) {
|
|
1975
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
1976
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
1977
|
+
tmp = ctx.p += +isTableArray;
|
|
1978
|
+
let k = parseKey$1(ctx, "]");
|
|
2003
1979
|
if (isTableArray) {
|
|
2004
|
-
if (toml
|
|
1980
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError$1("expected end of table declaration", {
|
|
2005
1981
|
toml,
|
|
2006
|
-
ptr:
|
|
1982
|
+
ptr: ctx.p - 1
|
|
2007
1983
|
});
|
|
2008
|
-
|
|
1984
|
+
ctx.p++;
|
|
2009
1985
|
}
|
|
2010
|
-
let p$2 = peekTable$1(k
|
|
1986
|
+
let p$2 = peekTable$1(k, res, meta$3, isTableArray ? 2 : 1);
|
|
2011
1987
|
if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
|
|
2012
1988
|
toml,
|
|
2013
|
-
ptr
|
|
1989
|
+
ptr: tmp
|
|
2014
1990
|
});
|
|
2015
1991
|
m = p$2[2];
|
|
2016
1992
|
tbl = p$2[1];
|
|
2017
|
-
ptr = k[1];
|
|
2018
1993
|
} else {
|
|
2019
|
-
|
|
2020
|
-
let p$2 = peekTable$1(
|
|
1994
|
+
tmp = ctx.p;
|
|
1995
|
+
let p$2 = peekTable$1(parseKey$1(ctx), tbl, m, 0);
|
|
2021
1996
|
if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
|
|
2022
1997
|
toml,
|
|
2023
|
-
ptr
|
|
1998
|
+
ptr: tmp
|
|
2024
1999
|
});
|
|
2025
|
-
|
|
2026
|
-
p$2[1][p$2[0]] = v[0];
|
|
2027
|
-
ptr = v[1];
|
|
2000
|
+
p$2[1][p$2[0]] = extractValue$1(ctx, void 0, integersAsBigInt);
|
|
2028
2001
|
}
|
|
2029
|
-
|
|
2030
|
-
if (toml
|
|
2002
|
+
skipVoid$1(ctx, true);
|
|
2003
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError$1("each key-value declaration must be followed by an end-of-line", {
|
|
2031
2004
|
toml,
|
|
2032
|
-
ptr
|
|
2005
|
+
ptr: ctx.p
|
|
2033
2006
|
});
|
|
2034
|
-
|
|
2007
|
+
skipVoid$1(ctx);
|
|
2035
2008
|
}
|
|
2036
2009
|
return res;
|
|
2037
2010
|
}
|
|
@@ -2041,7 +2014,8 @@ function extendedTypeOf$1(obj) {
|
|
|
2041
2014
|
let type = typeof obj;
|
|
2042
2015
|
if (type === "object") {
|
|
2043
2016
|
if (Array.isArray(obj)) return "array";
|
|
2044
|
-
if (obj instanceof Date) return "date";
|
|
2017
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
|
|
2018
|
+
if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
|
|
2045
2019
|
}
|
|
2046
2020
|
return type;
|
|
2047
2021
|
}
|
|
@@ -2055,23 +2029,31 @@ function formatString$1(s) {
|
|
|
2055
2029
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
2056
2030
|
}
|
|
2057
2031
|
__name$4(formatString$1, "formatString");
|
|
2032
|
+
function stringifyTemporal$1(temporal) {
|
|
2033
|
+
return temporal.toString({
|
|
2034
|
+
calendarName: "never",
|
|
2035
|
+
timeZoneName: "never"
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
__name$4(stringifyTemporal$1, "stringifyTemporal");
|
|
2058
2039
|
function stringifyValue$1(val, type, depth, numberAsFloat) {
|
|
2059
2040
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2041
|
+
switch (type) {
|
|
2042
|
+
case "number":
|
|
2043
|
+
if (isNaN(val)) return "nan";
|
|
2044
|
+
if (val === Infinity) return "inf";
|
|
2045
|
+
if (val === -Infinity) return "-inf";
|
|
2046
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
|
|
2047
|
+
case "bigint":
|
|
2048
|
+
case "boolean": return val.toString();
|
|
2049
|
+
case "string": return formatString$1(val);
|
|
2050
|
+
case "date":
|
|
2051
|
+
if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
|
|
2052
|
+
return val.toISOString();
|
|
2053
|
+
case "object": return stringifyInlineTable$1(val, depth, numberAsFloat);
|
|
2054
|
+
case "array": return stringifyArray$1(val, depth, numberAsFloat);
|
|
2055
|
+
case "temporal": return stringifyTemporal$1(val);
|
|
2056
|
+
}
|
|
2075
2057
|
}
|
|
2076
2058
|
__name$4(stringifyValue$1, "stringifyValue");
|
|
2077
2059
|
function stringifyInlineTable$1(obj, depth, numberAsFloat) {
|
|
@@ -54209,6 +54191,7 @@ const AssetConfigSchema = object({
|
|
|
54209
54191
|
"404-page",
|
|
54210
54192
|
"none"
|
|
54211
54193
|
]).optional(),
|
|
54194
|
+
base_path: string().optional(),
|
|
54212
54195
|
redirects: RedirectsSchema,
|
|
54213
54196
|
headers: HeadersSchema,
|
|
54214
54197
|
has_static_routing: boolean().optional(),
|
|
@@ -58947,7 +58930,7 @@ var __name$1 = (target$1, value) => __defProp$3(target$1, "name", {
|
|
|
58947
58930
|
});
|
|
58948
58931
|
|
|
58949
58932
|
//#endregion
|
|
58950
|
-
//#region ../workers-auth/dist/chunk-
|
|
58933
|
+
//#region ../workers-auth/dist/chunk-YWGRY65P.mjs
|
|
58951
58934
|
var import_undici$2 = require_undici();
|
|
58952
58935
|
var hasWarnedAboutDeprecatedV1ApiToken = false;
|
|
58953
58936
|
function readStoredAuthState(options) {
|
|
@@ -59256,6 +59239,62 @@ var TEMPORARY_TERMS_URLS = {
|
|
|
59256
59239
|
var TEMPORARY_TERMS_PROMPT = `You must accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}) in order to continue. By typing "yes", you agree to these terms. Type "yes" to continue.`;
|
|
59257
59240
|
var TEMPORARY_TERMS_NOTICE = `Continuing means you accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}).`;
|
|
59258
59241
|
var TEMPORARY_TERMS_ERROR = `You must accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}) to use --temporary.`;
|
|
59242
|
+
var EVENT_ACCOUNT_ERRORS = /* @__PURE__ */ new Map([
|
|
59243
|
+
[1035, {
|
|
59244
|
+
message: "The event code is malformed. Check it and try again.",
|
|
59245
|
+
telemetryMessage: "deploy temporary event code invalid"
|
|
59246
|
+
}],
|
|
59247
|
+
[1036, {
|
|
59248
|
+
message: "The event code was not found. Check it and try again.",
|
|
59249
|
+
telemetryMessage: "deploy temporary event not found"
|
|
59250
|
+
}],
|
|
59251
|
+
[1037, {
|
|
59252
|
+
message: "This event has not started yet.",
|
|
59253
|
+
telemetryMessage: "deploy temporary event not started"
|
|
59254
|
+
}],
|
|
59255
|
+
[1038, {
|
|
59256
|
+
message: "This event has ended.",
|
|
59257
|
+
telemetryMessage: "deploy temporary event expired"
|
|
59258
|
+
}],
|
|
59259
|
+
[1039, {
|
|
59260
|
+
message: "This event is disabled. Contact the event organizer.",
|
|
59261
|
+
telemetryMessage: "deploy temporary event disabled"
|
|
59262
|
+
}],
|
|
59263
|
+
[1040, {
|
|
59264
|
+
message: "This event has no temporary accounts remaining.",
|
|
59265
|
+
telemetryMessage: "deploy temporary event exhausted"
|
|
59266
|
+
}],
|
|
59267
|
+
[1041, {
|
|
59268
|
+
message: "The event account could not be prepared. Try again later or contact the event organizer.",
|
|
59269
|
+
telemetryMessage: "deploy temporary event provisioning unavailable",
|
|
59270
|
+
fatal: true
|
|
59271
|
+
}]
|
|
59272
|
+
]);
|
|
59273
|
+
function getResponseErrorCode(body) {
|
|
59274
|
+
if (typeof body !== "object" || body === null || !("errors" in body)) return;
|
|
59275
|
+
const { errors: errors$1 } = body;
|
|
59276
|
+
if (!Array.isArray(errors$1) || errors$1.length === 0) return;
|
|
59277
|
+
const [error$2] = errors$1;
|
|
59278
|
+
if (typeof error$2 !== "object" || error$2 === null || !("code" in error$2)) return;
|
|
59279
|
+
return typeof error$2.code === "number" ? error$2.code : void 0;
|
|
59280
|
+
}
|
|
59281
|
+
__name$1(getResponseErrorCode, "getResponseErrorCode");
|
|
59282
|
+
async function getEventAccountError(response) {
|
|
59283
|
+
let body;
|
|
59284
|
+
try {
|
|
59285
|
+
body = await response.json();
|
|
59286
|
+
} catch {
|
|
59287
|
+
return;
|
|
59288
|
+
}
|
|
59289
|
+
const errorCode = getResponseErrorCode(body);
|
|
59290
|
+
if (errorCode === void 0) return;
|
|
59291
|
+
const eventError = EVENT_ACCOUNT_ERRORS.get(errorCode);
|
|
59292
|
+
if (!eventError) return;
|
|
59293
|
+
const options = { telemetryMessage: eventError.telemetryMessage };
|
|
59294
|
+
if (eventError.fatal) return new FatalError(eventError.message, options);
|
|
59295
|
+
return new UserError(eventError.message, options);
|
|
59296
|
+
}
|
|
59297
|
+
__name$1(getEventAccountError, "getEventAccountError");
|
|
59259
59298
|
function getTemporaryPreviewUrl() {
|
|
59260
59299
|
return `${getCloudflareApiBaseUrl(COMPLIANCE_REGION_CONFIG_PUBLIC)}/provisioning/previews`;
|
|
59261
59300
|
}
|
|
@@ -59301,7 +59340,7 @@ async function requestPowSolution(logger$1) {
|
|
|
59301
59340
|
});
|
|
59302
59341
|
}
|
|
59303
59342
|
__name$1(requestPowSolution, "requestPowSolution");
|
|
59304
|
-
async function createTemporaryPreviewAccount(logger$1) {
|
|
59343
|
+
async function createTemporaryPreviewAccount(logger$1, request$1) {
|
|
59305
59344
|
const pow = await requestPowSolution(logger$1);
|
|
59306
59345
|
const response = await (0, import_undici$2.fetch)(getTemporaryPreviewUrl(), {
|
|
59307
59346
|
method: "POST",
|
|
@@ -59311,10 +59350,17 @@ async function createTemporaryPreviewAccount(logger$1) {
|
|
|
59311
59350
|
privacyPolicy: TEMPORARY_TERMS_URLS.privacyPolicy,
|
|
59312
59351
|
acceptTermsOfService: "yes",
|
|
59313
59352
|
challengeToken: pow.challengeToken,
|
|
59314
|
-
solution: pow.solution
|
|
59353
|
+
solution: pow.solution,
|
|
59354
|
+
...request$1?.eventCode ? { eventCode: request$1.eventCode } : {}
|
|
59315
59355
|
})
|
|
59316
59356
|
});
|
|
59317
|
-
if (!response.ok)
|
|
59357
|
+
if (!response.ok) {
|
|
59358
|
+
if (request$1?.eventCode) {
|
|
59359
|
+
const eventError = await getEventAccountError(response);
|
|
59360
|
+
if (eventError) throw eventError;
|
|
59361
|
+
}
|
|
59362
|
+
throw new FatalError(`Failed to create a temporary preview account (${response.status} ${response.statusText}).`, { telemetryMessage: "deploy temporary account create failed" });
|
|
59363
|
+
}
|
|
59318
59364
|
let responseBody;
|
|
59319
59365
|
try {
|
|
59320
59366
|
responseBody = await response.json();
|
|
@@ -59328,7 +59374,9 @@ async function createTemporaryPreviewAccount(logger$1) {
|
|
|
59328
59374
|
const accountExpiresAt = previewAccount?.account?.expiresAt;
|
|
59329
59375
|
const claimUrl = previewAccount?.claim?.url;
|
|
59330
59376
|
const claimExpiresAt = previewAccount?.claim?.expiresAt;
|
|
59377
|
+
const eventCodeAccepted = previewAccount?.eventCodeAccepted;
|
|
59331
59378
|
if (accountId === void 0 || accountName === void 0 || apiToken === void 0 || accountExpiresAt === void 0 || claimUrl === void 0 || claimExpiresAt === void 0) throw new FatalError("Failed to create a temporary preview account because the response was missing required fields.", { telemetryMessage: "deploy temporary account response incomplete" });
|
|
59379
|
+
if (request$1?.eventCode && eventCodeAccepted !== true) throw new FatalError("Failed to create a temporary preview account because the response did not acknowledge the event code.", { telemetryMessage: "deploy temporary event acknowledgement missing" });
|
|
59332
59380
|
return {
|
|
59333
59381
|
account: {
|
|
59334
59382
|
id: accountId,
|
|
@@ -59345,12 +59393,15 @@ async function createTemporaryPreviewAccount(logger$1) {
|
|
|
59345
59393
|
__name$1(createTemporaryPreviewAccount, "createTemporaryPreviewAccount");
|
|
59346
59394
|
async function getOrCreateTemporaryPreviewAccount(options) {
|
|
59347
59395
|
const cachedPreviewAccount = getCachedTemporaryPreviewAccount(options.storage);
|
|
59348
|
-
if (cachedPreviewAccount)
|
|
59349
|
-
account:
|
|
59350
|
-
|
|
59351
|
-
|
|
59396
|
+
if (cachedPreviewAccount) {
|
|
59397
|
+
if (options.request?.eventCode) throw new UserError("A temporary account is already cached. Rerun without --event-code to reuse it, or run `wrangler logout` and retry to create an account for this event.", { telemetryMessage: "deploy temporary event cache conflict" });
|
|
59398
|
+
return {
|
|
59399
|
+
account: cachedPreviewAccount,
|
|
59400
|
+
cached: true
|
|
59401
|
+
};
|
|
59402
|
+
}
|
|
59352
59403
|
if (!await options.prompt(TEMPORARY_TERMS_PROMPT, TEMPORARY_TERMS_NOTICE)) throw new UserError(TEMPORARY_TERMS_ERROR, { telemetryMessage: "user temporary terms not accepted" });
|
|
59353
|
-
const temporaryPreviewAccount = await createTemporaryPreviewAccount(options.logger);
|
|
59404
|
+
const temporaryPreviewAccount = await createTemporaryPreviewAccount(options.logger, options.request);
|
|
59354
59405
|
options.storage.write(temporaryPreviewAccount);
|
|
59355
59406
|
return {
|
|
59356
59407
|
account: temporaryPreviewAccount,
|
|
@@ -60104,7 +60155,7 @@ function createOAuthFlow(ctx) {
|
|
|
60104
60155
|
__name$1(getStorage, "getStorage");
|
|
60105
60156
|
const getClientId = /* @__PURE__ */ __name$1(() => typeof ctx.clientId === "function" ? ctx.clientId() : ctx.clientId, "getClientId");
|
|
60106
60157
|
const consent = ctx.consent;
|
|
60107
|
-
let
|
|
60158
|
+
let temporaryRequest;
|
|
60108
60159
|
let activeTemporaryAccount;
|
|
60109
60160
|
const redirectUrl = new URL(ctx.redirectUri);
|
|
60110
60161
|
const defaultCallbackHost = redirectUrl.hostname;
|
|
@@ -60270,13 +60321,13 @@ function createOAuthFlow(ctx) {
|
|
|
60270
60321
|
});
|
|
60271
60322
|
}
|
|
60272
60323
|
__name$1(requireApiTokenInternal, "requireApiTokenInternal");
|
|
60273
|
-
function setTemporaryAllowed(allowed) {
|
|
60274
|
-
|
|
60324
|
+
function setTemporaryAllowed(allowed, request$1) {
|
|
60325
|
+
temporaryRequest = allowed && ctx.temporary !== void 0 ? request$1 ?? {} : void 0;
|
|
60275
60326
|
activeTemporaryAccount = void 0;
|
|
60276
60327
|
}
|
|
60277
60328
|
__name$1(setTemporaryAllowed, "setTemporaryAllowed");
|
|
60278
60329
|
function isTemporaryAllowed() {
|
|
60279
|
-
return
|
|
60330
|
+
return temporaryRequest !== void 0;
|
|
60280
60331
|
}
|
|
60281
60332
|
__name$1(isTemporaryAllowed, "isTemporaryAllowed");
|
|
60282
60333
|
function getActiveTemporaryAccount() {
|
|
@@ -60287,7 +60338,8 @@ function createOAuthFlow(ctx) {
|
|
|
60287
60338
|
if (!ctx.temporary) throw new UserError("Temporary preview accounts are not supported by this CLI.", { telemetryMessage: "user temporary account unsupported" });
|
|
60288
60339
|
const result = await getOrCreateTemporaryPreviewAccount({
|
|
60289
60340
|
...ctx.temporary,
|
|
60290
|
-
logger: ctx.logger
|
|
60341
|
+
logger: ctx.logger,
|
|
60342
|
+
...temporaryRequest ? { request: temporaryRequest } : {}
|
|
60291
60343
|
});
|
|
60292
60344
|
activeTemporaryAccount = result.account;
|
|
60293
60345
|
return result;
|
|
@@ -60436,114 +60488,7 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
|
60436
60488
|
}
|
|
60437
60489
|
}
|
|
60438
60490
|
__name$1(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
|
|
60439
|
-
|
|
60440
|
-
let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
60441
|
-
return [lines.length, lines.pop().length + 1];
|
|
60442
|
-
}
|
|
60443
|
-
__name$1(getLineColFromPtr, "getLineColFromPtr");
|
|
60444
|
-
function makeCodeBlock(string$3, line, column) {
|
|
60445
|
-
let lines = string$3.split(/\r\n|\n|\r/g);
|
|
60446
|
-
let codeblock = "";
|
|
60447
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
60448
|
-
for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
|
|
60449
|
-
let l = lines[i$1 - 1];
|
|
60450
|
-
if (!l) continue;
|
|
60451
|
-
codeblock += i$1.toString().padEnd(numberLen, " ");
|
|
60452
|
-
codeblock += ": ";
|
|
60453
|
-
codeblock += l;
|
|
60454
|
-
codeblock += "\n";
|
|
60455
|
-
if (i$1 === line) {
|
|
60456
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
60457
|
-
codeblock += "^\n";
|
|
60458
|
-
}
|
|
60459
|
-
}
|
|
60460
|
-
return codeblock;
|
|
60461
|
-
}
|
|
60462
|
-
__name$1(makeCodeBlock, "makeCodeBlock");
|
|
60463
|
-
var TomlError = class extends Error {
|
|
60464
|
-
static {
|
|
60465
|
-
__name$1(this, "TomlError");
|
|
60466
|
-
}
|
|
60467
|
-
line;
|
|
60468
|
-
column;
|
|
60469
|
-
codeblock;
|
|
60470
|
-
constructor(message, options) {
|
|
60471
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
60472
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
60473
|
-
super(`Invalid TOML document: ${message}
|
|
60474
|
-
|
|
60475
|
-
${codeblock}`, options);
|
|
60476
|
-
this.line = line;
|
|
60477
|
-
this.column = column;
|
|
60478
|
-
this.codeblock = codeblock;
|
|
60479
|
-
}
|
|
60480
|
-
};
|
|
60481
|
-
function isEscaped(str, ptr) {
|
|
60482
|
-
let i$1 = 0;
|
|
60483
|
-
while (str[ptr - ++i$1] === "\\");
|
|
60484
|
-
return --i$1 && i$1 % 2;
|
|
60485
|
-
}
|
|
60486
|
-
__name$1(isEscaped, "isEscaped");
|
|
60487
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
60488
|
-
let idx = str.indexOf("\n", start);
|
|
60489
|
-
if (str[idx - 1] === "\r") idx--;
|
|
60490
|
-
return idx <= end ? idx : -1;
|
|
60491
|
-
}
|
|
60492
|
-
__name$1(indexOfNewline, "indexOfNewline");
|
|
60493
|
-
function skipComment(str, ptr) {
|
|
60494
|
-
for (let i$1 = ptr; i$1 < str.length; i$1++) {
|
|
60495
|
-
let c$1 = str[i$1];
|
|
60496
|
-
if (c$1 === "\n") return i$1;
|
|
60497
|
-
if (c$1 === "\r" && str[i$1 + 1] === "\n") return i$1 + 1;
|
|
60498
|
-
if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError("control characters are not allowed in comments", {
|
|
60499
|
-
toml: str,
|
|
60500
|
-
ptr
|
|
60501
|
-
});
|
|
60502
|
-
}
|
|
60503
|
-
return str.length;
|
|
60504
|
-
}
|
|
60505
|
-
__name$1(skipComment, "skipComment");
|
|
60506
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
60507
|
-
let c$1;
|
|
60508
|
-
while ((c$1 = str[ptr]) === " " || c$1 === " " || !banNewLines && (c$1 === "\n" || c$1 === "\r" && str[ptr + 1] === "\n")) ptr++;
|
|
60509
|
-
return banComments || c$1 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
60510
|
-
}
|
|
60511
|
-
__name$1(skipVoid, "skipVoid");
|
|
60512
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
60513
|
-
if (!end) {
|
|
60514
|
-
ptr = indexOfNewline(str, ptr);
|
|
60515
|
-
return ptr < 0 ? str.length : ptr;
|
|
60516
|
-
}
|
|
60517
|
-
for (let i$1 = ptr; i$1 < str.length; i$1++) {
|
|
60518
|
-
let c$1 = str[i$1];
|
|
60519
|
-
if (c$1 === "#") i$1 = indexOfNewline(str, i$1);
|
|
60520
|
-
else if (c$1 === sep) return i$1 + 1;
|
|
60521
|
-
else if (c$1 === end || banNewLines && (c$1 === "\n" || c$1 === "\r" && str[i$1 + 1] === "\n")) return i$1;
|
|
60522
|
-
}
|
|
60523
|
-
throw new TomlError("cannot find end of structure", {
|
|
60524
|
-
toml: str,
|
|
60525
|
-
ptr
|
|
60526
|
-
});
|
|
60527
|
-
}
|
|
60528
|
-
__name$1(skipUntil, "skipUntil");
|
|
60529
|
-
function getStringEnd(str, seek) {
|
|
60530
|
-
let first = str[seek];
|
|
60531
|
-
let target$1 = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
60532
|
-
seek += target$1.length - 1;
|
|
60533
|
-
do
|
|
60534
|
-
seek = str.indexOf(target$1, ++seek);
|
|
60535
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
60536
|
-
if (seek > -1) {
|
|
60537
|
-
seek += target$1.length;
|
|
60538
|
-
if (target$1.length > 1) {
|
|
60539
|
-
if (str[seek] === first) seek++;
|
|
60540
|
-
if (str[seek] === first) seek++;
|
|
60541
|
-
}
|
|
60542
|
-
}
|
|
60543
|
-
return seek;
|
|
60544
|
-
}
|
|
60545
|
-
__name$1(getStringEnd, "getStringEnd");
|
|
60546
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
60491
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
60547
60492
|
var TomlDate = class _TomlDate extends Date {
|
|
60548
60493
|
static {
|
|
60549
60494
|
__name$1(this, "TomlDate");
|
|
@@ -60627,305 +60572,380 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
60627
60572
|
return date$3;
|
|
60628
60573
|
}
|
|
60629
60574
|
};
|
|
60575
|
+
function getLineColFromPtr(string$3, ptr) {
|
|
60576
|
+
let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
60577
|
+
return [lines.length, lines.pop().length + 1];
|
|
60578
|
+
}
|
|
60579
|
+
__name$1(getLineColFromPtr, "getLineColFromPtr");
|
|
60580
|
+
function makeCodeBlock(string$3, line, column) {
|
|
60581
|
+
let lines = string$3.split(/\r\n|\n|\r/g);
|
|
60582
|
+
let codeblock = "";
|
|
60583
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
60584
|
+
for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
|
|
60585
|
+
let l = lines[i$1 - 1];
|
|
60586
|
+
if (!l) continue;
|
|
60587
|
+
codeblock += i$1.toString().padEnd(numberLen, " ");
|
|
60588
|
+
codeblock += ": ";
|
|
60589
|
+
codeblock += l;
|
|
60590
|
+
codeblock += "\n";
|
|
60591
|
+
if (i$1 === line) {
|
|
60592
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
60593
|
+
codeblock += "^\n";
|
|
60594
|
+
}
|
|
60595
|
+
}
|
|
60596
|
+
return codeblock;
|
|
60597
|
+
}
|
|
60598
|
+
__name$1(makeCodeBlock, "makeCodeBlock");
|
|
60599
|
+
var TomlError = class extends Error {
|
|
60600
|
+
static {
|
|
60601
|
+
__name$1(this, "TomlError");
|
|
60602
|
+
}
|
|
60603
|
+
line;
|
|
60604
|
+
column;
|
|
60605
|
+
codeblock;
|
|
60606
|
+
constructor(message, options) {
|
|
60607
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
60608
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
60609
|
+
super(`Invalid TOML document: ${message}
|
|
60610
|
+
|
|
60611
|
+
${codeblock}`, options);
|
|
60612
|
+
this.line = line;
|
|
60613
|
+
this.column = column;
|
|
60614
|
+
this.codeblock = codeblock;
|
|
60615
|
+
}
|
|
60616
|
+
};
|
|
60617
|
+
function indexOfNewline(str, start = 0) {
|
|
60618
|
+
let idx = str.indexOf("\n", start);
|
|
60619
|
+
if (str.charCodeAt(idx - 1) === 13) idx--;
|
|
60620
|
+
return idx;
|
|
60621
|
+
}
|
|
60622
|
+
__name$1(indexOfNewline, "indexOfNewline");
|
|
60623
|
+
function skipComment(ctx) {
|
|
60624
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
60625
|
+
let c$1 = ctx.s.charCodeAt(ctx.p);
|
|
60626
|
+
if (c$1 === 10) break;
|
|
60627
|
+
if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
60628
|
+
ctx.p++;
|
|
60629
|
+
break;
|
|
60630
|
+
}
|
|
60631
|
+
if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in comments", {
|
|
60632
|
+
toml: ctx.s,
|
|
60633
|
+
ptr: ctx.p
|
|
60634
|
+
});
|
|
60635
|
+
}
|
|
60636
|
+
}
|
|
60637
|
+
__name$1(skipComment, "skipComment");
|
|
60638
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
60639
|
+
let c$1;
|
|
60640
|
+
while (1) {
|
|
60641
|
+
while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
|
|
60642
|
+
if (banComments || c$1 !== 35) break;
|
|
60643
|
+
skipComment(ctx);
|
|
60644
|
+
}
|
|
60645
|
+
}
|
|
60646
|
+
__name$1(skipVoid, "skipVoid");
|
|
60647
|
+
function skipUntil(ctx, sep, end) {
|
|
60648
|
+
let ptr = ctx.p;
|
|
60649
|
+
if (!end) {
|
|
60650
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
60651
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
60652
|
+
return;
|
|
60653
|
+
}
|
|
60654
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
60655
|
+
let c$1 = ctx.s.charCodeAt(ctx.p);
|
|
60656
|
+
if (c$1 === 35) skipComment(ctx);
|
|
60657
|
+
else if (c$1 === end || c$1 === sep) return;
|
|
60658
|
+
}
|
|
60659
|
+
throw new TomlError("cannot find end of structure", {
|
|
60660
|
+
toml: ctx.s,
|
|
60661
|
+
ptr
|
|
60662
|
+
});
|
|
60663
|
+
}
|
|
60664
|
+
__name$1(skipUntil, "skipUntil");
|
|
60630
60665
|
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
60631
60666
|
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
60632
60667
|
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
60633
|
-
|
|
60634
|
-
|
|
60635
|
-
|
|
60636
|
-
|
|
60637
|
-
|
|
60638
|
-
|
|
60639
|
-
r: "\r",
|
|
60640
|
-
"\"": "\"",
|
|
60641
|
-
"\\": "\\"
|
|
60642
|
-
};
|
|
60643
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
60644
|
-
let isLiteral = str[ptr] === "'";
|
|
60645
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
60668
|
+
function parseString(ctx) {
|
|
60669
|
+
let start = ctx.p;
|
|
60670
|
+
let c$1 = ctx.s.charCodeAt(ctx.p++);
|
|
60671
|
+
let first = c$1;
|
|
60672
|
+
let isLiteral = c$1 === 39;
|
|
60673
|
+
let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
|
|
60646
60674
|
if (isMultiline) {
|
|
60647
|
-
|
|
60648
|
-
if (
|
|
60649
|
-
if (str[ptr] === "\n") ptr++;
|
|
60675
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
|
|
60676
|
+
else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
|
|
60650
60677
|
}
|
|
60651
|
-
let tmp = 0;
|
|
60652
|
-
let isEscape;
|
|
60653
60678
|
let parsed = "";
|
|
60654
|
-
let sliceStart =
|
|
60655
|
-
|
|
60656
|
-
|
|
60657
|
-
|
|
60658
|
-
|
|
60659
|
-
|
|
60660
|
-
|
|
60661
|
-
|
|
60662
|
-
} else if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError("control characters are not allowed in strings", {
|
|
60663
|
-
toml: str,
|
|
60664
|
-
ptr: ptr - 1
|
|
60679
|
+
let sliceStart = ctx.p;
|
|
60680
|
+
let state = 0;
|
|
60681
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
60682
|
+
c$1 = ctx.s.charCodeAt(ctx.p);
|
|
60683
|
+
if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
|
|
60684
|
+
else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in strings", {
|
|
60685
|
+
toml: ctx.s,
|
|
60686
|
+
ptr: ctx.p
|
|
60665
60687
|
});
|
|
60666
|
-
if (
|
|
60667
|
-
|
|
60668
|
-
|
|
60669
|
-
|
|
60670
|
-
|
|
60671
|
-
|
|
60672
|
-
|
|
60688
|
+
else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
60689
|
+
if (isMultiline) {
|
|
60690
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
|
|
60691
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
|
|
60692
|
+
}
|
|
60693
|
+
if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
60694
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
60695
|
+
return parsed;
|
|
60696
|
+
} else if (!state) {
|
|
60697
|
+
if (!isLiteral && c$1 === 92) {
|
|
60698
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
60699
|
+
state = 1;
|
|
60700
|
+
}
|
|
60701
|
+
} else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
|
|
60702
|
+
let value = 0;
|
|
60703
|
+
let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
|
|
60704
|
+
for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
|
|
60705
|
+
let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
|
|
60706
|
+
let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
|
|
60707
|
+
if (digit < 0) throw new TomlError("invalid non-hex character in unicode escape", {
|
|
60708
|
+
toml: ctx.s,
|
|
60709
|
+
ptr: ctx.p + 1
|
|
60673
60710
|
});
|
|
60674
|
-
|
|
60675
|
-
|
|
60676
|
-
|
|
60677
|
-
|
|
60678
|
-
|
|
60679
|
-
|
|
60680
|
-
|
|
60681
|
-
|
|
60682
|
-
|
|
60683
|
-
|
|
60684
|
-
|
|
60685
|
-
|
|
60686
|
-
|
|
60687
|
-
|
|
60688
|
-
|
|
60689
|
-
|
|
60711
|
+
value = value << 4 | digit;
|
|
60712
|
+
}
|
|
60713
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError("invalid unicode escape", {
|
|
60714
|
+
toml: ctx.s,
|
|
60715
|
+
ptr: ctx.p
|
|
60716
|
+
});
|
|
60717
|
+
parsed += String.fromCodePoint(value);
|
|
60718
|
+
sliceStart = ctx.p + 1;
|
|
60719
|
+
state = 0;
|
|
60720
|
+
} else if (c$1 === 32 || c$1 === 9) state = 2;
|
|
60721
|
+
else {
|
|
60722
|
+
if (c$1 === 98) parsed += "\b";
|
|
60723
|
+
else if (c$1 === 116) parsed += " ";
|
|
60724
|
+
else if (c$1 === 110) parsed += "\n";
|
|
60725
|
+
else if (c$1 === 102) parsed += "\f";
|
|
60726
|
+
else if (c$1 === 114) parsed += "\r";
|
|
60727
|
+
else if (c$1 === 101) parsed += "\x1B";
|
|
60728
|
+
else if (c$1 === 34) parsed += "\"";
|
|
60729
|
+
else if (c$1 === 92) parsed += "\\";
|
|
60690
60730
|
else throw new TomlError("unrecognized escape sequence", {
|
|
60691
|
-
toml:
|
|
60692
|
-
ptr:
|
|
60731
|
+
toml: ctx.s,
|
|
60732
|
+
ptr: ctx.p
|
|
60733
|
+
});
|
|
60734
|
+
sliceStart = ctx.p + 1;
|
|
60735
|
+
state = 0;
|
|
60736
|
+
}
|
|
60737
|
+
else if (c$1 !== 32 && c$1 !== 9) {
|
|
60738
|
+
if (state === 2) throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
60739
|
+
toml: ctx.s,
|
|
60740
|
+
ptr: sliceStart
|
|
60693
60741
|
});
|
|
60694
|
-
|
|
60695
|
-
|
|
60696
|
-
tmp = ptr - 1;
|
|
60697
|
-
isEscape = true;
|
|
60698
|
-
parsed += str.slice(sliceStart, tmp);
|
|
60742
|
+
state = !isLiteral && c$1 === 92 ? 1 : 0;
|
|
60743
|
+
sliceStart = ctx.p;
|
|
60699
60744
|
}
|
|
60700
60745
|
}
|
|
60701
|
-
|
|
60746
|
+
throw new TomlError("unfinished string", {
|
|
60747
|
+
toml: ctx.s,
|
|
60748
|
+
ptr: start
|
|
60749
|
+
});
|
|
60702
60750
|
}
|
|
60703
60751
|
__name$1(parseString, "parseString");
|
|
60704
|
-
function
|
|
60705
|
-
|
|
60706
|
-
|
|
60752
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
60753
|
+
let value = ctx.s.slice(start, end);
|
|
60754
|
+
let commentIdx = value.indexOf("#");
|
|
60755
|
+
if (commentIdx > 0) {
|
|
60756
|
+
skipComment({
|
|
60757
|
+
s: value,
|
|
60758
|
+
p: commentIdx
|
|
60759
|
+
});
|
|
60760
|
+
value = value.slice(0, commentIdx);
|
|
60761
|
+
}
|
|
60762
|
+
return value.trimEnd();
|
|
60763
|
+
}
|
|
60764
|
+
__name$1(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
60765
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
60766
|
+
let ptr = ctx.p;
|
|
60767
|
+
let err = {
|
|
60768
|
+
toml: ctx.s,
|
|
60769
|
+
ptr
|
|
60770
|
+
};
|
|
60771
|
+
skipUntil(ctx, 44, end);
|
|
60772
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
60773
|
+
if (!value) throw new TomlError("incomplete declaration: value expected", err);
|
|
60707
60774
|
if (value === "-inf") return -Infinity;
|
|
60708
60775
|
if (value === "inf" || value === "+inf") return Infinity;
|
|
60709
60776
|
if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
|
|
60710
60777
|
if (value === "-0") return integersAsBigInt ? 0n : 0;
|
|
60711
60778
|
let isInt = INT_REGEX.test(value);
|
|
60712
60779
|
if (isInt || FLOAT_REGEX.test(value)) {
|
|
60713
|
-
if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed",
|
|
60714
|
-
toml,
|
|
60715
|
-
ptr
|
|
60716
|
-
});
|
|
60780
|
+
if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", err);
|
|
60717
60781
|
value = value.replace(/_/g, "");
|
|
60718
60782
|
let numeric$1 = +value;
|
|
60719
|
-
if (isNaN(numeric$1)) throw new TomlError("invalid number",
|
|
60720
|
-
toml,
|
|
60721
|
-
ptr
|
|
60722
|
-
});
|
|
60783
|
+
if (isNaN(numeric$1)) throw new TomlError("invalid number", err);
|
|
60723
60784
|
if (isInt) {
|
|
60724
|
-
if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly",
|
|
60725
|
-
toml,
|
|
60726
|
-
ptr
|
|
60727
|
-
});
|
|
60785
|
+
if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", err);
|
|
60728
60786
|
if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
|
|
60729
60787
|
}
|
|
60730
60788
|
return numeric$1;
|
|
60731
60789
|
}
|
|
60732
60790
|
const date$3 = new TomlDate(value);
|
|
60733
|
-
if (!date$3.isValid()) throw new TomlError("invalid value",
|
|
60734
|
-
toml,
|
|
60735
|
-
ptr
|
|
60736
|
-
});
|
|
60791
|
+
if (!date$3.isValid()) throw new TomlError("invalid value", err);
|
|
60737
60792
|
return date$3;
|
|
60738
60793
|
}
|
|
60739
60794
|
__name$1(parseValue, "parseValue");
|
|
60740
|
-
function
|
|
60741
|
-
let
|
|
60742
|
-
let
|
|
60743
|
-
if (
|
|
60744
|
-
|
|
60745
|
-
|
|
60746
|
-
|
|
60747
|
-
let trimmed = value.trimEnd();
|
|
60748
|
-
if (!allowNewLines) {
|
|
60749
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
60750
|
-
if (newlineIdx > -1) throw new TomlError("newlines are not allowed in inline tables", {
|
|
60751
|
-
toml: str,
|
|
60752
|
-
ptr: startPtr + newlineIdx
|
|
60795
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
60796
|
+
let ptr = ctx.p;
|
|
60797
|
+
let c$1 = ctx.s.charCodeAt(ptr);
|
|
60798
|
+
if (c$1 === 91 || c$1 === 123) {
|
|
60799
|
+
if (!ctx.d--) throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
60800
|
+
toml: ctx.s,
|
|
60801
|
+
ptr
|
|
60753
60802
|
});
|
|
60803
|
+
let value = c$1 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
60804
|
+
ctx.d++;
|
|
60805
|
+
return value;
|
|
60754
60806
|
}
|
|
60755
|
-
return
|
|
60756
|
-
|
|
60757
|
-
|
|
60758
|
-
|
|
60759
|
-
|
|
60760
|
-
|
|
60761
|
-
|
|
60762
|
-
|
|
60763
|
-
let c$1 = str[ptr];
|
|
60764
|
-
if (c$1 === "[" || c$1 === "{") {
|
|
60765
|
-
let [value, endPtr2] = c$1 === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
60766
|
-
let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
|
|
60767
|
-
if (endPtr2 - newPtr && end === "}") {
|
|
60768
|
-
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
60769
|
-
if (nextNewLine > -1) throw new TomlError("newlines are not allowed in inline tables", {
|
|
60770
|
-
toml: str,
|
|
60771
|
-
ptr: nextNewLine
|
|
60772
|
-
});
|
|
60773
|
-
}
|
|
60774
|
-
return [value, newPtr];
|
|
60775
|
-
}
|
|
60776
|
-
let endPtr;
|
|
60777
|
-
if (c$1 === "\"" || c$1 === "'") {
|
|
60778
|
-
endPtr = getStringEnd(str, ptr);
|
|
60779
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
60780
|
-
if (end) {
|
|
60781
|
-
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
60782
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") throw new TomlError("unexpected character encountered", {
|
|
60783
|
-
toml: str,
|
|
60784
|
-
ptr: endPtr
|
|
60785
|
-
});
|
|
60786
|
-
endPtr += +(str[endPtr] === ",");
|
|
60787
|
-
}
|
|
60788
|
-
return [parsed, endPtr];
|
|
60807
|
+
if (c$1 === 34 || c$1 === 39) return parseString(ctx);
|
|
60808
|
+
if (c$1 === 116) {
|
|
60809
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
|
|
60810
|
+
toml: ctx.s,
|
|
60811
|
+
ptr
|
|
60812
|
+
});
|
|
60813
|
+
ctx.p++;
|
|
60814
|
+
return true;
|
|
60789
60815
|
}
|
|
60790
|
-
|
|
60791
|
-
|
|
60792
|
-
|
|
60793
|
-
|
|
60794
|
-
|
|
60795
|
-
|
|
60796
|
-
|
|
60797
|
-
endPtr = skipVoid(str, ptr + slice[1]);
|
|
60798
|
-
endPtr += +(str[endPtr] === ",");
|
|
60816
|
+
if (c$1 === 102) {
|
|
60817
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
|
|
60818
|
+
toml: ctx.s,
|
|
60819
|
+
ptr
|
|
60820
|
+
});
|
|
60821
|
+
ctx.p++;
|
|
60822
|
+
return false;
|
|
60799
60823
|
}
|
|
60800
|
-
return
|
|
60824
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
60801
60825
|
}
|
|
60802
60826
|
__name$1(extractValue, "extractValue");
|
|
60803
60827
|
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
60804
|
-
function parseKey(
|
|
60805
|
-
let
|
|
60828
|
+
function parseKey(ctx, end = "=") {
|
|
60829
|
+
let start = ctx.p;
|
|
60830
|
+
let dot = start - 1;
|
|
60806
60831
|
let parsed = [];
|
|
60807
|
-
let endPtr =
|
|
60832
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
60808
60833
|
if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
60809
|
-
toml:
|
|
60810
|
-
ptr
|
|
60834
|
+
toml: ctx.s,
|
|
60835
|
+
ptr: start
|
|
60811
60836
|
});
|
|
60812
60837
|
do {
|
|
60813
|
-
let c$1 =
|
|
60814
|
-
if (c$1 !==
|
|
60815
|
-
if (c$1 ===
|
|
60816
|
-
toml:
|
|
60817
|
-
ptr
|
|
60818
|
-
});
|
|
60819
|
-
let eos = getStringEnd(str, ptr);
|
|
60820
|
-
if (eos < 0) throw new TomlError("unfinished string encountered", {
|
|
60821
|
-
toml: str,
|
|
60822
|
-
ptr
|
|
60838
|
+
let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
60839
|
+
if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
|
|
60840
|
+
if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError("multiline strings are not allowed in keys", {
|
|
60841
|
+
toml: ctx.s,
|
|
60842
|
+
ptr: ctx.p
|
|
60823
60843
|
});
|
|
60824
|
-
|
|
60825
|
-
|
|
60844
|
+
let part = parseString(ctx);
|
|
60845
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
60846
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
60826
60847
|
let newLine = indexOfNewline(strEnd);
|
|
60827
60848
|
if (newLine > -1) throw new TomlError("newlines are not allowed in keys", {
|
|
60828
|
-
toml:
|
|
60829
|
-
ptr:
|
|
60849
|
+
toml: ctx.s,
|
|
60850
|
+
ptr: newLine
|
|
60830
60851
|
});
|
|
60831
60852
|
if (strEnd.trimStart()) throw new TomlError("found extra tokens after the string part", {
|
|
60832
|
-
toml:
|
|
60833
|
-
ptr:
|
|
60853
|
+
toml: ctx.s,
|
|
60854
|
+
ptr: ctx.p
|
|
60834
60855
|
});
|
|
60835
|
-
if (endPtr <
|
|
60836
|
-
endPtr =
|
|
60856
|
+
if (endPtr < ctx.p) {
|
|
60857
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
60837
60858
|
if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
60838
|
-
toml:
|
|
60839
|
-
ptr
|
|
60859
|
+
toml: ctx.s,
|
|
60860
|
+
ptr: start
|
|
60840
60861
|
});
|
|
60841
60862
|
}
|
|
60842
|
-
parsed.push(
|
|
60863
|
+
parsed.push(part);
|
|
60843
60864
|
} else {
|
|
60844
|
-
dot =
|
|
60845
|
-
let part =
|
|
60865
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
60866
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
60846
60867
|
if (!KEY_PART_RE.test(part)) throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
60847
|
-
toml:
|
|
60848
|
-
ptr
|
|
60868
|
+
toml: ctx.s,
|
|
60869
|
+
ptr: ctx.p
|
|
60849
60870
|
});
|
|
60850
60871
|
parsed.push(part.trimEnd());
|
|
60851
60872
|
}
|
|
60852
60873
|
} while (dot + 1 && dot < endPtr);
|
|
60853
|
-
|
|
60874
|
+
ctx.p = endPtr + 1;
|
|
60875
|
+
skipVoid(ctx, true, true);
|
|
60876
|
+
return parsed;
|
|
60854
60877
|
}
|
|
60855
60878
|
__name$1(parseKey, "parseKey");
|
|
60856
|
-
function parseInlineTable(
|
|
60879
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
60857
60880
|
let res = {};
|
|
60858
60881
|
let seen = /* @__PURE__ */ new Set();
|
|
60859
60882
|
let c$1;
|
|
60860
|
-
|
|
60861
|
-
|
|
60862
|
-
|
|
60863
|
-
|
|
60864
|
-
|
|
60865
|
-
|
|
60866
|
-
}
|
|
60867
|
-
|
|
60868
|
-
|
|
60869
|
-
|
|
60870
|
-
|
|
60871
|
-
|
|
60872
|
-
|
|
60873
|
-
|
|
60874
|
-
|
|
60875
|
-
|
|
60876
|
-
|
|
60877
|
-
|
|
60878
|
-
|
|
60879
|
-
|
|
60880
|
-
|
|
60881
|
-
|
|
60882
|
-
|
|
60883
|
-
enumerable: true,
|
|
60884
|
-
configurable: true,
|
|
60885
|
-
writable: true
|
|
60886
|
-
});
|
|
60887
|
-
}
|
|
60888
|
-
if (hasOwn$1) throw new TomlError("trying to redefine an already defined value", {
|
|
60889
|
-
toml: str,
|
|
60890
|
-
ptr
|
|
60883
|
+
ctx.p++;
|
|
60884
|
+
while (ctx.p < ctx.s.length) {
|
|
60885
|
+
skipVoid(ctx);
|
|
60886
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
60887
|
+
ctx.p++;
|
|
60888
|
+
return res;
|
|
60889
|
+
}
|
|
60890
|
+
let k;
|
|
60891
|
+
let t$2 = res;
|
|
60892
|
+
let hasOwn$1 = false;
|
|
60893
|
+
let p$2 = ctx.p;
|
|
60894
|
+
let key = parseKey(ctx);
|
|
60895
|
+
for (let i$1 = 0; i$1 < key.length; i$1++) {
|
|
60896
|
+
if (i$1) t$2 = hasOwn$1 ? t$2[k] : t$2[k] = {};
|
|
60897
|
+
k = key[i$1];
|
|
60898
|
+
if ((hasOwn$1 = Object.hasOwn(t$2, k)) && (typeof t$2[k] !== "object" || seen.has(t$2[k]))) throw new TomlError("trying to redefine an already defined value", {
|
|
60899
|
+
toml: ctx.s,
|
|
60900
|
+
ptr: p$2
|
|
60901
|
+
});
|
|
60902
|
+
if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$2, k, {
|
|
60903
|
+
enumerable: true,
|
|
60904
|
+
configurable: true,
|
|
60905
|
+
writable: true
|
|
60891
60906
|
});
|
|
60892
|
-
let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
60893
|
-
seen.add(value);
|
|
60894
|
-
t$2[k] = value;
|
|
60895
|
-
ptr = valueEndPtr;
|
|
60896
|
-
comma$1 = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
60897
60907
|
}
|
|
60908
|
+
if (hasOwn$1) throw new TomlError("trying to redefine an already defined value", {
|
|
60909
|
+
toml: ctx.s,
|
|
60910
|
+
ptr: ctx.p
|
|
60911
|
+
});
|
|
60912
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
60913
|
+
seen.add(t$2[k] = value);
|
|
60914
|
+
skipVoid(ctx);
|
|
60915
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
|
|
60916
|
+
if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
|
|
60917
|
+
toml: ctx.s,
|
|
60918
|
+
ptr: ctx.p - 1
|
|
60919
|
+
});
|
|
60898
60920
|
}
|
|
60899
|
-
|
|
60900
|
-
toml:
|
|
60901
|
-
ptr:
|
|
60902
|
-
});
|
|
60903
|
-
if (!c$1) throw new TomlError("unfinished table encountered", {
|
|
60904
|
-
toml: str,
|
|
60905
|
-
ptr
|
|
60921
|
+
throw new TomlError("unfinished table encountered", {
|
|
60922
|
+
toml: ctx.s,
|
|
60923
|
+
ptr: ctx.p
|
|
60906
60924
|
});
|
|
60907
|
-
return [res, ptr];
|
|
60908
60925
|
}
|
|
60909
60926
|
__name$1(parseInlineTable, "parseInlineTable");
|
|
60910
|
-
function parseArray(
|
|
60927
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
60911
60928
|
let res = [];
|
|
60912
60929
|
let c$1;
|
|
60913
|
-
|
|
60914
|
-
while (
|
|
60915
|
-
|
|
60916
|
-
|
|
60917
|
-
|
|
60918
|
-
|
|
60919
|
-
|
|
60920
|
-
|
|
60921
|
-
|
|
60922
|
-
|
|
60923
|
-
|
|
60924
|
-
|
|
60925
|
-
|
|
60926
|
-
|
|
60930
|
+
ctx.p++;
|
|
60931
|
+
while (ctx.p < ctx.s.length) {
|
|
60932
|
+
skipVoid(ctx);
|
|
60933
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
60934
|
+
ctx.p++;
|
|
60935
|
+
return res;
|
|
60936
|
+
}
|
|
60937
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
60938
|
+
skipVoid(ctx);
|
|
60939
|
+
if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
|
|
60940
|
+
if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
|
|
60941
|
+
toml: ctx.s,
|
|
60942
|
+
ptr: ctx.p - 1
|
|
60943
|
+
});
|
|
60944
|
+
}
|
|
60945
|
+
throw new TomlError("unfinished array encountered", {
|
|
60946
|
+
toml: ctx.s,
|
|
60947
|
+
ptr: ctx.p
|
|
60927
60948
|
});
|
|
60928
|
-
return [res, ptr];
|
|
60929
60949
|
}
|
|
60930
60950
|
__name$1(parseArray, "parseArray");
|
|
60931
60951
|
function peekTable(key, table, meta$3, type) {
|
|
@@ -60995,46 +61015,51 @@ function peekTable(key, table, meta$3, type) {
|
|
|
60995
61015
|
}
|
|
60996
61016
|
__name$1(peekTable, "peekTable");
|
|
60997
61017
|
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
61018
|
+
let ctx = {
|
|
61019
|
+
s: toml,
|
|
61020
|
+
p: 0,
|
|
61021
|
+
d: maxDepth
|
|
61022
|
+
};
|
|
60998
61023
|
let res = {};
|
|
60999
61024
|
let meta$3 = {};
|
|
61025
|
+
let tmp;
|
|
61000
61026
|
let tbl = res;
|
|
61001
61027
|
let m = meta$3;
|
|
61002
|
-
|
|
61003
|
-
|
|
61004
|
-
|
|
61005
|
-
let
|
|
61028
|
+
skipVoid(ctx);
|
|
61029
|
+
while (ctx.p < toml.length) {
|
|
61030
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
61031
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
61032
|
+
tmp = ctx.p += +isTableArray;
|
|
61033
|
+
let k = parseKey(ctx, "]");
|
|
61006
61034
|
if (isTableArray) {
|
|
61007
|
-
if (toml
|
|
61035
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError("expected end of table declaration", {
|
|
61008
61036
|
toml,
|
|
61009
|
-
ptr:
|
|
61037
|
+
ptr: ctx.p - 1
|
|
61010
61038
|
});
|
|
61011
|
-
|
|
61039
|
+
ctx.p++;
|
|
61012
61040
|
}
|
|
61013
|
-
let p$2 = peekTable(k
|
|
61041
|
+
let p$2 = peekTable(k, res, meta$3, isTableArray ? 2 : 1);
|
|
61014
61042
|
if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
|
|
61015
61043
|
toml,
|
|
61016
|
-
ptr
|
|
61044
|
+
ptr: tmp
|
|
61017
61045
|
});
|
|
61018
61046
|
m = p$2[2];
|
|
61019
61047
|
tbl = p$2[1];
|
|
61020
|
-
ptr = k[1];
|
|
61021
61048
|
} else {
|
|
61022
|
-
|
|
61023
|
-
let p$2 = peekTable(
|
|
61049
|
+
tmp = ctx.p;
|
|
61050
|
+
let p$2 = peekTable(parseKey(ctx), tbl, m, 0);
|
|
61024
61051
|
if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
|
|
61025
61052
|
toml,
|
|
61026
|
-
ptr
|
|
61053
|
+
ptr: tmp
|
|
61027
61054
|
});
|
|
61028
|
-
|
|
61029
|
-
p$2[1][p$2[0]] = v[0];
|
|
61030
|
-
ptr = v[1];
|
|
61055
|
+
p$2[1][p$2[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
61031
61056
|
}
|
|
61032
|
-
|
|
61033
|
-
if (toml
|
|
61057
|
+
skipVoid(ctx, true);
|
|
61058
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
61034
61059
|
toml,
|
|
61035
|
-
ptr
|
|
61060
|
+
ptr: ctx.p
|
|
61036
61061
|
});
|
|
61037
|
-
|
|
61062
|
+
skipVoid(ctx);
|
|
61038
61063
|
}
|
|
61039
61064
|
return res;
|
|
61040
61065
|
}
|
|
@@ -61044,7 +61069,8 @@ function extendedTypeOf(obj) {
|
|
|
61044
61069
|
let type = typeof obj;
|
|
61045
61070
|
if (type === "object") {
|
|
61046
61071
|
if (Array.isArray(obj)) return "array";
|
|
61047
|
-
if (obj instanceof Date) return "date";
|
|
61072
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
|
|
61073
|
+
if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
|
|
61048
61074
|
}
|
|
61049
61075
|
return type;
|
|
61050
61076
|
}
|
|
@@ -61058,23 +61084,31 @@ function formatString(s) {
|
|
|
61058
61084
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
61059
61085
|
}
|
|
61060
61086
|
__name$1(formatString, "formatString");
|
|
61087
|
+
function stringifyTemporal(temporal) {
|
|
61088
|
+
return temporal.toString({
|
|
61089
|
+
calendarName: "never",
|
|
61090
|
+
timeZoneName: "never"
|
|
61091
|
+
});
|
|
61092
|
+
}
|
|
61093
|
+
__name$1(stringifyTemporal, "stringifyTemporal");
|
|
61061
61094
|
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
61062
61095
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
61063
|
-
|
|
61064
|
-
|
|
61065
|
-
|
|
61066
|
-
|
|
61067
|
-
|
|
61068
|
-
|
|
61069
|
-
|
|
61070
|
-
|
|
61071
|
-
|
|
61072
|
-
|
|
61073
|
-
|
|
61074
|
-
|
|
61075
|
-
|
|
61076
|
-
|
|
61077
|
-
|
|
61096
|
+
switch (type) {
|
|
61097
|
+
case "number":
|
|
61098
|
+
if (isNaN(val)) return "nan";
|
|
61099
|
+
if (val === Infinity) return "inf";
|
|
61100
|
+
if (val === -Infinity) return "-inf";
|
|
61101
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
|
|
61102
|
+
case "bigint":
|
|
61103
|
+
case "boolean": return val.toString();
|
|
61104
|
+
case "string": return formatString(val);
|
|
61105
|
+
case "date":
|
|
61106
|
+
if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
|
|
61107
|
+
return val.toISOString();
|
|
61108
|
+
case "object": return stringifyInlineTable(val, depth, numberAsFloat);
|
|
61109
|
+
case "array": return stringifyArray(val, depth, numberAsFloat);
|
|
61110
|
+
case "temporal": return stringifyTemporal(val);
|
|
61111
|
+
}
|
|
61078
61112
|
}
|
|
61079
61113
|
__name$1(stringifyValue, "stringifyValue");
|
|
61080
61114
|
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
@@ -61903,7 +61937,7 @@ function scrubEncryptedCredentials(options) {
|
|
|
61903
61937
|
__name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
61904
61938
|
|
|
61905
61939
|
//#endregion
|
|
61906
|
-
//#region ../workers-auth/dist/chunk-
|
|
61940
|
+
//#region ../workers-auth/dist/chunk-MXU5RVJR.mjs
|
|
61907
61941
|
function createPreferences(getConfigPath) {
|
|
61908
61942
|
function getUserPreferencesPath() {
|
|
61909
61943
|
return path__default.resolve(getConfigPath(), "preferences.json");
|
|
@@ -62670,8 +62704,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
62670
62704
|
return credentialStorage.getActiveStore(oauthFlow.getActiveProfile());
|
|
62671
62705
|
}
|
|
62672
62706
|
__name$1(getCredentialStore, "getCredentialStore");
|
|
62673
|
-
function setTemporaryAllowed(allowed) {
|
|
62674
|
-
oauthFlow.setTemporaryAllowed(allowed);
|
|
62707
|
+
function setTemporaryAllowed(allowed, request$1) {
|
|
62708
|
+
oauthFlow.setTemporaryAllowed(allowed, request$1);
|
|
62675
62709
|
}
|
|
62676
62710
|
__name$1(setTemporaryAllowed, "setTemporaryAllowed");
|
|
62677
62711
|
function getAPIToken$1() {
|
|
@@ -63057,7 +63091,7 @@ function getCfConfigPath() {
|
|
|
63057
63091
|
});
|
|
63058
63092
|
}
|
|
63059
63093
|
__name$1(getCfConfigPath, "getCfConfigPath");
|
|
63060
|
-
var
|
|
63094
|
+
var CF_CLIENT_REGISTERED_SCOPES = [
|
|
63061
63095
|
"access:read",
|
|
63062
63096
|
"access:write",
|
|
63063
63097
|
"account:read",
|
|
@@ -63533,102 +63567,21 @@ var CF_REGISTERED_SCOPES = [
|
|
|
63533
63567
|
"zone.read",
|
|
63534
63568
|
"zone.write"
|
|
63535
63569
|
];
|
|
63536
|
-
var
|
|
63537
|
-
"
|
|
63538
|
-
"
|
|
63539
|
-
"
|
|
63540
|
-
"
|
|
63541
|
-
"
|
|
63542
|
-
"
|
|
63543
|
-
|
|
63544
|
-
|
|
63545
|
-
|
|
63546
|
-
"ai:read",
|
|
63547
|
-
"ai:write",
|
|
63548
|
-
"ai-search:read",
|
|
63549
|
-
"ai-search:run",
|
|
63550
|
-
"ai-search:write",
|
|
63551
|
-
"aiaudit:read",
|
|
63552
|
-
"aiaudit:write",
|
|
63553
|
-
"aig:read",
|
|
63554
|
-
"aig:write",
|
|
63555
|
-
"auditlogs:read",
|
|
63556
|
-
"browser:read",
|
|
63557
|
-
"browser:write",
|
|
63558
|
-
"cfone:read",
|
|
63559
|
-
"cfone:write",
|
|
63560
|
-
"cloudchamber:write",
|
|
63561
|
-
"connectivity:admin",
|
|
63562
|
-
"connectivity:bind",
|
|
63563
|
-
"connectivity:read",
|
|
63564
|
-
"constellation:write",
|
|
63565
|
-
"containers:write",
|
|
63566
|
-
"d1:write",
|
|
63567
|
-
"dex:read",
|
|
63568
|
-
"dex:write",
|
|
63569
|
-
"dns_analytics:read",
|
|
63570
|
-
"dns_records:edit",
|
|
63571
|
-
"dns_records:read",
|
|
63572
|
-
"dns_settings:read",
|
|
63573
|
-
"email_routing:write",
|
|
63574
|
-
"email_sending:write",
|
|
63575
|
-
"firstpartytags:write",
|
|
63576
|
-
"images:read",
|
|
63577
|
-
"images:write",
|
|
63578
|
-
"lb:edit",
|
|
63579
|
-
"lb:read",
|
|
63580
|
-
"logpush:read",
|
|
63581
|
-
"logpush:write",
|
|
63582
|
-
"mcp_portals:read",
|
|
63583
|
-
"mcp_portals:write",
|
|
63584
|
-
"notebook-examples:read",
|
|
63585
|
-
"notification:read",
|
|
63586
|
-
"notification:write",
|
|
63587
|
-
"pages:read",
|
|
63588
|
-
"pages:write",
|
|
63589
|
-
"pipelines:read",
|
|
63590
|
-
"pipelines:setup",
|
|
63591
|
-
"pipelines:write",
|
|
63592
|
-
"query_cache:write",
|
|
63593
|
-
"queues:write",
|
|
63594
|
-
"r2_catalog:write",
|
|
63595
|
-
"radar:read",
|
|
63596
|
-
"rag:read",
|
|
63597
|
-
"rag:write",
|
|
63598
|
-
"registrar:read",
|
|
63599
|
-
"registrar:write",
|
|
63600
|
-
"secrets_store:read",
|
|
63601
|
-
"secrets_store:write",
|
|
63602
|
-
"sso-connector:read",
|
|
63603
|
-
"sso-connector:write",
|
|
63604
|
-
"ssl_certs:write",
|
|
63605
|
-
"tag.write",
|
|
63606
|
-
"teams:pii",
|
|
63607
|
-
"teams:read",
|
|
63608
|
-
"teams:secure_location",
|
|
63609
|
-
"teams:write",
|
|
63610
|
-
"url_scanner:read",
|
|
63611
|
-
"url_scanner:write",
|
|
63612
|
-
"vectorize:write",
|
|
63613
|
-
"workers:read",
|
|
63614
|
-
"workers:write",
|
|
63615
|
-
"workers_builds:read",
|
|
63616
|
-
"workers_builds:write",
|
|
63617
|
-
"workers_deployments:read",
|
|
63618
|
-
"workers_kv:write",
|
|
63619
|
-
"workers_observability:read",
|
|
63620
|
-
"workers_observability:write",
|
|
63621
|
-
"workers_observability_telemetry:write",
|
|
63622
|
-
"workers_routes:write",
|
|
63623
|
-
"workers_scripts:write",
|
|
63624
|
-
"workers_tail:read",
|
|
63625
|
-
"zone:read"
|
|
63626
|
-
]];
|
|
63570
|
+
var CF_UNGRANTABLE_SCOPE_SET = new Set([
|
|
63571
|
+
"billing:read",
|
|
63572
|
+
"billing:write",
|
|
63573
|
+
"email_routing:read",
|
|
63574
|
+
"email_sending:read",
|
|
63575
|
+
"notebook-managed:read",
|
|
63576
|
+
"oauth_account_ssl_and_certificates_write"
|
|
63577
|
+
]);
|
|
63578
|
+
var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter((scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope));
|
|
63579
|
+
var DefaultScopeKeys$1 = [...CF_REQUESTABLE_SCOPES];
|
|
63627
63580
|
function setLoginScopeKeys$1(scopes) {
|
|
63628
63581
|
DefaultScopeKeys$1 = scopes;
|
|
63629
63582
|
}
|
|
63630
63583
|
__name$1(setLoginScopeKeys$1, "setLoginScopeKeys");
|
|
63631
|
-
var CF_SCOPE_SET = new Set(
|
|
63584
|
+
var CF_SCOPE_SET = new Set(CF_REQUESTABLE_SCOPES);
|
|
63632
63585
|
function validateScopeKeys$1(scopes) {
|
|
63633
63586
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
63634
63587
|
}
|
|
@@ -71932,7 +71885,6 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
|
|
|
71932
71885
|
const loadedConfig = await loadCloudflareConfig({
|
|
71933
71886
|
root,
|
|
71934
71887
|
mode,
|
|
71935
|
-
command: viteEnv.command,
|
|
71936
71888
|
types: types$5
|
|
71937
71889
|
});
|
|
71938
71890
|
const settings = {
|
|
@@ -72100,16 +72052,15 @@ function resolveWorker(workerConfig, devOnly, directoryName) {
|
|
|
72100
72052
|
};
|
|
72101
72053
|
}
|
|
72102
72054
|
const CONFIG_FILENAME = "cloudflare.config.ts";
|
|
72103
|
-
const
|
|
72055
|
+
const TYPES_OUTPUT_PATH = ".cloudflare/types/index.d.ts";
|
|
72104
72056
|
const EXPERIMENTAL_CONFIG_PKG = "@cloudflare/vite-plugin/experimental-config";
|
|
72105
72057
|
/**
|
|
72106
72058
|
* Load and validate `cloudflare.config.ts` via `@cloudflare/config`, if it
|
|
72107
72059
|
* exists. Returns the parsed default export, the absolute path of the loaded file, and
|
|
72108
72060
|
* the files imported while resolving the config (for watch-mode).
|
|
72109
72061
|
*
|
|
72110
|
-
* When `types.generate` is true, also writes
|
|
72111
|
-
*
|
|
72112
|
-
* Type generation only runs in dev.
|
|
72062
|
+
* When `types.generate` is true, also writes `.cloudflare/types/index.d.ts`
|
|
72063
|
+
* when the generated content differs from what's already on disk.
|
|
72113
72064
|
*/
|
|
72114
72065
|
async function loadCloudflareConfig(options) {
|
|
72115
72066
|
const configPath = path.resolve(options.root, CONFIG_FILENAME);
|
|
@@ -72121,7 +72072,7 @@ async function loadCloudflareConfig(options) {
|
|
|
72121
72072
|
if (!result.success) throw new Error(`Invalid \`${CONFIG_FILENAME}\`:\n${result.error.message}`);
|
|
72122
72073
|
const worker = result.data.worker;
|
|
72123
72074
|
if (worker === void 0) throw new Error(`\`${CONFIG_FILENAME}\` must define a Worker using the \`worker\` property.`);
|
|
72124
|
-
if (options.
|
|
72075
|
+
if (options.types.generate) await writeCloudflareTypes({
|
|
72125
72076
|
root: options.root,
|
|
72126
72077
|
configPath,
|
|
72127
72078
|
includeRuntime: options.types.includeRuntime,
|
|
@@ -72138,7 +72089,7 @@ async function loadCloudflareConfig(options) {
|
|
|
72138
72089
|
};
|
|
72139
72090
|
}
|
|
72140
72091
|
/**
|
|
72141
|
-
* Write
|
|
72092
|
+
* Write `.cloudflare/types/index.d.ts` using
|
|
72142
72093
|
* `@cloudflare/config`'s `generateTypes`, targeting the vite-plugin's
|
|
72143
72094
|
* `experimental-config` subpath (so users don't need a direct dependency on
|
|
72144
72095
|
* `@cloudflare/config`).
|
|
@@ -72152,15 +72103,17 @@ async function loadCloudflareConfig(options) {
|
|
|
72152
72103
|
* check and the diff-before-write (only writes if content differs, to avoid
|
|
72153
72104
|
* touching mtimes unnecessarily).
|
|
72154
72105
|
*/
|
|
72155
|
-
async function
|
|
72156
|
-
const outputPath = path.resolve(options.root,
|
|
72157
|
-
const
|
|
72106
|
+
async function writeCloudflareTypes(options) {
|
|
72107
|
+
const outputPath = path.resolve(options.root, TYPES_OUTPUT_PATH);
|
|
72108
|
+
const outputDir = path.dirname(outputPath);
|
|
72109
|
+
const relativeConfigPath = vite.normalizePath(path.relative(outputDir, options.configPath));
|
|
72110
|
+
const configImportPath = relativeConfigPath.startsWith(".") ? relativeConfigPath : `./${relativeConfigPath}`;
|
|
72158
72111
|
let existingContent;
|
|
72159
72112
|
try {
|
|
72160
72113
|
existingContent = await fs$1.readFile(outputPath, "utf8");
|
|
72161
72114
|
} catch {}
|
|
72162
72115
|
let content = generateTypes({
|
|
72163
|
-
configPath:
|
|
72116
|
+
configPath: configImportPath,
|
|
72164
72117
|
packageName: EXPERIMENTAL_CONFIG_PKG
|
|
72165
72118
|
});
|
|
72166
72119
|
if (options.includeRuntime) {
|
|
@@ -72171,7 +72124,10 @@ async function writeWorkerConfigurationDts(options) {
|
|
|
72171
72124
|
});
|
|
72172
72125
|
content += `\n${runtimeHeader}\n${RUNTIME_TYPES_MARKER}\n${runtimeTypes}`;
|
|
72173
72126
|
}
|
|
72174
|
-
if (existingContent !== content)
|
|
72127
|
+
if (existingContent !== content) {
|
|
72128
|
+
await fs$1.mkdir(outputDir, { recursive: true });
|
|
72129
|
+
await fs$1.writeFile(outputPath, content);
|
|
72130
|
+
}
|
|
72175
72131
|
}
|
|
72176
72132
|
|
|
72177
72133
|
//#endregion
|
|
@@ -75254,7 +75210,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
75254
75210
|
//#endregion
|
|
75255
75211
|
//#region ../remote-bindings/dist/index.mjs
|
|
75256
75212
|
var import_undici = require_undici();
|
|
75257
|
-
var version$2 = "0.0.
|
|
75213
|
+
var version$2 = "0.0.32";
|
|
75258
75214
|
var NoDefaultValueProvided = class extends UserError {
|
|
75259
75215
|
constructor() {
|
|
75260
75216
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|