@cloudflare/workers-auth 0.7.4 → 0.9.0
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/cf/index.d.mts +5 -2
- package/dist/cf/index.mjs +18 -94
- package/dist/{chunk-LQW53VED.mjs → chunk-4CJO23DA.mjs} +404 -453
- package/dist/{chunk-T63LVVAX.mjs → chunk-A6F4WXCF.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/wrangler/index.mjs +2 -2
- package/package.json +3 -3
|
@@ -1993,133 +1993,8 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
__name(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
|
|
1995
1995
|
|
|
1996
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1997
|
-
|
|
1998
|
-
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
1999
|
-
return [lines.length, lines.pop().length + 1];
|
|
2000
|
-
}
|
|
2001
|
-
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
2002
|
-
function makeCodeBlock(string, line, column) {
|
|
2003
|
-
let lines = string.split(/\r\n|\n|\r/g);
|
|
2004
|
-
let codeblock = "";
|
|
2005
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
2006
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
2007
|
-
let l = lines[i - 1];
|
|
2008
|
-
if (!l)
|
|
2009
|
-
continue;
|
|
2010
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
2011
|
-
codeblock += ": ";
|
|
2012
|
-
codeblock += l;
|
|
2013
|
-
codeblock += "\n";
|
|
2014
|
-
if (i === line) {
|
|
2015
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
2016
|
-
codeblock += "^\n";
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
return codeblock;
|
|
2020
|
-
}
|
|
2021
|
-
__name(makeCodeBlock, "makeCodeBlock");
|
|
2022
|
-
var TomlError = class extends Error {
|
|
2023
|
-
static {
|
|
2024
|
-
__name(this, "TomlError");
|
|
2025
|
-
}
|
|
2026
|
-
line;
|
|
2027
|
-
column;
|
|
2028
|
-
codeblock;
|
|
2029
|
-
constructor(message, options) {
|
|
2030
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
2031
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
2032
|
-
super(`Invalid TOML document: ${message}
|
|
2033
|
-
|
|
2034
|
-
${codeblock}`, options);
|
|
2035
|
-
this.line = line;
|
|
2036
|
-
this.column = column;
|
|
2037
|
-
this.codeblock = codeblock;
|
|
2038
|
-
}
|
|
2039
|
-
};
|
|
2040
|
-
|
|
2041
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
2042
|
-
function isEscaped(str, ptr) {
|
|
2043
|
-
let i = 0;
|
|
2044
|
-
while (str[ptr - ++i] === "\\")
|
|
2045
|
-
;
|
|
2046
|
-
return --i && i % 2;
|
|
2047
|
-
}
|
|
2048
|
-
__name(isEscaped, "isEscaped");
|
|
2049
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
2050
|
-
let idx = str.indexOf("\n", start);
|
|
2051
|
-
if (str[idx - 1] === "\r")
|
|
2052
|
-
idx--;
|
|
2053
|
-
return idx <= end ? idx : -1;
|
|
2054
|
-
}
|
|
2055
|
-
__name(indexOfNewline, "indexOfNewline");
|
|
2056
|
-
function skipComment(str, ptr) {
|
|
2057
|
-
for (let i = ptr; i < str.length; i++) {
|
|
2058
|
-
let c = str[i];
|
|
2059
|
-
if (c === "\n")
|
|
2060
|
-
return i;
|
|
2061
|
-
if (c === "\r" && str[i + 1] === "\n")
|
|
2062
|
-
return i + 1;
|
|
2063
|
-
if (c < " " && c !== " " || c === "\x7F") {
|
|
2064
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
2065
|
-
toml: str,
|
|
2066
|
-
ptr
|
|
2067
|
-
});
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
return str.length;
|
|
2071
|
-
}
|
|
2072
|
-
__name(skipComment, "skipComment");
|
|
2073
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
2074
|
-
let c;
|
|
2075
|
-
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
2076
|
-
ptr++;
|
|
2077
|
-
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
2078
|
-
}
|
|
2079
|
-
__name(skipVoid, "skipVoid");
|
|
2080
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
2081
|
-
if (!end) {
|
|
2082
|
-
ptr = indexOfNewline(str, ptr);
|
|
2083
|
-
return ptr < 0 ? str.length : ptr;
|
|
2084
|
-
}
|
|
2085
|
-
for (let i = ptr; i < str.length; i++) {
|
|
2086
|
-
let c = str[i];
|
|
2087
|
-
if (c === "#") {
|
|
2088
|
-
i = indexOfNewline(str, i);
|
|
2089
|
-
} else if (c === sep) {
|
|
2090
|
-
return i + 1;
|
|
2091
|
-
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
2092
|
-
return i;
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
throw new TomlError("cannot find end of structure", {
|
|
2096
|
-
toml: str,
|
|
2097
|
-
ptr
|
|
2098
|
-
});
|
|
2099
|
-
}
|
|
2100
|
-
__name(skipUntil, "skipUntil");
|
|
2101
|
-
function getStringEnd(str, seek) {
|
|
2102
|
-
let first = str[seek];
|
|
2103
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
2104
|
-
seek += target.length - 1;
|
|
2105
|
-
do
|
|
2106
|
-
seek = str.indexOf(target, ++seek);
|
|
2107
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
2108
|
-
if (seek > -1) {
|
|
2109
|
-
seek += target.length;
|
|
2110
|
-
if (target.length > 1) {
|
|
2111
|
-
if (str[seek] === first)
|
|
2112
|
-
seek++;
|
|
2113
|
-
if (str[seek] === first)
|
|
2114
|
-
seek++;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
return seek;
|
|
2118
|
-
}
|
|
2119
|
-
__name(getStringEnd, "getStringEnd");
|
|
2120
|
-
|
|
2121
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
2122
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1996
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/date.js
|
|
1997
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
2123
1998
|
var TomlDate = class _TomlDate extends Date {
|
|
2124
1999
|
static {
|
|
2125
2000
|
__name(this, "TomlDate");
|
|
@@ -2213,99 +2088,235 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
2213
2088
|
}
|
|
2214
2089
|
};
|
|
2215
2090
|
|
|
2216
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2091
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/error.js
|
|
2092
|
+
function getLineColFromPtr(string, ptr) {
|
|
2093
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
2094
|
+
return [lines.length, lines.pop().length + 1];
|
|
2095
|
+
}
|
|
2096
|
+
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
2097
|
+
function makeCodeBlock(string, line, column) {
|
|
2098
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
2099
|
+
let codeblock = "";
|
|
2100
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
2101
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
2102
|
+
let l = lines[i - 1];
|
|
2103
|
+
if (!l)
|
|
2104
|
+
continue;
|
|
2105
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
2106
|
+
codeblock += ": ";
|
|
2107
|
+
codeblock += l;
|
|
2108
|
+
codeblock += "\n";
|
|
2109
|
+
if (i === line) {
|
|
2110
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
2111
|
+
codeblock += "^\n";
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
return codeblock;
|
|
2115
|
+
}
|
|
2116
|
+
__name(makeCodeBlock, "makeCodeBlock");
|
|
2117
|
+
var TomlError = class extends Error {
|
|
2118
|
+
static {
|
|
2119
|
+
__name(this, "TomlError");
|
|
2120
|
+
}
|
|
2121
|
+
line;
|
|
2122
|
+
column;
|
|
2123
|
+
codeblock;
|
|
2124
|
+
constructor(message, options) {
|
|
2125
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
2126
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
2127
|
+
super(`Invalid TOML document: ${message}
|
|
2128
|
+
|
|
2129
|
+
${codeblock}`, options);
|
|
2130
|
+
this.line = line;
|
|
2131
|
+
this.column = column;
|
|
2132
|
+
this.codeblock = codeblock;
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
|
|
2136
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/util.js
|
|
2137
|
+
function indexOfNewline(str, start = 0) {
|
|
2138
|
+
let idx = str.indexOf("\n", start);
|
|
2139
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
2140
|
+
idx--;
|
|
2141
|
+
return idx;
|
|
2142
|
+
}
|
|
2143
|
+
__name(indexOfNewline, "indexOfNewline");
|
|
2144
|
+
function skipComment(ctx) {
|
|
2145
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
2146
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
2147
|
+
if (c === 10)
|
|
2148
|
+
break;
|
|
2149
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
2150
|
+
ctx.p++;
|
|
2151
|
+
break;
|
|
2152
|
+
}
|
|
2153
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
2154
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
2155
|
+
toml: ctx.s,
|
|
2156
|
+
ptr: ctx.p
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
__name(skipComment, "skipComment");
|
|
2162
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
2163
|
+
let c;
|
|
2164
|
+
while (1) {
|
|
2165
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
2166
|
+
ctx.p++;
|
|
2167
|
+
if (banComments || c !== 35)
|
|
2168
|
+
break;
|
|
2169
|
+
skipComment(ctx);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
__name(skipVoid, "skipVoid");
|
|
2173
|
+
function skipUntil(ctx, sep, end) {
|
|
2174
|
+
let ptr = ctx.p;
|
|
2175
|
+
if (!end) {
|
|
2176
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
2177
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
2181
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
2182
|
+
if (c === 35) {
|
|
2183
|
+
skipComment(ctx);
|
|
2184
|
+
} else if (c === end || c === sep) {
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
throw new TomlError("cannot find end of structure", {
|
|
2189
|
+
toml: ctx.s,
|
|
2190
|
+
ptr
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
__name(skipUntil, "skipUntil");
|
|
2194
|
+
|
|
2195
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/primitive.js
|
|
2217
2196
|
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
2218
2197
|
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
2219
2198
|
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
r: "\r",
|
|
2227
|
-
'"': '"',
|
|
2228
|
-
"\\": "\\"
|
|
2229
|
-
};
|
|
2230
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
2231
|
-
let isLiteral = str[ptr] === "'";
|
|
2232
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
2199
|
+
function parseString(ctx) {
|
|
2200
|
+
let start = ctx.p;
|
|
2201
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
2202
|
+
let first = c;
|
|
2203
|
+
let isLiteral = c === 39;
|
|
2204
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
2233
2205
|
if (isMultiline) {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
}
|
|
2240
|
-
let tmp = 0;
|
|
2241
|
-
let isEscape;
|
|
2206
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
2207
|
+
ctx.p++;
|
|
2208
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
2209
|
+
ctx.p += 2;
|
|
2210
|
+
}
|
|
2242
2211
|
let parsed = "";
|
|
2243
|
-
let sliceStart =
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
ptr: ptr - 1
|
|
2251
|
-
});
|
|
2252
|
-
}
|
|
2253
|
-
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
2212
|
+
let sliceStart = ctx.p;
|
|
2213
|
+
let state = 0;
|
|
2214
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
2215
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
2216
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
2217
|
+
state = state && 3;
|
|
2218
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
2254
2219
|
throw new TomlError("control characters are not allowed in strings", {
|
|
2255
|
-
toml:
|
|
2256
|
-
ptr:
|
|
2220
|
+
toml: ctx.s,
|
|
2221
|
+
ptr: ctx.p
|
|
2257
2222
|
});
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2223
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
2224
|
+
if (isMultiline) {
|
|
2225
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
2226
|
+
ctx.p++;
|
|
2227
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
2228
|
+
ctx.p++;
|
|
2229
|
+
}
|
|
2230
|
+
if (!state)
|
|
2231
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
2232
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
2233
|
+
return parsed;
|
|
2234
|
+
} else if (!state) {
|
|
2235
|
+
if (!isLiteral && c === 92) {
|
|
2236
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
2237
|
+
state = 1;
|
|
2238
|
+
}
|
|
2239
|
+
} else if (state === 1) {
|
|
2240
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
2241
|
+
let value = 0;
|
|
2242
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
2243
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
2244
|
+
let hex = ctx.s.charCodeAt(ctx.p + 1);
|
|
2245
|
+
let digit = (
|
|
2246
|
+
/* 0-9 */
|
|
2247
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
2248
|
+
/* A-F */
|
|
2249
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
2250
|
+
/* a-f */
|
|
2251
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
2252
|
+
)
|
|
2253
|
+
)
|
|
2254
|
+
);
|
|
2255
|
+
if (digit < 0)
|
|
2256
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
2257
|
+
value = value << 4 | digit;
|
|
2276
2258
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
2280
|
-
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
2281
|
-
toml: str,
|
|
2282
|
-
ptr: tmp
|
|
2283
|
-
});
|
|
2259
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
2260
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
2284
2261
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2262
|
+
parsed += String.fromCodePoint(value);
|
|
2263
|
+
sliceStart = ctx.p + 1;
|
|
2264
|
+
state = 0;
|
|
2265
|
+
} else if (c === 32 || c === 9) {
|
|
2266
|
+
state = 2;
|
|
2288
2267
|
} else {
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2268
|
+
if (c === 98)
|
|
2269
|
+
parsed += "\b";
|
|
2270
|
+
else if (c === 116)
|
|
2271
|
+
parsed += " ";
|
|
2272
|
+
else if (c === 110)
|
|
2273
|
+
parsed += "\n";
|
|
2274
|
+
else if (c === 102)
|
|
2275
|
+
parsed += "\f";
|
|
2276
|
+
else if (c === 114)
|
|
2277
|
+
parsed += "\r";
|
|
2278
|
+
else if (c === 101)
|
|
2279
|
+
parsed += "\x1B";
|
|
2280
|
+
else if (c === 34)
|
|
2281
|
+
parsed += '"';
|
|
2282
|
+
else if (c === 92)
|
|
2283
|
+
parsed += "\\";
|
|
2284
|
+
else
|
|
2285
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
2286
|
+
sliceStart = ctx.p + 1;
|
|
2287
|
+
state = 0;
|
|
2288
|
+
}
|
|
2289
|
+
} else if (c !== 32 && c !== 9) {
|
|
2290
|
+
if (state === 2) {
|
|
2291
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
2292
|
+
toml: ctx.s,
|
|
2293
|
+
ptr: sliceStart
|
|
2292
2294
|
});
|
|
2293
2295
|
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
tmp = ptr - 1;
|
|
2297
|
-
isEscape = true;
|
|
2298
|
-
parsed += str.slice(sliceStart, tmp);
|
|
2296
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
2297
|
+
sliceStart = ctx.p;
|
|
2299
2298
|
}
|
|
2300
2299
|
}
|
|
2301
|
-
|
|
2300
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
2302
2301
|
}
|
|
2303
2302
|
__name(parseString, "parseString");
|
|
2304
|
-
function
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
if (
|
|
2308
|
-
|
|
2303
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
2304
|
+
let value = ctx.s.slice(start, end);
|
|
2305
|
+
let commentIdx = value.indexOf("#");
|
|
2306
|
+
if (commentIdx > 0) {
|
|
2307
|
+
skipComment({ s: value, p: commentIdx});
|
|
2308
|
+
value = value.slice(0, commentIdx);
|
|
2309
|
+
}
|
|
2310
|
+
return value.trimEnd();
|
|
2311
|
+
}
|
|
2312
|
+
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
2313
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
2314
|
+
let ptr = ctx.p;
|
|
2315
|
+
let err = { toml: ctx.s, ptr };
|
|
2316
|
+
skipUntil(ctx, 44, end);
|
|
2317
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
2318
|
+
if (!value)
|
|
2319
|
+
throw new TomlError("incomplete declaration: value expected", err);
|
|
2309
2320
|
if (value === "-inf")
|
|
2310
2321
|
return -Infinity;
|
|
2311
2322
|
if (value === "inf" || value === "+inf")
|
|
@@ -2317,25 +2328,16 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
2317
2328
|
let isInt = INT_REGEX.test(value);
|
|
2318
2329
|
if (isInt || FLOAT_REGEX.test(value)) {
|
|
2319
2330
|
if (LEADING_ZERO.test(value)) {
|
|
2320
|
-
throw new TomlError("leading zeroes are not allowed",
|
|
2321
|
-
toml,
|
|
2322
|
-
ptr
|
|
2323
|
-
});
|
|
2331
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
2324
2332
|
}
|
|
2325
2333
|
value = value.replace(/_/g, "");
|
|
2326
2334
|
let numeric = +value;
|
|
2327
2335
|
if (isNaN(numeric)) {
|
|
2328
|
-
throw new TomlError("invalid number",
|
|
2329
|
-
toml,
|
|
2330
|
-
ptr
|
|
2331
|
-
});
|
|
2336
|
+
throw new TomlError("invalid number", err);
|
|
2332
2337
|
}
|
|
2333
2338
|
if (isInt) {
|
|
2334
2339
|
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
2335
|
-
throw new TomlError("integer value cannot be represented losslessly",
|
|
2336
|
-
toml,
|
|
2337
|
-
ptr
|
|
2338
|
-
});
|
|
2340
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
2339
2341
|
}
|
|
2340
2342
|
if (isInt || integersAsBigInt === true)
|
|
2341
2343
|
numeric = BigInt(value);
|
|
@@ -2343,254 +2345,192 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
|
2343
2345
|
return numeric;
|
|
2344
2346
|
}
|
|
2345
2347
|
const date = new TomlDate(value);
|
|
2346
|
-
if (!date.isValid())
|
|
2347
|
-
throw new TomlError("invalid value",
|
|
2348
|
-
toml,
|
|
2349
|
-
ptr
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2348
|
+
if (!date.isValid())
|
|
2349
|
+
throw new TomlError("invalid value", err);
|
|
2352
2350
|
return date;
|
|
2353
2351
|
}
|
|
2354
2352
|
__name(parseValue, "parseValue");
|
|
2355
2353
|
|
|
2356
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2357
|
-
function
|
|
2358
|
-
let
|
|
2359
|
-
let
|
|
2360
|
-
if (
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
if (!allowNewLines) {
|
|
2366
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
2367
|
-
if (newlineIdx > -1) {
|
|
2368
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
2369
|
-
toml: str,
|
|
2370
|
-
ptr: startPtr + newlineIdx
|
|
2354
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/extract.js
|
|
2355
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
2356
|
+
let ptr = ctx.p;
|
|
2357
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
2358
|
+
if (c === 91 || c === 123) {
|
|
2359
|
+
if (!ctx.d--) {
|
|
2360
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
2361
|
+
toml: ctx.s,
|
|
2362
|
+
ptr
|
|
2371
2363
|
});
|
|
2372
2364
|
}
|
|
2365
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
2366
|
+
ctx.d++;
|
|
2367
|
+
return value;
|
|
2373
2368
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
2377
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
2378
|
-
if (depth === 0) {
|
|
2379
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
2380
|
-
toml: str,
|
|
2381
|
-
ptr
|
|
2382
|
-
});
|
|
2369
|
+
if (c === 34 || c === 39) {
|
|
2370
|
+
return parseString(ctx);
|
|
2383
2371
|
}
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
2390
|
-
if (nextNewLine > -1) {
|
|
2391
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
2392
|
-
toml: str,
|
|
2393
|
-
ptr: nextNewLine
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
return [value, newPtr];
|
|
2398
|
-
}
|
|
2399
|
-
let endPtr;
|
|
2400
|
-
if (c === '"' || c === "'") {
|
|
2401
|
-
endPtr = getStringEnd(str, ptr);
|
|
2402
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
2403
|
-
if (end) {
|
|
2404
|
-
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
2405
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
2406
|
-
throw new TomlError("unexpected character encountered", {
|
|
2407
|
-
toml: str,
|
|
2408
|
-
ptr: endPtr
|
|
2409
|
-
});
|
|
2410
|
-
}
|
|
2411
|
-
endPtr += +(str[endPtr] === ",");
|
|
2412
|
-
}
|
|
2413
|
-
return [parsed, endPtr];
|
|
2414
|
-
}
|
|
2415
|
-
endPtr = skipUntil(str, ptr, ",", end);
|
|
2416
|
-
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
2417
|
-
if (!slice[0]) {
|
|
2418
|
-
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
2419
|
-
toml: str,
|
|
2420
|
-
ptr
|
|
2421
|
-
});
|
|
2372
|
+
if (c === 116) {
|
|
2373
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
2374
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
2375
|
+
ctx.p++;
|
|
2376
|
+
return true;
|
|
2422
2377
|
}
|
|
2423
|
-
if (
|
|
2424
|
-
|
|
2425
|
-
|
|
2378
|
+
if (c === 102) {
|
|
2379
|
+
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)
|
|
2380
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
2381
|
+
ctx.p++;
|
|
2382
|
+
return false;
|
|
2426
2383
|
}
|
|
2427
|
-
return
|
|
2428
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
2429
|
-
endPtr
|
|
2430
|
-
];
|
|
2384
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
2431
2385
|
}
|
|
2432
2386
|
__name(extractValue, "extractValue");
|
|
2433
2387
|
|
|
2434
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2388
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/struct.js
|
|
2435
2389
|
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
2436
|
-
function parseKey(
|
|
2437
|
-
let
|
|
2390
|
+
function parseKey(ctx, end = "=") {
|
|
2391
|
+
let start = ctx.p;
|
|
2392
|
+
let dot = start - 1;
|
|
2438
2393
|
let parsed = [];
|
|
2439
|
-
let endPtr =
|
|
2394
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
2440
2395
|
if (endPtr < 0) {
|
|
2441
2396
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2442
|
-
toml:
|
|
2443
|
-
ptr
|
|
2397
|
+
toml: ctx.s,
|
|
2398
|
+
ptr: start
|
|
2444
2399
|
});
|
|
2445
2400
|
}
|
|
2446
2401
|
do {
|
|
2447
|
-
let c =
|
|
2448
|
-
if (c !==
|
|
2449
|
-
if (c ===
|
|
2450
|
-
if (c ===
|
|
2402
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
2403
|
+
if (c !== 32 && c !== 9) {
|
|
2404
|
+
if (c === 34 || c === 39) {
|
|
2405
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
2451
2406
|
throw new TomlError("multiline strings are not allowed in keys", {
|
|
2452
|
-
toml:
|
|
2453
|
-
ptr
|
|
2407
|
+
toml: ctx.s,
|
|
2408
|
+
ptr: ctx.p
|
|
2454
2409
|
});
|
|
2455
2410
|
}
|
|
2456
|
-
let
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
toml: str,
|
|
2460
|
-
ptr
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
dot = str.indexOf(".", eos);
|
|
2464
|
-
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2411
|
+
let part = parseString(ctx);
|
|
2412
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
2413
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2465
2414
|
let newLine = indexOfNewline(strEnd);
|
|
2466
2415
|
if (newLine > -1) {
|
|
2467
2416
|
throw new TomlError("newlines are not allowed in keys", {
|
|
2468
|
-
toml:
|
|
2469
|
-
ptr:
|
|
2417
|
+
toml: ctx.s,
|
|
2418
|
+
ptr: newLine
|
|
2470
2419
|
});
|
|
2471
2420
|
}
|
|
2472
2421
|
if (strEnd.trimStart()) {
|
|
2473
2422
|
throw new TomlError("found extra tokens after the string part", {
|
|
2474
|
-
toml:
|
|
2475
|
-
ptr:
|
|
2423
|
+
toml: ctx.s,
|
|
2424
|
+
ptr: ctx.p
|
|
2476
2425
|
});
|
|
2477
2426
|
}
|
|
2478
|
-
if (endPtr <
|
|
2479
|
-
endPtr =
|
|
2427
|
+
if (endPtr < ctx.p) {
|
|
2428
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
2480
2429
|
if (endPtr < 0) {
|
|
2481
2430
|
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2482
|
-
toml:
|
|
2483
|
-
ptr
|
|
2431
|
+
toml: ctx.s,
|
|
2432
|
+
ptr: start
|
|
2484
2433
|
});
|
|
2485
2434
|
}
|
|
2486
2435
|
}
|
|
2487
|
-
parsed.push(
|
|
2436
|
+
parsed.push(part);
|
|
2488
2437
|
} else {
|
|
2489
|
-
dot =
|
|
2490
|
-
let part =
|
|
2438
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
2439
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2491
2440
|
if (!KEY_PART_RE.test(part)) {
|
|
2492
2441
|
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
2493
|
-
toml:
|
|
2494
|
-
ptr
|
|
2442
|
+
toml: ctx.s,
|
|
2443
|
+
ptr: ctx.p
|
|
2495
2444
|
});
|
|
2496
2445
|
}
|
|
2497
2446
|
parsed.push(part.trimEnd());
|
|
2498
2447
|
}
|
|
2499
2448
|
}
|
|
2500
2449
|
} while (dot + 1 && dot < endPtr);
|
|
2501
|
-
|
|
2450
|
+
ctx.p = endPtr + 1;
|
|
2451
|
+
skipVoid(ctx, true, true);
|
|
2452
|
+
return parsed;
|
|
2502
2453
|
}
|
|
2503
2454
|
__name(parseKey, "parseKey");
|
|
2504
|
-
function parseInlineTable(
|
|
2455
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
2505
2456
|
let res = {};
|
|
2506
2457
|
let seen = /* @__PURE__ */ new Set();
|
|
2507
2458
|
let c;
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
2526
|
-
k = key[i];
|
|
2527
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2528
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
2529
|
-
toml: str,
|
|
2530
|
-
ptr
|
|
2531
|
-
});
|
|
2532
|
-
}
|
|
2533
|
-
if (!hasOwn && k === "__proto__") {
|
|
2534
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
if (hasOwn) {
|
|
2459
|
+
ctx.p++;
|
|
2460
|
+
while (ctx.p < ctx.s.length) {
|
|
2461
|
+
skipVoid(ctx);
|
|
2462
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
2463
|
+
ctx.p++;
|
|
2464
|
+
return res;
|
|
2465
|
+
}
|
|
2466
|
+
let k;
|
|
2467
|
+
let t = res;
|
|
2468
|
+
let hasOwn = false;
|
|
2469
|
+
let p = ctx.p;
|
|
2470
|
+
let key = parseKey(ctx);
|
|
2471
|
+
for (let i = 0; i < key.length; i++) {
|
|
2472
|
+
if (i)
|
|
2473
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
2474
|
+
k = key[i];
|
|
2475
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2538
2476
|
throw new TomlError("trying to redefine an already defined value", {
|
|
2539
|
-
toml:
|
|
2540
|
-
ptr
|
|
2477
|
+
toml: ctx.s,
|
|
2478
|
+
ptr: p
|
|
2541
2479
|
});
|
|
2542
2480
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2481
|
+
if (!hasOwn && k === "__proto__") {
|
|
2482
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
if (hasOwn) {
|
|
2486
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
2487
|
+
toml: ctx.s,
|
|
2488
|
+
ptr: ctx.p
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
2492
|
+
seen.add(t[k] = value);
|
|
2493
|
+
skipVoid(ctx);
|
|
2494
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
2495
|
+
return res;
|
|
2496
|
+
}
|
|
2497
|
+
if (c !== 44) {
|
|
2498
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
2548
2499
|
}
|
|
2549
2500
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
if (!c) {
|
|
2557
|
-
throw new TomlError("unfinished table encountered", {
|
|
2558
|
-
toml: str,
|
|
2559
|
-
ptr
|
|
2560
|
-
});
|
|
2561
|
-
}
|
|
2562
|
-
return [res, ptr];
|
|
2501
|
+
throw new TomlError("unfinished table encountered", {
|
|
2502
|
+
toml: ctx.s,
|
|
2503
|
+
ptr: ctx.p
|
|
2504
|
+
});
|
|
2563
2505
|
}
|
|
2564
2506
|
__name(parseInlineTable, "parseInlineTable");
|
|
2565
|
-
function parseArray(
|
|
2507
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
2566
2508
|
let res = [];
|
|
2567
2509
|
let c;
|
|
2568
|
-
|
|
2569
|
-
while (
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2510
|
+
ctx.p++;
|
|
2511
|
+
while (ctx.p < ctx.s.length) {
|
|
2512
|
+
skipVoid(ctx);
|
|
2513
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
2514
|
+
ctx.p++;
|
|
2515
|
+
return res;
|
|
2516
|
+
}
|
|
2517
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
2518
|
+
skipVoid(ctx);
|
|
2519
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
2520
|
+
return res;
|
|
2521
|
+
}
|
|
2522
|
+
if (c !== 44) {
|
|
2523
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
2581
2524
|
}
|
|
2582
2525
|
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
});
|
|
2588
|
-
}
|
|
2589
|
-
return [res, ptr];
|
|
2526
|
+
throw new TomlError("unfinished array encountered", {
|
|
2527
|
+
toml: ctx.s,
|
|
2528
|
+
ptr: ctx.p
|
|
2529
|
+
});
|
|
2590
2530
|
}
|
|
2591
2531
|
__name(parseArray, "parseArray");
|
|
2592
2532
|
|
|
2593
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2533
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/parse.js
|
|
2594
2534
|
function peekTable(key, table, meta, type) {
|
|
2595
2535
|
let t = table;
|
|
2596
2536
|
let m = meta;
|
|
@@ -2652,25 +2592,29 @@ function peekTable(key, table, meta, type) {
|
|
|
2652
2592
|
}
|
|
2653
2593
|
__name(peekTable, "peekTable");
|
|
2654
2594
|
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
2595
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
2655
2596
|
let res = {};
|
|
2656
2597
|
let meta = {};
|
|
2598
|
+
let tmp;
|
|
2657
2599
|
let tbl = res;
|
|
2658
2600
|
let m = meta;
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
let
|
|
2601
|
+
skipVoid(ctx);
|
|
2602
|
+
while (ctx.p < toml.length) {
|
|
2603
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
2604
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
2605
|
+
tmp = ctx.p += +isTableArray;
|
|
2606
|
+
let k = parseKey(ctx, "]");
|
|
2663
2607
|
if (isTableArray) {
|
|
2664
|
-
if (toml
|
|
2608
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
2665
2609
|
throw new TomlError("expected end of table declaration", {
|
|
2666
2610
|
toml,
|
|
2667
|
-
ptr:
|
|
2611
|
+
ptr: ctx.p - 1
|
|
2668
2612
|
});
|
|
2669
2613
|
}
|
|
2670
|
-
|
|
2614
|
+
ctx.p++;
|
|
2671
2615
|
}
|
|
2672
2616
|
let p = peekTable(
|
|
2673
|
-
k
|
|
2617
|
+
k,
|
|
2674
2618
|
res,
|
|
2675
2619
|
meta,
|
|
2676
2620
|
isTableArray ? 2 : 1
|
|
@@ -2679,16 +2623,16 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2679
2623
|
if (!p) {
|
|
2680
2624
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2681
2625
|
toml,
|
|
2682
|
-
ptr
|
|
2626
|
+
ptr: tmp
|
|
2683
2627
|
});
|
|
2684
2628
|
}
|
|
2685
2629
|
m = p[2];
|
|
2686
2630
|
tbl = p[1];
|
|
2687
|
-
ptr = k[1];
|
|
2688
2631
|
} else {
|
|
2689
|
-
|
|
2632
|
+
tmp = ctx.p;
|
|
2633
|
+
let k = parseKey(ctx);
|
|
2690
2634
|
let p = peekTable(
|
|
2691
|
-
k
|
|
2635
|
+
k,
|
|
2692
2636
|
tbl,
|
|
2693
2637
|
m,
|
|
2694
2638
|
0
|
|
@@ -2697,35 +2641,37 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2697
2641
|
if (!p) {
|
|
2698
2642
|
throw new TomlError("trying to redefine an already defined table or value", {
|
|
2699
2643
|
toml,
|
|
2700
|
-
ptr
|
|
2644
|
+
ptr: tmp
|
|
2701
2645
|
});
|
|
2702
2646
|
}
|
|
2703
|
-
|
|
2704
|
-
p[1][p[0]] = v[0];
|
|
2705
|
-
ptr = v[1];
|
|
2647
|
+
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
2706
2648
|
}
|
|
2707
|
-
|
|
2708
|
-
if (toml
|
|
2649
|
+
skipVoid(ctx, true);
|
|
2650
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
2709
2651
|
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
2710
2652
|
toml,
|
|
2711
|
-
ptr
|
|
2653
|
+
ptr: ctx.p
|
|
2712
2654
|
});
|
|
2713
2655
|
}
|
|
2714
|
-
|
|
2656
|
+
skipVoid(ctx);
|
|
2715
2657
|
}
|
|
2716
2658
|
return res;
|
|
2717
2659
|
}
|
|
2718
2660
|
__name(parse, "parse");
|
|
2719
2661
|
|
|
2720
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2662
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/stringify.js
|
|
2721
2663
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
2722
2664
|
function extendedTypeOf(obj) {
|
|
2723
2665
|
let type = typeof obj;
|
|
2724
2666
|
if (type === "object") {
|
|
2725
2667
|
if (Array.isArray(obj))
|
|
2726
2668
|
return "array";
|
|
2727
|
-
if (obj instanceof Date)
|
|
2669
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
2728
2670
|
return "date";
|
|
2671
|
+
if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
|
|
2672
|
+
typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
|
|
2673
|
+
return "temporal";
|
|
2674
|
+
}
|
|
2729
2675
|
}
|
|
2730
2676
|
return type;
|
|
2731
2677
|
}
|
|
@@ -2742,38 +2688,43 @@ function formatString(s) {
|
|
|
2742
2688
|
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
2743
2689
|
}
|
|
2744
2690
|
__name(formatString, "formatString");
|
|
2691
|
+
function stringifyTemporal(temporal) {
|
|
2692
|
+
return temporal.toString({
|
|
2693
|
+
calendarName: "never",
|
|
2694
|
+
timeZoneName: "never"
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
__name(stringifyTemporal, "stringifyTemporal");
|
|
2745
2698
|
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
2746
2699
|
if (depth === 0) {
|
|
2747
2700
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2748
2701
|
}
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
if (type === "array") {
|
|
2776
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
2702
|
+
switch (type) {
|
|
2703
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
2704
|
+
case "number":
|
|
2705
|
+
if (isNaN(val))
|
|
2706
|
+
return "nan";
|
|
2707
|
+
if (val === Infinity)
|
|
2708
|
+
return "inf";
|
|
2709
|
+
if (val === -Infinity)
|
|
2710
|
+
return "-inf";
|
|
2711
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
2712
|
+
return val.toFixed(1);
|
|
2713
|
+
case "bigint":
|
|
2714
|
+
case "boolean":
|
|
2715
|
+
return val.toString();
|
|
2716
|
+
case "string":
|
|
2717
|
+
return formatString(val);
|
|
2718
|
+
case "date":
|
|
2719
|
+
if (isNaN(val.getTime()))
|
|
2720
|
+
throw new TypeError("cannot serialize invalid date");
|
|
2721
|
+
return val.toISOString();
|
|
2722
|
+
case "object":
|
|
2723
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
2724
|
+
case "array":
|
|
2725
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
2726
|
+
case "temporal":
|
|
2727
|
+
return stringifyTemporal(val);
|
|
2777
2728
|
}
|
|
2778
2729
|
}
|
|
2779
2730
|
__name(stringifyValue, "stringifyValue");
|
|
@@ -2867,7 +2818,7 @@ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
|
2867
2818
|
}
|
|
2868
2819
|
__name(stringify, "stringify");
|
|
2869
2820
|
|
|
2870
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2821
|
+
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/index.js
|
|
2871
2822
|
var dist_default = { parse, stringify, TomlDate, TomlError };
|
|
2872
2823
|
|
|
2873
2824
|
// src/core/file-format.ts
|
|
@@ -3870,7 +3821,7 @@ function scrubEncryptedCredentials(options) {
|
|
|
3870
3821
|
__name(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
3871
3822
|
/*! Bundled license information:
|
|
3872
3823
|
|
|
3873
|
-
smol-toml/dist/
|
|
3824
|
+
smol-toml/dist/date.js:
|
|
3874
3825
|
(*!
|
|
3875
3826
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3876
3827
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3899,7 +3850,7 @@ smol-toml/dist/error.js:
|
|
|
3899
3850
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3900
3851
|
*)
|
|
3901
3852
|
|
|
3902
|
-
smol-toml/dist/
|
|
3853
|
+
smol-toml/dist/error.js:
|
|
3903
3854
|
(*!
|
|
3904
3855
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3905
3856
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3928,7 +3879,7 @@ smol-toml/dist/util.js:
|
|
|
3928
3879
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3929
3880
|
*)
|
|
3930
3881
|
|
|
3931
|
-
smol-toml/dist/
|
|
3882
|
+
smol-toml/dist/util.js:
|
|
3932
3883
|
(*!
|
|
3933
3884
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3934
3885
|
* SPDX-License-Identifier: BSD-3-Clause
|