@rollup/plugin-commonjs 28.0.7 → 28.0.8
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 +20 -7
- package/dist/es/index.js +20 -7
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var estreeWalker = require('estree-walker');
|
|
|
11
11
|
var MagicString = require('magic-string');
|
|
12
12
|
var isReference = require('is-reference');
|
|
13
13
|
|
|
14
|
-
var version = "28.0.
|
|
14
|
+
var version = "28.0.8";
|
|
15
15
|
var peerDependencies = {
|
|
16
16
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
|
17
17
|
};
|
|
@@ -840,22 +840,35 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
|
|
|
840
840
|
getTypeForFullyAnalyzedModule(dependencyId));
|
|
841
841
|
// Special-case external Node built-ins to be handled via a lazy __require
|
|
842
842
|
// helper instead of hoisted ESM imports when strict wrapping is used.
|
|
843
|
+
const isExternalWrapped = isWrappedId(dependencyId, EXTERNAL_SUFFIX);
|
|
843
844
|
if (
|
|
844
845
|
parentMeta.initialCommonJSType === IS_WRAPPED_COMMONJS &&
|
|
845
846
|
!allowProxy &&
|
|
846
|
-
|
|
847
|
+
isExternalWrapped
|
|
847
848
|
) {
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
if (isNodeBuiltin) {
|
|
849
|
+
const actualExternalId = unwrapId(dependencyId, EXTERNAL_SUFFIX);
|
|
850
|
+
if (actualExternalId.startsWith('node:')) {
|
|
851
851
|
isCommonJS = IS_WRAPPED_COMMONJS;
|
|
852
|
+
parentMeta.isRequiredCommonJS[dependencyId] = isCommonJS;
|
|
852
853
|
}
|
|
853
854
|
}
|
|
854
855
|
const isWrappedCommonJS = isCommonJS === IS_WRAPPED_COMMONJS;
|
|
855
856
|
fullyAnalyzedModules[dependencyId] = true;
|
|
857
|
+
const moduleInfo =
|
|
858
|
+
isWrappedCommonJS && !isExternalWrapped
|
|
859
|
+
? rollupContext.getModuleInfo(dependencyId)
|
|
860
|
+
: null;
|
|
861
|
+
// For wrapped dependencies, annotate the generated require call as pure only
|
|
862
|
+
// when Rollup has module info and it explicitly reports no side effects.
|
|
863
|
+
// Note: For external Node built-ins (handled via EXTERNAL_SUFFIX), the module
|
|
864
|
+
// has not been loaded yet at this point and getModuleInfo returns null.
|
|
865
|
+
// Default to side effects = true in that case to be safe.
|
|
866
|
+
// Preserve Rollup's tri-state semantics (true | false | 'no-treeshake') when available.
|
|
867
|
+
const wrappedModuleSideEffects = !isWrappedCommonJS
|
|
868
|
+
? false
|
|
869
|
+
: moduleInfo?.moduleSideEffects ?? true;
|
|
856
870
|
return {
|
|
857
|
-
wrappedModuleSideEffects
|
|
858
|
-
isWrappedCommonJS && rollupContext.getModuleInfo(dependencyId).moduleSideEffects,
|
|
871
|
+
wrappedModuleSideEffects,
|
|
859
872
|
source: sources[index].source,
|
|
860
873
|
id: allowProxy
|
|
861
874
|
? wrapId(dependencyId, isWrappedCommonJS ? WRAPPED_SUFFIX : PROXY_SUFFIX)
|
package/dist/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { walk } from 'estree-walker';
|
|
|
7
7
|
import MagicString from 'magic-string';
|
|
8
8
|
import isReference from 'is-reference';
|
|
9
9
|
|
|
10
|
-
var version = "28.0.
|
|
10
|
+
var version = "28.0.8";
|
|
11
11
|
var peerDependencies = {
|
|
12
12
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
|
13
13
|
};
|
|
@@ -836,22 +836,35 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
|
|
|
836
836
|
getTypeForFullyAnalyzedModule(dependencyId));
|
|
837
837
|
// Special-case external Node built-ins to be handled via a lazy __require
|
|
838
838
|
// helper instead of hoisted ESM imports when strict wrapping is used.
|
|
839
|
+
const isExternalWrapped = isWrappedId(dependencyId, EXTERNAL_SUFFIX);
|
|
839
840
|
if (
|
|
840
841
|
parentMeta.initialCommonJSType === IS_WRAPPED_COMMONJS &&
|
|
841
842
|
!allowProxy &&
|
|
842
|
-
|
|
843
|
+
isExternalWrapped
|
|
843
844
|
) {
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
if (isNodeBuiltin) {
|
|
845
|
+
const actualExternalId = unwrapId(dependencyId, EXTERNAL_SUFFIX);
|
|
846
|
+
if (actualExternalId.startsWith('node:')) {
|
|
847
847
|
isCommonJS = IS_WRAPPED_COMMONJS;
|
|
848
|
+
parentMeta.isRequiredCommonJS[dependencyId] = isCommonJS;
|
|
848
849
|
}
|
|
849
850
|
}
|
|
850
851
|
const isWrappedCommonJS = isCommonJS === IS_WRAPPED_COMMONJS;
|
|
851
852
|
fullyAnalyzedModules[dependencyId] = true;
|
|
853
|
+
const moduleInfo =
|
|
854
|
+
isWrappedCommonJS && !isExternalWrapped
|
|
855
|
+
? rollupContext.getModuleInfo(dependencyId)
|
|
856
|
+
: null;
|
|
857
|
+
// For wrapped dependencies, annotate the generated require call as pure only
|
|
858
|
+
// when Rollup has module info and it explicitly reports no side effects.
|
|
859
|
+
// Note: For external Node built-ins (handled via EXTERNAL_SUFFIX), the module
|
|
860
|
+
// has not been loaded yet at this point and getModuleInfo returns null.
|
|
861
|
+
// Default to side effects = true in that case to be safe.
|
|
862
|
+
// Preserve Rollup's tri-state semantics (true | false | 'no-treeshake') when available.
|
|
863
|
+
const wrappedModuleSideEffects = !isWrappedCommonJS
|
|
864
|
+
? false
|
|
865
|
+
: moduleInfo?.moduleSideEffects ?? true;
|
|
852
866
|
return {
|
|
853
|
-
wrappedModuleSideEffects
|
|
854
|
-
isWrappedCommonJS && rollupContext.getModuleInfo(dependencyId).moduleSideEffects,
|
|
867
|
+
wrappedModuleSideEffects,
|
|
855
868
|
source: sources[index].source,
|
|
856
869
|
id: allowProxy
|
|
857
870
|
? wrapId(dependencyId, isWrappedCommonJS ? WRAPPED_SUFFIX : PROXY_SUFFIX)
|