@cloudflare/workers-utils 0.40.1 → 0.41.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/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-S6ZAI5DC.mjs → chunk-4PNP2TCS.mjs} +1 -1
- package/dist/{chunk-JGKSDUFK.mjs → chunk-IKXB77SR.mjs} +406 -456
- package/dist/{compliance-Bwzfy2P3.d.mts → compliance-CLyWFvPo.d.mts} +3 -2
- package/dist/compliance.d.mts +1 -1
- package/dist/index.d.mts +47 -5
- package/dist/index.mjs +962 -53
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +1 -1
- package/package.json +4 -2
|
@@ -39,7 +39,6 @@ function hasDurableObjectExports(exports$1) {
|
|
|
39
39
|
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
40
40
|
|
|
41
41
|
// src/config/containers.ts
|
|
42
|
-
var CONTAINER_IMAGES_BINDING = "EXPERIMENTAL_CLOUDFLARE_CONTAINER_IMAGES";
|
|
43
42
|
function isDurableObjectContainerApp(container) {
|
|
44
43
|
return container.scheduling_policy === "durable_object";
|
|
45
44
|
}
|
|
@@ -1599,133 +1598,8 @@ function applyEdits(text, edits) {
|
|
|
1599
1598
|
}
|
|
1600
1599
|
__name(applyEdits, "applyEdits");
|
|
1601
1600
|
|
|
1602
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1603
|
-
|
|
1604
|
-
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1605
|
-
return [lines.length, lines.pop().length + 1];
|
|
1606
|
-
}
|
|
1607
|
-
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
1608
|
-
function makeCodeBlock(string, line, column) {
|
|
1609
|
-
let lines = string.split(/\r\n|\n|\r/g);
|
|
1610
|
-
let codeblock = "";
|
|
1611
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1612
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
1613
|
-
let l = lines[i - 1];
|
|
1614
|
-
if (!l)
|
|
1615
|
-
continue;
|
|
1616
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
1617
|
-
codeblock += ": ";
|
|
1618
|
-
codeblock += l;
|
|
1619
|
-
codeblock += "\n";
|
|
1620
|
-
if (i === line) {
|
|
1621
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
1622
|
-
codeblock += "^\n";
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
return codeblock;
|
|
1626
|
-
}
|
|
1627
|
-
__name(makeCodeBlock, "makeCodeBlock");
|
|
1628
|
-
var TomlError = class extends Error {
|
|
1629
|
-
static {
|
|
1630
|
-
__name(this, "TomlError");
|
|
1631
|
-
}
|
|
1632
|
-
line;
|
|
1633
|
-
column;
|
|
1634
|
-
codeblock;
|
|
1635
|
-
constructor(message, options) {
|
|
1636
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
1637
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
1638
|
-
super(`Invalid TOML document: ${message}
|
|
1639
|
-
|
|
1640
|
-
${codeblock}`, options);
|
|
1641
|
-
this.line = line;
|
|
1642
|
-
this.column = column;
|
|
1643
|
-
this.codeblock = codeblock;
|
|
1644
|
-
}
|
|
1645
|
-
};
|
|
1646
|
-
|
|
1647
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
1648
|
-
function isEscaped(str, ptr) {
|
|
1649
|
-
let i = 0;
|
|
1650
|
-
while (str[ptr - ++i] === "\\")
|
|
1651
|
-
;
|
|
1652
|
-
return --i && i % 2;
|
|
1653
|
-
}
|
|
1654
|
-
__name(isEscaped, "isEscaped");
|
|
1655
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
1656
|
-
let idx = str.indexOf("\n", start);
|
|
1657
|
-
if (str[idx - 1] === "\r")
|
|
1658
|
-
idx--;
|
|
1659
|
-
return idx <= end ? idx : -1;
|
|
1660
|
-
}
|
|
1661
|
-
__name(indexOfNewline, "indexOfNewline");
|
|
1662
|
-
function skipComment(str, ptr) {
|
|
1663
|
-
for (let i = ptr; i < str.length; i++) {
|
|
1664
|
-
let c = str[i];
|
|
1665
|
-
if (c === "\n")
|
|
1666
|
-
return i;
|
|
1667
|
-
if (c === "\r" && str[i + 1] === "\n")
|
|
1668
|
-
return i + 1;
|
|
1669
|
-
if (c < " " && c !== " " || c === "\x7F") {
|
|
1670
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
1671
|
-
toml: str,
|
|
1672
|
-
ptr
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
return str.length;
|
|
1677
|
-
}
|
|
1678
|
-
__name(skipComment, "skipComment");
|
|
1679
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
1680
|
-
let c;
|
|
1681
|
-
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
1682
|
-
ptr++;
|
|
1683
|
-
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
1684
|
-
}
|
|
1685
|
-
__name(skipVoid, "skipVoid");
|
|
1686
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
1687
|
-
if (!end) {
|
|
1688
|
-
ptr = indexOfNewline(str, ptr);
|
|
1689
|
-
return ptr < 0 ? str.length : ptr;
|
|
1690
|
-
}
|
|
1691
|
-
for (let i = ptr; i < str.length; i++) {
|
|
1692
|
-
let c = str[i];
|
|
1693
|
-
if (c === "#") {
|
|
1694
|
-
i = indexOfNewline(str, i);
|
|
1695
|
-
} else if (c === sep) {
|
|
1696
|
-
return i + 1;
|
|
1697
|
-
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
1698
|
-
return i;
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
throw new TomlError("cannot find end of structure", {
|
|
1702
|
-
toml: str,
|
|
1703
|
-
ptr
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
__name(skipUntil, "skipUntil");
|
|
1707
|
-
function getStringEnd(str, seek) {
|
|
1708
|
-
let first = str[seek];
|
|
1709
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
1710
|
-
seek += target.length - 1;
|
|
1711
|
-
do
|
|
1712
|
-
seek = str.indexOf(target, ++seek);
|
|
1713
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
1714
|
-
if (seek > -1) {
|
|
1715
|
-
seek += target.length;
|
|
1716
|
-
if (target.length > 1) {
|
|
1717
|
-
if (str[seek] === first)
|
|
1718
|
-
seek++;
|
|
1719
|
-
if (str[seek] === first)
|
|
1720
|
-
seek++;
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
return seek;
|
|
1724
|
-
}
|
|
1725
|
-
__name(getStringEnd, "getStringEnd");
|
|
1726
|
-
|
|
1727
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
1728
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1601
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/date.js
|
|
1602
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1729
1603
|
var TomlDate = class _TomlDate extends Date {
|
|
1730
1604
|
static {
|
|
1731
1605
|
__name(this, "TomlDate");
|
|
@@ -1819,99 +1693,235 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
1819
1693
|
}
|
|
1820
1694
|
};
|
|
1821
1695
|
|
|
1822
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1696
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/error.js
|
|
1697
|
+
function getLineColFromPtr(string, ptr) {
|
|
1698
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1699
|
+
return [lines.length, lines.pop().length + 1];
|
|
1700
|
+
}
|
|
1701
|
+
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
1702
|
+
function makeCodeBlock(string, line, column) {
|
|
1703
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
1704
|
+
let codeblock = "";
|
|
1705
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1706
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
1707
|
+
let l = lines[i - 1];
|
|
1708
|
+
if (!l)
|
|
1709
|
+
continue;
|
|
1710
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
1711
|
+
codeblock += ": ";
|
|
1712
|
+
codeblock += l;
|
|
1713
|
+
codeblock += "\n";
|
|
1714
|
+
if (i === line) {
|
|
1715
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
1716
|
+
codeblock += "^\n";
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
return codeblock;
|
|
1720
|
+
}
|
|
1721
|
+
__name(makeCodeBlock, "makeCodeBlock");
|
|
1722
|
+
var TomlError = class extends Error {
|
|
1723
|
+
static {
|
|
1724
|
+
__name(this, "TomlError");
|
|
1725
|
+
}
|
|
1726
|
+
line;
|
|
1727
|
+
column;
|
|
1728
|
+
codeblock;
|
|
1729
|
+
constructor(message, options) {
|
|
1730
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
1731
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
1732
|
+
super(`Invalid TOML document: ${message}
|
|
1733
|
+
|
|
1734
|
+
${codeblock}`, options);
|
|
1735
|
+
this.line = line;
|
|
1736
|
+
this.column = column;
|
|
1737
|
+
this.codeblock = codeblock;
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/util.js
|
|
1742
|
+
function indexOfNewline(str, start = 0) {
|
|
1743
|
+
let idx = str.indexOf("\n", start);
|
|
1744
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
1745
|
+
idx--;
|
|
1746
|
+
return idx;
|
|
1747
|
+
}
|
|
1748
|
+
__name(indexOfNewline, "indexOfNewline");
|
|
1749
|
+
function skipComment(ctx) {
|
|
1750
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1751
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
1752
|
+
if (c === 10)
|
|
1753
|
+
break;
|
|
1754
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
1755
|
+
ctx.p++;
|
|
1756
|
+
break;
|
|
1757
|
+
}
|
|
1758
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
1759
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
1760
|
+
toml: ctx.s,
|
|
1761
|
+
ptr: ctx.p
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
__name(skipComment, "skipComment");
|
|
1767
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
1768
|
+
let c;
|
|
1769
|
+
while (1) {
|
|
1770
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
1771
|
+
ctx.p++;
|
|
1772
|
+
if (banComments || c !== 35)
|
|
1773
|
+
break;
|
|
1774
|
+
skipComment(ctx);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
__name(skipVoid, "skipVoid");
|
|
1778
|
+
function skipUntil(ctx, sep, end) {
|
|
1779
|
+
let ptr = ctx.p;
|
|
1780
|
+
if (!end) {
|
|
1781
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
1782
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1786
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
1787
|
+
if (c === 35) {
|
|
1788
|
+
skipComment(ctx);
|
|
1789
|
+
} else if (c === end || c === sep) {
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
throw new TomlError("cannot find end of structure", {
|
|
1794
|
+
toml: ctx.s,
|
|
1795
|
+
ptr
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
__name(skipUntil, "skipUntil");
|
|
1799
|
+
|
|
1800
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/primitive.js
|
|
1823
1801
|
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
1824
1802
|
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
1825
1803
|
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
r: "\r",
|
|
1833
|
-
'"': '"',
|
|
1834
|
-
"\\": "\\"
|
|
1835
|
-
};
|
|
1836
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
1837
|
-
let isLiteral = str[ptr] === "'";
|
|
1838
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
1804
|
+
function parseString(ctx) {
|
|
1805
|
+
let start = ctx.p;
|
|
1806
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
1807
|
+
let first = c;
|
|
1808
|
+
let isLiteral = c === 39;
|
|
1809
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
1839
1810
|
if (isMultiline) {
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
}
|
|
1846
|
-
let tmp = 0;
|
|
1847
|
-
let isEscape;
|
|
1811
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
1812
|
+
ctx.p++;
|
|
1813
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
1814
|
+
ctx.p += 2;
|
|
1815
|
+
}
|
|
1848
1816
|
let parsed = "";
|
|
1849
|
-
let sliceStart =
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
ptr: ptr - 1
|
|
1857
|
-
});
|
|
1858
|
-
}
|
|
1859
|
-
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
1817
|
+
let sliceStart = ctx.p;
|
|
1818
|
+
let state = 0;
|
|
1819
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1820
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
1821
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
1822
|
+
state = state && 3;
|
|
1823
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
1860
1824
|
throw new TomlError("control characters are not allowed in strings", {
|
|
1861
|
-
toml:
|
|
1862
|
-
ptr:
|
|
1825
|
+
toml: ctx.s,
|
|
1826
|
+
ptr: ctx.p
|
|
1863
1827
|
});
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1828
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
1829
|
+
if (isMultiline) {
|
|
1830
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
1831
|
+
ctx.p++;
|
|
1832
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
1833
|
+
ctx.p++;
|
|
1834
|
+
}
|
|
1835
|
+
if (!state)
|
|
1836
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
1837
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
1838
|
+
return parsed;
|
|
1839
|
+
} else if (!state) {
|
|
1840
|
+
if (!isLiteral && c === 92) {
|
|
1841
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
1842
|
+
state = 1;
|
|
1843
|
+
}
|
|
1844
|
+
} else if (state === 1) {
|
|
1845
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
1846
|
+
let value = 0;
|
|
1847
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
1848
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
1849
|
+
let hex = ctx.s.charCodeAt(ctx.p + 1);
|
|
1850
|
+
let digit = (
|
|
1851
|
+
/* 0-9 */
|
|
1852
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
1853
|
+
/* A-F */
|
|
1854
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
1855
|
+
/* a-f */
|
|
1856
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
1857
|
+
)
|
|
1858
|
+
)
|
|
1859
|
+
);
|
|
1860
|
+
if (digit < 0)
|
|
1861
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
1862
|
+
value = value << 4 | digit;
|
|
1882
1863
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
1886
|
-
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
1887
|
-
toml: str,
|
|
1888
|
-
ptr: tmp
|
|
1889
|
-
});
|
|
1864
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
1865
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
1890
1866
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1867
|
+
parsed += String.fromCodePoint(value);
|
|
1868
|
+
sliceStart = ctx.p + 1;
|
|
1869
|
+
state = 0;
|
|
1870
|
+
} else if (c === 32 || c === 9) {
|
|
1871
|
+
state = 2;
|
|
1894
1872
|
} else {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1873
|
+
if (c === 98)
|
|
1874
|
+
parsed += "\b";
|
|
1875
|
+
else if (c === 116)
|
|
1876
|
+
parsed += " ";
|
|
1877
|
+
else if (c === 110)
|
|
1878
|
+
parsed += "\n";
|
|
1879
|
+
else if (c === 102)
|
|
1880
|
+
parsed += "\f";
|
|
1881
|
+
else if (c === 114)
|
|
1882
|
+
parsed += "\r";
|
|
1883
|
+
else if (c === 101)
|
|
1884
|
+
parsed += "\x1B";
|
|
1885
|
+
else if (c === 34)
|
|
1886
|
+
parsed += '"';
|
|
1887
|
+
else if (c === 92)
|
|
1888
|
+
parsed += "\\";
|
|
1889
|
+
else
|
|
1890
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
1891
|
+
sliceStart = ctx.p + 1;
|
|
1892
|
+
state = 0;
|
|
1893
|
+
}
|
|
1894
|
+
} else if (c !== 32 && c !== 9) {
|
|
1895
|
+
if (state === 2) {
|
|
1896
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
1897
|
+
toml: ctx.s,
|
|
1898
|
+
ptr: sliceStart
|
|
1898
1899
|
});
|
|
1899
1900
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
tmp = ptr - 1;
|
|
1903
|
-
isEscape = true;
|
|
1904
|
-
parsed += str.slice(sliceStart, tmp);
|
|
1901
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
1902
|
+
sliceStart = ctx.p;
|
|
1905
1903
|
}
|
|
1906
1904
|
}
|
|
1907
|
-
|
|
1905
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
1908
1906
|
}
|
|
1909
1907
|
__name(parseString, "parseString");
|
|
1910
|
-
function
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
if (
|
|
1914
|
-
|
|
1908
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
1909
|
+
let value = ctx.s.slice(start, end);
|
|
1910
|
+
let commentIdx = value.indexOf("#");
|
|
1911
|
+
if (commentIdx > 0) {
|
|
1912
|
+
skipComment({ s: value, p: commentIdx});
|
|
1913
|
+
value = value.slice(0, commentIdx);
|
|
1914
|
+
}
|
|
1915
|
+
return value.trimEnd();
|
|
1916
|
+
}
|
|
1917
|
+
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
1918
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
1919
|
+
let ptr = ctx.p;
|
|
1920
|
+
let err = { toml: ctx.s, ptr };
|
|
1921
|
+
skipUntil(ctx, 44, end);
|
|
1922
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
1923
|
+
if (!value)
|
|
1924
|
+
throw new TomlError("incomplete declaration: value expected", err);
|
|
1915
1925
|
if (value === "-inf")
|
|
1916
1926
|
return -Infinity;
|
|
1917
1927
|
if (value === "inf" || value === "+inf")
|
|
@@ -1923,25 +1933,16 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
1923
1933
|
let isInt = INT_REGEX.test(value);
|
|
1924
1934
|
if (isInt || FLOAT_REGEX.test(value)) {
|
|
1925
1935
|
if (LEADING_ZERO.test(value)) {
|
|
1926
|
-
throw new TomlError("leading zeroes are not allowed",
|
|
1927
|
-
toml,
|
|
1928
|
-
ptr
|
|
1929
|
-
});
|
|
1936
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
1930
1937
|
}
|
|
1931
1938
|
value = value.replace(/_/g, "");
|
|
1932
1939
|
let numeric = +value;
|
|
1933
1940
|
if (isNaN(numeric)) {
|
|
1934
|
-
throw new TomlError("invalid number",
|
|
1935
|
-
toml,
|
|
1936
|
-
ptr
|
|
1937
|
-
});
|
|
1941
|
+
throw new TomlError("invalid number", err);
|
|
1938
1942
|
}
|
|
1939
1943
|
if (isInt) {
|
|
1940
1944
|
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
1941
|
-
throw new TomlError("integer value cannot be represented losslessly",
|
|
1942
|
-
toml,
|
|
1943
|
-
ptr
|
|
1944
|
-
});
|
|
1945
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
1945
1946
|
}
|
|
1946
1947
|
if (isInt || integersAsBigInt === true)
|
|
1947
1948
|
numeric = BigInt(value);
|
|
@@ -1949,254 +1950,192 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
1949
1950
|
return numeric;
|
|
1950
1951
|
}
|
|
1951
1952
|
const date = new TomlDate(value);
|
|
1952
|
-
if (!date.isValid())
|
|
1953
|
-
throw new TomlError("invalid value",
|
|
1954
|
-
toml,
|
|
1955
|
-
ptr
|
|
1956
|
-
});
|
|
1957
|
-
}
|
|
1953
|
+
if (!date.isValid())
|
|
1954
|
+
throw new TomlError("invalid value", err);
|
|
1958
1955
|
return date;
|
|
1959
1956
|
}
|
|
1960
1957
|
__name(parseValue, "parseValue");
|
|
1961
1958
|
|
|
1962
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1963
|
-
function
|
|
1964
|
-
let
|
|
1965
|
-
let
|
|
1966
|
-
if (
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
if (!allowNewLines) {
|
|
1972
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
1973
|
-
if (newlineIdx > -1) {
|
|
1974
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1975
|
-
toml: str,
|
|
1976
|
-
ptr: startPtr + newlineIdx
|
|
1959
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/extract.js
|
|
1960
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
1961
|
+
let ptr = ctx.p;
|
|
1962
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
1963
|
+
if (c === 91 || c === 123) {
|
|
1964
|
+
if (!ctx.d--) {
|
|
1965
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
1966
|
+
toml: ctx.s,
|
|
1967
|
+
ptr
|
|
1977
1968
|
});
|
|
1978
1969
|
}
|
|
1970
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
1971
|
+
ctx.d++;
|
|
1972
|
+
return value;
|
|
1979
1973
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
1983
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
1984
|
-
if (depth === 0) {
|
|
1985
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
1986
|
-
toml: str,
|
|
1987
|
-
ptr
|
|
1988
|
-
});
|
|
1974
|
+
if (c === 34 || c === 39) {
|
|
1975
|
+
return parseString(ctx);
|
|
1989
1976
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
1996
|
-
if (nextNewLine > -1) {
|
|
1997
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1998
|
-
toml: str,
|
|
1999
|
-
ptr: nextNewLine
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
return [value, newPtr];
|
|
2004
|
-
}
|
|
2005
|
-
let endPtr;
|
|
2006
|
-
if (c === '"' || c === "'") {
|
|
2007
|
-
endPtr = getStringEnd(str, ptr);
|
|
2008
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
2009
|
-
if (end) {
|
|
2010
|
-
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
2011
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
2012
|
-
throw new TomlError("unexpected character encountered", {
|
|
2013
|
-
toml: str,
|
|
2014
|
-
ptr: endPtr
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
endPtr += +(str[endPtr] === ",");
|
|
2018
|
-
}
|
|
2019
|
-
return [parsed, endPtr];
|
|
2020
|
-
}
|
|
2021
|
-
endPtr = skipUntil(str, ptr, ",", end);
|
|
2022
|
-
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
2023
|
-
if (!slice[0]) {
|
|
2024
|
-
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
2025
|
-
toml: str,
|
|
2026
|
-
ptr
|
|
2027
|
-
});
|
|
1977
|
+
if (c === 116) {
|
|
1978
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
1979
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
1980
|
+
ctx.p++;
|
|
1981
|
+
return true;
|
|
2028
1982
|
}
|
|
2029
|
-
if (
|
|
2030
|
-
|
|
2031
|
-
|
|
1983
|
+
if (c === 102) {
|
|
1984
|
+
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)
|
|
1985
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
1986
|
+
ctx.p++;
|
|
1987
|
+
return false;
|
|
2032
1988
|
}
|
|
2033
|
-
return
|
|
2034
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
2035
|
-
endPtr
|
|
2036
|
-
];
|
|
1989
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
2037
1990
|
}
|
|
2038
1991
|
__name(extractValue, "extractValue");
|
|
2039
1992
|
|
|
2040
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1993
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/struct.js
|
|
2041
1994
|
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
2042
|
-
function parseKey(
|
|
2043
|
-
let
|
|
1995
|
+
function parseKey(ctx, end = "=") {
|
|
1996
|
+
let start = ctx.p;
|
|
1997
|
+
let dot = start - 1;
|
|
2044
1998
|
let parsed = [];
|
|
2045
|
-
let endPtr =
|
|
1999
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
2046
2000
|
if (endPtr < 0) {
|
|
2047
2001
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2048
|
-
toml:
|
|
2049
|
-
ptr
|
|
2002
|
+
toml: ctx.s,
|
|
2003
|
+
ptr: start
|
|
2050
2004
|
});
|
|
2051
2005
|
}
|
|
2052
2006
|
do {
|
|
2053
|
-
let c =
|
|
2054
|
-
if (c !==
|
|
2055
|
-
if (c ===
|
|
2056
|
-
if (c ===
|
|
2007
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
2008
|
+
if (c !== 32 && c !== 9) {
|
|
2009
|
+
if (c === 34 || c === 39) {
|
|
2010
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
2057
2011
|
throw new TomlError("multiline strings are not allowed in keys", {
|
|
2058
|
-
toml:
|
|
2059
|
-
ptr
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
let eos = getStringEnd(str, ptr);
|
|
2063
|
-
if (eos < 0) {
|
|
2064
|
-
throw new TomlError("unfinished string encountered", {
|
|
2065
|
-
toml: str,
|
|
2066
|
-
ptr
|
|
2012
|
+
toml: ctx.s,
|
|
2013
|
+
ptr: ctx.p
|
|
2067
2014
|
});
|
|
2068
2015
|
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2016
|
+
let part = parseString(ctx);
|
|
2017
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
2018
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2071
2019
|
let newLine = indexOfNewline(strEnd);
|
|
2072
2020
|
if (newLine > -1) {
|
|
2073
2021
|
throw new TomlError("newlines are not allowed in keys", {
|
|
2074
|
-
toml:
|
|
2075
|
-
ptr:
|
|
2022
|
+
toml: ctx.s,
|
|
2023
|
+
ptr: newLine
|
|
2076
2024
|
});
|
|
2077
2025
|
}
|
|
2078
2026
|
if (strEnd.trimStart()) {
|
|
2079
2027
|
throw new TomlError("found extra tokens after the string part", {
|
|
2080
|
-
toml:
|
|
2081
|
-
ptr:
|
|
2028
|
+
toml: ctx.s,
|
|
2029
|
+
ptr: ctx.p
|
|
2082
2030
|
});
|
|
2083
2031
|
}
|
|
2084
|
-
if (endPtr <
|
|
2085
|
-
endPtr =
|
|
2032
|
+
if (endPtr < ctx.p) {
|
|
2033
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
2086
2034
|
if (endPtr < 0) {
|
|
2087
2035
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2088
|
-
toml:
|
|
2089
|
-
ptr
|
|
2036
|
+
toml: ctx.s,
|
|
2037
|
+
ptr: start
|
|
2090
2038
|
});
|
|
2091
2039
|
}
|
|
2092
2040
|
}
|
|
2093
|
-
parsed.push(
|
|
2041
|
+
parsed.push(part);
|
|
2094
2042
|
} else {
|
|
2095
|
-
dot =
|
|
2096
|
-
let part =
|
|
2043
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
2044
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2097
2045
|
if (!KEY_PART_RE.test(part)) {
|
|
2098
2046
|
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
2099
|
-
toml:
|
|
2100
|
-
ptr
|
|
2047
|
+
toml: ctx.s,
|
|
2048
|
+
ptr: ctx.p
|
|
2101
2049
|
});
|
|
2102
2050
|
}
|
|
2103
2051
|
parsed.push(part.trimEnd());
|
|
2104
2052
|
}
|
|
2105
2053
|
}
|
|
2106
2054
|
} while (dot + 1 && dot < endPtr);
|
|
2107
|
-
|
|
2055
|
+
ctx.p = endPtr + 1;
|
|
2056
|
+
skipVoid(ctx, true, true);
|
|
2057
|
+
return parsed;
|
|
2108
2058
|
}
|
|
2109
2059
|
__name(parseKey, "parseKey");
|
|
2110
|
-
function parseInlineTable(
|
|
2060
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
2111
2061
|
let res = {};
|
|
2112
2062
|
let seen = /* @__PURE__ */ new Set();
|
|
2113
2063
|
let c;
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
2132
|
-
k = key[i];
|
|
2133
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2134
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
2135
|
-
toml: str,
|
|
2136
|
-
ptr
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
if (!hasOwn && k === "__proto__") {
|
|
2140
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
if (hasOwn) {
|
|
2064
|
+
ctx.p++;
|
|
2065
|
+
while (ctx.p < ctx.s.length) {
|
|
2066
|
+
skipVoid(ctx);
|
|
2067
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
2068
|
+
ctx.p++;
|
|
2069
|
+
return res;
|
|
2070
|
+
}
|
|
2071
|
+
let k;
|
|
2072
|
+
let t = res;
|
|
2073
|
+
let hasOwn = false;
|
|
2074
|
+
let p = ctx.p;
|
|
2075
|
+
let key = parseKey(ctx);
|
|
2076
|
+
for (let i = 0; i < key.length; i++) {
|
|
2077
|
+
if (i)
|
|
2078
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
2079
|
+
k = key[i];
|
|
2080
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2144
2081
|
throw new TomlError("trying to redefine an already defined value", {
|
|
2145
|
-
toml:
|
|
2146
|
-
ptr
|
|
2082
|
+
toml: ctx.s,
|
|
2083
|
+
ptr: p
|
|
2147
2084
|
});
|
|
2148
2085
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2086
|
+
if (!hasOwn && k === "__proto__") {
|
|
2087
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
if (hasOwn) {
|
|
2091
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
2092
|
+
toml: ctx.s,
|
|
2093
|
+
ptr: ctx.p
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
2097
|
+
seen.add(t[k] = value);
|
|
2098
|
+
skipVoid(ctx);
|
|
2099
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
2100
|
+
return res;
|
|
2101
|
+
}
|
|
2102
|
+
if (c !== 44) {
|
|
2103
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
2154
2104
|
}
|
|
2155
2105
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
});
|
|
2161
|
-
}
|
|
2162
|
-
if (!c) {
|
|
2163
|
-
throw new TomlError("unfinished table encountered", {
|
|
2164
|
-
toml: str,
|
|
2165
|
-
ptr
|
|
2166
|
-
});
|
|
2167
|
-
}
|
|
2168
|
-
return [res, ptr];
|
|
2106
|
+
throw new TomlError("unfinished table encountered", {
|
|
2107
|
+
toml: ctx.s,
|
|
2108
|
+
ptr: ctx.p
|
|
2109
|
+
});
|
|
2169
2110
|
}
|
|
2170
2111
|
__name(parseInlineTable, "parseInlineTable");
|
|
2171
|
-
function parseArray(
|
|
2112
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
2172
2113
|
let res = [];
|
|
2173
2114
|
let c;
|
|
2174
|
-
|
|
2175
|
-
while (
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
if (!c) {
|
|
2190
|
-
throw new TomlError("unfinished array encountered", {
|
|
2191
|
-
toml: str,
|
|
2192
|
-
ptr
|
|
2193
|
-
});
|
|
2115
|
+
ctx.p++;
|
|
2116
|
+
while (ctx.p < ctx.s.length) {
|
|
2117
|
+
skipVoid(ctx);
|
|
2118
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
2119
|
+
ctx.p++;
|
|
2120
|
+
return res;
|
|
2121
|
+
}
|
|
2122
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
2123
|
+
skipVoid(ctx);
|
|
2124
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
2125
|
+
return res;
|
|
2126
|
+
}
|
|
2127
|
+
if (c !== 44) {
|
|
2128
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
2129
|
+
}
|
|
2194
2130
|
}
|
|
2195
|
-
|
|
2131
|
+
throw new TomlError("unfinished array encountered", {
|
|
2132
|
+
toml: ctx.s,
|
|
2133
|
+
ptr: ctx.p
|
|
2134
|
+
});
|
|
2196
2135
|
}
|
|
2197
2136
|
__name(parseArray, "parseArray");
|
|
2198
2137
|
|
|
2199
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2138
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/parse.js
|
|
2200
2139
|
function peekTable(key, table, meta, type) {
|
|
2201
2140
|
let t = table;
|
|
2202
2141
|
let m = meta;
|
|
@@ -2258,25 +2197,29 @@ function peekTable(key, table, meta, type) {
|
|
|
2258
2197
|
}
|
|
2259
2198
|
__name(peekTable, "peekTable");
|
|
2260
2199
|
function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
2200
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
2261
2201
|
let res = {};
|
|
2262
2202
|
let meta = {};
|
|
2203
|
+
let tmp;
|
|
2263
2204
|
let tbl = res;
|
|
2264
2205
|
let m = meta;
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
let
|
|
2206
|
+
skipVoid(ctx);
|
|
2207
|
+
while (ctx.p < toml.length) {
|
|
2208
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
2209
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
2210
|
+
tmp = ctx.p += +isTableArray;
|
|
2211
|
+
let k = parseKey(ctx, "]");
|
|
2269
2212
|
if (isTableArray) {
|
|
2270
|
-
if (toml
|
|
2213
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
2271
2214
|
throw new TomlError("expected end of table declaration", {
|
|
2272
2215
|
toml,
|
|
2273
|
-
ptr:
|
|
2216
|
+
ptr: ctx.p - 1
|
|
2274
2217
|
});
|
|
2275
2218
|
}
|
|
2276
|
-
|
|
2219
|
+
ctx.p++;
|
|
2277
2220
|
}
|
|
2278
2221
|
let p = peekTable(
|
|
2279
|
-
k
|
|
2222
|
+
k,
|
|
2280
2223
|
res,
|
|
2281
2224
|
meta,
|
|
2282
2225
|
isTableArray ? 2 : 1
|
|
@@ -2285,16 +2228,16 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2285
2228
|
if (!p) {
|
|
2286
2229
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2287
2230
|
toml,
|
|
2288
|
-
ptr
|
|
2231
|
+
ptr: tmp
|
|
2289
2232
|
});
|
|
2290
2233
|
}
|
|
2291
2234
|
m = p[2];
|
|
2292
2235
|
tbl = p[1];
|
|
2293
|
-
ptr = k[1];
|
|
2294
2236
|
} else {
|
|
2295
|
-
|
|
2237
|
+
tmp = ctx.p;
|
|
2238
|
+
let k = parseKey(ctx);
|
|
2296
2239
|
let p = peekTable(
|
|
2297
|
-
k
|
|
2240
|
+
k,
|
|
2298
2241
|
tbl,
|
|
2299
2242
|
m,
|
|
2300
2243
|
0
|
|
@@ -2303,35 +2246,37 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2303
2246
|
if (!p) {
|
|
2304
2247
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2305
2248
|
toml,
|
|
2306
|
-
ptr
|
|
2249
|
+
ptr: tmp
|
|
2307
2250
|
});
|
|
2308
2251
|
}
|
|
2309
|
-
|
|
2310
|
-
p[1][p[0]] = v[0];
|
|
2311
|
-
ptr = v[1];
|
|
2252
|
+
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
2312
2253
|
}
|
|
2313
|
-
|
|
2314
|
-
if (toml
|
|
2254
|
+
skipVoid(ctx, true);
|
|
2255
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
2315
2256
|
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
2316
2257
|
toml,
|
|
2317
|
-
ptr
|
|
2258
|
+
ptr: ctx.p
|
|
2318
2259
|
});
|
|
2319
2260
|
}
|
|
2320
|
-
|
|
2261
|
+
skipVoid(ctx);
|
|
2321
2262
|
}
|
|
2322
2263
|
return res;
|
|
2323
2264
|
}
|
|
2324
2265
|
__name(parse3, "parse");
|
|
2325
2266
|
|
|
2326
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2267
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/stringify.js
|
|
2327
2268
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
2328
2269
|
function extendedTypeOf(obj) {
|
|
2329
2270
|
let type = typeof obj;
|
|
2330
2271
|
if (type === "object") {
|
|
2331
2272
|
if (Array.isArray(obj))
|
|
2332
2273
|
return "array";
|
|
2333
|
-
if (obj instanceof Date)
|
|
2274
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
2334
2275
|
return "date";
|
|
2276
|
+
if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
|
|
2277
|
+
typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
|
|
2278
|
+
return "temporal";
|
|
2279
|
+
}
|
|
2335
2280
|
}
|
|
2336
2281
|
return type;
|
|
2337
2282
|
}
|
|
@@ -2348,38 +2293,43 @@ function formatString(s) {
|
|
|
2348
2293
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
2349
2294
|
}
|
|
2350
2295
|
__name(formatString, "formatString");
|
|
2296
|
+
function stringifyTemporal(temporal) {
|
|
2297
|
+
return temporal.toString({
|
|
2298
|
+
calendarName: "never",
|
|
2299
|
+
timeZoneName: "never"
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
__name(stringifyTemporal, "stringifyTemporal");
|
|
2351
2303
|
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
2352
2304
|
if (depth === 0) {
|
|
2353
2305
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2354
2306
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
if (type === "array") {
|
|
2382
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
2307
|
+
switch (type) {
|
|
2308
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
2309
|
+
case "number":
|
|
2310
|
+
if (isNaN(val))
|
|
2311
|
+
return "nan";
|
|
2312
|
+
if (val === Infinity)
|
|
2313
|
+
return "inf";
|
|
2314
|
+
if (val === -Infinity)
|
|
2315
|
+
return "-inf";
|
|
2316
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
2317
|
+
return val.toFixed(1);
|
|
2318
|
+
case "bigint":
|
|
2319
|
+
case "boolean":
|
|
2320
|
+
return val.toString();
|
|
2321
|
+
case "string":
|
|
2322
|
+
return formatString(val);
|
|
2323
|
+
case "date":
|
|
2324
|
+
if (isNaN(val.getTime()))
|
|
2325
|
+
throw new TypeError("cannot serialize invalid date");
|
|
2326
|
+
return val.toISOString();
|
|
2327
|
+
case "object":
|
|
2328
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
2329
|
+
case "array":
|
|
2330
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
2331
|
+
case "temporal":
|
|
2332
|
+
return stringifyTemporal(val);
|
|
2383
2333
|
}
|
|
2384
2334
|
}
|
|
2385
2335
|
__name(stringifyValue, "stringifyValue");
|
|
@@ -2473,7 +2423,7 @@ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
|
2473
2423
|
}
|
|
2474
2424
|
__name(stringify, "stringify");
|
|
2475
2425
|
|
|
2476
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2426
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/index.js
|
|
2477
2427
|
var dist_default = { parse: parse3, stringify, TomlDate, TomlError };
|
|
2478
2428
|
|
|
2479
2429
|
// src/parse.ts
|
|
@@ -3022,7 +2972,7 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
|
|
|
3022
2972
|
}, "experimental_readRawConfig");
|
|
3023
2973
|
/*! Bundled license information:
|
|
3024
2974
|
|
|
3025
|
-
smol-toml/dist/
|
|
2975
|
+
smol-toml/dist/date.js:
|
|
3026
2976
|
(*!
|
|
3027
2977
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3028
2978
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3051,7 +3001,7 @@ smol-toml/dist/error.js:
|
|
|
3051
3001
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3052
3002
|
*)
|
|
3053
3003
|
|
|
3054
|
-
smol-toml/dist/
|
|
3004
|
+
smol-toml/dist/error.js:
|
|
3055
3005
|
(*!
|
|
3056
3006
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3057
3007
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3080,7 +3030,7 @@ smol-toml/dist/util.js:
|
|
|
3080
3030
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3081
3031
|
*)
|
|
3082
3032
|
|
|
3083
|
-
smol-toml/dist/
|
|
3033
|
+
smol-toml/dist/util.js:
|
|
3084
3034
|
(*!
|
|
3085
3035
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3086
3036
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3284,4 +3234,4 @@ smol-toml/dist/index.js:
|
|
|
3284
3234
|
*)
|
|
3285
3235
|
*/
|
|
3286
3236
|
|
|
3287
|
-
export { APIError,
|
|
3237
|
+
export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, applyEdits, configFileName, configFormat, dir, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectClassNameToUseSQLiteMap, getDurableObjectContainerApps, getDurableObjectExports, getResolvedDurableObjectContainerApps, hasDurableObjectExports, indexLocation, isDurableObjectContainerApp, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation, validateDurableObjectContainerApplications };
|