rollup-plugin-commonjs
Advanced tools
Comparing version 8.0.2 to 8.1.0
# rollup-plugin-commonjs changelog | ||
## 8.1.0 | ||
* Handle `options.external` correctly ([#212](https://github.com/rollup/rollup-plugin-commonjs/pull/212)) | ||
* Support top-level return ([#195](https://github.com/rollup/rollup-plugin-commonjs/pull/195)) | ||
## 8.0.2 | ||
@@ -4,0 +9,0 @@ |
@@ -190,3 +190,4 @@ 'use strict'; | ||
ecmaVersion: 8, | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
allowReturnOutsideFunction: true | ||
}); | ||
@@ -295,2 +296,7 @@ } catch ( err ) { | ||
// if toplevel return, we need to wrap it | ||
if ( node.type === 'ReturnStatement' && lexicalDepth === 0 ) { | ||
shouldWrap = true; | ||
} | ||
// rewrite `this` as `commonjsHelpers.commonjsGlobal` | ||
@@ -698,2 +704,9 @@ if ( node.type === 'ThisExpression' && lexicalDepth === 0 ) { | ||
var isExternal = options$1.external ? | ||
Array.isArray( options$1.external ) ? function (id) { return ~options$1.external.indexOf( id ); } : | ||
options$1.external : | ||
function () { return false; }; | ||
resolvers.unshift( function (id) { return isExternal( id ) ? false : null; } ); | ||
resolveUsingOtherResolvers = first( resolvers ); | ||
@@ -700,0 +713,0 @@ |
@@ -187,3 +187,4 @@ import { statSync } from 'fs'; | ||
ecmaVersion: 8, | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
allowReturnOutsideFunction: true | ||
}); | ||
@@ -292,2 +293,7 @@ } catch ( err ) { | ||
// if toplevel return, we need to wrap it | ||
if ( node.type === 'ReturnStatement' && lexicalDepth === 0 ) { | ||
shouldWrap = true; | ||
} | ||
// rewrite `this` as `commonjsHelpers.commonjsGlobal` | ||
@@ -695,2 +701,9 @@ if ( node.type === 'ThisExpression' && lexicalDepth === 0 ) { | ||
var isExternal = options$1.external ? | ||
Array.isArray( options$1.external ) ? function (id) { return ~options$1.external.indexOf( id ); } : | ||
options$1.external : | ||
function () { return false; }; | ||
resolvers.unshift( function (id) { return isExternal( id ) ? false : null; } ); | ||
resolveUsingOtherResolvers = first( resolvers ); | ||
@@ -697,0 +710,0 @@ |
{ | ||
"name": "rollup-plugin-commonjs", | ||
"version": "8.0.2", | ||
"version": "8.1.0", | ||
"description": "Convert CommonJS modules to ES2015", | ||
@@ -11,6 +11,5 @@ "main": "dist/rollup-plugin-commonjs.cjs.js", | ||
"pretest": "npm run build", | ||
"posttest": "eslint src/*.js test/*.js", | ||
"build": "rm -rf dist/* && rollup -c", | ||
"dev": "rollup -c -w", | ||
"lint": "eslint src", | ||
"lint": "eslint src/*.js test/*.js", | ||
"prepublish": "npm run lint && npm test" | ||
@@ -31,6 +30,6 @@ }, | ||
"devDependencies": { | ||
"buble": "^0.15.0", | ||
"eslint": "^3.5.0", | ||
"locate-character": "^2.0.0", | ||
"mocha": "^3.0.2", | ||
"require-relative": "^0.8.7", | ||
"rollup": "^0.40.2", | ||
@@ -37,0 +36,0 @@ "rollup-plugin-buble": "^0.15.0", |
@@ -40,2 +40,4 @@ # rollup-plugin-commonjs [![Build Status][travis-img]][travis] | ||
exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ], // Default: undefined | ||
// these values can also be regular expressions | ||
// include: /node_modules/ | ||
@@ -42,0 +44,0 @@ // search for files other than .js files (must already |
@@ -125,2 +125,9 @@ import { statSync } from 'fs'; | ||
const isExternal = options.external ? | ||
Array.isArray( options.external ) ? id => ~options.external.indexOf( id ) : | ||
options.external : | ||
() => false; | ||
resolvers.unshift( id => isExternal( id ) ? false : null ); | ||
resolveUsingOtherResolvers = first( resolvers ); | ||
@@ -127,0 +134,0 @@ |
@@ -33,3 +33,4 @@ import acorn from 'acorn'; | ||
ecmaVersion: 8, | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
allowReturnOutsideFunction: true | ||
}); | ||
@@ -136,2 +137,7 @@ } catch ( err ) { | ||
// if toplevel return, we need to wrap it | ||
if ( node.type === 'ReturnStatement' && lexicalDepth === 0 ) { | ||
shouldWrap = true; | ||
} | ||
// rewrite `this` as `commonjsHelpers.commonjsGlobal` | ||
@@ -138,0 +144,0 @@ if ( node.type === 'ThisExpression' && lexicalDepth === 0 ) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178967
1727
114