vue-i18n-extract-plugin 1.0.75 → 1.0.76
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/lib/visitors.js +12 -14
- package/package.json +1 -1
package/lib/visitors.js
CHANGED
|
@@ -229,7 +229,18 @@ function createI18nVisitor(option, i18nMap) {
|
|
|
229
229
|
|
|
230
230
|
return {
|
|
231
231
|
CallExpression(path) {
|
|
232
|
-
if (!isTFunction(path.node, option))
|
|
232
|
+
if (!isTFunction(path.node, option)) {
|
|
233
|
+
if (isVNodeCall(path, "_createTextVNode")) {
|
|
234
|
+
const args = path.node.arguments;
|
|
235
|
+
if (!args.length) return;
|
|
236
|
+
const content = args[0];
|
|
237
|
+
// 是否动态文本
|
|
238
|
+
if (isDynamicTextExpression(content)) {
|
|
239
|
+
args[1] = t.numericLiteral(1); // PatchFlags.TEXT createTextVNode(" " + toDisplayString$1(text)) => createTextVNode(" " + toDisplayString$1(text), 1)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
233
244
|
|
|
234
245
|
const [firstArg] = path.node.arguments;
|
|
235
246
|
let keyText = null;
|
|
@@ -261,19 +272,6 @@ function createI18nVisitor(option, i18nMap) {
|
|
|
261
272
|
path.node.arguments.push(t.stringLiteral(keyText));
|
|
262
273
|
}
|
|
263
274
|
},
|
|
264
|
-
CallExpression(path) {
|
|
265
|
-
if (!isVNodeCall(path, "_createTextVNode")) return;
|
|
266
|
-
|
|
267
|
-
const args = path.node.arguments;
|
|
268
|
-
if (!args.length) return;
|
|
269
|
-
|
|
270
|
-
const content = args[0];
|
|
271
|
-
|
|
272
|
-
// 是否动态文本
|
|
273
|
-
if (isDynamicTextExpression(content)) {
|
|
274
|
-
args[1] = t.numericLiteral(1); // PatchFlags.TEXT createTextVNode(" " + toDisplayString$1(text)) => createTextVNode(" " + toDisplayString$1(text), 1)
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
275
|
StringLiteral(path) {
|
|
278
276
|
if (option.extractFromText === false) return;
|
|
279
277
|
if (!shouldTransform(path)) return;
|