@opensumi/ide-components 2.20.9 → 2.20.10-rc-1666765713.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +67 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2369,7 +2369,7 @@ exports.setLogger = function setLogger(loggerFunction) {
|
|
|
2369
2369
|
|
|
2370
2370
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2371
2371
|
exports.containsUppercaseCharacter = exports.fuzzyContains = exports.repeat = exports.safeBtoa = exports.stripUTF8BOM = exports.startsWithUTF8BOM = exports.UTF8_BOM_CHARACTER = exports.removeAccents = exports.removeAnsiEscapeCodes = exports.lcut = exports.isFullWidthCharacter = exports.containsFullWidthCharacter = exports.isBasicASCII = exports.containsEmoji = exports.containsRTL = exports.isLowSurrogate = exports.isHighSurrogate = exports.overlap = exports.commonSuffixLength = exports.commonPrefixLength = exports.startsWithIgnoreCase = exports.equalsIgnoreCase = exports.isUpperAsciiLetter = exports.isLowerAsciiLetter = exports.compareIgnoreCase = exports.compare = exports.lastNonWhitespaceIndex = exports.getLeadingWhitespace = exports.firstNonWhitespaceIndex = exports.regExpFlags = exports.regExpContainsBackreference = exports.regExpLeadsToEndlessLoop = exports.createRegExp = exports.endsWith = exports.startsWith = exports.stripWildcards = exports.convertSimple2RegExpPattern = exports.rtrim = exports.multiRightTrim = exports.ltrim = exports.trim = exports.count = exports.escapeRegExpCharacters = exports.escape = exports.mnemonicButtonLabel = exports.format = exports.pad = exports.isFalsyOrWhitespace = exports.stringUtils = exports.empty = void 0;
|
|
2372
|
-
exports.decodeUTF8 = exports.encodeUTF8 = exports.getNextCodePoint = exports.computeCodePoint = exports.getNLines = exports.uppercaseFirstLetter = void 0;
|
|
2372
|
+
exports.template = exports.decodeUTF8 = exports.encodeUTF8 = exports.getNextCodePoint = exports.computeCodePoint = exports.getNLines = exports.uppercaseFirstLetter = void 0;
|
|
2373
2373
|
const platform_1 = __webpack_require__(43);
|
|
2374
2374
|
/**
|
|
2375
2375
|
* The empty string.
|
|
@@ -3223,6 +3223,72 @@ function decodeUTF8(buffer) {
|
|
|
3223
3223
|
return result.join('');
|
|
3224
3224
|
}
|
|
3225
3225
|
exports.decodeUTF8 = decodeUTF8;
|
|
3226
|
+
/**
|
|
3227
|
+
* 插值表达式的标记使用的是 ${}
|
|
3228
|
+
* 该函数会对 options 中的 separator 会有特殊处理,
|
|
3229
|
+
*/
|
|
3230
|
+
function template(tpl, variables, options) {
|
|
3231
|
+
const result = [];
|
|
3232
|
+
let placeHolderStack = [];
|
|
3233
|
+
for (let idx = 0; idx < tpl.length; idx++) {
|
|
3234
|
+
const char = tpl[idx];
|
|
3235
|
+
const nextChar = tpl[idx + 1];
|
|
3236
|
+
// 往后多看一位
|
|
3237
|
+
if (char === '$' && nextChar === '{') {
|
|
3238
|
+
// 往后的可能是占位符了,注入进栈标志位(即 $)
|
|
3239
|
+
// 如果 placeHolder 栈已经有值了,现在不支持嵌套 ${},直接吐出所有值放到 result 中即可
|
|
3240
|
+
if (placeHolderStack.length > 0) {
|
|
3241
|
+
result.push(...placeHolderStack);
|
|
3242
|
+
placeHolderStack = [];
|
|
3243
|
+
}
|
|
3244
|
+
placeHolderStack.push(char);
|
|
3245
|
+
placeHolderStack.push(nextChar);
|
|
3246
|
+
idx++;
|
|
3247
|
+
continue;
|
|
3248
|
+
}
|
|
3249
|
+
// 如果当前 placeHolder 栈有字符,一直将字符入栈,直到匹配到 }
|
|
3250
|
+
if (placeHolderStack.length > 0) {
|
|
3251
|
+
if (char === '}') {
|
|
3252
|
+
// 占位符匹配结束
|
|
3253
|
+
// 拿出占位符进行值替换
|
|
3254
|
+
const placeholder = placeHolderStack.slice(2).join('');
|
|
3255
|
+
let v;
|
|
3256
|
+
if (placeholder === 'separator') {
|
|
3257
|
+
if (result[result.length - 1] === options.separator) {
|
|
3258
|
+
// 不需要重复 separator
|
|
3259
|
+
placeHolderStack = [];
|
|
3260
|
+
continue;
|
|
3261
|
+
}
|
|
3262
|
+
// 分隔符有单独的优化
|
|
3263
|
+
v = options.separator;
|
|
3264
|
+
}
|
|
3265
|
+
else {
|
|
3266
|
+
v = variables[placeholder];
|
|
3267
|
+
}
|
|
3268
|
+
const toPush = v !== null && v !== void 0 ? v : options.defaultValue;
|
|
3269
|
+
if (toPush) {
|
|
3270
|
+
result.push(toPush);
|
|
3271
|
+
}
|
|
3272
|
+
placeHolderStack = [];
|
|
3273
|
+
}
|
|
3274
|
+
else {
|
|
3275
|
+
placeHolderStack.push(char);
|
|
3276
|
+
}
|
|
3277
|
+
continue;
|
|
3278
|
+
}
|
|
3279
|
+
result.push(tpl[idx]);
|
|
3280
|
+
}
|
|
3281
|
+
// 去除前面和后面的 sep
|
|
3282
|
+
// 这些 sep 也是不需要的
|
|
3283
|
+
while (result[result.length - 1] === options.separator) {
|
|
3284
|
+
result.pop();
|
|
3285
|
+
}
|
|
3286
|
+
while (result[0] === options.separator) {
|
|
3287
|
+
result.shift();
|
|
3288
|
+
}
|
|
3289
|
+
return result.join('');
|
|
3290
|
+
}
|
|
3291
|
+
exports.template = template;
|
|
3226
3292
|
//# sourceMappingURL=strings.js.map
|
|
3227
3293
|
|
|
3228
3294
|
/***/ }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-components",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.10-rc-1666765713.0",
|
|
4
4
|
"description": "@opensumi/ide-components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@ant-design/icons": "^4.6.4",
|
|
19
|
-
"@opensumi/ide-utils": "2.20.
|
|
19
|
+
"@opensumi/ide-utils": "2.20.10-rc-1666765713.0",
|
|
20
20
|
"@types/react-window": "^1.8.5",
|
|
21
21
|
"fuzzy": "^0.1.3",
|
|
22
22
|
"lodash": "^4.17.15",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@opensumi/ide-dev-tool": "^1.3.1",
|
|
38
38
|
"@types/marked": "^4.0.7"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "358d1764c7436a4064916be264d05b144bbb0544"
|
|
41
41
|
}
|