vue-i18n-extract-plugin 1.0.73 → 1.0.74

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 +13 -2
  2. package/package.json +1 -1
package/lib/visitors.js CHANGED
@@ -347,7 +347,10 @@ function createI18nVisitor(option, i18nMap) {
347
347
  unwrapVueCacheCallIfNeeded(parentPath);
348
348
  }
349
349
  // 是否 vue.createElementVNode(...),且该 StringLiteral 是第三个参数
350
- } else if (isVNodeCall(parentPath, "_createElementVNode")) {
350
+ } else if (
351
+ isVNodeCall(parentPath, "_createElementVNode") ||
352
+ isVNodeCall(parentPath, "_createElementBlock")
353
+ ) {
351
354
  const callExpr = parentPath.node;
352
355
  const args = callExpr.arguments;
353
356
  // 第 3 个参数是 children
@@ -360,7 +363,15 @@ function createI18nVisitor(option, i18nMap) {
360
363
  } else {
361
364
  args[3] = t.numericLiteral(1);
362
365
  }
363
- unwrapVueCacheCallIfNeeded(parentPath);
366
+ // 先尝试 [...(_cache2[4] || (_cache2[4] = [ createTextVNode(...) ]))]
367
+ if (!unwrapVueSlotArrayCache(parentPath)) {
368
+ // 再尝试拆 _cache2[0] || (_cache2[0] = createTextVNode(...))
369
+ unwrapVueCacheCallIfNeeded(parentPath);
370
+ }
371
+ // 顶多再往上找一层
372
+ if (!unwrapVueSlotArrayCache(parentPath.parentPath.parentPath)) {
373
+ unwrapVueCacheCallIfNeeded(parentPath.parentPath.parentPath);
374
+ }
364
375
  }
365
376
  } else {
366
377
  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.73",
3
+ "version": "1.0.74",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "bin": {