You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@babel/helper-module-imports

Package Overview
Dependencies
Maintainers
5
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0 to 7.7.0

76

lib/import-builder.js

@@ -8,24 +8,10 @@ "use strict";

function _assert() {
const data = _interopRequireDefault(require("assert"));
var _assert = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
var t = _interopRequireWildcard(require("@babel/types"));
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
t = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -52,3 +38,3 @@

import() {
this._statements.push(t().importDeclaration([], t().stringLiteral(this._importedSource)));
this._statements.push(t.importDeclaration([], t.stringLiteral(this._importedSource)));

@@ -59,3 +45,3 @@ return this;

require() {
this._statements.push(t().expressionStatement(t().callExpression(t().identifier("require"), [t().stringLiteral(this._importedSource)])));
this._statements.push(t.expressionStatement(t.callExpression(t.identifier("require"), [t.stringLiteral(this._importedSource)])));

@@ -68,6 +54,6 @@ return this;

const statement = this._statements[this._statements.length - 1];
(0, _assert().default)(statement.type === "ImportDeclaration");
(0, _assert().default)(statement.specifiers.length === 0);
statement.specifiers = [t().importNamespaceSpecifier(name)];
this._resultName = t().cloneNode(name);
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importNamespaceSpecifier(name)];
this._resultName = t.cloneNode(name);
return this;

@@ -79,6 +65,6 @@ }

const statement = this._statements[this._statements.length - 1];
(0, _assert().default)(statement.type === "ImportDeclaration");
(0, _assert().default)(statement.specifiers.length === 0);
statement.specifiers = [t().importDefaultSpecifier(name)];
this._resultName = t().cloneNode(name);
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importDefaultSpecifier(name)];
this._resultName = t.cloneNode(name);
return this;

@@ -91,6 +77,6 @@ }

const statement = this._statements[this._statements.length - 1];
(0, _assert().default)(statement.type === "ImportDeclaration");
(0, _assert().default)(statement.specifiers.length === 0);
statement.specifiers = [t().importSpecifier(name, t().identifier(importName))];
this._resultName = t().cloneNode(name);
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importSpecifier(name, t.identifier(importName))];
this._resultName = t.cloneNode(name);
return this;

@@ -104,4 +90,4 @@ }

if (statement.type !== "ExpressionStatement") {
(0, _assert().default)(this._resultName);
statement = t().expressionStatement(this._resultName);
(0, _assert.default)(this._resultName);
statement = t.expressionStatement(this._resultName);

@@ -111,4 +97,4 @@ this._statements.push(statement);

this._statements[this._statements.length - 1] = t().variableDeclaration("var", [t().variableDeclarator(name, statement.expression)]);
this._resultName = t().cloneNode(name);
this._statements[this._statements.length - 1] = t.variableDeclaration("var", [t.variableDeclarator(name, statement.expression)]);
this._resultName = t.cloneNode(name);
return this;

@@ -129,8 +115,8 @@ }

if (statement.type === "ExpressionStatement") {
statement.expression = t().callExpression(callee, [statement.expression]);
statement.expression = t.callExpression(callee, [statement.expression]);
} else if (statement.type === "VariableDeclaration") {
(0, _assert().default)(statement.declarations.length === 1);
statement.declarations[0].init = t().callExpression(callee, [statement.declarations[0].init]);
(0, _assert.default)(statement.declarations.length === 1);
statement.declarations[0].init = t.callExpression(callee, [statement.declarations[0].init]);
} else {
_assert().default.fail("Unexpected type.");
_assert.default.fail("Unexpected type.");
}

@@ -145,8 +131,8 @@

if (statement.type === "ExpressionStatement") {
statement.expression = t().memberExpression(statement.expression, t().identifier(name));
statement.expression = t.memberExpression(statement.expression, t.identifier(name));
} else if (statement.type === "VariableDeclaration") {
(0, _assert().default)(statement.declarations.length === 1);
statement.declarations[0].init = t().memberExpression(statement.declarations[0].init, t().identifier(name));
(0, _assert.default)(statement.declarations.length === 1);
statement.declarations[0].init = t.memberExpression(statement.declarations[0].init, t.identifier(name));
} else {
_assert().default.fail("Unexpected type:" + statement.type);
_assert.default.fail("Unexpected type:" + statement.type);
}

@@ -158,3 +144,3 @@

read(name) {
this._resultName = t().memberExpression(this._resultName, t().identifier(name));
this._resultName = t.memberExpression(this._resultName, t.identifier(name));
}

@@ -161,0 +147,0 @@

@@ -8,22 +8,6 @@ "use strict";

function _assert() {
const data = _interopRequireDefault(require("assert"));
var _assert = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
var t = _interopRequireWildcard(require("@babel/types"));
return data;
}
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var _importBuilder = _interopRequireDefault(require("./import-builder"));

@@ -33,4 +17,6 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -60,3 +46,3 @@

addNamed(importName, importedSourceIn, opts) {
(0, _assert().default)(typeof importName === "string");
(0, _assert.default)(typeof importName === "string");
return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName);

@@ -82,3 +68,3 @@ }

} else {
(0, _assert().default)(!opts, "Unexpected secondary arguments.");
(0, _assert.default)(!opts, "Unexpected secondary arguments.");
optsList.push(importedSource);

@@ -264,3 +250,3 @@ }

if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
return t().sequenceExpression([t().numericLiteral(0), resultName]);
return t.sequenceExpression([t.numericLiteral(0), resultName]);
}

@@ -276,6 +262,6 @@

const targetPath = this._programPath.get("body").filter(p => {
const targetPath = this._programPath.get("body").find(p => {
const val = p.node._blockHoist;
return Number.isFinite(val) && val < 4;
})[0];
});

@@ -282,0 +268,0 @@ if (targetPath) {

{
"name": "@babel/helper-module-imports",
"version": "7.0.0",
"version": "7.7.0",
"description": "Babel helper functions for inserting module loads",

@@ -8,10 +8,14 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>",

"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports",
"main": "lib/index.js",
"dependencies": {
"@babel/types": "^7.0.0"
"@babel/types": "^7.7.0"
},
"devDependencies": {
"@babel/core": "^7.0.0"
}
"@babel/core": "^7.7.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc