@temps-sdk/cli 0.1.35 → 0.1.36
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.js +1376 -197
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74090,152 +74090,6 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
|
74090
74090
|
}
|
|
74091
74091
|
});
|
|
74092
74092
|
|
|
74093
|
-
// node_modules/jsonc-parser/lib/umd/main.js
|
|
74094
|
-
var require_main = __commonJS((exports, module) => {
|
|
74095
|
-
(function(factory) {
|
|
74096
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
74097
|
-
var v = factory(__require, exports);
|
|
74098
|
-
if (v !== undefined)
|
|
74099
|
-
module.exports = v;
|
|
74100
|
-
} else if (typeof define === "function" && define.amd) {
|
|
74101
|
-
define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory);
|
|
74102
|
-
}
|
|
74103
|
-
})(function(require2, exports2) {
|
|
74104
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
74105
|
-
exports2.applyEdits = exports2.modify = exports2.format = exports2.printParseErrorCode = exports2.ParseErrorCode = exports2.stripComments = exports2.visit = exports2.getNodeValue = exports2.getNodePath = exports2.findNodeAtOffset = exports2.findNodeAtLocation = exports2.parseTree = exports2.parse = exports2.getLocation = exports2.SyntaxKind = exports2.ScanError = exports2.createScanner = undefined;
|
|
74106
|
-
const formatter = require2("./impl/format");
|
|
74107
|
-
const edit = require2("./impl/edit");
|
|
74108
|
-
const scanner = require2("./impl/scanner");
|
|
74109
|
-
const parser = require2("./impl/parser");
|
|
74110
|
-
exports2.createScanner = scanner.createScanner;
|
|
74111
|
-
var ScanError;
|
|
74112
|
-
(function(ScanError2) {
|
|
74113
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
74114
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
74115
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
74116
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
74117
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
74118
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
74119
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
74120
|
-
})(ScanError || (exports2.ScanError = ScanError = {}));
|
|
74121
|
-
var SyntaxKind;
|
|
74122
|
-
(function(SyntaxKind2) {
|
|
74123
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
74124
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
74125
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
74126
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
74127
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
74128
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
74129
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
74130
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
74131
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
74132
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
74133
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
74134
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
74135
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
74136
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
74137
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
74138
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
74139
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
74140
|
-
})(SyntaxKind || (exports2.SyntaxKind = SyntaxKind = {}));
|
|
74141
|
-
exports2.getLocation = parser.getLocation;
|
|
74142
|
-
exports2.parse = parser.parse;
|
|
74143
|
-
exports2.parseTree = parser.parseTree;
|
|
74144
|
-
exports2.findNodeAtLocation = parser.findNodeAtLocation;
|
|
74145
|
-
exports2.findNodeAtOffset = parser.findNodeAtOffset;
|
|
74146
|
-
exports2.getNodePath = parser.getNodePath;
|
|
74147
|
-
exports2.getNodeValue = parser.getNodeValue;
|
|
74148
|
-
exports2.visit = parser.visit;
|
|
74149
|
-
exports2.stripComments = parser.stripComments;
|
|
74150
|
-
var ParseErrorCode;
|
|
74151
|
-
(function(ParseErrorCode2) {
|
|
74152
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
74153
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
74154
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
74155
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
74156
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
74157
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
74158
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
74159
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
74160
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
74161
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
74162
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
74163
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
74164
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
74165
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
74166
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
74167
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
74168
|
-
})(ParseErrorCode || (exports2.ParseErrorCode = ParseErrorCode = {}));
|
|
74169
|
-
function printParseErrorCode(code) {
|
|
74170
|
-
switch (code) {
|
|
74171
|
-
case 1:
|
|
74172
|
-
return "InvalidSymbol";
|
|
74173
|
-
case 2:
|
|
74174
|
-
return "InvalidNumberFormat";
|
|
74175
|
-
case 3:
|
|
74176
|
-
return "PropertyNameExpected";
|
|
74177
|
-
case 4:
|
|
74178
|
-
return "ValueExpected";
|
|
74179
|
-
case 5:
|
|
74180
|
-
return "ColonExpected";
|
|
74181
|
-
case 6:
|
|
74182
|
-
return "CommaExpected";
|
|
74183
|
-
case 7:
|
|
74184
|
-
return "CloseBraceExpected";
|
|
74185
|
-
case 8:
|
|
74186
|
-
return "CloseBracketExpected";
|
|
74187
|
-
case 9:
|
|
74188
|
-
return "EndOfFileExpected";
|
|
74189
|
-
case 10:
|
|
74190
|
-
return "InvalidCommentToken";
|
|
74191
|
-
case 11:
|
|
74192
|
-
return "UnexpectedEndOfComment";
|
|
74193
|
-
case 12:
|
|
74194
|
-
return "UnexpectedEndOfString";
|
|
74195
|
-
case 13:
|
|
74196
|
-
return "UnexpectedEndOfNumber";
|
|
74197
|
-
case 14:
|
|
74198
|
-
return "InvalidUnicode";
|
|
74199
|
-
case 15:
|
|
74200
|
-
return "InvalidEscapeCharacter";
|
|
74201
|
-
case 16:
|
|
74202
|
-
return "InvalidCharacter";
|
|
74203
|
-
}
|
|
74204
|
-
return "<unknown ParseErrorCode>";
|
|
74205
|
-
}
|
|
74206
|
-
exports2.printParseErrorCode = printParseErrorCode;
|
|
74207
|
-
function format2(documentText, range2, options) {
|
|
74208
|
-
return formatter.format(documentText, range2, options);
|
|
74209
|
-
}
|
|
74210
|
-
exports2.format = format2;
|
|
74211
|
-
function modify(text, path7, value, options) {
|
|
74212
|
-
return edit.setProperty(text, path7, value, options);
|
|
74213
|
-
}
|
|
74214
|
-
exports2.modify = modify;
|
|
74215
|
-
function applyEdits(text, edits) {
|
|
74216
|
-
let sortedEdits = edits.slice(0).sort((a, b) => {
|
|
74217
|
-
const diff2 = a.offset - b.offset;
|
|
74218
|
-
if (diff2 === 0) {
|
|
74219
|
-
return a.length - b.length;
|
|
74220
|
-
}
|
|
74221
|
-
return diff2;
|
|
74222
|
-
});
|
|
74223
|
-
let lastModifiedOffset = text.length;
|
|
74224
|
-
for (let i = sortedEdits.length - 1;i >= 0; i--) {
|
|
74225
|
-
let e = sortedEdits[i];
|
|
74226
|
-
if (e.offset + e.length <= lastModifiedOffset) {
|
|
74227
|
-
text = edit.applyEdit(text, e);
|
|
74228
|
-
} else {
|
|
74229
|
-
throw new Error("Overlapping edit");
|
|
74230
|
-
}
|
|
74231
|
-
lastModifiedOffset = e.offset;
|
|
74232
|
-
}
|
|
74233
|
-
return text;
|
|
74234
|
-
}
|
|
74235
|
-
exports2.applyEdits = applyEdits;
|
|
74236
|
-
});
|
|
74237
|
-
});
|
|
74238
|
-
|
|
74239
74093
|
// node_modules/ws/lib/constants.js
|
|
74240
74094
|
var require_constants4 = __commonJS((exports, module) => {
|
|
74241
74095
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
@@ -75730,7 +75584,7 @@ var require_extension2 = __commonJS((exports, module) => {
|
|
|
75730
75584
|
else
|
|
75731
75585
|
dest[name].push(elem);
|
|
75732
75586
|
}
|
|
75733
|
-
function
|
|
75587
|
+
function parse3(header2) {
|
|
75734
75588
|
const offers = Object.create(null);
|
|
75735
75589
|
let params = Object.create(null);
|
|
75736
75590
|
let mustUnescape = false;
|
|
@@ -75868,7 +75722,7 @@ var require_extension2 = __commonJS((exports, module) => {
|
|
|
75868
75722
|
}
|
|
75869
75723
|
return offers;
|
|
75870
75724
|
}
|
|
75871
|
-
function
|
|
75725
|
+
function format3(extensions) {
|
|
75872
75726
|
return Object.keys(extensions).map((extension) => {
|
|
75873
75727
|
let configurations = extensions[extension];
|
|
75874
75728
|
if (!Array.isArray(configurations))
|
|
@@ -75883,7 +75737,7 @@ var require_extension2 = __commonJS((exports, module) => {
|
|
|
75883
75737
|
}).join(", ");
|
|
75884
75738
|
}).join(", ");
|
|
75885
75739
|
}
|
|
75886
|
-
module.exports = { format:
|
|
75740
|
+
module.exports = { format: format3, parse: parse3 };
|
|
75887
75741
|
});
|
|
75888
75742
|
|
|
75889
75743
|
// node_modules/ws/lib/websocket.js
|
|
@@ -75894,7 +75748,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
75894
75748
|
var net = __require("net");
|
|
75895
75749
|
var tls = __require("tls");
|
|
75896
75750
|
var { randomBytes, createHash } = __require("crypto");
|
|
75897
|
-
var { Duplex, Readable } = __require("stream");
|
|
75751
|
+
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
75898
75752
|
var { URL: URL2 } = __require("url");
|
|
75899
75753
|
var PerMessageDeflate = require_permessage_deflate2();
|
|
75900
75754
|
var Receiver2 = require_receiver2();
|
|
@@ -75914,7 +75768,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
75914
75768
|
var {
|
|
75915
75769
|
EventTarget: { addEventListener, removeEventListener }
|
|
75916
75770
|
} = require_event_target2();
|
|
75917
|
-
var { format:
|
|
75771
|
+
var { format: format3, parse: parse3 } = require_extension2();
|
|
75918
75772
|
var { toBuffer } = require_buffer_util2();
|
|
75919
75773
|
var kAborted = Symbol("kAborted");
|
|
75920
75774
|
var protocolVersions = [8, 13];
|
|
@@ -76332,7 +76186,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
76332
76186
|
isServer: false,
|
|
76333
76187
|
maxPayload: opts.maxPayload
|
|
76334
76188
|
});
|
|
76335
|
-
opts.headers["Sec-WebSocket-Extensions"] =
|
|
76189
|
+
opts.headers["Sec-WebSocket-Extensions"] = format3({
|
|
76336
76190
|
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
76337
76191
|
});
|
|
76338
76192
|
}
|
|
@@ -76467,7 +76321,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
76467
76321
|
}
|
|
76468
76322
|
let extensions;
|
|
76469
76323
|
try {
|
|
76470
|
-
extensions =
|
|
76324
|
+
extensions = parse3(secWebSocketExtensions);
|
|
76471
76325
|
} catch (err) {
|
|
76472
76326
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
76473
76327
|
abortHandshake(websocket, socket, message);
|
|
@@ -76764,7 +76618,7 @@ var require_stream2 = __commonJS((exports, module) => {
|
|
|
76764
76618
|
// node_modules/ws/lib/subprotocol.js
|
|
76765
76619
|
var require_subprotocol2 = __commonJS((exports, module) => {
|
|
76766
76620
|
var { tokenChars } = require_validation4();
|
|
76767
|
-
function
|
|
76621
|
+
function parse3(header2) {
|
|
76768
76622
|
const protocols = new Set;
|
|
76769
76623
|
let start = -1;
|
|
76770
76624
|
let end = -1;
|
|
@@ -76803,7 +76657,7 @@ var require_subprotocol2 = __commonJS((exports, module) => {
|
|
|
76803
76657
|
protocols.add(protocol);
|
|
76804
76658
|
return protocols;
|
|
76805
76659
|
}
|
|
76806
|
-
module.exports = { parse:
|
|
76660
|
+
module.exports = { parse: parse3 };
|
|
76807
76661
|
});
|
|
76808
76662
|
|
|
76809
76663
|
// node_modules/ws/lib/websocket-server.js
|
|
@@ -87534,8 +87388,9 @@ init_prompts();
|
|
|
87534
87388
|
init_spinner();
|
|
87535
87389
|
init_output();
|
|
87536
87390
|
import { spawn as spawn3 } from "node:child_process";
|
|
87537
|
-
import { existsSync as existsSync6, createWriteStream, writeFileSync as writeFileSync3, mkdirSync } from "node:fs";
|
|
87391
|
+
import { existsSync as existsSync6, createWriteStream, writeFileSync as writeFileSync3, mkdirSync, createReadStream } from "node:fs";
|
|
87538
87392
|
import { unlink as unlink2 } from "node:fs/promises";
|
|
87393
|
+
import { Readable } from "node:stream";
|
|
87539
87394
|
import { resolve as resolve2, basename, join as join3 } from "node:path";
|
|
87540
87395
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
87541
87396
|
async function deployLocalImage(options) {
|
|
@@ -87785,10 +87640,9 @@ ${colors.dim("(freshly built)")}` : ""), `${icons.rocket} Deploy Local Image`);
|
|
|
87785
87640
|
queryParams.set("health_check_path", healthCheckPath);
|
|
87786
87641
|
}
|
|
87787
87642
|
const finalUrl = queryParams.toString() ? `${uploadUrl}?${queryParams.toString()}` : uploadUrl;
|
|
87788
|
-
const file = Bun.file(tempFilePath);
|
|
87789
87643
|
const filename = `${imageName.replace(/[/:]/g, "-")}.tar`;
|
|
87790
|
-
const boundary = `----
|
|
87791
|
-
const fileStream =
|
|
87644
|
+
const boundary = `----TempsFormBoundary${Date.now().toString(16)}`;
|
|
87645
|
+
const fileStream = Readable.toWeb(createReadStream(tempFilePath));
|
|
87792
87646
|
const header2 = [
|
|
87793
87647
|
`--${boundary}`,
|
|
87794
87648
|
`Content-Disposition: form-data; name="file"; filename="${filename}"`,
|
|
@@ -99094,7 +98948,7 @@ async function dnsStatusAction(options) {
|
|
|
99094
98948
|
}
|
|
99095
98949
|
|
|
99096
98950
|
// src/commands/docs.ts
|
|
99097
|
-
import { writeFile as
|
|
98951
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
99098
98952
|
|
|
99099
98953
|
// src/cli.ts
|
|
99100
98954
|
init_source();
|
|
@@ -112226,9 +112080,1333 @@ import * as path8 from "node:path";
|
|
|
112226
112080
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
112227
112081
|
|
|
112228
112082
|
// src/commands/mcp/clients/base.ts
|
|
112229
|
-
var jsonc = __toESM(require_main(), 1);
|
|
112230
112083
|
import * as fs5 from "node:fs";
|
|
112231
112084
|
import * as path7 from "node:path";
|
|
112085
|
+
|
|
112086
|
+
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
112087
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
112088
|
+
const len = text.length;
|
|
112089
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
112090
|
+
function scanHexDigits(count, exact) {
|
|
112091
|
+
let digits = 0;
|
|
112092
|
+
let value2 = 0;
|
|
112093
|
+
while (digits < count || !exact) {
|
|
112094
|
+
let ch = text.charCodeAt(pos);
|
|
112095
|
+
if (ch >= 48 && ch <= 57) {
|
|
112096
|
+
value2 = value2 * 16 + ch - 48;
|
|
112097
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
112098
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
112099
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
112100
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
112101
|
+
} else {
|
|
112102
|
+
break;
|
|
112103
|
+
}
|
|
112104
|
+
pos++;
|
|
112105
|
+
digits++;
|
|
112106
|
+
}
|
|
112107
|
+
if (digits < count) {
|
|
112108
|
+
value2 = -1;
|
|
112109
|
+
}
|
|
112110
|
+
return value2;
|
|
112111
|
+
}
|
|
112112
|
+
function setPosition(newPosition) {
|
|
112113
|
+
pos = newPosition;
|
|
112114
|
+
value = "";
|
|
112115
|
+
tokenOffset = 0;
|
|
112116
|
+
token = 16;
|
|
112117
|
+
scanError = 0;
|
|
112118
|
+
}
|
|
112119
|
+
function scanNumber() {
|
|
112120
|
+
let start = pos;
|
|
112121
|
+
if (text.charCodeAt(pos) === 48) {
|
|
112122
|
+
pos++;
|
|
112123
|
+
} else {
|
|
112124
|
+
pos++;
|
|
112125
|
+
while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
|
|
112126
|
+
pos++;
|
|
112127
|
+
}
|
|
112128
|
+
}
|
|
112129
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
112130
|
+
pos++;
|
|
112131
|
+
if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
|
|
112132
|
+
pos++;
|
|
112133
|
+
while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
|
|
112134
|
+
pos++;
|
|
112135
|
+
}
|
|
112136
|
+
} else {
|
|
112137
|
+
scanError = 3;
|
|
112138
|
+
return text.substring(start, pos);
|
|
112139
|
+
}
|
|
112140
|
+
}
|
|
112141
|
+
let end = pos;
|
|
112142
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
112143
|
+
pos++;
|
|
112144
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
112145
|
+
pos++;
|
|
112146
|
+
}
|
|
112147
|
+
if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
|
|
112148
|
+
pos++;
|
|
112149
|
+
while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
|
|
112150
|
+
pos++;
|
|
112151
|
+
}
|
|
112152
|
+
end = pos;
|
|
112153
|
+
} else {
|
|
112154
|
+
scanError = 3;
|
|
112155
|
+
}
|
|
112156
|
+
}
|
|
112157
|
+
return text.substring(start, end);
|
|
112158
|
+
}
|
|
112159
|
+
function scanString() {
|
|
112160
|
+
let result2 = "", start = pos;
|
|
112161
|
+
while (true) {
|
|
112162
|
+
if (pos >= len) {
|
|
112163
|
+
result2 += text.substring(start, pos);
|
|
112164
|
+
scanError = 2;
|
|
112165
|
+
break;
|
|
112166
|
+
}
|
|
112167
|
+
const ch = text.charCodeAt(pos);
|
|
112168
|
+
if (ch === 34) {
|
|
112169
|
+
result2 += text.substring(start, pos);
|
|
112170
|
+
pos++;
|
|
112171
|
+
break;
|
|
112172
|
+
}
|
|
112173
|
+
if (ch === 92) {
|
|
112174
|
+
result2 += text.substring(start, pos);
|
|
112175
|
+
pos++;
|
|
112176
|
+
if (pos >= len) {
|
|
112177
|
+
scanError = 2;
|
|
112178
|
+
break;
|
|
112179
|
+
}
|
|
112180
|
+
const ch2 = text.charCodeAt(pos++);
|
|
112181
|
+
switch (ch2) {
|
|
112182
|
+
case 34:
|
|
112183
|
+
result2 += '"';
|
|
112184
|
+
break;
|
|
112185
|
+
case 92:
|
|
112186
|
+
result2 += "\\";
|
|
112187
|
+
break;
|
|
112188
|
+
case 47:
|
|
112189
|
+
result2 += "/";
|
|
112190
|
+
break;
|
|
112191
|
+
case 98:
|
|
112192
|
+
result2 += "\b";
|
|
112193
|
+
break;
|
|
112194
|
+
case 102:
|
|
112195
|
+
result2 += "\f";
|
|
112196
|
+
break;
|
|
112197
|
+
case 110:
|
|
112198
|
+
result2 += `
|
|
112199
|
+
`;
|
|
112200
|
+
break;
|
|
112201
|
+
case 114:
|
|
112202
|
+
result2 += "\r";
|
|
112203
|
+
break;
|
|
112204
|
+
case 116:
|
|
112205
|
+
result2 += "\t";
|
|
112206
|
+
break;
|
|
112207
|
+
case 117:
|
|
112208
|
+
const ch3 = scanHexDigits(4, true);
|
|
112209
|
+
if (ch3 >= 0) {
|
|
112210
|
+
result2 += String.fromCharCode(ch3);
|
|
112211
|
+
} else {
|
|
112212
|
+
scanError = 4;
|
|
112213
|
+
}
|
|
112214
|
+
break;
|
|
112215
|
+
default:
|
|
112216
|
+
scanError = 5;
|
|
112217
|
+
}
|
|
112218
|
+
start = pos;
|
|
112219
|
+
continue;
|
|
112220
|
+
}
|
|
112221
|
+
if (ch >= 0 && ch <= 31) {
|
|
112222
|
+
if (isLineBreak(ch)) {
|
|
112223
|
+
result2 += text.substring(start, pos);
|
|
112224
|
+
scanError = 2;
|
|
112225
|
+
break;
|
|
112226
|
+
} else {
|
|
112227
|
+
scanError = 6;
|
|
112228
|
+
}
|
|
112229
|
+
}
|
|
112230
|
+
pos++;
|
|
112231
|
+
}
|
|
112232
|
+
return result2;
|
|
112233
|
+
}
|
|
112234
|
+
function scanNext() {
|
|
112235
|
+
value = "";
|
|
112236
|
+
scanError = 0;
|
|
112237
|
+
tokenOffset = pos;
|
|
112238
|
+
lineStartOffset = lineNumber;
|
|
112239
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
112240
|
+
if (pos >= len) {
|
|
112241
|
+
tokenOffset = len;
|
|
112242
|
+
return token = 17;
|
|
112243
|
+
}
|
|
112244
|
+
let code = text.charCodeAt(pos);
|
|
112245
|
+
if (isWhiteSpace(code)) {
|
|
112246
|
+
do {
|
|
112247
|
+
pos++;
|
|
112248
|
+
value += String.fromCharCode(code);
|
|
112249
|
+
code = text.charCodeAt(pos);
|
|
112250
|
+
} while (isWhiteSpace(code));
|
|
112251
|
+
return token = 15;
|
|
112252
|
+
}
|
|
112253
|
+
if (isLineBreak(code)) {
|
|
112254
|
+
pos++;
|
|
112255
|
+
value += String.fromCharCode(code);
|
|
112256
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
112257
|
+
pos++;
|
|
112258
|
+
value += `
|
|
112259
|
+
`;
|
|
112260
|
+
}
|
|
112261
|
+
lineNumber++;
|
|
112262
|
+
tokenLineStartOffset = pos;
|
|
112263
|
+
return token = 14;
|
|
112264
|
+
}
|
|
112265
|
+
switch (code) {
|
|
112266
|
+
case 123:
|
|
112267
|
+
pos++;
|
|
112268
|
+
return token = 1;
|
|
112269
|
+
case 125:
|
|
112270
|
+
pos++;
|
|
112271
|
+
return token = 2;
|
|
112272
|
+
case 91:
|
|
112273
|
+
pos++;
|
|
112274
|
+
return token = 3;
|
|
112275
|
+
case 93:
|
|
112276
|
+
pos++;
|
|
112277
|
+
return token = 4;
|
|
112278
|
+
case 58:
|
|
112279
|
+
pos++;
|
|
112280
|
+
return token = 6;
|
|
112281
|
+
case 44:
|
|
112282
|
+
pos++;
|
|
112283
|
+
return token = 5;
|
|
112284
|
+
case 34:
|
|
112285
|
+
pos++;
|
|
112286
|
+
value = scanString();
|
|
112287
|
+
return token = 10;
|
|
112288
|
+
case 47:
|
|
112289
|
+
const start = pos - 1;
|
|
112290
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
112291
|
+
pos += 2;
|
|
112292
|
+
while (pos < len) {
|
|
112293
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
112294
|
+
break;
|
|
112295
|
+
}
|
|
112296
|
+
pos++;
|
|
112297
|
+
}
|
|
112298
|
+
value = text.substring(start, pos);
|
|
112299
|
+
return token = 12;
|
|
112300
|
+
}
|
|
112301
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
112302
|
+
pos += 2;
|
|
112303
|
+
const safeLength = len - 1;
|
|
112304
|
+
let commentClosed = false;
|
|
112305
|
+
while (pos < safeLength) {
|
|
112306
|
+
const ch = text.charCodeAt(pos);
|
|
112307
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
112308
|
+
pos += 2;
|
|
112309
|
+
commentClosed = true;
|
|
112310
|
+
break;
|
|
112311
|
+
}
|
|
112312
|
+
pos++;
|
|
112313
|
+
if (isLineBreak(ch)) {
|
|
112314
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
112315
|
+
pos++;
|
|
112316
|
+
}
|
|
112317
|
+
lineNumber++;
|
|
112318
|
+
tokenLineStartOffset = pos;
|
|
112319
|
+
}
|
|
112320
|
+
}
|
|
112321
|
+
if (!commentClosed) {
|
|
112322
|
+
pos++;
|
|
112323
|
+
scanError = 1;
|
|
112324
|
+
}
|
|
112325
|
+
value = text.substring(start, pos);
|
|
112326
|
+
return token = 13;
|
|
112327
|
+
}
|
|
112328
|
+
value += String.fromCharCode(code);
|
|
112329
|
+
pos++;
|
|
112330
|
+
return token = 16;
|
|
112331
|
+
case 45:
|
|
112332
|
+
value += String.fromCharCode(code);
|
|
112333
|
+
pos++;
|
|
112334
|
+
if (pos === len || !isDigit2(text.charCodeAt(pos))) {
|
|
112335
|
+
return token = 16;
|
|
112336
|
+
}
|
|
112337
|
+
case 48:
|
|
112338
|
+
case 49:
|
|
112339
|
+
case 50:
|
|
112340
|
+
case 51:
|
|
112341
|
+
case 52:
|
|
112342
|
+
case 53:
|
|
112343
|
+
case 54:
|
|
112344
|
+
case 55:
|
|
112345
|
+
case 56:
|
|
112346
|
+
case 57:
|
|
112347
|
+
value += scanNumber();
|
|
112348
|
+
return token = 11;
|
|
112349
|
+
default:
|
|
112350
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
112351
|
+
pos++;
|
|
112352
|
+
code = text.charCodeAt(pos);
|
|
112353
|
+
}
|
|
112354
|
+
if (tokenOffset !== pos) {
|
|
112355
|
+
value = text.substring(tokenOffset, pos);
|
|
112356
|
+
switch (value) {
|
|
112357
|
+
case "true":
|
|
112358
|
+
return token = 8;
|
|
112359
|
+
case "false":
|
|
112360
|
+
return token = 9;
|
|
112361
|
+
case "null":
|
|
112362
|
+
return token = 7;
|
|
112363
|
+
}
|
|
112364
|
+
return token = 16;
|
|
112365
|
+
}
|
|
112366
|
+
value += String.fromCharCode(code);
|
|
112367
|
+
pos++;
|
|
112368
|
+
return token = 16;
|
|
112369
|
+
}
|
|
112370
|
+
}
|
|
112371
|
+
function isUnknownContentCharacter(code) {
|
|
112372
|
+
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
112373
|
+
return false;
|
|
112374
|
+
}
|
|
112375
|
+
switch (code) {
|
|
112376
|
+
case 125:
|
|
112377
|
+
case 93:
|
|
112378
|
+
case 123:
|
|
112379
|
+
case 91:
|
|
112380
|
+
case 34:
|
|
112381
|
+
case 58:
|
|
112382
|
+
case 44:
|
|
112383
|
+
case 47:
|
|
112384
|
+
return false;
|
|
112385
|
+
}
|
|
112386
|
+
return true;
|
|
112387
|
+
}
|
|
112388
|
+
function scanNextNonTrivia() {
|
|
112389
|
+
let result2;
|
|
112390
|
+
do {
|
|
112391
|
+
result2 = scanNext();
|
|
112392
|
+
} while (result2 >= 12 && result2 <= 15);
|
|
112393
|
+
return result2;
|
|
112394
|
+
}
|
|
112395
|
+
return {
|
|
112396
|
+
setPosition,
|
|
112397
|
+
getPosition: () => pos,
|
|
112398
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
112399
|
+
getToken: () => token,
|
|
112400
|
+
getTokenValue: () => value,
|
|
112401
|
+
getTokenOffset: () => tokenOffset,
|
|
112402
|
+
getTokenLength: () => pos - tokenOffset,
|
|
112403
|
+
getTokenStartLine: () => lineStartOffset,
|
|
112404
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
112405
|
+
getTokenError: () => scanError
|
|
112406
|
+
};
|
|
112407
|
+
}
|
|
112408
|
+
function isWhiteSpace(ch) {
|
|
112409
|
+
return ch === 32 || ch === 9;
|
|
112410
|
+
}
|
|
112411
|
+
function isLineBreak(ch) {
|
|
112412
|
+
return ch === 10 || ch === 13;
|
|
112413
|
+
}
|
|
112414
|
+
function isDigit2(ch) {
|
|
112415
|
+
return ch >= 48 && ch <= 57;
|
|
112416
|
+
}
|
|
112417
|
+
var CharacterCodes;
|
|
112418
|
+
(function(CharacterCodes2) {
|
|
112419
|
+
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
112420
|
+
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
112421
|
+
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
112422
|
+
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
112423
|
+
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
112424
|
+
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
112425
|
+
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
112426
|
+
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
112427
|
+
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
112428
|
+
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
112429
|
+
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
112430
|
+
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
112431
|
+
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
112432
|
+
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
112433
|
+
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
112434
|
+
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
112435
|
+
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
112436
|
+
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
112437
|
+
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
112438
|
+
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
112439
|
+
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
112440
|
+
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
112441
|
+
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
112442
|
+
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
112443
|
+
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
112444
|
+
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
112445
|
+
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
112446
|
+
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
112447
|
+
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
112448
|
+
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
112449
|
+
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
112450
|
+
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
112451
|
+
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
112452
|
+
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
112453
|
+
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
112454
|
+
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
112455
|
+
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
112456
|
+
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
112457
|
+
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
112458
|
+
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
112459
|
+
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
112460
|
+
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
112461
|
+
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
112462
|
+
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
112463
|
+
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
112464
|
+
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
112465
|
+
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
112466
|
+
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
112467
|
+
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
112468
|
+
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
112469
|
+
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
112470
|
+
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
112471
|
+
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
112472
|
+
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
112473
|
+
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
112474
|
+
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
112475
|
+
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
112476
|
+
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
112477
|
+
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
112478
|
+
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
112479
|
+
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
112480
|
+
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
112481
|
+
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
112482
|
+
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
112483
|
+
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
112484
|
+
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
112485
|
+
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
112486
|
+
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
112487
|
+
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
112488
|
+
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
112489
|
+
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
112490
|
+
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
112491
|
+
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
112492
|
+
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
112493
|
+
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
112494
|
+
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
112495
|
+
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
112496
|
+
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
112497
|
+
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
112498
|
+
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
112499
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
112500
|
+
|
|
112501
|
+
// node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
112502
|
+
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
112503
|
+
return " ".repeat(index);
|
|
112504
|
+
});
|
|
112505
|
+
var maxCachedValues = 200;
|
|
112506
|
+
var cachedBreakLinesWithSpaces = {
|
|
112507
|
+
" ": {
|
|
112508
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112509
|
+
return `
|
|
112510
|
+
` + " ".repeat(index);
|
|
112511
|
+
}),
|
|
112512
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112513
|
+
return "\r" + " ".repeat(index);
|
|
112514
|
+
}),
|
|
112515
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112516
|
+
return `\r
|
|
112517
|
+
` + " ".repeat(index);
|
|
112518
|
+
})
|
|
112519
|
+
},
|
|
112520
|
+
"\t": {
|
|
112521
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112522
|
+
return `
|
|
112523
|
+
` + "\t".repeat(index);
|
|
112524
|
+
}),
|
|
112525
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112526
|
+
return "\r" + "\t".repeat(index);
|
|
112527
|
+
}),
|
|
112528
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
112529
|
+
return `\r
|
|
112530
|
+
` + "\t".repeat(index);
|
|
112531
|
+
})
|
|
112532
|
+
}
|
|
112533
|
+
};
|
|
112534
|
+
var supportedEols = [`
|
|
112535
|
+
`, "\r", `\r
|
|
112536
|
+
`];
|
|
112537
|
+
|
|
112538
|
+
// node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
112539
|
+
function format2(documentText, range2, options) {
|
|
112540
|
+
let initialIndentLevel;
|
|
112541
|
+
let formatText;
|
|
112542
|
+
let formatTextStart;
|
|
112543
|
+
let rangeStart;
|
|
112544
|
+
let rangeEnd;
|
|
112545
|
+
if (range2) {
|
|
112546
|
+
rangeStart = range2.offset;
|
|
112547
|
+
rangeEnd = rangeStart + range2.length;
|
|
112548
|
+
formatTextStart = rangeStart;
|
|
112549
|
+
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
112550
|
+
formatTextStart--;
|
|
112551
|
+
}
|
|
112552
|
+
let endOffset = rangeEnd;
|
|
112553
|
+
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
112554
|
+
endOffset++;
|
|
112555
|
+
}
|
|
112556
|
+
formatText = documentText.substring(formatTextStart, endOffset);
|
|
112557
|
+
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
112558
|
+
} else {
|
|
112559
|
+
formatText = documentText;
|
|
112560
|
+
initialIndentLevel = 0;
|
|
112561
|
+
formatTextStart = 0;
|
|
112562
|
+
rangeStart = 0;
|
|
112563
|
+
rangeEnd = documentText.length;
|
|
112564
|
+
}
|
|
112565
|
+
const eol = getEOL(options, documentText);
|
|
112566
|
+
const eolFastPathSupported = supportedEols.includes(eol);
|
|
112567
|
+
let numberLineBreaks = 0;
|
|
112568
|
+
let indentLevel = 0;
|
|
112569
|
+
let indentValue;
|
|
112570
|
+
if (options.insertSpaces) {
|
|
112571
|
+
indentValue = cachedSpaces[options.tabSize || 4] ?? repeat2(cachedSpaces[1], options.tabSize || 4);
|
|
112572
|
+
} else {
|
|
112573
|
+
indentValue = "\t";
|
|
112574
|
+
}
|
|
112575
|
+
const indentType = indentValue === "\t" ? "\t" : " ";
|
|
112576
|
+
let scanner = createScanner(formatText, false);
|
|
112577
|
+
let hasError = false;
|
|
112578
|
+
function newLinesAndIndent() {
|
|
112579
|
+
if (numberLineBreaks > 1) {
|
|
112580
|
+
return repeat2(eol, numberLineBreaks) + repeat2(indentValue, initialIndentLevel + indentLevel);
|
|
112581
|
+
}
|
|
112582
|
+
const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);
|
|
112583
|
+
if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {
|
|
112584
|
+
return eol + repeat2(indentValue, initialIndentLevel + indentLevel);
|
|
112585
|
+
}
|
|
112586
|
+
if (amountOfSpaces <= 0) {
|
|
112587
|
+
return eol;
|
|
112588
|
+
}
|
|
112589
|
+
return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];
|
|
112590
|
+
}
|
|
112591
|
+
function scanNext() {
|
|
112592
|
+
let token = scanner.scan();
|
|
112593
|
+
numberLineBreaks = 0;
|
|
112594
|
+
while (token === 15 || token === 14) {
|
|
112595
|
+
if (token === 14 && options.keepLines) {
|
|
112596
|
+
numberLineBreaks += 1;
|
|
112597
|
+
} else if (token === 14) {
|
|
112598
|
+
numberLineBreaks = 1;
|
|
112599
|
+
}
|
|
112600
|
+
token = scanner.scan();
|
|
112601
|
+
}
|
|
112602
|
+
hasError = token === 16 || scanner.getTokenError() !== 0;
|
|
112603
|
+
return token;
|
|
112604
|
+
}
|
|
112605
|
+
const editOperations = [];
|
|
112606
|
+
function addEdit(text, startOffset, endOffset) {
|
|
112607
|
+
if (!hasError && (!range2 || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
|
|
112608
|
+
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
112609
|
+
}
|
|
112610
|
+
}
|
|
112611
|
+
let firstToken = scanNext();
|
|
112612
|
+
if (options.keepLines && numberLineBreaks > 0) {
|
|
112613
|
+
addEdit(repeat2(eol, numberLineBreaks), 0, 0);
|
|
112614
|
+
}
|
|
112615
|
+
if (firstToken !== 17) {
|
|
112616
|
+
let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
112617
|
+
let initialIndent = indentValue.length * initialIndentLevel < 20 && options.insertSpaces ? cachedSpaces[indentValue.length * initialIndentLevel] : repeat2(indentValue, initialIndentLevel);
|
|
112618
|
+
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
112619
|
+
}
|
|
112620
|
+
while (firstToken !== 17) {
|
|
112621
|
+
let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
112622
|
+
let secondToken = scanNext();
|
|
112623
|
+
let replaceContent = "";
|
|
112624
|
+
let needsLineBreak = false;
|
|
112625
|
+
while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
|
|
112626
|
+
let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
112627
|
+
addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);
|
|
112628
|
+
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
112629
|
+
needsLineBreak = secondToken === 12;
|
|
112630
|
+
replaceContent = needsLineBreak ? newLinesAndIndent() : "";
|
|
112631
|
+
secondToken = scanNext();
|
|
112632
|
+
}
|
|
112633
|
+
if (secondToken === 2) {
|
|
112634
|
+
if (firstToken !== 1) {
|
|
112635
|
+
indentLevel--;
|
|
112636
|
+
}
|
|
112637
|
+
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
|
|
112638
|
+
replaceContent = newLinesAndIndent();
|
|
112639
|
+
} else if (options.keepLines) {
|
|
112640
|
+
replaceContent = cachedSpaces[1];
|
|
112641
|
+
}
|
|
112642
|
+
} else if (secondToken === 4) {
|
|
112643
|
+
if (firstToken !== 3) {
|
|
112644
|
+
indentLevel--;
|
|
112645
|
+
}
|
|
112646
|
+
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
|
|
112647
|
+
replaceContent = newLinesAndIndent();
|
|
112648
|
+
} else if (options.keepLines) {
|
|
112649
|
+
replaceContent = cachedSpaces[1];
|
|
112650
|
+
}
|
|
112651
|
+
} else {
|
|
112652
|
+
switch (firstToken) {
|
|
112653
|
+
case 3:
|
|
112654
|
+
case 1:
|
|
112655
|
+
indentLevel++;
|
|
112656
|
+
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
112657
|
+
replaceContent = newLinesAndIndent();
|
|
112658
|
+
} else {
|
|
112659
|
+
replaceContent = cachedSpaces[1];
|
|
112660
|
+
}
|
|
112661
|
+
break;
|
|
112662
|
+
case 5:
|
|
112663
|
+
if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
|
|
112664
|
+
replaceContent = newLinesAndIndent();
|
|
112665
|
+
} else {
|
|
112666
|
+
replaceContent = cachedSpaces[1];
|
|
112667
|
+
}
|
|
112668
|
+
break;
|
|
112669
|
+
case 12:
|
|
112670
|
+
replaceContent = newLinesAndIndent();
|
|
112671
|
+
break;
|
|
112672
|
+
case 13:
|
|
112673
|
+
if (numberLineBreaks > 0) {
|
|
112674
|
+
replaceContent = newLinesAndIndent();
|
|
112675
|
+
} else if (!needsLineBreak) {
|
|
112676
|
+
replaceContent = cachedSpaces[1];
|
|
112677
|
+
}
|
|
112678
|
+
break;
|
|
112679
|
+
case 6:
|
|
112680
|
+
if (options.keepLines && numberLineBreaks > 0) {
|
|
112681
|
+
replaceContent = newLinesAndIndent();
|
|
112682
|
+
} else if (!needsLineBreak) {
|
|
112683
|
+
replaceContent = cachedSpaces[1];
|
|
112684
|
+
}
|
|
112685
|
+
break;
|
|
112686
|
+
case 10:
|
|
112687
|
+
if (options.keepLines && numberLineBreaks > 0) {
|
|
112688
|
+
replaceContent = newLinesAndIndent();
|
|
112689
|
+
} else if (secondToken === 6 && !needsLineBreak) {
|
|
112690
|
+
replaceContent = "";
|
|
112691
|
+
}
|
|
112692
|
+
break;
|
|
112693
|
+
case 7:
|
|
112694
|
+
case 8:
|
|
112695
|
+
case 9:
|
|
112696
|
+
case 11:
|
|
112697
|
+
case 2:
|
|
112698
|
+
case 4:
|
|
112699
|
+
if (options.keepLines && numberLineBreaks > 0) {
|
|
112700
|
+
replaceContent = newLinesAndIndent();
|
|
112701
|
+
} else {
|
|
112702
|
+
if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
|
|
112703
|
+
replaceContent = cachedSpaces[1];
|
|
112704
|
+
} else if (secondToken !== 5 && secondToken !== 17) {
|
|
112705
|
+
hasError = true;
|
|
112706
|
+
}
|
|
112707
|
+
}
|
|
112708
|
+
break;
|
|
112709
|
+
case 16:
|
|
112710
|
+
hasError = true;
|
|
112711
|
+
break;
|
|
112712
|
+
}
|
|
112713
|
+
if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
|
|
112714
|
+
replaceContent = newLinesAndIndent();
|
|
112715
|
+
}
|
|
112716
|
+
}
|
|
112717
|
+
if (secondToken === 17) {
|
|
112718
|
+
if (options.keepLines && numberLineBreaks > 0) {
|
|
112719
|
+
replaceContent = newLinesAndIndent();
|
|
112720
|
+
} else {
|
|
112721
|
+
replaceContent = options.insertFinalNewline ? eol : "";
|
|
112722
|
+
}
|
|
112723
|
+
}
|
|
112724
|
+
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
112725
|
+
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
112726
|
+
firstToken = secondToken;
|
|
112727
|
+
}
|
|
112728
|
+
return editOperations;
|
|
112729
|
+
}
|
|
112730
|
+
function repeat2(s, count) {
|
|
112731
|
+
let result2 = "";
|
|
112732
|
+
for (let i = 0;i < count; i++) {
|
|
112733
|
+
result2 += s;
|
|
112734
|
+
}
|
|
112735
|
+
return result2;
|
|
112736
|
+
}
|
|
112737
|
+
function computeIndentLevel(content, options) {
|
|
112738
|
+
let i = 0;
|
|
112739
|
+
let nChars = 0;
|
|
112740
|
+
const tabSize = options.tabSize || 4;
|
|
112741
|
+
while (i < content.length) {
|
|
112742
|
+
let ch = content.charAt(i);
|
|
112743
|
+
if (ch === cachedSpaces[1]) {
|
|
112744
|
+
nChars++;
|
|
112745
|
+
} else if (ch === "\t") {
|
|
112746
|
+
nChars += tabSize;
|
|
112747
|
+
} else {
|
|
112748
|
+
break;
|
|
112749
|
+
}
|
|
112750
|
+
i++;
|
|
112751
|
+
}
|
|
112752
|
+
return Math.floor(nChars / tabSize);
|
|
112753
|
+
}
|
|
112754
|
+
function getEOL(options, text) {
|
|
112755
|
+
for (let i = 0;i < text.length; i++) {
|
|
112756
|
+
const ch = text.charAt(i);
|
|
112757
|
+
if (ch === "\r") {
|
|
112758
|
+
if (i + 1 < text.length && text.charAt(i + 1) === `
|
|
112759
|
+
`) {
|
|
112760
|
+
return `\r
|
|
112761
|
+
`;
|
|
112762
|
+
}
|
|
112763
|
+
return "\r";
|
|
112764
|
+
} else if (ch === `
|
|
112765
|
+
`) {
|
|
112766
|
+
return `
|
|
112767
|
+
`;
|
|
112768
|
+
}
|
|
112769
|
+
}
|
|
112770
|
+
return options && options.eol || `
|
|
112771
|
+
`;
|
|
112772
|
+
}
|
|
112773
|
+
function isEOL(text, offset) {
|
|
112774
|
+
return `\r
|
|
112775
|
+
`.indexOf(text.charAt(offset)) !== -1;
|
|
112776
|
+
}
|
|
112777
|
+
|
|
112778
|
+
// node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
112779
|
+
var ParseOptions;
|
|
112780
|
+
(function(ParseOptions2) {
|
|
112781
|
+
ParseOptions2.DEFAULT = {
|
|
112782
|
+
allowTrailingComma: false
|
|
112783
|
+
};
|
|
112784
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
112785
|
+
function parse(text, errors8 = [], options = ParseOptions.DEFAULT) {
|
|
112786
|
+
let currentProperty = null;
|
|
112787
|
+
let currentParent = [];
|
|
112788
|
+
const previousParents = [];
|
|
112789
|
+
function onValue(value) {
|
|
112790
|
+
if (Array.isArray(currentParent)) {
|
|
112791
|
+
currentParent.push(value);
|
|
112792
|
+
} else if (currentProperty !== null) {
|
|
112793
|
+
currentParent[currentProperty] = value;
|
|
112794
|
+
}
|
|
112795
|
+
}
|
|
112796
|
+
const visitor = {
|
|
112797
|
+
onObjectBegin: () => {
|
|
112798
|
+
const object = {};
|
|
112799
|
+
onValue(object);
|
|
112800
|
+
previousParents.push(currentParent);
|
|
112801
|
+
currentParent = object;
|
|
112802
|
+
currentProperty = null;
|
|
112803
|
+
},
|
|
112804
|
+
onObjectProperty: (name) => {
|
|
112805
|
+
currentProperty = name;
|
|
112806
|
+
},
|
|
112807
|
+
onObjectEnd: () => {
|
|
112808
|
+
currentParent = previousParents.pop();
|
|
112809
|
+
},
|
|
112810
|
+
onArrayBegin: () => {
|
|
112811
|
+
const array = [];
|
|
112812
|
+
onValue(array);
|
|
112813
|
+
previousParents.push(currentParent);
|
|
112814
|
+
currentParent = array;
|
|
112815
|
+
currentProperty = null;
|
|
112816
|
+
},
|
|
112817
|
+
onArrayEnd: () => {
|
|
112818
|
+
currentParent = previousParents.pop();
|
|
112819
|
+
},
|
|
112820
|
+
onLiteralValue: onValue,
|
|
112821
|
+
onError: (error3, offset, length) => {
|
|
112822
|
+
errors8.push({ error: error3, offset, length });
|
|
112823
|
+
}
|
|
112824
|
+
};
|
|
112825
|
+
visit(text, visitor, options);
|
|
112826
|
+
return currentParent[0];
|
|
112827
|
+
}
|
|
112828
|
+
function parseTree(text, errors8 = [], options = ParseOptions.DEFAULT) {
|
|
112829
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
|
|
112830
|
+
function ensurePropertyComplete(endOffset) {
|
|
112831
|
+
if (currentParent.type === "property") {
|
|
112832
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
112833
|
+
currentParent = currentParent.parent;
|
|
112834
|
+
}
|
|
112835
|
+
}
|
|
112836
|
+
function onValue(valueNode) {
|
|
112837
|
+
currentParent.children.push(valueNode);
|
|
112838
|
+
return valueNode;
|
|
112839
|
+
}
|
|
112840
|
+
const visitor = {
|
|
112841
|
+
onObjectBegin: (offset) => {
|
|
112842
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
112843
|
+
},
|
|
112844
|
+
onObjectProperty: (name, offset, length) => {
|
|
112845
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
112846
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
112847
|
+
},
|
|
112848
|
+
onObjectEnd: (offset, length) => {
|
|
112849
|
+
ensurePropertyComplete(offset + length);
|
|
112850
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
112851
|
+
currentParent = currentParent.parent;
|
|
112852
|
+
ensurePropertyComplete(offset + length);
|
|
112853
|
+
},
|
|
112854
|
+
onArrayBegin: (offset, length) => {
|
|
112855
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
112856
|
+
},
|
|
112857
|
+
onArrayEnd: (offset, length) => {
|
|
112858
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
112859
|
+
currentParent = currentParent.parent;
|
|
112860
|
+
ensurePropertyComplete(offset + length);
|
|
112861
|
+
},
|
|
112862
|
+
onLiteralValue: (value, offset, length) => {
|
|
112863
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
112864
|
+
ensurePropertyComplete(offset + length);
|
|
112865
|
+
},
|
|
112866
|
+
onSeparator: (sep, offset, length) => {
|
|
112867
|
+
if (currentParent.type === "property") {
|
|
112868
|
+
if (sep === ":") {
|
|
112869
|
+
currentParent.colonOffset = offset;
|
|
112870
|
+
} else if (sep === ",") {
|
|
112871
|
+
ensurePropertyComplete(offset);
|
|
112872
|
+
}
|
|
112873
|
+
}
|
|
112874
|
+
},
|
|
112875
|
+
onError: (error3, offset, length) => {
|
|
112876
|
+
errors8.push({ error: error3, offset, length });
|
|
112877
|
+
}
|
|
112878
|
+
};
|
|
112879
|
+
visit(text, visitor, options);
|
|
112880
|
+
const result2 = currentParent.children[0];
|
|
112881
|
+
if (result2) {
|
|
112882
|
+
delete result2.parent;
|
|
112883
|
+
}
|
|
112884
|
+
return result2;
|
|
112885
|
+
}
|
|
112886
|
+
function findNodeAtLocation(root, path7) {
|
|
112887
|
+
if (!root) {
|
|
112888
|
+
return;
|
|
112889
|
+
}
|
|
112890
|
+
let node = root;
|
|
112891
|
+
for (let segment of path7) {
|
|
112892
|
+
if (typeof segment === "string") {
|
|
112893
|
+
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
112894
|
+
return;
|
|
112895
|
+
}
|
|
112896
|
+
let found = false;
|
|
112897
|
+
for (const propertyNode of node.children) {
|
|
112898
|
+
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
112899
|
+
node = propertyNode.children[1];
|
|
112900
|
+
found = true;
|
|
112901
|
+
break;
|
|
112902
|
+
}
|
|
112903
|
+
}
|
|
112904
|
+
if (!found) {
|
|
112905
|
+
return;
|
|
112906
|
+
}
|
|
112907
|
+
} else {
|
|
112908
|
+
const index = segment;
|
|
112909
|
+
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
112910
|
+
return;
|
|
112911
|
+
}
|
|
112912
|
+
node = node.children[index];
|
|
112913
|
+
}
|
|
112914
|
+
}
|
|
112915
|
+
return node;
|
|
112916
|
+
}
|
|
112917
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
112918
|
+
const _scanner = createScanner(text, false);
|
|
112919
|
+
const _jsonPath = [];
|
|
112920
|
+
let suppressedCallbacks = 0;
|
|
112921
|
+
function toNoArgVisit(visitFunction) {
|
|
112922
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
112923
|
+
}
|
|
112924
|
+
function toOneArgVisit(visitFunction) {
|
|
112925
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
112926
|
+
}
|
|
112927
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
112928
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
112929
|
+
}
|
|
112930
|
+
function toBeginVisit(visitFunction) {
|
|
112931
|
+
return visitFunction ? () => {
|
|
112932
|
+
if (suppressedCallbacks > 0) {
|
|
112933
|
+
suppressedCallbacks++;
|
|
112934
|
+
} else {
|
|
112935
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
112936
|
+
if (cbReturn === false) {
|
|
112937
|
+
suppressedCallbacks = 1;
|
|
112938
|
+
}
|
|
112939
|
+
}
|
|
112940
|
+
} : () => true;
|
|
112941
|
+
}
|
|
112942
|
+
function toEndVisit(visitFunction) {
|
|
112943
|
+
return visitFunction ? () => {
|
|
112944
|
+
if (suppressedCallbacks > 0) {
|
|
112945
|
+
suppressedCallbacks--;
|
|
112946
|
+
}
|
|
112947
|
+
if (suppressedCallbacks === 0) {
|
|
112948
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
112949
|
+
}
|
|
112950
|
+
} : () => true;
|
|
112951
|
+
}
|
|
112952
|
+
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);
|
|
112953
|
+
const disallowComments = options && options.disallowComments;
|
|
112954
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
112955
|
+
function scanNext() {
|
|
112956
|
+
while (true) {
|
|
112957
|
+
const token = _scanner.scan();
|
|
112958
|
+
switch (_scanner.getTokenError()) {
|
|
112959
|
+
case 4:
|
|
112960
|
+
handleError2(14);
|
|
112961
|
+
break;
|
|
112962
|
+
case 5:
|
|
112963
|
+
handleError2(15);
|
|
112964
|
+
break;
|
|
112965
|
+
case 3:
|
|
112966
|
+
handleError2(13);
|
|
112967
|
+
break;
|
|
112968
|
+
case 1:
|
|
112969
|
+
if (!disallowComments) {
|
|
112970
|
+
handleError2(11);
|
|
112971
|
+
}
|
|
112972
|
+
break;
|
|
112973
|
+
case 2:
|
|
112974
|
+
handleError2(12);
|
|
112975
|
+
break;
|
|
112976
|
+
case 6:
|
|
112977
|
+
handleError2(16);
|
|
112978
|
+
break;
|
|
112979
|
+
}
|
|
112980
|
+
switch (token) {
|
|
112981
|
+
case 12:
|
|
112982
|
+
case 13:
|
|
112983
|
+
if (disallowComments) {
|
|
112984
|
+
handleError2(10);
|
|
112985
|
+
} else {
|
|
112986
|
+
onComment();
|
|
112987
|
+
}
|
|
112988
|
+
break;
|
|
112989
|
+
case 16:
|
|
112990
|
+
handleError2(1);
|
|
112991
|
+
break;
|
|
112992
|
+
case 15:
|
|
112993
|
+
case 14:
|
|
112994
|
+
break;
|
|
112995
|
+
default:
|
|
112996
|
+
return token;
|
|
112997
|
+
}
|
|
112998
|
+
}
|
|
112999
|
+
}
|
|
113000
|
+
function handleError2(error3, skipUntilAfter = [], skipUntil = []) {
|
|
113001
|
+
onError(error3);
|
|
113002
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
113003
|
+
let token = _scanner.getToken();
|
|
113004
|
+
while (token !== 17) {
|
|
113005
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
113006
|
+
scanNext();
|
|
113007
|
+
break;
|
|
113008
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
113009
|
+
break;
|
|
113010
|
+
}
|
|
113011
|
+
token = scanNext();
|
|
113012
|
+
}
|
|
113013
|
+
}
|
|
113014
|
+
}
|
|
113015
|
+
function parseString(isValue) {
|
|
113016
|
+
const value = _scanner.getTokenValue();
|
|
113017
|
+
if (isValue) {
|
|
113018
|
+
onLiteralValue(value);
|
|
113019
|
+
} else {
|
|
113020
|
+
onObjectProperty(value);
|
|
113021
|
+
_jsonPath.push(value);
|
|
113022
|
+
}
|
|
113023
|
+
scanNext();
|
|
113024
|
+
return true;
|
|
113025
|
+
}
|
|
113026
|
+
function parseLiteral() {
|
|
113027
|
+
switch (_scanner.getToken()) {
|
|
113028
|
+
case 11:
|
|
113029
|
+
const tokenValue = _scanner.getTokenValue();
|
|
113030
|
+
let value = Number(tokenValue);
|
|
113031
|
+
if (isNaN(value)) {
|
|
113032
|
+
handleError2(2);
|
|
113033
|
+
value = 0;
|
|
113034
|
+
}
|
|
113035
|
+
onLiteralValue(value);
|
|
113036
|
+
break;
|
|
113037
|
+
case 7:
|
|
113038
|
+
onLiteralValue(null);
|
|
113039
|
+
break;
|
|
113040
|
+
case 8:
|
|
113041
|
+
onLiteralValue(true);
|
|
113042
|
+
break;
|
|
113043
|
+
case 9:
|
|
113044
|
+
onLiteralValue(false);
|
|
113045
|
+
break;
|
|
113046
|
+
default:
|
|
113047
|
+
return false;
|
|
113048
|
+
}
|
|
113049
|
+
scanNext();
|
|
113050
|
+
return true;
|
|
113051
|
+
}
|
|
113052
|
+
function parseProperty() {
|
|
113053
|
+
if (_scanner.getToken() !== 10) {
|
|
113054
|
+
handleError2(3, [], [2, 5]);
|
|
113055
|
+
return false;
|
|
113056
|
+
}
|
|
113057
|
+
parseString(false);
|
|
113058
|
+
if (_scanner.getToken() === 6) {
|
|
113059
|
+
onSeparator(":");
|
|
113060
|
+
scanNext();
|
|
113061
|
+
if (!parseValue2()) {
|
|
113062
|
+
handleError2(4, [], [2, 5]);
|
|
113063
|
+
}
|
|
113064
|
+
} else {
|
|
113065
|
+
handleError2(5, [], [2, 5]);
|
|
113066
|
+
}
|
|
113067
|
+
_jsonPath.pop();
|
|
113068
|
+
return true;
|
|
113069
|
+
}
|
|
113070
|
+
function parseObject() {
|
|
113071
|
+
onObjectBegin();
|
|
113072
|
+
scanNext();
|
|
113073
|
+
let needsComma = false;
|
|
113074
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
113075
|
+
if (_scanner.getToken() === 5) {
|
|
113076
|
+
if (!needsComma) {
|
|
113077
|
+
handleError2(4, [], []);
|
|
113078
|
+
}
|
|
113079
|
+
onSeparator(",");
|
|
113080
|
+
scanNext();
|
|
113081
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
113082
|
+
break;
|
|
113083
|
+
}
|
|
113084
|
+
} else if (needsComma) {
|
|
113085
|
+
handleError2(6, [], []);
|
|
113086
|
+
}
|
|
113087
|
+
if (!parseProperty()) {
|
|
113088
|
+
handleError2(4, [], [2, 5]);
|
|
113089
|
+
}
|
|
113090
|
+
needsComma = true;
|
|
113091
|
+
}
|
|
113092
|
+
onObjectEnd();
|
|
113093
|
+
if (_scanner.getToken() !== 2) {
|
|
113094
|
+
handleError2(7, [2], []);
|
|
113095
|
+
} else {
|
|
113096
|
+
scanNext();
|
|
113097
|
+
}
|
|
113098
|
+
return true;
|
|
113099
|
+
}
|
|
113100
|
+
function parseArray() {
|
|
113101
|
+
onArrayBegin();
|
|
113102
|
+
scanNext();
|
|
113103
|
+
let isFirstElement = true;
|
|
113104
|
+
let needsComma = false;
|
|
113105
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
113106
|
+
if (_scanner.getToken() === 5) {
|
|
113107
|
+
if (!needsComma) {
|
|
113108
|
+
handleError2(4, [], []);
|
|
113109
|
+
}
|
|
113110
|
+
onSeparator(",");
|
|
113111
|
+
scanNext();
|
|
113112
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
113113
|
+
break;
|
|
113114
|
+
}
|
|
113115
|
+
} else if (needsComma) {
|
|
113116
|
+
handleError2(6, [], []);
|
|
113117
|
+
}
|
|
113118
|
+
if (isFirstElement) {
|
|
113119
|
+
_jsonPath.push(0);
|
|
113120
|
+
isFirstElement = false;
|
|
113121
|
+
} else {
|
|
113122
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
113123
|
+
}
|
|
113124
|
+
if (!parseValue2()) {
|
|
113125
|
+
handleError2(4, [], [4, 5]);
|
|
113126
|
+
}
|
|
113127
|
+
needsComma = true;
|
|
113128
|
+
}
|
|
113129
|
+
onArrayEnd();
|
|
113130
|
+
if (!isFirstElement) {
|
|
113131
|
+
_jsonPath.pop();
|
|
113132
|
+
}
|
|
113133
|
+
if (_scanner.getToken() !== 4) {
|
|
113134
|
+
handleError2(8, [4], []);
|
|
113135
|
+
} else {
|
|
113136
|
+
scanNext();
|
|
113137
|
+
}
|
|
113138
|
+
return true;
|
|
113139
|
+
}
|
|
113140
|
+
function parseValue2() {
|
|
113141
|
+
switch (_scanner.getToken()) {
|
|
113142
|
+
case 3:
|
|
113143
|
+
return parseArray();
|
|
113144
|
+
case 1:
|
|
113145
|
+
return parseObject();
|
|
113146
|
+
case 10:
|
|
113147
|
+
return parseString(true);
|
|
113148
|
+
default:
|
|
113149
|
+
return parseLiteral();
|
|
113150
|
+
}
|
|
113151
|
+
}
|
|
113152
|
+
scanNext();
|
|
113153
|
+
if (_scanner.getToken() === 17) {
|
|
113154
|
+
if (options.allowEmptyContent) {
|
|
113155
|
+
return true;
|
|
113156
|
+
}
|
|
113157
|
+
handleError2(4, [], []);
|
|
113158
|
+
return false;
|
|
113159
|
+
}
|
|
113160
|
+
if (!parseValue2()) {
|
|
113161
|
+
handleError2(4, [], []);
|
|
113162
|
+
return false;
|
|
113163
|
+
}
|
|
113164
|
+
if (_scanner.getToken() !== 17) {
|
|
113165
|
+
handleError2(9, [], []);
|
|
113166
|
+
}
|
|
113167
|
+
return true;
|
|
113168
|
+
}
|
|
113169
|
+
function getNodeType(value) {
|
|
113170
|
+
switch (typeof value) {
|
|
113171
|
+
case "boolean":
|
|
113172
|
+
return "boolean";
|
|
113173
|
+
case "number":
|
|
113174
|
+
return "number";
|
|
113175
|
+
case "string":
|
|
113176
|
+
return "string";
|
|
113177
|
+
case "object": {
|
|
113178
|
+
if (!value) {
|
|
113179
|
+
return "null";
|
|
113180
|
+
} else if (Array.isArray(value)) {
|
|
113181
|
+
return "array";
|
|
113182
|
+
}
|
|
113183
|
+
return "object";
|
|
113184
|
+
}
|
|
113185
|
+
default:
|
|
113186
|
+
return "null";
|
|
113187
|
+
}
|
|
113188
|
+
}
|
|
113189
|
+
|
|
113190
|
+
// node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
113191
|
+
function setProperty2(text, originalPath, value, options) {
|
|
113192
|
+
const path7 = originalPath.slice();
|
|
113193
|
+
const errors8 = [];
|
|
113194
|
+
const root = parseTree(text, errors8);
|
|
113195
|
+
let parent = undefined;
|
|
113196
|
+
let lastSegment = undefined;
|
|
113197
|
+
while (path7.length > 0) {
|
|
113198
|
+
lastSegment = path7.pop();
|
|
113199
|
+
parent = findNodeAtLocation(root, path7);
|
|
113200
|
+
if (parent === undefined && value !== undefined) {
|
|
113201
|
+
if (typeof lastSegment === "string") {
|
|
113202
|
+
value = { [lastSegment]: value };
|
|
113203
|
+
} else {
|
|
113204
|
+
value = [value];
|
|
113205
|
+
}
|
|
113206
|
+
} else {
|
|
113207
|
+
break;
|
|
113208
|
+
}
|
|
113209
|
+
}
|
|
113210
|
+
if (!parent) {
|
|
113211
|
+
if (value === undefined) {
|
|
113212
|
+
throw new Error("Can not delete in empty document");
|
|
113213
|
+
}
|
|
113214
|
+
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
113215
|
+
} else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
|
|
113216
|
+
const existing = findNodeAtLocation(parent, [lastSegment]);
|
|
113217
|
+
if (existing !== undefined) {
|
|
113218
|
+
if (value === undefined) {
|
|
113219
|
+
if (!existing.parent) {
|
|
113220
|
+
throw new Error("Malformed AST");
|
|
113221
|
+
}
|
|
113222
|
+
const propertyIndex = parent.children.indexOf(existing.parent);
|
|
113223
|
+
let removeBegin;
|
|
113224
|
+
let removeEnd = existing.parent.offset + existing.parent.length;
|
|
113225
|
+
if (propertyIndex > 0) {
|
|
113226
|
+
let previous = parent.children[propertyIndex - 1];
|
|
113227
|
+
removeBegin = previous.offset + previous.length;
|
|
113228
|
+
} else {
|
|
113229
|
+
removeBegin = parent.offset + 1;
|
|
113230
|
+
if (parent.children.length > 1) {
|
|
113231
|
+
let next = parent.children[1];
|
|
113232
|
+
removeEnd = next.offset;
|
|
113233
|
+
}
|
|
113234
|
+
}
|
|
113235
|
+
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
|
|
113236
|
+
} else {
|
|
113237
|
+
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
113238
|
+
}
|
|
113239
|
+
} else {
|
|
113240
|
+
if (value === undefined) {
|
|
113241
|
+
return [];
|
|
113242
|
+
}
|
|
113243
|
+
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
|
|
113244
|
+
const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
|
|
113245
|
+
let edit;
|
|
113246
|
+
if (index > 0) {
|
|
113247
|
+
let previous = parent.children[index - 1];
|
|
113248
|
+
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
113249
|
+
} else if (parent.children.length === 0) {
|
|
113250
|
+
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
113251
|
+
} else {
|
|
113252
|
+
edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
|
|
113253
|
+
}
|
|
113254
|
+
return withFormatting(text, edit, options);
|
|
113255
|
+
}
|
|
113256
|
+
} else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
|
|
113257
|
+
const insertIndex = lastSegment;
|
|
113258
|
+
if (insertIndex === -1) {
|
|
113259
|
+
const newProperty = `${JSON.stringify(value)}`;
|
|
113260
|
+
let edit;
|
|
113261
|
+
if (parent.children.length === 0) {
|
|
113262
|
+
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
113263
|
+
} else {
|
|
113264
|
+
const previous = parent.children[parent.children.length - 1];
|
|
113265
|
+
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
113266
|
+
}
|
|
113267
|
+
return withFormatting(text, edit, options);
|
|
113268
|
+
} else if (value === undefined && parent.children.length >= 0) {
|
|
113269
|
+
const removalIndex = lastSegment;
|
|
113270
|
+
const toRemove = parent.children[removalIndex];
|
|
113271
|
+
let edit;
|
|
113272
|
+
if (parent.children.length === 1) {
|
|
113273
|
+
edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
|
|
113274
|
+
} else if (parent.children.length - 1 === removalIndex) {
|
|
113275
|
+
let previous = parent.children[removalIndex - 1];
|
|
113276
|
+
let offset = previous.offset + previous.length;
|
|
113277
|
+
let parentEndOffset = parent.offset + parent.length;
|
|
113278
|
+
edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
|
|
113279
|
+
} else {
|
|
113280
|
+
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
|
|
113281
|
+
}
|
|
113282
|
+
return withFormatting(text, edit, options);
|
|
113283
|
+
} else if (value !== undefined) {
|
|
113284
|
+
let edit;
|
|
113285
|
+
const newProperty = `${JSON.stringify(value)}`;
|
|
113286
|
+
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
113287
|
+
const toModify = parent.children[lastSegment];
|
|
113288
|
+
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
113289
|
+
} else if (parent.children.length === 0 || lastSegment === 0) {
|
|
113290
|
+
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
|
|
113291
|
+
} else {
|
|
113292
|
+
const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
113293
|
+
const previous = parent.children[index - 1];
|
|
113294
|
+
edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
|
|
113295
|
+
}
|
|
113296
|
+
return withFormatting(text, edit, options);
|
|
113297
|
+
} else {
|
|
113298
|
+
throw new Error(`Can not ${value === undefined ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
|
|
113299
|
+
}
|
|
113300
|
+
} else {
|
|
113301
|
+
throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
|
|
113302
|
+
}
|
|
113303
|
+
}
|
|
113304
|
+
function withFormatting(text, edit, options) {
|
|
113305
|
+
if (!options.formattingOptions) {
|
|
113306
|
+
return [edit];
|
|
113307
|
+
}
|
|
113308
|
+
let newText = applyEdit(text, edit);
|
|
113309
|
+
let begin = edit.offset;
|
|
113310
|
+
let end = edit.offset + edit.content.length;
|
|
113311
|
+
if (edit.length === 0 || edit.content.length === 0) {
|
|
113312
|
+
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
113313
|
+
begin--;
|
|
113314
|
+
}
|
|
113315
|
+
while (end < newText.length && !isEOL(newText, end)) {
|
|
113316
|
+
end++;
|
|
113317
|
+
}
|
|
113318
|
+
}
|
|
113319
|
+
const edits = format2(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
|
|
113320
|
+
for (let i = edits.length - 1;i >= 0; i--) {
|
|
113321
|
+
const edit2 = edits[i];
|
|
113322
|
+
newText = applyEdit(newText, edit2);
|
|
113323
|
+
begin = Math.min(begin, edit2.offset);
|
|
113324
|
+
end = Math.max(end, edit2.offset + edit2.length);
|
|
113325
|
+
end += edit2.content.length - edit2.length;
|
|
113326
|
+
}
|
|
113327
|
+
const editLength = text.length - (newText.length - end) - begin;
|
|
113328
|
+
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
113329
|
+
}
|
|
113330
|
+
function applyEdit(text, edit) {
|
|
113331
|
+
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
113332
|
+
}
|
|
113333
|
+
|
|
113334
|
+
// node_modules/jsonc-parser/lib/esm/main.js
|
|
113335
|
+
var ScanError;
|
|
113336
|
+
(function(ScanError2) {
|
|
113337
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
113338
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
113339
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
113340
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
113341
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
113342
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
113343
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
113344
|
+
})(ScanError || (ScanError = {}));
|
|
113345
|
+
var SyntaxKind;
|
|
113346
|
+
(function(SyntaxKind2) {
|
|
113347
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
113348
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
113349
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
113350
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
113351
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
113352
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
113353
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
113354
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
113355
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
113356
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
113357
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
113358
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
113359
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
113360
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
113361
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
113362
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
113363
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
113364
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
113365
|
+
var parse2 = parse;
|
|
113366
|
+
var ParseErrorCode;
|
|
113367
|
+
(function(ParseErrorCode2) {
|
|
113368
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
113369
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
113370
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
113371
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
113372
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
113373
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
113374
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
113375
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
113376
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
113377
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
113378
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
113379
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
113380
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
113381
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
113382
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
113383
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
113384
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
113385
|
+
function modify(text, path7, value, options) {
|
|
113386
|
+
return setProperty2(text, path7, value, options);
|
|
113387
|
+
}
|
|
113388
|
+
function applyEdits(text, edits) {
|
|
113389
|
+
let sortedEdits = edits.slice(0).sort((a, b) => {
|
|
113390
|
+
const diff2 = a.offset - b.offset;
|
|
113391
|
+
if (diff2 === 0) {
|
|
113392
|
+
return a.length - b.length;
|
|
113393
|
+
}
|
|
113394
|
+
return diff2;
|
|
113395
|
+
});
|
|
113396
|
+
let lastModifiedOffset = text.length;
|
|
113397
|
+
for (let i = sortedEdits.length - 1;i >= 0; i--) {
|
|
113398
|
+
let e = sortedEdits[i];
|
|
113399
|
+
if (e.offset + e.length <= lastModifiedOffset) {
|
|
113400
|
+
text = applyEdit(text, e);
|
|
113401
|
+
} else {
|
|
113402
|
+
throw new Error("Overlapping edit");
|
|
113403
|
+
}
|
|
113404
|
+
lastModifiedOffset = e.offset;
|
|
113405
|
+
}
|
|
113406
|
+
return text;
|
|
113407
|
+
}
|
|
113408
|
+
|
|
113409
|
+
// src/commands/mcp/clients/base.ts
|
|
112232
113410
|
var MCP_SERVER_NAME = "temps";
|
|
112233
113411
|
function redactSecrets(text) {
|
|
112234
113412
|
return text.replace(/Bearer\s+\S+/gi, "Bearer ***").replace(/Authorization:\s*\S+(\s+\S+)?/gi, "Authorization: ***");
|
|
@@ -112244,7 +113422,7 @@ class JsonConfigMcpClientAdapter {
|
|
|
112244
113422
|
return null;
|
|
112245
113423
|
try {
|
|
112246
113424
|
const content = await fs5.promises.readFile(configPath, "utf8");
|
|
112247
|
-
const config2 =
|
|
113425
|
+
const config2 = parse2(content);
|
|
112248
113426
|
const prop = this.getServerPropertyName();
|
|
112249
113427
|
return config2?.[prop]?.[MCP_SERVER_NAME] ?? null;
|
|
112250
113428
|
} catch {
|
|
@@ -112268,16 +113446,16 @@ class JsonConfigMcpClientAdapter {
|
|
|
112268
113446
|
content = await fs5.promises.readFile(configPath, "utf8");
|
|
112269
113447
|
}
|
|
112270
113448
|
const prop = this.getServerPropertyName();
|
|
112271
|
-
const existing =
|
|
113449
|
+
const existing = parse2(content || "{}") ?? {};
|
|
112272
113450
|
const newEntry = this.buildServerConfig(entry);
|
|
112273
113451
|
const currentEntry = existing?.[prop]?.[MCP_SERVER_NAME];
|
|
112274
113452
|
if (currentEntry !== undefined && JSON.stringify(currentEntry) === JSON.stringify(newEntry)) {
|
|
112275
113453
|
return { success: true, alreadyInstalled: true };
|
|
112276
113454
|
}
|
|
112277
|
-
const edits =
|
|
113455
|
+
const edits = modify(content, [prop, MCP_SERVER_NAME], newEntry, {
|
|
112278
113456
|
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
112279
113457
|
});
|
|
112280
|
-
const updated =
|
|
113458
|
+
const updated = applyEdits(content, edits);
|
|
112281
113459
|
await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
|
|
112282
113460
|
await fs5.promises.chmod(configPath, 384);
|
|
112283
113461
|
return { success: true };
|
|
@@ -112293,14 +113471,14 @@ class JsonConfigMcpClientAdapter {
|
|
|
112293
113471
|
await fs5.promises.chmod(configPath, 384);
|
|
112294
113472
|
const content = await fs5.promises.readFile(configPath, "utf8");
|
|
112295
113473
|
const prop = this.getServerPropertyName();
|
|
112296
|
-
const existing =
|
|
113474
|
+
const existing = parse2(content);
|
|
112297
113475
|
if (!existing?.[prop]?.[MCP_SERVER_NAME]) {
|
|
112298
113476
|
return { success: true, alreadyInstalled: true };
|
|
112299
113477
|
}
|
|
112300
|
-
const edits =
|
|
113478
|
+
const edits = modify(content, [prop, MCP_SERVER_NAME], undefined, {
|
|
112301
113479
|
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
112302
113480
|
});
|
|
112303
|
-
const updated =
|
|
113481
|
+
const updated = applyEdits(content, edits);
|
|
112304
113482
|
await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
|
|
112305
113483
|
await fs5.promises.chmod(configPath, 384);
|
|
112306
113484
|
return { success: true };
|
|
@@ -113245,6 +114423,7 @@ async function deleteAction4(name, options) {
|
|
|
113245
114423
|
}
|
|
113246
114424
|
|
|
113247
114425
|
// src/commands/sandbox/index.ts
|
|
114426
|
+
import { writeFile as writeFile5, readFile as readFile9 } from "node:fs/promises";
|
|
113248
114427
|
init_spinner();
|
|
113249
114428
|
init_prompts();
|
|
113250
114429
|
init_output();
|
|
@@ -114432,7 +115611,7 @@ async function fsReadAction(id, options) {
|
|
|
114432
115611
|
const res = await withSpinner("Reading file...", () => apiRequest(api, `/${encodeURIComponent(id)}/fs/read?path=${encodeURIComponent(options.path)}`));
|
|
114433
115612
|
const bytes = base64Decode(res.contents_b64);
|
|
114434
115613
|
if (options.out) {
|
|
114435
|
-
await
|
|
115614
|
+
await writeFile5(options.out, bytes);
|
|
114436
115615
|
success2(`Wrote ${res.size} bytes to ${colors.primary(options.out)}`);
|
|
114437
115616
|
} else {
|
|
114438
115617
|
process.stdout.write(bytes);
|
|
@@ -114444,8 +115623,7 @@ async function fsWriteAction(id, options) {
|
|
|
114444
115623
|
}
|
|
114445
115624
|
let bytes;
|
|
114446
115625
|
if (options.file) {
|
|
114447
|
-
|
|
114448
|
-
bytes = new Uint8Array(buf);
|
|
115626
|
+
bytes = new Uint8Array(await readFile9(options.file));
|
|
114449
115627
|
} else if (options.content !== undefined) {
|
|
114450
115628
|
bytes = new TextEncoder().encode(options.content);
|
|
114451
115629
|
} else {
|
|
@@ -114662,6 +115840,8 @@ async function snapshotStorageAction(options) {
|
|
|
114662
115840
|
}
|
|
114663
115841
|
|
|
114664
115842
|
// src/commands/workflow/index.ts
|
|
115843
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
115844
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
114665
115845
|
init_sdk_gen();
|
|
114666
115846
|
init_spinner();
|
|
114667
115847
|
init_output();
|
|
@@ -114839,13 +116019,12 @@ async function runAction2(slug, options) {
|
|
|
114839
116019
|
let run;
|
|
114840
116020
|
let runLabel;
|
|
114841
116021
|
if (options.fromFile) {
|
|
114842
|
-
|
|
114843
|
-
if (!await file.exists()) {
|
|
116022
|
+
if (!existsSync16(options.fromFile)) {
|
|
114844
116023
|
error2(`File not found: ${options.fromFile}`);
|
|
114845
116024
|
process.exitCode = 2;
|
|
114846
116025
|
return;
|
|
114847
116026
|
}
|
|
114848
|
-
const yaml = await
|
|
116027
|
+
const yaml = await readFile10(options.fromFile, "utf8");
|
|
114849
116028
|
if (!yaml.trim()) {
|
|
114850
116029
|
error2(`File is empty: ${options.fromFile}`);
|
|
114851
116030
|
process.exitCode = 2;
|
|
@@ -115349,7 +116528,7 @@ function printRunSummary(run) {
|
|
|
115349
116528
|
}
|
|
115350
116529
|
|
|
115351
116530
|
// src/commands/revenue/index.ts
|
|
115352
|
-
import { readFile as
|
|
116531
|
+
import { readFile as readFile11, stat } from "node:fs/promises";
|
|
115353
116532
|
import { basename as basename6 } from "node:path";
|
|
115354
116533
|
init_sdk_gen();
|
|
115355
116534
|
init_spinner();
|
|
@@ -115423,7 +116602,7 @@ async function uploadCsv(projectId, integrationId, kind, filePath) {
|
|
|
115423
116602
|
if (!fileStat.isFile()) {
|
|
115424
116603
|
throw new Error(`Not a regular file: ${filePath}`);
|
|
115425
116604
|
}
|
|
115426
|
-
const bytes = await
|
|
116605
|
+
const bytes = await readFile11(filePath);
|
|
115427
116606
|
const arrayBuffer = new ArrayBuffer(bytes.byteLength);
|
|
115428
116607
|
new Uint8Array(arrayBuffer).set(bytes);
|
|
115429
116608
|
const form = new FormData;
|
|
@@ -116087,7 +117266,7 @@ init_prompts();
|
|
|
116087
117266
|
init_spinner();
|
|
116088
117267
|
init_output();
|
|
116089
117268
|
init_sdk_gen();
|
|
116090
|
-
import { existsSync as
|
|
117269
|
+
import { existsSync as existsSync17, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
|
|
116091
117270
|
import { resolve as resolve8, join as join14 } from "node:path";
|
|
116092
117271
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
116093
117272
|
async function runSetupWizard(options) {
|
|
@@ -116191,7 +117370,7 @@ async function runSetupWizard(options) {
|
|
|
116191
117370
|
} else {
|
|
116192
117371
|
staticDir = detectedStaticDir ?? "dist";
|
|
116193
117372
|
}
|
|
116194
|
-
if (!
|
|
117373
|
+
if (!existsSync17(resolve8(staticDir))) {
|
|
116195
117374
|
warning2(`Folder not found: ${colors.bold(staticDir)}`);
|
|
116196
117375
|
info2("Build your project first, then re-run, or pass --static-dir <path>.");
|
|
116197
117376
|
return null;
|
|
@@ -116389,7 +117568,7 @@ async function runSetupWizard(options) {
|
|
|
116389
117568
|
info2("Building and deploying...");
|
|
116390
117569
|
newline();
|
|
116391
117570
|
try {
|
|
116392
|
-
const hasDockerfile =
|
|
117571
|
+
const hasDockerfile = existsSync17(resolve8("Dockerfile"));
|
|
116393
117572
|
let dockerfilePath;
|
|
116394
117573
|
let buildArgsList;
|
|
116395
117574
|
if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
|
|
@@ -116526,13 +117705,13 @@ async function selectPresetFromAll() {
|
|
|
116526
117705
|
}
|
|
116527
117706
|
function detectPackageManager(dir) {
|
|
116528
117707
|
const projectDir = dir ? resolve8(dir) : process.cwd();
|
|
116529
|
-
if (
|
|
117708
|
+
if (existsSync17(join14(projectDir, "pnpm-lock.yaml")))
|
|
116530
117709
|
return "pnpm";
|
|
116531
|
-
if (
|
|
117710
|
+
if (existsSync17(join14(projectDir, "yarn.lock")))
|
|
116532
117711
|
return "yarn";
|
|
116533
|
-
if (
|
|
117712
|
+
if (existsSync17(join14(projectDir, "bun.lockb")) || existsSync17(join14(projectDir, "bun.lock")))
|
|
116534
117713
|
return "bun";
|
|
116535
|
-
if (
|
|
117714
|
+
if (existsSync17(join14(projectDir, "package-lock.json")))
|
|
116536
117715
|
return "npm";
|
|
116537
117716
|
return "npm";
|
|
116538
117717
|
}
|
|
@@ -116983,8 +118162,8 @@ function registerAiCommands(program2) {
|
|
|
116983
118162
|
}
|
|
116984
118163
|
|
|
116985
118164
|
// src/config/instances.ts
|
|
116986
|
-
import { readFile as
|
|
116987
|
-
import { existsSync as
|
|
118165
|
+
import { readFile as readFile12, writeFile as writeFile6, mkdir as mkdir5 } from "node:fs/promises";
|
|
118166
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
116988
118167
|
import { dirname as dirname5 } from "node:path";
|
|
116989
118168
|
function getInstancesPath() {
|
|
116990
118169
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
@@ -116993,8 +118172,8 @@ function getInstancesPath() {
|
|
|
116993
118172
|
async function loadInstances() {
|
|
116994
118173
|
const path14 = getInstancesPath();
|
|
116995
118174
|
try {
|
|
116996
|
-
if (
|
|
116997
|
-
const content = await
|
|
118175
|
+
if (existsSync18(path14)) {
|
|
118176
|
+
const content = await readFile12(path14, "utf-8");
|
|
116998
118177
|
return JSON.parse(content);
|
|
116999
118178
|
}
|
|
117000
118179
|
} catch {}
|
|
@@ -117004,7 +118183,7 @@ async function saveInstances(instances2) {
|
|
|
117004
118183
|
const path14 = getInstancesPath();
|
|
117005
118184
|
const dir = dirname5(path14);
|
|
117006
118185
|
await mkdir5(dir, { recursive: true });
|
|
117007
|
-
await
|
|
118186
|
+
await writeFile6(path14, JSON.stringify(instances2, null, 2) + `
|
|
117008
118187
|
`, { mode: 384 });
|
|
117009
118188
|
}
|
|
117010
118189
|
async function listInstances() {
|
|
@@ -118377,7 +119556,7 @@ function extractCommandInfo(cmd2, parentName = "") {
|
|
|
118377
119556
|
function escapeForMdx(text) {
|
|
118378
119557
|
return text.replace(/('[^']*\{[^']*')/g, "`$1`");
|
|
118379
119558
|
}
|
|
118380
|
-
function generateMarkdown(commands, level = 2,
|
|
119559
|
+
function generateMarkdown(commands, level = 2, format3 = "markdown") {
|
|
118381
119560
|
let md = "";
|
|
118382
119561
|
for (const cmd2 of commands) {
|
|
118383
119562
|
const heading = "#".repeat(level);
|
|
@@ -118402,7 +119581,7 @@ function generateMarkdown(commands, level = 2, format2 = "markdown") {
|
|
|
118402
119581
|
const defaultVal = opt.defaultValue !== undefined ? `\`${opt.defaultValue}\`` : "-";
|
|
118403
119582
|
const required = opt.required ? "Yes" : "No";
|
|
118404
119583
|
let escapedDesc = opt.description.replace(/\|/g, "\\|");
|
|
118405
|
-
if (
|
|
119584
|
+
if (format3 === "mdx") {
|
|
118406
119585
|
escapedDesc = escapeForMdx(escapedDesc);
|
|
118407
119586
|
}
|
|
118408
119587
|
md += `| \`${opt.flags}\` | ${escapedDesc} | ${defaultVal} | ${required} |
|
|
@@ -118422,7 +119601,7 @@ function generateMarkdown(commands, level = 2, format2 = "markdown") {
|
|
|
118422
119601
|
}
|
|
118423
119602
|
md += `
|
|
118424
119603
|
`;
|
|
118425
|
-
md += generateMarkdown(cmd2.subcommands, level + 1,
|
|
119604
|
+
md += generateMarkdown(cmd2.subcommands, level + 1, format3);
|
|
118426
119605
|
}
|
|
118427
119606
|
}
|
|
118428
119607
|
return md;
|
|
@@ -118446,14 +119625,14 @@ function generateCommandIndex(commands) {
|
|
|
118446
119625
|
|
|
118447
119626
|
`;
|
|
118448
119627
|
}
|
|
118449
|
-
function generateHeader(
|
|
119628
|
+
function generateHeader(format3 = "markdown", version) {
|
|
118450
119629
|
const mdxMetadata = `export const metadata = {
|
|
118451
119630
|
title: 'CLI Reference',
|
|
118452
119631
|
description: 'Complete reference for the Temps CLI - all commands, options, and usage examples.',
|
|
118453
119632
|
}
|
|
118454
119633
|
|
|
118455
119634
|
`;
|
|
118456
|
-
return `${
|
|
119635
|
+
return `${format3 === "mdx" ? mdxMetadata : ""}# Temps CLI Reference
|
|
118457
119636
|
|
|
118458
119637
|
> Auto-generated documentation for the Temps CLI.
|
|
118459
119638
|
>
|
|
@@ -118581,15 +119760,15 @@ async function generateDocs(options) {
|
|
|
118581
119760
|
if (options.format === "json") {
|
|
118582
119761
|
output = JSON.stringify(commands, null, 2);
|
|
118583
119762
|
} else {
|
|
118584
|
-
const
|
|
119763
|
+
const format3 = options.format === "mdx" ? "mdx" : "markdown";
|
|
118585
119764
|
const version = program2.version() ?? "unknown";
|
|
118586
|
-
output = generateHeader(
|
|
119765
|
+
output = generateHeader(format3, version);
|
|
118587
119766
|
output += generateCommandIndex(commands);
|
|
118588
|
-
output += generateMarkdown(commands, 2,
|
|
119767
|
+
output += generateMarkdown(commands, 2, format3);
|
|
118589
119768
|
output += generateFooter(version);
|
|
118590
119769
|
}
|
|
118591
119770
|
if (options.output) {
|
|
118592
|
-
await
|
|
119771
|
+
await writeFile7(options.output, output, "utf8");
|
|
118593
119772
|
newline();
|
|
118594
119773
|
header("Documentation Generated");
|
|
118595
119774
|
console.log(`${colors.success("Written to:")} ${options.output}`);
|