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

@babel/helper-module-transforms

Package Overview
Dependencies
Maintainers
6
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-module-transforms - npm Package Compare versions

Comparing version 7.14.0 to 7.14.2

26

lib/index.js

@@ -41,24 +41,18 @@ "use strict";

var t = _interopRequireWildcard(require("@babel/types"));
var _assert = require("assert");
var _template = _interopRequireDefault(require("@babel/template"));
var t = require("@babel/types");
var _template = require("@babel/template");
var _helperModuleImports = require("@babel/helper-module-imports");
var _rewriteThis = _interopRequireDefault(require("./rewrite-this"));
var _rewriteThis = require("./rewrite-this");
var _rewriteLiveReferences = _interopRequireDefault(require("./rewrite-live-references"));
var _rewriteLiveReferences = require("./rewrite-live-references");
var _normalizeAndLoadMetadata = _interopRequireWildcard(require("./normalize-and-load-metadata"));
var _normalizeAndLoadMetadata = require("./normalize-and-load-metadata");
var _getModuleName = _interopRequireDefault(require("./get-module-name"));
var _getModuleName = require("./get-module-name");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; 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; }
const assert = require("assert");
function rewriteModuleStatementsAndPrepareHeader(path, {

@@ -78,3 +72,5 @@ loose,

(0, _normalizeAndLoadMetadata.validateImportInteropOption)(importInterop);
assert((0, _helperModuleImports.isModule)(path), "Cannot process module statements in a script");
_assert((0, _helperModuleImports.isModule)(path), "Cannot process module statements in a script");
path.node.sourceType = "script";

@@ -81,0 +77,0 @@ const meta = (0, _normalizeAndLoadMetadata.default)(path, exportName, {

@@ -15,6 +15,4 @@ "use strict";

var _helperSplitExportDeclaration = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasExports(metadata) {

@@ -110,2 +108,12 @@ return metadata.hasExports;

function assertExportSpecifier(path) {
if (path.isExportSpecifier()) {
return;
} else if (path.isExportNamespaceSpecifier()) {
throw path.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.");
} else {
throw path.buildCodeFrameError("Unexpected export specifier type");
}
}
function getModuleMetadata(programPath, {

@@ -195,6 +203,3 @@ lazy,

child.get("specifiers").forEach(spec => {
if (!spec.isExportSpecifier()) {
throw spec.buildCodeFrameError("Unexpected export specifier type");
}
assertExportSpecifier(spec);
const importName = getExportSpecifierName(spec.get("local"), stringSpecifiers);

@@ -276,4 +281,5 @@ const exportName = getExportSpecifierName(spec.get("exported"), stringSpecifiers);

} else if (initializeReexports && child.node.source && child.get("source").isStringLiteral()) {
child.node.specifiers.forEach(specifier => {
bindingKindLookup.set(specifier.local.name, "block");
child.get("specifiers").forEach(spec => {
assertExportSpecifier(spec);
bindingKindLookup.set(spec.get("local").node.name, "block");
});

@@ -280,0 +286,0 @@ return;

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

var t = _interopRequireWildcard(require("@babel/types"));
var _assert = require("assert");
var _template = _interopRequireDefault(require("@babel/template"));
var t = require("@babel/types");
var _helperSimpleAccess = _interopRequireDefault(require("@babel/helper-simple-access"));
var _template = require("@babel/template");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _helperSimpleAccess = require("@babel/helper-simple-access");
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; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; 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; }
const assert = require("assert");
function rewriteLiveReferences(programPath, metadata) {

@@ -221,3 +215,4 @@ const imported = new Map();

if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) {
assert(path.node.operator === "=", "Path was not simplified");
_assert(path.node.operator === "=", "Path was not simplified");
const assignment = path.node;

@@ -224,0 +219,0 @@

@@ -10,12 +10,6 @@ "use strict";

var _traverse = _interopRequireDefault(require("@babel/traverse"));
var _traverse = require("@babel/traverse");
var t = _interopRequireWildcard(require("@babel/types"));
var t = require("@babel/types");
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; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; 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 }; }
function rewriteThis(programPath) {

@@ -22,0 +16,0 @@ (0, _traverse.default)(programPath.node, Object.assign({}, rewriteThisVisitor, {

{
"name": "@babel/helper-module-transforms",
"version": "7.14.0",
"version": "7.14.2",
"description": "Babel helper functions for implementing ES6 module transformations",

@@ -24,5 +24,5 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>",

"@babel/template": "^7.12.13",
"@babel/traverse": "^7.14.0",
"@babel/types": "^7.14.0"
"@babel/traverse": "^7.14.2",
"@babel/types": "^7.14.2"
}
}
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