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
|
@@ -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
|
|
|
@@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
|
|
|
27
27
|
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version = "4.60.
|
|
30
|
+
var version = "4.60.2";
|
|
31
31
|
|
|
32
32
|
// src/vlq.ts
|
|
33
33
|
var comma = ",".charCodeAt(0);
|
|
@@ -6981,7 +6981,7 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
6981
6981
|
: null, options);
|
|
6982
6982
|
}
|
|
6983
6983
|
else if (this.variable.getOriginalVariable() !== this.variable) {
|
|
6984
|
-
// Remove altogether to prevent
|
|
6984
|
+
// Remove altogether to prevent redeclaring the same variable
|
|
6985
6985
|
treeshakeNode(this, code, start, end);
|
|
6986
6986
|
return;
|
|
6987
6987
|
}
|
|
@@ -8532,6 +8532,8 @@ const builtinModules = [
|
|
|
8532
8532
|
"stream",
|
|
8533
8533
|
"node:stream/consumers",
|
|
8534
8534
|
"stream/consumers",
|
|
8535
|
+
"node:stream/iter",
|
|
8536
|
+
"stream/iter",
|
|
8535
8537
|
"node:stream/promises",
|
|
8536
8538
|
"stream/promises",
|
|
8537
8539
|
"node:stream/web",
|
|
@@ -8565,7 +8567,9 @@ const builtinModules = [
|
|
|
8565
8567
|
"node:worker_threads",
|
|
8566
8568
|
"worker_threads",
|
|
8567
8569
|
"node:zlib",
|
|
8568
|
-
"zlib"
|
|
8570
|
+
"zlib",
|
|
8571
|
+
"node:zlib/iter",
|
|
8572
|
+
"zlib/iter"
|
|
8569
8573
|
];
|
|
8570
8574
|
|
|
8571
8575
|
const nodeBuiltins = new Set(builtinModules);
|
|
@@ -9200,6 +9204,8 @@ function requireConstants () {
|
|
|
9200
9204
|
const WIN_SLASH = '\\\\/';
|
|
9201
9205
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
9202
9206
|
|
|
9207
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
9208
|
+
|
|
9203
9209
|
/**
|
|
9204
9210
|
* Posix glob regex
|
|
9205
9211
|
*/
|
|
@@ -9266,6 +9272,7 @@ function requireConstants () {
|
|
|
9266
9272
|
*/
|
|
9267
9273
|
|
|
9268
9274
|
const POSIX_REGEX_SOURCE = {
|
|
9275
|
+
__proto__: null,
|
|
9269
9276
|
alnum: 'a-zA-Z0-9',
|
|
9270
9277
|
alpha: 'a-zA-Z',
|
|
9271
9278
|
ascii: '\\x00-\\x7F',
|
|
@@ -9283,6 +9290,7 @@ function requireConstants () {
|
|
|
9283
9290
|
};
|
|
9284
9291
|
|
|
9285
9292
|
constants = {
|
|
9293
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
9286
9294
|
MAX_LENGTH: 1024 * 64,
|
|
9287
9295
|
POSIX_REGEX_SOURCE,
|
|
9288
9296
|
|
|
@@ -9904,6 +9912,277 @@ function requireParse () {
|
|
|
9904
9912
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
9905
9913
|
};
|
|
9906
9914
|
|
|
9915
|
+
const splitTopLevel = input => {
|
|
9916
|
+
const parts = [];
|
|
9917
|
+
let bracket = 0;
|
|
9918
|
+
let paren = 0;
|
|
9919
|
+
let quote = 0;
|
|
9920
|
+
let value = '';
|
|
9921
|
+
let escaped = false;
|
|
9922
|
+
|
|
9923
|
+
for (const ch of input) {
|
|
9924
|
+
if (escaped === true) {
|
|
9925
|
+
value += ch;
|
|
9926
|
+
escaped = false;
|
|
9927
|
+
continue;
|
|
9928
|
+
}
|
|
9929
|
+
|
|
9930
|
+
if (ch === '\\') {
|
|
9931
|
+
value += ch;
|
|
9932
|
+
escaped = true;
|
|
9933
|
+
continue;
|
|
9934
|
+
}
|
|
9935
|
+
|
|
9936
|
+
if (ch === '"') {
|
|
9937
|
+
quote = quote === 1 ? 0 : 1;
|
|
9938
|
+
value += ch;
|
|
9939
|
+
continue;
|
|
9940
|
+
}
|
|
9941
|
+
|
|
9942
|
+
if (quote === 0) {
|
|
9943
|
+
if (ch === '[') {
|
|
9944
|
+
bracket++;
|
|
9945
|
+
} else if (ch === ']' && bracket > 0) {
|
|
9946
|
+
bracket--;
|
|
9947
|
+
} else if (bracket === 0) {
|
|
9948
|
+
if (ch === '(') {
|
|
9949
|
+
paren++;
|
|
9950
|
+
} else if (ch === ')' && paren > 0) {
|
|
9951
|
+
paren--;
|
|
9952
|
+
} else if (ch === '|' && paren === 0) {
|
|
9953
|
+
parts.push(value);
|
|
9954
|
+
value = '';
|
|
9955
|
+
continue;
|
|
9956
|
+
}
|
|
9957
|
+
}
|
|
9958
|
+
}
|
|
9959
|
+
|
|
9960
|
+
value += ch;
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9963
|
+
parts.push(value);
|
|
9964
|
+
return parts;
|
|
9965
|
+
};
|
|
9966
|
+
|
|
9967
|
+
const isPlainBranch = branch => {
|
|
9968
|
+
let escaped = false;
|
|
9969
|
+
|
|
9970
|
+
for (const ch of branch) {
|
|
9971
|
+
if (escaped === true) {
|
|
9972
|
+
escaped = false;
|
|
9973
|
+
continue;
|
|
9974
|
+
}
|
|
9975
|
+
|
|
9976
|
+
if (ch === '\\') {
|
|
9977
|
+
escaped = true;
|
|
9978
|
+
continue;
|
|
9979
|
+
}
|
|
9980
|
+
|
|
9981
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
9982
|
+
return false;
|
|
9983
|
+
}
|
|
9984
|
+
}
|
|
9985
|
+
|
|
9986
|
+
return true;
|
|
9987
|
+
};
|
|
9988
|
+
|
|
9989
|
+
const normalizeSimpleBranch = branch => {
|
|
9990
|
+
let value = branch.trim();
|
|
9991
|
+
let changed = true;
|
|
9992
|
+
|
|
9993
|
+
while (changed === true) {
|
|
9994
|
+
changed = false;
|
|
9995
|
+
|
|
9996
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
9997
|
+
value = value.slice(2, -1);
|
|
9998
|
+
changed = true;
|
|
9999
|
+
}
|
|
10000
|
+
}
|
|
10001
|
+
|
|
10002
|
+
if (!isPlainBranch(value)) {
|
|
10003
|
+
return;
|
|
10004
|
+
}
|
|
10005
|
+
|
|
10006
|
+
return value.replace(/\\(.)/g, '$1');
|
|
10007
|
+
};
|
|
10008
|
+
|
|
10009
|
+
const hasRepeatedCharPrefixOverlap = branches => {
|
|
10010
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
10011
|
+
|
|
10012
|
+
for (let i = 0; i < values.length; i++) {
|
|
10013
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
10014
|
+
const a = values[i];
|
|
10015
|
+
const b = values[j];
|
|
10016
|
+
const char = a[0];
|
|
10017
|
+
|
|
10018
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
10019
|
+
continue;
|
|
10020
|
+
}
|
|
10021
|
+
|
|
10022
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
10023
|
+
return true;
|
|
10024
|
+
}
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10027
|
+
|
|
10028
|
+
return false;
|
|
10029
|
+
};
|
|
10030
|
+
|
|
10031
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
10032
|
+
if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
|
|
10033
|
+
return;
|
|
10034
|
+
}
|
|
10035
|
+
|
|
10036
|
+
let bracket = 0;
|
|
10037
|
+
let paren = 0;
|
|
10038
|
+
let quote = 0;
|
|
10039
|
+
let escaped = false;
|
|
10040
|
+
|
|
10041
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
10042
|
+
const ch = pattern[i];
|
|
10043
|
+
|
|
10044
|
+
if (escaped === true) {
|
|
10045
|
+
escaped = false;
|
|
10046
|
+
continue;
|
|
10047
|
+
}
|
|
10048
|
+
|
|
10049
|
+
if (ch === '\\') {
|
|
10050
|
+
escaped = true;
|
|
10051
|
+
continue;
|
|
10052
|
+
}
|
|
10053
|
+
|
|
10054
|
+
if (ch === '"') {
|
|
10055
|
+
quote = quote === 1 ? 0 : 1;
|
|
10056
|
+
continue;
|
|
10057
|
+
}
|
|
10058
|
+
|
|
10059
|
+
if (quote === 1) {
|
|
10060
|
+
continue;
|
|
10061
|
+
}
|
|
10062
|
+
|
|
10063
|
+
if (ch === '[') {
|
|
10064
|
+
bracket++;
|
|
10065
|
+
continue;
|
|
10066
|
+
}
|
|
10067
|
+
|
|
10068
|
+
if (ch === ']' && bracket > 0) {
|
|
10069
|
+
bracket--;
|
|
10070
|
+
continue;
|
|
10071
|
+
}
|
|
10072
|
+
|
|
10073
|
+
if (bracket > 0) {
|
|
10074
|
+
continue;
|
|
10075
|
+
}
|
|
10076
|
+
|
|
10077
|
+
if (ch === '(') {
|
|
10078
|
+
paren++;
|
|
10079
|
+
continue;
|
|
10080
|
+
}
|
|
10081
|
+
|
|
10082
|
+
if (ch === ')') {
|
|
10083
|
+
paren--;
|
|
10084
|
+
|
|
10085
|
+
if (paren === 0) {
|
|
10086
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
10087
|
+
return;
|
|
10088
|
+
}
|
|
10089
|
+
|
|
10090
|
+
return {
|
|
10091
|
+
type: pattern[0],
|
|
10092
|
+
body: pattern.slice(2, i),
|
|
10093
|
+
end: i
|
|
10094
|
+
};
|
|
10095
|
+
}
|
|
10096
|
+
}
|
|
10097
|
+
}
|
|
10098
|
+
};
|
|
10099
|
+
|
|
10100
|
+
const getStarExtglobSequenceOutput = pattern => {
|
|
10101
|
+
let index = 0;
|
|
10102
|
+
const chars = [];
|
|
10103
|
+
|
|
10104
|
+
while (index < pattern.length) {
|
|
10105
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
10106
|
+
|
|
10107
|
+
if (!match || match.type !== '*') {
|
|
10108
|
+
return;
|
|
10109
|
+
}
|
|
10110
|
+
|
|
10111
|
+
const branches = splitTopLevel(match.body).map(branch => branch.trim());
|
|
10112
|
+
if (branches.length !== 1) {
|
|
10113
|
+
return;
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
10117
|
+
if (!branch || branch.length !== 1) {
|
|
10118
|
+
return;
|
|
10119
|
+
}
|
|
10120
|
+
|
|
10121
|
+
chars.push(branch);
|
|
10122
|
+
index += match.end + 1;
|
|
10123
|
+
}
|
|
10124
|
+
|
|
10125
|
+
if (chars.length < 1) {
|
|
10126
|
+
return;
|
|
10127
|
+
}
|
|
10128
|
+
|
|
10129
|
+
const source = chars.length === 1
|
|
10130
|
+
? utils.escapeRegex(chars[0])
|
|
10131
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
10132
|
+
|
|
10133
|
+
return `${source}*`;
|
|
10134
|
+
};
|
|
10135
|
+
|
|
10136
|
+
const repeatedExtglobRecursion = pattern => {
|
|
10137
|
+
let depth = 0;
|
|
10138
|
+
let value = pattern.trim();
|
|
10139
|
+
let match = parseRepeatedExtglob(value);
|
|
10140
|
+
|
|
10141
|
+
while (match) {
|
|
10142
|
+
depth++;
|
|
10143
|
+
value = match.body.trim();
|
|
10144
|
+
match = parseRepeatedExtglob(value);
|
|
10145
|
+
}
|
|
10146
|
+
|
|
10147
|
+
return depth;
|
|
10148
|
+
};
|
|
10149
|
+
|
|
10150
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
10151
|
+
if (options.maxExtglobRecursion === false) {
|
|
10152
|
+
return { risky: false };
|
|
10153
|
+
}
|
|
10154
|
+
|
|
10155
|
+
const max =
|
|
10156
|
+
typeof options.maxExtglobRecursion === 'number'
|
|
10157
|
+
? options.maxExtglobRecursion
|
|
10158
|
+
: constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
10159
|
+
|
|
10160
|
+
const branches = splitTopLevel(body).map(branch => branch.trim());
|
|
10161
|
+
|
|
10162
|
+
if (branches.length > 1) {
|
|
10163
|
+
if (
|
|
10164
|
+
branches.some(branch => branch === '') ||
|
|
10165
|
+
branches.some(branch => /^[*?]+$/.test(branch)) ||
|
|
10166
|
+
hasRepeatedCharPrefixOverlap(branches)
|
|
10167
|
+
) {
|
|
10168
|
+
return { risky: true };
|
|
10169
|
+
}
|
|
10170
|
+
}
|
|
10171
|
+
|
|
10172
|
+
for (const branch of branches) {
|
|
10173
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
10174
|
+
if (safeOutput) {
|
|
10175
|
+
return { risky: true, safeOutput };
|
|
10176
|
+
}
|
|
10177
|
+
|
|
10178
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
10179
|
+
return { risky: true };
|
|
10180
|
+
}
|
|
10181
|
+
}
|
|
10182
|
+
|
|
10183
|
+
return { risky: false };
|
|
10184
|
+
};
|
|
10185
|
+
|
|
9907
10186
|
/**
|
|
9908
10187
|
* Parse the given input string.
|
|
9909
10188
|
* @param {String} input
|
|
@@ -10084,6 +10363,8 @@ function requireParse () {
|
|
|
10084
10363
|
token.prev = prev;
|
|
10085
10364
|
token.parens = state.parens;
|
|
10086
10365
|
token.output = state.output;
|
|
10366
|
+
token.startIndex = state.index;
|
|
10367
|
+
token.tokensIndex = tokens.length;
|
|
10087
10368
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
10088
10369
|
|
|
10089
10370
|
increment('parens');
|
|
@@ -10093,6 +10374,34 @@ function requireParse () {
|
|
|
10093
10374
|
};
|
|
10094
10375
|
|
|
10095
10376
|
const extglobClose = token => {
|
|
10377
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
10378
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
10379
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
10380
|
+
|
|
10381
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
10382
|
+
const safeOutput = analysis.safeOutput
|
|
10383
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
10384
|
+
: undefined;
|
|
10385
|
+
const open = tokens[token.tokensIndex];
|
|
10386
|
+
|
|
10387
|
+
open.type = 'text';
|
|
10388
|
+
open.value = literal;
|
|
10389
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
10390
|
+
|
|
10391
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
10392
|
+
tokens[i].value = '';
|
|
10393
|
+
tokens[i].output = '';
|
|
10394
|
+
delete tokens[i].suffix;
|
|
10395
|
+
}
|
|
10396
|
+
|
|
10397
|
+
state.output = token.output + open.output;
|
|
10398
|
+
state.backtrack = true;
|
|
10399
|
+
|
|
10400
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
10401
|
+
decrement('parens');
|
|
10402
|
+
return;
|
|
10403
|
+
}
|
|
10404
|
+
|
|
10096
10405
|
let output = token.close + (opts.capture ? ')' : '');
|
|
10097
10406
|
let rest;
|
|
10098
10407
|
|
|
@@ -11185,6 +11494,14 @@ function requirePicomatch$1 () {
|
|
|
11185
11494
|
* Compile a regular expression from the `state` object returned by the
|
|
11186
11495
|
* [parse()](#parse) method.
|
|
11187
11496
|
*
|
|
11497
|
+
* ```js
|
|
11498
|
+
* const picomatch = require('picomatch');
|
|
11499
|
+
* const state = picomatch.parse('*.js');
|
|
11500
|
+
* // picomatch.compileRe(state[, options]);
|
|
11501
|
+
*
|
|
11502
|
+
* console.log(picomatch.compileRe(state));
|
|
11503
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11504
|
+
* ```
|
|
11188
11505
|
* @param {Object} `state`
|
|
11189
11506
|
* @param {Object} `options`
|
|
11190
11507
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -11220,10 +11537,10 @@ function requirePicomatch$1 () {
|
|
|
11220
11537
|
*
|
|
11221
11538
|
* ```js
|
|
11222
11539
|
* const picomatch = require('picomatch');
|
|
11223
|
-
*
|
|
11224
|
-
* // picomatch.compileRe(state[, options]);
|
|
11540
|
+
* // picomatch.makeRe(state[, options]);
|
|
11225
11541
|
*
|
|
11226
|
-
*
|
|
11542
|
+
* const result = picomatch.makeRe('*.js');
|
|
11543
|
+
* console.log(result);
|
|
11227
11544
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11228
11545
|
* ```
|
|
11229
11546
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -16868,7 +17185,7 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
16868
17185
|
identifier: null,
|
|
16869
17186
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
16870
17187
|
};
|
|
16871
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain) {
|
|
17188
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain, sideEffectModules, exportOrReexportModules) {
|
|
16872
17189
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
16873
17190
|
if (searchedModules) {
|
|
16874
17191
|
if (searchedModules.has(target)) {
|
|
@@ -16880,10 +17197,12 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
16880
17197
|
searchedNamesAndModules.set(name, new Set([target]));
|
|
16881
17198
|
}
|
|
16882
17199
|
return target.getVariableForExportName(name, {
|
|
17200
|
+
exportOrReexportModules,
|
|
16883
17201
|
importChain,
|
|
16884
17202
|
importerForSideEffects,
|
|
16885
17203
|
isExportAllSearch,
|
|
16886
|
-
searchedNamesAndModules
|
|
17204
|
+
searchedNamesAndModules,
|
|
17205
|
+
sideEffectModules
|
|
16887
17206
|
});
|
|
16888
17207
|
}
|
|
16889
17208
|
function getAndExtendSideEffectModules(variable, module) {
|
|
@@ -17204,7 +17523,7 @@ class Module {
|
|
|
17204
17523
|
}
|
|
17205
17524
|
return this.syntheticNamespace;
|
|
17206
17525
|
}
|
|
17207
|
-
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
17526
|
+
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = EMPTY_OBJECT) {
|
|
17208
17527
|
if (name[0] === '*') {
|
|
17209
17528
|
if (name.length === 1) {
|
|
17210
17529
|
// export * from './other'
|
|
@@ -17219,7 +17538,7 @@ class Module {
|
|
|
17219
17538
|
// export { foo } from './other'
|
|
17220
17539
|
const reexportDeclaration = this.reexportDescriptions.get(name);
|
|
17221
17540
|
if (reexportDeclaration) {
|
|
17222
|
-
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id]);
|
|
17541
|
+
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id], sideEffectModules, exportOrReexportModules);
|
|
17223
17542
|
if (!variable) {
|
|
17224
17543
|
return this.error(logMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id, !!options?.missingButExportExists), reexportDeclaration.start);
|
|
17225
17544
|
}
|
|
@@ -17229,6 +17548,10 @@ class Module {
|
|
|
17229
17548
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
17230
17549
|
}
|
|
17231
17550
|
}
|
|
17551
|
+
if (this.info.moduleSideEffects) {
|
|
17552
|
+
sideEffectModules?.add(this);
|
|
17553
|
+
}
|
|
17554
|
+
exportOrReexportModules?.add(this);
|
|
17232
17555
|
return [variable];
|
|
17233
17556
|
}
|
|
17234
17557
|
const exportDeclaration = this.exportDescriptions.get(name);
|
|
@@ -17238,8 +17561,10 @@ class Module {
|
|
|
17238
17561
|
}
|
|
17239
17562
|
const name = exportDeclaration.localName;
|
|
17240
17563
|
const variable = this.traceVariable(name, {
|
|
17564
|
+
exportOrReexportModules,
|
|
17241
17565
|
importerForSideEffects,
|
|
17242
|
-
searchedNamesAndModules
|
|
17566
|
+
searchedNamesAndModules,
|
|
17567
|
+
sideEffectModules
|
|
17243
17568
|
});
|
|
17244
17569
|
if (!variable) {
|
|
17245
17570
|
return [null, { missingButExportExists: true }];
|
|
@@ -17248,6 +17573,8 @@ class Module {
|
|
|
17248
17573
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
17249
17574
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
17250
17575
|
}
|
|
17576
|
+
sideEffectModules?.add(this);
|
|
17577
|
+
exportOrReexportModules?.add(this);
|
|
17251
17578
|
return [variable];
|
|
17252
17579
|
}
|
|
17253
17580
|
if (onlyExplicit) {
|
|
@@ -17258,6 +17585,19 @@ class Module {
|
|
|
17258
17585
|
this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, [...importChain, this.id]);
|
|
17259
17586
|
this.namespaceReexportsByName.set(name, foundNamespaceReexport);
|
|
17260
17587
|
if (foundNamespaceReexport[0]) {
|
|
17588
|
+
const [namespaceReexportVariable, namespaceReexportOptions] = foundNamespaceReexport;
|
|
17589
|
+
if (importerForSideEffects) {
|
|
17590
|
+
const { exportOrReexportModules, sideEffectModules } = namespaceReexportOptions;
|
|
17591
|
+
for (const module of exportOrReexportModules) {
|
|
17592
|
+
if (importerForSideEffects.alternativeReexportModules.has(namespaceReexportVariable)) {
|
|
17593
|
+
continue;
|
|
17594
|
+
}
|
|
17595
|
+
setAlternativeExporterIfCyclic(namespaceReexportVariable, importerForSideEffects, module);
|
|
17596
|
+
}
|
|
17597
|
+
for (const module of sideEffectModules) {
|
|
17598
|
+
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, namespaceReexportVariable, (getNewSet)).add(module);
|
|
17599
|
+
}
|
|
17600
|
+
}
|
|
17261
17601
|
return foundNamespaceReexport;
|
|
17262
17602
|
}
|
|
17263
17603
|
}
|
|
@@ -17461,7 +17801,7 @@ class Module {
|
|
|
17461
17801
|
transformFiles: this.transformFiles
|
|
17462
17802
|
};
|
|
17463
17803
|
}
|
|
17464
|
-
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
17804
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = EMPTY_OBJECT) {
|
|
17465
17805
|
const localVariable = this.scope.variables.get(name);
|
|
17466
17806
|
if (localVariable) {
|
|
17467
17807
|
return localVariable;
|
|
@@ -17472,7 +17812,7 @@ class Module {
|
|
|
17472
17812
|
if (otherModule instanceof Module && importDescription.name === '*') {
|
|
17473
17813
|
return otherModule.namespace;
|
|
17474
17814
|
}
|
|
17475
|
-
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id]);
|
|
17815
|
+
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id], sideEffectModules, exportOrReexportModules);
|
|
17476
17816
|
if (!declaration) {
|
|
17477
17817
|
return this.error(logMissingExport(importDescription.name, this.id, otherModule.id, !!options?.missingButExportExists), importDescription.start);
|
|
17478
17818
|
}
|
|
@@ -17693,6 +18033,8 @@ class Module {
|
|
|
17693
18033
|
let foundSyntheticDeclaration = null;
|
|
17694
18034
|
const foundInternalDeclarations = new Map();
|
|
17695
18035
|
const foundExternalDeclarations = new Set();
|
|
18036
|
+
const sideEffectModules = new Set();
|
|
18037
|
+
const exportOrReexportModules = new Set();
|
|
17696
18038
|
for (const module of this.exportAllModules) {
|
|
17697
18039
|
// Synthetic namespaces should not hide "regular" exports of the same name
|
|
17698
18040
|
if (module.info.syntheticNamedExports === name) {
|
|
@@ -17701,7 +18043,7 @@ class Module {
|
|
|
17701
18043
|
const [variable, options] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
17702
18044
|
// We are creating a copy to handle the case where the same binding is
|
|
17703
18045
|
// imported through different namespace reexports gracefully
|
|
17704
|
-
copyNameToModulesMap(searchedNamesAndModules), importChain);
|
|
18046
|
+
copyNameToModulesMap(searchedNamesAndModules), importChain, sideEffectModules, exportOrReexportModules);
|
|
17705
18047
|
if (module instanceof ExternalModule || options?.indirectExternal) {
|
|
17706
18048
|
foundExternalDeclarations.add(variable);
|
|
17707
18049
|
}
|
|
@@ -17718,7 +18060,7 @@ class Module {
|
|
|
17718
18060
|
const foundDeclarationList = [...foundInternalDeclarations];
|
|
17719
18061
|
const usedDeclaration = foundDeclarationList[0][0];
|
|
17720
18062
|
if (foundDeclarationList.length === 1) {
|
|
17721
|
-
return [usedDeclaration];
|
|
18063
|
+
return [usedDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
17722
18064
|
}
|
|
17723
18065
|
this.options.onLog(LOGLEVEL_WARN, logNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
17724
18066
|
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
@@ -17730,10 +18072,13 @@ class Module {
|
|
|
17730
18072
|
if (foundDeclarationList.length > 1) {
|
|
17731
18073
|
this.options.onLog(LOGLEVEL_WARN, logAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
17732
18074
|
}
|
|
17733
|
-
return [
|
|
18075
|
+
return [
|
|
18076
|
+
usedDeclaration,
|
|
18077
|
+
{ exportOrReexportModules, indirectExternal: true, sideEffectModules }
|
|
18078
|
+
];
|
|
17734
18079
|
}
|
|
17735
18080
|
if (foundSyntheticDeclaration) {
|
|
17736
|
-
return [foundSyntheticDeclaration];
|
|
18081
|
+
return [foundSyntheticDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
17737
18082
|
}
|
|
17738
18083
|
return [null];
|
|
17739
18084
|
}
|
|
@@ -19248,6 +19593,16 @@ class Chunk {
|
|
|
19248
19593
|
}
|
|
19249
19594
|
setIdentifierRenderResolutions() {
|
|
19250
19595
|
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
19596
|
+
// Reset stale render names from previous output renderings of the same
|
|
19597
|
+
// module graph. Without this, variables that were renamed during a prior
|
|
19598
|
+
// output's import deconfliction (e.g. given a chunk-prefixed
|
|
19599
|
+
// `renderBaseName` like `vendor`) would carry that name into the next
|
|
19600
|
+
// output, producing invalid identifiers such as `function vendor.foo()`.
|
|
19601
|
+
for (const module of this.orderedModules) {
|
|
19602
|
+
for (const variable of module.scope.variables.values()) {
|
|
19603
|
+
variable.setRenderNames(null, null);
|
|
19604
|
+
}
|
|
19605
|
+
}
|
|
19251
19606
|
const syntheticExports = new Set();
|
|
19252
19607
|
for (const exportName of this.getExportNames()) {
|
|
19253
19608
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -21477,8 +21832,8 @@ class ModuleLoader {
|
|
|
21477
21832
|
for (const module of implicitlyLoadedAfterModules) {
|
|
21478
21833
|
entryModule.implicitlyLoadedAfter.add(module);
|
|
21479
21834
|
}
|
|
21480
|
-
for (const
|
|
21481
|
-
|
|
21835
|
+
for (const dependent of entryModule.implicitlyLoadedAfter) {
|
|
21836
|
+
dependent.implicitlyLoadedBefore.add(entryModule);
|
|
21482
21837
|
}
|
|
21483
21838
|
}
|
|
21484
21839
|
}
|
|
@@ -21752,8 +22107,8 @@ class ModuleLoader {
|
|
|
21752
22107
|
// be performed atomically
|
|
21753
22108
|
module.info.isEntry = true;
|
|
21754
22109
|
this.implicitEntryModules.delete(module);
|
|
21755
|
-
for (const
|
|
21756
|
-
|
|
22110
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
22111
|
+
dependent.implicitlyLoadedBefore.delete(module);
|
|
21757
22112
|
}
|
|
21758
22113
|
module.implicitlyLoadedAfter.clear();
|
|
21759
22114
|
}
|
|
@@ -22656,7 +23011,7 @@ class PluginDriver {
|
|
|
22656
23011
|
* Run a sync plugin hook and return the result.
|
|
22657
23012
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
22658
23013
|
* @param args Arguments passed to the plugin hook.
|
|
22659
|
-
* @param plugin The
|
|
23014
|
+
* @param plugin The actual plugin
|
|
22660
23015
|
* @param replaceContext When passed, the plugin context can be overridden.
|
|
22661
23016
|
*/
|
|
22662
23017
|
runHookSync(hookName, parameters, plugin, replaceContext) {
|
|
@@ -22904,9 +23259,9 @@ class Graph {
|
|
|
22904
23259
|
for (const externalModule of this.externalModules)
|
|
22905
23260
|
externalModule.warnUnusedImports();
|
|
22906
23261
|
for (const module of this.implicitEntryModules) {
|
|
22907
|
-
for (const
|
|
22908
|
-
if (!(
|
|
22909
|
-
error(logImplicitDependantIsNotIncluded(
|
|
23262
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23263
|
+
if (!(dependent.info.isEntry || dependent.isIncluded())) {
|
|
23264
|
+
error(logImplicitDependantIsNotIncluded(dependent));
|
|
22910
23265
|
}
|
|
22911
23266
|
}
|
|
22912
23267
|
}
|