rollup 4.60.0 → 4.60.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/bin/rollup +3 -3
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +382 -27
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +614 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +614 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +382 -27
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +46 -47
package/dist/shared/parseAst.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.60.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.60.2
|
|
4
|
+
Sat, 18 Apr 2026 13:58:01 GMT - commit a6be82b8abd747458afdc7484319f7b5deb92535
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
|
|
|
42
42
|
|
|
43
43
|
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
|
44
44
|
|
|
45
|
-
var version = "4.60.
|
|
45
|
+
var version = "4.60.2";
|
|
46
46
|
|
|
47
47
|
function ensureArray$1(items) {
|
|
48
48
|
if (Array.isArray(items)) {
|
|
@@ -980,6 +980,8 @@ function requireConstants () {
|
|
|
980
980
|
const WIN_SLASH = '\\\\/';
|
|
981
981
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
982
982
|
|
|
983
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
984
|
+
|
|
983
985
|
/**
|
|
984
986
|
* Posix glob regex
|
|
985
987
|
*/
|
|
@@ -1046,6 +1048,7 @@ function requireConstants () {
|
|
|
1046
1048
|
*/
|
|
1047
1049
|
|
|
1048
1050
|
const POSIX_REGEX_SOURCE = {
|
|
1051
|
+
__proto__: null,
|
|
1049
1052
|
alnum: 'a-zA-Z0-9',
|
|
1050
1053
|
alpha: 'a-zA-Z',
|
|
1051
1054
|
ascii: '\\x00-\\x7F',
|
|
@@ -1063,6 +1066,7 @@ function requireConstants () {
|
|
|
1063
1066
|
};
|
|
1064
1067
|
|
|
1065
1068
|
constants = {
|
|
1069
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
1066
1070
|
MAX_LENGTH: 1024 * 64,
|
|
1067
1071
|
POSIX_REGEX_SOURCE,
|
|
1068
1072
|
|
|
@@ -1684,6 +1688,277 @@ function requireParse () {
|
|
|
1684
1688
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1685
1689
|
};
|
|
1686
1690
|
|
|
1691
|
+
const splitTopLevel = input => {
|
|
1692
|
+
const parts = [];
|
|
1693
|
+
let bracket = 0;
|
|
1694
|
+
let paren = 0;
|
|
1695
|
+
let quote = 0;
|
|
1696
|
+
let value = '';
|
|
1697
|
+
let escaped = false;
|
|
1698
|
+
|
|
1699
|
+
for (const ch of input) {
|
|
1700
|
+
if (escaped === true) {
|
|
1701
|
+
value += ch;
|
|
1702
|
+
escaped = false;
|
|
1703
|
+
continue;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
if (ch === '\\') {
|
|
1707
|
+
value += ch;
|
|
1708
|
+
escaped = true;
|
|
1709
|
+
continue;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
if (ch === '"') {
|
|
1713
|
+
quote = quote === 1 ? 0 : 1;
|
|
1714
|
+
value += ch;
|
|
1715
|
+
continue;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
if (quote === 0) {
|
|
1719
|
+
if (ch === '[') {
|
|
1720
|
+
bracket++;
|
|
1721
|
+
} else if (ch === ']' && bracket > 0) {
|
|
1722
|
+
bracket--;
|
|
1723
|
+
} else if (bracket === 0) {
|
|
1724
|
+
if (ch === '(') {
|
|
1725
|
+
paren++;
|
|
1726
|
+
} else if (ch === ')' && paren > 0) {
|
|
1727
|
+
paren--;
|
|
1728
|
+
} else if (ch === '|' && paren === 0) {
|
|
1729
|
+
parts.push(value);
|
|
1730
|
+
value = '';
|
|
1731
|
+
continue;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
value += ch;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
parts.push(value);
|
|
1740
|
+
return parts;
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
const isPlainBranch = branch => {
|
|
1744
|
+
let escaped = false;
|
|
1745
|
+
|
|
1746
|
+
for (const ch of branch) {
|
|
1747
|
+
if (escaped === true) {
|
|
1748
|
+
escaped = false;
|
|
1749
|
+
continue;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
if (ch === '\\') {
|
|
1753
|
+
escaped = true;
|
|
1754
|
+
continue;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
1758
|
+
return false;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
return true;
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1765
|
+
const normalizeSimpleBranch = branch => {
|
|
1766
|
+
let value = branch.trim();
|
|
1767
|
+
let changed = true;
|
|
1768
|
+
|
|
1769
|
+
while (changed === true) {
|
|
1770
|
+
changed = false;
|
|
1771
|
+
|
|
1772
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
1773
|
+
value = value.slice(2, -1);
|
|
1774
|
+
changed = true;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
if (!isPlainBranch(value)) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
return value.replace(/\\(.)/g, '$1');
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
const hasRepeatedCharPrefixOverlap = branches => {
|
|
1786
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
1787
|
+
|
|
1788
|
+
for (let i = 0; i < values.length; i++) {
|
|
1789
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
1790
|
+
const a = values[i];
|
|
1791
|
+
const b = values[j];
|
|
1792
|
+
const char = a[0];
|
|
1793
|
+
|
|
1794
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
1799
|
+
return true;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
return false;
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
1808
|
+
if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
let bracket = 0;
|
|
1813
|
+
let paren = 0;
|
|
1814
|
+
let quote = 0;
|
|
1815
|
+
let escaped = false;
|
|
1816
|
+
|
|
1817
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
1818
|
+
const ch = pattern[i];
|
|
1819
|
+
|
|
1820
|
+
if (escaped === true) {
|
|
1821
|
+
escaped = false;
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
if (ch === '\\') {
|
|
1826
|
+
escaped = true;
|
|
1827
|
+
continue;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
if (ch === '"') {
|
|
1831
|
+
quote = quote === 1 ? 0 : 1;
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
if (quote === 1) {
|
|
1836
|
+
continue;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
if (ch === '[') {
|
|
1840
|
+
bracket++;
|
|
1841
|
+
continue;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
if (ch === ']' && bracket > 0) {
|
|
1845
|
+
bracket--;
|
|
1846
|
+
continue;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
if (bracket > 0) {
|
|
1850
|
+
continue;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
if (ch === '(') {
|
|
1854
|
+
paren++;
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
if (ch === ')') {
|
|
1859
|
+
paren--;
|
|
1860
|
+
|
|
1861
|
+
if (paren === 0) {
|
|
1862
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
return {
|
|
1867
|
+
type: pattern[0],
|
|
1868
|
+
body: pattern.slice(2, i),
|
|
1869
|
+
end: i
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
const getStarExtglobSequenceOutput = pattern => {
|
|
1877
|
+
let index = 0;
|
|
1878
|
+
const chars = [];
|
|
1879
|
+
|
|
1880
|
+
while (index < pattern.length) {
|
|
1881
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
1882
|
+
|
|
1883
|
+
if (!match || match.type !== '*') {
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
const branches = splitTopLevel(match.body).map(branch => branch.trim());
|
|
1888
|
+
if (branches.length !== 1) {
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
1893
|
+
if (!branch || branch.length !== 1) {
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
chars.push(branch);
|
|
1898
|
+
index += match.end + 1;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
if (chars.length < 1) {
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
const source = chars.length === 1
|
|
1906
|
+
? utils.escapeRegex(chars[0])
|
|
1907
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
1908
|
+
|
|
1909
|
+
return `${source}*`;
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
const repeatedExtglobRecursion = pattern => {
|
|
1913
|
+
let depth = 0;
|
|
1914
|
+
let value = pattern.trim();
|
|
1915
|
+
let match = parseRepeatedExtglob(value);
|
|
1916
|
+
|
|
1917
|
+
while (match) {
|
|
1918
|
+
depth++;
|
|
1919
|
+
value = match.body.trim();
|
|
1920
|
+
match = parseRepeatedExtglob(value);
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
return depth;
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
1927
|
+
if (options.maxExtglobRecursion === false) {
|
|
1928
|
+
return { risky: false };
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
const max =
|
|
1932
|
+
typeof options.maxExtglobRecursion === 'number'
|
|
1933
|
+
? options.maxExtglobRecursion
|
|
1934
|
+
: constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
1935
|
+
|
|
1936
|
+
const branches = splitTopLevel(body).map(branch => branch.trim());
|
|
1937
|
+
|
|
1938
|
+
if (branches.length > 1) {
|
|
1939
|
+
if (
|
|
1940
|
+
branches.some(branch => branch === '') ||
|
|
1941
|
+
branches.some(branch => /^[*?]+$/.test(branch)) ||
|
|
1942
|
+
hasRepeatedCharPrefixOverlap(branches)
|
|
1943
|
+
) {
|
|
1944
|
+
return { risky: true };
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
for (const branch of branches) {
|
|
1949
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
1950
|
+
if (safeOutput) {
|
|
1951
|
+
return { risky: true, safeOutput };
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
1955
|
+
return { risky: true };
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
return { risky: false };
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1687
1962
|
/**
|
|
1688
1963
|
* Parse the given input string.
|
|
1689
1964
|
* @param {String} input
|
|
@@ -1864,6 +2139,8 @@ function requireParse () {
|
|
|
1864
2139
|
token.prev = prev;
|
|
1865
2140
|
token.parens = state.parens;
|
|
1866
2141
|
token.output = state.output;
|
|
2142
|
+
token.startIndex = state.index;
|
|
2143
|
+
token.tokensIndex = tokens.length;
|
|
1867
2144
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
1868
2145
|
|
|
1869
2146
|
increment('parens');
|
|
@@ -1873,6 +2150,34 @@ function requireParse () {
|
|
|
1873
2150
|
};
|
|
1874
2151
|
|
|
1875
2152
|
const extglobClose = token => {
|
|
2153
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
2154
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
2155
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
2156
|
+
|
|
2157
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
2158
|
+
const safeOutput = analysis.safeOutput
|
|
2159
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
2160
|
+
: undefined;
|
|
2161
|
+
const open = tokens[token.tokensIndex];
|
|
2162
|
+
|
|
2163
|
+
open.type = 'text';
|
|
2164
|
+
open.value = literal;
|
|
2165
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
2166
|
+
|
|
2167
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
2168
|
+
tokens[i].value = '';
|
|
2169
|
+
tokens[i].output = '';
|
|
2170
|
+
delete tokens[i].suffix;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
state.output = token.output + open.output;
|
|
2174
|
+
state.backtrack = true;
|
|
2175
|
+
|
|
2176
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
2177
|
+
decrement('parens');
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
1876
2181
|
let output = token.close + (opts.capture ? ')' : '');
|
|
1877
2182
|
let rest;
|
|
1878
2183
|
|
|
@@ -2965,6 +3270,14 @@ function requirePicomatch$1 () {
|
|
|
2965
3270
|
* Compile a regular expression from the `state` object returned by the
|
|
2966
3271
|
* [parse()](#parse) method.
|
|
2967
3272
|
*
|
|
3273
|
+
* ```js
|
|
3274
|
+
* const picomatch = require('picomatch');
|
|
3275
|
+
* const state = picomatch.parse('*.js');
|
|
3276
|
+
* // picomatch.compileRe(state[, options]);
|
|
3277
|
+
*
|
|
3278
|
+
* console.log(picomatch.compileRe(state));
|
|
3279
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
3280
|
+
* ```
|
|
2968
3281
|
* @param {Object} `state`
|
|
2969
3282
|
* @param {Object} `options`
|
|
2970
3283
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -3000,10 +3313,10 @@ function requirePicomatch$1 () {
|
|
|
3000
3313
|
*
|
|
3001
3314
|
* ```js
|
|
3002
3315
|
* const picomatch = require('picomatch');
|
|
3003
|
-
*
|
|
3004
|
-
* // picomatch.compileRe(state[, options]);
|
|
3316
|
+
* // picomatch.makeRe(state[, options]);
|
|
3005
3317
|
*
|
|
3006
|
-
*
|
|
3318
|
+
* const result = picomatch.makeRe('*.js');
|
|
3319
|
+
* console.log(result);
|
|
3007
3320
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
3008
3321
|
* ```
|
|
3009
3322
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -3422,7 +3735,7 @@ class PluginDriver {
|
|
|
3422
3735
|
* Run a sync plugin hook and return the result.
|
|
3423
3736
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
3424
3737
|
* @param args Arguments passed to the plugin hook.
|
|
3425
|
-
* @param plugin The
|
|
3738
|
+
* @param plugin The actual plugin
|
|
3426
3739
|
* @param replaceContext When passed, the plugin context can be overridden.
|
|
3427
3740
|
*/
|
|
3428
3741
|
runHookSync(hookName, parameters, plugin, replaceContext) {
|
|
@@ -10758,7 +11071,7 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
10758
11071
|
: null, options);
|
|
10759
11072
|
}
|
|
10760
11073
|
else if (this.variable.getOriginalVariable() !== this.variable) {
|
|
10761
|
-
// Remove altogether to prevent
|
|
11074
|
+
// Remove altogether to prevent redeclaring the same variable
|
|
10762
11075
|
treeshakeNode(this, code, start, end);
|
|
10763
11076
|
return;
|
|
10764
11077
|
}
|
|
@@ -12309,6 +12622,8 @@ const builtinModules = [
|
|
|
12309
12622
|
"stream",
|
|
12310
12623
|
"node:stream/consumers",
|
|
12311
12624
|
"stream/consumers",
|
|
12625
|
+
"node:stream/iter",
|
|
12626
|
+
"stream/iter",
|
|
12312
12627
|
"node:stream/promises",
|
|
12313
12628
|
"stream/promises",
|
|
12314
12629
|
"node:stream/web",
|
|
@@ -12342,7 +12657,9 @@ const builtinModules = [
|
|
|
12342
12657
|
"node:worker_threads",
|
|
12343
12658
|
"worker_threads",
|
|
12344
12659
|
"node:zlib",
|
|
12345
|
-
"zlib"
|
|
12660
|
+
"zlib",
|
|
12661
|
+
"node:zlib/iter",
|
|
12662
|
+
"zlib/iter"
|
|
12346
12663
|
];
|
|
12347
12664
|
|
|
12348
12665
|
const nodeBuiltins = new Set(builtinModules);
|
|
@@ -18471,7 +18788,7 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
18471
18788
|
identifier: null,
|
|
18472
18789
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
18473
18790
|
};
|
|
18474
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain) {
|
|
18791
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain, sideEffectModules, exportOrReexportModules) {
|
|
18475
18792
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
18476
18793
|
if (searchedModules) {
|
|
18477
18794
|
if (searchedModules.has(target)) {
|
|
@@ -18483,10 +18800,12 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
18483
18800
|
searchedNamesAndModules.set(name, new Set([target]));
|
|
18484
18801
|
}
|
|
18485
18802
|
return target.getVariableForExportName(name, {
|
|
18803
|
+
exportOrReexportModules,
|
|
18486
18804
|
importChain,
|
|
18487
18805
|
importerForSideEffects,
|
|
18488
18806
|
isExportAllSearch,
|
|
18489
|
-
searchedNamesAndModules
|
|
18807
|
+
searchedNamesAndModules,
|
|
18808
|
+
sideEffectModules
|
|
18490
18809
|
});
|
|
18491
18810
|
}
|
|
18492
18811
|
function getAndExtendSideEffectModules(variable, module) {
|
|
@@ -18807,7 +19126,7 @@ class Module {
|
|
|
18807
19126
|
}
|
|
18808
19127
|
return this.syntheticNamespace;
|
|
18809
19128
|
}
|
|
18810
|
-
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
|
|
19129
|
+
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = parseAst_js.EMPTY_OBJECT) {
|
|
18811
19130
|
if (name[0] === '*') {
|
|
18812
19131
|
if (name.length === 1) {
|
|
18813
19132
|
// export * from './other'
|
|
@@ -18822,7 +19141,7 @@ class Module {
|
|
|
18822
19141
|
// export { foo } from './other'
|
|
18823
19142
|
const reexportDeclaration = this.reexportDescriptions.get(name);
|
|
18824
19143
|
if (reexportDeclaration) {
|
|
18825
|
-
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id]);
|
|
19144
|
+
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id], sideEffectModules, exportOrReexportModules);
|
|
18826
19145
|
if (!variable) {
|
|
18827
19146
|
return this.error(parseAst_js.logMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id, !!options?.missingButExportExists), reexportDeclaration.start);
|
|
18828
19147
|
}
|
|
@@ -18832,6 +19151,10 @@ class Module {
|
|
|
18832
19151
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
18833
19152
|
}
|
|
18834
19153
|
}
|
|
19154
|
+
if (this.info.moduleSideEffects) {
|
|
19155
|
+
sideEffectModules?.add(this);
|
|
19156
|
+
}
|
|
19157
|
+
exportOrReexportModules?.add(this);
|
|
18835
19158
|
return [variable];
|
|
18836
19159
|
}
|
|
18837
19160
|
const exportDeclaration = this.exportDescriptions.get(name);
|
|
@@ -18841,8 +19164,10 @@ class Module {
|
|
|
18841
19164
|
}
|
|
18842
19165
|
const name = exportDeclaration.localName;
|
|
18843
19166
|
const variable = this.traceVariable(name, {
|
|
19167
|
+
exportOrReexportModules,
|
|
18844
19168
|
importerForSideEffects,
|
|
18845
|
-
searchedNamesAndModules
|
|
19169
|
+
searchedNamesAndModules,
|
|
19170
|
+
sideEffectModules
|
|
18846
19171
|
});
|
|
18847
19172
|
if (!variable) {
|
|
18848
19173
|
return [null, { missingButExportExists: true }];
|
|
@@ -18851,6 +19176,8 @@ class Module {
|
|
|
18851
19176
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
18852
19177
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
18853
19178
|
}
|
|
19179
|
+
sideEffectModules?.add(this);
|
|
19180
|
+
exportOrReexportModules?.add(this);
|
|
18854
19181
|
return [variable];
|
|
18855
19182
|
}
|
|
18856
19183
|
if (onlyExplicit) {
|
|
@@ -18861,6 +19188,19 @@ class Module {
|
|
|
18861
19188
|
this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, [...importChain, this.id]);
|
|
18862
19189
|
this.namespaceReexportsByName.set(name, foundNamespaceReexport);
|
|
18863
19190
|
if (foundNamespaceReexport[0]) {
|
|
19191
|
+
const [namespaceReexportVariable, namespaceReexportOptions] = foundNamespaceReexport;
|
|
19192
|
+
if (importerForSideEffects) {
|
|
19193
|
+
const { exportOrReexportModules, sideEffectModules } = namespaceReexportOptions;
|
|
19194
|
+
for (const module of exportOrReexportModules) {
|
|
19195
|
+
if (importerForSideEffects.alternativeReexportModules.has(namespaceReexportVariable)) {
|
|
19196
|
+
continue;
|
|
19197
|
+
}
|
|
19198
|
+
setAlternativeExporterIfCyclic(namespaceReexportVariable, importerForSideEffects, module);
|
|
19199
|
+
}
|
|
19200
|
+
for (const module of sideEffectModules) {
|
|
19201
|
+
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, namespaceReexportVariable, (getNewSet)).add(module);
|
|
19202
|
+
}
|
|
19203
|
+
}
|
|
18864
19204
|
return foundNamespaceReexport;
|
|
18865
19205
|
}
|
|
18866
19206
|
}
|
|
@@ -19064,7 +19404,7 @@ class Module {
|
|
|
19064
19404
|
transformFiles: this.transformFiles
|
|
19065
19405
|
};
|
|
19066
19406
|
}
|
|
19067
|
-
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
|
|
19407
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = parseAst_js.EMPTY_OBJECT) {
|
|
19068
19408
|
const localVariable = this.scope.variables.get(name);
|
|
19069
19409
|
if (localVariable) {
|
|
19070
19410
|
return localVariable;
|
|
@@ -19075,7 +19415,7 @@ class Module {
|
|
|
19075
19415
|
if (otherModule instanceof Module && importDescription.name === '*') {
|
|
19076
19416
|
return otherModule.namespace;
|
|
19077
19417
|
}
|
|
19078
|
-
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id]);
|
|
19418
|
+
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id], sideEffectModules, exportOrReexportModules);
|
|
19079
19419
|
if (!declaration) {
|
|
19080
19420
|
return this.error(parseAst_js.logMissingExport(importDescription.name, this.id, otherModule.id, !!options?.missingButExportExists), importDescription.start);
|
|
19081
19421
|
}
|
|
@@ -19296,6 +19636,8 @@ class Module {
|
|
|
19296
19636
|
let foundSyntheticDeclaration = null;
|
|
19297
19637
|
const foundInternalDeclarations = new Map();
|
|
19298
19638
|
const foundExternalDeclarations = new Set();
|
|
19639
|
+
const sideEffectModules = new Set();
|
|
19640
|
+
const exportOrReexportModules = new Set();
|
|
19299
19641
|
for (const module of this.exportAllModules) {
|
|
19300
19642
|
// Synthetic namespaces should not hide "regular" exports of the same name
|
|
19301
19643
|
if (module.info.syntheticNamedExports === name) {
|
|
@@ -19304,7 +19646,7 @@ class Module {
|
|
|
19304
19646
|
const [variable, options] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
19305
19647
|
// We are creating a copy to handle the case where the same binding is
|
|
19306
19648
|
// imported through different namespace reexports gracefully
|
|
19307
|
-
copyNameToModulesMap(searchedNamesAndModules), importChain);
|
|
19649
|
+
copyNameToModulesMap(searchedNamesAndModules), importChain, sideEffectModules, exportOrReexportModules);
|
|
19308
19650
|
if (module instanceof ExternalModule || options?.indirectExternal) {
|
|
19309
19651
|
foundExternalDeclarations.add(variable);
|
|
19310
19652
|
}
|
|
@@ -19321,7 +19663,7 @@ class Module {
|
|
|
19321
19663
|
const foundDeclarationList = [...foundInternalDeclarations];
|
|
19322
19664
|
const usedDeclaration = foundDeclarationList[0][0];
|
|
19323
19665
|
if (foundDeclarationList.length === 1) {
|
|
19324
|
-
return [usedDeclaration];
|
|
19666
|
+
return [usedDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
19325
19667
|
}
|
|
19326
19668
|
this.options.onLog(parseAst_js.LOGLEVEL_WARN, parseAst_js.logNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
19327
19669
|
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
@@ -19333,10 +19675,13 @@ class Module {
|
|
|
19333
19675
|
if (foundDeclarationList.length > 1) {
|
|
19334
19676
|
this.options.onLog(parseAst_js.LOGLEVEL_WARN, parseAst_js.logAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
19335
19677
|
}
|
|
19336
|
-
return [
|
|
19678
|
+
return [
|
|
19679
|
+
usedDeclaration,
|
|
19680
|
+
{ exportOrReexportModules, indirectExternal: true, sideEffectModules }
|
|
19681
|
+
];
|
|
19337
19682
|
}
|
|
19338
19683
|
if (foundSyntheticDeclaration) {
|
|
19339
|
-
return [foundSyntheticDeclaration];
|
|
19684
|
+
return [foundSyntheticDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
19340
19685
|
}
|
|
19341
19686
|
return [null];
|
|
19342
19687
|
}
|
|
@@ -20742,6 +21087,16 @@ class Chunk {
|
|
|
20742
21087
|
}
|
|
20743
21088
|
setIdentifierRenderResolutions() {
|
|
20744
21089
|
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
21090
|
+
// Reset stale render names from previous output renderings of the same
|
|
21091
|
+
// module graph. Without this, variables that were renamed during a prior
|
|
21092
|
+
// output's import deconfliction (e.g. given a chunk-prefixed
|
|
21093
|
+
// `renderBaseName` like `vendor`) would carry that name into the next
|
|
21094
|
+
// output, producing invalid identifiers such as `function vendor.foo()`.
|
|
21095
|
+
for (const module of this.orderedModules) {
|
|
21096
|
+
for (const variable of module.scope.variables.values()) {
|
|
21097
|
+
variable.setRenderNames(null, null);
|
|
21098
|
+
}
|
|
21099
|
+
}
|
|
20745
21100
|
const syntheticExports = new Set();
|
|
20746
21101
|
for (const exportName of this.getExportNames()) {
|
|
20747
21102
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -22706,8 +23061,8 @@ class ModuleLoader {
|
|
|
22706
23061
|
for (const module of implicitlyLoadedAfterModules) {
|
|
22707
23062
|
entryModule.implicitlyLoadedAfter.add(module);
|
|
22708
23063
|
}
|
|
22709
|
-
for (const
|
|
22710
|
-
|
|
23064
|
+
for (const dependent of entryModule.implicitlyLoadedAfter) {
|
|
23065
|
+
dependent.implicitlyLoadedBefore.add(entryModule);
|
|
22711
23066
|
}
|
|
22712
23067
|
}
|
|
22713
23068
|
}
|
|
@@ -22981,8 +23336,8 @@ class ModuleLoader {
|
|
|
22981
23336
|
// be performed atomically
|
|
22982
23337
|
module.info.isEntry = true;
|
|
22983
23338
|
this.implicitEntryModules.delete(module);
|
|
22984
|
-
for (const
|
|
22985
|
-
|
|
23339
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23340
|
+
dependent.implicitlyLoadedBefore.delete(module);
|
|
22986
23341
|
}
|
|
22987
23342
|
module.implicitlyLoadedAfter.clear();
|
|
22988
23343
|
}
|
|
@@ -23276,9 +23631,9 @@ class Graph {
|
|
|
23276
23631
|
for (const externalModule of this.externalModules)
|
|
23277
23632
|
externalModule.warnUnusedImports();
|
|
23278
23633
|
for (const module of this.implicitEntryModules) {
|
|
23279
|
-
for (const
|
|
23280
|
-
if (!(
|
|
23281
|
-
parseAst_js.error(parseAst_js.logImplicitDependantIsNotIncluded(
|
|
23634
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23635
|
+
if (!(dependent.info.isEntry || dependent.isIncluded())) {
|
|
23636
|
+
parseAst_js.error(parseAst_js.logImplicitDependantIsNotIncluded(dependent));
|
|
23282
23637
|
}
|
|
23283
23638
|
}
|
|
23284
23639
|
}
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED