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
4
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.21.4-esm.3 to 7.21.4-esm.4

lib/package.json

35

lib/import-builder.js

@@ -1,9 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _assert = require("assert");
var _t = require("@babel/types");
import assert from "assert";
import * as _t from "@babel/types";
const {

@@ -23,3 +17,3 @@ callExpression,

} = _t;
class ImportBuilder {
export default class ImportBuilder {
constructor(importedSource, scope, hub) {

@@ -50,4 +44,4 @@ this._statements = [];

const statement = this._statements[this._statements.length - 1];
_assert(statement.type === "ImportDeclaration");
_assert(statement.specifiers.length === 0);
assert(statement.type === "ImportDeclaration");
assert(statement.specifiers.length === 0);
statement.specifiers = [importNamespaceSpecifier(local)];

@@ -60,4 +54,4 @@ this._resultName = cloneNode(local);

const statement = this._statements[this._statements.length - 1];
_assert(statement.type === "ImportDeclaration");
_assert(statement.specifiers.length === 0);
assert(statement.type === "ImportDeclaration");
assert(statement.specifiers.length === 0);
statement.specifiers = [importDefaultSpecifier(id)];

@@ -71,4 +65,4 @@ this._resultName = cloneNode(id);

const statement = this._statements[this._statements.length - 1];
_assert(statement.type === "ImportDeclaration");
_assert(statement.specifiers.length === 0);
assert(statement.type === "ImportDeclaration");
assert(statement.specifiers.length === 0);
statement.specifiers = [importSpecifier(id, identifier(importName))];

@@ -82,3 +76,3 @@ this._resultName = cloneNode(id);

if (statement.type !== "ExpressionStatement") {
_assert(this._resultName);
assert(this._resultName);
statement = expressionStatement(this._resultName);

@@ -102,6 +96,6 @@ this._statements.push(statement);

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

@@ -115,6 +109,6 @@ return this;

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

@@ -127,4 +121,3 @@ return this;

}
exports.default = ImportBuilder;
//# sourceMappingURL=import-builder.js.map

25

lib/import-injector.js

@@ -1,11 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _assert = require("assert");
var _t = require("@babel/types");
var _importBuilder = require("./import-builder");
var _isModule = require("./is-module");
import assert from "assert";
import * as _t from "@babel/types";
const {

@@ -15,3 +7,5 @@ numericLiteral,

} = _t;
class ImportInjector {
import ImportBuilder from "./import-builder.js";
import isModule from "./is-module.js";
export default class ImportInjector {
constructor(path, importedSource, opts) {

@@ -37,3 +31,3 @@ this._defaultOpts = {

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

@@ -54,3 +48,3 @@ }

} else {
_assert(!opts, "Unexpected secondary arguments.");
assert(!opts, "Unexpected secondary arguments.");
newOpts = Object.assign({}, this._defaultOpts, importedSource);

@@ -80,3 +74,3 @@ }

let name = nameHint || importName;
const isMod = (0, _isModule.default)(this._programPath);
const isMod = isModule(this._programPath);
const isModuleForNode = isMod && importingInterop === "node";

@@ -87,3 +81,3 @@ const isModuleForBabel = isMod && importingInterop === "babel";

}
const builder = new _importBuilder.default(importedSource, this._programScope, this._hub);
const builder = new ImportBuilder(importedSource, this._programScope, this._hub);
if (importedType === "es6") {

@@ -243,4 +237,3 @@ if (!isModuleForNode && !isModuleForBabel) {

}
exports.default = ImportInjector;
//# sourceMappingURL=import-injector.js.map

@@ -1,37 +0,18 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ImportInjector", {
enumerable: true,
get: function () {
return _importInjector.default;
}
});
exports.addDefault = addDefault;
exports.addNamed = addNamed;
exports.addNamespace = addNamespace;
exports.addSideEffect = addSideEffect;
Object.defineProperty(exports, "isModule", {
enumerable: true,
get: function () {
return _isModule.default;
}
});
var _importInjector = require("./import-injector");
var _isModule = require("./is-module");
function addDefault(path, importedSource, opts) {
return new _importInjector.default(path).addDefault(importedSource, opts);
import ImportInjector from "./import-injector.js";
export { ImportInjector };
export { default as isModule } from "./is-module.js";
export function addDefault(path, importedSource, opts) {
return new ImportInjector(path).addDefault(importedSource, opts);
}
function addNamed(path, name, importedSource, opts) {
return new _importInjector.default(path).addNamed(name, importedSource, opts);
return new ImportInjector(path).addNamed(name, importedSource, opts);
}
function addNamespace(path, importedSource, opts) {
return new _importInjector.default(path).addNamespace(importedSource, opts);
export { addNamed };
export function addNamespace(path, importedSource, opts) {
return new ImportInjector(path).addNamespace(importedSource, opts);
}
function addSideEffect(path, importedSource, opts) {
return new _importInjector.default(path).addSideEffect(importedSource, opts);
export function addSideEffect(path, importedSource, opts) {
return new ImportInjector(path).addSideEffect(importedSource, opts);
}
//# sourceMappingURL=index.js.map

@@ -1,8 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isModule;
function isModule(path) {
export default function isModule(path) {
return path.node.sourceType === "module";

@@ -9,0 +3,0 @@ }

{
"name": "@babel/helper-module-imports",
"version": "7.21.4-esm.3",
"version": "7.21.4-esm.4",
"description": "Babel helper functions for inserting module loads",

@@ -18,7 +18,7 @@ "author": "The Babel Team (https://babel.dev/team)",

"dependencies": {
"@babel/types": "7.21.4-esm.3"
"@babel/types": "7.21.4-esm.4"
},
"devDependencies": {
"@babel/core": "7.21.4-esm.3",
"@babel/traverse": "7.21.4-esm.3"
"@babel/core": "7.21.4-esm.4",
"@babel/traverse": "7.21.4-esm.4"
},

@@ -25,0 +25,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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