@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
|
@@ -49466,6 +49466,7 @@ module.exports = {
|
|
|
49466
49466
|
* @public
|
|
49467
49467
|
*/
|
|
49468
49468
|
|
|
49469
|
+
|
|
49469
49470
|
var fs = __webpack_require__(57147);
|
|
49470
49471
|
var path = __webpack_require__(71017);
|
|
49471
49472
|
var utils = __webpack_require__(42781);
|
|
@@ -49486,6 +49487,7 @@ var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compi
|
|
|
49486
49487
|
// so we make an exception for `renderFile`
|
|
49487
49488
|
var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache');
|
|
49488
49489
|
var _BOM = /^\uFEFF/;
|
|
49490
|
+
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
49489
49491
|
|
|
49490
49492
|
/**
|
|
49491
49493
|
* EJS template function cache. This can be a LRU object from lru-cache NPM
|
|
@@ -49727,7 +49729,7 @@ function fileLoader(filePath){
|
|
|
49727
49729
|
*/
|
|
49728
49730
|
|
|
49729
49731
|
function includeFile(path, options) {
|
|
49730
|
-
var opts = utils.shallowCopy(
|
|
49732
|
+
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
|
|
49731
49733
|
opts.filename = getIncludePath(path, opts);
|
|
49732
49734
|
if (typeof options.includer === 'function') {
|
|
49733
49735
|
var includerResult = options.includer(path, opts.filename);
|
|
@@ -49833,8 +49835,8 @@ exports.compile = function compile(template, opts) {
|
|
|
49833
49835
|
*/
|
|
49834
49836
|
|
|
49835
49837
|
exports.render = function (template, d, o) {
|
|
49836
|
-
var data = d ||
|
|
49837
|
-
var opts = o ||
|
|
49838
|
+
var data = d || utils.createNullProtoObjWherePossible();
|
|
49839
|
+
var opts = o || utils.createNullProtoObjWherePossible();
|
|
49838
49840
|
|
|
49839
49841
|
// No options object -- if there are optiony names
|
|
49840
49842
|
// in the data, copy them to options
|
|
@@ -49905,7 +49907,7 @@ exports.renderFile = function () {
|
|
|
49905
49907
|
opts.filename = filename;
|
|
49906
49908
|
}
|
|
49907
49909
|
else {
|
|
49908
|
-
data =
|
|
49910
|
+
data = utils.createNullProtoObjWherePossible();
|
|
49909
49911
|
}
|
|
49910
49912
|
|
|
49911
49913
|
return tryHandleCache(opts, data, cb);
|
|
@@ -49927,8 +49929,8 @@ exports.clearCache = function () {
|
|
|
49927
49929
|
};
|
|
49928
49930
|
|
|
49929
49931
|
function Template(text, opts) {
|
|
49930
|
-
opts = opts ||
|
|
49931
|
-
var options =
|
|
49932
|
+
opts = opts || utils.createNullProtoObjWherePossible();
|
|
49933
|
+
var options = utils.createNullProtoObjWherePossible();
|
|
49932
49934
|
this.templateText = text;
|
|
49933
49935
|
/** @type {string | null} */
|
|
49934
49936
|
this.mode = null;
|
|
@@ -50009,12 +50011,21 @@ Template.prototype = {
|
|
|
50009
50011
|
' var __output = "";\n' +
|
|
50010
50012
|
' function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
|
|
50011
50013
|
if (opts.outputFunctionName) {
|
|
50014
|
+
if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) {
|
|
50015
|
+
throw new Error('outputFunctionName is not a valid JS identifier.');
|
|
50016
|
+
}
|
|
50012
50017
|
prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n';
|
|
50013
50018
|
}
|
|
50019
|
+
if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) {
|
|
50020
|
+
throw new Error('localsName is not a valid JS identifier.');
|
|
50021
|
+
}
|
|
50014
50022
|
if (opts.destructuredLocals && opts.destructuredLocals.length) {
|
|
50015
50023
|
var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n';
|
|
50016
50024
|
for (var i = 0; i < opts.destructuredLocals.length; i++) {
|
|
50017
50025
|
var name = opts.destructuredLocals[i];
|
|
50026
|
+
if (!_JS_IDENTIFIER.test(name)) {
|
|
50027
|
+
throw new Error('destructuredLocals[' + i + '] is not a valid JS identifier.');
|
|
50028
|
+
}
|
|
50018
50029
|
if (i > 0) {
|
|
50019
50030
|
destructuring += ',\n ';
|
|
50020
50031
|
}
|
|
@@ -50105,13 +50116,14 @@ Template.prototype = {
|
|
|
50105
50116
|
// Adds a local `include` function which allows full recursive include
|
|
50106
50117
|
var returnedFn = opts.client ? fn : function anonymous(data) {
|
|
50107
50118
|
var include = function (path, includeData) {
|
|
50108
|
-
var d = utils.shallowCopy(
|
|
50119
|
+
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
|
|
50109
50120
|
if (includeData) {
|
|
50110
50121
|
d = utils.shallowCopy(d, includeData);
|
|
50111
50122
|
}
|
|
50112
50123
|
return includeFile(path, opts)(d);
|
|
50113
50124
|
};
|
|
50114
|
-
return fn.apply(opts.context,
|
|
50125
|
+
return fn.apply(opts.context,
|
|
50126
|
+
[data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]);
|
|
50115
50127
|
};
|
|
50116
50128
|
if (opts.filename && typeof Object.defineProperty === 'function') {
|
|
50117
50129
|
var filename = opts.filename;
|
|
@@ -50483,8 +50495,10 @@ exports.escapeXML.toString = function () {
|
|
|
50483
50495
|
*/
|
|
50484
50496
|
exports.shallowCopy = function (to, from) {
|
|
50485
50497
|
from = from || {};
|
|
50486
|
-
|
|
50487
|
-
|
|
50498
|
+
if ((to !== null) && (to !== undefined)) {
|
|
50499
|
+
for (var p in from) {
|
|
50500
|
+
to[p] = from[p];
|
|
50501
|
+
}
|
|
50488
50502
|
}
|
|
50489
50503
|
return to;
|
|
50490
50504
|
};
|
|
@@ -50502,10 +50516,14 @@ exports.shallowCopy = function (to, from) {
|
|
|
50502
50516
|
* @private
|
|
50503
50517
|
*/
|
|
50504
50518
|
exports.shallowCopyFromList = function (to, from, list) {
|
|
50505
|
-
|
|
50506
|
-
|
|
50507
|
-
|
|
50508
|
-
|
|
50519
|
+
list = list || [];
|
|
50520
|
+
from = from || {};
|
|
50521
|
+
if ((to !== null) && (to !== undefined)) {
|
|
50522
|
+
for (var i = 0; i < list.length; i++) {
|
|
50523
|
+
var p = list[i];
|
|
50524
|
+
if (typeof from[p] != 'undefined') {
|
|
50525
|
+
to[p] = from[p];
|
|
50526
|
+
}
|
|
50509
50527
|
}
|
|
50510
50528
|
}
|
|
50511
50529
|
return to;
|
|
@@ -50547,6 +50565,32 @@ exports.hyphenToCamel = function (str) {
|
|
|
50547
50565
|
return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); });
|
|
50548
50566
|
};
|
|
50549
50567
|
|
|
50568
|
+
/**
|
|
50569
|
+
* Returns a null-prototype object in runtimes that support it
|
|
50570
|
+
*
|
|
50571
|
+
* @return {Object} Object, prototype will be set to null where possible
|
|
50572
|
+
* @static
|
|
50573
|
+
* @private
|
|
50574
|
+
*/
|
|
50575
|
+
exports.createNullProtoObjWherePossible = (function () {
|
|
50576
|
+
if (typeof Object.create == 'function') {
|
|
50577
|
+
return function () {
|
|
50578
|
+
return Object.create(null);
|
|
50579
|
+
};
|
|
50580
|
+
}
|
|
50581
|
+
if (!({__proto__: null} instanceof Object)) {
|
|
50582
|
+
return function () {
|
|
50583
|
+
return {__proto__: null};
|
|
50584
|
+
};
|
|
50585
|
+
}
|
|
50586
|
+
// Not possible, just pass through
|
|
50587
|
+
return function () {
|
|
50588
|
+
return {};
|
|
50589
|
+
};
|
|
50590
|
+
})();
|
|
50591
|
+
|
|
50592
|
+
|
|
50593
|
+
|
|
50550
50594
|
|
|
50551
50595
|
/***/ }),
|
|
50552
50596
|
|
|
@@ -66276,1524 +66320,6 @@ function serializer(replacer, cycleReplacer) {
|
|
|
66276
66320
|
}
|
|
66277
66321
|
|
|
66278
66322
|
|
|
66279
|
-
/***/ }),
|
|
66280
|
-
|
|
66281
|
-
/***/ 48617:
|
|
66282
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66283
|
-
|
|
66284
|
-
"use strict";
|
|
66285
|
-
// ESM COMPAT FLAG
|
|
66286
|
-
__webpack_require__.r(__webpack_exports__);
|
|
66287
|
-
|
|
66288
|
-
// EXPORTS
|
|
66289
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
66290
|
-
"applyEdits": () => (/* binding */ applyEdits),
|
|
66291
|
-
"createScanner": () => (/* binding */ main_createScanner),
|
|
66292
|
-
"findNodeAtLocation": () => (/* binding */ main_findNodeAtLocation),
|
|
66293
|
-
"findNodeAtOffset": () => (/* binding */ main_findNodeAtOffset),
|
|
66294
|
-
"format": () => (/* binding */ main_format),
|
|
66295
|
-
"getLocation": () => (/* binding */ main_getLocation),
|
|
66296
|
-
"getNodePath": () => (/* binding */ main_getNodePath),
|
|
66297
|
-
"getNodeValue": () => (/* binding */ main_getNodeValue),
|
|
66298
|
-
"modify": () => (/* binding */ modify),
|
|
66299
|
-
"parse": () => (/* binding */ main_parse),
|
|
66300
|
-
"parseTree": () => (/* binding */ main_parseTree),
|
|
66301
|
-
"printParseErrorCode": () => (/* binding */ printParseErrorCode),
|
|
66302
|
-
"stripComments": () => (/* binding */ main_stripComments),
|
|
66303
|
-
"visit": () => (/* binding */ main_visit)
|
|
66304
|
-
});
|
|
66305
|
-
|
|
66306
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
66307
|
-
/*---------------------------------------------------------------------------------------------
|
|
66308
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
66309
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
66310
|
-
*--------------------------------------------------------------------------------------------*/
|
|
66311
|
-
|
|
66312
|
-
/**
|
|
66313
|
-
* Creates a JSON scanner on the given text.
|
|
66314
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
66315
|
-
*/
|
|
66316
|
-
function createScanner(text, ignoreTrivia) {
|
|
66317
|
-
if (ignoreTrivia === void 0) { ignoreTrivia = false; }
|
|
66318
|
-
var len = text.length;
|
|
66319
|
-
var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */;
|
|
66320
|
-
function scanHexDigits(count, exact) {
|
|
66321
|
-
var digits = 0;
|
|
66322
|
-
var value = 0;
|
|
66323
|
-
while (digits < count || !exact) {
|
|
66324
|
-
var ch = text.charCodeAt(pos);
|
|
66325
|
-
if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) {
|
|
66326
|
-
value = value * 16 + ch - 48 /* _0 */;
|
|
66327
|
-
}
|
|
66328
|
-
else if (ch >= 65 /* A */ && ch <= 70 /* F */) {
|
|
66329
|
-
value = value * 16 + ch - 65 /* A */ + 10;
|
|
66330
|
-
}
|
|
66331
|
-
else if (ch >= 97 /* a */ && ch <= 102 /* f */) {
|
|
66332
|
-
value = value * 16 + ch - 97 /* a */ + 10;
|
|
66333
|
-
}
|
|
66334
|
-
else {
|
|
66335
|
-
break;
|
|
66336
|
-
}
|
|
66337
|
-
pos++;
|
|
66338
|
-
digits++;
|
|
66339
|
-
}
|
|
66340
|
-
if (digits < count) {
|
|
66341
|
-
value = -1;
|
|
66342
|
-
}
|
|
66343
|
-
return value;
|
|
66344
|
-
}
|
|
66345
|
-
function setPosition(newPosition) {
|
|
66346
|
-
pos = newPosition;
|
|
66347
|
-
value = '';
|
|
66348
|
-
tokenOffset = 0;
|
|
66349
|
-
token = 16 /* Unknown */;
|
|
66350
|
-
scanError = 0 /* None */;
|
|
66351
|
-
}
|
|
66352
|
-
function scanNumber() {
|
|
66353
|
-
var start = pos;
|
|
66354
|
-
if (text.charCodeAt(pos) === 48 /* _0 */) {
|
|
66355
|
-
pos++;
|
|
66356
|
-
}
|
|
66357
|
-
else {
|
|
66358
|
-
pos++;
|
|
66359
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
66360
|
-
pos++;
|
|
66361
|
-
}
|
|
66362
|
-
}
|
|
66363
|
-
if (pos < text.length && text.charCodeAt(pos) === 46 /* dot */) {
|
|
66364
|
-
pos++;
|
|
66365
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
66366
|
-
pos++;
|
|
66367
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
66368
|
-
pos++;
|
|
66369
|
-
}
|
|
66370
|
-
}
|
|
66371
|
-
else {
|
|
66372
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
66373
|
-
return text.substring(start, pos);
|
|
66374
|
-
}
|
|
66375
|
-
}
|
|
66376
|
-
var end = pos;
|
|
66377
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */)) {
|
|
66378
|
-
pos++;
|
|
66379
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) {
|
|
66380
|
-
pos++;
|
|
66381
|
-
}
|
|
66382
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
66383
|
-
pos++;
|
|
66384
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
66385
|
-
pos++;
|
|
66386
|
-
}
|
|
66387
|
-
end = pos;
|
|
66388
|
-
}
|
|
66389
|
-
else {
|
|
66390
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
66391
|
-
}
|
|
66392
|
-
}
|
|
66393
|
-
return text.substring(start, end);
|
|
66394
|
-
}
|
|
66395
|
-
function scanString() {
|
|
66396
|
-
var result = '', start = pos;
|
|
66397
|
-
while (true) {
|
|
66398
|
-
if (pos >= len) {
|
|
66399
|
-
result += text.substring(start, pos);
|
|
66400
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
66401
|
-
break;
|
|
66402
|
-
}
|
|
66403
|
-
var ch = text.charCodeAt(pos);
|
|
66404
|
-
if (ch === 34 /* doubleQuote */) {
|
|
66405
|
-
result += text.substring(start, pos);
|
|
66406
|
-
pos++;
|
|
66407
|
-
break;
|
|
66408
|
-
}
|
|
66409
|
-
if (ch === 92 /* backslash */) {
|
|
66410
|
-
result += text.substring(start, pos);
|
|
66411
|
-
pos++;
|
|
66412
|
-
if (pos >= len) {
|
|
66413
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
66414
|
-
break;
|
|
66415
|
-
}
|
|
66416
|
-
var ch2 = text.charCodeAt(pos++);
|
|
66417
|
-
switch (ch2) {
|
|
66418
|
-
case 34 /* doubleQuote */:
|
|
66419
|
-
result += '\"';
|
|
66420
|
-
break;
|
|
66421
|
-
case 92 /* backslash */:
|
|
66422
|
-
result += '\\';
|
|
66423
|
-
break;
|
|
66424
|
-
case 47 /* slash */:
|
|
66425
|
-
result += '/';
|
|
66426
|
-
break;
|
|
66427
|
-
case 98 /* b */:
|
|
66428
|
-
result += '\b';
|
|
66429
|
-
break;
|
|
66430
|
-
case 102 /* f */:
|
|
66431
|
-
result += '\f';
|
|
66432
|
-
break;
|
|
66433
|
-
case 110 /* n */:
|
|
66434
|
-
result += '\n';
|
|
66435
|
-
break;
|
|
66436
|
-
case 114 /* r */:
|
|
66437
|
-
result += '\r';
|
|
66438
|
-
break;
|
|
66439
|
-
case 116 /* t */:
|
|
66440
|
-
result += '\t';
|
|
66441
|
-
break;
|
|
66442
|
-
case 117 /* u */:
|
|
66443
|
-
var ch3 = scanHexDigits(4, true);
|
|
66444
|
-
if (ch3 >= 0) {
|
|
66445
|
-
result += String.fromCharCode(ch3);
|
|
66446
|
-
}
|
|
66447
|
-
else {
|
|
66448
|
-
scanError = 4 /* InvalidUnicode */;
|
|
66449
|
-
}
|
|
66450
|
-
break;
|
|
66451
|
-
default:
|
|
66452
|
-
scanError = 5 /* InvalidEscapeCharacter */;
|
|
66453
|
-
}
|
|
66454
|
-
start = pos;
|
|
66455
|
-
continue;
|
|
66456
|
-
}
|
|
66457
|
-
if (ch >= 0 && ch <= 0x1f) {
|
|
66458
|
-
if (isLineBreak(ch)) {
|
|
66459
|
-
result += text.substring(start, pos);
|
|
66460
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
66461
|
-
break;
|
|
66462
|
-
}
|
|
66463
|
-
else {
|
|
66464
|
-
scanError = 6 /* InvalidCharacter */;
|
|
66465
|
-
// mark as error but continue with string
|
|
66466
|
-
}
|
|
66467
|
-
}
|
|
66468
|
-
pos++;
|
|
66469
|
-
}
|
|
66470
|
-
return result;
|
|
66471
|
-
}
|
|
66472
|
-
function scanNext() {
|
|
66473
|
-
value = '';
|
|
66474
|
-
scanError = 0 /* None */;
|
|
66475
|
-
tokenOffset = pos;
|
|
66476
|
-
lineStartOffset = lineNumber;
|
|
66477
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
66478
|
-
if (pos >= len) {
|
|
66479
|
-
// at the end
|
|
66480
|
-
tokenOffset = len;
|
|
66481
|
-
return token = 17 /* EOF */;
|
|
66482
|
-
}
|
|
66483
|
-
var code = text.charCodeAt(pos);
|
|
66484
|
-
// trivia: whitespace
|
|
66485
|
-
if (isWhiteSpace(code)) {
|
|
66486
|
-
do {
|
|
66487
|
-
pos++;
|
|
66488
|
-
value += String.fromCharCode(code);
|
|
66489
|
-
code = text.charCodeAt(pos);
|
|
66490
|
-
} while (isWhiteSpace(code));
|
|
66491
|
-
return token = 15 /* Trivia */;
|
|
66492
|
-
}
|
|
66493
|
-
// trivia: newlines
|
|
66494
|
-
if (isLineBreak(code)) {
|
|
66495
|
-
pos++;
|
|
66496
|
-
value += String.fromCharCode(code);
|
|
66497
|
-
if (code === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
66498
|
-
pos++;
|
|
66499
|
-
value += '\n';
|
|
66500
|
-
}
|
|
66501
|
-
lineNumber++;
|
|
66502
|
-
tokenLineStartOffset = pos;
|
|
66503
|
-
return token = 14 /* LineBreakTrivia */;
|
|
66504
|
-
}
|
|
66505
|
-
switch (code) {
|
|
66506
|
-
// tokens: []{}:,
|
|
66507
|
-
case 123 /* openBrace */:
|
|
66508
|
-
pos++;
|
|
66509
|
-
return token = 1 /* OpenBraceToken */;
|
|
66510
|
-
case 125 /* closeBrace */:
|
|
66511
|
-
pos++;
|
|
66512
|
-
return token = 2 /* CloseBraceToken */;
|
|
66513
|
-
case 91 /* openBracket */:
|
|
66514
|
-
pos++;
|
|
66515
|
-
return token = 3 /* OpenBracketToken */;
|
|
66516
|
-
case 93 /* closeBracket */:
|
|
66517
|
-
pos++;
|
|
66518
|
-
return token = 4 /* CloseBracketToken */;
|
|
66519
|
-
case 58 /* colon */:
|
|
66520
|
-
pos++;
|
|
66521
|
-
return token = 6 /* ColonToken */;
|
|
66522
|
-
case 44 /* comma */:
|
|
66523
|
-
pos++;
|
|
66524
|
-
return token = 5 /* CommaToken */;
|
|
66525
|
-
// strings
|
|
66526
|
-
case 34 /* doubleQuote */:
|
|
66527
|
-
pos++;
|
|
66528
|
-
value = scanString();
|
|
66529
|
-
return token = 10 /* StringLiteral */;
|
|
66530
|
-
// comments
|
|
66531
|
-
case 47 /* slash */:
|
|
66532
|
-
var start = pos - 1;
|
|
66533
|
-
// Single-line comment
|
|
66534
|
-
if (text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
66535
|
-
pos += 2;
|
|
66536
|
-
while (pos < len) {
|
|
66537
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
66538
|
-
break;
|
|
66539
|
-
}
|
|
66540
|
-
pos++;
|
|
66541
|
-
}
|
|
66542
|
-
value = text.substring(start, pos);
|
|
66543
|
-
return token = 12 /* LineCommentTrivia */;
|
|
66544
|
-
}
|
|
66545
|
-
// Multi-line comment
|
|
66546
|
-
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
|
|
66547
|
-
pos += 2;
|
|
66548
|
-
var safeLength = len - 1; // For lookahead.
|
|
66549
|
-
var commentClosed = false;
|
|
66550
|
-
while (pos < safeLength) {
|
|
66551
|
-
var ch = text.charCodeAt(pos);
|
|
66552
|
-
if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
66553
|
-
pos += 2;
|
|
66554
|
-
commentClosed = true;
|
|
66555
|
-
break;
|
|
66556
|
-
}
|
|
66557
|
-
pos++;
|
|
66558
|
-
if (isLineBreak(ch)) {
|
|
66559
|
-
if (ch === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
66560
|
-
pos++;
|
|
66561
|
-
}
|
|
66562
|
-
lineNumber++;
|
|
66563
|
-
tokenLineStartOffset = pos;
|
|
66564
|
-
}
|
|
66565
|
-
}
|
|
66566
|
-
if (!commentClosed) {
|
|
66567
|
-
pos++;
|
|
66568
|
-
scanError = 1 /* UnexpectedEndOfComment */;
|
|
66569
|
-
}
|
|
66570
|
-
value = text.substring(start, pos);
|
|
66571
|
-
return token = 13 /* BlockCommentTrivia */;
|
|
66572
|
-
}
|
|
66573
|
-
// just a single slash
|
|
66574
|
-
value += String.fromCharCode(code);
|
|
66575
|
-
pos++;
|
|
66576
|
-
return token = 16 /* Unknown */;
|
|
66577
|
-
// numbers
|
|
66578
|
-
case 45 /* minus */:
|
|
66579
|
-
value += String.fromCharCode(code);
|
|
66580
|
-
pos++;
|
|
66581
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
66582
|
-
return token = 16 /* Unknown */;
|
|
66583
|
-
}
|
|
66584
|
-
// found a minus, followed by a number so
|
|
66585
|
-
// we fall through to proceed with scanning
|
|
66586
|
-
// numbers
|
|
66587
|
-
case 48 /* _0 */:
|
|
66588
|
-
case 49 /* _1 */:
|
|
66589
|
-
case 50 /* _2 */:
|
|
66590
|
-
case 51 /* _3 */:
|
|
66591
|
-
case 52 /* _4 */:
|
|
66592
|
-
case 53 /* _5 */:
|
|
66593
|
-
case 54 /* _6 */:
|
|
66594
|
-
case 55 /* _7 */:
|
|
66595
|
-
case 56 /* _8 */:
|
|
66596
|
-
case 57 /* _9 */:
|
|
66597
|
-
value += scanNumber();
|
|
66598
|
-
return token = 11 /* NumericLiteral */;
|
|
66599
|
-
// literals and unknown symbols
|
|
66600
|
-
default:
|
|
66601
|
-
// is a literal? Read the full word.
|
|
66602
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
66603
|
-
pos++;
|
|
66604
|
-
code = text.charCodeAt(pos);
|
|
66605
|
-
}
|
|
66606
|
-
if (tokenOffset !== pos) {
|
|
66607
|
-
value = text.substring(tokenOffset, pos);
|
|
66608
|
-
// keywords: true, false, null
|
|
66609
|
-
switch (value) {
|
|
66610
|
-
case 'true': return token = 8 /* TrueKeyword */;
|
|
66611
|
-
case 'false': return token = 9 /* FalseKeyword */;
|
|
66612
|
-
case 'null': return token = 7 /* NullKeyword */;
|
|
66613
|
-
}
|
|
66614
|
-
return token = 16 /* Unknown */;
|
|
66615
|
-
}
|
|
66616
|
-
// some
|
|
66617
|
-
value += String.fromCharCode(code);
|
|
66618
|
-
pos++;
|
|
66619
|
-
return token = 16 /* Unknown */;
|
|
66620
|
-
}
|
|
66621
|
-
}
|
|
66622
|
-
function isUnknownContentCharacter(code) {
|
|
66623
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
66624
|
-
return false;
|
|
66625
|
-
}
|
|
66626
|
-
switch (code) {
|
|
66627
|
-
case 125 /* closeBrace */:
|
|
66628
|
-
case 93 /* closeBracket */:
|
|
66629
|
-
case 123 /* openBrace */:
|
|
66630
|
-
case 91 /* openBracket */:
|
|
66631
|
-
case 34 /* doubleQuote */:
|
|
66632
|
-
case 58 /* colon */:
|
|
66633
|
-
case 44 /* comma */:
|
|
66634
|
-
case 47 /* slash */:
|
|
66635
|
-
return false;
|
|
66636
|
-
}
|
|
66637
|
-
return true;
|
|
66638
|
-
}
|
|
66639
|
-
function scanNextNonTrivia() {
|
|
66640
|
-
var result;
|
|
66641
|
-
do {
|
|
66642
|
-
result = scanNext();
|
|
66643
|
-
} while (result >= 12 /* LineCommentTrivia */ && result <= 15 /* Trivia */);
|
|
66644
|
-
return result;
|
|
66645
|
-
}
|
|
66646
|
-
return {
|
|
66647
|
-
setPosition: setPosition,
|
|
66648
|
-
getPosition: function () { return pos; },
|
|
66649
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
66650
|
-
getToken: function () { return token; },
|
|
66651
|
-
getTokenValue: function () { return value; },
|
|
66652
|
-
getTokenOffset: function () { return tokenOffset; },
|
|
66653
|
-
getTokenLength: function () { return pos - tokenOffset; },
|
|
66654
|
-
getTokenStartLine: function () { return lineStartOffset; },
|
|
66655
|
-
getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; },
|
|
66656
|
-
getTokenError: function () { return scanError; },
|
|
66657
|
-
};
|
|
66658
|
-
}
|
|
66659
|
-
function isWhiteSpace(ch) {
|
|
66660
|
-
return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ ||
|
|
66661
|
-
ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ ||
|
|
66662
|
-
ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */;
|
|
66663
|
-
}
|
|
66664
|
-
function isLineBreak(ch) {
|
|
66665
|
-
return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */;
|
|
66666
|
-
}
|
|
66667
|
-
function isDigit(ch) {
|
|
66668
|
-
return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;
|
|
66669
|
-
}
|
|
66670
|
-
|
|
66671
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
66672
|
-
/*---------------------------------------------------------------------------------------------
|
|
66673
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
66674
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
66675
|
-
*--------------------------------------------------------------------------------------------*/
|
|
66676
|
-
|
|
66677
|
-
|
|
66678
|
-
function format(documentText, range, options) {
|
|
66679
|
-
var initialIndentLevel;
|
|
66680
|
-
var formatText;
|
|
66681
|
-
var formatTextStart;
|
|
66682
|
-
var rangeStart;
|
|
66683
|
-
var rangeEnd;
|
|
66684
|
-
if (range) {
|
|
66685
|
-
rangeStart = range.offset;
|
|
66686
|
-
rangeEnd = rangeStart + range.length;
|
|
66687
|
-
formatTextStart = rangeStart;
|
|
66688
|
-
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
66689
|
-
formatTextStart--;
|
|
66690
|
-
}
|
|
66691
|
-
var endOffset = rangeEnd;
|
|
66692
|
-
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
66693
|
-
endOffset++;
|
|
66694
|
-
}
|
|
66695
|
-
formatText = documentText.substring(formatTextStart, endOffset);
|
|
66696
|
-
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
66697
|
-
}
|
|
66698
|
-
else {
|
|
66699
|
-
formatText = documentText;
|
|
66700
|
-
initialIndentLevel = 0;
|
|
66701
|
-
formatTextStart = 0;
|
|
66702
|
-
rangeStart = 0;
|
|
66703
|
-
rangeEnd = documentText.length;
|
|
66704
|
-
}
|
|
66705
|
-
var eol = getEOL(options, documentText);
|
|
66706
|
-
var lineBreak = false;
|
|
66707
|
-
var indentLevel = 0;
|
|
66708
|
-
var indentValue;
|
|
66709
|
-
if (options.insertSpaces) {
|
|
66710
|
-
indentValue = repeat(' ', options.tabSize || 4);
|
|
66711
|
-
}
|
|
66712
|
-
else {
|
|
66713
|
-
indentValue = '\t';
|
|
66714
|
-
}
|
|
66715
|
-
var scanner = createScanner(formatText, false);
|
|
66716
|
-
var hasError = false;
|
|
66717
|
-
function newLineAndIndent() {
|
|
66718
|
-
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
66719
|
-
}
|
|
66720
|
-
function scanNext() {
|
|
66721
|
-
var token = scanner.scan();
|
|
66722
|
-
lineBreak = false;
|
|
66723
|
-
while (token === 15 /* Trivia */ || token === 14 /* LineBreakTrivia */) {
|
|
66724
|
-
lineBreak = lineBreak || (token === 14 /* LineBreakTrivia */);
|
|
66725
|
-
token = scanner.scan();
|
|
66726
|
-
}
|
|
66727
|
-
hasError = token === 16 /* Unknown */ || scanner.getTokenError() !== 0 /* None */;
|
|
66728
|
-
return token;
|
|
66729
|
-
}
|
|
66730
|
-
var editOperations = [];
|
|
66731
|
-
function addEdit(text, startOffset, endOffset) {
|
|
66732
|
-
if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
|
|
66733
|
-
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
66734
|
-
}
|
|
66735
|
-
}
|
|
66736
|
-
var firstToken = scanNext();
|
|
66737
|
-
if (firstToken !== 17 /* EOF */) {
|
|
66738
|
-
var firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
66739
|
-
var initialIndent = repeat(indentValue, initialIndentLevel);
|
|
66740
|
-
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
66741
|
-
}
|
|
66742
|
-
while (firstToken !== 17 /* EOF */) {
|
|
66743
|
-
var firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
66744
|
-
var secondToken = scanNext();
|
|
66745
|
-
var replaceContent = '';
|
|
66746
|
-
while (!lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
66747
|
-
// comments on the same line: keep them on the same line, but ignore them otherwise
|
|
66748
|
-
var commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
66749
|
-
addEdit(' ', firstTokenEnd, commentTokenStart);
|
|
66750
|
-
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
66751
|
-
replaceContent = secondToken === 12 /* LineCommentTrivia */ ? newLineAndIndent() : '';
|
|
66752
|
-
secondToken = scanNext();
|
|
66753
|
-
}
|
|
66754
|
-
if (secondToken === 2 /* CloseBraceToken */) {
|
|
66755
|
-
if (firstToken !== 1 /* OpenBraceToken */) {
|
|
66756
|
-
indentLevel--;
|
|
66757
|
-
replaceContent = newLineAndIndent();
|
|
66758
|
-
}
|
|
66759
|
-
}
|
|
66760
|
-
else if (secondToken === 4 /* CloseBracketToken */) {
|
|
66761
|
-
if (firstToken !== 3 /* OpenBracketToken */) {
|
|
66762
|
-
indentLevel--;
|
|
66763
|
-
replaceContent = newLineAndIndent();
|
|
66764
|
-
}
|
|
66765
|
-
}
|
|
66766
|
-
else {
|
|
66767
|
-
switch (firstToken) {
|
|
66768
|
-
case 3 /* OpenBracketToken */:
|
|
66769
|
-
case 1 /* OpenBraceToken */:
|
|
66770
|
-
indentLevel++;
|
|
66771
|
-
replaceContent = newLineAndIndent();
|
|
66772
|
-
break;
|
|
66773
|
-
case 5 /* CommaToken */:
|
|
66774
|
-
case 12 /* LineCommentTrivia */:
|
|
66775
|
-
replaceContent = newLineAndIndent();
|
|
66776
|
-
break;
|
|
66777
|
-
case 13 /* BlockCommentTrivia */:
|
|
66778
|
-
if (lineBreak) {
|
|
66779
|
-
replaceContent = newLineAndIndent();
|
|
66780
|
-
}
|
|
66781
|
-
else {
|
|
66782
|
-
// symbol following comment on the same line: keep on same line, separate with ' '
|
|
66783
|
-
replaceContent = ' ';
|
|
66784
|
-
}
|
|
66785
|
-
break;
|
|
66786
|
-
case 6 /* ColonToken */:
|
|
66787
|
-
replaceContent = ' ';
|
|
66788
|
-
break;
|
|
66789
|
-
case 10 /* StringLiteral */:
|
|
66790
|
-
if (secondToken === 6 /* ColonToken */) {
|
|
66791
|
-
replaceContent = '';
|
|
66792
|
-
break;
|
|
66793
|
-
}
|
|
66794
|
-
// fall through
|
|
66795
|
-
case 7 /* NullKeyword */:
|
|
66796
|
-
case 8 /* TrueKeyword */:
|
|
66797
|
-
case 9 /* FalseKeyword */:
|
|
66798
|
-
case 11 /* NumericLiteral */:
|
|
66799
|
-
case 2 /* CloseBraceToken */:
|
|
66800
|
-
case 4 /* CloseBracketToken */:
|
|
66801
|
-
if (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */) {
|
|
66802
|
-
replaceContent = ' ';
|
|
66803
|
-
}
|
|
66804
|
-
else if (secondToken !== 5 /* CommaToken */ && secondToken !== 17 /* EOF */) {
|
|
66805
|
-
hasError = true;
|
|
66806
|
-
}
|
|
66807
|
-
break;
|
|
66808
|
-
case 16 /* Unknown */:
|
|
66809
|
-
hasError = true;
|
|
66810
|
-
break;
|
|
66811
|
-
}
|
|
66812
|
-
if (lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
66813
|
-
replaceContent = newLineAndIndent();
|
|
66814
|
-
}
|
|
66815
|
-
}
|
|
66816
|
-
var secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
66817
|
-
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
66818
|
-
firstToken = secondToken;
|
|
66819
|
-
}
|
|
66820
|
-
return editOperations;
|
|
66821
|
-
}
|
|
66822
|
-
function repeat(s, count) {
|
|
66823
|
-
var result = '';
|
|
66824
|
-
for (var i = 0; i < count; i++) {
|
|
66825
|
-
result += s;
|
|
66826
|
-
}
|
|
66827
|
-
return result;
|
|
66828
|
-
}
|
|
66829
|
-
function computeIndentLevel(content, options) {
|
|
66830
|
-
var i = 0;
|
|
66831
|
-
var nChars = 0;
|
|
66832
|
-
var tabSize = options.tabSize || 4;
|
|
66833
|
-
while (i < content.length) {
|
|
66834
|
-
var ch = content.charAt(i);
|
|
66835
|
-
if (ch === ' ') {
|
|
66836
|
-
nChars++;
|
|
66837
|
-
}
|
|
66838
|
-
else if (ch === '\t') {
|
|
66839
|
-
nChars += tabSize;
|
|
66840
|
-
}
|
|
66841
|
-
else {
|
|
66842
|
-
break;
|
|
66843
|
-
}
|
|
66844
|
-
i++;
|
|
66845
|
-
}
|
|
66846
|
-
return Math.floor(nChars / tabSize);
|
|
66847
|
-
}
|
|
66848
|
-
function getEOL(options, text) {
|
|
66849
|
-
for (var i = 0; i < text.length; i++) {
|
|
66850
|
-
var ch = text.charAt(i);
|
|
66851
|
-
if (ch === '\r') {
|
|
66852
|
-
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
|
66853
|
-
return '\r\n';
|
|
66854
|
-
}
|
|
66855
|
-
return '\r';
|
|
66856
|
-
}
|
|
66857
|
-
else if (ch === '\n') {
|
|
66858
|
-
return '\n';
|
|
66859
|
-
}
|
|
66860
|
-
}
|
|
66861
|
-
return (options && options.eol) || '\n';
|
|
66862
|
-
}
|
|
66863
|
-
function isEOL(text, offset) {
|
|
66864
|
-
return '\r\n'.indexOf(text.charAt(offset)) !== -1;
|
|
66865
|
-
}
|
|
66866
|
-
|
|
66867
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
66868
|
-
/*---------------------------------------------------------------------------------------------
|
|
66869
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
66870
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
66871
|
-
*--------------------------------------------------------------------------------------------*/
|
|
66872
|
-
|
|
66873
|
-
|
|
66874
|
-
var ParseOptions;
|
|
66875
|
-
(function (ParseOptions) {
|
|
66876
|
-
ParseOptions.DEFAULT = {
|
|
66877
|
-
allowTrailingComma: false
|
|
66878
|
-
};
|
|
66879
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
66880
|
-
/**
|
|
66881
|
-
* 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.
|
|
66882
|
-
*/
|
|
66883
|
-
function getLocation(text, position) {
|
|
66884
|
-
var segments = []; // strings or numbers
|
|
66885
|
-
var earlyReturnException = new Object();
|
|
66886
|
-
var previousNode = undefined;
|
|
66887
|
-
var previousNodeInst = {
|
|
66888
|
-
value: {},
|
|
66889
|
-
offset: 0,
|
|
66890
|
-
length: 0,
|
|
66891
|
-
type: 'object',
|
|
66892
|
-
parent: undefined
|
|
66893
|
-
};
|
|
66894
|
-
var isAtPropertyKey = false;
|
|
66895
|
-
function setPreviousNode(value, offset, length, type) {
|
|
66896
|
-
previousNodeInst.value = value;
|
|
66897
|
-
previousNodeInst.offset = offset;
|
|
66898
|
-
previousNodeInst.length = length;
|
|
66899
|
-
previousNodeInst.type = type;
|
|
66900
|
-
previousNodeInst.colonOffset = undefined;
|
|
66901
|
-
previousNode = previousNodeInst;
|
|
66902
|
-
}
|
|
66903
|
-
try {
|
|
66904
|
-
visit(text, {
|
|
66905
|
-
onObjectBegin: function (offset, length) {
|
|
66906
|
-
if (position <= offset) {
|
|
66907
|
-
throw earlyReturnException;
|
|
66908
|
-
}
|
|
66909
|
-
previousNode = undefined;
|
|
66910
|
-
isAtPropertyKey = position > offset;
|
|
66911
|
-
segments.push(''); // push a placeholder (will be replaced)
|
|
66912
|
-
},
|
|
66913
|
-
onObjectProperty: function (name, offset, length) {
|
|
66914
|
-
if (position < offset) {
|
|
66915
|
-
throw earlyReturnException;
|
|
66916
|
-
}
|
|
66917
|
-
setPreviousNode(name, offset, length, 'property');
|
|
66918
|
-
segments[segments.length - 1] = name;
|
|
66919
|
-
if (position <= offset + length) {
|
|
66920
|
-
throw earlyReturnException;
|
|
66921
|
-
}
|
|
66922
|
-
},
|
|
66923
|
-
onObjectEnd: function (offset, length) {
|
|
66924
|
-
if (position <= offset) {
|
|
66925
|
-
throw earlyReturnException;
|
|
66926
|
-
}
|
|
66927
|
-
previousNode = undefined;
|
|
66928
|
-
segments.pop();
|
|
66929
|
-
},
|
|
66930
|
-
onArrayBegin: function (offset, length) {
|
|
66931
|
-
if (position <= offset) {
|
|
66932
|
-
throw earlyReturnException;
|
|
66933
|
-
}
|
|
66934
|
-
previousNode = undefined;
|
|
66935
|
-
segments.push(0);
|
|
66936
|
-
},
|
|
66937
|
-
onArrayEnd: function (offset, length) {
|
|
66938
|
-
if (position <= offset) {
|
|
66939
|
-
throw earlyReturnException;
|
|
66940
|
-
}
|
|
66941
|
-
previousNode = undefined;
|
|
66942
|
-
segments.pop();
|
|
66943
|
-
},
|
|
66944
|
-
onLiteralValue: function (value, offset, length) {
|
|
66945
|
-
if (position < offset) {
|
|
66946
|
-
throw earlyReturnException;
|
|
66947
|
-
}
|
|
66948
|
-
setPreviousNode(value, offset, length, getNodeType(value));
|
|
66949
|
-
if (position <= offset + length) {
|
|
66950
|
-
throw earlyReturnException;
|
|
66951
|
-
}
|
|
66952
|
-
},
|
|
66953
|
-
onSeparator: function (sep, offset, length) {
|
|
66954
|
-
if (position <= offset) {
|
|
66955
|
-
throw earlyReturnException;
|
|
66956
|
-
}
|
|
66957
|
-
if (sep === ':' && previousNode && previousNode.type === 'property') {
|
|
66958
|
-
previousNode.colonOffset = offset;
|
|
66959
|
-
isAtPropertyKey = false;
|
|
66960
|
-
previousNode = undefined;
|
|
66961
|
-
}
|
|
66962
|
-
else if (sep === ',') {
|
|
66963
|
-
var last = segments[segments.length - 1];
|
|
66964
|
-
if (typeof last === 'number') {
|
|
66965
|
-
segments[segments.length - 1] = last + 1;
|
|
66966
|
-
}
|
|
66967
|
-
else {
|
|
66968
|
-
isAtPropertyKey = true;
|
|
66969
|
-
segments[segments.length - 1] = '';
|
|
66970
|
-
}
|
|
66971
|
-
previousNode = undefined;
|
|
66972
|
-
}
|
|
66973
|
-
}
|
|
66974
|
-
});
|
|
66975
|
-
}
|
|
66976
|
-
catch (e) {
|
|
66977
|
-
if (e !== earlyReturnException) {
|
|
66978
|
-
throw e;
|
|
66979
|
-
}
|
|
66980
|
-
}
|
|
66981
|
-
return {
|
|
66982
|
-
path: segments,
|
|
66983
|
-
previousNode: previousNode,
|
|
66984
|
-
isAtPropertyKey: isAtPropertyKey,
|
|
66985
|
-
matches: function (pattern) {
|
|
66986
|
-
var k = 0;
|
|
66987
|
-
for (var i = 0; k < pattern.length && i < segments.length; i++) {
|
|
66988
|
-
if (pattern[k] === segments[i] || pattern[k] === '*') {
|
|
66989
|
-
k++;
|
|
66990
|
-
}
|
|
66991
|
-
else if (pattern[k] !== '**') {
|
|
66992
|
-
return false;
|
|
66993
|
-
}
|
|
66994
|
-
}
|
|
66995
|
-
return k === pattern.length;
|
|
66996
|
-
}
|
|
66997
|
-
};
|
|
66998
|
-
}
|
|
66999
|
-
/**
|
|
67000
|
-
* 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.
|
|
67001
|
-
* Therefore always check the errors list to find out if the input was valid.
|
|
67002
|
-
*/
|
|
67003
|
-
function parse(text, errors, options) {
|
|
67004
|
-
if (errors === void 0) { errors = []; }
|
|
67005
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
67006
|
-
var currentProperty = null;
|
|
67007
|
-
var currentParent = [];
|
|
67008
|
-
var previousParents = [];
|
|
67009
|
-
function onValue(value) {
|
|
67010
|
-
if (Array.isArray(currentParent)) {
|
|
67011
|
-
currentParent.push(value);
|
|
67012
|
-
}
|
|
67013
|
-
else if (currentProperty !== null) {
|
|
67014
|
-
currentParent[currentProperty] = value;
|
|
67015
|
-
}
|
|
67016
|
-
}
|
|
67017
|
-
var visitor = {
|
|
67018
|
-
onObjectBegin: function () {
|
|
67019
|
-
var object = {};
|
|
67020
|
-
onValue(object);
|
|
67021
|
-
previousParents.push(currentParent);
|
|
67022
|
-
currentParent = object;
|
|
67023
|
-
currentProperty = null;
|
|
67024
|
-
},
|
|
67025
|
-
onObjectProperty: function (name) {
|
|
67026
|
-
currentProperty = name;
|
|
67027
|
-
},
|
|
67028
|
-
onObjectEnd: function () {
|
|
67029
|
-
currentParent = previousParents.pop();
|
|
67030
|
-
},
|
|
67031
|
-
onArrayBegin: function () {
|
|
67032
|
-
var array = [];
|
|
67033
|
-
onValue(array);
|
|
67034
|
-
previousParents.push(currentParent);
|
|
67035
|
-
currentParent = array;
|
|
67036
|
-
currentProperty = null;
|
|
67037
|
-
},
|
|
67038
|
-
onArrayEnd: function () {
|
|
67039
|
-
currentParent = previousParents.pop();
|
|
67040
|
-
},
|
|
67041
|
-
onLiteralValue: onValue,
|
|
67042
|
-
onError: function (error, offset, length) {
|
|
67043
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
67044
|
-
}
|
|
67045
|
-
};
|
|
67046
|
-
visit(text, visitor, options);
|
|
67047
|
-
return currentParent[0];
|
|
67048
|
-
}
|
|
67049
|
-
/**
|
|
67050
|
-
* 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.
|
|
67051
|
-
*/
|
|
67052
|
-
function parseTree(text, errors, options) {
|
|
67053
|
-
if (errors === void 0) { errors = []; }
|
|
67054
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
67055
|
-
var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root
|
|
67056
|
-
function ensurePropertyComplete(endOffset) {
|
|
67057
|
-
if (currentParent.type === 'property') {
|
|
67058
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
67059
|
-
currentParent = currentParent.parent;
|
|
67060
|
-
}
|
|
67061
|
-
}
|
|
67062
|
-
function onValue(valueNode) {
|
|
67063
|
-
currentParent.children.push(valueNode);
|
|
67064
|
-
return valueNode;
|
|
67065
|
-
}
|
|
67066
|
-
var visitor = {
|
|
67067
|
-
onObjectBegin: function (offset) {
|
|
67068
|
-
currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67069
|
-
},
|
|
67070
|
-
onObjectProperty: function (name, offset, length) {
|
|
67071
|
-
currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67072
|
-
currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });
|
|
67073
|
-
},
|
|
67074
|
-
onObjectEnd: function (offset, length) {
|
|
67075
|
-
ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete
|
|
67076
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
67077
|
-
currentParent = currentParent.parent;
|
|
67078
|
-
ensurePropertyComplete(offset + length);
|
|
67079
|
-
},
|
|
67080
|
-
onArrayBegin: function (offset, length) {
|
|
67081
|
-
currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
67082
|
-
},
|
|
67083
|
-
onArrayEnd: function (offset, length) {
|
|
67084
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
67085
|
-
currentParent = currentParent.parent;
|
|
67086
|
-
ensurePropertyComplete(offset + length);
|
|
67087
|
-
},
|
|
67088
|
-
onLiteralValue: function (value, offset, length) {
|
|
67089
|
-
onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value });
|
|
67090
|
-
ensurePropertyComplete(offset + length);
|
|
67091
|
-
},
|
|
67092
|
-
onSeparator: function (sep, offset, length) {
|
|
67093
|
-
if (currentParent.type === 'property') {
|
|
67094
|
-
if (sep === ':') {
|
|
67095
|
-
currentParent.colonOffset = offset;
|
|
67096
|
-
}
|
|
67097
|
-
else if (sep === ',') {
|
|
67098
|
-
ensurePropertyComplete(offset);
|
|
67099
|
-
}
|
|
67100
|
-
}
|
|
67101
|
-
},
|
|
67102
|
-
onError: function (error, offset, length) {
|
|
67103
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
67104
|
-
}
|
|
67105
|
-
};
|
|
67106
|
-
visit(text, visitor, options);
|
|
67107
|
-
var result = currentParent.children[0];
|
|
67108
|
-
if (result) {
|
|
67109
|
-
delete result.parent;
|
|
67110
|
-
}
|
|
67111
|
-
return result;
|
|
67112
|
-
}
|
|
67113
|
-
/**
|
|
67114
|
-
* Finds the node at the given path in a JSON DOM.
|
|
67115
|
-
*/
|
|
67116
|
-
function findNodeAtLocation(root, path) {
|
|
67117
|
-
if (!root) {
|
|
67118
|
-
return undefined;
|
|
67119
|
-
}
|
|
67120
|
-
var node = root;
|
|
67121
|
-
for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
|
|
67122
|
-
var segment = path_1[_i];
|
|
67123
|
-
if (typeof segment === 'string') {
|
|
67124
|
-
if (node.type !== 'object' || !Array.isArray(node.children)) {
|
|
67125
|
-
return undefined;
|
|
67126
|
-
}
|
|
67127
|
-
var found = false;
|
|
67128
|
-
for (var _a = 0, _b = node.children; _a < _b.length; _a++) {
|
|
67129
|
-
var propertyNode = _b[_a];
|
|
67130
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
|
|
67131
|
-
node = propertyNode.children[1];
|
|
67132
|
-
found = true;
|
|
67133
|
-
break;
|
|
67134
|
-
}
|
|
67135
|
-
}
|
|
67136
|
-
if (!found) {
|
|
67137
|
-
return undefined;
|
|
67138
|
-
}
|
|
67139
|
-
}
|
|
67140
|
-
else {
|
|
67141
|
-
var index = segment;
|
|
67142
|
-
if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
67143
|
-
return undefined;
|
|
67144
|
-
}
|
|
67145
|
-
node = node.children[index];
|
|
67146
|
-
}
|
|
67147
|
-
}
|
|
67148
|
-
return node;
|
|
67149
|
-
}
|
|
67150
|
-
/**
|
|
67151
|
-
* Gets the JSON path of the given JSON DOM node
|
|
67152
|
-
*/
|
|
67153
|
-
function getNodePath(node) {
|
|
67154
|
-
if (!node.parent || !node.parent.children) {
|
|
67155
|
-
return [];
|
|
67156
|
-
}
|
|
67157
|
-
var path = getNodePath(node.parent);
|
|
67158
|
-
if (node.parent.type === 'property') {
|
|
67159
|
-
var key = node.parent.children[0].value;
|
|
67160
|
-
path.push(key);
|
|
67161
|
-
}
|
|
67162
|
-
else if (node.parent.type === 'array') {
|
|
67163
|
-
var index = node.parent.children.indexOf(node);
|
|
67164
|
-
if (index !== -1) {
|
|
67165
|
-
path.push(index);
|
|
67166
|
-
}
|
|
67167
|
-
}
|
|
67168
|
-
return path;
|
|
67169
|
-
}
|
|
67170
|
-
/**
|
|
67171
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
67172
|
-
*/
|
|
67173
|
-
function getNodeValue(node) {
|
|
67174
|
-
switch (node.type) {
|
|
67175
|
-
case 'array':
|
|
67176
|
-
return node.children.map(getNodeValue);
|
|
67177
|
-
case 'object':
|
|
67178
|
-
var obj = Object.create(null);
|
|
67179
|
-
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
|
67180
|
-
var prop = _a[_i];
|
|
67181
|
-
var valueNode = prop.children[1];
|
|
67182
|
-
if (valueNode) {
|
|
67183
|
-
obj[prop.children[0].value] = getNodeValue(valueNode);
|
|
67184
|
-
}
|
|
67185
|
-
}
|
|
67186
|
-
return obj;
|
|
67187
|
-
case 'null':
|
|
67188
|
-
case 'string':
|
|
67189
|
-
case 'number':
|
|
67190
|
-
case 'boolean':
|
|
67191
|
-
return node.value;
|
|
67192
|
-
default:
|
|
67193
|
-
return undefined;
|
|
67194
|
-
}
|
|
67195
|
-
}
|
|
67196
|
-
function contains(node, offset, includeRightBound) {
|
|
67197
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
67198
|
-
return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));
|
|
67199
|
-
}
|
|
67200
|
-
/**
|
|
67201
|
-
* Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
67202
|
-
*/
|
|
67203
|
-
function findNodeAtOffset(node, offset, includeRightBound) {
|
|
67204
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
67205
|
-
if (contains(node, offset, includeRightBound)) {
|
|
67206
|
-
var children = node.children;
|
|
67207
|
-
if (Array.isArray(children)) {
|
|
67208
|
-
for (var i = 0; i < children.length && children[i].offset <= offset; i++) {
|
|
67209
|
-
var item = findNodeAtOffset(children[i], offset, includeRightBound);
|
|
67210
|
-
if (item) {
|
|
67211
|
-
return item;
|
|
67212
|
-
}
|
|
67213
|
-
}
|
|
67214
|
-
}
|
|
67215
|
-
return node;
|
|
67216
|
-
}
|
|
67217
|
-
return undefined;
|
|
67218
|
-
}
|
|
67219
|
-
/**
|
|
67220
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
67221
|
-
*/
|
|
67222
|
-
function visit(text, visitor, options) {
|
|
67223
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
67224
|
-
var _scanner = createScanner(text, false);
|
|
67225
|
-
function toNoArgVisit(visitFunction) {
|
|
67226
|
-
return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
67227
|
-
}
|
|
67228
|
-
function toOneArgVisit(visitFunction) {
|
|
67229
|
-
return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
67230
|
-
}
|
|
67231
|
-
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);
|
|
67232
|
-
var disallowComments = options && options.disallowComments;
|
|
67233
|
-
var allowTrailingComma = options && options.allowTrailingComma;
|
|
67234
|
-
function scanNext() {
|
|
67235
|
-
while (true) {
|
|
67236
|
-
var token = _scanner.scan();
|
|
67237
|
-
switch (_scanner.getTokenError()) {
|
|
67238
|
-
case 4 /* InvalidUnicode */:
|
|
67239
|
-
handleError(14 /* InvalidUnicode */);
|
|
67240
|
-
break;
|
|
67241
|
-
case 5 /* InvalidEscapeCharacter */:
|
|
67242
|
-
handleError(15 /* InvalidEscapeCharacter */);
|
|
67243
|
-
break;
|
|
67244
|
-
case 3 /* UnexpectedEndOfNumber */:
|
|
67245
|
-
handleError(13 /* UnexpectedEndOfNumber */);
|
|
67246
|
-
break;
|
|
67247
|
-
case 1 /* UnexpectedEndOfComment */:
|
|
67248
|
-
if (!disallowComments) {
|
|
67249
|
-
handleError(11 /* UnexpectedEndOfComment */);
|
|
67250
|
-
}
|
|
67251
|
-
break;
|
|
67252
|
-
case 2 /* UnexpectedEndOfString */:
|
|
67253
|
-
handleError(12 /* UnexpectedEndOfString */);
|
|
67254
|
-
break;
|
|
67255
|
-
case 6 /* InvalidCharacter */:
|
|
67256
|
-
handleError(16 /* InvalidCharacter */);
|
|
67257
|
-
break;
|
|
67258
|
-
}
|
|
67259
|
-
switch (token) {
|
|
67260
|
-
case 12 /* LineCommentTrivia */:
|
|
67261
|
-
case 13 /* BlockCommentTrivia */:
|
|
67262
|
-
if (disallowComments) {
|
|
67263
|
-
handleError(10 /* InvalidCommentToken */);
|
|
67264
|
-
}
|
|
67265
|
-
else {
|
|
67266
|
-
onComment();
|
|
67267
|
-
}
|
|
67268
|
-
break;
|
|
67269
|
-
case 16 /* Unknown */:
|
|
67270
|
-
handleError(1 /* InvalidSymbol */);
|
|
67271
|
-
break;
|
|
67272
|
-
case 15 /* Trivia */:
|
|
67273
|
-
case 14 /* LineBreakTrivia */:
|
|
67274
|
-
break;
|
|
67275
|
-
default:
|
|
67276
|
-
return token;
|
|
67277
|
-
}
|
|
67278
|
-
}
|
|
67279
|
-
}
|
|
67280
|
-
function handleError(error, skipUntilAfter, skipUntil) {
|
|
67281
|
-
if (skipUntilAfter === void 0) { skipUntilAfter = []; }
|
|
67282
|
-
if (skipUntil === void 0) { skipUntil = []; }
|
|
67283
|
-
onError(error);
|
|
67284
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
67285
|
-
var token = _scanner.getToken();
|
|
67286
|
-
while (token !== 17 /* EOF */) {
|
|
67287
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
67288
|
-
scanNext();
|
|
67289
|
-
break;
|
|
67290
|
-
}
|
|
67291
|
-
else if (skipUntil.indexOf(token) !== -1) {
|
|
67292
|
-
break;
|
|
67293
|
-
}
|
|
67294
|
-
token = scanNext();
|
|
67295
|
-
}
|
|
67296
|
-
}
|
|
67297
|
-
}
|
|
67298
|
-
function parseString(isValue) {
|
|
67299
|
-
var value = _scanner.getTokenValue();
|
|
67300
|
-
if (isValue) {
|
|
67301
|
-
onLiteralValue(value);
|
|
67302
|
-
}
|
|
67303
|
-
else {
|
|
67304
|
-
onObjectProperty(value);
|
|
67305
|
-
}
|
|
67306
|
-
scanNext();
|
|
67307
|
-
return true;
|
|
67308
|
-
}
|
|
67309
|
-
function parseLiteral() {
|
|
67310
|
-
switch (_scanner.getToken()) {
|
|
67311
|
-
case 11 /* NumericLiteral */:
|
|
67312
|
-
var tokenValue = _scanner.getTokenValue();
|
|
67313
|
-
var value = Number(tokenValue);
|
|
67314
|
-
if (isNaN(value)) {
|
|
67315
|
-
handleError(2 /* InvalidNumberFormat */);
|
|
67316
|
-
value = 0;
|
|
67317
|
-
}
|
|
67318
|
-
onLiteralValue(value);
|
|
67319
|
-
break;
|
|
67320
|
-
case 7 /* NullKeyword */:
|
|
67321
|
-
onLiteralValue(null);
|
|
67322
|
-
break;
|
|
67323
|
-
case 8 /* TrueKeyword */:
|
|
67324
|
-
onLiteralValue(true);
|
|
67325
|
-
break;
|
|
67326
|
-
case 9 /* FalseKeyword */:
|
|
67327
|
-
onLiteralValue(false);
|
|
67328
|
-
break;
|
|
67329
|
-
default:
|
|
67330
|
-
return false;
|
|
67331
|
-
}
|
|
67332
|
-
scanNext();
|
|
67333
|
-
return true;
|
|
67334
|
-
}
|
|
67335
|
-
function parseProperty() {
|
|
67336
|
-
if (_scanner.getToken() !== 10 /* StringLiteral */) {
|
|
67337
|
-
handleError(3 /* PropertyNameExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
67338
|
-
return false;
|
|
67339
|
-
}
|
|
67340
|
-
parseString(false);
|
|
67341
|
-
if (_scanner.getToken() === 6 /* ColonToken */) {
|
|
67342
|
-
onSeparator(':');
|
|
67343
|
-
scanNext(); // consume colon
|
|
67344
|
-
if (!parseValue()) {
|
|
67345
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
67346
|
-
}
|
|
67347
|
-
}
|
|
67348
|
-
else {
|
|
67349
|
-
handleError(5 /* ColonExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
67350
|
-
}
|
|
67351
|
-
return true;
|
|
67352
|
-
}
|
|
67353
|
-
function parseObject() {
|
|
67354
|
-
onObjectBegin();
|
|
67355
|
-
scanNext(); // consume open brace
|
|
67356
|
-
var needsComma = false;
|
|
67357
|
-
while (_scanner.getToken() !== 2 /* CloseBraceToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
67358
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
67359
|
-
if (!needsComma) {
|
|
67360
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
67361
|
-
}
|
|
67362
|
-
onSeparator(',');
|
|
67363
|
-
scanNext(); // consume comma
|
|
67364
|
-
if (_scanner.getToken() === 2 /* CloseBraceToken */ && allowTrailingComma) {
|
|
67365
|
-
break;
|
|
67366
|
-
}
|
|
67367
|
-
}
|
|
67368
|
-
else if (needsComma) {
|
|
67369
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
67370
|
-
}
|
|
67371
|
-
if (!parseProperty()) {
|
|
67372
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
67373
|
-
}
|
|
67374
|
-
needsComma = true;
|
|
67375
|
-
}
|
|
67376
|
-
onObjectEnd();
|
|
67377
|
-
if (_scanner.getToken() !== 2 /* CloseBraceToken */) {
|
|
67378
|
-
handleError(7 /* CloseBraceExpected */, [2 /* CloseBraceToken */], []);
|
|
67379
|
-
}
|
|
67380
|
-
else {
|
|
67381
|
-
scanNext(); // consume close brace
|
|
67382
|
-
}
|
|
67383
|
-
return true;
|
|
67384
|
-
}
|
|
67385
|
-
function parseArray() {
|
|
67386
|
-
onArrayBegin();
|
|
67387
|
-
scanNext(); // consume open bracket
|
|
67388
|
-
var needsComma = false;
|
|
67389
|
-
while (_scanner.getToken() !== 4 /* CloseBracketToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
67390
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
67391
|
-
if (!needsComma) {
|
|
67392
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
67393
|
-
}
|
|
67394
|
-
onSeparator(',');
|
|
67395
|
-
scanNext(); // consume comma
|
|
67396
|
-
if (_scanner.getToken() === 4 /* CloseBracketToken */ && allowTrailingComma) {
|
|
67397
|
-
break;
|
|
67398
|
-
}
|
|
67399
|
-
}
|
|
67400
|
-
else if (needsComma) {
|
|
67401
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
67402
|
-
}
|
|
67403
|
-
if (!parseValue()) {
|
|
67404
|
-
handleError(4 /* ValueExpected */, [], [4 /* CloseBracketToken */, 5 /* CommaToken */]);
|
|
67405
|
-
}
|
|
67406
|
-
needsComma = true;
|
|
67407
|
-
}
|
|
67408
|
-
onArrayEnd();
|
|
67409
|
-
if (_scanner.getToken() !== 4 /* CloseBracketToken */) {
|
|
67410
|
-
handleError(8 /* CloseBracketExpected */, [4 /* CloseBracketToken */], []);
|
|
67411
|
-
}
|
|
67412
|
-
else {
|
|
67413
|
-
scanNext(); // consume close bracket
|
|
67414
|
-
}
|
|
67415
|
-
return true;
|
|
67416
|
-
}
|
|
67417
|
-
function parseValue() {
|
|
67418
|
-
switch (_scanner.getToken()) {
|
|
67419
|
-
case 3 /* OpenBracketToken */:
|
|
67420
|
-
return parseArray();
|
|
67421
|
-
case 1 /* OpenBraceToken */:
|
|
67422
|
-
return parseObject();
|
|
67423
|
-
case 10 /* StringLiteral */:
|
|
67424
|
-
return parseString(true);
|
|
67425
|
-
default:
|
|
67426
|
-
return parseLiteral();
|
|
67427
|
-
}
|
|
67428
|
-
}
|
|
67429
|
-
scanNext();
|
|
67430
|
-
if (_scanner.getToken() === 17 /* EOF */) {
|
|
67431
|
-
if (options.allowEmptyContent) {
|
|
67432
|
-
return true;
|
|
67433
|
-
}
|
|
67434
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
67435
|
-
return false;
|
|
67436
|
-
}
|
|
67437
|
-
if (!parseValue()) {
|
|
67438
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
67439
|
-
return false;
|
|
67440
|
-
}
|
|
67441
|
-
if (_scanner.getToken() !== 17 /* EOF */) {
|
|
67442
|
-
handleError(9 /* EndOfFileExpected */, [], []);
|
|
67443
|
-
}
|
|
67444
|
-
return true;
|
|
67445
|
-
}
|
|
67446
|
-
/**
|
|
67447
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
67448
|
-
* them. Optionally replaces every none-newline character
|
|
67449
|
-
* of comments with a replaceCharacter
|
|
67450
|
-
*/
|
|
67451
|
-
function stripComments(text, replaceCh) {
|
|
67452
|
-
var _scanner = createScanner(text), parts = [], kind, offset = 0, pos;
|
|
67453
|
-
do {
|
|
67454
|
-
pos = _scanner.getPosition();
|
|
67455
|
-
kind = _scanner.scan();
|
|
67456
|
-
switch (kind) {
|
|
67457
|
-
case 12 /* LineCommentTrivia */:
|
|
67458
|
-
case 13 /* BlockCommentTrivia */:
|
|
67459
|
-
case 17 /* EOF */:
|
|
67460
|
-
if (offset !== pos) {
|
|
67461
|
-
parts.push(text.substring(offset, pos));
|
|
67462
|
-
}
|
|
67463
|
-
if (replaceCh !== undefined) {
|
|
67464
|
-
parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
|
|
67465
|
-
}
|
|
67466
|
-
offset = _scanner.getPosition();
|
|
67467
|
-
break;
|
|
67468
|
-
}
|
|
67469
|
-
} while (kind !== 17 /* EOF */);
|
|
67470
|
-
return parts.join('');
|
|
67471
|
-
}
|
|
67472
|
-
function getNodeType(value) {
|
|
67473
|
-
switch (typeof value) {
|
|
67474
|
-
case 'boolean': return 'boolean';
|
|
67475
|
-
case 'number': return 'number';
|
|
67476
|
-
case 'string': return 'string';
|
|
67477
|
-
case 'object': {
|
|
67478
|
-
if (!value) {
|
|
67479
|
-
return 'null';
|
|
67480
|
-
}
|
|
67481
|
-
else if (Array.isArray(value)) {
|
|
67482
|
-
return 'array';
|
|
67483
|
-
}
|
|
67484
|
-
return 'object';
|
|
67485
|
-
}
|
|
67486
|
-
default: return 'null';
|
|
67487
|
-
}
|
|
67488
|
-
}
|
|
67489
|
-
|
|
67490
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
67491
|
-
/*---------------------------------------------------------------------------------------------
|
|
67492
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
67493
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
67494
|
-
*--------------------------------------------------------------------------------------------*/
|
|
67495
|
-
|
|
67496
|
-
|
|
67497
|
-
|
|
67498
|
-
function removeProperty(text, path, options) {
|
|
67499
|
-
return setProperty(text, path, void 0, options);
|
|
67500
|
-
}
|
|
67501
|
-
function setProperty(text, originalPath, value, options) {
|
|
67502
|
-
var _a;
|
|
67503
|
-
var path = originalPath.slice();
|
|
67504
|
-
var errors = [];
|
|
67505
|
-
var root = parseTree(text, errors);
|
|
67506
|
-
var parent = void 0;
|
|
67507
|
-
var lastSegment = void 0;
|
|
67508
|
-
while (path.length > 0) {
|
|
67509
|
-
lastSegment = path.pop();
|
|
67510
|
-
parent = findNodeAtLocation(root, path);
|
|
67511
|
-
if (parent === void 0 && value !== void 0) {
|
|
67512
|
-
if (typeof lastSegment === 'string') {
|
|
67513
|
-
value = (_a = {}, _a[lastSegment] = value, _a);
|
|
67514
|
-
}
|
|
67515
|
-
else {
|
|
67516
|
-
value = [value];
|
|
67517
|
-
}
|
|
67518
|
-
}
|
|
67519
|
-
else {
|
|
67520
|
-
break;
|
|
67521
|
-
}
|
|
67522
|
-
}
|
|
67523
|
-
if (!parent) {
|
|
67524
|
-
// empty document
|
|
67525
|
-
if (value === void 0) { // delete
|
|
67526
|
-
throw new Error('Can not delete in empty document');
|
|
67527
|
-
}
|
|
67528
|
-
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
67529
|
-
}
|
|
67530
|
-
else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {
|
|
67531
|
-
var existing = findNodeAtLocation(parent, [lastSegment]);
|
|
67532
|
-
if (existing !== void 0) {
|
|
67533
|
-
if (value === void 0) { // delete
|
|
67534
|
-
if (!existing.parent) {
|
|
67535
|
-
throw new Error('Malformed AST');
|
|
67536
|
-
}
|
|
67537
|
-
var propertyIndex = parent.children.indexOf(existing.parent);
|
|
67538
|
-
var removeBegin = void 0;
|
|
67539
|
-
var removeEnd = existing.parent.offset + existing.parent.length;
|
|
67540
|
-
if (propertyIndex > 0) {
|
|
67541
|
-
// remove the comma of the previous node
|
|
67542
|
-
var previous = parent.children[propertyIndex - 1];
|
|
67543
|
-
removeBegin = previous.offset + previous.length;
|
|
67544
|
-
}
|
|
67545
|
-
else {
|
|
67546
|
-
removeBegin = parent.offset + 1;
|
|
67547
|
-
if (parent.children.length > 1) {
|
|
67548
|
-
// remove the comma of the next node
|
|
67549
|
-
var next = parent.children[1];
|
|
67550
|
-
removeEnd = next.offset;
|
|
67551
|
-
}
|
|
67552
|
-
}
|
|
67553
|
-
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options);
|
|
67554
|
-
}
|
|
67555
|
-
else {
|
|
67556
|
-
// set value of existing property
|
|
67557
|
-
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
67558
|
-
}
|
|
67559
|
-
}
|
|
67560
|
-
else {
|
|
67561
|
-
if (value === void 0) { // delete
|
|
67562
|
-
return []; // property does not exist, nothing to do
|
|
67563
|
-
}
|
|
67564
|
-
var newProperty = JSON.stringify(lastSegment) + ": " + JSON.stringify(value);
|
|
67565
|
-
var index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(function (p) { return p.children[0].value; })) : parent.children.length;
|
|
67566
|
-
var edit = void 0;
|
|
67567
|
-
if (index > 0) {
|
|
67568
|
-
var previous = parent.children[index - 1];
|
|
67569
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
67570
|
-
}
|
|
67571
|
-
else if (parent.children.length === 0) {
|
|
67572
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
67573
|
-
}
|
|
67574
|
-
else {
|
|
67575
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };
|
|
67576
|
-
}
|
|
67577
|
-
return withFormatting(text, edit, options);
|
|
67578
|
-
}
|
|
67579
|
-
}
|
|
67580
|
-
else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {
|
|
67581
|
-
var insertIndex = lastSegment;
|
|
67582
|
-
if (insertIndex === -1) {
|
|
67583
|
-
// Insert
|
|
67584
|
-
var newProperty = "" + JSON.stringify(value);
|
|
67585
|
-
var edit = void 0;
|
|
67586
|
-
if (parent.children.length === 0) {
|
|
67587
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
67588
|
-
}
|
|
67589
|
-
else {
|
|
67590
|
-
var previous = parent.children[parent.children.length - 1];
|
|
67591
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
67592
|
-
}
|
|
67593
|
-
return withFormatting(text, edit, options);
|
|
67594
|
-
}
|
|
67595
|
-
else if (value === void 0 && parent.children.length >= 0) {
|
|
67596
|
-
// Removal
|
|
67597
|
-
var removalIndex = lastSegment;
|
|
67598
|
-
var toRemove = parent.children[removalIndex];
|
|
67599
|
-
var edit = void 0;
|
|
67600
|
-
if (parent.children.length === 1) {
|
|
67601
|
-
// only item
|
|
67602
|
-
edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };
|
|
67603
|
-
}
|
|
67604
|
-
else if (parent.children.length - 1 === removalIndex) {
|
|
67605
|
-
// last item
|
|
67606
|
-
var previous = parent.children[removalIndex - 1];
|
|
67607
|
-
var offset = previous.offset + previous.length;
|
|
67608
|
-
var parentEndOffset = parent.offset + parent.length;
|
|
67609
|
-
edit = { offset: offset, length: parentEndOffset - 2 - offset, content: '' };
|
|
67610
|
-
}
|
|
67611
|
-
else {
|
|
67612
|
-
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };
|
|
67613
|
-
}
|
|
67614
|
-
return withFormatting(text, edit, options);
|
|
67615
|
-
}
|
|
67616
|
-
else if (value !== void 0) {
|
|
67617
|
-
var edit = void 0;
|
|
67618
|
-
var newProperty = "" + JSON.stringify(value);
|
|
67619
|
-
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
67620
|
-
var toModify = parent.children[lastSegment];
|
|
67621
|
-
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
67622
|
-
}
|
|
67623
|
-
else if (parent.children.length === 0 || lastSegment === 0) {
|
|
67624
|
-
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };
|
|
67625
|
-
}
|
|
67626
|
-
else {
|
|
67627
|
-
var index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
67628
|
-
var previous = parent.children[index - 1];
|
|
67629
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
67630
|
-
}
|
|
67631
|
-
return withFormatting(text, edit, options);
|
|
67632
|
-
}
|
|
67633
|
-
else {
|
|
67634
|
-
throw new Error("Can not " + (value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')) + " Array index " + insertIndex + " as length is not sufficient");
|
|
67635
|
-
}
|
|
67636
|
-
}
|
|
67637
|
-
else {
|
|
67638
|
-
throw new Error("Can not add " + (typeof lastSegment !== 'number' ? 'index' : 'property') + " to parent of type " + parent.type);
|
|
67639
|
-
}
|
|
67640
|
-
}
|
|
67641
|
-
function withFormatting(text, edit, options) {
|
|
67642
|
-
if (!options.formattingOptions) {
|
|
67643
|
-
return [edit];
|
|
67644
|
-
}
|
|
67645
|
-
// apply the edit
|
|
67646
|
-
var newText = applyEdit(text, edit);
|
|
67647
|
-
// format the new text
|
|
67648
|
-
var begin = edit.offset;
|
|
67649
|
-
var end = edit.offset + edit.content.length;
|
|
67650
|
-
if (edit.length === 0 || edit.content.length === 0) { // insert or remove
|
|
67651
|
-
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
67652
|
-
begin--;
|
|
67653
|
-
}
|
|
67654
|
-
while (end < newText.length && !isEOL(newText, end)) {
|
|
67655
|
-
end++;
|
|
67656
|
-
}
|
|
67657
|
-
}
|
|
67658
|
-
var edits = format(newText, { offset: begin, length: end - begin }, options.formattingOptions);
|
|
67659
|
-
// apply the formatting edits and track the begin and end offsets of the changes
|
|
67660
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
67661
|
-
var edit_1 = edits[i];
|
|
67662
|
-
newText = applyEdit(newText, edit_1);
|
|
67663
|
-
begin = Math.min(begin, edit_1.offset);
|
|
67664
|
-
end = Math.max(end, edit_1.offset + edit_1.length);
|
|
67665
|
-
end += edit_1.content.length - edit_1.length;
|
|
67666
|
-
}
|
|
67667
|
-
// create a single edit with all changes
|
|
67668
|
-
var editLength = text.length - (newText.length - end) - begin;
|
|
67669
|
-
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
67670
|
-
}
|
|
67671
|
-
function applyEdit(text, edit) {
|
|
67672
|
-
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
67673
|
-
}
|
|
67674
|
-
function isWS(text, offset) {
|
|
67675
|
-
return '\r\n \t'.indexOf(text.charAt(offset)) !== -1;
|
|
67676
|
-
}
|
|
67677
|
-
|
|
67678
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/main.js
|
|
67679
|
-
/*---------------------------------------------------------------------------------------------
|
|
67680
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
67681
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
67682
|
-
*--------------------------------------------------------------------------------------------*/
|
|
67683
|
-
|
|
67684
|
-
|
|
67685
|
-
|
|
67686
|
-
|
|
67687
|
-
|
|
67688
|
-
/**
|
|
67689
|
-
* Creates a JSON scanner on the given text.
|
|
67690
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
67691
|
-
*/
|
|
67692
|
-
var main_createScanner = createScanner;
|
|
67693
|
-
/**
|
|
67694
|
-
* 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.
|
|
67695
|
-
*/
|
|
67696
|
-
var main_getLocation = getLocation;
|
|
67697
|
-
/**
|
|
67698
|
-
* 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.
|
|
67699
|
-
* Therefore, always check the errors list to find out if the input was valid.
|
|
67700
|
-
*/
|
|
67701
|
-
var main_parse = parse;
|
|
67702
|
-
/**
|
|
67703
|
-
* 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.
|
|
67704
|
-
*/
|
|
67705
|
-
var main_parseTree = parseTree;
|
|
67706
|
-
/**
|
|
67707
|
-
* Finds the node at the given path in a JSON DOM.
|
|
67708
|
-
*/
|
|
67709
|
-
var main_findNodeAtLocation = findNodeAtLocation;
|
|
67710
|
-
/**
|
|
67711
|
-
* Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
67712
|
-
*/
|
|
67713
|
-
var main_findNodeAtOffset = findNodeAtOffset;
|
|
67714
|
-
/**
|
|
67715
|
-
* Gets the JSON path of the given JSON DOM node
|
|
67716
|
-
*/
|
|
67717
|
-
var main_getNodePath = getNodePath;
|
|
67718
|
-
/**
|
|
67719
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
67720
|
-
*/
|
|
67721
|
-
var main_getNodeValue = getNodeValue;
|
|
67722
|
-
/**
|
|
67723
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
67724
|
-
*/
|
|
67725
|
-
var main_visit = visit;
|
|
67726
|
-
/**
|
|
67727
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
67728
|
-
* them. Optionally replaces every none-newline character
|
|
67729
|
-
* of comments with a replaceCharacter
|
|
67730
|
-
*/
|
|
67731
|
-
var main_stripComments = stripComments;
|
|
67732
|
-
function printParseErrorCode(code) {
|
|
67733
|
-
switch (code) {
|
|
67734
|
-
case 1 /* InvalidSymbol */: return 'InvalidSymbol';
|
|
67735
|
-
case 2 /* InvalidNumberFormat */: return 'InvalidNumberFormat';
|
|
67736
|
-
case 3 /* PropertyNameExpected */: return 'PropertyNameExpected';
|
|
67737
|
-
case 4 /* ValueExpected */: return 'ValueExpected';
|
|
67738
|
-
case 5 /* ColonExpected */: return 'ColonExpected';
|
|
67739
|
-
case 6 /* CommaExpected */: return 'CommaExpected';
|
|
67740
|
-
case 7 /* CloseBraceExpected */: return 'CloseBraceExpected';
|
|
67741
|
-
case 8 /* CloseBracketExpected */: return 'CloseBracketExpected';
|
|
67742
|
-
case 9 /* EndOfFileExpected */: return 'EndOfFileExpected';
|
|
67743
|
-
case 10 /* InvalidCommentToken */: return 'InvalidCommentToken';
|
|
67744
|
-
case 11 /* UnexpectedEndOfComment */: return 'UnexpectedEndOfComment';
|
|
67745
|
-
case 12 /* UnexpectedEndOfString */: return 'UnexpectedEndOfString';
|
|
67746
|
-
case 13 /* UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber';
|
|
67747
|
-
case 14 /* InvalidUnicode */: return 'InvalidUnicode';
|
|
67748
|
-
case 15 /* InvalidEscapeCharacter */: return 'InvalidEscapeCharacter';
|
|
67749
|
-
case 16 /* InvalidCharacter */: return 'InvalidCharacter';
|
|
67750
|
-
}
|
|
67751
|
-
return '<unknown ParseErrorCode>';
|
|
67752
|
-
}
|
|
67753
|
-
/**
|
|
67754
|
-
* Computes the edits needed to format a JSON document.
|
|
67755
|
-
*
|
|
67756
|
-
* @param documentText The input text
|
|
67757
|
-
* @param range The range to format or `undefined` to format the full content
|
|
67758
|
-
* @param options The formatting options
|
|
67759
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
67760
|
-
* 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
|
|
67761
|
-
* text in the original document. However, multiple edits can have
|
|
67762
|
-
* 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.
|
|
67763
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
67764
|
-
*/
|
|
67765
|
-
function main_format(documentText, range, options) {
|
|
67766
|
-
return format(documentText, range, options);
|
|
67767
|
-
}
|
|
67768
|
-
/**
|
|
67769
|
-
* Computes the edits needed to modify a value in the JSON document.
|
|
67770
|
-
*
|
|
67771
|
-
* @param documentText The input text
|
|
67772
|
-
* @param path The path of the value to change. The path represents either to the document root, a property or an array item.
|
|
67773
|
-
* If the path points to an non-existing property or item, it will be created.
|
|
67774
|
-
* @param value The new value for the specified property or item. If the value is undefined,
|
|
67775
|
-
* the property or item will be removed.
|
|
67776
|
-
* @param options Options
|
|
67777
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
67778
|
-
* 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
|
|
67779
|
-
* text in the original document. However, multiple edits can have
|
|
67780
|
-
* 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.
|
|
67781
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
67782
|
-
*/
|
|
67783
|
-
function modify(text, path, value, options) {
|
|
67784
|
-
return setProperty(text, path, value, options);
|
|
67785
|
-
}
|
|
67786
|
-
/**
|
|
67787
|
-
* Applies edits to a input string.
|
|
67788
|
-
*/
|
|
67789
|
-
function applyEdits(text, edits) {
|
|
67790
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
67791
|
-
text = applyEdit(text, edits[i]);
|
|
67792
|
-
}
|
|
67793
|
-
return text;
|
|
67794
|
-
}
|
|
67795
|
-
|
|
67796
|
-
|
|
67797
66323
|
/***/ }),
|
|
67798
66324
|
|
|
67799
66325
|
/***/ 47296:
|
|
@@ -117876,287 +116402,6 @@ function dumpException(ex)
|
|
|
117876
116402
|
}
|
|
117877
116403
|
|
|
117878
116404
|
|
|
117879
|
-
/***/ }),
|
|
117880
|
-
|
|
117881
|
-
/***/ 61096:
|
|
117882
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
117883
|
-
|
|
117884
|
-
"use strict";
|
|
117885
|
-
__webpack_require__.r(__webpack_exports__);
|
|
117886
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
117887
|
-
/* harmony export */ "TextDocument": () => (/* binding */ TextDocument)
|
|
117888
|
-
/* harmony export */ });
|
|
117889
|
-
/* --------------------------------------------------------------------------------------------
|
|
117890
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
117891
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
117892
|
-
* ------------------------------------------------------------------------------------------ */
|
|
117893
|
-
|
|
117894
|
-
var FullTextDocument = /** @class */ (function () {
|
|
117895
|
-
function FullTextDocument(uri, languageId, version, content) {
|
|
117896
|
-
this._uri = uri;
|
|
117897
|
-
this._languageId = languageId;
|
|
117898
|
-
this._version = version;
|
|
117899
|
-
this._content = content;
|
|
117900
|
-
this._lineOffsets = undefined;
|
|
117901
|
-
}
|
|
117902
|
-
Object.defineProperty(FullTextDocument.prototype, "uri", {
|
|
117903
|
-
get: function () {
|
|
117904
|
-
return this._uri;
|
|
117905
|
-
},
|
|
117906
|
-
enumerable: true,
|
|
117907
|
-
configurable: true
|
|
117908
|
-
});
|
|
117909
|
-
Object.defineProperty(FullTextDocument.prototype, "languageId", {
|
|
117910
|
-
get: function () {
|
|
117911
|
-
return this._languageId;
|
|
117912
|
-
},
|
|
117913
|
-
enumerable: true,
|
|
117914
|
-
configurable: true
|
|
117915
|
-
});
|
|
117916
|
-
Object.defineProperty(FullTextDocument.prototype, "version", {
|
|
117917
|
-
get: function () {
|
|
117918
|
-
return this._version;
|
|
117919
|
-
},
|
|
117920
|
-
enumerable: true,
|
|
117921
|
-
configurable: true
|
|
117922
|
-
});
|
|
117923
|
-
FullTextDocument.prototype.getText = function (range) {
|
|
117924
|
-
if (range) {
|
|
117925
|
-
var start = this.offsetAt(range.start);
|
|
117926
|
-
var end = this.offsetAt(range.end);
|
|
117927
|
-
return this._content.substring(start, end);
|
|
117928
|
-
}
|
|
117929
|
-
return this._content;
|
|
117930
|
-
};
|
|
117931
|
-
FullTextDocument.prototype.update = function (changes, version) {
|
|
117932
|
-
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
|
|
117933
|
-
var change = changes_1[_i];
|
|
117934
|
-
if (FullTextDocument.isIncremental(change)) {
|
|
117935
|
-
// makes sure start is before end
|
|
117936
|
-
var range = getWellformedRange(change.range);
|
|
117937
|
-
// update content
|
|
117938
|
-
var startOffset = this.offsetAt(range.start);
|
|
117939
|
-
var endOffset = this.offsetAt(range.end);
|
|
117940
|
-
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
|
|
117941
|
-
// update the offsets
|
|
117942
|
-
var startLine = Math.max(range.start.line, 0);
|
|
117943
|
-
var endLine = Math.max(range.end.line, 0);
|
|
117944
|
-
var lineOffsets = this._lineOffsets;
|
|
117945
|
-
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
|
|
117946
|
-
if (endLine - startLine === addedLineOffsets.length) {
|
|
117947
|
-
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
|
|
117948
|
-
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
|
|
117949
|
-
}
|
|
117950
|
-
}
|
|
117951
|
-
else {
|
|
117952
|
-
if (addedLineOffsets.length < 10000) {
|
|
117953
|
-
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
|
|
117954
|
-
}
|
|
117955
|
-
else { // avoid too many arguments for splice
|
|
117956
|
-
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
|
|
117957
|
-
}
|
|
117958
|
-
}
|
|
117959
|
-
var diff = change.text.length - (endOffset - startOffset);
|
|
117960
|
-
if (diff !== 0) {
|
|
117961
|
-
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
|
|
117962
|
-
lineOffsets[i] = lineOffsets[i] + diff;
|
|
117963
|
-
}
|
|
117964
|
-
}
|
|
117965
|
-
}
|
|
117966
|
-
else if (FullTextDocument.isFull(change)) {
|
|
117967
|
-
this._content = change.text;
|
|
117968
|
-
this._lineOffsets = undefined;
|
|
117969
|
-
}
|
|
117970
|
-
else {
|
|
117971
|
-
throw new Error('Unknown change event received');
|
|
117972
|
-
}
|
|
117973
|
-
}
|
|
117974
|
-
this._version = version;
|
|
117975
|
-
};
|
|
117976
|
-
FullTextDocument.prototype.getLineOffsets = function () {
|
|
117977
|
-
if (this._lineOffsets === undefined) {
|
|
117978
|
-
this._lineOffsets = computeLineOffsets(this._content, true);
|
|
117979
|
-
}
|
|
117980
|
-
return this._lineOffsets;
|
|
117981
|
-
};
|
|
117982
|
-
FullTextDocument.prototype.positionAt = function (offset) {
|
|
117983
|
-
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
117984
|
-
var lineOffsets = this.getLineOffsets();
|
|
117985
|
-
var low = 0, high = lineOffsets.length;
|
|
117986
|
-
if (high === 0) {
|
|
117987
|
-
return { line: 0, character: offset };
|
|
117988
|
-
}
|
|
117989
|
-
while (low < high) {
|
|
117990
|
-
var mid = Math.floor((low + high) / 2);
|
|
117991
|
-
if (lineOffsets[mid] > offset) {
|
|
117992
|
-
high = mid;
|
|
117993
|
-
}
|
|
117994
|
-
else {
|
|
117995
|
-
low = mid + 1;
|
|
117996
|
-
}
|
|
117997
|
-
}
|
|
117998
|
-
// low is the least x for which the line offset is larger than the current offset
|
|
117999
|
-
// or array.length if no line offset is larger than the current offset
|
|
118000
|
-
var line = low - 1;
|
|
118001
|
-
return { line: line, character: offset - lineOffsets[line] };
|
|
118002
|
-
};
|
|
118003
|
-
FullTextDocument.prototype.offsetAt = function (position) {
|
|
118004
|
-
var lineOffsets = this.getLineOffsets();
|
|
118005
|
-
if (position.line >= lineOffsets.length) {
|
|
118006
|
-
return this._content.length;
|
|
118007
|
-
}
|
|
118008
|
-
else if (position.line < 0) {
|
|
118009
|
-
return 0;
|
|
118010
|
-
}
|
|
118011
|
-
var lineOffset = lineOffsets[position.line];
|
|
118012
|
-
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
|
|
118013
|
-
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
|
118014
|
-
};
|
|
118015
|
-
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
|
|
118016
|
-
get: function () {
|
|
118017
|
-
return this.getLineOffsets().length;
|
|
118018
|
-
},
|
|
118019
|
-
enumerable: true,
|
|
118020
|
-
configurable: true
|
|
118021
|
-
});
|
|
118022
|
-
FullTextDocument.isIncremental = function (event) {
|
|
118023
|
-
var candidate = event;
|
|
118024
|
-
return candidate !== undefined && candidate !== null &&
|
|
118025
|
-
typeof candidate.text === 'string' && candidate.range !== undefined &&
|
|
118026
|
-
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
|
|
118027
|
-
};
|
|
118028
|
-
FullTextDocument.isFull = function (event) {
|
|
118029
|
-
var candidate = event;
|
|
118030
|
-
return candidate !== undefined && candidate !== null &&
|
|
118031
|
-
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
|
|
118032
|
-
};
|
|
118033
|
-
return FullTextDocument;
|
|
118034
|
-
}());
|
|
118035
|
-
var TextDocument;
|
|
118036
|
-
(function (TextDocument) {
|
|
118037
|
-
/**
|
|
118038
|
-
* Creates a new text document.
|
|
118039
|
-
*
|
|
118040
|
-
* @param uri The document's uri.
|
|
118041
|
-
* @param languageId The document's language Id.
|
|
118042
|
-
* @param version The document's initial version number.
|
|
118043
|
-
* @param content The document's content.
|
|
118044
|
-
*/
|
|
118045
|
-
function create(uri, languageId, version, content) {
|
|
118046
|
-
return new FullTextDocument(uri, languageId, version, content);
|
|
118047
|
-
}
|
|
118048
|
-
TextDocument.create = create;
|
|
118049
|
-
/**
|
|
118050
|
-
* Updates a TextDocument by modifing its content.
|
|
118051
|
-
*
|
|
118052
|
-
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
|
|
118053
|
-
* @param changes the changes to apply to the document.
|
|
118054
|
-
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
|
|
118055
|
-
*
|
|
118056
|
-
*/
|
|
118057
|
-
function update(document, changes, version) {
|
|
118058
|
-
if (document instanceof FullTextDocument) {
|
|
118059
|
-
document.update(changes, version);
|
|
118060
|
-
return document;
|
|
118061
|
-
}
|
|
118062
|
-
else {
|
|
118063
|
-
throw new Error('TextDocument.update: document must be created by TextDocument.create');
|
|
118064
|
-
}
|
|
118065
|
-
}
|
|
118066
|
-
TextDocument.update = update;
|
|
118067
|
-
function applyEdits(document, edits) {
|
|
118068
|
-
var text = document.getText();
|
|
118069
|
-
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
|
|
118070
|
-
var diff = a.range.start.line - b.range.start.line;
|
|
118071
|
-
if (diff === 0) {
|
|
118072
|
-
return a.range.start.character - b.range.start.character;
|
|
118073
|
-
}
|
|
118074
|
-
return diff;
|
|
118075
|
-
});
|
|
118076
|
-
var lastModifiedOffset = 0;
|
|
118077
|
-
var spans = [];
|
|
118078
|
-
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
|
|
118079
|
-
var e = sortedEdits_1[_i];
|
|
118080
|
-
var startOffset = document.offsetAt(e.range.start);
|
|
118081
|
-
if (startOffset < lastModifiedOffset) {
|
|
118082
|
-
throw new Error('Overlapping edit');
|
|
118083
|
-
}
|
|
118084
|
-
else if (startOffset > lastModifiedOffset) {
|
|
118085
|
-
spans.push(text.substring(lastModifiedOffset, startOffset));
|
|
118086
|
-
}
|
|
118087
|
-
if (e.newText.length) {
|
|
118088
|
-
spans.push(e.newText);
|
|
118089
|
-
}
|
|
118090
|
-
lastModifiedOffset = document.offsetAt(e.range.end);
|
|
118091
|
-
}
|
|
118092
|
-
spans.push(text.substr(lastModifiedOffset));
|
|
118093
|
-
return spans.join('');
|
|
118094
|
-
}
|
|
118095
|
-
TextDocument.applyEdits = applyEdits;
|
|
118096
|
-
})(TextDocument || (TextDocument = {}));
|
|
118097
|
-
function mergeSort(data, compare) {
|
|
118098
|
-
if (data.length <= 1) {
|
|
118099
|
-
// sorted
|
|
118100
|
-
return data;
|
|
118101
|
-
}
|
|
118102
|
-
var p = (data.length / 2) | 0;
|
|
118103
|
-
var left = data.slice(0, p);
|
|
118104
|
-
var right = data.slice(p);
|
|
118105
|
-
mergeSort(left, compare);
|
|
118106
|
-
mergeSort(right, compare);
|
|
118107
|
-
var leftIdx = 0;
|
|
118108
|
-
var rightIdx = 0;
|
|
118109
|
-
var i = 0;
|
|
118110
|
-
while (leftIdx < left.length && rightIdx < right.length) {
|
|
118111
|
-
var ret = compare(left[leftIdx], right[rightIdx]);
|
|
118112
|
-
if (ret <= 0) {
|
|
118113
|
-
// smaller_equal -> take left to preserve order
|
|
118114
|
-
data[i++] = left[leftIdx++];
|
|
118115
|
-
}
|
|
118116
|
-
else {
|
|
118117
|
-
// greater -> take right
|
|
118118
|
-
data[i++] = right[rightIdx++];
|
|
118119
|
-
}
|
|
118120
|
-
}
|
|
118121
|
-
while (leftIdx < left.length) {
|
|
118122
|
-
data[i++] = left[leftIdx++];
|
|
118123
|
-
}
|
|
118124
|
-
while (rightIdx < right.length) {
|
|
118125
|
-
data[i++] = right[rightIdx++];
|
|
118126
|
-
}
|
|
118127
|
-
return data;
|
|
118128
|
-
}
|
|
118129
|
-
function computeLineOffsets(text, isAtLineStart, textOffset) {
|
|
118130
|
-
if (textOffset === void 0) { textOffset = 0; }
|
|
118131
|
-
var result = isAtLineStart ? [textOffset] : [];
|
|
118132
|
-
for (var i = 0; i < text.length; i++) {
|
|
118133
|
-
var ch = text.charCodeAt(i);
|
|
118134
|
-
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
|
|
118135
|
-
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
|
|
118136
|
-
i++;
|
|
118137
|
-
}
|
|
118138
|
-
result.push(textOffset + i + 1);
|
|
118139
|
-
}
|
|
118140
|
-
}
|
|
118141
|
-
return result;
|
|
118142
|
-
}
|
|
118143
|
-
function getWellformedRange(range) {
|
|
118144
|
-
var start = range.start;
|
|
118145
|
-
var end = range.end;
|
|
118146
|
-
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
|
|
118147
|
-
return { start: end, end: start };
|
|
118148
|
-
}
|
|
118149
|
-
return range;
|
|
118150
|
-
}
|
|
118151
|
-
function getWellformedEdit(textEdit) {
|
|
118152
|
-
var range = getWellformedRange(textEdit.range);
|
|
118153
|
-
if (range !== textEdit.range) {
|
|
118154
|
-
return { newText: textEdit.newText, range: range };
|
|
118155
|
-
}
|
|
118156
|
-
return textEdit;
|
|
118157
|
-
}
|
|
118158
|
-
|
|
118159
|
-
|
|
118160
116405
|
/***/ }),
|
|
118161
116406
|
|
|
118162
116407
|
/***/ 26070:
|
|
@@ -128880,964 +127125,6 @@ exports.enableFeature = featureToggle_1.enableFeature;
|
|
|
128880
127125
|
exports.ExperimentalFeatures = featureToggle_1.ExperimentalFeatures;
|
|
128881
127126
|
|
|
128882
127127
|
|
|
128883
|
-
/***/ }),
|
|
128884
|
-
|
|
128885
|
-
/***/ 76241:
|
|
128886
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
128887
|
-
|
|
128888
|
-
"use strict";
|
|
128889
|
-
|
|
128890
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
128891
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
128892
|
-
};
|
|
128893
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
128894
|
-
const i18next_1 = __importDefault(__webpack_require__(83896));
|
|
128895
|
-
const i18n_json_1 = __importDefault(__webpack_require__(97992));
|
|
128896
|
-
exports.i18n = i18next_1.default.createInstance();
|
|
128897
|
-
/**
|
|
128898
|
-
* Initialize i18next of "@sap/ux-i18n-properties"
|
|
128899
|
-
*/
|
|
128900
|
-
async function initI18n() {
|
|
128901
|
-
await exports.i18n.init({
|
|
128902
|
-
resources: {
|
|
128903
|
-
en: {
|
|
128904
|
-
translation: i18n_json_1.default
|
|
128905
|
-
}
|
|
128906
|
-
},
|
|
128907
|
-
lng: 'en',
|
|
128908
|
-
fallbackLng: 'en',
|
|
128909
|
-
joinArrays: '\n\n'
|
|
128910
|
-
});
|
|
128911
|
-
}
|
|
128912
|
-
exports.initI18n = initI18n;
|
|
128913
|
-
|
|
128914
|
-
|
|
128915
|
-
/***/ }),
|
|
128916
|
-
|
|
128917
|
-
/***/ 55203:
|
|
128918
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
128919
|
-
|
|
128920
|
-
"use strict";
|
|
128921
|
-
|
|
128922
|
-
function __export(m) {
|
|
128923
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
128924
|
-
}
|
|
128925
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
128926
|
-
var properties_1 = __webpack_require__(47753);
|
|
128927
|
-
exports.geI18ntDocumentation = properties_1.geI18ntDocumentation;
|
|
128928
|
-
exports.loadPropertiesTexts = properties_1.loadPropertiesTexts;
|
|
128929
|
-
exports.printPropertiesFileI18nEntry = properties_1.printPropertiesFileI18nEntry;
|
|
128930
|
-
exports.printPropertiesFileI18nAnnotation = properties_1.printPropertiesFileI18nAnnotation;
|
|
128931
|
-
var lineOffsets_1 = __webpack_require__(4787);
|
|
128932
|
-
exports.getLineOffsets = lineOffsets_1.getLineOffsets;
|
|
128933
|
-
var text_1 = __webpack_require__(79910);
|
|
128934
|
-
exports.getI18nMaxLength = text_1.getI18nMaxLength;
|
|
128935
|
-
exports.getI18nTextType = text_1.getI18nTextType;
|
|
128936
|
-
var key_1 = __webpack_require__(75502);
|
|
128937
|
-
exports.extractI18nKey = key_1.extractI18nKey;
|
|
128938
|
-
exports.getI18nUniqueKey = key_1.getI18nUniqueKey;
|
|
128939
|
-
var textConverters_1 = __webpack_require__(83525);
|
|
128940
|
-
exports.convertToCamelCase = textConverters_1.convertToCamelCase;
|
|
128941
|
-
exports.convertToPascalCase = textConverters_1.convertToPascalCase;
|
|
128942
|
-
var position_1 = __webpack_require__(63787);
|
|
128943
|
-
exports.Position = position_1.Position;
|
|
128944
|
-
exports.Range = position_1.Range;
|
|
128945
|
-
var positionAt_1 = __webpack_require__(72372);
|
|
128946
|
-
exports.positionAt = positionAt_1.positionAt;
|
|
128947
|
-
exports.rangeAt = positionAt_1.rangeAt;
|
|
128948
|
-
__export(__webpack_require__(69338));
|
|
128949
|
-
var i18n_1 = __webpack_require__(76241);
|
|
128950
|
-
exports.initI18n = i18n_1.initI18n;
|
|
128951
|
-
exports.i18n = i18n_1.i18n;
|
|
128952
|
-
const i18n_2 = __webpack_require__(76241);
|
|
128953
|
-
// init i18n
|
|
128954
|
-
(async () => {
|
|
128955
|
-
await i18n_2.initI18n();
|
|
128956
|
-
})();
|
|
128957
|
-
|
|
128958
|
-
|
|
128959
|
-
/***/ }),
|
|
128960
|
-
|
|
128961
|
-
/***/ 75502:
|
|
128962
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
128963
|
-
|
|
128964
|
-
"use strict";
|
|
128965
|
-
|
|
128966
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
128967
|
-
/**
|
|
128968
|
-
* Extract i18n key
|
|
128969
|
-
*/
|
|
128970
|
-
exports.extractI18nKey = (input, withoutAt) => {
|
|
128971
|
-
if (withoutAt) {
|
|
128972
|
-
const result = input
|
|
128973
|
-
.replace(/{i18n>|{i18n>/, '')
|
|
128974
|
-
.replace('}', '')
|
|
128975
|
-
.trim();
|
|
128976
|
-
return result;
|
|
128977
|
-
}
|
|
128978
|
-
const result = input
|
|
128979
|
-
.replace(/{@i18n>|{@i18n>/, '')
|
|
128980
|
-
.replace('}', '')
|
|
128981
|
-
.trim();
|
|
128982
|
-
return result;
|
|
128983
|
-
};
|
|
128984
|
-
/**
|
|
128985
|
-
* Get unique key
|
|
128986
|
-
*
|
|
128987
|
-
* If the key is not unique, it increment key by one and recheck
|
|
128988
|
-
*
|
|
128989
|
-
* @param key new key and it is incremented
|
|
128990
|
-
* @param i18nData I18n entries
|
|
128991
|
-
* @param originalKey original key without any index increment
|
|
128992
|
-
* @param counter counter for increment
|
|
128993
|
-
*/
|
|
128994
|
-
exports.getI18nUniqueKey = (key, i18nData, originalKey = key, counter = 1) => {
|
|
128995
|
-
const uniqueKey = key;
|
|
128996
|
-
let keyExists = false;
|
|
128997
|
-
if (Array.isArray(i18nData)) {
|
|
128998
|
-
keyExists = i18nData.findIndex((item) => item.key.value === key) !== -1;
|
|
128999
|
-
}
|
|
129000
|
-
else {
|
|
129001
|
-
keyExists = i18nData[key] !== undefined;
|
|
129002
|
-
}
|
|
129003
|
-
if (keyExists) {
|
|
129004
|
-
key = `${originalKey}${counter}`;
|
|
129005
|
-
counter++;
|
|
129006
|
-
return exports.getI18nUniqueKey(key, i18nData, originalKey, counter);
|
|
129007
|
-
}
|
|
129008
|
-
return uniqueKey;
|
|
129009
|
-
};
|
|
129010
|
-
|
|
129011
|
-
|
|
129012
|
-
/***/ }),
|
|
129013
|
-
|
|
129014
|
-
/***/ 4787:
|
|
129015
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
129016
|
-
|
|
129017
|
-
"use strict";
|
|
129018
|
-
|
|
129019
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129020
|
-
/**
|
|
129021
|
-
* Computes line offsets for the given string
|
|
129022
|
-
* @param text
|
|
129023
|
-
*/
|
|
129024
|
-
function getLineOffsets(text) {
|
|
129025
|
-
const lineOffsets = [0];
|
|
129026
|
-
for (let index = 0; index < text.length; index++) {
|
|
129027
|
-
const character = text[index];
|
|
129028
|
-
if (character === '\n') {
|
|
129029
|
-
lineOffsets.push(index + 1);
|
|
129030
|
-
}
|
|
129031
|
-
else if (character === '\r') {
|
|
129032
|
-
if (index + 1 < text.length && text[index + 1] === '\n') {
|
|
129033
|
-
index++;
|
|
129034
|
-
}
|
|
129035
|
-
lineOffsets.push(index + 1);
|
|
129036
|
-
}
|
|
129037
|
-
}
|
|
129038
|
-
return lineOffsets;
|
|
129039
|
-
}
|
|
129040
|
-
exports.getLineOffsets = getLineOffsets;
|
|
129041
|
-
|
|
129042
|
-
|
|
129043
|
-
/***/ }),
|
|
129044
|
-
|
|
129045
|
-
/***/ 63787:
|
|
129046
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
129047
|
-
|
|
129048
|
-
"use strict";
|
|
129049
|
-
|
|
129050
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129051
|
-
exports.Position = {
|
|
129052
|
-
create(line, character) {
|
|
129053
|
-
return {
|
|
129054
|
-
line,
|
|
129055
|
-
character
|
|
129056
|
-
};
|
|
129057
|
-
}
|
|
129058
|
-
};
|
|
129059
|
-
function createRange(one, two, three, four) {
|
|
129060
|
-
if (typeof one === 'number' &&
|
|
129061
|
-
!isNaN(one) &&
|
|
129062
|
-
typeof two === 'number' &&
|
|
129063
|
-
!isNaN(two) &&
|
|
129064
|
-
typeof three === 'number' &&
|
|
129065
|
-
!isNaN(three) &&
|
|
129066
|
-
typeof four === 'number' &&
|
|
129067
|
-
!isNaN(four)) {
|
|
129068
|
-
return {
|
|
129069
|
-
start: exports.Position.create(one, two),
|
|
129070
|
-
end: exports.Position.create(three, four)
|
|
129071
|
-
};
|
|
129072
|
-
}
|
|
129073
|
-
else if (typeof one === 'object' && typeof two === 'object') {
|
|
129074
|
-
return {
|
|
129075
|
-
start: one,
|
|
129076
|
-
end: two
|
|
129077
|
-
};
|
|
129078
|
-
}
|
|
129079
|
-
throw new Error(`Range#create called with invalid arguments ${one}, ${two}, ${three}, ${four}`);
|
|
129080
|
-
}
|
|
129081
|
-
exports.Range = {
|
|
129082
|
-
create: createRange
|
|
129083
|
-
};
|
|
129084
|
-
|
|
129085
|
-
|
|
129086
|
-
/***/ }),
|
|
129087
|
-
|
|
129088
|
-
/***/ 72372:
|
|
129089
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
129090
|
-
|
|
129091
|
-
"use strict";
|
|
129092
|
-
|
|
129093
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129094
|
-
const position_1 = __webpack_require__(63787);
|
|
129095
|
-
/**
|
|
129096
|
-
*
|
|
129097
|
-
* @param lineOffsets Array of indices with line start offsets.
|
|
129098
|
-
* e.g [0] represents a document with one line that starts at offset 0.
|
|
129099
|
-
* @param offset
|
|
129100
|
-
* @param textLength
|
|
129101
|
-
*/
|
|
129102
|
-
function positionAt(lineOffsets, offset, textLength) {
|
|
129103
|
-
const target = Math.max(Math.min(offset, textLength), 0);
|
|
129104
|
-
let low = 0;
|
|
129105
|
-
let high = lineOffsets.length;
|
|
129106
|
-
if (high === 0) {
|
|
129107
|
-
return position_1.Position.create(0, target);
|
|
129108
|
-
}
|
|
129109
|
-
while (low < high) {
|
|
129110
|
-
const mid = Math.floor((low + high) / 2);
|
|
129111
|
-
if (lineOffsets[mid] > target) {
|
|
129112
|
-
high = mid;
|
|
129113
|
-
}
|
|
129114
|
-
else {
|
|
129115
|
-
low = mid + 1;
|
|
129116
|
-
}
|
|
129117
|
-
}
|
|
129118
|
-
const line = low - 1;
|
|
129119
|
-
return position_1.Position.create(line, target - lineOffsets[line]);
|
|
129120
|
-
}
|
|
129121
|
-
exports.positionAt = positionAt;
|
|
129122
|
-
function rangeAt(lineOffsets, start, end, textLength) {
|
|
129123
|
-
return position_1.Range.create(positionAt(lineOffsets, start, textLength), positionAt(lineOffsets, end, textLength));
|
|
129124
|
-
}
|
|
129125
|
-
exports.rangeAt = rangeAt;
|
|
129126
|
-
|
|
129127
|
-
|
|
129128
|
-
/***/ }),
|
|
129129
|
-
|
|
129130
|
-
/***/ 47753:
|
|
129131
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
129132
|
-
|
|
129133
|
-
"use strict";
|
|
129134
|
-
|
|
129135
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129136
|
-
const i18n_1 = __webpack_require__(76241);
|
|
129137
|
-
const position_1 = __webpack_require__(63787);
|
|
129138
|
-
const propertiesParser_1 = __webpack_require__(86334);
|
|
129139
|
-
const text_1 = __webpack_require__(79910);
|
|
129140
|
-
const COMMENT_REGEX = /\s*(:?#|!)|[^\n\r]*/;
|
|
129141
|
-
/**
|
|
129142
|
-
* Get abstract syntax tree for i18n.properties file
|
|
129143
|
-
* @param content
|
|
129144
|
-
* @param filePath
|
|
129145
|
-
*/
|
|
129146
|
-
exports.loadPropertiesTexts = (content, filePath = '') => {
|
|
129147
|
-
const i18nEntries = [];
|
|
129148
|
-
const lines = propertiesParser_1.parseProperties(content);
|
|
129149
|
-
for (let i = 0; lines.length > i; i++) {
|
|
129150
|
-
const line = lines[i];
|
|
129151
|
-
if (line.type === 'key-element-line') {
|
|
129152
|
-
const commentLine = lines[i - 1];
|
|
129153
|
-
const entry = {
|
|
129154
|
-
filePath,
|
|
129155
|
-
key: {
|
|
129156
|
-
value: line.key.value,
|
|
129157
|
-
range: line.key.range
|
|
129158
|
-
},
|
|
129159
|
-
value: {
|
|
129160
|
-
value: line.element.value,
|
|
129161
|
-
range: line.element.range
|
|
129162
|
-
}
|
|
129163
|
-
};
|
|
129164
|
-
if ((commentLine === null || commentLine === void 0 ? void 0 : commentLine.type) === 'comment-line' && COMMENT_REGEX.test(commentLine.value)) {
|
|
129165
|
-
const { start } = commentLine.range;
|
|
129166
|
-
const commaIndex = commentLine.value.indexOf(',');
|
|
129167
|
-
const colonIndex = commentLine.value.indexOf(':');
|
|
129168
|
-
entry.annotation = {
|
|
129169
|
-
textType: toTextTypeNode(commentLine, commaIndex, colonIndex)
|
|
129170
|
-
};
|
|
129171
|
-
if (commaIndex !== -1) {
|
|
129172
|
-
entry.annotation.maxLength = {
|
|
129173
|
-
value: parseInt(commentLine.value.slice(commaIndex + 1, colonIndex === -1 ? undefined : colonIndex)),
|
|
129174
|
-
range: position_1.Range.create(start.line, start.character + commaIndex + 1, start.line, start.character + (colonIndex === -1 ? commentLine.value.length : colonIndex))
|
|
129175
|
-
};
|
|
129176
|
-
}
|
|
129177
|
-
if (colonIndex !== -1) {
|
|
129178
|
-
entry.annotation.note = {
|
|
129179
|
-
value: commentLine.value.slice(colonIndex + 1),
|
|
129180
|
-
range: position_1.Range.create(start.line, start.character + colonIndex + 1, start.line, start.character + commentLine.value.length)
|
|
129181
|
-
};
|
|
129182
|
-
}
|
|
129183
|
-
}
|
|
129184
|
-
i18nEntries.push(entry);
|
|
129185
|
-
}
|
|
129186
|
-
}
|
|
129187
|
-
return i18nEntries;
|
|
129188
|
-
};
|
|
129189
|
-
function toTextTypeNode(comment, commaIndex, colonIndex) {
|
|
129190
|
-
const { start } = comment.range;
|
|
129191
|
-
// Comments can only be single line, so start and end lines will be equal
|
|
129192
|
-
if (commaIndex !== -1) {
|
|
129193
|
-
return {
|
|
129194
|
-
value: comment.value.slice(1, commaIndex),
|
|
129195
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + commaIndex)
|
|
129196
|
-
};
|
|
129197
|
-
}
|
|
129198
|
-
else if (colonIndex !== -1) {
|
|
129199
|
-
return {
|
|
129200
|
-
value: comment.value.slice(1, colonIndex),
|
|
129201
|
-
range: position_1.Range.create(start.line, start.character + 1, start.line, start.character + colonIndex)
|
|
129202
|
-
};
|
|
129203
|
-
}
|
|
129204
|
-
return {
|
|
129205
|
-
value: comment.value.slice(1),
|
|
129206
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + comment.value.length)
|
|
129207
|
-
};
|
|
129208
|
-
}
|
|
129209
|
-
/**
|
|
129210
|
-
* Creates annotation text in .properties file format.
|
|
129211
|
-
* If no annotation is not provided, default one is generated based on text.
|
|
129212
|
-
* @param text
|
|
129213
|
-
* @param annotation Context information for the text
|
|
129214
|
-
*/
|
|
129215
|
-
function printPropertiesFileI18nAnnotation(text, annotation) {
|
|
129216
|
-
if (!annotation) {
|
|
129217
|
-
const maxLen = text_1.getI18nMaxLength(text);
|
|
129218
|
-
const textType = text_1.getI18nTextType(maxLen);
|
|
129219
|
-
return `${textType},${maxLen}`;
|
|
129220
|
-
}
|
|
129221
|
-
if (typeof annotation === 'string') {
|
|
129222
|
-
const prefix = text.length <= 120 ? 'X' : 'Y';
|
|
129223
|
-
return `${prefix}${annotation}`;
|
|
129224
|
-
}
|
|
129225
|
-
if (typeof annotation === 'object') {
|
|
129226
|
-
const { textType, note, maxLength } = annotation;
|
|
129227
|
-
const fragments = [textType];
|
|
129228
|
-
if (maxLength !== undefined) {
|
|
129229
|
-
fragments.push(',', maxLength.toString());
|
|
129230
|
-
}
|
|
129231
|
-
if (note) {
|
|
129232
|
-
fragments.push(':', ' ', note.trim());
|
|
129233
|
-
}
|
|
129234
|
-
return fragments.join('');
|
|
129235
|
-
}
|
|
129236
|
-
return '';
|
|
129237
|
-
}
|
|
129238
|
-
exports.printPropertiesFileI18nAnnotation = printPropertiesFileI18nAnnotation;
|
|
129239
|
-
/**
|
|
129240
|
-
* Creates text for i18n entry in .properties file format.
|
|
129241
|
-
* If no annotation is not present, generic default one will be generated based on the text.
|
|
129242
|
-
* @param key
|
|
129243
|
-
* @param text
|
|
129244
|
-
* @param annotation Context information for the text
|
|
129245
|
-
*/
|
|
129246
|
-
function printPropertiesFileI18nEntry(key, text, annotation) {
|
|
129247
|
-
const annotationText = printPropertiesFileI18nAnnotation(text, annotation);
|
|
129248
|
-
const comment = `#${annotationText}`;
|
|
129249
|
-
const keyValue = `${key}=${text}`;
|
|
129250
|
-
const i18nEntry = `\n${comment}\n${keyValue}\n`;
|
|
129251
|
-
return i18nEntry;
|
|
129252
|
-
}
|
|
129253
|
-
exports.printPropertiesFileI18nEntry = printPropertiesFileI18nEntry;
|
|
129254
|
-
/**
|
|
129255
|
-
* Get documentation for i18n entry
|
|
129256
|
-
*/
|
|
129257
|
-
exports.geI18ntDocumentation = (entry) => {
|
|
129258
|
-
var _a, _b;
|
|
129259
|
-
const documentation = [];
|
|
129260
|
-
const key = `**${i18n_1.i18n.t('Text_Key')}:** ${entry.key.value}`;
|
|
129261
|
-
const value = `**${i18n_1.i18n.t('Text_Value')}:** ${entry.value.value}`;
|
|
129262
|
-
documentation.push(key, value);
|
|
129263
|
-
if (entry.annotation) {
|
|
129264
|
-
const annotationText = printPropertiesFileI18nAnnotation(entry.value.value, {
|
|
129265
|
-
maxLength: (_a = entry.annotation.maxLength) === null || _a === void 0 ? void 0 : _a.value,
|
|
129266
|
-
textType: entry.annotation.textType.value,
|
|
129267
|
-
note: (_b = entry.annotation.note) === null || _b === void 0 ? void 0 : _b.value
|
|
129268
|
-
});
|
|
129269
|
-
documentation.push(`**${i18n_1.i18n.t('Additional_Information')}:** ${annotationText}`);
|
|
129270
|
-
}
|
|
129271
|
-
return documentation.join('\n\n');
|
|
129272
|
-
};
|
|
129273
|
-
|
|
129274
|
-
|
|
129275
|
-
/***/ }),
|
|
129276
|
-
|
|
129277
|
-
/***/ 86334:
|
|
129278
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
129279
|
-
|
|
129280
|
-
"use strict";
|
|
129281
|
-
|
|
129282
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129283
|
-
const lineOffsets_1 = __webpack_require__(4787);
|
|
129284
|
-
const position_1 = __webpack_require__(63787);
|
|
129285
|
-
const positionAt_1 = __webpack_require__(72372);
|
|
129286
|
-
/**
|
|
129287
|
-
* Implements reading files Java properties files as described in https://docs.oracle.com/javase/10/docs/api/java/util/Properties.html
|
|
129288
|
-
*/
|
|
129289
|
-
function parseProperties(text) {
|
|
129290
|
-
const tokens = tokenize(text);
|
|
129291
|
-
const lineOffsets = lineOffsets_1.getLineOffsets(text);
|
|
129292
|
-
const contentLength = text.length;
|
|
129293
|
-
let i = 0;
|
|
129294
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
129295
|
-
const consume = () => tokens[i++];
|
|
129296
|
-
const eof = () => i >= tokens.length;
|
|
129297
|
-
function parseComment() {
|
|
129298
|
-
const comment = consume();
|
|
129299
|
-
return {
|
|
129300
|
-
type: 'comment-line',
|
|
129301
|
-
value: comment.image,
|
|
129302
|
-
range: positionAt_1.rangeAt(lineOffsets, comment.start, comment.end, contentLength)
|
|
129303
|
-
};
|
|
129304
|
-
}
|
|
129305
|
-
function parseKeyElement() {
|
|
129306
|
-
var _a, _b, _c, _d, _e, _f;
|
|
129307
|
-
const keyToken = consume();
|
|
129308
|
-
const key = {
|
|
129309
|
-
type: 'text',
|
|
129310
|
-
value: keyToken.image,
|
|
129311
|
-
range: positionAt_1.rangeAt(lineOffsets, keyToken.start, keyToken.end, contentLength)
|
|
129312
|
-
};
|
|
129313
|
-
let resetStartOffset = true;
|
|
129314
|
-
let start;
|
|
129315
|
-
let end;
|
|
129316
|
-
if (peek().type === 'whitespace') {
|
|
129317
|
-
consume();
|
|
129318
|
-
}
|
|
129319
|
-
if (peek().type === 'separator') {
|
|
129320
|
-
const separator = consume();
|
|
129321
|
-
start = end = separator.end;
|
|
129322
|
-
if (peek().type === 'whitespace') {
|
|
129323
|
-
consume();
|
|
129324
|
-
}
|
|
129325
|
-
}
|
|
129326
|
-
let concatenatedValue = '';
|
|
129327
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'end-of-line') {
|
|
129328
|
-
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') {
|
|
129329
|
-
if (((_d = peek()) === null || _d === void 0 ? void 0 : _d.type) === 'text' || ((_e = peek()) === null || _e === void 0 ? void 0 : _e.type) === 'whitespace') {
|
|
129330
|
-
const valueToken = consume();
|
|
129331
|
-
if (resetStartOffset) {
|
|
129332
|
-
start = valueToken.start;
|
|
129333
|
-
resetStartOffset = false;
|
|
129334
|
-
}
|
|
129335
|
-
end = valueToken.end;
|
|
129336
|
-
concatenatedValue += valueToken.image;
|
|
129337
|
-
}
|
|
129338
|
-
}
|
|
129339
|
-
if (((_f = peek()) === null || _f === void 0 ? void 0 : _f.type) === 'continuation-line-marker') {
|
|
129340
|
-
consume();
|
|
129341
|
-
if (peek().type === 'whitespace') {
|
|
129342
|
-
consume();
|
|
129343
|
-
}
|
|
129344
|
-
}
|
|
129345
|
-
}
|
|
129346
|
-
const element = {
|
|
129347
|
-
type: 'text',
|
|
129348
|
-
value: concatenatedValue,
|
|
129349
|
-
range: positionAt_1.rangeAt(lineOffsets, start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : 0, contentLength)
|
|
129350
|
-
};
|
|
129351
|
-
return {
|
|
129352
|
-
type: 'key-element-line',
|
|
129353
|
-
key,
|
|
129354
|
-
element,
|
|
129355
|
-
range: position_1.Range.create(key.range.start, element.range.end)
|
|
129356
|
-
};
|
|
129357
|
-
}
|
|
129358
|
-
function parseList() {
|
|
129359
|
-
var _a, _b;
|
|
129360
|
-
const list = [];
|
|
129361
|
-
while (!eof()) {
|
|
129362
|
-
const next = peek();
|
|
129363
|
-
if (next.type === 'comment') {
|
|
129364
|
-
list.push(parseComment());
|
|
129365
|
-
}
|
|
129366
|
-
else if (next.type === 'text') {
|
|
129367
|
-
list.push(parseKeyElement());
|
|
129368
|
-
}
|
|
129369
|
-
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') {
|
|
129370
|
-
consume();
|
|
129371
|
-
}
|
|
129372
|
-
}
|
|
129373
|
-
return list;
|
|
129374
|
-
}
|
|
129375
|
-
return parseList();
|
|
129376
|
-
}
|
|
129377
|
-
exports.parseProperties = parseProperties;
|
|
129378
|
-
const SEPARATOR = /=|:/;
|
|
129379
|
-
const COMMENT_START = /#|!/;
|
|
129380
|
-
const END_OF_LINE = /\r|\n|\r\n/;
|
|
129381
|
-
const WHITESPACE = /[ \t\f]+/;
|
|
129382
|
-
const HEX_DIGIT = /[0-9a-fA-F]/;
|
|
129383
|
-
const ELEMENT_ESCAPE_MAPPING = {
|
|
129384
|
-
'\\\\': '\\',
|
|
129385
|
-
'\\f': '\f',
|
|
129386
|
-
'\\n': '\n',
|
|
129387
|
-
'\\r': '\r',
|
|
129388
|
-
'\\t': '\t'
|
|
129389
|
-
};
|
|
129390
|
-
const KEY_ESCAPE_MAPPING = {
|
|
129391
|
-
...ELEMENT_ESCAPE_MAPPING,
|
|
129392
|
-
'\\=': '=',
|
|
129393
|
-
'\\:': ':'
|
|
129394
|
-
};
|
|
129395
|
-
const UNICODE_CHARACTER_LENGTH = 4;
|
|
129396
|
-
function createToken(type, image, start, end) {
|
|
129397
|
-
return {
|
|
129398
|
-
type,
|
|
129399
|
-
image,
|
|
129400
|
-
start,
|
|
129401
|
-
end
|
|
129402
|
-
};
|
|
129403
|
-
}
|
|
129404
|
-
exports.createToken = createToken;
|
|
129405
|
-
function tokenize(text) {
|
|
129406
|
-
const tokens = [];
|
|
129407
|
-
let i = 0;
|
|
129408
|
-
let image = '';
|
|
129409
|
-
let start = 0;
|
|
129410
|
-
while (i < text.length) {
|
|
129411
|
-
let character = text[i];
|
|
129412
|
-
if (character === '\n') {
|
|
129413
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
129414
|
-
start = i + 1;
|
|
129415
|
-
}
|
|
129416
|
-
else if (character === '\r') {
|
|
129417
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
129418
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
129419
|
-
start = i + 2;
|
|
129420
|
-
i++;
|
|
129421
|
-
}
|
|
129422
|
-
else {
|
|
129423
|
-
tokens.push({
|
|
129424
|
-
type: 'end-of-line',
|
|
129425
|
-
image: character,
|
|
129426
|
-
start: i,
|
|
129427
|
-
end: i + 1
|
|
129428
|
-
});
|
|
129429
|
-
start = i + 1;
|
|
129430
|
-
}
|
|
129431
|
-
}
|
|
129432
|
-
else if (COMMENT_START.test(character)) {
|
|
129433
|
-
image += character;
|
|
129434
|
-
while (i + 1 < text.length) {
|
|
129435
|
-
const next = text[i + 1];
|
|
129436
|
-
if (END_OF_LINE.test(next)) {
|
|
129437
|
-
break;
|
|
129438
|
-
}
|
|
129439
|
-
image += next;
|
|
129440
|
-
i++;
|
|
129441
|
-
}
|
|
129442
|
-
tokens.push(createToken('comment', image, start, i + 1));
|
|
129443
|
-
image = '';
|
|
129444
|
-
start = i + 1;
|
|
129445
|
-
}
|
|
129446
|
-
else if (WHITESPACE.test(character)) {
|
|
129447
|
-
image += character;
|
|
129448
|
-
while (i + 1 < text.length) {
|
|
129449
|
-
const next = text[i + 1];
|
|
129450
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
129451
|
-
break;
|
|
129452
|
-
}
|
|
129453
|
-
image += next;
|
|
129454
|
-
i++;
|
|
129455
|
-
}
|
|
129456
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
129457
|
-
image = '';
|
|
129458
|
-
start = i + 1;
|
|
129459
|
-
}
|
|
129460
|
-
else {
|
|
129461
|
-
// key-element pair
|
|
129462
|
-
while (i < text.length) {
|
|
129463
|
-
character = text[i];
|
|
129464
|
-
if (character === '\\') {
|
|
129465
|
-
const next = text[i + 1];
|
|
129466
|
-
if (next !== undefined) {
|
|
129467
|
-
const mappedValue = KEY_ESCAPE_MAPPING[character + next];
|
|
129468
|
-
if (mappedValue !== undefined) {
|
|
129469
|
-
image += mappedValue;
|
|
129470
|
-
i += 2;
|
|
129471
|
-
}
|
|
129472
|
-
else if (character + next === '\\u') {
|
|
129473
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
129474
|
-
let unicodeCharacterCode = '';
|
|
129475
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
129476
|
-
const c = text[index];
|
|
129477
|
-
if (HEX_DIGIT.test(c)) {
|
|
129478
|
-
unicodeCharacterCode += c;
|
|
129479
|
-
}
|
|
129480
|
-
else {
|
|
129481
|
-
break;
|
|
129482
|
-
}
|
|
129483
|
-
}
|
|
129484
|
-
if (unicodeCharacterCode.length === 4) {
|
|
129485
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
129486
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
129487
|
-
}
|
|
129488
|
-
else {
|
|
129489
|
-
// partial unicode escape sequence
|
|
129490
|
-
image += '\\u' + unicodeCharacterCode;
|
|
129491
|
-
i += 2 + unicodeCharacterCode.length;
|
|
129492
|
-
}
|
|
129493
|
-
}
|
|
129494
|
-
else {
|
|
129495
|
-
i++;
|
|
129496
|
-
}
|
|
129497
|
-
}
|
|
129498
|
-
continue;
|
|
129499
|
-
}
|
|
129500
|
-
if (WHITESPACE.test(character) || SEPARATOR.test(character) || END_OF_LINE.test(character)) {
|
|
129501
|
-
break;
|
|
129502
|
-
}
|
|
129503
|
-
image += character;
|
|
129504
|
-
i++;
|
|
129505
|
-
}
|
|
129506
|
-
tokens.push(createToken('text', image, start, i));
|
|
129507
|
-
image = '';
|
|
129508
|
-
start = i;
|
|
129509
|
-
if (WHITESPACE.test(character)) {
|
|
129510
|
-
image += character;
|
|
129511
|
-
while (i + 1 < text.length) {
|
|
129512
|
-
const next = text[i + 1];
|
|
129513
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
129514
|
-
break;
|
|
129515
|
-
}
|
|
129516
|
-
image += next;
|
|
129517
|
-
i++;
|
|
129518
|
-
}
|
|
129519
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
129520
|
-
image = '';
|
|
129521
|
-
start = i + 1;
|
|
129522
|
-
i++;
|
|
129523
|
-
character = text[i];
|
|
129524
|
-
}
|
|
129525
|
-
if (SEPARATOR.test(character)) {
|
|
129526
|
-
tokens.push(createToken('separator', character, start, i + 1));
|
|
129527
|
-
start = i + 1;
|
|
129528
|
-
i++;
|
|
129529
|
-
character = text[i];
|
|
129530
|
-
}
|
|
129531
|
-
if (WHITESPACE.test(character)) {
|
|
129532
|
-
image = character;
|
|
129533
|
-
while (i + 1 < text.length) {
|
|
129534
|
-
const next = text[i + 1];
|
|
129535
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
129536
|
-
break;
|
|
129537
|
-
}
|
|
129538
|
-
image += next;
|
|
129539
|
-
i++;
|
|
129540
|
-
}
|
|
129541
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
129542
|
-
image = '';
|
|
129543
|
-
start = i + 1;
|
|
129544
|
-
i++;
|
|
129545
|
-
character = text[i];
|
|
129546
|
-
}
|
|
129547
|
-
if (character === '\n') {
|
|
129548
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
129549
|
-
start = i + 1;
|
|
129550
|
-
}
|
|
129551
|
-
else if (character === '\r') {
|
|
129552
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
129553
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
129554
|
-
start = i + 2;
|
|
129555
|
-
i++;
|
|
129556
|
-
}
|
|
129557
|
-
else {
|
|
129558
|
-
tokens.push({
|
|
129559
|
-
type: 'end-of-line',
|
|
129560
|
-
image: character,
|
|
129561
|
-
start: i,
|
|
129562
|
-
end: i + 1
|
|
129563
|
-
});
|
|
129564
|
-
start = i + 1;
|
|
129565
|
-
}
|
|
129566
|
-
}
|
|
129567
|
-
else {
|
|
129568
|
-
while (i < text.length) {
|
|
129569
|
-
character = text[i];
|
|
129570
|
-
if (character === '\\') {
|
|
129571
|
-
const next = text[i + 1];
|
|
129572
|
-
if (next !== undefined) {
|
|
129573
|
-
const mappedValue = ELEMENT_ESCAPE_MAPPING[character + next];
|
|
129574
|
-
if (mappedValue !== undefined) {
|
|
129575
|
-
image += mappedValue;
|
|
129576
|
-
i += 2;
|
|
129577
|
-
}
|
|
129578
|
-
else if (character + next === '\\u') {
|
|
129579
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
129580
|
-
let unicodeCharacterCode = '';
|
|
129581
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
129582
|
-
const c = text[index];
|
|
129583
|
-
if (HEX_DIGIT.test(c)) {
|
|
129584
|
-
unicodeCharacterCode += c;
|
|
129585
|
-
}
|
|
129586
|
-
else {
|
|
129587
|
-
break;
|
|
129588
|
-
}
|
|
129589
|
-
}
|
|
129590
|
-
if (unicodeCharacterCode.length === 4) {
|
|
129591
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
129592
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
129593
|
-
}
|
|
129594
|
-
else {
|
|
129595
|
-
// partial unicode escape sequence
|
|
129596
|
-
image += '\\u' + unicodeCharacterCode;
|
|
129597
|
-
i += 2 + unicodeCharacterCode.length;
|
|
129598
|
-
}
|
|
129599
|
-
}
|
|
129600
|
-
else if (next === '\n') {
|
|
129601
|
-
tokens.push(createToken('text', image, start, i));
|
|
129602
|
-
tokens.push(createToken('continuation-line-marker', '\\\n', i, i + 2));
|
|
129603
|
-
start = i + 2;
|
|
129604
|
-
i += 2;
|
|
129605
|
-
image = '';
|
|
129606
|
-
}
|
|
129607
|
-
else if (next === '\r') {
|
|
129608
|
-
if (i + 1 < text.length && text[i + 2] === '\n') {
|
|
129609
|
-
tokens.push(createToken('text', image, start, i));
|
|
129610
|
-
tokens.push(createToken('continuation-line-marker', '\\\r\n', i, i + 3));
|
|
129611
|
-
start = i + 3;
|
|
129612
|
-
i += 3;
|
|
129613
|
-
image = '';
|
|
129614
|
-
}
|
|
129615
|
-
else {
|
|
129616
|
-
tokens.push(createToken('text', image, start, i));
|
|
129617
|
-
tokens.push(createToken('continuation-line-marker', '\\\r', i, i + 2));
|
|
129618
|
-
start = i + 2;
|
|
129619
|
-
i += 2;
|
|
129620
|
-
image = '';
|
|
129621
|
-
}
|
|
129622
|
-
}
|
|
129623
|
-
else {
|
|
129624
|
-
i++;
|
|
129625
|
-
}
|
|
129626
|
-
}
|
|
129627
|
-
continue;
|
|
129628
|
-
}
|
|
129629
|
-
if (WHITESPACE.test(character)) {
|
|
129630
|
-
if (image) {
|
|
129631
|
-
tokens.push(createToken('text', image, start, i));
|
|
129632
|
-
image = '';
|
|
129633
|
-
start = i;
|
|
129634
|
-
}
|
|
129635
|
-
image = character;
|
|
129636
|
-
while (i + 1 < text.length) {
|
|
129637
|
-
const next = text[i + 1];
|
|
129638
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
129639
|
-
break;
|
|
129640
|
-
}
|
|
129641
|
-
image += next;
|
|
129642
|
-
i++;
|
|
129643
|
-
}
|
|
129644
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
129645
|
-
image = '';
|
|
129646
|
-
start = i + 1;
|
|
129647
|
-
i++;
|
|
129648
|
-
character = text[i];
|
|
129649
|
-
continue;
|
|
129650
|
-
}
|
|
129651
|
-
if (END_OF_LINE.test(character)) {
|
|
129652
|
-
break;
|
|
129653
|
-
}
|
|
129654
|
-
image += character;
|
|
129655
|
-
i++;
|
|
129656
|
-
}
|
|
129657
|
-
tokens.push(createToken('text', image, start, i));
|
|
129658
|
-
image = '';
|
|
129659
|
-
start = i;
|
|
129660
|
-
if (END_OF_LINE.test(character)) {
|
|
129661
|
-
continue;
|
|
129662
|
-
}
|
|
129663
|
-
}
|
|
129664
|
-
}
|
|
129665
|
-
i++;
|
|
129666
|
-
}
|
|
129667
|
-
return tokens;
|
|
129668
|
-
}
|
|
129669
|
-
exports.tokenize = tokenize;
|
|
129670
|
-
|
|
129671
|
-
|
|
129672
|
-
/***/ }),
|
|
129673
|
-
|
|
129674
|
-
/***/ 79910:
|
|
129675
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
129676
|
-
|
|
129677
|
-
"use strict";
|
|
129678
|
-
|
|
129679
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129680
|
-
const types_1 = __webpack_require__(69338);
|
|
129681
|
-
/**
|
|
129682
|
-
* Get the calculated maximum text length for an i18n property value.
|
|
129683
|
-
*
|
|
129684
|
-
* (The algorithm considers the current UI5 specification)
|
|
129685
|
-
*
|
|
129686
|
-
* @param value - Value of the i18n property
|
|
129687
|
-
*/
|
|
129688
|
-
exports.getI18nMaxLength = (value) => {
|
|
129689
|
-
const iLength = value.length;
|
|
129690
|
-
const iMaxLength = iLength < 8 ? iLength * 5 : iLength <= 30 ? iLength * 3 : iLength * 1.5;
|
|
129691
|
-
return iMaxLength;
|
|
129692
|
-
};
|
|
129693
|
-
/**
|
|
129694
|
-
* Get a suitable textType for an i18n property.
|
|
129695
|
-
*
|
|
129696
|
-
* The textType is derived from the maximum text length maxLength of the property value.
|
|
129697
|
-
*
|
|
129698
|
-
* @param maxLength - Maximum text length of the i18n property value
|
|
129699
|
-
*/
|
|
129700
|
-
exports.getI18nTextType = (maxLength) => {
|
|
129701
|
-
if (maxLength <= 120) {
|
|
129702
|
-
return types_1.SapShortTextType.Label;
|
|
129703
|
-
}
|
|
129704
|
-
return types_1.SapLongTextType.MessageText;
|
|
129705
|
-
};
|
|
129706
|
-
|
|
129707
|
-
|
|
129708
|
-
/***/ }),
|
|
129709
|
-
|
|
129710
|
-
/***/ 83525:
|
|
129711
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
129712
|
-
|
|
129713
|
-
"use strict";
|
|
129714
|
-
|
|
129715
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129716
|
-
/**
|
|
129717
|
-
* Convert to camel case
|
|
129718
|
-
*
|
|
129719
|
-
* It gets input like 'product details info' and convert it
|
|
129720
|
-
* to 'productDetailsInfo'
|
|
129721
|
-
*
|
|
129722
|
-
*/
|
|
129723
|
-
exports.convertToCamelCase = (input = '', maxWord = 4) => {
|
|
129724
|
-
let output = '';
|
|
129725
|
-
const parts = input
|
|
129726
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
129727
|
-
.trim()
|
|
129728
|
-
.split(' ');
|
|
129729
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
129730
|
-
for (let i = 0; len > i; i++) {
|
|
129731
|
-
const part = parts[i];
|
|
129732
|
-
if (i === 0) {
|
|
129733
|
-
output += part.toLowerCase();
|
|
129734
|
-
}
|
|
129735
|
-
else {
|
|
129736
|
-
const initial = part.charAt(0).toUpperCase();
|
|
129737
|
-
const rest = part.substr(1).toLowerCase();
|
|
129738
|
-
output += `${initial}${rest}`;
|
|
129739
|
-
}
|
|
129740
|
-
}
|
|
129741
|
-
return output;
|
|
129742
|
-
};
|
|
129743
|
-
/**
|
|
129744
|
-
* Convert to pascal case
|
|
129745
|
-
*
|
|
129746
|
-
* It gets input like 'product details info' and convert it
|
|
129747
|
-
* to 'ProductDetailsInfo'
|
|
129748
|
-
*/
|
|
129749
|
-
exports.convertToPascalCase = (input, maxWord = 4) => {
|
|
129750
|
-
let output = '';
|
|
129751
|
-
const parts = input
|
|
129752
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
129753
|
-
.trim()
|
|
129754
|
-
.split(' ');
|
|
129755
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
129756
|
-
for (let i = 0; len > i; i++) {
|
|
129757
|
-
const part = parts[i];
|
|
129758
|
-
const initial = part.charAt(0).toUpperCase();
|
|
129759
|
-
const rest = part.substr(1).toLowerCase();
|
|
129760
|
-
output += `${initial}${rest}`;
|
|
129761
|
-
}
|
|
129762
|
-
return output;
|
|
129763
|
-
};
|
|
129764
|
-
|
|
129765
|
-
|
|
129766
|
-
/***/ }),
|
|
129767
|
-
|
|
129768
|
-
/***/ 69338:
|
|
129769
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
129770
|
-
|
|
129771
|
-
"use strict";
|
|
129772
|
-
|
|
129773
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
129774
|
-
/**
|
|
129775
|
-
* Text types for texts that are less than 120 characters long
|
|
129776
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
129777
|
-
*/
|
|
129778
|
-
var SapShortTextType;
|
|
129779
|
-
(function (SapShortTextType) {
|
|
129780
|
-
SapShortTextType["Accessibility"] = "XACT";
|
|
129781
|
-
SapShortTextType["AlternativeText"] = "XALT";
|
|
129782
|
-
SapShortTextType["BreadcrumbStep"] = "XBCB";
|
|
129783
|
-
SapShortTextType["BulletListItemText"] = "XBLI";
|
|
129784
|
-
SapShortTextType["ButtonText"] = "XBUT";
|
|
129785
|
-
SapShortTextType["Caption"] = "XCAP";
|
|
129786
|
-
SapShortTextType["Cell"] = "XCEL";
|
|
129787
|
-
SapShortTextType["Checkbox"] = "XCKL";
|
|
129788
|
-
SapShortTextType["ColumnHeader"] = "XCOL";
|
|
129789
|
-
SapShortTextType["Tabstrip"] = "XCRD";
|
|
129790
|
-
SapShortTextType["DataNavigationText"] = "XDAT";
|
|
129791
|
-
SapShortTextType["Label"] = "XFLD";
|
|
129792
|
-
SapShortTextType["Frame"] = "XFRM";
|
|
129793
|
-
SapShortTextType["Term"] = "XGLS";
|
|
129794
|
-
SapShortTextType["GroupTitle"] = "XGRP";
|
|
129795
|
-
SapShortTextType["Heading"] = "XHED";
|
|
129796
|
-
SapShortTextType["LegendText"] = "XLGD";
|
|
129797
|
-
SapShortTextType["HyperlinkText"] = "XLNK";
|
|
129798
|
-
SapShortTextType["LogEntry"] = "XLOG";
|
|
129799
|
-
SapShortTextType["ListBoxItem"] = "XLST";
|
|
129800
|
-
SapShortTextType["MenuHeader"] = "XMEN";
|
|
129801
|
-
SapShortTextType["MenuItem"] = "XMIT";
|
|
129802
|
-
SapShortTextType["MessageText"] = "XMSG";
|
|
129803
|
-
SapShortTextType["RadioButton"] = "XRBL";
|
|
129804
|
-
SapShortTextType["RoadmapStep"] = "XRMP";
|
|
129805
|
-
SapShortTextType["TableRowHeading"] = "XROW";
|
|
129806
|
-
SapShortTextType["SelectionText"] = "XSEL";
|
|
129807
|
-
SapShortTextType["TabStripText"] = "XTBS";
|
|
129808
|
-
SapShortTextType["TableTitle"] = "XTIT";
|
|
129809
|
-
SapShortTextType["TreeNodeText"] = "XTND";
|
|
129810
|
-
SapShortTextType["QuickInfoText"] = "XTOL";
|
|
129811
|
-
SapShortTextType["GeneralText"] = "XTXT";
|
|
129812
|
-
})(SapShortTextType = exports.SapShortTextType || (exports.SapShortTextType = {}));
|
|
129813
|
-
/**
|
|
129814
|
-
* Text types for texts that are more than 120 characters long
|
|
129815
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
129816
|
-
*/
|
|
129817
|
-
var SapLongTextType;
|
|
129818
|
-
(function (SapLongTextType) {
|
|
129819
|
-
SapLongTextType["Accessibility"] = "YACT";
|
|
129820
|
-
SapLongTextType["BulletListItemText"] = "YBLI";
|
|
129821
|
-
SapLongTextType["Definition"] = "YDEF";
|
|
129822
|
-
SapLongTextType["Description"] = "YDES";
|
|
129823
|
-
SapLongTextType["Explanation"] = "YEXP";
|
|
129824
|
-
SapLongTextType["FaqAnswer"] = "YFAA";
|
|
129825
|
-
SapLongTextType["Faq"] = "YFAQ";
|
|
129826
|
-
SapLongTextType["GlossaryDefinition"] = "YGLS";
|
|
129827
|
-
SapLongTextType["Information"] = "YINF";
|
|
129828
|
-
SapLongTextType["Instruction"] = "YINS";
|
|
129829
|
-
SapLongTextType["LogEntry"] = "YLOG";
|
|
129830
|
-
SapLongTextType["ErrorMessage"] = "YMSE";
|
|
129831
|
-
SapLongTextType["MessageText"] = "YMSG";
|
|
129832
|
-
SapLongTextType["InformationMessageLong"] = "YMSI";
|
|
129833
|
-
SapLongTextType["WarningMessage"] = "YMSW";
|
|
129834
|
-
SapLongTextType["TechnicalText"] = "YTEC";
|
|
129835
|
-
SapLongTextType["Ticker"] = "YTIC";
|
|
129836
|
-
SapLongTextType["GeneralTextLong"] = "YTXT";
|
|
129837
|
-
})(SapLongTextType = exports.SapLongTextType || (exports.SapLongTextType = {}));
|
|
129838
|
-
exports.NOT_RELEVANT_FOR_TRANSLATION = 'NOTR';
|
|
129839
|
-
|
|
129840
|
-
|
|
129841
127128
|
/***/ }),
|
|
129842
127129
|
|
|
129843
127130
|
/***/ 52136:
|
|
@@ -131067,8 +128354,7 @@ async function getAuthHeaderForInstanceBasedDest(destinationInstance) {
|
|
|
131067
128354
|
const credentials = (await cf_tools_1.apiGetInstanceCredentials(destinationInstance)).credentials;
|
|
131068
128355
|
const clientId = ((_a = credentials.uaa) === null || _a === void 0 ? void 0 : _a.clientid) || credentials.clientid;
|
|
131069
128356
|
const clientSecret = ((_b = credentials.uaa) === null || _b === void 0 ? void 0 : _b.clientsecret) || credentials.clientsecret;
|
|
131070
|
-
|
|
131071
|
-
return base64Header;
|
|
128357
|
+
return Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
|
|
131072
128358
|
}
|
|
131073
128359
|
catch (error) {
|
|
131074
128360
|
throw new Error(`An error occurred while retrieving service key for the destination instance ${destinationInstance}: ${error}`);
|
|
@@ -131505,8 +128791,7 @@ async function runPostConnectionCallback({ log, uaa, accessToken, postConnection
|
|
|
131505
128791
|
async function getUserInfo(uaa, accessToken) {
|
|
131506
128792
|
var _a, _b;
|
|
131507
128793
|
const userInfoResp = await axios_1.default.request(uaa.getUserinfoRequest(accessToken));
|
|
131508
|
-
|
|
131509
|
-
return userDisplayName;
|
|
128794
|
+
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);
|
|
131510
128795
|
}
|
|
131511
128796
|
/** Gets user information from UAA. Will call the callback function passed in. Will swallow errors and only log them
|
|
131512
128797
|
* If we don't succeed, we try again later
|
|
@@ -132698,10 +129983,7 @@ async function getBTPSystem(system, savedSapSystemServiceKey) {
|
|
|
132698
129983
|
}
|
|
132699
129984
|
exports.getBTPSystem = getBTPSystem;
|
|
132700
129985
|
async function isSystemNameValid(newName, savedSystemName) {
|
|
132701
|
-
|
|
132702
|
-
return false;
|
|
132703
|
-
}
|
|
132704
|
-
return true;
|
|
129986
|
+
return newName && newName !== savedSystemName && (await __1.isSystemNameInUse(newName)) ? false : true;
|
|
132705
129987
|
}
|
|
132706
129988
|
exports.isSystemNameValid = isSystemNameValid;
|
|
132707
129989
|
async function isSapSystemConnected(sapSystem) {
|
|
@@ -134079,8 +131361,7 @@ async function getParsedUi5YamlConfig(dirPath, filename) {
|
|
|
134079
131361
|
if (contents) {
|
|
134080
131362
|
try {
|
|
134081
131363
|
// yaml.parse can throw exception if .yaml file has syntax errors
|
|
134082
|
-
|
|
134083
|
-
return parsedConfig;
|
|
131364
|
+
return yaml.parse(contents);
|
|
134084
131365
|
}
|
|
134085
131366
|
catch (e) {
|
|
134086
131367
|
throw new Error(i18n_1.i18n.t('ERROR_UI5_YAML_PARSING', { filePath: path_1.join(dirPath, filename), parsingError: e.message }));
|
|
@@ -134120,7 +131401,7 @@ const i18n_1 = __webpack_require__(23794);
|
|
|
134120
131401
|
const file_1 = __webpack_require__(1595);
|
|
134121
131402
|
const yaml = __importStar(__webpack_require__(86916));
|
|
134122
131403
|
const os_1 = __importDefault(__webpack_require__(22037));
|
|
134123
|
-
const
|
|
131404
|
+
const capProject_1 = __webpack_require__(87616);
|
|
134124
131405
|
const webapp_1 = __webpack_require__(39198);
|
|
134125
131406
|
const request_promise_1 = __importDefault(__webpack_require__(19602));
|
|
134126
131407
|
const ui5Config_1 = __webpack_require__(94116);
|
|
@@ -134418,10 +131699,10 @@ async function getDetailedProjectType(appRoot, projectRoot) {
|
|
|
134418
131699
|
if (appRoot === projectRoot) {
|
|
134419
131700
|
return "EDMX Backend" /* Edxm */;
|
|
134420
131701
|
}
|
|
134421
|
-
if (await
|
|
131702
|
+
if (await capProject_1.isCapJavaProject(projectRoot)) {
|
|
134422
131703
|
return "CAP Java" /* CAPJava */;
|
|
134423
131704
|
}
|
|
134424
|
-
if (await
|
|
131705
|
+
if (await capProject_1.isCapNodeJsProject(projectRoot)) {
|
|
134425
131706
|
return "CAP Node.js" /* CAPNode */;
|
|
134426
131707
|
}
|
|
134427
131708
|
throw new Error(i18n_1.i18n.t('ERROR_DETAIL_PROJECT_TYPE', { appRoot, projectRoot }));
|
|
@@ -134471,7 +131752,7 @@ async function findRootsForPath(path) {
|
|
|
134471
131752
|
// The first package.json we found when searching up contains sapux, but not true -> not supported
|
|
134472
131753
|
return null;
|
|
134473
131754
|
}
|
|
134474
|
-
if (await
|
|
131755
|
+
if (await capProject_1.isCapProject(appRoot, appPckJson)) {
|
|
134475
131756
|
// App is part of a CAP project, but doesn't have own package.json and is not mentioned in sapux array
|
|
134476
131757
|
// in root -> not supported
|
|
134477
131758
|
return null;
|
|
@@ -134488,7 +131769,7 @@ async function findRootsForPath(path) {
|
|
|
134488
131769
|
const { root } = path_1.parse(appRoot);
|
|
134489
131770
|
let projectRoot = path_1.dirname(appRoot);
|
|
134490
131771
|
while (projectRoot !== root) {
|
|
134491
|
-
if (await
|
|
131772
|
+
if (await capProject_1.isCapProject(projectRoot)) {
|
|
134492
131773
|
// We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
|
|
134493
131774
|
// Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
|
|
134494
131775
|
if (path_1.join(projectRoot, 'app') !== appRoot) {
|
|
@@ -134549,7 +131830,7 @@ exports.findRunnableProjects = async (workspaceRoots, logger) => {
|
|
|
134549
131830
|
for (const root of roots) {
|
|
134550
131831
|
try {
|
|
134551
131832
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
134552
|
-
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await
|
|
131833
|
+
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await capProject_1.isCapProject(root, packageJson))) &&
|
|
134553
131834
|
hasScript(packageJson)) {
|
|
134554
131835
|
result.push(root);
|
|
134555
131836
|
}
|
|
@@ -134573,10 +131854,7 @@ async function checkPackageJson(root, dependency, sapux) {
|
|
|
134573
131854
|
(packageJson.devDependencies && packageJson.devDependencies[dependency] !== undefined)) {
|
|
134574
131855
|
return true;
|
|
134575
131856
|
}
|
|
134576
|
-
|
|
134577
|
-
return true;
|
|
134578
|
-
}
|
|
134579
|
-
return false;
|
|
131857
|
+
return sapux === true && packageJson.sapux === true;
|
|
134580
131858
|
}
|
|
134581
131859
|
exports.checkPackageJson = checkPackageJson;
|
|
134582
131860
|
/**
|
|
@@ -134909,7 +132187,7 @@ exports.findI18nProperty = findI18nProperty;
|
|
|
134909
132187
|
* @param packageJson - the parsed content of package.json
|
|
134910
132188
|
*/
|
|
134911
132189
|
async function getProjectTypeFromProjectFiles(projectRoot, packageJson) {
|
|
134912
|
-
return (await
|
|
132190
|
+
return (await capProject_1.isCapProject(projectRoot, packageJson)) ? "Cap" /* Cap */ : "Edmx" /* Edmx */;
|
|
134913
132191
|
}
|
|
134914
132192
|
exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
134915
132193
|
/**
|
|
@@ -134918,8 +132196,7 @@ exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
|
134918
132196
|
*/
|
|
134919
132197
|
async function getProjectType(root) {
|
|
134920
132198
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
134921
|
-
|
|
134922
|
-
return projectType;
|
|
132199
|
+
return getProjectTypeFromProjectFiles(root, packageJson);
|
|
134923
132200
|
}
|
|
134924
132201
|
exports.getProjectType = getProjectType;
|
|
134925
132202
|
/**
|
|
@@ -134969,8 +132246,7 @@ async function getLocalUI5Version(root) {
|
|
|
134969
132246
|
const yamlFile = path_1.join(root, project_spec_1.FileName.Ui5LocalYaml);
|
|
134970
132247
|
if (await file_1.fileExists(yamlFile)) {
|
|
134971
132248
|
const yamlContent = yaml.parse(await file_1.readFile(yamlFile));
|
|
134972
|
-
|
|
134973
|
-
return ui5Version;
|
|
132249
|
+
return yamlContent.framework && yamlContent.framework.version;
|
|
134974
132250
|
}
|
|
134975
132251
|
}
|
|
134976
132252
|
exports.getLocalUI5Version = getLocalUI5Version;
|
|
@@ -138829,16 +136105,13 @@ class PerformanceMeasurementAPI extends types_1.PerformanceMeasurement {
|
|
|
138829
136105
|
return PerformanceMeasurementAPI.entries;
|
|
138830
136106
|
}
|
|
138831
136107
|
static getEntriesByName(name) {
|
|
138832
|
-
|
|
138833
|
-
return filtered;
|
|
136108
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name);
|
|
138834
136109
|
}
|
|
138835
136110
|
static getEntriesByNameType(name, type) {
|
|
138836
|
-
|
|
138837
|
-
return filtered;
|
|
136111
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name && entry.type === type);
|
|
138838
136112
|
}
|
|
138839
136113
|
static getEntriesByType(type) {
|
|
138840
|
-
|
|
138841
|
-
return filtered;
|
|
136114
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.type === type);
|
|
138842
136115
|
}
|
|
138843
136116
|
static getMeasurementDuration(name) {
|
|
138844
136117
|
const entry = PerformanceMeasurementAPI.getEntriesByNameType(name, types_1.EntryType.MEASUREMENT).slice(-1)[0];
|
|
@@ -139194,8 +136467,7 @@ async function processToolsSuiteTelemetry(telemetryHelperProperties) {
|
|
|
139194
136467
|
if (telemetryHelperProperties) {
|
|
139195
136468
|
appProperties = await getAppProperties(telemetryHelperProperties['appPath']);
|
|
139196
136469
|
}
|
|
139197
|
-
|
|
139198
|
-
return finalProperties;
|
|
136470
|
+
return { ...commonProperties, ...appProperties };
|
|
139199
136471
|
}
|
|
139200
136472
|
exports.processToolsSuiteTelemetry = processToolsSuiteTelemetry;
|
|
139201
136473
|
/**
|
|
@@ -139808,775 +137080,6 @@ function configAzureTelemetryClient(client) {
|
|
|
139808
137080
|
exports.configAzureTelemetryClient = configAzureTelemetryClient;
|
|
139809
137081
|
|
|
139810
137082
|
|
|
139811
|
-
/***/ }),
|
|
139812
|
-
|
|
139813
|
-
/***/ 42745:
|
|
139814
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
139815
|
-
|
|
139816
|
-
"use strict";
|
|
139817
|
-
|
|
139818
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
139819
|
-
const path_1 = __webpack_require__(71017);
|
|
139820
|
-
const fs_1 = __webpack_require__(57147);
|
|
139821
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
139822
|
-
const resolve_1 = __webpack_require__(96749);
|
|
139823
|
-
const utils_1 = __webpack_require__(8655);
|
|
139824
|
-
const json_1 = __webpack_require__(34692);
|
|
139825
|
-
const csv_1 = __webpack_require__(98944);
|
|
139826
|
-
/**
|
|
139827
|
-
* Adds new i18n entries to an existing file or in a new file if one does not exist
|
|
139828
|
-
* @param env CDS environment configuration
|
|
139829
|
-
* @param root project root, where i18n folder should reside if no i18n file exists
|
|
139830
|
-
* @param path path to cds file for which translation should be maintained
|
|
139831
|
-
* @param newI18nEntries new i18n entries that will be maintained
|
|
139832
|
-
*/
|
|
139833
|
-
async function addI18nEntriesForCdsFile(env, root, path, newI18nEntries) {
|
|
139834
|
-
const { folders, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
139835
|
-
let i18nFolderPath = resolve_1.resolveI18nFolderForFile(env, path_1.join(root, path));
|
|
139836
|
-
if (!i18nFolderPath) {
|
|
139837
|
-
const folder = folders[0];
|
|
139838
|
-
i18nFolderPath = path_1.join(root, folder);
|
|
139839
|
-
await fs_1.promises.mkdir(i18nFolderPath);
|
|
139840
|
-
}
|
|
139841
|
-
const updaters = [tryAddJsonTexts, tryAddPropertiesTexts, tryAddCsvTexts];
|
|
139842
|
-
const filePath = path_1.join(i18nFolderPath, baseFileName);
|
|
139843
|
-
for (const update of updaters) {
|
|
139844
|
-
const completed = await update(env, filePath, newI18nEntries);
|
|
139845
|
-
if (completed) {
|
|
139846
|
-
break;
|
|
139847
|
-
}
|
|
139848
|
-
}
|
|
139849
|
-
}
|
|
139850
|
-
exports.addI18nEntriesForCdsFile = addI18nEntriesForCdsFile;
|
|
139851
|
-
async function tryAddJsonTexts(env, path, newI18nEntries) {
|
|
139852
|
-
const { fallbackLanguage } = utils_1.getI18nConfiguration(env);
|
|
139853
|
-
try {
|
|
139854
|
-
const i18nFilePath = utils_1.jsonPathFormatter(path);
|
|
139855
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
139856
|
-
const newContent = json_1.addJsonTexts(content, fallbackLanguage, newI18nEntries);
|
|
139857
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
139858
|
-
}
|
|
139859
|
-
catch (error) {
|
|
139860
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
139861
|
-
return false;
|
|
139862
|
-
}
|
|
139863
|
-
else {
|
|
139864
|
-
throw error;
|
|
139865
|
-
}
|
|
139866
|
-
}
|
|
139867
|
-
return true;
|
|
139868
|
-
}
|
|
139869
|
-
async function tryAddPropertiesTexts(env, path, newI18nEntries) {
|
|
139870
|
-
const i18nFilePath = utils_1.propertiesPathFormatter(path, env);
|
|
139871
|
-
let newContent = newI18nEntries
|
|
139872
|
-
.map((entry) => ux_i18n_properties_1.printPropertiesFileI18nEntry(entry.key, entry.value, entry.annotation))
|
|
139873
|
-
//No need join with new line, because it is already added in 'printPropertiesFileI18nEntry'
|
|
139874
|
-
.join('');
|
|
139875
|
-
try {
|
|
139876
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
139877
|
-
const lines = content.split(/\r\n|\n/);
|
|
139878
|
-
// check if file does not end with new line
|
|
139879
|
-
if (lines.length > 0 && lines[lines.length - 1].trim()) {
|
|
139880
|
-
// If there no end line - add new gap line before new content
|
|
139881
|
-
newContent = `\n${newContent}`;
|
|
139882
|
-
}
|
|
139883
|
-
await fs_1.promises.writeFile(i18nFilePath, content.concat(newContent), { encoding: 'utf8' });
|
|
139884
|
-
}
|
|
139885
|
-
catch (error) {
|
|
139886
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
139887
|
-
const completed = await tryAddCsvTexts(env, path, newI18nEntries);
|
|
139888
|
-
if (!completed) {
|
|
139889
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
139890
|
-
return true;
|
|
139891
|
-
}
|
|
139892
|
-
return true;
|
|
139893
|
-
}
|
|
139894
|
-
else {
|
|
139895
|
-
throw error;
|
|
139896
|
-
}
|
|
139897
|
-
}
|
|
139898
|
-
return true;
|
|
139899
|
-
}
|
|
139900
|
-
async function tryAddCsvTexts(env, path, newI18nEntries) {
|
|
139901
|
-
const { defaultLanguage } = utils_1.getI18nConfiguration(env);
|
|
139902
|
-
try {
|
|
139903
|
-
const i18nFilePath = utils_1.csvPathFormatter(path);
|
|
139904
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
139905
|
-
const newContent = csv_1.addCsvTexts(content, defaultLanguage, newI18nEntries);
|
|
139906
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
139907
|
-
}
|
|
139908
|
-
catch (error) {
|
|
139909
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
139910
|
-
return false;
|
|
139911
|
-
}
|
|
139912
|
-
else {
|
|
139913
|
-
throw error;
|
|
139914
|
-
}
|
|
139915
|
-
}
|
|
139916
|
-
return true;
|
|
139917
|
-
}
|
|
139918
|
-
|
|
139919
|
-
|
|
139920
|
-
/***/ }),
|
|
139921
|
-
|
|
139922
|
-
/***/ 98944:
|
|
139923
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
139924
|
-
|
|
139925
|
-
"use strict";
|
|
139926
|
-
|
|
139927
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
139928
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
139929
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
139930
|
-
const csvParser_1 = __webpack_require__(34521);
|
|
139931
|
-
const utils_1 = __webpack_require__(8655);
|
|
139932
|
-
function loadCsvTexts(text, filePath = '') {
|
|
139933
|
-
const bundle = {};
|
|
139934
|
-
const document = csvParser_1.parseCsv(text);
|
|
139935
|
-
for (let columnIndex = 1; columnIndex < document.header.fields.length; columnIndex++) {
|
|
139936
|
-
const locale = document.header.fields[columnIndex];
|
|
139937
|
-
const entries = [];
|
|
139938
|
-
bundle[locale.value] = entries;
|
|
139939
|
-
for (let i = 0; i < document.rows.length; i++) {
|
|
139940
|
-
const row = document.rows[i];
|
|
139941
|
-
if (row) {
|
|
139942
|
-
const key = toTextNode(row.fields[0]);
|
|
139943
|
-
const value = toTextNode(row.fields[columnIndex]);
|
|
139944
|
-
if (key && value) {
|
|
139945
|
-
entries.push({
|
|
139946
|
-
filePath,
|
|
139947
|
-
key,
|
|
139948
|
-
value
|
|
139949
|
-
});
|
|
139950
|
-
}
|
|
139951
|
-
}
|
|
139952
|
-
}
|
|
139953
|
-
}
|
|
139954
|
-
return bundle;
|
|
139955
|
-
}
|
|
139956
|
-
exports.loadCsvTexts = loadCsvTexts;
|
|
139957
|
-
function addCsvTexts(text, fallbackLocale, newEntries) {
|
|
139958
|
-
const csvDocument = csvParser_1.parseCsv(text);
|
|
139959
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
139960
|
-
const headerFields = csvDocument.header.fields;
|
|
139961
|
-
const fallbackFieldIndex = headerFields.findIndex((field) => field.value === fallbackLocale);
|
|
139962
|
-
if (fallbackFieldIndex !== -1) {
|
|
139963
|
-
let newText = '';
|
|
139964
|
-
for (const entry of newEntries) {
|
|
139965
|
-
newText += `${entry.key};`;
|
|
139966
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
139967
|
-
const columnHeader = headerFields[column];
|
|
139968
|
-
if (columnHeader.value === fallbackLocale) {
|
|
139969
|
-
newText += `${entry.value}`;
|
|
139970
|
-
}
|
|
139971
|
-
if (column + 1 !== headerFields.length) {
|
|
139972
|
-
newText += ';';
|
|
139973
|
-
}
|
|
139974
|
-
}
|
|
139975
|
-
newText += eol;
|
|
139976
|
-
}
|
|
139977
|
-
if (text.endsWith(eol)) {
|
|
139978
|
-
return text + newText;
|
|
139979
|
-
}
|
|
139980
|
-
else {
|
|
139981
|
-
return text + eol + newText;
|
|
139982
|
-
}
|
|
139983
|
-
}
|
|
139984
|
-
else if (headerFields.length === 0) {
|
|
139985
|
-
let newText = `key;${fallbackLocale}${eol}`;
|
|
139986
|
-
for (const entry of newEntries) {
|
|
139987
|
-
newText += `${entry.key};${entry.value}${eol}`;
|
|
139988
|
-
}
|
|
139989
|
-
return text + newText;
|
|
139990
|
-
}
|
|
139991
|
-
else {
|
|
139992
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
139993
|
-
const edits = [];
|
|
139994
|
-
edits.push({
|
|
139995
|
-
newText: `;${fallbackLocale}`,
|
|
139996
|
-
range: ux_i18n_properties_1.Range.create(0, csvDocument.header.range.end.character, 0, csvDocument.header.range.end.character)
|
|
139997
|
-
});
|
|
139998
|
-
for (const row of csvDocument.rows) {
|
|
139999
|
-
edits.push({
|
|
140000
|
-
newText: `;`,
|
|
140001
|
-
range: ux_i18n_properties_1.Range.create(row.range.end, row.range.end)
|
|
140002
|
-
});
|
|
140003
|
-
}
|
|
140004
|
-
let newText = `${eol}`;
|
|
140005
|
-
for (const entry of newEntries) {
|
|
140006
|
-
newText += `${entry.key};`;
|
|
140007
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
140008
|
-
newText += ';';
|
|
140009
|
-
}
|
|
140010
|
-
newText += `${entry.value}${eol}`;
|
|
140011
|
-
}
|
|
140012
|
-
const lastRow = csvDocument.rows.slice(-1)[0];
|
|
140013
|
-
const position = lastRow ? lastRow.range.end : ux_i18n_properties_1.Position.create(1, 0);
|
|
140014
|
-
edits.push({
|
|
140015
|
-
newText,
|
|
140016
|
-
range: ux_i18n_properties_1.Range.create(position, position)
|
|
140017
|
-
});
|
|
140018
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, edits);
|
|
140019
|
-
}
|
|
140020
|
-
}
|
|
140021
|
-
exports.addCsvTexts = addCsvTexts;
|
|
140022
|
-
function toTextNode(field) {
|
|
140023
|
-
if (field) {
|
|
140024
|
-
return {
|
|
140025
|
-
value: field.value,
|
|
140026
|
-
range: field.range
|
|
140027
|
-
};
|
|
140028
|
-
}
|
|
140029
|
-
}
|
|
140030
|
-
function createTextNode(value, range) {
|
|
140031
|
-
return {
|
|
140032
|
-
value,
|
|
140033
|
-
range
|
|
140034
|
-
};
|
|
140035
|
-
}
|
|
140036
|
-
exports.createTextNode = createTextNode;
|
|
140037
|
-
|
|
140038
|
-
|
|
140039
|
-
/***/ }),
|
|
140040
|
-
|
|
140041
|
-
/***/ 34521:
|
|
140042
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140043
|
-
|
|
140044
|
-
"use strict";
|
|
140045
|
-
|
|
140046
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140047
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
140048
|
-
const SEPARATOR = /[,;\t]/;
|
|
140049
|
-
function parseCsv(text) {
|
|
140050
|
-
const tokens = tokenize(text);
|
|
140051
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
140052
|
-
const contentLength = text.length;
|
|
140053
|
-
let i = 0;
|
|
140054
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
140055
|
-
const consume = () => tokens[i++];
|
|
140056
|
-
const eof = () => i >= tokens.length;
|
|
140057
|
-
function parseField() {
|
|
140058
|
-
const token = consume();
|
|
140059
|
-
return {
|
|
140060
|
-
quoted: token.type === 'escaped-text' ? true : false,
|
|
140061
|
-
value: token.value,
|
|
140062
|
-
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))
|
|
140063
|
-
};
|
|
140064
|
-
}
|
|
140065
|
-
function parseRow() {
|
|
140066
|
-
var _a;
|
|
140067
|
-
const row = {
|
|
140068
|
-
fields: [],
|
|
140069
|
-
range: ux_i18n_properties_1.Range.create(0, 0, 0, 0)
|
|
140070
|
-
};
|
|
140071
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'eol') {
|
|
140072
|
-
if (peek().type === 'escaped-text' || peek().type === 'text') {
|
|
140073
|
-
row.fields.push(parseField());
|
|
140074
|
-
}
|
|
140075
|
-
const next = peek();
|
|
140076
|
-
if (next && next.type !== 'eol') {
|
|
140077
|
-
if (next.type === 'separator' && peek(1) === undefined) {
|
|
140078
|
-
// trailing separator at the end of file
|
|
140079
|
-
row.fields.push({
|
|
140080
|
-
quoted: false,
|
|
140081
|
-
value: '',
|
|
140082
|
-
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))
|
|
140083
|
-
});
|
|
140084
|
-
}
|
|
140085
|
-
consume();
|
|
140086
|
-
}
|
|
140087
|
-
}
|
|
140088
|
-
if (row.fields.length) {
|
|
140089
|
-
const start = row.fields[0].range.start;
|
|
140090
|
-
const end = row.fields[row.fields.length - 1].range.end;
|
|
140091
|
-
row.range = ux_i18n_properties_1.Range.create(start.line, start.character, end.line, end.character);
|
|
140092
|
-
}
|
|
140093
|
-
return row;
|
|
140094
|
-
}
|
|
140095
|
-
function parseDocument() {
|
|
140096
|
-
var _a, _b;
|
|
140097
|
-
const document = {
|
|
140098
|
-
header: parseRow(),
|
|
140099
|
-
rows: []
|
|
140100
|
-
};
|
|
140101
|
-
while (!eof()) {
|
|
140102
|
-
if (((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) === 'escaped-text' || ((_b = peek()) === null || _b === void 0 ? void 0 : _b.type) === 'text') {
|
|
140103
|
-
document.rows.push(parseRow());
|
|
140104
|
-
}
|
|
140105
|
-
consume();
|
|
140106
|
-
}
|
|
140107
|
-
return document;
|
|
140108
|
-
}
|
|
140109
|
-
return parseDocument();
|
|
140110
|
-
}
|
|
140111
|
-
exports.parseCsv = parseCsv;
|
|
140112
|
-
function tokenize(text) {
|
|
140113
|
-
const tokens = [];
|
|
140114
|
-
let i = 0;
|
|
140115
|
-
let value = '';
|
|
140116
|
-
let mode = 'default';
|
|
140117
|
-
let start = 0;
|
|
140118
|
-
let lastTextTokenType = 'text';
|
|
140119
|
-
while (i < text.length) {
|
|
140120
|
-
const character = text[i];
|
|
140121
|
-
if (mode === 'default') {
|
|
140122
|
-
if (SEPARATOR.test(character) || character === '\n') {
|
|
140123
|
-
tokens.push({
|
|
140124
|
-
type: lastTextTokenType,
|
|
140125
|
-
value,
|
|
140126
|
-
start,
|
|
140127
|
-
end: i
|
|
140128
|
-
});
|
|
140129
|
-
if (character === '\n') {
|
|
140130
|
-
tokens.push({
|
|
140131
|
-
type: 'eol',
|
|
140132
|
-
value: '\n',
|
|
140133
|
-
start: i,
|
|
140134
|
-
end: i + 1
|
|
140135
|
-
});
|
|
140136
|
-
}
|
|
140137
|
-
else if (SEPARATOR.test(character)) {
|
|
140138
|
-
tokens.push({
|
|
140139
|
-
type: 'separator',
|
|
140140
|
-
value: character,
|
|
140141
|
-
start: i,
|
|
140142
|
-
end: i + 1
|
|
140143
|
-
});
|
|
140144
|
-
}
|
|
140145
|
-
value = '';
|
|
140146
|
-
start = i + 1;
|
|
140147
|
-
lastTextTokenType = 'text';
|
|
140148
|
-
}
|
|
140149
|
-
else if (character === '"') {
|
|
140150
|
-
mode = 'quoted';
|
|
140151
|
-
}
|
|
140152
|
-
else {
|
|
140153
|
-
value += character;
|
|
140154
|
-
}
|
|
140155
|
-
}
|
|
140156
|
-
else if (mode === 'quoted') {
|
|
140157
|
-
if (character === '"') {
|
|
140158
|
-
// we need to check if it is escaping next double quote
|
|
140159
|
-
if (i + 1 < text.length && text[i + 1] === '"') {
|
|
140160
|
-
value += '"';
|
|
140161
|
-
i++;
|
|
140162
|
-
}
|
|
140163
|
-
else {
|
|
140164
|
-
lastTextTokenType = 'escaped-text';
|
|
140165
|
-
mode = 'default';
|
|
140166
|
-
}
|
|
140167
|
-
}
|
|
140168
|
-
else {
|
|
140169
|
-
value += character;
|
|
140170
|
-
}
|
|
140171
|
-
}
|
|
140172
|
-
i++;
|
|
140173
|
-
}
|
|
140174
|
-
if (value) {
|
|
140175
|
-
tokens.push({
|
|
140176
|
-
type: 'text',
|
|
140177
|
-
value,
|
|
140178
|
-
start,
|
|
140179
|
-
end: i
|
|
140180
|
-
});
|
|
140181
|
-
}
|
|
140182
|
-
return tokens;
|
|
140183
|
-
}
|
|
140184
|
-
exports.tokenize = tokenize;
|
|
140185
|
-
|
|
140186
|
-
|
|
140187
|
-
/***/ }),
|
|
140188
|
-
|
|
140189
|
-
/***/ 98702:
|
|
140190
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140191
|
-
|
|
140192
|
-
"use strict";
|
|
140193
|
-
|
|
140194
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140195
|
-
var csv_1 = __webpack_require__(98944);
|
|
140196
|
-
exports.addCsvTexts = csv_1.addCsvTexts;
|
|
140197
|
-
exports.loadCsvTexts = csv_1.loadCsvTexts;
|
|
140198
|
-
var json_1 = __webpack_require__(34692);
|
|
140199
|
-
exports.addJsonTexts = json_1.addJsonTexts;
|
|
140200
|
-
exports.loadJsonTexts = json_1.loadJsonTexts;
|
|
140201
|
-
var resolve_1 = __webpack_require__(96749);
|
|
140202
|
-
exports.getI18nFolderNames = resolve_1.getI18nFolderNames;
|
|
140203
|
-
exports.getCapI18nBundle = resolve_1.getCapI18nBundle;
|
|
140204
|
-
var add_1 = __webpack_require__(42745);
|
|
140205
|
-
exports.addI18nEntriesForCdsFile = add_1.addI18nEntriesForCdsFile;
|
|
140206
|
-
|
|
140207
|
-
|
|
140208
|
-
/***/ }),
|
|
140209
|
-
|
|
140210
|
-
/***/ 34692:
|
|
140211
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140212
|
-
|
|
140213
|
-
"use strict";
|
|
140214
|
-
|
|
140215
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140216
|
-
const jsonc_parser_1 = __webpack_require__(48617);
|
|
140217
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
140218
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
140219
|
-
const utils_1 = __webpack_require__(8655);
|
|
140220
|
-
function loadJsonTexts(text, filePath = '') {
|
|
140221
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
140222
|
-
const bundle = {};
|
|
140223
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
140224
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
140225
|
-
const contentLength = text.length;
|
|
140226
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
140227
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
140228
|
-
for (const localeNode of localeNodes) {
|
|
140229
|
-
if (localeNode.type === 'property') {
|
|
140230
|
-
const entries = [];
|
|
140231
|
-
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 : '';
|
|
140232
|
-
bundle[locale] = entries;
|
|
140233
|
-
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 : [];
|
|
140234
|
-
for (const textNode of textNodes) {
|
|
140235
|
-
if (textNode.type === 'property') {
|
|
140236
|
-
const key = toTextNode(((_h = textNode.children) !== null && _h !== void 0 ? _h : [])[0], lineOffsets, contentLength);
|
|
140237
|
-
const value = toTextNode(((_j = textNode.children) !== null && _j !== void 0 ? _j : [])[1], lineOffsets, contentLength);
|
|
140238
|
-
entries.push({
|
|
140239
|
-
filePath,
|
|
140240
|
-
key,
|
|
140241
|
-
value
|
|
140242
|
-
});
|
|
140243
|
-
}
|
|
140244
|
-
}
|
|
140245
|
-
}
|
|
140246
|
-
}
|
|
140247
|
-
}
|
|
140248
|
-
return bundle;
|
|
140249
|
-
}
|
|
140250
|
-
exports.loadJsonTexts = loadJsonTexts;
|
|
140251
|
-
function createFullBundle(fallbackLocale, newEntries) {
|
|
140252
|
-
const fallbackBundle = newEntries.reduce((acc, entry) => {
|
|
140253
|
-
acc[entry.key] = entry.value;
|
|
140254
|
-
return acc;
|
|
140255
|
-
}, {});
|
|
140256
|
-
const bundle = {
|
|
140257
|
-
[fallbackLocale]: fallbackBundle
|
|
140258
|
-
};
|
|
140259
|
-
return bundle;
|
|
140260
|
-
}
|
|
140261
|
-
function addJsonTexts(text, fallbackLocale, newEntries) {
|
|
140262
|
-
var _a, _b, _c;
|
|
140263
|
-
if (text === '') {
|
|
140264
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
140265
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
140266
|
-
}
|
|
140267
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
140268
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
140269
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
140270
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
140271
|
-
const indent = utils_1.discoverIndent(text);
|
|
140272
|
-
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; });
|
|
140273
|
-
if (fallbackLocaleNode) {
|
|
140274
|
-
const bundleNode = ((_b = fallbackLocaleNode.children) !== null && _b !== void 0 ? _b : [])[1];
|
|
140275
|
-
const textNodes = (_c = bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.children) !== null && _c !== void 0 ? _c : [];
|
|
140276
|
-
if (textNodes.length) {
|
|
140277
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
140278
|
-
const position = document.positionAt(textNodes[0].offset);
|
|
140279
|
-
let newText = '';
|
|
140280
|
-
for (let i = 0; i < newEntries.length; i++) {
|
|
140281
|
-
const entry = newEntries[i];
|
|
140282
|
-
newText += `${indent + indent}"${entry.key}": "${entry.value}",${eol}`;
|
|
140283
|
-
}
|
|
140284
|
-
const edit = {
|
|
140285
|
-
newText: newText,
|
|
140286
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
140287
|
-
};
|
|
140288
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
140289
|
-
}
|
|
140290
|
-
else if (bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.offset) {
|
|
140291
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
140292
|
-
const start = document.positionAt(bundleNode.offset);
|
|
140293
|
-
const end = document.positionAt(bundleNode.offset + bundleNode.length);
|
|
140294
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
140295
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
140296
|
-
const indented = utils_1.applyIndent(`${newText}`, indent, eol, false);
|
|
140297
|
-
const edit = {
|
|
140298
|
-
newText: indented,
|
|
140299
|
-
range: ux_i18n_properties_1.Range.create(start, end)
|
|
140300
|
-
};
|
|
140301
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
140302
|
-
}
|
|
140303
|
-
}
|
|
140304
|
-
else if (localeNodes.length === 0) {
|
|
140305
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
140306
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
140307
|
-
}
|
|
140308
|
-
else {
|
|
140309
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
140310
|
-
const [last] = localeNodes.slice(-1);
|
|
140311
|
-
const position = document.positionAt(last.offset);
|
|
140312
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
140313
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
140314
|
-
const indented = utils_1.applyIndent(`"${fallbackLocale}": ${newText},`, indent, eol);
|
|
140315
|
-
const edit = {
|
|
140316
|
-
newText: indented + eol,
|
|
140317
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
140318
|
-
};
|
|
140319
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
140320
|
-
}
|
|
140321
|
-
}
|
|
140322
|
-
return text;
|
|
140323
|
-
}
|
|
140324
|
-
exports.addJsonTexts = addJsonTexts;
|
|
140325
|
-
function createTextNode(value, range) {
|
|
140326
|
-
return {
|
|
140327
|
-
value,
|
|
140328
|
-
range
|
|
140329
|
-
};
|
|
140330
|
-
}
|
|
140331
|
-
exports.createTextNode = createTextNode;
|
|
140332
|
-
function toTextNode(node, lineOffsets, contentLength) {
|
|
140333
|
-
if (node) {
|
|
140334
|
-
switch (typeof node.value) {
|
|
140335
|
-
case 'string': {
|
|
140336
|
-
// for string literals node offset starts with '"' character, but we don't include it in the text node range
|
|
140337
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset + 1, contentLength);
|
|
140338
|
-
const { value } = node;
|
|
140339
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
140340
|
-
}
|
|
140341
|
-
case 'number': {
|
|
140342
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
140343
|
-
const value = node.value.toString();
|
|
140344
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
140345
|
-
}
|
|
140346
|
-
case 'boolean': {
|
|
140347
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
140348
|
-
// CDS currently uses the boolean value if its true, otherwise falls back to using the key
|
|
140349
|
-
const value = node.value ? 'true' : '';
|
|
140350
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
140351
|
-
}
|
|
140352
|
-
default: {
|
|
140353
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
140354
|
-
return createTextNode('', ux_i18n_properties_1.Range.create(start, start));
|
|
140355
|
-
}
|
|
140356
|
-
}
|
|
140357
|
-
}
|
|
140358
|
-
}
|
|
140359
|
-
|
|
140360
|
-
|
|
140361
|
-
/***/ }),
|
|
140362
|
-
|
|
140363
|
-
/***/ 96749:
|
|
140364
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140365
|
-
|
|
140366
|
-
"use strict";
|
|
140367
|
-
|
|
140368
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140369
|
-
const path_1 = __webpack_require__(71017);
|
|
140370
|
-
const fs_1 = __webpack_require__(57147);
|
|
140371
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
140372
|
-
const csv_1 = __webpack_require__(98944);
|
|
140373
|
-
const json_1 = __webpack_require__(34692);
|
|
140374
|
-
const utils_1 = __webpack_require__(8655);
|
|
140375
|
-
/**
|
|
140376
|
-
* Returns a list of allowed i18n folder names, where translation files can be found.
|
|
140377
|
-
*/
|
|
140378
|
-
function getI18nFolderNames(env) {
|
|
140379
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
140380
|
-
return folders;
|
|
140381
|
-
}
|
|
140382
|
-
exports.getI18nFolderNames = getI18nFolderNames;
|
|
140383
|
-
/**
|
|
140384
|
-
* Returns the location of an existing _i18n folder next to or in the
|
|
140385
|
-
* folder hierarchy above the given path, if any.
|
|
140386
|
-
* @param env CDS environment configuration
|
|
140387
|
-
* @param filePath CDS source file path
|
|
140388
|
-
* @param cache If translation file mapping should be cached
|
|
140389
|
-
*/
|
|
140390
|
-
function resolveI18nFolderForFile(env, filePath) {
|
|
140391
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
140392
|
-
function resolve(path) {
|
|
140393
|
-
// check whether a <path>/_i18n exists
|
|
140394
|
-
for (const folderName of folders) {
|
|
140395
|
-
const folderPath = path_1.join(path, folderName);
|
|
140396
|
-
if (fs_1.existsSync(folderPath)) {
|
|
140397
|
-
return folderPath;
|
|
140398
|
-
}
|
|
140399
|
-
}
|
|
140400
|
-
//> no --> search up the folder hierarchy
|
|
140401
|
-
const next = path_1.dirname(path);
|
|
140402
|
-
return next === path ? undefined : resolve(next);
|
|
140403
|
-
}
|
|
140404
|
-
return resolve(filePath);
|
|
140405
|
-
}
|
|
140406
|
-
exports.resolveI18nFolderForFile = resolveI18nFolderForFile;
|
|
140407
|
-
/**
|
|
140408
|
-
* Merges i18n files in to a single bundle for CDS source files
|
|
140409
|
-
* @param env CDS environment configuration
|
|
140410
|
-
* @param filePaths CDS file path
|
|
140411
|
-
* @param logger Fiori tools logger
|
|
140412
|
-
*/
|
|
140413
|
-
async function getCapI18nBundle(env, filePaths, logger) {
|
|
140414
|
-
var _a;
|
|
140415
|
-
const { defaultLanguage, fallbackLanguage, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
140416
|
-
const bundle = {};
|
|
140417
|
-
const i18nFiles = filePaths.reduce((acc, filePath) => {
|
|
140418
|
-
const i18nFolder = resolveI18nFolderForFile(env, filePath);
|
|
140419
|
-
if (i18nFolder) {
|
|
140420
|
-
const file = path_1.join(i18nFolder, baseFileName);
|
|
140421
|
-
if (acc.indexOf(file) === -1) {
|
|
140422
|
-
acc.push(file);
|
|
140423
|
-
}
|
|
140424
|
-
}
|
|
140425
|
-
return acc;
|
|
140426
|
-
}, []);
|
|
140427
|
-
const loaders = [
|
|
140428
|
-
{ loader: json_1.loadJsonTexts, filePathFormatter: utils_1.jsonPathFormatter },
|
|
140429
|
-
{
|
|
140430
|
-
loader: (content, path) => ({
|
|
140431
|
-
[fallbackLanguage]: ux_i18n_properties_1.loadPropertiesTexts(content, path)
|
|
140432
|
-
}),
|
|
140433
|
-
filePathFormatter: utils_1.propertiesPathFormatter
|
|
140434
|
-
},
|
|
140435
|
-
{ loader: csv_1.loadCsvTexts, filePathFormatter: utils_1.csvPathFormatter }
|
|
140436
|
-
];
|
|
140437
|
-
for (const path of i18nFiles) {
|
|
140438
|
-
let loaded = false;
|
|
140439
|
-
let hasError = false;
|
|
140440
|
-
for (const { loader, filePathFormatter } of loaders) {
|
|
140441
|
-
const i18nFilePath = filePathFormatter(path, env);
|
|
140442
|
-
try {
|
|
140443
|
-
const entries = await tryLoadTexts(i18nFilePath, loader);
|
|
140444
|
-
if (entries) {
|
|
140445
|
-
const currentBundle = (_a = entries[fallbackLanguage]) !== null && _a !== void 0 ? _a : entries[defaultLanguage];
|
|
140446
|
-
for (const entry of currentBundle) {
|
|
140447
|
-
if (bundle[entry.key.value]) {
|
|
140448
|
-
bundle[entry.key.value].push(entry);
|
|
140449
|
-
}
|
|
140450
|
-
else {
|
|
140451
|
-
bundle[entry.key.value] = [entry];
|
|
140452
|
-
}
|
|
140453
|
-
}
|
|
140454
|
-
logger.info(`Loaded i18n texts from ${i18nFilePath}`);
|
|
140455
|
-
loaded = true;
|
|
140456
|
-
break;
|
|
140457
|
-
}
|
|
140458
|
-
}
|
|
140459
|
-
catch (error) {
|
|
140460
|
-
hasError = true;
|
|
140461
|
-
logger.error(`Failed to load ${i18nFilePath}. ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
140462
|
-
break;
|
|
140463
|
-
}
|
|
140464
|
-
}
|
|
140465
|
-
if (!loaded && !hasError) {
|
|
140466
|
-
logger.error(`No translation file found in ${path_1.dirname(path)}`);
|
|
140467
|
-
}
|
|
140468
|
-
}
|
|
140469
|
-
return bundle;
|
|
140470
|
-
}
|
|
140471
|
-
exports.getCapI18nBundle = getCapI18nBundle;
|
|
140472
|
-
async function tryLoadTexts(path, loader) {
|
|
140473
|
-
try {
|
|
140474
|
-
const content = await fs_1.promises.readFile(path, { encoding: 'utf8' });
|
|
140475
|
-
return loader(content, path);
|
|
140476
|
-
}
|
|
140477
|
-
catch (error) {
|
|
140478
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
140479
|
-
return;
|
|
140480
|
-
}
|
|
140481
|
-
else {
|
|
140482
|
-
throw error;
|
|
140483
|
-
}
|
|
140484
|
-
}
|
|
140485
|
-
}
|
|
140486
|
-
|
|
140487
|
-
|
|
140488
|
-
/***/ }),
|
|
140489
|
-
|
|
140490
|
-
/***/ 8655:
|
|
140491
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
140492
|
-
|
|
140493
|
-
"use strict";
|
|
140494
|
-
|
|
140495
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140496
|
-
const LINE_ENDING_PATTERN = /\r|\n|\r?\n/;
|
|
140497
|
-
const INDENT_PATTERN = /(?:\r|\n|\r?\n)([\t|\s]+)/;
|
|
140498
|
-
function discoverLineEnding(text) {
|
|
140499
|
-
for (let i = 0; i < text.length; i++) {
|
|
140500
|
-
const character = text[i];
|
|
140501
|
-
if (character === '\r') {
|
|
140502
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
140503
|
-
return '\r\n';
|
|
140504
|
-
}
|
|
140505
|
-
return '\r';
|
|
140506
|
-
}
|
|
140507
|
-
else if (character === '\n') {
|
|
140508
|
-
return '\n';
|
|
140509
|
-
}
|
|
140510
|
-
}
|
|
140511
|
-
return '\n';
|
|
140512
|
-
}
|
|
140513
|
-
exports.discoverLineEnding = discoverLineEnding;
|
|
140514
|
-
function discoverIndent(text) {
|
|
140515
|
-
const match = INDENT_PATTERN.exec(text);
|
|
140516
|
-
if (match) {
|
|
140517
|
-
return match[1];
|
|
140518
|
-
}
|
|
140519
|
-
return ' ';
|
|
140520
|
-
}
|
|
140521
|
-
exports.discoverIndent = discoverIndent;
|
|
140522
|
-
function applyIndent(text, indent, eol, indentFirstLine = true) {
|
|
140523
|
-
const lines = text.split(LINE_ENDING_PATTERN);
|
|
140524
|
-
let out = '';
|
|
140525
|
-
for (let i = 0; i < lines.length; i++) {
|
|
140526
|
-
const line = lines[i];
|
|
140527
|
-
if (!indentFirstLine && i === 0) {
|
|
140528
|
-
out += line;
|
|
140529
|
-
}
|
|
140530
|
-
else {
|
|
140531
|
-
out += indent + line;
|
|
140532
|
-
}
|
|
140533
|
-
if (i + 1 !== lines.length) {
|
|
140534
|
-
out += eol;
|
|
140535
|
-
}
|
|
140536
|
-
}
|
|
140537
|
-
return out;
|
|
140538
|
-
}
|
|
140539
|
-
exports.applyIndent = applyIndent;
|
|
140540
|
-
function getI18nConfiguration(env) {
|
|
140541
|
-
const { default_language, fallback_bundle, file, folders } = (env && env.i18n) || {};
|
|
140542
|
-
return {
|
|
140543
|
-
defaultLanguage: default_language !== null && default_language !== void 0 ? default_language : 'en',
|
|
140544
|
-
fallbackLanguage: fallback_bundle !== null && fallback_bundle !== void 0 ? fallback_bundle : '',
|
|
140545
|
-
baseFileName: file !== null && file !== void 0 ? file : 'i18n',
|
|
140546
|
-
folders: folders !== null && folders !== void 0 ? folders : ['_i18n', 'i18n']
|
|
140547
|
-
};
|
|
140548
|
-
}
|
|
140549
|
-
exports.getI18nConfiguration = getI18nConfiguration;
|
|
140550
|
-
function jsonPathFormatter(path) {
|
|
140551
|
-
return `${path}.json`;
|
|
140552
|
-
}
|
|
140553
|
-
exports.jsonPathFormatter = jsonPathFormatter;
|
|
140554
|
-
function propertiesPathFormatter(path, env) {
|
|
140555
|
-
const { fallbackLanguage } = getI18nConfiguration(env);
|
|
140556
|
-
return `${path}${fallbackLanguage === '' ? '' : `_${fallbackLanguage}`}.properties`;
|
|
140557
|
-
}
|
|
140558
|
-
exports.propertiesPathFormatter = propertiesPathFormatter;
|
|
140559
|
-
function csvPathFormatter(path) {
|
|
140560
|
-
return `${path}.csv`;
|
|
140561
|
-
}
|
|
140562
|
-
exports.csvPathFormatter = csvPathFormatter;
|
|
140563
|
-
|
|
140564
|
-
|
|
140565
|
-
/***/ }),
|
|
140566
|
-
|
|
140567
|
-
/***/ 43290:
|
|
140568
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140569
|
-
|
|
140570
|
-
"use strict";
|
|
140571
|
-
|
|
140572
|
-
function __export(m) {
|
|
140573
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
140574
|
-
}
|
|
140575
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140576
|
-
__export(__webpack_require__(9929));
|
|
140577
|
-
__export(__webpack_require__(98702));
|
|
140578
|
-
|
|
140579
|
-
|
|
140580
137083
|
/***/ }),
|
|
140581
137084
|
|
|
140582
137085
|
/***/ 87616:
|
|
@@ -140586,7 +137089,6 @@ __export(__webpack_require__(98702));
|
|
|
140586
137089
|
|
|
140587
137090
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140588
137091
|
const path_1 = __webpack_require__(71017);
|
|
140589
|
-
const fs_1 = __webpack_require__(57147);
|
|
140590
137092
|
const file_1 = __webpack_require__(13681);
|
|
140591
137093
|
exports.CAP_SERVICES_FOLDER = 'srv';
|
|
140592
137094
|
exports.CAP_APPS_FOLDER = 'app';
|
|
@@ -140648,32 +137150,9 @@ exports.isCapNodeJsProject = isCapNodeJsProject;
|
|
|
140648
137150
|
* @return {Promise<boolean>} - true if the project is a CAP project
|
|
140649
137151
|
*/
|
|
140650
137152
|
async function isCapJavaProject(projectRoot) {
|
|
140651
|
-
|
|
140652
|
-
return hasApplicationYaml;
|
|
137153
|
+
return file_1.fileExists(path_1.join(projectRoot, exports.CAP_SERVICES_FOLDER, 'src', 'main', 'resources', 'application.yaml'));
|
|
140653
137154
|
}
|
|
140654
137155
|
exports.isCapJavaProject = isCapJavaProject;
|
|
140655
|
-
/**
|
|
140656
|
-
* Get CAP CDS project custom paths for project root
|
|
140657
|
-
* @params {capProjectPath}
|
|
140658
|
-
* @returns {CapCustomPaths} Cap Custom Paths
|
|
140659
|
-
*/
|
|
140660
|
-
exports.getCapCustomPaths = function (capProjectPath) {
|
|
140661
|
-
var _a;
|
|
140662
|
-
const result = {};
|
|
140663
|
-
const packagePath = path_1.join(capProjectPath, 'package.json');
|
|
140664
|
-
try {
|
|
140665
|
-
const packageJson = JSON.parse(fs_1.readFileSync(packagePath, 'utf8'));
|
|
140666
|
-
if ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.cds) === null || _a === void 0 ? void 0 : _a.folders) {
|
|
140667
|
-
result.app = packageJson.cds.folders.app;
|
|
140668
|
-
result.db = packageJson.cds.folders.db;
|
|
140669
|
-
result.srv = packageJson.cds.folders.srv;
|
|
140670
|
-
}
|
|
140671
|
-
}
|
|
140672
|
-
catch (e) {
|
|
140673
|
-
// Ignore errors as may have no custom paths or invalid package.json
|
|
140674
|
-
}
|
|
140675
|
-
return result;
|
|
140676
|
-
};
|
|
140677
137156
|
exports.toAbsoluteUri = (project, relativeUri) => path_1.join(project.root, relativeUri);
|
|
140678
137157
|
exports.toReferenceUri = async (project, relativeUriFrom, relativeUriTo) => {
|
|
140679
137158
|
let relativeUri = '';
|
|
@@ -140772,20 +137251,6 @@ async function fileExists(path) {
|
|
|
140772
137251
|
exports.fileExists = fileExists;
|
|
140773
137252
|
|
|
140774
137253
|
|
|
140775
|
-
/***/ }),
|
|
140776
|
-
|
|
140777
|
-
/***/ 9929:
|
|
140778
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
140779
|
-
|
|
140780
|
-
"use strict";
|
|
140781
|
-
|
|
140782
|
-
function __export(m) {
|
|
140783
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
140784
|
-
}
|
|
140785
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
140786
|
-
__export(__webpack_require__(87616));
|
|
140787
|
-
|
|
140788
|
-
|
|
140789
137254
|
/***/ }),
|
|
140790
137255
|
|
|
140791
137256
|
/***/ 50553:
|
|
@@ -146762,7 +143227,7 @@ const getUi5Configuration = (libs, component, theme) => {
|
|
|
146762
143227
|
custom: true
|
|
146763
143228
|
}
|
|
146764
143229
|
];
|
|
146765
|
-
|
|
143230
|
+
return new Map([
|
|
146766
143231
|
['libs', libs],
|
|
146767
143232
|
['async', 'true'],
|
|
146768
143233
|
['preload', 'async'],
|
|
@@ -146774,7 +143239,6 @@ const getUi5Configuration = (libs, component, theme) => {
|
|
|
146774
143239
|
// Do not load Component-preload.js, since it is missing in development
|
|
146775
143240
|
['xx-componentPreload', 'off']
|
|
146776
143241
|
]);
|
|
146777
|
-
return config;
|
|
146778
143242
|
};
|
|
146779
143243
|
function serializeUi5Configuration(config) {
|
|
146780
143244
|
return serializeDataAttributes(config, 'data-sap-ui');
|
|
@@ -146795,12 +143259,7 @@ const hasChanges = (projectPath, webappPath) => {
|
|
|
146795
143259
|
const path = path_1.join(projectPath, webappPath, project_spec_1.DirName.Changes);
|
|
146796
143260
|
if (fs_1.existsSync(path)) {
|
|
146797
143261
|
const files = fs_1.readdirSync(path);
|
|
146798
|
-
|
|
146799
|
-
return true;
|
|
146800
|
-
}
|
|
146801
|
-
else {
|
|
146802
|
-
return false;
|
|
146803
|
-
}
|
|
143262
|
+
return files.length > 0;
|
|
146804
143263
|
}
|
|
146805
143264
|
else {
|
|
146806
143265
|
return false;
|
|
@@ -147544,8 +144003,7 @@ function createDistWorkspace() {
|
|
|
147544
144003
|
virBasePath,
|
|
147545
144004
|
fsBasePath: path_1.join(process.cwd(), 'dist')
|
|
147546
144005
|
});
|
|
147547
|
-
|
|
147548
|
-
return workspace;
|
|
144006
|
+
return fs_2.resourceFactory.createWorkspace({ reader: fs, name: 'fiori', virBasePath: 'fiori' });
|
|
147549
144007
|
}
|
|
147550
144008
|
exports.createDistWorkspace = createDistWorkspace;
|
|
147551
144009
|
/**
|
|
@@ -161785,7 +158243,7 @@ module.exports = {"i8":"0.2.0"};
|
|
|
161785
158243
|
/***/ ((module) => {
|
|
161786
158244
|
|
|
161787
158245
|
"use strict";
|
|
161788
|
-
module.exports = {"i8":"3.1.
|
|
158246
|
+
module.exports = {"i8":"3.1.7"};
|
|
161789
158247
|
|
|
161790
158248
|
/***/ }),
|
|
161791
158249
|
|
|
@@ -161965,14 +158423,6 @@ module.exports = {"i8":"3.3.3"};
|
|
|
161965
158423
|
|
|
161966
158424
|
/***/ }),
|
|
161967
158425
|
|
|
161968
|
-
/***/ 97992:
|
|
161969
|
-
/***/ ((module) => {
|
|
161970
|
-
|
|
161971
|
-
"use strict";
|
|
161972
|
-
module.exports = JSON.parse('{"Text_Key":"Text Key","Text_Value":"Text Value","Additional_Information":"Additional Information"}');
|
|
161973
|
-
|
|
161974
|
-
/***/ }),
|
|
161975
|
-
|
|
161976
158426
|
/***/ 13086:
|
|
161977
158427
|
/***/ ((module) => {
|
|
161978
158428
|
|
|
@@ -161985,7 +158435,7 @@ module.exports = JSON.parse('{"ERROR_SPECIFICATION_MISSING":"Seems specification
|
|
|
161985
158435
|
/***/ ((module) => {
|
|
161986
158436
|
|
|
161987
158437
|
"use strict";
|
|
161988
|
-
module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.5.
|
|
158438
|
+
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"}]}}');
|
|
161989
158439
|
|
|
161990
158440
|
/***/ }),
|
|
161991
158441
|
|