@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/cjs/index.js
CHANGED
|
@@ -16,9 +16,9 @@ var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
|
|
|
16
16
|
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
17
17
|
var isReference__default = /*#__PURE__*/_interopDefaultLegacy(isReference);
|
|
18
18
|
|
|
19
|
-
var version = "22.0.0-
|
|
19
|
+
var version = "22.0.0-9";
|
|
20
20
|
var peerDependencies = {
|
|
21
|
-
rollup: "^2.
|
|
21
|
+
rollup: "^2.67.0"
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
function tryParse(parse, code, id) {
|
|
@@ -430,11 +430,11 @@ async function getStaticRequireProxy(id, requireReturnsDefault, loadModule) {
|
|
|
430
430
|
return `export { default } from ${JSON.stringify(id)};`;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
|
|
433
|
+
function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
|
|
434
434
|
const {
|
|
435
435
|
meta: { commonjs: commonjsMeta },
|
|
436
436
|
hasDefaultExport
|
|
437
|
-
} =
|
|
437
|
+
} = getModuleInfo(id);
|
|
438
438
|
if (!commonjsMeta || commonjsMeta.isCommonJS !== IS_WRAPPED_COMMONJS) {
|
|
439
439
|
const stringifiedId = JSON.stringify(id);
|
|
440
440
|
let code = `export * from ${stringifiedId};`;
|
|
@@ -502,11 +502,8 @@ function resolveExtensions(importee, importer, extensions) {
|
|
|
502
502
|
function getResolveId(extensions) {
|
|
503
503
|
return async function resolveId(importee, importer, resolveOptions) {
|
|
504
504
|
// We assume that all requires are pre-resolved
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
resolveOptions.custom['node-resolve'] &&
|
|
508
|
-
resolveOptions.custom['node-resolve'].isRequire
|
|
509
|
-
) {
|
|
505
|
+
const customOptions = resolveOptions.custom;
|
|
506
|
+
if (customOptions && customOptions['node-resolve'] && customOptions['node-resolve'].isRequire) {
|
|
510
507
|
return null;
|
|
511
508
|
}
|
|
512
509
|
if (isWrappedId(importee, WRAPPED_SUFFIX)) {
|
|
@@ -552,13 +549,6 @@ function getResolveId(extensions) {
|
|
|
552
549
|
|
|
553
550
|
// If this is an entry point or ESM import, we need to figure out if the importee is wrapped and
|
|
554
551
|
// if that is the case, we need to add a proxy.
|
|
555
|
-
const customOptions = resolveOptions.custom;
|
|
556
|
-
|
|
557
|
-
// If this is a require, we do not need a proxy
|
|
558
|
-
if (customOptions && customOptions['node-resolve'] && customOptions['node-resolve'].isRequire) {
|
|
559
|
-
return null;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
552
|
const resolved =
|
|
563
553
|
(await this.resolve(importee, importer, Object.assign({ skipSelf: true }, resolveOptions))) ||
|
|
564
554
|
resolveExtensions(importee, importer, extensions);
|
|
@@ -571,13 +561,15 @@ function getResolveId(extensions) {
|
|
|
571
561
|
) {
|
|
572
562
|
return resolved;
|
|
573
563
|
}
|
|
564
|
+
const moduleInfo = await this.load(resolved);
|
|
574
565
|
if (resolveOptions.isEntry) {
|
|
566
|
+
moduleInfo.moduleSideEffects = true;
|
|
575
567
|
// We must not precede entry proxies with a `\0` as that will mess up relative external resolution
|
|
576
568
|
return resolved.id + ENTRY_SUFFIX;
|
|
577
569
|
}
|
|
578
570
|
const {
|
|
579
571
|
meta: { commonjs: commonjsMeta }
|
|
580
|
-
} =
|
|
572
|
+
} = moduleInfo;
|
|
581
573
|
if (commonjsMeta && commonjsMeta.isCommonJS === IS_WRAPPED_COMMONJS) {
|
|
582
574
|
return wrapId(resolved.id, ES_IMPORT_SUFFIX);
|
|
583
575
|
}
|
|
@@ -2059,7 +2051,11 @@ function commonjs(options = {}) {
|
|
|
2059
2051
|
|
|
2060
2052
|
// entry suffix is just appended to not mess up relative external resolution
|
|
2061
2053
|
if (id.endsWith(ENTRY_SUFFIX)) {
|
|
2062
|
-
return getEntryProxy(
|
|
2054
|
+
return getEntryProxy(
|
|
2055
|
+
id.slice(0, -ENTRY_SUFFIX.length),
|
|
2056
|
+
defaultIsModuleExports,
|
|
2057
|
+
this.getModuleInfo
|
|
2058
|
+
);
|
|
2063
2059
|
}
|
|
2064
2060
|
|
|
2065
2061
|
if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
|