Socket
Socket
Sign inDemoInstall

babel-plugin-knifecycle

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-knifecycle - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

CHANGELOG.md

@@ -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 @@

51

dist/index.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc