webpack-gc-i18n-plugin 1.1.12 → 1.1.13
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/customLoader/index.cjs +27 -43
- package/dist/customLoader/index.cjs.map +1 -1
- package/dist/customLoader/index.mjs +27 -43
- package/dist/customLoader/index.mjs.map +1 -1
- package/dist/index.cjs +27 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +27 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
27
|
***************************************************************************** */
|
|
28
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
28
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
29
29
|
|
|
30
30
|
var __assign = function () {
|
|
31
31
|
__assign = Object.assign || function __assign(t) {
|
|
@@ -77,8 +77,12 @@ function __generator(thisArg, body) {
|
|
|
77
77
|
f,
|
|
78
78
|
y,
|
|
79
79
|
t,
|
|
80
|
-
g
|
|
81
|
-
return g
|
|
80
|
+
g;
|
|
81
|
+
return g = {
|
|
82
|
+
next: verb(0),
|
|
83
|
+
"throw": verb(1),
|
|
84
|
+
"return": verb(2)
|
|
85
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
82
86
|
return this;
|
|
83
87
|
}), g;
|
|
84
88
|
function verb(n) {
|
|
@@ -547,7 +551,7 @@ function splitTrailingInlineText(value) {
|
|
|
547
551
|
*/
|
|
548
552
|
function checkNeedSplit(str) {
|
|
549
553
|
// 检查字符串中是否包含需要切割的特殊字符
|
|
550
|
-
return str.includes('\\') ||
|
|
554
|
+
return str.includes('\\') || /<\/?[A-Za-z][^>]*>/.test(str);
|
|
551
555
|
}
|
|
552
556
|
|
|
553
557
|
/**
|
|
@@ -556,49 +560,29 @@ function checkNeedSplit(str) {
|
|
|
556
560
|
* @return {types.CallExpression} - babel的深度扫描的表达式
|
|
557
561
|
*/
|
|
558
562
|
function convertToTemplateLiteral(strArray, option) {
|
|
559
|
-
const quasis = [
|
|
563
|
+
const quasis = [types.templateElement({
|
|
564
|
+
raw: '',
|
|
565
|
+
cooked: ''
|
|
566
|
+
}, false)];
|
|
560
567
|
const expressions = [];
|
|
561
|
-
strArray.forEach(
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}));
|
|
573
|
-
} else {
|
|
574
|
-
quasis.push(types.templateElement({
|
|
575
|
-
raw: str,
|
|
576
|
-
cooked: str
|
|
577
|
-
}, false));
|
|
578
|
-
}
|
|
568
|
+
strArray.forEach(str => {
|
|
569
|
+
if (getOriginRegex().test(str)) {
|
|
570
|
+
expressions.push(createI18nTranslator({
|
|
571
|
+
value: str,
|
|
572
|
+
isExpression: true,
|
|
573
|
+
insertOption: option
|
|
574
|
+
}));
|
|
575
|
+
quasis.push(types.templateElement({
|
|
576
|
+
raw: '',
|
|
577
|
+
cooked: ''
|
|
578
|
+
}, false));
|
|
579
579
|
} else {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
isExpression: true,
|
|
584
|
-
insertOption: option
|
|
585
|
-
}));
|
|
586
|
-
} else {
|
|
587
|
-
quasis.push(types.templateElement({
|
|
588
|
-
raw: str,
|
|
589
|
-
cooked: str
|
|
590
|
-
}, false));
|
|
591
|
-
}
|
|
580
|
+
const quasi = quasis[quasis.length - 1];
|
|
581
|
+
quasi.value.raw += str;
|
|
582
|
+
quasi.value.cooked = `${quasi.value.cooked || ''}${str}`;
|
|
592
583
|
}
|
|
593
584
|
});
|
|
594
|
-
|
|
595
|
-
quasis.push(types.templateElement({
|
|
596
|
-
raw: '',
|
|
597
|
-
cooked: ''
|
|
598
|
-
}, true));
|
|
599
|
-
} else if (quasis.length > expressions.length) {
|
|
600
|
-
quasis[quasis.length - 1].tail = true;
|
|
601
|
-
}
|
|
585
|
+
quasis[quasis.length - 1].tail = true;
|
|
602
586
|
const templateLiteral = types.templateLiteral(quasis, expressions);
|
|
603
587
|
const deepScanCall = types.callExpression(types.identifier('$deepScan'), [templateLiteral]);
|
|
604
588
|
// 打印转换结果
|