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
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
26
26
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
27
|
PERFORMANCE OF THIS SOFTWARE.
|
|
28
28
|
***************************************************************************** */
|
|
29
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
29
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30
30
|
|
|
31
31
|
var __assign = function () {
|
|
32
32
|
__assign = Object.assign || function __assign(t) {
|
|
@@ -78,8 +78,12 @@ function __generator(thisArg, body) {
|
|
|
78
78
|
f,
|
|
79
79
|
y,
|
|
80
80
|
t,
|
|
81
|
-
g
|
|
82
|
-
return g
|
|
81
|
+
g;
|
|
82
|
+
return g = {
|
|
83
|
+
next: verb(0),
|
|
84
|
+
"throw": verb(1),
|
|
85
|
+
"return": verb(2)
|
|
86
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
83
87
|
return this;
|
|
84
88
|
}), g;
|
|
85
89
|
function verb(n) {
|
|
@@ -1045,7 +1049,7 @@ function splitTrailingInlineText(value) {
|
|
|
1045
1049
|
*/
|
|
1046
1050
|
function checkNeedSplit(str) {
|
|
1047
1051
|
// 检查字符串中是否包含需要切割的特殊字符
|
|
1048
|
-
return str.includes('\\') ||
|
|
1052
|
+
return str.includes('\\') || /<\/?[A-Za-z][^>]*>/.test(str);
|
|
1049
1053
|
}
|
|
1050
1054
|
|
|
1051
1055
|
/**
|
|
@@ -1054,49 +1058,29 @@ function checkNeedSplit(str) {
|
|
|
1054
1058
|
* @return {types.CallExpression} - babel的深度扫描的表达式
|
|
1055
1059
|
*/
|
|
1056
1060
|
function convertToTemplateLiteral(strArray, option) {
|
|
1057
|
-
const quasis = [
|
|
1061
|
+
const quasis = [types.templateElement({
|
|
1062
|
+
raw: '',
|
|
1063
|
+
cooked: ''
|
|
1064
|
+
}, false)];
|
|
1058
1065
|
const expressions = [];
|
|
1059
|
-
strArray.forEach(
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
}));
|
|
1071
|
-
} else {
|
|
1072
|
-
quasis.push(types.templateElement({
|
|
1073
|
-
raw: str,
|
|
1074
|
-
cooked: str
|
|
1075
|
-
}, false));
|
|
1076
|
-
}
|
|
1066
|
+
strArray.forEach(str => {
|
|
1067
|
+
if (getOriginRegex().test(str)) {
|
|
1068
|
+
expressions.push(createI18nTranslator({
|
|
1069
|
+
value: str,
|
|
1070
|
+
isExpression: true,
|
|
1071
|
+
insertOption: option
|
|
1072
|
+
}));
|
|
1073
|
+
quasis.push(types.templateElement({
|
|
1074
|
+
raw: '',
|
|
1075
|
+
cooked: ''
|
|
1076
|
+
}, false));
|
|
1077
1077
|
} else {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
isExpression: true,
|
|
1082
|
-
insertOption: option
|
|
1083
|
-
}));
|
|
1084
|
-
} else {
|
|
1085
|
-
quasis.push(types.templateElement({
|
|
1086
|
-
raw: str,
|
|
1087
|
-
cooked: str
|
|
1088
|
-
}, false));
|
|
1089
|
-
}
|
|
1078
|
+
const quasi = quasis[quasis.length - 1];
|
|
1079
|
+
quasi.value.raw += str;
|
|
1080
|
+
quasi.value.cooked = `${quasi.value.cooked || ''}${str}`;
|
|
1090
1081
|
}
|
|
1091
1082
|
});
|
|
1092
|
-
|
|
1093
|
-
quasis.push(types.templateElement({
|
|
1094
|
-
raw: '',
|
|
1095
|
-
cooked: ''
|
|
1096
|
-
}, true));
|
|
1097
|
-
} else if (quasis.length > expressions.length) {
|
|
1098
|
-
quasis[quasis.length - 1].tail = true;
|
|
1099
|
-
}
|
|
1083
|
+
quasis[quasis.length - 1].tail = true;
|
|
1100
1084
|
const templateLiteral = types.templateLiteral(quasis, expressions);
|
|
1101
1085
|
const deepScanCall = types.callExpression(types.identifier('$deepScan'), [templateLiteral]);
|
|
1102
1086
|
// 打印转换结果
|