@rollup/plugin-commonjs
Advanced tools
Comparing version 13.0.2 to 14.0.0
# @rollup/plugin-commonjs ChangeLog | ||
## v14.0.0 | ||
_2020-07-13_ | ||
### Release Notes | ||
This restores the fixes from v13.0.1, but as a semver compliant major version. | ||
## v13.0.2 | ||
@@ -4,0 +12,0 @@ |
@@ -197,6 +197,2 @@ import { statSync, existsSync, readFileSync } from 'fs'; | ||
export function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
export function createCommonjsModule(fn, basedir, module) { | ||
@@ -553,2 +549,12 @@ return module = { | ||
function isNodeRequireStatement(parent) { | ||
const reservedMethod = ['resolve', 'cache', 'main']; | ||
if (parent && parent.property && reservedMethod.indexOf(parent.property.name) > -1) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isIgnoredRequireStatement(requiredNode) { | ||
@@ -720,2 +726,6 @@ return ignoreRequire(requiredNode.arguments[0].value); | ||
if (isRequireIdentifier(node)) { | ||
if (isNodeRequireStatement(parent)) { | ||
return; | ||
} | ||
if (!isDynamicRequireModulesEnabled && isStaticRequireStatement(parent)) { | ||
@@ -972,3 +982,3 @@ return; | ||
const defaultExport = /__esModule/.test(code) ? `export default /*@__PURE__*/${HELPERS_NAME}.unwrapExports(${moduleName});` : `export default ${moduleName};`; | ||
const defaultExport = `export default ${moduleName};`; | ||
const named = namedExportDeclarations.filter(x => x.name !== 'default' || !hasDefaultExport).map(x => x.str); | ||
@@ -975,0 +985,0 @@ const exportBlock = `\n\n${(isEsModule ? [] : [defaultExport]).concat(named).concat(hasDefaultExport ? defaultExportPropertyAssignments : []).join('\n')}`; |
@@ -201,6 +201,2 @@ 'use strict'; | ||
export function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
export function createCommonjsModule(fn, basedir, module) { | ||
@@ -557,2 +553,12 @@ return module = { | ||
function isNodeRequireStatement(parent) { | ||
const reservedMethod = ['resolve', 'cache', 'main']; | ||
if (parent && parent.property && reservedMethod.indexOf(parent.property.name) > -1) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isIgnoredRequireStatement(requiredNode) { | ||
@@ -724,2 +730,6 @@ return ignoreRequire(requiredNode.arguments[0].value); | ||
if (isRequireIdentifier(node)) { | ||
if (isNodeRequireStatement(parent)) { | ||
return; | ||
} | ||
if (!isDynamicRequireModulesEnabled && isStaticRequireStatement(parent)) { | ||
@@ -976,3 +986,3 @@ return; | ||
const defaultExport = /__esModule/.test(code) ? `export default /*@__PURE__*/${HELPERS_NAME}.unwrapExports(${moduleName});` : `export default ${moduleName};`; | ||
const defaultExport = `export default ${moduleName};`; | ||
const named = namedExportDeclarations.filter(x => x.name !== 'default' || !hasDefaultExport).map(x => x.str); | ||
@@ -979,0 +989,0 @@ const exportBlock = `\n\n${(isEsModule ? [] : [defaultExport]).concat(named).concat(hasDefaultExport ? defaultExportPropertyAssignments : []).join('\n')}`; |
{ | ||
"name": "@rollup/plugin-commonjs", | ||
"version": "13.0.2", | ||
"version": "14.0.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
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
280877
2330