@rollup/plugin-commonjs 24.1.0-0 → 25.0.0
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 +10 -8
- package/dist/es/index.js +10 -8
- 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 = "
|
|
14
|
+
var version = "25.0.0";
|
|
15
15
|
var peerDependencies = {
|
|
16
16
|
rollup: "^2.68.0||^3.0.0"
|
|
17
17
|
};
|
|
@@ -2064,6 +2064,7 @@ function commonjs(options = {}) {
|
|
|
2064
2064
|
let requireResolver;
|
|
2065
2065
|
|
|
2066
2066
|
function transformAndCheckExports(code, id) {
|
|
2067
|
+
const normalizedId = normalizePathSlashes(id);
|
|
2067
2068
|
const { isEsModule, hasDefaultExport, hasNamedExports, ast } = analyzeTopLevelStatements(
|
|
2068
2069
|
this.parse,
|
|
2069
2070
|
code,
|
|
@@ -2079,7 +2080,7 @@ function commonjs(options = {}) {
|
|
|
2079
2080
|
}
|
|
2080
2081
|
|
|
2081
2082
|
if (
|
|
2082
|
-
!dynamicRequireModules.has(
|
|
2083
|
+
!dynamicRequireModules.has(normalizedId) &&
|
|
2083
2084
|
(!(hasCjsKeywords(code, ignoreGlobal) || requireResolver.isRequiredId(id)) ||
|
|
2084
2085
|
(isEsModule && !options.transformMixedEsModules))
|
|
2085
2086
|
) {
|
|
@@ -2088,18 +2089,19 @@ function commonjs(options = {}) {
|
|
|
2088
2089
|
}
|
|
2089
2090
|
|
|
2090
2091
|
const needsRequireWrapper =
|
|
2091
|
-
!isEsModule &&
|
|
2092
|
-
(dynamicRequireModules.has(normalizePathSlashes(id)) || strictRequiresFilter(id));
|
|
2092
|
+
!isEsModule && (dynamicRequireModules.has(normalizedId) || strictRequiresFilter(id));
|
|
2093
2093
|
|
|
2094
2094
|
const checkDynamicRequire = (position) => {
|
|
2095
|
-
|
|
2095
|
+
const normalizedRequireRoot = normalizePathSlashes(dynamicRequireRoot);
|
|
2096
|
+
|
|
2097
|
+
if (normalizedId.indexOf(normalizedRequireRoot) !== 0) {
|
|
2096
2098
|
this.error(
|
|
2097
2099
|
{
|
|
2098
2100
|
code: 'DYNAMIC_REQUIRE_OUTSIDE_ROOT',
|
|
2099
|
-
|
|
2101
|
+
normalizedId,
|
|
2100
2102
|
dynamicRequireRoot,
|
|
2101
|
-
message: `"${
|
|
2102
|
-
|
|
2103
|
+
message: `"${normalizedId}" contains dynamic require statements but it is not within the current dynamicRequireRoot "${normalizedRequireRoot}". You should set dynamicRequireRoot to "${path.dirname(
|
|
2104
|
+
normalizedId
|
|
2103
2105
|
)}" or one of its parent directories.`
|
|
2104
2106
|
},
|
|
2105
2107
|
position
|
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 = "
|
|
10
|
+
var version = "25.0.0";
|
|
11
11
|
var peerDependencies = {
|
|
12
12
|
rollup: "^2.68.0||^3.0.0"
|
|
13
13
|
};
|
|
@@ -2060,6 +2060,7 @@ function commonjs(options = {}) {
|
|
|
2060
2060
|
let requireResolver;
|
|
2061
2061
|
|
|
2062
2062
|
function transformAndCheckExports(code, id) {
|
|
2063
|
+
const normalizedId = normalizePathSlashes(id);
|
|
2063
2064
|
const { isEsModule, hasDefaultExport, hasNamedExports, ast } = analyzeTopLevelStatements(
|
|
2064
2065
|
this.parse,
|
|
2065
2066
|
code,
|
|
@@ -2075,7 +2076,7 @@ function commonjs(options = {}) {
|
|
|
2075
2076
|
}
|
|
2076
2077
|
|
|
2077
2078
|
if (
|
|
2078
|
-
!dynamicRequireModules.has(
|
|
2079
|
+
!dynamicRequireModules.has(normalizedId) &&
|
|
2079
2080
|
(!(hasCjsKeywords(code, ignoreGlobal) || requireResolver.isRequiredId(id)) ||
|
|
2080
2081
|
(isEsModule && !options.transformMixedEsModules))
|
|
2081
2082
|
) {
|
|
@@ -2084,18 +2085,19 @@ function commonjs(options = {}) {
|
|
|
2084
2085
|
}
|
|
2085
2086
|
|
|
2086
2087
|
const needsRequireWrapper =
|
|
2087
|
-
!isEsModule &&
|
|
2088
|
-
(dynamicRequireModules.has(normalizePathSlashes(id)) || strictRequiresFilter(id));
|
|
2088
|
+
!isEsModule && (dynamicRequireModules.has(normalizedId) || strictRequiresFilter(id));
|
|
2089
2089
|
|
|
2090
2090
|
const checkDynamicRequire = (position) => {
|
|
2091
|
-
|
|
2091
|
+
const normalizedRequireRoot = normalizePathSlashes(dynamicRequireRoot);
|
|
2092
|
+
|
|
2093
|
+
if (normalizedId.indexOf(normalizedRequireRoot) !== 0) {
|
|
2092
2094
|
this.error(
|
|
2093
2095
|
{
|
|
2094
2096
|
code: 'DYNAMIC_REQUIRE_OUTSIDE_ROOT',
|
|
2095
|
-
|
|
2097
|
+
normalizedId,
|
|
2096
2098
|
dynamicRequireRoot,
|
|
2097
|
-
message: `"${
|
|
2098
|
-
|
|
2099
|
+
message: `"${normalizedId}" contains dynamic require statements but it is not within the current dynamicRequireRoot "${normalizedRequireRoot}". You should set dynamicRequireRoot to "${dirname(
|
|
2100
|
+
normalizedId
|
|
2099
2101
|
)}" or one of its parent directories.`
|
|
2100
2102
|
},
|
|
2101
2103
|
position
|