Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-auto-import

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-auto-import - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

lib/index.js

@@ -11,2 +11,4 @@ "use strict";

var not = require("not-value");
var ImportType = {

@@ -25,3 +27,3 @@ DEFAULT: 1,

file = _ref2.file;
if (!isCorrectIdentifier(path)) return;
if (not(isCorrectIdentifier(path))) return;
var identifier = path.node,

@@ -31,3 +33,3 @@ scope = path.scope;

var declarations = options.declarations;
if (!Array.isArray(declarations)) return;
if (not(Array.isArray(declarations))) return;
var filename = basename(file.opts.filename);

@@ -45,3 +47,3 @@ declarations.some(handleDeclaration, {

var parentPath = path.parentPath;
if (parentPath.isArrayExpression()) return true;else if (parentPath.isArrowFunctionExpression()) return true;else if (parentPath.isAssignmentExpression() && parentPath.get("right") == path) return true;else if (parentPath.isAwaitExpression()) return true;else if (parentPath.isBinaryExpression()) return true;else if (parentPath.bindExpression && parentPath.bindExpression()) return true;else if (parentPath.isCallExpression()) return true;else if (parentPath.isClassDeclaration() && parentPath.get("superClass") == path) return true;else if (parentPath.isClassExpression() && parentPath.get("superClass") == path) return true;else if (parentPath.isConditionalExpression()) return true;else if (parentPath.isDecorator()) return true;else if (parentPath.isDoWhileStatement()) return true;else if (parentPath.isExpressionStatement()) return true;else if (parentPath.isExportDefaultDeclaration()) return true;else if (parentPath.isForInStatement()) return true;else if (parentPath.isForStatement()) return true;else if (parentPath.isIfStatement()) return true;else if (parentPath.isLogicalExpression()) return true;else if (parentPath.isMemberExpression() && parentPath.get("object") == path) return true;else if (parentPath.isNewExpression()) return true;else if (parentPath.isObjectProperty() && parentPath.get("value") == path) return !parentPath.node.shorthand;else if (parentPath.isReturnStatement()) return true;else if (parentPath.isSpreadElement()) return true;else if (parentPath.isSwitchStatement()) return true;else if (parentPath.isTaggedTemplateExpression()) return true;else if (parentPath.isThrowStatement()) return true;else if (parentPath.isUnaryExpression()) return true;else if (parentPath.isVariableDeclarator() && parentPath.get("init") == path) return true;else return false;
if (parentPath.isArrayExpression()) return true;else if (parentPath.isArrowFunctionExpression()) return true;else if (parentPath.isAssignmentExpression() && parentPath.get("right") == path) return true;else if (parentPath.isAwaitExpression()) return true;else if (parentPath.isBinaryExpression()) return true;else if (parentPath.bindExpression && parentPath.bindExpression()) return true;else if (parentPath.isCallExpression()) return true;else if (parentPath.isClassDeclaration() && parentPath.get("superClass") == path) return true;else if (parentPath.isClassExpression() && parentPath.get("superClass") == path) return true;else if (parentPath.isConditionalExpression()) return true;else if (parentPath.isDecorator()) return true;else if (parentPath.isDoWhileStatement()) return true;else if (parentPath.isExpressionStatement()) return true;else if (parentPath.isExportDefaultDeclaration()) return true;else if (parentPath.isForInStatement()) return true;else if (parentPath.isForStatement()) return true;else if (parentPath.isIfStatement()) return true;else if (parentPath.isLogicalExpression()) return true;else if (parentPath.isMemberExpression() && parentPath.get("object") == path) return true;else if (parentPath.isNewExpression()) return true;else if (parentPath.isObjectProperty() && parentPath.get("value") == path) return not(parentPath.node.shorthand);else if (parentPath.isReturnStatement()) return true;else if (parentPath.isSpreadElement()) return true;else if (parentPath.isSwitchStatement()) return true;else if (parentPath.isTaggedTemplateExpression()) return true;else if (parentPath.isThrowStatement()) return true;else if (parentPath.isUnaryExpression()) return true;else if (parentPath.isVariableDeclarator() && parentPath.get("init") == path) return true;else return false;
}

@@ -66,3 +68,3 @@

filename = this.filename;
if (!declaration) return;
if (not(declaration)) return;
var importType = null;

@@ -163,3 +165,3 @@

if (type == ImportType.DEFAULT) {
if (!specifiers.some(hasImportDefaultSpecifier)) {
if (not(specifiers.some(hasImportDefaultSpecifier))) {
var specifier = t.importDefaultSpecifier(identifier);

@@ -172,3 +174,3 @@ importDeclarationPath.unshiftContainer("specifiers", specifier);

if (type == ImportType.MEMBER) {
if (!specifiers.some(hasSpecifierWithName, identifier)) {
if (not(specifiers.some(hasSpecifierWithName, identifier))) {
var _specifier = t.importSpecifier(identifier, identifier);

@@ -187,3 +189,3 @@

function hasSpecifierWithName(node) {
if (!t.isImportSpecifier(node)) return false;
if (not(t.isImportSpecifier(node))) return false;
var name = this.name;

@@ -190,0 +192,0 @@ return node.imported.name == name;

{
"name": "babel-plugin-auto-import",
"version": "1.0.0",
"version": "1.0.1",
"description": "Auto imports",

@@ -31,8 +31,9 @@ "main": "lib/index.js",

"chai": "^3.5.0",
"mocha": "^3.3.0",
"mocha": "^5.2.0",
"rimraf": "^2.6.1"
},
"dependencies": {
"@babel/core": "^7.2.2"
"@babel/core": "^7.2.2",
"not-value": "^1.0.0"
}
}
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