Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-modules-commonjs

Package Overview
Dependencies
Maintainers
4
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-modules-commonjs - npm Package Compare versions

Comparing version 7.20.11 to 7.21.2

1

lib/dynamic-import.js

@@ -9,3 +9,2 @@ "use strict";

var _helperModuleTransforms = require("@babel/helper-module-transforms");
const requireNoInterop = source => _core.template.expression.ast`require(${source})`;

@@ -12,0 +11,0 @@ const requireInterop = (source, file) => _core.types.callExpression(file.addHelper("interopRequireWildcard"), [requireNoInterop(source)]);

10

lib/index.js

@@ -53,4 +53,3 @@ "use strict";

const rootBinding = this.scope.getBinding(localName);
if (
rootBinding !== localBinding || path.parentPath.isObjectProperty({
if (rootBinding !== localBinding || path.parentPath.isObjectProperty({
value: path.node

@@ -73,3 +72,2 @@ }) && path.parentPath.parentPath.isObjectPattern() || path.parentPath.isAssignmentExpression({

const rootBinding = this.scope.getBinding(localName);
if (rootBinding !== localBinding) return;

@@ -85,3 +83,2 @@ path.replaceWith(_core.types.assignmentExpression(path.node.operator[0] + "=", arg.node, getAssertion(localName)));

const rootBinding = this.scope.getBinding(localName);
if (rootBinding !== localBinding) return;

@@ -123,3 +120,2 @@ const right = path.get("right");

if (!(0, _helperModuleTransforms.isModule)(path)) return;
path.scope.rename("exports");

@@ -130,3 +126,2 @@ path.scope.rename("module");

path.scope.rename("__dirname");
if (!allowCommonJSExports) {

@@ -164,2 +159,5 @@ (0, _helperSimpleAccess.default)(path, new Set(["module", "exports"]), false);

} else {
if (metadata.lazy && !metadata.referenced) {
continue;
}
const init = (0, _helperModuleTransforms.wrapInterop)(path, loadExpr, metadata.interop) || loadExpr;

@@ -166,0 +164,0 @@ if (metadata.lazy) {

{
"name": "@babel/plugin-transform-modules-commonjs",
"version": "7.20.11",
"version": "7.21.2",
"description": "This plugin transforms ES2015 modules to CommonJS",

@@ -16,3 +16,3 @@ "repository": {

"dependencies": {
"@babel/helper-module-transforms": "^7.20.11",
"@babel/helper-module-transforms": "^7.21.2",
"@babel/helper-plugin-utils": "^7.20.2",

@@ -28,3 +28,3 @@ "@babel/helper-simple-access": "^7.20.2"

"devDependencies": {
"@babel/core": "^7.20.7",
"@babel/core": "^7.21.0",
"@babel/helper-plugin-test-runner": "^7.18.6",

@@ -31,0 +31,0 @@ "@babel/plugin-external-helpers": "^7.18.6",

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc