@sap/ux-ui5-tooling 1.5.4 → 1.5.5
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/CHANGELOG.md +4 -0
- package/README.md +23 -4
- package/dist/cli/index.js +82 -3643
- package/dist/middlewares/fiori-tools-appreload.js +1 -2
- package/dist/middlewares/fiori-tools-preview.js +82 -3632
- package/dist/middlewares/fiori-tools-proxy.js +80 -3624
- package/dist/middlewares/fiori-tools-servestatic.js +14 -8
- package/dist/tasks/cf-deploy/index.js +20 -3610
- package/dist/tasks/deploy/index.js +77 -3627
- package/dist/templates/control-property-editor/app.js +1 -1
- package/dist/templates/control-property-editor/ui5-adaptation.js +1 -1
- package/package.json +8 -8
|
@@ -67139,1524 +67139,6 @@ function serializer(replacer, cycleReplacer) {
|
|
|
67139
67139
|
}
|
|
67140
67140
|
|
|
67141
67141
|
|
|
67142
|
-
/***/ }),
|
|
67143
|
-
|
|
67144
|
-
/***/ 48617:
|
|
67145
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
67146
|
-
|
|
67147
|
-
"use strict";
|
|
67148
|
-
// ESM COMPAT FLAG
|
|
67149
|
-
__webpack_require__.r(__webpack_exports__);
|
|
67150
|
-
|
|
67151
|
-
// EXPORTS
|
|
67152
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
67153
|
-
"applyEdits": () => (/* binding */ applyEdits),
|
|
67154
|
-
"createScanner": () => (/* binding */ main_createScanner),
|
|
67155
|
-
"findNodeAtLocation": () => (/* binding */ main_findNodeAtLocation),
|
|
67156
|
-
"findNodeAtOffset": () => (/* binding */ main_findNodeAtOffset),
|
|
67157
|
-
"format": () => (/* binding */ main_format),
|
|
67158
|
-
"getLocation": () => (/* binding */ main_getLocation),
|
|
67159
|
-
"getNodePath": () => (/* binding */ main_getNodePath),
|
|
67160
|
-
"getNodeValue": () => (/* binding */ main_getNodeValue),
|
|
67161
|
-
"modify": () => (/* binding */ modify),
|
|
67162
|
-
"parse": () => (/* binding */ main_parse),
|
|
67163
|
-
"parseTree": () => (/* binding */ main_parseTree),
|
|
67164
|
-
"printParseErrorCode": () => (/* binding */ printParseErrorCode),
|
|
67165
|
-
"stripComments": () => (/* binding */ main_stripComments),
|
|
67166
|
-
"visit": () => (/* binding */ main_visit)
|
|
67167
|
-
});
|
|
67168
|
-
|
|
67169
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
67170
|
-
/*---------------------------------------------------------------------------------------------
|
|
67171
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
67172
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
67173
|
-
*--------------------------------------------------------------------------------------------*/
|
|
67174
|
-
|
|
67175
|
-
/**
|
|
67176
|
-
* Creates a JSON scanner on the given text.
|
|
67177
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
67178
|
-
*/
|
|
67179
|
-
function createScanner(text, ignoreTrivia) {
|
|
67180
|
-
if (ignoreTrivia === void 0) { ignoreTrivia = false; }
|
|
67181
|
-
var len = text.length;
|
|
67182
|
-
var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */;
|
|
67183
|
-
function scanHexDigits(count, exact) {
|
|
67184
|
-
var digits = 0;
|
|
67185
|
-
var value = 0;
|
|
67186
|
-
while (digits < count || !exact) {
|
|
67187
|
-
var ch = text.charCodeAt(pos);
|
|
67188
|
-
if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) {
|
|
67189
|
-
value = value * 16 + ch - 48 /* _0 */;
|
|
67190
|
-
}
|
|
67191
|
-
else if (ch >= 65 /* A */ && ch <= 70 /* F */) {
|
|
67192
|
-
value = value * 16 + ch - 65 /* A */ + 10;
|
|
67193
|
-
}
|
|
67194
|
-
else if (ch >= 97 /* a */ && ch <= 102 /* f */) {
|
|
67195
|
-
value = value * 16 + ch - 97 /* a */ + 10;
|
|
67196
|
-
}
|
|
67197
|
-
else {
|
|
67198
|
-
break;
|
|
67199
|
-
}
|
|
67200
|
-
pos++;
|
|
67201
|
-
digits++;
|
|
67202
|
-
}
|
|
67203
|
-
if (digits < count) {
|
|
67204
|
-
value = -1;
|
|
67205
|
-
}
|
|
67206
|
-
return value;
|
|
67207
|
-
}
|
|
67208
|
-
function setPosition(newPosition) {
|
|
67209
|
-
pos = newPosition;
|
|
67210
|
-
value = '';
|
|
67211
|
-
tokenOffset = 0;
|
|
67212
|
-
token = 16 /* Unknown */;
|
|
67213
|
-
scanError = 0 /* None */;
|
|
67214
|
-
}
|
|
67215
|
-
function scanNumber() {
|
|
67216
|
-
var start = pos;
|
|
67217
|
-
if (text.charCodeAt(pos) === 48 /* _0 */) {
|
|
67218
|
-
pos++;
|
|
67219
|
-
}
|
|
67220
|
-
else {
|
|
67221
|
-
pos++;
|
|
67222
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67223
|
-
pos++;
|
|
67224
|
-
}
|
|
67225
|
-
}
|
|
67226
|
-
if (pos < text.length && text.charCodeAt(pos) === 46 /* dot */) {
|
|
67227
|
-
pos++;
|
|
67228
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67229
|
-
pos++;
|
|
67230
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67231
|
-
pos++;
|
|
67232
|
-
}
|
|
67233
|
-
}
|
|
67234
|
-
else {
|
|
67235
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
67236
|
-
return text.substring(start, pos);
|
|
67237
|
-
}
|
|
67238
|
-
}
|
|
67239
|
-
var end = pos;
|
|
67240
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */)) {
|
|
67241
|
-
pos++;
|
|
67242
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) {
|
|
67243
|
-
pos++;
|
|
67244
|
-
}
|
|
67245
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67246
|
-
pos++;
|
|
67247
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67248
|
-
pos++;
|
|
67249
|
-
}
|
|
67250
|
-
end = pos;
|
|
67251
|
-
}
|
|
67252
|
-
else {
|
|
67253
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
67254
|
-
}
|
|
67255
|
-
}
|
|
67256
|
-
return text.substring(start, end);
|
|
67257
|
-
}
|
|
67258
|
-
function scanString() {
|
|
67259
|
-
var result = '', start = pos;
|
|
67260
|
-
while (true) {
|
|
67261
|
-
if (pos >= len) {
|
|
67262
|
-
result += text.substring(start, pos);
|
|
67263
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
67264
|
-
break;
|
|
67265
|
-
}
|
|
67266
|
-
var ch = text.charCodeAt(pos);
|
|
67267
|
-
if (ch === 34 /* doubleQuote */) {
|
|
67268
|
-
result += text.substring(start, pos);
|
|
67269
|
-
pos++;
|
|
67270
|
-
break;
|
|
67271
|
-
}
|
|
67272
|
-
if (ch === 92 /* backslash */) {
|
|
67273
|
-
result += text.substring(start, pos);
|
|
67274
|
-
pos++;
|
|
67275
|
-
if (pos >= len) {
|
|
67276
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
67277
|
-
break;
|
|
67278
|
-
}
|
|
67279
|
-
var ch2 = text.charCodeAt(pos++);
|
|
67280
|
-
switch (ch2) {
|
|
67281
|
-
case 34 /* doubleQuote */:
|
|
67282
|
-
result += '\"';
|
|
67283
|
-
break;
|
|
67284
|
-
case 92 /* backslash */:
|
|
67285
|
-
result += '\\';
|
|
67286
|
-
break;
|
|
67287
|
-
case 47 /* slash */:
|
|
67288
|
-
result += '/';
|
|
67289
|
-
break;
|
|
67290
|
-
case 98 /* b */:
|
|
67291
|
-
result += '\b';
|
|
67292
|
-
break;
|
|
67293
|
-
case 102 /* f */:
|
|
67294
|
-
result += '\f';
|
|
67295
|
-
break;
|
|
67296
|
-
case 110 /* n */:
|
|
67297
|
-
result += '\n';
|
|
67298
|
-
break;
|
|
67299
|
-
case 114 /* r */:
|
|
67300
|
-
result += '\r';
|
|
67301
|
-
break;
|
|
67302
|
-
case 116 /* t */:
|
|
67303
|
-
result += '\t';
|
|
67304
|
-
break;
|
|
67305
|
-
case 117 /* u */:
|
|
67306
|
-
var ch3 = scanHexDigits(4, true);
|
|
67307
|
-
if (ch3 >= 0) {
|
|
67308
|
-
result += String.fromCharCode(ch3);
|
|
67309
|
-
}
|
|
67310
|
-
else {
|
|
67311
|
-
scanError = 4 /* InvalidUnicode */;
|
|
67312
|
-
}
|
|
67313
|
-
break;
|
|
67314
|
-
default:
|
|
67315
|
-
scanError = 5 /* InvalidEscapeCharacter */;
|
|
67316
|
-
}
|
|
67317
|
-
start = pos;
|
|
67318
|
-
continue;
|
|
67319
|
-
}
|
|
67320
|
-
if (ch >= 0 && ch <= 0x1f) {
|
|
67321
|
-
if (isLineBreak(ch)) {
|
|
67322
|
-
result += text.substring(start, pos);
|
|
67323
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
67324
|
-
break;
|
|
67325
|
-
}
|
|
67326
|
-
else {
|
|
67327
|
-
scanError = 6 /* InvalidCharacter */;
|
|
67328
|
-
// mark as error but continue with string
|
|
67329
|
-
}
|
|
67330
|
-
}
|
|
67331
|
-
pos++;
|
|
67332
|
-
}
|
|
67333
|
-
return result;
|
|
67334
|
-
}
|
|
67335
|
-
function scanNext() {
|
|
67336
|
-
value = '';
|
|
67337
|
-
scanError = 0 /* None */;
|
|
67338
|
-
tokenOffset = pos;
|
|
67339
|
-
lineStartOffset = lineNumber;
|
|
67340
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
67341
|
-
if (pos >= len) {
|
|
67342
|
-
// at the end
|
|
67343
|
-
tokenOffset = len;
|
|
67344
|
-
return token = 17 /* EOF */;
|
|
67345
|
-
}
|
|
67346
|
-
var code = text.charCodeAt(pos);
|
|
67347
|
-
// trivia: whitespace
|
|
67348
|
-
if (isWhiteSpace(code)) {
|
|
67349
|
-
do {
|
|
67350
|
-
pos++;
|
|
67351
|
-
value += String.fromCharCode(code);
|
|
67352
|
-
code = text.charCodeAt(pos);
|
|
67353
|
-
} while (isWhiteSpace(code));
|
|
67354
|
-
return token = 15 /* Trivia */;
|
|
67355
|
-
}
|
|
67356
|
-
// trivia: newlines
|
|
67357
|
-
if (isLineBreak(code)) {
|
|
67358
|
-
pos++;
|
|
67359
|
-
value += String.fromCharCode(code);
|
|
67360
|
-
if (code === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
67361
|
-
pos++;
|
|
67362
|
-
value += '\n';
|
|
67363
|
-
}
|
|
67364
|
-
lineNumber++;
|
|
67365
|
-
tokenLineStartOffset = pos;
|
|
67366
|
-
return token = 14 /* LineBreakTrivia */;
|
|
67367
|
-
}
|
|
67368
|
-
switch (code) {
|
|
67369
|
-
// tokens: []{}:,
|
|
67370
|
-
case 123 /* openBrace */:
|
|
67371
|
-
pos++;
|
|
67372
|
-
return token = 1 /* OpenBraceToken */;
|
|
67373
|
-
case 125 /* closeBrace */:
|
|
67374
|
-
pos++;
|
|
67375
|
-
return token = 2 /* CloseBraceToken */;
|
|
67376
|
-
case 91 /* openBracket */:
|
|
67377
|
-
pos++;
|
|
67378
|
-
return token = 3 /* OpenBracketToken */;
|
|
67379
|
-
case 93 /* closeBracket */:
|
|
67380
|
-
pos++;
|
|
67381
|
-
return token = 4 /* CloseBracketToken */;
|
|
67382
|
-
case 58 /* colon */:
|
|
67383
|
-
pos++;
|
|
67384
|
-
return token = 6 /* ColonToken */;
|
|
67385
|
-
case 44 /* comma */:
|
|
67386
|
-
pos++;
|
|
67387
|
-
return token = 5 /* CommaToken */;
|
|
67388
|
-
// strings
|
|
67389
|
-
case 34 /* doubleQuote */:
|
|
67390
|
-
pos++;
|
|
67391
|
-
value = scanString();
|
|
67392
|
-
return token = 10 /* StringLiteral */;
|
|
67393
|
-
// comments
|
|
67394
|
-
case 47 /* slash */:
|
|
67395
|
-
var start = pos - 1;
|
|
67396
|
-
// Single-line comment
|
|
67397
|
-
if (text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
67398
|
-
pos += 2;
|
|
67399
|
-
while (pos < len) {
|
|
67400
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
67401
|
-
break;
|
|
67402
|
-
}
|
|
67403
|
-
pos++;
|
|
67404
|
-
}
|
|
67405
|
-
value = text.substring(start, pos);
|
|
67406
|
-
return token = 12 /* LineCommentTrivia */;
|
|
67407
|
-
}
|
|
67408
|
-
// Multi-line comment
|
|
67409
|
-
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
|
|
67410
|
-
pos += 2;
|
|
67411
|
-
var safeLength = len - 1; // For lookahead.
|
|
67412
|
-
var commentClosed = false;
|
|
67413
|
-
while (pos < safeLength) {
|
|
67414
|
-
var ch = text.charCodeAt(pos);
|
|
67415
|
-
if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
67416
|
-
pos += 2;
|
|
67417
|
-
commentClosed = true;
|
|
67418
|
-
break;
|
|
67419
|
-
}
|
|
67420
|
-
pos++;
|
|
67421
|
-
if (isLineBreak(ch)) {
|
|
67422
|
-
if (ch === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
67423
|
-
pos++;
|
|
67424
|
-
}
|
|
67425
|
-
lineNumber++;
|
|
67426
|
-
tokenLineStartOffset = pos;
|
|
67427
|
-
}
|
|
67428
|
-
}
|
|
67429
|
-
if (!commentClosed) {
|
|
67430
|
-
pos++;
|
|
67431
|
-
scanError = 1 /* UnexpectedEndOfComment */;
|
|
67432
|
-
}
|
|
67433
|
-
value = text.substring(start, pos);
|
|
67434
|
-
return token = 13 /* BlockCommentTrivia */;
|
|
67435
|
-
}
|
|
67436
|
-
// just a single slash
|
|
67437
|
-
value += String.fromCharCode(code);
|
|
67438
|
-
pos++;
|
|
67439
|
-
return token = 16 /* Unknown */;
|
|
67440
|
-
// numbers
|
|
67441
|
-
case 45 /* minus */:
|
|
67442
|
-
value += String.fromCharCode(code);
|
|
67443
|
-
pos++;
|
|
67444
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
67445
|
-
return token = 16 /* Unknown */;
|
|
67446
|
-
}
|
|
67447
|
-
// found a minus, followed by a number so
|
|
67448
|
-
// we fall through to proceed with scanning
|
|
67449
|
-
// numbers
|
|
67450
|
-
case 48 /* _0 */:
|
|
67451
|
-
case 49 /* _1 */:
|
|
67452
|
-
case 50 /* _2 */:
|
|
67453
|
-
case 51 /* _3 */:
|
|
67454
|
-
case 52 /* _4 */:
|
|
67455
|
-
case 53 /* _5 */:
|
|
67456
|
-
case 54 /* _6 */:
|
|
67457
|
-
case 55 /* _7 */:
|
|
67458
|
-
case 56 /* _8 */:
|
|
67459
|
-
case 57 /* _9 */:
|
|
67460
|
-
value += scanNumber();
|
|
67461
|
-
return token = 11 /* NumericLiteral */;
|
|
67462
|
-
// literals and unknown symbols
|
|
67463
|
-
default:
|
|
67464
|
-
// is a literal? Read the full word.
|
|
67465
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
67466
|
-
pos++;
|
|
67467
|
-
code = text.charCodeAt(pos);
|
|
67468
|
-
}
|
|
67469
|
-
if (tokenOffset !== pos) {
|
|
67470
|
-
value = text.substring(tokenOffset, pos);
|
|
67471
|
-
// keywords: true, false, null
|
|
67472
|
-
switch (value) {
|
|
67473
|
-
case 'true': return token = 8 /* TrueKeyword */;
|
|
67474
|
-
case 'false': return token = 9 /* FalseKeyword */;
|
|
67475
|
-
case 'null': return token = 7 /* NullKeyword */;
|
|
67476
|
-
}
|
|
67477
|
-
return token = 16 /* Unknown */;
|
|
67478
|
-
}
|
|
67479
|
-
// some
|
|
67480
|
-
value += String.fromCharCode(code);
|
|
67481
|
-
pos++;
|
|
67482
|
-
return token = 16 /* Unknown */;
|
|
67483
|
-
}
|
|
67484
|
-
}
|
|
67485
|
-
function isUnknownContentCharacter(code) {
|
|
67486
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
67487
|
-
return false;
|
|
67488
|
-
}
|
|
67489
|
-
switch (code) {
|
|
67490
|
-
case 125 /* closeBrace */:
|
|
67491
|
-
case 93 /* closeBracket */:
|
|
67492
|
-
case 123 /* openBrace */:
|
|
67493
|
-
case 91 /* openBracket */:
|
|
67494
|
-
case 34 /* doubleQuote */:
|
|
67495
|
-
case 58 /* colon */:
|
|
67496
|
-
case 44 /* comma */:
|
|
67497
|
-
case 47 /* slash */:
|
|
67498
|
-
return false;
|
|
67499
|
-
}
|
|
67500
|
-
return true;
|
|
67501
|
-
}
|
|
67502
|
-
function scanNextNonTrivia() {
|
|
67503
|
-
var result;
|
|
67504
|
-
do {
|
|
67505
|
-
result = scanNext();
|
|
67506
|
-
} while (result >= 12 /* LineCommentTrivia */ && result <= 15 /* Trivia */);
|
|
67507
|
-
return result;
|
|
67508
|
-
}
|
|
67509
|
-
return {
|
|
67510
|
-
setPosition: setPosition,
|
|
67511
|
-
getPosition: function () { return pos; },
|
|
67512
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
67513
|
-
getToken: function () { return token; },
|
|
67514
|
-
getTokenValue: function () { return value; },
|
|
67515
|
-
getTokenOffset: function () { return tokenOffset; },
|
|
67516
|
-
getTokenLength: function () { return pos - tokenOffset; },
|
|
67517
|
-
getTokenStartLine: function () { return lineStartOffset; },
|
|
67518
|
-
getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; },
|
|
67519
|
-
getTokenError: function () { return scanError; },
|
|
67520
|
-
};
|
|
67521
|
-
}
|
|
67522
|
-
function isWhiteSpace(ch) {
|
|
67523
|
-
return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ ||
|
|
67524
|
-
ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ ||
|
|
67525
|
-
ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */;
|
|
67526
|
-
}
|
|
67527
|
-
function isLineBreak(ch) {
|
|
67528
|
-
return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */;
|
|
67529
|
-
}
|
|
67530
|
-
function isDigit(ch) {
|
|
67531
|
-
return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;
|
|
67532
|
-
}
|
|
67533
|
-
|
|
67534
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
67535
|
-
/*---------------------------------------------------------------------------------------------
|
|
67536
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
67537
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
67538
|
-
*--------------------------------------------------------------------------------------------*/
|
|
67539
|
-
|
|
67540
|
-
|
|
67541
|
-
function format(documentText, range, options) {
|
|
67542
|
-
var initialIndentLevel;
|
|
67543
|
-
var formatText;
|
|
67544
|
-
var formatTextStart;
|
|
67545
|
-
var rangeStart;
|
|
67546
|
-
var rangeEnd;
|
|
67547
|
-
if (range) {
|
|
67548
|
-
rangeStart = range.offset;
|
|
67549
|
-
rangeEnd = rangeStart + range.length;
|
|
67550
|
-
formatTextStart = rangeStart;
|
|
67551
|
-
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
67552
|
-
formatTextStart--;
|
|
67553
|
-
}
|
|
67554
|
-
var endOffset = rangeEnd;
|
|
67555
|
-
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
67556
|
-
endOffset++;
|
|
67557
|
-
}
|
|
67558
|
-
formatText = documentText.substring(formatTextStart, endOffset);
|
|
67559
|
-
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
67560
|
-
}
|
|
67561
|
-
else {
|
|
67562
|
-
formatText = documentText;
|
|
67563
|
-
initialIndentLevel = 0;
|
|
67564
|
-
formatTextStart = 0;
|
|
67565
|
-
rangeStart = 0;
|
|
67566
|
-
rangeEnd = documentText.length;
|
|
67567
|
-
}
|
|
67568
|
-
var eol = getEOL(options, documentText);
|
|
67569
|
-
var lineBreak = false;
|
|
67570
|
-
var indentLevel = 0;
|
|
67571
|
-
var indentValue;
|
|
67572
|
-
if (options.insertSpaces) {
|
|
67573
|
-
indentValue = repeat(' ', options.tabSize || 4);
|
|
67574
|
-
}
|
|
67575
|
-
else {
|
|
67576
|
-
indentValue = '\t';
|
|
67577
|
-
}
|
|
67578
|
-
var scanner = createScanner(formatText, false);
|
|
67579
|
-
var hasError = false;
|
|
67580
|
-
function newLineAndIndent() {
|
|
67581
|
-
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
67582
|
-
}
|
|
67583
|
-
function scanNext() {
|
|
67584
|
-
var token = scanner.scan();
|
|
67585
|
-
lineBreak = false;
|
|
67586
|
-
while (token === 15 /* Trivia */ || token === 14 /* LineBreakTrivia */) {
|
|
67587
|
-
lineBreak = lineBreak || (token === 14 /* LineBreakTrivia */);
|
|
67588
|
-
token = scanner.scan();
|
|
67589
|
-
}
|
|
67590
|
-
hasError = token === 16 /* Unknown */ || scanner.getTokenError() !== 0 /* None */;
|
|
67591
|
-
return token;
|
|
67592
|
-
}
|
|
67593
|
-
var editOperations = [];
|
|
67594
|
-
function addEdit(text, startOffset, endOffset) {
|
|
67595
|
-
if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
|
|
67596
|
-
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
67597
|
-
}
|
|
67598
|
-
}
|
|
67599
|
-
var firstToken = scanNext();
|
|
67600
|
-
if (firstToken !== 17 /* EOF */) {
|
|
67601
|
-
var firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
67602
|
-
var initialIndent = repeat(indentValue, initialIndentLevel);
|
|
67603
|
-
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
67604
|
-
}
|
|
67605
|
-
while (firstToken !== 17 /* EOF */) {
|
|
67606
|
-
var firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
67607
|
-
var secondToken = scanNext();
|
|
67608
|
-
var replaceContent = '';
|
|
67609
|
-
while (!lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
67610
|
-
// comments on the same line: keep them on the same line, but ignore them otherwise
|
|
67611
|
-
var commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
67612
|
-
addEdit(' ', firstTokenEnd, commentTokenStart);
|
|
67613
|
-
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
67614
|
-
replaceContent = secondToken === 12 /* LineCommentTrivia */ ? newLineAndIndent() : '';
|
|
67615
|
-
secondToken = scanNext();
|
|
67616
|
-
}
|
|
67617
|
-
if (secondToken === 2 /* CloseBraceToken */) {
|
|
67618
|
-
if (firstToken !== 1 /* OpenBraceToken */) {
|
|
67619
|
-
indentLevel--;
|
|
67620
|
-
replaceContent = newLineAndIndent();
|
|
67621
|
-
}
|
|
67622
|
-
}
|
|
67623
|
-
else if (secondToken === 4 /* CloseBracketToken */) {
|
|
67624
|
-
if (firstToken !== 3 /* OpenBracketToken */) {
|
|
67625
|
-
indentLevel--;
|
|
67626
|
-
replaceContent = newLineAndIndent();
|
|
67627
|
-
}
|
|
67628
|
-
}
|
|
67629
|
-
else {
|
|
67630
|
-
switch (firstToken) {
|
|
67631
|
-
case 3 /* OpenBracketToken */:
|
|
67632
|
-
case 1 /* OpenBraceToken */:
|
|
67633
|
-
indentLevel++;
|
|
67634
|
-
replaceContent = newLineAndIndent();
|
|
67635
|
-
break;
|
|
67636
|
-
case 5 /* CommaToken */:
|
|
67637
|
-
case 12 /* LineCommentTrivia */:
|
|
67638
|
-
replaceContent = newLineAndIndent();
|
|
67639
|
-
break;
|
|
67640
|
-
case 13 /* BlockCommentTrivia */:
|
|
67641
|
-
if (lineBreak) {
|
|
67642
|
-
replaceContent = newLineAndIndent();
|
|
67643
|
-
}
|
|
67644
|
-
else {
|
|
67645
|
-
// symbol following comment on the same line: keep on same line, separate with ' '
|
|
67646
|
-
replaceContent = ' ';
|
|
67647
|
-
}
|
|
67648
|
-
break;
|
|
67649
|
-
case 6 /* ColonToken */:
|
|
67650
|
-
replaceContent = ' ';
|
|
67651
|
-
break;
|
|
67652
|
-
case 10 /* StringLiteral */:
|
|
67653
|
-
if (secondToken === 6 /* ColonToken */) {
|
|
67654
|
-
replaceContent = '';
|
|
67655
|
-
break;
|
|
67656
|
-
}
|
|
67657
|
-
// fall through
|
|
67658
|
-
case 7 /* NullKeyword */:
|
|
67659
|
-
case 8 /* TrueKeyword */:
|
|
67660
|
-
case 9 /* FalseKeyword */:
|
|
67661
|
-
case 11 /* NumericLiteral */:
|
|
67662
|
-
case 2 /* CloseBraceToken */:
|
|
67663
|
-
case 4 /* CloseBracketToken */:
|
|
67664
|
-
if (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */) {
|
|
67665
|
-
replaceContent = ' ';
|
|
67666
|
-
}
|
|
67667
|
-
else if (secondToken !== 5 /* CommaToken */ && secondToken !== 17 /* EOF */) {
|
|
67668
|
-
hasError = true;
|
|
67669
|
-
}
|
|
67670
|
-
break;
|
|
67671
|
-
case 16 /* Unknown */:
|
|
67672
|
-
hasError = true;
|
|
67673
|
-
break;
|
|
67674
|
-
}
|
|
67675
|
-
if (lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
67676
|
-
replaceContent = newLineAndIndent();
|
|
67677
|
-
}
|
|
67678
|
-
}
|
|
67679
|
-
var secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
67680
|
-
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
67681
|
-
firstToken = secondToken;
|
|
67682
|
-
}
|
|
67683
|
-
return editOperations;
|
|
67684
|
-
}
|
|
67685
|
-
function repeat(s, count) {
|
|
67686
|
-
var result = '';
|
|
67687
|
-
for (var i = 0; i < count; i++) {
|
|
67688
|
-
result += s;
|
|
67689
|
-
}
|
|
67690
|
-
return result;
|
|
67691
|
-
}
|
|
67692
|
-
function computeIndentLevel(content, options) {
|
|
67693
|
-
var i = 0;
|
|
67694
|
-
var nChars = 0;
|
|
67695
|
-
var tabSize = options.tabSize || 4;
|
|
67696
|
-
while (i < content.length) {
|
|
67697
|
-
var ch = content.charAt(i);
|
|
67698
|
-
if (ch === ' ') {
|
|
67699
|
-
nChars++;
|
|
67700
|
-
}
|
|
67701
|
-
else if (ch === '\t') {
|
|
67702
|
-
nChars += tabSize;
|
|
67703
|
-
}
|
|
67704
|
-
else {
|
|
67705
|
-
break;
|
|
67706
|
-
}
|
|
67707
|
-
i++;
|
|
67708
|
-
}
|
|
67709
|
-
return Math.floor(nChars / tabSize);
|
|
67710
|
-
}
|
|
67711
|
-
function getEOL(options, text) {
|
|
67712
|
-
for (var i = 0; i < text.length; i++) {
|
|
67713
|
-
var ch = text.charAt(i);
|
|
67714
|
-
if (ch === '\r') {
|
|
67715
|
-
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
|
67716
|
-
return '\r\n';
|
|
67717
|
-
}
|
|
67718
|
-
return '\r';
|
|
67719
|
-
}
|
|
67720
|
-
else if (ch === '\n') {
|
|
67721
|
-
return '\n';
|
|
67722
|
-
}
|
|
67723
|
-
}
|
|
67724
|
-
return (options && options.eol) || '\n';
|
|
67725
|
-
}
|
|
67726
|
-
function isEOL(text, offset) {
|
|
67727
|
-
return '\r\n'.indexOf(text.charAt(offset)) !== -1;
|
|
67728
|
-
}
|
|
67729
|
-
|
|
67730
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
67731
|
-
/*---------------------------------------------------------------------------------------------
|
|
67732
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
67733
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
67734
|
-
*--------------------------------------------------------------------------------------------*/
|
|
67735
|
-
|
|
67736
|
-
|
|
67737
|
-
var ParseOptions;
|
|
67738
|
-
(function (ParseOptions) {
|
|
67739
|
-
ParseOptions.DEFAULT = {
|
|
67740
|
-
allowTrailingComma: false
|
|
67741
|
-
};
|
|
67742
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
67743
|
-
/**
|
|
67744
|
-
* 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.
|
|
67745
|
-
*/
|
|
67746
|
-
function getLocation(text, position) {
|
|
67747
|
-
var segments = []; // strings or numbers
|
|
67748
|
-
var earlyReturnException = new Object();
|
|
67749
|
-
var previousNode = undefined;
|
|
67750
|
-
var previousNodeInst = {
|
|
67751
|
-
value: {},
|
|
67752
|
-
offset: 0,
|
|
67753
|
-
length: 0,
|
|
67754
|
-
type: 'object',
|
|
67755
|
-
parent: undefined
|
|
67756
|
-
};
|
|
67757
|
-
var isAtPropertyKey = false;
|
|
67758
|
-
function setPreviousNode(value, offset, length, type) {
|
|
67759
|
-
previousNodeInst.value = value;
|
|
67760
|
-
previousNodeInst.offset = offset;
|
|
67761
|
-
previousNodeInst.length = length;
|
|
67762
|
-
previousNodeInst.type = type;
|
|
67763
|
-
previousNodeInst.colonOffset = undefined;
|
|
67764
|
-
previousNode = previousNodeInst;
|
|
67765
|
-
}
|
|
67766
|
-
try {
|
|
67767
|
-
visit(text, {
|
|
67768
|
-
onObjectBegin: function (offset, length) {
|
|
67769
|
-
if (position <= offset) {
|
|
67770
|
-
throw earlyReturnException;
|
|
67771
|
-
}
|
|
67772
|
-
previousNode = undefined;
|
|
67773
|
-
isAtPropertyKey = position > offset;
|
|
67774
|
-
segments.push(''); // push a placeholder (will be replaced)
|
|
67775
|
-
},
|
|
67776
|
-
onObjectProperty: function (name, offset, length) {
|
|
67777
|
-
if (position < offset) {
|
|
67778
|
-
throw earlyReturnException;
|
|
67779
|
-
}
|
|
67780
|
-
setPreviousNode(name, offset, length, 'property');
|
|
67781
|
-
segments[segments.length - 1] = name;
|
|
67782
|
-
if (position <= offset + length) {
|
|
67783
|
-
throw earlyReturnException;
|
|
67784
|
-
}
|
|
67785
|
-
},
|
|
67786
|
-
onObjectEnd: function (offset, length) {
|
|
67787
|
-
if (position <= offset) {
|
|
67788
|
-
throw earlyReturnException;
|
|
67789
|
-
}
|
|
67790
|
-
previousNode = undefined;
|
|
67791
|
-
segments.pop();
|
|
67792
|
-
},
|
|
67793
|
-
onArrayBegin: function (offset, length) {
|
|
67794
|
-
if (position <= offset) {
|
|
67795
|
-
throw earlyReturnException;
|
|
67796
|
-
}
|
|
67797
|
-
previousNode = undefined;
|
|
67798
|
-
segments.push(0);
|
|
67799
|
-
},
|
|
67800
|
-
onArrayEnd: function (offset, length) {
|
|
67801
|
-
if (position <= offset) {
|
|
67802
|
-
throw earlyReturnException;
|
|
67803
|
-
}
|
|
67804
|
-
previousNode = undefined;
|
|
67805
|
-
segments.pop();
|
|
67806
|
-
},
|
|
67807
|
-
onLiteralValue: function (value, offset, length) {
|
|
67808
|
-
if (position < offset) {
|
|
67809
|
-
throw earlyReturnException;
|
|
67810
|
-
}
|
|
67811
|
-
setPreviousNode(value, offset, length, getNodeType(value));
|
|
67812
|
-
if (position <= offset + length) {
|
|
67813
|
-
throw earlyReturnException;
|
|
67814
|
-
}
|
|
67815
|
-
},
|
|
67816
|
-
onSeparator: function (sep, offset, length) {
|
|
67817
|
-
if (position <= offset) {
|
|
67818
|
-
throw earlyReturnException;
|
|
67819
|
-
}
|
|
67820
|
-
if (sep === ':' && previousNode && previousNode.type === 'property') {
|
|
67821
|
-
previousNode.colonOffset = offset;
|
|
67822
|
-
isAtPropertyKey = false;
|
|
67823
|
-
previousNode = undefined;
|
|
67824
|
-
}
|
|
67825
|
-
else if (sep === ',') {
|
|
67826
|
-
var last = segments[segments.length - 1];
|
|
67827
|
-
if (typeof last === 'number') {
|
|
67828
|
-
segments[segments.length - 1] = last + 1;
|
|
67829
|
-
}
|
|
67830
|
-
else {
|
|
67831
|
-
isAtPropertyKey = true;
|
|
67832
|
-
segments[segments.length - 1] = '';
|
|
67833
|
-
}
|
|
67834
|
-
previousNode = undefined;
|
|
67835
|
-
}
|
|
67836
|
-
}
|
|
67837
|
-
});
|
|
67838
|
-
}
|
|
67839
|
-
catch (e) {
|
|
67840
|
-
if (e !== earlyReturnException) {
|
|
67841
|
-
throw e;
|
|
67842
|
-
}
|
|
67843
|
-
}
|
|
67844
|
-
return {
|
|
67845
|
-
path: segments,
|
|
67846
|
-
previousNode: previousNode,
|
|
67847
|
-
isAtPropertyKey: isAtPropertyKey,
|
|
67848
|
-
matches: function (pattern) {
|
|
67849
|
-
var k = 0;
|
|
67850
|
-
for (var i = 0; k < pattern.length && i < segments.length; i++) {
|
|
67851
|
-
if (pattern[k] === segments[i] || pattern[k] === '*') {
|
|
67852
|
-
k++;
|
|
67853
|
-
}
|
|
67854
|
-
else if (pattern[k] !== '**') {
|
|
67855
|
-
return false;
|
|
67856
|
-
}
|
|
67857
|
-
}
|
|
67858
|
-
return k === pattern.length;
|
|
67859
|
-
}
|
|
67860
|
-
};
|
|
67861
|
-
}
|
|
67862
|
-
/**
|
|
67863
|
-
* 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.
|
|
67864
|
-
* Therefore always check the errors list to find out if the input was valid.
|
|
67865
|
-
*/
|
|
67866
|
-
function parse(text, errors, options) {
|
|
67867
|
-
if (errors === void 0) { errors = []; }
|
|
67868
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
67869
|
-
var currentProperty = null;
|
|
67870
|
-
var currentParent = [];
|
|
67871
|
-
var previousParents = [];
|
|
67872
|
-
function onValue(value) {
|
|
67873
|
-
if (Array.isArray(currentParent)) {
|
|
67874
|
-
currentParent.push(value);
|
|
67875
|
-
}
|
|
67876
|
-
else if (currentProperty !== null) {
|
|
67877
|
-
currentParent[currentProperty] = value;
|
|
67878
|
-
}
|
|
67879
|
-
}
|
|
67880
|
-
var visitor = {
|
|
67881
|
-
onObjectBegin: function () {
|
|
67882
|
-
var object = {};
|
|
67883
|
-
onValue(object);
|
|
67884
|
-
previousParents.push(currentParent);
|
|
67885
|
-
currentParent = object;
|
|
67886
|
-
currentProperty = null;
|
|
67887
|
-
},
|
|
67888
|
-
onObjectProperty: function (name) {
|
|
67889
|
-
currentProperty = name;
|
|
67890
|
-
},
|
|
67891
|
-
onObjectEnd: function () {
|
|
67892
|
-
currentParent = previousParents.pop();
|
|
67893
|
-
},
|
|
67894
|
-
onArrayBegin: function () {
|
|
67895
|
-
var array = [];
|
|
67896
|
-
onValue(array);
|
|
67897
|
-
previousParents.push(currentParent);
|
|
67898
|
-
currentParent = array;
|
|
67899
|
-
currentProperty = null;
|
|
67900
|
-
},
|
|
67901
|
-
onArrayEnd: function () {
|
|
67902
|
-
currentParent = previousParents.pop();
|
|
67903
|
-
},
|
|
67904
|
-
onLiteralValue: onValue,
|
|
67905
|
-
onError: function (error, offset, length) {
|
|
67906
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
67907
|
-
}
|
|
67908
|
-
};
|
|
67909
|
-
visit(text, visitor, options);
|
|
67910
|
-
return currentParent[0];
|
|
67911
|
-
}
|
|
67912
|
-
/**
|
|
67913
|
-
* 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.
|
|
67914
|
-
*/
|
|
67915
|
-
function parseTree(text, errors, options) {
|
|
67916
|
-
if (errors === void 0) { errors = []; }
|
|
67917
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
67918
|
-
var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root
|
|
67919
|
-
function ensurePropertyComplete(endOffset) {
|
|
67920
|
-
if (currentParent.type === 'property') {
|
|
67921
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
67922
|
-
currentParent = currentParent.parent;
|
|
67923
|
-
}
|
|
67924
|
-
}
|
|
67925
|
-
function onValue(valueNode) {
|
|
67926
|
-
currentParent.children.push(valueNode);
|
|
67927
|
-
return valueNode;
|
|
67928
|
-
}
|
|
67929
|
-
var visitor = {
|
|
67930
|
-
onObjectBegin: function (offset) {
|
|
67931
|
-
currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67932
|
-
},
|
|
67933
|
-
onObjectProperty: function (name, offset, length) {
|
|
67934
|
-
currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67935
|
-
currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });
|
|
67936
|
-
},
|
|
67937
|
-
onObjectEnd: function (offset, length) {
|
|
67938
|
-
ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete
|
|
67939
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
67940
|
-
currentParent = currentParent.parent;
|
|
67941
|
-
ensurePropertyComplete(offset + length);
|
|
67942
|
-
},
|
|
67943
|
-
onArrayBegin: function (offset, length) {
|
|
67944
|
-
currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67945
|
-
},
|
|
67946
|
-
onArrayEnd: function (offset, length) {
|
|
67947
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
67948
|
-
currentParent = currentParent.parent;
|
|
67949
|
-
ensurePropertyComplete(offset + length);
|
|
67950
|
-
},
|
|
67951
|
-
onLiteralValue: function (value, offset, length) {
|
|
67952
|
-
onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value });
|
|
67953
|
-
ensurePropertyComplete(offset + length);
|
|
67954
|
-
},
|
|
67955
|
-
onSeparator: function (sep, offset, length) {
|
|
67956
|
-
if (currentParent.type === 'property') {
|
|
67957
|
-
if (sep === ':') {
|
|
67958
|
-
currentParent.colonOffset = offset;
|
|
67959
|
-
}
|
|
67960
|
-
else if (sep === ',') {
|
|
67961
|
-
ensurePropertyComplete(offset);
|
|
67962
|
-
}
|
|
67963
|
-
}
|
|
67964
|
-
},
|
|
67965
|
-
onError: function (error, offset, length) {
|
|
67966
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
67967
|
-
}
|
|
67968
|
-
};
|
|
67969
|
-
visit(text, visitor, options);
|
|
67970
|
-
var result = currentParent.children[0];
|
|
67971
|
-
if (result) {
|
|
67972
|
-
delete result.parent;
|
|
67973
|
-
}
|
|
67974
|
-
return result;
|
|
67975
|
-
}
|
|
67976
|
-
/**
|
|
67977
|
-
* Finds the node at the given path in a JSON DOM.
|
|
67978
|
-
*/
|
|
67979
|
-
function findNodeAtLocation(root, path) {
|
|
67980
|
-
if (!root) {
|
|
67981
|
-
return undefined;
|
|
67982
|
-
}
|
|
67983
|
-
var node = root;
|
|
67984
|
-
for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
|
|
67985
|
-
var segment = path_1[_i];
|
|
67986
|
-
if (typeof segment === 'string') {
|
|
67987
|
-
if (node.type !== 'object' || !Array.isArray(node.children)) {
|
|
67988
|
-
return undefined;
|
|
67989
|
-
}
|
|
67990
|
-
var found = false;
|
|
67991
|
-
for (var _a = 0, _b = node.children; _a < _b.length; _a++) {
|
|
67992
|
-
var propertyNode = _b[_a];
|
|
67993
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
|
|
67994
|
-
node = propertyNode.children[1];
|
|
67995
|
-
found = true;
|
|
67996
|
-
break;
|
|
67997
|
-
}
|
|
67998
|
-
}
|
|
67999
|
-
if (!found) {
|
|
68000
|
-
return undefined;
|
|
68001
|
-
}
|
|
68002
|
-
}
|
|
68003
|
-
else {
|
|
68004
|
-
var index = segment;
|
|
68005
|
-
if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
68006
|
-
return undefined;
|
|
68007
|
-
}
|
|
68008
|
-
node = node.children[index];
|
|
68009
|
-
}
|
|
68010
|
-
}
|
|
68011
|
-
return node;
|
|
68012
|
-
}
|
|
68013
|
-
/**
|
|
68014
|
-
* Gets the JSON path of the given JSON DOM node
|
|
68015
|
-
*/
|
|
68016
|
-
function getNodePath(node) {
|
|
68017
|
-
if (!node.parent || !node.parent.children) {
|
|
68018
|
-
return [];
|
|
68019
|
-
}
|
|
68020
|
-
var path = getNodePath(node.parent);
|
|
68021
|
-
if (node.parent.type === 'property') {
|
|
68022
|
-
var key = node.parent.children[0].value;
|
|
68023
|
-
path.push(key);
|
|
68024
|
-
}
|
|
68025
|
-
else if (node.parent.type === 'array') {
|
|
68026
|
-
var index = node.parent.children.indexOf(node);
|
|
68027
|
-
if (index !== -1) {
|
|
68028
|
-
path.push(index);
|
|
68029
|
-
}
|
|
68030
|
-
}
|
|
68031
|
-
return path;
|
|
68032
|
-
}
|
|
68033
|
-
/**
|
|
68034
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
68035
|
-
*/
|
|
68036
|
-
function getNodeValue(node) {
|
|
68037
|
-
switch (node.type) {
|
|
68038
|
-
case 'array':
|
|
68039
|
-
return node.children.map(getNodeValue);
|
|
68040
|
-
case 'object':
|
|
68041
|
-
var obj = Object.create(null);
|
|
68042
|
-
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
|
68043
|
-
var prop = _a[_i];
|
|
68044
|
-
var valueNode = prop.children[1];
|
|
68045
|
-
if (valueNode) {
|
|
68046
|
-
obj[prop.children[0].value] = getNodeValue(valueNode);
|
|
68047
|
-
}
|
|
68048
|
-
}
|
|
68049
|
-
return obj;
|
|
68050
|
-
case 'null':
|
|
68051
|
-
case 'string':
|
|
68052
|
-
case 'number':
|
|
68053
|
-
case 'boolean':
|
|
68054
|
-
return node.value;
|
|
68055
|
-
default:
|
|
68056
|
-
return undefined;
|
|
68057
|
-
}
|
|
68058
|
-
}
|
|
68059
|
-
function contains(node, offset, includeRightBound) {
|
|
68060
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
68061
|
-
return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));
|
|
68062
|
-
}
|
|
68063
|
-
/**
|
|
68064
|
-
* Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
68065
|
-
*/
|
|
68066
|
-
function findNodeAtOffset(node, offset, includeRightBound) {
|
|
68067
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
68068
|
-
if (contains(node, offset, includeRightBound)) {
|
|
68069
|
-
var children = node.children;
|
|
68070
|
-
if (Array.isArray(children)) {
|
|
68071
|
-
for (var i = 0; i < children.length && children[i].offset <= offset; i++) {
|
|
68072
|
-
var item = findNodeAtOffset(children[i], offset, includeRightBound);
|
|
68073
|
-
if (item) {
|
|
68074
|
-
return item;
|
|
68075
|
-
}
|
|
68076
|
-
}
|
|
68077
|
-
}
|
|
68078
|
-
return node;
|
|
68079
|
-
}
|
|
68080
|
-
return undefined;
|
|
68081
|
-
}
|
|
68082
|
-
/**
|
|
68083
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
68084
|
-
*/
|
|
68085
|
-
function visit(text, visitor, options) {
|
|
68086
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
68087
|
-
var _scanner = createScanner(text, false);
|
|
68088
|
-
function toNoArgVisit(visitFunction) {
|
|
68089
|
-
return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
68090
|
-
}
|
|
68091
|
-
function toOneArgVisit(visitFunction) {
|
|
68092
|
-
return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
68093
|
-
}
|
|
68094
|
-
var onObjectBegin = toNoArgVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisit(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisit(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisit(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
68095
|
-
var disallowComments = options && options.disallowComments;
|
|
68096
|
-
var allowTrailingComma = options && options.allowTrailingComma;
|
|
68097
|
-
function scanNext() {
|
|
68098
|
-
while (true) {
|
|
68099
|
-
var token = _scanner.scan();
|
|
68100
|
-
switch (_scanner.getTokenError()) {
|
|
68101
|
-
case 4 /* InvalidUnicode */:
|
|
68102
|
-
handleError(14 /* InvalidUnicode */);
|
|
68103
|
-
break;
|
|
68104
|
-
case 5 /* InvalidEscapeCharacter */:
|
|
68105
|
-
handleError(15 /* InvalidEscapeCharacter */);
|
|
68106
|
-
break;
|
|
68107
|
-
case 3 /* UnexpectedEndOfNumber */:
|
|
68108
|
-
handleError(13 /* UnexpectedEndOfNumber */);
|
|
68109
|
-
break;
|
|
68110
|
-
case 1 /* UnexpectedEndOfComment */:
|
|
68111
|
-
if (!disallowComments) {
|
|
68112
|
-
handleError(11 /* UnexpectedEndOfComment */);
|
|
68113
|
-
}
|
|
68114
|
-
break;
|
|
68115
|
-
case 2 /* UnexpectedEndOfString */:
|
|
68116
|
-
handleError(12 /* UnexpectedEndOfString */);
|
|
68117
|
-
break;
|
|
68118
|
-
case 6 /* InvalidCharacter */:
|
|
68119
|
-
handleError(16 /* InvalidCharacter */);
|
|
68120
|
-
break;
|
|
68121
|
-
}
|
|
68122
|
-
switch (token) {
|
|
68123
|
-
case 12 /* LineCommentTrivia */:
|
|
68124
|
-
case 13 /* BlockCommentTrivia */:
|
|
68125
|
-
if (disallowComments) {
|
|
68126
|
-
handleError(10 /* InvalidCommentToken */);
|
|
68127
|
-
}
|
|
68128
|
-
else {
|
|
68129
|
-
onComment();
|
|
68130
|
-
}
|
|
68131
|
-
break;
|
|
68132
|
-
case 16 /* Unknown */:
|
|
68133
|
-
handleError(1 /* InvalidSymbol */);
|
|
68134
|
-
break;
|
|
68135
|
-
case 15 /* Trivia */:
|
|
68136
|
-
case 14 /* LineBreakTrivia */:
|
|
68137
|
-
break;
|
|
68138
|
-
default:
|
|
68139
|
-
return token;
|
|
68140
|
-
}
|
|
68141
|
-
}
|
|
68142
|
-
}
|
|
68143
|
-
function handleError(error, skipUntilAfter, skipUntil) {
|
|
68144
|
-
if (skipUntilAfter === void 0) { skipUntilAfter = []; }
|
|
68145
|
-
if (skipUntil === void 0) { skipUntil = []; }
|
|
68146
|
-
onError(error);
|
|
68147
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
68148
|
-
var token = _scanner.getToken();
|
|
68149
|
-
while (token !== 17 /* EOF */) {
|
|
68150
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
68151
|
-
scanNext();
|
|
68152
|
-
break;
|
|
68153
|
-
}
|
|
68154
|
-
else if (skipUntil.indexOf(token) !== -1) {
|
|
68155
|
-
break;
|
|
68156
|
-
}
|
|
68157
|
-
token = scanNext();
|
|
68158
|
-
}
|
|
68159
|
-
}
|
|
68160
|
-
}
|
|
68161
|
-
function parseString(isValue) {
|
|
68162
|
-
var value = _scanner.getTokenValue();
|
|
68163
|
-
if (isValue) {
|
|
68164
|
-
onLiteralValue(value);
|
|
68165
|
-
}
|
|
68166
|
-
else {
|
|
68167
|
-
onObjectProperty(value);
|
|
68168
|
-
}
|
|
68169
|
-
scanNext();
|
|
68170
|
-
return true;
|
|
68171
|
-
}
|
|
68172
|
-
function parseLiteral() {
|
|
68173
|
-
switch (_scanner.getToken()) {
|
|
68174
|
-
case 11 /* NumericLiteral */:
|
|
68175
|
-
var tokenValue = _scanner.getTokenValue();
|
|
68176
|
-
var value = Number(tokenValue);
|
|
68177
|
-
if (isNaN(value)) {
|
|
68178
|
-
handleError(2 /* InvalidNumberFormat */);
|
|
68179
|
-
value = 0;
|
|
68180
|
-
}
|
|
68181
|
-
onLiteralValue(value);
|
|
68182
|
-
break;
|
|
68183
|
-
case 7 /* NullKeyword */:
|
|
68184
|
-
onLiteralValue(null);
|
|
68185
|
-
break;
|
|
68186
|
-
case 8 /* TrueKeyword */:
|
|
68187
|
-
onLiteralValue(true);
|
|
68188
|
-
break;
|
|
68189
|
-
case 9 /* FalseKeyword */:
|
|
68190
|
-
onLiteralValue(false);
|
|
68191
|
-
break;
|
|
68192
|
-
default:
|
|
68193
|
-
return false;
|
|
68194
|
-
}
|
|
68195
|
-
scanNext();
|
|
68196
|
-
return true;
|
|
68197
|
-
}
|
|
68198
|
-
function parseProperty() {
|
|
68199
|
-
if (_scanner.getToken() !== 10 /* StringLiteral */) {
|
|
68200
|
-
handleError(3 /* PropertyNameExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
68201
|
-
return false;
|
|
68202
|
-
}
|
|
68203
|
-
parseString(false);
|
|
68204
|
-
if (_scanner.getToken() === 6 /* ColonToken */) {
|
|
68205
|
-
onSeparator(':');
|
|
68206
|
-
scanNext(); // consume colon
|
|
68207
|
-
if (!parseValue()) {
|
|
68208
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
68209
|
-
}
|
|
68210
|
-
}
|
|
68211
|
-
else {
|
|
68212
|
-
handleError(5 /* ColonExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
68213
|
-
}
|
|
68214
|
-
return true;
|
|
68215
|
-
}
|
|
68216
|
-
function parseObject() {
|
|
68217
|
-
onObjectBegin();
|
|
68218
|
-
scanNext(); // consume open brace
|
|
68219
|
-
var needsComma = false;
|
|
68220
|
-
while (_scanner.getToken() !== 2 /* CloseBraceToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
68221
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
68222
|
-
if (!needsComma) {
|
|
68223
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
68224
|
-
}
|
|
68225
|
-
onSeparator(',');
|
|
68226
|
-
scanNext(); // consume comma
|
|
68227
|
-
if (_scanner.getToken() === 2 /* CloseBraceToken */ && allowTrailingComma) {
|
|
68228
|
-
break;
|
|
68229
|
-
}
|
|
68230
|
-
}
|
|
68231
|
-
else if (needsComma) {
|
|
68232
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
68233
|
-
}
|
|
68234
|
-
if (!parseProperty()) {
|
|
68235
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
68236
|
-
}
|
|
68237
|
-
needsComma = true;
|
|
68238
|
-
}
|
|
68239
|
-
onObjectEnd();
|
|
68240
|
-
if (_scanner.getToken() !== 2 /* CloseBraceToken */) {
|
|
68241
|
-
handleError(7 /* CloseBraceExpected */, [2 /* CloseBraceToken */], []);
|
|
68242
|
-
}
|
|
68243
|
-
else {
|
|
68244
|
-
scanNext(); // consume close brace
|
|
68245
|
-
}
|
|
68246
|
-
return true;
|
|
68247
|
-
}
|
|
68248
|
-
function parseArray() {
|
|
68249
|
-
onArrayBegin();
|
|
68250
|
-
scanNext(); // consume open bracket
|
|
68251
|
-
var needsComma = false;
|
|
68252
|
-
while (_scanner.getToken() !== 4 /* CloseBracketToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
68253
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
68254
|
-
if (!needsComma) {
|
|
68255
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
68256
|
-
}
|
|
68257
|
-
onSeparator(',');
|
|
68258
|
-
scanNext(); // consume comma
|
|
68259
|
-
if (_scanner.getToken() === 4 /* CloseBracketToken */ && allowTrailingComma) {
|
|
68260
|
-
break;
|
|
68261
|
-
}
|
|
68262
|
-
}
|
|
68263
|
-
else if (needsComma) {
|
|
68264
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
68265
|
-
}
|
|
68266
|
-
if (!parseValue()) {
|
|
68267
|
-
handleError(4 /* ValueExpected */, [], [4 /* CloseBracketToken */, 5 /* CommaToken */]);
|
|
68268
|
-
}
|
|
68269
|
-
needsComma = true;
|
|
68270
|
-
}
|
|
68271
|
-
onArrayEnd();
|
|
68272
|
-
if (_scanner.getToken() !== 4 /* CloseBracketToken */) {
|
|
68273
|
-
handleError(8 /* CloseBracketExpected */, [4 /* CloseBracketToken */], []);
|
|
68274
|
-
}
|
|
68275
|
-
else {
|
|
68276
|
-
scanNext(); // consume close bracket
|
|
68277
|
-
}
|
|
68278
|
-
return true;
|
|
68279
|
-
}
|
|
68280
|
-
function parseValue() {
|
|
68281
|
-
switch (_scanner.getToken()) {
|
|
68282
|
-
case 3 /* OpenBracketToken */:
|
|
68283
|
-
return parseArray();
|
|
68284
|
-
case 1 /* OpenBraceToken */:
|
|
68285
|
-
return parseObject();
|
|
68286
|
-
case 10 /* StringLiteral */:
|
|
68287
|
-
return parseString(true);
|
|
68288
|
-
default:
|
|
68289
|
-
return parseLiteral();
|
|
68290
|
-
}
|
|
68291
|
-
}
|
|
68292
|
-
scanNext();
|
|
68293
|
-
if (_scanner.getToken() === 17 /* EOF */) {
|
|
68294
|
-
if (options.allowEmptyContent) {
|
|
68295
|
-
return true;
|
|
68296
|
-
}
|
|
68297
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
68298
|
-
return false;
|
|
68299
|
-
}
|
|
68300
|
-
if (!parseValue()) {
|
|
68301
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
68302
|
-
return false;
|
|
68303
|
-
}
|
|
68304
|
-
if (_scanner.getToken() !== 17 /* EOF */) {
|
|
68305
|
-
handleError(9 /* EndOfFileExpected */, [], []);
|
|
68306
|
-
}
|
|
68307
|
-
return true;
|
|
68308
|
-
}
|
|
68309
|
-
/**
|
|
68310
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
68311
|
-
* them. Optionally replaces every none-newline character
|
|
68312
|
-
* of comments with a replaceCharacter
|
|
68313
|
-
*/
|
|
68314
|
-
function stripComments(text, replaceCh) {
|
|
68315
|
-
var _scanner = createScanner(text), parts = [], kind, offset = 0, pos;
|
|
68316
|
-
do {
|
|
68317
|
-
pos = _scanner.getPosition();
|
|
68318
|
-
kind = _scanner.scan();
|
|
68319
|
-
switch (kind) {
|
|
68320
|
-
case 12 /* LineCommentTrivia */:
|
|
68321
|
-
case 13 /* BlockCommentTrivia */:
|
|
68322
|
-
case 17 /* EOF */:
|
|
68323
|
-
if (offset !== pos) {
|
|
68324
|
-
parts.push(text.substring(offset, pos));
|
|
68325
|
-
}
|
|
68326
|
-
if (replaceCh !== undefined) {
|
|
68327
|
-
parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
|
|
68328
|
-
}
|
|
68329
|
-
offset = _scanner.getPosition();
|
|
68330
|
-
break;
|
|
68331
|
-
}
|
|
68332
|
-
} while (kind !== 17 /* EOF */);
|
|
68333
|
-
return parts.join('');
|
|
68334
|
-
}
|
|
68335
|
-
function getNodeType(value) {
|
|
68336
|
-
switch (typeof value) {
|
|
68337
|
-
case 'boolean': return 'boolean';
|
|
68338
|
-
case 'number': return 'number';
|
|
68339
|
-
case 'string': return 'string';
|
|
68340
|
-
case 'object': {
|
|
68341
|
-
if (!value) {
|
|
68342
|
-
return 'null';
|
|
68343
|
-
}
|
|
68344
|
-
else if (Array.isArray(value)) {
|
|
68345
|
-
return 'array';
|
|
68346
|
-
}
|
|
68347
|
-
return 'object';
|
|
68348
|
-
}
|
|
68349
|
-
default: return 'null';
|
|
68350
|
-
}
|
|
68351
|
-
}
|
|
68352
|
-
|
|
68353
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
68354
|
-
/*---------------------------------------------------------------------------------------------
|
|
68355
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
68356
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
68357
|
-
*--------------------------------------------------------------------------------------------*/
|
|
68358
|
-
|
|
68359
|
-
|
|
68360
|
-
|
|
68361
|
-
function removeProperty(text, path, options) {
|
|
68362
|
-
return setProperty(text, path, void 0, options);
|
|
68363
|
-
}
|
|
68364
|
-
function setProperty(text, originalPath, value, options) {
|
|
68365
|
-
var _a;
|
|
68366
|
-
var path = originalPath.slice();
|
|
68367
|
-
var errors = [];
|
|
68368
|
-
var root = parseTree(text, errors);
|
|
68369
|
-
var parent = void 0;
|
|
68370
|
-
var lastSegment = void 0;
|
|
68371
|
-
while (path.length > 0) {
|
|
68372
|
-
lastSegment = path.pop();
|
|
68373
|
-
parent = findNodeAtLocation(root, path);
|
|
68374
|
-
if (parent === void 0 && value !== void 0) {
|
|
68375
|
-
if (typeof lastSegment === 'string') {
|
|
68376
|
-
value = (_a = {}, _a[lastSegment] = value, _a);
|
|
68377
|
-
}
|
|
68378
|
-
else {
|
|
68379
|
-
value = [value];
|
|
68380
|
-
}
|
|
68381
|
-
}
|
|
68382
|
-
else {
|
|
68383
|
-
break;
|
|
68384
|
-
}
|
|
68385
|
-
}
|
|
68386
|
-
if (!parent) {
|
|
68387
|
-
// empty document
|
|
68388
|
-
if (value === void 0) { // delete
|
|
68389
|
-
throw new Error('Can not delete in empty document');
|
|
68390
|
-
}
|
|
68391
|
-
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
68392
|
-
}
|
|
68393
|
-
else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {
|
|
68394
|
-
var existing = findNodeAtLocation(parent, [lastSegment]);
|
|
68395
|
-
if (existing !== void 0) {
|
|
68396
|
-
if (value === void 0) { // delete
|
|
68397
|
-
if (!existing.parent) {
|
|
68398
|
-
throw new Error('Malformed AST');
|
|
68399
|
-
}
|
|
68400
|
-
var propertyIndex = parent.children.indexOf(existing.parent);
|
|
68401
|
-
var removeBegin = void 0;
|
|
68402
|
-
var removeEnd = existing.parent.offset + existing.parent.length;
|
|
68403
|
-
if (propertyIndex > 0) {
|
|
68404
|
-
// remove the comma of the previous node
|
|
68405
|
-
var previous = parent.children[propertyIndex - 1];
|
|
68406
|
-
removeBegin = previous.offset + previous.length;
|
|
68407
|
-
}
|
|
68408
|
-
else {
|
|
68409
|
-
removeBegin = parent.offset + 1;
|
|
68410
|
-
if (parent.children.length > 1) {
|
|
68411
|
-
// remove the comma of the next node
|
|
68412
|
-
var next = parent.children[1];
|
|
68413
|
-
removeEnd = next.offset;
|
|
68414
|
-
}
|
|
68415
|
-
}
|
|
68416
|
-
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options);
|
|
68417
|
-
}
|
|
68418
|
-
else {
|
|
68419
|
-
// set value of existing property
|
|
68420
|
-
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
68421
|
-
}
|
|
68422
|
-
}
|
|
68423
|
-
else {
|
|
68424
|
-
if (value === void 0) { // delete
|
|
68425
|
-
return []; // property does not exist, nothing to do
|
|
68426
|
-
}
|
|
68427
|
-
var newProperty = JSON.stringify(lastSegment) + ": " + JSON.stringify(value);
|
|
68428
|
-
var index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(function (p) { return p.children[0].value; })) : parent.children.length;
|
|
68429
|
-
var edit = void 0;
|
|
68430
|
-
if (index > 0) {
|
|
68431
|
-
var previous = parent.children[index - 1];
|
|
68432
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
68433
|
-
}
|
|
68434
|
-
else if (parent.children.length === 0) {
|
|
68435
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
68436
|
-
}
|
|
68437
|
-
else {
|
|
68438
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };
|
|
68439
|
-
}
|
|
68440
|
-
return withFormatting(text, edit, options);
|
|
68441
|
-
}
|
|
68442
|
-
}
|
|
68443
|
-
else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {
|
|
68444
|
-
var insertIndex = lastSegment;
|
|
68445
|
-
if (insertIndex === -1) {
|
|
68446
|
-
// Insert
|
|
68447
|
-
var newProperty = "" + JSON.stringify(value);
|
|
68448
|
-
var edit = void 0;
|
|
68449
|
-
if (parent.children.length === 0) {
|
|
68450
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
68451
|
-
}
|
|
68452
|
-
else {
|
|
68453
|
-
var previous = parent.children[parent.children.length - 1];
|
|
68454
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
68455
|
-
}
|
|
68456
|
-
return withFormatting(text, edit, options);
|
|
68457
|
-
}
|
|
68458
|
-
else if (value === void 0 && parent.children.length >= 0) {
|
|
68459
|
-
// Removal
|
|
68460
|
-
var removalIndex = lastSegment;
|
|
68461
|
-
var toRemove = parent.children[removalIndex];
|
|
68462
|
-
var edit = void 0;
|
|
68463
|
-
if (parent.children.length === 1) {
|
|
68464
|
-
// only item
|
|
68465
|
-
edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };
|
|
68466
|
-
}
|
|
68467
|
-
else if (parent.children.length - 1 === removalIndex) {
|
|
68468
|
-
// last item
|
|
68469
|
-
var previous = parent.children[removalIndex - 1];
|
|
68470
|
-
var offset = previous.offset + previous.length;
|
|
68471
|
-
var parentEndOffset = parent.offset + parent.length;
|
|
68472
|
-
edit = { offset: offset, length: parentEndOffset - 2 - offset, content: '' };
|
|
68473
|
-
}
|
|
68474
|
-
else {
|
|
68475
|
-
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };
|
|
68476
|
-
}
|
|
68477
|
-
return withFormatting(text, edit, options);
|
|
68478
|
-
}
|
|
68479
|
-
else if (value !== void 0) {
|
|
68480
|
-
var edit = void 0;
|
|
68481
|
-
var newProperty = "" + JSON.stringify(value);
|
|
68482
|
-
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
68483
|
-
var toModify = parent.children[lastSegment];
|
|
68484
|
-
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
68485
|
-
}
|
|
68486
|
-
else if (parent.children.length === 0 || lastSegment === 0) {
|
|
68487
|
-
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };
|
|
68488
|
-
}
|
|
68489
|
-
else {
|
|
68490
|
-
var index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
68491
|
-
var previous = parent.children[index - 1];
|
|
68492
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
68493
|
-
}
|
|
68494
|
-
return withFormatting(text, edit, options);
|
|
68495
|
-
}
|
|
68496
|
-
else {
|
|
68497
|
-
throw new Error("Can not " + (value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')) + " Array index " + insertIndex + " as length is not sufficient");
|
|
68498
|
-
}
|
|
68499
|
-
}
|
|
68500
|
-
else {
|
|
68501
|
-
throw new Error("Can not add " + (typeof lastSegment !== 'number' ? 'index' : 'property') + " to parent of type " + parent.type);
|
|
68502
|
-
}
|
|
68503
|
-
}
|
|
68504
|
-
function withFormatting(text, edit, options) {
|
|
68505
|
-
if (!options.formattingOptions) {
|
|
68506
|
-
return [edit];
|
|
68507
|
-
}
|
|
68508
|
-
// apply the edit
|
|
68509
|
-
var newText = applyEdit(text, edit);
|
|
68510
|
-
// format the new text
|
|
68511
|
-
var begin = edit.offset;
|
|
68512
|
-
var end = edit.offset + edit.content.length;
|
|
68513
|
-
if (edit.length === 0 || edit.content.length === 0) { // insert or remove
|
|
68514
|
-
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
68515
|
-
begin--;
|
|
68516
|
-
}
|
|
68517
|
-
while (end < newText.length && !isEOL(newText, end)) {
|
|
68518
|
-
end++;
|
|
68519
|
-
}
|
|
68520
|
-
}
|
|
68521
|
-
var edits = format(newText, { offset: begin, length: end - begin }, options.formattingOptions);
|
|
68522
|
-
// apply the formatting edits and track the begin and end offsets of the changes
|
|
68523
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
68524
|
-
var edit_1 = edits[i];
|
|
68525
|
-
newText = applyEdit(newText, edit_1);
|
|
68526
|
-
begin = Math.min(begin, edit_1.offset);
|
|
68527
|
-
end = Math.max(end, edit_1.offset + edit_1.length);
|
|
68528
|
-
end += edit_1.content.length - edit_1.length;
|
|
68529
|
-
}
|
|
68530
|
-
// create a single edit with all changes
|
|
68531
|
-
var editLength = text.length - (newText.length - end) - begin;
|
|
68532
|
-
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
68533
|
-
}
|
|
68534
|
-
function applyEdit(text, edit) {
|
|
68535
|
-
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
68536
|
-
}
|
|
68537
|
-
function isWS(text, offset) {
|
|
68538
|
-
return '\r\n \t'.indexOf(text.charAt(offset)) !== -1;
|
|
68539
|
-
}
|
|
68540
|
-
|
|
68541
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/main.js
|
|
68542
|
-
/*---------------------------------------------------------------------------------------------
|
|
68543
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
68544
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
68545
|
-
*--------------------------------------------------------------------------------------------*/
|
|
68546
|
-
|
|
68547
|
-
|
|
68548
|
-
|
|
68549
|
-
|
|
68550
|
-
|
|
68551
|
-
/**
|
|
68552
|
-
* Creates a JSON scanner on the given text.
|
|
68553
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
68554
|
-
*/
|
|
68555
|
-
var main_createScanner = createScanner;
|
|
68556
|
-
/**
|
|
68557
|
-
* 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.
|
|
68558
|
-
*/
|
|
68559
|
-
var main_getLocation = getLocation;
|
|
68560
|
-
/**
|
|
68561
|
-
* 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.
|
|
68562
|
-
* Therefore, always check the errors list to find out if the input was valid.
|
|
68563
|
-
*/
|
|
68564
|
-
var main_parse = parse;
|
|
68565
|
-
/**
|
|
68566
|
-
* 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.
|
|
68567
|
-
*/
|
|
68568
|
-
var main_parseTree = parseTree;
|
|
68569
|
-
/**
|
|
68570
|
-
* Finds the node at the given path in a JSON DOM.
|
|
68571
|
-
*/
|
|
68572
|
-
var main_findNodeAtLocation = findNodeAtLocation;
|
|
68573
|
-
/**
|
|
68574
|
-
* Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
68575
|
-
*/
|
|
68576
|
-
var main_findNodeAtOffset = findNodeAtOffset;
|
|
68577
|
-
/**
|
|
68578
|
-
* Gets the JSON path of the given JSON DOM node
|
|
68579
|
-
*/
|
|
68580
|
-
var main_getNodePath = getNodePath;
|
|
68581
|
-
/**
|
|
68582
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
68583
|
-
*/
|
|
68584
|
-
var main_getNodeValue = getNodeValue;
|
|
68585
|
-
/**
|
|
68586
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
68587
|
-
*/
|
|
68588
|
-
var main_visit = visit;
|
|
68589
|
-
/**
|
|
68590
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
68591
|
-
* them. Optionally replaces every none-newline character
|
|
68592
|
-
* of comments with a replaceCharacter
|
|
68593
|
-
*/
|
|
68594
|
-
var main_stripComments = stripComments;
|
|
68595
|
-
function printParseErrorCode(code) {
|
|
68596
|
-
switch (code) {
|
|
68597
|
-
case 1 /* InvalidSymbol */: return 'InvalidSymbol';
|
|
68598
|
-
case 2 /* InvalidNumberFormat */: return 'InvalidNumberFormat';
|
|
68599
|
-
case 3 /* PropertyNameExpected */: return 'PropertyNameExpected';
|
|
68600
|
-
case 4 /* ValueExpected */: return 'ValueExpected';
|
|
68601
|
-
case 5 /* ColonExpected */: return 'ColonExpected';
|
|
68602
|
-
case 6 /* CommaExpected */: return 'CommaExpected';
|
|
68603
|
-
case 7 /* CloseBraceExpected */: return 'CloseBraceExpected';
|
|
68604
|
-
case 8 /* CloseBracketExpected */: return 'CloseBracketExpected';
|
|
68605
|
-
case 9 /* EndOfFileExpected */: return 'EndOfFileExpected';
|
|
68606
|
-
case 10 /* InvalidCommentToken */: return 'InvalidCommentToken';
|
|
68607
|
-
case 11 /* UnexpectedEndOfComment */: return 'UnexpectedEndOfComment';
|
|
68608
|
-
case 12 /* UnexpectedEndOfString */: return 'UnexpectedEndOfString';
|
|
68609
|
-
case 13 /* UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber';
|
|
68610
|
-
case 14 /* InvalidUnicode */: return 'InvalidUnicode';
|
|
68611
|
-
case 15 /* InvalidEscapeCharacter */: return 'InvalidEscapeCharacter';
|
|
68612
|
-
case 16 /* InvalidCharacter */: return 'InvalidCharacter';
|
|
68613
|
-
}
|
|
68614
|
-
return '<unknown ParseErrorCode>';
|
|
68615
|
-
}
|
|
68616
|
-
/**
|
|
68617
|
-
* Computes the edits needed to format a JSON document.
|
|
68618
|
-
*
|
|
68619
|
-
* @param documentText The input text
|
|
68620
|
-
* @param range The range to format or `undefined` to format the full content
|
|
68621
|
-
* @param options The formatting options
|
|
68622
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
68623
|
-
* removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of
|
|
68624
|
-
* text in the original document. However, multiple edits can have
|
|
68625
|
-
* the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first.
|
|
68626
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
68627
|
-
*/
|
|
68628
|
-
function main_format(documentText, range, options) {
|
|
68629
|
-
return format(documentText, range, options);
|
|
68630
|
-
}
|
|
68631
|
-
/**
|
|
68632
|
-
* Computes the edits needed to modify a value in the JSON document.
|
|
68633
|
-
*
|
|
68634
|
-
* @param documentText The input text
|
|
68635
|
-
* @param path The path of the value to change. The path represents either to the document root, a property or an array item.
|
|
68636
|
-
* If the path points to an non-existing property or item, it will be created.
|
|
68637
|
-
* @param value The new value for the specified property or item. If the value is undefined,
|
|
68638
|
-
* the property or item will be removed.
|
|
68639
|
-
* @param options Options
|
|
68640
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
68641
|
-
* removals of text segments. All offsets refer to the original state of the document. No two edits must change or remove the same range of
|
|
68642
|
-
* text in the original document. However, multiple edits can have
|
|
68643
|
-
* the same offset, for example multiple inserts, or an insert followed by a remove or replace. The order in the array defines which edit is applied first.
|
|
68644
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
68645
|
-
*/
|
|
68646
|
-
function modify(text, path, value, options) {
|
|
68647
|
-
return setProperty(text, path, value, options);
|
|
68648
|
-
}
|
|
68649
|
-
/**
|
|
68650
|
-
* Applies edits to a input string.
|
|
68651
|
-
*/
|
|
68652
|
-
function applyEdits(text, edits) {
|
|
68653
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
68654
|
-
text = applyEdit(text, edits[i]);
|
|
68655
|
-
}
|
|
68656
|
-
return text;
|
|
68657
|
-
}
|
|
68658
|
-
|
|
68659
|
-
|
|
68660
67142
|
/***/ }),
|
|
68661
67143
|
|
|
68662
67144
|
/***/ 47296:
|
|
@@ -120301,287 +118783,6 @@ function dumpException(ex)
|
|
|
120301
118783
|
}
|
|
120302
118784
|
|
|
120303
118785
|
|
|
120304
|
-
/***/ }),
|
|
120305
|
-
|
|
120306
|
-
/***/ 61096:
|
|
120307
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
120308
|
-
|
|
120309
|
-
"use strict";
|
|
120310
|
-
__webpack_require__.r(__webpack_exports__);
|
|
120311
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
120312
|
-
/* harmony export */ "TextDocument": () => (/* binding */ TextDocument)
|
|
120313
|
-
/* harmony export */ });
|
|
120314
|
-
/* --------------------------------------------------------------------------------------------
|
|
120315
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
120316
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
120317
|
-
* ------------------------------------------------------------------------------------------ */
|
|
120318
|
-
|
|
120319
|
-
var FullTextDocument = /** @class */ (function () {
|
|
120320
|
-
function FullTextDocument(uri, languageId, version, content) {
|
|
120321
|
-
this._uri = uri;
|
|
120322
|
-
this._languageId = languageId;
|
|
120323
|
-
this._version = version;
|
|
120324
|
-
this._content = content;
|
|
120325
|
-
this._lineOffsets = undefined;
|
|
120326
|
-
}
|
|
120327
|
-
Object.defineProperty(FullTextDocument.prototype, "uri", {
|
|
120328
|
-
get: function () {
|
|
120329
|
-
return this._uri;
|
|
120330
|
-
},
|
|
120331
|
-
enumerable: true,
|
|
120332
|
-
configurable: true
|
|
120333
|
-
});
|
|
120334
|
-
Object.defineProperty(FullTextDocument.prototype, "languageId", {
|
|
120335
|
-
get: function () {
|
|
120336
|
-
return this._languageId;
|
|
120337
|
-
},
|
|
120338
|
-
enumerable: true,
|
|
120339
|
-
configurable: true
|
|
120340
|
-
});
|
|
120341
|
-
Object.defineProperty(FullTextDocument.prototype, "version", {
|
|
120342
|
-
get: function () {
|
|
120343
|
-
return this._version;
|
|
120344
|
-
},
|
|
120345
|
-
enumerable: true,
|
|
120346
|
-
configurable: true
|
|
120347
|
-
});
|
|
120348
|
-
FullTextDocument.prototype.getText = function (range) {
|
|
120349
|
-
if (range) {
|
|
120350
|
-
var start = this.offsetAt(range.start);
|
|
120351
|
-
var end = this.offsetAt(range.end);
|
|
120352
|
-
return this._content.substring(start, end);
|
|
120353
|
-
}
|
|
120354
|
-
return this._content;
|
|
120355
|
-
};
|
|
120356
|
-
FullTextDocument.prototype.update = function (changes, version) {
|
|
120357
|
-
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
|
|
120358
|
-
var change = changes_1[_i];
|
|
120359
|
-
if (FullTextDocument.isIncremental(change)) {
|
|
120360
|
-
// makes sure start is before end
|
|
120361
|
-
var range = getWellformedRange(change.range);
|
|
120362
|
-
// update content
|
|
120363
|
-
var startOffset = this.offsetAt(range.start);
|
|
120364
|
-
var endOffset = this.offsetAt(range.end);
|
|
120365
|
-
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
|
|
120366
|
-
// update the offsets
|
|
120367
|
-
var startLine = Math.max(range.start.line, 0);
|
|
120368
|
-
var endLine = Math.max(range.end.line, 0);
|
|
120369
|
-
var lineOffsets = this._lineOffsets;
|
|
120370
|
-
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
|
|
120371
|
-
if (endLine - startLine === addedLineOffsets.length) {
|
|
120372
|
-
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
|
|
120373
|
-
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
|
|
120374
|
-
}
|
|
120375
|
-
}
|
|
120376
|
-
else {
|
|
120377
|
-
if (addedLineOffsets.length < 10000) {
|
|
120378
|
-
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
|
|
120379
|
-
}
|
|
120380
|
-
else { // avoid too many arguments for splice
|
|
120381
|
-
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
|
|
120382
|
-
}
|
|
120383
|
-
}
|
|
120384
|
-
var diff = change.text.length - (endOffset - startOffset);
|
|
120385
|
-
if (diff !== 0) {
|
|
120386
|
-
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
|
|
120387
|
-
lineOffsets[i] = lineOffsets[i] + diff;
|
|
120388
|
-
}
|
|
120389
|
-
}
|
|
120390
|
-
}
|
|
120391
|
-
else if (FullTextDocument.isFull(change)) {
|
|
120392
|
-
this._content = change.text;
|
|
120393
|
-
this._lineOffsets = undefined;
|
|
120394
|
-
}
|
|
120395
|
-
else {
|
|
120396
|
-
throw new Error('Unknown change event received');
|
|
120397
|
-
}
|
|
120398
|
-
}
|
|
120399
|
-
this._version = version;
|
|
120400
|
-
};
|
|
120401
|
-
FullTextDocument.prototype.getLineOffsets = function () {
|
|
120402
|
-
if (this._lineOffsets === undefined) {
|
|
120403
|
-
this._lineOffsets = computeLineOffsets(this._content, true);
|
|
120404
|
-
}
|
|
120405
|
-
return this._lineOffsets;
|
|
120406
|
-
};
|
|
120407
|
-
FullTextDocument.prototype.positionAt = function (offset) {
|
|
120408
|
-
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
120409
|
-
var lineOffsets = this.getLineOffsets();
|
|
120410
|
-
var low = 0, high = lineOffsets.length;
|
|
120411
|
-
if (high === 0) {
|
|
120412
|
-
return { line: 0, character: offset };
|
|
120413
|
-
}
|
|
120414
|
-
while (low < high) {
|
|
120415
|
-
var mid = Math.floor((low + high) / 2);
|
|
120416
|
-
if (lineOffsets[mid] > offset) {
|
|
120417
|
-
high = mid;
|
|
120418
|
-
}
|
|
120419
|
-
else {
|
|
120420
|
-
low = mid + 1;
|
|
120421
|
-
}
|
|
120422
|
-
}
|
|
120423
|
-
// low is the least x for which the line offset is larger than the current offset
|
|
120424
|
-
// or array.length if no line offset is larger than the current offset
|
|
120425
|
-
var line = low - 1;
|
|
120426
|
-
return { line: line, character: offset - lineOffsets[line] };
|
|
120427
|
-
};
|
|
120428
|
-
FullTextDocument.prototype.offsetAt = function (position) {
|
|
120429
|
-
var lineOffsets = this.getLineOffsets();
|
|
120430
|
-
if (position.line >= lineOffsets.length) {
|
|
120431
|
-
return this._content.length;
|
|
120432
|
-
}
|
|
120433
|
-
else if (position.line < 0) {
|
|
120434
|
-
return 0;
|
|
120435
|
-
}
|
|
120436
|
-
var lineOffset = lineOffsets[position.line];
|
|
120437
|
-
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
|
|
120438
|
-
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
|
120439
|
-
};
|
|
120440
|
-
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
|
|
120441
|
-
get: function () {
|
|
120442
|
-
return this.getLineOffsets().length;
|
|
120443
|
-
},
|
|
120444
|
-
enumerable: true,
|
|
120445
|
-
configurable: true
|
|
120446
|
-
});
|
|
120447
|
-
FullTextDocument.isIncremental = function (event) {
|
|
120448
|
-
var candidate = event;
|
|
120449
|
-
return candidate !== undefined && candidate !== null &&
|
|
120450
|
-
typeof candidate.text === 'string' && candidate.range !== undefined &&
|
|
120451
|
-
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
|
|
120452
|
-
};
|
|
120453
|
-
FullTextDocument.isFull = function (event) {
|
|
120454
|
-
var candidate = event;
|
|
120455
|
-
return candidate !== undefined && candidate !== null &&
|
|
120456
|
-
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
|
|
120457
|
-
};
|
|
120458
|
-
return FullTextDocument;
|
|
120459
|
-
}());
|
|
120460
|
-
var TextDocument;
|
|
120461
|
-
(function (TextDocument) {
|
|
120462
|
-
/**
|
|
120463
|
-
* Creates a new text document.
|
|
120464
|
-
*
|
|
120465
|
-
* @param uri The document's uri.
|
|
120466
|
-
* @param languageId The document's language Id.
|
|
120467
|
-
* @param version The document's initial version number.
|
|
120468
|
-
* @param content The document's content.
|
|
120469
|
-
*/
|
|
120470
|
-
function create(uri, languageId, version, content) {
|
|
120471
|
-
return new FullTextDocument(uri, languageId, version, content);
|
|
120472
|
-
}
|
|
120473
|
-
TextDocument.create = create;
|
|
120474
|
-
/**
|
|
120475
|
-
* Updates a TextDocument by modifing its content.
|
|
120476
|
-
*
|
|
120477
|
-
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
|
|
120478
|
-
* @param changes the changes to apply to the document.
|
|
120479
|
-
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
|
|
120480
|
-
*
|
|
120481
|
-
*/
|
|
120482
|
-
function update(document, changes, version) {
|
|
120483
|
-
if (document instanceof FullTextDocument) {
|
|
120484
|
-
document.update(changes, version);
|
|
120485
|
-
return document;
|
|
120486
|
-
}
|
|
120487
|
-
else {
|
|
120488
|
-
throw new Error('TextDocument.update: document must be created by TextDocument.create');
|
|
120489
|
-
}
|
|
120490
|
-
}
|
|
120491
|
-
TextDocument.update = update;
|
|
120492
|
-
function applyEdits(document, edits) {
|
|
120493
|
-
var text = document.getText();
|
|
120494
|
-
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
|
|
120495
|
-
var diff = a.range.start.line - b.range.start.line;
|
|
120496
|
-
if (diff === 0) {
|
|
120497
|
-
return a.range.start.character - b.range.start.character;
|
|
120498
|
-
}
|
|
120499
|
-
return diff;
|
|
120500
|
-
});
|
|
120501
|
-
var lastModifiedOffset = 0;
|
|
120502
|
-
var spans = [];
|
|
120503
|
-
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
|
|
120504
|
-
var e = sortedEdits_1[_i];
|
|
120505
|
-
var startOffset = document.offsetAt(e.range.start);
|
|
120506
|
-
if (startOffset < lastModifiedOffset) {
|
|
120507
|
-
throw new Error('Overlapping edit');
|
|
120508
|
-
}
|
|
120509
|
-
else if (startOffset > lastModifiedOffset) {
|
|
120510
|
-
spans.push(text.substring(lastModifiedOffset, startOffset));
|
|
120511
|
-
}
|
|
120512
|
-
if (e.newText.length) {
|
|
120513
|
-
spans.push(e.newText);
|
|
120514
|
-
}
|
|
120515
|
-
lastModifiedOffset = document.offsetAt(e.range.end);
|
|
120516
|
-
}
|
|
120517
|
-
spans.push(text.substr(lastModifiedOffset));
|
|
120518
|
-
return spans.join('');
|
|
120519
|
-
}
|
|
120520
|
-
TextDocument.applyEdits = applyEdits;
|
|
120521
|
-
})(TextDocument || (TextDocument = {}));
|
|
120522
|
-
function mergeSort(data, compare) {
|
|
120523
|
-
if (data.length <= 1) {
|
|
120524
|
-
// sorted
|
|
120525
|
-
return data;
|
|
120526
|
-
}
|
|
120527
|
-
var p = (data.length / 2) | 0;
|
|
120528
|
-
var left = data.slice(0, p);
|
|
120529
|
-
var right = data.slice(p);
|
|
120530
|
-
mergeSort(left, compare);
|
|
120531
|
-
mergeSort(right, compare);
|
|
120532
|
-
var leftIdx = 0;
|
|
120533
|
-
var rightIdx = 0;
|
|
120534
|
-
var i = 0;
|
|
120535
|
-
while (leftIdx < left.length && rightIdx < right.length) {
|
|
120536
|
-
var ret = compare(left[leftIdx], right[rightIdx]);
|
|
120537
|
-
if (ret <= 0) {
|
|
120538
|
-
// smaller_equal -> take left to preserve order
|
|
120539
|
-
data[i++] = left[leftIdx++];
|
|
120540
|
-
}
|
|
120541
|
-
else {
|
|
120542
|
-
// greater -> take right
|
|
120543
|
-
data[i++] = right[rightIdx++];
|
|
120544
|
-
}
|
|
120545
|
-
}
|
|
120546
|
-
while (leftIdx < left.length) {
|
|
120547
|
-
data[i++] = left[leftIdx++];
|
|
120548
|
-
}
|
|
120549
|
-
while (rightIdx < right.length) {
|
|
120550
|
-
data[i++] = right[rightIdx++];
|
|
120551
|
-
}
|
|
120552
|
-
return data;
|
|
120553
|
-
}
|
|
120554
|
-
function computeLineOffsets(text, isAtLineStart, textOffset) {
|
|
120555
|
-
if (textOffset === void 0) { textOffset = 0; }
|
|
120556
|
-
var result = isAtLineStart ? [textOffset] : [];
|
|
120557
|
-
for (var i = 0; i < text.length; i++) {
|
|
120558
|
-
var ch = text.charCodeAt(i);
|
|
120559
|
-
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
|
|
120560
|
-
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
|
|
120561
|
-
i++;
|
|
120562
|
-
}
|
|
120563
|
-
result.push(textOffset + i + 1);
|
|
120564
|
-
}
|
|
120565
|
-
}
|
|
120566
|
-
return result;
|
|
120567
|
-
}
|
|
120568
|
-
function getWellformedRange(range) {
|
|
120569
|
-
var start = range.start;
|
|
120570
|
-
var end = range.end;
|
|
120571
|
-
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
|
|
120572
|
-
return { start: end, end: start };
|
|
120573
|
-
}
|
|
120574
|
-
return range;
|
|
120575
|
-
}
|
|
120576
|
-
function getWellformedEdit(textEdit) {
|
|
120577
|
-
var range = getWellformedRange(textEdit.range);
|
|
120578
|
-
if (range !== textEdit.range) {
|
|
120579
|
-
return { newText: textEdit.newText, range: range };
|
|
120580
|
-
}
|
|
120581
|
-
return textEdit;
|
|
120582
|
-
}
|
|
120583
|
-
|
|
120584
|
-
|
|
120585
118786
|
/***/ }),
|
|
120586
118787
|
|
|
120587
118788
|
/***/ 26070:
|
|
@@ -132411,964 +130612,6 @@ exports.enableFeature = featureToggle_1.enableFeature;
|
|
|
132411
130612
|
exports.ExperimentalFeatures = featureToggle_1.ExperimentalFeatures;
|
|
132412
130613
|
|
|
132413
130614
|
|
|
132414
|
-
/***/ }),
|
|
132415
|
-
|
|
132416
|
-
/***/ 76241:
|
|
132417
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
132418
|
-
|
|
132419
|
-
"use strict";
|
|
132420
|
-
|
|
132421
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
132422
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
132423
|
-
};
|
|
132424
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132425
|
-
const i18next_1 = __importDefault(__webpack_require__(83896));
|
|
132426
|
-
const i18n_json_1 = __importDefault(__webpack_require__(97992));
|
|
132427
|
-
exports.i18n = i18next_1.default.createInstance();
|
|
132428
|
-
/**
|
|
132429
|
-
* Initialize i18next of "@sap/ux-i18n-properties"
|
|
132430
|
-
*/
|
|
132431
|
-
async function initI18n() {
|
|
132432
|
-
await exports.i18n.init({
|
|
132433
|
-
resources: {
|
|
132434
|
-
en: {
|
|
132435
|
-
translation: i18n_json_1.default
|
|
132436
|
-
}
|
|
132437
|
-
},
|
|
132438
|
-
lng: 'en',
|
|
132439
|
-
fallbackLng: 'en',
|
|
132440
|
-
joinArrays: '\n\n'
|
|
132441
|
-
});
|
|
132442
|
-
}
|
|
132443
|
-
exports.initI18n = initI18n;
|
|
132444
|
-
|
|
132445
|
-
|
|
132446
|
-
/***/ }),
|
|
132447
|
-
|
|
132448
|
-
/***/ 55203:
|
|
132449
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
132450
|
-
|
|
132451
|
-
"use strict";
|
|
132452
|
-
|
|
132453
|
-
function __export(m) {
|
|
132454
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
132455
|
-
}
|
|
132456
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132457
|
-
var properties_1 = __webpack_require__(47753);
|
|
132458
|
-
exports.geI18ntDocumentation = properties_1.geI18ntDocumentation;
|
|
132459
|
-
exports.loadPropertiesTexts = properties_1.loadPropertiesTexts;
|
|
132460
|
-
exports.printPropertiesFileI18nEntry = properties_1.printPropertiesFileI18nEntry;
|
|
132461
|
-
exports.printPropertiesFileI18nAnnotation = properties_1.printPropertiesFileI18nAnnotation;
|
|
132462
|
-
var lineOffsets_1 = __webpack_require__(4787);
|
|
132463
|
-
exports.getLineOffsets = lineOffsets_1.getLineOffsets;
|
|
132464
|
-
var text_1 = __webpack_require__(79910);
|
|
132465
|
-
exports.getI18nMaxLength = text_1.getI18nMaxLength;
|
|
132466
|
-
exports.getI18nTextType = text_1.getI18nTextType;
|
|
132467
|
-
var key_1 = __webpack_require__(75502);
|
|
132468
|
-
exports.extractI18nKey = key_1.extractI18nKey;
|
|
132469
|
-
exports.getI18nUniqueKey = key_1.getI18nUniqueKey;
|
|
132470
|
-
var textConverters_1 = __webpack_require__(83525);
|
|
132471
|
-
exports.convertToCamelCase = textConverters_1.convertToCamelCase;
|
|
132472
|
-
exports.convertToPascalCase = textConverters_1.convertToPascalCase;
|
|
132473
|
-
var position_1 = __webpack_require__(63787);
|
|
132474
|
-
exports.Position = position_1.Position;
|
|
132475
|
-
exports.Range = position_1.Range;
|
|
132476
|
-
var positionAt_1 = __webpack_require__(72372);
|
|
132477
|
-
exports.positionAt = positionAt_1.positionAt;
|
|
132478
|
-
exports.rangeAt = positionAt_1.rangeAt;
|
|
132479
|
-
__export(__webpack_require__(69338));
|
|
132480
|
-
var i18n_1 = __webpack_require__(76241);
|
|
132481
|
-
exports.initI18n = i18n_1.initI18n;
|
|
132482
|
-
exports.i18n = i18n_1.i18n;
|
|
132483
|
-
const i18n_2 = __webpack_require__(76241);
|
|
132484
|
-
// init i18n
|
|
132485
|
-
(async () => {
|
|
132486
|
-
await i18n_2.initI18n();
|
|
132487
|
-
})();
|
|
132488
|
-
|
|
132489
|
-
|
|
132490
|
-
/***/ }),
|
|
132491
|
-
|
|
132492
|
-
/***/ 75502:
|
|
132493
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
132494
|
-
|
|
132495
|
-
"use strict";
|
|
132496
|
-
|
|
132497
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132498
|
-
/**
|
|
132499
|
-
* Extract i18n key
|
|
132500
|
-
*/
|
|
132501
|
-
exports.extractI18nKey = (input, withoutAt) => {
|
|
132502
|
-
if (withoutAt) {
|
|
132503
|
-
const result = input
|
|
132504
|
-
.replace(/{i18n>|{i18n>/, '')
|
|
132505
|
-
.replace('}', '')
|
|
132506
|
-
.trim();
|
|
132507
|
-
return result;
|
|
132508
|
-
}
|
|
132509
|
-
const result = input
|
|
132510
|
-
.replace(/{@i18n>|{@i18n>/, '')
|
|
132511
|
-
.replace('}', '')
|
|
132512
|
-
.trim();
|
|
132513
|
-
return result;
|
|
132514
|
-
};
|
|
132515
|
-
/**
|
|
132516
|
-
* Get unique key
|
|
132517
|
-
*
|
|
132518
|
-
* If the key is not unique, it increment key by one and recheck
|
|
132519
|
-
*
|
|
132520
|
-
* @param key new key and it is incremented
|
|
132521
|
-
* @param i18nData I18n entries
|
|
132522
|
-
* @param originalKey original key without any index increment
|
|
132523
|
-
* @param counter counter for increment
|
|
132524
|
-
*/
|
|
132525
|
-
exports.getI18nUniqueKey = (key, i18nData, originalKey = key, counter = 1) => {
|
|
132526
|
-
const uniqueKey = key;
|
|
132527
|
-
let keyExists = false;
|
|
132528
|
-
if (Array.isArray(i18nData)) {
|
|
132529
|
-
keyExists = i18nData.findIndex((item) => item.key.value === key) !== -1;
|
|
132530
|
-
}
|
|
132531
|
-
else {
|
|
132532
|
-
keyExists = i18nData[key] !== undefined;
|
|
132533
|
-
}
|
|
132534
|
-
if (keyExists) {
|
|
132535
|
-
key = `${originalKey}${counter}`;
|
|
132536
|
-
counter++;
|
|
132537
|
-
return exports.getI18nUniqueKey(key, i18nData, originalKey, counter);
|
|
132538
|
-
}
|
|
132539
|
-
return uniqueKey;
|
|
132540
|
-
};
|
|
132541
|
-
|
|
132542
|
-
|
|
132543
|
-
/***/ }),
|
|
132544
|
-
|
|
132545
|
-
/***/ 4787:
|
|
132546
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
132547
|
-
|
|
132548
|
-
"use strict";
|
|
132549
|
-
|
|
132550
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132551
|
-
/**
|
|
132552
|
-
* Computes line offsets for the given string
|
|
132553
|
-
* @param text
|
|
132554
|
-
*/
|
|
132555
|
-
function getLineOffsets(text) {
|
|
132556
|
-
const lineOffsets = [0];
|
|
132557
|
-
for (let index = 0; index < text.length; index++) {
|
|
132558
|
-
const character = text[index];
|
|
132559
|
-
if (character === '\n') {
|
|
132560
|
-
lineOffsets.push(index + 1);
|
|
132561
|
-
}
|
|
132562
|
-
else if (character === '\r') {
|
|
132563
|
-
if (index + 1 < text.length && text[index + 1] === '\n') {
|
|
132564
|
-
index++;
|
|
132565
|
-
}
|
|
132566
|
-
lineOffsets.push(index + 1);
|
|
132567
|
-
}
|
|
132568
|
-
}
|
|
132569
|
-
return lineOffsets;
|
|
132570
|
-
}
|
|
132571
|
-
exports.getLineOffsets = getLineOffsets;
|
|
132572
|
-
|
|
132573
|
-
|
|
132574
|
-
/***/ }),
|
|
132575
|
-
|
|
132576
|
-
/***/ 63787:
|
|
132577
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
132578
|
-
|
|
132579
|
-
"use strict";
|
|
132580
|
-
|
|
132581
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132582
|
-
exports.Position = {
|
|
132583
|
-
create(line, character) {
|
|
132584
|
-
return {
|
|
132585
|
-
line,
|
|
132586
|
-
character
|
|
132587
|
-
};
|
|
132588
|
-
}
|
|
132589
|
-
};
|
|
132590
|
-
function createRange(one, two, three, four) {
|
|
132591
|
-
if (typeof one === 'number' &&
|
|
132592
|
-
!isNaN(one) &&
|
|
132593
|
-
typeof two === 'number' &&
|
|
132594
|
-
!isNaN(two) &&
|
|
132595
|
-
typeof three === 'number' &&
|
|
132596
|
-
!isNaN(three) &&
|
|
132597
|
-
typeof four === 'number' &&
|
|
132598
|
-
!isNaN(four)) {
|
|
132599
|
-
return {
|
|
132600
|
-
start: exports.Position.create(one, two),
|
|
132601
|
-
end: exports.Position.create(three, four)
|
|
132602
|
-
};
|
|
132603
|
-
}
|
|
132604
|
-
else if (typeof one === 'object' && typeof two === 'object') {
|
|
132605
|
-
return {
|
|
132606
|
-
start: one,
|
|
132607
|
-
end: two
|
|
132608
|
-
};
|
|
132609
|
-
}
|
|
132610
|
-
throw new Error(`Range#create called with invalid arguments ${one}, ${two}, ${three}, ${four}`);
|
|
132611
|
-
}
|
|
132612
|
-
exports.Range = {
|
|
132613
|
-
create: createRange
|
|
132614
|
-
};
|
|
132615
|
-
|
|
132616
|
-
|
|
132617
|
-
/***/ }),
|
|
132618
|
-
|
|
132619
|
-
/***/ 72372:
|
|
132620
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
132621
|
-
|
|
132622
|
-
"use strict";
|
|
132623
|
-
|
|
132624
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132625
|
-
const position_1 = __webpack_require__(63787);
|
|
132626
|
-
/**
|
|
132627
|
-
*
|
|
132628
|
-
* @param lineOffsets Array of indices with line start offsets.
|
|
132629
|
-
* e.g [0] represents a document with one line that starts at offset 0.
|
|
132630
|
-
* @param offset
|
|
132631
|
-
* @param textLength
|
|
132632
|
-
*/
|
|
132633
|
-
function positionAt(lineOffsets, offset, textLength) {
|
|
132634
|
-
const target = Math.max(Math.min(offset, textLength), 0);
|
|
132635
|
-
let low = 0;
|
|
132636
|
-
let high = lineOffsets.length;
|
|
132637
|
-
if (high === 0) {
|
|
132638
|
-
return position_1.Position.create(0, target);
|
|
132639
|
-
}
|
|
132640
|
-
while (low < high) {
|
|
132641
|
-
const mid = Math.floor((low + high) / 2);
|
|
132642
|
-
if (lineOffsets[mid] > target) {
|
|
132643
|
-
high = mid;
|
|
132644
|
-
}
|
|
132645
|
-
else {
|
|
132646
|
-
low = mid + 1;
|
|
132647
|
-
}
|
|
132648
|
-
}
|
|
132649
|
-
const line = low - 1;
|
|
132650
|
-
return position_1.Position.create(line, target - lineOffsets[line]);
|
|
132651
|
-
}
|
|
132652
|
-
exports.positionAt = positionAt;
|
|
132653
|
-
function rangeAt(lineOffsets, start, end, textLength) {
|
|
132654
|
-
return position_1.Range.create(positionAt(lineOffsets, start, textLength), positionAt(lineOffsets, end, textLength));
|
|
132655
|
-
}
|
|
132656
|
-
exports.rangeAt = rangeAt;
|
|
132657
|
-
|
|
132658
|
-
|
|
132659
|
-
/***/ }),
|
|
132660
|
-
|
|
132661
|
-
/***/ 47753:
|
|
132662
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
132663
|
-
|
|
132664
|
-
"use strict";
|
|
132665
|
-
|
|
132666
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132667
|
-
const i18n_1 = __webpack_require__(76241);
|
|
132668
|
-
const position_1 = __webpack_require__(63787);
|
|
132669
|
-
const propertiesParser_1 = __webpack_require__(86334);
|
|
132670
|
-
const text_1 = __webpack_require__(79910);
|
|
132671
|
-
const COMMENT_REGEX = /\s*(:?#|!)|[^\n\r]*/;
|
|
132672
|
-
/**
|
|
132673
|
-
* Get abstract syntax tree for i18n.properties file
|
|
132674
|
-
* @param content
|
|
132675
|
-
* @param filePath
|
|
132676
|
-
*/
|
|
132677
|
-
exports.loadPropertiesTexts = (content, filePath = '') => {
|
|
132678
|
-
const i18nEntries = [];
|
|
132679
|
-
const lines = propertiesParser_1.parseProperties(content);
|
|
132680
|
-
for (let i = 0; lines.length > i; i++) {
|
|
132681
|
-
const line = lines[i];
|
|
132682
|
-
if (line.type === 'key-element-line') {
|
|
132683
|
-
const commentLine = lines[i - 1];
|
|
132684
|
-
const entry = {
|
|
132685
|
-
filePath,
|
|
132686
|
-
key: {
|
|
132687
|
-
value: line.key.value,
|
|
132688
|
-
range: line.key.range
|
|
132689
|
-
},
|
|
132690
|
-
value: {
|
|
132691
|
-
value: line.element.value,
|
|
132692
|
-
range: line.element.range
|
|
132693
|
-
}
|
|
132694
|
-
};
|
|
132695
|
-
if ((commentLine === null || commentLine === void 0 ? void 0 : commentLine.type) === 'comment-line' && COMMENT_REGEX.test(commentLine.value)) {
|
|
132696
|
-
const { start } = commentLine.range;
|
|
132697
|
-
const commaIndex = commentLine.value.indexOf(',');
|
|
132698
|
-
const colonIndex = commentLine.value.indexOf(':');
|
|
132699
|
-
entry.annotation = {
|
|
132700
|
-
textType: toTextTypeNode(commentLine, commaIndex, colonIndex)
|
|
132701
|
-
};
|
|
132702
|
-
if (commaIndex !== -1) {
|
|
132703
|
-
entry.annotation.maxLength = {
|
|
132704
|
-
value: parseInt(commentLine.value.slice(commaIndex + 1, colonIndex === -1 ? undefined : colonIndex)),
|
|
132705
|
-
range: position_1.Range.create(start.line, start.character + commaIndex + 1, start.line, start.character + (colonIndex === -1 ? commentLine.value.length : colonIndex))
|
|
132706
|
-
};
|
|
132707
|
-
}
|
|
132708
|
-
if (colonIndex !== -1) {
|
|
132709
|
-
entry.annotation.note = {
|
|
132710
|
-
value: commentLine.value.slice(colonIndex + 1),
|
|
132711
|
-
range: position_1.Range.create(start.line, start.character + colonIndex + 1, start.line, start.character + commentLine.value.length)
|
|
132712
|
-
};
|
|
132713
|
-
}
|
|
132714
|
-
}
|
|
132715
|
-
i18nEntries.push(entry);
|
|
132716
|
-
}
|
|
132717
|
-
}
|
|
132718
|
-
return i18nEntries;
|
|
132719
|
-
};
|
|
132720
|
-
function toTextTypeNode(comment, commaIndex, colonIndex) {
|
|
132721
|
-
const { start } = comment.range;
|
|
132722
|
-
// Comments can only be single line, so start and end lines will be equal
|
|
132723
|
-
if (commaIndex !== -1) {
|
|
132724
|
-
return {
|
|
132725
|
-
value: comment.value.slice(1, commaIndex),
|
|
132726
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + commaIndex)
|
|
132727
|
-
};
|
|
132728
|
-
}
|
|
132729
|
-
else if (colonIndex !== -1) {
|
|
132730
|
-
return {
|
|
132731
|
-
value: comment.value.slice(1, colonIndex),
|
|
132732
|
-
range: position_1.Range.create(start.line, start.character + 1, start.line, start.character + colonIndex)
|
|
132733
|
-
};
|
|
132734
|
-
}
|
|
132735
|
-
return {
|
|
132736
|
-
value: comment.value.slice(1),
|
|
132737
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + comment.value.length)
|
|
132738
|
-
};
|
|
132739
|
-
}
|
|
132740
|
-
/**
|
|
132741
|
-
* Creates annotation text in .properties file format.
|
|
132742
|
-
* If no annotation is not provided, default one is generated based on text.
|
|
132743
|
-
* @param text
|
|
132744
|
-
* @param annotation Context information for the text
|
|
132745
|
-
*/
|
|
132746
|
-
function printPropertiesFileI18nAnnotation(text, annotation) {
|
|
132747
|
-
if (!annotation) {
|
|
132748
|
-
const maxLen = text_1.getI18nMaxLength(text);
|
|
132749
|
-
const textType = text_1.getI18nTextType(maxLen);
|
|
132750
|
-
return `${textType},${maxLen}`;
|
|
132751
|
-
}
|
|
132752
|
-
if (typeof annotation === 'string') {
|
|
132753
|
-
const prefix = text.length <= 120 ? 'X' : 'Y';
|
|
132754
|
-
return `${prefix}${annotation}`;
|
|
132755
|
-
}
|
|
132756
|
-
if (typeof annotation === 'object') {
|
|
132757
|
-
const { textType, note, maxLength } = annotation;
|
|
132758
|
-
const fragments = [textType];
|
|
132759
|
-
if (maxLength !== undefined) {
|
|
132760
|
-
fragments.push(',', maxLength.toString());
|
|
132761
|
-
}
|
|
132762
|
-
if (note) {
|
|
132763
|
-
fragments.push(':', ' ', note.trim());
|
|
132764
|
-
}
|
|
132765
|
-
return fragments.join('');
|
|
132766
|
-
}
|
|
132767
|
-
return '';
|
|
132768
|
-
}
|
|
132769
|
-
exports.printPropertiesFileI18nAnnotation = printPropertiesFileI18nAnnotation;
|
|
132770
|
-
/**
|
|
132771
|
-
* Creates text for i18n entry in .properties file format.
|
|
132772
|
-
* If no annotation is not present, generic default one will be generated based on the text.
|
|
132773
|
-
* @param key
|
|
132774
|
-
* @param text
|
|
132775
|
-
* @param annotation Context information for the text
|
|
132776
|
-
*/
|
|
132777
|
-
function printPropertiesFileI18nEntry(key, text, annotation) {
|
|
132778
|
-
const annotationText = printPropertiesFileI18nAnnotation(text, annotation);
|
|
132779
|
-
const comment = `#${annotationText}`;
|
|
132780
|
-
const keyValue = `${key}=${text}`;
|
|
132781
|
-
const i18nEntry = `\n${comment}\n${keyValue}\n`;
|
|
132782
|
-
return i18nEntry;
|
|
132783
|
-
}
|
|
132784
|
-
exports.printPropertiesFileI18nEntry = printPropertiesFileI18nEntry;
|
|
132785
|
-
/**
|
|
132786
|
-
* Get documentation for i18n entry
|
|
132787
|
-
*/
|
|
132788
|
-
exports.geI18ntDocumentation = (entry) => {
|
|
132789
|
-
var _a, _b;
|
|
132790
|
-
const documentation = [];
|
|
132791
|
-
const key = `**${i18n_1.i18n.t('Text_Key')}:** ${entry.key.value}`;
|
|
132792
|
-
const value = `**${i18n_1.i18n.t('Text_Value')}:** ${entry.value.value}`;
|
|
132793
|
-
documentation.push(key, value);
|
|
132794
|
-
if (entry.annotation) {
|
|
132795
|
-
const annotationText = printPropertiesFileI18nAnnotation(entry.value.value, {
|
|
132796
|
-
maxLength: (_a = entry.annotation.maxLength) === null || _a === void 0 ? void 0 : _a.value,
|
|
132797
|
-
textType: entry.annotation.textType.value,
|
|
132798
|
-
note: (_b = entry.annotation.note) === null || _b === void 0 ? void 0 : _b.value
|
|
132799
|
-
});
|
|
132800
|
-
documentation.push(`**${i18n_1.i18n.t('Additional_Information')}:** ${annotationText}`);
|
|
132801
|
-
}
|
|
132802
|
-
return documentation.join('\n\n');
|
|
132803
|
-
};
|
|
132804
|
-
|
|
132805
|
-
|
|
132806
|
-
/***/ }),
|
|
132807
|
-
|
|
132808
|
-
/***/ 86334:
|
|
132809
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
132810
|
-
|
|
132811
|
-
"use strict";
|
|
132812
|
-
|
|
132813
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132814
|
-
const lineOffsets_1 = __webpack_require__(4787);
|
|
132815
|
-
const position_1 = __webpack_require__(63787);
|
|
132816
|
-
const positionAt_1 = __webpack_require__(72372);
|
|
132817
|
-
/**
|
|
132818
|
-
* Implements reading files Java properties files as described in https://docs.oracle.com/javase/10/docs/api/java/util/Properties.html
|
|
132819
|
-
*/
|
|
132820
|
-
function parseProperties(text) {
|
|
132821
|
-
const tokens = tokenize(text);
|
|
132822
|
-
const lineOffsets = lineOffsets_1.getLineOffsets(text);
|
|
132823
|
-
const contentLength = text.length;
|
|
132824
|
-
let i = 0;
|
|
132825
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
132826
|
-
const consume = () => tokens[i++];
|
|
132827
|
-
const eof = () => i >= tokens.length;
|
|
132828
|
-
function parseComment() {
|
|
132829
|
-
const comment = consume();
|
|
132830
|
-
return {
|
|
132831
|
-
type: 'comment-line',
|
|
132832
|
-
value: comment.image,
|
|
132833
|
-
range: positionAt_1.rangeAt(lineOffsets, comment.start, comment.end, contentLength)
|
|
132834
|
-
};
|
|
132835
|
-
}
|
|
132836
|
-
function parseKeyElement() {
|
|
132837
|
-
var _a, _b, _c, _d, _e, _f;
|
|
132838
|
-
const keyToken = consume();
|
|
132839
|
-
const key = {
|
|
132840
|
-
type: 'text',
|
|
132841
|
-
value: keyToken.image,
|
|
132842
|
-
range: positionAt_1.rangeAt(lineOffsets, keyToken.start, keyToken.end, contentLength)
|
|
132843
|
-
};
|
|
132844
|
-
let resetStartOffset = true;
|
|
132845
|
-
let start;
|
|
132846
|
-
let end;
|
|
132847
|
-
if (peek().type === 'whitespace') {
|
|
132848
|
-
consume();
|
|
132849
|
-
}
|
|
132850
|
-
if (peek().type === 'separator') {
|
|
132851
|
-
const separator = consume();
|
|
132852
|
-
start = end = separator.end;
|
|
132853
|
-
if (peek().type === 'whitespace') {
|
|
132854
|
-
consume();
|
|
132855
|
-
}
|
|
132856
|
-
}
|
|
132857
|
-
let concatenatedValue = '';
|
|
132858
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'end-of-line') {
|
|
132859
|
-
while (!eof() && ((_b = peek()) === null || _b === void 0 ? void 0 : _b.type) !== 'end-of-line' && ((_c = peek()) === null || _c === void 0 ? void 0 : _c.type) !== 'continuation-line-marker') {
|
|
132860
|
-
if (((_d = peek()) === null || _d === void 0 ? void 0 : _d.type) === 'text' || ((_e = peek()) === null || _e === void 0 ? void 0 : _e.type) === 'whitespace') {
|
|
132861
|
-
const valueToken = consume();
|
|
132862
|
-
if (resetStartOffset) {
|
|
132863
|
-
start = valueToken.start;
|
|
132864
|
-
resetStartOffset = false;
|
|
132865
|
-
}
|
|
132866
|
-
end = valueToken.end;
|
|
132867
|
-
concatenatedValue += valueToken.image;
|
|
132868
|
-
}
|
|
132869
|
-
}
|
|
132870
|
-
if (((_f = peek()) === null || _f === void 0 ? void 0 : _f.type) === 'continuation-line-marker') {
|
|
132871
|
-
consume();
|
|
132872
|
-
if (peek().type === 'whitespace') {
|
|
132873
|
-
consume();
|
|
132874
|
-
}
|
|
132875
|
-
}
|
|
132876
|
-
}
|
|
132877
|
-
const element = {
|
|
132878
|
-
type: 'text',
|
|
132879
|
-
value: concatenatedValue,
|
|
132880
|
-
range: positionAt_1.rangeAt(lineOffsets, start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : 0, contentLength)
|
|
132881
|
-
};
|
|
132882
|
-
return {
|
|
132883
|
-
type: 'key-element-line',
|
|
132884
|
-
key,
|
|
132885
|
-
element,
|
|
132886
|
-
range: position_1.Range.create(key.range.start, element.range.end)
|
|
132887
|
-
};
|
|
132888
|
-
}
|
|
132889
|
-
function parseList() {
|
|
132890
|
-
var _a, _b;
|
|
132891
|
-
const list = [];
|
|
132892
|
-
while (!eof()) {
|
|
132893
|
-
const next = peek();
|
|
132894
|
-
if (next.type === 'comment') {
|
|
132895
|
-
list.push(parseComment());
|
|
132896
|
-
}
|
|
132897
|
-
else if (next.type === 'text') {
|
|
132898
|
-
list.push(parseKeyElement());
|
|
132899
|
-
}
|
|
132900
|
-
if (((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) === 'end-of-line' || ((_b = peek()) === null || _b === void 0 ? void 0 : _b.type) === 'whitespace') {
|
|
132901
|
-
consume();
|
|
132902
|
-
}
|
|
132903
|
-
}
|
|
132904
|
-
return list;
|
|
132905
|
-
}
|
|
132906
|
-
return parseList();
|
|
132907
|
-
}
|
|
132908
|
-
exports.parseProperties = parseProperties;
|
|
132909
|
-
const SEPARATOR = /=|:/;
|
|
132910
|
-
const COMMENT_START = /#|!/;
|
|
132911
|
-
const END_OF_LINE = /\r|\n|\r\n/;
|
|
132912
|
-
const WHITESPACE = /[ \t\f]+/;
|
|
132913
|
-
const HEX_DIGIT = /[0-9a-fA-F]/;
|
|
132914
|
-
const ELEMENT_ESCAPE_MAPPING = {
|
|
132915
|
-
'\\\\': '\\',
|
|
132916
|
-
'\\f': '\f',
|
|
132917
|
-
'\\n': '\n',
|
|
132918
|
-
'\\r': '\r',
|
|
132919
|
-
'\\t': '\t'
|
|
132920
|
-
};
|
|
132921
|
-
const KEY_ESCAPE_MAPPING = {
|
|
132922
|
-
...ELEMENT_ESCAPE_MAPPING,
|
|
132923
|
-
'\\=': '=',
|
|
132924
|
-
'\\:': ':'
|
|
132925
|
-
};
|
|
132926
|
-
const UNICODE_CHARACTER_LENGTH = 4;
|
|
132927
|
-
function createToken(type, image, start, end) {
|
|
132928
|
-
return {
|
|
132929
|
-
type,
|
|
132930
|
-
image,
|
|
132931
|
-
start,
|
|
132932
|
-
end
|
|
132933
|
-
};
|
|
132934
|
-
}
|
|
132935
|
-
exports.createToken = createToken;
|
|
132936
|
-
function tokenize(text) {
|
|
132937
|
-
const tokens = [];
|
|
132938
|
-
let i = 0;
|
|
132939
|
-
let image = '';
|
|
132940
|
-
let start = 0;
|
|
132941
|
-
while (i < text.length) {
|
|
132942
|
-
let character = text[i];
|
|
132943
|
-
if (character === '\n') {
|
|
132944
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
132945
|
-
start = i + 1;
|
|
132946
|
-
}
|
|
132947
|
-
else if (character === '\r') {
|
|
132948
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
132949
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
132950
|
-
start = i + 2;
|
|
132951
|
-
i++;
|
|
132952
|
-
}
|
|
132953
|
-
else {
|
|
132954
|
-
tokens.push({
|
|
132955
|
-
type: 'end-of-line',
|
|
132956
|
-
image: character,
|
|
132957
|
-
start: i,
|
|
132958
|
-
end: i + 1
|
|
132959
|
-
});
|
|
132960
|
-
start = i + 1;
|
|
132961
|
-
}
|
|
132962
|
-
}
|
|
132963
|
-
else if (COMMENT_START.test(character)) {
|
|
132964
|
-
image += character;
|
|
132965
|
-
while (i + 1 < text.length) {
|
|
132966
|
-
const next = text[i + 1];
|
|
132967
|
-
if (END_OF_LINE.test(next)) {
|
|
132968
|
-
break;
|
|
132969
|
-
}
|
|
132970
|
-
image += next;
|
|
132971
|
-
i++;
|
|
132972
|
-
}
|
|
132973
|
-
tokens.push(createToken('comment', image, start, i + 1));
|
|
132974
|
-
image = '';
|
|
132975
|
-
start = i + 1;
|
|
132976
|
-
}
|
|
132977
|
-
else if (WHITESPACE.test(character)) {
|
|
132978
|
-
image += character;
|
|
132979
|
-
while (i + 1 < text.length) {
|
|
132980
|
-
const next = text[i + 1];
|
|
132981
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
132982
|
-
break;
|
|
132983
|
-
}
|
|
132984
|
-
image += next;
|
|
132985
|
-
i++;
|
|
132986
|
-
}
|
|
132987
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
132988
|
-
image = '';
|
|
132989
|
-
start = i + 1;
|
|
132990
|
-
}
|
|
132991
|
-
else {
|
|
132992
|
-
// key-element pair
|
|
132993
|
-
while (i < text.length) {
|
|
132994
|
-
character = text[i];
|
|
132995
|
-
if (character === '\\') {
|
|
132996
|
-
const next = text[i + 1];
|
|
132997
|
-
if (next !== undefined) {
|
|
132998
|
-
const mappedValue = KEY_ESCAPE_MAPPING[character + next];
|
|
132999
|
-
if (mappedValue !== undefined) {
|
|
133000
|
-
image += mappedValue;
|
|
133001
|
-
i += 2;
|
|
133002
|
-
}
|
|
133003
|
-
else if (character + next === '\\u') {
|
|
133004
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
133005
|
-
let unicodeCharacterCode = '';
|
|
133006
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
133007
|
-
const c = text[index];
|
|
133008
|
-
if (HEX_DIGIT.test(c)) {
|
|
133009
|
-
unicodeCharacterCode += c;
|
|
133010
|
-
}
|
|
133011
|
-
else {
|
|
133012
|
-
break;
|
|
133013
|
-
}
|
|
133014
|
-
}
|
|
133015
|
-
if (unicodeCharacterCode.length === 4) {
|
|
133016
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
133017
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
133018
|
-
}
|
|
133019
|
-
else {
|
|
133020
|
-
// partial unicode escape sequence
|
|
133021
|
-
image += '\\u' + unicodeCharacterCode;
|
|
133022
|
-
i += 2 + unicodeCharacterCode.length;
|
|
133023
|
-
}
|
|
133024
|
-
}
|
|
133025
|
-
else {
|
|
133026
|
-
i++;
|
|
133027
|
-
}
|
|
133028
|
-
}
|
|
133029
|
-
continue;
|
|
133030
|
-
}
|
|
133031
|
-
if (WHITESPACE.test(character) || SEPARATOR.test(character) || END_OF_LINE.test(character)) {
|
|
133032
|
-
break;
|
|
133033
|
-
}
|
|
133034
|
-
image += character;
|
|
133035
|
-
i++;
|
|
133036
|
-
}
|
|
133037
|
-
tokens.push(createToken('text', image, start, i));
|
|
133038
|
-
image = '';
|
|
133039
|
-
start = i;
|
|
133040
|
-
if (WHITESPACE.test(character)) {
|
|
133041
|
-
image += character;
|
|
133042
|
-
while (i + 1 < text.length) {
|
|
133043
|
-
const next = text[i + 1];
|
|
133044
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
133045
|
-
break;
|
|
133046
|
-
}
|
|
133047
|
-
image += next;
|
|
133048
|
-
i++;
|
|
133049
|
-
}
|
|
133050
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
133051
|
-
image = '';
|
|
133052
|
-
start = i + 1;
|
|
133053
|
-
i++;
|
|
133054
|
-
character = text[i];
|
|
133055
|
-
}
|
|
133056
|
-
if (SEPARATOR.test(character)) {
|
|
133057
|
-
tokens.push(createToken('separator', character, start, i + 1));
|
|
133058
|
-
start = i + 1;
|
|
133059
|
-
i++;
|
|
133060
|
-
character = text[i];
|
|
133061
|
-
}
|
|
133062
|
-
if (WHITESPACE.test(character)) {
|
|
133063
|
-
image = character;
|
|
133064
|
-
while (i + 1 < text.length) {
|
|
133065
|
-
const next = text[i + 1];
|
|
133066
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
133067
|
-
break;
|
|
133068
|
-
}
|
|
133069
|
-
image += next;
|
|
133070
|
-
i++;
|
|
133071
|
-
}
|
|
133072
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
133073
|
-
image = '';
|
|
133074
|
-
start = i + 1;
|
|
133075
|
-
i++;
|
|
133076
|
-
character = text[i];
|
|
133077
|
-
}
|
|
133078
|
-
if (character === '\n') {
|
|
133079
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
133080
|
-
start = i + 1;
|
|
133081
|
-
}
|
|
133082
|
-
else if (character === '\r') {
|
|
133083
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
133084
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
133085
|
-
start = i + 2;
|
|
133086
|
-
i++;
|
|
133087
|
-
}
|
|
133088
|
-
else {
|
|
133089
|
-
tokens.push({
|
|
133090
|
-
type: 'end-of-line',
|
|
133091
|
-
image: character,
|
|
133092
|
-
start: i,
|
|
133093
|
-
end: i + 1
|
|
133094
|
-
});
|
|
133095
|
-
start = i + 1;
|
|
133096
|
-
}
|
|
133097
|
-
}
|
|
133098
|
-
else {
|
|
133099
|
-
while (i < text.length) {
|
|
133100
|
-
character = text[i];
|
|
133101
|
-
if (character === '\\') {
|
|
133102
|
-
const next = text[i + 1];
|
|
133103
|
-
if (next !== undefined) {
|
|
133104
|
-
const mappedValue = ELEMENT_ESCAPE_MAPPING[character + next];
|
|
133105
|
-
if (mappedValue !== undefined) {
|
|
133106
|
-
image += mappedValue;
|
|
133107
|
-
i += 2;
|
|
133108
|
-
}
|
|
133109
|
-
else if (character + next === '\\u') {
|
|
133110
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
133111
|
-
let unicodeCharacterCode = '';
|
|
133112
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
133113
|
-
const c = text[index];
|
|
133114
|
-
if (HEX_DIGIT.test(c)) {
|
|
133115
|
-
unicodeCharacterCode += c;
|
|
133116
|
-
}
|
|
133117
|
-
else {
|
|
133118
|
-
break;
|
|
133119
|
-
}
|
|
133120
|
-
}
|
|
133121
|
-
if (unicodeCharacterCode.length === 4) {
|
|
133122
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
133123
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
133124
|
-
}
|
|
133125
|
-
else {
|
|
133126
|
-
// partial unicode escape sequence
|
|
133127
|
-
image += '\\u' + unicodeCharacterCode;
|
|
133128
|
-
i += 2 + unicodeCharacterCode.length;
|
|
133129
|
-
}
|
|
133130
|
-
}
|
|
133131
|
-
else if (next === '\n') {
|
|
133132
|
-
tokens.push(createToken('text', image, start, i));
|
|
133133
|
-
tokens.push(createToken('continuation-line-marker', '\\\n', i, i + 2));
|
|
133134
|
-
start = i + 2;
|
|
133135
|
-
i += 2;
|
|
133136
|
-
image = '';
|
|
133137
|
-
}
|
|
133138
|
-
else if (next === '\r') {
|
|
133139
|
-
if (i + 1 < text.length && text[i + 2] === '\n') {
|
|
133140
|
-
tokens.push(createToken('text', image, start, i));
|
|
133141
|
-
tokens.push(createToken('continuation-line-marker', '\\\r\n', i, i + 3));
|
|
133142
|
-
start = i + 3;
|
|
133143
|
-
i += 3;
|
|
133144
|
-
image = '';
|
|
133145
|
-
}
|
|
133146
|
-
else {
|
|
133147
|
-
tokens.push(createToken('text', image, start, i));
|
|
133148
|
-
tokens.push(createToken('continuation-line-marker', '\\\r', i, i + 2));
|
|
133149
|
-
start = i + 2;
|
|
133150
|
-
i += 2;
|
|
133151
|
-
image = '';
|
|
133152
|
-
}
|
|
133153
|
-
}
|
|
133154
|
-
else {
|
|
133155
|
-
i++;
|
|
133156
|
-
}
|
|
133157
|
-
}
|
|
133158
|
-
continue;
|
|
133159
|
-
}
|
|
133160
|
-
if (WHITESPACE.test(character)) {
|
|
133161
|
-
if (image) {
|
|
133162
|
-
tokens.push(createToken('text', image, start, i));
|
|
133163
|
-
image = '';
|
|
133164
|
-
start = i;
|
|
133165
|
-
}
|
|
133166
|
-
image = character;
|
|
133167
|
-
while (i + 1 < text.length) {
|
|
133168
|
-
const next = text[i + 1];
|
|
133169
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
133170
|
-
break;
|
|
133171
|
-
}
|
|
133172
|
-
image += next;
|
|
133173
|
-
i++;
|
|
133174
|
-
}
|
|
133175
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
133176
|
-
image = '';
|
|
133177
|
-
start = i + 1;
|
|
133178
|
-
i++;
|
|
133179
|
-
character = text[i];
|
|
133180
|
-
continue;
|
|
133181
|
-
}
|
|
133182
|
-
if (END_OF_LINE.test(character)) {
|
|
133183
|
-
break;
|
|
133184
|
-
}
|
|
133185
|
-
image += character;
|
|
133186
|
-
i++;
|
|
133187
|
-
}
|
|
133188
|
-
tokens.push(createToken('text', image, start, i));
|
|
133189
|
-
image = '';
|
|
133190
|
-
start = i;
|
|
133191
|
-
if (END_OF_LINE.test(character)) {
|
|
133192
|
-
continue;
|
|
133193
|
-
}
|
|
133194
|
-
}
|
|
133195
|
-
}
|
|
133196
|
-
i++;
|
|
133197
|
-
}
|
|
133198
|
-
return tokens;
|
|
133199
|
-
}
|
|
133200
|
-
exports.tokenize = tokenize;
|
|
133201
|
-
|
|
133202
|
-
|
|
133203
|
-
/***/ }),
|
|
133204
|
-
|
|
133205
|
-
/***/ 79910:
|
|
133206
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
133207
|
-
|
|
133208
|
-
"use strict";
|
|
133209
|
-
|
|
133210
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
133211
|
-
const types_1 = __webpack_require__(69338);
|
|
133212
|
-
/**
|
|
133213
|
-
* Get the calculated maximum text length for an i18n property value.
|
|
133214
|
-
*
|
|
133215
|
-
* (The algorithm considers the current UI5 specification)
|
|
133216
|
-
*
|
|
133217
|
-
* @param value - Value of the i18n property
|
|
133218
|
-
*/
|
|
133219
|
-
exports.getI18nMaxLength = (value) => {
|
|
133220
|
-
const iLength = value.length;
|
|
133221
|
-
const iMaxLength = iLength < 8 ? iLength * 5 : iLength <= 30 ? iLength * 3 : iLength * 1.5;
|
|
133222
|
-
return iMaxLength;
|
|
133223
|
-
};
|
|
133224
|
-
/**
|
|
133225
|
-
* Get a suitable textType for an i18n property.
|
|
133226
|
-
*
|
|
133227
|
-
* The textType is derived from the maximum text length maxLength of the property value.
|
|
133228
|
-
*
|
|
133229
|
-
* @param maxLength - Maximum text length of the i18n property value
|
|
133230
|
-
*/
|
|
133231
|
-
exports.getI18nTextType = (maxLength) => {
|
|
133232
|
-
if (maxLength <= 120) {
|
|
133233
|
-
return types_1.SapShortTextType.Label;
|
|
133234
|
-
}
|
|
133235
|
-
return types_1.SapLongTextType.MessageText;
|
|
133236
|
-
};
|
|
133237
|
-
|
|
133238
|
-
|
|
133239
|
-
/***/ }),
|
|
133240
|
-
|
|
133241
|
-
/***/ 83525:
|
|
133242
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
133243
|
-
|
|
133244
|
-
"use strict";
|
|
133245
|
-
|
|
133246
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
133247
|
-
/**
|
|
133248
|
-
* Convert to camel case
|
|
133249
|
-
*
|
|
133250
|
-
* It gets input like 'product details info' and convert it
|
|
133251
|
-
* to 'productDetailsInfo'
|
|
133252
|
-
*
|
|
133253
|
-
*/
|
|
133254
|
-
exports.convertToCamelCase = (input = '', maxWord = 4) => {
|
|
133255
|
-
let output = '';
|
|
133256
|
-
const parts = input
|
|
133257
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
133258
|
-
.trim()
|
|
133259
|
-
.split(' ');
|
|
133260
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
133261
|
-
for (let i = 0; len > i; i++) {
|
|
133262
|
-
const part = parts[i];
|
|
133263
|
-
if (i === 0) {
|
|
133264
|
-
output += part.toLowerCase();
|
|
133265
|
-
}
|
|
133266
|
-
else {
|
|
133267
|
-
const initial = part.charAt(0).toUpperCase();
|
|
133268
|
-
const rest = part.substr(1).toLowerCase();
|
|
133269
|
-
output += `${initial}${rest}`;
|
|
133270
|
-
}
|
|
133271
|
-
}
|
|
133272
|
-
return output;
|
|
133273
|
-
};
|
|
133274
|
-
/**
|
|
133275
|
-
* Convert to pascal case
|
|
133276
|
-
*
|
|
133277
|
-
* It gets input like 'product details info' and convert it
|
|
133278
|
-
* to 'ProductDetailsInfo'
|
|
133279
|
-
*/
|
|
133280
|
-
exports.convertToPascalCase = (input, maxWord = 4) => {
|
|
133281
|
-
let output = '';
|
|
133282
|
-
const parts = input
|
|
133283
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
133284
|
-
.trim()
|
|
133285
|
-
.split(' ');
|
|
133286
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
133287
|
-
for (let i = 0; len > i; i++) {
|
|
133288
|
-
const part = parts[i];
|
|
133289
|
-
const initial = part.charAt(0).toUpperCase();
|
|
133290
|
-
const rest = part.substr(1).toLowerCase();
|
|
133291
|
-
output += `${initial}${rest}`;
|
|
133292
|
-
}
|
|
133293
|
-
return output;
|
|
133294
|
-
};
|
|
133295
|
-
|
|
133296
|
-
|
|
133297
|
-
/***/ }),
|
|
133298
|
-
|
|
133299
|
-
/***/ 69338:
|
|
133300
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
133301
|
-
|
|
133302
|
-
"use strict";
|
|
133303
|
-
|
|
133304
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
133305
|
-
/**
|
|
133306
|
-
* Text types for texts that are less than 120 characters long
|
|
133307
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
133308
|
-
*/
|
|
133309
|
-
var SapShortTextType;
|
|
133310
|
-
(function (SapShortTextType) {
|
|
133311
|
-
SapShortTextType["Accessibility"] = "XACT";
|
|
133312
|
-
SapShortTextType["AlternativeText"] = "XALT";
|
|
133313
|
-
SapShortTextType["BreadcrumbStep"] = "XBCB";
|
|
133314
|
-
SapShortTextType["BulletListItemText"] = "XBLI";
|
|
133315
|
-
SapShortTextType["ButtonText"] = "XBUT";
|
|
133316
|
-
SapShortTextType["Caption"] = "XCAP";
|
|
133317
|
-
SapShortTextType["Cell"] = "XCEL";
|
|
133318
|
-
SapShortTextType["Checkbox"] = "XCKL";
|
|
133319
|
-
SapShortTextType["ColumnHeader"] = "XCOL";
|
|
133320
|
-
SapShortTextType["Tabstrip"] = "XCRD";
|
|
133321
|
-
SapShortTextType["DataNavigationText"] = "XDAT";
|
|
133322
|
-
SapShortTextType["Label"] = "XFLD";
|
|
133323
|
-
SapShortTextType["Frame"] = "XFRM";
|
|
133324
|
-
SapShortTextType["Term"] = "XGLS";
|
|
133325
|
-
SapShortTextType["GroupTitle"] = "XGRP";
|
|
133326
|
-
SapShortTextType["Heading"] = "XHED";
|
|
133327
|
-
SapShortTextType["LegendText"] = "XLGD";
|
|
133328
|
-
SapShortTextType["HyperlinkText"] = "XLNK";
|
|
133329
|
-
SapShortTextType["LogEntry"] = "XLOG";
|
|
133330
|
-
SapShortTextType["ListBoxItem"] = "XLST";
|
|
133331
|
-
SapShortTextType["MenuHeader"] = "XMEN";
|
|
133332
|
-
SapShortTextType["MenuItem"] = "XMIT";
|
|
133333
|
-
SapShortTextType["MessageText"] = "XMSG";
|
|
133334
|
-
SapShortTextType["RadioButton"] = "XRBL";
|
|
133335
|
-
SapShortTextType["RoadmapStep"] = "XRMP";
|
|
133336
|
-
SapShortTextType["TableRowHeading"] = "XROW";
|
|
133337
|
-
SapShortTextType["SelectionText"] = "XSEL";
|
|
133338
|
-
SapShortTextType["TabStripText"] = "XTBS";
|
|
133339
|
-
SapShortTextType["TableTitle"] = "XTIT";
|
|
133340
|
-
SapShortTextType["TreeNodeText"] = "XTND";
|
|
133341
|
-
SapShortTextType["QuickInfoText"] = "XTOL";
|
|
133342
|
-
SapShortTextType["GeneralText"] = "XTXT";
|
|
133343
|
-
})(SapShortTextType = exports.SapShortTextType || (exports.SapShortTextType = {}));
|
|
133344
|
-
/**
|
|
133345
|
-
* Text types for texts that are more than 120 characters long
|
|
133346
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
133347
|
-
*/
|
|
133348
|
-
var SapLongTextType;
|
|
133349
|
-
(function (SapLongTextType) {
|
|
133350
|
-
SapLongTextType["Accessibility"] = "YACT";
|
|
133351
|
-
SapLongTextType["BulletListItemText"] = "YBLI";
|
|
133352
|
-
SapLongTextType["Definition"] = "YDEF";
|
|
133353
|
-
SapLongTextType["Description"] = "YDES";
|
|
133354
|
-
SapLongTextType["Explanation"] = "YEXP";
|
|
133355
|
-
SapLongTextType["FaqAnswer"] = "YFAA";
|
|
133356
|
-
SapLongTextType["Faq"] = "YFAQ";
|
|
133357
|
-
SapLongTextType["GlossaryDefinition"] = "YGLS";
|
|
133358
|
-
SapLongTextType["Information"] = "YINF";
|
|
133359
|
-
SapLongTextType["Instruction"] = "YINS";
|
|
133360
|
-
SapLongTextType["LogEntry"] = "YLOG";
|
|
133361
|
-
SapLongTextType["ErrorMessage"] = "YMSE";
|
|
133362
|
-
SapLongTextType["MessageText"] = "YMSG";
|
|
133363
|
-
SapLongTextType["InformationMessageLong"] = "YMSI";
|
|
133364
|
-
SapLongTextType["WarningMessage"] = "YMSW";
|
|
133365
|
-
SapLongTextType["TechnicalText"] = "YTEC";
|
|
133366
|
-
SapLongTextType["Ticker"] = "YTIC";
|
|
133367
|
-
SapLongTextType["GeneralTextLong"] = "YTXT";
|
|
133368
|
-
})(SapLongTextType = exports.SapLongTextType || (exports.SapLongTextType = {}));
|
|
133369
|
-
exports.NOT_RELEVANT_FOR_TRANSLATION = 'NOTR';
|
|
133370
|
-
|
|
133371
|
-
|
|
133372
130615
|
/***/ }),
|
|
133373
130616
|
|
|
133374
130617
|
/***/ 52136:
|
|
@@ -134598,8 +131841,7 @@ async function getAuthHeaderForInstanceBasedDest(destinationInstance) {
|
|
|
134598
131841
|
const credentials = (await cf_tools_1.apiGetInstanceCredentials(destinationInstance)).credentials;
|
|
134599
131842
|
const clientId = ((_a = credentials.uaa) === null || _a === void 0 ? void 0 : _a.clientid) || credentials.clientid;
|
|
134600
131843
|
const clientSecret = ((_b = credentials.uaa) === null || _b === void 0 ? void 0 : _b.clientsecret) || credentials.clientsecret;
|
|
134601
|
-
|
|
134602
|
-
return base64Header;
|
|
131844
|
+
return Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
|
|
134603
131845
|
}
|
|
134604
131846
|
catch (error) {
|
|
134605
131847
|
throw new Error(`An error occurred while retrieving service key for the destination instance ${destinationInstance}: ${error}`);
|
|
@@ -135036,8 +132278,7 @@ async function runPostConnectionCallback({ log, uaa, accessToken, postConnection
|
|
|
135036
132278
|
async function getUserInfo(uaa, accessToken) {
|
|
135037
132279
|
var _a, _b;
|
|
135038
132280
|
const userInfoResp = await axios_1.default.request(uaa.getUserinfoRequest(accessToken));
|
|
135039
|
-
|
|
135040
|
-
return userDisplayName;
|
|
132281
|
+
return ((_a = userInfoResp === null || userInfoResp === void 0 ? void 0 : userInfoResp.data) === null || _a === void 0 ? void 0 : _a.email) || ((_b = userInfoResp === null || userInfoResp === void 0 ? void 0 : userInfoResp.data) === null || _b === void 0 ? void 0 : _b.name);
|
|
135041
132282
|
}
|
|
135042
132283
|
/** Gets user information from UAA. Will call the callback function passed in. Will swallow errors and only log them
|
|
135043
132284
|
* If we don't succeed, we try again later
|
|
@@ -136229,10 +133470,7 @@ async function getBTPSystem(system, savedSapSystemServiceKey) {
|
|
|
136229
133470
|
}
|
|
136230
133471
|
exports.getBTPSystem = getBTPSystem;
|
|
136231
133472
|
async function isSystemNameValid(newName, savedSystemName) {
|
|
136232
|
-
|
|
136233
|
-
return false;
|
|
136234
|
-
}
|
|
136235
|
-
return true;
|
|
133473
|
+
return newName && newName !== savedSystemName && (await __1.isSystemNameInUse(newName)) ? false : true;
|
|
136236
133474
|
}
|
|
136237
133475
|
exports.isSystemNameValid = isSystemNameValid;
|
|
136238
133476
|
async function isSapSystemConnected(sapSystem) {
|
|
@@ -137610,8 +134848,7 @@ async function getParsedUi5YamlConfig(dirPath, filename) {
|
|
|
137610
134848
|
if (contents) {
|
|
137611
134849
|
try {
|
|
137612
134850
|
// yaml.parse can throw exception if .yaml file has syntax errors
|
|
137613
|
-
|
|
137614
|
-
return parsedConfig;
|
|
134851
|
+
return yaml.parse(contents);
|
|
137615
134852
|
}
|
|
137616
134853
|
catch (e) {
|
|
137617
134854
|
throw new Error(i18n_1.i18n.t('ERROR_UI5_YAML_PARSING', { filePath: path_1.join(dirPath, filename), parsingError: e.message }));
|
|
@@ -137651,7 +134888,7 @@ const i18n_1 = __webpack_require__(23794);
|
|
|
137651
134888
|
const file_1 = __webpack_require__(1595);
|
|
137652
134889
|
const yaml = __importStar(__webpack_require__(86916));
|
|
137653
134890
|
const os_1 = __importDefault(__webpack_require__(22037));
|
|
137654
|
-
const
|
|
134891
|
+
const capProject_1 = __webpack_require__(87616);
|
|
137655
134892
|
const webapp_1 = __webpack_require__(39198);
|
|
137656
134893
|
const request_promise_1 = __importDefault(__webpack_require__(19602));
|
|
137657
134894
|
const ui5Config_1 = __webpack_require__(94116);
|
|
@@ -137949,10 +135186,10 @@ async function getDetailedProjectType(appRoot, projectRoot) {
|
|
|
137949
135186
|
if (appRoot === projectRoot) {
|
|
137950
135187
|
return "EDMX Backend" /* Edxm */;
|
|
137951
135188
|
}
|
|
137952
|
-
if (await
|
|
135189
|
+
if (await capProject_1.isCapJavaProject(projectRoot)) {
|
|
137953
135190
|
return "CAP Java" /* CAPJava */;
|
|
137954
135191
|
}
|
|
137955
|
-
if (await
|
|
135192
|
+
if (await capProject_1.isCapNodeJsProject(projectRoot)) {
|
|
137956
135193
|
return "CAP Node.js" /* CAPNode */;
|
|
137957
135194
|
}
|
|
137958
135195
|
throw new Error(i18n_1.i18n.t('ERROR_DETAIL_PROJECT_TYPE', { appRoot, projectRoot }));
|
|
@@ -138002,7 +135239,7 @@ async function findRootsForPath(path) {
|
|
|
138002
135239
|
// The first package.json we found when searching up contains sapux, but not true -> not supported
|
|
138003
135240
|
return null;
|
|
138004
135241
|
}
|
|
138005
|
-
if (await
|
|
135242
|
+
if (await capProject_1.isCapProject(appRoot, appPckJson)) {
|
|
138006
135243
|
// App is part of a CAP project, but doesn't have own package.json and is not mentioned in sapux array
|
|
138007
135244
|
// in root -> not supported
|
|
138008
135245
|
return null;
|
|
@@ -138019,7 +135256,7 @@ async function findRootsForPath(path) {
|
|
|
138019
135256
|
const { root } = path_1.parse(appRoot);
|
|
138020
135257
|
let projectRoot = path_1.dirname(appRoot);
|
|
138021
135258
|
while (projectRoot !== root) {
|
|
138022
|
-
if (await
|
|
135259
|
+
if (await capProject_1.isCapProject(projectRoot)) {
|
|
138023
135260
|
// We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
|
|
138024
135261
|
// Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
|
|
138025
135262
|
if (path_1.join(projectRoot, 'app') !== appRoot) {
|
|
@@ -138080,7 +135317,7 @@ exports.findRunnableProjects = async (workspaceRoots, logger) => {
|
|
|
138080
135317
|
for (const root of roots) {
|
|
138081
135318
|
try {
|
|
138082
135319
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
138083
|
-
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await
|
|
135320
|
+
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await capProject_1.isCapProject(root, packageJson))) &&
|
|
138084
135321
|
hasScript(packageJson)) {
|
|
138085
135322
|
result.push(root);
|
|
138086
135323
|
}
|
|
@@ -138104,10 +135341,7 @@ async function checkPackageJson(root, dependency, sapux) {
|
|
|
138104
135341
|
(packageJson.devDependencies && packageJson.devDependencies[dependency] !== undefined)) {
|
|
138105
135342
|
return true;
|
|
138106
135343
|
}
|
|
138107
|
-
|
|
138108
|
-
return true;
|
|
138109
|
-
}
|
|
138110
|
-
return false;
|
|
135344
|
+
return sapux === true && packageJson.sapux === true;
|
|
138111
135345
|
}
|
|
138112
135346
|
exports.checkPackageJson = checkPackageJson;
|
|
138113
135347
|
/**
|
|
@@ -138440,7 +135674,7 @@ exports.findI18nProperty = findI18nProperty;
|
|
|
138440
135674
|
* @param packageJson - the parsed content of package.json
|
|
138441
135675
|
*/
|
|
138442
135676
|
async function getProjectTypeFromProjectFiles(projectRoot, packageJson) {
|
|
138443
|
-
return (await
|
|
135677
|
+
return (await capProject_1.isCapProject(projectRoot, packageJson)) ? "Cap" /* Cap */ : "Edmx" /* Edmx */;
|
|
138444
135678
|
}
|
|
138445
135679
|
exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
138446
135680
|
/**
|
|
@@ -138449,8 +135683,7 @@ exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
|
138449
135683
|
*/
|
|
138450
135684
|
async function getProjectType(root) {
|
|
138451
135685
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
138452
|
-
|
|
138453
|
-
return projectType;
|
|
135686
|
+
return getProjectTypeFromProjectFiles(root, packageJson);
|
|
138454
135687
|
}
|
|
138455
135688
|
exports.getProjectType = getProjectType;
|
|
138456
135689
|
/**
|
|
@@ -138500,8 +135733,7 @@ async function getLocalUI5Version(root) {
|
|
|
138500
135733
|
const yamlFile = path_1.join(root, project_spec_1.FileName.Ui5LocalYaml);
|
|
138501
135734
|
if (await file_1.fileExists(yamlFile)) {
|
|
138502
135735
|
const yamlContent = yaml.parse(await file_1.readFile(yamlFile));
|
|
138503
|
-
|
|
138504
|
-
return ui5Version;
|
|
135736
|
+
return yamlContent.framework && yamlContent.framework.version;
|
|
138505
135737
|
}
|
|
138506
135738
|
}
|
|
138507
135739
|
exports.getLocalUI5Version = getLocalUI5Version;
|
|
@@ -142360,16 +139592,13 @@ class PerformanceMeasurementAPI extends types_1.PerformanceMeasurement {
|
|
|
142360
139592
|
return PerformanceMeasurementAPI.entries;
|
|
142361
139593
|
}
|
|
142362
139594
|
static getEntriesByName(name) {
|
|
142363
|
-
|
|
142364
|
-
return filtered;
|
|
139595
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name);
|
|
142365
139596
|
}
|
|
142366
139597
|
static getEntriesByNameType(name, type) {
|
|
142367
|
-
|
|
142368
|
-
return filtered;
|
|
139598
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name && entry.type === type);
|
|
142369
139599
|
}
|
|
142370
139600
|
static getEntriesByType(type) {
|
|
142371
|
-
|
|
142372
|
-
return filtered;
|
|
139601
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.type === type);
|
|
142373
139602
|
}
|
|
142374
139603
|
static getMeasurementDuration(name) {
|
|
142375
139604
|
const entry = PerformanceMeasurementAPI.getEntriesByNameType(name, types_1.EntryType.MEASUREMENT).slice(-1)[0];
|
|
@@ -142725,8 +139954,7 @@ async function processToolsSuiteTelemetry(telemetryHelperProperties) {
|
|
|
142725
139954
|
if (telemetryHelperProperties) {
|
|
142726
139955
|
appProperties = await getAppProperties(telemetryHelperProperties['appPath']);
|
|
142727
139956
|
}
|
|
142728
|
-
|
|
142729
|
-
return finalProperties;
|
|
139957
|
+
return { ...commonProperties, ...appProperties };
|
|
142730
139958
|
}
|
|
142731
139959
|
exports.processToolsSuiteTelemetry = processToolsSuiteTelemetry;
|
|
142732
139960
|
/**
|
|
@@ -143388,12 +140616,14 @@ exports.MIN_UI5_VERSION_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_V4_TEMPLATE;
|
|
|
143388
140616
|
exports.MIN_UI5_VERSION = ui5_info_1.MIN_UI5_VERSION;
|
|
143389
140617
|
exports.MIN_UI5_VERSION_ALP_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_ALP_V4_TEMPLATE;
|
|
143390
140618
|
exports.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE;
|
|
140619
|
+
exports.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE;
|
|
143391
140620
|
exports.retrieveUI5Versions = ui5_info_1.retrieveUI5Versions;
|
|
143392
140621
|
exports.getUi5Themes = ui5_info_1.getUi5Themes;
|
|
143393
140622
|
exports.getManifestVersion = ui5_info_1.getManifestVersion;
|
|
143394
140623
|
exports.uI5VersionsWithCodeAssist = ui5_info_1.uI5VersionsWithCodeAssist;
|
|
143395
140624
|
exports.getUI5Versions = ui5_info_1.getUI5Versions;
|
|
143396
140625
|
exports.getSapSystemUI5Version = ui5_info_1.getSapSystemUI5Version;
|
|
140626
|
+
exports.getUI5VersionsEnhanced = ui5_info_1.getUI5VersionsEnhanced;
|
|
143397
140627
|
var types_1 = __webpack_require__(8450);
|
|
143398
140628
|
exports.FioriElementsVersion = types_1.FioriElementsVersion;
|
|
143399
140629
|
exports.minUI5VersionForLocalDev = types_1.minUI5VersionForLocalDev;
|
|
@@ -143445,6 +140675,7 @@ const https_1 = __importDefault(__webpack_require__(95687));
|
|
|
143445
140675
|
exports.MIN_UI5_VERSION_V4_TEMPLATE = '1.84.0';
|
|
143446
140676
|
exports.MIN_UI5_VERSION = '1.65.0';
|
|
143447
140677
|
exports.MIN_UI5_VERSION_ALP_V4_TEMPLATE = '1.90.0';
|
|
140678
|
+
exports.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE = '1.99.0';
|
|
143448
140679
|
exports.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE = '1.90.0';
|
|
143449
140680
|
const MIN_UI5_VERSION_V2_TEMPLATE = '1.76.0';
|
|
143450
140681
|
const MIN_UI5_DARK_THEME = '1.72.0';
|
|
@@ -143537,6 +140768,15 @@ const consoleLogger = {
|
|
|
143537
140768
|
const PASS_THROUGH_STRINGS = new Set(['snapshot', 'snapshot-untested', "Latest" /* LatestVersionString */]);
|
|
143538
140769
|
// This one holds the actual version, not 'Latest'
|
|
143539
140770
|
let latestUI5Version;
|
|
140771
|
+
var UI5_VERSIONS_TYPE;
|
|
140772
|
+
(function (UI5_VERSIONS_TYPE) {
|
|
140773
|
+
UI5_VERSIONS_TYPE["official"] = "officialVersions";
|
|
140774
|
+
UI5_VERSIONS_TYPE["snapshot"] = "snapshotsVersions";
|
|
140775
|
+
})(UI5_VERSIONS_TYPE = exports.UI5_VERSIONS_TYPE || (exports.UI5_VERSIONS_TYPE = {}));
|
|
140776
|
+
exports.ui5VersionsCache = {
|
|
140777
|
+
officialVersions: [],
|
|
140778
|
+
snapshotsVersions: []
|
|
140779
|
+
};
|
|
143540
140780
|
/**
|
|
143541
140781
|
* Get manifest version from UI5 version
|
|
143542
140782
|
* @param ui5Version - selected UI5 version
|
|
@@ -143621,12 +140861,25 @@ async function getUI5Versions(url) {
|
|
|
143621
140861
|
if (route.path === '/') {
|
|
143622
140862
|
latestUI5Version = route.target.version;
|
|
143623
140863
|
}
|
|
143624
|
-
|
|
143625
|
-
return version;
|
|
140864
|
+
return route.path === '/' ? "Latest" /* DefaultVersion */ : route.target.version;
|
|
143626
140865
|
});
|
|
143627
140866
|
return result;
|
|
143628
140867
|
}
|
|
143629
140868
|
exports.getUI5Versions = getUI5Versions;
|
|
140869
|
+
/**
|
|
140870
|
+
* Returns ui5 versions from cache object
|
|
140871
|
+
* @param type 'officialVersions' or 'snapshotsVersions
|
|
140872
|
+
* @returns Array of UI5 versions
|
|
140873
|
+
*/
|
|
140874
|
+
exports.retrieveUI5VersionsCache = async (type, useCache = false) => {
|
|
140875
|
+
if (!useCache) {
|
|
140876
|
+
return getUI5Versions(type === "officialVersions" /* official */ ? "https://ui5.sap.com" /* OfficialUrl */ : "https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */);
|
|
140877
|
+
}
|
|
140878
|
+
if (exports.ui5VersionsCache[type].length === 0) {
|
|
140879
|
+
exports.ui5VersionsCache[type] = await getUI5Versions(type === "officialVersions" /* official */ ? "https://ui5.sap.com" /* OfficialUrl */ : "https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */);
|
|
140880
|
+
}
|
|
140881
|
+
return exports.ui5VersionsCache[type];
|
|
140882
|
+
};
|
|
143630
140883
|
/**
|
|
143631
140884
|
* Return a list of UI5 versions.
|
|
143632
140885
|
* @param filterOptions - filter the UI5 versions returned
|
|
@@ -143638,7 +140891,7 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
143638
140891
|
let snapshotVersions = [];
|
|
143639
140892
|
try {
|
|
143640
140893
|
officialVersions = (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.onlyNpmVersion) ? await retrieveNpmUI5Versions(filterOptions.fioriElementsVersion || "v2" /* v2 */, filterOptions.ui5SelectedVersion)
|
|
143641
|
-
: await
|
|
140894
|
+
: await exports.retrieveUI5VersionsCache("officialVersions" /* official */, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.useCache);
|
|
143642
140895
|
}
|
|
143643
140896
|
catch (error) {
|
|
143644
140897
|
logger.warning(`Request to '${"https://ui5.sap.com" /* OfficialUrl */}' failed. Error was: '${error.message}'. Fallback to default UI5 versions`);
|
|
@@ -143646,7 +140899,7 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
143646
140899
|
}
|
|
143647
140900
|
if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.includeSnapshots) {
|
|
143648
140901
|
try {
|
|
143649
|
-
snapshotVersions = await
|
|
140902
|
+
snapshotVersions = await exports.retrieveUI5VersionsCache("snapshotsVersions" /* snapshot */, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.useCache);
|
|
143650
140903
|
}
|
|
143651
140904
|
catch (error) {
|
|
143652
140905
|
logger.error(`Request to '${"https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */}' failed. Error was: '${error.message}'`);
|
|
@@ -143656,11 +140909,8 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
143656
140909
|
if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.minSupportedUI5Version) {
|
|
143657
140910
|
versions = filterNewerEqual(versions, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.minSupportedUI5Version);
|
|
143658
140911
|
}
|
|
143659
|
-
else if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.fioriElementsVersion) {
|
|
143660
|
-
versions =
|
|
143661
|
-
filterOptions.fioriElementsVersion === "v4" /* v4 */
|
|
143662
|
-
? filterNewerEqual(versions, exports.MIN_UI5_VERSION_V4_TEMPLATE)
|
|
143663
|
-
: filterNewerEqual(versions, exports.MIN_UI5_VERSION);
|
|
140912
|
+
else if ((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.fioriElementsVersion) && filterOptions.fioriElementsVersion === "v4" /* v4 */) {
|
|
140913
|
+
versions = filterNewerEqual(versions, exports.MIN_UI5_VERSION_V4_TEMPLATE);
|
|
143664
140914
|
}
|
|
143665
140915
|
else {
|
|
143666
140916
|
versions = filterNewerEqual(versions, exports.MIN_UI5_VERSION);
|
|
@@ -143671,9 +140921,31 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
143671
140921
|
if (returnLatestValue && versions[0].includes("Latest" /* LatestVersionString */)) {
|
|
143672
140922
|
versions[0] = latestUI5Version;
|
|
143673
140923
|
}
|
|
143674
|
-
return versions;
|
|
140924
|
+
return (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.removeDuplicateVersions) === true ? [...new Set(versions)] : versions;
|
|
143675
140925
|
}
|
|
143676
140926
|
exports.retrieveUI5Versions = retrieveUI5Versions;
|
|
140927
|
+
/**
|
|
140928
|
+
* Return a list of UI5 versions structured for Project Inquirer prompt.
|
|
140929
|
+
* @param filterOptions - filter the UI5 versions returned
|
|
140930
|
+
* @returns - returns array of UI5 versions.
|
|
140931
|
+
*/
|
|
140932
|
+
async function getUI5VersionsEnhanced(filterOptions) {
|
|
140933
|
+
let filteredUI5Versions = await retrieveUI5Versions(filterOptions, undefined, true);
|
|
140934
|
+
const defaultUI5Version = filteredUI5Versions[0];
|
|
140935
|
+
if (!(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.includeSnapshots)) {
|
|
140936
|
+
filteredUI5Versions = sortUI5Versions(filteredUI5Versions);
|
|
140937
|
+
}
|
|
140938
|
+
return filteredUI5Versions.map((ui5) => ({
|
|
140939
|
+
value: {
|
|
140940
|
+
version: ui5,
|
|
140941
|
+
semantic: ui5,
|
|
140942
|
+
toString: () => ui5,
|
|
140943
|
+
default: defaultUI5Version === ui5
|
|
140944
|
+
},
|
|
140945
|
+
name: ui5
|
|
140946
|
+
}));
|
|
140947
|
+
}
|
|
140948
|
+
exports.getUI5VersionsEnhanced = getUI5VersionsEnhanced;
|
|
143677
140949
|
/**
|
|
143678
140950
|
* Return supported UI5 themes
|
|
143679
140951
|
* @param [ui5Version] - optional, UI5 version to get themes for
|
|
@@ -143834,775 +141106,6 @@ async function getSapSystemUI5Version(sapSystemHost, rejectUnauthorized = false)
|
|
|
143834
141106
|
exports.getSapSystemUI5Version = getSapSystemUI5Version;
|
|
143835
141107
|
|
|
143836
141108
|
|
|
143837
|
-
/***/ }),
|
|
143838
|
-
|
|
143839
|
-
/***/ 42745:
|
|
143840
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
143841
|
-
|
|
143842
|
-
"use strict";
|
|
143843
|
-
|
|
143844
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
143845
|
-
const path_1 = __webpack_require__(71017);
|
|
143846
|
-
const fs_1 = __webpack_require__(57147);
|
|
143847
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
143848
|
-
const resolve_1 = __webpack_require__(96749);
|
|
143849
|
-
const utils_1 = __webpack_require__(8655);
|
|
143850
|
-
const json_1 = __webpack_require__(34692);
|
|
143851
|
-
const csv_1 = __webpack_require__(98944);
|
|
143852
|
-
/**
|
|
143853
|
-
* Adds new i18n entries to an existing file or in a new file if one does not exist
|
|
143854
|
-
* @param env CDS environment configuration
|
|
143855
|
-
* @param root project root, where i18n folder should reside if no i18n file exists
|
|
143856
|
-
* @param path path to cds file for which translation should be maintained
|
|
143857
|
-
* @param newI18nEntries new i18n entries that will be maintained
|
|
143858
|
-
*/
|
|
143859
|
-
async function addI18nEntriesForCdsFile(env, root, path, newI18nEntries) {
|
|
143860
|
-
const { folders, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
143861
|
-
let i18nFolderPath = resolve_1.resolveI18nFolderForFile(env, path_1.join(root, path));
|
|
143862
|
-
if (!i18nFolderPath) {
|
|
143863
|
-
const folder = folders[0];
|
|
143864
|
-
i18nFolderPath = path_1.join(root, folder);
|
|
143865
|
-
await fs_1.promises.mkdir(i18nFolderPath);
|
|
143866
|
-
}
|
|
143867
|
-
const updaters = [tryAddJsonTexts, tryAddPropertiesTexts, tryAddCsvTexts];
|
|
143868
|
-
const filePath = path_1.join(i18nFolderPath, baseFileName);
|
|
143869
|
-
for (const update of updaters) {
|
|
143870
|
-
const completed = await update(env, filePath, newI18nEntries);
|
|
143871
|
-
if (completed) {
|
|
143872
|
-
break;
|
|
143873
|
-
}
|
|
143874
|
-
}
|
|
143875
|
-
}
|
|
143876
|
-
exports.addI18nEntriesForCdsFile = addI18nEntriesForCdsFile;
|
|
143877
|
-
async function tryAddJsonTexts(env, path, newI18nEntries) {
|
|
143878
|
-
const { fallbackLanguage } = utils_1.getI18nConfiguration(env);
|
|
143879
|
-
try {
|
|
143880
|
-
const i18nFilePath = utils_1.jsonPathFormatter(path);
|
|
143881
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
143882
|
-
const newContent = json_1.addJsonTexts(content, fallbackLanguage, newI18nEntries);
|
|
143883
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
143884
|
-
}
|
|
143885
|
-
catch (error) {
|
|
143886
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
143887
|
-
return false;
|
|
143888
|
-
}
|
|
143889
|
-
else {
|
|
143890
|
-
throw error;
|
|
143891
|
-
}
|
|
143892
|
-
}
|
|
143893
|
-
return true;
|
|
143894
|
-
}
|
|
143895
|
-
async function tryAddPropertiesTexts(env, path, newI18nEntries) {
|
|
143896
|
-
const i18nFilePath = utils_1.propertiesPathFormatter(path, env);
|
|
143897
|
-
let newContent = newI18nEntries
|
|
143898
|
-
.map((entry) => ux_i18n_properties_1.printPropertiesFileI18nEntry(entry.key, entry.value, entry.annotation))
|
|
143899
|
-
//No need join with new line, because it is already added in 'printPropertiesFileI18nEntry'
|
|
143900
|
-
.join('');
|
|
143901
|
-
try {
|
|
143902
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
143903
|
-
const lines = content.split(/\r\n|\n/);
|
|
143904
|
-
// check if file does not end with new line
|
|
143905
|
-
if (lines.length > 0 && lines[lines.length - 1].trim()) {
|
|
143906
|
-
// If there no end line - add new gap line before new content
|
|
143907
|
-
newContent = `\n${newContent}`;
|
|
143908
|
-
}
|
|
143909
|
-
await fs_1.promises.writeFile(i18nFilePath, content.concat(newContent), { encoding: 'utf8' });
|
|
143910
|
-
}
|
|
143911
|
-
catch (error) {
|
|
143912
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
143913
|
-
const completed = await tryAddCsvTexts(env, path, newI18nEntries);
|
|
143914
|
-
if (!completed) {
|
|
143915
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
143916
|
-
return true;
|
|
143917
|
-
}
|
|
143918
|
-
return true;
|
|
143919
|
-
}
|
|
143920
|
-
else {
|
|
143921
|
-
throw error;
|
|
143922
|
-
}
|
|
143923
|
-
}
|
|
143924
|
-
return true;
|
|
143925
|
-
}
|
|
143926
|
-
async function tryAddCsvTexts(env, path, newI18nEntries) {
|
|
143927
|
-
const { defaultLanguage } = utils_1.getI18nConfiguration(env);
|
|
143928
|
-
try {
|
|
143929
|
-
const i18nFilePath = utils_1.csvPathFormatter(path);
|
|
143930
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
143931
|
-
const newContent = csv_1.addCsvTexts(content, defaultLanguage, newI18nEntries);
|
|
143932
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
143933
|
-
}
|
|
143934
|
-
catch (error) {
|
|
143935
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
143936
|
-
return false;
|
|
143937
|
-
}
|
|
143938
|
-
else {
|
|
143939
|
-
throw error;
|
|
143940
|
-
}
|
|
143941
|
-
}
|
|
143942
|
-
return true;
|
|
143943
|
-
}
|
|
143944
|
-
|
|
143945
|
-
|
|
143946
|
-
/***/ }),
|
|
143947
|
-
|
|
143948
|
-
/***/ 98944:
|
|
143949
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
143950
|
-
|
|
143951
|
-
"use strict";
|
|
143952
|
-
|
|
143953
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
143954
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
143955
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
143956
|
-
const csvParser_1 = __webpack_require__(34521);
|
|
143957
|
-
const utils_1 = __webpack_require__(8655);
|
|
143958
|
-
function loadCsvTexts(text, filePath = '') {
|
|
143959
|
-
const bundle = {};
|
|
143960
|
-
const document = csvParser_1.parseCsv(text);
|
|
143961
|
-
for (let columnIndex = 1; columnIndex < document.header.fields.length; columnIndex++) {
|
|
143962
|
-
const locale = document.header.fields[columnIndex];
|
|
143963
|
-
const entries = [];
|
|
143964
|
-
bundle[locale.value] = entries;
|
|
143965
|
-
for (let i = 0; i < document.rows.length; i++) {
|
|
143966
|
-
const row = document.rows[i];
|
|
143967
|
-
if (row) {
|
|
143968
|
-
const key = toTextNode(row.fields[0]);
|
|
143969
|
-
const value = toTextNode(row.fields[columnIndex]);
|
|
143970
|
-
if (key && value) {
|
|
143971
|
-
entries.push({
|
|
143972
|
-
filePath,
|
|
143973
|
-
key,
|
|
143974
|
-
value
|
|
143975
|
-
});
|
|
143976
|
-
}
|
|
143977
|
-
}
|
|
143978
|
-
}
|
|
143979
|
-
}
|
|
143980
|
-
return bundle;
|
|
143981
|
-
}
|
|
143982
|
-
exports.loadCsvTexts = loadCsvTexts;
|
|
143983
|
-
function addCsvTexts(text, fallbackLocale, newEntries) {
|
|
143984
|
-
const csvDocument = csvParser_1.parseCsv(text);
|
|
143985
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
143986
|
-
const headerFields = csvDocument.header.fields;
|
|
143987
|
-
const fallbackFieldIndex = headerFields.findIndex((field) => field.value === fallbackLocale);
|
|
143988
|
-
if (fallbackFieldIndex !== -1) {
|
|
143989
|
-
let newText = '';
|
|
143990
|
-
for (const entry of newEntries) {
|
|
143991
|
-
newText += `${entry.key};`;
|
|
143992
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
143993
|
-
const columnHeader = headerFields[column];
|
|
143994
|
-
if (columnHeader.value === fallbackLocale) {
|
|
143995
|
-
newText += `${entry.value}`;
|
|
143996
|
-
}
|
|
143997
|
-
if (column + 1 !== headerFields.length) {
|
|
143998
|
-
newText += ';';
|
|
143999
|
-
}
|
|
144000
|
-
}
|
|
144001
|
-
newText += eol;
|
|
144002
|
-
}
|
|
144003
|
-
if (text.endsWith(eol)) {
|
|
144004
|
-
return text + newText;
|
|
144005
|
-
}
|
|
144006
|
-
else {
|
|
144007
|
-
return text + eol + newText;
|
|
144008
|
-
}
|
|
144009
|
-
}
|
|
144010
|
-
else if (headerFields.length === 0) {
|
|
144011
|
-
let newText = `key;${fallbackLocale}${eol}`;
|
|
144012
|
-
for (const entry of newEntries) {
|
|
144013
|
-
newText += `${entry.key};${entry.value}${eol}`;
|
|
144014
|
-
}
|
|
144015
|
-
return text + newText;
|
|
144016
|
-
}
|
|
144017
|
-
else {
|
|
144018
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
144019
|
-
const edits = [];
|
|
144020
|
-
edits.push({
|
|
144021
|
-
newText: `;${fallbackLocale}`,
|
|
144022
|
-
range: ux_i18n_properties_1.Range.create(0, csvDocument.header.range.end.character, 0, csvDocument.header.range.end.character)
|
|
144023
|
-
});
|
|
144024
|
-
for (const row of csvDocument.rows) {
|
|
144025
|
-
edits.push({
|
|
144026
|
-
newText: `;`,
|
|
144027
|
-
range: ux_i18n_properties_1.Range.create(row.range.end, row.range.end)
|
|
144028
|
-
});
|
|
144029
|
-
}
|
|
144030
|
-
let newText = `${eol}`;
|
|
144031
|
-
for (const entry of newEntries) {
|
|
144032
|
-
newText += `${entry.key};`;
|
|
144033
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
144034
|
-
newText += ';';
|
|
144035
|
-
}
|
|
144036
|
-
newText += `${entry.value}${eol}`;
|
|
144037
|
-
}
|
|
144038
|
-
const lastRow = csvDocument.rows.slice(-1)[0];
|
|
144039
|
-
const position = lastRow ? lastRow.range.end : ux_i18n_properties_1.Position.create(1, 0);
|
|
144040
|
-
edits.push({
|
|
144041
|
-
newText,
|
|
144042
|
-
range: ux_i18n_properties_1.Range.create(position, position)
|
|
144043
|
-
});
|
|
144044
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, edits);
|
|
144045
|
-
}
|
|
144046
|
-
}
|
|
144047
|
-
exports.addCsvTexts = addCsvTexts;
|
|
144048
|
-
function toTextNode(field) {
|
|
144049
|
-
if (field) {
|
|
144050
|
-
return {
|
|
144051
|
-
value: field.value,
|
|
144052
|
-
range: field.range
|
|
144053
|
-
};
|
|
144054
|
-
}
|
|
144055
|
-
}
|
|
144056
|
-
function createTextNode(value, range) {
|
|
144057
|
-
return {
|
|
144058
|
-
value,
|
|
144059
|
-
range
|
|
144060
|
-
};
|
|
144061
|
-
}
|
|
144062
|
-
exports.createTextNode = createTextNode;
|
|
144063
|
-
|
|
144064
|
-
|
|
144065
|
-
/***/ }),
|
|
144066
|
-
|
|
144067
|
-
/***/ 34521:
|
|
144068
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144069
|
-
|
|
144070
|
-
"use strict";
|
|
144071
|
-
|
|
144072
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144073
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
144074
|
-
const SEPARATOR = /[,;\t]/;
|
|
144075
|
-
function parseCsv(text) {
|
|
144076
|
-
const tokens = tokenize(text);
|
|
144077
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
144078
|
-
const contentLength = text.length;
|
|
144079
|
-
let i = 0;
|
|
144080
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
144081
|
-
const consume = () => tokens[i++];
|
|
144082
|
-
const eof = () => i >= tokens.length;
|
|
144083
|
-
function parseField() {
|
|
144084
|
-
const token = consume();
|
|
144085
|
-
return {
|
|
144086
|
-
quoted: token.type === 'escaped-text' ? true : false,
|
|
144087
|
-
value: token.value,
|
|
144088
|
-
range: ux_i18n_properties_1.Range.create(ux_i18n_properties_1.positionAt(lineOffsets, token.start, contentLength), ux_i18n_properties_1.positionAt(lineOffsets, token.end, contentLength))
|
|
144089
|
-
};
|
|
144090
|
-
}
|
|
144091
|
-
function parseRow() {
|
|
144092
|
-
var _a;
|
|
144093
|
-
const row = {
|
|
144094
|
-
fields: [],
|
|
144095
|
-
range: ux_i18n_properties_1.Range.create(0, 0, 0, 0)
|
|
144096
|
-
};
|
|
144097
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'eol') {
|
|
144098
|
-
if (peek().type === 'escaped-text' || peek().type === 'text') {
|
|
144099
|
-
row.fields.push(parseField());
|
|
144100
|
-
}
|
|
144101
|
-
const next = peek();
|
|
144102
|
-
if (next && next.type !== 'eol') {
|
|
144103
|
-
if (next.type === 'separator' && peek(1) === undefined) {
|
|
144104
|
-
// trailing separator at the end of file
|
|
144105
|
-
row.fields.push({
|
|
144106
|
-
quoted: false,
|
|
144107
|
-
value: '',
|
|
144108
|
-
range: ux_i18n_properties_1.Range.create(ux_i18n_properties_1.positionAt(lineOffsets, next.end, contentLength), ux_i18n_properties_1.positionAt(lineOffsets, next.end, contentLength))
|
|
144109
|
-
});
|
|
144110
|
-
}
|
|
144111
|
-
consume();
|
|
144112
|
-
}
|
|
144113
|
-
}
|
|
144114
|
-
if (row.fields.length) {
|
|
144115
|
-
const start = row.fields[0].range.start;
|
|
144116
|
-
const end = row.fields[row.fields.length - 1].range.end;
|
|
144117
|
-
row.range = ux_i18n_properties_1.Range.create(start.line, start.character, end.line, end.character);
|
|
144118
|
-
}
|
|
144119
|
-
return row;
|
|
144120
|
-
}
|
|
144121
|
-
function parseDocument() {
|
|
144122
|
-
var _a, _b;
|
|
144123
|
-
const document = {
|
|
144124
|
-
header: parseRow(),
|
|
144125
|
-
rows: []
|
|
144126
|
-
};
|
|
144127
|
-
while (!eof()) {
|
|
144128
|
-
if (((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) === 'escaped-text' || ((_b = peek()) === null || _b === void 0 ? void 0 : _b.type) === 'text') {
|
|
144129
|
-
document.rows.push(parseRow());
|
|
144130
|
-
}
|
|
144131
|
-
consume();
|
|
144132
|
-
}
|
|
144133
|
-
return document;
|
|
144134
|
-
}
|
|
144135
|
-
return parseDocument();
|
|
144136
|
-
}
|
|
144137
|
-
exports.parseCsv = parseCsv;
|
|
144138
|
-
function tokenize(text) {
|
|
144139
|
-
const tokens = [];
|
|
144140
|
-
let i = 0;
|
|
144141
|
-
let value = '';
|
|
144142
|
-
let mode = 'default';
|
|
144143
|
-
let start = 0;
|
|
144144
|
-
let lastTextTokenType = 'text';
|
|
144145
|
-
while (i < text.length) {
|
|
144146
|
-
const character = text[i];
|
|
144147
|
-
if (mode === 'default') {
|
|
144148
|
-
if (SEPARATOR.test(character) || character === '\n') {
|
|
144149
|
-
tokens.push({
|
|
144150
|
-
type: lastTextTokenType,
|
|
144151
|
-
value,
|
|
144152
|
-
start,
|
|
144153
|
-
end: i
|
|
144154
|
-
});
|
|
144155
|
-
if (character === '\n') {
|
|
144156
|
-
tokens.push({
|
|
144157
|
-
type: 'eol',
|
|
144158
|
-
value: '\n',
|
|
144159
|
-
start: i,
|
|
144160
|
-
end: i + 1
|
|
144161
|
-
});
|
|
144162
|
-
}
|
|
144163
|
-
else if (SEPARATOR.test(character)) {
|
|
144164
|
-
tokens.push({
|
|
144165
|
-
type: 'separator',
|
|
144166
|
-
value: character,
|
|
144167
|
-
start: i,
|
|
144168
|
-
end: i + 1
|
|
144169
|
-
});
|
|
144170
|
-
}
|
|
144171
|
-
value = '';
|
|
144172
|
-
start = i + 1;
|
|
144173
|
-
lastTextTokenType = 'text';
|
|
144174
|
-
}
|
|
144175
|
-
else if (character === '"') {
|
|
144176
|
-
mode = 'quoted';
|
|
144177
|
-
}
|
|
144178
|
-
else {
|
|
144179
|
-
value += character;
|
|
144180
|
-
}
|
|
144181
|
-
}
|
|
144182
|
-
else if (mode === 'quoted') {
|
|
144183
|
-
if (character === '"') {
|
|
144184
|
-
// we need to check if it is escaping next double quote
|
|
144185
|
-
if (i + 1 < text.length && text[i + 1] === '"') {
|
|
144186
|
-
value += '"';
|
|
144187
|
-
i++;
|
|
144188
|
-
}
|
|
144189
|
-
else {
|
|
144190
|
-
lastTextTokenType = 'escaped-text';
|
|
144191
|
-
mode = 'default';
|
|
144192
|
-
}
|
|
144193
|
-
}
|
|
144194
|
-
else {
|
|
144195
|
-
value += character;
|
|
144196
|
-
}
|
|
144197
|
-
}
|
|
144198
|
-
i++;
|
|
144199
|
-
}
|
|
144200
|
-
if (value) {
|
|
144201
|
-
tokens.push({
|
|
144202
|
-
type: 'text',
|
|
144203
|
-
value,
|
|
144204
|
-
start,
|
|
144205
|
-
end: i
|
|
144206
|
-
});
|
|
144207
|
-
}
|
|
144208
|
-
return tokens;
|
|
144209
|
-
}
|
|
144210
|
-
exports.tokenize = tokenize;
|
|
144211
|
-
|
|
144212
|
-
|
|
144213
|
-
/***/ }),
|
|
144214
|
-
|
|
144215
|
-
/***/ 98702:
|
|
144216
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144217
|
-
|
|
144218
|
-
"use strict";
|
|
144219
|
-
|
|
144220
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144221
|
-
var csv_1 = __webpack_require__(98944);
|
|
144222
|
-
exports.addCsvTexts = csv_1.addCsvTexts;
|
|
144223
|
-
exports.loadCsvTexts = csv_1.loadCsvTexts;
|
|
144224
|
-
var json_1 = __webpack_require__(34692);
|
|
144225
|
-
exports.addJsonTexts = json_1.addJsonTexts;
|
|
144226
|
-
exports.loadJsonTexts = json_1.loadJsonTexts;
|
|
144227
|
-
var resolve_1 = __webpack_require__(96749);
|
|
144228
|
-
exports.getI18nFolderNames = resolve_1.getI18nFolderNames;
|
|
144229
|
-
exports.getCapI18nBundle = resolve_1.getCapI18nBundle;
|
|
144230
|
-
var add_1 = __webpack_require__(42745);
|
|
144231
|
-
exports.addI18nEntriesForCdsFile = add_1.addI18nEntriesForCdsFile;
|
|
144232
|
-
|
|
144233
|
-
|
|
144234
|
-
/***/ }),
|
|
144235
|
-
|
|
144236
|
-
/***/ 34692:
|
|
144237
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144238
|
-
|
|
144239
|
-
"use strict";
|
|
144240
|
-
|
|
144241
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144242
|
-
const jsonc_parser_1 = __webpack_require__(48617);
|
|
144243
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
144244
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
144245
|
-
const utils_1 = __webpack_require__(8655);
|
|
144246
|
-
function loadJsonTexts(text, filePath = '') {
|
|
144247
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
144248
|
-
const bundle = {};
|
|
144249
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
144250
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
144251
|
-
const contentLength = text.length;
|
|
144252
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
144253
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
144254
|
-
for (const localeNode of localeNodes) {
|
|
144255
|
-
if (localeNode.type === 'property') {
|
|
144256
|
-
const entries = [];
|
|
144257
|
-
const locale = (_d = (_c = ((_b = localeNode.children) !== null && _b !== void 0 ? _b : [])[0]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '';
|
|
144258
|
-
bundle[locale] = entries;
|
|
144259
|
-
const textNodes = (_g = (_f = ((_e = localeNode.children) !== null && _e !== void 0 ? _e : [])[1]) === null || _f === void 0 ? void 0 : _f.children) !== null && _g !== void 0 ? _g : [];
|
|
144260
|
-
for (const textNode of textNodes) {
|
|
144261
|
-
if (textNode.type === 'property') {
|
|
144262
|
-
const key = toTextNode(((_h = textNode.children) !== null && _h !== void 0 ? _h : [])[0], lineOffsets, contentLength);
|
|
144263
|
-
const value = toTextNode(((_j = textNode.children) !== null && _j !== void 0 ? _j : [])[1], lineOffsets, contentLength);
|
|
144264
|
-
entries.push({
|
|
144265
|
-
filePath,
|
|
144266
|
-
key,
|
|
144267
|
-
value
|
|
144268
|
-
});
|
|
144269
|
-
}
|
|
144270
|
-
}
|
|
144271
|
-
}
|
|
144272
|
-
}
|
|
144273
|
-
}
|
|
144274
|
-
return bundle;
|
|
144275
|
-
}
|
|
144276
|
-
exports.loadJsonTexts = loadJsonTexts;
|
|
144277
|
-
function createFullBundle(fallbackLocale, newEntries) {
|
|
144278
|
-
const fallbackBundle = newEntries.reduce((acc, entry) => {
|
|
144279
|
-
acc[entry.key] = entry.value;
|
|
144280
|
-
return acc;
|
|
144281
|
-
}, {});
|
|
144282
|
-
const bundle = {
|
|
144283
|
-
[fallbackLocale]: fallbackBundle
|
|
144284
|
-
};
|
|
144285
|
-
return bundle;
|
|
144286
|
-
}
|
|
144287
|
-
function addJsonTexts(text, fallbackLocale, newEntries) {
|
|
144288
|
-
var _a, _b, _c;
|
|
144289
|
-
if (text === '') {
|
|
144290
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
144291
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
144292
|
-
}
|
|
144293
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
144294
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
144295
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
144296
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
144297
|
-
const indent = utils_1.discoverIndent(text);
|
|
144298
|
-
const fallbackLocaleNode = localeNodes.find((node) => { var _a, _b; return ((_b = ((_a = node.children) !== null && _a !== void 0 ? _a : [])[0]) === null || _b === void 0 ? void 0 : _b.value) === fallbackLocale; });
|
|
144299
|
-
if (fallbackLocaleNode) {
|
|
144300
|
-
const bundleNode = ((_b = fallbackLocaleNode.children) !== null && _b !== void 0 ? _b : [])[1];
|
|
144301
|
-
const textNodes = (_c = bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.children) !== null && _c !== void 0 ? _c : [];
|
|
144302
|
-
if (textNodes.length) {
|
|
144303
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
144304
|
-
const position = document.positionAt(textNodes[0].offset);
|
|
144305
|
-
let newText = '';
|
|
144306
|
-
for (let i = 0; i < newEntries.length; i++) {
|
|
144307
|
-
const entry = newEntries[i];
|
|
144308
|
-
newText += `${indent + indent}"${entry.key}": "${entry.value}",${eol}`;
|
|
144309
|
-
}
|
|
144310
|
-
const edit = {
|
|
144311
|
-
newText: newText,
|
|
144312
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
144313
|
-
};
|
|
144314
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
144315
|
-
}
|
|
144316
|
-
else if (bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.offset) {
|
|
144317
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
144318
|
-
const start = document.positionAt(bundleNode.offset);
|
|
144319
|
-
const end = document.positionAt(bundleNode.offset + bundleNode.length);
|
|
144320
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
144321
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
144322
|
-
const indented = utils_1.applyIndent(`${newText}`, indent, eol, false);
|
|
144323
|
-
const edit = {
|
|
144324
|
-
newText: indented,
|
|
144325
|
-
range: ux_i18n_properties_1.Range.create(start, end)
|
|
144326
|
-
};
|
|
144327
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
144328
|
-
}
|
|
144329
|
-
}
|
|
144330
|
-
else if (localeNodes.length === 0) {
|
|
144331
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
144332
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
144333
|
-
}
|
|
144334
|
-
else {
|
|
144335
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
144336
|
-
const [last] = localeNodes.slice(-1);
|
|
144337
|
-
const position = document.positionAt(last.offset);
|
|
144338
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
144339
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
144340
|
-
const indented = utils_1.applyIndent(`"${fallbackLocale}": ${newText},`, indent, eol);
|
|
144341
|
-
const edit = {
|
|
144342
|
-
newText: indented + eol,
|
|
144343
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
144344
|
-
};
|
|
144345
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
144346
|
-
}
|
|
144347
|
-
}
|
|
144348
|
-
return text;
|
|
144349
|
-
}
|
|
144350
|
-
exports.addJsonTexts = addJsonTexts;
|
|
144351
|
-
function createTextNode(value, range) {
|
|
144352
|
-
return {
|
|
144353
|
-
value,
|
|
144354
|
-
range
|
|
144355
|
-
};
|
|
144356
|
-
}
|
|
144357
|
-
exports.createTextNode = createTextNode;
|
|
144358
|
-
function toTextNode(node, lineOffsets, contentLength) {
|
|
144359
|
-
if (node) {
|
|
144360
|
-
switch (typeof node.value) {
|
|
144361
|
-
case 'string': {
|
|
144362
|
-
// for string literals node offset starts with '"' character, but we don't include it in the text node range
|
|
144363
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset + 1, contentLength);
|
|
144364
|
-
const { value } = node;
|
|
144365
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
144366
|
-
}
|
|
144367
|
-
case 'number': {
|
|
144368
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
144369
|
-
const value = node.value.toString();
|
|
144370
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
144371
|
-
}
|
|
144372
|
-
case 'boolean': {
|
|
144373
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
144374
|
-
// CDS currently uses the boolean value if its true, otherwise falls back to using the key
|
|
144375
|
-
const value = node.value ? 'true' : '';
|
|
144376
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
144377
|
-
}
|
|
144378
|
-
default: {
|
|
144379
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
144380
|
-
return createTextNode('', ux_i18n_properties_1.Range.create(start, start));
|
|
144381
|
-
}
|
|
144382
|
-
}
|
|
144383
|
-
}
|
|
144384
|
-
}
|
|
144385
|
-
|
|
144386
|
-
|
|
144387
|
-
/***/ }),
|
|
144388
|
-
|
|
144389
|
-
/***/ 96749:
|
|
144390
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144391
|
-
|
|
144392
|
-
"use strict";
|
|
144393
|
-
|
|
144394
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144395
|
-
const path_1 = __webpack_require__(71017);
|
|
144396
|
-
const fs_1 = __webpack_require__(57147);
|
|
144397
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
144398
|
-
const csv_1 = __webpack_require__(98944);
|
|
144399
|
-
const json_1 = __webpack_require__(34692);
|
|
144400
|
-
const utils_1 = __webpack_require__(8655);
|
|
144401
|
-
/**
|
|
144402
|
-
* Returns a list of allowed i18n folder names, where translation files can be found.
|
|
144403
|
-
*/
|
|
144404
|
-
function getI18nFolderNames(env) {
|
|
144405
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
144406
|
-
return folders;
|
|
144407
|
-
}
|
|
144408
|
-
exports.getI18nFolderNames = getI18nFolderNames;
|
|
144409
|
-
/**
|
|
144410
|
-
* Returns the location of an existing _i18n folder next to or in the
|
|
144411
|
-
* folder hierarchy above the given path, if any.
|
|
144412
|
-
* @param env CDS environment configuration
|
|
144413
|
-
* @param filePath CDS source file path
|
|
144414
|
-
* @param cache If translation file mapping should be cached
|
|
144415
|
-
*/
|
|
144416
|
-
function resolveI18nFolderForFile(env, filePath) {
|
|
144417
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
144418
|
-
function resolve(path) {
|
|
144419
|
-
// check whether a <path>/_i18n exists
|
|
144420
|
-
for (const folderName of folders) {
|
|
144421
|
-
const folderPath = path_1.join(path, folderName);
|
|
144422
|
-
if (fs_1.existsSync(folderPath)) {
|
|
144423
|
-
return folderPath;
|
|
144424
|
-
}
|
|
144425
|
-
}
|
|
144426
|
-
//> no --> search up the folder hierarchy
|
|
144427
|
-
const next = path_1.dirname(path);
|
|
144428
|
-
return next === path ? undefined : resolve(next);
|
|
144429
|
-
}
|
|
144430
|
-
return resolve(filePath);
|
|
144431
|
-
}
|
|
144432
|
-
exports.resolveI18nFolderForFile = resolveI18nFolderForFile;
|
|
144433
|
-
/**
|
|
144434
|
-
* Merges i18n files in to a single bundle for CDS source files
|
|
144435
|
-
* @param env CDS environment configuration
|
|
144436
|
-
* @param filePaths CDS file path
|
|
144437
|
-
* @param logger Fiori tools logger
|
|
144438
|
-
*/
|
|
144439
|
-
async function getCapI18nBundle(env, filePaths, logger) {
|
|
144440
|
-
var _a;
|
|
144441
|
-
const { defaultLanguage, fallbackLanguage, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
144442
|
-
const bundle = {};
|
|
144443
|
-
const i18nFiles = filePaths.reduce((acc, filePath) => {
|
|
144444
|
-
const i18nFolder = resolveI18nFolderForFile(env, filePath);
|
|
144445
|
-
if (i18nFolder) {
|
|
144446
|
-
const file = path_1.join(i18nFolder, baseFileName);
|
|
144447
|
-
if (acc.indexOf(file) === -1) {
|
|
144448
|
-
acc.push(file);
|
|
144449
|
-
}
|
|
144450
|
-
}
|
|
144451
|
-
return acc;
|
|
144452
|
-
}, []);
|
|
144453
|
-
const loaders = [
|
|
144454
|
-
{ loader: json_1.loadJsonTexts, filePathFormatter: utils_1.jsonPathFormatter },
|
|
144455
|
-
{
|
|
144456
|
-
loader: (content, path) => ({
|
|
144457
|
-
[fallbackLanguage]: ux_i18n_properties_1.loadPropertiesTexts(content, path)
|
|
144458
|
-
}),
|
|
144459
|
-
filePathFormatter: utils_1.propertiesPathFormatter
|
|
144460
|
-
},
|
|
144461
|
-
{ loader: csv_1.loadCsvTexts, filePathFormatter: utils_1.csvPathFormatter }
|
|
144462
|
-
];
|
|
144463
|
-
for (const path of i18nFiles) {
|
|
144464
|
-
let loaded = false;
|
|
144465
|
-
let hasError = false;
|
|
144466
|
-
for (const { loader, filePathFormatter } of loaders) {
|
|
144467
|
-
const i18nFilePath = filePathFormatter(path, env);
|
|
144468
|
-
try {
|
|
144469
|
-
const entries = await tryLoadTexts(i18nFilePath, loader);
|
|
144470
|
-
if (entries) {
|
|
144471
|
-
const currentBundle = (_a = entries[fallbackLanguage]) !== null && _a !== void 0 ? _a : entries[defaultLanguage];
|
|
144472
|
-
for (const entry of currentBundle) {
|
|
144473
|
-
if (bundle[entry.key.value]) {
|
|
144474
|
-
bundle[entry.key.value].push(entry);
|
|
144475
|
-
}
|
|
144476
|
-
else {
|
|
144477
|
-
bundle[entry.key.value] = [entry];
|
|
144478
|
-
}
|
|
144479
|
-
}
|
|
144480
|
-
logger.info(`Loaded i18n texts from ${i18nFilePath}`);
|
|
144481
|
-
loaded = true;
|
|
144482
|
-
break;
|
|
144483
|
-
}
|
|
144484
|
-
}
|
|
144485
|
-
catch (error) {
|
|
144486
|
-
hasError = true;
|
|
144487
|
-
logger.error(`Failed to load ${i18nFilePath}. ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
144488
|
-
break;
|
|
144489
|
-
}
|
|
144490
|
-
}
|
|
144491
|
-
if (!loaded && !hasError) {
|
|
144492
|
-
logger.error(`No translation file found in ${path_1.dirname(path)}`);
|
|
144493
|
-
}
|
|
144494
|
-
}
|
|
144495
|
-
return bundle;
|
|
144496
|
-
}
|
|
144497
|
-
exports.getCapI18nBundle = getCapI18nBundle;
|
|
144498
|
-
async function tryLoadTexts(path, loader) {
|
|
144499
|
-
try {
|
|
144500
|
-
const content = await fs_1.promises.readFile(path, { encoding: 'utf8' });
|
|
144501
|
-
return loader(content, path);
|
|
144502
|
-
}
|
|
144503
|
-
catch (error) {
|
|
144504
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
144505
|
-
return;
|
|
144506
|
-
}
|
|
144507
|
-
else {
|
|
144508
|
-
throw error;
|
|
144509
|
-
}
|
|
144510
|
-
}
|
|
144511
|
-
}
|
|
144512
|
-
|
|
144513
|
-
|
|
144514
|
-
/***/ }),
|
|
144515
|
-
|
|
144516
|
-
/***/ 8655:
|
|
144517
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
144518
|
-
|
|
144519
|
-
"use strict";
|
|
144520
|
-
|
|
144521
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144522
|
-
const LINE_ENDING_PATTERN = /\r|\n|\r?\n/;
|
|
144523
|
-
const INDENT_PATTERN = /(?:\r|\n|\r?\n)([\t|\s]+)/;
|
|
144524
|
-
function discoverLineEnding(text) {
|
|
144525
|
-
for (let i = 0; i < text.length; i++) {
|
|
144526
|
-
const character = text[i];
|
|
144527
|
-
if (character === '\r') {
|
|
144528
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
144529
|
-
return '\r\n';
|
|
144530
|
-
}
|
|
144531
|
-
return '\r';
|
|
144532
|
-
}
|
|
144533
|
-
else if (character === '\n') {
|
|
144534
|
-
return '\n';
|
|
144535
|
-
}
|
|
144536
|
-
}
|
|
144537
|
-
return '\n';
|
|
144538
|
-
}
|
|
144539
|
-
exports.discoverLineEnding = discoverLineEnding;
|
|
144540
|
-
function discoverIndent(text) {
|
|
144541
|
-
const match = INDENT_PATTERN.exec(text);
|
|
144542
|
-
if (match) {
|
|
144543
|
-
return match[1];
|
|
144544
|
-
}
|
|
144545
|
-
return ' ';
|
|
144546
|
-
}
|
|
144547
|
-
exports.discoverIndent = discoverIndent;
|
|
144548
|
-
function applyIndent(text, indent, eol, indentFirstLine = true) {
|
|
144549
|
-
const lines = text.split(LINE_ENDING_PATTERN);
|
|
144550
|
-
let out = '';
|
|
144551
|
-
for (let i = 0; i < lines.length; i++) {
|
|
144552
|
-
const line = lines[i];
|
|
144553
|
-
if (!indentFirstLine && i === 0) {
|
|
144554
|
-
out += line;
|
|
144555
|
-
}
|
|
144556
|
-
else {
|
|
144557
|
-
out += indent + line;
|
|
144558
|
-
}
|
|
144559
|
-
if (i + 1 !== lines.length) {
|
|
144560
|
-
out += eol;
|
|
144561
|
-
}
|
|
144562
|
-
}
|
|
144563
|
-
return out;
|
|
144564
|
-
}
|
|
144565
|
-
exports.applyIndent = applyIndent;
|
|
144566
|
-
function getI18nConfiguration(env) {
|
|
144567
|
-
const { default_language, fallback_bundle, file, folders } = (env && env.i18n) || {};
|
|
144568
|
-
return {
|
|
144569
|
-
defaultLanguage: default_language !== null && default_language !== void 0 ? default_language : 'en',
|
|
144570
|
-
fallbackLanguage: fallback_bundle !== null && fallback_bundle !== void 0 ? fallback_bundle : '',
|
|
144571
|
-
baseFileName: file !== null && file !== void 0 ? file : 'i18n',
|
|
144572
|
-
folders: folders !== null && folders !== void 0 ? folders : ['_i18n', 'i18n']
|
|
144573
|
-
};
|
|
144574
|
-
}
|
|
144575
|
-
exports.getI18nConfiguration = getI18nConfiguration;
|
|
144576
|
-
function jsonPathFormatter(path) {
|
|
144577
|
-
return `${path}.json`;
|
|
144578
|
-
}
|
|
144579
|
-
exports.jsonPathFormatter = jsonPathFormatter;
|
|
144580
|
-
function propertiesPathFormatter(path, env) {
|
|
144581
|
-
const { fallbackLanguage } = getI18nConfiguration(env);
|
|
144582
|
-
return `${path}${fallbackLanguage === '' ? '' : `_${fallbackLanguage}`}.properties`;
|
|
144583
|
-
}
|
|
144584
|
-
exports.propertiesPathFormatter = propertiesPathFormatter;
|
|
144585
|
-
function csvPathFormatter(path) {
|
|
144586
|
-
return `${path}.csv`;
|
|
144587
|
-
}
|
|
144588
|
-
exports.csvPathFormatter = csvPathFormatter;
|
|
144589
|
-
|
|
144590
|
-
|
|
144591
|
-
/***/ }),
|
|
144592
|
-
|
|
144593
|
-
/***/ 43290:
|
|
144594
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144595
|
-
|
|
144596
|
-
"use strict";
|
|
144597
|
-
|
|
144598
|
-
function __export(m) {
|
|
144599
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
144600
|
-
}
|
|
144601
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144602
|
-
__export(__webpack_require__(9929));
|
|
144603
|
-
__export(__webpack_require__(98702));
|
|
144604
|
-
|
|
144605
|
-
|
|
144606
141109
|
/***/ }),
|
|
144607
141110
|
|
|
144608
141111
|
/***/ 87616:
|
|
@@ -144612,7 +141115,6 @@ __export(__webpack_require__(98702));
|
|
|
144612
141115
|
|
|
144613
141116
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144614
141117
|
const path_1 = __webpack_require__(71017);
|
|
144615
|
-
const fs_1 = __webpack_require__(57147);
|
|
144616
141118
|
const file_1 = __webpack_require__(13681);
|
|
144617
141119
|
exports.CAP_SERVICES_FOLDER = 'srv';
|
|
144618
141120
|
exports.CAP_APPS_FOLDER = 'app';
|
|
@@ -144674,32 +141176,9 @@ exports.isCapNodeJsProject = isCapNodeJsProject;
|
|
|
144674
141176
|
* @return {Promise<boolean>} - true if the project is a CAP project
|
|
144675
141177
|
*/
|
|
144676
141178
|
async function isCapJavaProject(projectRoot) {
|
|
144677
|
-
|
|
144678
|
-
return hasApplicationYaml;
|
|
141179
|
+
return file_1.fileExists(path_1.join(projectRoot, exports.CAP_SERVICES_FOLDER, 'src', 'main', 'resources', 'application.yaml'));
|
|
144679
141180
|
}
|
|
144680
141181
|
exports.isCapJavaProject = isCapJavaProject;
|
|
144681
|
-
/**
|
|
144682
|
-
* Get CAP CDS project custom paths for project root
|
|
144683
|
-
* @params {capProjectPath}
|
|
144684
|
-
* @returns {CapCustomPaths} Cap Custom Paths
|
|
144685
|
-
*/
|
|
144686
|
-
exports.getCapCustomPaths = function (capProjectPath) {
|
|
144687
|
-
var _a;
|
|
144688
|
-
const result = {};
|
|
144689
|
-
const packagePath = path_1.join(capProjectPath, 'package.json');
|
|
144690
|
-
try {
|
|
144691
|
-
const packageJson = JSON.parse(fs_1.readFileSync(packagePath, 'utf8'));
|
|
144692
|
-
if ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.cds) === null || _a === void 0 ? void 0 : _a.folders) {
|
|
144693
|
-
result.app = packageJson.cds.folders.app;
|
|
144694
|
-
result.db = packageJson.cds.folders.db;
|
|
144695
|
-
result.srv = packageJson.cds.folders.srv;
|
|
144696
|
-
}
|
|
144697
|
-
}
|
|
144698
|
-
catch (e) {
|
|
144699
|
-
// Ignore errors as may have no custom paths or invalid package.json
|
|
144700
|
-
}
|
|
144701
|
-
return result;
|
|
144702
|
-
};
|
|
144703
141182
|
exports.toAbsoluteUri = (project, relativeUri) => path_1.join(project.root, relativeUri);
|
|
144704
141183
|
exports.toReferenceUri = async (project, relativeUriFrom, relativeUriTo) => {
|
|
144705
141184
|
let relativeUri = '';
|
|
@@ -144798,20 +141277,6 @@ async function fileExists(path) {
|
|
|
144798
141277
|
exports.fileExists = fileExists;
|
|
144799
141278
|
|
|
144800
141279
|
|
|
144801
|
-
/***/ }),
|
|
144802
|
-
|
|
144803
|
-
/***/ 9929:
|
|
144804
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
144805
|
-
|
|
144806
|
-
"use strict";
|
|
144807
|
-
|
|
144808
|
-
function __export(m) {
|
|
144809
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
144810
|
-
}
|
|
144811
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
144812
|
-
__export(__webpack_require__(87616));
|
|
144813
|
-
|
|
144814
|
-
|
|
144815
141280
|
/***/ }),
|
|
144816
141281
|
|
|
144817
141282
|
/***/ 50553:
|
|
@@ -152991,12 +149456,7 @@ const path_1 = __importDefault(__webpack_require__(71017));
|
|
|
152991
149456
|
const https_1 = __importDefault(__webpack_require__(95687));
|
|
152992
149457
|
const util_1 = __webpack_require__(31939);
|
|
152993
149458
|
function isConfirmationRequired(config) {
|
|
152994
|
-
|
|
152995
|
-
return false;
|
|
152996
|
-
}
|
|
152997
|
-
else {
|
|
152998
|
-
return true;
|
|
152999
|
-
}
|
|
149459
|
+
return config.yes || (process.argv && process.argv.includes('-y')) ? false : true;
|
|
153000
149460
|
}
|
|
153001
149461
|
async function getUrlArchive(archiveUrl, strictSsl) {
|
|
153002
149462
|
const cwd = process.cwd();
|
|
@@ -153364,8 +149824,7 @@ async function getUI5Theme(root) {
|
|
|
153364
149824
|
const yamlFile = path_1.default.join(root, 'ui5-deploy.yaml');
|
|
153365
149825
|
if (await fileExists(yamlFile)) {
|
|
153366
149826
|
const yamlContent = yaml_1.default.parse(await readLocalFile(yamlFile));
|
|
153367
|
-
|
|
153368
|
-
return ui5Theme;
|
|
149827
|
+
return yamlContent.ui5Theme;
|
|
153369
149828
|
}
|
|
153370
149829
|
}
|
|
153371
149830
|
/**
|
|
@@ -153901,8 +150360,7 @@ function createDistWorkspace() {
|
|
|
153901
150360
|
virBasePath,
|
|
153902
150361
|
fsBasePath: path_1.join(process.cwd(), 'dist')
|
|
153903
150362
|
});
|
|
153904
|
-
|
|
153905
|
-
return workspace;
|
|
150363
|
+
return fs_2.resourceFactory.createWorkspace({ reader: fs, name: 'fiori', virBasePath: 'fiori' });
|
|
153906
150364
|
}
|
|
153907
150365
|
exports.createDistWorkspace = createDistWorkspace;
|
|
153908
150366
|
/**
|
|
@@ -168314,14 +164772,6 @@ module.exports = {"i8":"3.3.3"};
|
|
|
168314
164772
|
|
|
168315
164773
|
/***/ }),
|
|
168316
164774
|
|
|
168317
|
-
/***/ 97992:
|
|
168318
|
-
/***/ ((module) => {
|
|
168319
|
-
|
|
168320
|
-
"use strict";
|
|
168321
|
-
module.exports = JSON.parse('{"Text_Key":"Text Key","Text_Value":"Text Value","Additional_Information":"Additional Information"}');
|
|
168322
|
-
|
|
168323
|
-
/***/ }),
|
|
168324
|
-
|
|
168325
164775
|
/***/ 13086:
|
|
168326
164776
|
/***/ ((module) => {
|
|
168327
164777
|
|
|
@@ -168334,7 +164784,7 @@ module.exports = JSON.parse('{"ERROR_SPECIFICATION_MISSING":"Seems specification
|
|
|
168334
164784
|
/***/ ((module) => {
|
|
168335
164785
|
|
|
168336
164786
|
"use strict";
|
|
168337
|
-
module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.5.
|
|
164787
|
+
module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.5.5","description":"SAP Fiori tools telemetry library","main":"dist/src/index.js","author":"SAP SE","license":"MIT","private":true,"azureInstrumentationKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","azureProdKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","scripts":{"pre-commit":"lint-staged --quiet","clean":"rimraf ./dist","build":"ts-node ./build-script/ && yarn run clean && tsc --project ./","test":"jest --maxWorkers=1 --silent --ci --forceExit --detectOpenHandles","lint":"eslint . --ext .ts","lint:summary":"eslint . --ext .ts -f summary","lint:fix":"eslint --fix","lint:fix:all":"eslint . --ext .ts --fix","lint:report":"eslint . --ext .ts -f multiple ","format:fix":"prettier --write --loglevel silent --ignore-path ../../../.prettierignore","format:fix:all":"prettier --write \'**/*.{css,scss,html,js,json,ts,tsx,yaml,yml}\' \'!**/{out,dist,node_modules}/**\' \'!**/*.{svg,png,xml}\' --ignore-path ../../../.prettierignore","madge":"madge --warning --circular --extensions ts ./"},"dependencies":{"@sap-ux/store":"0.1.0","@sap/ux-cds":"1.5.5","@sap/ux-common-utils":"1.5.5","@sap/ux-feature-toggle":"1.5.5","@sap/ux-project-access":"1.5.5","applicationinsights":"1.4.1","performance-now":"2.1.0","yaml":"2.0.0-10"},"devDependencies":{"ts-node":"8.5.2","typescript":"3.8.3"},"files":["dist/"],"jestSonar":{"reportPath":"reports/test/unit","reportFile":"test-report.xml"},"eslint-formatter-multiple":{"formatters":[{"name":"stylish","output":"console"},{"name":"json","output":"file","path":"reports/lint/eslint.json"},{"name":"checkstyle","output":"file","path":"reports/lint/eslint.checkstyle.xml"}]}}');
|
|
168338
164788
|
|
|
168339
164789
|
/***/ }),
|
|
168340
164790
|
|