rollup-plugin-commonjs
Advanced tools
Comparing version 9.2.2 to 9.2.3
# rollup-plugin-commonjs changelog | ||
## 9.2.3 | ||
*2019-04-02* | ||
* Improve support for ES3 browsers ([#364](https://github.com/rollup/rollup-plugin-commonjs/issues/364)) | ||
* Add note about monorepo usage to readme ([#372](https://github.com/rollup/rollup-plugin-commonjs/issues/372)) | ||
* Add .js extension to generated helper file ([#373](https://github.com/rollup/rollup-plugin-commonjs/issues/373)) | ||
## 9.2.2 | ||
@@ -4,0 +10,0 @@ *2019-03-25* |
@@ -14,5 +14,7 @@ 'use strict'; | ||
var EXTERNAL_PREFIX = '\0commonjs-external:'; | ||
var HELPERS_ID = '\0commonjsHelpers'; | ||
var HELPERS_ID = '\0commonjsHelpers.js'; | ||
var HELPERS = "\nexport var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n.default || n;\n}"; | ||
// `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers. | ||
// Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled. | ||
var HELPERS = "\nexport var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n['default'] || n;\n}"; | ||
@@ -104,4 +106,3 @@ var isCjsPromises = Object.create(null); | ||
return candidates.reduce(function (promise, candidate) { | ||
return promise.then( | ||
function (result) { return (result != null ? result : Promise.resolve(candidate.call.apply(candidate, [ this$1 ].concat( args )))); } | ||
return promise.then(function (result) { return result != null ? result : Promise.resolve(candidate.call.apply(candidate, [ this$1 ].concat( args ))); } | ||
); | ||
@@ -108,0 +109,0 @@ }, Promise.resolve()); |
@@ -10,5 +10,7 @@ import { resolve, dirname, basename, extname, sep } from 'path'; | ||
var EXTERNAL_PREFIX = '\0commonjs-external:'; | ||
var HELPERS_ID = '\0commonjsHelpers'; | ||
var HELPERS_ID = '\0commonjsHelpers.js'; | ||
var HELPERS = "\nexport var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n.default || n;\n}"; | ||
// `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers. | ||
// Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled. | ||
var HELPERS = "\nexport var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n['default'] || n;\n}"; | ||
@@ -100,4 +102,3 @@ var isCjsPromises = Object.create(null); | ||
return candidates.reduce(function (promise, candidate) { | ||
return promise.then( | ||
function (result) { return (result != null ? result : Promise.resolve(candidate.call.apply(candidate, [ this$1 ].concat( args )))); } | ||
return promise.then(function (result) { return result != null ? result : Promise.resolve(candidate.call.apply(candidate, [ this$1 ].concat( args ))); } | ||
); | ||
@@ -104,0 +105,0 @@ }, Promise.resolve()); |
{ | ||
"name": "rollup-plugin-commonjs", | ||
"version": "9.2.2", | ||
"version": "9.2.3", | ||
"description": "Convert CommonJS modules to ES2015", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-commonjs.cjs.js", |
@@ -69,2 +69,12 @@ # rollup-plugin-commonjs [![Build Status][travis-img]][travis] | ||
### Usage in monorepo | ||
In case you are using a monorepo, you may want to use a regular expression for `include` as the string 'node_modules' will not match if your `node_modules` is not in your current working directory (i.e. '../node_modules'). Try this: | ||
``` | ||
commonjs({ | ||
include: /node_modules/ | ||
}) | ||
``` | ||
### Custom named exports | ||
@@ -71,0 +81,0 @@ |
export const PROXY_PREFIX = '\0commonjs-proxy:'; | ||
export const EXTERNAL_PREFIX = '\0commonjs-external:'; | ||
export const HELPERS_ID = '\0commonjsHelpers'; | ||
export const HELPERS_ID = '\0commonjsHelpers.js'; | ||
// `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers. | ||
// Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled. | ||
export const HELPERS = ` | ||
export var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
export var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
@@ -13,3 +15,3 @@ export function commonjsRequire () { | ||
export function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x; | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
@@ -22,3 +24,3 @@ | ||
export function getCjsExportFromNamespace (n) { | ||
return n && n.default || n; | ||
return n && n['default'] || n; | ||
}`; |
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
211406
2267
126