babel-plugin-import
Advanced tools
Comparing version 1.12.1 to 1.12.2
@@ -175,4 +175,8 @@ "use strict"; | ||
path.replaceWith(this.importMethod(node.property.name, file, pluginState)); | ||
} else if (pluginState.specified[node.object.name]) { | ||
node.object = this.importMethod(pluginState.specified[node.object.name], file, pluginState); | ||
} else if (pluginState.specified[node.object.name] && path.scope.hasBinding(node.object.name)) { | ||
const scope = path.scope.getBinding(node.object.name).scope; // global variable in file scope | ||
if (scope.path.parent.type === 'File') { | ||
node.object = this.importMethod(pluginState.specified[node.object.name], file, pluginState); | ||
} | ||
} | ||
@@ -179,0 +183,0 @@ } |
{ | ||
"name": "babel-plugin-import", | ||
"version": "1.12.1", | ||
"version": "1.12.2", | ||
"description": "Component modular import plugin for babel.", | ||
@@ -33,8 +33,8 @@ "repository": { | ||
"babel-preset-umi": "^1.0.0", | ||
"coveralls": "^2.11.6", | ||
"coveralls": "^3.0.6", | ||
"eslint": "^2.7.0", | ||
"eslint-config-airbnb": "^6.2.0", | ||
"material-ui": "^0.15.4", | ||
"material-ui": "^0.20.2", | ||
"np": "^5.0.3", | ||
"pre-commit": "~1.1.2", | ||
"pre-commit": "~1.2.2", | ||
"react-toolbox": "^1.2.5", | ||
@@ -41,0 +41,0 @@ "umi-tools": "^0.1.4" |
@@ -187,4 +187,12 @@ import { join } from 'path'; | ||
path.replaceWith(this.importMethod(node.property.name, file, pluginState)); | ||
} else if (pluginState.specified[node.object.name]) { | ||
node.object = this.importMethod(pluginState.specified[node.object.name], file, pluginState); | ||
} else if (pluginState.specified[node.object.name] && path.scope.hasBinding(node.object.name)) { | ||
const scope = path.scope.getBinding(node.object.name).scope; | ||
// global variable in file scope | ||
if (scope.path.parent.type === 'File') { | ||
node.object = this.importMethod( | ||
pluginState.specified[node.object.name], | ||
file, | ||
pluginState | ||
); | ||
} | ||
} | ||
@@ -191,0 +199,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30579
615