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

rollup-plugin-commonjs

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-commonjs - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

4

CHANGELOG.md
# rollup-plugin-commonjs changelog
## 5.0.3
* Respect custom `namedExports` in optimised modules ([#35](https://github.com/rollup/rollup-plugin-commonjs/issues/35))
## 5.0.2

@@ -4,0 +8,0 @@

33

dist/rollup-plugin-commonjs.cjs.js

@@ -198,3 +198,2 @@ 'use strict';

var namedExports = {};
if ( customNamedExports ) customNamedExports.forEach( function (name) { return namedExports[ name ] = true; } );

@@ -356,7 +355,22 @@ // TODO handle transpiled modules

var name = getName( id );
function addExport ( x ) {
var declaration;
if ( x === name ) {
var deconflicted = deconflict( scope, globals, name );
declaration = "var " + deconflicted + " = " + moduleName + "." + x + ";\nexport { " + deconflicted + " as " + x + " };";
} else {
declaration = "export var " + x + " = " + moduleName + "." + x + ";";
}
namedExportDeclarations.push( declaration );
}
if ( customNamedExports ) customNamedExports.forEach( addExport );
if ( shouldWrap ) {
var args = "module" + (uses.exports ? ', exports' : '');
var name = getName( id );
wrapperStart = "var " + moduleName + " = " + HELPERS_NAME + ".createCommonjsModule(function (" + args + ") {\n";

@@ -367,14 +381,3 @@ wrapperEnd = "\n});";

.filter( function (key) { return !blacklistedExports[ key ]; } )
.forEach( function (x) {
var declaration;
if ( x === name ) {
var deconflicted = deconflict( scope, globals, name );
declaration = "var " + deconflicted + " = " + moduleName + "." + x + ";\nexport { " + deconflicted + " as " + x + " };";
} else {
declaration = "export var " + x + " = " + moduleName + "." + x + ";";
}
namedExportDeclarations.push( declaration );
});
.forEach( addExport );
} else {

@@ -381,0 +384,0 @@ var hasDefaultExport = false;

@@ -195,3 +195,2 @@ import { statSync } from 'fs';

var namedExports = {};
if ( customNamedExports ) customNamedExports.forEach( function (name) { return namedExports[ name ] = true; } );

@@ -353,7 +352,22 @@ // TODO handle transpiled modules

var name = getName( id );
function addExport ( x ) {
var declaration;
if ( x === name ) {
var deconflicted = deconflict( scope, globals, name );
declaration = "var " + deconflicted + " = " + moduleName + "." + x + ";\nexport { " + deconflicted + " as " + x + " };";
} else {
declaration = "export var " + x + " = " + moduleName + "." + x + ";";
}
namedExportDeclarations.push( declaration );
}
if ( customNamedExports ) customNamedExports.forEach( addExport );
if ( shouldWrap ) {
var args = "module" + (uses.exports ? ', exports' : '');
var name = getName( id );
wrapperStart = "var " + moduleName + " = " + HELPERS_NAME + ".createCommonjsModule(function (" + args + ") {\n";

@@ -364,14 +378,3 @@ wrapperEnd = "\n});";

.filter( function (key) { return !blacklistedExports[ key ]; } )
.forEach( function (x) {
var declaration;
if ( x === name ) {
var deconflicted = deconflict( scope, globals, name );
declaration = "var " + deconflicted + " = " + moduleName + "." + x + ";\nexport { " + deconflicted + " as " + x + " };";
} else {
declaration = "export var " + x + " = " + moduleName + "." + x + ";";
}
namedExportDeclarations.push( declaration );
});
.forEach( addExport );
} else {

@@ -378,0 +381,0 @@ var hasDefaultExport = false;

{
"name": "rollup-plugin-commonjs",
"version": "5.0.2",
"version": "5.0.3",
"description": "Convert CommonJS modules to ES2015",

@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-commonjs.cjs.js",

@@ -72,3 +72,2 @@ import acorn from 'acorn';

const namedExports = {};
if ( customNamedExports ) customNamedExports.forEach( name => namedExports[ name ] = true );

@@ -228,7 +227,22 @@ // TODO handle transpiled modules

const name = getName( id );
function addExport ( x ) {
let declaration;
if ( x === name ) {
const deconflicted = deconflict( scope, globals, name );
declaration = `var ${deconflicted} = ${moduleName}.${x};\nexport { ${deconflicted} as ${x} };`;
} else {
declaration = `export var ${x} = ${moduleName}.${x};`;
}
namedExportDeclarations.push( declaration );
}
if ( customNamedExports ) customNamedExports.forEach( addExport );
if ( shouldWrap ) {
const args = `module${uses.exports ? ', exports' : ''}`;
const name = getName( id );
wrapperStart = `var ${moduleName} = ${HELPERS_NAME}.createCommonjsModule(function (${args}) {\n`;

@@ -239,14 +253,3 @@ wrapperEnd = `\n});`;

.filter( key => !blacklistedExports[ key ] )
.forEach( x => {
let declaration;
if ( x === name ) {
const deconflicted = deconflict( scope, globals, name );
declaration = `var ${deconflicted} = ${moduleName}.${x};\nexport { ${deconflicted} as ${x} };`;
} else {
declaration = `export var ${x} = ${moduleName}.${x};`;
}
namedExportDeclarations.push( declaration );
});
.forEach( addExport );
} else {

@@ -253,0 +256,0 @@ let hasDefaultExport = false;

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