babel-plugin-knifecycle
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,5 @@ | ||
## [1.0.3](https://github.com/nfroidure/babel-plugin-knifecycle/compare/v1.0.2...v1.0.3) (2019-02-02) | ||
## [1.0.2](https://github.com/nfroidure/babel-plugin-knifecycle/compare/v1.0.1...v1.0.2) (2019-01-26) | ||
@@ -2,0 +6,0 @@ |
@@ -50,33 +50,38 @@ "use strict"; | ||
visitor: { | ||
ImportDeclaration(path) { | ||
const sourceNode = path.get('source'); | ||
Program(programPath) { | ||
programPath.traverse({ | ||
ImportDeclaration(path) { | ||
const sourceNode = path.get('source'); | ||
if (!sourceNode.isStringLiteral()) { | ||
return; | ||
} | ||
if (!sourceNode.isStringLiteral()) { | ||
return; | ||
} | ||
if (!sourceNode.node.value === 'knifecycle') { | ||
return; | ||
} | ||
path.traverse({ | ||
ImportSpecifier(path) { | ||
const localNode = path.get('local'); | ||
const importedNode = path.get('imported'); | ||
if (!(localNode.isIdentifier() && importedNode.isIdentifier())) { | ||
if (!sourceNode.node.value === 'knifecycle') { | ||
return; | ||
} | ||
const autoFunctionName = importedNode.node.name; | ||
path.traverse({ | ||
ImportSpecifier(path) { | ||
const localNode = path.get('local'); | ||
const importedNode = path.get('imported'); | ||
if (AUTO_FUNCTIONS_TRANFORMS[autoFunctionName]) { | ||
_renameAutoFunction(path, importedNode, localNode, AUTO_FUNCTIONS_TRANFORMS[autoFunctionName].target); | ||
if (!(localNode.isIdentifier() && importedNode.isIdentifier())) { | ||
return; | ||
} | ||
_forEachCallExpression(path, localNode, path => { | ||
const functionDefinitionPath = _findFunctionDefinitionPath(path); | ||
const autoFunctionName = importedNode.node.name; | ||
AUTO_FUNCTIONS_TRANFORMS[autoFunctionName].transform(babel, path, functionDefinitionPath); | ||
}); | ||
} | ||
if (AUTO_FUNCTIONS_TRANFORMS[autoFunctionName]) { | ||
_renameAutoFunction(path, importedNode, localNode, AUTO_FUNCTIONS_TRANFORMS[autoFunctionName].target); | ||
_forEachCallExpression(path, localNode, path => { | ||
const functionDefinitionPath = _findFunctionDefinitionPath(path); | ||
AUTO_FUNCTIONS_TRANFORMS[autoFunctionName].transform(babel, path, functionDefinitionPath); | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -83,0 +88,0 @@ |
{ | ||
"name": "babel-plugin-knifecycle", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A Babel plugin to transform Knifecycle auto* functions to their raw equivalent.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
20525
353