rollup 4.60.1 → 4.60.3
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 +96 -76
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +100 -100
- 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 +100 -100
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +96 -76
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +57 -50
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.60.
|
|
4
|
-
Mon,
|
|
3
|
+
Rollup.js v4.60.3
|
|
4
|
+
Mon, 04 May 2026 15:33:41 GMT - commit b47bdabeccbb7aa1b1d4117f2f4a781a9f6de297
|
|
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.3";
|
|
46
46
|
|
|
47
47
|
function ensureArray$1(items) {
|
|
48
48
|
if (Array.isArray(items)) {
|
|
@@ -1169,7 +1169,7 @@ var hasRequiredUtils;
|
|
|
1169
1169
|
function requireUtils () {
|
|
1170
1170
|
if (hasRequiredUtils) return utils;
|
|
1171
1171
|
hasRequiredUtils = 1;
|
|
1172
|
-
(function (exports
|
|
1172
|
+
(function (exports) {
|
|
1173
1173
|
|
|
1174
1174
|
const {
|
|
1175
1175
|
REGEX_BACKSLASH,
|
|
@@ -1178,13 +1178,13 @@ function requireUtils () {
|
|
|
1178
1178
|
REGEX_SPECIAL_CHARS_GLOBAL
|
|
1179
1179
|
} = /*@__PURE__*/ requireConstants();
|
|
1180
1180
|
|
|
1181
|
-
exports
|
|
1182
|
-
exports
|
|
1183
|
-
exports
|
|
1184
|
-
exports
|
|
1185
|
-
exports
|
|
1181
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
1182
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
1183
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
1184
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
1185
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
1186
1186
|
|
|
1187
|
-
exports
|
|
1187
|
+
exports.isWindows = () => {
|
|
1188
1188
|
if (typeof navigator !== 'undefined' && navigator.platform) {
|
|
1189
1189
|
const platform = navigator.platform.toLowerCase();
|
|
1190
1190
|
return platform === 'win32' || platform === 'windows';
|
|
@@ -1197,20 +1197,20 @@ function requireUtils () {
|
|
|
1197
1197
|
return false;
|
|
1198
1198
|
};
|
|
1199
1199
|
|
|
1200
|
-
exports
|
|
1200
|
+
exports.removeBackslashes = str => {
|
|
1201
1201
|
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
1202
1202
|
return match === '\\' ? '' : match;
|
|
1203
1203
|
});
|
|
1204
1204
|
};
|
|
1205
1205
|
|
|
1206
|
-
exports
|
|
1206
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
1207
1207
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
1208
1208
|
if (idx === -1) return input;
|
|
1209
|
-
if (input[idx - 1] === '\\') return exports
|
|
1209
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
1210
1210
|
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1211
1211
|
};
|
|
1212
1212
|
|
|
1213
|
-
exports
|
|
1213
|
+
exports.removePrefix = (input, state = {}) => {
|
|
1214
1214
|
let output = input;
|
|
1215
1215
|
if (output.startsWith('./')) {
|
|
1216
1216
|
output = output.slice(2);
|
|
@@ -1219,7 +1219,7 @@ function requireUtils () {
|
|
|
1219
1219
|
return output;
|
|
1220
1220
|
};
|
|
1221
1221
|
|
|
1222
|
-
exports
|
|
1222
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
1223
1223
|
const prepend = options.contains ? '' : '^';
|
|
1224
1224
|
const append = options.contains ? '' : '$';
|
|
1225
1225
|
|
|
@@ -1230,7 +1230,7 @@ function requireUtils () {
|
|
|
1230
1230
|
return output;
|
|
1231
1231
|
};
|
|
1232
1232
|
|
|
1233
|
-
exports
|
|
1233
|
+
exports.basename = (path, { windows } = {}) => {
|
|
1234
1234
|
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
1235
1235
|
const last = segs[segs.length - 1];
|
|
1236
1236
|
|
|
@@ -3735,7 +3735,7 @@ class PluginDriver {
|
|
|
3735
3735
|
* Run a sync plugin hook and return the result.
|
|
3736
3736
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
3737
3737
|
* @param args Arguments passed to the plugin hook.
|
|
3738
|
-
* @param plugin The
|
|
3738
|
+
* @param plugin The actual plugin
|
|
3739
3739
|
* @param replaceContext When passed, the plugin context can be overridden.
|
|
3740
3740
|
*/
|
|
3741
3741
|
runHookSync(hookName, parameters, plugin, replaceContext) {
|
|
@@ -6623,7 +6623,6 @@ const RESERVED_NAMES = new Set([
|
|
|
6623
6623
|
'enum',
|
|
6624
6624
|
'eval',
|
|
6625
6625
|
'export',
|
|
6626
|
-
'exports',
|
|
6627
6626
|
'extends',
|
|
6628
6627
|
'false',
|
|
6629
6628
|
'finally',
|
|
@@ -9715,10 +9714,17 @@ class ChildScope extends Scope {
|
|
|
9715
9714
|
this.parent.addReturnExpression(expression);
|
|
9716
9715
|
}
|
|
9717
9716
|
}
|
|
9718
|
-
addUsedOutsideNames(usedNames, accessedGlobalsByScope) {
|
|
9717
|
+
addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope) {
|
|
9719
9718
|
for (const variable of this.accessedOutsideVariables.values()) {
|
|
9720
9719
|
if (variable.included) {
|
|
9721
9720
|
usedNames.add(variable.getBaseVariableName());
|
|
9721
|
+
// In system format, exported variables are assigned via `exports(name, value)`.
|
|
9722
|
+
// Any scope that references such a variable must treat `exports` as used so
|
|
9723
|
+
// that a nested binding of the same name does not shadow the system wrapper's
|
|
9724
|
+
// `exports` argument.
|
|
9725
|
+
if (format === 'system' && exportNamesByVariable.has(variable)) {
|
|
9726
|
+
usedNames.add('exports');
|
|
9727
|
+
}
|
|
9722
9728
|
}
|
|
9723
9729
|
}
|
|
9724
9730
|
const accessedGlobals = accessedGlobalsByScope.get(this);
|
|
@@ -9733,7 +9739,7 @@ class ChildScope extends Scope {
|
|
|
9733
9739
|
}
|
|
9734
9740
|
deconflict(format, exportNamesByVariable, accessedGlobalsByScope) {
|
|
9735
9741
|
const usedNames = new Set();
|
|
9736
|
-
this.addUsedOutsideNames(usedNames, accessedGlobalsByScope);
|
|
9742
|
+
this.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
|
|
9737
9743
|
if (this.accessedDynamicImports) {
|
|
9738
9744
|
for (const importExpression of this.accessedDynamicImports) {
|
|
9739
9745
|
if (importExpression.inlineNamespace) {
|
|
@@ -11071,7 +11077,7 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
11071
11077
|
: null, options);
|
|
11072
11078
|
}
|
|
11073
11079
|
else if (this.variable.getOriginalVariable() !== this.variable) {
|
|
11074
|
-
// Remove altogether to prevent
|
|
11080
|
+
// Remove altogether to prevent redeclaring the same variable
|
|
11075
11081
|
treeshakeNode(this, code, start, end);
|
|
11076
11082
|
return;
|
|
11077
11083
|
}
|
|
@@ -12311,10 +12317,10 @@ function getCompleteAmdId(options, chunkId) {
|
|
|
12311
12317
|
return options.id ?? '';
|
|
12312
12318
|
}
|
|
12313
12319
|
|
|
12314
|
-
function getExportBlock$1(exports
|
|
12320
|
+
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, mechanism = 'return ') {
|
|
12315
12321
|
const { _, getDirectReturnFunction, getFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
12316
12322
|
if (!namedExportsMode) {
|
|
12317
|
-
return `${n}${n}${mechanism}${getSingleDefaultExport(exports
|
|
12323
|
+
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
12318
12324
|
}
|
|
12319
12325
|
let exportBlock = '';
|
|
12320
12326
|
if (namedExportsMode) {
|
|
@@ -12351,7 +12357,7 @@ function getExportBlock$1(exports$1, dependencies, namedExportsMode, interop, sn
|
|
|
12351
12357
|
}
|
|
12352
12358
|
}
|
|
12353
12359
|
}
|
|
12354
|
-
for (const { exported, local } of exports
|
|
12360
|
+
for (const { exported, local } of exports) {
|
|
12355
12361
|
const lhs = `exports${getPropertyAccess(exported)}`;
|
|
12356
12362
|
const rhs = local;
|
|
12357
12363
|
if (lhs !== rhs) {
|
|
@@ -12398,9 +12404,9 @@ function getExportBlock$1(exports$1, dependencies, namedExportsMode, interop, sn
|
|
|
12398
12404
|
}
|
|
12399
12405
|
return '';
|
|
12400
12406
|
}
|
|
12401
|
-
function getSingleDefaultExport(exports
|
|
12402
|
-
if (exports
|
|
12403
|
-
return exports
|
|
12407
|
+
function getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess) {
|
|
12408
|
+
if (exports.length > 0) {
|
|
12409
|
+
return exports[0].local;
|
|
12404
12410
|
}
|
|
12405
12411
|
else {
|
|
12406
12412
|
for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
|
|
@@ -12622,6 +12628,8 @@ const builtinModules = [
|
|
|
12622
12628
|
"stream",
|
|
12623
12629
|
"node:stream/consumers",
|
|
12624
12630
|
"stream/consumers",
|
|
12631
|
+
"node:stream/iter",
|
|
12632
|
+
"stream/iter",
|
|
12625
12633
|
"node:stream/promises",
|
|
12626
12634
|
"stream/promises",
|
|
12627
12635
|
"node:stream/web",
|
|
@@ -12655,7 +12663,9 @@ const builtinModules = [
|
|
|
12655
12663
|
"node:worker_threads",
|
|
12656
12664
|
"worker_threads",
|
|
12657
12665
|
"node:zlib",
|
|
12658
|
-
"zlib"
|
|
12666
|
+
"zlib",
|
|
12667
|
+
"node:zlib/iter",
|
|
12668
|
+
"zlib/iter"
|
|
12659
12669
|
];
|
|
12660
12670
|
|
|
12661
12671
|
const nodeBuiltins = new Set(builtinModules);
|
|
@@ -12668,13 +12678,13 @@ function warnOnBuiltins(log, dependencies) {
|
|
|
12668
12678
|
log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logMissingNodeBuiltins(externalBuiltins));
|
|
12669
12679
|
}
|
|
12670
12680
|
|
|
12671
|
-
function amd(magicString, { accessedGlobals, dependencies, exports
|
|
12681
|
+
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze, generatedCode: { symbols }, interop, reexportProtoFromExternal, strict }) {
|
|
12672
12682
|
warnOnBuiltins(log, dependencies);
|
|
12673
12683
|
throwOnPhase('amd', id, dependencies);
|
|
12674
12684
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
12675
12685
|
const parameters = dependencies.map(m => m.name);
|
|
12676
12686
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
12677
|
-
if (hasExports && (namedExportsMode || exports
|
|
12687
|
+
if (hasExports && (namedExportsMode || exports[0]?.local === 'exports.default')) {
|
|
12678
12688
|
parameters.unshift(`exports`);
|
|
12679
12689
|
deps.unshift(`'exports'`);
|
|
12680
12690
|
}
|
|
@@ -12691,7 +12701,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
12691
12701
|
(deps.length > 0 ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
12692
12702
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
12693
12703
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
12694
|
-
const exportBlock = getExportBlock$1(exports
|
|
12704
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
12695
12705
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
12696
12706
|
if (namespaceMarkers) {
|
|
12697
12707
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -12708,7 +12718,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
12708
12718
|
.append(`${n}${n}}));`);
|
|
12709
12719
|
}
|
|
12710
12720
|
|
|
12711
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports
|
|
12721
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, generatedCode: { symbols }, reexportProtoFromExternal, strict }) {
|
|
12712
12722
|
throwOnPhase('cjs', id, dependencies);
|
|
12713
12723
|
const { _, n } = snippets;
|
|
12714
12724
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
@@ -12719,7 +12729,7 @@ function cjs(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
12719
12729
|
const importBlock = getImportBlock$1(dependencies, snippets, compact);
|
|
12720
12730
|
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
12721
12731
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
12722
|
-
const exportBlock = getExportBlock$1(exports
|
|
12732
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, `module.exports${_}=${_}`);
|
|
12723
12733
|
magicString.append(`${exportBlock}${outro}`);
|
|
12724
12734
|
}
|
|
12725
12735
|
function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
@@ -12745,7 +12755,7 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
|
12745
12755
|
return '';
|
|
12746
12756
|
}
|
|
12747
12757
|
|
|
12748
|
-
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports
|
|
12758
|
+
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols }, importAttributesKey }) {
|
|
12749
12759
|
const { n } = snippets;
|
|
12750
12760
|
const importBlock = getImportBlock(dependencies, importAttributesKey, snippets);
|
|
12751
12761
|
if (importBlock.length > 0)
|
|
@@ -12753,7 +12763,7 @@ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencie
|
|
|
12753
12763
|
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
|
|
12754
12764
|
if (intro)
|
|
12755
12765
|
magicString.prepend(intro);
|
|
12756
|
-
const exportBlock = getExportBlock(exports
|
|
12766
|
+
const exportBlock = getExportBlock(exports, snippets);
|
|
12757
12767
|
if (exportBlock.length > 0)
|
|
12758
12768
|
magicString.append(n + n + exportBlock.join(n).trim());
|
|
12759
12769
|
if (outro)
|
|
@@ -12843,11 +12853,11 @@ function getImportBlock(dependencies, importAttributesKey, { _ }) {
|
|
|
12843
12853
|
}
|
|
12844
12854
|
return importBlock;
|
|
12845
12855
|
}
|
|
12846
|
-
function getExportBlock(exports
|
|
12856
|
+
function getExportBlock(exports, { _, cnst }) {
|
|
12847
12857
|
const exportBlock = [];
|
|
12848
|
-
const exportDeclaration = new Array(exports
|
|
12858
|
+
const exportDeclaration = new Array(exports.length);
|
|
12849
12859
|
let index = 0;
|
|
12850
|
-
for (const specifier of exports
|
|
12860
|
+
for (const specifier of exports) {
|
|
12851
12861
|
if (specifier.expression) {
|
|
12852
12862
|
exportBlock.push(`${cnst} ${specifier.local}${_}=${_}${specifier.expression};`);
|
|
12853
12863
|
}
|
|
@@ -12925,7 +12935,7 @@ function trimEmptyImports(dependencies) {
|
|
|
12925
12935
|
return [];
|
|
12926
12936
|
}
|
|
12927
12937
|
|
|
12928
|
-
function iife(magicString, { accessedGlobals, dependencies, exports
|
|
12938
|
+
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, reexportProtoFromExternal, globals, interop, name, generatedCode: { symbols }, strict }) {
|
|
12929
12939
|
throwOnPhase('iife', id, dependencies);
|
|
12930
12940
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
12931
12941
|
const isNamespaced = name && name.includes('.');
|
|
@@ -12940,7 +12950,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
12940
12950
|
if (hasExports && !name) {
|
|
12941
12951
|
log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logMissingNameOptionForIifeExport());
|
|
12942
12952
|
}
|
|
12943
|
-
if (hasExports && (namedExportsMode || exports
|
|
12953
|
+
if (hasExports && (namedExportsMode || exports[0]?.local === 'exports.default')) {
|
|
12944
12954
|
if (extend) {
|
|
12945
12955
|
deps.unshift(`this${keypath(name, getPropertyAccess)}${_}=${_}this${keypath(name, getPropertyAccess)}${_}||${_}{}`);
|
|
12946
12956
|
parameters.unshift('exports');
|
|
@@ -12971,7 +12981,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
12971
12981
|
if (hasExports && !extend && namedExportsMode) {
|
|
12972
12982
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
12973
12983
|
}
|
|
12974
|
-
const exportBlock = getExportBlock$1(exports
|
|
12984
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
12975
12985
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
12976
12986
|
if (namespaceMarkers) {
|
|
12977
12987
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -12985,10 +12995,10 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
12985
12995
|
|
|
12986
12996
|
const MISSING_EXPORT_SHIM_VARIABLE = '_missingExportShim';
|
|
12987
12997
|
|
|
12988
|
-
function system(magicString, { accessedGlobals, dependencies, exports
|
|
12998
|
+
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name, generatedCode: { symbols }, strict, systemNullSetters }) {
|
|
12989
12999
|
throwOnPhase('system', id, dependencies);
|
|
12990
13000
|
const { _, getFunctionIntro, getNonArrowFunctionIntro, n, s } = snippets;
|
|
12991
|
-
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports
|
|
13001
|
+
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports, t, snippets);
|
|
12992
13002
|
const registeredName = name ? `'${name}',${_}` : '';
|
|
12993
13003
|
const wrapperParameters = accessedGlobals.has('module')
|
|
12994
13004
|
? ['exports', 'module']
|
|
@@ -13025,15 +13035,15 @@ function system(magicString, { accessedGlobals, dependencies, exports: exports$1
|
|
|
13025
13035
|
magicString
|
|
13026
13036
|
.prepend(intro +
|
|
13027
13037
|
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols) +
|
|
13028
|
-
getHoistedExportsBlock(exports
|
|
13038
|
+
getHoistedExportsBlock(exports, t, snippets))
|
|
13029
13039
|
.append(`${outro}${n}${n}` +
|
|
13030
|
-
getSyntheticExportsBlock(exports
|
|
13031
|
-
getMissingExportsBlock(exports
|
|
13040
|
+
getSyntheticExportsBlock(exports, t, snippets) +
|
|
13041
|
+
getMissingExportsBlock(exports, t, snippets))
|
|
13032
13042
|
.indent(`${t}${t}${t}`)
|
|
13033
13043
|
.append(wrapperEnd)
|
|
13034
13044
|
.prepend(wrapperStart);
|
|
13035
13045
|
}
|
|
13036
|
-
function analyzeDependencies(dependencies, exports
|
|
13046
|
+
function analyzeDependencies(dependencies, exports, t, { _, cnst, getObject, getPropertyAccess, n }) {
|
|
13037
13047
|
const importBindings = [];
|
|
13038
13048
|
const setters = [];
|
|
13039
13049
|
let starExcludes = null;
|
|
@@ -13067,7 +13077,7 @@ function analyzeDependencies(dependencies, exports$1, t, { _, cnst, getObject, g
|
|
|
13067
13077
|
if (reexportedNames.length > 1 || hasStarReexport) {
|
|
13068
13078
|
if (hasStarReexport) {
|
|
13069
13079
|
if (!starExcludes) {
|
|
13070
|
-
starExcludes = getStarExcludes({ dependencies, exports
|
|
13080
|
+
starExcludes = getStarExcludes({ dependencies, exports });
|
|
13071
13081
|
}
|
|
13072
13082
|
reexportedNames.unshift([null, `__proto__:${_}null`]);
|
|
13073
13083
|
const exportMapping = getObject(reexportedNames, { lineBreakIndent: null });
|
|
@@ -13087,8 +13097,8 @@ function analyzeDependencies(dependencies, exports$1, t, { _, cnst, getObject, g
|
|
|
13087
13097
|
}
|
|
13088
13098
|
return { importBindings, setters, starExcludes };
|
|
13089
13099
|
}
|
|
13090
|
-
const getStarExcludes = ({ dependencies, exports
|
|
13091
|
-
const starExcludes = new Set(exports
|
|
13100
|
+
const getStarExcludes = ({ dependencies, exports }) => {
|
|
13101
|
+
const starExcludes = new Set(exports.map(expt => expt.exported));
|
|
13092
13102
|
starExcludes.add('default');
|
|
13093
13103
|
for (const { reexports } of dependencies) {
|
|
13094
13104
|
if (reexports) {
|
|
@@ -13114,24 +13124,24 @@ const getStarExcludesBlock = (starExcludes, t, { _, cnst, getObject, n }) => {
|
|
|
13114
13124
|
return '';
|
|
13115
13125
|
};
|
|
13116
13126
|
const getImportBindingsBlock = (importBindings, t, { _, n }) => (importBindings.length > 0 ? `${n}${t}var ${importBindings.join(`,${_}`)};` : '');
|
|
13117
|
-
const getHoistedExportsBlock = (exports
|
|
13118
|
-
function getExportsBlock(exports
|
|
13119
|
-
if (exports
|
|
13127
|
+
const getHoistedExportsBlock = (exports, t, snippets) => getExportsBlock(exports.filter(expt => expt.hoisted).map(expt => ({ name: expt.exported, value: expt.local })), t, snippets);
|
|
13128
|
+
function getExportsBlock(exports, t, { _, n }) {
|
|
13129
|
+
if (exports.length === 0) {
|
|
13120
13130
|
return '';
|
|
13121
13131
|
}
|
|
13122
|
-
if (exports
|
|
13123
|
-
return `exports(${JSON.stringify(exports
|
|
13132
|
+
if (exports.length === 1) {
|
|
13133
|
+
return `exports(${JSON.stringify(exports[0].name)},${_}${exports[0].value});${n}${n}`;
|
|
13124
13134
|
}
|
|
13125
13135
|
return (`exports({${n}` +
|
|
13126
|
-
exports
|
|
13136
|
+
exports
|
|
13127
13137
|
.map(({ name, value }) => `${t}${stringifyObjectKeyIfNeeded(name)}:${_}${value}`)
|
|
13128
13138
|
.join(`,${n}`) +
|
|
13129
13139
|
`${n}});${n}${n}`);
|
|
13130
13140
|
}
|
|
13131
|
-
const getSyntheticExportsBlock = (exports
|
|
13141
|
+
const getSyntheticExportsBlock = (exports, t, snippets) => getExportsBlock(exports
|
|
13132
13142
|
.filter(expt => expt.expression)
|
|
13133
13143
|
.map(expt => ({ name: expt.exported, value: expt.local })), t, snippets);
|
|
13134
|
-
const getMissingExportsBlock = (exports
|
|
13144
|
+
const getMissingExportsBlock = (exports, t, snippets) => getExportsBlock(exports
|
|
13135
13145
|
.filter(expt => expt.local === MISSING_EXPORT_SHIM_VARIABLE)
|
|
13136
13146
|
.map(expt => ({ name: expt.exported, value: MISSING_EXPORT_SHIM_VARIABLE })), t, snippets);
|
|
13137
13147
|
|
|
@@ -13147,7 +13157,7 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
13147
13157
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
13148
13158
|
.join(`${_}&&${_}`);
|
|
13149
13159
|
}
|
|
13150
|
-
function umd(magicString, { accessedGlobals, dependencies, exports
|
|
13160
|
+
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, generatedCode: { symbols }, globals, noConflict, reexportProtoFromExternal, strict }) {
|
|
13151
13161
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
13152
13162
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
13153
13163
|
const globalVariable = compact ? 'g' : 'global';
|
|
@@ -13162,7 +13172,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
13162
13172
|
const globalDeps = trimmedImports.map(module => globalProperty(module.globalName, globalVariable, getPropertyAccess));
|
|
13163
13173
|
const factoryParameters = trimmedImports.map(m => m.name);
|
|
13164
13174
|
if ((hasExports || noConflict) &&
|
|
13165
|
-
(namedExportsMode || (hasExports && exports
|
|
13175
|
+
(namedExportsMode || (hasExports && exports[0]?.local === 'exports.default'))) {
|
|
13166
13176
|
amdDeps.unshift(`'exports'`);
|
|
13167
13177
|
cjsDeps.unshift(`exports`);
|
|
13168
13178
|
globalDeps.unshift(assignToDeepVariable(name, globalVariable, globals, `${extend ? `${globalProperty(name, globalVariable, getPropertyAccess)}${_}||${_}` : ''}{}`, snippets, log));
|
|
@@ -13230,7 +13240,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
13230
13240
|
})}{${useStrict}${n}`;
|
|
13231
13241
|
const wrapperOutro = n + n + '}));';
|
|
13232
13242
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
13233
|
-
const exportBlock = getExportBlock$1(exports
|
|
13243
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
13234
13244
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
13235
13245
|
if (namespaceMarkers) {
|
|
13236
13246
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -19813,7 +19823,7 @@ const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
|
|
|
19813
19823
|
function deconflictChunk(modules, dependenciesToBeDeconflicted, imports, usedNames, format, interop, preserveModules, externalLiveBindings, chunkByModule, externalChunkByModule, syntheticExports, exportNamesByVariable, accessedGlobalsByScope, includedNamespaces) {
|
|
19814
19824
|
const reversedModules = [...modules].reverse();
|
|
19815
19825
|
for (const module of reversedModules) {
|
|
19816
|
-
module.scope.addUsedOutsideNames(usedNames, accessedGlobalsByScope);
|
|
19826
|
+
module.scope.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
|
|
19817
19827
|
}
|
|
19818
19828
|
deconflictTopLevelVariables(usedNames, reversedModules, includedNamespaces);
|
|
19819
19829
|
DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT[format](usedNames, imports, dependenciesToBeDeconflicted, interop, preserveModules, externalLiveBindings, chunkByModule, externalChunkByModule, syntheticExports);
|
|
@@ -19934,9 +19944,9 @@ function deconflictTopLevelVariables(usedNames, modules, includedNamespaces) {
|
|
|
19934
19944
|
}
|
|
19935
19945
|
}
|
|
19936
19946
|
|
|
19937
|
-
function assignExportsToMangledNames(exports
|
|
19947
|
+
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
19938
19948
|
let nameIndex = 0;
|
|
19939
|
-
for (const variable of exports
|
|
19949
|
+
for (const variable of exports) {
|
|
19940
19950
|
let [exportName] = variable.name;
|
|
19941
19951
|
if (exportsByName.has(exportName)) {
|
|
19942
19952
|
do {
|
|
@@ -19952,8 +19962,8 @@ function assignExportsToMangledNames(exports$1, exportsByName, exportNamesByVari
|
|
|
19952
19962
|
exportNamesByVariable.set(variable, [exportName]);
|
|
19953
19963
|
}
|
|
19954
19964
|
}
|
|
19955
|
-
function assignExportsToNames(exports
|
|
19956
|
-
for (const variable of exports
|
|
19965
|
+
function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
19966
|
+
for (const variable of exports) {
|
|
19957
19967
|
let nameIndex = 0;
|
|
19958
19968
|
let exportName = variable.name;
|
|
19959
19969
|
while (exportsByName.has(exportName)) {
|
|
@@ -20626,7 +20636,7 @@ class Chunk {
|
|
|
20626
20636
|
return 'chunk';
|
|
20627
20637
|
}
|
|
20628
20638
|
getChunkExportDeclarations(format) {
|
|
20629
|
-
const exports
|
|
20639
|
+
const exports = [];
|
|
20630
20640
|
for (const exportName of this.getExportNames()) {
|
|
20631
20641
|
if (exportName[0] === '*')
|
|
20632
20642
|
continue;
|
|
@@ -20671,14 +20681,14 @@ class Chunk {
|
|
|
20671
20681
|
local = variable.renderName;
|
|
20672
20682
|
}
|
|
20673
20683
|
}
|
|
20674
|
-
exports
|
|
20684
|
+
exports.push({
|
|
20675
20685
|
exported: exportName,
|
|
20676
20686
|
expression,
|
|
20677
20687
|
hoisted,
|
|
20678
20688
|
local
|
|
20679
20689
|
});
|
|
20680
20690
|
}
|
|
20681
|
-
return exports
|
|
20691
|
+
return exports;
|
|
20682
20692
|
}
|
|
20683
20693
|
getDependenciesToBeDeconflicted(addNonNamespacesAndInteropHelpers, addDependenciesWithoutBindings, interop) {
|
|
20684
20694
|
const dependencies = new Set();
|
|
@@ -21083,6 +21093,16 @@ class Chunk {
|
|
|
21083
21093
|
}
|
|
21084
21094
|
setIdentifierRenderResolutions() {
|
|
21085
21095
|
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
21096
|
+
// Reset stale render names from previous output renderings of the same
|
|
21097
|
+
// module graph. Without this, variables that were renamed during a prior
|
|
21098
|
+
// output's import deconfliction (e.g. given a chunk-prefixed
|
|
21099
|
+
// `renderBaseName` like `vendor`) would carry that name into the next
|
|
21100
|
+
// output, producing invalid identifiers such as `function vendor.foo()`.
|
|
21101
|
+
for (const module of this.orderedModules) {
|
|
21102
|
+
for (const variable of module.scope.variables.values()) {
|
|
21103
|
+
variable.setRenderNames(null, null);
|
|
21104
|
+
}
|
|
21105
|
+
}
|
|
21086
21106
|
const syntheticExports = new Set();
|
|
21087
21107
|
for (const exportName of this.getExportNames()) {
|
|
21088
21108
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -23047,8 +23067,8 @@ class ModuleLoader {
|
|
|
23047
23067
|
for (const module of implicitlyLoadedAfterModules) {
|
|
23048
23068
|
entryModule.implicitlyLoadedAfter.add(module);
|
|
23049
23069
|
}
|
|
23050
|
-
for (const
|
|
23051
|
-
|
|
23070
|
+
for (const dependent of entryModule.implicitlyLoadedAfter) {
|
|
23071
|
+
dependent.implicitlyLoadedBefore.add(entryModule);
|
|
23052
23072
|
}
|
|
23053
23073
|
}
|
|
23054
23074
|
}
|
|
@@ -23322,8 +23342,8 @@ class ModuleLoader {
|
|
|
23322
23342
|
// be performed atomically
|
|
23323
23343
|
module.info.isEntry = true;
|
|
23324
23344
|
this.implicitEntryModules.delete(module);
|
|
23325
|
-
for (const
|
|
23326
|
-
|
|
23345
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23346
|
+
dependent.implicitlyLoadedBefore.delete(module);
|
|
23327
23347
|
}
|
|
23328
23348
|
module.implicitlyLoadedAfter.clear();
|
|
23329
23349
|
}
|
|
@@ -23617,9 +23637,9 @@ class Graph {
|
|
|
23617
23637
|
for (const externalModule of this.externalModules)
|
|
23618
23638
|
externalModule.warnUnusedImports();
|
|
23619
23639
|
for (const module of this.implicitEntryModules) {
|
|
23620
|
-
for (const
|
|
23621
|
-
if (!(
|
|
23622
|
-
parseAst_js.error(parseAst_js.logImplicitDependantIsNotIncluded(
|
|
23640
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23641
|
+
if (!(dependent.info.isEntry || dependent.isIncluded())) {
|
|
23642
|
+
parseAst_js.error(parseAst_js.logImplicitDependantIsNotIncluded(dependent));
|
|
23623
23643
|
}
|
|
23624
23644
|
}
|
|
23625
23645
|
}
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED