@cloudflare/workers-utils 0.1.0 → 0.1.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-BbMtmAbH.d.mts → browser-BJCkNVW9.d.mts} +19 -3
- package/dist/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-LFBFF6MG.mjs → chunk-PSOC3TD3.mjs} +2 -32
- package/dist/index.d.mts +35 -3
- package/dist/index.mjs +1224 -2138
- package/dist/metafile-esm.json +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX, UserError, assertNever, constructWranglerConfig, createFatalError, formatCompatibilityDate, mapWorkerMetadataBindings } from './chunk-
|
|
1
|
+
import { __name, UserError, PATH_TO_DEPLOY_CONFIG, FatalError } from './chunk-PSOC3TD3.mjs';
|
|
2
|
+
export { CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX, UserError, assertNever, constructWranglerConfig, createFatalError, formatCompatibilityDate, mapWorkerMetadataBindings } from './chunk-PSOC3TD3.mjs';
|
|
3
3
|
import fs, { readFileSync as readFileSync$1, existsSync } from 'node:fs';
|
|
4
4
|
import path5, { resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -8,2088 +8,6 @@ import { statSync, existsSync as existsSync$1, writeFileSync } from 'fs';
|
|
|
8
8
|
import assert from 'node:assert';
|
|
9
9
|
import path4 from 'path';
|
|
10
10
|
|
|
11
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/parser.js
|
|
12
|
-
var require_parser = __commonJS({
|
|
13
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
|
|
14
|
-
var ParserEND = 1114112;
|
|
15
|
-
var ParserError = class _ParserError extends Error {
|
|
16
|
-
static {
|
|
17
|
-
__name(this, "ParserError");
|
|
18
|
-
}
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
constructor(msg, filename, linenumber) {
|
|
21
|
-
super("[ParserError] " + msg, filename, linenumber);
|
|
22
|
-
this.name = "ParserError";
|
|
23
|
-
this.code = "ParserError";
|
|
24
|
-
if (Error.captureStackTrace) Error.captureStackTrace(this, _ParserError);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var State = class {
|
|
28
|
-
static {
|
|
29
|
-
__name(this, "State");
|
|
30
|
-
}
|
|
31
|
-
constructor(parser) {
|
|
32
|
-
this.parser = parser;
|
|
33
|
-
this.buf = "";
|
|
34
|
-
this.returned = null;
|
|
35
|
-
this.result = null;
|
|
36
|
-
this.resultTable = null;
|
|
37
|
-
this.resultArr = null;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var Parser = class {
|
|
41
|
-
static {
|
|
42
|
-
__name(this, "Parser");
|
|
43
|
-
}
|
|
44
|
-
constructor() {
|
|
45
|
-
this.pos = 0;
|
|
46
|
-
this.col = 0;
|
|
47
|
-
this.line = 0;
|
|
48
|
-
this.obj = {};
|
|
49
|
-
this.ctx = this.obj;
|
|
50
|
-
this.stack = [];
|
|
51
|
-
this._buf = "";
|
|
52
|
-
this.char = null;
|
|
53
|
-
this.ii = 0;
|
|
54
|
-
this.state = new State(this.parseStart);
|
|
55
|
-
}
|
|
56
|
-
parse(str) {
|
|
57
|
-
if (str.length === 0 || str.length == null) return;
|
|
58
|
-
this._buf = String(str);
|
|
59
|
-
this.ii = -1;
|
|
60
|
-
this.char = -1;
|
|
61
|
-
let getNext;
|
|
62
|
-
while (getNext === false || this.nextChar()) {
|
|
63
|
-
getNext = this.runOne();
|
|
64
|
-
}
|
|
65
|
-
this._buf = null;
|
|
66
|
-
}
|
|
67
|
-
nextChar() {
|
|
68
|
-
if (this.char === 10) {
|
|
69
|
-
++this.line;
|
|
70
|
-
this.col = -1;
|
|
71
|
-
}
|
|
72
|
-
++this.ii;
|
|
73
|
-
this.char = this._buf.codePointAt(this.ii);
|
|
74
|
-
++this.pos;
|
|
75
|
-
++this.col;
|
|
76
|
-
return this.haveBuffer();
|
|
77
|
-
}
|
|
78
|
-
haveBuffer() {
|
|
79
|
-
return this.ii < this._buf.length;
|
|
80
|
-
}
|
|
81
|
-
runOne() {
|
|
82
|
-
return this.state.parser.call(this, this.state.returned);
|
|
83
|
-
}
|
|
84
|
-
finish() {
|
|
85
|
-
this.char = ParserEND;
|
|
86
|
-
let last;
|
|
87
|
-
do {
|
|
88
|
-
last = this.state.parser;
|
|
89
|
-
this.runOne();
|
|
90
|
-
} while (this.state.parser !== last);
|
|
91
|
-
this.ctx = null;
|
|
92
|
-
this.state = null;
|
|
93
|
-
this._buf = null;
|
|
94
|
-
return this.obj;
|
|
95
|
-
}
|
|
96
|
-
next(fn) {
|
|
97
|
-
if (typeof fn !== "function") throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
|
|
98
|
-
this.state.parser = fn;
|
|
99
|
-
}
|
|
100
|
-
goto(fn) {
|
|
101
|
-
this.next(fn);
|
|
102
|
-
return this.runOne();
|
|
103
|
-
}
|
|
104
|
-
call(fn, returnWith) {
|
|
105
|
-
if (returnWith) this.next(returnWith);
|
|
106
|
-
this.stack.push(this.state);
|
|
107
|
-
this.state = new State(fn);
|
|
108
|
-
}
|
|
109
|
-
callNow(fn, returnWith) {
|
|
110
|
-
this.call(fn, returnWith);
|
|
111
|
-
return this.runOne();
|
|
112
|
-
}
|
|
113
|
-
return(value) {
|
|
114
|
-
if (this.stack.length === 0) throw this.error(new ParserError("Stack underflow"));
|
|
115
|
-
if (value === void 0) value = this.state.buf;
|
|
116
|
-
this.state = this.stack.pop();
|
|
117
|
-
this.state.returned = value;
|
|
118
|
-
}
|
|
119
|
-
returnNow(value) {
|
|
120
|
-
this.return(value);
|
|
121
|
-
return this.runOne();
|
|
122
|
-
}
|
|
123
|
-
consume() {
|
|
124
|
-
if (this.char === ParserEND) throw this.error(new ParserError("Unexpected end-of-buffer"));
|
|
125
|
-
this.state.buf += this._buf[this.ii];
|
|
126
|
-
}
|
|
127
|
-
error(err) {
|
|
128
|
-
err.line = this.line;
|
|
129
|
-
err.col = this.col;
|
|
130
|
-
err.pos = this.pos;
|
|
131
|
-
return err;
|
|
132
|
-
}
|
|
133
|
-
/* istanbul ignore next */
|
|
134
|
-
parseStart() {
|
|
135
|
-
throw new ParserError("Must declare a parseStart method");
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
Parser.END = ParserEND;
|
|
139
|
-
Parser.Error = ParserError;
|
|
140
|
-
module2.exports = Parser;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime.js
|
|
145
|
-
var require_create_datetime = __commonJS({
|
|
146
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
|
|
147
|
-
module2.exports = (value) => {
|
|
148
|
-
const date = new Date(value);
|
|
149
|
-
if (isNaN(date)) {
|
|
150
|
-
throw new TypeError("Invalid Datetime");
|
|
151
|
-
} else {
|
|
152
|
-
return date;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/format-num.js
|
|
159
|
-
var require_format_num = __commonJS({
|
|
160
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
|
|
161
|
-
module2.exports = (d, num) => {
|
|
162
|
-
num = String(num);
|
|
163
|
-
while (num.length < d) num = "0" + num;
|
|
164
|
-
return num;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime-float.js
|
|
170
|
-
var require_create_datetime_float = __commonJS({
|
|
171
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
|
|
172
|
-
var f = require_format_num();
|
|
173
|
-
var FloatingDateTime = class extends Date {
|
|
174
|
-
static {
|
|
175
|
-
__name(this, "FloatingDateTime");
|
|
176
|
-
}
|
|
177
|
-
constructor(value) {
|
|
178
|
-
super(value + "Z");
|
|
179
|
-
this.isFloating = true;
|
|
180
|
-
}
|
|
181
|
-
toISOString() {
|
|
182
|
-
const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
|
183
|
-
const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
184
|
-
return `${date}T${time}`;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
module2.exports = (value) => {
|
|
188
|
-
const date = new FloatingDateTime(value);
|
|
189
|
-
if (isNaN(date)) {
|
|
190
|
-
throw new TypeError("Invalid Datetime");
|
|
191
|
-
} else {
|
|
192
|
-
return date;
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-date.js
|
|
199
|
-
var require_create_date = __commonJS({
|
|
200
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
|
|
201
|
-
var f = require_format_num();
|
|
202
|
-
var DateTime = global.Date;
|
|
203
|
-
var Date2 = class extends DateTime {
|
|
204
|
-
static {
|
|
205
|
-
__name(this, "Date");
|
|
206
|
-
}
|
|
207
|
-
constructor(value) {
|
|
208
|
-
super(value);
|
|
209
|
-
this.isDate = true;
|
|
210
|
-
}
|
|
211
|
-
toISOString() {
|
|
212
|
-
return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
module2.exports = (value) => {
|
|
216
|
-
const date = new Date2(value);
|
|
217
|
-
if (isNaN(date)) {
|
|
218
|
-
throw new TypeError("Invalid Datetime");
|
|
219
|
-
} else {
|
|
220
|
-
return date;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-time.js
|
|
227
|
-
var require_create_time = __commonJS({
|
|
228
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
|
|
229
|
-
var f = require_format_num();
|
|
230
|
-
var Time = class extends Date {
|
|
231
|
-
static {
|
|
232
|
-
__name(this, "Time");
|
|
233
|
-
}
|
|
234
|
-
constructor(value) {
|
|
235
|
-
super(`0000-01-01T${value}Z`);
|
|
236
|
-
this.isTime = true;
|
|
237
|
-
}
|
|
238
|
-
toISOString() {
|
|
239
|
-
return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
module2.exports = (value) => {
|
|
243
|
-
const date = new Time(value);
|
|
244
|
-
if (isNaN(date)) {
|
|
245
|
-
throw new TypeError("Invalid Datetime");
|
|
246
|
-
} else {
|
|
247
|
-
return date;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/toml-parser.js
|
|
254
|
-
var require_toml_parser = __commonJS({
|
|
255
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
|
|
256
|
-
module.exports = makeParserClass(require_parser());
|
|
257
|
-
module.exports.makeParserClass = makeParserClass;
|
|
258
|
-
var TomlError = class _TomlError extends Error {
|
|
259
|
-
static {
|
|
260
|
-
__name(this, "TomlError");
|
|
261
|
-
}
|
|
262
|
-
constructor(msg) {
|
|
263
|
-
super(msg);
|
|
264
|
-
this.name = "TomlError";
|
|
265
|
-
if (Error.captureStackTrace) Error.captureStackTrace(this, _TomlError);
|
|
266
|
-
this.fromTOML = true;
|
|
267
|
-
this.wrapped = null;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
TomlError.wrap = (err) => {
|
|
271
|
-
const terr = new TomlError(err.message);
|
|
272
|
-
terr.code = err.code;
|
|
273
|
-
terr.wrapped = err;
|
|
274
|
-
return terr;
|
|
275
|
-
};
|
|
276
|
-
module.exports.TomlError = TomlError;
|
|
277
|
-
var createDateTime = require_create_datetime();
|
|
278
|
-
var createDateTimeFloat = require_create_datetime_float();
|
|
279
|
-
var createDate = require_create_date();
|
|
280
|
-
var createTime = require_create_time();
|
|
281
|
-
var CTRL_I = 9;
|
|
282
|
-
var CTRL_J = 10;
|
|
283
|
-
var CTRL_M = 13;
|
|
284
|
-
var CTRL_CHAR_BOUNDARY = 31;
|
|
285
|
-
var CHAR_SP = 32;
|
|
286
|
-
var CHAR_QUOT = 34;
|
|
287
|
-
var CHAR_NUM = 35;
|
|
288
|
-
var CHAR_APOS = 39;
|
|
289
|
-
var CHAR_PLUS = 43;
|
|
290
|
-
var CHAR_COMMA = 44;
|
|
291
|
-
var CHAR_HYPHEN = 45;
|
|
292
|
-
var CHAR_PERIOD = 46;
|
|
293
|
-
var CHAR_0 = 48;
|
|
294
|
-
var CHAR_1 = 49;
|
|
295
|
-
var CHAR_7 = 55;
|
|
296
|
-
var CHAR_9 = 57;
|
|
297
|
-
var CHAR_COLON = 58;
|
|
298
|
-
var CHAR_EQUALS = 61;
|
|
299
|
-
var CHAR_A = 65;
|
|
300
|
-
var CHAR_E = 69;
|
|
301
|
-
var CHAR_F = 70;
|
|
302
|
-
var CHAR_T = 84;
|
|
303
|
-
var CHAR_U = 85;
|
|
304
|
-
var CHAR_Z = 90;
|
|
305
|
-
var CHAR_LOWBAR = 95;
|
|
306
|
-
var CHAR_a = 97;
|
|
307
|
-
var CHAR_b = 98;
|
|
308
|
-
var CHAR_e = 101;
|
|
309
|
-
var CHAR_f = 102;
|
|
310
|
-
var CHAR_i = 105;
|
|
311
|
-
var CHAR_l = 108;
|
|
312
|
-
var CHAR_n = 110;
|
|
313
|
-
var CHAR_o = 111;
|
|
314
|
-
var CHAR_r = 114;
|
|
315
|
-
var CHAR_s = 115;
|
|
316
|
-
var CHAR_t = 116;
|
|
317
|
-
var CHAR_u = 117;
|
|
318
|
-
var CHAR_x = 120;
|
|
319
|
-
var CHAR_z = 122;
|
|
320
|
-
var CHAR_LCUB = 123;
|
|
321
|
-
var CHAR_RCUB = 125;
|
|
322
|
-
var CHAR_LSQB = 91;
|
|
323
|
-
var CHAR_BSOL = 92;
|
|
324
|
-
var CHAR_RSQB = 93;
|
|
325
|
-
var CHAR_DEL = 127;
|
|
326
|
-
var SURROGATE_FIRST = 55296;
|
|
327
|
-
var SURROGATE_LAST = 57343;
|
|
328
|
-
var escapes = {
|
|
329
|
-
[CHAR_b]: "\b",
|
|
330
|
-
[CHAR_t]: " ",
|
|
331
|
-
[CHAR_n]: "\n",
|
|
332
|
-
[CHAR_f]: "\f",
|
|
333
|
-
[CHAR_r]: "\r",
|
|
334
|
-
[CHAR_QUOT]: '"',
|
|
335
|
-
[CHAR_BSOL]: "\\"
|
|
336
|
-
};
|
|
337
|
-
function isDigit(cp) {
|
|
338
|
-
return cp >= CHAR_0 && cp <= CHAR_9;
|
|
339
|
-
}
|
|
340
|
-
__name(isDigit, "isDigit");
|
|
341
|
-
function isHexit(cp) {
|
|
342
|
-
return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
|
343
|
-
}
|
|
344
|
-
__name(isHexit, "isHexit");
|
|
345
|
-
function isBit(cp) {
|
|
346
|
-
return cp === CHAR_1 || cp === CHAR_0;
|
|
347
|
-
}
|
|
348
|
-
__name(isBit, "isBit");
|
|
349
|
-
function isOctit(cp) {
|
|
350
|
-
return cp >= CHAR_0 && cp <= CHAR_7;
|
|
351
|
-
}
|
|
352
|
-
__name(isOctit, "isOctit");
|
|
353
|
-
function isAlphaNumQuoteHyphen(cp) {
|
|
354
|
-
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
355
|
-
}
|
|
356
|
-
__name(isAlphaNumQuoteHyphen, "isAlphaNumQuoteHyphen");
|
|
357
|
-
function isAlphaNumHyphen(cp) {
|
|
358
|
-
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
359
|
-
}
|
|
360
|
-
__name(isAlphaNumHyphen, "isAlphaNumHyphen");
|
|
361
|
-
var _type = Symbol("type");
|
|
362
|
-
var _declared = Symbol("declared");
|
|
363
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
364
|
-
var defineProperty = Object.defineProperty;
|
|
365
|
-
var descriptor = { configurable: true, enumerable: true, writable: true, value: void 0 };
|
|
366
|
-
function hasKey(obj, key) {
|
|
367
|
-
if (hasOwnProperty.call(obj, key)) return true;
|
|
368
|
-
if (key === "__proto__") defineProperty(obj, "__proto__", descriptor);
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
__name(hasKey, "hasKey");
|
|
372
|
-
var INLINE_TABLE = Symbol("inline-table");
|
|
373
|
-
function InlineTable() {
|
|
374
|
-
return Object.defineProperties({}, {
|
|
375
|
-
[_type]: { value: INLINE_TABLE }
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
__name(InlineTable, "InlineTable");
|
|
379
|
-
function isInlineTable(obj) {
|
|
380
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
381
|
-
return obj[_type] === INLINE_TABLE;
|
|
382
|
-
}
|
|
383
|
-
__name(isInlineTable, "isInlineTable");
|
|
384
|
-
var TABLE = Symbol("table");
|
|
385
|
-
function Table() {
|
|
386
|
-
return Object.defineProperties({}, {
|
|
387
|
-
[_type]: { value: TABLE },
|
|
388
|
-
[_declared]: { value: false, writable: true }
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
__name(Table, "Table");
|
|
392
|
-
function isTable(obj) {
|
|
393
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
394
|
-
return obj[_type] === TABLE;
|
|
395
|
-
}
|
|
396
|
-
__name(isTable, "isTable");
|
|
397
|
-
var _contentType = Symbol("content-type");
|
|
398
|
-
var INLINE_LIST = Symbol("inline-list");
|
|
399
|
-
function InlineList(type) {
|
|
400
|
-
return Object.defineProperties([], {
|
|
401
|
-
[_type]: { value: INLINE_LIST },
|
|
402
|
-
[_contentType]: { value: type }
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
__name(InlineList, "InlineList");
|
|
406
|
-
function isInlineList(obj) {
|
|
407
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
408
|
-
return obj[_type] === INLINE_LIST;
|
|
409
|
-
}
|
|
410
|
-
__name(isInlineList, "isInlineList");
|
|
411
|
-
var LIST = Symbol("list");
|
|
412
|
-
function List() {
|
|
413
|
-
return Object.defineProperties([], {
|
|
414
|
-
[_type]: { value: LIST }
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
__name(List, "List");
|
|
418
|
-
function isList(obj) {
|
|
419
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
420
|
-
return obj[_type] === LIST;
|
|
421
|
-
}
|
|
422
|
-
__name(isList, "isList");
|
|
423
|
-
var _custom;
|
|
424
|
-
try {
|
|
425
|
-
const utilInspect = eval("require('util').inspect");
|
|
426
|
-
_custom = utilInspect.custom;
|
|
427
|
-
} catch (_) {
|
|
428
|
-
}
|
|
429
|
-
var _inspect = _custom || "inspect";
|
|
430
|
-
var BoxedBigInt = class {
|
|
431
|
-
static {
|
|
432
|
-
__name(this, "BoxedBigInt");
|
|
433
|
-
}
|
|
434
|
-
constructor(value) {
|
|
435
|
-
try {
|
|
436
|
-
this.value = global.BigInt.asIntN(64, value);
|
|
437
|
-
} catch (_) {
|
|
438
|
-
this.value = null;
|
|
439
|
-
}
|
|
440
|
-
Object.defineProperty(this, _type, { value: INTEGER });
|
|
441
|
-
}
|
|
442
|
-
isNaN() {
|
|
443
|
-
return this.value === null;
|
|
444
|
-
}
|
|
445
|
-
/* istanbul ignore next */
|
|
446
|
-
toString() {
|
|
447
|
-
return String(this.value);
|
|
448
|
-
}
|
|
449
|
-
/* istanbul ignore next */
|
|
450
|
-
[_inspect]() {
|
|
451
|
-
return `[BigInt: ${this.toString()}]}`;
|
|
452
|
-
}
|
|
453
|
-
valueOf() {
|
|
454
|
-
return this.value;
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
var INTEGER = Symbol("integer");
|
|
458
|
-
function Integer(value) {
|
|
459
|
-
let num = Number(value);
|
|
460
|
-
if (Object.is(num, -0)) num = 0;
|
|
461
|
-
if (global.BigInt && !Number.isSafeInteger(num)) {
|
|
462
|
-
return new BoxedBigInt(value);
|
|
463
|
-
} else {
|
|
464
|
-
return Object.defineProperties(new Number(num), {
|
|
465
|
-
isNaN: { value: /* @__PURE__ */ __name(function() {
|
|
466
|
-
return isNaN(this);
|
|
467
|
-
}, "value") },
|
|
468
|
-
[_type]: { value: INTEGER },
|
|
469
|
-
[_inspect]: { value: /* @__PURE__ */ __name(() => `[Integer: ${value}]`, "value") }
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
__name(Integer, "Integer");
|
|
474
|
-
function isInteger(obj) {
|
|
475
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
476
|
-
return obj[_type] === INTEGER;
|
|
477
|
-
}
|
|
478
|
-
__name(isInteger, "isInteger");
|
|
479
|
-
var FLOAT = Symbol("float");
|
|
480
|
-
function Float(value) {
|
|
481
|
-
return Object.defineProperties(new Number(value), {
|
|
482
|
-
[_type]: { value: FLOAT },
|
|
483
|
-
[_inspect]: { value: /* @__PURE__ */ __name(() => `[Float: ${value}]`, "value") }
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
__name(Float, "Float");
|
|
487
|
-
function isFloat(obj) {
|
|
488
|
-
if (obj === null || typeof obj !== "object") return false;
|
|
489
|
-
return obj[_type] === FLOAT;
|
|
490
|
-
}
|
|
491
|
-
__name(isFloat, "isFloat");
|
|
492
|
-
function tomlType(value) {
|
|
493
|
-
const type = typeof value;
|
|
494
|
-
if (type === "object") {
|
|
495
|
-
if (value === null) return "null";
|
|
496
|
-
if (value instanceof Date) return "datetime";
|
|
497
|
-
if (_type in value) {
|
|
498
|
-
switch (value[_type]) {
|
|
499
|
-
case INLINE_TABLE:
|
|
500
|
-
return "inline-table";
|
|
501
|
-
case INLINE_LIST:
|
|
502
|
-
return "inline-list";
|
|
503
|
-
/* istanbul ignore next */
|
|
504
|
-
case TABLE:
|
|
505
|
-
return "table";
|
|
506
|
-
/* istanbul ignore next */
|
|
507
|
-
case LIST:
|
|
508
|
-
return "list";
|
|
509
|
-
case FLOAT:
|
|
510
|
-
return "float";
|
|
511
|
-
case INTEGER:
|
|
512
|
-
return "integer";
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
return type;
|
|
517
|
-
}
|
|
518
|
-
__name(tomlType, "tomlType");
|
|
519
|
-
function makeParserClass(Parser) {
|
|
520
|
-
class TOMLParser extends Parser {
|
|
521
|
-
static {
|
|
522
|
-
__name(this, "TOMLParser");
|
|
523
|
-
}
|
|
524
|
-
constructor() {
|
|
525
|
-
super();
|
|
526
|
-
this.ctx = this.obj = Table();
|
|
527
|
-
}
|
|
528
|
-
/* MATCH HELPER */
|
|
529
|
-
atEndOfWord() {
|
|
530
|
-
return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
|
531
|
-
}
|
|
532
|
-
atEndOfLine() {
|
|
533
|
-
return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
|
534
|
-
}
|
|
535
|
-
parseStart() {
|
|
536
|
-
if (this.char === Parser.END) {
|
|
537
|
-
return null;
|
|
538
|
-
} else if (this.char === CHAR_LSQB) {
|
|
539
|
-
return this.call(this.parseTableOrList);
|
|
540
|
-
} else if (this.char === CHAR_NUM) {
|
|
541
|
-
return this.call(this.parseComment);
|
|
542
|
-
} else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
543
|
-
return null;
|
|
544
|
-
} else if (isAlphaNumQuoteHyphen(this.char)) {
|
|
545
|
-
return this.callNow(this.parseAssignStatement);
|
|
546
|
-
} else {
|
|
547
|
-
throw this.error(new TomlError(`Unknown character "${this.char}"`));
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
// HELPER, this strips any whitespace and comments to the end of the line
|
|
551
|
-
// then RETURNS. Last state in a production.
|
|
552
|
-
parseWhitespaceToEOL() {
|
|
553
|
-
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
554
|
-
return null;
|
|
555
|
-
} else if (this.char === CHAR_NUM) {
|
|
556
|
-
return this.goto(this.parseComment);
|
|
557
|
-
} else if (this.char === Parser.END || this.char === CTRL_J) {
|
|
558
|
-
return this.return();
|
|
559
|
-
} else {
|
|
560
|
-
throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
/* ASSIGNMENT: key = value */
|
|
564
|
-
parseAssignStatement() {
|
|
565
|
-
return this.callNow(this.parseAssign, this.recordAssignStatement);
|
|
566
|
-
}
|
|
567
|
-
recordAssignStatement(kv) {
|
|
568
|
-
let target = this.ctx;
|
|
569
|
-
let finalKey = kv.key.pop();
|
|
570
|
-
for (let kw of kv.key) {
|
|
571
|
-
if (hasKey(target, kw) && !isTable(target[kw])) {
|
|
572
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
573
|
-
}
|
|
574
|
-
target = target[kw] = target[kw] || Table();
|
|
575
|
-
}
|
|
576
|
-
if (hasKey(target, finalKey)) {
|
|
577
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
578
|
-
}
|
|
579
|
-
target[_declared] = true;
|
|
580
|
-
if (isInteger(kv.value) || isFloat(kv.value)) {
|
|
581
|
-
target[finalKey] = kv.value.valueOf();
|
|
582
|
-
} else {
|
|
583
|
-
target[finalKey] = kv.value;
|
|
584
|
-
}
|
|
585
|
-
return this.goto(this.parseWhitespaceToEOL);
|
|
586
|
-
}
|
|
587
|
-
/* ASSSIGNMENT expression, key = value possibly inside an inline table */
|
|
588
|
-
parseAssign() {
|
|
589
|
-
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
590
|
-
}
|
|
591
|
-
recordAssignKeyword(key) {
|
|
592
|
-
if (this.state.resultTable) {
|
|
593
|
-
this.state.resultTable.push(key);
|
|
594
|
-
} else {
|
|
595
|
-
this.state.resultTable = [key];
|
|
596
|
-
}
|
|
597
|
-
return this.goto(this.parseAssignKeywordPreDot);
|
|
598
|
-
}
|
|
599
|
-
parseAssignKeywordPreDot() {
|
|
600
|
-
if (this.char === CHAR_PERIOD) {
|
|
601
|
-
return this.next(this.parseAssignKeywordPostDot);
|
|
602
|
-
} else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
|
603
|
-
return this.goto(this.parseAssignEqual);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
parseAssignKeywordPostDot() {
|
|
607
|
-
if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
|
608
|
-
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
parseAssignEqual() {
|
|
612
|
-
if (this.char === CHAR_EQUALS) {
|
|
613
|
-
return this.next(this.parseAssignPreValue);
|
|
614
|
-
} else {
|
|
615
|
-
throw this.error(new TomlError('Invalid character, expected "="'));
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
parseAssignPreValue() {
|
|
619
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
620
|
-
return null;
|
|
621
|
-
} else {
|
|
622
|
-
return this.callNow(this.parseValue, this.recordAssignValue);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
recordAssignValue(value) {
|
|
626
|
-
return this.returnNow({ key: this.state.resultTable, value });
|
|
627
|
-
}
|
|
628
|
-
/* COMMENTS: #...eol */
|
|
629
|
-
parseComment() {
|
|
630
|
-
do {
|
|
631
|
-
if (this.char === Parser.END || this.char === CTRL_J) {
|
|
632
|
-
return this.return();
|
|
633
|
-
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
|
634
|
-
throw this.errorControlCharIn("comments");
|
|
635
|
-
}
|
|
636
|
-
} while (this.nextChar());
|
|
637
|
-
}
|
|
638
|
-
/* TABLES AND LISTS, [foo] and [[foo]] */
|
|
639
|
-
parseTableOrList() {
|
|
640
|
-
if (this.char === CHAR_LSQB) {
|
|
641
|
-
this.next(this.parseList);
|
|
642
|
-
} else {
|
|
643
|
-
return this.goto(this.parseTable);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
/* TABLE [foo.bar.baz] */
|
|
647
|
-
parseTable() {
|
|
648
|
-
this.ctx = this.obj;
|
|
649
|
-
return this.goto(this.parseTableNext);
|
|
650
|
-
}
|
|
651
|
-
parseTableNext() {
|
|
652
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
653
|
-
return null;
|
|
654
|
-
} else {
|
|
655
|
-
return this.callNow(this.parseKeyword, this.parseTableMore);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
parseTableMore(keyword) {
|
|
659
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
660
|
-
return null;
|
|
661
|
-
} else if (this.char === CHAR_RSQB) {
|
|
662
|
-
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
|
663
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
664
|
-
} else {
|
|
665
|
-
this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
|
666
|
-
this.ctx[_declared] = true;
|
|
667
|
-
}
|
|
668
|
-
return this.next(this.parseWhitespaceToEOL);
|
|
669
|
-
} else if (this.char === CHAR_PERIOD) {
|
|
670
|
-
if (!hasKey(this.ctx, keyword)) {
|
|
671
|
-
this.ctx = this.ctx[keyword] = Table();
|
|
672
|
-
} else if (isTable(this.ctx[keyword])) {
|
|
673
|
-
this.ctx = this.ctx[keyword];
|
|
674
|
-
} else if (isList(this.ctx[keyword])) {
|
|
675
|
-
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
676
|
-
} else {
|
|
677
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
678
|
-
}
|
|
679
|
-
return this.next(this.parseTableNext);
|
|
680
|
-
} else {
|
|
681
|
-
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
/* LIST [[a.b.c]] */
|
|
685
|
-
parseList() {
|
|
686
|
-
this.ctx = this.obj;
|
|
687
|
-
return this.goto(this.parseListNext);
|
|
688
|
-
}
|
|
689
|
-
parseListNext() {
|
|
690
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
691
|
-
return null;
|
|
692
|
-
} else {
|
|
693
|
-
return this.callNow(this.parseKeyword, this.parseListMore);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
parseListMore(keyword) {
|
|
697
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
698
|
-
return null;
|
|
699
|
-
} else if (this.char === CHAR_RSQB) {
|
|
700
|
-
if (!hasKey(this.ctx, keyword)) {
|
|
701
|
-
this.ctx[keyword] = List();
|
|
702
|
-
}
|
|
703
|
-
if (isInlineList(this.ctx[keyword])) {
|
|
704
|
-
throw this.error(new TomlError("Can't extend an inline array"));
|
|
705
|
-
} else if (isList(this.ctx[keyword])) {
|
|
706
|
-
const next = Table();
|
|
707
|
-
this.ctx[keyword].push(next);
|
|
708
|
-
this.ctx = next;
|
|
709
|
-
} else {
|
|
710
|
-
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
711
|
-
}
|
|
712
|
-
return this.next(this.parseListEnd);
|
|
713
|
-
} else if (this.char === CHAR_PERIOD) {
|
|
714
|
-
if (!hasKey(this.ctx, keyword)) {
|
|
715
|
-
this.ctx = this.ctx[keyword] = Table();
|
|
716
|
-
} else if (isInlineList(this.ctx[keyword])) {
|
|
717
|
-
throw this.error(new TomlError("Can't extend an inline array"));
|
|
718
|
-
} else if (isInlineTable(this.ctx[keyword])) {
|
|
719
|
-
throw this.error(new TomlError("Can't extend an inline table"));
|
|
720
|
-
} else if (isList(this.ctx[keyword])) {
|
|
721
|
-
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
722
|
-
} else if (isTable(this.ctx[keyword])) {
|
|
723
|
-
this.ctx = this.ctx[keyword];
|
|
724
|
-
} else {
|
|
725
|
-
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
726
|
-
}
|
|
727
|
-
return this.next(this.parseListNext);
|
|
728
|
-
} else {
|
|
729
|
-
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
parseListEnd(keyword) {
|
|
733
|
-
if (this.char === CHAR_RSQB) {
|
|
734
|
-
return this.next(this.parseWhitespaceToEOL);
|
|
735
|
-
} else {
|
|
736
|
-
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
/* VALUE string, number, boolean, inline list, inline object */
|
|
740
|
-
parseValue() {
|
|
741
|
-
if (this.char === Parser.END) {
|
|
742
|
-
throw this.error(new TomlError("Key without value"));
|
|
743
|
-
} else if (this.char === CHAR_QUOT) {
|
|
744
|
-
return this.next(this.parseDoubleString);
|
|
745
|
-
}
|
|
746
|
-
if (this.char === CHAR_APOS) {
|
|
747
|
-
return this.next(this.parseSingleString);
|
|
748
|
-
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
749
|
-
return this.goto(this.parseNumberSign);
|
|
750
|
-
} else if (this.char === CHAR_i) {
|
|
751
|
-
return this.next(this.parseInf);
|
|
752
|
-
} else if (this.char === CHAR_n) {
|
|
753
|
-
return this.next(this.parseNan);
|
|
754
|
-
} else if (isDigit(this.char)) {
|
|
755
|
-
return this.goto(this.parseNumberOrDateTime);
|
|
756
|
-
} else if (this.char === CHAR_t || this.char === CHAR_f) {
|
|
757
|
-
return this.goto(this.parseBoolean);
|
|
758
|
-
} else if (this.char === CHAR_LSQB) {
|
|
759
|
-
return this.call(this.parseInlineList, this.recordValue);
|
|
760
|
-
} else if (this.char === CHAR_LCUB) {
|
|
761
|
-
return this.call(this.parseInlineTable, this.recordValue);
|
|
762
|
-
} else {
|
|
763
|
-
throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
recordValue(value) {
|
|
767
|
-
return this.returnNow(value);
|
|
768
|
-
}
|
|
769
|
-
parseInf() {
|
|
770
|
-
if (this.char === CHAR_n) {
|
|
771
|
-
return this.next(this.parseInf2);
|
|
772
|
-
} else {
|
|
773
|
-
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
parseInf2() {
|
|
777
|
-
if (this.char === CHAR_f) {
|
|
778
|
-
if (this.state.buf === "-") {
|
|
779
|
-
return this.return(-Infinity);
|
|
780
|
-
} else {
|
|
781
|
-
return this.return(Infinity);
|
|
782
|
-
}
|
|
783
|
-
} else {
|
|
784
|
-
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
parseNan() {
|
|
788
|
-
if (this.char === CHAR_a) {
|
|
789
|
-
return this.next(this.parseNan2);
|
|
790
|
-
} else {
|
|
791
|
-
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
parseNan2() {
|
|
795
|
-
if (this.char === CHAR_n) {
|
|
796
|
-
return this.return(NaN);
|
|
797
|
-
} else {
|
|
798
|
-
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
/* KEYS, barewords or basic, literal, or dotted */
|
|
802
|
-
parseKeyword() {
|
|
803
|
-
if (this.char === CHAR_QUOT) {
|
|
804
|
-
return this.next(this.parseBasicString);
|
|
805
|
-
} else if (this.char === CHAR_APOS) {
|
|
806
|
-
return this.next(this.parseLiteralString);
|
|
807
|
-
} else {
|
|
808
|
-
return this.goto(this.parseBareKey);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
/* KEYS: barewords */
|
|
812
|
-
parseBareKey() {
|
|
813
|
-
do {
|
|
814
|
-
if (this.char === Parser.END) {
|
|
815
|
-
throw this.error(new TomlError("Key ended without value"));
|
|
816
|
-
} else if (isAlphaNumHyphen(this.char)) {
|
|
817
|
-
this.consume();
|
|
818
|
-
} else if (this.state.buf.length === 0) {
|
|
819
|
-
throw this.error(new TomlError("Empty bare keys are not allowed"));
|
|
820
|
-
} else {
|
|
821
|
-
return this.returnNow();
|
|
822
|
-
}
|
|
823
|
-
} while (this.nextChar());
|
|
824
|
-
}
|
|
825
|
-
/* STRINGS, single quoted (literal) */
|
|
826
|
-
parseSingleString() {
|
|
827
|
-
if (this.char === CHAR_APOS) {
|
|
828
|
-
return this.next(this.parseLiteralMultiStringMaybe);
|
|
829
|
-
} else {
|
|
830
|
-
return this.goto(this.parseLiteralString);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
parseLiteralString() {
|
|
834
|
-
do {
|
|
835
|
-
if (this.char === CHAR_APOS) {
|
|
836
|
-
return this.return();
|
|
837
|
-
} else if (this.atEndOfLine()) {
|
|
838
|
-
throw this.error(new TomlError("Unterminated string"));
|
|
839
|
-
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
|
840
|
-
throw this.errorControlCharIn("strings");
|
|
841
|
-
} else {
|
|
842
|
-
this.consume();
|
|
843
|
-
}
|
|
844
|
-
} while (this.nextChar());
|
|
845
|
-
}
|
|
846
|
-
parseLiteralMultiStringMaybe() {
|
|
847
|
-
if (this.char === CHAR_APOS) {
|
|
848
|
-
return this.next(this.parseLiteralMultiString);
|
|
849
|
-
} else {
|
|
850
|
-
return this.returnNow();
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
parseLiteralMultiString() {
|
|
854
|
-
if (this.char === CTRL_M) {
|
|
855
|
-
return null;
|
|
856
|
-
} else if (this.char === CTRL_J) {
|
|
857
|
-
return this.next(this.parseLiteralMultiStringContent);
|
|
858
|
-
} else {
|
|
859
|
-
return this.goto(this.parseLiteralMultiStringContent);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
parseLiteralMultiStringContent() {
|
|
863
|
-
do {
|
|
864
|
-
if (this.char === CHAR_APOS) {
|
|
865
|
-
return this.next(this.parseLiteralMultiEnd);
|
|
866
|
-
} else if (this.char === Parser.END) {
|
|
867
|
-
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
868
|
-
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
|
869
|
-
throw this.errorControlCharIn("strings");
|
|
870
|
-
} else {
|
|
871
|
-
this.consume();
|
|
872
|
-
}
|
|
873
|
-
} while (this.nextChar());
|
|
874
|
-
}
|
|
875
|
-
parseLiteralMultiEnd() {
|
|
876
|
-
if (this.char === CHAR_APOS) {
|
|
877
|
-
return this.next(this.parseLiteralMultiEnd2);
|
|
878
|
-
} else {
|
|
879
|
-
this.state.buf += "'";
|
|
880
|
-
return this.goto(this.parseLiteralMultiStringContent);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
parseLiteralMultiEnd2() {
|
|
884
|
-
if (this.char === CHAR_APOS) {
|
|
885
|
-
return this.next(this.parseLiteralMultiEnd3);
|
|
886
|
-
} else {
|
|
887
|
-
this.state.buf += "''";
|
|
888
|
-
return this.goto(this.parseLiteralMultiStringContent);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
parseLiteralMultiEnd3() {
|
|
892
|
-
if (this.char === CHAR_APOS) {
|
|
893
|
-
this.state.buf += "'";
|
|
894
|
-
return this.next(this.parseLiteralMultiEnd4);
|
|
895
|
-
} else {
|
|
896
|
-
return this.returnNow();
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
parseLiteralMultiEnd4() {
|
|
900
|
-
if (this.char === CHAR_APOS) {
|
|
901
|
-
this.state.buf += "'";
|
|
902
|
-
return this.return();
|
|
903
|
-
} else {
|
|
904
|
-
return this.returnNow();
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
/* STRINGS double quoted */
|
|
908
|
-
parseDoubleString() {
|
|
909
|
-
if (this.char === CHAR_QUOT) {
|
|
910
|
-
return this.next(this.parseMultiStringMaybe);
|
|
911
|
-
} else {
|
|
912
|
-
return this.goto(this.parseBasicString);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
parseBasicString() {
|
|
916
|
-
do {
|
|
917
|
-
if (this.char === CHAR_BSOL) {
|
|
918
|
-
return this.call(this.parseEscape, this.recordEscapeReplacement);
|
|
919
|
-
} else if (this.char === CHAR_QUOT) {
|
|
920
|
-
return this.return();
|
|
921
|
-
} else if (this.atEndOfLine()) {
|
|
922
|
-
throw this.error(new TomlError("Unterminated string"));
|
|
923
|
-
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
|
924
|
-
throw this.errorControlCharIn("strings");
|
|
925
|
-
} else {
|
|
926
|
-
this.consume();
|
|
927
|
-
}
|
|
928
|
-
} while (this.nextChar());
|
|
929
|
-
}
|
|
930
|
-
recordEscapeReplacement(replacement) {
|
|
931
|
-
this.state.buf += replacement;
|
|
932
|
-
return this.goto(this.parseBasicString);
|
|
933
|
-
}
|
|
934
|
-
parseMultiStringMaybe() {
|
|
935
|
-
if (this.char === CHAR_QUOT) {
|
|
936
|
-
return this.next(this.parseMultiString);
|
|
937
|
-
} else {
|
|
938
|
-
return this.returnNow();
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
parseMultiString() {
|
|
942
|
-
if (this.char === CTRL_M) {
|
|
943
|
-
return null;
|
|
944
|
-
} else if (this.char === CTRL_J) {
|
|
945
|
-
return this.next(this.parseMultiStringContent);
|
|
946
|
-
} else {
|
|
947
|
-
return this.goto(this.parseMultiStringContent);
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
parseMultiStringContent() {
|
|
951
|
-
do {
|
|
952
|
-
if (this.char === CHAR_BSOL) {
|
|
953
|
-
return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
|
954
|
-
} else if (this.char === CHAR_QUOT) {
|
|
955
|
-
return this.next(this.parseMultiEnd);
|
|
956
|
-
} else if (this.char === Parser.END) {
|
|
957
|
-
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
958
|
-
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
|
959
|
-
throw this.errorControlCharIn("strings");
|
|
960
|
-
} else {
|
|
961
|
-
this.consume();
|
|
962
|
-
}
|
|
963
|
-
} while (this.nextChar());
|
|
964
|
-
}
|
|
965
|
-
errorControlCharIn(type) {
|
|
966
|
-
let displayCode = "\\u00";
|
|
967
|
-
if (this.char < 16) {
|
|
968
|
-
displayCode += "0";
|
|
969
|
-
}
|
|
970
|
-
displayCode += this.char.toString(16);
|
|
971
|
-
return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in ${type}, use ${displayCode} instead`));
|
|
972
|
-
}
|
|
973
|
-
recordMultiEscapeReplacement(replacement) {
|
|
974
|
-
this.state.buf += replacement;
|
|
975
|
-
return this.goto(this.parseMultiStringContent);
|
|
976
|
-
}
|
|
977
|
-
parseMultiEnd() {
|
|
978
|
-
if (this.char === CHAR_QUOT) {
|
|
979
|
-
return this.next(this.parseMultiEnd2);
|
|
980
|
-
} else {
|
|
981
|
-
this.state.buf += '"';
|
|
982
|
-
return this.goto(this.parseMultiStringContent);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
parseMultiEnd2() {
|
|
986
|
-
if (this.char === CHAR_QUOT) {
|
|
987
|
-
return this.next(this.parseMultiEnd3);
|
|
988
|
-
} else {
|
|
989
|
-
this.state.buf += '""';
|
|
990
|
-
return this.goto(this.parseMultiStringContent);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
parseMultiEnd3() {
|
|
994
|
-
if (this.char === CHAR_QUOT) {
|
|
995
|
-
this.state.buf += '"';
|
|
996
|
-
return this.next(this.parseMultiEnd4);
|
|
997
|
-
} else {
|
|
998
|
-
return this.returnNow();
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
parseMultiEnd4() {
|
|
1002
|
-
if (this.char === CHAR_QUOT) {
|
|
1003
|
-
this.state.buf += '"';
|
|
1004
|
-
return this.return();
|
|
1005
|
-
} else {
|
|
1006
|
-
return this.returnNow();
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
parseMultiEscape() {
|
|
1010
|
-
if (this.char === CTRL_M || this.char === CTRL_J) {
|
|
1011
|
-
return this.next(this.parseMultiTrim);
|
|
1012
|
-
} else if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
1013
|
-
return this.next(this.parsePreMultiTrim);
|
|
1014
|
-
} else {
|
|
1015
|
-
return this.goto(this.parseEscape);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
parsePreMultiTrim() {
|
|
1019
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
1020
|
-
return null;
|
|
1021
|
-
} else if (this.char === CTRL_M || this.char === CTRL_J) {
|
|
1022
|
-
return this.next(this.parseMultiTrim);
|
|
1023
|
-
} else {
|
|
1024
|
-
throw this.error(new TomlError("Can't escape whitespace"));
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
parseMultiTrim() {
|
|
1028
|
-
if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
1029
|
-
return null;
|
|
1030
|
-
} else {
|
|
1031
|
-
return this.returnNow();
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
parseEscape() {
|
|
1035
|
-
if (this.char in escapes) {
|
|
1036
|
-
return this.return(escapes[this.char]);
|
|
1037
|
-
} else if (this.char === CHAR_u) {
|
|
1038
|
-
return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
|
|
1039
|
-
} else if (this.char === CHAR_U) {
|
|
1040
|
-
return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
|
1041
|
-
} else {
|
|
1042
|
-
throw this.error(new TomlError("Unknown escape character: " + this.char));
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
parseUnicodeReturn(char) {
|
|
1046
|
-
try {
|
|
1047
|
-
const codePoint = parseInt(char, 16);
|
|
1048
|
-
if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
|
|
1049
|
-
throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
|
1050
|
-
}
|
|
1051
|
-
return this.returnNow(String.fromCodePoint(codePoint));
|
|
1052
|
-
} catch (err) {
|
|
1053
|
-
throw this.error(TomlError.wrap(err));
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
parseSmallUnicode() {
|
|
1057
|
-
if (!isHexit(this.char)) {
|
|
1058
|
-
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
1059
|
-
} else {
|
|
1060
|
-
this.consume();
|
|
1061
|
-
if (this.state.buf.length >= 4) return this.return();
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
parseLargeUnicode() {
|
|
1065
|
-
if (!isHexit(this.char)) {
|
|
1066
|
-
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
1067
|
-
} else {
|
|
1068
|
-
this.consume();
|
|
1069
|
-
if (this.state.buf.length >= 8) return this.return();
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
/* NUMBERS */
|
|
1073
|
-
parseNumberSign() {
|
|
1074
|
-
this.consume();
|
|
1075
|
-
return this.next(this.parseMaybeSignedInfOrNan);
|
|
1076
|
-
}
|
|
1077
|
-
parseMaybeSignedInfOrNan() {
|
|
1078
|
-
if (this.char === CHAR_i) {
|
|
1079
|
-
return this.next(this.parseInf);
|
|
1080
|
-
} else if (this.char === CHAR_n) {
|
|
1081
|
-
return this.next(this.parseNan);
|
|
1082
|
-
} else {
|
|
1083
|
-
return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
parseNumberIntegerStart() {
|
|
1087
|
-
if (this.char === CHAR_0) {
|
|
1088
|
-
this.consume();
|
|
1089
|
-
return this.next(this.parseNumberIntegerExponentOrDecimal);
|
|
1090
|
-
} else {
|
|
1091
|
-
return this.goto(this.parseNumberInteger);
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
parseNumberIntegerExponentOrDecimal() {
|
|
1095
|
-
if (this.char === CHAR_PERIOD) {
|
|
1096
|
-
this.consume();
|
|
1097
|
-
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
1098
|
-
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
1099
|
-
this.consume();
|
|
1100
|
-
return this.next(this.parseNumberExponentSign);
|
|
1101
|
-
} else {
|
|
1102
|
-
return this.returnNow(Integer(this.state.buf));
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
parseNumberInteger() {
|
|
1106
|
-
if (isDigit(this.char)) {
|
|
1107
|
-
this.consume();
|
|
1108
|
-
} else if (this.char === CHAR_LOWBAR) {
|
|
1109
|
-
return this.call(this.parseNoUnder);
|
|
1110
|
-
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
1111
|
-
this.consume();
|
|
1112
|
-
return this.next(this.parseNumberExponentSign);
|
|
1113
|
-
} else if (this.char === CHAR_PERIOD) {
|
|
1114
|
-
this.consume();
|
|
1115
|
-
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
1116
|
-
} else {
|
|
1117
|
-
const result = Integer(this.state.buf);
|
|
1118
|
-
if (result.isNaN()) {
|
|
1119
|
-
throw this.error(new TomlError("Invalid number"));
|
|
1120
|
-
} else {
|
|
1121
|
-
return this.returnNow(result);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
parseNoUnder() {
|
|
1126
|
-
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
|
|
1127
|
-
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
1128
|
-
} else if (this.atEndOfWord()) {
|
|
1129
|
-
throw this.error(new TomlError("Incomplete number"));
|
|
1130
|
-
}
|
|
1131
|
-
return this.returnNow();
|
|
1132
|
-
}
|
|
1133
|
-
parseNoUnderHexOctBinLiteral() {
|
|
1134
|
-
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
|
|
1135
|
-
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
1136
|
-
} else if (this.atEndOfWord()) {
|
|
1137
|
-
throw this.error(new TomlError("Incomplete number"));
|
|
1138
|
-
}
|
|
1139
|
-
return this.returnNow();
|
|
1140
|
-
}
|
|
1141
|
-
parseNumberFloat() {
|
|
1142
|
-
if (this.char === CHAR_LOWBAR) {
|
|
1143
|
-
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
1144
|
-
} else if (isDigit(this.char)) {
|
|
1145
|
-
this.consume();
|
|
1146
|
-
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
1147
|
-
this.consume();
|
|
1148
|
-
return this.next(this.parseNumberExponentSign);
|
|
1149
|
-
} else {
|
|
1150
|
-
return this.returnNow(Float(this.state.buf));
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
parseNumberExponentSign() {
|
|
1154
|
-
if (isDigit(this.char)) {
|
|
1155
|
-
return this.goto(this.parseNumberExponent);
|
|
1156
|
-
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
1157
|
-
this.consume();
|
|
1158
|
-
this.call(this.parseNoUnder, this.parseNumberExponent);
|
|
1159
|
-
} else {
|
|
1160
|
-
throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
parseNumberExponent() {
|
|
1164
|
-
if (isDigit(this.char)) {
|
|
1165
|
-
this.consume();
|
|
1166
|
-
} else if (this.char === CHAR_LOWBAR) {
|
|
1167
|
-
return this.call(this.parseNoUnder);
|
|
1168
|
-
} else {
|
|
1169
|
-
return this.returnNow(Float(this.state.buf));
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
/* NUMBERS or DATETIMES */
|
|
1173
|
-
parseNumberOrDateTime() {
|
|
1174
|
-
if (this.char === CHAR_0) {
|
|
1175
|
-
this.consume();
|
|
1176
|
-
return this.next(this.parseNumberBaseOrDateTime);
|
|
1177
|
-
} else {
|
|
1178
|
-
return this.goto(this.parseNumberOrDateTimeOnly);
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
parseNumberOrDateTimeOnly() {
|
|
1182
|
-
if (this.char === CHAR_LOWBAR) {
|
|
1183
|
-
return this.call(this.parseNoUnder, this.parseNumberInteger);
|
|
1184
|
-
} else if (isDigit(this.char)) {
|
|
1185
|
-
this.consume();
|
|
1186
|
-
if (this.state.buf.length > 4) this.next(this.parseNumberInteger);
|
|
1187
|
-
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
1188
|
-
this.consume();
|
|
1189
|
-
return this.next(this.parseNumberExponentSign);
|
|
1190
|
-
} else if (this.char === CHAR_PERIOD) {
|
|
1191
|
-
this.consume();
|
|
1192
|
-
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
1193
|
-
} else if (this.char === CHAR_HYPHEN) {
|
|
1194
|
-
return this.goto(this.parseDateTime);
|
|
1195
|
-
} else if (this.char === CHAR_COLON) {
|
|
1196
|
-
return this.goto(this.parseOnlyTimeHour);
|
|
1197
|
-
} else {
|
|
1198
|
-
return this.returnNow(Integer(this.state.buf));
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
parseDateTimeOnly() {
|
|
1202
|
-
if (this.state.buf.length < 4) {
|
|
1203
|
-
if (isDigit(this.char)) {
|
|
1204
|
-
return this.consume();
|
|
1205
|
-
} else if (this.char === CHAR_COLON) {
|
|
1206
|
-
return this.goto(this.parseOnlyTimeHour);
|
|
1207
|
-
} else {
|
|
1208
|
-
throw this.error(new TomlError("Expected digit while parsing year part of a date"));
|
|
1209
|
-
}
|
|
1210
|
-
} else {
|
|
1211
|
-
if (this.char === CHAR_HYPHEN) {
|
|
1212
|
-
return this.goto(this.parseDateTime);
|
|
1213
|
-
} else {
|
|
1214
|
-
throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
parseNumberBaseOrDateTime() {
|
|
1219
|
-
if (this.char === CHAR_b) {
|
|
1220
|
-
this.consume();
|
|
1221
|
-
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
|
|
1222
|
-
} else if (this.char === CHAR_o) {
|
|
1223
|
-
this.consume();
|
|
1224
|
-
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
|
|
1225
|
-
} else if (this.char === CHAR_x) {
|
|
1226
|
-
this.consume();
|
|
1227
|
-
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
|
|
1228
|
-
} else if (this.char === CHAR_PERIOD) {
|
|
1229
|
-
return this.goto(this.parseNumberInteger);
|
|
1230
|
-
} else if (isDigit(this.char)) {
|
|
1231
|
-
return this.goto(this.parseDateTimeOnly);
|
|
1232
|
-
} else {
|
|
1233
|
-
return this.returnNow(Integer(this.state.buf));
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
parseIntegerHex() {
|
|
1237
|
-
if (isHexit(this.char)) {
|
|
1238
|
-
this.consume();
|
|
1239
|
-
} else if (this.char === CHAR_LOWBAR) {
|
|
1240
|
-
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
1241
|
-
} else {
|
|
1242
|
-
const result = Integer(this.state.buf);
|
|
1243
|
-
if (result.isNaN()) {
|
|
1244
|
-
throw this.error(new TomlError("Invalid number"));
|
|
1245
|
-
} else {
|
|
1246
|
-
return this.returnNow(result);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
parseIntegerOct() {
|
|
1251
|
-
if (isOctit(this.char)) {
|
|
1252
|
-
this.consume();
|
|
1253
|
-
} else if (this.char === CHAR_LOWBAR) {
|
|
1254
|
-
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
1255
|
-
} else {
|
|
1256
|
-
const result = Integer(this.state.buf);
|
|
1257
|
-
if (result.isNaN()) {
|
|
1258
|
-
throw this.error(new TomlError("Invalid number"));
|
|
1259
|
-
} else {
|
|
1260
|
-
return this.returnNow(result);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
parseIntegerBin() {
|
|
1265
|
-
if (isBit(this.char)) {
|
|
1266
|
-
this.consume();
|
|
1267
|
-
} else if (this.char === CHAR_LOWBAR) {
|
|
1268
|
-
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
1269
|
-
} else {
|
|
1270
|
-
const result = Integer(this.state.buf);
|
|
1271
|
-
if (result.isNaN()) {
|
|
1272
|
-
throw this.error(new TomlError("Invalid number"));
|
|
1273
|
-
} else {
|
|
1274
|
-
return this.returnNow(result);
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
/* DATETIME */
|
|
1279
|
-
parseDateTime() {
|
|
1280
|
-
if (this.state.buf.length < 4) {
|
|
1281
|
-
throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
|
|
1282
|
-
}
|
|
1283
|
-
this.state.result = this.state.buf;
|
|
1284
|
-
this.state.buf = "";
|
|
1285
|
-
return this.next(this.parseDateMonth);
|
|
1286
|
-
}
|
|
1287
|
-
parseDateMonth() {
|
|
1288
|
-
if (this.char === CHAR_HYPHEN) {
|
|
1289
|
-
if (this.state.buf.length < 2) {
|
|
1290
|
-
throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
|
|
1291
|
-
}
|
|
1292
|
-
this.state.result += "-" + this.state.buf;
|
|
1293
|
-
this.state.buf = "";
|
|
1294
|
-
return this.next(this.parseDateDay);
|
|
1295
|
-
} else if (isDigit(this.char)) {
|
|
1296
|
-
this.consume();
|
|
1297
|
-
} else {
|
|
1298
|
-
throw this.error(new TomlError("Incomplete datetime"));
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
parseDateDay() {
|
|
1302
|
-
if (this.char === CHAR_T || this.char === CHAR_SP) {
|
|
1303
|
-
if (this.state.buf.length < 2) {
|
|
1304
|
-
throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
|
|
1305
|
-
}
|
|
1306
|
-
this.state.result += "-" + this.state.buf;
|
|
1307
|
-
this.state.buf = "";
|
|
1308
|
-
return this.next(this.parseStartTimeHour);
|
|
1309
|
-
} else if (this.atEndOfWord()) {
|
|
1310
|
-
return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
|
|
1311
|
-
} else if (isDigit(this.char)) {
|
|
1312
|
-
this.consume();
|
|
1313
|
-
} else {
|
|
1314
|
-
throw this.error(new TomlError("Incomplete datetime"));
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
parseStartTimeHour() {
|
|
1318
|
-
if (this.atEndOfWord()) {
|
|
1319
|
-
return this.returnNow(createDate(this.state.result));
|
|
1320
|
-
} else {
|
|
1321
|
-
return this.goto(this.parseTimeHour);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
parseTimeHour() {
|
|
1325
|
-
if (this.char === CHAR_COLON) {
|
|
1326
|
-
if (this.state.buf.length < 2) {
|
|
1327
|
-
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
1328
|
-
}
|
|
1329
|
-
this.state.result += "T" + this.state.buf;
|
|
1330
|
-
this.state.buf = "";
|
|
1331
|
-
return this.next(this.parseTimeMin);
|
|
1332
|
-
} else if (isDigit(this.char)) {
|
|
1333
|
-
this.consume();
|
|
1334
|
-
} else {
|
|
1335
|
-
throw this.error(new TomlError("Incomplete datetime"));
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
parseTimeMin() {
|
|
1339
|
-
if (this.state.buf.length < 2 && isDigit(this.char)) {
|
|
1340
|
-
this.consume();
|
|
1341
|
-
} else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
|
1342
|
-
this.state.result += ":" + this.state.buf;
|
|
1343
|
-
this.state.buf = "";
|
|
1344
|
-
return this.next(this.parseTimeSec);
|
|
1345
|
-
} else {
|
|
1346
|
-
throw this.error(new TomlError("Incomplete datetime"));
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
parseTimeSec() {
|
|
1350
|
-
if (isDigit(this.char)) {
|
|
1351
|
-
this.consume();
|
|
1352
|
-
if (this.state.buf.length === 2) {
|
|
1353
|
-
this.state.result += ":" + this.state.buf;
|
|
1354
|
-
this.state.buf = "";
|
|
1355
|
-
return this.next(this.parseTimeZoneOrFraction);
|
|
1356
|
-
}
|
|
1357
|
-
} else {
|
|
1358
|
-
throw this.error(new TomlError("Incomplete datetime"));
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
parseOnlyTimeHour() {
|
|
1362
|
-
if (this.char === CHAR_COLON) {
|
|
1363
|
-
if (this.state.buf.length < 2) {
|
|
1364
|
-
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
1365
|
-
}
|
|
1366
|
-
this.state.result = this.state.buf;
|
|
1367
|
-
this.state.buf = "";
|
|
1368
|
-
return this.next(this.parseOnlyTimeMin);
|
|
1369
|
-
} else {
|
|
1370
|
-
throw this.error(new TomlError("Incomplete time"));
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
parseOnlyTimeMin() {
|
|
1374
|
-
if (this.state.buf.length < 2 && isDigit(this.char)) {
|
|
1375
|
-
this.consume();
|
|
1376
|
-
} else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
|
1377
|
-
this.state.result += ":" + this.state.buf;
|
|
1378
|
-
this.state.buf = "";
|
|
1379
|
-
return this.next(this.parseOnlyTimeSec);
|
|
1380
|
-
} else {
|
|
1381
|
-
throw this.error(new TomlError("Incomplete time"));
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
parseOnlyTimeSec() {
|
|
1385
|
-
if (isDigit(this.char)) {
|
|
1386
|
-
this.consume();
|
|
1387
|
-
if (this.state.buf.length === 2) {
|
|
1388
|
-
return this.next(this.parseOnlyTimeFractionMaybe);
|
|
1389
|
-
}
|
|
1390
|
-
} else {
|
|
1391
|
-
throw this.error(new TomlError("Incomplete time"));
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
parseOnlyTimeFractionMaybe() {
|
|
1395
|
-
this.state.result += ":" + this.state.buf;
|
|
1396
|
-
if (this.char === CHAR_PERIOD) {
|
|
1397
|
-
this.state.buf = "";
|
|
1398
|
-
this.next(this.parseOnlyTimeFraction);
|
|
1399
|
-
} else {
|
|
1400
|
-
return this.return(createTime(this.state.result));
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
parseOnlyTimeFraction() {
|
|
1404
|
-
if (isDigit(this.char)) {
|
|
1405
|
-
this.consume();
|
|
1406
|
-
} else if (this.atEndOfWord()) {
|
|
1407
|
-
if (this.state.buf.length === 0) throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
1408
|
-
return this.returnNow(createTime(this.state.result + "." + this.state.buf));
|
|
1409
|
-
} else {
|
|
1410
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
parseTimeZoneOrFraction() {
|
|
1414
|
-
if (this.char === CHAR_PERIOD) {
|
|
1415
|
-
this.consume();
|
|
1416
|
-
this.next(this.parseDateTimeFraction);
|
|
1417
|
-
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
1418
|
-
this.consume();
|
|
1419
|
-
this.next(this.parseTimeZoneHour);
|
|
1420
|
-
} else if (this.char === CHAR_Z) {
|
|
1421
|
-
this.consume();
|
|
1422
|
-
return this.return(createDateTime(this.state.result + this.state.buf));
|
|
1423
|
-
} else if (this.atEndOfWord()) {
|
|
1424
|
-
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
1425
|
-
} else {
|
|
1426
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
parseDateTimeFraction() {
|
|
1430
|
-
if (isDigit(this.char)) {
|
|
1431
|
-
this.consume();
|
|
1432
|
-
} else if (this.state.buf.length === 1) {
|
|
1433
|
-
throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
1434
|
-
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
1435
|
-
this.consume();
|
|
1436
|
-
this.next(this.parseTimeZoneHour);
|
|
1437
|
-
} else if (this.char === CHAR_Z) {
|
|
1438
|
-
this.consume();
|
|
1439
|
-
return this.return(createDateTime(this.state.result + this.state.buf));
|
|
1440
|
-
} else if (this.atEndOfWord()) {
|
|
1441
|
-
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
1442
|
-
} else {
|
|
1443
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
parseTimeZoneHour() {
|
|
1447
|
-
if (isDigit(this.char)) {
|
|
1448
|
-
this.consume();
|
|
1449
|
-
if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep);
|
|
1450
|
-
} else {
|
|
1451
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
parseTimeZoneSep() {
|
|
1455
|
-
if (this.char === CHAR_COLON) {
|
|
1456
|
-
this.consume();
|
|
1457
|
-
this.next(this.parseTimeZoneMin);
|
|
1458
|
-
} else {
|
|
1459
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
parseTimeZoneMin() {
|
|
1463
|
-
if (isDigit(this.char)) {
|
|
1464
|
-
this.consume();
|
|
1465
|
-
if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf));
|
|
1466
|
-
} else {
|
|
1467
|
-
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
/* BOOLEAN */
|
|
1471
|
-
parseBoolean() {
|
|
1472
|
-
if (this.char === CHAR_t) {
|
|
1473
|
-
this.consume();
|
|
1474
|
-
return this.next(this.parseTrue_r);
|
|
1475
|
-
} else if (this.char === CHAR_f) {
|
|
1476
|
-
this.consume();
|
|
1477
|
-
return this.next(this.parseFalse_a);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
parseTrue_r() {
|
|
1481
|
-
if (this.char === CHAR_r) {
|
|
1482
|
-
this.consume();
|
|
1483
|
-
return this.next(this.parseTrue_u);
|
|
1484
|
-
} else {
|
|
1485
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
parseTrue_u() {
|
|
1489
|
-
if (this.char === CHAR_u) {
|
|
1490
|
-
this.consume();
|
|
1491
|
-
return this.next(this.parseTrue_e);
|
|
1492
|
-
} else {
|
|
1493
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
parseTrue_e() {
|
|
1497
|
-
if (this.char === CHAR_e) {
|
|
1498
|
-
return this.return(true);
|
|
1499
|
-
} else {
|
|
1500
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
parseFalse_a() {
|
|
1504
|
-
if (this.char === CHAR_a) {
|
|
1505
|
-
this.consume();
|
|
1506
|
-
return this.next(this.parseFalse_l);
|
|
1507
|
-
} else {
|
|
1508
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
parseFalse_l() {
|
|
1512
|
-
if (this.char === CHAR_l) {
|
|
1513
|
-
this.consume();
|
|
1514
|
-
return this.next(this.parseFalse_s);
|
|
1515
|
-
} else {
|
|
1516
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
parseFalse_s() {
|
|
1520
|
-
if (this.char === CHAR_s) {
|
|
1521
|
-
this.consume();
|
|
1522
|
-
return this.next(this.parseFalse_e);
|
|
1523
|
-
} else {
|
|
1524
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
parseFalse_e() {
|
|
1528
|
-
if (this.char === CHAR_e) {
|
|
1529
|
-
return this.return(false);
|
|
1530
|
-
} else {
|
|
1531
|
-
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
/* INLINE LISTS */
|
|
1535
|
-
parseInlineList() {
|
|
1536
|
-
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
|
1537
|
-
return null;
|
|
1538
|
-
} else if (this.char === Parser.END) {
|
|
1539
|
-
throw this.error(new TomlError("Unterminated inline array"));
|
|
1540
|
-
} else if (this.char === CHAR_NUM) {
|
|
1541
|
-
return this.call(this.parseComment);
|
|
1542
|
-
} else if (this.char === CHAR_RSQB) {
|
|
1543
|
-
return this.return(this.state.resultArr || InlineList());
|
|
1544
|
-
} else {
|
|
1545
|
-
return this.callNow(this.parseValue, this.recordInlineListValue);
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
recordInlineListValue(value) {
|
|
1549
|
-
if (!this.state.resultArr) {
|
|
1550
|
-
this.state.resultArr = InlineList(tomlType(value));
|
|
1551
|
-
}
|
|
1552
|
-
if (isFloat(value) || isInteger(value)) {
|
|
1553
|
-
this.state.resultArr.push(value.valueOf());
|
|
1554
|
-
} else {
|
|
1555
|
-
this.state.resultArr.push(value);
|
|
1556
|
-
}
|
|
1557
|
-
return this.goto(this.parseInlineListNext);
|
|
1558
|
-
}
|
|
1559
|
-
parseInlineListNext() {
|
|
1560
|
-
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
|
1561
|
-
return null;
|
|
1562
|
-
} else if (this.char === CHAR_NUM) {
|
|
1563
|
-
return this.call(this.parseComment);
|
|
1564
|
-
} else if (this.char === CHAR_COMMA) {
|
|
1565
|
-
return this.next(this.parseInlineList);
|
|
1566
|
-
} else if (this.char === CHAR_RSQB) {
|
|
1567
|
-
return this.goto(this.parseInlineList);
|
|
1568
|
-
} else {
|
|
1569
|
-
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
/* INLINE TABLE */
|
|
1573
|
-
parseInlineTable() {
|
|
1574
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
1575
|
-
return null;
|
|
1576
|
-
} else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
|
1577
|
-
throw this.error(new TomlError("Unterminated inline array"));
|
|
1578
|
-
} else if (this.char === CHAR_RCUB) {
|
|
1579
|
-
return this.return(this.state.resultTable || InlineTable());
|
|
1580
|
-
} else {
|
|
1581
|
-
if (!this.state.resultTable) this.state.resultTable = InlineTable();
|
|
1582
|
-
return this.callNow(this.parseAssign, this.recordInlineTableValue);
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
recordInlineTableValue(kv) {
|
|
1586
|
-
let target = this.state.resultTable;
|
|
1587
|
-
let finalKey = kv.key.pop();
|
|
1588
|
-
for (let kw of kv.key) {
|
|
1589
|
-
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
1590
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
1591
|
-
}
|
|
1592
|
-
target = target[kw] = target[kw] || Table();
|
|
1593
|
-
}
|
|
1594
|
-
if (hasKey(target, finalKey)) {
|
|
1595
|
-
throw this.error(new TomlError("Can't redefine existing key"));
|
|
1596
|
-
}
|
|
1597
|
-
if (isInteger(kv.value) || isFloat(kv.value)) {
|
|
1598
|
-
target[finalKey] = kv.value.valueOf();
|
|
1599
|
-
} else {
|
|
1600
|
-
target[finalKey] = kv.value;
|
|
1601
|
-
}
|
|
1602
|
-
return this.goto(this.parseInlineTableNext);
|
|
1603
|
-
}
|
|
1604
|
-
parseInlineTableNext() {
|
|
1605
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
1606
|
-
return null;
|
|
1607
|
-
} else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
|
1608
|
-
throw this.error(new TomlError("Unterminated inline array"));
|
|
1609
|
-
} else if (this.char === CHAR_COMMA) {
|
|
1610
|
-
return this.next(this.parseInlineTablePostComma);
|
|
1611
|
-
} else if (this.char === CHAR_RCUB) {
|
|
1612
|
-
return this.goto(this.parseInlineTable);
|
|
1613
|
-
} else {
|
|
1614
|
-
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
parseInlineTablePostComma() {
|
|
1618
|
-
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
1619
|
-
return null;
|
|
1620
|
-
} else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
|
1621
|
-
throw this.error(new TomlError("Unterminated inline array"));
|
|
1622
|
-
} else if (this.char === CHAR_COMMA) {
|
|
1623
|
-
throw this.error(new TomlError("Empty elements in inline tables are not permitted"));
|
|
1624
|
-
} else if (this.char === CHAR_RCUB) {
|
|
1625
|
-
throw this.error(new TomlError("Trailing commas in inline tables are not permitted"));
|
|
1626
|
-
} else {
|
|
1627
|
-
return this.goto(this.parseInlineTable);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
return TOMLParser;
|
|
1632
|
-
}
|
|
1633
|
-
__name(makeParserClass, "makeParserClass");
|
|
1634
|
-
}
|
|
1635
|
-
});
|
|
1636
|
-
|
|
1637
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-pretty-error.js
|
|
1638
|
-
var require_parse_pretty_error = __commonJS({
|
|
1639
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
|
|
1640
|
-
module2.exports = prettyError;
|
|
1641
|
-
function prettyError(err, buf) {
|
|
1642
|
-
if (err.pos == null || err.line == null) return err;
|
|
1643
|
-
let msg = err.message;
|
|
1644
|
-
msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
|
|
1645
|
-
`;
|
|
1646
|
-
if (buf && buf.split) {
|
|
1647
|
-
const lines = buf.split(/\n/);
|
|
1648
|
-
const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
|
|
1649
|
-
let linePadding = " ";
|
|
1650
|
-
while (linePadding.length < lineNumWidth) linePadding += " ";
|
|
1651
|
-
for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
|
|
1652
|
-
let lineNum = String(ii + 1);
|
|
1653
|
-
if (lineNum.length < lineNumWidth) lineNum = " " + lineNum;
|
|
1654
|
-
if (err.line === ii) {
|
|
1655
|
-
msg += lineNum + "> " + lines[ii] + "\n";
|
|
1656
|
-
msg += linePadding + " ";
|
|
1657
|
-
for (let hh = 0; hh < err.col; ++hh) {
|
|
1658
|
-
msg += " ";
|
|
1659
|
-
}
|
|
1660
|
-
msg += "^\n";
|
|
1661
|
-
} else {
|
|
1662
|
-
msg += lineNum + ": " + lines[ii] + "\n";
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
err.message = msg + "\n";
|
|
1667
|
-
return err;
|
|
1668
|
-
}
|
|
1669
|
-
__name(prettyError, "prettyError");
|
|
1670
|
-
}
|
|
1671
|
-
});
|
|
1672
|
-
|
|
1673
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-string.js
|
|
1674
|
-
var require_parse_string = __commonJS({
|
|
1675
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
|
|
1676
|
-
module2.exports = parseString;
|
|
1677
|
-
var TOMLParser = require_toml_parser();
|
|
1678
|
-
var prettyError = require_parse_pretty_error();
|
|
1679
|
-
function parseString(str) {
|
|
1680
|
-
if (global.Buffer && global.Buffer.isBuffer(str)) {
|
|
1681
|
-
str = str.toString("utf8");
|
|
1682
|
-
}
|
|
1683
|
-
const parser = new TOMLParser();
|
|
1684
|
-
try {
|
|
1685
|
-
parser.parse(str);
|
|
1686
|
-
return parser.finish();
|
|
1687
|
-
} catch (err) {
|
|
1688
|
-
throw prettyError(err, str);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
__name(parseString, "parseString");
|
|
1692
|
-
}
|
|
1693
|
-
});
|
|
1694
|
-
|
|
1695
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-async.js
|
|
1696
|
-
var require_parse_async = __commonJS({
|
|
1697
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
|
|
1698
|
-
module2.exports = parseAsync;
|
|
1699
|
-
var TOMLParser = require_toml_parser();
|
|
1700
|
-
var prettyError = require_parse_pretty_error();
|
|
1701
|
-
function parseAsync(str, opts) {
|
|
1702
|
-
if (!opts) opts = {};
|
|
1703
|
-
const index = 0;
|
|
1704
|
-
const blocksize = opts.blocksize || 40960;
|
|
1705
|
-
const parser = new TOMLParser();
|
|
1706
|
-
return new Promise((resolve2, reject) => {
|
|
1707
|
-
setImmediate(parseAsyncNext, index, blocksize, resolve2, reject);
|
|
1708
|
-
});
|
|
1709
|
-
function parseAsyncNext(index2, blocksize2, resolve2, reject) {
|
|
1710
|
-
if (index2 >= str.length) {
|
|
1711
|
-
try {
|
|
1712
|
-
return resolve2(parser.finish());
|
|
1713
|
-
} catch (err) {
|
|
1714
|
-
return reject(prettyError(err, str));
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
try {
|
|
1718
|
-
parser.parse(str.slice(index2, index2 + blocksize2));
|
|
1719
|
-
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve2, reject);
|
|
1720
|
-
} catch (err) {
|
|
1721
|
-
reject(prettyError(err, str));
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
__name(parseAsync, "parseAsync");
|
|
1726
|
-
}
|
|
1727
|
-
});
|
|
1728
|
-
|
|
1729
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-stream.js
|
|
1730
|
-
var require_parse_stream = __commonJS({
|
|
1731
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
|
|
1732
|
-
module2.exports = parseStream;
|
|
1733
|
-
var stream = __require("stream");
|
|
1734
|
-
var TOMLParser = require_toml_parser();
|
|
1735
|
-
function parseStream(stm) {
|
|
1736
|
-
if (stm) {
|
|
1737
|
-
return parseReadable(stm);
|
|
1738
|
-
} else {
|
|
1739
|
-
return parseTransform();
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
__name(parseStream, "parseStream");
|
|
1743
|
-
function parseReadable(stm) {
|
|
1744
|
-
const parser = new TOMLParser();
|
|
1745
|
-
stm.setEncoding("utf8");
|
|
1746
|
-
return new Promise((resolve2, reject) => {
|
|
1747
|
-
let readable;
|
|
1748
|
-
let ended = false;
|
|
1749
|
-
let errored = false;
|
|
1750
|
-
function finish() {
|
|
1751
|
-
ended = true;
|
|
1752
|
-
if (readable) return;
|
|
1753
|
-
try {
|
|
1754
|
-
resolve2(parser.finish());
|
|
1755
|
-
} catch (err) {
|
|
1756
|
-
reject(err);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
__name(finish, "finish");
|
|
1760
|
-
function error(err) {
|
|
1761
|
-
errored = true;
|
|
1762
|
-
reject(err);
|
|
1763
|
-
}
|
|
1764
|
-
__name(error, "error");
|
|
1765
|
-
stm.once("end", finish);
|
|
1766
|
-
stm.once("error", error);
|
|
1767
|
-
readNext();
|
|
1768
|
-
function readNext() {
|
|
1769
|
-
readable = true;
|
|
1770
|
-
let data;
|
|
1771
|
-
while ((data = stm.read()) !== null) {
|
|
1772
|
-
try {
|
|
1773
|
-
parser.parse(data);
|
|
1774
|
-
} catch (err) {
|
|
1775
|
-
return error(err);
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
readable = false;
|
|
1779
|
-
if (ended) return finish();
|
|
1780
|
-
if (errored) return;
|
|
1781
|
-
stm.once("readable", readNext);
|
|
1782
|
-
}
|
|
1783
|
-
__name(readNext, "readNext");
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
__name(parseReadable, "parseReadable");
|
|
1787
|
-
function parseTransform() {
|
|
1788
|
-
const parser = new TOMLParser();
|
|
1789
|
-
return new stream.Transform({
|
|
1790
|
-
objectMode: true,
|
|
1791
|
-
transform(chunk, encoding, cb) {
|
|
1792
|
-
try {
|
|
1793
|
-
parser.parse(chunk.toString(encoding));
|
|
1794
|
-
} catch (err) {
|
|
1795
|
-
this.emit("error", err);
|
|
1796
|
-
}
|
|
1797
|
-
cb();
|
|
1798
|
-
},
|
|
1799
|
-
flush(cb) {
|
|
1800
|
-
try {
|
|
1801
|
-
this.push(parser.finish());
|
|
1802
|
-
} catch (err) {
|
|
1803
|
-
this.emit("error", err);
|
|
1804
|
-
}
|
|
1805
|
-
cb();
|
|
1806
|
-
}
|
|
1807
|
-
});
|
|
1808
|
-
}
|
|
1809
|
-
__name(parseTransform, "parseTransform");
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
|
-
|
|
1813
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse.js
|
|
1814
|
-
var require_parse = __commonJS({
|
|
1815
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/parse.js"(exports2, module2) {
|
|
1816
|
-
module2.exports = require_parse_string();
|
|
1817
|
-
module2.exports.async = require_parse_async();
|
|
1818
|
-
module2.exports.stream = require_parse_stream();
|
|
1819
|
-
module2.exports.prettyError = require_parse_pretty_error();
|
|
1820
|
-
}
|
|
1821
|
-
});
|
|
1822
|
-
|
|
1823
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/stringify.js
|
|
1824
|
-
var require_stringify = __commonJS({
|
|
1825
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/stringify.js"(exports2, module2) {
|
|
1826
|
-
module2.exports = stringify;
|
|
1827
|
-
module2.exports.value = stringifyInline;
|
|
1828
|
-
function stringify(obj) {
|
|
1829
|
-
if (obj === null) throw typeError("null");
|
|
1830
|
-
if (obj === void 0) throw typeError("undefined");
|
|
1831
|
-
if (typeof obj !== "object") throw typeError(typeof obj);
|
|
1832
|
-
if (typeof obj.toJSON === "function") obj = obj.toJSON();
|
|
1833
|
-
if (obj == null) return null;
|
|
1834
|
-
const type = tomlType2(obj);
|
|
1835
|
-
if (type !== "table") throw typeError(type);
|
|
1836
|
-
return stringifyObject("", "", obj);
|
|
1837
|
-
}
|
|
1838
|
-
__name(stringify, "stringify");
|
|
1839
|
-
function typeError(type) {
|
|
1840
|
-
return new Error("Can only stringify objects, not " + type);
|
|
1841
|
-
}
|
|
1842
|
-
__name(typeError, "typeError");
|
|
1843
|
-
function getInlineKeys(obj) {
|
|
1844
|
-
return Object.keys(obj).filter((key) => isInline(obj[key]));
|
|
1845
|
-
}
|
|
1846
|
-
__name(getInlineKeys, "getInlineKeys");
|
|
1847
|
-
function getComplexKeys(obj) {
|
|
1848
|
-
return Object.keys(obj).filter((key) => !isInline(obj[key]));
|
|
1849
|
-
}
|
|
1850
|
-
__name(getComplexKeys, "getComplexKeys");
|
|
1851
|
-
function toJSON(obj) {
|
|
1852
|
-
let nobj = Array.isArray(obj) ? [] : Object.prototype.hasOwnProperty.call(obj, "__proto__") ? { ["__proto__"]: void 0 } : {};
|
|
1853
|
-
for (let prop of Object.keys(obj)) {
|
|
1854
|
-
if (obj[prop] && typeof obj[prop].toJSON === "function" && !("toISOString" in obj[prop])) {
|
|
1855
|
-
nobj[prop] = obj[prop].toJSON();
|
|
1856
|
-
} else {
|
|
1857
|
-
nobj[prop] = obj[prop];
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
return nobj;
|
|
1861
|
-
}
|
|
1862
|
-
__name(toJSON, "toJSON");
|
|
1863
|
-
function stringifyObject(prefix, indent, obj) {
|
|
1864
|
-
obj = toJSON(obj);
|
|
1865
|
-
let inlineKeys;
|
|
1866
|
-
let complexKeys;
|
|
1867
|
-
inlineKeys = getInlineKeys(obj);
|
|
1868
|
-
complexKeys = getComplexKeys(obj);
|
|
1869
|
-
const result = [];
|
|
1870
|
-
const inlineIndent = indent || "";
|
|
1871
|
-
inlineKeys.forEach((key) => {
|
|
1872
|
-
var type = tomlType2(obj[key]);
|
|
1873
|
-
if (type !== "undefined" && type !== "null") {
|
|
1874
|
-
result.push(inlineIndent + stringifyKey(key) + " = " + stringifyAnyInline(obj[key], true));
|
|
1875
|
-
}
|
|
1876
|
-
});
|
|
1877
|
-
if (result.length > 0) result.push("");
|
|
1878
|
-
const complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
|
|
1879
|
-
complexKeys.forEach((key) => {
|
|
1880
|
-
result.push(stringifyComplex(prefix, complexIndent, key, obj[key]));
|
|
1881
|
-
});
|
|
1882
|
-
return result.join("\n");
|
|
1883
|
-
}
|
|
1884
|
-
__name(stringifyObject, "stringifyObject");
|
|
1885
|
-
function isInline(value) {
|
|
1886
|
-
switch (tomlType2(value)) {
|
|
1887
|
-
case "undefined":
|
|
1888
|
-
case "null":
|
|
1889
|
-
case "integer":
|
|
1890
|
-
case "nan":
|
|
1891
|
-
case "float":
|
|
1892
|
-
case "boolean":
|
|
1893
|
-
case "string":
|
|
1894
|
-
case "datetime":
|
|
1895
|
-
return true;
|
|
1896
|
-
case "array":
|
|
1897
|
-
return value.length === 0 || tomlType2(value[0]) !== "table";
|
|
1898
|
-
case "table":
|
|
1899
|
-
return Object.keys(value).length === 0;
|
|
1900
|
-
/* istanbul ignore next */
|
|
1901
|
-
default:
|
|
1902
|
-
return false;
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
__name(isInline, "isInline");
|
|
1906
|
-
function tomlType2(value) {
|
|
1907
|
-
if (value === void 0) {
|
|
1908
|
-
return "undefined";
|
|
1909
|
-
} else if (value === null) {
|
|
1910
|
-
return "null";
|
|
1911
|
-
} else if (typeof value === "bigint" || Number.isInteger(value) && !Object.is(value, -0)) {
|
|
1912
|
-
return "integer";
|
|
1913
|
-
} else if (typeof value === "number") {
|
|
1914
|
-
return "float";
|
|
1915
|
-
} else if (typeof value === "boolean") {
|
|
1916
|
-
return "boolean";
|
|
1917
|
-
} else if (typeof value === "string") {
|
|
1918
|
-
return "string";
|
|
1919
|
-
} else if ("toISOString" in value) {
|
|
1920
|
-
return isNaN(value) ? "undefined" : "datetime";
|
|
1921
|
-
} else if (Array.isArray(value)) {
|
|
1922
|
-
return "array";
|
|
1923
|
-
} else {
|
|
1924
|
-
return "table";
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
__name(tomlType2, "tomlType");
|
|
1928
|
-
function stringifyKey(key) {
|
|
1929
|
-
const keyStr = String(key);
|
|
1930
|
-
if (/^[-A-Za-z0-9_]+$/.test(keyStr)) {
|
|
1931
|
-
return keyStr;
|
|
1932
|
-
} else {
|
|
1933
|
-
return stringifyBasicString(keyStr);
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
__name(stringifyKey, "stringifyKey");
|
|
1937
|
-
function stringifyBasicString(str) {
|
|
1938
|
-
return '"' + escapeString(str).replace(/"/g, '\\"') + '"';
|
|
1939
|
-
}
|
|
1940
|
-
__name(stringifyBasicString, "stringifyBasicString");
|
|
1941
|
-
function stringifyLiteralString(str) {
|
|
1942
|
-
return "'" + str + "'";
|
|
1943
|
-
}
|
|
1944
|
-
__name(stringifyLiteralString, "stringifyLiteralString");
|
|
1945
|
-
function numpad(num, str) {
|
|
1946
|
-
while (str.length < num) str = "0" + str;
|
|
1947
|
-
return str;
|
|
1948
|
-
}
|
|
1949
|
-
__name(numpad, "numpad");
|
|
1950
|
-
function escapeString(str) {
|
|
1951
|
-
return str.replace(/\\/g, "\\\\").replace(/[\b]/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/([\u0000-\u001f\u007f])/, (c) => "\\u" + numpad(4, c.codePointAt(0).toString(16)));
|
|
1952
|
-
}
|
|
1953
|
-
__name(escapeString, "escapeString");
|
|
1954
|
-
function stringifyMultilineString(str) {
|
|
1955
|
-
let escaped = str.split(/\n/).map((str2) => {
|
|
1956
|
-
return escapeString(str2).replace(/"(?="")/g, '\\"');
|
|
1957
|
-
}).join("\n");
|
|
1958
|
-
if (escaped.slice(-1) === '"') escaped += "\\\n";
|
|
1959
|
-
return '"""\n' + escaped + '"""';
|
|
1960
|
-
}
|
|
1961
|
-
__name(stringifyMultilineString, "stringifyMultilineString");
|
|
1962
|
-
function stringifyAnyInline(value, multilineOk) {
|
|
1963
|
-
let type = tomlType2(value);
|
|
1964
|
-
if (type === "string") {
|
|
1965
|
-
if (multilineOk && /\n/.test(value)) {
|
|
1966
|
-
type = "string-multiline";
|
|
1967
|
-
} else if (!/[\b\t\n\f\r']/.test(value) && /"/.test(value)) {
|
|
1968
|
-
type = "string-literal";
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
return stringifyInline(value, type);
|
|
1972
|
-
}
|
|
1973
|
-
__name(stringifyAnyInline, "stringifyAnyInline");
|
|
1974
|
-
function stringifyInline(value, type) {
|
|
1975
|
-
if (!type) type = tomlType2(value);
|
|
1976
|
-
switch (type) {
|
|
1977
|
-
case "string-multiline":
|
|
1978
|
-
return stringifyMultilineString(value);
|
|
1979
|
-
case "string":
|
|
1980
|
-
return stringifyBasicString(value);
|
|
1981
|
-
case "string-literal":
|
|
1982
|
-
return stringifyLiteralString(value);
|
|
1983
|
-
case "integer":
|
|
1984
|
-
return stringifyInteger(value);
|
|
1985
|
-
case "float":
|
|
1986
|
-
return stringifyFloat(value);
|
|
1987
|
-
case "boolean":
|
|
1988
|
-
return stringifyBoolean(value);
|
|
1989
|
-
case "datetime":
|
|
1990
|
-
return stringifyDatetime(value);
|
|
1991
|
-
case "array":
|
|
1992
|
-
return stringifyInlineArray(value.filter((_) => tomlType2(_) !== "null" && tomlType2(_) !== "undefined" && tomlType2(_) !== "nan"));
|
|
1993
|
-
case "table":
|
|
1994
|
-
return stringifyInlineTable(value);
|
|
1995
|
-
/* istanbul ignore next */
|
|
1996
|
-
default:
|
|
1997
|
-
throw typeError(type);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
__name(stringifyInline, "stringifyInline");
|
|
2001
|
-
function stringifyInteger(value) {
|
|
2002
|
-
return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
|
2003
|
-
}
|
|
2004
|
-
__name(stringifyInteger, "stringifyInteger");
|
|
2005
|
-
function stringifyFloat(value) {
|
|
2006
|
-
if (value === Infinity) {
|
|
2007
|
-
return "inf";
|
|
2008
|
-
} else if (value === -Infinity) {
|
|
2009
|
-
return "-inf";
|
|
2010
|
-
} else if (Object.is(value, NaN)) {
|
|
2011
|
-
return "nan";
|
|
2012
|
-
} else if (Object.is(value, -0)) {
|
|
2013
|
-
return "-0.0";
|
|
2014
|
-
}
|
|
2015
|
-
const [int, dec] = String(value).split(".");
|
|
2016
|
-
return stringifyInteger(int) + "." + dec;
|
|
2017
|
-
}
|
|
2018
|
-
__name(stringifyFloat, "stringifyFloat");
|
|
2019
|
-
function stringifyBoolean(value) {
|
|
2020
|
-
return String(value);
|
|
2021
|
-
}
|
|
2022
|
-
__name(stringifyBoolean, "stringifyBoolean");
|
|
2023
|
-
function stringifyDatetime(value) {
|
|
2024
|
-
return value.toISOString();
|
|
2025
|
-
}
|
|
2026
|
-
__name(stringifyDatetime, "stringifyDatetime");
|
|
2027
|
-
function stringifyInlineArray(values) {
|
|
2028
|
-
values = toJSON(values);
|
|
2029
|
-
let result = "[";
|
|
2030
|
-
const stringified = values.map((_) => stringifyInline(_));
|
|
2031
|
-
if (stringified.join(", ").length > 60 || /\n/.test(stringified)) {
|
|
2032
|
-
result += "\n " + stringified.join(",\n ") + "\n";
|
|
2033
|
-
} else {
|
|
2034
|
-
result += " " + stringified.join(", ") + (stringified.length > 0 ? " " : "");
|
|
2035
|
-
}
|
|
2036
|
-
return result + "]";
|
|
2037
|
-
}
|
|
2038
|
-
__name(stringifyInlineArray, "stringifyInlineArray");
|
|
2039
|
-
function stringifyInlineTable(value) {
|
|
2040
|
-
value = toJSON(value);
|
|
2041
|
-
const result = [];
|
|
2042
|
-
Object.keys(value).forEach((key) => {
|
|
2043
|
-
result.push(stringifyKey(key) + " = " + stringifyAnyInline(value[key], false));
|
|
2044
|
-
});
|
|
2045
|
-
return "{ " + result.join(", ") + (result.length > 0 ? " " : "") + "}";
|
|
2046
|
-
}
|
|
2047
|
-
__name(stringifyInlineTable, "stringifyInlineTable");
|
|
2048
|
-
function stringifyComplex(prefix, indent, key, value) {
|
|
2049
|
-
const valueType = tomlType2(value);
|
|
2050
|
-
if (valueType === "array") {
|
|
2051
|
-
return stringifyArrayOfTables(prefix, indent, key, value);
|
|
2052
|
-
} else if (valueType === "table") {
|
|
2053
|
-
return stringifyComplexTable(prefix, indent, key, value);
|
|
2054
|
-
} else {
|
|
2055
|
-
throw typeError(valueType);
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
__name(stringifyComplex, "stringifyComplex");
|
|
2059
|
-
function stringifyArrayOfTables(prefix, indent, key, values) {
|
|
2060
|
-
values = toJSON(values);
|
|
2061
|
-
const firstValueType = tomlType2(values[0]);
|
|
2062
|
-
if (firstValueType !== "table") throw typeError(firstValueType);
|
|
2063
|
-
const fullKey = prefix + stringifyKey(key);
|
|
2064
|
-
let result = "";
|
|
2065
|
-
values.forEach((table) => {
|
|
2066
|
-
if (result.length > 0) result += "\n";
|
|
2067
|
-
result += indent + "[[" + fullKey + "]]\n";
|
|
2068
|
-
result += stringifyObject(fullKey + ".", indent, table);
|
|
2069
|
-
});
|
|
2070
|
-
return result;
|
|
2071
|
-
}
|
|
2072
|
-
__name(stringifyArrayOfTables, "stringifyArrayOfTables");
|
|
2073
|
-
function stringifyComplexTable(prefix, indent, key, value) {
|
|
2074
|
-
const fullKey = prefix + stringifyKey(key);
|
|
2075
|
-
let result = "";
|
|
2076
|
-
if (getInlineKeys(value).length > 0) {
|
|
2077
|
-
result += indent + "[" + fullKey + "]\n";
|
|
2078
|
-
}
|
|
2079
|
-
return result + stringifyObject(fullKey + ".", indent, value);
|
|
2080
|
-
}
|
|
2081
|
-
__name(stringifyComplexTable, "stringifyComplexTable");
|
|
2082
|
-
}
|
|
2083
|
-
});
|
|
2084
|
-
|
|
2085
|
-
// ../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/toml.js
|
|
2086
|
-
var require_toml = __commonJS({
|
|
2087
|
-
"../../node_modules/.pnpm/@iarna+toml@3.0.0/node_modules/@iarna/toml/toml.js"(exports2) {
|
|
2088
|
-
exports2.parse = require_parse();
|
|
2089
|
-
exports2.stringify = require_stringify();
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2092
|
-
|
|
2093
11
|
// src/config/config.ts
|
|
2094
12
|
var defaultWranglerConfig = {
|
|
2095
13
|
/* COMPUTED_FIELDS */
|
|
@@ -2199,15 +117,887 @@ var defaultWranglerConfig = {
|
|
|
2199
117
|
unsafe: {},
|
|
2200
118
|
mtls_certificates: [],
|
|
2201
119
|
tail_consumers: void 0,
|
|
120
|
+
streaming_tail_consumers: void 0,
|
|
2202
121
|
pipelines: [],
|
|
2203
122
|
vpc_services: []
|
|
2204
123
|
};
|
|
2205
124
|
|
|
2206
|
-
//
|
|
2207
|
-
|
|
125
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/error.js
|
|
126
|
+
function getLineColFromPtr(string, ptr) {
|
|
127
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
128
|
+
return [lines.length, lines.pop().length + 1];
|
|
129
|
+
}
|
|
130
|
+
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
131
|
+
function makeCodeBlock(string, line, column) {
|
|
132
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
133
|
+
let codeblock = "";
|
|
134
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
135
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
136
|
+
let l = lines[i - 1];
|
|
137
|
+
if (!l)
|
|
138
|
+
continue;
|
|
139
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
140
|
+
codeblock += ": ";
|
|
141
|
+
codeblock += l;
|
|
142
|
+
codeblock += "\n";
|
|
143
|
+
if (i === line) {
|
|
144
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
145
|
+
codeblock += "^\n";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return codeblock;
|
|
149
|
+
}
|
|
150
|
+
__name(makeCodeBlock, "makeCodeBlock");
|
|
151
|
+
var TomlError = class extends Error {
|
|
152
|
+
static {
|
|
153
|
+
__name(this, "TomlError");
|
|
154
|
+
}
|
|
155
|
+
line;
|
|
156
|
+
column;
|
|
157
|
+
codeblock;
|
|
158
|
+
constructor(message, options) {
|
|
159
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
160
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
161
|
+
super(`Invalid TOML document: ${message}
|
|
2208
162
|
|
|
2209
|
-
|
|
2210
|
-
|
|
163
|
+
${codeblock}`, options);
|
|
164
|
+
this.line = line;
|
|
165
|
+
this.column = column;
|
|
166
|
+
this.codeblock = codeblock;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
171
|
+
function isEscaped(str, ptr) {
|
|
172
|
+
let i = 0;
|
|
173
|
+
while (str[ptr - ++i] === "\\")
|
|
174
|
+
;
|
|
175
|
+
return --i && i % 2;
|
|
176
|
+
}
|
|
177
|
+
__name(isEscaped, "isEscaped");
|
|
178
|
+
function indexOfNewline(str, start = 0, end = str.length) {
|
|
179
|
+
let idx = str.indexOf("\n", start);
|
|
180
|
+
if (str[idx - 1] === "\r")
|
|
181
|
+
idx--;
|
|
182
|
+
return idx <= end ? idx : -1;
|
|
183
|
+
}
|
|
184
|
+
__name(indexOfNewline, "indexOfNewline");
|
|
185
|
+
function skipComment(str, ptr) {
|
|
186
|
+
for (let i = ptr; i < str.length; i++) {
|
|
187
|
+
let c = str[i];
|
|
188
|
+
if (c === "\n")
|
|
189
|
+
return i;
|
|
190
|
+
if (c === "\r" && str[i + 1] === "\n")
|
|
191
|
+
return i + 1;
|
|
192
|
+
if (c < " " && c !== " " || c === "\x7F") {
|
|
193
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
194
|
+
toml: str,
|
|
195
|
+
ptr
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return str.length;
|
|
200
|
+
}
|
|
201
|
+
__name(skipComment, "skipComment");
|
|
202
|
+
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
203
|
+
let c;
|
|
204
|
+
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
205
|
+
ptr++;
|
|
206
|
+
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
207
|
+
}
|
|
208
|
+
__name(skipVoid, "skipVoid");
|
|
209
|
+
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
210
|
+
if (!end) {
|
|
211
|
+
ptr = indexOfNewline(str, ptr);
|
|
212
|
+
return ptr < 0 ? str.length : ptr;
|
|
213
|
+
}
|
|
214
|
+
for (let i = ptr; i < str.length; i++) {
|
|
215
|
+
let c = str[i];
|
|
216
|
+
if (c === "#") {
|
|
217
|
+
i = indexOfNewline(str, i);
|
|
218
|
+
} else if (c === sep) {
|
|
219
|
+
return i + 1;
|
|
220
|
+
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
221
|
+
return i;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
throw new TomlError("cannot find end of structure", {
|
|
225
|
+
toml: str,
|
|
226
|
+
ptr
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
__name(skipUntil, "skipUntil");
|
|
230
|
+
function getStringEnd(str, seek) {
|
|
231
|
+
let first = str[seek];
|
|
232
|
+
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
233
|
+
seek += target.length - 1;
|
|
234
|
+
do
|
|
235
|
+
seek = str.indexOf(target, ++seek);
|
|
236
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
237
|
+
if (seek > -1) {
|
|
238
|
+
seek += target.length;
|
|
239
|
+
if (target.length > 1) {
|
|
240
|
+
if (str[seek] === first)
|
|
241
|
+
seek++;
|
|
242
|
+
if (str[seek] === first)
|
|
243
|
+
seek++;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return seek;
|
|
247
|
+
}
|
|
248
|
+
__name(getStringEnd, "getStringEnd");
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
251
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
252
|
+
var TomlDate = class _TomlDate extends Date {
|
|
253
|
+
static {
|
|
254
|
+
__name(this, "TomlDate");
|
|
255
|
+
}
|
|
256
|
+
#hasDate = false;
|
|
257
|
+
#hasTime = false;
|
|
258
|
+
#offset = null;
|
|
259
|
+
constructor(date) {
|
|
260
|
+
let hasDate = true;
|
|
261
|
+
let hasTime = true;
|
|
262
|
+
let offset = "Z";
|
|
263
|
+
if (typeof date === "string") {
|
|
264
|
+
let match = date.match(DATE_TIME_RE);
|
|
265
|
+
if (match) {
|
|
266
|
+
if (!match[1]) {
|
|
267
|
+
hasDate = false;
|
|
268
|
+
date = `0000-01-01T${date}`;
|
|
269
|
+
}
|
|
270
|
+
hasTime = !!match[2];
|
|
271
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
272
|
+
if (match[2] && +match[2] > 23) {
|
|
273
|
+
date = "";
|
|
274
|
+
} else {
|
|
275
|
+
offset = match[3] || null;
|
|
276
|
+
date = date.toUpperCase();
|
|
277
|
+
if (!offset && hasTime)
|
|
278
|
+
date += "Z";
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
date = "";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
super(date);
|
|
285
|
+
if (!isNaN(this.getTime())) {
|
|
286
|
+
this.#hasDate = hasDate;
|
|
287
|
+
this.#hasTime = hasTime;
|
|
288
|
+
this.#offset = offset;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
isDateTime() {
|
|
292
|
+
return this.#hasDate && this.#hasTime;
|
|
293
|
+
}
|
|
294
|
+
isLocal() {
|
|
295
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
296
|
+
}
|
|
297
|
+
isDate() {
|
|
298
|
+
return this.#hasDate && !this.#hasTime;
|
|
299
|
+
}
|
|
300
|
+
isTime() {
|
|
301
|
+
return this.#hasTime && !this.#hasDate;
|
|
302
|
+
}
|
|
303
|
+
isValid() {
|
|
304
|
+
return this.#hasDate || this.#hasTime;
|
|
305
|
+
}
|
|
306
|
+
toISOString() {
|
|
307
|
+
let iso = super.toISOString();
|
|
308
|
+
if (this.isDate())
|
|
309
|
+
return iso.slice(0, 10);
|
|
310
|
+
if (this.isTime())
|
|
311
|
+
return iso.slice(11, 23);
|
|
312
|
+
if (this.#offset === null)
|
|
313
|
+
return iso.slice(0, -1);
|
|
314
|
+
if (this.#offset === "Z")
|
|
315
|
+
return iso;
|
|
316
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
317
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
318
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
319
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
320
|
+
}
|
|
321
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
322
|
+
let date = new _TomlDate(jsDate);
|
|
323
|
+
date.#offset = offset;
|
|
324
|
+
return date;
|
|
325
|
+
}
|
|
326
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
327
|
+
let date = new _TomlDate(jsDate);
|
|
328
|
+
date.#offset = null;
|
|
329
|
+
return date;
|
|
330
|
+
}
|
|
331
|
+
static wrapAsLocalDate(jsDate) {
|
|
332
|
+
let date = new _TomlDate(jsDate);
|
|
333
|
+
date.#hasTime = false;
|
|
334
|
+
date.#offset = null;
|
|
335
|
+
return date;
|
|
336
|
+
}
|
|
337
|
+
static wrapAsLocalTime(jsDate) {
|
|
338
|
+
let date = new _TomlDate(jsDate);
|
|
339
|
+
date.#hasDate = false;
|
|
340
|
+
date.#offset = null;
|
|
341
|
+
return date;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/primitive.js
|
|
346
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
347
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
348
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
349
|
+
var ESCAPE_REGEX = /^[0-9a-f]{4,8}$/i;
|
|
350
|
+
var ESC_MAP = {
|
|
351
|
+
b: "\b",
|
|
352
|
+
t: " ",
|
|
353
|
+
n: "\n",
|
|
354
|
+
f: "\f",
|
|
355
|
+
r: "\r",
|
|
356
|
+
'"': '"',
|
|
357
|
+
"\\": "\\"
|
|
358
|
+
};
|
|
359
|
+
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
360
|
+
let isLiteral = str[ptr] === "'";
|
|
361
|
+
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
362
|
+
if (isMultiline) {
|
|
363
|
+
endPtr -= 2;
|
|
364
|
+
if (str[ptr += 2] === "\r")
|
|
365
|
+
ptr++;
|
|
366
|
+
if (str[ptr] === "\n")
|
|
367
|
+
ptr++;
|
|
368
|
+
}
|
|
369
|
+
let tmp = 0;
|
|
370
|
+
let isEscape;
|
|
371
|
+
let parsed = "";
|
|
372
|
+
let sliceStart = ptr;
|
|
373
|
+
while (ptr < endPtr - 1) {
|
|
374
|
+
let c = str[ptr++];
|
|
375
|
+
if (c === "\n" || c === "\r" && str[ptr] === "\n") {
|
|
376
|
+
if (!isMultiline) {
|
|
377
|
+
throw new TomlError("newlines are not allowed in strings", {
|
|
378
|
+
toml: str,
|
|
379
|
+
ptr: ptr - 1
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
383
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
384
|
+
toml: str,
|
|
385
|
+
ptr: ptr - 1
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (isEscape) {
|
|
389
|
+
isEscape = false;
|
|
390
|
+
if (c === "u" || c === "U") {
|
|
391
|
+
let code = str.slice(ptr, ptr += c === "u" ? 4 : 8);
|
|
392
|
+
if (!ESCAPE_REGEX.test(code)) {
|
|
393
|
+
throw new TomlError("invalid unicode escape", {
|
|
394
|
+
toml: str,
|
|
395
|
+
ptr: tmp
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
399
|
+
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
400
|
+
} catch {
|
|
401
|
+
throw new TomlError("invalid unicode escape", {
|
|
402
|
+
toml: str,
|
|
403
|
+
ptr: tmp
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
} else if (isMultiline && (c === "\n" || c === " " || c === " " || c === "\r")) {
|
|
407
|
+
ptr = skipVoid(str, ptr - 1, true);
|
|
408
|
+
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
409
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
410
|
+
toml: str,
|
|
411
|
+
ptr: tmp
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
ptr = skipVoid(str, ptr);
|
|
415
|
+
} else if (c in ESC_MAP) {
|
|
416
|
+
parsed += ESC_MAP[c];
|
|
417
|
+
} else {
|
|
418
|
+
throw new TomlError("unrecognized escape sequence", {
|
|
419
|
+
toml: str,
|
|
420
|
+
ptr: tmp
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
sliceStart = ptr;
|
|
424
|
+
} else if (!isLiteral && c === "\\") {
|
|
425
|
+
tmp = ptr - 1;
|
|
426
|
+
isEscape = true;
|
|
427
|
+
parsed += str.slice(sliceStart, tmp);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
431
|
+
}
|
|
432
|
+
__name(parseString, "parseString");
|
|
433
|
+
function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
434
|
+
if (value === "true")
|
|
435
|
+
return true;
|
|
436
|
+
if (value === "false")
|
|
437
|
+
return false;
|
|
438
|
+
if (value === "-inf")
|
|
439
|
+
return -Infinity;
|
|
440
|
+
if (value === "inf" || value === "+inf")
|
|
441
|
+
return Infinity;
|
|
442
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
443
|
+
return NaN;
|
|
444
|
+
if (value === "-0")
|
|
445
|
+
return integersAsBigInt ? 0n : 0;
|
|
446
|
+
let isInt = INT_REGEX.test(value);
|
|
447
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
448
|
+
if (LEADING_ZERO.test(value)) {
|
|
449
|
+
throw new TomlError("leading zeroes are not allowed", {
|
|
450
|
+
toml,
|
|
451
|
+
ptr
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
value = value.replace(/_/g, "");
|
|
455
|
+
let numeric = +value;
|
|
456
|
+
if (isNaN(numeric)) {
|
|
457
|
+
throw new TomlError("invalid number", {
|
|
458
|
+
toml,
|
|
459
|
+
ptr
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
if (isInt) {
|
|
463
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
464
|
+
throw new TomlError("integer value cannot be represented losslessly", {
|
|
465
|
+
toml,
|
|
466
|
+
ptr
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
if (isInt || integersAsBigInt === true)
|
|
470
|
+
numeric = BigInt(value);
|
|
471
|
+
}
|
|
472
|
+
return numeric;
|
|
473
|
+
}
|
|
474
|
+
const date = new TomlDate(value);
|
|
475
|
+
if (!date.isValid()) {
|
|
476
|
+
throw new TomlError("invalid value", {
|
|
477
|
+
toml,
|
|
478
|
+
ptr
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
return date;
|
|
482
|
+
}
|
|
483
|
+
__name(parseValue, "parseValue");
|
|
484
|
+
|
|
485
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/extract.js
|
|
486
|
+
function sliceAndTrimEndOf(str, startPtr, endPtr, allowNewLines) {
|
|
487
|
+
let value = str.slice(startPtr, endPtr);
|
|
488
|
+
let commentIdx = value.indexOf("#");
|
|
489
|
+
if (commentIdx > -1) {
|
|
490
|
+
skipComment(str, commentIdx);
|
|
491
|
+
value = value.slice(0, commentIdx);
|
|
492
|
+
}
|
|
493
|
+
let trimmed = value.trimEnd();
|
|
494
|
+
if (!allowNewLines) {
|
|
495
|
+
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
496
|
+
if (newlineIdx > -1) {
|
|
497
|
+
throw new TomlError("newlines are not allowed in inline tables", {
|
|
498
|
+
toml: str,
|
|
499
|
+
ptr: startPtr + newlineIdx
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return [trimmed, commentIdx];
|
|
504
|
+
}
|
|
505
|
+
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
506
|
+
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
507
|
+
if (depth === 0) {
|
|
508
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
509
|
+
toml: str,
|
|
510
|
+
ptr
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
let c = str[ptr];
|
|
514
|
+
if (c === "[" || c === "{") {
|
|
515
|
+
let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
516
|
+
let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
|
|
517
|
+
if (endPtr2 - newPtr && end === "}") {
|
|
518
|
+
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
519
|
+
if (nextNewLine > -1) {
|
|
520
|
+
throw new TomlError("newlines are not allowed in inline tables", {
|
|
521
|
+
toml: str,
|
|
522
|
+
ptr: nextNewLine
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return [value, newPtr];
|
|
527
|
+
}
|
|
528
|
+
let endPtr;
|
|
529
|
+
if (c === '"' || c === "'") {
|
|
530
|
+
endPtr = getStringEnd(str, ptr);
|
|
531
|
+
let parsed = parseString(str, ptr, endPtr);
|
|
532
|
+
if (end) {
|
|
533
|
+
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
534
|
+
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
535
|
+
throw new TomlError("unexpected character encountered", {
|
|
536
|
+
toml: str,
|
|
537
|
+
ptr: endPtr
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
endPtr += +(str[endPtr] === ",");
|
|
541
|
+
}
|
|
542
|
+
return [parsed, endPtr];
|
|
543
|
+
}
|
|
544
|
+
endPtr = skipUntil(str, ptr, ",", end);
|
|
545
|
+
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
546
|
+
if (!slice[0]) {
|
|
547
|
+
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
548
|
+
toml: str,
|
|
549
|
+
ptr
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
if (end && slice[1] > -1) {
|
|
553
|
+
endPtr = skipVoid(str, ptr + slice[1]);
|
|
554
|
+
endPtr += +(str[endPtr] === ",");
|
|
555
|
+
}
|
|
556
|
+
return [
|
|
557
|
+
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
558
|
+
endPtr
|
|
559
|
+
];
|
|
560
|
+
}
|
|
561
|
+
__name(extractValue, "extractValue");
|
|
562
|
+
|
|
563
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/struct.js
|
|
564
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
565
|
+
function parseKey(str, ptr, end = "=") {
|
|
566
|
+
let dot = ptr - 1;
|
|
567
|
+
let parsed = [];
|
|
568
|
+
let endPtr = str.indexOf(end, ptr);
|
|
569
|
+
if (endPtr < 0) {
|
|
570
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
571
|
+
toml: str,
|
|
572
|
+
ptr
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
do {
|
|
576
|
+
let c = str[ptr = ++dot];
|
|
577
|
+
if (c !== " " && c !== " ") {
|
|
578
|
+
if (c === '"' || c === "'") {
|
|
579
|
+
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
580
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
581
|
+
toml: str,
|
|
582
|
+
ptr
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
let eos = getStringEnd(str, ptr);
|
|
586
|
+
if (eos < 0) {
|
|
587
|
+
throw new TomlError("unfinished string encountered", {
|
|
588
|
+
toml: str,
|
|
589
|
+
ptr
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
dot = str.indexOf(".", eos);
|
|
593
|
+
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
594
|
+
let newLine = indexOfNewline(strEnd);
|
|
595
|
+
if (newLine > -1) {
|
|
596
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
597
|
+
toml: str,
|
|
598
|
+
ptr: ptr + dot + newLine
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
if (strEnd.trimStart()) {
|
|
602
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
603
|
+
toml: str,
|
|
604
|
+
ptr: eos
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
if (endPtr < eos) {
|
|
608
|
+
endPtr = str.indexOf(end, eos);
|
|
609
|
+
if (endPtr < 0) {
|
|
610
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
611
|
+
toml: str,
|
|
612
|
+
ptr
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
parsed.push(parseString(str, ptr, eos));
|
|
617
|
+
} else {
|
|
618
|
+
dot = str.indexOf(".", ptr);
|
|
619
|
+
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
620
|
+
if (!KEY_PART_RE.test(part)) {
|
|
621
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
622
|
+
toml: str,
|
|
623
|
+
ptr
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
parsed.push(part.trimEnd());
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
} while (dot + 1 && dot < endPtr);
|
|
630
|
+
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
631
|
+
}
|
|
632
|
+
__name(parseKey, "parseKey");
|
|
633
|
+
function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
634
|
+
let res = {};
|
|
635
|
+
let seen = /* @__PURE__ */ new Set();
|
|
636
|
+
let c;
|
|
637
|
+
let comma = 0;
|
|
638
|
+
ptr++;
|
|
639
|
+
while ((c = str[ptr++]) !== "}" && c) {
|
|
640
|
+
let err = { toml: str, ptr: ptr - 1 };
|
|
641
|
+
if (c === "\n") {
|
|
642
|
+
throw new TomlError("newlines are not allowed in inline tables", err);
|
|
643
|
+
} else if (c === "#") {
|
|
644
|
+
throw new TomlError("inline tables cannot contain comments", err);
|
|
645
|
+
} else if (c === ",") {
|
|
646
|
+
throw new TomlError("expected key-value, found comma", err);
|
|
647
|
+
} else if (c !== " " && c !== " ") {
|
|
648
|
+
let k;
|
|
649
|
+
let t = res;
|
|
650
|
+
let hasOwn = false;
|
|
651
|
+
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
652
|
+
for (let i = 0; i < key.length; i++) {
|
|
653
|
+
if (i)
|
|
654
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
655
|
+
k = key[i];
|
|
656
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
657
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
658
|
+
toml: str,
|
|
659
|
+
ptr
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
if (!hasOwn && k === "__proto__") {
|
|
663
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (hasOwn) {
|
|
667
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
668
|
+
toml: str,
|
|
669
|
+
ptr
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
673
|
+
seen.add(value);
|
|
674
|
+
t[k] = value;
|
|
675
|
+
ptr = valueEndPtr;
|
|
676
|
+
comma = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (comma) {
|
|
680
|
+
throw new TomlError("trailing commas are not allowed in inline tables", {
|
|
681
|
+
toml: str,
|
|
682
|
+
ptr: comma
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
if (!c) {
|
|
686
|
+
throw new TomlError("unfinished table encountered", {
|
|
687
|
+
toml: str,
|
|
688
|
+
ptr
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
return [res, ptr];
|
|
692
|
+
}
|
|
693
|
+
__name(parseInlineTable, "parseInlineTable");
|
|
694
|
+
function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
695
|
+
let res = [];
|
|
696
|
+
let c;
|
|
697
|
+
ptr++;
|
|
698
|
+
while ((c = str[ptr++]) !== "]" && c) {
|
|
699
|
+
if (c === ",") {
|
|
700
|
+
throw new TomlError("expected value, found comma", {
|
|
701
|
+
toml: str,
|
|
702
|
+
ptr: ptr - 1
|
|
703
|
+
});
|
|
704
|
+
} else if (c === "#")
|
|
705
|
+
ptr = skipComment(str, ptr);
|
|
706
|
+
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
707
|
+
let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
708
|
+
res.push(e[0]);
|
|
709
|
+
ptr = e[1];
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (!c) {
|
|
713
|
+
throw new TomlError("unfinished array encountered", {
|
|
714
|
+
toml: str,
|
|
715
|
+
ptr
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
return [res, ptr];
|
|
719
|
+
}
|
|
720
|
+
__name(parseArray, "parseArray");
|
|
721
|
+
|
|
722
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/parse.js
|
|
723
|
+
function peekTable(key, table, meta, type) {
|
|
724
|
+
let t = table;
|
|
725
|
+
let m = meta;
|
|
726
|
+
let k;
|
|
727
|
+
let hasOwn = false;
|
|
728
|
+
let state;
|
|
729
|
+
for (let i = 0; i < key.length; i++) {
|
|
730
|
+
if (i) {
|
|
731
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
732
|
+
m = (state = m[k]).c;
|
|
733
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
if (state.t === 2) {
|
|
737
|
+
let l = t.length - 1;
|
|
738
|
+
t = t[l];
|
|
739
|
+
m = m[l].c;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
k = key[i];
|
|
743
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
if (!hasOwn) {
|
|
747
|
+
if (k === "__proto__") {
|
|
748
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
749
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
750
|
+
}
|
|
751
|
+
m[k] = {
|
|
752
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
753
|
+
d: false,
|
|
754
|
+
i: 0,
|
|
755
|
+
c: {}
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
state = m[k];
|
|
760
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
if (type === 2) {
|
|
764
|
+
if (!state.d) {
|
|
765
|
+
state.d = true;
|
|
766
|
+
t[k] = [];
|
|
767
|
+
}
|
|
768
|
+
t[k].push(t = {});
|
|
769
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
770
|
+
}
|
|
771
|
+
if (state.d) {
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
state.d = true;
|
|
775
|
+
if (type === 1) {
|
|
776
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
777
|
+
} else if (type === 0 && hasOwn) {
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
return [k, t, state.c];
|
|
781
|
+
}
|
|
782
|
+
__name(peekTable, "peekTable");
|
|
783
|
+
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
784
|
+
let res = {};
|
|
785
|
+
let meta = {};
|
|
786
|
+
let tbl = res;
|
|
787
|
+
let m = meta;
|
|
788
|
+
for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
|
|
789
|
+
if (toml[ptr] === "[") {
|
|
790
|
+
let isTableArray = toml[++ptr] === "[";
|
|
791
|
+
let k = parseKey(toml, ptr += +isTableArray, "]");
|
|
792
|
+
if (isTableArray) {
|
|
793
|
+
if (toml[k[1] - 1] !== "]") {
|
|
794
|
+
throw new TomlError("expected end of table declaration", {
|
|
795
|
+
toml,
|
|
796
|
+
ptr: k[1] - 1
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
k[1]++;
|
|
800
|
+
}
|
|
801
|
+
let p = peekTable(
|
|
802
|
+
k[0],
|
|
803
|
+
res,
|
|
804
|
+
meta,
|
|
805
|
+
isTableArray ? 2 : 1
|
|
806
|
+
/* Type.EXPLICIT */
|
|
807
|
+
);
|
|
808
|
+
if (!p) {
|
|
809
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
810
|
+
toml,
|
|
811
|
+
ptr
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
m = p[2];
|
|
815
|
+
tbl = p[1];
|
|
816
|
+
ptr = k[1];
|
|
817
|
+
} else {
|
|
818
|
+
let k = parseKey(toml, ptr);
|
|
819
|
+
let p = peekTable(
|
|
820
|
+
k[0],
|
|
821
|
+
tbl,
|
|
822
|
+
m,
|
|
823
|
+
0
|
|
824
|
+
/* Type.DOTTED */
|
|
825
|
+
);
|
|
826
|
+
if (!p) {
|
|
827
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
828
|
+
toml,
|
|
829
|
+
ptr
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
|
|
833
|
+
p[1][p[0]] = v[0];
|
|
834
|
+
ptr = v[1];
|
|
835
|
+
}
|
|
836
|
+
ptr = skipVoid(toml, ptr, true);
|
|
837
|
+
if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
|
|
838
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
839
|
+
toml,
|
|
840
|
+
ptr
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
ptr = skipVoid(toml, ptr);
|
|
844
|
+
}
|
|
845
|
+
return res;
|
|
846
|
+
}
|
|
847
|
+
__name(parse, "parse");
|
|
848
|
+
|
|
849
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/stringify.js
|
|
850
|
+
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
851
|
+
function extendedTypeOf(obj) {
|
|
852
|
+
let type = typeof obj;
|
|
853
|
+
if (type === "object") {
|
|
854
|
+
if (Array.isArray(obj))
|
|
855
|
+
return "array";
|
|
856
|
+
if (obj instanceof Date)
|
|
857
|
+
return "date";
|
|
858
|
+
}
|
|
859
|
+
return type;
|
|
860
|
+
}
|
|
861
|
+
__name(extendedTypeOf, "extendedTypeOf");
|
|
862
|
+
function isArrayOfTables(obj) {
|
|
863
|
+
for (let i = 0; i < obj.length; i++) {
|
|
864
|
+
if (extendedTypeOf(obj[i]) !== "object")
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
return obj.length != 0;
|
|
868
|
+
}
|
|
869
|
+
__name(isArrayOfTables, "isArrayOfTables");
|
|
870
|
+
function formatString(s) {
|
|
871
|
+
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
872
|
+
}
|
|
873
|
+
__name(formatString, "formatString");
|
|
874
|
+
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
875
|
+
if (depth === 0) {
|
|
876
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
877
|
+
}
|
|
878
|
+
if (type === "number") {
|
|
879
|
+
if (isNaN(val))
|
|
880
|
+
return "nan";
|
|
881
|
+
if (val === Infinity)
|
|
882
|
+
return "inf";
|
|
883
|
+
if (val === -Infinity)
|
|
884
|
+
return "-inf";
|
|
885
|
+
if (numberAsFloat && Number.isInteger(val))
|
|
886
|
+
return val.toFixed(1);
|
|
887
|
+
return val.toString();
|
|
888
|
+
}
|
|
889
|
+
if (type === "bigint" || type === "boolean") {
|
|
890
|
+
return val.toString();
|
|
891
|
+
}
|
|
892
|
+
if (type === "string") {
|
|
893
|
+
return formatString(val);
|
|
894
|
+
}
|
|
895
|
+
if (type === "date") {
|
|
896
|
+
if (isNaN(val.getTime())) {
|
|
897
|
+
throw new TypeError("cannot serialize invalid date");
|
|
898
|
+
}
|
|
899
|
+
return val.toISOString();
|
|
900
|
+
}
|
|
901
|
+
if (type === "object") {
|
|
902
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
903
|
+
}
|
|
904
|
+
if (type === "array") {
|
|
905
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
__name(stringifyValue, "stringifyValue");
|
|
909
|
+
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
910
|
+
let keys = Object.keys(obj);
|
|
911
|
+
if (keys.length === 0)
|
|
912
|
+
return "{}";
|
|
913
|
+
let res = "{ ";
|
|
914
|
+
for (let i = 0; i < keys.length; i++) {
|
|
915
|
+
let k = keys[i];
|
|
916
|
+
if (i)
|
|
917
|
+
res += ", ";
|
|
918
|
+
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
919
|
+
res += " = ";
|
|
920
|
+
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
921
|
+
}
|
|
922
|
+
return res + " }";
|
|
923
|
+
}
|
|
924
|
+
__name(stringifyInlineTable, "stringifyInlineTable");
|
|
925
|
+
function stringifyArray(array, depth, numberAsFloat) {
|
|
926
|
+
if (array.length === 0)
|
|
927
|
+
return "[]";
|
|
928
|
+
let res = "[ ";
|
|
929
|
+
for (let i = 0; i < array.length; i++) {
|
|
930
|
+
if (i)
|
|
931
|
+
res += ", ";
|
|
932
|
+
if (array[i] === null || array[i] === void 0) {
|
|
933
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
934
|
+
}
|
|
935
|
+
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
|
|
936
|
+
}
|
|
937
|
+
return res + " ]";
|
|
938
|
+
}
|
|
939
|
+
__name(stringifyArray, "stringifyArray");
|
|
940
|
+
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
941
|
+
if (depth === 0) {
|
|
942
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
943
|
+
}
|
|
944
|
+
let res = "";
|
|
945
|
+
for (let i = 0; i < array.length; i++) {
|
|
946
|
+
res += `${res && "\n"}[[${key}]]
|
|
947
|
+
`;
|
|
948
|
+
res += stringifyTable(0, array[i], key, depth, numberAsFloat);
|
|
949
|
+
}
|
|
950
|
+
return res;
|
|
951
|
+
}
|
|
952
|
+
__name(stringifyArrayTable, "stringifyArrayTable");
|
|
953
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
954
|
+
if (depth === 0) {
|
|
955
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
956
|
+
}
|
|
957
|
+
let preamble = "";
|
|
958
|
+
let tables = "";
|
|
959
|
+
let keys = Object.keys(obj);
|
|
960
|
+
for (let i = 0; i < keys.length; i++) {
|
|
961
|
+
let k = keys[i];
|
|
962
|
+
if (obj[k] !== null && obj[k] !== void 0) {
|
|
963
|
+
let type = extendedTypeOf(obj[k]);
|
|
964
|
+
if (type === "symbol" || type === "function") {
|
|
965
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
966
|
+
}
|
|
967
|
+
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
968
|
+
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
969
|
+
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
970
|
+
} else if (type === "object") {
|
|
971
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
972
|
+
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
973
|
+
} else {
|
|
974
|
+
preamble += key;
|
|
975
|
+
preamble += " = ";
|
|
976
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
977
|
+
preamble += "\n";
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (tableKey && (preamble || !tables))
|
|
982
|
+
preamble = preamble ? `[${tableKey}]
|
|
983
|
+
${preamble}` : `[${tableKey}]`;
|
|
984
|
+
return preamble && tables ? `${preamble}
|
|
985
|
+
${tables}` : preamble || tables;
|
|
986
|
+
}
|
|
987
|
+
__name(stringifyTable, "stringifyTable");
|
|
988
|
+
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
989
|
+
if (extendedTypeOf(obj) !== "object") {
|
|
990
|
+
throw new TypeError("stringify can only be called with an object");
|
|
991
|
+
}
|
|
992
|
+
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
993
|
+
if (str[str.length - 1] !== "\n")
|
|
994
|
+
return str + "\n";
|
|
995
|
+
return str;
|
|
996
|
+
}
|
|
997
|
+
__name(stringify, "stringify");
|
|
998
|
+
|
|
999
|
+
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/index.js
|
|
1000
|
+
var dist_default = { parse, stringify, TomlDate, TomlError };
|
|
2211
1001
|
|
|
2212
1002
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
2213
1003
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -2250,15 +1040,15 @@ function createScanner(text, ignoreTrivia = false) {
|
|
|
2250
1040
|
pos++;
|
|
2251
1041
|
} else {
|
|
2252
1042
|
pos++;
|
|
2253
|
-
while (pos < text.length &&
|
|
1043
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2254
1044
|
pos++;
|
|
2255
1045
|
}
|
|
2256
1046
|
}
|
|
2257
1047
|
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
2258
1048
|
pos++;
|
|
2259
|
-
if (pos < text.length &&
|
|
1049
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2260
1050
|
pos++;
|
|
2261
|
-
while (pos < text.length &&
|
|
1051
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2262
1052
|
pos++;
|
|
2263
1053
|
}
|
|
2264
1054
|
} else {
|
|
@@ -2272,9 +1062,9 @@ function createScanner(text, ignoreTrivia = false) {
|
|
|
2272
1062
|
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
2273
1063
|
pos++;
|
|
2274
1064
|
}
|
|
2275
|
-
if (pos < text.length &&
|
|
1065
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2276
1066
|
pos++;
|
|
2277
|
-
while (pos < text.length &&
|
|
1067
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
2278
1068
|
pos++;
|
|
2279
1069
|
}
|
|
2280
1070
|
end = pos;
|
|
@@ -2463,7 +1253,7 @@ function createScanner(text, ignoreTrivia = false) {
|
|
|
2463
1253
|
case 45:
|
|
2464
1254
|
value += String.fromCharCode(code);
|
|
2465
1255
|
pos++;
|
|
2466
|
-
if (pos === len || !
|
|
1256
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
2467
1257
|
return token = 16;
|
|
2468
1258
|
}
|
|
2469
1259
|
// found a minus, followed by a number so
|
|
@@ -2553,10 +1343,10 @@ function isLineBreak(ch) {
|
|
|
2553
1343
|
return ch === 10 || ch === 13;
|
|
2554
1344
|
}
|
|
2555
1345
|
__name(isLineBreak, "isLineBreak");
|
|
2556
|
-
function
|
|
1346
|
+
function isDigit(ch) {
|
|
2557
1347
|
return ch >= 48 && ch <= 57;
|
|
2558
1348
|
}
|
|
2559
|
-
__name(
|
|
1349
|
+
__name(isDigit, "isDigit");
|
|
2560
1350
|
var CharacterCodes;
|
|
2561
1351
|
(function(CharacterCodes2) {
|
|
2562
1352
|
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
@@ -2882,7 +1672,7 @@ var ParseOptions;
|
|
|
2882
1672
|
allowTrailingComma: false
|
|
2883
1673
|
};
|
|
2884
1674
|
})(ParseOptions || (ParseOptions = {}));
|
|
2885
|
-
function
|
|
1675
|
+
function parse2(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
2886
1676
|
let currentProperty = null;
|
|
2887
1677
|
let currentParent = [];
|
|
2888
1678
|
const previousParents = [];
|
|
@@ -2926,7 +1716,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
2926
1716
|
visit(text, visitor, options);
|
|
2927
1717
|
return currentParent[0];
|
|
2928
1718
|
}
|
|
2929
|
-
__name(
|
|
1719
|
+
__name(parse2, "parse");
|
|
2930
1720
|
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
2931
1721
|
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
2932
1722
|
function ensurePropertyComplete(endOffset) {
|
|
@@ -3112,15 +1902,15 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3112
1902
|
}
|
|
3113
1903
|
}
|
|
3114
1904
|
__name(scanNext, "scanNext");
|
|
3115
|
-
function handleError(error, skipUntilAfter = [],
|
|
1905
|
+
function handleError(error, skipUntilAfter = [], skipUntil2 = []) {
|
|
3116
1906
|
onError(error);
|
|
3117
|
-
if (skipUntilAfter.length +
|
|
1907
|
+
if (skipUntilAfter.length + skipUntil2.length > 0) {
|
|
3118
1908
|
let token = _scanner.getToken();
|
|
3119
1909
|
while (token !== 17) {
|
|
3120
1910
|
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
3121
1911
|
scanNext();
|
|
3122
1912
|
break;
|
|
3123
|
-
} else if (
|
|
1913
|
+
} else if (skipUntil2.indexOf(token) !== -1) {
|
|
3124
1914
|
break;
|
|
3125
1915
|
}
|
|
3126
1916
|
token = scanNext();
|
|
@@ -3128,7 +1918,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3128
1918
|
}
|
|
3129
1919
|
}
|
|
3130
1920
|
__name(handleError, "handleError");
|
|
3131
|
-
function
|
|
1921
|
+
function parseString2(isValue) {
|
|
3132
1922
|
const value = _scanner.getTokenValue();
|
|
3133
1923
|
if (isValue) {
|
|
3134
1924
|
onLiteralValue(value);
|
|
@@ -3139,7 +1929,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3139
1929
|
scanNext();
|
|
3140
1930
|
return true;
|
|
3141
1931
|
}
|
|
3142
|
-
__name(
|
|
1932
|
+
__name(parseString2, "parseString");
|
|
3143
1933
|
function parseLiteral() {
|
|
3144
1934
|
switch (_scanner.getToken()) {
|
|
3145
1935
|
case 11:
|
|
@@ -3179,11 +1969,11 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3179
1969
|
]);
|
|
3180
1970
|
return false;
|
|
3181
1971
|
}
|
|
3182
|
-
|
|
1972
|
+
parseString2(false);
|
|
3183
1973
|
if (_scanner.getToken() === 6) {
|
|
3184
1974
|
onSeparator(":");
|
|
3185
1975
|
scanNext();
|
|
3186
|
-
if (!
|
|
1976
|
+
if (!parseValue2()) {
|
|
3187
1977
|
handleError(4, [], [
|
|
3188
1978
|
2,
|
|
3189
1979
|
5
|
|
@@ -3239,7 +2029,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3239
2029
|
return true;
|
|
3240
2030
|
}
|
|
3241
2031
|
__name(parseObject, "parseObject");
|
|
3242
|
-
function
|
|
2032
|
+
function parseArray2() {
|
|
3243
2033
|
onArrayBegin();
|
|
3244
2034
|
scanNext();
|
|
3245
2035
|
let isFirstElement = true;
|
|
@@ -3263,7 +2053,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3263
2053
|
} else {
|
|
3264
2054
|
_jsonPath[_jsonPath.length - 1]++;
|
|
3265
2055
|
}
|
|
3266
|
-
if (!
|
|
2056
|
+
if (!parseValue2()) {
|
|
3267
2057
|
handleError(4, [], [
|
|
3268
2058
|
4,
|
|
3269
2059
|
5
|
|
@@ -3286,20 +2076,20 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3286
2076
|
}
|
|
3287
2077
|
return true;
|
|
3288
2078
|
}
|
|
3289
|
-
__name(
|
|
3290
|
-
function
|
|
2079
|
+
__name(parseArray2, "parseArray");
|
|
2080
|
+
function parseValue2() {
|
|
3291
2081
|
switch (_scanner.getToken()) {
|
|
3292
2082
|
case 3:
|
|
3293
|
-
return
|
|
2083
|
+
return parseArray2();
|
|
3294
2084
|
case 1:
|
|
3295
2085
|
return parseObject();
|
|
3296
2086
|
case 10:
|
|
3297
|
-
return
|
|
2087
|
+
return parseString2(true);
|
|
3298
2088
|
default:
|
|
3299
2089
|
return parseLiteral();
|
|
3300
2090
|
}
|
|
3301
2091
|
}
|
|
3302
|
-
__name(
|
|
2092
|
+
__name(parseValue2, "parseValue");
|
|
3303
2093
|
scanNext();
|
|
3304
2094
|
if (_scanner.getToken() === 17) {
|
|
3305
2095
|
if (options.allowEmptyContent) {
|
|
@@ -3308,7 +2098,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
3308
2098
|
handleError(4, [], []);
|
|
3309
2099
|
return false;
|
|
3310
2100
|
}
|
|
3311
|
-
if (!
|
|
2101
|
+
if (!parseValue2()) {
|
|
3312
2102
|
handleError(4, [], []);
|
|
3313
2103
|
return false;
|
|
3314
2104
|
}
|
|
@@ -3518,7 +2308,7 @@ var SyntaxKind;
|
|
|
3518
2308
|
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
3519
2309
|
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
3520
2310
|
})(SyntaxKind || (SyntaxKind = {}));
|
|
3521
|
-
var
|
|
2311
|
+
var parse3 = parse2;
|
|
3522
2312
|
var ParseErrorCode;
|
|
3523
2313
|
(function(ParseErrorCode2) {
|
|
3524
2314
|
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
@@ -3654,28 +2444,22 @@ var APIError = class extends ParseError {
|
|
|
3654
2444
|
this.#reportable = false;
|
|
3655
2445
|
}
|
|
3656
2446
|
};
|
|
3657
|
-
var TOML_ERROR_NAME = "TomlError";
|
|
3658
|
-
var TOML_ERROR_SUFFIX = " at row ";
|
|
3659
2447
|
function parseTOML(input, file) {
|
|
3660
2448
|
try {
|
|
3661
|
-
|
|
3662
|
-
return import_toml.default.parse(normalizedInput);
|
|
2449
|
+
return dist_default.parse(input);
|
|
3663
2450
|
} catch (err) {
|
|
3664
|
-
|
|
3665
|
-
if (name !== TOML_ERROR_NAME) {
|
|
2451
|
+
if (!(err instanceof TomlError)) {
|
|
3666
2452
|
throw err;
|
|
3667
2453
|
}
|
|
3668
|
-
const text = message.substring(0, message.lastIndexOf(TOML_ERROR_SUFFIX));
|
|
3669
|
-
const lineText = input.split("\n")[line];
|
|
3670
2454
|
const location = {
|
|
3671
|
-
lineText,
|
|
3672
|
-
line: line
|
|
3673
|
-
column:
|
|
2455
|
+
lineText: input.split("\n")[err.line - 1],
|
|
2456
|
+
line: err.line,
|
|
2457
|
+
column: err.column - 1,
|
|
3674
2458
|
file,
|
|
3675
2459
|
fileText: input
|
|
3676
2460
|
};
|
|
3677
2461
|
throw new ParseError({
|
|
3678
|
-
text,
|
|
2462
|
+
text: err.message.substring(0, err.message.indexOf("\n")),
|
|
3679
2463
|
location,
|
|
3680
2464
|
telemetryMessage: "TOML parse error"
|
|
3681
2465
|
});
|
|
@@ -3696,7 +2480,7 @@ function parseJSON(input, file) {
|
|
|
3696
2480
|
__name(parseJSON, "parseJSON");
|
|
3697
2481
|
function parseJSONC(input, file, options = { allowTrailingComma: true }) {
|
|
3698
2482
|
const errors = [];
|
|
3699
|
-
const data =
|
|
2483
|
+
const data = parse3(input, errors, options);
|
|
3700
2484
|
if (errors.length) {
|
|
3701
2485
|
throw new ParseError({
|
|
3702
2486
|
text: printParseErrorCode(errors[0].error),
|
|
@@ -4154,7 +2938,7 @@ __name(configFileName, "configFileName");
|
|
|
4154
2938
|
function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
4155
2939
|
const format3 = configFormat(configPath);
|
|
4156
2940
|
if (format3 === "toml") {
|
|
4157
|
-
return
|
|
2941
|
+
return dist_default.stringify(snippet);
|
|
4158
2942
|
} else {
|
|
4159
2943
|
return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
|
|
4160
2944
|
}
|
|
@@ -4180,9 +2964,6 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
|
|
|
4180
2964
|
redirected
|
|
4181
2965
|
};
|
|
4182
2966
|
}, "experimental_readRawConfig");
|
|
4183
|
-
|
|
4184
|
-
// src/config/patch-config.ts
|
|
4185
|
-
var import_toml3 = __toESM(require_toml());
|
|
4186
2967
|
var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArrayInsertion = true) => {
|
|
4187
2968
|
let configString = readFileSync(configPath);
|
|
4188
2969
|
if (configPath.endsWith("toml")) {
|
|
@@ -4206,7 +2987,7 @@ var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArra
|
|
|
4206
2987
|
const formatEdit = format2(configString, void 0, {});
|
|
4207
2988
|
configString = applyEdits(configString, formatEdit);
|
|
4208
2989
|
if (configPath.endsWith(".toml")) {
|
|
4209
|
-
configString =
|
|
2990
|
+
configString = dist_default.stringify(parseJSONC(configString));
|
|
4210
2991
|
}
|
|
4211
2992
|
writeFileSync(configPath, configString);
|
|
4212
2993
|
return configString;
|
|
@@ -4218,13 +2999,13 @@ var getJSONPath = /* @__PURE__ */ __name((obj, allPaths, isArrayInsertion, prevP
|
|
|
4218
2999
|
v.forEach((x, i) => {
|
|
4219
3000
|
if (isArrayInsertion) {
|
|
4220
3001
|
allPaths.push([...currentPath, -1, x]);
|
|
4221
|
-
} else if (typeof x === "object") {
|
|
3002
|
+
} else if (typeof x === "object" && x !== null) {
|
|
4222
3003
|
getJSONPath(x, allPaths, isArrayInsertion, [...currentPath, i]);
|
|
4223
3004
|
} else {
|
|
4224
3005
|
allPaths.push([...currentPath, i, x]);
|
|
4225
3006
|
}
|
|
4226
3007
|
});
|
|
4227
|
-
} else if (typeof v === "object") {
|
|
3008
|
+
} else if (typeof v === "object" && v !== null) {
|
|
4228
3009
|
getJSONPath(v, allPaths, isArrayInsertion, currentPath);
|
|
4229
3010
|
} else {
|
|
4230
3011
|
allPaths.push([...currentPath, v]);
|
|
@@ -4819,9 +3600,9 @@ var validateOptionalTypedArray = /* @__PURE__ */ __name((diagnostics, container,
|
|
|
4819
3600
|
}
|
|
4820
3601
|
return true;
|
|
4821
3602
|
}, "validateOptionalTypedArray");
|
|
4822
|
-
var isRequiredProperty = /* @__PURE__ */ __name((
|
|
4823
|
-
var isOptionalProperty = /* @__PURE__ */ __name((
|
|
4824
|
-
var hasProperty = /* @__PURE__ */ __name((
|
|
3603
|
+
var isRequiredProperty = /* @__PURE__ */ __name((target, property, type, choices) => hasProperty(target, property) && typeof target[property] === type && (choices === void 0 || choices.includes(target[property])), "isRequiredProperty");
|
|
3604
|
+
var isOptionalProperty = /* @__PURE__ */ __name((target, property, type) => !hasProperty(target, property) || typeof target[property] === type, "isOptionalProperty");
|
|
3605
|
+
var hasProperty = /* @__PURE__ */ __name((target, property) => property in target, "hasProperty");
|
|
4825
3606
|
var validateAdditionalProperties = /* @__PURE__ */ __name((diagnostics, fieldPath, restProps, knownProps) => {
|
|
4826
3607
|
const restPropSet = new Set(restProps);
|
|
4827
3608
|
for (const knownProp of knownProps) {
|
|
@@ -5602,6 +4383,38 @@ var validateTailConsumers = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
5602
4383
|
}
|
|
5603
4384
|
return isValid;
|
|
5604
4385
|
}, "validateTailConsumers");
|
|
4386
|
+
function validateStreamingTailConsumer(diagnostics, field, value) {
|
|
4387
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
4388
|
+
diagnostics.errors.push(
|
|
4389
|
+
`"${field}" should be an object but got ${JSON.stringify(value)}.`
|
|
4390
|
+
);
|
|
4391
|
+
return false;
|
|
4392
|
+
}
|
|
4393
|
+
return validateRequiredProperty(
|
|
4394
|
+
diagnostics,
|
|
4395
|
+
field,
|
|
4396
|
+
"service",
|
|
4397
|
+
value.service,
|
|
4398
|
+
"string"
|
|
4399
|
+
);
|
|
4400
|
+
}
|
|
4401
|
+
__name(validateStreamingTailConsumer, "validateStreamingTailConsumer");
|
|
4402
|
+
var validateStreamingTailConsumers = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
4403
|
+
if (!value) {
|
|
4404
|
+
return true;
|
|
4405
|
+
}
|
|
4406
|
+
if (!Array.isArray(value)) {
|
|
4407
|
+
diagnostics.errors.push(
|
|
4408
|
+
`Expected "${field}" to be an array but got ${JSON.stringify(value)}.`
|
|
4409
|
+
);
|
|
4410
|
+
return false;
|
|
4411
|
+
}
|
|
4412
|
+
let isValid = true;
|
|
4413
|
+
for (let i = 0; i < value.length; i++) {
|
|
4414
|
+
isValid = validateStreamingTailConsumer(diagnostics, `${field}[${i}]`, value[i]) && isValid;
|
|
4415
|
+
}
|
|
4416
|
+
return isValid;
|
|
4417
|
+
}, "validateStreamingTailConsumers");
|
|
5605
4418
|
function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
|
|
5606
4419
|
deprecated(
|
|
5607
4420
|
diagnostics,
|
|
@@ -5955,6 +4768,16 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
5955
4768
|
validateTailConsumers,
|
|
5956
4769
|
void 0
|
|
5957
4770
|
),
|
|
4771
|
+
streaming_tail_consumers: notInheritable(
|
|
4772
|
+
diagnostics,
|
|
4773
|
+
topLevelEnv,
|
|
4774
|
+
rawConfig,
|
|
4775
|
+
rawEnv,
|
|
4776
|
+
envName,
|
|
4777
|
+
"streaming_tail_consumers",
|
|
4778
|
+
validateStreamingTailConsumers,
|
|
4779
|
+
void 0
|
|
4780
|
+
),
|
|
5958
4781
|
unsafe: notInheritable(
|
|
5959
4782
|
diagnostics,
|
|
5960
4783
|
topLevelEnv,
|
|
@@ -8536,5 +7359,268 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
8536
7359
|
}
|
|
8537
7360
|
}
|
|
8538
7361
|
__name(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
7362
|
+
/*! Bundled license information:
|
|
7363
|
+
|
|
7364
|
+
smol-toml/dist/error.js:
|
|
7365
|
+
(*!
|
|
7366
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7367
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7368
|
+
*
|
|
7369
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7370
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7371
|
+
*
|
|
7372
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7373
|
+
* list of conditions and the following disclaimer.
|
|
7374
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7375
|
+
* this list of conditions and the following disclaimer in the
|
|
7376
|
+
* documentation and/or other materials provided with the distribution.
|
|
7377
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7378
|
+
* may be used to endorse or promote products derived from this software without
|
|
7379
|
+
* specific prior written permission.
|
|
7380
|
+
*
|
|
7381
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7382
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7383
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7384
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7385
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7386
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7387
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7388
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7389
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7390
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7391
|
+
*)
|
|
7392
|
+
|
|
7393
|
+
smol-toml/dist/util.js:
|
|
7394
|
+
(*!
|
|
7395
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7396
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7397
|
+
*
|
|
7398
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7399
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7400
|
+
*
|
|
7401
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7402
|
+
* list of conditions and the following disclaimer.
|
|
7403
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7404
|
+
* this list of conditions and the following disclaimer in the
|
|
7405
|
+
* documentation and/or other materials provided with the distribution.
|
|
7406
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7407
|
+
* may be used to endorse or promote products derived from this software without
|
|
7408
|
+
* specific prior written permission.
|
|
7409
|
+
*
|
|
7410
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7411
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7412
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7413
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7414
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7415
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7416
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7417
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7418
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7419
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7420
|
+
*)
|
|
7421
|
+
|
|
7422
|
+
smol-toml/dist/date.js:
|
|
7423
|
+
(*!
|
|
7424
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7425
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7426
|
+
*
|
|
7427
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7428
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7429
|
+
*
|
|
7430
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7431
|
+
* list of conditions and the following disclaimer.
|
|
7432
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7433
|
+
* this list of conditions and the following disclaimer in the
|
|
7434
|
+
* documentation and/or other materials provided with the distribution.
|
|
7435
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7436
|
+
* may be used to endorse or promote products derived from this software without
|
|
7437
|
+
* specific prior written permission.
|
|
7438
|
+
*
|
|
7439
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7440
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7441
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7442
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7443
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7444
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7445
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7446
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7447
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7448
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7449
|
+
*)
|
|
7450
|
+
|
|
7451
|
+
smol-toml/dist/primitive.js:
|
|
7452
|
+
(*!
|
|
7453
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7454
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7455
|
+
*
|
|
7456
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7457
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7458
|
+
*
|
|
7459
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7460
|
+
* list of conditions and the following disclaimer.
|
|
7461
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7462
|
+
* this list of conditions and the following disclaimer in the
|
|
7463
|
+
* documentation and/or other materials provided with the distribution.
|
|
7464
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7465
|
+
* may be used to endorse or promote products derived from this software without
|
|
7466
|
+
* specific prior written permission.
|
|
7467
|
+
*
|
|
7468
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7469
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7470
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7471
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7472
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7473
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7474
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7475
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7476
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7477
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7478
|
+
*)
|
|
7479
|
+
|
|
7480
|
+
smol-toml/dist/extract.js:
|
|
7481
|
+
(*!
|
|
7482
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7483
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7484
|
+
*
|
|
7485
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7486
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7487
|
+
*
|
|
7488
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7489
|
+
* list of conditions and the following disclaimer.
|
|
7490
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7491
|
+
* this list of conditions and the following disclaimer in the
|
|
7492
|
+
* documentation and/or other materials provided with the distribution.
|
|
7493
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7494
|
+
* may be used to endorse or promote products derived from this software without
|
|
7495
|
+
* specific prior written permission.
|
|
7496
|
+
*
|
|
7497
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7498
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7499
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7500
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7501
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7502
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7503
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7504
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7505
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7506
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7507
|
+
*)
|
|
7508
|
+
|
|
7509
|
+
smol-toml/dist/struct.js:
|
|
7510
|
+
(*!
|
|
7511
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7512
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7513
|
+
*
|
|
7514
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7515
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7516
|
+
*
|
|
7517
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7518
|
+
* list of conditions and the following disclaimer.
|
|
7519
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7520
|
+
* this list of conditions and the following disclaimer in the
|
|
7521
|
+
* documentation and/or other materials provided with the distribution.
|
|
7522
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7523
|
+
* may be used to endorse or promote products derived from this software without
|
|
7524
|
+
* specific prior written permission.
|
|
7525
|
+
*
|
|
7526
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7527
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7528
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7529
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7530
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7531
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7532
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7533
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7534
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7535
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7536
|
+
*)
|
|
7537
|
+
|
|
7538
|
+
smol-toml/dist/parse.js:
|
|
7539
|
+
(*!
|
|
7540
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7541
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7542
|
+
*
|
|
7543
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7544
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7545
|
+
*
|
|
7546
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7547
|
+
* list of conditions and the following disclaimer.
|
|
7548
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7549
|
+
* this list of conditions and the following disclaimer in the
|
|
7550
|
+
* documentation and/or other materials provided with the distribution.
|
|
7551
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7552
|
+
* may be used to endorse or promote products derived from this software without
|
|
7553
|
+
* specific prior written permission.
|
|
7554
|
+
*
|
|
7555
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7556
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7557
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7558
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7559
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7560
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7561
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7562
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7563
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7564
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7565
|
+
*)
|
|
7566
|
+
|
|
7567
|
+
smol-toml/dist/stringify.js:
|
|
7568
|
+
(*!
|
|
7569
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7570
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7571
|
+
*
|
|
7572
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7573
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7574
|
+
*
|
|
7575
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7576
|
+
* list of conditions and the following disclaimer.
|
|
7577
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7578
|
+
* this list of conditions and the following disclaimer in the
|
|
7579
|
+
* documentation and/or other materials provided with the distribution.
|
|
7580
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7581
|
+
* may be used to endorse or promote products derived from this software without
|
|
7582
|
+
* specific prior written permission.
|
|
7583
|
+
*
|
|
7584
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7585
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7586
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7587
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7588
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7589
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7590
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7591
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7592
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7593
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7594
|
+
*)
|
|
7595
|
+
|
|
7596
|
+
smol-toml/dist/index.js:
|
|
7597
|
+
(*!
|
|
7598
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7599
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7600
|
+
*
|
|
7601
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7602
|
+
* modification, are permitted provided that the following conditions are met:
|
|
7603
|
+
*
|
|
7604
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
7605
|
+
* list of conditions and the following disclaimer.
|
|
7606
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
7607
|
+
* this list of conditions and the following disclaimer in the
|
|
7608
|
+
* documentation and/or other materials provided with the distribution.
|
|
7609
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
7610
|
+
* may be used to endorse or promote products derived from this software without
|
|
7611
|
+
* specific prior written permission.
|
|
7612
|
+
*
|
|
7613
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
7614
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
7615
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
7616
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
7617
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
7618
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
7619
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
7620
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
7621
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
7622
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7623
|
+
*)
|
|
7624
|
+
*/
|
|
8539
7625
|
|
|
8540
|
-
export { APIError, ParseError, PatchConfigError, bucketFormatMessage, configFileName, configFormat, defaultWranglerConfig, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, friendlyBindingNames, indexLocation, isPagesConfig, isValidR2BucketName, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
|
|
7626
|
+
export { APIError, ParseError, PatchConfigError, bucketFormatMessage, configFileName, configFormat, defaultWranglerConfig, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, friendlyBindingNames, hasProperty, indexLocation, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
|