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

rollup-plugin-commonjs

Package Overview
Dependencies
Maintainers
4
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 9.1.0 to 9.1.1

4

CHANGELOG.md
# rollup-plugin-commonjs changelog
## 9.1.1
*2018-04-30*
* Fix ordering of modules when using rollup 0.58 ([#302](https://github.com/rollup/rollup-plugin-commonjs/issues/302))
## 9.1.0

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

@@ -694,5 +694,28 @@ 'use strict';

var commonjsModules = new Map();
var resolveUsingOtherResolvers;
var isCjsPromises = Object.create(null);
function getIsCjsPromise ( id ) {
var isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
{ return isCjsPromise.promise; }
var promise = new Promise( function (resolve$$1) {
isCjsPromises[id] = isCjsPromise = {
resolve: resolve$$1,
promise: undefined
};
});
isCjsPromise.promise = promise;
return promise;
}
function setIsCjsPromise ( id, promise ) {
var isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
{ isCjsPromise.resolve(promise); }
else
{ isCjsPromises[id] = { promise: promise, resolve: undefined }; }
}
return {

@@ -757,8 +780,11 @@ name: 'commonjs',

if (commonjsModules.has( actualId$1 ))
{ return ("import { __moduleExports } from " + (JSON.stringify( actualId$1 )) + "; export default __moduleExports;"); }
else if (esModulesWithoutDefaultExport.indexOf(actualId$1) !== -1)
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default " + name$1 + ";"); }
else
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default ( " + name$1 + " && " + name$1 + "['default'] ) || " + name$1 + ";"); }
return getIsCjsPromise( actualId$1 )
.then( function (isCjs) {
if ( isCjs )
{ return ("import { __moduleExports } from " + (JSON.stringify( actualId$1 )) + "; export default __moduleExports;"); }
else if (esModulesWithoutDefaultExport.indexOf(actualId$1) !== -1)
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default " + name$1 + ";"); }
else
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default ( " + name$1 + " && " + name$1 + "['default'] ) || " + name$1 + ";"); }
});
}

@@ -773,3 +799,3 @@ },

return entryModuleIdsPromise.then( function (entryModuleIds) {
var transformPromise = entryModuleIdsPromise.then( function (entryModuleIds) {
var ref = checkEsModule( this$1.parse, code, id );

@@ -797,3 +823,2 @@ var isEsModule = ref.isEsModule;

commonjsModules.set( id, true );
return transformed;

@@ -803,2 +828,6 @@ }).catch(function (err) {

});
setIsCjsPromise(id, transformPromise.then( function (transformed) { return transformed ? true : false; }, function () { return true; } ));
return transformPromise;
}

@@ -805,0 +834,0 @@ };

@@ -690,5 +690,28 @@ import { statSync } from 'fs';

var commonjsModules = new Map();
var resolveUsingOtherResolvers;
var isCjsPromises = Object.create(null);
function getIsCjsPromise ( id ) {
var isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
{ return isCjsPromise.promise; }
var promise = new Promise( function (resolve$$1) {
isCjsPromises[id] = isCjsPromise = {
resolve: resolve$$1,
promise: undefined
};
});
isCjsPromise.promise = promise;
return promise;
}
function setIsCjsPromise ( id, promise ) {
var isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
{ isCjsPromise.resolve(promise); }
else
{ isCjsPromises[id] = { promise: promise, resolve: undefined }; }
}
return {

@@ -753,8 +776,11 @@ name: 'commonjs',

if (commonjsModules.has( actualId$1 ))
{ return ("import { __moduleExports } from " + (JSON.stringify( actualId$1 )) + "; export default __moduleExports;"); }
else if (esModulesWithoutDefaultExport.indexOf(actualId$1) !== -1)
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default " + name$1 + ";"); }
else
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default ( " + name$1 + " && " + name$1 + "['default'] ) || " + name$1 + ";"); }
return getIsCjsPromise( actualId$1 )
.then( function (isCjs) {
if ( isCjs )
{ return ("import { __moduleExports } from " + (JSON.stringify( actualId$1 )) + "; export default __moduleExports;"); }
else if (esModulesWithoutDefaultExport.indexOf(actualId$1) !== -1)
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default " + name$1 + ";"); }
else
{ return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default ( " + name$1 + " && " + name$1 + "['default'] ) || " + name$1 + ";"); }
});
}

@@ -769,3 +795,3 @@ },

return entryModuleIdsPromise.then( function (entryModuleIds) {
var transformPromise = entryModuleIdsPromise.then( function (entryModuleIds) {
var ref = checkEsModule( this$1.parse, code, id );

@@ -793,3 +819,2 @@ var isEsModule = ref.isEsModule;

commonjsModules.set( id, true );
return transformed;

@@ -799,2 +824,6 @@ }).catch(function (err) {

});
setIsCjsPromise(id, transformPromise.then( function (transformed) { return transformed ? true : false; }, function () { return true; } ));
return transformPromise;
}

@@ -801,0 +830,0 @@ };

4

package.json
{
"name": "rollup-plugin-commonjs",
"version": "9.1.0",
"version": "9.1.1",
"description": "Convert CommonJS modules to ES2015",

@@ -38,3 +38,3 @@ "main": "dist/rollup-plugin-commonjs.cjs.js",

"require-relative": "^0.8.7",
"rollup": "^0.56.4",
"rollup": "^0.57.0",
"rollup-plugin-buble": "^0.19.2",

@@ -41,0 +41,0 @@ "rollup-plugin-node-resolve": "^3.0.3",

@@ -96,5 +96,28 @@ import { statSync } from 'fs';

const commonjsModules = new Map();
let resolveUsingOtherResolvers;
const isCjsPromises = Object.create(null);
function getIsCjsPromise ( id ) {
let isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
return isCjsPromise.promise;
const promise = new Promise( resolve => {
isCjsPromises[id] = isCjsPromise = {
resolve: resolve,
promise: undefined
};
});
isCjsPromise.promise = promise;
return promise;
}
function setIsCjsPromise ( id, promise ) {
const isCjsPromise = isCjsPromises[id];
if (isCjsPromise)
isCjsPromise.resolve(promise);
else
isCjsPromises[id] = { promise: promise, resolve: undefined };
}
return {

@@ -159,8 +182,11 @@ name: 'commonjs',

if (commonjsModules.has( actualId ))
return `import { __moduleExports } from ${JSON.stringify( actualId )}; export default __moduleExports;`;
else if (esModulesWithoutDefaultExport.indexOf(actualId) !== -1)
return `import * as ${name} from ${JSON.stringify( actualId )}; export default ${name};`;
else
return `import * as ${name} from ${JSON.stringify( actualId )}; export default ( ${name} && ${name}['default'] ) || ${name};`;
return getIsCjsPromise( actualId )
.then( isCjs => {
if ( isCjs )
return `import { __moduleExports } from ${JSON.stringify( actualId )}; export default __moduleExports;`;
else if (esModulesWithoutDefaultExport.indexOf(actualId) !== -1)
return `import * as ${name} from ${JSON.stringify( actualId )}; export default ${name};`;
else
return `import * as ${name} from ${JSON.stringify( actualId )}; export default ( ${name} && ${name}['default'] ) || ${name};`;
});
}

@@ -173,3 +199,3 @@ },

return entryModuleIdsPromise.then( (entryModuleIds) => {
const transformPromise = entryModuleIdsPromise.then( (entryModuleIds) => {
const {isEsModule, hasDefaultExport, ast} = checkEsModule( this.parse, code, id );

@@ -194,3 +220,2 @@ if ( isEsModule ) {

commonjsModules.set( id, true );
return transformed;

@@ -200,4 +225,8 @@ }).catch(err => {

});
setIsCjsPromise(id, transformPromise.then( transformed => transformed ? true : false, () => true ));
return transformPromise;
}
};
}

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