vue-i18n-extract-plugin 1.0.74 → 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.
Files changed (2) hide show
  1. package/lib/visitors.js +12 -18
  2. 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)) return;
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;
@@ -368,10 +366,6 @@ function createI18nVisitor(option, i18nMap) {
368
366
  // 再尝试拆 _cache2[0] || (_cache2[0] = createTextVNode(...))
369
367
  unwrapVueCacheCallIfNeeded(parentPath);
370
368
  }
371
- // 顶多再往上找一层
372
- if (!unwrapVueSlotArrayCache(parentPath.parentPath.parentPath)) {
373
- unwrapVueCacheCallIfNeeded(parentPath.parentPath.parentPath);
374
- }
375
369
  }
376
370
  } else {
377
371
  const hasCreateVNode = transformDirectiveIfNeeded(path, parentPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-i18n-extract-plugin",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "bin": {