@rollup/plugin-commonjs 22.0.0-8 → 22.0.0-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +14 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +14 -18
- package/dist/es/index.js.map +1 -1
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import { walk } from 'estree-walker';
|
|
|
7
7
|
import MagicString from 'magic-string';
|
|
8
8
|
import isReference from 'is-reference';
|
|
9
9
|
|
|
10
|
-
var version = "22.0.0-
|
|
10
|
+
var version = "22.0.0-9";
|
|
11
11
|
var peerDependencies = {
|
|
12
|
-
rollup: "^2.
|
|
12
|
+
rollup: "^2.67.0"
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function tryParse(parse, code, id) {
|
|
@@ -421,11 +421,11 @@ async function getStaticRequireProxy(id, requireReturnsDefault, loadModule) {
|
|
|
421
421
|
return `export { default } from ${JSON.stringify(id)};`;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
|
|
425
425
|
const {
|
|
426
426
|
meta: { commonjs: commonjsMeta },
|
|
427
427
|
hasDefaultExport
|
|
428
|
-
} =
|
|
428
|
+
} = getModuleInfo(id);
|
|
429
429
|
if (!commonjsMeta || commonjsMeta.isCommonJS !== IS_WRAPPED_COMMONJS) {
|
|
430
430
|
const stringifiedId = JSON.stringify(id);
|
|
431
431
|
let code = `export * from ${stringifiedId};`;
|
|
@@ -493,11 +493,8 @@ function resolveExtensions(importee, importer, extensions) {
|
|
|
493
493
|
function getResolveId(extensions) {
|
|
494
494
|
return async function resolveId(importee, importer, resolveOptions) {
|
|
495
495
|
// We assume that all requires are pre-resolved
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
resolveOptions.custom['node-resolve'] &&
|
|
499
|
-
resolveOptions.custom['node-resolve'].isRequire
|
|
500
|
-
) {
|
|
496
|
+
const customOptions = resolveOptions.custom;
|
|
497
|
+
if (customOptions && customOptions['node-resolve'] && customOptions['node-resolve'].isRequire) {
|
|
501
498
|
return null;
|
|
502
499
|
}
|
|
503
500
|
if (isWrappedId(importee, WRAPPED_SUFFIX)) {
|
|
@@ -543,13 +540,6 @@ function getResolveId(extensions) {
|
|
|
543
540
|
|
|
544
541
|
// If this is an entry point or ESM import, we need to figure out if the importee is wrapped and
|
|
545
542
|
// if that is the case, we need to add a proxy.
|
|
546
|
-
const customOptions = resolveOptions.custom;
|
|
547
|
-
|
|
548
|
-
// If this is a require, we do not need a proxy
|
|
549
|
-
if (customOptions && customOptions['node-resolve'] && customOptions['node-resolve'].isRequire) {
|
|
550
|
-
return null;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
543
|
const resolved =
|
|
554
544
|
(await this.resolve(importee, importer, Object.assign({ skipSelf: true }, resolveOptions))) ||
|
|
555
545
|
resolveExtensions(importee, importer, extensions);
|
|
@@ -562,13 +552,15 @@ function getResolveId(extensions) {
|
|
|
562
552
|
) {
|
|
563
553
|
return resolved;
|
|
564
554
|
}
|
|
555
|
+
const moduleInfo = await this.load(resolved);
|
|
565
556
|
if (resolveOptions.isEntry) {
|
|
557
|
+
moduleInfo.moduleSideEffects = true;
|
|
566
558
|
// We must not precede entry proxies with a `\0` as that will mess up relative external resolution
|
|
567
559
|
return resolved.id + ENTRY_SUFFIX;
|
|
568
560
|
}
|
|
569
561
|
const {
|
|
570
562
|
meta: { commonjs: commonjsMeta }
|
|
571
|
-
} =
|
|
563
|
+
} = moduleInfo;
|
|
572
564
|
if (commonjsMeta && commonjsMeta.isCommonJS === IS_WRAPPED_COMMONJS) {
|
|
573
565
|
return wrapId(resolved.id, ES_IMPORT_SUFFIX);
|
|
574
566
|
}
|
|
@@ -2050,7 +2042,11 @@ function commonjs(options = {}) {
|
|
|
2050
2042
|
|
|
2051
2043
|
// entry suffix is just appended to not mess up relative external resolution
|
|
2052
2044
|
if (id.endsWith(ENTRY_SUFFIX)) {
|
|
2053
|
-
return getEntryProxy(
|
|
2045
|
+
return getEntryProxy(
|
|
2046
|
+
id.slice(0, -ENTRY_SUFFIX.length),
|
|
2047
|
+
defaultIsModuleExports,
|
|
2048
|
+
this.getModuleInfo
|
|
2049
|
+
);
|
|
2054
2050
|
}
|
|
2055
2051
|
|
|
2056
2052
|
if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
|