@cloudflare/workers-utils 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +41 -3
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-73TUG5Z7.mjs → chunk-H6ZOCMLW.mjs} +2 -8
- package/dist/{chunk-DCOBXSFB.mjs → chunk-UB4QLUTD.mjs} +7 -1
- package/dist/chunk-WHXYFHDX.mjs +3180 -0
- package/dist/{browser-mD2xO9Bj.d.mts → config-cFPB-c8J.d.mts} +42 -40
- package/dist/index.d.mts +13 -4
- package/dist/index.mjs +213 -3253
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +10 -1
- package/dist/test-helpers/index.mjs +68 -8
- package/package.json +9 -7
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import process2 from 'node:process';
|
|
8
|
-
import { statSync, existsSync as existsSync$1, writeFileSync } from 'fs';
|
|
1
|
+
export { assertNever, constructWranglerConfig, formatCompatibilityDate, mapWorkerMetadataBindings } from './chunk-H6ZOCMLW.mjs';
|
|
2
|
+
import { UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, readFileSync, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-WHXYFHDX.mjs';
|
|
3
|
+
export { APIError, CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, ParseError, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation } from './chunk-WHXYFHDX.mjs';
|
|
4
|
+
import { __commonJS, __name, __require, __export, __toESM, __reExport } from './chunk-UB4QLUTD.mjs';
|
|
5
|
+
export { ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX } from './chunk-UB4QLUTD.mjs';
|
|
6
|
+
import fs, { statSync, existsSync, writeFileSync } from 'node:fs';
|
|
9
7
|
import assert from 'node:assert';
|
|
10
|
-
import path4 from 'path';
|
|
8
|
+
import path4 from 'node:path';
|
|
11
9
|
import os from 'node:os';
|
|
12
10
|
|
|
13
11
|
// ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js
|
|
@@ -32,7 +30,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
32
30
|
}
|
|
33
31
|
__name(typeOf, "typeOf");
|
|
34
32
|
function Adapt(adapter_) {
|
|
35
|
-
var meta = adapter_.meta,
|
|
33
|
+
var meta = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
|
|
36
34
|
var XDGAppPaths_ = /* @__PURE__ */ function() {
|
|
37
35
|
function XDGAppPaths_2(options_) {
|
|
38
36
|
if (options_ === void 0) {
|
|
@@ -55,7 +53,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
55
53
|
meta.mainFilename()
|
|
56
54
|
];
|
|
57
55
|
var nameFallback = "$eval";
|
|
58
|
-
var name =
|
|
56
|
+
var name = path5.parse(((_c = namePriorityList.find(function(e) {
|
|
59
57
|
return isString2(e);
|
|
60
58
|
})) !== null && _c !== void 0 ? _c : nameFallback) + suffix).name;
|
|
61
59
|
XDGAppPaths.$name = /* @__PURE__ */ __name(function $name() {
|
|
@@ -76,28 +74,28 @@ var require_XDGAppPaths = __commonJS({
|
|
|
76
74
|
}
|
|
77
75
|
__name(finalPathSegment, "finalPathSegment");
|
|
78
76
|
XDGAppPaths.cache = /* @__PURE__ */ __name(function cache(dirOptions) {
|
|
79
|
-
return
|
|
77
|
+
return path5.join(xdg.cache(), finalPathSegment(dirOptions));
|
|
80
78
|
}, "cache");
|
|
81
79
|
XDGAppPaths.config = /* @__PURE__ */ __name(function config(dirOptions) {
|
|
82
|
-
return
|
|
80
|
+
return path5.join(xdg.config(), finalPathSegment(dirOptions));
|
|
83
81
|
}, "config");
|
|
84
82
|
XDGAppPaths.data = /* @__PURE__ */ __name(function data(dirOptions) {
|
|
85
|
-
return
|
|
83
|
+
return path5.join(xdg.data(), finalPathSegment(dirOptions));
|
|
86
84
|
}, "data");
|
|
87
85
|
XDGAppPaths.runtime = /* @__PURE__ */ __name(function runtime(dirOptions) {
|
|
88
|
-
return xdg.runtime() ?
|
|
86
|
+
return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
|
|
89
87
|
}, "runtime");
|
|
90
88
|
XDGAppPaths.state = /* @__PURE__ */ __name(function state(dirOptions) {
|
|
91
|
-
return
|
|
89
|
+
return path5.join(xdg.state(), finalPathSegment(dirOptions));
|
|
92
90
|
}, "state");
|
|
93
91
|
XDGAppPaths.configDirs = /* @__PURE__ */ __name(function configDirs(dirOptions) {
|
|
94
92
|
return xdg.configDirs().map(function(s) {
|
|
95
|
-
return
|
|
93
|
+
return path5.join(s, finalPathSegment(dirOptions));
|
|
96
94
|
});
|
|
97
95
|
}, "configDirs");
|
|
98
96
|
XDGAppPaths.dataDirs = /* @__PURE__ */ __name(function dataDirs(dirOptions) {
|
|
99
97
|
return xdg.dataDirs().map(function(s) {
|
|
100
|
-
return
|
|
98
|
+
return path5.join(s, finalPathSegment(dirOptions));
|
|
101
99
|
});
|
|
102
100
|
}, "dataDirs");
|
|
103
101
|
return XDGAppPaths;
|
|
@@ -123,7 +121,7 @@ var require_XDG = __commonJS({
|
|
|
123
121
|
exports.__esModule = true;
|
|
124
122
|
exports.Adapt = void 0;
|
|
125
123
|
function Adapt(adapter_) {
|
|
126
|
-
var env = adapter_.env, osPaths = adapter_.osPaths,
|
|
124
|
+
var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
|
|
127
125
|
var isMacOS = /^darwin$/i.test(adapter_.process.platform);
|
|
128
126
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
|
129
127
|
function baseDir() {
|
|
@@ -131,7 +129,7 @@ var require_XDG = __commonJS({
|
|
|
131
129
|
}
|
|
132
130
|
__name(baseDir, "baseDir");
|
|
133
131
|
function valOrPath(val, pathSegments) {
|
|
134
|
-
return val ||
|
|
132
|
+
return val || path5.join.apply(path5, pathSegments);
|
|
135
133
|
}
|
|
136
134
|
__name(valOrPath, "valOrPath");
|
|
137
135
|
var linux = /* @__PURE__ */ __name(function() {
|
|
@@ -210,11 +208,11 @@ var require_XDG = __commonJS({
|
|
|
210
208
|
XDG.state = extension.state;
|
|
211
209
|
XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
|
|
212
210
|
var pathList = env.get("XDG_CONFIG_DIRS");
|
|
213
|
-
return __spreadArray([extension.config()], pathList ? pathList.split(
|
|
211
|
+
return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
|
|
214
212
|
}, "configDirs");
|
|
215
213
|
XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
|
|
216
214
|
var pathList = env.get("XDG_DATA_DIRS");
|
|
217
|
-
return __spreadArray([extension.data()], pathList ? pathList.split(
|
|
215
|
+
return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
|
|
218
216
|
}, "dataDirs");
|
|
219
217
|
return XDG;
|
|
220
218
|
}
|
|
@@ -243,7 +241,7 @@ var require_OSPaths = __commonJS({
|
|
|
243
241
|
}
|
|
244
242
|
__name(isEmpty, "isEmpty");
|
|
245
243
|
function Adapt(adapter_) {
|
|
246
|
-
var env = adapter_.env, os2 = adapter_.os,
|
|
244
|
+
var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
|
|
247
245
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
|
248
246
|
function normalizePath(path_) {
|
|
249
247
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
|
@@ -258,7 +256,7 @@ var require_OSPaths = __commonJS({
|
|
|
258
256
|
typeof os2.homedir === "function" ? os2.homedir() : void 0,
|
|
259
257
|
env.get("USERPROFILE"),
|
|
260
258
|
env.get("HOME"),
|
|
261
|
-
env.get("HOMEDRIVE") || env.get("HOMEPATH") ?
|
|
259
|
+
env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path5.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
|
|
262
260
|
];
|
|
263
261
|
return normalizePath(priorityList.find(function(v) {
|
|
264
262
|
return !isEmpty(v);
|
|
@@ -269,7 +267,7 @@ var require_OSPaths = __commonJS({
|
|
|
269
267
|
__name(home, "home");
|
|
270
268
|
function temp() {
|
|
271
269
|
function joinPathToBase(base, segments) {
|
|
272
|
-
return base ?
|
|
270
|
+
return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
|
|
273
271
|
}
|
|
274
272
|
__name(joinPathToBase, "joinPathToBase");
|
|
275
273
|
function posix() {
|
|
@@ -374,7 +372,7 @@ var require_node = __commonJS({
|
|
|
374
372
|
exports.__esModule = true;
|
|
375
373
|
exports.adapter = void 0;
|
|
376
374
|
var os2 = __importStar(__require("os"));
|
|
377
|
-
var
|
|
375
|
+
var path5 = __importStar(__require("path"));
|
|
378
376
|
exports.adapter = {
|
|
379
377
|
atImportPermissions: { env: true },
|
|
380
378
|
env: {
|
|
@@ -383,7 +381,7 @@ var require_node = __commonJS({
|
|
|
383
381
|
}, "get")
|
|
384
382
|
},
|
|
385
383
|
os: os2,
|
|
386
|
-
path:
|
|
384
|
+
path: path5,
|
|
387
385
|
process
|
|
388
386
|
};
|
|
389
387
|
}
|
|
@@ -429,7 +427,7 @@ var require_node2 = __commonJS({
|
|
|
429
427
|
};
|
|
430
428
|
exports.__esModule = true;
|
|
431
429
|
exports.adapter = void 0;
|
|
432
|
-
var
|
|
430
|
+
var path5 = __importStar(__require("path"));
|
|
433
431
|
var os_paths_1 = __importDefault(require_mod_cjs());
|
|
434
432
|
exports.adapter = {
|
|
435
433
|
atImportPermissions: { env: true },
|
|
@@ -439,7 +437,7 @@ var require_node2 = __commonJS({
|
|
|
439
437
|
}, "get")
|
|
440
438
|
},
|
|
441
439
|
osPaths: os_paths_1["default"],
|
|
442
|
-
path:
|
|
440
|
+
path: path5,
|
|
443
441
|
process
|
|
444
442
|
};
|
|
445
443
|
}
|
|
@@ -485,7 +483,7 @@ var require_node3 = __commonJS({
|
|
|
485
483
|
};
|
|
486
484
|
exports.__esModule = true;
|
|
487
485
|
exports.adapter = void 0;
|
|
488
|
-
var
|
|
486
|
+
var path5 = __importStar(__require("path"));
|
|
489
487
|
var xdg_portable_1 = __importDefault(require_mod_cjs2());
|
|
490
488
|
exports.adapter = {
|
|
491
489
|
atImportPermissions: { env: true, read: true },
|
|
@@ -500,7 +498,7 @@ var require_node3 = __commonJS({
|
|
|
500
498
|
return process.pkg ? process.execPath : void 0;
|
|
501
499
|
}, "pkgMainFilename")
|
|
502
500
|
},
|
|
503
|
-
path:
|
|
501
|
+
path: path5,
|
|
504
502
|
process,
|
|
505
503
|
xdg: xdg_portable_1["default"]
|
|
506
504
|
};
|
|
@@ -629,2916 +627,6 @@ var defaultWranglerConfig = {
|
|
|
629
627
|
pipelines: [],
|
|
630
628
|
vpc_services: []
|
|
631
629
|
};
|
|
632
|
-
|
|
633
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/error.js
|
|
634
|
-
function getLineColFromPtr(string, ptr) {
|
|
635
|
-
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
636
|
-
return [lines.length, lines.pop().length + 1];
|
|
637
|
-
}
|
|
638
|
-
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
639
|
-
function makeCodeBlock(string, line, column) {
|
|
640
|
-
let lines = string.split(/\r\n|\n|\r/g);
|
|
641
|
-
let codeblock = "";
|
|
642
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
643
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
644
|
-
let l = lines[i - 1];
|
|
645
|
-
if (!l)
|
|
646
|
-
continue;
|
|
647
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
648
|
-
codeblock += ": ";
|
|
649
|
-
codeblock += l;
|
|
650
|
-
codeblock += "\n";
|
|
651
|
-
if (i === line) {
|
|
652
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
653
|
-
codeblock += "^\n";
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
return codeblock;
|
|
657
|
-
}
|
|
658
|
-
__name(makeCodeBlock, "makeCodeBlock");
|
|
659
|
-
var TomlError = class extends Error {
|
|
660
|
-
static {
|
|
661
|
-
__name(this, "TomlError");
|
|
662
|
-
}
|
|
663
|
-
line;
|
|
664
|
-
column;
|
|
665
|
-
codeblock;
|
|
666
|
-
constructor(message, options) {
|
|
667
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
668
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
669
|
-
super(`Invalid TOML document: ${message}
|
|
670
|
-
|
|
671
|
-
${codeblock}`, options);
|
|
672
|
-
this.line = line;
|
|
673
|
-
this.column = column;
|
|
674
|
-
this.codeblock = codeblock;
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/util.js
|
|
679
|
-
function isEscaped(str, ptr) {
|
|
680
|
-
let i = 0;
|
|
681
|
-
while (str[ptr - ++i] === "\\")
|
|
682
|
-
;
|
|
683
|
-
return --i && i % 2;
|
|
684
|
-
}
|
|
685
|
-
__name(isEscaped, "isEscaped");
|
|
686
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
687
|
-
let idx = str.indexOf("\n", start);
|
|
688
|
-
if (str[idx - 1] === "\r")
|
|
689
|
-
idx--;
|
|
690
|
-
return idx <= end ? idx : -1;
|
|
691
|
-
}
|
|
692
|
-
__name(indexOfNewline, "indexOfNewline");
|
|
693
|
-
function skipComment(str, ptr) {
|
|
694
|
-
for (let i = ptr; i < str.length; i++) {
|
|
695
|
-
let c = str[i];
|
|
696
|
-
if (c === "\n")
|
|
697
|
-
return i;
|
|
698
|
-
if (c === "\r" && str[i + 1] === "\n")
|
|
699
|
-
return i + 1;
|
|
700
|
-
if (c < " " && c !== " " || c === "\x7F") {
|
|
701
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
702
|
-
toml: str,
|
|
703
|
-
ptr
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
return str.length;
|
|
708
|
-
}
|
|
709
|
-
__name(skipComment, "skipComment");
|
|
710
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
711
|
-
let c;
|
|
712
|
-
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
713
|
-
ptr++;
|
|
714
|
-
return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
715
|
-
}
|
|
716
|
-
__name(skipVoid, "skipVoid");
|
|
717
|
-
function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
718
|
-
if (!end) {
|
|
719
|
-
ptr = indexOfNewline(str, ptr);
|
|
720
|
-
return ptr < 0 ? str.length : ptr;
|
|
721
|
-
}
|
|
722
|
-
for (let i = ptr; i < str.length; i++) {
|
|
723
|
-
let c = str[i];
|
|
724
|
-
if (c === "#") {
|
|
725
|
-
i = indexOfNewline(str, i);
|
|
726
|
-
} else if (c === sep) {
|
|
727
|
-
return i + 1;
|
|
728
|
-
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
729
|
-
return i;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
throw new TomlError("cannot find end of structure", {
|
|
733
|
-
toml: str,
|
|
734
|
-
ptr
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
__name(skipUntil, "skipUntil");
|
|
738
|
-
function getStringEnd(str, seek) {
|
|
739
|
-
let first = str[seek];
|
|
740
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
741
|
-
seek += target.length - 1;
|
|
742
|
-
do
|
|
743
|
-
seek = str.indexOf(target, ++seek);
|
|
744
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
745
|
-
if (seek > -1) {
|
|
746
|
-
seek += target.length;
|
|
747
|
-
if (target.length > 1) {
|
|
748
|
-
if (str[seek] === first)
|
|
749
|
-
seek++;
|
|
750
|
-
if (str[seek] === first)
|
|
751
|
-
seek++;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
return seek;
|
|
755
|
-
}
|
|
756
|
-
__name(getStringEnd, "getStringEnd");
|
|
757
|
-
|
|
758
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/date.js
|
|
759
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
760
|
-
var TomlDate = class _TomlDate extends Date {
|
|
761
|
-
static {
|
|
762
|
-
__name(this, "TomlDate");
|
|
763
|
-
}
|
|
764
|
-
#hasDate = false;
|
|
765
|
-
#hasTime = false;
|
|
766
|
-
#offset = null;
|
|
767
|
-
constructor(date) {
|
|
768
|
-
let hasDate = true;
|
|
769
|
-
let hasTime = true;
|
|
770
|
-
let offset = "Z";
|
|
771
|
-
if (typeof date === "string") {
|
|
772
|
-
let match = date.match(DATE_TIME_RE);
|
|
773
|
-
if (match) {
|
|
774
|
-
if (!match[1]) {
|
|
775
|
-
hasDate = false;
|
|
776
|
-
date = `0000-01-01T${date}`;
|
|
777
|
-
}
|
|
778
|
-
hasTime = !!match[2];
|
|
779
|
-
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
780
|
-
if (match[2] && +match[2] > 23) {
|
|
781
|
-
date = "";
|
|
782
|
-
} else {
|
|
783
|
-
offset = match[3] || null;
|
|
784
|
-
date = date.toUpperCase();
|
|
785
|
-
if (!offset && hasTime)
|
|
786
|
-
date += "Z";
|
|
787
|
-
}
|
|
788
|
-
} else {
|
|
789
|
-
date = "";
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
super(date);
|
|
793
|
-
if (!isNaN(this.getTime())) {
|
|
794
|
-
this.#hasDate = hasDate;
|
|
795
|
-
this.#hasTime = hasTime;
|
|
796
|
-
this.#offset = offset;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
isDateTime() {
|
|
800
|
-
return this.#hasDate && this.#hasTime;
|
|
801
|
-
}
|
|
802
|
-
isLocal() {
|
|
803
|
-
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
804
|
-
}
|
|
805
|
-
isDate() {
|
|
806
|
-
return this.#hasDate && !this.#hasTime;
|
|
807
|
-
}
|
|
808
|
-
isTime() {
|
|
809
|
-
return this.#hasTime && !this.#hasDate;
|
|
810
|
-
}
|
|
811
|
-
isValid() {
|
|
812
|
-
return this.#hasDate || this.#hasTime;
|
|
813
|
-
}
|
|
814
|
-
toISOString() {
|
|
815
|
-
let iso = super.toISOString();
|
|
816
|
-
if (this.isDate())
|
|
817
|
-
return iso.slice(0, 10);
|
|
818
|
-
if (this.isTime())
|
|
819
|
-
return iso.slice(11, 23);
|
|
820
|
-
if (this.#offset === null)
|
|
821
|
-
return iso.slice(0, -1);
|
|
822
|
-
if (this.#offset === "Z")
|
|
823
|
-
return iso;
|
|
824
|
-
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
825
|
-
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
826
|
-
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
827
|
-
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
828
|
-
}
|
|
829
|
-
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
830
|
-
let date = new _TomlDate(jsDate);
|
|
831
|
-
date.#offset = offset;
|
|
832
|
-
return date;
|
|
833
|
-
}
|
|
834
|
-
static wrapAsLocalDateTime(jsDate) {
|
|
835
|
-
let date = new _TomlDate(jsDate);
|
|
836
|
-
date.#offset = null;
|
|
837
|
-
return date;
|
|
838
|
-
}
|
|
839
|
-
static wrapAsLocalDate(jsDate) {
|
|
840
|
-
let date = new _TomlDate(jsDate);
|
|
841
|
-
date.#hasTime = false;
|
|
842
|
-
date.#offset = null;
|
|
843
|
-
return date;
|
|
844
|
-
}
|
|
845
|
-
static wrapAsLocalTime(jsDate) {
|
|
846
|
-
let date = new _TomlDate(jsDate);
|
|
847
|
-
date.#hasDate = false;
|
|
848
|
-
date.#offset = null;
|
|
849
|
-
return date;
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/primitive.js
|
|
854
|
-
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
855
|
-
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
856
|
-
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
857
|
-
var ESCAPE_REGEX = /^[0-9a-f]{4,8}$/i;
|
|
858
|
-
var ESC_MAP = {
|
|
859
|
-
b: "\b",
|
|
860
|
-
t: " ",
|
|
861
|
-
n: "\n",
|
|
862
|
-
f: "\f",
|
|
863
|
-
r: "\r",
|
|
864
|
-
'"': '"',
|
|
865
|
-
"\\": "\\"
|
|
866
|
-
};
|
|
867
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
868
|
-
let isLiteral = str[ptr] === "'";
|
|
869
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
870
|
-
if (isMultiline) {
|
|
871
|
-
endPtr -= 2;
|
|
872
|
-
if (str[ptr += 2] === "\r")
|
|
873
|
-
ptr++;
|
|
874
|
-
if (str[ptr] === "\n")
|
|
875
|
-
ptr++;
|
|
876
|
-
}
|
|
877
|
-
let tmp = 0;
|
|
878
|
-
let isEscape;
|
|
879
|
-
let parsed = "";
|
|
880
|
-
let sliceStart = ptr;
|
|
881
|
-
while (ptr < endPtr - 1) {
|
|
882
|
-
let c = str[ptr++];
|
|
883
|
-
if (c === "\n" || c === "\r" && str[ptr] === "\n") {
|
|
884
|
-
if (!isMultiline) {
|
|
885
|
-
throw new TomlError("newlines are not allowed in strings", {
|
|
886
|
-
toml: str,
|
|
887
|
-
ptr: ptr - 1
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
891
|
-
throw new TomlError("control characters are not allowed in strings", {
|
|
892
|
-
toml: str,
|
|
893
|
-
ptr: ptr - 1
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
if (isEscape) {
|
|
897
|
-
isEscape = false;
|
|
898
|
-
if (c === "u" || c === "U") {
|
|
899
|
-
let code = str.slice(ptr, ptr += c === "u" ? 4 : 8);
|
|
900
|
-
if (!ESCAPE_REGEX.test(code)) {
|
|
901
|
-
throw new TomlError("invalid unicode escape", {
|
|
902
|
-
toml: str,
|
|
903
|
-
ptr: tmp
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
|
-
try {
|
|
907
|
-
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
908
|
-
} catch {
|
|
909
|
-
throw new TomlError("invalid unicode escape", {
|
|
910
|
-
toml: str,
|
|
911
|
-
ptr: tmp
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
} else if (isMultiline && (c === "\n" || c === " " || c === " " || c === "\r")) {
|
|
915
|
-
ptr = skipVoid(str, ptr - 1, true);
|
|
916
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
917
|
-
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
918
|
-
toml: str,
|
|
919
|
-
ptr: tmp
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
ptr = skipVoid(str, ptr);
|
|
923
|
-
} else if (c in ESC_MAP) {
|
|
924
|
-
parsed += ESC_MAP[c];
|
|
925
|
-
} else {
|
|
926
|
-
throw new TomlError("unrecognized escape sequence", {
|
|
927
|
-
toml: str,
|
|
928
|
-
ptr: tmp
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
sliceStart = ptr;
|
|
932
|
-
} else if (!isLiteral && c === "\\") {
|
|
933
|
-
tmp = ptr - 1;
|
|
934
|
-
isEscape = true;
|
|
935
|
-
parsed += str.slice(sliceStart, tmp);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
939
|
-
}
|
|
940
|
-
__name(parseString, "parseString");
|
|
941
|
-
function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
942
|
-
if (value === "true")
|
|
943
|
-
return true;
|
|
944
|
-
if (value === "false")
|
|
945
|
-
return false;
|
|
946
|
-
if (value === "-inf")
|
|
947
|
-
return -Infinity;
|
|
948
|
-
if (value === "inf" || value === "+inf")
|
|
949
|
-
return Infinity;
|
|
950
|
-
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
951
|
-
return NaN;
|
|
952
|
-
if (value === "-0")
|
|
953
|
-
return integersAsBigInt ? 0n : 0;
|
|
954
|
-
let isInt = INT_REGEX.test(value);
|
|
955
|
-
if (isInt || FLOAT_REGEX.test(value)) {
|
|
956
|
-
if (LEADING_ZERO.test(value)) {
|
|
957
|
-
throw new TomlError("leading zeroes are not allowed", {
|
|
958
|
-
toml,
|
|
959
|
-
ptr
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
value = value.replace(/_/g, "");
|
|
963
|
-
let numeric = +value;
|
|
964
|
-
if (isNaN(numeric)) {
|
|
965
|
-
throw new TomlError("invalid number", {
|
|
966
|
-
toml,
|
|
967
|
-
ptr
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
if (isInt) {
|
|
971
|
-
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
972
|
-
throw new TomlError("integer value cannot be represented losslessly", {
|
|
973
|
-
toml,
|
|
974
|
-
ptr
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
if (isInt || integersAsBigInt === true)
|
|
978
|
-
numeric = BigInt(value);
|
|
979
|
-
}
|
|
980
|
-
return numeric;
|
|
981
|
-
}
|
|
982
|
-
const date = new TomlDate(value);
|
|
983
|
-
if (!date.isValid()) {
|
|
984
|
-
throw new TomlError("invalid value", {
|
|
985
|
-
toml,
|
|
986
|
-
ptr
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
return date;
|
|
990
|
-
}
|
|
991
|
-
__name(parseValue, "parseValue");
|
|
992
|
-
|
|
993
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/extract.js
|
|
994
|
-
function sliceAndTrimEndOf(str, startPtr, endPtr, allowNewLines) {
|
|
995
|
-
let value = str.slice(startPtr, endPtr);
|
|
996
|
-
let commentIdx = value.indexOf("#");
|
|
997
|
-
if (commentIdx > -1) {
|
|
998
|
-
skipComment(str, commentIdx);
|
|
999
|
-
value = value.slice(0, commentIdx);
|
|
1000
|
-
}
|
|
1001
|
-
let trimmed = value.trimEnd();
|
|
1002
|
-
if (!allowNewLines) {
|
|
1003
|
-
let newlineIdx = value.indexOf("\n", trimmed.length);
|
|
1004
|
-
if (newlineIdx > -1) {
|
|
1005
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1006
|
-
toml: str,
|
|
1007
|
-
ptr: startPtr + newlineIdx
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
return [trimmed, commentIdx];
|
|
1012
|
-
}
|
|
1013
|
-
__name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
|
|
1014
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
1015
|
-
if (depth === 0) {
|
|
1016
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
1017
|
-
toml: str,
|
|
1018
|
-
ptr
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
let c = str[ptr];
|
|
1022
|
-
if (c === "[" || c === "{") {
|
|
1023
|
-
let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
1024
|
-
let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
|
|
1025
|
-
if (endPtr2 - newPtr && end === "}") {
|
|
1026
|
-
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
|
|
1027
|
-
if (nextNewLine > -1) {
|
|
1028
|
-
throw new TomlError("newlines are not allowed in inline tables", {
|
|
1029
|
-
toml: str,
|
|
1030
|
-
ptr: nextNewLine
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
return [value, newPtr];
|
|
1035
|
-
}
|
|
1036
|
-
let endPtr;
|
|
1037
|
-
if (c === '"' || c === "'") {
|
|
1038
|
-
endPtr = getStringEnd(str, ptr);
|
|
1039
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
1040
|
-
if (end) {
|
|
1041
|
-
endPtr = skipVoid(str, endPtr, end !== "]");
|
|
1042
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
1043
|
-
throw new TomlError("unexpected character encountered", {
|
|
1044
|
-
toml: str,
|
|
1045
|
-
ptr: endPtr
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
endPtr += +(str[endPtr] === ",");
|
|
1049
|
-
}
|
|
1050
|
-
return [parsed, endPtr];
|
|
1051
|
-
}
|
|
1052
|
-
endPtr = skipUntil(str, ptr, ",", end);
|
|
1053
|
-
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
|
|
1054
|
-
if (!slice[0]) {
|
|
1055
|
-
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
1056
|
-
toml: str,
|
|
1057
|
-
ptr
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
if (end && slice[1] > -1) {
|
|
1061
|
-
endPtr = skipVoid(str, ptr + slice[1]);
|
|
1062
|
-
endPtr += +(str[endPtr] === ",");
|
|
1063
|
-
}
|
|
1064
|
-
return [
|
|
1065
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
1066
|
-
endPtr
|
|
1067
|
-
];
|
|
1068
|
-
}
|
|
1069
|
-
__name(extractValue, "extractValue");
|
|
1070
|
-
|
|
1071
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/struct.js
|
|
1072
|
-
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
1073
|
-
function parseKey(str, ptr, end = "=") {
|
|
1074
|
-
let dot = ptr - 1;
|
|
1075
|
-
let parsed = [];
|
|
1076
|
-
let endPtr = str.indexOf(end, ptr);
|
|
1077
|
-
if (endPtr < 0) {
|
|
1078
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
1079
|
-
toml: str,
|
|
1080
|
-
ptr
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
do {
|
|
1084
|
-
let c = str[ptr = ++dot];
|
|
1085
|
-
if (c !== " " && c !== " ") {
|
|
1086
|
-
if (c === '"' || c === "'") {
|
|
1087
|
-
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
1088
|
-
throw new TomlError("multiline strings are not allowed in keys", {
|
|
1089
|
-
toml: str,
|
|
1090
|
-
ptr
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
let eos = getStringEnd(str, ptr);
|
|
1094
|
-
if (eos < 0) {
|
|
1095
|
-
throw new TomlError("unfinished string encountered", {
|
|
1096
|
-
toml: str,
|
|
1097
|
-
ptr
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
dot = str.indexOf(".", eos);
|
|
1101
|
-
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
1102
|
-
let newLine = indexOfNewline(strEnd);
|
|
1103
|
-
if (newLine > -1) {
|
|
1104
|
-
throw new TomlError("newlines are not allowed in keys", {
|
|
1105
|
-
toml: str,
|
|
1106
|
-
ptr: ptr + dot + newLine
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
if (strEnd.trimStart()) {
|
|
1110
|
-
throw new TomlError("found extra tokens after the string part", {
|
|
1111
|
-
toml: str,
|
|
1112
|
-
ptr: eos
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
if (endPtr < eos) {
|
|
1116
|
-
endPtr = str.indexOf(end, eos);
|
|
1117
|
-
if (endPtr < 0) {
|
|
1118
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
1119
|
-
toml: str,
|
|
1120
|
-
ptr
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
parsed.push(parseString(str, ptr, eos));
|
|
1125
|
-
} else {
|
|
1126
|
-
dot = str.indexOf(".", ptr);
|
|
1127
|
-
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
1128
|
-
if (!KEY_PART_RE.test(part)) {
|
|
1129
|
-
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
1130
|
-
toml: str,
|
|
1131
|
-
ptr
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
parsed.push(part.trimEnd());
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
} while (dot + 1 && dot < endPtr);
|
|
1138
|
-
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
1139
|
-
}
|
|
1140
|
-
__name(parseKey, "parseKey");
|
|
1141
|
-
function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
1142
|
-
let res = {};
|
|
1143
|
-
let seen = /* @__PURE__ */ new Set();
|
|
1144
|
-
let c;
|
|
1145
|
-
let comma = 0;
|
|
1146
|
-
ptr++;
|
|
1147
|
-
while ((c = str[ptr++]) !== "}" && c) {
|
|
1148
|
-
let err = { toml: str, ptr: ptr - 1 };
|
|
1149
|
-
if (c === "\n") {
|
|
1150
|
-
throw new TomlError("newlines are not allowed in inline tables", err);
|
|
1151
|
-
} else if (c === "#") {
|
|
1152
|
-
throw new TomlError("inline tables cannot contain comments", err);
|
|
1153
|
-
} else if (c === ",") {
|
|
1154
|
-
throw new TomlError("expected key-value, found comma", err);
|
|
1155
|
-
} else if (c !== " " && c !== " ") {
|
|
1156
|
-
let k;
|
|
1157
|
-
let t = res;
|
|
1158
|
-
let hasOwn = false;
|
|
1159
|
-
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
1160
|
-
for (let i = 0; i < key.length; i++) {
|
|
1161
|
-
if (i)
|
|
1162
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
1163
|
-
k = key[i];
|
|
1164
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
1165
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
1166
|
-
toml: str,
|
|
1167
|
-
ptr
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
if (!hasOwn && k === "__proto__") {
|
|
1171
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
if (hasOwn) {
|
|
1175
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
1176
|
-
toml: str,
|
|
1177
|
-
ptr
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
1181
|
-
seen.add(value);
|
|
1182
|
-
t[k] = value;
|
|
1183
|
-
ptr = valueEndPtr;
|
|
1184
|
-
comma = str[ptr - 1] === "," ? ptr - 1 : 0;
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
if (comma) {
|
|
1188
|
-
throw new TomlError("trailing commas are not allowed in inline tables", {
|
|
1189
|
-
toml: str,
|
|
1190
|
-
ptr: comma
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
if (!c) {
|
|
1194
|
-
throw new TomlError("unfinished table encountered", {
|
|
1195
|
-
toml: str,
|
|
1196
|
-
ptr
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
return [res, ptr];
|
|
1200
|
-
}
|
|
1201
|
-
__name(parseInlineTable, "parseInlineTable");
|
|
1202
|
-
function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
1203
|
-
let res = [];
|
|
1204
|
-
let c;
|
|
1205
|
-
ptr++;
|
|
1206
|
-
while ((c = str[ptr++]) !== "]" && c) {
|
|
1207
|
-
if (c === ",") {
|
|
1208
|
-
throw new TomlError("expected value, found comma", {
|
|
1209
|
-
toml: str,
|
|
1210
|
-
ptr: ptr - 1
|
|
1211
|
-
});
|
|
1212
|
-
} else if (c === "#")
|
|
1213
|
-
ptr = skipComment(str, ptr);
|
|
1214
|
-
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
1215
|
-
let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
1216
|
-
res.push(e[0]);
|
|
1217
|
-
ptr = e[1];
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
if (!c) {
|
|
1221
|
-
throw new TomlError("unfinished array encountered", {
|
|
1222
|
-
toml: str,
|
|
1223
|
-
ptr
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
return [res, ptr];
|
|
1227
|
-
}
|
|
1228
|
-
__name(parseArray, "parseArray");
|
|
1229
|
-
|
|
1230
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/parse.js
|
|
1231
|
-
function peekTable(key, table, meta, type) {
|
|
1232
|
-
let t = table;
|
|
1233
|
-
let m = meta;
|
|
1234
|
-
let k;
|
|
1235
|
-
let hasOwn = false;
|
|
1236
|
-
let state;
|
|
1237
|
-
for (let i = 0; i < key.length; i++) {
|
|
1238
|
-
if (i) {
|
|
1239
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
1240
|
-
m = (state = m[k]).c;
|
|
1241
|
-
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
1242
|
-
return null;
|
|
1243
|
-
}
|
|
1244
|
-
if (state.t === 2) {
|
|
1245
|
-
let l = t.length - 1;
|
|
1246
|
-
t = t[l];
|
|
1247
|
-
m = m[l].c;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
k = key[i];
|
|
1251
|
-
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
1252
|
-
return null;
|
|
1253
|
-
}
|
|
1254
|
-
if (!hasOwn) {
|
|
1255
|
-
if (k === "__proto__") {
|
|
1256
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
1257
|
-
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
1258
|
-
}
|
|
1259
|
-
m[k] = {
|
|
1260
|
-
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
1261
|
-
d: false,
|
|
1262
|
-
i: 0,
|
|
1263
|
-
c: {}
|
|
1264
|
-
};
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
state = m[k];
|
|
1268
|
-
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
1269
|
-
return null;
|
|
1270
|
-
}
|
|
1271
|
-
if (type === 2) {
|
|
1272
|
-
if (!state.d) {
|
|
1273
|
-
state.d = true;
|
|
1274
|
-
t[k] = [];
|
|
1275
|
-
}
|
|
1276
|
-
t[k].push(t = {});
|
|
1277
|
-
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
1278
|
-
}
|
|
1279
|
-
if (state.d) {
|
|
1280
|
-
return null;
|
|
1281
|
-
}
|
|
1282
|
-
state.d = true;
|
|
1283
|
-
if (type === 1) {
|
|
1284
|
-
t = hasOwn ? t[k] : t[k] = {};
|
|
1285
|
-
} else if (type === 0 && hasOwn) {
|
|
1286
|
-
return null;
|
|
1287
|
-
}
|
|
1288
|
-
return [k, t, state.c];
|
|
1289
|
-
}
|
|
1290
|
-
__name(peekTable, "peekTable");
|
|
1291
|
-
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
1292
|
-
let res = {};
|
|
1293
|
-
let meta = {};
|
|
1294
|
-
let tbl = res;
|
|
1295
|
-
let m = meta;
|
|
1296
|
-
for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
|
|
1297
|
-
if (toml[ptr] === "[") {
|
|
1298
|
-
let isTableArray = toml[++ptr] === "[";
|
|
1299
|
-
let k = parseKey(toml, ptr += +isTableArray, "]");
|
|
1300
|
-
if (isTableArray) {
|
|
1301
|
-
if (toml[k[1] - 1] !== "]") {
|
|
1302
|
-
throw new TomlError("expected end of table declaration", {
|
|
1303
|
-
toml,
|
|
1304
|
-
ptr: k[1] - 1
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
k[1]++;
|
|
1308
|
-
}
|
|
1309
|
-
let p = peekTable(
|
|
1310
|
-
k[0],
|
|
1311
|
-
res,
|
|
1312
|
-
meta,
|
|
1313
|
-
isTableArray ? 2 : 1
|
|
1314
|
-
/* Type.EXPLICIT */
|
|
1315
|
-
);
|
|
1316
|
-
if (!p) {
|
|
1317
|
-
throw new TomlError("trying to redefine an already defined table or value", {
|
|
1318
|
-
toml,
|
|
1319
|
-
ptr
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
m = p[2];
|
|
1323
|
-
tbl = p[1];
|
|
1324
|
-
ptr = k[1];
|
|
1325
|
-
} else {
|
|
1326
|
-
let k = parseKey(toml, ptr);
|
|
1327
|
-
let p = peekTable(
|
|
1328
|
-
k[0],
|
|
1329
|
-
tbl,
|
|
1330
|
-
m,
|
|
1331
|
-
0
|
|
1332
|
-
/* Type.DOTTED */
|
|
1333
|
-
);
|
|
1334
|
-
if (!p) {
|
|
1335
|
-
throw new TomlError("trying to redefine an already defined table or value", {
|
|
1336
|
-
toml,
|
|
1337
|
-
ptr
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
|
|
1341
|
-
p[1][p[0]] = v[0];
|
|
1342
|
-
ptr = v[1];
|
|
1343
|
-
}
|
|
1344
|
-
ptr = skipVoid(toml, ptr, true);
|
|
1345
|
-
if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
|
|
1346
|
-
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
1347
|
-
toml,
|
|
1348
|
-
ptr
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
ptr = skipVoid(toml, ptr);
|
|
1352
|
-
}
|
|
1353
|
-
return res;
|
|
1354
|
-
}
|
|
1355
|
-
__name(parse, "parse");
|
|
1356
|
-
|
|
1357
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/stringify.js
|
|
1358
|
-
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
1359
|
-
function extendedTypeOf(obj) {
|
|
1360
|
-
let type = typeof obj;
|
|
1361
|
-
if (type === "object") {
|
|
1362
|
-
if (Array.isArray(obj))
|
|
1363
|
-
return "array";
|
|
1364
|
-
if (obj instanceof Date)
|
|
1365
|
-
return "date";
|
|
1366
|
-
}
|
|
1367
|
-
return type;
|
|
1368
|
-
}
|
|
1369
|
-
__name(extendedTypeOf, "extendedTypeOf");
|
|
1370
|
-
function isArrayOfTables(obj) {
|
|
1371
|
-
for (let i = 0; i < obj.length; i++) {
|
|
1372
|
-
if (extendedTypeOf(obj[i]) !== "object")
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
return obj.length != 0;
|
|
1376
|
-
}
|
|
1377
|
-
__name(isArrayOfTables, "isArrayOfTables");
|
|
1378
|
-
function formatString(s) {
|
|
1379
|
-
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
1380
|
-
}
|
|
1381
|
-
__name(formatString, "formatString");
|
|
1382
|
-
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
1383
|
-
if (depth === 0) {
|
|
1384
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
1385
|
-
}
|
|
1386
|
-
if (type === "number") {
|
|
1387
|
-
if (isNaN(val))
|
|
1388
|
-
return "nan";
|
|
1389
|
-
if (val === Infinity)
|
|
1390
|
-
return "inf";
|
|
1391
|
-
if (val === -Infinity)
|
|
1392
|
-
return "-inf";
|
|
1393
|
-
if (numberAsFloat && Number.isInteger(val))
|
|
1394
|
-
return val.toFixed(1);
|
|
1395
|
-
return val.toString();
|
|
1396
|
-
}
|
|
1397
|
-
if (type === "bigint" || type === "boolean") {
|
|
1398
|
-
return val.toString();
|
|
1399
|
-
}
|
|
1400
|
-
if (type === "string") {
|
|
1401
|
-
return formatString(val);
|
|
1402
|
-
}
|
|
1403
|
-
if (type === "date") {
|
|
1404
|
-
if (isNaN(val.getTime())) {
|
|
1405
|
-
throw new TypeError("cannot serialize invalid date");
|
|
1406
|
-
}
|
|
1407
|
-
return val.toISOString();
|
|
1408
|
-
}
|
|
1409
|
-
if (type === "object") {
|
|
1410
|
-
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
1411
|
-
}
|
|
1412
|
-
if (type === "array") {
|
|
1413
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
__name(stringifyValue, "stringifyValue");
|
|
1417
|
-
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
1418
|
-
let keys = Object.keys(obj);
|
|
1419
|
-
if (keys.length === 0)
|
|
1420
|
-
return "{}";
|
|
1421
|
-
let res = "{ ";
|
|
1422
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1423
|
-
let k = keys[i];
|
|
1424
|
-
if (i)
|
|
1425
|
-
res += ", ";
|
|
1426
|
-
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
1427
|
-
res += " = ";
|
|
1428
|
-
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
1429
|
-
}
|
|
1430
|
-
return res + " }";
|
|
1431
|
-
}
|
|
1432
|
-
__name(stringifyInlineTable, "stringifyInlineTable");
|
|
1433
|
-
function stringifyArray(array, depth, numberAsFloat) {
|
|
1434
|
-
if (array.length === 0)
|
|
1435
|
-
return "[]";
|
|
1436
|
-
let res = "[ ";
|
|
1437
|
-
for (let i = 0; i < array.length; i++) {
|
|
1438
|
-
if (i)
|
|
1439
|
-
res += ", ";
|
|
1440
|
-
if (array[i] === null || array[i] === void 0) {
|
|
1441
|
-
throw new TypeError("arrays cannot contain null or undefined values");
|
|
1442
|
-
}
|
|
1443
|
-
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
|
|
1444
|
-
}
|
|
1445
|
-
return res + " ]";
|
|
1446
|
-
}
|
|
1447
|
-
__name(stringifyArray, "stringifyArray");
|
|
1448
|
-
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
1449
|
-
if (depth === 0) {
|
|
1450
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
1451
|
-
}
|
|
1452
|
-
let res = "";
|
|
1453
|
-
for (let i = 0; i < array.length; i++) {
|
|
1454
|
-
res += `${res && "\n"}[[${key}]]
|
|
1455
|
-
`;
|
|
1456
|
-
res += stringifyTable(0, array[i], key, depth, numberAsFloat);
|
|
1457
|
-
}
|
|
1458
|
-
return res;
|
|
1459
|
-
}
|
|
1460
|
-
__name(stringifyArrayTable, "stringifyArrayTable");
|
|
1461
|
-
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
1462
|
-
if (depth === 0) {
|
|
1463
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
1464
|
-
}
|
|
1465
|
-
let preamble = "";
|
|
1466
|
-
let tables = "";
|
|
1467
|
-
let keys = Object.keys(obj);
|
|
1468
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1469
|
-
let k = keys[i];
|
|
1470
|
-
if (obj[k] !== null && obj[k] !== void 0) {
|
|
1471
|
-
let type = extendedTypeOf(obj[k]);
|
|
1472
|
-
if (type === "symbol" || type === "function") {
|
|
1473
|
-
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
1474
|
-
}
|
|
1475
|
-
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
1476
|
-
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
1477
|
-
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
1478
|
-
} else if (type === "object") {
|
|
1479
|
-
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
1480
|
-
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
1481
|
-
} else {
|
|
1482
|
-
preamble += key;
|
|
1483
|
-
preamble += " = ";
|
|
1484
|
-
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
1485
|
-
preamble += "\n";
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
if (tableKey && (preamble || !tables))
|
|
1490
|
-
preamble = preamble ? `[${tableKey}]
|
|
1491
|
-
${preamble}` : `[${tableKey}]`;
|
|
1492
|
-
return preamble && tables ? `${preamble}
|
|
1493
|
-
${tables}` : preamble || tables;
|
|
1494
|
-
}
|
|
1495
|
-
__name(stringifyTable, "stringifyTable");
|
|
1496
|
-
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
1497
|
-
if (extendedTypeOf(obj) !== "object") {
|
|
1498
|
-
throw new TypeError("stringify can only be called with an object");
|
|
1499
|
-
}
|
|
1500
|
-
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
1501
|
-
if (str[str.length - 1] !== "\n")
|
|
1502
|
-
return str + "\n";
|
|
1503
|
-
return str;
|
|
1504
|
-
}
|
|
1505
|
-
__name(stringify, "stringify");
|
|
1506
|
-
|
|
1507
|
-
// ../../node_modules/.pnpm/smol-toml@1.5.2/node_modules/smol-toml/dist/index.js
|
|
1508
|
-
var dist_default = { parse, stringify, TomlDate, TomlError };
|
|
1509
|
-
|
|
1510
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
1511
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
1512
|
-
const len = text.length;
|
|
1513
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
1514
|
-
function scanHexDigits(count, exact) {
|
|
1515
|
-
let digits = 0;
|
|
1516
|
-
let value2 = 0;
|
|
1517
|
-
while (digits < count || !exact) {
|
|
1518
|
-
let ch = text.charCodeAt(pos);
|
|
1519
|
-
if (ch >= 48 && ch <= 57) {
|
|
1520
|
-
value2 = value2 * 16 + ch - 48;
|
|
1521
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
1522
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
1523
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
1524
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
1525
|
-
} else {
|
|
1526
|
-
break;
|
|
1527
|
-
}
|
|
1528
|
-
pos++;
|
|
1529
|
-
digits++;
|
|
1530
|
-
}
|
|
1531
|
-
if (digits < count) {
|
|
1532
|
-
value2 = -1;
|
|
1533
|
-
}
|
|
1534
|
-
return value2;
|
|
1535
|
-
}
|
|
1536
|
-
__name(scanHexDigits, "scanHexDigits");
|
|
1537
|
-
function setPosition(newPosition) {
|
|
1538
|
-
pos = newPosition;
|
|
1539
|
-
value = "";
|
|
1540
|
-
tokenOffset = 0;
|
|
1541
|
-
token = 16;
|
|
1542
|
-
scanError = 0;
|
|
1543
|
-
}
|
|
1544
|
-
__name(setPosition, "setPosition");
|
|
1545
|
-
function scanNumber() {
|
|
1546
|
-
let start = pos;
|
|
1547
|
-
if (text.charCodeAt(pos) === 48) {
|
|
1548
|
-
pos++;
|
|
1549
|
-
} else {
|
|
1550
|
-
pos++;
|
|
1551
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
1552
|
-
pos++;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
1556
|
-
pos++;
|
|
1557
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
1558
|
-
pos++;
|
|
1559
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
1560
|
-
pos++;
|
|
1561
|
-
}
|
|
1562
|
-
} else {
|
|
1563
|
-
scanError = 3;
|
|
1564
|
-
return text.substring(start, pos);
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
let end = pos;
|
|
1568
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
1569
|
-
pos++;
|
|
1570
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
1571
|
-
pos++;
|
|
1572
|
-
}
|
|
1573
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
1574
|
-
pos++;
|
|
1575
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
1576
|
-
pos++;
|
|
1577
|
-
}
|
|
1578
|
-
end = pos;
|
|
1579
|
-
} else {
|
|
1580
|
-
scanError = 3;
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
return text.substring(start, end);
|
|
1584
|
-
}
|
|
1585
|
-
__name(scanNumber, "scanNumber");
|
|
1586
|
-
function scanString() {
|
|
1587
|
-
let result = "", start = pos;
|
|
1588
|
-
while (true) {
|
|
1589
|
-
if (pos >= len) {
|
|
1590
|
-
result += text.substring(start, pos);
|
|
1591
|
-
scanError = 2;
|
|
1592
|
-
break;
|
|
1593
|
-
}
|
|
1594
|
-
const ch = text.charCodeAt(pos);
|
|
1595
|
-
if (ch === 34) {
|
|
1596
|
-
result += text.substring(start, pos);
|
|
1597
|
-
pos++;
|
|
1598
|
-
break;
|
|
1599
|
-
}
|
|
1600
|
-
if (ch === 92) {
|
|
1601
|
-
result += text.substring(start, pos);
|
|
1602
|
-
pos++;
|
|
1603
|
-
if (pos >= len) {
|
|
1604
|
-
scanError = 2;
|
|
1605
|
-
break;
|
|
1606
|
-
}
|
|
1607
|
-
const ch2 = text.charCodeAt(pos++);
|
|
1608
|
-
switch (ch2) {
|
|
1609
|
-
case 34:
|
|
1610
|
-
result += '"';
|
|
1611
|
-
break;
|
|
1612
|
-
case 92:
|
|
1613
|
-
result += "\\";
|
|
1614
|
-
break;
|
|
1615
|
-
case 47:
|
|
1616
|
-
result += "/";
|
|
1617
|
-
break;
|
|
1618
|
-
case 98:
|
|
1619
|
-
result += "\b";
|
|
1620
|
-
break;
|
|
1621
|
-
case 102:
|
|
1622
|
-
result += "\f";
|
|
1623
|
-
break;
|
|
1624
|
-
case 110:
|
|
1625
|
-
result += "\n";
|
|
1626
|
-
break;
|
|
1627
|
-
case 114:
|
|
1628
|
-
result += "\r";
|
|
1629
|
-
break;
|
|
1630
|
-
case 116:
|
|
1631
|
-
result += " ";
|
|
1632
|
-
break;
|
|
1633
|
-
case 117:
|
|
1634
|
-
const ch3 = scanHexDigits(4, true);
|
|
1635
|
-
if (ch3 >= 0) {
|
|
1636
|
-
result += String.fromCharCode(ch3);
|
|
1637
|
-
} else {
|
|
1638
|
-
scanError = 4;
|
|
1639
|
-
}
|
|
1640
|
-
break;
|
|
1641
|
-
default:
|
|
1642
|
-
scanError = 5;
|
|
1643
|
-
}
|
|
1644
|
-
start = pos;
|
|
1645
|
-
continue;
|
|
1646
|
-
}
|
|
1647
|
-
if (ch >= 0 && ch <= 31) {
|
|
1648
|
-
if (isLineBreak(ch)) {
|
|
1649
|
-
result += text.substring(start, pos);
|
|
1650
|
-
scanError = 2;
|
|
1651
|
-
break;
|
|
1652
|
-
} else {
|
|
1653
|
-
scanError = 6;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
pos++;
|
|
1657
|
-
}
|
|
1658
|
-
return result;
|
|
1659
|
-
}
|
|
1660
|
-
__name(scanString, "scanString");
|
|
1661
|
-
function scanNext() {
|
|
1662
|
-
value = "";
|
|
1663
|
-
scanError = 0;
|
|
1664
|
-
tokenOffset = pos;
|
|
1665
|
-
lineStartOffset = lineNumber;
|
|
1666
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
1667
|
-
if (pos >= len) {
|
|
1668
|
-
tokenOffset = len;
|
|
1669
|
-
return token = 17;
|
|
1670
|
-
}
|
|
1671
|
-
let code = text.charCodeAt(pos);
|
|
1672
|
-
if (isWhiteSpace(code)) {
|
|
1673
|
-
do {
|
|
1674
|
-
pos++;
|
|
1675
|
-
value += String.fromCharCode(code);
|
|
1676
|
-
code = text.charCodeAt(pos);
|
|
1677
|
-
} while (isWhiteSpace(code));
|
|
1678
|
-
return token = 15;
|
|
1679
|
-
}
|
|
1680
|
-
if (isLineBreak(code)) {
|
|
1681
|
-
pos++;
|
|
1682
|
-
value += String.fromCharCode(code);
|
|
1683
|
-
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
1684
|
-
pos++;
|
|
1685
|
-
value += "\n";
|
|
1686
|
-
}
|
|
1687
|
-
lineNumber++;
|
|
1688
|
-
tokenLineStartOffset = pos;
|
|
1689
|
-
return token = 14;
|
|
1690
|
-
}
|
|
1691
|
-
switch (code) {
|
|
1692
|
-
// tokens: []{}:,
|
|
1693
|
-
case 123:
|
|
1694
|
-
pos++;
|
|
1695
|
-
return token = 1;
|
|
1696
|
-
case 125:
|
|
1697
|
-
pos++;
|
|
1698
|
-
return token = 2;
|
|
1699
|
-
case 91:
|
|
1700
|
-
pos++;
|
|
1701
|
-
return token = 3;
|
|
1702
|
-
case 93:
|
|
1703
|
-
pos++;
|
|
1704
|
-
return token = 4;
|
|
1705
|
-
case 58:
|
|
1706
|
-
pos++;
|
|
1707
|
-
return token = 6;
|
|
1708
|
-
case 44:
|
|
1709
|
-
pos++;
|
|
1710
|
-
return token = 5;
|
|
1711
|
-
// strings
|
|
1712
|
-
case 34:
|
|
1713
|
-
pos++;
|
|
1714
|
-
value = scanString();
|
|
1715
|
-
return token = 10;
|
|
1716
|
-
// comments
|
|
1717
|
-
case 47:
|
|
1718
|
-
const start = pos - 1;
|
|
1719
|
-
if (text.charCodeAt(pos + 1) === 47) {
|
|
1720
|
-
pos += 2;
|
|
1721
|
-
while (pos < len) {
|
|
1722
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
1723
|
-
break;
|
|
1724
|
-
}
|
|
1725
|
-
pos++;
|
|
1726
|
-
}
|
|
1727
|
-
value = text.substring(start, pos);
|
|
1728
|
-
return token = 12;
|
|
1729
|
-
}
|
|
1730
|
-
if (text.charCodeAt(pos + 1) === 42) {
|
|
1731
|
-
pos += 2;
|
|
1732
|
-
const safeLength = len - 1;
|
|
1733
|
-
let commentClosed = false;
|
|
1734
|
-
while (pos < safeLength) {
|
|
1735
|
-
const ch = text.charCodeAt(pos);
|
|
1736
|
-
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
1737
|
-
pos += 2;
|
|
1738
|
-
commentClosed = true;
|
|
1739
|
-
break;
|
|
1740
|
-
}
|
|
1741
|
-
pos++;
|
|
1742
|
-
if (isLineBreak(ch)) {
|
|
1743
|
-
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
1744
|
-
pos++;
|
|
1745
|
-
}
|
|
1746
|
-
lineNumber++;
|
|
1747
|
-
tokenLineStartOffset = pos;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
if (!commentClosed) {
|
|
1751
|
-
pos++;
|
|
1752
|
-
scanError = 1;
|
|
1753
|
-
}
|
|
1754
|
-
value = text.substring(start, pos);
|
|
1755
|
-
return token = 13;
|
|
1756
|
-
}
|
|
1757
|
-
value += String.fromCharCode(code);
|
|
1758
|
-
pos++;
|
|
1759
|
-
return token = 16;
|
|
1760
|
-
// numbers
|
|
1761
|
-
case 45:
|
|
1762
|
-
value += String.fromCharCode(code);
|
|
1763
|
-
pos++;
|
|
1764
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
1765
|
-
return token = 16;
|
|
1766
|
-
}
|
|
1767
|
-
// found a minus, followed by a number so
|
|
1768
|
-
// we fall through to proceed with scanning
|
|
1769
|
-
// numbers
|
|
1770
|
-
case 48:
|
|
1771
|
-
case 49:
|
|
1772
|
-
case 50:
|
|
1773
|
-
case 51:
|
|
1774
|
-
case 52:
|
|
1775
|
-
case 53:
|
|
1776
|
-
case 54:
|
|
1777
|
-
case 55:
|
|
1778
|
-
case 56:
|
|
1779
|
-
case 57:
|
|
1780
|
-
value += scanNumber();
|
|
1781
|
-
return token = 11;
|
|
1782
|
-
// literals and unknown symbols
|
|
1783
|
-
default:
|
|
1784
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
1785
|
-
pos++;
|
|
1786
|
-
code = text.charCodeAt(pos);
|
|
1787
|
-
}
|
|
1788
|
-
if (tokenOffset !== pos) {
|
|
1789
|
-
value = text.substring(tokenOffset, pos);
|
|
1790
|
-
switch (value) {
|
|
1791
|
-
case "true":
|
|
1792
|
-
return token = 8;
|
|
1793
|
-
case "false":
|
|
1794
|
-
return token = 9;
|
|
1795
|
-
case "null":
|
|
1796
|
-
return token = 7;
|
|
1797
|
-
}
|
|
1798
|
-
return token = 16;
|
|
1799
|
-
}
|
|
1800
|
-
value += String.fromCharCode(code);
|
|
1801
|
-
pos++;
|
|
1802
|
-
return token = 16;
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
__name(scanNext, "scanNext");
|
|
1806
|
-
function isUnknownContentCharacter(code) {
|
|
1807
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
1808
|
-
return false;
|
|
1809
|
-
}
|
|
1810
|
-
switch (code) {
|
|
1811
|
-
case 125:
|
|
1812
|
-
case 93:
|
|
1813
|
-
case 123:
|
|
1814
|
-
case 91:
|
|
1815
|
-
case 34:
|
|
1816
|
-
case 58:
|
|
1817
|
-
case 44:
|
|
1818
|
-
case 47:
|
|
1819
|
-
return false;
|
|
1820
|
-
}
|
|
1821
|
-
return true;
|
|
1822
|
-
}
|
|
1823
|
-
__name(isUnknownContentCharacter, "isUnknownContentCharacter");
|
|
1824
|
-
function scanNextNonTrivia() {
|
|
1825
|
-
let result;
|
|
1826
|
-
do {
|
|
1827
|
-
result = scanNext();
|
|
1828
|
-
} while (result >= 12 && result <= 15);
|
|
1829
|
-
return result;
|
|
1830
|
-
}
|
|
1831
|
-
__name(scanNextNonTrivia, "scanNextNonTrivia");
|
|
1832
|
-
return {
|
|
1833
|
-
setPosition,
|
|
1834
|
-
getPosition: /* @__PURE__ */ __name(() => pos, "getPosition"),
|
|
1835
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
1836
|
-
getToken: /* @__PURE__ */ __name(() => token, "getToken"),
|
|
1837
|
-
getTokenValue: /* @__PURE__ */ __name(() => value, "getTokenValue"),
|
|
1838
|
-
getTokenOffset: /* @__PURE__ */ __name(() => tokenOffset, "getTokenOffset"),
|
|
1839
|
-
getTokenLength: /* @__PURE__ */ __name(() => pos - tokenOffset, "getTokenLength"),
|
|
1840
|
-
getTokenStartLine: /* @__PURE__ */ __name(() => lineStartOffset, "getTokenStartLine"),
|
|
1841
|
-
getTokenStartCharacter: /* @__PURE__ */ __name(() => tokenOffset - prevTokenLineStartOffset, "getTokenStartCharacter"),
|
|
1842
|
-
getTokenError: /* @__PURE__ */ __name(() => scanError, "getTokenError")
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
__name(createScanner, "createScanner");
|
|
1846
|
-
function isWhiteSpace(ch) {
|
|
1847
|
-
return ch === 32 || ch === 9;
|
|
1848
|
-
}
|
|
1849
|
-
__name(isWhiteSpace, "isWhiteSpace");
|
|
1850
|
-
function isLineBreak(ch) {
|
|
1851
|
-
return ch === 10 || ch === 13;
|
|
1852
|
-
}
|
|
1853
|
-
__name(isLineBreak, "isLineBreak");
|
|
1854
|
-
function isDigit(ch) {
|
|
1855
|
-
return ch >= 48 && ch <= 57;
|
|
1856
|
-
}
|
|
1857
|
-
__name(isDigit, "isDigit");
|
|
1858
|
-
var CharacterCodes;
|
|
1859
|
-
(function(CharacterCodes2) {
|
|
1860
|
-
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
1861
|
-
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
1862
|
-
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
1863
|
-
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
1864
|
-
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
1865
|
-
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
1866
|
-
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
1867
|
-
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
1868
|
-
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
1869
|
-
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
1870
|
-
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
1871
|
-
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
1872
|
-
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
1873
|
-
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
1874
|
-
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
1875
|
-
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
1876
|
-
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
1877
|
-
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
1878
|
-
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
1879
|
-
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
1880
|
-
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
1881
|
-
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
1882
|
-
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
1883
|
-
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
1884
|
-
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
1885
|
-
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
1886
|
-
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
1887
|
-
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
1888
|
-
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
1889
|
-
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
1890
|
-
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
1891
|
-
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
1892
|
-
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
1893
|
-
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
1894
|
-
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
1895
|
-
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
1896
|
-
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
1897
|
-
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
1898
|
-
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
1899
|
-
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
1900
|
-
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
1901
|
-
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
1902
|
-
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
1903
|
-
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
1904
|
-
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
1905
|
-
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
1906
|
-
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
1907
|
-
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
1908
|
-
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
1909
|
-
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
1910
|
-
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
1911
|
-
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
1912
|
-
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
1913
|
-
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
1914
|
-
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
1915
|
-
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
1916
|
-
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
1917
|
-
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
1918
|
-
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
1919
|
-
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
1920
|
-
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
1921
|
-
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
1922
|
-
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
1923
|
-
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
1924
|
-
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
1925
|
-
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
1926
|
-
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
1927
|
-
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
1928
|
-
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
1929
|
-
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
1930
|
-
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
1931
|
-
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
1932
|
-
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
1933
|
-
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
1934
|
-
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
1935
|
-
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
1936
|
-
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
1937
|
-
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
1938
|
-
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
1939
|
-
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
1940
|
-
})(CharacterCodes || (CharacterCodes = {}));
|
|
1941
|
-
|
|
1942
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
1943
|
-
function format(documentText, range, options) {
|
|
1944
|
-
let initialIndentLevel;
|
|
1945
|
-
let formatText;
|
|
1946
|
-
let formatTextStart;
|
|
1947
|
-
let rangeStart;
|
|
1948
|
-
let rangeEnd;
|
|
1949
|
-
if (range) {
|
|
1950
|
-
rangeStart = range.offset;
|
|
1951
|
-
rangeEnd = rangeStart + range.length;
|
|
1952
|
-
formatTextStart = rangeStart;
|
|
1953
|
-
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
1954
|
-
formatTextStart--;
|
|
1955
|
-
}
|
|
1956
|
-
let endOffset = rangeEnd;
|
|
1957
|
-
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
1958
|
-
endOffset++;
|
|
1959
|
-
}
|
|
1960
|
-
formatText = documentText.substring(formatTextStart, endOffset);
|
|
1961
|
-
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
1962
|
-
} else {
|
|
1963
|
-
formatText = documentText;
|
|
1964
|
-
initialIndentLevel = 0;
|
|
1965
|
-
formatTextStart = 0;
|
|
1966
|
-
rangeStart = 0;
|
|
1967
|
-
rangeEnd = documentText.length;
|
|
1968
|
-
}
|
|
1969
|
-
const eol = getEOL(options, documentText);
|
|
1970
|
-
let numberLineBreaks = 0;
|
|
1971
|
-
let indentLevel = 0;
|
|
1972
|
-
let indentValue;
|
|
1973
|
-
if (options.insertSpaces) {
|
|
1974
|
-
indentValue = repeat(" ", options.tabSize || 4);
|
|
1975
|
-
} else {
|
|
1976
|
-
indentValue = " ";
|
|
1977
|
-
}
|
|
1978
|
-
let scanner = createScanner(formatText, false);
|
|
1979
|
-
let hasError = false;
|
|
1980
|
-
function newLinesAndIndent() {
|
|
1981
|
-
if (numberLineBreaks > 1) {
|
|
1982
|
-
return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
1983
|
-
} else {
|
|
1984
|
-
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
__name(newLinesAndIndent, "newLinesAndIndent");
|
|
1988
|
-
function scanNext() {
|
|
1989
|
-
let token = scanner.scan();
|
|
1990
|
-
numberLineBreaks = 0;
|
|
1991
|
-
while (token === 15 || token === 14) {
|
|
1992
|
-
if (token === 14 && options.keepLines) {
|
|
1993
|
-
numberLineBreaks += 1;
|
|
1994
|
-
} else if (token === 14) {
|
|
1995
|
-
numberLineBreaks = 1;
|
|
1996
|
-
}
|
|
1997
|
-
token = scanner.scan();
|
|
1998
|
-
}
|
|
1999
|
-
hasError = token === 16 || scanner.getTokenError() !== 0;
|
|
2000
|
-
return token;
|
|
2001
|
-
}
|
|
2002
|
-
__name(scanNext, "scanNext");
|
|
2003
|
-
const editOperations = [];
|
|
2004
|
-
function addEdit(text, startOffset, endOffset) {
|
|
2005
|
-
if (!hasError && (!range || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
|
|
2006
|
-
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
__name(addEdit, "addEdit");
|
|
2010
|
-
let firstToken = scanNext();
|
|
2011
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
2012
|
-
addEdit(repeat(eol, numberLineBreaks), 0, 0);
|
|
2013
|
-
}
|
|
2014
|
-
if (firstToken !== 17) {
|
|
2015
|
-
let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
2016
|
-
let initialIndent = repeat(indentValue, initialIndentLevel);
|
|
2017
|
-
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
2018
|
-
}
|
|
2019
|
-
while (firstToken !== 17) {
|
|
2020
|
-
let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
2021
|
-
let secondToken = scanNext();
|
|
2022
|
-
let replaceContent = "";
|
|
2023
|
-
let needsLineBreak = false;
|
|
2024
|
-
while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
|
|
2025
|
-
let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
2026
|
-
addEdit(" ", firstTokenEnd, commentTokenStart);
|
|
2027
|
-
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
2028
|
-
needsLineBreak = secondToken === 12;
|
|
2029
|
-
replaceContent = needsLineBreak ? newLinesAndIndent() : "";
|
|
2030
|
-
secondToken = scanNext();
|
|
2031
|
-
}
|
|
2032
|
-
if (secondToken === 2) {
|
|
2033
|
-
if (firstToken !== 1) {
|
|
2034
|
-
indentLevel--;
|
|
2035
|
-
}
|
|
2036
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
|
|
2037
|
-
replaceContent = newLinesAndIndent();
|
|
2038
|
-
} else if (options.keepLines) {
|
|
2039
|
-
replaceContent = " ";
|
|
2040
|
-
}
|
|
2041
|
-
} else if (secondToken === 4) {
|
|
2042
|
-
if (firstToken !== 3) {
|
|
2043
|
-
indentLevel--;
|
|
2044
|
-
}
|
|
2045
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
|
|
2046
|
-
replaceContent = newLinesAndIndent();
|
|
2047
|
-
} else if (options.keepLines) {
|
|
2048
|
-
replaceContent = " ";
|
|
2049
|
-
}
|
|
2050
|
-
} else {
|
|
2051
|
-
switch (firstToken) {
|
|
2052
|
-
case 3:
|
|
2053
|
-
case 1:
|
|
2054
|
-
indentLevel++;
|
|
2055
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
2056
|
-
replaceContent = newLinesAndIndent();
|
|
2057
|
-
} else {
|
|
2058
|
-
replaceContent = " ";
|
|
2059
|
-
}
|
|
2060
|
-
break;
|
|
2061
|
-
case 5:
|
|
2062
|
-
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
2063
|
-
replaceContent = newLinesAndIndent();
|
|
2064
|
-
} else {
|
|
2065
|
-
replaceContent = " ";
|
|
2066
|
-
}
|
|
2067
|
-
break;
|
|
2068
|
-
case 12:
|
|
2069
|
-
replaceContent = newLinesAndIndent();
|
|
2070
|
-
break;
|
|
2071
|
-
case 13:
|
|
2072
|
-
if (numberLineBreaks > 0) {
|
|
2073
|
-
replaceContent = newLinesAndIndent();
|
|
2074
|
-
} else if (!needsLineBreak) {
|
|
2075
|
-
replaceContent = " ";
|
|
2076
|
-
}
|
|
2077
|
-
break;
|
|
2078
|
-
case 6:
|
|
2079
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
2080
|
-
replaceContent = newLinesAndIndent();
|
|
2081
|
-
} else if (!needsLineBreak) {
|
|
2082
|
-
replaceContent = " ";
|
|
2083
|
-
}
|
|
2084
|
-
break;
|
|
2085
|
-
case 10:
|
|
2086
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
2087
|
-
replaceContent = newLinesAndIndent();
|
|
2088
|
-
} else if (secondToken === 6 && !needsLineBreak) {
|
|
2089
|
-
replaceContent = "";
|
|
2090
|
-
}
|
|
2091
|
-
break;
|
|
2092
|
-
case 7:
|
|
2093
|
-
case 8:
|
|
2094
|
-
case 9:
|
|
2095
|
-
case 11:
|
|
2096
|
-
case 2:
|
|
2097
|
-
case 4:
|
|
2098
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
2099
|
-
replaceContent = newLinesAndIndent();
|
|
2100
|
-
} else {
|
|
2101
|
-
if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
|
|
2102
|
-
replaceContent = " ";
|
|
2103
|
-
} else if (secondToken !== 5 && secondToken !== 17) {
|
|
2104
|
-
hasError = true;
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
break;
|
|
2108
|
-
case 16:
|
|
2109
|
-
hasError = true;
|
|
2110
|
-
break;
|
|
2111
|
-
}
|
|
2112
|
-
if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
|
|
2113
|
-
replaceContent = newLinesAndIndent();
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
if (secondToken === 17) {
|
|
2117
|
-
if (options.keepLines && numberLineBreaks > 0) {
|
|
2118
|
-
replaceContent = newLinesAndIndent();
|
|
2119
|
-
} else {
|
|
2120
|
-
replaceContent = options.insertFinalNewline ? eol : "";
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
2124
|
-
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
2125
|
-
firstToken = secondToken;
|
|
2126
|
-
}
|
|
2127
|
-
return editOperations;
|
|
2128
|
-
}
|
|
2129
|
-
__name(format, "format");
|
|
2130
|
-
function repeat(s, count) {
|
|
2131
|
-
let result = "";
|
|
2132
|
-
for (let i = 0; i < count; i++) {
|
|
2133
|
-
result += s;
|
|
2134
|
-
}
|
|
2135
|
-
return result;
|
|
2136
|
-
}
|
|
2137
|
-
__name(repeat, "repeat");
|
|
2138
|
-
function computeIndentLevel(content, options) {
|
|
2139
|
-
let i = 0;
|
|
2140
|
-
let nChars = 0;
|
|
2141
|
-
const tabSize = options.tabSize || 4;
|
|
2142
|
-
while (i < content.length) {
|
|
2143
|
-
let ch = content.charAt(i);
|
|
2144
|
-
if (ch === " ") {
|
|
2145
|
-
nChars++;
|
|
2146
|
-
} else if (ch === " ") {
|
|
2147
|
-
nChars += tabSize;
|
|
2148
|
-
} else {
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
i++;
|
|
2152
|
-
}
|
|
2153
|
-
return Math.floor(nChars / tabSize);
|
|
2154
|
-
}
|
|
2155
|
-
__name(computeIndentLevel, "computeIndentLevel");
|
|
2156
|
-
function getEOL(options, text) {
|
|
2157
|
-
for (let i = 0; i < text.length; i++) {
|
|
2158
|
-
const ch = text.charAt(i);
|
|
2159
|
-
if (ch === "\r") {
|
|
2160
|
-
if (i + 1 < text.length && text.charAt(i + 1) === "\n") {
|
|
2161
|
-
return "\r\n";
|
|
2162
|
-
}
|
|
2163
|
-
return "\r";
|
|
2164
|
-
} else if (ch === "\n") {
|
|
2165
|
-
return "\n";
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
return options && options.eol || "\n";
|
|
2169
|
-
}
|
|
2170
|
-
__name(getEOL, "getEOL");
|
|
2171
|
-
function isEOL(text, offset) {
|
|
2172
|
-
return "\r\n".indexOf(text.charAt(offset)) !== -1;
|
|
2173
|
-
}
|
|
2174
|
-
__name(isEOL, "isEOL");
|
|
2175
|
-
|
|
2176
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
2177
|
-
var ParseOptions;
|
|
2178
|
-
(function(ParseOptions2) {
|
|
2179
|
-
ParseOptions2.DEFAULT = {
|
|
2180
|
-
allowTrailingComma: false
|
|
2181
|
-
};
|
|
2182
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
2183
|
-
function parse2(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
2184
|
-
let currentProperty = null;
|
|
2185
|
-
let currentParent = [];
|
|
2186
|
-
const previousParents = [];
|
|
2187
|
-
function onValue(value) {
|
|
2188
|
-
if (Array.isArray(currentParent)) {
|
|
2189
|
-
currentParent.push(value);
|
|
2190
|
-
} else if (currentProperty !== null) {
|
|
2191
|
-
currentParent[currentProperty] = value;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
__name(onValue, "onValue");
|
|
2195
|
-
const visitor = {
|
|
2196
|
-
onObjectBegin: /* @__PURE__ */ __name(() => {
|
|
2197
|
-
const object = {};
|
|
2198
|
-
onValue(object);
|
|
2199
|
-
previousParents.push(currentParent);
|
|
2200
|
-
currentParent = object;
|
|
2201
|
-
currentProperty = null;
|
|
2202
|
-
}, "onObjectBegin"),
|
|
2203
|
-
onObjectProperty: /* @__PURE__ */ __name((name) => {
|
|
2204
|
-
currentProperty = name;
|
|
2205
|
-
}, "onObjectProperty"),
|
|
2206
|
-
onObjectEnd: /* @__PURE__ */ __name(() => {
|
|
2207
|
-
currentParent = previousParents.pop();
|
|
2208
|
-
}, "onObjectEnd"),
|
|
2209
|
-
onArrayBegin: /* @__PURE__ */ __name(() => {
|
|
2210
|
-
const array = [];
|
|
2211
|
-
onValue(array);
|
|
2212
|
-
previousParents.push(currentParent);
|
|
2213
|
-
currentParent = array;
|
|
2214
|
-
currentProperty = null;
|
|
2215
|
-
}, "onArrayBegin"),
|
|
2216
|
-
onArrayEnd: /* @__PURE__ */ __name(() => {
|
|
2217
|
-
currentParent = previousParents.pop();
|
|
2218
|
-
}, "onArrayEnd"),
|
|
2219
|
-
onLiteralValue: onValue,
|
|
2220
|
-
onError: /* @__PURE__ */ __name((error, offset, length) => {
|
|
2221
|
-
errors.push({ error, offset, length });
|
|
2222
|
-
}, "onError")
|
|
2223
|
-
};
|
|
2224
|
-
visit(text, visitor, options);
|
|
2225
|
-
return currentParent[0];
|
|
2226
|
-
}
|
|
2227
|
-
__name(parse2, "parse");
|
|
2228
|
-
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
2229
|
-
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
2230
|
-
function ensurePropertyComplete(endOffset) {
|
|
2231
|
-
if (currentParent.type === "property") {
|
|
2232
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
2233
|
-
currentParent = currentParent.parent;
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
__name(ensurePropertyComplete, "ensurePropertyComplete");
|
|
2237
|
-
function onValue(valueNode) {
|
|
2238
|
-
currentParent.children.push(valueNode);
|
|
2239
|
-
return valueNode;
|
|
2240
|
-
}
|
|
2241
|
-
__name(onValue, "onValue");
|
|
2242
|
-
const visitor = {
|
|
2243
|
-
onObjectBegin: /* @__PURE__ */ __name((offset) => {
|
|
2244
|
-
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
2245
|
-
}, "onObjectBegin"),
|
|
2246
|
-
onObjectProperty: /* @__PURE__ */ __name((name, offset, length) => {
|
|
2247
|
-
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
2248
|
-
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
2249
|
-
}, "onObjectProperty"),
|
|
2250
|
-
onObjectEnd: /* @__PURE__ */ __name((offset, length) => {
|
|
2251
|
-
ensurePropertyComplete(offset + length);
|
|
2252
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
2253
|
-
currentParent = currentParent.parent;
|
|
2254
|
-
ensurePropertyComplete(offset + length);
|
|
2255
|
-
}, "onObjectEnd"),
|
|
2256
|
-
onArrayBegin: /* @__PURE__ */ __name((offset, length) => {
|
|
2257
|
-
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
2258
|
-
}, "onArrayBegin"),
|
|
2259
|
-
onArrayEnd: /* @__PURE__ */ __name((offset, length) => {
|
|
2260
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
2261
|
-
currentParent = currentParent.parent;
|
|
2262
|
-
ensurePropertyComplete(offset + length);
|
|
2263
|
-
}, "onArrayEnd"),
|
|
2264
|
-
onLiteralValue: /* @__PURE__ */ __name((value, offset, length) => {
|
|
2265
|
-
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
2266
|
-
ensurePropertyComplete(offset + length);
|
|
2267
|
-
}, "onLiteralValue"),
|
|
2268
|
-
onSeparator: /* @__PURE__ */ __name((sep, offset, length) => {
|
|
2269
|
-
if (currentParent.type === "property") {
|
|
2270
|
-
if (sep === ":") {
|
|
2271
|
-
currentParent.colonOffset = offset;
|
|
2272
|
-
} else if (sep === ",") {
|
|
2273
|
-
ensurePropertyComplete(offset);
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
}, "onSeparator"),
|
|
2277
|
-
onError: /* @__PURE__ */ __name((error, offset, length) => {
|
|
2278
|
-
errors.push({ error, offset, length });
|
|
2279
|
-
}, "onError")
|
|
2280
|
-
};
|
|
2281
|
-
visit(text, visitor, options);
|
|
2282
|
-
const result = currentParent.children[0];
|
|
2283
|
-
if (result) {
|
|
2284
|
-
delete result.parent;
|
|
2285
|
-
}
|
|
2286
|
-
return result;
|
|
2287
|
-
}
|
|
2288
|
-
__name(parseTree, "parseTree");
|
|
2289
|
-
function findNodeAtLocation(root, path8) {
|
|
2290
|
-
if (!root) {
|
|
2291
|
-
return void 0;
|
|
2292
|
-
}
|
|
2293
|
-
let node = root;
|
|
2294
|
-
for (let segment of path8) {
|
|
2295
|
-
if (typeof segment === "string") {
|
|
2296
|
-
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
2297
|
-
return void 0;
|
|
2298
|
-
}
|
|
2299
|
-
let found = false;
|
|
2300
|
-
for (const propertyNode of node.children) {
|
|
2301
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
2302
|
-
node = propertyNode.children[1];
|
|
2303
|
-
found = true;
|
|
2304
|
-
break;
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
if (!found) {
|
|
2308
|
-
return void 0;
|
|
2309
|
-
}
|
|
2310
|
-
} else {
|
|
2311
|
-
const index = segment;
|
|
2312
|
-
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
2313
|
-
return void 0;
|
|
2314
|
-
}
|
|
2315
|
-
node = node.children[index];
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
return node;
|
|
2319
|
-
}
|
|
2320
|
-
__name(findNodeAtLocation, "findNodeAtLocation");
|
|
2321
|
-
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
2322
|
-
const _scanner = createScanner(text, false);
|
|
2323
|
-
const _jsonPath = [];
|
|
2324
|
-
function toNoArgVisit(visitFunction) {
|
|
2325
|
-
return visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
2326
|
-
}
|
|
2327
|
-
__name(toNoArgVisit, "toNoArgVisit");
|
|
2328
|
-
function toNoArgVisitWithPath(visitFunction) {
|
|
2329
|
-
return visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
2330
|
-
}
|
|
2331
|
-
__name(toNoArgVisitWithPath, "toNoArgVisitWithPath");
|
|
2332
|
-
function toOneArgVisit(visitFunction) {
|
|
2333
|
-
return visitFunction ? (arg) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
2334
|
-
}
|
|
2335
|
-
__name(toOneArgVisit, "toOneArgVisit");
|
|
2336
|
-
function toOneArgVisitWithPath(visitFunction) {
|
|
2337
|
-
return visitFunction ? (arg) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
2338
|
-
}
|
|
2339
|
-
__name(toOneArgVisitWithPath, "toOneArgVisitWithPath");
|
|
2340
|
-
const onObjectBegin = toNoArgVisitWithPath(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisitWithPath(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
2341
|
-
const disallowComments = options && options.disallowComments;
|
|
2342
|
-
const allowTrailingComma = options && options.allowTrailingComma;
|
|
2343
|
-
function scanNext() {
|
|
2344
|
-
while (true) {
|
|
2345
|
-
const token = _scanner.scan();
|
|
2346
|
-
switch (_scanner.getTokenError()) {
|
|
2347
|
-
case 4:
|
|
2348
|
-
handleError(
|
|
2349
|
-
14
|
|
2350
|
-
/* ParseErrorCode.InvalidUnicode */
|
|
2351
|
-
);
|
|
2352
|
-
break;
|
|
2353
|
-
case 5:
|
|
2354
|
-
handleError(
|
|
2355
|
-
15
|
|
2356
|
-
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
2357
|
-
);
|
|
2358
|
-
break;
|
|
2359
|
-
case 3:
|
|
2360
|
-
handleError(
|
|
2361
|
-
13
|
|
2362
|
-
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
2363
|
-
);
|
|
2364
|
-
break;
|
|
2365
|
-
case 1:
|
|
2366
|
-
if (!disallowComments) {
|
|
2367
|
-
handleError(
|
|
2368
|
-
11
|
|
2369
|
-
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
2370
|
-
);
|
|
2371
|
-
}
|
|
2372
|
-
break;
|
|
2373
|
-
case 2:
|
|
2374
|
-
handleError(
|
|
2375
|
-
12
|
|
2376
|
-
/* ParseErrorCode.UnexpectedEndOfString */
|
|
2377
|
-
);
|
|
2378
|
-
break;
|
|
2379
|
-
case 6:
|
|
2380
|
-
handleError(
|
|
2381
|
-
16
|
|
2382
|
-
/* ParseErrorCode.InvalidCharacter */
|
|
2383
|
-
);
|
|
2384
|
-
break;
|
|
2385
|
-
}
|
|
2386
|
-
switch (token) {
|
|
2387
|
-
case 12:
|
|
2388
|
-
case 13:
|
|
2389
|
-
if (disallowComments) {
|
|
2390
|
-
handleError(
|
|
2391
|
-
10
|
|
2392
|
-
/* ParseErrorCode.InvalidCommentToken */
|
|
2393
|
-
);
|
|
2394
|
-
} else {
|
|
2395
|
-
onComment();
|
|
2396
|
-
}
|
|
2397
|
-
break;
|
|
2398
|
-
case 16:
|
|
2399
|
-
handleError(
|
|
2400
|
-
1
|
|
2401
|
-
/* ParseErrorCode.InvalidSymbol */
|
|
2402
|
-
);
|
|
2403
|
-
break;
|
|
2404
|
-
case 15:
|
|
2405
|
-
case 14:
|
|
2406
|
-
break;
|
|
2407
|
-
default:
|
|
2408
|
-
return token;
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
__name(scanNext, "scanNext");
|
|
2413
|
-
function handleError(error, skipUntilAfter = [], skipUntil2 = []) {
|
|
2414
|
-
onError(error);
|
|
2415
|
-
if (skipUntilAfter.length + skipUntil2.length > 0) {
|
|
2416
|
-
let token = _scanner.getToken();
|
|
2417
|
-
while (token !== 17) {
|
|
2418
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
2419
|
-
scanNext();
|
|
2420
|
-
break;
|
|
2421
|
-
} else if (skipUntil2.indexOf(token) !== -1) {
|
|
2422
|
-
break;
|
|
2423
|
-
}
|
|
2424
|
-
token = scanNext();
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
__name(handleError, "handleError");
|
|
2429
|
-
function parseString2(isValue) {
|
|
2430
|
-
const value = _scanner.getTokenValue();
|
|
2431
|
-
if (isValue) {
|
|
2432
|
-
onLiteralValue(value);
|
|
2433
|
-
} else {
|
|
2434
|
-
onObjectProperty(value);
|
|
2435
|
-
_jsonPath.push(value);
|
|
2436
|
-
}
|
|
2437
|
-
scanNext();
|
|
2438
|
-
return true;
|
|
2439
|
-
}
|
|
2440
|
-
__name(parseString2, "parseString");
|
|
2441
|
-
function parseLiteral() {
|
|
2442
|
-
switch (_scanner.getToken()) {
|
|
2443
|
-
case 11:
|
|
2444
|
-
const tokenValue = _scanner.getTokenValue();
|
|
2445
|
-
let value = Number(tokenValue);
|
|
2446
|
-
if (isNaN(value)) {
|
|
2447
|
-
handleError(
|
|
2448
|
-
2
|
|
2449
|
-
/* ParseErrorCode.InvalidNumberFormat */
|
|
2450
|
-
);
|
|
2451
|
-
value = 0;
|
|
2452
|
-
}
|
|
2453
|
-
onLiteralValue(value);
|
|
2454
|
-
break;
|
|
2455
|
-
case 7:
|
|
2456
|
-
onLiteralValue(null);
|
|
2457
|
-
break;
|
|
2458
|
-
case 8:
|
|
2459
|
-
onLiteralValue(true);
|
|
2460
|
-
break;
|
|
2461
|
-
case 9:
|
|
2462
|
-
onLiteralValue(false);
|
|
2463
|
-
break;
|
|
2464
|
-
default:
|
|
2465
|
-
return false;
|
|
2466
|
-
}
|
|
2467
|
-
scanNext();
|
|
2468
|
-
return true;
|
|
2469
|
-
}
|
|
2470
|
-
__name(parseLiteral, "parseLiteral");
|
|
2471
|
-
function parseProperty() {
|
|
2472
|
-
if (_scanner.getToken() !== 10) {
|
|
2473
|
-
handleError(3, [], [
|
|
2474
|
-
2,
|
|
2475
|
-
5
|
|
2476
|
-
/* SyntaxKind.CommaToken */
|
|
2477
|
-
]);
|
|
2478
|
-
return false;
|
|
2479
|
-
}
|
|
2480
|
-
parseString2(false);
|
|
2481
|
-
if (_scanner.getToken() === 6) {
|
|
2482
|
-
onSeparator(":");
|
|
2483
|
-
scanNext();
|
|
2484
|
-
if (!parseValue2()) {
|
|
2485
|
-
handleError(4, [], [
|
|
2486
|
-
2,
|
|
2487
|
-
5
|
|
2488
|
-
/* SyntaxKind.CommaToken */
|
|
2489
|
-
]);
|
|
2490
|
-
}
|
|
2491
|
-
} else {
|
|
2492
|
-
handleError(5, [], [
|
|
2493
|
-
2,
|
|
2494
|
-
5
|
|
2495
|
-
/* SyntaxKind.CommaToken */
|
|
2496
|
-
]);
|
|
2497
|
-
}
|
|
2498
|
-
_jsonPath.pop();
|
|
2499
|
-
return true;
|
|
2500
|
-
}
|
|
2501
|
-
__name(parseProperty, "parseProperty");
|
|
2502
|
-
function parseObject() {
|
|
2503
|
-
onObjectBegin();
|
|
2504
|
-
scanNext();
|
|
2505
|
-
let needsComma = false;
|
|
2506
|
-
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
2507
|
-
if (_scanner.getToken() === 5) {
|
|
2508
|
-
if (!needsComma) {
|
|
2509
|
-
handleError(4, [], []);
|
|
2510
|
-
}
|
|
2511
|
-
onSeparator(",");
|
|
2512
|
-
scanNext();
|
|
2513
|
-
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
2514
|
-
break;
|
|
2515
|
-
}
|
|
2516
|
-
} else if (needsComma) {
|
|
2517
|
-
handleError(6, [], []);
|
|
2518
|
-
}
|
|
2519
|
-
if (!parseProperty()) {
|
|
2520
|
-
handleError(4, [], [
|
|
2521
|
-
2,
|
|
2522
|
-
5
|
|
2523
|
-
/* SyntaxKind.CommaToken */
|
|
2524
|
-
]);
|
|
2525
|
-
}
|
|
2526
|
-
needsComma = true;
|
|
2527
|
-
}
|
|
2528
|
-
onObjectEnd();
|
|
2529
|
-
if (_scanner.getToken() !== 2) {
|
|
2530
|
-
handleError(7, [
|
|
2531
|
-
2
|
|
2532
|
-
/* SyntaxKind.CloseBraceToken */
|
|
2533
|
-
], []);
|
|
2534
|
-
} else {
|
|
2535
|
-
scanNext();
|
|
2536
|
-
}
|
|
2537
|
-
return true;
|
|
2538
|
-
}
|
|
2539
|
-
__name(parseObject, "parseObject");
|
|
2540
|
-
function parseArray2() {
|
|
2541
|
-
onArrayBegin();
|
|
2542
|
-
scanNext();
|
|
2543
|
-
let isFirstElement = true;
|
|
2544
|
-
let needsComma = false;
|
|
2545
|
-
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
2546
|
-
if (_scanner.getToken() === 5) {
|
|
2547
|
-
if (!needsComma) {
|
|
2548
|
-
handleError(4, [], []);
|
|
2549
|
-
}
|
|
2550
|
-
onSeparator(",");
|
|
2551
|
-
scanNext();
|
|
2552
|
-
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
} else if (needsComma) {
|
|
2556
|
-
handleError(6, [], []);
|
|
2557
|
-
}
|
|
2558
|
-
if (isFirstElement) {
|
|
2559
|
-
_jsonPath.push(0);
|
|
2560
|
-
isFirstElement = false;
|
|
2561
|
-
} else {
|
|
2562
|
-
_jsonPath[_jsonPath.length - 1]++;
|
|
2563
|
-
}
|
|
2564
|
-
if (!parseValue2()) {
|
|
2565
|
-
handleError(4, [], [
|
|
2566
|
-
4,
|
|
2567
|
-
5
|
|
2568
|
-
/* SyntaxKind.CommaToken */
|
|
2569
|
-
]);
|
|
2570
|
-
}
|
|
2571
|
-
needsComma = true;
|
|
2572
|
-
}
|
|
2573
|
-
onArrayEnd();
|
|
2574
|
-
if (!isFirstElement) {
|
|
2575
|
-
_jsonPath.pop();
|
|
2576
|
-
}
|
|
2577
|
-
if (_scanner.getToken() !== 4) {
|
|
2578
|
-
handleError(8, [
|
|
2579
|
-
4
|
|
2580
|
-
/* SyntaxKind.CloseBracketToken */
|
|
2581
|
-
], []);
|
|
2582
|
-
} else {
|
|
2583
|
-
scanNext();
|
|
2584
|
-
}
|
|
2585
|
-
return true;
|
|
2586
|
-
}
|
|
2587
|
-
__name(parseArray2, "parseArray");
|
|
2588
|
-
function parseValue2() {
|
|
2589
|
-
switch (_scanner.getToken()) {
|
|
2590
|
-
case 3:
|
|
2591
|
-
return parseArray2();
|
|
2592
|
-
case 1:
|
|
2593
|
-
return parseObject();
|
|
2594
|
-
case 10:
|
|
2595
|
-
return parseString2(true);
|
|
2596
|
-
default:
|
|
2597
|
-
return parseLiteral();
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
__name(parseValue2, "parseValue");
|
|
2601
|
-
scanNext();
|
|
2602
|
-
if (_scanner.getToken() === 17) {
|
|
2603
|
-
if (options.allowEmptyContent) {
|
|
2604
|
-
return true;
|
|
2605
|
-
}
|
|
2606
|
-
handleError(4, [], []);
|
|
2607
|
-
return false;
|
|
2608
|
-
}
|
|
2609
|
-
if (!parseValue2()) {
|
|
2610
|
-
handleError(4, [], []);
|
|
2611
|
-
return false;
|
|
2612
|
-
}
|
|
2613
|
-
if (_scanner.getToken() !== 17) {
|
|
2614
|
-
handleError(9, [], []);
|
|
2615
|
-
}
|
|
2616
|
-
return true;
|
|
2617
|
-
}
|
|
2618
|
-
__name(visit, "visit");
|
|
2619
|
-
function getNodeType(value) {
|
|
2620
|
-
switch (typeof value) {
|
|
2621
|
-
case "boolean":
|
|
2622
|
-
return "boolean";
|
|
2623
|
-
case "number":
|
|
2624
|
-
return "number";
|
|
2625
|
-
case "string":
|
|
2626
|
-
return "string";
|
|
2627
|
-
case "object": {
|
|
2628
|
-
if (!value) {
|
|
2629
|
-
return "null";
|
|
2630
|
-
} else if (Array.isArray(value)) {
|
|
2631
|
-
return "array";
|
|
2632
|
-
}
|
|
2633
|
-
return "object";
|
|
2634
|
-
}
|
|
2635
|
-
default:
|
|
2636
|
-
return "null";
|
|
2637
|
-
}
|
|
2638
|
-
}
|
|
2639
|
-
__name(getNodeType, "getNodeType");
|
|
2640
|
-
|
|
2641
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
2642
|
-
function setProperty(text, originalPath, value, options) {
|
|
2643
|
-
const path8 = originalPath.slice();
|
|
2644
|
-
const errors = [];
|
|
2645
|
-
const root = parseTree(text, errors);
|
|
2646
|
-
let parent = void 0;
|
|
2647
|
-
let lastSegment = void 0;
|
|
2648
|
-
while (path8.length > 0) {
|
|
2649
|
-
lastSegment = path8.pop();
|
|
2650
|
-
parent = findNodeAtLocation(root, path8);
|
|
2651
|
-
if (parent === void 0 && value !== void 0) {
|
|
2652
|
-
if (typeof lastSegment === "string") {
|
|
2653
|
-
value = { [lastSegment]: value };
|
|
2654
|
-
} else {
|
|
2655
|
-
value = [value];
|
|
2656
|
-
}
|
|
2657
|
-
} else {
|
|
2658
|
-
break;
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
if (!parent) {
|
|
2662
|
-
if (value === void 0) {
|
|
2663
|
-
throw new Error("Can not delete in empty document");
|
|
2664
|
-
}
|
|
2665
|
-
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
2666
|
-
} else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
|
|
2667
|
-
const existing = findNodeAtLocation(parent, [lastSegment]);
|
|
2668
|
-
if (existing !== void 0) {
|
|
2669
|
-
if (value === void 0) {
|
|
2670
|
-
if (!existing.parent) {
|
|
2671
|
-
throw new Error("Malformed AST");
|
|
2672
|
-
}
|
|
2673
|
-
const propertyIndex = parent.children.indexOf(existing.parent);
|
|
2674
|
-
let removeBegin;
|
|
2675
|
-
let removeEnd = existing.parent.offset + existing.parent.length;
|
|
2676
|
-
if (propertyIndex > 0) {
|
|
2677
|
-
let previous = parent.children[propertyIndex - 1];
|
|
2678
|
-
removeBegin = previous.offset + previous.length;
|
|
2679
|
-
} else {
|
|
2680
|
-
removeBegin = parent.offset + 1;
|
|
2681
|
-
if (parent.children.length > 1) {
|
|
2682
|
-
let next = parent.children[1];
|
|
2683
|
-
removeEnd = next.offset;
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
|
|
2687
|
-
} else {
|
|
2688
|
-
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
2689
|
-
}
|
|
2690
|
-
} else {
|
|
2691
|
-
if (value === void 0) {
|
|
2692
|
-
return [];
|
|
2693
|
-
}
|
|
2694
|
-
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
|
|
2695
|
-
const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
|
|
2696
|
-
let edit;
|
|
2697
|
-
if (index > 0) {
|
|
2698
|
-
let previous = parent.children[index - 1];
|
|
2699
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
2700
|
-
} else if (parent.children.length === 0) {
|
|
2701
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
2702
|
-
} else {
|
|
2703
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
|
|
2704
|
-
}
|
|
2705
|
-
return withFormatting(text, edit, options);
|
|
2706
|
-
}
|
|
2707
|
-
} else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
|
|
2708
|
-
const insertIndex = lastSegment;
|
|
2709
|
-
if (insertIndex === -1) {
|
|
2710
|
-
const newProperty = `${JSON.stringify(value)}`;
|
|
2711
|
-
let edit;
|
|
2712
|
-
if (parent.children.length === 0) {
|
|
2713
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
2714
|
-
} else {
|
|
2715
|
-
const previous = parent.children[parent.children.length - 1];
|
|
2716
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
2717
|
-
}
|
|
2718
|
-
return withFormatting(text, edit, options);
|
|
2719
|
-
} else if (value === void 0 && parent.children.length >= 0) {
|
|
2720
|
-
const removalIndex = lastSegment;
|
|
2721
|
-
const toRemove = parent.children[removalIndex];
|
|
2722
|
-
let edit;
|
|
2723
|
-
if (parent.children.length === 1) {
|
|
2724
|
-
edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
|
|
2725
|
-
} else if (parent.children.length - 1 === removalIndex) {
|
|
2726
|
-
let previous = parent.children[removalIndex - 1];
|
|
2727
|
-
let offset = previous.offset + previous.length;
|
|
2728
|
-
let parentEndOffset = parent.offset + parent.length;
|
|
2729
|
-
edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
|
|
2730
|
-
} else {
|
|
2731
|
-
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
|
|
2732
|
-
}
|
|
2733
|
-
return withFormatting(text, edit, options);
|
|
2734
|
-
} else if (value !== void 0) {
|
|
2735
|
-
let edit;
|
|
2736
|
-
const newProperty = `${JSON.stringify(value)}`;
|
|
2737
|
-
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
2738
|
-
const toModify = parent.children[lastSegment];
|
|
2739
|
-
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
2740
|
-
} else if (parent.children.length === 0 || lastSegment === 0) {
|
|
2741
|
-
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
|
|
2742
|
-
} else {
|
|
2743
|
-
const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
2744
|
-
const previous = parent.children[index - 1];
|
|
2745
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
2746
|
-
}
|
|
2747
|
-
return withFormatting(text, edit, options);
|
|
2748
|
-
} else {
|
|
2749
|
-
throw new Error(`Can not ${value === void 0 ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
|
|
2750
|
-
}
|
|
2751
|
-
} else {
|
|
2752
|
-
throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
|
|
2753
|
-
}
|
|
2754
|
-
}
|
|
2755
|
-
__name(setProperty, "setProperty");
|
|
2756
|
-
function withFormatting(text, edit, options) {
|
|
2757
|
-
if (!options.formattingOptions) {
|
|
2758
|
-
return [edit];
|
|
2759
|
-
}
|
|
2760
|
-
let newText = applyEdit(text, edit);
|
|
2761
|
-
let begin = edit.offset;
|
|
2762
|
-
let end = edit.offset + edit.content.length;
|
|
2763
|
-
if (edit.length === 0 || edit.content.length === 0) {
|
|
2764
|
-
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
2765
|
-
begin--;
|
|
2766
|
-
}
|
|
2767
|
-
while (end < newText.length && !isEOL(newText, end)) {
|
|
2768
|
-
end++;
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
const edits = format(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
|
|
2772
|
-
for (let i = edits.length - 1; i >= 0; i--) {
|
|
2773
|
-
const edit2 = edits[i];
|
|
2774
|
-
newText = applyEdit(newText, edit2);
|
|
2775
|
-
begin = Math.min(begin, edit2.offset);
|
|
2776
|
-
end = Math.max(end, edit2.offset + edit2.length);
|
|
2777
|
-
end += edit2.content.length - edit2.length;
|
|
2778
|
-
}
|
|
2779
|
-
const editLength = text.length - (newText.length - end) - begin;
|
|
2780
|
-
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
2781
|
-
}
|
|
2782
|
-
__name(withFormatting, "withFormatting");
|
|
2783
|
-
function applyEdit(text, edit) {
|
|
2784
|
-
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
2785
|
-
}
|
|
2786
|
-
__name(applyEdit, "applyEdit");
|
|
2787
|
-
|
|
2788
|
-
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/main.js
|
|
2789
|
-
var ScanError;
|
|
2790
|
-
(function(ScanError2) {
|
|
2791
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
2792
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
2793
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
2794
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
2795
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
2796
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
2797
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
2798
|
-
})(ScanError || (ScanError = {}));
|
|
2799
|
-
var SyntaxKind;
|
|
2800
|
-
(function(SyntaxKind2) {
|
|
2801
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
2802
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
2803
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
2804
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
2805
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
2806
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
2807
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
2808
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
2809
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
2810
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
2811
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
2812
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
2813
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
2814
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
2815
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
2816
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
2817
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
2818
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
2819
|
-
var parse3 = parse2;
|
|
2820
|
-
var ParseErrorCode;
|
|
2821
|
-
(function(ParseErrorCode2) {
|
|
2822
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
2823
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
2824
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
2825
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
2826
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
2827
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
2828
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
2829
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
2830
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
2831
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
2832
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
2833
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
2834
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
2835
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
2836
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
2837
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
2838
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
2839
|
-
function printParseErrorCode(code) {
|
|
2840
|
-
switch (code) {
|
|
2841
|
-
case 1:
|
|
2842
|
-
return "InvalidSymbol";
|
|
2843
|
-
case 2:
|
|
2844
|
-
return "InvalidNumberFormat";
|
|
2845
|
-
case 3:
|
|
2846
|
-
return "PropertyNameExpected";
|
|
2847
|
-
case 4:
|
|
2848
|
-
return "ValueExpected";
|
|
2849
|
-
case 5:
|
|
2850
|
-
return "ColonExpected";
|
|
2851
|
-
case 6:
|
|
2852
|
-
return "CommaExpected";
|
|
2853
|
-
case 7:
|
|
2854
|
-
return "CloseBraceExpected";
|
|
2855
|
-
case 8:
|
|
2856
|
-
return "CloseBracketExpected";
|
|
2857
|
-
case 9:
|
|
2858
|
-
return "EndOfFileExpected";
|
|
2859
|
-
case 10:
|
|
2860
|
-
return "InvalidCommentToken";
|
|
2861
|
-
case 11:
|
|
2862
|
-
return "UnexpectedEndOfComment";
|
|
2863
|
-
case 12:
|
|
2864
|
-
return "UnexpectedEndOfString";
|
|
2865
|
-
case 13:
|
|
2866
|
-
return "UnexpectedEndOfNumber";
|
|
2867
|
-
case 14:
|
|
2868
|
-
return "InvalidUnicode";
|
|
2869
|
-
case 15:
|
|
2870
|
-
return "InvalidEscapeCharacter";
|
|
2871
|
-
case 16:
|
|
2872
|
-
return "InvalidCharacter";
|
|
2873
|
-
}
|
|
2874
|
-
return "<unknown ParseErrorCode>";
|
|
2875
|
-
}
|
|
2876
|
-
__name(printParseErrorCode, "printParseErrorCode");
|
|
2877
|
-
function format2(documentText, range, options) {
|
|
2878
|
-
return format(documentText, range, options);
|
|
2879
|
-
}
|
|
2880
|
-
__name(format2, "format");
|
|
2881
|
-
function modify(text, path8, value, options) {
|
|
2882
|
-
return setProperty(text, path8, value, options);
|
|
2883
|
-
}
|
|
2884
|
-
__name(modify, "modify");
|
|
2885
|
-
function applyEdits(text, edits) {
|
|
2886
|
-
let sortedEdits = edits.slice(0).sort((a, b) => {
|
|
2887
|
-
const diff = a.offset - b.offset;
|
|
2888
|
-
if (diff === 0) {
|
|
2889
|
-
return a.length - b.length;
|
|
2890
|
-
}
|
|
2891
|
-
return diff;
|
|
2892
|
-
});
|
|
2893
|
-
let lastModifiedOffset = text.length;
|
|
2894
|
-
for (let i = sortedEdits.length - 1; i >= 0; i--) {
|
|
2895
|
-
let e = sortedEdits[i];
|
|
2896
|
-
if (e.offset + e.length <= lastModifiedOffset) {
|
|
2897
|
-
text = applyEdit(text, e);
|
|
2898
|
-
} else {
|
|
2899
|
-
throw new Error("Overlapping edit");
|
|
2900
|
-
}
|
|
2901
|
-
lastModifiedOffset = e.offset;
|
|
2902
|
-
}
|
|
2903
|
-
return text;
|
|
2904
|
-
}
|
|
2905
|
-
__name(applyEdits, "applyEdits");
|
|
2906
|
-
|
|
2907
|
-
// src/errors.ts
|
|
2908
|
-
var UserError = class extends Error {
|
|
2909
|
-
static {
|
|
2910
|
-
__name(this, "UserError");
|
|
2911
|
-
}
|
|
2912
|
-
telemetryMessage;
|
|
2913
|
-
constructor(message, options) {
|
|
2914
|
-
super(message, options);
|
|
2915
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
2916
|
-
this.telemetryMessage = options?.telemetryMessage === true ? message : options?.telemetryMessage;
|
|
2917
|
-
}
|
|
2918
|
-
};
|
|
2919
|
-
var DeprecationError = class extends UserError {
|
|
2920
|
-
static {
|
|
2921
|
-
__name(this, "DeprecationError");
|
|
2922
|
-
}
|
|
2923
|
-
constructor(message, options) {
|
|
2924
|
-
super(`Deprecation:
|
|
2925
|
-
${message}`, options);
|
|
2926
|
-
}
|
|
2927
|
-
};
|
|
2928
|
-
var FatalError = class extends UserError {
|
|
2929
|
-
constructor(message, code, options) {
|
|
2930
|
-
super(message, options);
|
|
2931
|
-
this.code = code;
|
|
2932
|
-
}
|
|
2933
|
-
static {
|
|
2934
|
-
__name(this, "FatalError");
|
|
2935
|
-
}
|
|
2936
|
-
};
|
|
2937
|
-
var CommandLineArgsError = class extends UserError {
|
|
2938
|
-
static {
|
|
2939
|
-
__name(this, "CommandLineArgsError");
|
|
2940
|
-
}
|
|
2941
|
-
};
|
|
2942
|
-
var JsonFriendlyFatalError = class extends FatalError {
|
|
2943
|
-
constructor(message, code, options) {
|
|
2944
|
-
super(message, code, options);
|
|
2945
|
-
this.code = code;
|
|
2946
|
-
}
|
|
2947
|
-
static {
|
|
2948
|
-
__name(this, "JsonFriendlyFatalError");
|
|
2949
|
-
}
|
|
2950
|
-
};
|
|
2951
|
-
var MissingConfigError = class extends Error {
|
|
2952
|
-
static {
|
|
2953
|
-
__name(this, "MissingConfigError");
|
|
2954
|
-
}
|
|
2955
|
-
telemetryMessage;
|
|
2956
|
-
constructor(key) {
|
|
2957
|
-
super(`Missing config value for ${key}`);
|
|
2958
|
-
this.telemetryMessage = `Missing config value for ${key}`;
|
|
2959
|
-
}
|
|
2960
|
-
};
|
|
2961
|
-
function createFatalError(message, isJson, code, telemetryMessage) {
|
|
2962
|
-
if (isJson) {
|
|
2963
|
-
return new JsonFriendlyFatalError(
|
|
2964
|
-
JSON.stringify(message),
|
|
2965
|
-
code,
|
|
2966
|
-
telemetryMessage
|
|
2967
|
-
);
|
|
2968
|
-
} else {
|
|
2969
|
-
return new FatalError(`${message}`, code, telemetryMessage);
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
__name(createFatalError, "createFatalError");
|
|
2973
|
-
|
|
2974
|
-
// src/parse.ts
|
|
2975
|
-
var ParseError = class extends UserError {
|
|
2976
|
-
static {
|
|
2977
|
-
__name(this, "ParseError");
|
|
2978
|
-
}
|
|
2979
|
-
text;
|
|
2980
|
-
notes;
|
|
2981
|
-
location;
|
|
2982
|
-
kind;
|
|
2983
|
-
constructor({ text, notes, location, kind, telemetryMessage }) {
|
|
2984
|
-
super(text, { telemetryMessage });
|
|
2985
|
-
this.name = this.constructor.name;
|
|
2986
|
-
this.text = text;
|
|
2987
|
-
this.notes = notes ?? [];
|
|
2988
|
-
this.location = location;
|
|
2989
|
-
this.kind = kind ?? "error";
|
|
2990
|
-
}
|
|
2991
|
-
};
|
|
2992
|
-
var APIError = class extends ParseError {
|
|
2993
|
-
static {
|
|
2994
|
-
__name(this, "APIError");
|
|
2995
|
-
}
|
|
2996
|
-
#status;
|
|
2997
|
-
code;
|
|
2998
|
-
accountTag;
|
|
2999
|
-
constructor({ status, ...rest }) {
|
|
3000
|
-
super(rest);
|
|
3001
|
-
this.name = this.constructor.name;
|
|
3002
|
-
this.#status = status;
|
|
3003
|
-
}
|
|
3004
|
-
isGatewayError() {
|
|
3005
|
-
if (this.#status !== void 0) {
|
|
3006
|
-
return [524].includes(this.#status);
|
|
3007
|
-
}
|
|
3008
|
-
return false;
|
|
3009
|
-
}
|
|
3010
|
-
isRetryable() {
|
|
3011
|
-
return String(this.#status).startsWith("5");
|
|
3012
|
-
}
|
|
3013
|
-
// Allow `APIError`s to be marked as handled.
|
|
3014
|
-
#reportable = true;
|
|
3015
|
-
get reportable() {
|
|
3016
|
-
return this.#reportable;
|
|
3017
|
-
}
|
|
3018
|
-
preventReport() {
|
|
3019
|
-
this.#reportable = false;
|
|
3020
|
-
}
|
|
3021
|
-
};
|
|
3022
|
-
function parseTOML(input, file) {
|
|
3023
|
-
try {
|
|
3024
|
-
return dist_default.parse(input);
|
|
3025
|
-
} catch (err) {
|
|
3026
|
-
if (!(err instanceof TomlError)) {
|
|
3027
|
-
throw err;
|
|
3028
|
-
}
|
|
3029
|
-
const location = {
|
|
3030
|
-
lineText: input.split("\n")[err.line - 1],
|
|
3031
|
-
line: err.line,
|
|
3032
|
-
column: err.column - 1,
|
|
3033
|
-
file,
|
|
3034
|
-
fileText: input
|
|
3035
|
-
};
|
|
3036
|
-
throw new ParseError({
|
|
3037
|
-
text: err.message.substring(0, err.message.indexOf("\n")),
|
|
3038
|
-
location,
|
|
3039
|
-
telemetryMessage: "TOML parse error"
|
|
3040
|
-
});
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
__name(parseTOML, "parseTOML");
|
|
3044
|
-
function parsePackageJSON(input, file) {
|
|
3045
|
-
return parseJSON(input, file);
|
|
3046
|
-
}
|
|
3047
|
-
__name(parsePackageJSON, "parsePackageJSON");
|
|
3048
|
-
function parseJSON(input, file) {
|
|
3049
|
-
return parseJSONC(input, file, {
|
|
3050
|
-
allowEmptyContent: false,
|
|
3051
|
-
allowTrailingComma: false,
|
|
3052
|
-
disallowComments: true
|
|
3053
|
-
});
|
|
3054
|
-
}
|
|
3055
|
-
__name(parseJSON, "parseJSON");
|
|
3056
|
-
function parseJSONC(input, file, options = { allowTrailingComma: true }) {
|
|
3057
|
-
const errors = [];
|
|
3058
|
-
const data = parse3(input, errors, options);
|
|
3059
|
-
if (errors.length) {
|
|
3060
|
-
throw new ParseError({
|
|
3061
|
-
text: printParseErrorCode(errors[0].error),
|
|
3062
|
-
location: {
|
|
3063
|
-
...indexLocation({ file, fileText: input }, errors[0].offset + 1),
|
|
3064
|
-
length: errors[0].length
|
|
3065
|
-
},
|
|
3066
|
-
telemetryMessage: "JSON(C) parse error"
|
|
3067
|
-
});
|
|
3068
|
-
}
|
|
3069
|
-
return data;
|
|
3070
|
-
}
|
|
3071
|
-
__name(parseJSONC, "parseJSONC");
|
|
3072
|
-
function readFileSyncToBuffer(file) {
|
|
3073
|
-
try {
|
|
3074
|
-
return readFileSync$1(file);
|
|
3075
|
-
} catch (err) {
|
|
3076
|
-
const { message } = err;
|
|
3077
|
-
throw new ParseError({
|
|
3078
|
-
text: `Could not read file: ${file}`,
|
|
3079
|
-
notes: [
|
|
3080
|
-
{
|
|
3081
|
-
text: message.replace(file, resolve(file))
|
|
3082
|
-
}
|
|
3083
|
-
]
|
|
3084
|
-
});
|
|
3085
|
-
}
|
|
3086
|
-
}
|
|
3087
|
-
__name(readFileSyncToBuffer, "readFileSyncToBuffer");
|
|
3088
|
-
function readFileSync(file) {
|
|
3089
|
-
try {
|
|
3090
|
-
const buffer = readFileSync$1(file);
|
|
3091
|
-
return removeBOMAndValidate(buffer, file);
|
|
3092
|
-
} catch (err) {
|
|
3093
|
-
if (err instanceof ParseError) {
|
|
3094
|
-
throw err;
|
|
3095
|
-
}
|
|
3096
|
-
const { message } = err;
|
|
3097
|
-
throw new ParseError({
|
|
3098
|
-
text: `Could not read file: ${file}`,
|
|
3099
|
-
notes: [
|
|
3100
|
-
{
|
|
3101
|
-
text: message.replace(file, resolve(file))
|
|
3102
|
-
}
|
|
3103
|
-
],
|
|
3104
|
-
telemetryMessage: "Could not read file"
|
|
3105
|
-
});
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
__name(readFileSync, "readFileSync");
|
|
3109
|
-
function indexLocation(file, index) {
|
|
3110
|
-
let lineText, line = 0, column = 0, cursor = 0;
|
|
3111
|
-
const { fileText = "" } = file;
|
|
3112
|
-
for (const row of fileText.split("\n")) {
|
|
3113
|
-
line++;
|
|
3114
|
-
cursor += row.length + 1;
|
|
3115
|
-
if (cursor >= index) {
|
|
3116
|
-
lineText = row;
|
|
3117
|
-
column = row.length - (cursor - index);
|
|
3118
|
-
break;
|
|
3119
|
-
}
|
|
3120
|
-
}
|
|
3121
|
-
return { lineText, line, column, ...file };
|
|
3122
|
-
}
|
|
3123
|
-
__name(indexLocation, "indexLocation");
|
|
3124
|
-
function searchLocation(file, query) {
|
|
3125
|
-
let lineText, length, line = 0, column = 0;
|
|
3126
|
-
const queryText = String(query);
|
|
3127
|
-
const { fileText = "" } = file;
|
|
3128
|
-
for (const content of fileText.split("\n")) {
|
|
3129
|
-
line++;
|
|
3130
|
-
const index = content.indexOf(queryText);
|
|
3131
|
-
if (index >= 0) {
|
|
3132
|
-
lineText = content;
|
|
3133
|
-
column = index;
|
|
3134
|
-
length = queryText.length;
|
|
3135
|
-
break;
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
return { lineText, line, column, length, ...file };
|
|
3139
|
-
}
|
|
3140
|
-
__name(searchLocation, "searchLocation");
|
|
3141
|
-
var units = {
|
|
3142
|
-
nanoseconds: 1e-9,
|
|
3143
|
-
nanosecond: 1e-9,
|
|
3144
|
-
microseconds: 1e-6,
|
|
3145
|
-
microsecond: 1e-6,
|
|
3146
|
-
milliseconds: 1e-3,
|
|
3147
|
-
millisecond: 1e-3,
|
|
3148
|
-
seconds: 1,
|
|
3149
|
-
second: 1,
|
|
3150
|
-
minutes: 60,
|
|
3151
|
-
minute: 60,
|
|
3152
|
-
hours: 3600,
|
|
3153
|
-
hour: 3600,
|
|
3154
|
-
days: 86400,
|
|
3155
|
-
day: 86400,
|
|
3156
|
-
weeks: 604800,
|
|
3157
|
-
week: 604800,
|
|
3158
|
-
month: 18144e3,
|
|
3159
|
-
year: 220752e3,
|
|
3160
|
-
nsecs: 1e-9,
|
|
3161
|
-
nsec: 1e-9,
|
|
3162
|
-
usecs: 1e-6,
|
|
3163
|
-
usec: 1e-6,
|
|
3164
|
-
msecs: 1e-3,
|
|
3165
|
-
msec: 1e-3,
|
|
3166
|
-
secs: 1,
|
|
3167
|
-
sec: 1,
|
|
3168
|
-
mins: 60,
|
|
3169
|
-
min: 60,
|
|
3170
|
-
ns: 1e-9,
|
|
3171
|
-
us: 1e-6,
|
|
3172
|
-
ms: 1e-3,
|
|
3173
|
-
mo: 18144e3,
|
|
3174
|
-
yr: 220752e3,
|
|
3175
|
-
s: 1,
|
|
3176
|
-
m: 60,
|
|
3177
|
-
h: 3600,
|
|
3178
|
-
d: 86400,
|
|
3179
|
-
w: 604800,
|
|
3180
|
-
y: 220752e3
|
|
3181
|
-
};
|
|
3182
|
-
function parseHumanDuration(s) {
|
|
3183
|
-
const unitsMap = new Map(Object.entries(units));
|
|
3184
|
-
s = s.trim().toLowerCase();
|
|
3185
|
-
let base = 1;
|
|
3186
|
-
for (const [name, _2] of unitsMap) {
|
|
3187
|
-
if (s.endsWith(name)) {
|
|
3188
|
-
s = s.substring(0, s.length - name.length);
|
|
3189
|
-
base = unitsMap.get(name) || 1;
|
|
3190
|
-
break;
|
|
3191
|
-
}
|
|
3192
|
-
}
|
|
3193
|
-
return Number(s) * base;
|
|
3194
|
-
}
|
|
3195
|
-
__name(parseHumanDuration, "parseHumanDuration");
|
|
3196
|
-
function parseNonHyphenedUuid(uuid) {
|
|
3197
|
-
if (uuid == null || uuid.includes("-")) {
|
|
3198
|
-
return uuid;
|
|
3199
|
-
}
|
|
3200
|
-
if (uuid.length != 32) {
|
|
3201
|
-
return null;
|
|
3202
|
-
}
|
|
3203
|
-
const uuid_parts = [];
|
|
3204
|
-
uuid_parts.push(uuid.slice(0, 8));
|
|
3205
|
-
uuid_parts.push(uuid.slice(8, 12));
|
|
3206
|
-
uuid_parts.push(uuid.slice(12, 16));
|
|
3207
|
-
uuid_parts.push(uuid.slice(16, 20));
|
|
3208
|
-
uuid_parts.push(uuid.slice(20));
|
|
3209
|
-
let hyphenated = "";
|
|
3210
|
-
uuid_parts.forEach((part) => hyphenated += part + "-");
|
|
3211
|
-
return hyphenated.slice(0, 36);
|
|
3212
|
-
}
|
|
3213
|
-
__name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
|
|
3214
|
-
function parseByteSize(s, base = void 0) {
|
|
3215
|
-
const match = s.match(
|
|
3216
|
-
/^(\d*\.*\d*)\s*([kKmMgGtTpP]{0,1})([i]{0,1}[bB]{0,1})$/
|
|
3217
|
-
);
|
|
3218
|
-
if (!match) {
|
|
3219
|
-
return NaN;
|
|
3220
|
-
}
|
|
3221
|
-
const size = match[1];
|
|
3222
|
-
if (size.length === 0 || isNaN(Number(size))) {
|
|
3223
|
-
return NaN;
|
|
3224
|
-
}
|
|
3225
|
-
const unit = match[2].toLowerCase();
|
|
3226
|
-
const sizeUnits = {
|
|
3227
|
-
k: 1,
|
|
3228
|
-
m: 2,
|
|
3229
|
-
g: 3,
|
|
3230
|
-
t: 4,
|
|
3231
|
-
p: 5
|
|
3232
|
-
};
|
|
3233
|
-
if (unit.length !== 0 && !(unit in sizeUnits)) {
|
|
3234
|
-
return NaN;
|
|
3235
|
-
}
|
|
3236
|
-
const binary = match[3].toLowerCase() == "ib";
|
|
3237
|
-
if (binary && unit.length === 0) {
|
|
3238
|
-
return NaN;
|
|
3239
|
-
}
|
|
3240
|
-
const pow = sizeUnits[unit] || 0;
|
|
3241
|
-
return Math.floor(
|
|
3242
|
-
Number(size) * Math.pow(base ?? (binary ? 1024 : 1e3), pow)
|
|
3243
|
-
);
|
|
3244
|
-
}
|
|
3245
|
-
__name(parseByteSize, "parseByteSize");
|
|
3246
|
-
var UNSUPPORTED_BOMS = [
|
|
3247
|
-
{
|
|
3248
|
-
buffer: Buffer.from([0, 0, 254, 255]),
|
|
3249
|
-
encoding: "UTF-32 BE"
|
|
3250
|
-
},
|
|
3251
|
-
{
|
|
3252
|
-
buffer: Buffer.from([255, 254, 0, 0]),
|
|
3253
|
-
encoding: "UTF-32 LE"
|
|
3254
|
-
},
|
|
3255
|
-
{
|
|
3256
|
-
buffer: Buffer.from([254, 255]),
|
|
3257
|
-
encoding: "UTF-16 BE"
|
|
3258
|
-
},
|
|
3259
|
-
{
|
|
3260
|
-
buffer: Buffer.from([255, 254]),
|
|
3261
|
-
encoding: "UTF-16 LE"
|
|
3262
|
-
}
|
|
3263
|
-
];
|
|
3264
|
-
function removeBOMAndValidate(buffer, file) {
|
|
3265
|
-
for (const bom of UNSUPPORTED_BOMS) {
|
|
3266
|
-
if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) {
|
|
3267
|
-
throw new ParseError({
|
|
3268
|
-
text: `Configuration file contains ${bom.encoding} byte order marker`,
|
|
3269
|
-
notes: [
|
|
3270
|
-
{
|
|
3271
|
-
text: `The file "${file}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`
|
|
3272
|
-
}
|
|
3273
|
-
],
|
|
3274
|
-
location: { file, line: 1, column: 0 },
|
|
3275
|
-
telemetryMessage: `${bom.encoding} BOM detected`
|
|
3276
|
-
});
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
const content = buffer.toString("utf-8");
|
|
3280
|
-
if (content.charCodeAt(0) === 65279) {
|
|
3281
|
-
return content.slice(1);
|
|
3282
|
-
}
|
|
3283
|
-
return content;
|
|
3284
|
-
}
|
|
3285
|
-
__name(removeBOMAndValidate, "removeBOMAndValidate");
|
|
3286
|
-
var typeMappings = {
|
|
3287
|
-
directory: "isDirectory",
|
|
3288
|
-
file: "isFile"
|
|
3289
|
-
};
|
|
3290
|
-
function checkType(type) {
|
|
3291
|
-
if (type in typeMappings) {
|
|
3292
|
-
return;
|
|
3293
|
-
}
|
|
3294
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
3295
|
-
}
|
|
3296
|
-
__name(checkType, "checkType");
|
|
3297
|
-
var matchType = /* @__PURE__ */ __name((type, stat) => type === void 0 || stat[typeMappings[type]](), "matchType");
|
|
3298
|
-
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
3299
|
-
function locatePathSync(paths, {
|
|
3300
|
-
cwd = process2.cwd(),
|
|
3301
|
-
type = "file",
|
|
3302
|
-
allowSymlinks = true
|
|
3303
|
-
} = {}) {
|
|
3304
|
-
checkType(type);
|
|
3305
|
-
cwd = toPath(cwd);
|
|
3306
|
-
const statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;
|
|
3307
|
-
for (const path_ of paths) {
|
|
3308
|
-
try {
|
|
3309
|
-
const stat = statFunction(path7.resolve(cwd, path_));
|
|
3310
|
-
if (matchType(type, stat)) {
|
|
3311
|
-
return path_;
|
|
3312
|
-
}
|
|
3313
|
-
} catch {
|
|
3314
|
-
}
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3317
|
-
__name(locatePathSync, "locatePathSync");
|
|
3318
|
-
|
|
3319
|
-
// ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
|
|
3320
|
-
var toPath2 = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
3321
|
-
var findUpStop = Symbol("findUpStop");
|
|
3322
|
-
function findUpMultipleSync(name, options = {}) {
|
|
3323
|
-
let directory = path7.resolve(toPath2(options.cwd) || "");
|
|
3324
|
-
const { root } = path7.parse(directory);
|
|
3325
|
-
const stopAt = options.stopAt || root;
|
|
3326
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
3327
|
-
const paths = [name].flat();
|
|
3328
|
-
const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
|
|
3329
|
-
if (typeof name !== "function") {
|
|
3330
|
-
return locatePathSync(paths, locateOptions);
|
|
3331
|
-
}
|
|
3332
|
-
const foundPath = name(locateOptions.cwd);
|
|
3333
|
-
if (typeof foundPath === "string") {
|
|
3334
|
-
return locatePathSync([foundPath], locateOptions);
|
|
3335
|
-
}
|
|
3336
|
-
return foundPath;
|
|
3337
|
-
}, "runMatcher");
|
|
3338
|
-
const matches = [];
|
|
3339
|
-
while (true) {
|
|
3340
|
-
const foundPath = runMatcher({ ...options, cwd: directory });
|
|
3341
|
-
if (foundPath === findUpStop) {
|
|
3342
|
-
break;
|
|
3343
|
-
}
|
|
3344
|
-
if (foundPath) {
|
|
3345
|
-
matches.push(path7.resolve(directory, foundPath));
|
|
3346
|
-
}
|
|
3347
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
3348
|
-
break;
|
|
3349
|
-
}
|
|
3350
|
-
directory = path7.dirname(directory);
|
|
3351
|
-
}
|
|
3352
|
-
return matches;
|
|
3353
|
-
}
|
|
3354
|
-
__name(findUpMultipleSync, "findUpMultipleSync");
|
|
3355
|
-
function findUpSync(name, options = {}) {
|
|
3356
|
-
const matches = findUpMultipleSync(name, { ...options, limit: 1 });
|
|
3357
|
-
return matches[0];
|
|
3358
|
-
}
|
|
3359
|
-
__name(findUpSync, "findUpSync");
|
|
3360
|
-
|
|
3361
|
-
// ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
|
|
3362
|
-
function dedent(templ) {
|
|
3363
|
-
var values = [];
|
|
3364
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3365
|
-
values[_i - 1] = arguments[_i];
|
|
3366
|
-
}
|
|
3367
|
-
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
3368
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
3369
|
-
var indentLengths = strings.reduce(function(arr, str) {
|
|
3370
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
3371
|
-
if (matches) {
|
|
3372
|
-
return arr.concat(matches.map(function(match) {
|
|
3373
|
-
var _a, _b;
|
|
3374
|
-
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
3375
|
-
}));
|
|
3376
|
-
}
|
|
3377
|
-
return arr;
|
|
3378
|
-
}, []);
|
|
3379
|
-
if (indentLengths.length) {
|
|
3380
|
-
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
3381
|
-
strings = strings.map(function(str) {
|
|
3382
|
-
return str.replace(pattern_1, "\n");
|
|
3383
|
-
});
|
|
3384
|
-
}
|
|
3385
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
3386
|
-
var string = strings[0];
|
|
3387
|
-
values.forEach(function(value, i) {
|
|
3388
|
-
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
3389
|
-
var endentation = endentations ? endentations[1] : "";
|
|
3390
|
-
var indentedValue = value;
|
|
3391
|
-
if (typeof value === "string" && value.includes("\n")) {
|
|
3392
|
-
indentedValue = String(value).split("\n").map(function(str, i2) {
|
|
3393
|
-
return i2 === 0 ? str : "" + endentation + str;
|
|
3394
|
-
}).join("\n");
|
|
3395
|
-
}
|
|
3396
|
-
string += indentedValue + strings[i + 1];
|
|
3397
|
-
});
|
|
3398
|
-
return string;
|
|
3399
|
-
}
|
|
3400
|
-
__name(dedent, "dedent");
|
|
3401
|
-
var esm_default = dedent;
|
|
3402
|
-
|
|
3403
|
-
// src/config/config-helpers.ts
|
|
3404
|
-
function resolveWranglerConfigPath({
|
|
3405
|
-
config,
|
|
3406
|
-
script
|
|
3407
|
-
}, options) {
|
|
3408
|
-
if (config !== void 0) {
|
|
3409
|
-
return {
|
|
3410
|
-
userConfigPath: config,
|
|
3411
|
-
configPath: config,
|
|
3412
|
-
deployConfigPath: void 0,
|
|
3413
|
-
redirected: false
|
|
3414
|
-
};
|
|
3415
|
-
}
|
|
3416
|
-
const leafPath = script !== void 0 ? path7.dirname(script) : process.cwd();
|
|
3417
|
-
return findWranglerConfig(leafPath, options);
|
|
3418
|
-
}
|
|
3419
|
-
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
3420
|
-
function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
3421
|
-
const userConfigPath = findUpSync(`wrangler.json`, { cwd: referencePath }) ?? findUpSync(`wrangler.jsonc`, { cwd: referencePath }) ?? findUpSync(`wrangler.toml`, { cwd: referencePath });
|
|
3422
|
-
if (!useRedirectIfAvailable) {
|
|
3423
|
-
return {
|
|
3424
|
-
userConfigPath,
|
|
3425
|
-
configPath: userConfigPath,
|
|
3426
|
-
deployConfigPath: void 0,
|
|
3427
|
-
redirected: false
|
|
3428
|
-
};
|
|
3429
|
-
}
|
|
3430
|
-
const { configPath, deployConfigPath, redirected } = findRedirectedWranglerConfig(referencePath, userConfigPath);
|
|
3431
|
-
return {
|
|
3432
|
-
userConfigPath,
|
|
3433
|
-
configPath,
|
|
3434
|
-
deployConfigPath,
|
|
3435
|
-
redirected
|
|
3436
|
-
};
|
|
3437
|
-
}
|
|
3438
|
-
__name(findWranglerConfig, "findWranglerConfig");
|
|
3439
|
-
function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
3440
|
-
const deployConfigPath = findUpSync(PATH_TO_DEPLOY_CONFIG, { cwd });
|
|
3441
|
-
if (deployConfigPath === void 0) {
|
|
3442
|
-
return { configPath: userConfigPath, deployConfigPath, redirected: false };
|
|
3443
|
-
}
|
|
3444
|
-
let redirectedConfigPath;
|
|
3445
|
-
const deployConfigFile = readFileSync(deployConfigPath);
|
|
3446
|
-
try {
|
|
3447
|
-
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
3448
|
-
redirectedConfigPath = deployConfig.configPath && path7.resolve(path7.dirname(deployConfigPath), deployConfig.configPath);
|
|
3449
|
-
} catch (e) {
|
|
3450
|
-
throw new UserError(
|
|
3451
|
-
`Failed to parse the deploy configuration file at ${path7.relative(".", deployConfigPath)}`,
|
|
3452
|
-
{ cause: e }
|
|
3453
|
-
);
|
|
3454
|
-
}
|
|
3455
|
-
if (!redirectedConfigPath) {
|
|
3456
|
-
throw new UserError(esm_default`
|
|
3457
|
-
A deploy configuration file was found at "${path7.relative(".", deployConfigPath)}".
|
|
3458
|
-
But this is not valid - the required "configPath" property was not found.
|
|
3459
|
-
Instead this file contains:
|
|
3460
|
-
\`\`\`
|
|
3461
|
-
${deployConfigFile}
|
|
3462
|
-
\`\`\`
|
|
3463
|
-
`);
|
|
3464
|
-
}
|
|
3465
|
-
if (!existsSync(redirectedConfigPath)) {
|
|
3466
|
-
throw new UserError(esm_default`
|
|
3467
|
-
There is a deploy configuration at "${path7.relative(".", deployConfigPath)}".
|
|
3468
|
-
But the redirected configuration path it points to, "${path7.relative(".", redirectedConfigPath)}", does not exist.
|
|
3469
|
-
`);
|
|
3470
|
-
}
|
|
3471
|
-
if (userConfigPath) {
|
|
3472
|
-
if (path7.join(path7.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) {
|
|
3473
|
-
throw new UserError(esm_default`
|
|
3474
|
-
Found both a user configuration file at "${path7.relative(".", userConfigPath)}"
|
|
3475
|
-
and a deploy configuration file at "${path7.relative(".", deployConfigPath)}".
|
|
3476
|
-
But these do not share the same base path so it is not clear which should be used.
|
|
3477
|
-
`);
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
|
-
return {
|
|
3481
|
-
configPath: redirectedConfigPath,
|
|
3482
|
-
deployConfigPath,
|
|
3483
|
-
redirected: true
|
|
3484
|
-
};
|
|
3485
|
-
}
|
|
3486
|
-
__name(findRedirectedWranglerConfig, "findRedirectedWranglerConfig");
|
|
3487
|
-
function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
|
|
3488
|
-
return configPath !== void 0 && configPath !== userConfigPath;
|
|
3489
|
-
}
|
|
3490
|
-
__name(isRedirectedRawConfig, "isRedirectedRawConfig");
|
|
3491
|
-
|
|
3492
|
-
// src/config/index.ts
|
|
3493
|
-
function configFormat(configPath) {
|
|
3494
|
-
if (configPath?.endsWith("toml")) {
|
|
3495
|
-
return "toml";
|
|
3496
|
-
} else if (configPath?.endsWith("json") || configPath?.endsWith("jsonc")) {
|
|
3497
|
-
return "jsonc";
|
|
3498
|
-
}
|
|
3499
|
-
return "none";
|
|
3500
|
-
}
|
|
3501
|
-
__name(configFormat, "configFormat");
|
|
3502
|
-
function configFileName(configPath) {
|
|
3503
|
-
const format3 = configFormat(configPath);
|
|
3504
|
-
if (format3 === "toml") {
|
|
3505
|
-
return "wrangler.toml";
|
|
3506
|
-
} else if (format3 === "jsonc") {
|
|
3507
|
-
return "wrangler.json";
|
|
3508
|
-
} else {
|
|
3509
|
-
return "Wrangler configuration";
|
|
3510
|
-
}
|
|
3511
|
-
}
|
|
3512
|
-
__name(configFileName, "configFileName");
|
|
3513
|
-
function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
3514
|
-
const format3 = configFormat(configPath);
|
|
3515
|
-
if (format3 === "toml") {
|
|
3516
|
-
return dist_default.stringify(snippet);
|
|
3517
|
-
} else {
|
|
3518
|
-
return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
__name(formatConfigSnippet, "formatConfigSnippet");
|
|
3522
|
-
var parseRawConfigFile = /* @__PURE__ */ __name((configPath) => {
|
|
3523
|
-
if (configPath.endsWith(".toml")) {
|
|
3524
|
-
return parseTOML(readFileSync(configPath), configPath);
|
|
3525
|
-
}
|
|
3526
|
-
if (configPath.endsWith(".json") || configPath.endsWith(".jsonc")) {
|
|
3527
|
-
return parseJSONC(readFileSync(configPath), configPath);
|
|
3528
|
-
}
|
|
3529
|
-
return {};
|
|
3530
|
-
}, "parseRawConfigFile");
|
|
3531
|
-
var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) => {
|
|
3532
|
-
const { configPath, userConfigPath, deployConfigPath, redirected } = resolveWranglerConfigPath(args, options);
|
|
3533
|
-
const rawConfig = parseRawConfigFile(configPath ?? "");
|
|
3534
|
-
return {
|
|
3535
|
-
rawConfig,
|
|
3536
|
-
configPath,
|
|
3537
|
-
userConfigPath,
|
|
3538
|
-
deployConfigPath,
|
|
3539
|
-
redirected
|
|
3540
|
-
};
|
|
3541
|
-
}, "experimental_readRawConfig");
|
|
3542
630
|
var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArrayInsertion = true) => {
|
|
3543
631
|
let configString = readFileSync(configPath);
|
|
3544
632
|
if (configPath.endsWith("toml")) {
|
|
@@ -3559,7 +647,7 @@ var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArra
|
|
|
3559
647
|
});
|
|
3560
648
|
configString = applyEdits(configString, edit);
|
|
3561
649
|
}
|
|
3562
|
-
const formatEdit =
|
|
650
|
+
const formatEdit = format(configString, void 0, {});
|
|
3563
651
|
configString = applyEdits(configString, formatEdit);
|
|
3564
652
|
if (configPath.endsWith(".toml")) {
|
|
3565
653
|
configString = dist_default.stringify(parseJSONC(configString));
|
|
@@ -3780,7 +868,7 @@ __name(isDir, "isDir");
|
|
|
3780
868
|
var isDockerfile = /* @__PURE__ */ __name((image, configPath) => {
|
|
3781
869
|
const baseDir = configPath ? path4.dirname(configPath) : process.cwd();
|
|
3782
870
|
const maybeDockerfile = path4.resolve(baseDir, image);
|
|
3783
|
-
if (existsSync
|
|
871
|
+
if (existsSync(maybeDockerfile)) {
|
|
3784
872
|
if (isDir(maybeDockerfile)) {
|
|
3785
873
|
throw new UserError2(
|
|
3786
874
|
`${image} is a directory, you should specify a path to the Dockerfile`
|
|
@@ -3850,7 +938,7 @@ function isDirectory(configPath) {
|
|
|
3850
938
|
__name(isDirectory, "isDirectory");
|
|
3851
939
|
function getGlobalWranglerConfigPath() {
|
|
3852
940
|
const configDir = mod_esm_default(".wrangler").config();
|
|
3853
|
-
const legacyConfigDir =
|
|
941
|
+
const legacyConfigDir = path4.join(os.homedir(), ".wrangler");
|
|
3854
942
|
if (isDirectory(legacyConfigDir)) {
|
|
3855
943
|
return legacyConfigDir;
|
|
3856
944
|
} else {
|
|
@@ -4006,7 +1094,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
|
|
|
4006
1094
|
var getRegistryPath = getEnvironmentVariableFactory({
|
|
4007
1095
|
variableName: "WRANGLER_REGISTRY_PATH",
|
|
4008
1096
|
defaultValue() {
|
|
4009
|
-
return
|
|
1097
|
+
return path4.join(getGlobalWranglerConfigPath(), "registry");
|
|
4010
1098
|
}
|
|
4011
1099
|
});
|
|
4012
1100
|
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
|
|
@@ -4044,6 +1132,9 @@ var getWranglerHideBanner = getBooleanEnvironmentVariableFactory({
|
|
|
4044
1132
|
var getCloudflareEnv = getEnvironmentVariableFactory({
|
|
4045
1133
|
variableName: "CLOUDFLARE_ENV"
|
|
4046
1134
|
});
|
|
1135
|
+
var getOpenNextDeployFromEnv = getEnvironmentVariableFactory({
|
|
1136
|
+
variableName: "OPEN_NEXT_DEPLOY"
|
|
1137
|
+
});
|
|
4047
1138
|
|
|
4048
1139
|
// src/config/diagnostics.ts
|
|
4049
1140
|
var Diagnostics = class {
|
|
@@ -4190,9 +1281,9 @@ Please add "${field}" to "env.${envName}".`
|
|
|
4190
1281
|
return rawEnv[field] ?? defaultValue;
|
|
4191
1282
|
}
|
|
4192
1283
|
__name(notInheritable, "notInheritable");
|
|
4193
|
-
function unwindPropertyPath(root,
|
|
1284
|
+
function unwindPropertyPath(root, path5) {
|
|
4194
1285
|
let container = root;
|
|
4195
|
-
const parts =
|
|
1286
|
+
const parts = path5.split(".");
|
|
4196
1287
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
4197
1288
|
if (!hasProperty(container, parts[i])) {
|
|
4198
1289
|
return;
|
|
@@ -4507,7 +1598,7 @@ function isPagesConfig(rawConfig) {
|
|
|
4507
1598
|
__name(isPagesConfig, "isPagesConfig");
|
|
4508
1599
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
4509
1600
|
const diagnostics = new Diagnostics(
|
|
4510
|
-
`Processing ${configPath ?
|
|
1601
|
+
`Processing ${configPath ? path4.relative(process.cwd(), configPath) : "wrangler"} configuration:`
|
|
4511
1602
|
);
|
|
4512
1603
|
validateOptionalProperty(
|
|
4513
1604
|
diagnostics,
|
|
@@ -4731,13 +1822,13 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
4731
1822
|
// be configured in the Wrangler configuration file, but who knows, that may
|
|
4732
1823
|
// change in the future, so we do a check anyway
|
|
4733
1824
|
command && configPath ? Array.isArray(watch_dir) ? watch_dir.map(
|
|
4734
|
-
(dir) =>
|
|
1825
|
+
(dir) => path4.relative(
|
|
4735
1826
|
process.cwd(),
|
|
4736
|
-
|
|
1827
|
+
path4.join(path4.dirname(configPath), `${dir}`)
|
|
4737
1828
|
)
|
|
4738
|
-
) :
|
|
1829
|
+
) : path4.relative(
|
|
4739
1830
|
process.cwd(),
|
|
4740
|
-
|
|
1831
|
+
path4.join(path4.dirname(configPath), `${watch_dir}`)
|
|
4741
1832
|
) : watch_dir
|
|
4742
1833
|
),
|
|
4743
1834
|
cwd
|
|
@@ -4745,11 +1836,11 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
4745
1836
|
}
|
|
4746
1837
|
__name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
4747
1838
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
4748
|
-
const configDir =
|
|
1839
|
+
const configDir = path4.dirname(configPath ?? "wrangler.toml");
|
|
4749
1840
|
if (rawMain !== void 0) {
|
|
4750
1841
|
if (typeof rawMain === "string") {
|
|
4751
|
-
const directory =
|
|
4752
|
-
return
|
|
1842
|
+
const directory = path4.resolve(configDir);
|
|
1843
|
+
return path4.resolve(directory, rawMain);
|
|
4753
1844
|
} else {
|
|
4754
1845
|
return rawMain;
|
|
4755
1846
|
}
|
|
@@ -4759,11 +1850,11 @@ function normalizeAndValidateMainField(configPath, rawMain) {
|
|
|
4759
1850
|
}
|
|
4760
1851
|
__name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
4761
1852
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
4762
|
-
const configDir =
|
|
1853
|
+
const configDir = path4.dirname(configPath ?? "wrangler.toml");
|
|
4763
1854
|
if (rawDir !== void 0) {
|
|
4764
1855
|
if (typeof rawDir === "string") {
|
|
4765
|
-
const directory =
|
|
4766
|
-
return
|
|
1856
|
+
const directory = path4.resolve(configDir);
|
|
1857
|
+
return path4.resolve(directory, rawDir);
|
|
4767
1858
|
} else {
|
|
4768
1859
|
return rawDir;
|
|
4769
1860
|
}
|
|
@@ -4773,11 +1864,11 @@ function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
|
4773
1864
|
}
|
|
4774
1865
|
__name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
4775
1866
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
4776
|
-
const configDir =
|
|
1867
|
+
const configDir = path4.dirname(configPath ?? "wrangler.toml");
|
|
4777
1868
|
if (rawPagesDir !== void 0) {
|
|
4778
1869
|
if (typeof rawPagesDir === "string") {
|
|
4779
|
-
const directory =
|
|
4780
|
-
return
|
|
1870
|
+
const directory = path4.resolve(configDir);
|
|
1871
|
+
return path4.resolve(directory, rawPagesDir);
|
|
4781
1872
|
} else {
|
|
4782
1873
|
return rawPagesDir;
|
|
4783
1874
|
}
|
|
@@ -4909,9 +2000,9 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
4909
2000
|
`site.entry-point`,
|
|
4910
2001
|
`Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
4911
2002
|
\`\`\`
|
|
4912
|
-
main = "${
|
|
2003
|
+
main = "${path4.join(
|
|
4913
2004
|
String(rawConfig.site["entry-point"]) || "workers-site",
|
|
4914
|
-
|
|
2005
|
+
path4.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js"
|
|
4915
2006
|
)}"
|
|
4916
2007
|
\`\`\``,
|
|
4917
2008
|
false,
|
|
@@ -4936,9 +2027,9 @@ Delete the deprecated \`site.entry-point\` field from your config.`
|
|
|
4936
2027
|
);
|
|
4937
2028
|
}
|
|
4938
2029
|
if (configPath && siteEntryPoint) {
|
|
4939
|
-
siteEntryPoint =
|
|
2030
|
+
siteEntryPoint = path4.relative(
|
|
4940
2031
|
process.cwd(),
|
|
4941
|
-
|
|
2032
|
+
path4.join(path4.dirname(configPath), siteEntryPoint)
|
|
4942
2033
|
);
|
|
4943
2034
|
}
|
|
4944
2035
|
return {
|
|
@@ -4984,9 +2075,9 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
4984
2075
|
for (const [name, filePath] of Object.entries(rawMapping)) {
|
|
4985
2076
|
if (isString(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
4986
2077
|
if (configPath) {
|
|
4987
|
-
mapping[name] = configPath ?
|
|
2078
|
+
mapping[name] = configPath ? path4.relative(
|
|
4988
2079
|
process.cwd(),
|
|
4989
|
-
|
|
2080
|
+
path4.join(path4.dirname(configPath), filePath)
|
|
4990
2081
|
) : filePath;
|
|
4991
2082
|
}
|
|
4992
2083
|
}
|
|
@@ -5102,24 +2193,106 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv) {
|
|
|
5102
2193
|
__name(validateRoutes, "validateRoutes");
|
|
5103
2194
|
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
5104
2195
|
if (rawEnv.placement) {
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
);
|
|
5113
|
-
validateOptionalProperty(
|
|
5114
|
-
diagnostics,
|
|
5115
|
-
"placement",
|
|
5116
|
-
"hint",
|
|
5117
|
-
rawEnv.placement.hint,
|
|
5118
|
-
"string"
|
|
5119
|
-
);
|
|
5120
|
-
if (rawEnv.placement.hint && rawEnv.placement.mode !== "smart") {
|
|
2196
|
+
const placement = rawEnv.placement;
|
|
2197
|
+
const hasHint = "hint" in placement;
|
|
2198
|
+
const hasRegion = "region" in placement;
|
|
2199
|
+
const hasHost = "host" in placement;
|
|
2200
|
+
const hasHostname = "hostname" in placement;
|
|
2201
|
+
const hasTargetedFields = hasRegion || hasHost || hasHostname;
|
|
2202
|
+
if (hasHint && hasTargetedFields) {
|
|
5121
2203
|
diagnostics.errors.push(
|
|
5122
|
-
`"placement
|
|
2204
|
+
`"placement" cannot have both "hint" (smart format) and "region"/"host"/"hostname" (targeted format) fields`
|
|
2205
|
+
);
|
|
2206
|
+
return inheritable(
|
|
2207
|
+
diagnostics,
|
|
2208
|
+
topLevelEnv,
|
|
2209
|
+
rawEnv,
|
|
2210
|
+
"placement",
|
|
2211
|
+
() => true,
|
|
2212
|
+
void 0
|
|
2213
|
+
);
|
|
2214
|
+
}
|
|
2215
|
+
if (hasHint) {
|
|
2216
|
+
validateRequiredProperty(
|
|
2217
|
+
diagnostics,
|
|
2218
|
+
"placement",
|
|
2219
|
+
"mode",
|
|
2220
|
+
placement.mode,
|
|
2221
|
+
"string",
|
|
2222
|
+
["off", "smart"]
|
|
2223
|
+
);
|
|
2224
|
+
const mode = placement.mode;
|
|
2225
|
+
const hint = placement.hint;
|
|
2226
|
+
if (hint !== void 0 && typeof hint !== "string") {
|
|
2227
|
+
diagnostics.errors.push(
|
|
2228
|
+
`"placement.hint" must be a string when "placement.mode" is "${mode}"`
|
|
2229
|
+
);
|
|
2230
|
+
}
|
|
2231
|
+
if (hint && mode !== "smart") {
|
|
2232
|
+
diagnostics.errors.push(
|
|
2233
|
+
`"placement.hint" can only be set when "placement.mode" is "smart"`
|
|
2234
|
+
);
|
|
2235
|
+
}
|
|
2236
|
+
} else if (hasTargetedFields) {
|
|
2237
|
+
validateOptionalProperty(
|
|
2238
|
+
diagnostics,
|
|
2239
|
+
"placement",
|
|
2240
|
+
"mode",
|
|
2241
|
+
placement.mode,
|
|
2242
|
+
"string",
|
|
2243
|
+
["off", "targeted"]
|
|
2244
|
+
);
|
|
2245
|
+
if (hasRegion) {
|
|
2246
|
+
validateOptionalProperty(
|
|
2247
|
+
diagnostics,
|
|
2248
|
+
"placement",
|
|
2249
|
+
"region",
|
|
2250
|
+
placement.region,
|
|
2251
|
+
"string"
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
if (hasHost) {
|
|
2255
|
+
validateOptionalProperty(
|
|
2256
|
+
diagnostics,
|
|
2257
|
+
"placement",
|
|
2258
|
+
"host",
|
|
2259
|
+
placement.host,
|
|
2260
|
+
"string"
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
if (hasHostname) {
|
|
2264
|
+
validateOptionalProperty(
|
|
2265
|
+
diagnostics,
|
|
2266
|
+
"placement",
|
|
2267
|
+
"hostname",
|
|
2268
|
+
placement.hostname,
|
|
2269
|
+
"string"
|
|
2270
|
+
);
|
|
2271
|
+
}
|
|
2272
|
+
const fieldsPresent = [hasRegion, hasHost, hasHostname].filter(Boolean);
|
|
2273
|
+
if (fieldsPresent.length > 1) {
|
|
2274
|
+
const presentFields = [];
|
|
2275
|
+
if (hasRegion) {
|
|
2276
|
+
presentFields.push("region");
|
|
2277
|
+
}
|
|
2278
|
+
if (hasHost) {
|
|
2279
|
+
presentFields.push("host");
|
|
2280
|
+
}
|
|
2281
|
+
if (hasHostname) {
|
|
2282
|
+
presentFields.push("hostname");
|
|
2283
|
+
}
|
|
2284
|
+
diagnostics.errors.push(
|
|
2285
|
+
`"placement" fields ${presentFields.map((f) => `"${f}"`).join(", ")} are mutually exclusive. Only one can be specified.`
|
|
2286
|
+
);
|
|
2287
|
+
}
|
|
2288
|
+
} else {
|
|
2289
|
+
validateRequiredProperty(
|
|
2290
|
+
diagnostics,
|
|
2291
|
+
"placement",
|
|
2292
|
+
"mode",
|
|
2293
|
+
placement.mode,
|
|
2294
|
+
"string",
|
|
2295
|
+
["off", "smart", "targeted"]
|
|
5123
2296
|
);
|
|
5124
2297
|
}
|
|
5125
2298
|
}
|
|
@@ -5790,9 +2963,9 @@ function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPa
|
|
|
5790
2963
|
isString,
|
|
5791
2964
|
void 0
|
|
5792
2965
|
);
|
|
5793
|
-
return configPath && tsconfig ?
|
|
2966
|
+
return configPath && tsconfig ? path4.relative(
|
|
5794
2967
|
process.cwd(),
|
|
5795
|
-
|
|
2968
|
+
path4.join(path4.dirname(configPath), tsconfig)
|
|
5796
2969
|
) : tsconfig;
|
|
5797
2970
|
}
|
|
5798
2971
|
__name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
@@ -6551,9 +3724,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
6551
3724
|
let resolvedBuildContextPath = void 0;
|
|
6552
3725
|
try {
|
|
6553
3726
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
6554
|
-
const baseDir = configPath ?
|
|
6555
|
-
resolvedImage =
|
|
6556
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
3727
|
+
const baseDir = configPath ? path4.dirname(configPath) : process.cwd();
|
|
3728
|
+
resolvedImage = path4.resolve(baseDir, resolvedImage);
|
|
3729
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path4.resolve(baseDir, containerAppOptional.image_build_context) : path4.dirname(resolvedImage);
|
|
6557
3730
|
}
|
|
6558
3731
|
} catch (err) {
|
|
6559
3732
|
if (err instanceof Error && err.message) {
|
|
@@ -6700,6 +3873,8 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
6700
3873
|
"class_name",
|
|
6701
3874
|
"scheduling_policy",
|
|
6702
3875
|
"instance_type",
|
|
3876
|
+
"wrangler_ssh",
|
|
3877
|
+
"authorized_keys",
|
|
6703
3878
|
"configuration",
|
|
6704
3879
|
"constraints",
|
|
6705
3880
|
"affinities",
|
|
@@ -6718,6 +3893,54 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
6718
3893
|
["image", "secrets", "labels", "disk", "vcpu", "memory_mib"]
|
|
6719
3894
|
);
|
|
6720
3895
|
}
|
|
3896
|
+
if ("wrangler_ssh" in containerAppOptional) {
|
|
3897
|
+
if (!isRequiredProperty(
|
|
3898
|
+
containerAppOptional.wrangler_ssh,
|
|
3899
|
+
"enabled",
|
|
3900
|
+
"boolean"
|
|
3901
|
+
)) {
|
|
3902
|
+
diagnostics.errors.push(
|
|
3903
|
+
`${field}.wrangler_ssh.enabled must be a boolean`
|
|
3904
|
+
);
|
|
3905
|
+
}
|
|
3906
|
+
if (!isOptionalProperty(
|
|
3907
|
+
containerAppOptional.wrangler_ssh,
|
|
3908
|
+
"port",
|
|
3909
|
+
"number"
|
|
3910
|
+
) || containerAppOptional.wrangler_ssh.port < 1 || containerAppOptional.wrangler_ssh.port > 65535) {
|
|
3911
|
+
diagnostics.errors.push(
|
|
3912
|
+
`${field}.wrangler_ssh.port must be a number between 1 and 65535 inclusive`
|
|
3913
|
+
);
|
|
3914
|
+
}
|
|
3915
|
+
if (!("authorized_keys" in containerAppOptional) && containerAppOptional.wrangler_ssh.enabled) {
|
|
3916
|
+
diagnostics.errors.push(
|
|
3917
|
+
`${field}.authorized_keys must be provided if wrangler ssh is enabled`
|
|
3918
|
+
);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
if ("authorized_keys" in containerAppOptional) {
|
|
3922
|
+
if (!Array.isArray(containerAppOptional.authorized_keys)) {
|
|
3923
|
+
diagnostics.errors.push(`${field}.authorized_keys must be an array`);
|
|
3924
|
+
} else {
|
|
3925
|
+
for (const index in containerAppOptional.authorized_keys) {
|
|
3926
|
+
const fieldPath = `${field}.authorized_keys[${index}]`;
|
|
3927
|
+
const key = containerAppOptional.authorized_keys[index];
|
|
3928
|
+
if (!isRequiredProperty(key, "name", "string")) {
|
|
3929
|
+
diagnostics.errors.push(`${fieldPath}.name must be a string`);
|
|
3930
|
+
}
|
|
3931
|
+
if (!isRequiredProperty(key, "public_key", "string")) {
|
|
3932
|
+
diagnostics.errors.push(
|
|
3933
|
+
`${fieldPath}.public_key must be a string`
|
|
3934
|
+
);
|
|
3935
|
+
}
|
|
3936
|
+
if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
|
|
3937
|
+
diagnostics.errors.push(
|
|
3938
|
+
`${fieldPath}.public_key is a unsupported key type. Please provide a ED25519 public key.`
|
|
3939
|
+
);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
6721
3944
|
if (typeof containerAppOptional.instance_type === "string") {
|
|
6722
3945
|
validateOptionalProperty(
|
|
6723
3946
|
diagnostics,
|
|
@@ -8160,268 +5383,5 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
8160
5383
|
}
|
|
8161
5384
|
}
|
|
8162
5385
|
__name(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
8163
|
-
/*! Bundled license information:
|
|
8164
|
-
|
|
8165
|
-
smol-toml/dist/error.js:
|
|
8166
|
-
(*!
|
|
8167
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8168
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8169
|
-
*
|
|
8170
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8171
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8172
|
-
*
|
|
8173
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8174
|
-
* list of conditions and the following disclaimer.
|
|
8175
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8176
|
-
* this list of conditions and the following disclaimer in the
|
|
8177
|
-
* documentation and/or other materials provided with the distribution.
|
|
8178
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8179
|
-
* may be used to endorse or promote products derived from this software without
|
|
8180
|
-
* specific prior written permission.
|
|
8181
|
-
*
|
|
8182
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8183
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8184
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8185
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8186
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8187
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8188
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8189
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8190
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8191
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8192
|
-
*)
|
|
8193
|
-
|
|
8194
|
-
smol-toml/dist/util.js:
|
|
8195
|
-
(*!
|
|
8196
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8197
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8198
|
-
*
|
|
8199
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8200
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8201
|
-
*
|
|
8202
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8203
|
-
* list of conditions and the following disclaimer.
|
|
8204
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8205
|
-
* this list of conditions and the following disclaimer in the
|
|
8206
|
-
* documentation and/or other materials provided with the distribution.
|
|
8207
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8208
|
-
* may be used to endorse or promote products derived from this software without
|
|
8209
|
-
* specific prior written permission.
|
|
8210
|
-
*
|
|
8211
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8212
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8213
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8214
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8215
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8216
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8217
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8218
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8219
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8220
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8221
|
-
*)
|
|
8222
|
-
|
|
8223
|
-
smol-toml/dist/date.js:
|
|
8224
|
-
(*!
|
|
8225
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8226
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8227
|
-
*
|
|
8228
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8229
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8230
|
-
*
|
|
8231
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8232
|
-
* list of conditions and the following disclaimer.
|
|
8233
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8234
|
-
* this list of conditions and the following disclaimer in the
|
|
8235
|
-
* documentation and/or other materials provided with the distribution.
|
|
8236
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8237
|
-
* may be used to endorse or promote products derived from this software without
|
|
8238
|
-
* specific prior written permission.
|
|
8239
|
-
*
|
|
8240
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8241
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8242
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8243
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8244
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8245
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8246
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8247
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8248
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8249
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8250
|
-
*)
|
|
8251
|
-
|
|
8252
|
-
smol-toml/dist/primitive.js:
|
|
8253
|
-
(*!
|
|
8254
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8255
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8256
|
-
*
|
|
8257
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8258
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8259
|
-
*
|
|
8260
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8261
|
-
* list of conditions and the following disclaimer.
|
|
8262
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8263
|
-
* this list of conditions and the following disclaimer in the
|
|
8264
|
-
* documentation and/or other materials provided with the distribution.
|
|
8265
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8266
|
-
* may be used to endorse or promote products derived from this software without
|
|
8267
|
-
* specific prior written permission.
|
|
8268
|
-
*
|
|
8269
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8270
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8271
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8272
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8273
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8274
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8275
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8276
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8277
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8278
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8279
|
-
*)
|
|
8280
|
-
|
|
8281
|
-
smol-toml/dist/extract.js:
|
|
8282
|
-
(*!
|
|
8283
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8284
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8285
|
-
*
|
|
8286
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8287
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8288
|
-
*
|
|
8289
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8290
|
-
* list of conditions and the following disclaimer.
|
|
8291
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8292
|
-
* this list of conditions and the following disclaimer in the
|
|
8293
|
-
* documentation and/or other materials provided with the distribution.
|
|
8294
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8295
|
-
* may be used to endorse or promote products derived from this software without
|
|
8296
|
-
* specific prior written permission.
|
|
8297
|
-
*
|
|
8298
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8299
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8300
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8301
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8302
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8303
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8304
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8305
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8306
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8307
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8308
|
-
*)
|
|
8309
|
-
|
|
8310
|
-
smol-toml/dist/struct.js:
|
|
8311
|
-
(*!
|
|
8312
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8313
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8314
|
-
*
|
|
8315
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8316
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8317
|
-
*
|
|
8318
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8319
|
-
* list of conditions and the following disclaimer.
|
|
8320
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8321
|
-
* this list of conditions and the following disclaimer in the
|
|
8322
|
-
* documentation and/or other materials provided with the distribution.
|
|
8323
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8324
|
-
* may be used to endorse or promote products derived from this software without
|
|
8325
|
-
* specific prior written permission.
|
|
8326
|
-
*
|
|
8327
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8328
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8329
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8330
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8331
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8332
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8333
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8334
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8335
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8336
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8337
|
-
*)
|
|
8338
|
-
|
|
8339
|
-
smol-toml/dist/parse.js:
|
|
8340
|
-
(*!
|
|
8341
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8342
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8343
|
-
*
|
|
8344
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8345
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8346
|
-
*
|
|
8347
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8348
|
-
* list of conditions and the following disclaimer.
|
|
8349
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8350
|
-
* this list of conditions and the following disclaimer in the
|
|
8351
|
-
* documentation and/or other materials provided with the distribution.
|
|
8352
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8353
|
-
* may be used to endorse or promote products derived from this software without
|
|
8354
|
-
* specific prior written permission.
|
|
8355
|
-
*
|
|
8356
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8357
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8358
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8359
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8360
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8361
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8362
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8363
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8364
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8365
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8366
|
-
*)
|
|
8367
|
-
|
|
8368
|
-
smol-toml/dist/stringify.js:
|
|
8369
|
-
(*!
|
|
8370
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8371
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8372
|
-
*
|
|
8373
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8374
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8375
|
-
*
|
|
8376
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8377
|
-
* list of conditions and the following disclaimer.
|
|
8378
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8379
|
-
* this list of conditions and the following disclaimer in the
|
|
8380
|
-
* documentation and/or other materials provided with the distribution.
|
|
8381
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8382
|
-
* may be used to endorse or promote products derived from this software without
|
|
8383
|
-
* specific prior written permission.
|
|
8384
|
-
*
|
|
8385
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8386
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8387
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8388
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8389
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8390
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8391
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8392
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8393
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8394
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8395
|
-
*)
|
|
8396
|
-
|
|
8397
|
-
smol-toml/dist/index.js:
|
|
8398
|
-
(*!
|
|
8399
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
8400
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8401
|
-
*
|
|
8402
|
-
* Redistribution and use in source and binary forms, with or without
|
|
8403
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8404
|
-
*
|
|
8405
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
8406
|
-
* list of conditions and the following disclaimer.
|
|
8407
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
8408
|
-
* this list of conditions and the following disclaimer in the
|
|
8409
|
-
* documentation and/or other materials provided with the distribution.
|
|
8410
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
8411
|
-
* may be used to endorse or promote products derived from this software without
|
|
8412
|
-
* specific prior written permission.
|
|
8413
|
-
*
|
|
8414
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
8415
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
8416
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
8417
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
8418
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
8419
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
8420
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
8421
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
8422
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
8423
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8424
|
-
*)
|
|
8425
|
-
*/
|
|
8426
5386
|
|
|
8427
|
-
export {
|
|
5387
|
+
export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, PatchConfigError, bucketFormatMessage, defaultWranglerConfig, experimental_patchConfig, friendlyBindingNames, getBooleanEnvironmentVariableFactory, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, normalizeAndValidateConfig, validatePagesConfig };
|