@rollup/plugin-commonjs 26.0.0 → 26.0.2
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 +9 -3
- package/dist/es/index.js +9 -3
- 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 = "26.0.
|
|
14
|
+
var version = "26.0.2";
|
|
15
15
|
var peerDependencies = {
|
|
16
16
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
|
17
17
|
};
|
|
@@ -178,7 +178,7 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
|
|
|
178
178
|
isNegated
|
|
179
179
|
? dynamicRequireModules.delete(targetPath)
|
|
180
180
|
: dynamicRequireModules.set(targetPath, resolvedPath);
|
|
181
|
-
for (const path$1 of glob
|
|
181
|
+
for (const path$1 of glob.glob
|
|
182
182
|
.sync(isNegated ? pattern.substr(1) : pattern)
|
|
183
183
|
.sort((a, b) => a.localeCompare(b, 'en'))) {
|
|
184
184
|
const resolvedPath = path.resolve(path$1);
|
|
@@ -1531,6 +1531,7 @@ async function transformCommonjs(
|
|
|
1531
1531
|
const topLevelAssignments = new Set();
|
|
1532
1532
|
const topLevelDefineCompiledEsmExpressions = [];
|
|
1533
1533
|
const replacedGlobal = [];
|
|
1534
|
+
const replacedThis = [];
|
|
1534
1535
|
const replacedDynamicRequires = [];
|
|
1535
1536
|
const importedVariables = new Set();
|
|
1536
1537
|
const indentExclusionRanges = [];
|
|
@@ -1798,7 +1799,7 @@ async function transformCommonjs(
|
|
|
1798
1799
|
if (lexicalDepth === 0 && !classBodyDepth) {
|
|
1799
1800
|
uses.global = true;
|
|
1800
1801
|
if (!ignoreGlobal) {
|
|
1801
|
-
|
|
1802
|
+
replacedThis.push(node);
|
|
1802
1803
|
}
|
|
1803
1804
|
}
|
|
1804
1805
|
return;
|
|
@@ -1873,6 +1874,11 @@ async function transformCommonjs(
|
|
|
1873
1874
|
storeName: true
|
|
1874
1875
|
});
|
|
1875
1876
|
}
|
|
1877
|
+
for (const node of replacedThis) {
|
|
1878
|
+
magicString.overwrite(node.start, node.end, exportsName, {
|
|
1879
|
+
storeName: true
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1876
1882
|
for (const node of replacedDynamicRequires) {
|
|
1877
1883
|
magicString.overwrite(
|
|
1878
1884
|
node.start,
|
package/dist/es/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { basename, extname, dirname, relative, resolve, join, sep } from 'path';
|
|
|
2
2
|
import { makeLegalIdentifier, createFilter, attachScopes, extractAssignedNames } from '@rollup/pluginutils';
|
|
3
3
|
import { existsSync, readFileSync, statSync } from 'fs';
|
|
4
4
|
import getCommonDir from 'commondir';
|
|
5
|
-
import glob from 'glob';
|
|
5
|
+
import { glob } from 'glob';
|
|
6
6
|
import { walk } from 'estree-walker';
|
|
7
7
|
import MagicString from 'magic-string';
|
|
8
8
|
import isReference from 'is-reference';
|
|
9
9
|
|
|
10
|
-
var version = "26.0.
|
|
10
|
+
var version = "26.0.2";
|
|
11
11
|
var peerDependencies = {
|
|
12
12
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
|
13
13
|
};
|
|
@@ -1527,6 +1527,7 @@ async function transformCommonjs(
|
|
|
1527
1527
|
const topLevelAssignments = new Set();
|
|
1528
1528
|
const topLevelDefineCompiledEsmExpressions = [];
|
|
1529
1529
|
const replacedGlobal = [];
|
|
1530
|
+
const replacedThis = [];
|
|
1530
1531
|
const replacedDynamicRequires = [];
|
|
1531
1532
|
const importedVariables = new Set();
|
|
1532
1533
|
const indentExclusionRanges = [];
|
|
@@ -1794,7 +1795,7 @@ async function transformCommonjs(
|
|
|
1794
1795
|
if (lexicalDepth === 0 && !classBodyDepth) {
|
|
1795
1796
|
uses.global = true;
|
|
1796
1797
|
if (!ignoreGlobal) {
|
|
1797
|
-
|
|
1798
|
+
replacedThis.push(node);
|
|
1798
1799
|
}
|
|
1799
1800
|
}
|
|
1800
1801
|
return;
|
|
@@ -1869,6 +1870,11 @@ async function transformCommonjs(
|
|
|
1869
1870
|
storeName: true
|
|
1870
1871
|
});
|
|
1871
1872
|
}
|
|
1873
|
+
for (const node of replacedThis) {
|
|
1874
|
+
magicString.overwrite(node.start, node.end, exportsName, {
|
|
1875
|
+
storeName: true
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1872
1878
|
for (const node of replacedDynamicRequires) {
|
|
1873
1879
|
magicString.overwrite(
|
|
1874
1880
|
node.start,
|