e2sm 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1074 -202
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
import { stripVTControlCharacters } from "node:util";
|
|
4
3
|
import y, { stdin, stdout } from "node:process";
|
|
5
4
|
import * as g from "node:readline";
|
|
@@ -34,7 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
33
|
value: mod,
|
|
35
34
|
enumerable: true
|
|
36
35
|
}) : target, mod));
|
|
37
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
38
36
|
|
|
39
37
|
//#endregion
|
|
40
38
|
//#region node_modules/args-tokens/lib/utils-1LQrGCWG.js
|
|
@@ -632,7 +630,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
632
630
|
const actualInputName = isShortOption(token.rawName) ? `-${token.name}` : `--${arg}`;
|
|
633
631
|
actualInputNames.set(rawArg, actualInputName);
|
|
634
632
|
if (schema.type === "boolean") token.value = void 0;
|
|
635
|
-
const [parsedValue, error] = parse$
|
|
633
|
+
const [parsedValue, error] = parse$2(token, arg, schema);
|
|
636
634
|
if (error) errors.push(error);
|
|
637
635
|
else if (schema.multiple) {
|
|
638
636
|
values[rawArg] ||= [];
|
|
@@ -652,7 +650,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
652
650
|
explicit
|
|
653
651
|
};
|
|
654
652
|
}
|
|
655
|
-
function parse$
|
|
653
|
+
function parse$2(token, option, schema) {
|
|
656
654
|
switch (schema.type) {
|
|
657
655
|
case "string": return typeof token.value === "string" ? [token.value || schema.default, void 0] : [void 0, createTypeError(option, schema)];
|
|
658
656
|
case "boolean": return token.value ? [token.value || schema.default, void 0] : [!(schema.negatable && token.name.startsWith("no-")), void 0];
|
|
@@ -855,7 +853,7 @@ function resolveDependencies(plugins) {
|
|
|
855
853
|
if (pluginMap.has(plugin$1.id)) console.warn(`Duplicate plugin id detected: \`${plugin$1.id}\``);
|
|
856
854
|
pluginMap.set(plugin$1.id, plugin$1);
|
|
857
855
|
}
|
|
858
|
-
function visit(plugin$1) {
|
|
856
|
+
function visit$2(plugin$1) {
|
|
859
857
|
if (!plugin$1.id) return;
|
|
860
858
|
if (visited.has(plugin$1.id)) return;
|
|
861
859
|
if (visiting.has(plugin$1.id)) throw new Error(`Circular dependency detected: \`${[...visiting].join(` -> `) + " -> " + plugin$1.id}\``);
|
|
@@ -866,13 +864,13 @@ function resolveDependencies(plugins) {
|
|
|
866
864
|
const isOptional = typeof dep === "string" ? false : dep.optional || false;
|
|
867
865
|
const depPlugin = pluginMap.get(depId);
|
|
868
866
|
if (!depPlugin && !isOptional) throw new Error(`Missing required dependency: \`${depId}\` on \`${plugin$1.id}\``);
|
|
869
|
-
if (depPlugin) visit(depPlugin);
|
|
867
|
+
if (depPlugin) visit$2(depPlugin);
|
|
870
868
|
}
|
|
871
869
|
visiting.delete(plugin$1.id);
|
|
872
870
|
visited.add(plugin$1.id);
|
|
873
871
|
sorted.push(plugin$1);
|
|
874
872
|
}
|
|
875
|
-
for (const plugin$1 of plugins) visit(plugin$1);
|
|
873
|
+
for (const plugin$1 of plugins) visit$2(plugin$1);
|
|
876
874
|
return sorted;
|
|
877
875
|
}
|
|
878
876
|
/**
|
|
@@ -1059,7 +1057,7 @@ async function executeCommand(cmd, ctx, decorators) {
|
|
|
1059
1057
|
* @param definition - A {@link Command | command} definition
|
|
1060
1058
|
* @returns A defined {@link Command | command}
|
|
1061
1059
|
*/
|
|
1062
|
-
function define
|
|
1060
|
+
function define(definition) {
|
|
1063
1061
|
return definition;
|
|
1064
1062
|
}
|
|
1065
1063
|
|
|
@@ -1829,7 +1827,7 @@ BUILT_IN_PREFIX.codePointAt(0);
|
|
|
1829
1827
|
|
|
1830
1828
|
//#endregion
|
|
1831
1829
|
//#region package.json
|
|
1832
|
-
var version = "0.6.
|
|
1830
|
+
var version = "0.6.2";
|
|
1833
1831
|
|
|
1834
1832
|
//#endregion
|
|
1835
1833
|
//#region node_modules/sisteransi/src/index.js
|
|
@@ -3160,201 +3158,1075 @@ function formatJson(obj, indent = 0) {
|
|
|
3160
3158
|
}
|
|
3161
3159
|
|
|
3162
3160
|
//#endregion
|
|
3163
|
-
//#region node_modules/jsonc-parser/lib/
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
}
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
SyntaxKind$1[SyntaxKind$1["NullKeyword"] = 7] = "NullKeyword";
|
|
3209
|
-
SyntaxKind$1[SyntaxKind$1["TrueKeyword"] = 8] = "TrueKeyword";
|
|
3210
|
-
SyntaxKind$1[SyntaxKind$1["FalseKeyword"] = 9] = "FalseKeyword";
|
|
3211
|
-
SyntaxKind$1[SyntaxKind$1["StringLiteral"] = 10] = "StringLiteral";
|
|
3212
|
-
SyntaxKind$1[SyntaxKind$1["NumericLiteral"] = 11] = "NumericLiteral";
|
|
3213
|
-
SyntaxKind$1[SyntaxKind$1["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
3214
|
-
SyntaxKind$1[SyntaxKind$1["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
3215
|
-
SyntaxKind$1[SyntaxKind$1["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
3216
|
-
SyntaxKind$1[SyntaxKind$1["Trivia"] = 15] = "Trivia";
|
|
3217
|
-
SyntaxKind$1[SyntaxKind$1["Unknown"] = 16] = "Unknown";
|
|
3218
|
-
SyntaxKind$1[SyntaxKind$1["EOF"] = 17] = "EOF";
|
|
3219
|
-
})(SyntaxKind || (exports$1.SyntaxKind = SyntaxKind = {}));
|
|
3220
|
-
/**
|
|
3221
|
-
* For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.
|
|
3222
|
-
*/
|
|
3223
|
-
exports$1.getLocation = parser.getLocation;
|
|
3224
|
-
/**
|
|
3225
|
-
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
3226
|
-
* Therefore, always check the errors list to find out if the input was valid.
|
|
3227
|
-
*/
|
|
3228
|
-
exports$1.parse = parser.parse;
|
|
3229
|
-
/**
|
|
3230
|
-
* Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
3231
|
-
*/
|
|
3232
|
-
exports$1.parseTree = parser.parseTree;
|
|
3233
|
-
/**
|
|
3234
|
-
* Finds the node at the given path in a JSON DOM.
|
|
3235
|
-
*/
|
|
3236
|
-
exports$1.findNodeAtLocation = parser.findNodeAtLocation;
|
|
3237
|
-
/**
|
|
3238
|
-
* Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
3239
|
-
*/
|
|
3240
|
-
exports$1.findNodeAtOffset = parser.findNodeAtOffset;
|
|
3241
|
-
/**
|
|
3242
|
-
* Gets the JSON path of the given JSON DOM node
|
|
3243
|
-
*/
|
|
3244
|
-
exports$1.getNodePath = parser.getNodePath;
|
|
3245
|
-
/**
|
|
3246
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
3247
|
-
*/
|
|
3248
|
-
exports$1.getNodeValue = parser.getNodeValue;
|
|
3249
|
-
/**
|
|
3250
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
3251
|
-
*/
|
|
3252
|
-
exports$1.visit = parser.visit;
|
|
3253
|
-
/**
|
|
3254
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
3255
|
-
* them. Optionally replaces every none-newline character
|
|
3256
|
-
* of comments with a replaceCharacter
|
|
3257
|
-
*/
|
|
3258
|
-
exports$1.stripComments = parser.stripComments;
|
|
3259
|
-
var ParseErrorCode;
|
|
3260
|
-
(function(ParseErrorCode$1) {
|
|
3261
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
3262
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
3263
|
-
ParseErrorCode$1[ParseErrorCode$1["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
3264
|
-
ParseErrorCode$1[ParseErrorCode$1["ValueExpected"] = 4] = "ValueExpected";
|
|
3265
|
-
ParseErrorCode$1[ParseErrorCode$1["ColonExpected"] = 5] = "ColonExpected";
|
|
3266
|
-
ParseErrorCode$1[ParseErrorCode$1["CommaExpected"] = 6] = "CommaExpected";
|
|
3267
|
-
ParseErrorCode$1[ParseErrorCode$1["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
3268
|
-
ParseErrorCode$1[ParseErrorCode$1["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
3269
|
-
ParseErrorCode$1[ParseErrorCode$1["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
3270
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
3271
|
-
ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
3272
|
-
ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
3273
|
-
ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
3274
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
3275
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
3276
|
-
ParseErrorCode$1[ParseErrorCode$1["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
3277
|
-
})(ParseErrorCode || (exports$1.ParseErrorCode = ParseErrorCode = {}));
|
|
3278
|
-
function printParseErrorCode$1(code) {
|
|
3279
|
-
switch (code) {
|
|
3280
|
-
case 1: return "InvalidSymbol";
|
|
3281
|
-
case 2: return "InvalidNumberFormat";
|
|
3282
|
-
case 3: return "PropertyNameExpected";
|
|
3283
|
-
case 4: return "ValueExpected";
|
|
3284
|
-
case 5: return "ColonExpected";
|
|
3285
|
-
case 6: return "CommaExpected";
|
|
3286
|
-
case 7: return "CloseBraceExpected";
|
|
3287
|
-
case 8: return "CloseBracketExpected";
|
|
3288
|
-
case 9: return "EndOfFileExpected";
|
|
3289
|
-
case 10: return "InvalidCommentToken";
|
|
3290
|
-
case 11: return "UnexpectedEndOfComment";
|
|
3291
|
-
case 12: return "UnexpectedEndOfString";
|
|
3292
|
-
case 13: return "UnexpectedEndOfNumber";
|
|
3293
|
-
case 14: return "InvalidUnicode";
|
|
3294
|
-
case 15: return "InvalidEscapeCharacter";
|
|
3295
|
-
case 16: return "InvalidCharacter";
|
|
3161
|
+
//#region node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
3162
|
+
/**
|
|
3163
|
+
* Creates a JSON scanner on the given text.
|
|
3164
|
+
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
3165
|
+
*/
|
|
3166
|
+
function createScanner$1(text, ignoreTrivia = false) {
|
|
3167
|
+
const len = text.length;
|
|
3168
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
3169
|
+
function scanHexDigits(count, exact) {
|
|
3170
|
+
let digits = 0;
|
|
3171
|
+
let value$1 = 0;
|
|
3172
|
+
while (digits < count || !exact) {
|
|
3173
|
+
let ch = text.charCodeAt(pos);
|
|
3174
|
+
if (ch >= 48 && ch <= 57) value$1 = value$1 * 16 + ch - 48;
|
|
3175
|
+
else if (ch >= 65 && ch <= 70) value$1 = value$1 * 16 + ch - 65 + 10;
|
|
3176
|
+
else if (ch >= 97 && ch <= 102) value$1 = value$1 * 16 + ch - 97 + 10;
|
|
3177
|
+
else break;
|
|
3178
|
+
pos++;
|
|
3179
|
+
digits++;
|
|
3180
|
+
}
|
|
3181
|
+
if (digits < count) value$1 = -1;
|
|
3182
|
+
return value$1;
|
|
3183
|
+
}
|
|
3184
|
+
function setPosition(newPosition) {
|
|
3185
|
+
pos = newPosition;
|
|
3186
|
+
value = "";
|
|
3187
|
+
tokenOffset = 0;
|
|
3188
|
+
token = 16;
|
|
3189
|
+
scanError = 0;
|
|
3190
|
+
}
|
|
3191
|
+
function scanNumber() {
|
|
3192
|
+
let start = pos;
|
|
3193
|
+
if (text.charCodeAt(pos) === 48) pos++;
|
|
3194
|
+
else {
|
|
3195
|
+
pos++;
|
|
3196
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
3197
|
+
}
|
|
3198
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
3199
|
+
pos++;
|
|
3200
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
3201
|
+
pos++;
|
|
3202
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
3203
|
+
} else {
|
|
3204
|
+
scanError = 3;
|
|
3205
|
+
return text.substring(start, pos);
|
|
3296
3206
|
}
|
|
3297
|
-
return "<unknown ParseErrorCode>";
|
|
3298
3207
|
}
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
*/
|
|
3309
|
-
function format(documentText, range, options) {
|
|
3310
|
-
return formatter.format(documentText, range, options);
|
|
3208
|
+
let end = pos;
|
|
3209
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
3210
|
+
pos++;
|
|
3211
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++;
|
|
3212
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
3213
|
+
pos++;
|
|
3214
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
3215
|
+
end = pos;
|
|
3216
|
+
} else scanError = 3;
|
|
3311
3217
|
}
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3218
|
+
return text.substring(start, end);
|
|
3219
|
+
}
|
|
3220
|
+
function scanString() {
|
|
3221
|
+
let result = "", start = pos;
|
|
3222
|
+
while (true) {
|
|
3223
|
+
if (pos >= len) {
|
|
3224
|
+
result += text.substring(start, pos);
|
|
3225
|
+
scanError = 2;
|
|
3226
|
+
break;
|
|
3227
|
+
}
|
|
3228
|
+
const ch = text.charCodeAt(pos);
|
|
3229
|
+
if (ch === 34) {
|
|
3230
|
+
result += text.substring(start, pos);
|
|
3231
|
+
pos++;
|
|
3232
|
+
break;
|
|
3233
|
+
}
|
|
3234
|
+
if (ch === 92) {
|
|
3235
|
+
result += text.substring(start, pos);
|
|
3236
|
+
pos++;
|
|
3237
|
+
if (pos >= len) {
|
|
3238
|
+
scanError = 2;
|
|
3239
|
+
break;
|
|
3240
|
+
}
|
|
3241
|
+
switch (text.charCodeAt(pos++)) {
|
|
3242
|
+
case 34:
|
|
3243
|
+
result += "\"";
|
|
3244
|
+
break;
|
|
3245
|
+
case 92:
|
|
3246
|
+
result += "\\";
|
|
3247
|
+
break;
|
|
3248
|
+
case 47:
|
|
3249
|
+
result += "/";
|
|
3250
|
+
break;
|
|
3251
|
+
case 98:
|
|
3252
|
+
result += "\b";
|
|
3253
|
+
break;
|
|
3254
|
+
case 102:
|
|
3255
|
+
result += "\f";
|
|
3256
|
+
break;
|
|
3257
|
+
case 110:
|
|
3258
|
+
result += "\n";
|
|
3259
|
+
break;
|
|
3260
|
+
case 114:
|
|
3261
|
+
result += "\r";
|
|
3262
|
+
break;
|
|
3263
|
+
case 116:
|
|
3264
|
+
result += " ";
|
|
3265
|
+
break;
|
|
3266
|
+
case 117:
|
|
3267
|
+
const ch3 = scanHexDigits(4, true);
|
|
3268
|
+
if (ch3 >= 0) result += String.fromCharCode(ch3);
|
|
3269
|
+
else scanError = 4;
|
|
3270
|
+
break;
|
|
3271
|
+
default: scanError = 5;
|
|
3272
|
+
}
|
|
3273
|
+
start = pos;
|
|
3274
|
+
continue;
|
|
3275
|
+
}
|
|
3276
|
+
if (ch >= 0 && ch <= 31) if (isLineBreak(ch)) {
|
|
3277
|
+
result += text.substring(start, pos);
|
|
3278
|
+
scanError = 2;
|
|
3279
|
+
break;
|
|
3280
|
+
} else scanError = 6;
|
|
3281
|
+
pos++;
|
|
3327
3282
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3283
|
+
return result;
|
|
3284
|
+
}
|
|
3285
|
+
function scanNext() {
|
|
3286
|
+
value = "";
|
|
3287
|
+
scanError = 0;
|
|
3288
|
+
tokenOffset = pos;
|
|
3289
|
+
lineStartOffset = lineNumber;
|
|
3290
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
3291
|
+
if (pos >= len) {
|
|
3292
|
+
tokenOffset = len;
|
|
3293
|
+
return token = 17;
|
|
3294
|
+
}
|
|
3295
|
+
let code = text.charCodeAt(pos);
|
|
3296
|
+
if (isWhiteSpace(code)) {
|
|
3297
|
+
do {
|
|
3298
|
+
pos++;
|
|
3299
|
+
value += String.fromCharCode(code);
|
|
3300
|
+
code = text.charCodeAt(pos);
|
|
3301
|
+
} while (isWhiteSpace(code));
|
|
3302
|
+
return token = 15;
|
|
3303
|
+
}
|
|
3304
|
+
if (isLineBreak(code)) {
|
|
3305
|
+
pos++;
|
|
3306
|
+
value += String.fromCharCode(code);
|
|
3307
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
3308
|
+
pos++;
|
|
3309
|
+
value += "\n";
|
|
3310
|
+
}
|
|
3311
|
+
lineNumber++;
|
|
3312
|
+
tokenLineStartOffset = pos;
|
|
3313
|
+
return token = 14;
|
|
3314
|
+
}
|
|
3315
|
+
switch (code) {
|
|
3316
|
+
case 123:
|
|
3317
|
+
pos++;
|
|
3318
|
+
return token = 1;
|
|
3319
|
+
case 125:
|
|
3320
|
+
pos++;
|
|
3321
|
+
return token = 2;
|
|
3322
|
+
case 91:
|
|
3323
|
+
pos++;
|
|
3324
|
+
return token = 3;
|
|
3325
|
+
case 93:
|
|
3326
|
+
pos++;
|
|
3327
|
+
return token = 4;
|
|
3328
|
+
case 58:
|
|
3329
|
+
pos++;
|
|
3330
|
+
return token = 6;
|
|
3331
|
+
case 44:
|
|
3332
|
+
pos++;
|
|
3333
|
+
return token = 5;
|
|
3334
|
+
case 34:
|
|
3335
|
+
pos++;
|
|
3336
|
+
value = scanString();
|
|
3337
|
+
return token = 10;
|
|
3338
|
+
case 47:
|
|
3339
|
+
const start = pos - 1;
|
|
3340
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
3341
|
+
pos += 2;
|
|
3342
|
+
while (pos < len) {
|
|
3343
|
+
if (isLineBreak(text.charCodeAt(pos))) break;
|
|
3344
|
+
pos++;
|
|
3345
|
+
}
|
|
3346
|
+
value = text.substring(start, pos);
|
|
3347
|
+
return token = 12;
|
|
3348
|
+
}
|
|
3349
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
3350
|
+
pos += 2;
|
|
3351
|
+
const safeLength = len - 1;
|
|
3352
|
+
let commentClosed = false;
|
|
3353
|
+
while (pos < safeLength) {
|
|
3354
|
+
const ch = text.charCodeAt(pos);
|
|
3355
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
3356
|
+
pos += 2;
|
|
3357
|
+
commentClosed = true;
|
|
3358
|
+
break;
|
|
3359
|
+
}
|
|
3360
|
+
pos++;
|
|
3361
|
+
if (isLineBreak(ch)) {
|
|
3362
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) pos++;
|
|
3363
|
+
lineNumber++;
|
|
3364
|
+
tokenLineStartOffset = pos;
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
if (!commentClosed) {
|
|
3368
|
+
pos++;
|
|
3369
|
+
scanError = 1;
|
|
3370
|
+
}
|
|
3371
|
+
value = text.substring(start, pos);
|
|
3372
|
+
return token = 13;
|
|
3373
|
+
}
|
|
3374
|
+
value += String.fromCharCode(code);
|
|
3375
|
+
pos++;
|
|
3376
|
+
return token = 16;
|
|
3377
|
+
case 45:
|
|
3378
|
+
value += String.fromCharCode(code);
|
|
3379
|
+
pos++;
|
|
3380
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) return token = 16;
|
|
3381
|
+
case 48:
|
|
3382
|
+
case 49:
|
|
3383
|
+
case 50:
|
|
3384
|
+
case 51:
|
|
3385
|
+
case 52:
|
|
3386
|
+
case 53:
|
|
3387
|
+
case 54:
|
|
3388
|
+
case 55:
|
|
3389
|
+
case 56:
|
|
3390
|
+
case 57:
|
|
3391
|
+
value += scanNumber();
|
|
3392
|
+
return token = 11;
|
|
3393
|
+
default:
|
|
3394
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
3395
|
+
pos++;
|
|
3396
|
+
code = text.charCodeAt(pos);
|
|
3397
|
+
}
|
|
3398
|
+
if (tokenOffset !== pos) {
|
|
3399
|
+
value = text.substring(tokenOffset, pos);
|
|
3400
|
+
switch (value) {
|
|
3401
|
+
case "true": return token = 8;
|
|
3402
|
+
case "false": return token = 9;
|
|
3403
|
+
case "null": return token = 7;
|
|
3404
|
+
}
|
|
3405
|
+
return token = 16;
|
|
3406
|
+
}
|
|
3407
|
+
value += String.fromCharCode(code);
|
|
3408
|
+
pos++;
|
|
3409
|
+
return token = 16;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
function isUnknownContentCharacter(code) {
|
|
3413
|
+
if (isWhiteSpace(code) || isLineBreak(code)) return false;
|
|
3414
|
+
switch (code) {
|
|
3415
|
+
case 125:
|
|
3416
|
+
case 93:
|
|
3417
|
+
case 123:
|
|
3418
|
+
case 91:
|
|
3419
|
+
case 34:
|
|
3420
|
+
case 58:
|
|
3421
|
+
case 44:
|
|
3422
|
+
case 47: return false;
|
|
3423
|
+
}
|
|
3424
|
+
return true;
|
|
3425
|
+
}
|
|
3426
|
+
function scanNextNonTrivia() {
|
|
3427
|
+
let result;
|
|
3428
|
+
do
|
|
3429
|
+
result = scanNext();
|
|
3430
|
+
while (result >= 12 && result <= 15);
|
|
3431
|
+
return result;
|
|
3432
|
+
}
|
|
3433
|
+
return {
|
|
3434
|
+
setPosition,
|
|
3435
|
+
getPosition: () => pos,
|
|
3436
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
3437
|
+
getToken: () => token,
|
|
3438
|
+
getTokenValue: () => value,
|
|
3439
|
+
getTokenOffset: () => tokenOffset,
|
|
3440
|
+
getTokenLength: () => pos - tokenOffset,
|
|
3441
|
+
getTokenStartLine: () => lineStartOffset,
|
|
3442
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
3443
|
+
getTokenError: () => scanError
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function isWhiteSpace(ch) {
|
|
3447
|
+
return ch === 32 || ch === 9;
|
|
3448
|
+
}
|
|
3449
|
+
function isLineBreak(ch) {
|
|
3450
|
+
return ch === 10 || ch === 13;
|
|
3451
|
+
}
|
|
3452
|
+
function isDigit(ch) {
|
|
3453
|
+
return ch >= 48 && ch <= 57;
|
|
3454
|
+
}
|
|
3455
|
+
var CharacterCodes;
|
|
3456
|
+
(function(CharacterCodes) {
|
|
3457
|
+
CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed";
|
|
3458
|
+
CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn";
|
|
3459
|
+
CharacterCodes[CharacterCodes["space"] = 32] = "space";
|
|
3460
|
+
CharacterCodes[CharacterCodes["_0"] = 48] = "_0";
|
|
3461
|
+
CharacterCodes[CharacterCodes["_1"] = 49] = "_1";
|
|
3462
|
+
CharacterCodes[CharacterCodes["_2"] = 50] = "_2";
|
|
3463
|
+
CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
|
|
3464
|
+
CharacterCodes[CharacterCodes["_4"] = 52] = "_4";
|
|
3465
|
+
CharacterCodes[CharacterCodes["_5"] = 53] = "_5";
|
|
3466
|
+
CharacterCodes[CharacterCodes["_6"] = 54] = "_6";
|
|
3467
|
+
CharacterCodes[CharacterCodes["_7"] = 55] = "_7";
|
|
3468
|
+
CharacterCodes[CharacterCodes["_8"] = 56] = "_8";
|
|
3469
|
+
CharacterCodes[CharacterCodes["_9"] = 57] = "_9";
|
|
3470
|
+
CharacterCodes[CharacterCodes["a"] = 97] = "a";
|
|
3471
|
+
CharacterCodes[CharacterCodes["b"] = 98] = "b";
|
|
3472
|
+
CharacterCodes[CharacterCodes["c"] = 99] = "c";
|
|
3473
|
+
CharacterCodes[CharacterCodes["d"] = 100] = "d";
|
|
3474
|
+
CharacterCodes[CharacterCodes["e"] = 101] = "e";
|
|
3475
|
+
CharacterCodes[CharacterCodes["f"] = 102] = "f";
|
|
3476
|
+
CharacterCodes[CharacterCodes["g"] = 103] = "g";
|
|
3477
|
+
CharacterCodes[CharacterCodes["h"] = 104] = "h";
|
|
3478
|
+
CharacterCodes[CharacterCodes["i"] = 105] = "i";
|
|
3479
|
+
CharacterCodes[CharacterCodes["j"] = 106] = "j";
|
|
3480
|
+
CharacterCodes[CharacterCodes["k"] = 107] = "k";
|
|
3481
|
+
CharacterCodes[CharacterCodes["l"] = 108] = "l";
|
|
3482
|
+
CharacterCodes[CharacterCodes["m"] = 109] = "m";
|
|
3483
|
+
CharacterCodes[CharacterCodes["n"] = 110] = "n";
|
|
3484
|
+
CharacterCodes[CharacterCodes["o"] = 111] = "o";
|
|
3485
|
+
CharacterCodes[CharacterCodes["p"] = 112] = "p";
|
|
3486
|
+
CharacterCodes[CharacterCodes["q"] = 113] = "q";
|
|
3487
|
+
CharacterCodes[CharacterCodes["r"] = 114] = "r";
|
|
3488
|
+
CharacterCodes[CharacterCodes["s"] = 115] = "s";
|
|
3489
|
+
CharacterCodes[CharacterCodes["t"] = 116] = "t";
|
|
3490
|
+
CharacterCodes[CharacterCodes["u"] = 117] = "u";
|
|
3491
|
+
CharacterCodes[CharacterCodes["v"] = 118] = "v";
|
|
3492
|
+
CharacterCodes[CharacterCodes["w"] = 119] = "w";
|
|
3493
|
+
CharacterCodes[CharacterCodes["x"] = 120] = "x";
|
|
3494
|
+
CharacterCodes[CharacterCodes["y"] = 121] = "y";
|
|
3495
|
+
CharacterCodes[CharacterCodes["z"] = 122] = "z";
|
|
3496
|
+
CharacterCodes[CharacterCodes["A"] = 65] = "A";
|
|
3497
|
+
CharacterCodes[CharacterCodes["B"] = 66] = "B";
|
|
3498
|
+
CharacterCodes[CharacterCodes["C"] = 67] = "C";
|
|
3499
|
+
CharacterCodes[CharacterCodes["D"] = 68] = "D";
|
|
3500
|
+
CharacterCodes[CharacterCodes["E"] = 69] = "E";
|
|
3501
|
+
CharacterCodes[CharacterCodes["F"] = 70] = "F";
|
|
3502
|
+
CharacterCodes[CharacterCodes["G"] = 71] = "G";
|
|
3503
|
+
CharacterCodes[CharacterCodes["H"] = 72] = "H";
|
|
3504
|
+
CharacterCodes[CharacterCodes["I"] = 73] = "I";
|
|
3505
|
+
CharacterCodes[CharacterCodes["J"] = 74] = "J";
|
|
3506
|
+
CharacterCodes[CharacterCodes["K"] = 75] = "K";
|
|
3507
|
+
CharacterCodes[CharacterCodes["L"] = 76] = "L";
|
|
3508
|
+
CharacterCodes[CharacterCodes["M"] = 77] = "M";
|
|
3509
|
+
CharacterCodes[CharacterCodes["N"] = 78] = "N";
|
|
3510
|
+
CharacterCodes[CharacterCodes["O"] = 79] = "O";
|
|
3511
|
+
CharacterCodes[CharacterCodes["P"] = 80] = "P";
|
|
3512
|
+
CharacterCodes[CharacterCodes["Q"] = 81] = "Q";
|
|
3513
|
+
CharacterCodes[CharacterCodes["R"] = 82] = "R";
|
|
3514
|
+
CharacterCodes[CharacterCodes["S"] = 83] = "S";
|
|
3515
|
+
CharacterCodes[CharacterCodes["T"] = 84] = "T";
|
|
3516
|
+
CharacterCodes[CharacterCodes["U"] = 85] = "U";
|
|
3517
|
+
CharacterCodes[CharacterCodes["V"] = 86] = "V";
|
|
3518
|
+
CharacterCodes[CharacterCodes["W"] = 87] = "W";
|
|
3519
|
+
CharacterCodes[CharacterCodes["X"] = 88] = "X";
|
|
3520
|
+
CharacterCodes[CharacterCodes["Y"] = 89] = "Y";
|
|
3521
|
+
CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
|
|
3522
|
+
CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk";
|
|
3523
|
+
CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
|
|
3524
|
+
CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace";
|
|
3525
|
+
CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket";
|
|
3526
|
+
CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
|
|
3527
|
+
CharacterCodes[CharacterCodes["comma"] = 44] = "comma";
|
|
3528
|
+
CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
|
|
3529
|
+
CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote";
|
|
3530
|
+
CharacterCodes[CharacterCodes["minus"] = 45] = "minus";
|
|
3531
|
+
CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace";
|
|
3532
|
+
CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket";
|
|
3533
|
+
CharacterCodes[CharacterCodes["plus"] = 43] = "plus";
|
|
3534
|
+
CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
|
|
3535
|
+
CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed";
|
|
3536
|
+
CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
|
|
3537
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
3538
|
+
|
|
3539
|
+
//#endregion
|
|
3540
|
+
//#region node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
3541
|
+
const cachedSpaces = new Array(20).fill(0).map((_$2, index) => {
|
|
3542
|
+
return " ".repeat(index);
|
|
3543
|
+
});
|
|
3544
|
+
const maxCachedValues = 200;
|
|
3545
|
+
const cachedBreakLinesWithSpaces = {
|
|
3546
|
+
" ": {
|
|
3547
|
+
"\n": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3548
|
+
return "\n" + " ".repeat(index);
|
|
3549
|
+
}),
|
|
3550
|
+
"\r": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3551
|
+
return "\r" + " ".repeat(index);
|
|
3552
|
+
}),
|
|
3553
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3554
|
+
return "\r\n" + " ".repeat(index);
|
|
3555
|
+
})
|
|
3556
|
+
},
|
|
3557
|
+
" ": {
|
|
3558
|
+
"\n": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3559
|
+
return "\n" + " ".repeat(index);
|
|
3560
|
+
}),
|
|
3561
|
+
"\r": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3562
|
+
return "\r" + " ".repeat(index);
|
|
3563
|
+
}),
|
|
3564
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_$2, index) => {
|
|
3565
|
+
return "\r\n" + " ".repeat(index);
|
|
3566
|
+
})
|
|
3567
|
+
}
|
|
3568
|
+
};
|
|
3569
|
+
|
|
3570
|
+
//#endregion
|
|
3571
|
+
//#region node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
3572
|
+
var ParseOptions;
|
|
3573
|
+
(function(ParseOptions) {
|
|
3574
|
+
ParseOptions.DEFAULT = { allowTrailingComma: false };
|
|
3575
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
3576
|
+
/**
|
|
3577
|
+
* For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.
|
|
3578
|
+
*/
|
|
3579
|
+
function getLocation$1(text, position) {
|
|
3580
|
+
const segments = [];
|
|
3581
|
+
const earlyReturnException = /* @__PURE__ */ new Object();
|
|
3582
|
+
let previousNode = void 0;
|
|
3583
|
+
const previousNodeInst = {
|
|
3584
|
+
value: {},
|
|
3585
|
+
offset: 0,
|
|
3586
|
+
length: 0,
|
|
3587
|
+
type: "object",
|
|
3588
|
+
parent: void 0
|
|
3589
|
+
};
|
|
3590
|
+
let isAtPropertyKey = false;
|
|
3591
|
+
function setPreviousNode(value, offset, length, type) {
|
|
3592
|
+
previousNodeInst.value = value;
|
|
3593
|
+
previousNodeInst.offset = offset;
|
|
3594
|
+
previousNodeInst.length = length;
|
|
3595
|
+
previousNodeInst.type = type;
|
|
3596
|
+
previousNodeInst.colonOffset = void 0;
|
|
3597
|
+
previousNode = previousNodeInst;
|
|
3598
|
+
}
|
|
3599
|
+
try {
|
|
3600
|
+
visit$1(text, {
|
|
3601
|
+
onObjectBegin: (offset, length) => {
|
|
3602
|
+
if (position <= offset) throw earlyReturnException;
|
|
3603
|
+
previousNode = void 0;
|
|
3604
|
+
isAtPropertyKey = position > offset;
|
|
3605
|
+
segments.push("");
|
|
3606
|
+
},
|
|
3607
|
+
onObjectProperty: (name, offset, length) => {
|
|
3608
|
+
if (position < offset) throw earlyReturnException;
|
|
3609
|
+
setPreviousNode(name, offset, length, "property");
|
|
3610
|
+
segments[segments.length - 1] = name;
|
|
3611
|
+
if (position <= offset + length) throw earlyReturnException;
|
|
3612
|
+
},
|
|
3613
|
+
onObjectEnd: (offset, length) => {
|
|
3614
|
+
if (position <= offset) throw earlyReturnException;
|
|
3615
|
+
previousNode = void 0;
|
|
3616
|
+
segments.pop();
|
|
3617
|
+
},
|
|
3618
|
+
onArrayBegin: (offset, length) => {
|
|
3619
|
+
if (position <= offset) throw earlyReturnException;
|
|
3620
|
+
previousNode = void 0;
|
|
3621
|
+
segments.push(0);
|
|
3622
|
+
},
|
|
3623
|
+
onArrayEnd: (offset, length) => {
|
|
3624
|
+
if (position <= offset) throw earlyReturnException;
|
|
3625
|
+
previousNode = void 0;
|
|
3626
|
+
segments.pop();
|
|
3627
|
+
},
|
|
3628
|
+
onLiteralValue: (value, offset, length) => {
|
|
3629
|
+
if (position < offset) throw earlyReturnException;
|
|
3630
|
+
setPreviousNode(value, offset, length, getNodeType(value));
|
|
3631
|
+
if (position <= offset + length) throw earlyReturnException;
|
|
3632
|
+
},
|
|
3633
|
+
onSeparator: (sep, offset, length) => {
|
|
3634
|
+
if (position <= offset) throw earlyReturnException;
|
|
3635
|
+
if (sep === ":" && previousNode && previousNode.type === "property") {
|
|
3636
|
+
previousNode.colonOffset = offset;
|
|
3637
|
+
isAtPropertyKey = false;
|
|
3638
|
+
previousNode = void 0;
|
|
3639
|
+
} else if (sep === ",") {
|
|
3640
|
+
const last = segments[segments.length - 1];
|
|
3641
|
+
if (typeof last === "number") segments[segments.length - 1] = last + 1;
|
|
3642
|
+
else {
|
|
3643
|
+
isAtPropertyKey = true;
|
|
3644
|
+
segments[segments.length - 1] = "";
|
|
3645
|
+
}
|
|
3646
|
+
previousNode = void 0;
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
});
|
|
3650
|
+
} catch (e$1) {
|
|
3651
|
+
if (e$1 !== earlyReturnException) throw e$1;
|
|
3652
|
+
}
|
|
3653
|
+
return {
|
|
3654
|
+
path: segments,
|
|
3655
|
+
previousNode,
|
|
3656
|
+
isAtPropertyKey,
|
|
3657
|
+
matches: (pattern) => {
|
|
3658
|
+
let k$2 = 0;
|
|
3659
|
+
for (let i = 0; k$2 < pattern.length && i < segments.length; i++) if (pattern[k$2] === segments[i] || pattern[k$2] === "*") k$2++;
|
|
3660
|
+
else if (pattern[k$2] !== "**") return false;
|
|
3661
|
+
return k$2 === pattern.length;
|
|
3662
|
+
}
|
|
3663
|
+
};
|
|
3664
|
+
}
|
|
3665
|
+
/**
|
|
3666
|
+
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
3667
|
+
* Therefore always check the errors list to find out if the input was valid.
|
|
3668
|
+
*/
|
|
3669
|
+
function parse$1(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
3670
|
+
let currentProperty = null;
|
|
3671
|
+
let currentParent = [];
|
|
3672
|
+
const previousParents = [];
|
|
3673
|
+
function onValue(value) {
|
|
3674
|
+
if (Array.isArray(currentParent)) currentParent.push(value);
|
|
3675
|
+
else if (currentProperty !== null) currentParent[currentProperty] = value;
|
|
3676
|
+
}
|
|
3677
|
+
visit$1(text, {
|
|
3678
|
+
onObjectBegin: () => {
|
|
3679
|
+
const object = {};
|
|
3680
|
+
onValue(object);
|
|
3681
|
+
previousParents.push(currentParent);
|
|
3682
|
+
currentParent = object;
|
|
3683
|
+
currentProperty = null;
|
|
3684
|
+
},
|
|
3685
|
+
onObjectProperty: (name) => {
|
|
3686
|
+
currentProperty = name;
|
|
3687
|
+
},
|
|
3688
|
+
onObjectEnd: () => {
|
|
3689
|
+
currentParent = previousParents.pop();
|
|
3690
|
+
},
|
|
3691
|
+
onArrayBegin: () => {
|
|
3692
|
+
const array = [];
|
|
3693
|
+
onValue(array);
|
|
3694
|
+
previousParents.push(currentParent);
|
|
3695
|
+
currentParent = array;
|
|
3696
|
+
currentProperty = null;
|
|
3697
|
+
},
|
|
3698
|
+
onArrayEnd: () => {
|
|
3699
|
+
currentParent = previousParents.pop();
|
|
3700
|
+
},
|
|
3701
|
+
onLiteralValue: onValue,
|
|
3702
|
+
onError: (error, offset, length) => {
|
|
3703
|
+
errors.push({
|
|
3704
|
+
error,
|
|
3705
|
+
offset,
|
|
3706
|
+
length
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
}, options);
|
|
3710
|
+
return currentParent[0];
|
|
3711
|
+
}
|
|
3712
|
+
/**
|
|
3713
|
+
* Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
3714
|
+
*/
|
|
3715
|
+
function parseTree$1(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
3716
|
+
let currentParent = {
|
|
3717
|
+
type: "array",
|
|
3718
|
+
offset: -1,
|
|
3719
|
+
length: -1,
|
|
3720
|
+
children: [],
|
|
3721
|
+
parent: void 0
|
|
3722
|
+
};
|
|
3723
|
+
function ensurePropertyComplete(endOffset) {
|
|
3724
|
+
if (currentParent.type === "property") {
|
|
3725
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
3726
|
+
currentParent = currentParent.parent;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
function onValue(valueNode) {
|
|
3730
|
+
currentParent.children.push(valueNode);
|
|
3731
|
+
return valueNode;
|
|
3732
|
+
}
|
|
3733
|
+
visit$1(text, {
|
|
3734
|
+
onObjectBegin: (offset) => {
|
|
3735
|
+
currentParent = onValue({
|
|
3736
|
+
type: "object",
|
|
3737
|
+
offset,
|
|
3738
|
+
length: -1,
|
|
3739
|
+
parent: currentParent,
|
|
3740
|
+
children: []
|
|
3741
|
+
});
|
|
3742
|
+
},
|
|
3743
|
+
onObjectProperty: (name, offset, length) => {
|
|
3744
|
+
currentParent = onValue({
|
|
3745
|
+
type: "property",
|
|
3746
|
+
offset,
|
|
3747
|
+
length: -1,
|
|
3748
|
+
parent: currentParent,
|
|
3749
|
+
children: []
|
|
3750
|
+
});
|
|
3751
|
+
currentParent.children.push({
|
|
3752
|
+
type: "string",
|
|
3753
|
+
value: name,
|
|
3754
|
+
offset,
|
|
3755
|
+
length,
|
|
3756
|
+
parent: currentParent
|
|
3757
|
+
});
|
|
3758
|
+
},
|
|
3759
|
+
onObjectEnd: (offset, length) => {
|
|
3760
|
+
ensurePropertyComplete(offset + length);
|
|
3761
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
3762
|
+
currentParent = currentParent.parent;
|
|
3763
|
+
ensurePropertyComplete(offset + length);
|
|
3764
|
+
},
|
|
3765
|
+
onArrayBegin: (offset, length) => {
|
|
3766
|
+
currentParent = onValue({
|
|
3767
|
+
type: "array",
|
|
3768
|
+
offset,
|
|
3769
|
+
length: -1,
|
|
3770
|
+
parent: currentParent,
|
|
3771
|
+
children: []
|
|
3341
3772
|
});
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3773
|
+
},
|
|
3774
|
+
onArrayEnd: (offset, length) => {
|
|
3775
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
3776
|
+
currentParent = currentParent.parent;
|
|
3777
|
+
ensurePropertyComplete(offset + length);
|
|
3778
|
+
},
|
|
3779
|
+
onLiteralValue: (value, offset, length) => {
|
|
3780
|
+
onValue({
|
|
3781
|
+
type: getNodeType(value),
|
|
3782
|
+
offset,
|
|
3783
|
+
length,
|
|
3784
|
+
parent: currentParent,
|
|
3785
|
+
value
|
|
3786
|
+
});
|
|
3787
|
+
ensurePropertyComplete(offset + length);
|
|
3788
|
+
},
|
|
3789
|
+
onSeparator: (sep, offset, length) => {
|
|
3790
|
+
if (currentParent.type === "property") {
|
|
3791
|
+
if (sep === ":") currentParent.colonOffset = offset;
|
|
3792
|
+
else if (sep === ",") ensurePropertyComplete(offset);
|
|
3348
3793
|
}
|
|
3349
|
-
|
|
3794
|
+
},
|
|
3795
|
+
onError: (error, offset, length) => {
|
|
3796
|
+
errors.push({
|
|
3797
|
+
error,
|
|
3798
|
+
offset,
|
|
3799
|
+
length
|
|
3800
|
+
});
|
|
3350
3801
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3802
|
+
}, options);
|
|
3803
|
+
const result = currentParent.children[0];
|
|
3804
|
+
if (result) delete result.parent;
|
|
3805
|
+
return result;
|
|
3806
|
+
}
|
|
3807
|
+
/**
|
|
3808
|
+
* Finds the node at the given path in a JSON DOM.
|
|
3809
|
+
*/
|
|
3810
|
+
function findNodeAtLocation$1(root, path) {
|
|
3811
|
+
if (!root) return;
|
|
3812
|
+
let node = root;
|
|
3813
|
+
for (let segment of path) if (typeof segment === "string") {
|
|
3814
|
+
if (node.type !== "object" || !Array.isArray(node.children)) return;
|
|
3815
|
+
let found = false;
|
|
3816
|
+
for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
3817
|
+
node = propertyNode.children[1];
|
|
3818
|
+
found = true;
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3821
|
+
if (!found) return;
|
|
3822
|
+
} else {
|
|
3823
|
+
const index = segment;
|
|
3824
|
+
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) return;
|
|
3825
|
+
node = node.children[index];
|
|
3826
|
+
}
|
|
3827
|
+
return node;
|
|
3828
|
+
}
|
|
3829
|
+
/**
|
|
3830
|
+
* Gets the JSON path of the given JSON DOM node
|
|
3831
|
+
*/
|
|
3832
|
+
function getNodePath$1(node) {
|
|
3833
|
+
if (!node.parent || !node.parent.children) return [];
|
|
3834
|
+
const path = getNodePath$1(node.parent);
|
|
3835
|
+
if (node.parent.type === "property") {
|
|
3836
|
+
const key = node.parent.children[0].value;
|
|
3837
|
+
path.push(key);
|
|
3838
|
+
} else if (node.parent.type === "array") {
|
|
3839
|
+
const index = node.parent.children.indexOf(node);
|
|
3840
|
+
if (index !== -1) path.push(index);
|
|
3841
|
+
}
|
|
3842
|
+
return path;
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Evaluates the JavaScript object of the given JSON DOM node
|
|
3846
|
+
*/
|
|
3847
|
+
function getNodeValue$1(node) {
|
|
3848
|
+
switch (node.type) {
|
|
3849
|
+
case "array": return node.children.map(getNodeValue$1);
|
|
3850
|
+
case "object":
|
|
3851
|
+
const obj = Object.create(null);
|
|
3852
|
+
for (let prop of node.children) {
|
|
3853
|
+
const valueNode = prop.children[1];
|
|
3854
|
+
if (valueNode) obj[prop.children[0].value] = getNodeValue$1(valueNode);
|
|
3855
|
+
}
|
|
3856
|
+
return obj;
|
|
3857
|
+
case "null":
|
|
3858
|
+
case "string":
|
|
3859
|
+
case "number":
|
|
3860
|
+
case "boolean": return node.value;
|
|
3861
|
+
default: return;
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
function contains(node, offset, includeRightBound = false) {
|
|
3865
|
+
return offset >= node.offset && offset < node.offset + node.length || includeRightBound && offset === node.offset + node.length;
|
|
3866
|
+
}
|
|
3867
|
+
/**
|
|
3868
|
+
* Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
3869
|
+
*/
|
|
3870
|
+
function findNodeAtOffset$1(node, offset, includeRightBound = false) {
|
|
3871
|
+
if (contains(node, offset, includeRightBound)) {
|
|
3872
|
+
const children = node.children;
|
|
3873
|
+
if (Array.isArray(children)) for (let i = 0; i < children.length && children[i].offset <= offset; i++) {
|
|
3874
|
+
const item = findNodeAtOffset$1(children[i], offset, includeRightBound);
|
|
3875
|
+
if (item) return item;
|
|
3876
|
+
}
|
|
3877
|
+
return node;
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
/**
|
|
3881
|
+
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
3882
|
+
*/
|
|
3883
|
+
function visit$1(text, visitor, options = ParseOptions.DEFAULT) {
|
|
3884
|
+
const _scanner = createScanner$1(text, false);
|
|
3885
|
+
const _jsonPath = [];
|
|
3886
|
+
let suppressedCallbacks = 0;
|
|
3887
|
+
function toNoArgVisit(visitFunction) {
|
|
3888
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
3889
|
+
}
|
|
3890
|
+
function toOneArgVisit(visitFunction) {
|
|
3891
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
3892
|
+
}
|
|
3893
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
3894
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
3895
|
+
}
|
|
3896
|
+
function toBeginVisit(visitFunction) {
|
|
3897
|
+
return visitFunction ? () => {
|
|
3898
|
+
if (suppressedCallbacks > 0) suppressedCallbacks++;
|
|
3899
|
+
else if (visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) === false) suppressedCallbacks = 1;
|
|
3900
|
+
} : () => true;
|
|
3901
|
+
}
|
|
3902
|
+
function toEndVisit(visitFunction) {
|
|
3903
|
+
return visitFunction ? () => {
|
|
3904
|
+
if (suppressedCallbacks > 0) suppressedCallbacks--;
|
|
3905
|
+
if (suppressedCallbacks === 0) visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
3906
|
+
} : () => true;
|
|
3907
|
+
}
|
|
3908
|
+
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
3909
|
+
const disallowComments = options && options.disallowComments;
|
|
3910
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
3911
|
+
function scanNext() {
|
|
3912
|
+
while (true) {
|
|
3913
|
+
const token = _scanner.scan();
|
|
3914
|
+
switch (_scanner.getTokenError()) {
|
|
3915
|
+
case 4:
|
|
3916
|
+
handleError(14);
|
|
3917
|
+
break;
|
|
3918
|
+
case 5:
|
|
3919
|
+
handleError(15);
|
|
3920
|
+
break;
|
|
3921
|
+
case 3:
|
|
3922
|
+
handleError(13);
|
|
3923
|
+
break;
|
|
3924
|
+
case 1:
|
|
3925
|
+
if (!disallowComments) handleError(11);
|
|
3926
|
+
break;
|
|
3927
|
+
case 2:
|
|
3928
|
+
handleError(12);
|
|
3929
|
+
break;
|
|
3930
|
+
case 6:
|
|
3931
|
+
handleError(16);
|
|
3932
|
+
break;
|
|
3933
|
+
}
|
|
3934
|
+
switch (token) {
|
|
3935
|
+
case 12:
|
|
3936
|
+
case 13:
|
|
3937
|
+
if (disallowComments) handleError(10);
|
|
3938
|
+
else onComment();
|
|
3939
|
+
break;
|
|
3940
|
+
case 16:
|
|
3941
|
+
handleError(1);
|
|
3942
|
+
break;
|
|
3943
|
+
case 15:
|
|
3944
|
+
case 14: break;
|
|
3945
|
+
default: return token;
|
|
3946
|
+
}
|
|
3947
|
+
}
|
|
3948
|
+
}
|
|
3949
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
3950
|
+
onError(error);
|
|
3951
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
3952
|
+
let token = _scanner.getToken();
|
|
3953
|
+
while (token !== 17) {
|
|
3954
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
3955
|
+
scanNext();
|
|
3956
|
+
break;
|
|
3957
|
+
} else if (skipUntil.indexOf(token) !== -1) break;
|
|
3958
|
+
token = scanNext();
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
function parseString(isValue) {
|
|
3963
|
+
const value = _scanner.getTokenValue();
|
|
3964
|
+
if (isValue) onLiteralValue(value);
|
|
3965
|
+
else {
|
|
3966
|
+
onObjectProperty(value);
|
|
3967
|
+
_jsonPath.push(value);
|
|
3968
|
+
}
|
|
3969
|
+
scanNext();
|
|
3970
|
+
return true;
|
|
3971
|
+
}
|
|
3972
|
+
function parseLiteral() {
|
|
3973
|
+
switch (_scanner.getToken()) {
|
|
3974
|
+
case 11:
|
|
3975
|
+
const tokenValue = _scanner.getTokenValue();
|
|
3976
|
+
let value = Number(tokenValue);
|
|
3977
|
+
if (isNaN(value)) {
|
|
3978
|
+
handleError(2);
|
|
3979
|
+
value = 0;
|
|
3980
|
+
}
|
|
3981
|
+
onLiteralValue(value);
|
|
3982
|
+
break;
|
|
3983
|
+
case 7:
|
|
3984
|
+
onLiteralValue(null);
|
|
3985
|
+
break;
|
|
3986
|
+
case 8:
|
|
3987
|
+
onLiteralValue(true);
|
|
3988
|
+
break;
|
|
3989
|
+
case 9:
|
|
3990
|
+
onLiteralValue(false);
|
|
3991
|
+
break;
|
|
3992
|
+
default: return false;
|
|
3993
|
+
}
|
|
3994
|
+
scanNext();
|
|
3995
|
+
return true;
|
|
3996
|
+
}
|
|
3997
|
+
function parseProperty() {
|
|
3998
|
+
if (_scanner.getToken() !== 10) {
|
|
3999
|
+
handleError(3, [], [2, 5]);
|
|
4000
|
+
return false;
|
|
4001
|
+
}
|
|
4002
|
+
parseString(false);
|
|
4003
|
+
if (_scanner.getToken() === 6) {
|
|
4004
|
+
onSeparator(":");
|
|
4005
|
+
scanNext();
|
|
4006
|
+
if (!parseValue()) handleError(4, [], [2, 5]);
|
|
4007
|
+
} else handleError(5, [], [2, 5]);
|
|
4008
|
+
_jsonPath.pop();
|
|
4009
|
+
return true;
|
|
4010
|
+
}
|
|
4011
|
+
function parseObject() {
|
|
4012
|
+
onObjectBegin();
|
|
4013
|
+
scanNext();
|
|
4014
|
+
let needsComma = false;
|
|
4015
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
4016
|
+
if (_scanner.getToken() === 5) {
|
|
4017
|
+
if (!needsComma) handleError(4, [], []);
|
|
4018
|
+
onSeparator(",");
|
|
4019
|
+
scanNext();
|
|
4020
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) break;
|
|
4021
|
+
} else if (needsComma) handleError(6, [], []);
|
|
4022
|
+
if (!parseProperty()) handleError(4, [], [2, 5]);
|
|
4023
|
+
needsComma = true;
|
|
4024
|
+
}
|
|
4025
|
+
onObjectEnd();
|
|
4026
|
+
if (_scanner.getToken() !== 2) handleError(7, [2], []);
|
|
4027
|
+
else scanNext();
|
|
4028
|
+
return true;
|
|
4029
|
+
}
|
|
4030
|
+
function parseArray() {
|
|
4031
|
+
onArrayBegin();
|
|
4032
|
+
scanNext();
|
|
4033
|
+
let isFirstElement = true;
|
|
4034
|
+
let needsComma = false;
|
|
4035
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
4036
|
+
if (_scanner.getToken() === 5) {
|
|
4037
|
+
if (!needsComma) handleError(4, [], []);
|
|
4038
|
+
onSeparator(",");
|
|
4039
|
+
scanNext();
|
|
4040
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) break;
|
|
4041
|
+
} else if (needsComma) handleError(6, [], []);
|
|
4042
|
+
if (isFirstElement) {
|
|
4043
|
+
_jsonPath.push(0);
|
|
4044
|
+
isFirstElement = false;
|
|
4045
|
+
} else _jsonPath[_jsonPath.length - 1]++;
|
|
4046
|
+
if (!parseValue()) handleError(4, [], [4, 5]);
|
|
4047
|
+
needsComma = true;
|
|
4048
|
+
}
|
|
4049
|
+
onArrayEnd();
|
|
4050
|
+
if (!isFirstElement) _jsonPath.pop();
|
|
4051
|
+
if (_scanner.getToken() !== 4) handleError(8, [4], []);
|
|
4052
|
+
else scanNext();
|
|
4053
|
+
return true;
|
|
4054
|
+
}
|
|
4055
|
+
function parseValue() {
|
|
4056
|
+
switch (_scanner.getToken()) {
|
|
4057
|
+
case 3: return parseArray();
|
|
4058
|
+
case 1: return parseObject();
|
|
4059
|
+
case 10: return parseString(true);
|
|
4060
|
+
default: return parseLiteral();
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
scanNext();
|
|
4064
|
+
if (_scanner.getToken() === 17) {
|
|
4065
|
+
if (options.allowEmptyContent) return true;
|
|
4066
|
+
handleError(4, [], []);
|
|
4067
|
+
return false;
|
|
4068
|
+
}
|
|
4069
|
+
if (!parseValue()) {
|
|
4070
|
+
handleError(4, [], []);
|
|
4071
|
+
return false;
|
|
4072
|
+
}
|
|
4073
|
+
if (_scanner.getToken() !== 17) handleError(9, [], []);
|
|
4074
|
+
return true;
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* Takes JSON with JavaScript-style comments and remove
|
|
4078
|
+
* them. Optionally replaces every none-newline character
|
|
4079
|
+
* of comments with a replaceCharacter
|
|
4080
|
+
*/
|
|
4081
|
+
function stripComments$1(text, replaceCh) {
|
|
4082
|
+
let _scanner = createScanner$1(text), parts = [], kind, offset = 0, pos;
|
|
4083
|
+
do {
|
|
4084
|
+
pos = _scanner.getPosition();
|
|
4085
|
+
kind = _scanner.scan();
|
|
4086
|
+
switch (kind) {
|
|
4087
|
+
case 12:
|
|
4088
|
+
case 13:
|
|
4089
|
+
case 17:
|
|
4090
|
+
if (offset !== pos) parts.push(text.substring(offset, pos));
|
|
4091
|
+
if (replaceCh !== void 0) parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
|
|
4092
|
+
offset = _scanner.getPosition();
|
|
4093
|
+
break;
|
|
4094
|
+
}
|
|
4095
|
+
} while (kind !== 17);
|
|
4096
|
+
return parts.join("");
|
|
4097
|
+
}
|
|
4098
|
+
function getNodeType(value) {
|
|
4099
|
+
switch (typeof value) {
|
|
4100
|
+
case "boolean": return "boolean";
|
|
4101
|
+
case "number": return "number";
|
|
4102
|
+
case "string": return "string";
|
|
4103
|
+
case "object":
|
|
4104
|
+
if (!value) return "null";
|
|
4105
|
+
else if (Array.isArray(value)) return "array";
|
|
4106
|
+
return "object";
|
|
4107
|
+
default: return "null";
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
//#endregion
|
|
4112
|
+
//#region node_modules/jsonc-parser/lib/esm/main.js
|
|
4113
|
+
/**
|
|
4114
|
+
* Creates a JSON scanner on the given text.
|
|
4115
|
+
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
4116
|
+
*/
|
|
4117
|
+
const createScanner = createScanner$1;
|
|
4118
|
+
var ScanError;
|
|
4119
|
+
(function(ScanError) {
|
|
4120
|
+
ScanError[ScanError["None"] = 0] = "None";
|
|
4121
|
+
ScanError[ScanError["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
4122
|
+
ScanError[ScanError["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
4123
|
+
ScanError[ScanError["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
4124
|
+
ScanError[ScanError["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
4125
|
+
ScanError[ScanError["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
4126
|
+
ScanError[ScanError["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
4127
|
+
})(ScanError || (ScanError = {}));
|
|
4128
|
+
var SyntaxKind;
|
|
4129
|
+
(function(SyntaxKind) {
|
|
4130
|
+
SyntaxKind[SyntaxKind["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
4131
|
+
SyntaxKind[SyntaxKind["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
4132
|
+
SyntaxKind[SyntaxKind["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
4133
|
+
SyntaxKind[SyntaxKind["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
4134
|
+
SyntaxKind[SyntaxKind["CommaToken"] = 5] = "CommaToken";
|
|
4135
|
+
SyntaxKind[SyntaxKind["ColonToken"] = 6] = "ColonToken";
|
|
4136
|
+
SyntaxKind[SyntaxKind["NullKeyword"] = 7] = "NullKeyword";
|
|
4137
|
+
SyntaxKind[SyntaxKind["TrueKeyword"] = 8] = "TrueKeyword";
|
|
4138
|
+
SyntaxKind[SyntaxKind["FalseKeyword"] = 9] = "FalseKeyword";
|
|
4139
|
+
SyntaxKind[SyntaxKind["StringLiteral"] = 10] = "StringLiteral";
|
|
4140
|
+
SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral";
|
|
4141
|
+
SyntaxKind[SyntaxKind["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
4142
|
+
SyntaxKind[SyntaxKind["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
4143
|
+
SyntaxKind[SyntaxKind["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
4144
|
+
SyntaxKind[SyntaxKind["Trivia"] = 15] = "Trivia";
|
|
4145
|
+
SyntaxKind[SyntaxKind["Unknown"] = 16] = "Unknown";
|
|
4146
|
+
SyntaxKind[SyntaxKind["EOF"] = 17] = "EOF";
|
|
4147
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
4148
|
+
/**
|
|
4149
|
+
* For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.
|
|
4150
|
+
*/
|
|
4151
|
+
const getLocation = getLocation$1;
|
|
4152
|
+
/**
|
|
4153
|
+
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
4154
|
+
* Therefore, always check the errors list to find out if the input was valid.
|
|
4155
|
+
*/
|
|
4156
|
+
const parse = parse$1;
|
|
4157
|
+
/**
|
|
4158
|
+
* Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
4159
|
+
*/
|
|
4160
|
+
const parseTree = parseTree$1;
|
|
4161
|
+
/**
|
|
4162
|
+
* Finds the node at the given path in a JSON DOM.
|
|
4163
|
+
*/
|
|
4164
|
+
const findNodeAtLocation = findNodeAtLocation$1;
|
|
4165
|
+
/**
|
|
4166
|
+
* Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
4167
|
+
*/
|
|
4168
|
+
const findNodeAtOffset = findNodeAtOffset$1;
|
|
4169
|
+
/**
|
|
4170
|
+
* Gets the JSON path of the given JSON DOM node
|
|
4171
|
+
*/
|
|
4172
|
+
const getNodePath = getNodePath$1;
|
|
4173
|
+
/**
|
|
4174
|
+
* Evaluates the JavaScript object of the given JSON DOM node
|
|
4175
|
+
*/
|
|
4176
|
+
const getNodeValue = getNodeValue$1;
|
|
4177
|
+
/**
|
|
4178
|
+
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
4179
|
+
*/
|
|
4180
|
+
const visit = visit$1;
|
|
4181
|
+
/**
|
|
4182
|
+
* Takes JSON with JavaScript-style comments and remove
|
|
4183
|
+
* them. Optionally replaces every none-newline character
|
|
4184
|
+
* of comments with a replaceCharacter
|
|
4185
|
+
*/
|
|
4186
|
+
const stripComments = stripComments$1;
|
|
4187
|
+
var ParseErrorCode;
|
|
4188
|
+
(function(ParseErrorCode) {
|
|
4189
|
+
ParseErrorCode[ParseErrorCode["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
4190
|
+
ParseErrorCode[ParseErrorCode["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
4191
|
+
ParseErrorCode[ParseErrorCode["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
4192
|
+
ParseErrorCode[ParseErrorCode["ValueExpected"] = 4] = "ValueExpected";
|
|
4193
|
+
ParseErrorCode[ParseErrorCode["ColonExpected"] = 5] = "ColonExpected";
|
|
4194
|
+
ParseErrorCode[ParseErrorCode["CommaExpected"] = 6] = "CommaExpected";
|
|
4195
|
+
ParseErrorCode[ParseErrorCode["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
4196
|
+
ParseErrorCode[ParseErrorCode["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
4197
|
+
ParseErrorCode[ParseErrorCode["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
4198
|
+
ParseErrorCode[ParseErrorCode["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
4199
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
4200
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
4201
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
4202
|
+
ParseErrorCode[ParseErrorCode["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
4203
|
+
ParseErrorCode[ParseErrorCode["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
4204
|
+
ParseErrorCode[ParseErrorCode["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
4205
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
4206
|
+
function printParseErrorCode(code) {
|
|
4207
|
+
switch (code) {
|
|
4208
|
+
case 1: return "InvalidSymbol";
|
|
4209
|
+
case 2: return "InvalidNumberFormat";
|
|
4210
|
+
case 3: return "PropertyNameExpected";
|
|
4211
|
+
case 4: return "ValueExpected";
|
|
4212
|
+
case 5: return "ColonExpected";
|
|
4213
|
+
case 6: return "CommaExpected";
|
|
4214
|
+
case 7: return "CloseBraceExpected";
|
|
4215
|
+
case 8: return "CloseBracketExpected";
|
|
4216
|
+
case 9: return "EndOfFileExpected";
|
|
4217
|
+
case 10: return "InvalidCommentToken";
|
|
4218
|
+
case 11: return "UnexpectedEndOfComment";
|
|
4219
|
+
case 12: return "UnexpectedEndOfString";
|
|
4220
|
+
case 13: return "UnexpectedEndOfNumber";
|
|
4221
|
+
case 14: return "InvalidUnicode";
|
|
4222
|
+
case 15: return "InvalidEscapeCharacter";
|
|
4223
|
+
case 16: return "InvalidCharacter";
|
|
4224
|
+
}
|
|
4225
|
+
return "<unknown ParseErrorCode>";
|
|
4226
|
+
}
|
|
3354
4227
|
|
|
3355
4228
|
//#endregion
|
|
3356
4229
|
//#region src/lib/config.ts
|
|
3357
|
-
var import_main = require_main();
|
|
3358
4230
|
/**
|
|
3359
4231
|
* Loads config from .e2smrc.jsonc or .e2smrc.json (project or global).
|
|
3360
4232
|
* Searches in order: .jsonc (preferred) then .json (backward compatibility).
|
|
@@ -3378,9 +4250,9 @@ async function loadConfig() {
|
|
|
3378
4250
|
continue;
|
|
3379
4251
|
}
|
|
3380
4252
|
const errors = [];
|
|
3381
|
-
const config =
|
|
4253
|
+
const config = parse(content, errors, { allowTrailingComma: true });
|
|
3382
4254
|
if (errors.length > 0) {
|
|
3383
|
-
const errorMessages = errors.map((e$1) =>
|
|
4255
|
+
const errorMessages = errors.map((e$1) => printParseErrorCode(e$1.error)).join(", ");
|
|
3384
4256
|
console.warn(`Warning: Parse error in ${filePath}: ${errorMessages}`);
|
|
3385
4257
|
console.warn("Skipping this config file and trying next candidate...");
|
|
3386
4258
|
continue;
|
|
@@ -3452,7 +4324,7 @@ function isCancel$3(value) {
|
|
|
3452
4324
|
}
|
|
3453
4325
|
const MIN_RECOVERY_DAYS = 7;
|
|
3454
4326
|
const MAX_RECOVERY_DAYS = 30;
|
|
3455
|
-
const deleteCommand = define
|
|
4327
|
+
const deleteCommand = define({
|
|
3456
4328
|
name: "delete",
|
|
3457
4329
|
description: "Delete secret from AWS Secrets Manager",
|
|
3458
4330
|
args: {
|
|
@@ -3592,7 +4464,7 @@ const deleteCommand = define$1({
|
|
|
3592
4464
|
function isCancel$2(value) {
|
|
3593
4465
|
return pD(value);
|
|
3594
4466
|
}
|
|
3595
|
-
const getCommand = define
|
|
4467
|
+
const getCommand = define({
|
|
3596
4468
|
name: "get",
|
|
3597
4469
|
description: "Get secret value from AWS Secrets Manager",
|
|
3598
4470
|
args: {
|
|
@@ -3695,7 +4567,7 @@ var template_default = "{\n \"$schema\": \"https://unpkg.com/e2sm/assets/schema
|
|
|
3695
4567
|
//#endregion
|
|
3696
4568
|
//#region src/commands/init.ts
|
|
3697
4569
|
const CONFIG_FILE = ".e2smrc.jsonc";
|
|
3698
|
-
const initCommand = define
|
|
4570
|
+
const initCommand = define({
|
|
3699
4571
|
name: "init",
|
|
3700
4572
|
description: "Initialize a new .e2smrc.jsonc configuration file",
|
|
3701
4573
|
args: { force: {
|
|
@@ -3739,7 +4611,7 @@ const initCommand = define$1({
|
|
|
3739
4611
|
function isCancel$1(value) {
|
|
3740
4612
|
return pD(value);
|
|
3741
4613
|
}
|
|
3742
|
-
const pullCommand = define
|
|
4614
|
+
const pullCommand = define({
|
|
3743
4615
|
name: "pull",
|
|
3744
4616
|
description: "Pull secret from AWS Secrets Manager and generate .env file",
|
|
3745
4617
|
args: {
|
|
@@ -3911,7 +4783,7 @@ const pullCommand = define$1({
|
|
|
3911
4783
|
function isCancel(value) {
|
|
3912
4784
|
return pD(value);
|
|
3913
4785
|
}
|
|
3914
|
-
const setCommand = define
|
|
4786
|
+
const setCommand = define({
|
|
3915
4787
|
name: "set",
|
|
3916
4788
|
description: "Upload .env file to AWS Secrets Manager",
|
|
3917
4789
|
args: {
|
|
@@ -4127,7 +4999,7 @@ const setCommand = define$1({
|
|
|
4127
4999
|
|
|
4128
5000
|
//#endregion
|
|
4129
5001
|
//#region src/index.ts
|
|
4130
|
-
const command = define
|
|
5002
|
+
const command = define({
|
|
4131
5003
|
name: "e2sm",
|
|
4132
5004
|
description: "Manage environment variables with AWS Secrets Manager",
|
|
4133
5005
|
run: () => {
|