vue-i18n-extract-plugin 1.0.61 → 1.0.63

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.
@@ -7,7 +7,7 @@ module.exports = function () {
7
7
  visitor: {
8
8
  Program(path, state) {
9
9
  const {
10
- translateKey: importName,
10
+ translateKey: _importName,
11
11
  i18nPkgImportPath: importPath,
12
12
  enabled
13
13
  } = {
@@ -17,6 +17,12 @@ module.exports = function () {
17
17
 
18
18
  if (!enabled) return;
19
19
 
20
+ let importName = _importName;
21
+
22
+ if (importName.includes(".")) {
23
+ importName = importName.split(".")[0];
24
+ }
25
+
20
26
  const localName = importName;
21
27
  let hasI18nImport = false;
22
28
  let lastImportPath = null;
@@ -9,6 +9,10 @@ function i18nImportAstTransform(ast, importName, importPath) {
9
9
  let needTransform = false;
10
10
  let conflictTDefined = false;
11
11
 
12
+ if (importName.includes(".")) {
13
+ importName = importName.split(".")[0];
14
+ }
15
+
12
16
  traverse(ast, {
13
17
  ImportDeclaration(path) {
14
18
  lastImportNode = path.node;
package/lib/visitors.js CHANGED
@@ -11,7 +11,9 @@ function isTFunction(node, option) {
11
11
  t.isCallExpression(node) &&
12
12
  (t.isIdentifier(node.callee, { name: option.translateKey }) || // $t(...)
13
13
  (t.isMemberExpression(node.callee) &&
14
- t.isIdentifier(node.callee.property, { name: option.translateKey }))) // xxx.$t(...)
14
+ t.isIdentifier(node.callee.property, {
15
+ name: option.translateKey.split(".").pop()
16
+ }))) // xxx.$t(...)
15
17
  );
16
18
  }
17
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-i18n-extract-plugin",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
6
  "bin": {
package/types/index.d.ts CHANGED
@@ -44,4 +44,4 @@ declare const defaultOptions: I18nOptions;
44
44
 
45
45
  export { defaultOptions }
46
46
 
47
- export function defineConfig<T = Partial<I18nOptions>>(options: T | (() => T)): T;
47
+ export function defineConfig<T extends Partial<I18nOptions>>(options: T | (() => T)): T;