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
|
@@ -48,7 +48,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
48
48
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
49
49
|
PERFORMANCE OF THIS SOFTWARE.
|
|
50
50
|
***************************************************************************** */
|
|
51
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
51
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
52
52
|
|
|
53
53
|
var __assign = function () {
|
|
54
54
|
__assign = Object.assign || function __assign(t) {
|
|
@@ -100,8 +100,12 @@ function __generator(thisArg, body) {
|
|
|
100
100
|
f,
|
|
101
101
|
y,
|
|
102
102
|
t,
|
|
103
|
-
g
|
|
104
|
-
return g
|
|
103
|
+
g;
|
|
104
|
+
return g = {
|
|
105
|
+
next: verb(0),
|
|
106
|
+
"throw": verb(1),
|
|
107
|
+
"return": verb(2)
|
|
108
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
105
109
|
return this;
|
|
106
110
|
}), g;
|
|
107
111
|
function verb(n) {
|
|
@@ -570,7 +574,7 @@ function splitTrailingInlineText(value) {
|
|
|
570
574
|
*/
|
|
571
575
|
function checkNeedSplit(str) {
|
|
572
576
|
// 检查字符串中是否包含需要切割的特殊字符
|
|
573
|
-
return str.includes('\\') ||
|
|
577
|
+
return str.includes('\\') || /<\/?[A-Za-z][^>]*>/.test(str);
|
|
574
578
|
}
|
|
575
579
|
|
|
576
580
|
/**
|
|
@@ -579,49 +583,29 @@ function checkNeedSplit(str) {
|
|
|
579
583
|
* @return {types.CallExpression} - babel的深度扫描的表达式
|
|
580
584
|
*/
|
|
581
585
|
function convertToTemplateLiteral(strArray, option) {
|
|
582
|
-
const quasis = [
|
|
586
|
+
const quasis = [types__namespace.templateElement({
|
|
587
|
+
raw: '',
|
|
588
|
+
cooked: ''
|
|
589
|
+
}, false)];
|
|
583
590
|
const expressions = [];
|
|
584
|
-
strArray.forEach(
|
|
585
|
-
if (
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}));
|
|
596
|
-
} else {
|
|
597
|
-
quasis.push(types__namespace.templateElement({
|
|
598
|
-
raw: str,
|
|
599
|
-
cooked: str
|
|
600
|
-
}, false));
|
|
601
|
-
}
|
|
591
|
+
strArray.forEach(str => {
|
|
592
|
+
if (getOriginRegex().test(str)) {
|
|
593
|
+
expressions.push(createI18nTranslator({
|
|
594
|
+
value: str,
|
|
595
|
+
isExpression: true,
|
|
596
|
+
insertOption: option
|
|
597
|
+
}));
|
|
598
|
+
quasis.push(types__namespace.templateElement({
|
|
599
|
+
raw: '',
|
|
600
|
+
cooked: ''
|
|
601
|
+
}, false));
|
|
602
602
|
} else {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
isExpression: true,
|
|
607
|
-
insertOption: option
|
|
608
|
-
}));
|
|
609
|
-
} else {
|
|
610
|
-
quasis.push(types__namespace.templateElement({
|
|
611
|
-
raw: str,
|
|
612
|
-
cooked: str
|
|
613
|
-
}, false));
|
|
614
|
-
}
|
|
603
|
+
const quasi = quasis[quasis.length - 1];
|
|
604
|
+
quasi.value.raw += str;
|
|
605
|
+
quasi.value.cooked = `${quasi.value.cooked || ''}${str}`;
|
|
615
606
|
}
|
|
616
607
|
});
|
|
617
|
-
|
|
618
|
-
quasis.push(types__namespace.templateElement({
|
|
619
|
-
raw: '',
|
|
620
|
-
cooked: ''
|
|
621
|
-
}, true));
|
|
622
|
-
} else if (quasis.length > expressions.length) {
|
|
623
|
-
quasis[quasis.length - 1].tail = true;
|
|
624
|
-
}
|
|
608
|
+
quasis[quasis.length - 1].tail = true;
|
|
625
609
|
const templateLiteral = types__namespace.templateLiteral(quasis, expressions);
|
|
626
610
|
const deepScanCall = types__namespace.callExpression(types__namespace.identifier('$deepScan'), [templateLiteral]);
|
|
627
611
|
// 打印转换结果
|