@cloudflare/workers-utils 0.41.0 → 0.41.2
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/{chunk-JTB7VJSC.mjs → chunk-IKXB77SR.mjs} +405 -454
- package/dist/chunk-OWXQB7GP.mjs +14968 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +318 -15276
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.mjs +1 -1
- package/dist/zod-format.d.mts +3 -3
- package/dist/zod-format.mjs +1 -1
- package/package.json +5 -6
- package/dist/chunk-7AX24RFK.mjs +0 -265
|
@@ -1598,133 +1598,8 @@ function applyEdits(text, edits) {
|
|
|
1598
1598
|
}
|
|
1599
1599
|
__name(applyEdits, "applyEdits");
|
|
1600
1600
|
|
|
1601
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1602
|
-
|
|
1603
|
-
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1604
|
-
return [lines.length, lines.pop().length + 1];
|
|
1605
|
-
}
|
|
1606
|
-
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
1607
|
-
function makeCodeBlock(string, line, column) {
|
|
1608
|
-
let lines = string.split(/\r\n|\n|\r/g);
|
|
1609
|
-
let codeblock = "";
|
|
1610
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1611
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
1612
|
-
let l = lines[i - 1];
|
|
1613
|
-
if (!l)
|
|
1614
|
-
continue;
|
|
1615
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
1616
|
-
codeblock += ": ";
|
|
1617
|
-
codeblock += l;
|
|
1618
|
-
codeblock += "\n";
|
|
1619
|
-
if (i === line) {
|
|
1620
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
1621
|
-
codeblock += "^\n";
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
return codeblock;
|
|
1625
|
-
}
|
|
1626
|
-
__name(makeCodeBlock, "makeCodeBlock");
|
|
1627
|
-
var TomlError = class extends Error {
|
|
1628
|
-
static {
|
|
1629
|
-
__name(this, "TomlError");
|
|
1630
|
-
}
|
|
1631
|
-
line;
|
|
1632
|
-
column;
|
|
1633
|
-
codeblock;
|
|
1634
|
-
constructor(message, options) {
|
|
1635
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
1636
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
1637
|
-
super(`Invalid TOML document: ${message}
|
|
1638
|
-
|
|
1639
|
-
${codeblock}`, options);
|
|
1640
|
-
this.line = line;
|
|
1641
|
-
this.column = column;
|
|
1642
|
-
this.codeblock = codeblock;
|
|
1643
|
-
}
|
|
1644
|
-
};
|
|
1645
|
-
|
|
1646
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
1647
|
-
function isEscaped(str, ptr) {
|
|
1648
|
-
let i = 0;
|
|
1649
|
-
while (str[ptr - ++i] === "\\")
|
|
1650
|
-
;
|
|
1651
|
-
return --i && i % 2;
|
|
1652
|
-
}
|
|
1653
|
-
__name(isEscaped, "isEscaped");
|
|
1654
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
1655
|
-
let idx = str.indexOf("\n", start);
|
|
1656
|
-
if (str[idx - 1] === "\r")
|
|
1657
|
-
idx--;
|
|
1658
|
-
return idx <= end ? idx : -1;
|
|
1659
|
-
}
|
|
1660
|
-
__name(indexOfNewline, "indexOfNewline");
|
|
1661
|
-
function skipComment(str, ptr) {
|
|
1662
|
-
for (let i = ptr; i < str.length; i++) {
|
|
1663
|
-
let c = str[i];
|
|
1664
|
-
if (c === "\n")
|
|
1665
|
-
return i;
|
|
1666
|
-
if (c === "\r" && str[i + 1] === "\n")
|
|
1667
|
-
return i + 1;
|
|
1668
|
-
if (c < " " && c !== " " || c === "\x7F") {
|
|
1669
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
1670
|
-
toml: str,
|
|
1671
|
-
ptr
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
return str.length;
|
|
1676
|
-
}
|
|
1677
|
-
__name(skipComment, "skipComment");
|
|
1678
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
1679
|
-
let c;
|
|
1680
|
-
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
1681
|
-
ptr++;
|
|
1682
|
-
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
1683
|
-
}
|
|
1684
|
-
__name(skipVoid, "skipVoid");
|
|
1685
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
1686
|
-
if (!end) {
|
|
1687
|
-
ptr = indexOfNewline(str, ptr);
|
|
1688
|
-
return ptr < 0 ? str.length : ptr;
|
|
1689
|
-
}
|
|
1690
|
-
for (let i = ptr; i < str.length; i++) {
|
|
1691
|
-
let c = str[i];
|
|
1692
|
-
if (c === "#") {
|
|
1693
|
-
i = indexOfNewline(str, i);
|
|
1694
|
-
} else if (c === sep) {
|
|
1695
|
-
return i + 1;
|
|
1696
|
-
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
1697
|
-
return i;
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
throw new TomlError("cannot find end of structure", {
|
|
1701
|
-
toml: str,
|
|
1702
|
-
ptr
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
__name(skipUntil, "skipUntil");
|
|
1706
|
-
function getStringEnd(str, seek) {
|
|
1707
|
-
let first = str[seek];
|
|
1708
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
1709
|
-
seek += target.length - 1;
|
|
1710
|
-
do
|
|
1711
|
-
seek = str.indexOf(target, ++seek);
|
|
1712
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
1713
|
-
if (seek > -1) {
|
|
1714
|
-
seek += target.length;
|
|
1715
|
-
if (target.length > 1) {
|
|
1716
|
-
if (str[seek] === first)
|
|
1717
|
-
seek++;
|
|
1718
|
-
if (str[seek] === first)
|
|
1719
|
-
seek++;
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
return seek;
|
|
1723
|
-
}
|
|
1724
|
-
__name(getStringEnd, "getStringEnd");
|
|
1725
|
-
|
|
1726
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
1727
|
-
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;
|
|
1728
1603
|
var TomlDate = class _TomlDate extends Date {
|
|
1729
1604
|
static {
|
|
1730
1605
|
__name(this, "TomlDate");
|
|
@@ -1818,99 +1693,235 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
1818
1693
|
}
|
|
1819
1694
|
};
|
|
1820
1695
|
|
|
1821
|
-
// ../../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
|
|
1822
1801
|
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
1823
1802
|
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
1824
1803
|
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
r: "\r",
|
|
1832
|
-
'"': '"',
|
|
1833
|
-
"\\": "\\"
|
|
1834
|
-
};
|
|
1835
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
1836
|
-
let isLiteral = str[ptr] === "'";
|
|
1837
|
-
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);
|
|
1838
1810
|
if (isMultiline) {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
}
|
|
1845
|
-
let tmp = 0;
|
|
1846
|
-
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
|
+
}
|
|
1847
1816
|
let parsed = "";
|
|
1848
|
-
let sliceStart =
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
ptr: ptr - 1
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
} 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) {
|
|
1859
1824
|
throw new TomlError("control characters are not allowed in strings", {
|
|
1860
|
-
toml:
|
|
1861
|
-
ptr:
|
|
1825
|
+
toml: ctx.s,
|
|
1826
|
+
ptr: ctx.p
|
|
1862
1827
|
});
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
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;
|
|
1881
1863
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
1885
|
-
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
1886
|
-
toml: str,
|
|
1887
|
-
ptr: tmp
|
|
1888
|
-
});
|
|
1864
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
1865
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
1889
1866
|
}
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1867
|
+
parsed += String.fromCodePoint(value);
|
|
1868
|
+
sliceStart = ctx.p + 1;
|
|
1869
|
+
state = 0;
|
|
1870
|
+
} else if (c === 32 || c === 9) {
|
|
1871
|
+
state = 2;
|
|
1893
1872
|
} else {
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
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
|
|
1897
1899
|
});
|
|
1898
1900
|
}
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
tmp = ptr - 1;
|
|
1902
|
-
isEscape = true;
|
|
1903
|
-
parsed += str.slice(sliceStart, tmp);
|
|
1901
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
1902
|
+
sliceStart = ctx.p;
|
|
1904
1903
|
}
|
|
1905
1904
|
}
|
|
1906
|
-
|
|
1905
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
1907
1906
|
}
|
|
1908
1907
|
__name(parseString, "parseString");
|
|
1909
|
-
function
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
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);
|
|
1914
1925
|
if (value === "-inf")
|
|
1915
1926
|
return -Infinity;
|
|
1916
1927
|
if (value === "inf" || value === "+inf")
|
|
@@ -1922,25 +1933,16 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
1922
1933
|
let isInt = INT_REGEX.test(value);
|
|
1923
1934
|
if (isInt || FLOAT_REGEX.test(value)) {
|
|
1924
1935
|
if (LEADING_ZERO.test(value)) {
|
|
1925
|
-
throw new TomlError("leading zeroes are not allowed",
|
|
1926
|
-
toml,
|
|
1927
|
-
ptr
|
|
1928
|
-
});
|
|
1936
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
1929
1937
|
}
|
|
1930
1938
|
value = value.replace(/_/g, "");
|
|
1931
1939
|
let numeric = +value;
|
|
1932
1940
|
if (isNaN(numeric)) {
|
|
1933
|
-
throw new TomlError("invalid number",
|
|
1934
|
-
toml,
|
|
1935
|
-
ptr
|
|
1936
|
-
});
|
|
1941
|
+
throw new TomlError("invalid number", err);
|
|
1937
1942
|
}
|
|
1938
1943
|
if (isInt) {
|
|
1939
1944
|
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
1940
|
-
throw new TomlError("integer value cannot be represented losslessly",
|
|
1941
|
-
toml,
|
|
1942
|
-
ptr
|
|
1943
|
-
});
|
|
1945
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
1944
1946
|
}
|
|
1945
1947
|
if (isInt || integersAsBigInt === true)
|
|
1946
1948
|
numeric = BigInt(value);
|
|
@@ -1948,254 +1950,192 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
1948
1950
|
return numeric;
|
|
1949
1951
|
}
|
|
1950
1952
|
const date = new TomlDate(value);
|
|
1951
|
-
if (!date.isValid())
|
|
1952
|
-
throw new TomlError("invalid value",
|
|
1953
|
-
toml,
|
|
1954
|
-
ptr
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1953
|
+
if (!date.isValid())
|
|
1954
|
+
throw new TomlError("invalid value", err);
|
|
1957
1955
|
return date;
|
|
1958
1956
|
}
|
|
1959
1957
|
__name(parseValue, "parseValue");
|
|
1960
1958
|
|
|
1961
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1962
|
-
function
|
|
1963
|
-
let
|
|
1964
|
-
let
|
|
1965
|
-
if (
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
if (!allowNewLines) {
|
|
1971
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
1972
|
-
if (newlineIdx > -1) {
|
|
1973
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1974
|
-
toml: str,
|
|
1975
|
-
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
|
|
1976
1968
|
});
|
|
1977
1969
|
}
|
|
1970
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
1971
|
+
ctx.d++;
|
|
1972
|
+
return value;
|
|
1978
1973
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
1982
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
1983
|
-
if (depth === 0) {
|
|
1984
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
1985
|
-
toml: str,
|
|
1986
|
-
ptr
|
|
1987
|
-
});
|
|
1974
|
+
if (c === 34 || c === 39) {
|
|
1975
|
+
return parseString(ctx);
|
|
1988
1976
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
1995
|
-
if (nextNewLine > -1) {
|
|
1996
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1997
|
-
toml: str,
|
|
1998
|
-
ptr: nextNewLine
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
return [value, newPtr];
|
|
2003
|
-
}
|
|
2004
|
-
let endPtr;
|
|
2005
|
-
if (c === '"' || c === "'") {
|
|
2006
|
-
endPtr = getStringEnd(str, ptr);
|
|
2007
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
2008
|
-
if (end) {
|
|
2009
|
-
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
2010
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
2011
|
-
throw new TomlError("unexpected character encountered", {
|
|
2012
|
-
toml: str,
|
|
2013
|
-
ptr: endPtr
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
endPtr += +(str[endPtr] === ",");
|
|
2017
|
-
}
|
|
2018
|
-
return [parsed, endPtr];
|
|
2019
|
-
}
|
|
2020
|
-
endPtr = skipUntil(str, ptr, ",", end);
|
|
2021
|
-
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
2022
|
-
if (!slice[0]) {
|
|
2023
|
-
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
2024
|
-
toml: str,
|
|
2025
|
-
ptr
|
|
2026
|
-
});
|
|
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;
|
|
2027
1982
|
}
|
|
2028
|
-
if (
|
|
2029
|
-
|
|
2030
|
-
|
|
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;
|
|
2031
1988
|
}
|
|
2032
|
-
return
|
|
2033
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
2034
|
-
endPtr
|
|
2035
|
-
];
|
|
1989
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
2036
1990
|
}
|
|
2037
1991
|
__name(extractValue, "extractValue");
|
|
2038
1992
|
|
|
2039
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1993
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/struct.js
|
|
2040
1994
|
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
2041
|
-
function parseKey(
|
|
2042
|
-
let
|
|
1995
|
+
function parseKey(ctx, end = "=") {
|
|
1996
|
+
let start = ctx.p;
|
|
1997
|
+
let dot = start - 1;
|
|
2043
1998
|
let parsed = [];
|
|
2044
|
-
let endPtr =
|
|
1999
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
2045
2000
|
if (endPtr < 0) {
|
|
2046
2001
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2047
|
-
toml:
|
|
2048
|
-
ptr
|
|
2002
|
+
toml: ctx.s,
|
|
2003
|
+
ptr: start
|
|
2049
2004
|
});
|
|
2050
2005
|
}
|
|
2051
2006
|
do {
|
|
2052
|
-
let c =
|
|
2053
|
-
if (c !==
|
|
2054
|
-
if (c ===
|
|
2055
|
-
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)) {
|
|
2056
2011
|
throw new TomlError("multiline strings are not allowed in keys", {
|
|
2057
|
-
toml:
|
|
2058
|
-
ptr
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
|
-
let eos = getStringEnd(str, ptr);
|
|
2062
|
-
if (eos < 0) {
|
|
2063
|
-
throw new TomlError("unfinished string encountered", {
|
|
2064
|
-
toml: str,
|
|
2065
|
-
ptr
|
|
2012
|
+
toml: ctx.s,
|
|
2013
|
+
ptr: ctx.p
|
|
2066
2014
|
});
|
|
2067
2015
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
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);
|
|
2070
2019
|
let newLine = indexOfNewline(strEnd);
|
|
2071
2020
|
if (newLine > -1) {
|
|
2072
2021
|
throw new TomlError("newlines are not allowed in keys", {
|
|
2073
|
-
toml:
|
|
2074
|
-
ptr:
|
|
2022
|
+
toml: ctx.s,
|
|
2023
|
+
ptr: newLine
|
|
2075
2024
|
});
|
|
2076
2025
|
}
|
|
2077
2026
|
if (strEnd.trimStart()) {
|
|
2078
2027
|
throw new TomlError("found extra tokens after the string part", {
|
|
2079
|
-
toml:
|
|
2080
|
-
ptr:
|
|
2028
|
+
toml: ctx.s,
|
|
2029
|
+
ptr: ctx.p
|
|
2081
2030
|
});
|
|
2082
2031
|
}
|
|
2083
|
-
if (endPtr <
|
|
2084
|
-
endPtr =
|
|
2032
|
+
if (endPtr < ctx.p) {
|
|
2033
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
2085
2034
|
if (endPtr < 0) {
|
|
2086
2035
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2087
|
-
toml:
|
|
2088
|
-
ptr
|
|
2036
|
+
toml: ctx.s,
|
|
2037
|
+
ptr: start
|
|
2089
2038
|
});
|
|
2090
2039
|
}
|
|
2091
2040
|
}
|
|
2092
|
-
parsed.push(
|
|
2041
|
+
parsed.push(part);
|
|
2093
2042
|
} else {
|
|
2094
|
-
dot =
|
|
2095
|
-
let part =
|
|
2043
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
2044
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2096
2045
|
if (!KEY_PART_RE.test(part)) {
|
|
2097
2046
|
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
2098
|
-
toml:
|
|
2099
|
-
ptr
|
|
2047
|
+
toml: ctx.s,
|
|
2048
|
+
ptr: ctx.p
|
|
2100
2049
|
});
|
|
2101
2050
|
}
|
|
2102
2051
|
parsed.push(part.trimEnd());
|
|
2103
2052
|
}
|
|
2104
2053
|
}
|
|
2105
2054
|
} while (dot + 1 && dot < endPtr);
|
|
2106
|
-
|
|
2055
|
+
ctx.p = endPtr + 1;
|
|
2056
|
+
skipVoid(ctx, true, true);
|
|
2057
|
+
return parsed;
|
|
2107
2058
|
}
|
|
2108
2059
|
__name(parseKey, "parseKey");
|
|
2109
|
-
function parseInlineTable(
|
|
2060
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
2110
2061
|
let res = {};
|
|
2111
2062
|
let seen = /* @__PURE__ */ new Set();
|
|
2112
2063
|
let c;
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
2131
|
-
k = key[i];
|
|
2132
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2133
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
2134
|
-
toml: str,
|
|
2135
|
-
ptr
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2138
|
-
if (!hasOwn && k === "__proto__") {
|
|
2139
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
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]))) {
|
|
2143
2081
|
throw new TomlError("trying to redefine an already defined value", {
|
|
2144
|
-
toml:
|
|
2145
|
-
ptr
|
|
2082
|
+
toml: ctx.s,
|
|
2083
|
+
ptr: p
|
|
2146
2084
|
});
|
|
2147
2085
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
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 });
|
|
2153
2104
|
}
|
|
2154
2105
|
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
if (!c) {
|
|
2162
|
-
throw new TomlError("unfinished table encountered", {
|
|
2163
|
-
toml: str,
|
|
2164
|
-
ptr
|
|
2165
|
-
});
|
|
2166
|
-
}
|
|
2167
|
-
return [res, ptr];
|
|
2106
|
+
throw new TomlError("unfinished table encountered", {
|
|
2107
|
+
toml: ctx.s,
|
|
2108
|
+
ptr: ctx.p
|
|
2109
|
+
});
|
|
2168
2110
|
}
|
|
2169
2111
|
__name(parseInlineTable, "parseInlineTable");
|
|
2170
|
-
function parseArray(
|
|
2112
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
2171
2113
|
let res = [];
|
|
2172
2114
|
let c;
|
|
2173
|
-
|
|
2174
|
-
while (
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
if (!c) {
|
|
2189
|
-
throw new TomlError("unfinished array encountered", {
|
|
2190
|
-
toml: str,
|
|
2191
|
-
ptr
|
|
2192
|
-
});
|
|
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
|
+
}
|
|
2193
2130
|
}
|
|
2194
|
-
|
|
2131
|
+
throw new TomlError("unfinished array encountered", {
|
|
2132
|
+
toml: ctx.s,
|
|
2133
|
+
ptr: ctx.p
|
|
2134
|
+
});
|
|
2195
2135
|
}
|
|
2196
2136
|
__name(parseArray, "parseArray");
|
|
2197
2137
|
|
|
2198
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2138
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/parse.js
|
|
2199
2139
|
function peekTable(key, table, meta, type) {
|
|
2200
2140
|
let t = table;
|
|
2201
2141
|
let m = meta;
|
|
@@ -2257,25 +2197,29 @@ function peekTable(key, table, meta, type) {
|
|
|
2257
2197
|
}
|
|
2258
2198
|
__name(peekTable, "peekTable");
|
|
2259
2199
|
function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
2200
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
2260
2201
|
let res = {};
|
|
2261
2202
|
let meta = {};
|
|
2203
|
+
let tmp;
|
|
2262
2204
|
let tbl = res;
|
|
2263
2205
|
let m = meta;
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
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, "]");
|
|
2268
2212
|
if (isTableArray) {
|
|
2269
|
-
if (toml
|
|
2213
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
2270
2214
|
throw new TomlError("expected end of table declaration", {
|
|
2271
2215
|
toml,
|
|
2272
|
-
ptr:
|
|
2216
|
+
ptr: ctx.p - 1
|
|
2273
2217
|
});
|
|
2274
2218
|
}
|
|
2275
|
-
|
|
2219
|
+
ctx.p++;
|
|
2276
2220
|
}
|
|
2277
2221
|
let p = peekTable(
|
|
2278
|
-
k
|
|
2222
|
+
k,
|
|
2279
2223
|
res,
|
|
2280
2224
|
meta,
|
|
2281
2225
|
isTableArray ? 2 : 1
|
|
@@ -2284,16 +2228,16 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2284
2228
|
if (!p) {
|
|
2285
2229
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2286
2230
|
toml,
|
|
2287
|
-
ptr
|
|
2231
|
+
ptr: tmp
|
|
2288
2232
|
});
|
|
2289
2233
|
}
|
|
2290
2234
|
m = p[2];
|
|
2291
2235
|
tbl = p[1];
|
|
2292
|
-
ptr = k[1];
|
|
2293
2236
|
} else {
|
|
2294
|
-
|
|
2237
|
+
tmp = ctx.p;
|
|
2238
|
+
let k = parseKey(ctx);
|
|
2295
2239
|
let p = peekTable(
|
|
2296
|
-
k
|
|
2240
|
+
k,
|
|
2297
2241
|
tbl,
|
|
2298
2242
|
m,
|
|
2299
2243
|
0
|
|
@@ -2302,35 +2246,37 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2302
2246
|
if (!p) {
|
|
2303
2247
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2304
2248
|
toml,
|
|
2305
|
-
ptr
|
|
2249
|
+
ptr: tmp
|
|
2306
2250
|
});
|
|
2307
2251
|
}
|
|
2308
|
-
|
|
2309
|
-
p[1][p[0]] = v[0];
|
|
2310
|
-
ptr = v[1];
|
|
2252
|
+
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
2311
2253
|
}
|
|
2312
|
-
|
|
2313
|
-
if (toml
|
|
2254
|
+
skipVoid(ctx, true);
|
|
2255
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
2314
2256
|
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
2315
2257
|
toml,
|
|
2316
|
-
ptr
|
|
2258
|
+
ptr: ctx.p
|
|
2317
2259
|
});
|
|
2318
2260
|
}
|
|
2319
|
-
|
|
2261
|
+
skipVoid(ctx);
|
|
2320
2262
|
}
|
|
2321
2263
|
return res;
|
|
2322
2264
|
}
|
|
2323
2265
|
__name(parse3, "parse");
|
|
2324
2266
|
|
|
2325
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2267
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/stringify.js
|
|
2326
2268
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
2327
2269
|
function extendedTypeOf(obj) {
|
|
2328
2270
|
let type = typeof obj;
|
|
2329
2271
|
if (type === "object") {
|
|
2330
2272
|
if (Array.isArray(obj))
|
|
2331
2273
|
return "array";
|
|
2332
|
-
if (obj instanceof Date)
|
|
2274
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
2333
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
|
+
}
|
|
2334
2280
|
}
|
|
2335
2281
|
return type;
|
|
2336
2282
|
}
|
|
@@ -2347,38 +2293,43 @@ function formatString(s) {
|
|
|
2347
2293
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
2348
2294
|
}
|
|
2349
2295
|
__name(formatString, "formatString");
|
|
2296
|
+
function stringifyTemporal(temporal) {
|
|
2297
|
+
return temporal.toString({
|
|
2298
|
+
calendarName: "never",
|
|
2299
|
+
timeZoneName: "never"
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
__name(stringifyTemporal, "stringifyTemporal");
|
|
2350
2303
|
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
2351
2304
|
if (depth === 0) {
|
|
2352
2305
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2353
2306
|
}
|
|
2354
|
-
|
|
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
|
-
if (type === "array") {
|
|
2381
|
-
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);
|
|
2382
2333
|
}
|
|
2383
2334
|
}
|
|
2384
2335
|
__name(stringifyValue, "stringifyValue");
|
|
@@ -2472,7 +2423,7 @@ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
|
2472
2423
|
}
|
|
2473
2424
|
__name(stringify, "stringify");
|
|
2474
2425
|
|
|
2475
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2426
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/index.js
|
|
2476
2427
|
var dist_default = { parse: parse3, stringify, TomlDate, TomlError };
|
|
2477
2428
|
|
|
2478
2429
|
// src/parse.ts
|
|
@@ -3021,7 +2972,7 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
|
|
|
3021
2972
|
}, "experimental_readRawConfig");
|
|
3022
2973
|
/*! Bundled license information:
|
|
3023
2974
|
|
|
3024
|
-
smol-toml/dist/
|
|
2975
|
+
smol-toml/dist/date.js:
|
|
3025
2976
|
(*!
|
|
3026
2977
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3027
2978
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3050,7 +3001,7 @@ smol-toml/dist/error.js:
|
|
|
3050
3001
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3051
3002
|
*)
|
|
3052
3003
|
|
|
3053
|
-
smol-toml/dist/
|
|
3004
|
+
smol-toml/dist/error.js:
|
|
3054
3005
|
(*!
|
|
3055
3006
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3056
3007
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3079,7 +3030,7 @@ smol-toml/dist/util.js:
|
|
|
3079
3030
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3080
3031
|
*)
|
|
3081
3032
|
|
|
3082
|
-
smol-toml/dist/
|
|
3033
|
+
smol-toml/dist/util.js:
|
|
3083
3034
|
(*!
|
|
3084
3035
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3085
3036
|
* SPDX-License-Identifier: BSD-3-Clause
|