@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
package/dist/cli/index.js
CHANGED
|
@@ -68735,1524 +68735,6 @@ function serializer(replacer, cycleReplacer) {
|
|
|
68735
68735
|
}
|
|
68736
68736
|
|
|
68737
68737
|
|
|
68738
|
-
/***/ }),
|
|
68739
|
-
|
|
68740
|
-
/***/ 48617:
|
|
68741
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
68742
|
-
|
|
68743
|
-
"use strict";
|
|
68744
|
-
// ESM COMPAT FLAG
|
|
68745
|
-
__webpack_require__.r(__webpack_exports__);
|
|
68746
|
-
|
|
68747
|
-
// EXPORTS
|
|
68748
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
68749
|
-
"applyEdits": () => (/* binding */ applyEdits),
|
|
68750
|
-
"createScanner": () => (/* binding */ main_createScanner),
|
|
68751
|
-
"findNodeAtLocation": () => (/* binding */ main_findNodeAtLocation),
|
|
68752
|
-
"findNodeAtOffset": () => (/* binding */ main_findNodeAtOffset),
|
|
68753
|
-
"format": () => (/* binding */ main_format),
|
|
68754
|
-
"getLocation": () => (/* binding */ main_getLocation),
|
|
68755
|
-
"getNodePath": () => (/* binding */ main_getNodePath),
|
|
68756
|
-
"getNodeValue": () => (/* binding */ main_getNodeValue),
|
|
68757
|
-
"modify": () => (/* binding */ modify),
|
|
68758
|
-
"parse": () => (/* binding */ main_parse),
|
|
68759
|
-
"parseTree": () => (/* binding */ main_parseTree),
|
|
68760
|
-
"printParseErrorCode": () => (/* binding */ printParseErrorCode),
|
|
68761
|
-
"stripComments": () => (/* binding */ main_stripComments),
|
|
68762
|
-
"visit": () => (/* binding */ main_visit)
|
|
68763
|
-
});
|
|
68764
|
-
|
|
68765
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
68766
|
-
/*---------------------------------------------------------------------------------------------
|
|
68767
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
68768
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
68769
|
-
*--------------------------------------------------------------------------------------------*/
|
|
68770
|
-
|
|
68771
|
-
/**
|
|
68772
|
-
* Creates a JSON scanner on the given text.
|
|
68773
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
68774
|
-
*/
|
|
68775
|
-
function createScanner(text, ignoreTrivia) {
|
|
68776
|
-
if (ignoreTrivia === void 0) { ignoreTrivia = false; }
|
|
68777
|
-
var len = text.length;
|
|
68778
|
-
var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */;
|
|
68779
|
-
function scanHexDigits(count, exact) {
|
|
68780
|
-
var digits = 0;
|
|
68781
|
-
var value = 0;
|
|
68782
|
-
while (digits < count || !exact) {
|
|
68783
|
-
var ch = text.charCodeAt(pos);
|
|
68784
|
-
if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) {
|
|
68785
|
-
value = value * 16 + ch - 48 /* _0 */;
|
|
68786
|
-
}
|
|
68787
|
-
else if (ch >= 65 /* A */ && ch <= 70 /* F */) {
|
|
68788
|
-
value = value * 16 + ch - 65 /* A */ + 10;
|
|
68789
|
-
}
|
|
68790
|
-
else if (ch >= 97 /* a */ && ch <= 102 /* f */) {
|
|
68791
|
-
value = value * 16 + ch - 97 /* a */ + 10;
|
|
68792
|
-
}
|
|
68793
|
-
else {
|
|
68794
|
-
break;
|
|
68795
|
-
}
|
|
68796
|
-
pos++;
|
|
68797
|
-
digits++;
|
|
68798
|
-
}
|
|
68799
|
-
if (digits < count) {
|
|
68800
|
-
value = -1;
|
|
68801
|
-
}
|
|
68802
|
-
return value;
|
|
68803
|
-
}
|
|
68804
|
-
function setPosition(newPosition) {
|
|
68805
|
-
pos = newPosition;
|
|
68806
|
-
value = '';
|
|
68807
|
-
tokenOffset = 0;
|
|
68808
|
-
token = 16 /* Unknown */;
|
|
68809
|
-
scanError = 0 /* None */;
|
|
68810
|
-
}
|
|
68811
|
-
function scanNumber() {
|
|
68812
|
-
var start = pos;
|
|
68813
|
-
if (text.charCodeAt(pos) === 48 /* _0 */) {
|
|
68814
|
-
pos++;
|
|
68815
|
-
}
|
|
68816
|
-
else {
|
|
68817
|
-
pos++;
|
|
68818
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
68819
|
-
pos++;
|
|
68820
|
-
}
|
|
68821
|
-
}
|
|
68822
|
-
if (pos < text.length && text.charCodeAt(pos) === 46 /* dot */) {
|
|
68823
|
-
pos++;
|
|
68824
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
68825
|
-
pos++;
|
|
68826
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
68827
|
-
pos++;
|
|
68828
|
-
}
|
|
68829
|
-
}
|
|
68830
|
-
else {
|
|
68831
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
68832
|
-
return text.substring(start, pos);
|
|
68833
|
-
}
|
|
68834
|
-
}
|
|
68835
|
-
var end = pos;
|
|
68836
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */)) {
|
|
68837
|
-
pos++;
|
|
68838
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) {
|
|
68839
|
-
pos++;
|
|
68840
|
-
}
|
|
68841
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
68842
|
-
pos++;
|
|
68843
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
68844
|
-
pos++;
|
|
68845
|
-
}
|
|
68846
|
-
end = pos;
|
|
68847
|
-
}
|
|
68848
|
-
else {
|
|
68849
|
-
scanError = 3 /* UnexpectedEndOfNumber */;
|
|
68850
|
-
}
|
|
68851
|
-
}
|
|
68852
|
-
return text.substring(start, end);
|
|
68853
|
-
}
|
|
68854
|
-
function scanString() {
|
|
68855
|
-
var result = '', start = pos;
|
|
68856
|
-
while (true) {
|
|
68857
|
-
if (pos >= len) {
|
|
68858
|
-
result += text.substring(start, pos);
|
|
68859
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
68860
|
-
break;
|
|
68861
|
-
}
|
|
68862
|
-
var ch = text.charCodeAt(pos);
|
|
68863
|
-
if (ch === 34 /* doubleQuote */) {
|
|
68864
|
-
result += text.substring(start, pos);
|
|
68865
|
-
pos++;
|
|
68866
|
-
break;
|
|
68867
|
-
}
|
|
68868
|
-
if (ch === 92 /* backslash */) {
|
|
68869
|
-
result += text.substring(start, pos);
|
|
68870
|
-
pos++;
|
|
68871
|
-
if (pos >= len) {
|
|
68872
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
68873
|
-
break;
|
|
68874
|
-
}
|
|
68875
|
-
var ch2 = text.charCodeAt(pos++);
|
|
68876
|
-
switch (ch2) {
|
|
68877
|
-
case 34 /* doubleQuote */:
|
|
68878
|
-
result += '\"';
|
|
68879
|
-
break;
|
|
68880
|
-
case 92 /* backslash */:
|
|
68881
|
-
result += '\\';
|
|
68882
|
-
break;
|
|
68883
|
-
case 47 /* slash */:
|
|
68884
|
-
result += '/';
|
|
68885
|
-
break;
|
|
68886
|
-
case 98 /* b */:
|
|
68887
|
-
result += '\b';
|
|
68888
|
-
break;
|
|
68889
|
-
case 102 /* f */:
|
|
68890
|
-
result += '\f';
|
|
68891
|
-
break;
|
|
68892
|
-
case 110 /* n */:
|
|
68893
|
-
result += '\n';
|
|
68894
|
-
break;
|
|
68895
|
-
case 114 /* r */:
|
|
68896
|
-
result += '\r';
|
|
68897
|
-
break;
|
|
68898
|
-
case 116 /* t */:
|
|
68899
|
-
result += '\t';
|
|
68900
|
-
break;
|
|
68901
|
-
case 117 /* u */:
|
|
68902
|
-
var ch3 = scanHexDigits(4, true);
|
|
68903
|
-
if (ch3 >= 0) {
|
|
68904
|
-
result += String.fromCharCode(ch3);
|
|
68905
|
-
}
|
|
68906
|
-
else {
|
|
68907
|
-
scanError = 4 /* InvalidUnicode */;
|
|
68908
|
-
}
|
|
68909
|
-
break;
|
|
68910
|
-
default:
|
|
68911
|
-
scanError = 5 /* InvalidEscapeCharacter */;
|
|
68912
|
-
}
|
|
68913
|
-
start = pos;
|
|
68914
|
-
continue;
|
|
68915
|
-
}
|
|
68916
|
-
if (ch >= 0 && ch <= 0x1f) {
|
|
68917
|
-
if (isLineBreak(ch)) {
|
|
68918
|
-
result += text.substring(start, pos);
|
|
68919
|
-
scanError = 2 /* UnexpectedEndOfString */;
|
|
68920
|
-
break;
|
|
68921
|
-
}
|
|
68922
|
-
else {
|
|
68923
|
-
scanError = 6 /* InvalidCharacter */;
|
|
68924
|
-
// mark as error but continue with string
|
|
68925
|
-
}
|
|
68926
|
-
}
|
|
68927
|
-
pos++;
|
|
68928
|
-
}
|
|
68929
|
-
return result;
|
|
68930
|
-
}
|
|
68931
|
-
function scanNext() {
|
|
68932
|
-
value = '';
|
|
68933
|
-
scanError = 0 /* None */;
|
|
68934
|
-
tokenOffset = pos;
|
|
68935
|
-
lineStartOffset = lineNumber;
|
|
68936
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
68937
|
-
if (pos >= len) {
|
|
68938
|
-
// at the end
|
|
68939
|
-
tokenOffset = len;
|
|
68940
|
-
return token = 17 /* EOF */;
|
|
68941
|
-
}
|
|
68942
|
-
var code = text.charCodeAt(pos);
|
|
68943
|
-
// trivia: whitespace
|
|
68944
|
-
if (isWhiteSpace(code)) {
|
|
68945
|
-
do {
|
|
68946
|
-
pos++;
|
|
68947
|
-
value += String.fromCharCode(code);
|
|
68948
|
-
code = text.charCodeAt(pos);
|
|
68949
|
-
} while (isWhiteSpace(code));
|
|
68950
|
-
return token = 15 /* Trivia */;
|
|
68951
|
-
}
|
|
68952
|
-
// trivia: newlines
|
|
68953
|
-
if (isLineBreak(code)) {
|
|
68954
|
-
pos++;
|
|
68955
|
-
value += String.fromCharCode(code);
|
|
68956
|
-
if (code === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
68957
|
-
pos++;
|
|
68958
|
-
value += '\n';
|
|
68959
|
-
}
|
|
68960
|
-
lineNumber++;
|
|
68961
|
-
tokenLineStartOffset = pos;
|
|
68962
|
-
return token = 14 /* LineBreakTrivia */;
|
|
68963
|
-
}
|
|
68964
|
-
switch (code) {
|
|
68965
|
-
// tokens: []{}:,
|
|
68966
|
-
case 123 /* openBrace */:
|
|
68967
|
-
pos++;
|
|
68968
|
-
return token = 1 /* OpenBraceToken */;
|
|
68969
|
-
case 125 /* closeBrace */:
|
|
68970
|
-
pos++;
|
|
68971
|
-
return token = 2 /* CloseBraceToken */;
|
|
68972
|
-
case 91 /* openBracket */:
|
|
68973
|
-
pos++;
|
|
68974
|
-
return token = 3 /* OpenBracketToken */;
|
|
68975
|
-
case 93 /* closeBracket */:
|
|
68976
|
-
pos++;
|
|
68977
|
-
return token = 4 /* CloseBracketToken */;
|
|
68978
|
-
case 58 /* colon */:
|
|
68979
|
-
pos++;
|
|
68980
|
-
return token = 6 /* ColonToken */;
|
|
68981
|
-
case 44 /* comma */:
|
|
68982
|
-
pos++;
|
|
68983
|
-
return token = 5 /* CommaToken */;
|
|
68984
|
-
// strings
|
|
68985
|
-
case 34 /* doubleQuote */:
|
|
68986
|
-
pos++;
|
|
68987
|
-
value = scanString();
|
|
68988
|
-
return token = 10 /* StringLiteral */;
|
|
68989
|
-
// comments
|
|
68990
|
-
case 47 /* slash */:
|
|
68991
|
-
var start = pos - 1;
|
|
68992
|
-
// Single-line comment
|
|
68993
|
-
if (text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
68994
|
-
pos += 2;
|
|
68995
|
-
while (pos < len) {
|
|
68996
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
68997
|
-
break;
|
|
68998
|
-
}
|
|
68999
|
-
pos++;
|
|
69000
|
-
}
|
|
69001
|
-
value = text.substring(start, pos);
|
|
69002
|
-
return token = 12 /* LineCommentTrivia */;
|
|
69003
|
-
}
|
|
69004
|
-
// Multi-line comment
|
|
69005
|
-
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
|
|
69006
|
-
pos += 2;
|
|
69007
|
-
var safeLength = len - 1; // For lookahead.
|
|
69008
|
-
var commentClosed = false;
|
|
69009
|
-
while (pos < safeLength) {
|
|
69010
|
-
var ch = text.charCodeAt(pos);
|
|
69011
|
-
if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) {
|
|
69012
|
-
pos += 2;
|
|
69013
|
-
commentClosed = true;
|
|
69014
|
-
break;
|
|
69015
|
-
}
|
|
69016
|
-
pos++;
|
|
69017
|
-
if (isLineBreak(ch)) {
|
|
69018
|
-
if (ch === 13 /* carriageReturn */ && text.charCodeAt(pos) === 10 /* lineFeed */) {
|
|
69019
|
-
pos++;
|
|
69020
|
-
}
|
|
69021
|
-
lineNumber++;
|
|
69022
|
-
tokenLineStartOffset = pos;
|
|
69023
|
-
}
|
|
69024
|
-
}
|
|
69025
|
-
if (!commentClosed) {
|
|
69026
|
-
pos++;
|
|
69027
|
-
scanError = 1 /* UnexpectedEndOfComment */;
|
|
69028
|
-
}
|
|
69029
|
-
value = text.substring(start, pos);
|
|
69030
|
-
return token = 13 /* BlockCommentTrivia */;
|
|
69031
|
-
}
|
|
69032
|
-
// just a single slash
|
|
69033
|
-
value += String.fromCharCode(code);
|
|
69034
|
-
pos++;
|
|
69035
|
-
return token = 16 /* Unknown */;
|
|
69036
|
-
// numbers
|
|
69037
|
-
case 45 /* minus */:
|
|
69038
|
-
value += String.fromCharCode(code);
|
|
69039
|
-
pos++;
|
|
69040
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
69041
|
-
return token = 16 /* Unknown */;
|
|
69042
|
-
}
|
|
69043
|
-
// found a minus, followed by a number so
|
|
69044
|
-
// we fall through to proceed with scanning
|
|
69045
|
-
// numbers
|
|
69046
|
-
case 48 /* _0 */:
|
|
69047
|
-
case 49 /* _1 */:
|
|
69048
|
-
case 50 /* _2 */:
|
|
69049
|
-
case 51 /* _3 */:
|
|
69050
|
-
case 52 /* _4 */:
|
|
69051
|
-
case 53 /* _5 */:
|
|
69052
|
-
case 54 /* _6 */:
|
|
69053
|
-
case 55 /* _7 */:
|
|
69054
|
-
case 56 /* _8 */:
|
|
69055
|
-
case 57 /* _9 */:
|
|
69056
|
-
value += scanNumber();
|
|
69057
|
-
return token = 11 /* NumericLiteral */;
|
|
69058
|
-
// literals and unknown symbols
|
|
69059
|
-
default:
|
|
69060
|
-
// is a literal? Read the full word.
|
|
69061
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
69062
|
-
pos++;
|
|
69063
|
-
code = text.charCodeAt(pos);
|
|
69064
|
-
}
|
|
69065
|
-
if (tokenOffset !== pos) {
|
|
69066
|
-
value = text.substring(tokenOffset, pos);
|
|
69067
|
-
// keywords: true, false, null
|
|
69068
|
-
switch (value) {
|
|
69069
|
-
case 'true': return token = 8 /* TrueKeyword */;
|
|
69070
|
-
case 'false': return token = 9 /* FalseKeyword */;
|
|
69071
|
-
case 'null': return token = 7 /* NullKeyword */;
|
|
69072
|
-
}
|
|
69073
|
-
return token = 16 /* Unknown */;
|
|
69074
|
-
}
|
|
69075
|
-
// some
|
|
69076
|
-
value += String.fromCharCode(code);
|
|
69077
|
-
pos++;
|
|
69078
|
-
return token = 16 /* Unknown */;
|
|
69079
|
-
}
|
|
69080
|
-
}
|
|
69081
|
-
function isUnknownContentCharacter(code) {
|
|
69082
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
69083
|
-
return false;
|
|
69084
|
-
}
|
|
69085
|
-
switch (code) {
|
|
69086
|
-
case 125 /* closeBrace */:
|
|
69087
|
-
case 93 /* closeBracket */:
|
|
69088
|
-
case 123 /* openBrace */:
|
|
69089
|
-
case 91 /* openBracket */:
|
|
69090
|
-
case 34 /* doubleQuote */:
|
|
69091
|
-
case 58 /* colon */:
|
|
69092
|
-
case 44 /* comma */:
|
|
69093
|
-
case 47 /* slash */:
|
|
69094
|
-
return false;
|
|
69095
|
-
}
|
|
69096
|
-
return true;
|
|
69097
|
-
}
|
|
69098
|
-
function scanNextNonTrivia() {
|
|
69099
|
-
var result;
|
|
69100
|
-
do {
|
|
69101
|
-
result = scanNext();
|
|
69102
|
-
} while (result >= 12 /* LineCommentTrivia */ && result <= 15 /* Trivia */);
|
|
69103
|
-
return result;
|
|
69104
|
-
}
|
|
69105
|
-
return {
|
|
69106
|
-
setPosition: setPosition,
|
|
69107
|
-
getPosition: function () { return pos; },
|
|
69108
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
69109
|
-
getToken: function () { return token; },
|
|
69110
|
-
getTokenValue: function () { return value; },
|
|
69111
|
-
getTokenOffset: function () { return tokenOffset; },
|
|
69112
|
-
getTokenLength: function () { return pos - tokenOffset; },
|
|
69113
|
-
getTokenStartLine: function () { return lineStartOffset; },
|
|
69114
|
-
getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; },
|
|
69115
|
-
getTokenError: function () { return scanError; },
|
|
69116
|
-
};
|
|
69117
|
-
}
|
|
69118
|
-
function isWhiteSpace(ch) {
|
|
69119
|
-
return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ ||
|
|
69120
|
-
ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ ||
|
|
69121
|
-
ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */;
|
|
69122
|
-
}
|
|
69123
|
-
function isLineBreak(ch) {
|
|
69124
|
-
return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */;
|
|
69125
|
-
}
|
|
69126
|
-
function isDigit(ch) {
|
|
69127
|
-
return ch >= 48 /* _0 */ && ch <= 57 /* _9 */;
|
|
69128
|
-
}
|
|
69129
|
-
|
|
69130
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
69131
|
-
/*---------------------------------------------------------------------------------------------
|
|
69132
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
69133
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
69134
|
-
*--------------------------------------------------------------------------------------------*/
|
|
69135
|
-
|
|
69136
|
-
|
|
69137
|
-
function format(documentText, range, options) {
|
|
69138
|
-
var initialIndentLevel;
|
|
69139
|
-
var formatText;
|
|
69140
|
-
var formatTextStart;
|
|
69141
|
-
var rangeStart;
|
|
69142
|
-
var rangeEnd;
|
|
69143
|
-
if (range) {
|
|
69144
|
-
rangeStart = range.offset;
|
|
69145
|
-
rangeEnd = rangeStart + range.length;
|
|
69146
|
-
formatTextStart = rangeStart;
|
|
69147
|
-
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
69148
|
-
formatTextStart--;
|
|
69149
|
-
}
|
|
69150
|
-
var endOffset = rangeEnd;
|
|
69151
|
-
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
69152
|
-
endOffset++;
|
|
69153
|
-
}
|
|
69154
|
-
formatText = documentText.substring(formatTextStart, endOffset);
|
|
69155
|
-
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
69156
|
-
}
|
|
69157
|
-
else {
|
|
69158
|
-
formatText = documentText;
|
|
69159
|
-
initialIndentLevel = 0;
|
|
69160
|
-
formatTextStart = 0;
|
|
69161
|
-
rangeStart = 0;
|
|
69162
|
-
rangeEnd = documentText.length;
|
|
69163
|
-
}
|
|
69164
|
-
var eol = getEOL(options, documentText);
|
|
69165
|
-
var lineBreak = false;
|
|
69166
|
-
var indentLevel = 0;
|
|
69167
|
-
var indentValue;
|
|
69168
|
-
if (options.insertSpaces) {
|
|
69169
|
-
indentValue = repeat(' ', options.tabSize || 4);
|
|
69170
|
-
}
|
|
69171
|
-
else {
|
|
69172
|
-
indentValue = '\t';
|
|
69173
|
-
}
|
|
69174
|
-
var scanner = createScanner(formatText, false);
|
|
69175
|
-
var hasError = false;
|
|
69176
|
-
function newLineAndIndent() {
|
|
69177
|
-
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
69178
|
-
}
|
|
69179
|
-
function scanNext() {
|
|
69180
|
-
var token = scanner.scan();
|
|
69181
|
-
lineBreak = false;
|
|
69182
|
-
while (token === 15 /* Trivia */ || token === 14 /* LineBreakTrivia */) {
|
|
69183
|
-
lineBreak = lineBreak || (token === 14 /* LineBreakTrivia */);
|
|
69184
|
-
token = scanner.scan();
|
|
69185
|
-
}
|
|
69186
|
-
hasError = token === 16 /* Unknown */ || scanner.getTokenError() !== 0 /* None */;
|
|
69187
|
-
return token;
|
|
69188
|
-
}
|
|
69189
|
-
var editOperations = [];
|
|
69190
|
-
function addEdit(text, startOffset, endOffset) {
|
|
69191
|
-
if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
|
|
69192
|
-
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
69193
|
-
}
|
|
69194
|
-
}
|
|
69195
|
-
var firstToken = scanNext();
|
|
69196
|
-
if (firstToken !== 17 /* EOF */) {
|
|
69197
|
-
var firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
69198
|
-
var initialIndent = repeat(indentValue, initialIndentLevel);
|
|
69199
|
-
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
69200
|
-
}
|
|
69201
|
-
while (firstToken !== 17 /* EOF */) {
|
|
69202
|
-
var firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
69203
|
-
var secondToken = scanNext();
|
|
69204
|
-
var replaceContent = '';
|
|
69205
|
-
while (!lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
69206
|
-
// comments on the same line: keep them on the same line, but ignore them otherwise
|
|
69207
|
-
var commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
69208
|
-
addEdit(' ', firstTokenEnd, commentTokenStart);
|
|
69209
|
-
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
69210
|
-
replaceContent = secondToken === 12 /* LineCommentTrivia */ ? newLineAndIndent() : '';
|
|
69211
|
-
secondToken = scanNext();
|
|
69212
|
-
}
|
|
69213
|
-
if (secondToken === 2 /* CloseBraceToken */) {
|
|
69214
|
-
if (firstToken !== 1 /* OpenBraceToken */) {
|
|
69215
|
-
indentLevel--;
|
|
69216
|
-
replaceContent = newLineAndIndent();
|
|
69217
|
-
}
|
|
69218
|
-
}
|
|
69219
|
-
else if (secondToken === 4 /* CloseBracketToken */) {
|
|
69220
|
-
if (firstToken !== 3 /* OpenBracketToken */) {
|
|
69221
|
-
indentLevel--;
|
|
69222
|
-
replaceContent = newLineAndIndent();
|
|
69223
|
-
}
|
|
69224
|
-
}
|
|
69225
|
-
else {
|
|
69226
|
-
switch (firstToken) {
|
|
69227
|
-
case 3 /* OpenBracketToken */:
|
|
69228
|
-
case 1 /* OpenBraceToken */:
|
|
69229
|
-
indentLevel++;
|
|
69230
|
-
replaceContent = newLineAndIndent();
|
|
69231
|
-
break;
|
|
69232
|
-
case 5 /* CommaToken */:
|
|
69233
|
-
case 12 /* LineCommentTrivia */:
|
|
69234
|
-
replaceContent = newLineAndIndent();
|
|
69235
|
-
break;
|
|
69236
|
-
case 13 /* BlockCommentTrivia */:
|
|
69237
|
-
if (lineBreak) {
|
|
69238
|
-
replaceContent = newLineAndIndent();
|
|
69239
|
-
}
|
|
69240
|
-
else {
|
|
69241
|
-
// symbol following comment on the same line: keep on same line, separate with ' '
|
|
69242
|
-
replaceContent = ' ';
|
|
69243
|
-
}
|
|
69244
|
-
break;
|
|
69245
|
-
case 6 /* ColonToken */:
|
|
69246
|
-
replaceContent = ' ';
|
|
69247
|
-
break;
|
|
69248
|
-
case 10 /* StringLiteral */:
|
|
69249
|
-
if (secondToken === 6 /* ColonToken */) {
|
|
69250
|
-
replaceContent = '';
|
|
69251
|
-
break;
|
|
69252
|
-
}
|
|
69253
|
-
// fall through
|
|
69254
|
-
case 7 /* NullKeyword */:
|
|
69255
|
-
case 8 /* TrueKeyword */:
|
|
69256
|
-
case 9 /* FalseKeyword */:
|
|
69257
|
-
case 11 /* NumericLiteral */:
|
|
69258
|
-
case 2 /* CloseBraceToken */:
|
|
69259
|
-
case 4 /* CloseBracketToken */:
|
|
69260
|
-
if (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */) {
|
|
69261
|
-
replaceContent = ' ';
|
|
69262
|
-
}
|
|
69263
|
-
else if (secondToken !== 5 /* CommaToken */ && secondToken !== 17 /* EOF */) {
|
|
69264
|
-
hasError = true;
|
|
69265
|
-
}
|
|
69266
|
-
break;
|
|
69267
|
-
case 16 /* Unknown */:
|
|
69268
|
-
hasError = true;
|
|
69269
|
-
break;
|
|
69270
|
-
}
|
|
69271
|
-
if (lineBreak && (secondToken === 12 /* LineCommentTrivia */ || secondToken === 13 /* BlockCommentTrivia */)) {
|
|
69272
|
-
replaceContent = newLineAndIndent();
|
|
69273
|
-
}
|
|
69274
|
-
}
|
|
69275
|
-
var secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
69276
|
-
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
69277
|
-
firstToken = secondToken;
|
|
69278
|
-
}
|
|
69279
|
-
return editOperations;
|
|
69280
|
-
}
|
|
69281
|
-
function repeat(s, count) {
|
|
69282
|
-
var result = '';
|
|
69283
|
-
for (var i = 0; i < count; i++) {
|
|
69284
|
-
result += s;
|
|
69285
|
-
}
|
|
69286
|
-
return result;
|
|
69287
|
-
}
|
|
69288
|
-
function computeIndentLevel(content, options) {
|
|
69289
|
-
var i = 0;
|
|
69290
|
-
var nChars = 0;
|
|
69291
|
-
var tabSize = options.tabSize || 4;
|
|
69292
|
-
while (i < content.length) {
|
|
69293
|
-
var ch = content.charAt(i);
|
|
69294
|
-
if (ch === ' ') {
|
|
69295
|
-
nChars++;
|
|
69296
|
-
}
|
|
69297
|
-
else if (ch === '\t') {
|
|
69298
|
-
nChars += tabSize;
|
|
69299
|
-
}
|
|
69300
|
-
else {
|
|
69301
|
-
break;
|
|
69302
|
-
}
|
|
69303
|
-
i++;
|
|
69304
|
-
}
|
|
69305
|
-
return Math.floor(nChars / tabSize);
|
|
69306
|
-
}
|
|
69307
|
-
function getEOL(options, text) {
|
|
69308
|
-
for (var i = 0; i < text.length; i++) {
|
|
69309
|
-
var ch = text.charAt(i);
|
|
69310
|
-
if (ch === '\r') {
|
|
69311
|
-
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
|
69312
|
-
return '\r\n';
|
|
69313
|
-
}
|
|
69314
|
-
return '\r';
|
|
69315
|
-
}
|
|
69316
|
-
else if (ch === '\n') {
|
|
69317
|
-
return '\n';
|
|
69318
|
-
}
|
|
69319
|
-
}
|
|
69320
|
-
return (options && options.eol) || '\n';
|
|
69321
|
-
}
|
|
69322
|
-
function isEOL(text, offset) {
|
|
69323
|
-
return '\r\n'.indexOf(text.charAt(offset)) !== -1;
|
|
69324
|
-
}
|
|
69325
|
-
|
|
69326
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
69327
|
-
/*---------------------------------------------------------------------------------------------
|
|
69328
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
69329
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
69330
|
-
*--------------------------------------------------------------------------------------------*/
|
|
69331
|
-
|
|
69332
|
-
|
|
69333
|
-
var ParseOptions;
|
|
69334
|
-
(function (ParseOptions) {
|
|
69335
|
-
ParseOptions.DEFAULT = {
|
|
69336
|
-
allowTrailingComma: false
|
|
69337
|
-
};
|
|
69338
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
69339
|
-
/**
|
|
69340
|
-
* 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.
|
|
69341
|
-
*/
|
|
69342
|
-
function getLocation(text, position) {
|
|
69343
|
-
var segments = []; // strings or numbers
|
|
69344
|
-
var earlyReturnException = new Object();
|
|
69345
|
-
var previousNode = undefined;
|
|
69346
|
-
var previousNodeInst = {
|
|
69347
|
-
value: {},
|
|
69348
|
-
offset: 0,
|
|
69349
|
-
length: 0,
|
|
69350
|
-
type: 'object',
|
|
69351
|
-
parent: undefined
|
|
69352
|
-
};
|
|
69353
|
-
var isAtPropertyKey = false;
|
|
69354
|
-
function setPreviousNode(value, offset, length, type) {
|
|
69355
|
-
previousNodeInst.value = value;
|
|
69356
|
-
previousNodeInst.offset = offset;
|
|
69357
|
-
previousNodeInst.length = length;
|
|
69358
|
-
previousNodeInst.type = type;
|
|
69359
|
-
previousNodeInst.colonOffset = undefined;
|
|
69360
|
-
previousNode = previousNodeInst;
|
|
69361
|
-
}
|
|
69362
|
-
try {
|
|
69363
|
-
visit(text, {
|
|
69364
|
-
onObjectBegin: function (offset, length) {
|
|
69365
|
-
if (position <= offset) {
|
|
69366
|
-
throw earlyReturnException;
|
|
69367
|
-
}
|
|
69368
|
-
previousNode = undefined;
|
|
69369
|
-
isAtPropertyKey = position > offset;
|
|
69370
|
-
segments.push(''); // push a placeholder (will be replaced)
|
|
69371
|
-
},
|
|
69372
|
-
onObjectProperty: function (name, offset, length) {
|
|
69373
|
-
if (position < offset) {
|
|
69374
|
-
throw earlyReturnException;
|
|
69375
|
-
}
|
|
69376
|
-
setPreviousNode(name, offset, length, 'property');
|
|
69377
|
-
segments[segments.length - 1] = name;
|
|
69378
|
-
if (position <= offset + length) {
|
|
69379
|
-
throw earlyReturnException;
|
|
69380
|
-
}
|
|
69381
|
-
},
|
|
69382
|
-
onObjectEnd: function (offset, length) {
|
|
69383
|
-
if (position <= offset) {
|
|
69384
|
-
throw earlyReturnException;
|
|
69385
|
-
}
|
|
69386
|
-
previousNode = undefined;
|
|
69387
|
-
segments.pop();
|
|
69388
|
-
},
|
|
69389
|
-
onArrayBegin: function (offset, length) {
|
|
69390
|
-
if (position <= offset) {
|
|
69391
|
-
throw earlyReturnException;
|
|
69392
|
-
}
|
|
69393
|
-
previousNode = undefined;
|
|
69394
|
-
segments.push(0);
|
|
69395
|
-
},
|
|
69396
|
-
onArrayEnd: function (offset, length) {
|
|
69397
|
-
if (position <= offset) {
|
|
69398
|
-
throw earlyReturnException;
|
|
69399
|
-
}
|
|
69400
|
-
previousNode = undefined;
|
|
69401
|
-
segments.pop();
|
|
69402
|
-
},
|
|
69403
|
-
onLiteralValue: function (value, offset, length) {
|
|
69404
|
-
if (position < offset) {
|
|
69405
|
-
throw earlyReturnException;
|
|
69406
|
-
}
|
|
69407
|
-
setPreviousNode(value, offset, length, getNodeType(value));
|
|
69408
|
-
if (position <= offset + length) {
|
|
69409
|
-
throw earlyReturnException;
|
|
69410
|
-
}
|
|
69411
|
-
},
|
|
69412
|
-
onSeparator: function (sep, offset, length) {
|
|
69413
|
-
if (position <= offset) {
|
|
69414
|
-
throw earlyReturnException;
|
|
69415
|
-
}
|
|
69416
|
-
if (sep === ':' && previousNode && previousNode.type === 'property') {
|
|
69417
|
-
previousNode.colonOffset = offset;
|
|
69418
|
-
isAtPropertyKey = false;
|
|
69419
|
-
previousNode = undefined;
|
|
69420
|
-
}
|
|
69421
|
-
else if (sep === ',') {
|
|
69422
|
-
var last = segments[segments.length - 1];
|
|
69423
|
-
if (typeof last === 'number') {
|
|
69424
|
-
segments[segments.length - 1] = last + 1;
|
|
69425
|
-
}
|
|
69426
|
-
else {
|
|
69427
|
-
isAtPropertyKey = true;
|
|
69428
|
-
segments[segments.length - 1] = '';
|
|
69429
|
-
}
|
|
69430
|
-
previousNode = undefined;
|
|
69431
|
-
}
|
|
69432
|
-
}
|
|
69433
|
-
});
|
|
69434
|
-
}
|
|
69435
|
-
catch (e) {
|
|
69436
|
-
if (e !== earlyReturnException) {
|
|
69437
|
-
throw e;
|
|
69438
|
-
}
|
|
69439
|
-
}
|
|
69440
|
-
return {
|
|
69441
|
-
path: segments,
|
|
69442
|
-
previousNode: previousNode,
|
|
69443
|
-
isAtPropertyKey: isAtPropertyKey,
|
|
69444
|
-
matches: function (pattern) {
|
|
69445
|
-
var k = 0;
|
|
69446
|
-
for (var i = 0; k < pattern.length && i < segments.length; i++) {
|
|
69447
|
-
if (pattern[k] === segments[i] || pattern[k] === '*') {
|
|
69448
|
-
k++;
|
|
69449
|
-
}
|
|
69450
|
-
else if (pattern[k] !== '**') {
|
|
69451
|
-
return false;
|
|
69452
|
-
}
|
|
69453
|
-
}
|
|
69454
|
-
return k === pattern.length;
|
|
69455
|
-
}
|
|
69456
|
-
};
|
|
69457
|
-
}
|
|
69458
|
-
/**
|
|
69459
|
-
* 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.
|
|
69460
|
-
* Therefore always check the errors list to find out if the input was valid.
|
|
69461
|
-
*/
|
|
69462
|
-
function parse(text, errors, options) {
|
|
69463
|
-
if (errors === void 0) { errors = []; }
|
|
69464
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
69465
|
-
var currentProperty = null;
|
|
69466
|
-
var currentParent = [];
|
|
69467
|
-
var previousParents = [];
|
|
69468
|
-
function onValue(value) {
|
|
69469
|
-
if (Array.isArray(currentParent)) {
|
|
69470
|
-
currentParent.push(value);
|
|
69471
|
-
}
|
|
69472
|
-
else if (currentProperty !== null) {
|
|
69473
|
-
currentParent[currentProperty] = value;
|
|
69474
|
-
}
|
|
69475
|
-
}
|
|
69476
|
-
var visitor = {
|
|
69477
|
-
onObjectBegin: function () {
|
|
69478
|
-
var object = {};
|
|
69479
|
-
onValue(object);
|
|
69480
|
-
previousParents.push(currentParent);
|
|
69481
|
-
currentParent = object;
|
|
69482
|
-
currentProperty = null;
|
|
69483
|
-
},
|
|
69484
|
-
onObjectProperty: function (name) {
|
|
69485
|
-
currentProperty = name;
|
|
69486
|
-
},
|
|
69487
|
-
onObjectEnd: function () {
|
|
69488
|
-
currentParent = previousParents.pop();
|
|
69489
|
-
},
|
|
69490
|
-
onArrayBegin: function () {
|
|
69491
|
-
var array = [];
|
|
69492
|
-
onValue(array);
|
|
69493
|
-
previousParents.push(currentParent);
|
|
69494
|
-
currentParent = array;
|
|
69495
|
-
currentProperty = null;
|
|
69496
|
-
},
|
|
69497
|
-
onArrayEnd: function () {
|
|
69498
|
-
currentParent = previousParents.pop();
|
|
69499
|
-
},
|
|
69500
|
-
onLiteralValue: onValue,
|
|
69501
|
-
onError: function (error, offset, length) {
|
|
69502
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
69503
|
-
}
|
|
69504
|
-
};
|
|
69505
|
-
visit(text, visitor, options);
|
|
69506
|
-
return currentParent[0];
|
|
69507
|
-
}
|
|
69508
|
-
/**
|
|
69509
|
-
* 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.
|
|
69510
|
-
*/
|
|
69511
|
-
function parseTree(text, errors, options) {
|
|
69512
|
-
if (errors === void 0) { errors = []; }
|
|
69513
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
69514
|
-
var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root
|
|
69515
|
-
function ensurePropertyComplete(endOffset) {
|
|
69516
|
-
if (currentParent.type === 'property') {
|
|
69517
|
-
currentParent.length = endOffset - currentParent.offset;
|
|
69518
|
-
currentParent = currentParent.parent;
|
|
69519
|
-
}
|
|
69520
|
-
}
|
|
69521
|
-
function onValue(valueNode) {
|
|
69522
|
-
currentParent.children.push(valueNode);
|
|
69523
|
-
return valueNode;
|
|
69524
|
-
}
|
|
69525
|
-
var visitor = {
|
|
69526
|
-
onObjectBegin: function (offset) {
|
|
69527
|
-
currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
69528
|
-
},
|
|
69529
|
-
onObjectProperty: function (name, offset, length) {
|
|
69530
|
-
currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
69531
|
-
currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });
|
|
69532
|
-
},
|
|
69533
|
-
onObjectEnd: function (offset, length) {
|
|
69534
|
-
ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete
|
|
69535
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
69536
|
-
currentParent = currentParent.parent;
|
|
69537
|
-
ensurePropertyComplete(offset + length);
|
|
69538
|
-
},
|
|
69539
|
-
onArrayBegin: function (offset, length) {
|
|
69540
|
-
currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });
|
|
69541
|
-
},
|
|
69542
|
-
onArrayEnd: function (offset, length) {
|
|
69543
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
69544
|
-
currentParent = currentParent.parent;
|
|
69545
|
-
ensurePropertyComplete(offset + length);
|
|
69546
|
-
},
|
|
69547
|
-
onLiteralValue: function (value, offset, length) {
|
|
69548
|
-
onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value });
|
|
69549
|
-
ensurePropertyComplete(offset + length);
|
|
69550
|
-
},
|
|
69551
|
-
onSeparator: function (sep, offset, length) {
|
|
69552
|
-
if (currentParent.type === 'property') {
|
|
69553
|
-
if (sep === ':') {
|
|
69554
|
-
currentParent.colonOffset = offset;
|
|
69555
|
-
}
|
|
69556
|
-
else if (sep === ',') {
|
|
69557
|
-
ensurePropertyComplete(offset);
|
|
69558
|
-
}
|
|
69559
|
-
}
|
|
69560
|
-
},
|
|
69561
|
-
onError: function (error, offset, length) {
|
|
69562
|
-
errors.push({ error: error, offset: offset, length: length });
|
|
69563
|
-
}
|
|
69564
|
-
};
|
|
69565
|
-
visit(text, visitor, options);
|
|
69566
|
-
var result = currentParent.children[0];
|
|
69567
|
-
if (result) {
|
|
69568
|
-
delete result.parent;
|
|
69569
|
-
}
|
|
69570
|
-
return result;
|
|
69571
|
-
}
|
|
69572
|
-
/**
|
|
69573
|
-
* Finds the node at the given path in a JSON DOM.
|
|
69574
|
-
*/
|
|
69575
|
-
function findNodeAtLocation(root, path) {
|
|
69576
|
-
if (!root) {
|
|
69577
|
-
return undefined;
|
|
69578
|
-
}
|
|
69579
|
-
var node = root;
|
|
69580
|
-
for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
|
|
69581
|
-
var segment = path_1[_i];
|
|
69582
|
-
if (typeof segment === 'string') {
|
|
69583
|
-
if (node.type !== 'object' || !Array.isArray(node.children)) {
|
|
69584
|
-
return undefined;
|
|
69585
|
-
}
|
|
69586
|
-
var found = false;
|
|
69587
|
-
for (var _a = 0, _b = node.children; _a < _b.length; _a++) {
|
|
69588
|
-
var propertyNode = _b[_a];
|
|
69589
|
-
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
|
|
69590
|
-
node = propertyNode.children[1];
|
|
69591
|
-
found = true;
|
|
69592
|
-
break;
|
|
69593
|
-
}
|
|
69594
|
-
}
|
|
69595
|
-
if (!found) {
|
|
69596
|
-
return undefined;
|
|
69597
|
-
}
|
|
69598
|
-
}
|
|
69599
|
-
else {
|
|
69600
|
-
var index = segment;
|
|
69601
|
-
if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
69602
|
-
return undefined;
|
|
69603
|
-
}
|
|
69604
|
-
node = node.children[index];
|
|
69605
|
-
}
|
|
69606
|
-
}
|
|
69607
|
-
return node;
|
|
69608
|
-
}
|
|
69609
|
-
/**
|
|
69610
|
-
* Gets the JSON path of the given JSON DOM node
|
|
69611
|
-
*/
|
|
69612
|
-
function getNodePath(node) {
|
|
69613
|
-
if (!node.parent || !node.parent.children) {
|
|
69614
|
-
return [];
|
|
69615
|
-
}
|
|
69616
|
-
var path = getNodePath(node.parent);
|
|
69617
|
-
if (node.parent.type === 'property') {
|
|
69618
|
-
var key = node.parent.children[0].value;
|
|
69619
|
-
path.push(key);
|
|
69620
|
-
}
|
|
69621
|
-
else if (node.parent.type === 'array') {
|
|
69622
|
-
var index = node.parent.children.indexOf(node);
|
|
69623
|
-
if (index !== -1) {
|
|
69624
|
-
path.push(index);
|
|
69625
|
-
}
|
|
69626
|
-
}
|
|
69627
|
-
return path;
|
|
69628
|
-
}
|
|
69629
|
-
/**
|
|
69630
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
69631
|
-
*/
|
|
69632
|
-
function getNodeValue(node) {
|
|
69633
|
-
switch (node.type) {
|
|
69634
|
-
case 'array':
|
|
69635
|
-
return node.children.map(getNodeValue);
|
|
69636
|
-
case 'object':
|
|
69637
|
-
var obj = Object.create(null);
|
|
69638
|
-
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
|
69639
|
-
var prop = _a[_i];
|
|
69640
|
-
var valueNode = prop.children[1];
|
|
69641
|
-
if (valueNode) {
|
|
69642
|
-
obj[prop.children[0].value] = getNodeValue(valueNode);
|
|
69643
|
-
}
|
|
69644
|
-
}
|
|
69645
|
-
return obj;
|
|
69646
|
-
case 'null':
|
|
69647
|
-
case 'string':
|
|
69648
|
-
case 'number':
|
|
69649
|
-
case 'boolean':
|
|
69650
|
-
return node.value;
|
|
69651
|
-
default:
|
|
69652
|
-
return undefined;
|
|
69653
|
-
}
|
|
69654
|
-
}
|
|
69655
|
-
function contains(node, offset, includeRightBound) {
|
|
69656
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
69657
|
-
return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));
|
|
69658
|
-
}
|
|
69659
|
-
/**
|
|
69660
|
-
* Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
69661
|
-
*/
|
|
69662
|
-
function findNodeAtOffset(node, offset, includeRightBound) {
|
|
69663
|
-
if (includeRightBound === void 0) { includeRightBound = false; }
|
|
69664
|
-
if (contains(node, offset, includeRightBound)) {
|
|
69665
|
-
var children = node.children;
|
|
69666
|
-
if (Array.isArray(children)) {
|
|
69667
|
-
for (var i = 0; i < children.length && children[i].offset <= offset; i++) {
|
|
69668
|
-
var item = findNodeAtOffset(children[i], offset, includeRightBound);
|
|
69669
|
-
if (item) {
|
|
69670
|
-
return item;
|
|
69671
|
-
}
|
|
69672
|
-
}
|
|
69673
|
-
}
|
|
69674
|
-
return node;
|
|
69675
|
-
}
|
|
69676
|
-
return undefined;
|
|
69677
|
-
}
|
|
69678
|
-
/**
|
|
69679
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
69680
|
-
*/
|
|
69681
|
-
function visit(text, visitor, options) {
|
|
69682
|
-
if (options === void 0) { options = ParseOptions.DEFAULT; }
|
|
69683
|
-
var _scanner = createScanner(text, false);
|
|
69684
|
-
function toNoArgVisit(visitFunction) {
|
|
69685
|
-
return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
69686
|
-
}
|
|
69687
|
-
function toOneArgVisit(visitFunction) {
|
|
69688
|
-
return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; };
|
|
69689
|
-
}
|
|
69690
|
-
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);
|
|
69691
|
-
var disallowComments = options && options.disallowComments;
|
|
69692
|
-
var allowTrailingComma = options && options.allowTrailingComma;
|
|
69693
|
-
function scanNext() {
|
|
69694
|
-
while (true) {
|
|
69695
|
-
var token = _scanner.scan();
|
|
69696
|
-
switch (_scanner.getTokenError()) {
|
|
69697
|
-
case 4 /* InvalidUnicode */:
|
|
69698
|
-
handleError(14 /* InvalidUnicode */);
|
|
69699
|
-
break;
|
|
69700
|
-
case 5 /* InvalidEscapeCharacter */:
|
|
69701
|
-
handleError(15 /* InvalidEscapeCharacter */);
|
|
69702
|
-
break;
|
|
69703
|
-
case 3 /* UnexpectedEndOfNumber */:
|
|
69704
|
-
handleError(13 /* UnexpectedEndOfNumber */);
|
|
69705
|
-
break;
|
|
69706
|
-
case 1 /* UnexpectedEndOfComment */:
|
|
69707
|
-
if (!disallowComments) {
|
|
69708
|
-
handleError(11 /* UnexpectedEndOfComment */);
|
|
69709
|
-
}
|
|
69710
|
-
break;
|
|
69711
|
-
case 2 /* UnexpectedEndOfString */:
|
|
69712
|
-
handleError(12 /* UnexpectedEndOfString */);
|
|
69713
|
-
break;
|
|
69714
|
-
case 6 /* InvalidCharacter */:
|
|
69715
|
-
handleError(16 /* InvalidCharacter */);
|
|
69716
|
-
break;
|
|
69717
|
-
}
|
|
69718
|
-
switch (token) {
|
|
69719
|
-
case 12 /* LineCommentTrivia */:
|
|
69720
|
-
case 13 /* BlockCommentTrivia */:
|
|
69721
|
-
if (disallowComments) {
|
|
69722
|
-
handleError(10 /* InvalidCommentToken */);
|
|
69723
|
-
}
|
|
69724
|
-
else {
|
|
69725
|
-
onComment();
|
|
69726
|
-
}
|
|
69727
|
-
break;
|
|
69728
|
-
case 16 /* Unknown */:
|
|
69729
|
-
handleError(1 /* InvalidSymbol */);
|
|
69730
|
-
break;
|
|
69731
|
-
case 15 /* Trivia */:
|
|
69732
|
-
case 14 /* LineBreakTrivia */:
|
|
69733
|
-
break;
|
|
69734
|
-
default:
|
|
69735
|
-
return token;
|
|
69736
|
-
}
|
|
69737
|
-
}
|
|
69738
|
-
}
|
|
69739
|
-
function handleError(error, skipUntilAfter, skipUntil) {
|
|
69740
|
-
if (skipUntilAfter === void 0) { skipUntilAfter = []; }
|
|
69741
|
-
if (skipUntil === void 0) { skipUntil = []; }
|
|
69742
|
-
onError(error);
|
|
69743
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
69744
|
-
var token = _scanner.getToken();
|
|
69745
|
-
while (token !== 17 /* EOF */) {
|
|
69746
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
69747
|
-
scanNext();
|
|
69748
|
-
break;
|
|
69749
|
-
}
|
|
69750
|
-
else if (skipUntil.indexOf(token) !== -1) {
|
|
69751
|
-
break;
|
|
69752
|
-
}
|
|
69753
|
-
token = scanNext();
|
|
69754
|
-
}
|
|
69755
|
-
}
|
|
69756
|
-
}
|
|
69757
|
-
function parseString(isValue) {
|
|
69758
|
-
var value = _scanner.getTokenValue();
|
|
69759
|
-
if (isValue) {
|
|
69760
|
-
onLiteralValue(value);
|
|
69761
|
-
}
|
|
69762
|
-
else {
|
|
69763
|
-
onObjectProperty(value);
|
|
69764
|
-
}
|
|
69765
|
-
scanNext();
|
|
69766
|
-
return true;
|
|
69767
|
-
}
|
|
69768
|
-
function parseLiteral() {
|
|
69769
|
-
switch (_scanner.getToken()) {
|
|
69770
|
-
case 11 /* NumericLiteral */:
|
|
69771
|
-
var tokenValue = _scanner.getTokenValue();
|
|
69772
|
-
var value = Number(tokenValue);
|
|
69773
|
-
if (isNaN(value)) {
|
|
69774
|
-
handleError(2 /* InvalidNumberFormat */);
|
|
69775
|
-
value = 0;
|
|
69776
|
-
}
|
|
69777
|
-
onLiteralValue(value);
|
|
69778
|
-
break;
|
|
69779
|
-
case 7 /* NullKeyword */:
|
|
69780
|
-
onLiteralValue(null);
|
|
69781
|
-
break;
|
|
69782
|
-
case 8 /* TrueKeyword */:
|
|
69783
|
-
onLiteralValue(true);
|
|
69784
|
-
break;
|
|
69785
|
-
case 9 /* FalseKeyword */:
|
|
69786
|
-
onLiteralValue(false);
|
|
69787
|
-
break;
|
|
69788
|
-
default:
|
|
69789
|
-
return false;
|
|
69790
|
-
}
|
|
69791
|
-
scanNext();
|
|
69792
|
-
return true;
|
|
69793
|
-
}
|
|
69794
|
-
function parseProperty() {
|
|
69795
|
-
if (_scanner.getToken() !== 10 /* StringLiteral */) {
|
|
69796
|
-
handleError(3 /* PropertyNameExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
69797
|
-
return false;
|
|
69798
|
-
}
|
|
69799
|
-
parseString(false);
|
|
69800
|
-
if (_scanner.getToken() === 6 /* ColonToken */) {
|
|
69801
|
-
onSeparator(':');
|
|
69802
|
-
scanNext(); // consume colon
|
|
69803
|
-
if (!parseValue()) {
|
|
69804
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
69805
|
-
}
|
|
69806
|
-
}
|
|
69807
|
-
else {
|
|
69808
|
-
handleError(5 /* ColonExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
69809
|
-
}
|
|
69810
|
-
return true;
|
|
69811
|
-
}
|
|
69812
|
-
function parseObject() {
|
|
69813
|
-
onObjectBegin();
|
|
69814
|
-
scanNext(); // consume open brace
|
|
69815
|
-
var needsComma = false;
|
|
69816
|
-
while (_scanner.getToken() !== 2 /* CloseBraceToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
69817
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
69818
|
-
if (!needsComma) {
|
|
69819
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
69820
|
-
}
|
|
69821
|
-
onSeparator(',');
|
|
69822
|
-
scanNext(); // consume comma
|
|
69823
|
-
if (_scanner.getToken() === 2 /* CloseBraceToken */ && allowTrailingComma) {
|
|
69824
|
-
break;
|
|
69825
|
-
}
|
|
69826
|
-
}
|
|
69827
|
-
else if (needsComma) {
|
|
69828
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
69829
|
-
}
|
|
69830
|
-
if (!parseProperty()) {
|
|
69831
|
-
handleError(4 /* ValueExpected */, [], [2 /* CloseBraceToken */, 5 /* CommaToken */]);
|
|
69832
|
-
}
|
|
69833
|
-
needsComma = true;
|
|
69834
|
-
}
|
|
69835
|
-
onObjectEnd();
|
|
69836
|
-
if (_scanner.getToken() !== 2 /* CloseBraceToken */) {
|
|
69837
|
-
handleError(7 /* CloseBraceExpected */, [2 /* CloseBraceToken */], []);
|
|
69838
|
-
}
|
|
69839
|
-
else {
|
|
69840
|
-
scanNext(); // consume close brace
|
|
69841
|
-
}
|
|
69842
|
-
return true;
|
|
69843
|
-
}
|
|
69844
|
-
function parseArray() {
|
|
69845
|
-
onArrayBegin();
|
|
69846
|
-
scanNext(); // consume open bracket
|
|
69847
|
-
var needsComma = false;
|
|
69848
|
-
while (_scanner.getToken() !== 4 /* CloseBracketToken */ && _scanner.getToken() !== 17 /* EOF */) {
|
|
69849
|
-
if (_scanner.getToken() === 5 /* CommaToken */) {
|
|
69850
|
-
if (!needsComma) {
|
|
69851
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
69852
|
-
}
|
|
69853
|
-
onSeparator(',');
|
|
69854
|
-
scanNext(); // consume comma
|
|
69855
|
-
if (_scanner.getToken() === 4 /* CloseBracketToken */ && allowTrailingComma) {
|
|
69856
|
-
break;
|
|
69857
|
-
}
|
|
69858
|
-
}
|
|
69859
|
-
else if (needsComma) {
|
|
69860
|
-
handleError(6 /* CommaExpected */, [], []);
|
|
69861
|
-
}
|
|
69862
|
-
if (!parseValue()) {
|
|
69863
|
-
handleError(4 /* ValueExpected */, [], [4 /* CloseBracketToken */, 5 /* CommaToken */]);
|
|
69864
|
-
}
|
|
69865
|
-
needsComma = true;
|
|
69866
|
-
}
|
|
69867
|
-
onArrayEnd();
|
|
69868
|
-
if (_scanner.getToken() !== 4 /* CloseBracketToken */) {
|
|
69869
|
-
handleError(8 /* CloseBracketExpected */, [4 /* CloseBracketToken */], []);
|
|
69870
|
-
}
|
|
69871
|
-
else {
|
|
69872
|
-
scanNext(); // consume close bracket
|
|
69873
|
-
}
|
|
69874
|
-
return true;
|
|
69875
|
-
}
|
|
69876
|
-
function parseValue() {
|
|
69877
|
-
switch (_scanner.getToken()) {
|
|
69878
|
-
case 3 /* OpenBracketToken */:
|
|
69879
|
-
return parseArray();
|
|
69880
|
-
case 1 /* OpenBraceToken */:
|
|
69881
|
-
return parseObject();
|
|
69882
|
-
case 10 /* StringLiteral */:
|
|
69883
|
-
return parseString(true);
|
|
69884
|
-
default:
|
|
69885
|
-
return parseLiteral();
|
|
69886
|
-
}
|
|
69887
|
-
}
|
|
69888
|
-
scanNext();
|
|
69889
|
-
if (_scanner.getToken() === 17 /* EOF */) {
|
|
69890
|
-
if (options.allowEmptyContent) {
|
|
69891
|
-
return true;
|
|
69892
|
-
}
|
|
69893
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
69894
|
-
return false;
|
|
69895
|
-
}
|
|
69896
|
-
if (!parseValue()) {
|
|
69897
|
-
handleError(4 /* ValueExpected */, [], []);
|
|
69898
|
-
return false;
|
|
69899
|
-
}
|
|
69900
|
-
if (_scanner.getToken() !== 17 /* EOF */) {
|
|
69901
|
-
handleError(9 /* EndOfFileExpected */, [], []);
|
|
69902
|
-
}
|
|
69903
|
-
return true;
|
|
69904
|
-
}
|
|
69905
|
-
/**
|
|
69906
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
69907
|
-
* them. Optionally replaces every none-newline character
|
|
69908
|
-
* of comments with a replaceCharacter
|
|
69909
|
-
*/
|
|
69910
|
-
function stripComments(text, replaceCh) {
|
|
69911
|
-
var _scanner = createScanner(text), parts = [], kind, offset = 0, pos;
|
|
69912
|
-
do {
|
|
69913
|
-
pos = _scanner.getPosition();
|
|
69914
|
-
kind = _scanner.scan();
|
|
69915
|
-
switch (kind) {
|
|
69916
|
-
case 12 /* LineCommentTrivia */:
|
|
69917
|
-
case 13 /* BlockCommentTrivia */:
|
|
69918
|
-
case 17 /* EOF */:
|
|
69919
|
-
if (offset !== pos) {
|
|
69920
|
-
parts.push(text.substring(offset, pos));
|
|
69921
|
-
}
|
|
69922
|
-
if (replaceCh !== undefined) {
|
|
69923
|
-
parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
|
|
69924
|
-
}
|
|
69925
|
-
offset = _scanner.getPosition();
|
|
69926
|
-
break;
|
|
69927
|
-
}
|
|
69928
|
-
} while (kind !== 17 /* EOF */);
|
|
69929
|
-
return parts.join('');
|
|
69930
|
-
}
|
|
69931
|
-
function getNodeType(value) {
|
|
69932
|
-
switch (typeof value) {
|
|
69933
|
-
case 'boolean': return 'boolean';
|
|
69934
|
-
case 'number': return 'number';
|
|
69935
|
-
case 'string': return 'string';
|
|
69936
|
-
case 'object': {
|
|
69937
|
-
if (!value) {
|
|
69938
|
-
return 'null';
|
|
69939
|
-
}
|
|
69940
|
-
else if (Array.isArray(value)) {
|
|
69941
|
-
return 'array';
|
|
69942
|
-
}
|
|
69943
|
-
return 'object';
|
|
69944
|
-
}
|
|
69945
|
-
default: return 'null';
|
|
69946
|
-
}
|
|
69947
|
-
}
|
|
69948
|
-
|
|
69949
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
69950
|
-
/*---------------------------------------------------------------------------------------------
|
|
69951
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
69952
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
69953
|
-
*--------------------------------------------------------------------------------------------*/
|
|
69954
|
-
|
|
69955
|
-
|
|
69956
|
-
|
|
69957
|
-
function removeProperty(text, path, options) {
|
|
69958
|
-
return setProperty(text, path, void 0, options);
|
|
69959
|
-
}
|
|
69960
|
-
function setProperty(text, originalPath, value, options) {
|
|
69961
|
-
var _a;
|
|
69962
|
-
var path = originalPath.slice();
|
|
69963
|
-
var errors = [];
|
|
69964
|
-
var root = parseTree(text, errors);
|
|
69965
|
-
var parent = void 0;
|
|
69966
|
-
var lastSegment = void 0;
|
|
69967
|
-
while (path.length > 0) {
|
|
69968
|
-
lastSegment = path.pop();
|
|
69969
|
-
parent = findNodeAtLocation(root, path);
|
|
69970
|
-
if (parent === void 0 && value !== void 0) {
|
|
69971
|
-
if (typeof lastSegment === 'string') {
|
|
69972
|
-
value = (_a = {}, _a[lastSegment] = value, _a);
|
|
69973
|
-
}
|
|
69974
|
-
else {
|
|
69975
|
-
value = [value];
|
|
69976
|
-
}
|
|
69977
|
-
}
|
|
69978
|
-
else {
|
|
69979
|
-
break;
|
|
69980
|
-
}
|
|
69981
|
-
}
|
|
69982
|
-
if (!parent) {
|
|
69983
|
-
// empty document
|
|
69984
|
-
if (value === void 0) { // delete
|
|
69985
|
-
throw new Error('Can not delete in empty document');
|
|
69986
|
-
}
|
|
69987
|
-
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
|
|
69988
|
-
}
|
|
69989
|
-
else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {
|
|
69990
|
-
var existing = findNodeAtLocation(parent, [lastSegment]);
|
|
69991
|
-
if (existing !== void 0) {
|
|
69992
|
-
if (value === void 0) { // delete
|
|
69993
|
-
if (!existing.parent) {
|
|
69994
|
-
throw new Error('Malformed AST');
|
|
69995
|
-
}
|
|
69996
|
-
var propertyIndex = parent.children.indexOf(existing.parent);
|
|
69997
|
-
var removeBegin = void 0;
|
|
69998
|
-
var removeEnd = existing.parent.offset + existing.parent.length;
|
|
69999
|
-
if (propertyIndex > 0) {
|
|
70000
|
-
// remove the comma of the previous node
|
|
70001
|
-
var previous = parent.children[propertyIndex - 1];
|
|
70002
|
-
removeBegin = previous.offset + previous.length;
|
|
70003
|
-
}
|
|
70004
|
-
else {
|
|
70005
|
-
removeBegin = parent.offset + 1;
|
|
70006
|
-
if (parent.children.length > 1) {
|
|
70007
|
-
// remove the comma of the next node
|
|
70008
|
-
var next = parent.children[1];
|
|
70009
|
-
removeEnd = next.offset;
|
|
70010
|
-
}
|
|
70011
|
-
}
|
|
70012
|
-
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, options);
|
|
70013
|
-
}
|
|
70014
|
-
else {
|
|
70015
|
-
// set value of existing property
|
|
70016
|
-
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
|
|
70017
|
-
}
|
|
70018
|
-
}
|
|
70019
|
-
else {
|
|
70020
|
-
if (value === void 0) { // delete
|
|
70021
|
-
return []; // property does not exist, nothing to do
|
|
70022
|
-
}
|
|
70023
|
-
var newProperty = JSON.stringify(lastSegment) + ": " + JSON.stringify(value);
|
|
70024
|
-
var index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map(function (p) { return p.children[0].value; })) : parent.children.length;
|
|
70025
|
-
var edit = void 0;
|
|
70026
|
-
if (index > 0) {
|
|
70027
|
-
var previous = parent.children[index - 1];
|
|
70028
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
70029
|
-
}
|
|
70030
|
-
else if (parent.children.length === 0) {
|
|
70031
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
70032
|
-
}
|
|
70033
|
-
else {
|
|
70034
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };
|
|
70035
|
-
}
|
|
70036
|
-
return withFormatting(text, edit, options);
|
|
70037
|
-
}
|
|
70038
|
-
}
|
|
70039
|
-
else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {
|
|
70040
|
-
var insertIndex = lastSegment;
|
|
70041
|
-
if (insertIndex === -1) {
|
|
70042
|
-
// Insert
|
|
70043
|
-
var newProperty = "" + JSON.stringify(value);
|
|
70044
|
-
var edit = void 0;
|
|
70045
|
-
if (parent.children.length === 0) {
|
|
70046
|
-
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
70047
|
-
}
|
|
70048
|
-
else {
|
|
70049
|
-
var previous = parent.children[parent.children.length - 1];
|
|
70050
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
70051
|
-
}
|
|
70052
|
-
return withFormatting(text, edit, options);
|
|
70053
|
-
}
|
|
70054
|
-
else if (value === void 0 && parent.children.length >= 0) {
|
|
70055
|
-
// Removal
|
|
70056
|
-
var removalIndex = lastSegment;
|
|
70057
|
-
var toRemove = parent.children[removalIndex];
|
|
70058
|
-
var edit = void 0;
|
|
70059
|
-
if (parent.children.length === 1) {
|
|
70060
|
-
// only item
|
|
70061
|
-
edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };
|
|
70062
|
-
}
|
|
70063
|
-
else if (parent.children.length - 1 === removalIndex) {
|
|
70064
|
-
// last item
|
|
70065
|
-
var previous = parent.children[removalIndex - 1];
|
|
70066
|
-
var offset = previous.offset + previous.length;
|
|
70067
|
-
var parentEndOffset = parent.offset + parent.length;
|
|
70068
|
-
edit = { offset: offset, length: parentEndOffset - 2 - offset, content: '' };
|
|
70069
|
-
}
|
|
70070
|
-
else {
|
|
70071
|
-
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };
|
|
70072
|
-
}
|
|
70073
|
-
return withFormatting(text, edit, options);
|
|
70074
|
-
}
|
|
70075
|
-
else if (value !== void 0) {
|
|
70076
|
-
var edit = void 0;
|
|
70077
|
-
var newProperty = "" + JSON.stringify(value);
|
|
70078
|
-
if (!options.isArrayInsertion && parent.children.length > lastSegment) {
|
|
70079
|
-
var toModify = parent.children[lastSegment];
|
|
70080
|
-
edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
|
|
70081
|
-
}
|
|
70082
|
-
else if (parent.children.length === 0 || lastSegment === 0) {
|
|
70083
|
-
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };
|
|
70084
|
-
}
|
|
70085
|
-
else {
|
|
70086
|
-
var index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
70087
|
-
var previous = parent.children[index - 1];
|
|
70088
|
-
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
70089
|
-
}
|
|
70090
|
-
return withFormatting(text, edit, options);
|
|
70091
|
-
}
|
|
70092
|
-
else {
|
|
70093
|
-
throw new Error("Can not " + (value === void 0 ? 'remove' : (options.isArrayInsertion ? 'insert' : 'modify')) + " Array index " + insertIndex + " as length is not sufficient");
|
|
70094
|
-
}
|
|
70095
|
-
}
|
|
70096
|
-
else {
|
|
70097
|
-
throw new Error("Can not add " + (typeof lastSegment !== 'number' ? 'index' : 'property') + " to parent of type " + parent.type);
|
|
70098
|
-
}
|
|
70099
|
-
}
|
|
70100
|
-
function withFormatting(text, edit, options) {
|
|
70101
|
-
if (!options.formattingOptions) {
|
|
70102
|
-
return [edit];
|
|
70103
|
-
}
|
|
70104
|
-
// apply the edit
|
|
70105
|
-
var newText = applyEdit(text, edit);
|
|
70106
|
-
// format the new text
|
|
70107
|
-
var begin = edit.offset;
|
|
70108
|
-
var end = edit.offset + edit.content.length;
|
|
70109
|
-
if (edit.length === 0 || edit.content.length === 0) { // insert or remove
|
|
70110
|
-
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
70111
|
-
begin--;
|
|
70112
|
-
}
|
|
70113
|
-
while (end < newText.length && !isEOL(newText, end)) {
|
|
70114
|
-
end++;
|
|
70115
|
-
}
|
|
70116
|
-
}
|
|
70117
|
-
var edits = format(newText, { offset: begin, length: end - begin }, options.formattingOptions);
|
|
70118
|
-
// apply the formatting edits and track the begin and end offsets of the changes
|
|
70119
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
70120
|
-
var edit_1 = edits[i];
|
|
70121
|
-
newText = applyEdit(newText, edit_1);
|
|
70122
|
-
begin = Math.min(begin, edit_1.offset);
|
|
70123
|
-
end = Math.max(end, edit_1.offset + edit_1.length);
|
|
70124
|
-
end += edit_1.content.length - edit_1.length;
|
|
70125
|
-
}
|
|
70126
|
-
// create a single edit with all changes
|
|
70127
|
-
var editLength = text.length - (newText.length - end) - begin;
|
|
70128
|
-
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
70129
|
-
}
|
|
70130
|
-
function applyEdit(text, edit) {
|
|
70131
|
-
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
70132
|
-
}
|
|
70133
|
-
function isWS(text, offset) {
|
|
70134
|
-
return '\r\n \t'.indexOf(text.charAt(offset)) !== -1;
|
|
70135
|
-
}
|
|
70136
|
-
|
|
70137
|
-
;// CONCATENATED MODULE: ../../node_modules/jsonc-parser/lib/esm/main.js
|
|
70138
|
-
/*---------------------------------------------------------------------------------------------
|
|
70139
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
70140
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
70141
|
-
*--------------------------------------------------------------------------------------------*/
|
|
70142
|
-
|
|
70143
|
-
|
|
70144
|
-
|
|
70145
|
-
|
|
70146
|
-
|
|
70147
|
-
/**
|
|
70148
|
-
* Creates a JSON scanner on the given text.
|
|
70149
|
-
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
70150
|
-
*/
|
|
70151
|
-
var main_createScanner = createScanner;
|
|
70152
|
-
/**
|
|
70153
|
-
* 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.
|
|
70154
|
-
*/
|
|
70155
|
-
var main_getLocation = getLocation;
|
|
70156
|
-
/**
|
|
70157
|
-
* 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.
|
|
70158
|
-
* Therefore, always check the errors list to find out if the input was valid.
|
|
70159
|
-
*/
|
|
70160
|
-
var main_parse = parse;
|
|
70161
|
-
/**
|
|
70162
|
-
* 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.
|
|
70163
|
-
*/
|
|
70164
|
-
var main_parseTree = parseTree;
|
|
70165
|
-
/**
|
|
70166
|
-
* Finds the node at the given path in a JSON DOM.
|
|
70167
|
-
*/
|
|
70168
|
-
var main_findNodeAtLocation = findNodeAtLocation;
|
|
70169
|
-
/**
|
|
70170
|
-
* Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
|
|
70171
|
-
*/
|
|
70172
|
-
var main_findNodeAtOffset = findNodeAtOffset;
|
|
70173
|
-
/**
|
|
70174
|
-
* Gets the JSON path of the given JSON DOM node
|
|
70175
|
-
*/
|
|
70176
|
-
var main_getNodePath = getNodePath;
|
|
70177
|
-
/**
|
|
70178
|
-
* Evaluates the JavaScript object of the given JSON DOM node
|
|
70179
|
-
*/
|
|
70180
|
-
var main_getNodeValue = getNodeValue;
|
|
70181
|
-
/**
|
|
70182
|
-
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
70183
|
-
*/
|
|
70184
|
-
var main_visit = visit;
|
|
70185
|
-
/**
|
|
70186
|
-
* Takes JSON with JavaScript-style comments and remove
|
|
70187
|
-
* them. Optionally replaces every none-newline character
|
|
70188
|
-
* of comments with a replaceCharacter
|
|
70189
|
-
*/
|
|
70190
|
-
var main_stripComments = stripComments;
|
|
70191
|
-
function printParseErrorCode(code) {
|
|
70192
|
-
switch (code) {
|
|
70193
|
-
case 1 /* InvalidSymbol */: return 'InvalidSymbol';
|
|
70194
|
-
case 2 /* InvalidNumberFormat */: return 'InvalidNumberFormat';
|
|
70195
|
-
case 3 /* PropertyNameExpected */: return 'PropertyNameExpected';
|
|
70196
|
-
case 4 /* ValueExpected */: return 'ValueExpected';
|
|
70197
|
-
case 5 /* ColonExpected */: return 'ColonExpected';
|
|
70198
|
-
case 6 /* CommaExpected */: return 'CommaExpected';
|
|
70199
|
-
case 7 /* CloseBraceExpected */: return 'CloseBraceExpected';
|
|
70200
|
-
case 8 /* CloseBracketExpected */: return 'CloseBracketExpected';
|
|
70201
|
-
case 9 /* EndOfFileExpected */: return 'EndOfFileExpected';
|
|
70202
|
-
case 10 /* InvalidCommentToken */: return 'InvalidCommentToken';
|
|
70203
|
-
case 11 /* UnexpectedEndOfComment */: return 'UnexpectedEndOfComment';
|
|
70204
|
-
case 12 /* UnexpectedEndOfString */: return 'UnexpectedEndOfString';
|
|
70205
|
-
case 13 /* UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber';
|
|
70206
|
-
case 14 /* InvalidUnicode */: return 'InvalidUnicode';
|
|
70207
|
-
case 15 /* InvalidEscapeCharacter */: return 'InvalidEscapeCharacter';
|
|
70208
|
-
case 16 /* InvalidCharacter */: return 'InvalidCharacter';
|
|
70209
|
-
}
|
|
70210
|
-
return '<unknown ParseErrorCode>';
|
|
70211
|
-
}
|
|
70212
|
-
/**
|
|
70213
|
-
* Computes the edits needed to format a JSON document.
|
|
70214
|
-
*
|
|
70215
|
-
* @param documentText The input text
|
|
70216
|
-
* @param range The range to format or `undefined` to format the full content
|
|
70217
|
-
* @param options The formatting options
|
|
70218
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
70219
|
-
* 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
|
|
70220
|
-
* text in the original document. However, multiple edits can have
|
|
70221
|
-
* 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.
|
|
70222
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
70223
|
-
*/
|
|
70224
|
-
function main_format(documentText, range, options) {
|
|
70225
|
-
return format(documentText, range, options);
|
|
70226
|
-
}
|
|
70227
|
-
/**
|
|
70228
|
-
* Computes the edits needed to modify a value in the JSON document.
|
|
70229
|
-
*
|
|
70230
|
-
* @param documentText The input text
|
|
70231
|
-
* @param path The path of the value to change. The path represents either to the document root, a property or an array item.
|
|
70232
|
-
* If the path points to an non-existing property or item, it will be created.
|
|
70233
|
-
* @param value The new value for the specified property or item. If the value is undefined,
|
|
70234
|
-
* the property or item will be removed.
|
|
70235
|
-
* @param options Options
|
|
70236
|
-
* @returns A list of edit operations describing the formatting changes to the original document. Edits can be either inserts, replacements or
|
|
70237
|
-
* 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
|
|
70238
|
-
* text in the original document. However, multiple edits can have
|
|
70239
|
-
* 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.
|
|
70240
|
-
* To apply edits to an input, you can use `applyEdits`.
|
|
70241
|
-
*/
|
|
70242
|
-
function modify(text, path, value, options) {
|
|
70243
|
-
return setProperty(text, path, value, options);
|
|
70244
|
-
}
|
|
70245
|
-
/**
|
|
70246
|
-
* Applies edits to a input string.
|
|
70247
|
-
*/
|
|
70248
|
-
function applyEdits(text, edits) {
|
|
70249
|
-
for (var i = edits.length - 1; i >= 0; i--) {
|
|
70250
|
-
text = applyEdit(text, edits[i]);
|
|
70251
|
-
}
|
|
70252
|
-
return text;
|
|
70253
|
-
}
|
|
70254
|
-
|
|
70255
|
-
|
|
70256
68738
|
/***/ }),
|
|
70257
68739
|
|
|
70258
68740
|
/***/ 47296:
|
|
@@ -124328,287 +122810,6 @@ function dumpException(ex)
|
|
|
124328
122810
|
}
|
|
124329
122811
|
|
|
124330
122812
|
|
|
124331
|
-
/***/ }),
|
|
124332
|
-
|
|
124333
|
-
/***/ 61096:
|
|
124334
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
124335
|
-
|
|
124336
|
-
"use strict";
|
|
124337
|
-
__webpack_require__.r(__webpack_exports__);
|
|
124338
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
124339
|
-
/* harmony export */ "TextDocument": () => (/* binding */ TextDocument)
|
|
124340
|
-
/* harmony export */ });
|
|
124341
|
-
/* --------------------------------------------------------------------------------------------
|
|
124342
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
124343
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
124344
|
-
* ------------------------------------------------------------------------------------------ */
|
|
124345
|
-
|
|
124346
|
-
var FullTextDocument = /** @class */ (function () {
|
|
124347
|
-
function FullTextDocument(uri, languageId, version, content) {
|
|
124348
|
-
this._uri = uri;
|
|
124349
|
-
this._languageId = languageId;
|
|
124350
|
-
this._version = version;
|
|
124351
|
-
this._content = content;
|
|
124352
|
-
this._lineOffsets = undefined;
|
|
124353
|
-
}
|
|
124354
|
-
Object.defineProperty(FullTextDocument.prototype, "uri", {
|
|
124355
|
-
get: function () {
|
|
124356
|
-
return this._uri;
|
|
124357
|
-
},
|
|
124358
|
-
enumerable: true,
|
|
124359
|
-
configurable: true
|
|
124360
|
-
});
|
|
124361
|
-
Object.defineProperty(FullTextDocument.prototype, "languageId", {
|
|
124362
|
-
get: function () {
|
|
124363
|
-
return this._languageId;
|
|
124364
|
-
},
|
|
124365
|
-
enumerable: true,
|
|
124366
|
-
configurable: true
|
|
124367
|
-
});
|
|
124368
|
-
Object.defineProperty(FullTextDocument.prototype, "version", {
|
|
124369
|
-
get: function () {
|
|
124370
|
-
return this._version;
|
|
124371
|
-
},
|
|
124372
|
-
enumerable: true,
|
|
124373
|
-
configurable: true
|
|
124374
|
-
});
|
|
124375
|
-
FullTextDocument.prototype.getText = function (range) {
|
|
124376
|
-
if (range) {
|
|
124377
|
-
var start = this.offsetAt(range.start);
|
|
124378
|
-
var end = this.offsetAt(range.end);
|
|
124379
|
-
return this._content.substring(start, end);
|
|
124380
|
-
}
|
|
124381
|
-
return this._content;
|
|
124382
|
-
};
|
|
124383
|
-
FullTextDocument.prototype.update = function (changes, version) {
|
|
124384
|
-
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
|
|
124385
|
-
var change = changes_1[_i];
|
|
124386
|
-
if (FullTextDocument.isIncremental(change)) {
|
|
124387
|
-
// makes sure start is before end
|
|
124388
|
-
var range = getWellformedRange(change.range);
|
|
124389
|
-
// update content
|
|
124390
|
-
var startOffset = this.offsetAt(range.start);
|
|
124391
|
-
var endOffset = this.offsetAt(range.end);
|
|
124392
|
-
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
|
|
124393
|
-
// update the offsets
|
|
124394
|
-
var startLine = Math.max(range.start.line, 0);
|
|
124395
|
-
var endLine = Math.max(range.end.line, 0);
|
|
124396
|
-
var lineOffsets = this._lineOffsets;
|
|
124397
|
-
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
|
|
124398
|
-
if (endLine - startLine === addedLineOffsets.length) {
|
|
124399
|
-
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
|
|
124400
|
-
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
|
|
124401
|
-
}
|
|
124402
|
-
}
|
|
124403
|
-
else {
|
|
124404
|
-
if (addedLineOffsets.length < 10000) {
|
|
124405
|
-
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
|
|
124406
|
-
}
|
|
124407
|
-
else { // avoid too many arguments for splice
|
|
124408
|
-
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
|
|
124409
|
-
}
|
|
124410
|
-
}
|
|
124411
|
-
var diff = change.text.length - (endOffset - startOffset);
|
|
124412
|
-
if (diff !== 0) {
|
|
124413
|
-
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
|
|
124414
|
-
lineOffsets[i] = lineOffsets[i] + diff;
|
|
124415
|
-
}
|
|
124416
|
-
}
|
|
124417
|
-
}
|
|
124418
|
-
else if (FullTextDocument.isFull(change)) {
|
|
124419
|
-
this._content = change.text;
|
|
124420
|
-
this._lineOffsets = undefined;
|
|
124421
|
-
}
|
|
124422
|
-
else {
|
|
124423
|
-
throw new Error('Unknown change event received');
|
|
124424
|
-
}
|
|
124425
|
-
}
|
|
124426
|
-
this._version = version;
|
|
124427
|
-
};
|
|
124428
|
-
FullTextDocument.prototype.getLineOffsets = function () {
|
|
124429
|
-
if (this._lineOffsets === undefined) {
|
|
124430
|
-
this._lineOffsets = computeLineOffsets(this._content, true);
|
|
124431
|
-
}
|
|
124432
|
-
return this._lineOffsets;
|
|
124433
|
-
};
|
|
124434
|
-
FullTextDocument.prototype.positionAt = function (offset) {
|
|
124435
|
-
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
124436
|
-
var lineOffsets = this.getLineOffsets();
|
|
124437
|
-
var low = 0, high = lineOffsets.length;
|
|
124438
|
-
if (high === 0) {
|
|
124439
|
-
return { line: 0, character: offset };
|
|
124440
|
-
}
|
|
124441
|
-
while (low < high) {
|
|
124442
|
-
var mid = Math.floor((low + high) / 2);
|
|
124443
|
-
if (lineOffsets[mid] > offset) {
|
|
124444
|
-
high = mid;
|
|
124445
|
-
}
|
|
124446
|
-
else {
|
|
124447
|
-
low = mid + 1;
|
|
124448
|
-
}
|
|
124449
|
-
}
|
|
124450
|
-
// low is the least x for which the line offset is larger than the current offset
|
|
124451
|
-
// or array.length if no line offset is larger than the current offset
|
|
124452
|
-
var line = low - 1;
|
|
124453
|
-
return { line: line, character: offset - lineOffsets[line] };
|
|
124454
|
-
};
|
|
124455
|
-
FullTextDocument.prototype.offsetAt = function (position) {
|
|
124456
|
-
var lineOffsets = this.getLineOffsets();
|
|
124457
|
-
if (position.line >= lineOffsets.length) {
|
|
124458
|
-
return this._content.length;
|
|
124459
|
-
}
|
|
124460
|
-
else if (position.line < 0) {
|
|
124461
|
-
return 0;
|
|
124462
|
-
}
|
|
124463
|
-
var lineOffset = lineOffsets[position.line];
|
|
124464
|
-
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
|
|
124465
|
-
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
|
124466
|
-
};
|
|
124467
|
-
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
|
|
124468
|
-
get: function () {
|
|
124469
|
-
return this.getLineOffsets().length;
|
|
124470
|
-
},
|
|
124471
|
-
enumerable: true,
|
|
124472
|
-
configurable: true
|
|
124473
|
-
});
|
|
124474
|
-
FullTextDocument.isIncremental = function (event) {
|
|
124475
|
-
var candidate = event;
|
|
124476
|
-
return candidate !== undefined && candidate !== null &&
|
|
124477
|
-
typeof candidate.text === 'string' && candidate.range !== undefined &&
|
|
124478
|
-
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
|
|
124479
|
-
};
|
|
124480
|
-
FullTextDocument.isFull = function (event) {
|
|
124481
|
-
var candidate = event;
|
|
124482
|
-
return candidate !== undefined && candidate !== null &&
|
|
124483
|
-
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
|
|
124484
|
-
};
|
|
124485
|
-
return FullTextDocument;
|
|
124486
|
-
}());
|
|
124487
|
-
var TextDocument;
|
|
124488
|
-
(function (TextDocument) {
|
|
124489
|
-
/**
|
|
124490
|
-
* Creates a new text document.
|
|
124491
|
-
*
|
|
124492
|
-
* @param uri The document's uri.
|
|
124493
|
-
* @param languageId The document's language Id.
|
|
124494
|
-
* @param version The document's initial version number.
|
|
124495
|
-
* @param content The document's content.
|
|
124496
|
-
*/
|
|
124497
|
-
function create(uri, languageId, version, content) {
|
|
124498
|
-
return new FullTextDocument(uri, languageId, version, content);
|
|
124499
|
-
}
|
|
124500
|
-
TextDocument.create = create;
|
|
124501
|
-
/**
|
|
124502
|
-
* Updates a TextDocument by modifing its content.
|
|
124503
|
-
*
|
|
124504
|
-
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
|
|
124505
|
-
* @param changes the changes to apply to the document.
|
|
124506
|
-
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
|
|
124507
|
-
*
|
|
124508
|
-
*/
|
|
124509
|
-
function update(document, changes, version) {
|
|
124510
|
-
if (document instanceof FullTextDocument) {
|
|
124511
|
-
document.update(changes, version);
|
|
124512
|
-
return document;
|
|
124513
|
-
}
|
|
124514
|
-
else {
|
|
124515
|
-
throw new Error('TextDocument.update: document must be created by TextDocument.create');
|
|
124516
|
-
}
|
|
124517
|
-
}
|
|
124518
|
-
TextDocument.update = update;
|
|
124519
|
-
function applyEdits(document, edits) {
|
|
124520
|
-
var text = document.getText();
|
|
124521
|
-
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
|
|
124522
|
-
var diff = a.range.start.line - b.range.start.line;
|
|
124523
|
-
if (diff === 0) {
|
|
124524
|
-
return a.range.start.character - b.range.start.character;
|
|
124525
|
-
}
|
|
124526
|
-
return diff;
|
|
124527
|
-
});
|
|
124528
|
-
var lastModifiedOffset = 0;
|
|
124529
|
-
var spans = [];
|
|
124530
|
-
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
|
|
124531
|
-
var e = sortedEdits_1[_i];
|
|
124532
|
-
var startOffset = document.offsetAt(e.range.start);
|
|
124533
|
-
if (startOffset < lastModifiedOffset) {
|
|
124534
|
-
throw new Error('Overlapping edit');
|
|
124535
|
-
}
|
|
124536
|
-
else if (startOffset > lastModifiedOffset) {
|
|
124537
|
-
spans.push(text.substring(lastModifiedOffset, startOffset));
|
|
124538
|
-
}
|
|
124539
|
-
if (e.newText.length) {
|
|
124540
|
-
spans.push(e.newText);
|
|
124541
|
-
}
|
|
124542
|
-
lastModifiedOffset = document.offsetAt(e.range.end);
|
|
124543
|
-
}
|
|
124544
|
-
spans.push(text.substr(lastModifiedOffset));
|
|
124545
|
-
return spans.join('');
|
|
124546
|
-
}
|
|
124547
|
-
TextDocument.applyEdits = applyEdits;
|
|
124548
|
-
})(TextDocument || (TextDocument = {}));
|
|
124549
|
-
function mergeSort(data, compare) {
|
|
124550
|
-
if (data.length <= 1) {
|
|
124551
|
-
// sorted
|
|
124552
|
-
return data;
|
|
124553
|
-
}
|
|
124554
|
-
var p = (data.length / 2) | 0;
|
|
124555
|
-
var left = data.slice(0, p);
|
|
124556
|
-
var right = data.slice(p);
|
|
124557
|
-
mergeSort(left, compare);
|
|
124558
|
-
mergeSort(right, compare);
|
|
124559
|
-
var leftIdx = 0;
|
|
124560
|
-
var rightIdx = 0;
|
|
124561
|
-
var i = 0;
|
|
124562
|
-
while (leftIdx < left.length && rightIdx < right.length) {
|
|
124563
|
-
var ret = compare(left[leftIdx], right[rightIdx]);
|
|
124564
|
-
if (ret <= 0) {
|
|
124565
|
-
// smaller_equal -> take left to preserve order
|
|
124566
|
-
data[i++] = left[leftIdx++];
|
|
124567
|
-
}
|
|
124568
|
-
else {
|
|
124569
|
-
// greater -> take right
|
|
124570
|
-
data[i++] = right[rightIdx++];
|
|
124571
|
-
}
|
|
124572
|
-
}
|
|
124573
|
-
while (leftIdx < left.length) {
|
|
124574
|
-
data[i++] = left[leftIdx++];
|
|
124575
|
-
}
|
|
124576
|
-
while (rightIdx < right.length) {
|
|
124577
|
-
data[i++] = right[rightIdx++];
|
|
124578
|
-
}
|
|
124579
|
-
return data;
|
|
124580
|
-
}
|
|
124581
|
-
function computeLineOffsets(text, isAtLineStart, textOffset) {
|
|
124582
|
-
if (textOffset === void 0) { textOffset = 0; }
|
|
124583
|
-
var result = isAtLineStart ? [textOffset] : [];
|
|
124584
|
-
for (var i = 0; i < text.length; i++) {
|
|
124585
|
-
var ch = text.charCodeAt(i);
|
|
124586
|
-
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
|
|
124587
|
-
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
|
|
124588
|
-
i++;
|
|
124589
|
-
}
|
|
124590
|
-
result.push(textOffset + i + 1);
|
|
124591
|
-
}
|
|
124592
|
-
}
|
|
124593
|
-
return result;
|
|
124594
|
-
}
|
|
124595
|
-
function getWellformedRange(range) {
|
|
124596
|
-
var start = range.start;
|
|
124597
|
-
var end = range.end;
|
|
124598
|
-
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
|
|
124599
|
-
return { start: end, end: start };
|
|
124600
|
-
}
|
|
124601
|
-
return range;
|
|
124602
|
-
}
|
|
124603
|
-
function getWellformedEdit(textEdit) {
|
|
124604
|
-
var range = getWellformedRange(textEdit.range);
|
|
124605
|
-
if (range !== textEdit.range) {
|
|
124606
|
-
return { newText: textEdit.newText, range: range };
|
|
124607
|
-
}
|
|
124608
|
-
return textEdit;
|
|
124609
|
-
}
|
|
124610
|
-
|
|
124611
|
-
|
|
124612
122813
|
/***/ }),
|
|
124613
122814
|
|
|
124614
122815
|
/***/ 26070:
|
|
@@ -136438,964 +134639,6 @@ exports.enableFeature = featureToggle_1.enableFeature;
|
|
|
136438
134639
|
exports.ExperimentalFeatures = featureToggle_1.ExperimentalFeatures;
|
|
136439
134640
|
|
|
136440
134641
|
|
|
136441
|
-
/***/ }),
|
|
136442
|
-
|
|
136443
|
-
/***/ 76241:
|
|
136444
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
136445
|
-
|
|
136446
|
-
"use strict";
|
|
136447
|
-
|
|
136448
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
136449
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
136450
|
-
};
|
|
136451
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136452
|
-
const i18next_1 = __importDefault(__webpack_require__(83896));
|
|
136453
|
-
const i18n_json_1 = __importDefault(__webpack_require__(97992));
|
|
136454
|
-
exports.i18n = i18next_1.default.createInstance();
|
|
136455
|
-
/**
|
|
136456
|
-
* Initialize i18next of "@sap/ux-i18n-properties"
|
|
136457
|
-
*/
|
|
136458
|
-
async function initI18n() {
|
|
136459
|
-
await exports.i18n.init({
|
|
136460
|
-
resources: {
|
|
136461
|
-
en: {
|
|
136462
|
-
translation: i18n_json_1.default
|
|
136463
|
-
}
|
|
136464
|
-
},
|
|
136465
|
-
lng: 'en',
|
|
136466
|
-
fallbackLng: 'en',
|
|
136467
|
-
joinArrays: '\n\n'
|
|
136468
|
-
});
|
|
136469
|
-
}
|
|
136470
|
-
exports.initI18n = initI18n;
|
|
136471
|
-
|
|
136472
|
-
|
|
136473
|
-
/***/ }),
|
|
136474
|
-
|
|
136475
|
-
/***/ 55203:
|
|
136476
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
136477
|
-
|
|
136478
|
-
"use strict";
|
|
136479
|
-
|
|
136480
|
-
function __export(m) {
|
|
136481
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
136482
|
-
}
|
|
136483
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136484
|
-
var properties_1 = __webpack_require__(47753);
|
|
136485
|
-
exports.geI18ntDocumentation = properties_1.geI18ntDocumentation;
|
|
136486
|
-
exports.loadPropertiesTexts = properties_1.loadPropertiesTexts;
|
|
136487
|
-
exports.printPropertiesFileI18nEntry = properties_1.printPropertiesFileI18nEntry;
|
|
136488
|
-
exports.printPropertiesFileI18nAnnotation = properties_1.printPropertiesFileI18nAnnotation;
|
|
136489
|
-
var lineOffsets_1 = __webpack_require__(4787);
|
|
136490
|
-
exports.getLineOffsets = lineOffsets_1.getLineOffsets;
|
|
136491
|
-
var text_1 = __webpack_require__(79910);
|
|
136492
|
-
exports.getI18nMaxLength = text_1.getI18nMaxLength;
|
|
136493
|
-
exports.getI18nTextType = text_1.getI18nTextType;
|
|
136494
|
-
var key_1 = __webpack_require__(75502);
|
|
136495
|
-
exports.extractI18nKey = key_1.extractI18nKey;
|
|
136496
|
-
exports.getI18nUniqueKey = key_1.getI18nUniqueKey;
|
|
136497
|
-
var textConverters_1 = __webpack_require__(83525);
|
|
136498
|
-
exports.convertToCamelCase = textConverters_1.convertToCamelCase;
|
|
136499
|
-
exports.convertToPascalCase = textConverters_1.convertToPascalCase;
|
|
136500
|
-
var position_1 = __webpack_require__(63787);
|
|
136501
|
-
exports.Position = position_1.Position;
|
|
136502
|
-
exports.Range = position_1.Range;
|
|
136503
|
-
var positionAt_1 = __webpack_require__(72372);
|
|
136504
|
-
exports.positionAt = positionAt_1.positionAt;
|
|
136505
|
-
exports.rangeAt = positionAt_1.rangeAt;
|
|
136506
|
-
__export(__webpack_require__(69338));
|
|
136507
|
-
var i18n_1 = __webpack_require__(76241);
|
|
136508
|
-
exports.initI18n = i18n_1.initI18n;
|
|
136509
|
-
exports.i18n = i18n_1.i18n;
|
|
136510
|
-
const i18n_2 = __webpack_require__(76241);
|
|
136511
|
-
// init i18n
|
|
136512
|
-
(async () => {
|
|
136513
|
-
await i18n_2.initI18n();
|
|
136514
|
-
})();
|
|
136515
|
-
|
|
136516
|
-
|
|
136517
|
-
/***/ }),
|
|
136518
|
-
|
|
136519
|
-
/***/ 75502:
|
|
136520
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
136521
|
-
|
|
136522
|
-
"use strict";
|
|
136523
|
-
|
|
136524
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136525
|
-
/**
|
|
136526
|
-
* Extract i18n key
|
|
136527
|
-
*/
|
|
136528
|
-
exports.extractI18nKey = (input, withoutAt) => {
|
|
136529
|
-
if (withoutAt) {
|
|
136530
|
-
const result = input
|
|
136531
|
-
.replace(/{i18n>|{i18n>/, '')
|
|
136532
|
-
.replace('}', '')
|
|
136533
|
-
.trim();
|
|
136534
|
-
return result;
|
|
136535
|
-
}
|
|
136536
|
-
const result = input
|
|
136537
|
-
.replace(/{@i18n>|{@i18n>/, '')
|
|
136538
|
-
.replace('}', '')
|
|
136539
|
-
.trim();
|
|
136540
|
-
return result;
|
|
136541
|
-
};
|
|
136542
|
-
/**
|
|
136543
|
-
* Get unique key
|
|
136544
|
-
*
|
|
136545
|
-
* If the key is not unique, it increment key by one and recheck
|
|
136546
|
-
*
|
|
136547
|
-
* @param key new key and it is incremented
|
|
136548
|
-
* @param i18nData I18n entries
|
|
136549
|
-
* @param originalKey original key without any index increment
|
|
136550
|
-
* @param counter counter for increment
|
|
136551
|
-
*/
|
|
136552
|
-
exports.getI18nUniqueKey = (key, i18nData, originalKey = key, counter = 1) => {
|
|
136553
|
-
const uniqueKey = key;
|
|
136554
|
-
let keyExists = false;
|
|
136555
|
-
if (Array.isArray(i18nData)) {
|
|
136556
|
-
keyExists = i18nData.findIndex((item) => item.key.value === key) !== -1;
|
|
136557
|
-
}
|
|
136558
|
-
else {
|
|
136559
|
-
keyExists = i18nData[key] !== undefined;
|
|
136560
|
-
}
|
|
136561
|
-
if (keyExists) {
|
|
136562
|
-
key = `${originalKey}${counter}`;
|
|
136563
|
-
counter++;
|
|
136564
|
-
return exports.getI18nUniqueKey(key, i18nData, originalKey, counter);
|
|
136565
|
-
}
|
|
136566
|
-
return uniqueKey;
|
|
136567
|
-
};
|
|
136568
|
-
|
|
136569
|
-
|
|
136570
|
-
/***/ }),
|
|
136571
|
-
|
|
136572
|
-
/***/ 4787:
|
|
136573
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
136574
|
-
|
|
136575
|
-
"use strict";
|
|
136576
|
-
|
|
136577
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136578
|
-
/**
|
|
136579
|
-
* Computes line offsets for the given string
|
|
136580
|
-
* @param text
|
|
136581
|
-
*/
|
|
136582
|
-
function getLineOffsets(text) {
|
|
136583
|
-
const lineOffsets = [0];
|
|
136584
|
-
for (let index = 0; index < text.length; index++) {
|
|
136585
|
-
const character = text[index];
|
|
136586
|
-
if (character === '\n') {
|
|
136587
|
-
lineOffsets.push(index + 1);
|
|
136588
|
-
}
|
|
136589
|
-
else if (character === '\r') {
|
|
136590
|
-
if (index + 1 < text.length && text[index + 1] === '\n') {
|
|
136591
|
-
index++;
|
|
136592
|
-
}
|
|
136593
|
-
lineOffsets.push(index + 1);
|
|
136594
|
-
}
|
|
136595
|
-
}
|
|
136596
|
-
return lineOffsets;
|
|
136597
|
-
}
|
|
136598
|
-
exports.getLineOffsets = getLineOffsets;
|
|
136599
|
-
|
|
136600
|
-
|
|
136601
|
-
/***/ }),
|
|
136602
|
-
|
|
136603
|
-
/***/ 63787:
|
|
136604
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
136605
|
-
|
|
136606
|
-
"use strict";
|
|
136607
|
-
|
|
136608
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136609
|
-
exports.Position = {
|
|
136610
|
-
create(line, character) {
|
|
136611
|
-
return {
|
|
136612
|
-
line,
|
|
136613
|
-
character
|
|
136614
|
-
};
|
|
136615
|
-
}
|
|
136616
|
-
};
|
|
136617
|
-
function createRange(one, two, three, four) {
|
|
136618
|
-
if (typeof one === 'number' &&
|
|
136619
|
-
!isNaN(one) &&
|
|
136620
|
-
typeof two === 'number' &&
|
|
136621
|
-
!isNaN(two) &&
|
|
136622
|
-
typeof three === 'number' &&
|
|
136623
|
-
!isNaN(three) &&
|
|
136624
|
-
typeof four === 'number' &&
|
|
136625
|
-
!isNaN(four)) {
|
|
136626
|
-
return {
|
|
136627
|
-
start: exports.Position.create(one, two),
|
|
136628
|
-
end: exports.Position.create(three, four)
|
|
136629
|
-
};
|
|
136630
|
-
}
|
|
136631
|
-
else if (typeof one === 'object' && typeof two === 'object') {
|
|
136632
|
-
return {
|
|
136633
|
-
start: one,
|
|
136634
|
-
end: two
|
|
136635
|
-
};
|
|
136636
|
-
}
|
|
136637
|
-
throw new Error(`Range#create called with invalid arguments ${one}, ${two}, ${three}, ${four}`);
|
|
136638
|
-
}
|
|
136639
|
-
exports.Range = {
|
|
136640
|
-
create: createRange
|
|
136641
|
-
};
|
|
136642
|
-
|
|
136643
|
-
|
|
136644
|
-
/***/ }),
|
|
136645
|
-
|
|
136646
|
-
/***/ 72372:
|
|
136647
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
136648
|
-
|
|
136649
|
-
"use strict";
|
|
136650
|
-
|
|
136651
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136652
|
-
const position_1 = __webpack_require__(63787);
|
|
136653
|
-
/**
|
|
136654
|
-
*
|
|
136655
|
-
* @param lineOffsets Array of indices with line start offsets.
|
|
136656
|
-
* e.g [0] represents a document with one line that starts at offset 0.
|
|
136657
|
-
* @param offset
|
|
136658
|
-
* @param textLength
|
|
136659
|
-
*/
|
|
136660
|
-
function positionAt(lineOffsets, offset, textLength) {
|
|
136661
|
-
const target = Math.max(Math.min(offset, textLength), 0);
|
|
136662
|
-
let low = 0;
|
|
136663
|
-
let high = lineOffsets.length;
|
|
136664
|
-
if (high === 0) {
|
|
136665
|
-
return position_1.Position.create(0, target);
|
|
136666
|
-
}
|
|
136667
|
-
while (low < high) {
|
|
136668
|
-
const mid = Math.floor((low + high) / 2);
|
|
136669
|
-
if (lineOffsets[mid] > target) {
|
|
136670
|
-
high = mid;
|
|
136671
|
-
}
|
|
136672
|
-
else {
|
|
136673
|
-
low = mid + 1;
|
|
136674
|
-
}
|
|
136675
|
-
}
|
|
136676
|
-
const line = low - 1;
|
|
136677
|
-
return position_1.Position.create(line, target - lineOffsets[line]);
|
|
136678
|
-
}
|
|
136679
|
-
exports.positionAt = positionAt;
|
|
136680
|
-
function rangeAt(lineOffsets, start, end, textLength) {
|
|
136681
|
-
return position_1.Range.create(positionAt(lineOffsets, start, textLength), positionAt(lineOffsets, end, textLength));
|
|
136682
|
-
}
|
|
136683
|
-
exports.rangeAt = rangeAt;
|
|
136684
|
-
|
|
136685
|
-
|
|
136686
|
-
/***/ }),
|
|
136687
|
-
|
|
136688
|
-
/***/ 47753:
|
|
136689
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
136690
|
-
|
|
136691
|
-
"use strict";
|
|
136692
|
-
|
|
136693
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136694
|
-
const i18n_1 = __webpack_require__(76241);
|
|
136695
|
-
const position_1 = __webpack_require__(63787);
|
|
136696
|
-
const propertiesParser_1 = __webpack_require__(86334);
|
|
136697
|
-
const text_1 = __webpack_require__(79910);
|
|
136698
|
-
const COMMENT_REGEX = /\s*(:?#|!)|[^\n\r]*/;
|
|
136699
|
-
/**
|
|
136700
|
-
* Get abstract syntax tree for i18n.properties file
|
|
136701
|
-
* @param content
|
|
136702
|
-
* @param filePath
|
|
136703
|
-
*/
|
|
136704
|
-
exports.loadPropertiesTexts = (content, filePath = '') => {
|
|
136705
|
-
const i18nEntries = [];
|
|
136706
|
-
const lines = propertiesParser_1.parseProperties(content);
|
|
136707
|
-
for (let i = 0; lines.length > i; i++) {
|
|
136708
|
-
const line = lines[i];
|
|
136709
|
-
if (line.type === 'key-element-line') {
|
|
136710
|
-
const commentLine = lines[i - 1];
|
|
136711
|
-
const entry = {
|
|
136712
|
-
filePath,
|
|
136713
|
-
key: {
|
|
136714
|
-
value: line.key.value,
|
|
136715
|
-
range: line.key.range
|
|
136716
|
-
},
|
|
136717
|
-
value: {
|
|
136718
|
-
value: line.element.value,
|
|
136719
|
-
range: line.element.range
|
|
136720
|
-
}
|
|
136721
|
-
};
|
|
136722
|
-
if ((commentLine === null || commentLine === void 0 ? void 0 : commentLine.type) === 'comment-line' && COMMENT_REGEX.test(commentLine.value)) {
|
|
136723
|
-
const { start } = commentLine.range;
|
|
136724
|
-
const commaIndex = commentLine.value.indexOf(',');
|
|
136725
|
-
const colonIndex = commentLine.value.indexOf(':');
|
|
136726
|
-
entry.annotation = {
|
|
136727
|
-
textType: toTextTypeNode(commentLine, commaIndex, colonIndex)
|
|
136728
|
-
};
|
|
136729
|
-
if (commaIndex !== -1) {
|
|
136730
|
-
entry.annotation.maxLength = {
|
|
136731
|
-
value: parseInt(commentLine.value.slice(commaIndex + 1, colonIndex === -1 ? undefined : colonIndex)),
|
|
136732
|
-
range: position_1.Range.create(start.line, start.character + commaIndex + 1, start.line, start.character + (colonIndex === -1 ? commentLine.value.length : colonIndex))
|
|
136733
|
-
};
|
|
136734
|
-
}
|
|
136735
|
-
if (colonIndex !== -1) {
|
|
136736
|
-
entry.annotation.note = {
|
|
136737
|
-
value: commentLine.value.slice(colonIndex + 1),
|
|
136738
|
-
range: position_1.Range.create(start.line, start.character + colonIndex + 1, start.line, start.character + commentLine.value.length)
|
|
136739
|
-
};
|
|
136740
|
-
}
|
|
136741
|
-
}
|
|
136742
|
-
i18nEntries.push(entry);
|
|
136743
|
-
}
|
|
136744
|
-
}
|
|
136745
|
-
return i18nEntries;
|
|
136746
|
-
};
|
|
136747
|
-
function toTextTypeNode(comment, commaIndex, colonIndex) {
|
|
136748
|
-
const { start } = comment.range;
|
|
136749
|
-
// Comments can only be single line, so start and end lines will be equal
|
|
136750
|
-
if (commaIndex !== -1) {
|
|
136751
|
-
return {
|
|
136752
|
-
value: comment.value.slice(1, commaIndex),
|
|
136753
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + commaIndex)
|
|
136754
|
-
};
|
|
136755
|
-
}
|
|
136756
|
-
else if (colonIndex !== -1) {
|
|
136757
|
-
return {
|
|
136758
|
-
value: comment.value.slice(1, colonIndex),
|
|
136759
|
-
range: position_1.Range.create(start.line, start.character + 1, start.line, start.character + colonIndex)
|
|
136760
|
-
};
|
|
136761
|
-
}
|
|
136762
|
-
return {
|
|
136763
|
-
value: comment.value.slice(1),
|
|
136764
|
-
range: position_1.Range.create(start.line, start.character, start.line, start.character + comment.value.length)
|
|
136765
|
-
};
|
|
136766
|
-
}
|
|
136767
|
-
/**
|
|
136768
|
-
* Creates annotation text in .properties file format.
|
|
136769
|
-
* If no annotation is not provided, default one is generated based on text.
|
|
136770
|
-
* @param text
|
|
136771
|
-
* @param annotation Context information for the text
|
|
136772
|
-
*/
|
|
136773
|
-
function printPropertiesFileI18nAnnotation(text, annotation) {
|
|
136774
|
-
if (!annotation) {
|
|
136775
|
-
const maxLen = text_1.getI18nMaxLength(text);
|
|
136776
|
-
const textType = text_1.getI18nTextType(maxLen);
|
|
136777
|
-
return `${textType},${maxLen}`;
|
|
136778
|
-
}
|
|
136779
|
-
if (typeof annotation === 'string') {
|
|
136780
|
-
const prefix = text.length <= 120 ? 'X' : 'Y';
|
|
136781
|
-
return `${prefix}${annotation}`;
|
|
136782
|
-
}
|
|
136783
|
-
if (typeof annotation === 'object') {
|
|
136784
|
-
const { textType, note, maxLength } = annotation;
|
|
136785
|
-
const fragments = [textType];
|
|
136786
|
-
if (maxLength !== undefined) {
|
|
136787
|
-
fragments.push(',', maxLength.toString());
|
|
136788
|
-
}
|
|
136789
|
-
if (note) {
|
|
136790
|
-
fragments.push(':', ' ', note.trim());
|
|
136791
|
-
}
|
|
136792
|
-
return fragments.join('');
|
|
136793
|
-
}
|
|
136794
|
-
return '';
|
|
136795
|
-
}
|
|
136796
|
-
exports.printPropertiesFileI18nAnnotation = printPropertiesFileI18nAnnotation;
|
|
136797
|
-
/**
|
|
136798
|
-
* Creates text for i18n entry in .properties file format.
|
|
136799
|
-
* If no annotation is not present, generic default one will be generated based on the text.
|
|
136800
|
-
* @param key
|
|
136801
|
-
* @param text
|
|
136802
|
-
* @param annotation Context information for the text
|
|
136803
|
-
*/
|
|
136804
|
-
function printPropertiesFileI18nEntry(key, text, annotation) {
|
|
136805
|
-
const annotationText = printPropertiesFileI18nAnnotation(text, annotation);
|
|
136806
|
-
const comment = `#${annotationText}`;
|
|
136807
|
-
const keyValue = `${key}=${text}`;
|
|
136808
|
-
const i18nEntry = `\n${comment}\n${keyValue}\n`;
|
|
136809
|
-
return i18nEntry;
|
|
136810
|
-
}
|
|
136811
|
-
exports.printPropertiesFileI18nEntry = printPropertiesFileI18nEntry;
|
|
136812
|
-
/**
|
|
136813
|
-
* Get documentation for i18n entry
|
|
136814
|
-
*/
|
|
136815
|
-
exports.geI18ntDocumentation = (entry) => {
|
|
136816
|
-
var _a, _b;
|
|
136817
|
-
const documentation = [];
|
|
136818
|
-
const key = `**${i18n_1.i18n.t('Text_Key')}:** ${entry.key.value}`;
|
|
136819
|
-
const value = `**${i18n_1.i18n.t('Text_Value')}:** ${entry.value.value}`;
|
|
136820
|
-
documentation.push(key, value);
|
|
136821
|
-
if (entry.annotation) {
|
|
136822
|
-
const annotationText = printPropertiesFileI18nAnnotation(entry.value.value, {
|
|
136823
|
-
maxLength: (_a = entry.annotation.maxLength) === null || _a === void 0 ? void 0 : _a.value,
|
|
136824
|
-
textType: entry.annotation.textType.value,
|
|
136825
|
-
note: (_b = entry.annotation.note) === null || _b === void 0 ? void 0 : _b.value
|
|
136826
|
-
});
|
|
136827
|
-
documentation.push(`**${i18n_1.i18n.t('Additional_Information')}:** ${annotationText}`);
|
|
136828
|
-
}
|
|
136829
|
-
return documentation.join('\n\n');
|
|
136830
|
-
};
|
|
136831
|
-
|
|
136832
|
-
|
|
136833
|
-
/***/ }),
|
|
136834
|
-
|
|
136835
|
-
/***/ 86334:
|
|
136836
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
136837
|
-
|
|
136838
|
-
"use strict";
|
|
136839
|
-
|
|
136840
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
136841
|
-
const lineOffsets_1 = __webpack_require__(4787);
|
|
136842
|
-
const position_1 = __webpack_require__(63787);
|
|
136843
|
-
const positionAt_1 = __webpack_require__(72372);
|
|
136844
|
-
/**
|
|
136845
|
-
* Implements reading files Java properties files as described in https://docs.oracle.com/javase/10/docs/api/java/util/Properties.html
|
|
136846
|
-
*/
|
|
136847
|
-
function parseProperties(text) {
|
|
136848
|
-
const tokens = tokenize(text);
|
|
136849
|
-
const lineOffsets = lineOffsets_1.getLineOffsets(text);
|
|
136850
|
-
const contentLength = text.length;
|
|
136851
|
-
let i = 0;
|
|
136852
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
136853
|
-
const consume = () => tokens[i++];
|
|
136854
|
-
const eof = () => i >= tokens.length;
|
|
136855
|
-
function parseComment() {
|
|
136856
|
-
const comment = consume();
|
|
136857
|
-
return {
|
|
136858
|
-
type: 'comment-line',
|
|
136859
|
-
value: comment.image,
|
|
136860
|
-
range: positionAt_1.rangeAt(lineOffsets, comment.start, comment.end, contentLength)
|
|
136861
|
-
};
|
|
136862
|
-
}
|
|
136863
|
-
function parseKeyElement() {
|
|
136864
|
-
var _a, _b, _c, _d, _e, _f;
|
|
136865
|
-
const keyToken = consume();
|
|
136866
|
-
const key = {
|
|
136867
|
-
type: 'text',
|
|
136868
|
-
value: keyToken.image,
|
|
136869
|
-
range: positionAt_1.rangeAt(lineOffsets, keyToken.start, keyToken.end, contentLength)
|
|
136870
|
-
};
|
|
136871
|
-
let resetStartOffset = true;
|
|
136872
|
-
let start;
|
|
136873
|
-
let end;
|
|
136874
|
-
if (peek().type === 'whitespace') {
|
|
136875
|
-
consume();
|
|
136876
|
-
}
|
|
136877
|
-
if (peek().type === 'separator') {
|
|
136878
|
-
const separator = consume();
|
|
136879
|
-
start = end = separator.end;
|
|
136880
|
-
if (peek().type === 'whitespace') {
|
|
136881
|
-
consume();
|
|
136882
|
-
}
|
|
136883
|
-
}
|
|
136884
|
-
let concatenatedValue = '';
|
|
136885
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'end-of-line') {
|
|
136886
|
-
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') {
|
|
136887
|
-
if (((_d = peek()) === null || _d === void 0 ? void 0 : _d.type) === 'text' || ((_e = peek()) === null || _e === void 0 ? void 0 : _e.type) === 'whitespace') {
|
|
136888
|
-
const valueToken = consume();
|
|
136889
|
-
if (resetStartOffset) {
|
|
136890
|
-
start = valueToken.start;
|
|
136891
|
-
resetStartOffset = false;
|
|
136892
|
-
}
|
|
136893
|
-
end = valueToken.end;
|
|
136894
|
-
concatenatedValue += valueToken.image;
|
|
136895
|
-
}
|
|
136896
|
-
}
|
|
136897
|
-
if (((_f = peek()) === null || _f === void 0 ? void 0 : _f.type) === 'continuation-line-marker') {
|
|
136898
|
-
consume();
|
|
136899
|
-
if (peek().type === 'whitespace') {
|
|
136900
|
-
consume();
|
|
136901
|
-
}
|
|
136902
|
-
}
|
|
136903
|
-
}
|
|
136904
|
-
const element = {
|
|
136905
|
-
type: 'text',
|
|
136906
|
-
value: concatenatedValue,
|
|
136907
|
-
range: positionAt_1.rangeAt(lineOffsets, start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : 0, contentLength)
|
|
136908
|
-
};
|
|
136909
|
-
return {
|
|
136910
|
-
type: 'key-element-line',
|
|
136911
|
-
key,
|
|
136912
|
-
element,
|
|
136913
|
-
range: position_1.Range.create(key.range.start, element.range.end)
|
|
136914
|
-
};
|
|
136915
|
-
}
|
|
136916
|
-
function parseList() {
|
|
136917
|
-
var _a, _b;
|
|
136918
|
-
const list = [];
|
|
136919
|
-
while (!eof()) {
|
|
136920
|
-
const next = peek();
|
|
136921
|
-
if (next.type === 'comment') {
|
|
136922
|
-
list.push(parseComment());
|
|
136923
|
-
}
|
|
136924
|
-
else if (next.type === 'text') {
|
|
136925
|
-
list.push(parseKeyElement());
|
|
136926
|
-
}
|
|
136927
|
-
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') {
|
|
136928
|
-
consume();
|
|
136929
|
-
}
|
|
136930
|
-
}
|
|
136931
|
-
return list;
|
|
136932
|
-
}
|
|
136933
|
-
return parseList();
|
|
136934
|
-
}
|
|
136935
|
-
exports.parseProperties = parseProperties;
|
|
136936
|
-
const SEPARATOR = /=|:/;
|
|
136937
|
-
const COMMENT_START = /#|!/;
|
|
136938
|
-
const END_OF_LINE = /\r|\n|\r\n/;
|
|
136939
|
-
const WHITESPACE = /[ \t\f]+/;
|
|
136940
|
-
const HEX_DIGIT = /[0-9a-fA-F]/;
|
|
136941
|
-
const ELEMENT_ESCAPE_MAPPING = {
|
|
136942
|
-
'\\\\': '\\',
|
|
136943
|
-
'\\f': '\f',
|
|
136944
|
-
'\\n': '\n',
|
|
136945
|
-
'\\r': '\r',
|
|
136946
|
-
'\\t': '\t'
|
|
136947
|
-
};
|
|
136948
|
-
const KEY_ESCAPE_MAPPING = {
|
|
136949
|
-
...ELEMENT_ESCAPE_MAPPING,
|
|
136950
|
-
'\\=': '=',
|
|
136951
|
-
'\\:': ':'
|
|
136952
|
-
};
|
|
136953
|
-
const UNICODE_CHARACTER_LENGTH = 4;
|
|
136954
|
-
function createToken(type, image, start, end) {
|
|
136955
|
-
return {
|
|
136956
|
-
type,
|
|
136957
|
-
image,
|
|
136958
|
-
start,
|
|
136959
|
-
end
|
|
136960
|
-
};
|
|
136961
|
-
}
|
|
136962
|
-
exports.createToken = createToken;
|
|
136963
|
-
function tokenize(text) {
|
|
136964
|
-
const tokens = [];
|
|
136965
|
-
let i = 0;
|
|
136966
|
-
let image = '';
|
|
136967
|
-
let start = 0;
|
|
136968
|
-
while (i < text.length) {
|
|
136969
|
-
let character = text[i];
|
|
136970
|
-
if (character === '\n') {
|
|
136971
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
136972
|
-
start = i + 1;
|
|
136973
|
-
}
|
|
136974
|
-
else if (character === '\r') {
|
|
136975
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
136976
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
136977
|
-
start = i + 2;
|
|
136978
|
-
i++;
|
|
136979
|
-
}
|
|
136980
|
-
else {
|
|
136981
|
-
tokens.push({
|
|
136982
|
-
type: 'end-of-line',
|
|
136983
|
-
image: character,
|
|
136984
|
-
start: i,
|
|
136985
|
-
end: i + 1
|
|
136986
|
-
});
|
|
136987
|
-
start = i + 1;
|
|
136988
|
-
}
|
|
136989
|
-
}
|
|
136990
|
-
else if (COMMENT_START.test(character)) {
|
|
136991
|
-
image += character;
|
|
136992
|
-
while (i + 1 < text.length) {
|
|
136993
|
-
const next = text[i + 1];
|
|
136994
|
-
if (END_OF_LINE.test(next)) {
|
|
136995
|
-
break;
|
|
136996
|
-
}
|
|
136997
|
-
image += next;
|
|
136998
|
-
i++;
|
|
136999
|
-
}
|
|
137000
|
-
tokens.push(createToken('comment', image, start, i + 1));
|
|
137001
|
-
image = '';
|
|
137002
|
-
start = i + 1;
|
|
137003
|
-
}
|
|
137004
|
-
else if (WHITESPACE.test(character)) {
|
|
137005
|
-
image += character;
|
|
137006
|
-
while (i + 1 < text.length) {
|
|
137007
|
-
const next = text[i + 1];
|
|
137008
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
137009
|
-
break;
|
|
137010
|
-
}
|
|
137011
|
-
image += next;
|
|
137012
|
-
i++;
|
|
137013
|
-
}
|
|
137014
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
137015
|
-
image = '';
|
|
137016
|
-
start = i + 1;
|
|
137017
|
-
}
|
|
137018
|
-
else {
|
|
137019
|
-
// key-element pair
|
|
137020
|
-
while (i < text.length) {
|
|
137021
|
-
character = text[i];
|
|
137022
|
-
if (character === '\\') {
|
|
137023
|
-
const next = text[i + 1];
|
|
137024
|
-
if (next !== undefined) {
|
|
137025
|
-
const mappedValue = KEY_ESCAPE_MAPPING[character + next];
|
|
137026
|
-
if (mappedValue !== undefined) {
|
|
137027
|
-
image += mappedValue;
|
|
137028
|
-
i += 2;
|
|
137029
|
-
}
|
|
137030
|
-
else if (character + next === '\\u') {
|
|
137031
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
137032
|
-
let unicodeCharacterCode = '';
|
|
137033
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
137034
|
-
const c = text[index];
|
|
137035
|
-
if (HEX_DIGIT.test(c)) {
|
|
137036
|
-
unicodeCharacterCode += c;
|
|
137037
|
-
}
|
|
137038
|
-
else {
|
|
137039
|
-
break;
|
|
137040
|
-
}
|
|
137041
|
-
}
|
|
137042
|
-
if (unicodeCharacterCode.length === 4) {
|
|
137043
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
137044
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
137045
|
-
}
|
|
137046
|
-
else {
|
|
137047
|
-
// partial unicode escape sequence
|
|
137048
|
-
image += '\\u' + unicodeCharacterCode;
|
|
137049
|
-
i += 2 + unicodeCharacterCode.length;
|
|
137050
|
-
}
|
|
137051
|
-
}
|
|
137052
|
-
else {
|
|
137053
|
-
i++;
|
|
137054
|
-
}
|
|
137055
|
-
}
|
|
137056
|
-
continue;
|
|
137057
|
-
}
|
|
137058
|
-
if (WHITESPACE.test(character) || SEPARATOR.test(character) || END_OF_LINE.test(character)) {
|
|
137059
|
-
break;
|
|
137060
|
-
}
|
|
137061
|
-
image += character;
|
|
137062
|
-
i++;
|
|
137063
|
-
}
|
|
137064
|
-
tokens.push(createToken('text', image, start, i));
|
|
137065
|
-
image = '';
|
|
137066
|
-
start = i;
|
|
137067
|
-
if (WHITESPACE.test(character)) {
|
|
137068
|
-
image += character;
|
|
137069
|
-
while (i + 1 < text.length) {
|
|
137070
|
-
const next = text[i + 1];
|
|
137071
|
-
if (!WHITESPACE.test(next) || END_OF_LINE.test(next)) {
|
|
137072
|
-
break;
|
|
137073
|
-
}
|
|
137074
|
-
image += next;
|
|
137075
|
-
i++;
|
|
137076
|
-
}
|
|
137077
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
137078
|
-
image = '';
|
|
137079
|
-
start = i + 1;
|
|
137080
|
-
i++;
|
|
137081
|
-
character = text[i];
|
|
137082
|
-
}
|
|
137083
|
-
if (SEPARATOR.test(character)) {
|
|
137084
|
-
tokens.push(createToken('separator', character, start, i + 1));
|
|
137085
|
-
start = i + 1;
|
|
137086
|
-
i++;
|
|
137087
|
-
character = text[i];
|
|
137088
|
-
}
|
|
137089
|
-
if (WHITESPACE.test(character)) {
|
|
137090
|
-
image = character;
|
|
137091
|
-
while (i + 1 < text.length) {
|
|
137092
|
-
const next = text[i + 1];
|
|
137093
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
137094
|
-
break;
|
|
137095
|
-
}
|
|
137096
|
-
image += next;
|
|
137097
|
-
i++;
|
|
137098
|
-
}
|
|
137099
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
137100
|
-
image = '';
|
|
137101
|
-
start = i + 1;
|
|
137102
|
-
i++;
|
|
137103
|
-
character = text[i];
|
|
137104
|
-
}
|
|
137105
|
-
if (character === '\n') {
|
|
137106
|
-
tokens.push(createToken('end-of-line', '\n', start, i + 1));
|
|
137107
|
-
start = i + 1;
|
|
137108
|
-
}
|
|
137109
|
-
else if (character === '\r') {
|
|
137110
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
137111
|
-
tokens.push(createToken('end-of-line', character + text[i + 1], i, i + 2));
|
|
137112
|
-
start = i + 2;
|
|
137113
|
-
i++;
|
|
137114
|
-
}
|
|
137115
|
-
else {
|
|
137116
|
-
tokens.push({
|
|
137117
|
-
type: 'end-of-line',
|
|
137118
|
-
image: character,
|
|
137119
|
-
start: i,
|
|
137120
|
-
end: i + 1
|
|
137121
|
-
});
|
|
137122
|
-
start = i + 1;
|
|
137123
|
-
}
|
|
137124
|
-
}
|
|
137125
|
-
else {
|
|
137126
|
-
while (i < text.length) {
|
|
137127
|
-
character = text[i];
|
|
137128
|
-
if (character === '\\') {
|
|
137129
|
-
const next = text[i + 1];
|
|
137130
|
-
if (next !== undefined) {
|
|
137131
|
-
const mappedValue = ELEMENT_ESCAPE_MAPPING[character + next];
|
|
137132
|
-
if (mappedValue !== undefined) {
|
|
137133
|
-
image += mappedValue;
|
|
137134
|
-
i += 2;
|
|
137135
|
-
}
|
|
137136
|
-
else if (character + next === '\\u') {
|
|
137137
|
-
const unicodeEscapeEnd = i + UNICODE_CHARACTER_LENGTH + 1;
|
|
137138
|
-
let unicodeCharacterCode = '';
|
|
137139
|
-
for (let index = i + 2; index <= unicodeEscapeEnd; index++) {
|
|
137140
|
-
const c = text[index];
|
|
137141
|
-
if (HEX_DIGIT.test(c)) {
|
|
137142
|
-
unicodeCharacterCode += c;
|
|
137143
|
-
}
|
|
137144
|
-
else {
|
|
137145
|
-
break;
|
|
137146
|
-
}
|
|
137147
|
-
}
|
|
137148
|
-
if (unicodeCharacterCode.length === 4) {
|
|
137149
|
-
image += String.fromCharCode(parseInt(unicodeCharacterCode, 16));
|
|
137150
|
-
i += 2 + UNICODE_CHARACTER_LENGTH;
|
|
137151
|
-
}
|
|
137152
|
-
else {
|
|
137153
|
-
// partial unicode escape sequence
|
|
137154
|
-
image += '\\u' + unicodeCharacterCode;
|
|
137155
|
-
i += 2 + unicodeCharacterCode.length;
|
|
137156
|
-
}
|
|
137157
|
-
}
|
|
137158
|
-
else if (next === '\n') {
|
|
137159
|
-
tokens.push(createToken('text', image, start, i));
|
|
137160
|
-
tokens.push(createToken('continuation-line-marker', '\\\n', i, i + 2));
|
|
137161
|
-
start = i + 2;
|
|
137162
|
-
i += 2;
|
|
137163
|
-
image = '';
|
|
137164
|
-
}
|
|
137165
|
-
else if (next === '\r') {
|
|
137166
|
-
if (i + 1 < text.length && text[i + 2] === '\n') {
|
|
137167
|
-
tokens.push(createToken('text', image, start, i));
|
|
137168
|
-
tokens.push(createToken('continuation-line-marker', '\\\r\n', i, i + 3));
|
|
137169
|
-
start = i + 3;
|
|
137170
|
-
i += 3;
|
|
137171
|
-
image = '';
|
|
137172
|
-
}
|
|
137173
|
-
else {
|
|
137174
|
-
tokens.push(createToken('text', image, start, i));
|
|
137175
|
-
tokens.push(createToken('continuation-line-marker', '\\\r', i, i + 2));
|
|
137176
|
-
start = i + 2;
|
|
137177
|
-
i += 2;
|
|
137178
|
-
image = '';
|
|
137179
|
-
}
|
|
137180
|
-
}
|
|
137181
|
-
else {
|
|
137182
|
-
i++;
|
|
137183
|
-
}
|
|
137184
|
-
}
|
|
137185
|
-
continue;
|
|
137186
|
-
}
|
|
137187
|
-
if (WHITESPACE.test(character)) {
|
|
137188
|
-
if (image) {
|
|
137189
|
-
tokens.push(createToken('text', image, start, i));
|
|
137190
|
-
image = '';
|
|
137191
|
-
start = i;
|
|
137192
|
-
}
|
|
137193
|
-
image = character;
|
|
137194
|
-
while (i + 1 < text.length) {
|
|
137195
|
-
const next = text[i + 1];
|
|
137196
|
-
if (WHITESPACE.test(next) === false || END_OF_LINE.test(next)) {
|
|
137197
|
-
break;
|
|
137198
|
-
}
|
|
137199
|
-
image += next;
|
|
137200
|
-
i++;
|
|
137201
|
-
}
|
|
137202
|
-
tokens.push(createToken('whitespace', image, start, i + 1));
|
|
137203
|
-
image = '';
|
|
137204
|
-
start = i + 1;
|
|
137205
|
-
i++;
|
|
137206
|
-
character = text[i];
|
|
137207
|
-
continue;
|
|
137208
|
-
}
|
|
137209
|
-
if (END_OF_LINE.test(character)) {
|
|
137210
|
-
break;
|
|
137211
|
-
}
|
|
137212
|
-
image += character;
|
|
137213
|
-
i++;
|
|
137214
|
-
}
|
|
137215
|
-
tokens.push(createToken('text', image, start, i));
|
|
137216
|
-
image = '';
|
|
137217
|
-
start = i;
|
|
137218
|
-
if (END_OF_LINE.test(character)) {
|
|
137219
|
-
continue;
|
|
137220
|
-
}
|
|
137221
|
-
}
|
|
137222
|
-
}
|
|
137223
|
-
i++;
|
|
137224
|
-
}
|
|
137225
|
-
return tokens;
|
|
137226
|
-
}
|
|
137227
|
-
exports.tokenize = tokenize;
|
|
137228
|
-
|
|
137229
|
-
|
|
137230
|
-
/***/ }),
|
|
137231
|
-
|
|
137232
|
-
/***/ 79910:
|
|
137233
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
137234
|
-
|
|
137235
|
-
"use strict";
|
|
137236
|
-
|
|
137237
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
137238
|
-
const types_1 = __webpack_require__(69338);
|
|
137239
|
-
/**
|
|
137240
|
-
* Get the calculated maximum text length for an i18n property value.
|
|
137241
|
-
*
|
|
137242
|
-
* (The algorithm considers the current UI5 specification)
|
|
137243
|
-
*
|
|
137244
|
-
* @param value - Value of the i18n property
|
|
137245
|
-
*/
|
|
137246
|
-
exports.getI18nMaxLength = (value) => {
|
|
137247
|
-
const iLength = value.length;
|
|
137248
|
-
const iMaxLength = iLength < 8 ? iLength * 5 : iLength <= 30 ? iLength * 3 : iLength * 1.5;
|
|
137249
|
-
return iMaxLength;
|
|
137250
|
-
};
|
|
137251
|
-
/**
|
|
137252
|
-
* Get a suitable textType for an i18n property.
|
|
137253
|
-
*
|
|
137254
|
-
* The textType is derived from the maximum text length maxLength of the property value.
|
|
137255
|
-
*
|
|
137256
|
-
* @param maxLength - Maximum text length of the i18n property value
|
|
137257
|
-
*/
|
|
137258
|
-
exports.getI18nTextType = (maxLength) => {
|
|
137259
|
-
if (maxLength <= 120) {
|
|
137260
|
-
return types_1.SapShortTextType.Label;
|
|
137261
|
-
}
|
|
137262
|
-
return types_1.SapLongTextType.MessageText;
|
|
137263
|
-
};
|
|
137264
|
-
|
|
137265
|
-
|
|
137266
|
-
/***/ }),
|
|
137267
|
-
|
|
137268
|
-
/***/ 83525:
|
|
137269
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
137270
|
-
|
|
137271
|
-
"use strict";
|
|
137272
|
-
|
|
137273
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
137274
|
-
/**
|
|
137275
|
-
* Convert to camel case
|
|
137276
|
-
*
|
|
137277
|
-
* It gets input like 'product details info' and convert it
|
|
137278
|
-
* to 'productDetailsInfo'
|
|
137279
|
-
*
|
|
137280
|
-
*/
|
|
137281
|
-
exports.convertToCamelCase = (input = '', maxWord = 4) => {
|
|
137282
|
-
let output = '';
|
|
137283
|
-
const parts = input
|
|
137284
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
137285
|
-
.trim()
|
|
137286
|
-
.split(' ');
|
|
137287
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
137288
|
-
for (let i = 0; len > i; i++) {
|
|
137289
|
-
const part = parts[i];
|
|
137290
|
-
if (i === 0) {
|
|
137291
|
-
output += part.toLowerCase();
|
|
137292
|
-
}
|
|
137293
|
-
else {
|
|
137294
|
-
const initial = part.charAt(0).toUpperCase();
|
|
137295
|
-
const rest = part.substr(1).toLowerCase();
|
|
137296
|
-
output += `${initial}${rest}`;
|
|
137297
|
-
}
|
|
137298
|
-
}
|
|
137299
|
-
return output;
|
|
137300
|
-
};
|
|
137301
|
-
/**
|
|
137302
|
-
* Convert to pascal case
|
|
137303
|
-
*
|
|
137304
|
-
* It gets input like 'product details info' and convert it
|
|
137305
|
-
* to 'ProductDetailsInfo'
|
|
137306
|
-
*/
|
|
137307
|
-
exports.convertToPascalCase = (input, maxWord = 4) => {
|
|
137308
|
-
let output = '';
|
|
137309
|
-
const parts = input
|
|
137310
|
-
.replace(/[^a-zA-Z0-9 ]/g, '')
|
|
137311
|
-
.trim()
|
|
137312
|
-
.split(' ');
|
|
137313
|
-
const len = parts.length >= maxWord ? maxWord : parts.length;
|
|
137314
|
-
for (let i = 0; len > i; i++) {
|
|
137315
|
-
const part = parts[i];
|
|
137316
|
-
const initial = part.charAt(0).toUpperCase();
|
|
137317
|
-
const rest = part.substr(1).toLowerCase();
|
|
137318
|
-
output += `${initial}${rest}`;
|
|
137319
|
-
}
|
|
137320
|
-
return output;
|
|
137321
|
-
};
|
|
137322
|
-
|
|
137323
|
-
|
|
137324
|
-
/***/ }),
|
|
137325
|
-
|
|
137326
|
-
/***/ 69338:
|
|
137327
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
137328
|
-
|
|
137329
|
-
"use strict";
|
|
137330
|
-
|
|
137331
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
137332
|
-
/**
|
|
137333
|
-
* Text types for texts that are less than 120 characters long
|
|
137334
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
137335
|
-
*/
|
|
137336
|
-
var SapShortTextType;
|
|
137337
|
-
(function (SapShortTextType) {
|
|
137338
|
-
SapShortTextType["Accessibility"] = "XACT";
|
|
137339
|
-
SapShortTextType["AlternativeText"] = "XALT";
|
|
137340
|
-
SapShortTextType["BreadcrumbStep"] = "XBCB";
|
|
137341
|
-
SapShortTextType["BulletListItemText"] = "XBLI";
|
|
137342
|
-
SapShortTextType["ButtonText"] = "XBUT";
|
|
137343
|
-
SapShortTextType["Caption"] = "XCAP";
|
|
137344
|
-
SapShortTextType["Cell"] = "XCEL";
|
|
137345
|
-
SapShortTextType["Checkbox"] = "XCKL";
|
|
137346
|
-
SapShortTextType["ColumnHeader"] = "XCOL";
|
|
137347
|
-
SapShortTextType["Tabstrip"] = "XCRD";
|
|
137348
|
-
SapShortTextType["DataNavigationText"] = "XDAT";
|
|
137349
|
-
SapShortTextType["Label"] = "XFLD";
|
|
137350
|
-
SapShortTextType["Frame"] = "XFRM";
|
|
137351
|
-
SapShortTextType["Term"] = "XGLS";
|
|
137352
|
-
SapShortTextType["GroupTitle"] = "XGRP";
|
|
137353
|
-
SapShortTextType["Heading"] = "XHED";
|
|
137354
|
-
SapShortTextType["LegendText"] = "XLGD";
|
|
137355
|
-
SapShortTextType["HyperlinkText"] = "XLNK";
|
|
137356
|
-
SapShortTextType["LogEntry"] = "XLOG";
|
|
137357
|
-
SapShortTextType["ListBoxItem"] = "XLST";
|
|
137358
|
-
SapShortTextType["MenuHeader"] = "XMEN";
|
|
137359
|
-
SapShortTextType["MenuItem"] = "XMIT";
|
|
137360
|
-
SapShortTextType["MessageText"] = "XMSG";
|
|
137361
|
-
SapShortTextType["RadioButton"] = "XRBL";
|
|
137362
|
-
SapShortTextType["RoadmapStep"] = "XRMP";
|
|
137363
|
-
SapShortTextType["TableRowHeading"] = "XROW";
|
|
137364
|
-
SapShortTextType["SelectionText"] = "XSEL";
|
|
137365
|
-
SapShortTextType["TabStripText"] = "XTBS";
|
|
137366
|
-
SapShortTextType["TableTitle"] = "XTIT";
|
|
137367
|
-
SapShortTextType["TreeNodeText"] = "XTND";
|
|
137368
|
-
SapShortTextType["QuickInfoText"] = "XTOL";
|
|
137369
|
-
SapShortTextType["GeneralText"] = "XTXT";
|
|
137370
|
-
})(SapShortTextType = exports.SapShortTextType || (exports.SapShortTextType = {}));
|
|
137371
|
-
/**
|
|
137372
|
-
* Text types for texts that are more than 120 characters long
|
|
137373
|
-
* https://openui5.hana.ondemand.com/topic/831039835e7c4da3a8a0b49567573afe
|
|
137374
|
-
*/
|
|
137375
|
-
var SapLongTextType;
|
|
137376
|
-
(function (SapLongTextType) {
|
|
137377
|
-
SapLongTextType["Accessibility"] = "YACT";
|
|
137378
|
-
SapLongTextType["BulletListItemText"] = "YBLI";
|
|
137379
|
-
SapLongTextType["Definition"] = "YDEF";
|
|
137380
|
-
SapLongTextType["Description"] = "YDES";
|
|
137381
|
-
SapLongTextType["Explanation"] = "YEXP";
|
|
137382
|
-
SapLongTextType["FaqAnswer"] = "YFAA";
|
|
137383
|
-
SapLongTextType["Faq"] = "YFAQ";
|
|
137384
|
-
SapLongTextType["GlossaryDefinition"] = "YGLS";
|
|
137385
|
-
SapLongTextType["Information"] = "YINF";
|
|
137386
|
-
SapLongTextType["Instruction"] = "YINS";
|
|
137387
|
-
SapLongTextType["LogEntry"] = "YLOG";
|
|
137388
|
-
SapLongTextType["ErrorMessage"] = "YMSE";
|
|
137389
|
-
SapLongTextType["MessageText"] = "YMSG";
|
|
137390
|
-
SapLongTextType["InformationMessageLong"] = "YMSI";
|
|
137391
|
-
SapLongTextType["WarningMessage"] = "YMSW";
|
|
137392
|
-
SapLongTextType["TechnicalText"] = "YTEC";
|
|
137393
|
-
SapLongTextType["Ticker"] = "YTIC";
|
|
137394
|
-
SapLongTextType["GeneralTextLong"] = "YTXT";
|
|
137395
|
-
})(SapLongTextType = exports.SapLongTextType || (exports.SapLongTextType = {}));
|
|
137396
|
-
exports.NOT_RELEVANT_FOR_TRANSLATION = 'NOTR';
|
|
137397
|
-
|
|
137398
|
-
|
|
137399
134642
|
/***/ }),
|
|
137400
134643
|
|
|
137401
134644
|
/***/ 52136:
|
|
@@ -138625,8 +135868,7 @@ async function getAuthHeaderForInstanceBasedDest(destinationInstance) {
|
|
|
138625
135868
|
const credentials = (await cf_tools_1.apiGetInstanceCredentials(destinationInstance)).credentials;
|
|
138626
135869
|
const clientId = ((_a = credentials.uaa) === null || _a === void 0 ? void 0 : _a.clientid) || credentials.clientid;
|
|
138627
135870
|
const clientSecret = ((_b = credentials.uaa) === null || _b === void 0 ? void 0 : _b.clientsecret) || credentials.clientsecret;
|
|
138628
|
-
|
|
138629
|
-
return base64Header;
|
|
135871
|
+
return Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
|
|
138630
135872
|
}
|
|
138631
135873
|
catch (error) {
|
|
138632
135874
|
throw new Error(`An error occurred while retrieving service key for the destination instance ${destinationInstance}: ${error}`);
|
|
@@ -139063,8 +136305,7 @@ async function runPostConnectionCallback({ log, uaa, accessToken, postConnection
|
|
|
139063
136305
|
async function getUserInfo(uaa, accessToken) {
|
|
139064
136306
|
var _a, _b;
|
|
139065
136307
|
const userInfoResp = await axios_1.default.request(uaa.getUserinfoRequest(accessToken));
|
|
139066
|
-
|
|
139067
|
-
return userDisplayName;
|
|
136308
|
+
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);
|
|
139068
136309
|
}
|
|
139069
136310
|
/** Gets user information from UAA. Will call the callback function passed in. Will swallow errors and only log them
|
|
139070
136311
|
* If we don't succeed, we try again later
|
|
@@ -140256,10 +137497,7 @@ async function getBTPSystem(system, savedSapSystemServiceKey) {
|
|
|
140256
137497
|
}
|
|
140257
137498
|
exports.getBTPSystem = getBTPSystem;
|
|
140258
137499
|
async function isSystemNameValid(newName, savedSystemName) {
|
|
140259
|
-
|
|
140260
|
-
return false;
|
|
140261
|
-
}
|
|
140262
|
-
return true;
|
|
137500
|
+
return newName && newName !== savedSystemName && (await __1.isSystemNameInUse(newName)) ? false : true;
|
|
140263
137501
|
}
|
|
140264
137502
|
exports.isSystemNameValid = isSystemNameValid;
|
|
140265
137503
|
async function isSapSystemConnected(sapSystem) {
|
|
@@ -141637,8 +138875,7 @@ async function getParsedUi5YamlConfig(dirPath, filename) {
|
|
|
141637
138875
|
if (contents) {
|
|
141638
138876
|
try {
|
|
141639
138877
|
// yaml.parse can throw exception if .yaml file has syntax errors
|
|
141640
|
-
|
|
141641
|
-
return parsedConfig;
|
|
138878
|
+
return yaml.parse(contents);
|
|
141642
138879
|
}
|
|
141643
138880
|
catch (e) {
|
|
141644
138881
|
throw new Error(i18n_1.i18n.t('ERROR_UI5_YAML_PARSING', { filePath: path_1.join(dirPath, filename), parsingError: e.message }));
|
|
@@ -141678,7 +138915,7 @@ const i18n_1 = __webpack_require__(23794);
|
|
|
141678
138915
|
const file_1 = __webpack_require__(1595);
|
|
141679
138916
|
const yaml = __importStar(__webpack_require__(86916));
|
|
141680
138917
|
const os_1 = __importDefault(__webpack_require__(22037));
|
|
141681
|
-
const
|
|
138918
|
+
const capProject_1 = __webpack_require__(87616);
|
|
141682
138919
|
const webapp_1 = __webpack_require__(39198);
|
|
141683
138920
|
const request_promise_1 = __importDefault(__webpack_require__(19602));
|
|
141684
138921
|
const ui5Config_1 = __webpack_require__(94116);
|
|
@@ -141976,10 +139213,10 @@ async function getDetailedProjectType(appRoot, projectRoot) {
|
|
|
141976
139213
|
if (appRoot === projectRoot) {
|
|
141977
139214
|
return "EDMX Backend" /* Edxm */;
|
|
141978
139215
|
}
|
|
141979
|
-
if (await
|
|
139216
|
+
if (await capProject_1.isCapJavaProject(projectRoot)) {
|
|
141980
139217
|
return "CAP Java" /* CAPJava */;
|
|
141981
139218
|
}
|
|
141982
|
-
if (await
|
|
139219
|
+
if (await capProject_1.isCapNodeJsProject(projectRoot)) {
|
|
141983
139220
|
return "CAP Node.js" /* CAPNode */;
|
|
141984
139221
|
}
|
|
141985
139222
|
throw new Error(i18n_1.i18n.t('ERROR_DETAIL_PROJECT_TYPE', { appRoot, projectRoot }));
|
|
@@ -142029,7 +139266,7 @@ async function findRootsForPath(path) {
|
|
|
142029
139266
|
// The first package.json we found when searching up contains sapux, but not true -> not supported
|
|
142030
139267
|
return null;
|
|
142031
139268
|
}
|
|
142032
|
-
if (await
|
|
139269
|
+
if (await capProject_1.isCapProject(appRoot, appPckJson)) {
|
|
142033
139270
|
// App is part of a CAP project, but doesn't have own package.json and is not mentioned in sapux array
|
|
142034
139271
|
// in root -> not supported
|
|
142035
139272
|
return null;
|
|
@@ -142046,7 +139283,7 @@ async function findRootsForPath(path) {
|
|
|
142046
139283
|
const { root } = path_1.parse(appRoot);
|
|
142047
139284
|
let projectRoot = path_1.dirname(appRoot);
|
|
142048
139285
|
while (projectRoot !== root) {
|
|
142049
|
-
if (await
|
|
139286
|
+
if (await capProject_1.isCapProject(projectRoot)) {
|
|
142050
139287
|
// We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
|
|
142051
139288
|
// Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
|
|
142052
139289
|
if (path_1.join(projectRoot, 'app') !== appRoot) {
|
|
@@ -142107,7 +139344,7 @@ exports.findRunnableProjects = async (workspaceRoots, logger) => {
|
|
|
142107
139344
|
for (const root of roots) {
|
|
142108
139345
|
try {
|
|
142109
139346
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
142110
|
-
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await
|
|
139347
|
+
if ((exports.hasDependency(packageJson, '@sap/ux-ui5-tooling') || (await capProject_1.isCapProject(root, packageJson))) &&
|
|
142111
139348
|
hasScript(packageJson)) {
|
|
142112
139349
|
result.push(root);
|
|
142113
139350
|
}
|
|
@@ -142131,10 +139368,7 @@ async function checkPackageJson(root, dependency, sapux) {
|
|
|
142131
139368
|
(packageJson.devDependencies && packageJson.devDependencies[dependency] !== undefined)) {
|
|
142132
139369
|
return true;
|
|
142133
139370
|
}
|
|
142134
|
-
|
|
142135
|
-
return true;
|
|
142136
|
-
}
|
|
142137
|
-
return false;
|
|
139371
|
+
return sapux === true && packageJson.sapux === true;
|
|
142138
139372
|
}
|
|
142139
139373
|
exports.checkPackageJson = checkPackageJson;
|
|
142140
139374
|
/**
|
|
@@ -142467,7 +139701,7 @@ exports.findI18nProperty = findI18nProperty;
|
|
|
142467
139701
|
* @param packageJson - the parsed content of package.json
|
|
142468
139702
|
*/
|
|
142469
139703
|
async function getProjectTypeFromProjectFiles(projectRoot, packageJson) {
|
|
142470
|
-
return (await
|
|
139704
|
+
return (await capProject_1.isCapProject(projectRoot, packageJson)) ? "Cap" /* Cap */ : "Edmx" /* Edmx */;
|
|
142471
139705
|
}
|
|
142472
139706
|
exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
142473
139707
|
/**
|
|
@@ -142476,8 +139710,7 @@ exports.getProjectTypeFromProjectFiles = getProjectTypeFromProjectFiles;
|
|
|
142476
139710
|
*/
|
|
142477
139711
|
async function getProjectType(root) {
|
|
142478
139712
|
const packageJson = await file_1.readJSON(path_1.join(root, project_spec_1.FileName.Package));
|
|
142479
|
-
|
|
142480
|
-
return projectType;
|
|
139713
|
+
return getProjectTypeFromProjectFiles(root, packageJson);
|
|
142481
139714
|
}
|
|
142482
139715
|
exports.getProjectType = getProjectType;
|
|
142483
139716
|
/**
|
|
@@ -142527,8 +139760,7 @@ async function getLocalUI5Version(root) {
|
|
|
142527
139760
|
const yamlFile = path_1.join(root, project_spec_1.FileName.Ui5LocalYaml);
|
|
142528
139761
|
if (await file_1.fileExists(yamlFile)) {
|
|
142529
139762
|
const yamlContent = yaml.parse(await file_1.readFile(yamlFile));
|
|
142530
|
-
|
|
142531
|
-
return ui5Version;
|
|
139763
|
+
return yamlContent.framework && yamlContent.framework.version;
|
|
142532
139764
|
}
|
|
142533
139765
|
}
|
|
142534
139766
|
exports.getLocalUI5Version = getLocalUI5Version;
|
|
@@ -146387,16 +143619,13 @@ class PerformanceMeasurementAPI extends types_1.PerformanceMeasurement {
|
|
|
146387
143619
|
return PerformanceMeasurementAPI.entries;
|
|
146388
143620
|
}
|
|
146389
143621
|
static getEntriesByName(name) {
|
|
146390
|
-
|
|
146391
|
-
return filtered;
|
|
143622
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name);
|
|
146392
143623
|
}
|
|
146393
143624
|
static getEntriesByNameType(name, type) {
|
|
146394
|
-
|
|
146395
|
-
return filtered;
|
|
143625
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.name === name && entry.type === type);
|
|
146396
143626
|
}
|
|
146397
143627
|
static getEntriesByType(type) {
|
|
146398
|
-
|
|
146399
|
-
return filtered;
|
|
143628
|
+
return PerformanceMeasurementAPI.entries.filter((entry) => entry.type === type);
|
|
146400
143629
|
}
|
|
146401
143630
|
static getMeasurementDuration(name) {
|
|
146402
143631
|
const entry = PerformanceMeasurementAPI.getEntriesByNameType(name, types_1.EntryType.MEASUREMENT).slice(-1)[0];
|
|
@@ -146752,8 +143981,7 @@ async function processToolsSuiteTelemetry(telemetryHelperProperties) {
|
|
|
146752
143981
|
if (telemetryHelperProperties) {
|
|
146753
143982
|
appProperties = await getAppProperties(telemetryHelperProperties['appPath']);
|
|
146754
143983
|
}
|
|
146755
|
-
|
|
146756
|
-
return finalProperties;
|
|
143984
|
+
return { ...commonProperties, ...appProperties };
|
|
146757
143985
|
}
|
|
146758
143986
|
exports.processToolsSuiteTelemetry = processToolsSuiteTelemetry;
|
|
146759
143987
|
/**
|
|
@@ -147415,12 +144643,14 @@ exports.MIN_UI5_VERSION_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_V4_TEMPLATE;
|
|
|
147415
144643
|
exports.MIN_UI5_VERSION = ui5_info_1.MIN_UI5_VERSION;
|
|
147416
144644
|
exports.MIN_UI5_VERSION_ALP_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_ALP_V4_TEMPLATE;
|
|
147417
144645
|
exports.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE;
|
|
144646
|
+
exports.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE = ui5_info_1.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE;
|
|
147418
144647
|
exports.retrieveUI5Versions = ui5_info_1.retrieveUI5Versions;
|
|
147419
144648
|
exports.getUi5Themes = ui5_info_1.getUi5Themes;
|
|
147420
144649
|
exports.getManifestVersion = ui5_info_1.getManifestVersion;
|
|
147421
144650
|
exports.uI5VersionsWithCodeAssist = ui5_info_1.uI5VersionsWithCodeAssist;
|
|
147422
144651
|
exports.getUI5Versions = ui5_info_1.getUI5Versions;
|
|
147423
144652
|
exports.getSapSystemUI5Version = ui5_info_1.getSapSystemUI5Version;
|
|
144653
|
+
exports.getUI5VersionsEnhanced = ui5_info_1.getUI5VersionsEnhanced;
|
|
147424
144654
|
var types_1 = __webpack_require__(8450);
|
|
147425
144655
|
exports.FioriElementsVersion = types_1.FioriElementsVersion;
|
|
147426
144656
|
exports.minUI5VersionForLocalDev = types_1.minUI5VersionForLocalDev;
|
|
@@ -147472,6 +144702,7 @@ const https_1 = __importDefault(__webpack_require__(95687));
|
|
|
147472
144702
|
exports.MIN_UI5_VERSION_V4_TEMPLATE = '1.84.0';
|
|
147473
144703
|
exports.MIN_UI5_VERSION = '1.65.0';
|
|
147474
144704
|
exports.MIN_UI5_VERSION_ALP_V4_TEMPLATE = '1.90.0';
|
|
144705
|
+
exports.MIN_UI5_VERSION_WORKLIST_V4_TEMPLATE = '1.99.0';
|
|
147475
144706
|
exports.MIN_UI5_VERSION_FORM_ENTRY_TEMPLATE = '1.90.0';
|
|
147476
144707
|
const MIN_UI5_VERSION_V2_TEMPLATE = '1.76.0';
|
|
147477
144708
|
const MIN_UI5_DARK_THEME = '1.72.0';
|
|
@@ -147564,6 +144795,15 @@ const consoleLogger = {
|
|
|
147564
144795
|
const PASS_THROUGH_STRINGS = new Set(['snapshot', 'snapshot-untested', "Latest" /* LatestVersionString */]);
|
|
147565
144796
|
// This one holds the actual version, not 'Latest'
|
|
147566
144797
|
let latestUI5Version;
|
|
144798
|
+
var UI5_VERSIONS_TYPE;
|
|
144799
|
+
(function (UI5_VERSIONS_TYPE) {
|
|
144800
|
+
UI5_VERSIONS_TYPE["official"] = "officialVersions";
|
|
144801
|
+
UI5_VERSIONS_TYPE["snapshot"] = "snapshotsVersions";
|
|
144802
|
+
})(UI5_VERSIONS_TYPE = exports.UI5_VERSIONS_TYPE || (exports.UI5_VERSIONS_TYPE = {}));
|
|
144803
|
+
exports.ui5VersionsCache = {
|
|
144804
|
+
officialVersions: [],
|
|
144805
|
+
snapshotsVersions: []
|
|
144806
|
+
};
|
|
147567
144807
|
/**
|
|
147568
144808
|
* Get manifest version from UI5 version
|
|
147569
144809
|
* @param ui5Version - selected UI5 version
|
|
@@ -147648,12 +144888,25 @@ async function getUI5Versions(url) {
|
|
|
147648
144888
|
if (route.path === '/') {
|
|
147649
144889
|
latestUI5Version = route.target.version;
|
|
147650
144890
|
}
|
|
147651
|
-
|
|
147652
|
-
return version;
|
|
144891
|
+
return route.path === '/' ? "Latest" /* DefaultVersion */ : route.target.version;
|
|
147653
144892
|
});
|
|
147654
144893
|
return result;
|
|
147655
144894
|
}
|
|
147656
144895
|
exports.getUI5Versions = getUI5Versions;
|
|
144896
|
+
/**
|
|
144897
|
+
* Returns ui5 versions from cache object
|
|
144898
|
+
* @param type 'officialVersions' or 'snapshotsVersions
|
|
144899
|
+
* @returns Array of UI5 versions
|
|
144900
|
+
*/
|
|
144901
|
+
exports.retrieveUI5VersionsCache = async (type, useCache = false) => {
|
|
144902
|
+
if (!useCache) {
|
|
144903
|
+
return getUI5Versions(type === "officialVersions" /* official */ ? "https://ui5.sap.com" /* OfficialUrl */ : "https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */);
|
|
144904
|
+
}
|
|
144905
|
+
if (exports.ui5VersionsCache[type].length === 0) {
|
|
144906
|
+
exports.ui5VersionsCache[type] = await getUI5Versions(type === "officialVersions" /* official */ ? "https://ui5.sap.com" /* OfficialUrl */ : "https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */);
|
|
144907
|
+
}
|
|
144908
|
+
return exports.ui5VersionsCache[type];
|
|
144909
|
+
};
|
|
147657
144910
|
/**
|
|
147658
144911
|
* Return a list of UI5 versions.
|
|
147659
144912
|
* @param filterOptions - filter the UI5 versions returned
|
|
@@ -147665,7 +144918,7 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
147665
144918
|
let snapshotVersions = [];
|
|
147666
144919
|
try {
|
|
147667
144920
|
officialVersions = (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.onlyNpmVersion) ? await retrieveNpmUI5Versions(filterOptions.fioriElementsVersion || "v2" /* v2 */, filterOptions.ui5SelectedVersion)
|
|
147668
|
-
: await
|
|
144921
|
+
: await exports.retrieveUI5VersionsCache("officialVersions" /* official */, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.useCache);
|
|
147669
144922
|
}
|
|
147670
144923
|
catch (error) {
|
|
147671
144924
|
logger.warning(`Request to '${"https://ui5.sap.com" /* OfficialUrl */}' failed. Error was: '${error.message}'. Fallback to default UI5 versions`);
|
|
@@ -147673,7 +144926,7 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
147673
144926
|
}
|
|
147674
144927
|
if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.includeSnapshots) {
|
|
147675
144928
|
try {
|
|
147676
|
-
snapshotVersions = await
|
|
144929
|
+
snapshotVersions = await exports.retrieveUI5VersionsCache("snapshotsVersions" /* snapshot */, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.useCache);
|
|
147677
144930
|
}
|
|
147678
144931
|
catch (error) {
|
|
147679
144932
|
logger.error(`Request to '${"https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com" /* SnapshotUrl */}' failed. Error was: '${error.message}'`);
|
|
@@ -147683,11 +144936,8 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
147683
144936
|
if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.minSupportedUI5Version) {
|
|
147684
144937
|
versions = filterNewerEqual(versions, filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.minSupportedUI5Version);
|
|
147685
144938
|
}
|
|
147686
|
-
else if (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.fioriElementsVersion) {
|
|
147687
|
-
versions =
|
|
147688
|
-
filterOptions.fioriElementsVersion === "v4" /* v4 */
|
|
147689
|
-
? filterNewerEqual(versions, exports.MIN_UI5_VERSION_V4_TEMPLATE)
|
|
147690
|
-
: filterNewerEqual(versions, exports.MIN_UI5_VERSION);
|
|
144939
|
+
else if ((filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.fioriElementsVersion) && filterOptions.fioriElementsVersion === "v4" /* v4 */) {
|
|
144940
|
+
versions = filterNewerEqual(versions, exports.MIN_UI5_VERSION_V4_TEMPLATE);
|
|
147691
144941
|
}
|
|
147692
144942
|
else {
|
|
147693
144943
|
versions = filterNewerEqual(versions, exports.MIN_UI5_VERSION);
|
|
@@ -147698,9 +144948,31 @@ async function retrieveUI5Versions(filterOptions, logger = consoleLogger, return
|
|
|
147698
144948
|
if (returnLatestValue && versions[0].includes("Latest" /* LatestVersionString */)) {
|
|
147699
144949
|
versions[0] = latestUI5Version;
|
|
147700
144950
|
}
|
|
147701
|
-
return versions;
|
|
144951
|
+
return (filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.removeDuplicateVersions) === true ? [...new Set(versions)] : versions;
|
|
147702
144952
|
}
|
|
147703
144953
|
exports.retrieveUI5Versions = retrieveUI5Versions;
|
|
144954
|
+
/**
|
|
144955
|
+
* Return a list of UI5 versions structured for Project Inquirer prompt.
|
|
144956
|
+
* @param filterOptions - filter the UI5 versions returned
|
|
144957
|
+
* @returns - returns array of UI5 versions.
|
|
144958
|
+
*/
|
|
144959
|
+
async function getUI5VersionsEnhanced(filterOptions) {
|
|
144960
|
+
let filteredUI5Versions = await retrieveUI5Versions(filterOptions, undefined, true);
|
|
144961
|
+
const defaultUI5Version = filteredUI5Versions[0];
|
|
144962
|
+
if (!(filterOptions === null || filterOptions === void 0 ? void 0 : filterOptions.includeSnapshots)) {
|
|
144963
|
+
filteredUI5Versions = sortUI5Versions(filteredUI5Versions);
|
|
144964
|
+
}
|
|
144965
|
+
return filteredUI5Versions.map((ui5) => ({
|
|
144966
|
+
value: {
|
|
144967
|
+
version: ui5,
|
|
144968
|
+
semantic: ui5,
|
|
144969
|
+
toString: () => ui5,
|
|
144970
|
+
default: defaultUI5Version === ui5
|
|
144971
|
+
},
|
|
144972
|
+
name: ui5
|
|
144973
|
+
}));
|
|
144974
|
+
}
|
|
144975
|
+
exports.getUI5VersionsEnhanced = getUI5VersionsEnhanced;
|
|
147704
144976
|
/**
|
|
147705
144977
|
* Return supported UI5 themes
|
|
147706
144978
|
* @param [ui5Version] - optional, UI5 version to get themes for
|
|
@@ -147861,775 +145133,6 @@ async function getSapSystemUI5Version(sapSystemHost, rejectUnauthorized = false)
|
|
|
147861
145133
|
exports.getSapSystemUI5Version = getSapSystemUI5Version;
|
|
147862
145134
|
|
|
147863
145135
|
|
|
147864
|
-
/***/ }),
|
|
147865
|
-
|
|
147866
|
-
/***/ 42745:
|
|
147867
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
147868
|
-
|
|
147869
|
-
"use strict";
|
|
147870
|
-
|
|
147871
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
147872
|
-
const path_1 = __webpack_require__(71017);
|
|
147873
|
-
const fs_1 = __webpack_require__(57147);
|
|
147874
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
147875
|
-
const resolve_1 = __webpack_require__(96749);
|
|
147876
|
-
const utils_1 = __webpack_require__(8655);
|
|
147877
|
-
const json_1 = __webpack_require__(34692);
|
|
147878
|
-
const csv_1 = __webpack_require__(98944);
|
|
147879
|
-
/**
|
|
147880
|
-
* Adds new i18n entries to an existing file or in a new file if one does not exist
|
|
147881
|
-
* @param env CDS environment configuration
|
|
147882
|
-
* @param root project root, where i18n folder should reside if no i18n file exists
|
|
147883
|
-
* @param path path to cds file for which translation should be maintained
|
|
147884
|
-
* @param newI18nEntries new i18n entries that will be maintained
|
|
147885
|
-
*/
|
|
147886
|
-
async function addI18nEntriesForCdsFile(env, root, path, newI18nEntries) {
|
|
147887
|
-
const { folders, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
147888
|
-
let i18nFolderPath = resolve_1.resolveI18nFolderForFile(env, path_1.join(root, path));
|
|
147889
|
-
if (!i18nFolderPath) {
|
|
147890
|
-
const folder = folders[0];
|
|
147891
|
-
i18nFolderPath = path_1.join(root, folder);
|
|
147892
|
-
await fs_1.promises.mkdir(i18nFolderPath);
|
|
147893
|
-
}
|
|
147894
|
-
const updaters = [tryAddJsonTexts, tryAddPropertiesTexts, tryAddCsvTexts];
|
|
147895
|
-
const filePath = path_1.join(i18nFolderPath, baseFileName);
|
|
147896
|
-
for (const update of updaters) {
|
|
147897
|
-
const completed = await update(env, filePath, newI18nEntries);
|
|
147898
|
-
if (completed) {
|
|
147899
|
-
break;
|
|
147900
|
-
}
|
|
147901
|
-
}
|
|
147902
|
-
}
|
|
147903
|
-
exports.addI18nEntriesForCdsFile = addI18nEntriesForCdsFile;
|
|
147904
|
-
async function tryAddJsonTexts(env, path, newI18nEntries) {
|
|
147905
|
-
const { fallbackLanguage } = utils_1.getI18nConfiguration(env);
|
|
147906
|
-
try {
|
|
147907
|
-
const i18nFilePath = utils_1.jsonPathFormatter(path);
|
|
147908
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
147909
|
-
const newContent = json_1.addJsonTexts(content, fallbackLanguage, newI18nEntries);
|
|
147910
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
147911
|
-
}
|
|
147912
|
-
catch (error) {
|
|
147913
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
147914
|
-
return false;
|
|
147915
|
-
}
|
|
147916
|
-
else {
|
|
147917
|
-
throw error;
|
|
147918
|
-
}
|
|
147919
|
-
}
|
|
147920
|
-
return true;
|
|
147921
|
-
}
|
|
147922
|
-
async function tryAddPropertiesTexts(env, path, newI18nEntries) {
|
|
147923
|
-
const i18nFilePath = utils_1.propertiesPathFormatter(path, env);
|
|
147924
|
-
let newContent = newI18nEntries
|
|
147925
|
-
.map((entry) => ux_i18n_properties_1.printPropertiesFileI18nEntry(entry.key, entry.value, entry.annotation))
|
|
147926
|
-
//No need join with new line, because it is already added in 'printPropertiesFileI18nEntry'
|
|
147927
|
-
.join('');
|
|
147928
|
-
try {
|
|
147929
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
147930
|
-
const lines = content.split(/\r\n|\n/);
|
|
147931
|
-
// check if file does not end with new line
|
|
147932
|
-
if (lines.length > 0 && lines[lines.length - 1].trim()) {
|
|
147933
|
-
// If there no end line - add new gap line before new content
|
|
147934
|
-
newContent = `\n${newContent}`;
|
|
147935
|
-
}
|
|
147936
|
-
await fs_1.promises.writeFile(i18nFilePath, content.concat(newContent), { encoding: 'utf8' });
|
|
147937
|
-
}
|
|
147938
|
-
catch (error) {
|
|
147939
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
147940
|
-
const completed = await tryAddCsvTexts(env, path, newI18nEntries);
|
|
147941
|
-
if (!completed) {
|
|
147942
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
147943
|
-
return true;
|
|
147944
|
-
}
|
|
147945
|
-
return true;
|
|
147946
|
-
}
|
|
147947
|
-
else {
|
|
147948
|
-
throw error;
|
|
147949
|
-
}
|
|
147950
|
-
}
|
|
147951
|
-
return true;
|
|
147952
|
-
}
|
|
147953
|
-
async function tryAddCsvTexts(env, path, newI18nEntries) {
|
|
147954
|
-
const { defaultLanguage } = utils_1.getI18nConfiguration(env);
|
|
147955
|
-
try {
|
|
147956
|
-
const i18nFilePath = utils_1.csvPathFormatter(path);
|
|
147957
|
-
const content = await fs_1.promises.readFile(i18nFilePath, { encoding: 'utf8' });
|
|
147958
|
-
const newContent = csv_1.addCsvTexts(content, defaultLanguage, newI18nEntries);
|
|
147959
|
-
await fs_1.promises.writeFile(i18nFilePath, newContent, { encoding: 'utf8' });
|
|
147960
|
-
}
|
|
147961
|
-
catch (error) {
|
|
147962
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
147963
|
-
return false;
|
|
147964
|
-
}
|
|
147965
|
-
else {
|
|
147966
|
-
throw error;
|
|
147967
|
-
}
|
|
147968
|
-
}
|
|
147969
|
-
return true;
|
|
147970
|
-
}
|
|
147971
|
-
|
|
147972
|
-
|
|
147973
|
-
/***/ }),
|
|
147974
|
-
|
|
147975
|
-
/***/ 98944:
|
|
147976
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
147977
|
-
|
|
147978
|
-
"use strict";
|
|
147979
|
-
|
|
147980
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
147981
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
147982
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
147983
|
-
const csvParser_1 = __webpack_require__(34521);
|
|
147984
|
-
const utils_1 = __webpack_require__(8655);
|
|
147985
|
-
function loadCsvTexts(text, filePath = '') {
|
|
147986
|
-
const bundle = {};
|
|
147987
|
-
const document = csvParser_1.parseCsv(text);
|
|
147988
|
-
for (let columnIndex = 1; columnIndex < document.header.fields.length; columnIndex++) {
|
|
147989
|
-
const locale = document.header.fields[columnIndex];
|
|
147990
|
-
const entries = [];
|
|
147991
|
-
bundle[locale.value] = entries;
|
|
147992
|
-
for (let i = 0; i < document.rows.length; i++) {
|
|
147993
|
-
const row = document.rows[i];
|
|
147994
|
-
if (row) {
|
|
147995
|
-
const key = toTextNode(row.fields[0]);
|
|
147996
|
-
const value = toTextNode(row.fields[columnIndex]);
|
|
147997
|
-
if (key && value) {
|
|
147998
|
-
entries.push({
|
|
147999
|
-
filePath,
|
|
148000
|
-
key,
|
|
148001
|
-
value
|
|
148002
|
-
});
|
|
148003
|
-
}
|
|
148004
|
-
}
|
|
148005
|
-
}
|
|
148006
|
-
}
|
|
148007
|
-
return bundle;
|
|
148008
|
-
}
|
|
148009
|
-
exports.loadCsvTexts = loadCsvTexts;
|
|
148010
|
-
function addCsvTexts(text, fallbackLocale, newEntries) {
|
|
148011
|
-
const csvDocument = csvParser_1.parseCsv(text);
|
|
148012
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
148013
|
-
const headerFields = csvDocument.header.fields;
|
|
148014
|
-
const fallbackFieldIndex = headerFields.findIndex((field) => field.value === fallbackLocale);
|
|
148015
|
-
if (fallbackFieldIndex !== -1) {
|
|
148016
|
-
let newText = '';
|
|
148017
|
-
for (const entry of newEntries) {
|
|
148018
|
-
newText += `${entry.key};`;
|
|
148019
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
148020
|
-
const columnHeader = headerFields[column];
|
|
148021
|
-
if (columnHeader.value === fallbackLocale) {
|
|
148022
|
-
newText += `${entry.value}`;
|
|
148023
|
-
}
|
|
148024
|
-
if (column + 1 !== headerFields.length) {
|
|
148025
|
-
newText += ';';
|
|
148026
|
-
}
|
|
148027
|
-
}
|
|
148028
|
-
newText += eol;
|
|
148029
|
-
}
|
|
148030
|
-
if (text.endsWith(eol)) {
|
|
148031
|
-
return text + newText;
|
|
148032
|
-
}
|
|
148033
|
-
else {
|
|
148034
|
-
return text + eol + newText;
|
|
148035
|
-
}
|
|
148036
|
-
}
|
|
148037
|
-
else if (headerFields.length === 0) {
|
|
148038
|
-
let newText = `key;${fallbackLocale}${eol}`;
|
|
148039
|
-
for (const entry of newEntries) {
|
|
148040
|
-
newText += `${entry.key};${entry.value}${eol}`;
|
|
148041
|
-
}
|
|
148042
|
-
return text + newText;
|
|
148043
|
-
}
|
|
148044
|
-
else {
|
|
148045
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
148046
|
-
const edits = [];
|
|
148047
|
-
edits.push({
|
|
148048
|
-
newText: `;${fallbackLocale}`,
|
|
148049
|
-
range: ux_i18n_properties_1.Range.create(0, csvDocument.header.range.end.character, 0, csvDocument.header.range.end.character)
|
|
148050
|
-
});
|
|
148051
|
-
for (const row of csvDocument.rows) {
|
|
148052
|
-
edits.push({
|
|
148053
|
-
newText: `;`,
|
|
148054
|
-
range: ux_i18n_properties_1.Range.create(row.range.end, row.range.end)
|
|
148055
|
-
});
|
|
148056
|
-
}
|
|
148057
|
-
let newText = `${eol}`;
|
|
148058
|
-
for (const entry of newEntries) {
|
|
148059
|
-
newText += `${entry.key};`;
|
|
148060
|
-
for (let column = 1; column < headerFields.length; column++) {
|
|
148061
|
-
newText += ';';
|
|
148062
|
-
}
|
|
148063
|
-
newText += `${entry.value}${eol}`;
|
|
148064
|
-
}
|
|
148065
|
-
const lastRow = csvDocument.rows.slice(-1)[0];
|
|
148066
|
-
const position = lastRow ? lastRow.range.end : ux_i18n_properties_1.Position.create(1, 0);
|
|
148067
|
-
edits.push({
|
|
148068
|
-
newText,
|
|
148069
|
-
range: ux_i18n_properties_1.Range.create(position, position)
|
|
148070
|
-
});
|
|
148071
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, edits);
|
|
148072
|
-
}
|
|
148073
|
-
}
|
|
148074
|
-
exports.addCsvTexts = addCsvTexts;
|
|
148075
|
-
function toTextNode(field) {
|
|
148076
|
-
if (field) {
|
|
148077
|
-
return {
|
|
148078
|
-
value: field.value,
|
|
148079
|
-
range: field.range
|
|
148080
|
-
};
|
|
148081
|
-
}
|
|
148082
|
-
}
|
|
148083
|
-
function createTextNode(value, range) {
|
|
148084
|
-
return {
|
|
148085
|
-
value,
|
|
148086
|
-
range
|
|
148087
|
-
};
|
|
148088
|
-
}
|
|
148089
|
-
exports.createTextNode = createTextNode;
|
|
148090
|
-
|
|
148091
|
-
|
|
148092
|
-
/***/ }),
|
|
148093
|
-
|
|
148094
|
-
/***/ 34521:
|
|
148095
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148096
|
-
|
|
148097
|
-
"use strict";
|
|
148098
|
-
|
|
148099
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148100
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
148101
|
-
const SEPARATOR = /[,;\t]/;
|
|
148102
|
-
function parseCsv(text) {
|
|
148103
|
-
const tokens = tokenize(text);
|
|
148104
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
148105
|
-
const contentLength = text.length;
|
|
148106
|
-
let i = 0;
|
|
148107
|
-
const peek = (count) => (count ? tokens[i + count] : tokens[i]);
|
|
148108
|
-
const consume = () => tokens[i++];
|
|
148109
|
-
const eof = () => i >= tokens.length;
|
|
148110
|
-
function parseField() {
|
|
148111
|
-
const token = consume();
|
|
148112
|
-
return {
|
|
148113
|
-
quoted: token.type === 'escaped-text' ? true : false,
|
|
148114
|
-
value: token.value,
|
|
148115
|
-
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))
|
|
148116
|
-
};
|
|
148117
|
-
}
|
|
148118
|
-
function parseRow() {
|
|
148119
|
-
var _a;
|
|
148120
|
-
const row = {
|
|
148121
|
-
fields: [],
|
|
148122
|
-
range: ux_i18n_properties_1.Range.create(0, 0, 0, 0)
|
|
148123
|
-
};
|
|
148124
|
-
while (!eof() && ((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) !== 'eol') {
|
|
148125
|
-
if (peek().type === 'escaped-text' || peek().type === 'text') {
|
|
148126
|
-
row.fields.push(parseField());
|
|
148127
|
-
}
|
|
148128
|
-
const next = peek();
|
|
148129
|
-
if (next && next.type !== 'eol') {
|
|
148130
|
-
if (next.type === 'separator' && peek(1) === undefined) {
|
|
148131
|
-
// trailing separator at the end of file
|
|
148132
|
-
row.fields.push({
|
|
148133
|
-
quoted: false,
|
|
148134
|
-
value: '',
|
|
148135
|
-
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))
|
|
148136
|
-
});
|
|
148137
|
-
}
|
|
148138
|
-
consume();
|
|
148139
|
-
}
|
|
148140
|
-
}
|
|
148141
|
-
if (row.fields.length) {
|
|
148142
|
-
const start = row.fields[0].range.start;
|
|
148143
|
-
const end = row.fields[row.fields.length - 1].range.end;
|
|
148144
|
-
row.range = ux_i18n_properties_1.Range.create(start.line, start.character, end.line, end.character);
|
|
148145
|
-
}
|
|
148146
|
-
return row;
|
|
148147
|
-
}
|
|
148148
|
-
function parseDocument() {
|
|
148149
|
-
var _a, _b;
|
|
148150
|
-
const document = {
|
|
148151
|
-
header: parseRow(),
|
|
148152
|
-
rows: []
|
|
148153
|
-
};
|
|
148154
|
-
while (!eof()) {
|
|
148155
|
-
if (((_a = peek()) === null || _a === void 0 ? void 0 : _a.type) === 'escaped-text' || ((_b = peek()) === null || _b === void 0 ? void 0 : _b.type) === 'text') {
|
|
148156
|
-
document.rows.push(parseRow());
|
|
148157
|
-
}
|
|
148158
|
-
consume();
|
|
148159
|
-
}
|
|
148160
|
-
return document;
|
|
148161
|
-
}
|
|
148162
|
-
return parseDocument();
|
|
148163
|
-
}
|
|
148164
|
-
exports.parseCsv = parseCsv;
|
|
148165
|
-
function tokenize(text) {
|
|
148166
|
-
const tokens = [];
|
|
148167
|
-
let i = 0;
|
|
148168
|
-
let value = '';
|
|
148169
|
-
let mode = 'default';
|
|
148170
|
-
let start = 0;
|
|
148171
|
-
let lastTextTokenType = 'text';
|
|
148172
|
-
while (i < text.length) {
|
|
148173
|
-
const character = text[i];
|
|
148174
|
-
if (mode === 'default') {
|
|
148175
|
-
if (SEPARATOR.test(character) || character === '\n') {
|
|
148176
|
-
tokens.push({
|
|
148177
|
-
type: lastTextTokenType,
|
|
148178
|
-
value,
|
|
148179
|
-
start,
|
|
148180
|
-
end: i
|
|
148181
|
-
});
|
|
148182
|
-
if (character === '\n') {
|
|
148183
|
-
tokens.push({
|
|
148184
|
-
type: 'eol',
|
|
148185
|
-
value: '\n',
|
|
148186
|
-
start: i,
|
|
148187
|
-
end: i + 1
|
|
148188
|
-
});
|
|
148189
|
-
}
|
|
148190
|
-
else if (SEPARATOR.test(character)) {
|
|
148191
|
-
tokens.push({
|
|
148192
|
-
type: 'separator',
|
|
148193
|
-
value: character,
|
|
148194
|
-
start: i,
|
|
148195
|
-
end: i + 1
|
|
148196
|
-
});
|
|
148197
|
-
}
|
|
148198
|
-
value = '';
|
|
148199
|
-
start = i + 1;
|
|
148200
|
-
lastTextTokenType = 'text';
|
|
148201
|
-
}
|
|
148202
|
-
else if (character === '"') {
|
|
148203
|
-
mode = 'quoted';
|
|
148204
|
-
}
|
|
148205
|
-
else {
|
|
148206
|
-
value += character;
|
|
148207
|
-
}
|
|
148208
|
-
}
|
|
148209
|
-
else if (mode === 'quoted') {
|
|
148210
|
-
if (character === '"') {
|
|
148211
|
-
// we need to check if it is escaping next double quote
|
|
148212
|
-
if (i + 1 < text.length && text[i + 1] === '"') {
|
|
148213
|
-
value += '"';
|
|
148214
|
-
i++;
|
|
148215
|
-
}
|
|
148216
|
-
else {
|
|
148217
|
-
lastTextTokenType = 'escaped-text';
|
|
148218
|
-
mode = 'default';
|
|
148219
|
-
}
|
|
148220
|
-
}
|
|
148221
|
-
else {
|
|
148222
|
-
value += character;
|
|
148223
|
-
}
|
|
148224
|
-
}
|
|
148225
|
-
i++;
|
|
148226
|
-
}
|
|
148227
|
-
if (value) {
|
|
148228
|
-
tokens.push({
|
|
148229
|
-
type: 'text',
|
|
148230
|
-
value,
|
|
148231
|
-
start,
|
|
148232
|
-
end: i
|
|
148233
|
-
});
|
|
148234
|
-
}
|
|
148235
|
-
return tokens;
|
|
148236
|
-
}
|
|
148237
|
-
exports.tokenize = tokenize;
|
|
148238
|
-
|
|
148239
|
-
|
|
148240
|
-
/***/ }),
|
|
148241
|
-
|
|
148242
|
-
/***/ 98702:
|
|
148243
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148244
|
-
|
|
148245
|
-
"use strict";
|
|
148246
|
-
|
|
148247
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148248
|
-
var csv_1 = __webpack_require__(98944);
|
|
148249
|
-
exports.addCsvTexts = csv_1.addCsvTexts;
|
|
148250
|
-
exports.loadCsvTexts = csv_1.loadCsvTexts;
|
|
148251
|
-
var json_1 = __webpack_require__(34692);
|
|
148252
|
-
exports.addJsonTexts = json_1.addJsonTexts;
|
|
148253
|
-
exports.loadJsonTexts = json_1.loadJsonTexts;
|
|
148254
|
-
var resolve_1 = __webpack_require__(96749);
|
|
148255
|
-
exports.getI18nFolderNames = resolve_1.getI18nFolderNames;
|
|
148256
|
-
exports.getCapI18nBundle = resolve_1.getCapI18nBundle;
|
|
148257
|
-
var add_1 = __webpack_require__(42745);
|
|
148258
|
-
exports.addI18nEntriesForCdsFile = add_1.addI18nEntriesForCdsFile;
|
|
148259
|
-
|
|
148260
|
-
|
|
148261
|
-
/***/ }),
|
|
148262
|
-
|
|
148263
|
-
/***/ 34692:
|
|
148264
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148265
|
-
|
|
148266
|
-
"use strict";
|
|
148267
|
-
|
|
148268
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148269
|
-
const jsonc_parser_1 = __webpack_require__(48617);
|
|
148270
|
-
const vscode_languageserver_textdocument_1 = __webpack_require__(61096);
|
|
148271
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
148272
|
-
const utils_1 = __webpack_require__(8655);
|
|
148273
|
-
function loadJsonTexts(text, filePath = '') {
|
|
148274
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148275
|
-
const bundle = {};
|
|
148276
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
148277
|
-
const lineOffsets = ux_i18n_properties_1.getLineOffsets(text);
|
|
148278
|
-
const contentLength = text.length;
|
|
148279
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
148280
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
148281
|
-
for (const localeNode of localeNodes) {
|
|
148282
|
-
if (localeNode.type === 'property') {
|
|
148283
|
-
const entries = [];
|
|
148284
|
-
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 : '';
|
|
148285
|
-
bundle[locale] = entries;
|
|
148286
|
-
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 : [];
|
|
148287
|
-
for (const textNode of textNodes) {
|
|
148288
|
-
if (textNode.type === 'property') {
|
|
148289
|
-
const key = toTextNode(((_h = textNode.children) !== null && _h !== void 0 ? _h : [])[0], lineOffsets, contentLength);
|
|
148290
|
-
const value = toTextNode(((_j = textNode.children) !== null && _j !== void 0 ? _j : [])[1], lineOffsets, contentLength);
|
|
148291
|
-
entries.push({
|
|
148292
|
-
filePath,
|
|
148293
|
-
key,
|
|
148294
|
-
value
|
|
148295
|
-
});
|
|
148296
|
-
}
|
|
148297
|
-
}
|
|
148298
|
-
}
|
|
148299
|
-
}
|
|
148300
|
-
}
|
|
148301
|
-
return bundle;
|
|
148302
|
-
}
|
|
148303
|
-
exports.loadJsonTexts = loadJsonTexts;
|
|
148304
|
-
function createFullBundle(fallbackLocale, newEntries) {
|
|
148305
|
-
const fallbackBundle = newEntries.reduce((acc, entry) => {
|
|
148306
|
-
acc[entry.key] = entry.value;
|
|
148307
|
-
return acc;
|
|
148308
|
-
}, {});
|
|
148309
|
-
const bundle = {
|
|
148310
|
-
[fallbackLocale]: fallbackBundle
|
|
148311
|
-
};
|
|
148312
|
-
return bundle;
|
|
148313
|
-
}
|
|
148314
|
-
function addJsonTexts(text, fallbackLocale, newEntries) {
|
|
148315
|
-
var _a, _b, _c;
|
|
148316
|
-
if (text === '') {
|
|
148317
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
148318
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
148319
|
-
}
|
|
148320
|
-
const rootNode = jsonc_parser_1.parseTree(text);
|
|
148321
|
-
if ((rootNode === null || rootNode === void 0 ? void 0 : rootNode.type) === 'object') {
|
|
148322
|
-
const localeNodes = (_a = rootNode.children) !== null && _a !== void 0 ? _a : [];
|
|
148323
|
-
const eol = utils_1.discoverLineEnding(text);
|
|
148324
|
-
const indent = utils_1.discoverIndent(text);
|
|
148325
|
-
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; });
|
|
148326
|
-
if (fallbackLocaleNode) {
|
|
148327
|
-
const bundleNode = ((_b = fallbackLocaleNode.children) !== null && _b !== void 0 ? _b : [])[1];
|
|
148328
|
-
const textNodes = (_c = bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.children) !== null && _c !== void 0 ? _c : [];
|
|
148329
|
-
if (textNodes.length) {
|
|
148330
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
148331
|
-
const position = document.positionAt(textNodes[0].offset);
|
|
148332
|
-
let newText = '';
|
|
148333
|
-
for (let i = 0; i < newEntries.length; i++) {
|
|
148334
|
-
const entry = newEntries[i];
|
|
148335
|
-
newText += `${indent + indent}"${entry.key}": "${entry.value}",${eol}`;
|
|
148336
|
-
}
|
|
148337
|
-
const edit = {
|
|
148338
|
-
newText: newText,
|
|
148339
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
148340
|
-
};
|
|
148341
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
148342
|
-
}
|
|
148343
|
-
else if (bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.offset) {
|
|
148344
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
148345
|
-
const start = document.positionAt(bundleNode.offset);
|
|
148346
|
-
const end = document.positionAt(bundleNode.offset + bundleNode.length);
|
|
148347
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
148348
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
148349
|
-
const indented = utils_1.applyIndent(`${newText}`, indent, eol, false);
|
|
148350
|
-
const edit = {
|
|
148351
|
-
newText: indented,
|
|
148352
|
-
range: ux_i18n_properties_1.Range.create(start, end)
|
|
148353
|
-
};
|
|
148354
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
148355
|
-
}
|
|
148356
|
-
}
|
|
148357
|
-
else if (localeNodes.length === 0) {
|
|
148358
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
148359
|
-
return JSON.stringify(bundle, undefined, 4);
|
|
148360
|
-
}
|
|
148361
|
-
else {
|
|
148362
|
-
const document = vscode_languageserver_textdocument_1.TextDocument.create('', '', 0, text);
|
|
148363
|
-
const [last] = localeNodes.slice(-1);
|
|
148364
|
-
const position = document.positionAt(last.offset);
|
|
148365
|
-
const bundle = createFullBundle(fallbackLocale, newEntries);
|
|
148366
|
-
const newText = JSON.stringify(bundle[fallbackLocale], undefined, indent);
|
|
148367
|
-
const indented = utils_1.applyIndent(`"${fallbackLocale}": ${newText},`, indent, eol);
|
|
148368
|
-
const edit = {
|
|
148369
|
-
newText: indented + eol,
|
|
148370
|
-
range: ux_i18n_properties_1.Range.create(position.line, 0, position.line, 0)
|
|
148371
|
-
};
|
|
148372
|
-
return vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, [edit]);
|
|
148373
|
-
}
|
|
148374
|
-
}
|
|
148375
|
-
return text;
|
|
148376
|
-
}
|
|
148377
|
-
exports.addJsonTexts = addJsonTexts;
|
|
148378
|
-
function createTextNode(value, range) {
|
|
148379
|
-
return {
|
|
148380
|
-
value,
|
|
148381
|
-
range
|
|
148382
|
-
};
|
|
148383
|
-
}
|
|
148384
|
-
exports.createTextNode = createTextNode;
|
|
148385
|
-
function toTextNode(node, lineOffsets, contentLength) {
|
|
148386
|
-
if (node) {
|
|
148387
|
-
switch (typeof node.value) {
|
|
148388
|
-
case 'string': {
|
|
148389
|
-
// for string literals node offset starts with '"' character, but we don't include it in the text node range
|
|
148390
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset + 1, contentLength);
|
|
148391
|
-
const { value } = node;
|
|
148392
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
148393
|
-
}
|
|
148394
|
-
case 'number': {
|
|
148395
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
148396
|
-
const value = node.value.toString();
|
|
148397
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
148398
|
-
}
|
|
148399
|
-
case 'boolean': {
|
|
148400
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
148401
|
-
// CDS currently uses the boolean value if its true, otherwise falls back to using the key
|
|
148402
|
-
const value = node.value ? 'true' : '';
|
|
148403
|
-
return createTextNode(value, ux_i18n_properties_1.Range.create(start, ux_i18n_properties_1.Position.create(start.line, start.character + value.length)));
|
|
148404
|
-
}
|
|
148405
|
-
default: {
|
|
148406
|
-
const start = ux_i18n_properties_1.positionAt(lineOffsets, node.offset, contentLength);
|
|
148407
|
-
return createTextNode('', ux_i18n_properties_1.Range.create(start, start));
|
|
148408
|
-
}
|
|
148409
|
-
}
|
|
148410
|
-
}
|
|
148411
|
-
}
|
|
148412
|
-
|
|
148413
|
-
|
|
148414
|
-
/***/ }),
|
|
148415
|
-
|
|
148416
|
-
/***/ 96749:
|
|
148417
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148418
|
-
|
|
148419
|
-
"use strict";
|
|
148420
|
-
|
|
148421
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148422
|
-
const path_1 = __webpack_require__(71017);
|
|
148423
|
-
const fs_1 = __webpack_require__(57147);
|
|
148424
|
-
const ux_i18n_properties_1 = __webpack_require__(55203);
|
|
148425
|
-
const csv_1 = __webpack_require__(98944);
|
|
148426
|
-
const json_1 = __webpack_require__(34692);
|
|
148427
|
-
const utils_1 = __webpack_require__(8655);
|
|
148428
|
-
/**
|
|
148429
|
-
* Returns a list of allowed i18n folder names, where translation files can be found.
|
|
148430
|
-
*/
|
|
148431
|
-
function getI18nFolderNames(env) {
|
|
148432
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
148433
|
-
return folders;
|
|
148434
|
-
}
|
|
148435
|
-
exports.getI18nFolderNames = getI18nFolderNames;
|
|
148436
|
-
/**
|
|
148437
|
-
* Returns the location of an existing _i18n folder next to or in the
|
|
148438
|
-
* folder hierarchy above the given path, if any.
|
|
148439
|
-
* @param env CDS environment configuration
|
|
148440
|
-
* @param filePath CDS source file path
|
|
148441
|
-
* @param cache If translation file mapping should be cached
|
|
148442
|
-
*/
|
|
148443
|
-
function resolveI18nFolderForFile(env, filePath) {
|
|
148444
|
-
const { folders } = utils_1.getI18nConfiguration(env);
|
|
148445
|
-
function resolve(path) {
|
|
148446
|
-
// check whether a <path>/_i18n exists
|
|
148447
|
-
for (const folderName of folders) {
|
|
148448
|
-
const folderPath = path_1.join(path, folderName);
|
|
148449
|
-
if (fs_1.existsSync(folderPath)) {
|
|
148450
|
-
return folderPath;
|
|
148451
|
-
}
|
|
148452
|
-
}
|
|
148453
|
-
//> no --> search up the folder hierarchy
|
|
148454
|
-
const next = path_1.dirname(path);
|
|
148455
|
-
return next === path ? undefined : resolve(next);
|
|
148456
|
-
}
|
|
148457
|
-
return resolve(filePath);
|
|
148458
|
-
}
|
|
148459
|
-
exports.resolveI18nFolderForFile = resolveI18nFolderForFile;
|
|
148460
|
-
/**
|
|
148461
|
-
* Merges i18n files in to a single bundle for CDS source files
|
|
148462
|
-
* @param env CDS environment configuration
|
|
148463
|
-
* @param filePaths CDS file path
|
|
148464
|
-
* @param logger Fiori tools logger
|
|
148465
|
-
*/
|
|
148466
|
-
async function getCapI18nBundle(env, filePaths, logger) {
|
|
148467
|
-
var _a;
|
|
148468
|
-
const { defaultLanguage, fallbackLanguage, baseFileName } = utils_1.getI18nConfiguration(env);
|
|
148469
|
-
const bundle = {};
|
|
148470
|
-
const i18nFiles = filePaths.reduce((acc, filePath) => {
|
|
148471
|
-
const i18nFolder = resolveI18nFolderForFile(env, filePath);
|
|
148472
|
-
if (i18nFolder) {
|
|
148473
|
-
const file = path_1.join(i18nFolder, baseFileName);
|
|
148474
|
-
if (acc.indexOf(file) === -1) {
|
|
148475
|
-
acc.push(file);
|
|
148476
|
-
}
|
|
148477
|
-
}
|
|
148478
|
-
return acc;
|
|
148479
|
-
}, []);
|
|
148480
|
-
const loaders = [
|
|
148481
|
-
{ loader: json_1.loadJsonTexts, filePathFormatter: utils_1.jsonPathFormatter },
|
|
148482
|
-
{
|
|
148483
|
-
loader: (content, path) => ({
|
|
148484
|
-
[fallbackLanguage]: ux_i18n_properties_1.loadPropertiesTexts(content, path)
|
|
148485
|
-
}),
|
|
148486
|
-
filePathFormatter: utils_1.propertiesPathFormatter
|
|
148487
|
-
},
|
|
148488
|
-
{ loader: csv_1.loadCsvTexts, filePathFormatter: utils_1.csvPathFormatter }
|
|
148489
|
-
];
|
|
148490
|
-
for (const path of i18nFiles) {
|
|
148491
|
-
let loaded = false;
|
|
148492
|
-
let hasError = false;
|
|
148493
|
-
for (const { loader, filePathFormatter } of loaders) {
|
|
148494
|
-
const i18nFilePath = filePathFormatter(path, env);
|
|
148495
|
-
try {
|
|
148496
|
-
const entries = await tryLoadTexts(i18nFilePath, loader);
|
|
148497
|
-
if (entries) {
|
|
148498
|
-
const currentBundle = (_a = entries[fallbackLanguage]) !== null && _a !== void 0 ? _a : entries[defaultLanguage];
|
|
148499
|
-
for (const entry of currentBundle) {
|
|
148500
|
-
if (bundle[entry.key.value]) {
|
|
148501
|
-
bundle[entry.key.value].push(entry);
|
|
148502
|
-
}
|
|
148503
|
-
else {
|
|
148504
|
-
bundle[entry.key.value] = [entry];
|
|
148505
|
-
}
|
|
148506
|
-
}
|
|
148507
|
-
logger.info(`Loaded i18n texts from ${i18nFilePath}`);
|
|
148508
|
-
loaded = true;
|
|
148509
|
-
break;
|
|
148510
|
-
}
|
|
148511
|
-
}
|
|
148512
|
-
catch (error) {
|
|
148513
|
-
hasError = true;
|
|
148514
|
-
logger.error(`Failed to load ${i18nFilePath}. ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
148515
|
-
break;
|
|
148516
|
-
}
|
|
148517
|
-
}
|
|
148518
|
-
if (!loaded && !hasError) {
|
|
148519
|
-
logger.error(`No translation file found in ${path_1.dirname(path)}`);
|
|
148520
|
-
}
|
|
148521
|
-
}
|
|
148522
|
-
return bundle;
|
|
148523
|
-
}
|
|
148524
|
-
exports.getCapI18nBundle = getCapI18nBundle;
|
|
148525
|
-
async function tryLoadTexts(path, loader) {
|
|
148526
|
-
try {
|
|
148527
|
-
const content = await fs_1.promises.readFile(path, { encoding: 'utf8' });
|
|
148528
|
-
return loader(content, path);
|
|
148529
|
-
}
|
|
148530
|
-
catch (error) {
|
|
148531
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === 'ENOENT') {
|
|
148532
|
-
return;
|
|
148533
|
-
}
|
|
148534
|
-
else {
|
|
148535
|
-
throw error;
|
|
148536
|
-
}
|
|
148537
|
-
}
|
|
148538
|
-
}
|
|
148539
|
-
|
|
148540
|
-
|
|
148541
|
-
/***/ }),
|
|
148542
|
-
|
|
148543
|
-
/***/ 8655:
|
|
148544
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
148545
|
-
|
|
148546
|
-
"use strict";
|
|
148547
|
-
|
|
148548
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148549
|
-
const LINE_ENDING_PATTERN = /\r|\n|\r?\n/;
|
|
148550
|
-
const INDENT_PATTERN = /(?:\r|\n|\r?\n)([\t|\s]+)/;
|
|
148551
|
-
function discoverLineEnding(text) {
|
|
148552
|
-
for (let i = 0; i < text.length; i++) {
|
|
148553
|
-
const character = text[i];
|
|
148554
|
-
if (character === '\r') {
|
|
148555
|
-
if (i + 1 < text.length && text[i + 1] === '\n') {
|
|
148556
|
-
return '\r\n';
|
|
148557
|
-
}
|
|
148558
|
-
return '\r';
|
|
148559
|
-
}
|
|
148560
|
-
else if (character === '\n') {
|
|
148561
|
-
return '\n';
|
|
148562
|
-
}
|
|
148563
|
-
}
|
|
148564
|
-
return '\n';
|
|
148565
|
-
}
|
|
148566
|
-
exports.discoverLineEnding = discoverLineEnding;
|
|
148567
|
-
function discoverIndent(text) {
|
|
148568
|
-
const match = INDENT_PATTERN.exec(text);
|
|
148569
|
-
if (match) {
|
|
148570
|
-
return match[1];
|
|
148571
|
-
}
|
|
148572
|
-
return ' ';
|
|
148573
|
-
}
|
|
148574
|
-
exports.discoverIndent = discoverIndent;
|
|
148575
|
-
function applyIndent(text, indent, eol, indentFirstLine = true) {
|
|
148576
|
-
const lines = text.split(LINE_ENDING_PATTERN);
|
|
148577
|
-
let out = '';
|
|
148578
|
-
for (let i = 0; i < lines.length; i++) {
|
|
148579
|
-
const line = lines[i];
|
|
148580
|
-
if (!indentFirstLine && i === 0) {
|
|
148581
|
-
out += line;
|
|
148582
|
-
}
|
|
148583
|
-
else {
|
|
148584
|
-
out += indent + line;
|
|
148585
|
-
}
|
|
148586
|
-
if (i + 1 !== lines.length) {
|
|
148587
|
-
out += eol;
|
|
148588
|
-
}
|
|
148589
|
-
}
|
|
148590
|
-
return out;
|
|
148591
|
-
}
|
|
148592
|
-
exports.applyIndent = applyIndent;
|
|
148593
|
-
function getI18nConfiguration(env) {
|
|
148594
|
-
const { default_language, fallback_bundle, file, folders } = (env && env.i18n) || {};
|
|
148595
|
-
return {
|
|
148596
|
-
defaultLanguage: default_language !== null && default_language !== void 0 ? default_language : 'en',
|
|
148597
|
-
fallbackLanguage: fallback_bundle !== null && fallback_bundle !== void 0 ? fallback_bundle : '',
|
|
148598
|
-
baseFileName: file !== null && file !== void 0 ? file : 'i18n',
|
|
148599
|
-
folders: folders !== null && folders !== void 0 ? folders : ['_i18n', 'i18n']
|
|
148600
|
-
};
|
|
148601
|
-
}
|
|
148602
|
-
exports.getI18nConfiguration = getI18nConfiguration;
|
|
148603
|
-
function jsonPathFormatter(path) {
|
|
148604
|
-
return `${path}.json`;
|
|
148605
|
-
}
|
|
148606
|
-
exports.jsonPathFormatter = jsonPathFormatter;
|
|
148607
|
-
function propertiesPathFormatter(path, env) {
|
|
148608
|
-
const { fallbackLanguage } = getI18nConfiguration(env);
|
|
148609
|
-
return `${path}${fallbackLanguage === '' ? '' : `_${fallbackLanguage}`}.properties`;
|
|
148610
|
-
}
|
|
148611
|
-
exports.propertiesPathFormatter = propertiesPathFormatter;
|
|
148612
|
-
function csvPathFormatter(path) {
|
|
148613
|
-
return `${path}.csv`;
|
|
148614
|
-
}
|
|
148615
|
-
exports.csvPathFormatter = csvPathFormatter;
|
|
148616
|
-
|
|
148617
|
-
|
|
148618
|
-
/***/ }),
|
|
148619
|
-
|
|
148620
|
-
/***/ 43290:
|
|
148621
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148622
|
-
|
|
148623
|
-
"use strict";
|
|
148624
|
-
|
|
148625
|
-
function __export(m) {
|
|
148626
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
148627
|
-
}
|
|
148628
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148629
|
-
__export(__webpack_require__(9929));
|
|
148630
|
-
__export(__webpack_require__(98702));
|
|
148631
|
-
|
|
148632
|
-
|
|
148633
145136
|
/***/ }),
|
|
148634
145137
|
|
|
148635
145138
|
/***/ 87616:
|
|
@@ -148639,7 +145142,6 @@ __export(__webpack_require__(98702));
|
|
|
148639
145142
|
|
|
148640
145143
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148641
145144
|
const path_1 = __webpack_require__(71017);
|
|
148642
|
-
const fs_1 = __webpack_require__(57147);
|
|
148643
145145
|
const file_1 = __webpack_require__(13681);
|
|
148644
145146
|
exports.CAP_SERVICES_FOLDER = 'srv';
|
|
148645
145147
|
exports.CAP_APPS_FOLDER = 'app';
|
|
@@ -148701,32 +145203,9 @@ exports.isCapNodeJsProject = isCapNodeJsProject;
|
|
|
148701
145203
|
* @return {Promise<boolean>} - true if the project is a CAP project
|
|
148702
145204
|
*/
|
|
148703
145205
|
async function isCapJavaProject(projectRoot) {
|
|
148704
|
-
|
|
148705
|
-
return hasApplicationYaml;
|
|
145206
|
+
return file_1.fileExists(path_1.join(projectRoot, exports.CAP_SERVICES_FOLDER, 'src', 'main', 'resources', 'application.yaml'));
|
|
148706
145207
|
}
|
|
148707
145208
|
exports.isCapJavaProject = isCapJavaProject;
|
|
148708
|
-
/**
|
|
148709
|
-
* Get CAP CDS project custom paths for project root
|
|
148710
|
-
* @params {capProjectPath}
|
|
148711
|
-
* @returns {CapCustomPaths} Cap Custom Paths
|
|
148712
|
-
*/
|
|
148713
|
-
exports.getCapCustomPaths = function (capProjectPath) {
|
|
148714
|
-
var _a;
|
|
148715
|
-
const result = {};
|
|
148716
|
-
const packagePath = path_1.join(capProjectPath, 'package.json');
|
|
148717
|
-
try {
|
|
148718
|
-
const packageJson = JSON.parse(fs_1.readFileSync(packagePath, 'utf8'));
|
|
148719
|
-
if ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.cds) === null || _a === void 0 ? void 0 : _a.folders) {
|
|
148720
|
-
result.app = packageJson.cds.folders.app;
|
|
148721
|
-
result.db = packageJson.cds.folders.db;
|
|
148722
|
-
result.srv = packageJson.cds.folders.srv;
|
|
148723
|
-
}
|
|
148724
|
-
}
|
|
148725
|
-
catch (e) {
|
|
148726
|
-
// Ignore errors as may have no custom paths or invalid package.json
|
|
148727
|
-
}
|
|
148728
|
-
return result;
|
|
148729
|
-
};
|
|
148730
145209
|
exports.toAbsoluteUri = (project, relativeUri) => path_1.join(project.root, relativeUri);
|
|
148731
145210
|
exports.toReferenceUri = async (project, relativeUriFrom, relativeUriTo) => {
|
|
148732
145211
|
let relativeUri = '';
|
|
@@ -148825,20 +145304,6 @@ async function fileExists(path) {
|
|
|
148825
145304
|
exports.fileExists = fileExists;
|
|
148826
145305
|
|
|
148827
145306
|
|
|
148828
|
-
/***/ }),
|
|
148829
|
-
|
|
148830
|
-
/***/ 9929:
|
|
148831
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
148832
|
-
|
|
148833
|
-
"use strict";
|
|
148834
|
-
|
|
148835
|
-
function __export(m) {
|
|
148836
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
148837
|
-
}
|
|
148838
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
148839
|
-
__export(__webpack_require__(87616));
|
|
148840
|
-
|
|
148841
|
-
|
|
148842
145307
|
/***/ }),
|
|
148843
145308
|
|
|
148844
145309
|
/***/ 15295:
|
|
@@ -157886,7 +154351,7 @@ const i18next_1 = __importDefault(__webpack_require__(83896));
|
|
|
157886
154351
|
const i18n_1 = __webpack_require__(66170);
|
|
157887
154352
|
const yaml_1 = __importDefault(__webpack_require__(6306));
|
|
157888
154353
|
const yargs_parser_1 = __importDefault(__webpack_require__(10925));
|
|
157889
|
-
const
|
|
154354
|
+
const capProject_1 = __webpack_require__(87616);
|
|
157890
154355
|
/**
|
|
157891
154356
|
* Adds the necessary configuration for running the application in FLP Embedded Mode
|
|
157892
154357
|
*
|
|
@@ -157905,7 +154370,7 @@ async function addFlpEmbeddedConfig(args) {
|
|
|
157905
154370
|
}
|
|
157906
154371
|
const projectPath = process.cwd();
|
|
157907
154372
|
const yamlPath = parsedArgs.config ? path_1.join(projectPath, parsedArgs.config) : path_1.join(projectPath, 'ui5.yaml');
|
|
157908
|
-
if (await
|
|
154373
|
+
if (await capProject_1.isCapProject(projectPath)) {
|
|
157909
154374
|
throw new Error(i18next_1.default.t('NO_CAP'));
|
|
157910
154375
|
}
|
|
157911
154376
|
await addStartFlpEmbeddedScript(projectPath, parsedArgs.flp);
|
|
@@ -158214,7 +154679,6 @@ async function cfDeploy(args) {
|
|
|
158214
154679
|
}
|
|
158215
154680
|
else {
|
|
158216
154681
|
await cf_deploy_1.default();
|
|
158217
|
-
return;
|
|
158218
154682
|
}
|
|
158219
154683
|
}
|
|
158220
154684
|
exports.cfDeploy = cfDeploy;
|
|
@@ -158367,7 +154831,7 @@ function getTableOptions(commandName) {
|
|
|
158367
154831
|
if (commandName === 'add') {
|
|
158368
154832
|
paddingLeft = 8;
|
|
158369
154833
|
}
|
|
158370
|
-
|
|
154834
|
+
return {
|
|
158371
154835
|
chars: {
|
|
158372
154836
|
top: '',
|
|
158373
154837
|
'top-mid': '',
|
|
@@ -158389,7 +154853,6 @@ function getTableOptions(commandName) {
|
|
|
158389
154853
|
style: { 'padding-left': paddingLeft, 'padding-right': 0 },
|
|
158390
154854
|
wordWrap: true
|
|
158391
154855
|
};
|
|
158392
|
-
return tableOptions;
|
|
158393
154856
|
}
|
|
158394
154857
|
function printHelp(command) {
|
|
158395
154858
|
const systenLanguage = i18next_1.default.language;
|
|
@@ -158744,12 +155207,7 @@ exports.toOptionsArray = toOptionsArray;
|
|
|
158744
155207
|
* Returns true, if app is v2
|
|
158745
155208
|
*/
|
|
158746
155209
|
async function isV2App(args) {
|
|
158747
|
-
|
|
158748
|
-
return true;
|
|
158749
|
-
}
|
|
158750
|
-
else {
|
|
158751
|
-
return false;
|
|
158752
|
-
}
|
|
155210
|
+
return (await getVersionFromManifest(args)) === ux_ui5_info_1.FioriElementsVersion.v2;
|
|
158753
155211
|
}
|
|
158754
155212
|
exports.isV2App = isV2App;
|
|
158755
155213
|
/**
|
|
@@ -158767,10 +155225,9 @@ exports.getVersionFromManifest = getVersionFromManifest;
|
|
|
158767
155225
|
* @param search string to use for the search
|
|
158768
155226
|
*/
|
|
158769
155227
|
function findArgument(args, search) {
|
|
158770
|
-
|
|
155228
|
+
return args.find((arg) => {
|
|
158771
155229
|
return arg.indexOf(search) !== -1;
|
|
158772
155230
|
});
|
|
158773
|
-
return element;
|
|
158774
155231
|
}
|
|
158775
155232
|
exports.findArgument = findArgument;
|
|
158776
155233
|
/**
|
|
@@ -159226,7 +155683,6 @@ async function _reportDeployTelemetry(exitCode, markName) {
|
|
|
159226
155683
|
scp,
|
|
159227
155684
|
authType
|
|
159228
155685
|
}, { DeployTime: executionTime }, ux_telemetry_1.SampleRate.NoSampling);
|
|
159229
|
-
return;
|
|
159230
155686
|
}
|
|
159231
155687
|
async function _getMtaAppName() {
|
|
159232
155688
|
let mtaId;
|
|
@@ -159261,7 +155717,6 @@ async function _showHelpGuide() {
|
|
|
159261
155717
|
// Hide the error from the end user
|
|
159262
155718
|
}
|
|
159263
155719
|
log.info(`${i18next_1.default.t('DEPLOYMENT_HELP')}`);
|
|
159264
|
-
return;
|
|
159265
155720
|
}
|
|
159266
155721
|
module.exports = async function task() {
|
|
159267
155722
|
await ux_telemetry_1.initTelemetrySettings();
|
|
@@ -159316,7 +155771,6 @@ module.exports = async function task() {
|
|
|
159316
155771
|
throw error;
|
|
159317
155772
|
}
|
|
159318
155773
|
}
|
|
159319
|
-
return;
|
|
159320
155774
|
};
|
|
159321
155775
|
|
|
159322
155776
|
|
|
@@ -159346,12 +155800,7 @@ const path_1 = __importDefault(__webpack_require__(71017));
|
|
|
159346
155800
|
const https_1 = __importDefault(__webpack_require__(95687));
|
|
159347
155801
|
const util_1 = __webpack_require__(31939);
|
|
159348
155802
|
function isConfirmationRequired(config) {
|
|
159349
|
-
|
|
159350
|
-
return false;
|
|
159351
|
-
}
|
|
159352
|
-
else {
|
|
159353
|
-
return true;
|
|
159354
|
-
}
|
|
155803
|
+
return config.yes || (process.argv && process.argv.includes('-y')) ? false : true;
|
|
159355
155804
|
}
|
|
159356
155805
|
async function getUrlArchive(archiveUrl, strictSsl) {
|
|
159357
155806
|
const cwd = process.cwd();
|
|
@@ -159719,8 +156168,7 @@ async function getUI5Theme(root) {
|
|
|
159719
156168
|
const yamlFile = path_1.default.join(root, 'ui5-deploy.yaml');
|
|
159720
156169
|
if (await fileExists(yamlFile)) {
|
|
159721
156170
|
const yamlContent = yaml_1.default.parse(await readLocalFile(yamlFile));
|
|
159722
|
-
|
|
159723
|
-
return ui5Theme;
|
|
156171
|
+
return yamlContent.ui5Theme;
|
|
159724
156172
|
}
|
|
159725
156173
|
}
|
|
159726
156174
|
/**
|
|
@@ -160398,8 +156846,7 @@ function createDistWorkspace() {
|
|
|
160398
156846
|
virBasePath,
|
|
160399
156847
|
fsBasePath: path_1.join(process.cwd(), 'dist')
|
|
160400
156848
|
});
|
|
160401
|
-
|
|
160402
|
-
return workspace;
|
|
156849
|
+
return fs_2.resourceFactory.createWorkspace({ reader: fs, name: 'fiori', virBasePath: 'fiori' });
|
|
160403
156850
|
}
|
|
160404
156851
|
exports.createDistWorkspace = createDistWorkspace;
|
|
160405
156852
|
/**
|
|
@@ -190936,14 +187383,6 @@ module.exports = {"i8":"3.3.3"};
|
|
|
190936
187383
|
|
|
190937
187384
|
/***/ }),
|
|
190938
187385
|
|
|
190939
|
-
/***/ 97992:
|
|
190940
|
-
/***/ ((module) => {
|
|
190941
|
-
|
|
190942
|
-
"use strict";
|
|
190943
|
-
module.exports = JSON.parse('{"Text_Key":"Text Key","Text_Value":"Text Value","Additional_Information":"Additional Information"}');
|
|
190944
|
-
|
|
190945
|
-
/***/ }),
|
|
190946
|
-
|
|
190947
187386
|
/***/ 13086:
|
|
190948
187387
|
/***/ ((module) => {
|
|
190949
187388
|
|
|
@@ -190956,7 +187395,7 @@ module.exports = JSON.parse('{"ERROR_SPECIFICATION_MISSING":"Seems specification
|
|
|
190956
187395
|
/***/ ((module) => {
|
|
190957
187396
|
|
|
190958
187397
|
"use strict";
|
|
190959
|
-
module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.5.
|
|
187398
|
+
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"}]}}');
|
|
190960
187399
|
|
|
190961
187400
|
/***/ }),
|
|
190962
187401
|
|