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.cjs
CHANGED
|
@@ -50,7 +50,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
50
50
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
51
51
|
PERFORMANCE OF THIS SOFTWARE.
|
|
52
52
|
***************************************************************************** */
|
|
53
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
53
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
54
54
|
|
|
55
55
|
var __assign = function () {
|
|
56
56
|
__assign = Object.assign || function __assign(t) {
|
|
@@ -102,8 +102,12 @@ function __generator(thisArg, body) {
|
|
|
102
102
|
f,
|
|
103
103
|
y,
|
|
104
104
|
t,
|
|
105
|
-
g
|
|
106
|
-
return g
|
|
105
|
+
g;
|
|
106
|
+
return g = {
|
|
107
|
+
next: verb(0),
|
|
108
|
+
"throw": verb(1),
|
|
109
|
+
"return": verb(2)
|
|
110
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
107
111
|
return this;
|
|
108
112
|
}), g;
|
|
109
113
|
function verb(n) {
|
|
@@ -1069,7 +1073,7 @@ function splitTrailingInlineText(value) {
|
|
|
1069
1073
|
*/
|
|
1070
1074
|
function checkNeedSplit(str) {
|
|
1071
1075
|
// 检查字符串中是否包含需要切割的特殊字符
|
|
1072
|
-
return str.includes('\\') ||
|
|
1076
|
+
return str.includes('\\') || /<\/?[A-Za-z][^>]*>/.test(str);
|
|
1073
1077
|
}
|
|
1074
1078
|
|
|
1075
1079
|
/**
|
|
@@ -1078,49 +1082,29 @@ function checkNeedSplit(str) {
|
|
|
1078
1082
|
* @return {types.CallExpression} - babel的深度扫描的表达式
|
|
1079
1083
|
*/
|
|
1080
1084
|
function convertToTemplateLiteral(strArray, option) {
|
|
1081
|
-
const quasis = [
|
|
1085
|
+
const quasis = [types__namespace.templateElement({
|
|
1086
|
+
raw: '',
|
|
1087
|
+
cooked: ''
|
|
1088
|
+
}, false)];
|
|
1082
1089
|
const expressions = [];
|
|
1083
|
-
strArray.forEach(
|
|
1084
|
-
if (
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
}));
|
|
1095
|
-
} else {
|
|
1096
|
-
quasis.push(types__namespace.templateElement({
|
|
1097
|
-
raw: str,
|
|
1098
|
-
cooked: str
|
|
1099
|
-
}, false));
|
|
1100
|
-
}
|
|
1090
|
+
strArray.forEach(str => {
|
|
1091
|
+
if (getOriginRegex().test(str)) {
|
|
1092
|
+
expressions.push(createI18nTranslator({
|
|
1093
|
+
value: str,
|
|
1094
|
+
isExpression: true,
|
|
1095
|
+
insertOption: option
|
|
1096
|
+
}));
|
|
1097
|
+
quasis.push(types__namespace.templateElement({
|
|
1098
|
+
raw: '',
|
|
1099
|
+
cooked: ''
|
|
1100
|
+
}, false));
|
|
1101
1101
|
} else {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
isExpression: true,
|
|
1106
|
-
insertOption: option
|
|
1107
|
-
}));
|
|
1108
|
-
} else {
|
|
1109
|
-
quasis.push(types__namespace.templateElement({
|
|
1110
|
-
raw: str,
|
|
1111
|
-
cooked: str
|
|
1112
|
-
}, false));
|
|
1113
|
-
}
|
|
1102
|
+
const quasi = quasis[quasis.length - 1];
|
|
1103
|
+
quasi.value.raw += str;
|
|
1104
|
+
quasi.value.cooked = `${quasi.value.cooked || ''}${str}`;
|
|
1114
1105
|
}
|
|
1115
1106
|
});
|
|
1116
|
-
|
|
1117
|
-
quasis.push(types__namespace.templateElement({
|
|
1118
|
-
raw: '',
|
|
1119
|
-
cooked: ''
|
|
1120
|
-
}, true));
|
|
1121
|
-
} else if (quasis.length > expressions.length) {
|
|
1122
|
-
quasis[quasis.length - 1].tail = true;
|
|
1123
|
-
}
|
|
1107
|
+
quasis[quasis.length - 1].tail = true;
|
|
1124
1108
|
const templateLiteral = types__namespace.templateLiteral(quasis, expressions);
|
|
1125
1109
|
const deepScanCall = types__namespace.callExpression(types__namespace.identifier('$deepScan'), [templateLiteral]);
|
|
1126
1110
|
// 打印转换结果
|