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/bin/rollup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
3
|
@license
|
|
4
|
-
Rollup.js v4.60.
|
|
5
|
-
Mon,
|
|
4
|
+
Rollup.js v4.60.3
|
|
5
|
+
Mon, 04 May 2026 15:33:41 GMT - commit b47bdabeccbb7aa1b1d4117f2f4a781a9f6de297
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ require('node:perf_hooks');
|
|
|
27
27
|
require('node:url');
|
|
28
28
|
require('../getLogFilter.js');
|
|
29
29
|
|
|
30
|
-
const help = "rollup version 4.60.
|
|
30
|
+
const help = "rollup version 4.60.3\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @license
|
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/parseAst.js
CHANGED
package/dist/es/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
|
|
|
@@ -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.3";
|
|
31
31
|
|
|
32
32
|
// src/vlq.ts
|
|
33
33
|
var comma = ",".charCodeAt(0);
|
|
@@ -2519,7 +2519,6 @@ const RESERVED_NAMES = new Set([
|
|
|
2519
2519
|
'enum',
|
|
2520
2520
|
'eval',
|
|
2521
2521
|
'export',
|
|
2522
|
-
'exports',
|
|
2523
2522
|
'extends',
|
|
2524
2523
|
'false',
|
|
2525
2524
|
'finally',
|
|
@@ -5625,10 +5624,17 @@ class ChildScope extends Scope {
|
|
|
5625
5624
|
this.parent.addReturnExpression(expression);
|
|
5626
5625
|
}
|
|
5627
5626
|
}
|
|
5628
|
-
addUsedOutsideNames(usedNames, accessedGlobalsByScope) {
|
|
5627
|
+
addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope) {
|
|
5629
5628
|
for (const variable of this.accessedOutsideVariables.values()) {
|
|
5630
5629
|
if (variable.included) {
|
|
5631
5630
|
usedNames.add(variable.getBaseVariableName());
|
|
5631
|
+
// In system format, exported variables are assigned via `exports(name, value)`.
|
|
5632
|
+
// Any scope that references such a variable must treat `exports` as used so
|
|
5633
|
+
// that a nested binding of the same name does not shadow the system wrapper's
|
|
5634
|
+
// `exports` argument.
|
|
5635
|
+
if (format === 'system' && exportNamesByVariable.has(variable)) {
|
|
5636
|
+
usedNames.add('exports');
|
|
5637
|
+
}
|
|
5632
5638
|
}
|
|
5633
5639
|
}
|
|
5634
5640
|
const accessedGlobals = accessedGlobalsByScope.get(this);
|
|
@@ -5643,7 +5649,7 @@ class ChildScope extends Scope {
|
|
|
5643
5649
|
}
|
|
5644
5650
|
deconflict(format, exportNamesByVariable, accessedGlobalsByScope) {
|
|
5645
5651
|
const usedNames = new Set();
|
|
5646
|
-
this.addUsedOutsideNames(usedNames, accessedGlobalsByScope);
|
|
5652
|
+
this.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
|
|
5647
5653
|
if (this.accessedDynamicImports) {
|
|
5648
5654
|
for (const importExpression of this.accessedDynamicImports) {
|
|
5649
5655
|
if (importExpression.inlineNamespace) {
|
|
@@ -6981,7 +6987,7 @@ class ExportDefaultDeclaration extends NodeBase {
|
|
|
6981
6987
|
: null, options);
|
|
6982
6988
|
}
|
|
6983
6989
|
else if (this.variable.getOriginalVariable() !== this.variable) {
|
|
6984
|
-
// Remove altogether to prevent
|
|
6990
|
+
// Remove altogether to prevent redeclaring the same variable
|
|
6985
6991
|
treeshakeNode(this, code, start, end);
|
|
6986
6992
|
return;
|
|
6987
6993
|
}
|
|
@@ -8221,10 +8227,10 @@ function getCompleteAmdId(options, chunkId) {
|
|
|
8221
8227
|
return options.id ?? '';
|
|
8222
8228
|
}
|
|
8223
8229
|
|
|
8224
|
-
function getExportBlock$1(exports
|
|
8230
|
+
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, mechanism = 'return ') {
|
|
8225
8231
|
const { _, getDirectReturnFunction, getFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
8226
8232
|
if (!namedExportsMode) {
|
|
8227
|
-
return `${n}${n}${mechanism}${getSingleDefaultExport(exports
|
|
8233
|
+
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
8228
8234
|
}
|
|
8229
8235
|
let exportBlock = '';
|
|
8230
8236
|
if (namedExportsMode) {
|
|
@@ -8261,7 +8267,7 @@ function getExportBlock$1(exports$1, dependencies, namedExportsMode, interop, sn
|
|
|
8261
8267
|
}
|
|
8262
8268
|
}
|
|
8263
8269
|
}
|
|
8264
|
-
for (const { exported, local } of exports
|
|
8270
|
+
for (const { exported, local } of exports) {
|
|
8265
8271
|
const lhs = `exports${getPropertyAccess(exported)}`;
|
|
8266
8272
|
const rhs = local;
|
|
8267
8273
|
if (lhs !== rhs) {
|
|
@@ -8308,9 +8314,9 @@ function getExportBlock$1(exports$1, dependencies, namedExportsMode, interop, sn
|
|
|
8308
8314
|
}
|
|
8309
8315
|
return '';
|
|
8310
8316
|
}
|
|
8311
|
-
function getSingleDefaultExport(exports
|
|
8312
|
-
if (exports
|
|
8313
|
-
return exports
|
|
8317
|
+
function getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess) {
|
|
8318
|
+
if (exports.length > 0) {
|
|
8319
|
+
return exports[0].local;
|
|
8314
8320
|
}
|
|
8315
8321
|
else {
|
|
8316
8322
|
for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
|
|
@@ -8532,6 +8538,8 @@ const builtinModules = [
|
|
|
8532
8538
|
"stream",
|
|
8533
8539
|
"node:stream/consumers",
|
|
8534
8540
|
"stream/consumers",
|
|
8541
|
+
"node:stream/iter",
|
|
8542
|
+
"stream/iter",
|
|
8535
8543
|
"node:stream/promises",
|
|
8536
8544
|
"stream/promises",
|
|
8537
8545
|
"node:stream/web",
|
|
@@ -8565,7 +8573,9 @@ const builtinModules = [
|
|
|
8565
8573
|
"node:worker_threads",
|
|
8566
8574
|
"worker_threads",
|
|
8567
8575
|
"node:zlib",
|
|
8568
|
-
"zlib"
|
|
8576
|
+
"zlib",
|
|
8577
|
+
"node:zlib/iter",
|
|
8578
|
+
"zlib/iter"
|
|
8569
8579
|
];
|
|
8570
8580
|
|
|
8571
8581
|
const nodeBuiltins = new Set(builtinModules);
|
|
@@ -8578,13 +8588,13 @@ function warnOnBuiltins(log, dependencies) {
|
|
|
8578
8588
|
log(LOGLEVEL_WARN, logMissingNodeBuiltins(externalBuiltins));
|
|
8579
8589
|
}
|
|
8580
8590
|
|
|
8581
|
-
function amd(magicString, { accessedGlobals, dependencies, exports
|
|
8591
|
+
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 }) {
|
|
8582
8592
|
warnOnBuiltins(log, dependencies);
|
|
8583
8593
|
throwOnPhase('amd', id, dependencies);
|
|
8584
8594
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
8585
8595
|
const parameters = dependencies.map(m => m.name);
|
|
8586
8596
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
8587
|
-
if (hasExports && (namedExportsMode || exports
|
|
8597
|
+
if (hasExports && (namedExportsMode || exports[0]?.local === 'exports.default')) {
|
|
8588
8598
|
parameters.unshift(`exports`);
|
|
8589
8599
|
deps.unshift(`'exports'`);
|
|
8590
8600
|
}
|
|
@@ -8601,7 +8611,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
8601
8611
|
(deps.length > 0 ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
8602
8612
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
8603
8613
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
8604
|
-
const exportBlock = getExportBlock$1(exports
|
|
8614
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
8605
8615
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
8606
8616
|
if (namespaceMarkers) {
|
|
8607
8617
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -8618,7 +8628,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
8618
8628
|
.append(`${n}${n}}));`);
|
|
8619
8629
|
}
|
|
8620
8630
|
|
|
8621
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports
|
|
8631
|
+
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 }) {
|
|
8622
8632
|
throwOnPhase('cjs', id, dependencies);
|
|
8623
8633
|
const { _, n } = snippets;
|
|
8624
8634
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
@@ -8629,7 +8639,7 @@ function cjs(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
8629
8639
|
const importBlock = getImportBlock$1(dependencies, snippets, compact);
|
|
8630
8640
|
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
8631
8641
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
8632
|
-
const exportBlock = getExportBlock$1(exports
|
|
8642
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, `module.exports${_}=${_}`);
|
|
8633
8643
|
magicString.append(`${exportBlock}${outro}`);
|
|
8634
8644
|
}
|
|
8635
8645
|
function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
@@ -8655,7 +8665,7 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
|
8655
8665
|
return '';
|
|
8656
8666
|
}
|
|
8657
8667
|
|
|
8658
|
-
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports
|
|
8668
|
+
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols }, importAttributesKey }) {
|
|
8659
8669
|
const { n } = snippets;
|
|
8660
8670
|
const importBlock = getImportBlock(dependencies, importAttributesKey, snippets);
|
|
8661
8671
|
if (importBlock.length > 0)
|
|
@@ -8663,7 +8673,7 @@ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencie
|
|
|
8663
8673
|
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
|
|
8664
8674
|
if (intro)
|
|
8665
8675
|
magicString.prepend(intro);
|
|
8666
|
-
const exportBlock = getExportBlock(exports
|
|
8676
|
+
const exportBlock = getExportBlock(exports, snippets);
|
|
8667
8677
|
if (exportBlock.length > 0)
|
|
8668
8678
|
magicString.append(n + n + exportBlock.join(n).trim());
|
|
8669
8679
|
if (outro)
|
|
@@ -8753,11 +8763,11 @@ function getImportBlock(dependencies, importAttributesKey, { _ }) {
|
|
|
8753
8763
|
}
|
|
8754
8764
|
return importBlock;
|
|
8755
8765
|
}
|
|
8756
|
-
function getExportBlock(exports
|
|
8766
|
+
function getExportBlock(exports, { _, cnst }) {
|
|
8757
8767
|
const exportBlock = [];
|
|
8758
|
-
const exportDeclaration = new Array(exports
|
|
8768
|
+
const exportDeclaration = new Array(exports.length);
|
|
8759
8769
|
let index = 0;
|
|
8760
|
-
for (const specifier of exports
|
|
8770
|
+
for (const specifier of exports) {
|
|
8761
8771
|
if (specifier.expression) {
|
|
8762
8772
|
exportBlock.push(`${cnst} ${specifier.local}${_}=${_}${specifier.expression};`);
|
|
8763
8773
|
}
|
|
@@ -8835,7 +8845,7 @@ function trimEmptyImports(dependencies) {
|
|
|
8835
8845
|
return [];
|
|
8836
8846
|
}
|
|
8837
8847
|
|
|
8838
|
-
function iife(magicString, { accessedGlobals, dependencies, exports
|
|
8848
|
+
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 }) {
|
|
8839
8849
|
throwOnPhase('iife', id, dependencies);
|
|
8840
8850
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
8841
8851
|
const isNamespaced = name && name.includes('.');
|
|
@@ -8850,7 +8860,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
8850
8860
|
if (hasExports && !name) {
|
|
8851
8861
|
log(LOGLEVEL_WARN, logMissingNameOptionForIifeExport());
|
|
8852
8862
|
}
|
|
8853
|
-
if (hasExports && (namedExportsMode || exports
|
|
8863
|
+
if (hasExports && (namedExportsMode || exports[0]?.local === 'exports.default')) {
|
|
8854
8864
|
if (extend) {
|
|
8855
8865
|
deps.unshift(`this${keypath(name, getPropertyAccess)}${_}=${_}this${keypath(name, getPropertyAccess)}${_}||${_}{}`);
|
|
8856
8866
|
parameters.unshift('exports');
|
|
@@ -8881,7 +8891,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
8881
8891
|
if (hasExports && !extend && namedExportsMode) {
|
|
8882
8892
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
8883
8893
|
}
|
|
8884
|
-
const exportBlock = getExportBlock$1(exports
|
|
8894
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
8885
8895
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
8886
8896
|
if (namespaceMarkers) {
|
|
8887
8897
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -8895,10 +8905,10 @@ function iife(magicString, { accessedGlobals, dependencies, exports: exports$1,
|
|
|
8895
8905
|
|
|
8896
8906
|
const MISSING_EXPORT_SHIM_VARIABLE = '_missingExportShim';
|
|
8897
8907
|
|
|
8898
|
-
function system(magicString, { accessedGlobals, dependencies, exports
|
|
8908
|
+
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name, generatedCode: { symbols }, strict, systemNullSetters }) {
|
|
8899
8909
|
throwOnPhase('system', id, dependencies);
|
|
8900
8910
|
const { _, getFunctionIntro, getNonArrowFunctionIntro, n, s } = snippets;
|
|
8901
|
-
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports
|
|
8911
|
+
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports, t, snippets);
|
|
8902
8912
|
const registeredName = name ? `'${name}',${_}` : '';
|
|
8903
8913
|
const wrapperParameters = accessedGlobals.has('module')
|
|
8904
8914
|
? ['exports', 'module']
|
|
@@ -8935,15 +8945,15 @@ function system(magicString, { accessedGlobals, dependencies, exports: exports$1
|
|
|
8935
8945
|
magicString
|
|
8936
8946
|
.prepend(intro +
|
|
8937
8947
|
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols) +
|
|
8938
|
-
getHoistedExportsBlock(exports
|
|
8948
|
+
getHoistedExportsBlock(exports, t, snippets))
|
|
8939
8949
|
.append(`${outro}${n}${n}` +
|
|
8940
|
-
getSyntheticExportsBlock(exports
|
|
8941
|
-
getMissingExportsBlock(exports
|
|
8950
|
+
getSyntheticExportsBlock(exports, t, snippets) +
|
|
8951
|
+
getMissingExportsBlock(exports, t, snippets))
|
|
8942
8952
|
.indent(`${t}${t}${t}`)
|
|
8943
8953
|
.append(wrapperEnd)
|
|
8944
8954
|
.prepend(wrapperStart);
|
|
8945
8955
|
}
|
|
8946
|
-
function analyzeDependencies(dependencies, exports
|
|
8956
|
+
function analyzeDependencies(dependencies, exports, t, { _, cnst, getObject, getPropertyAccess, n }) {
|
|
8947
8957
|
const importBindings = [];
|
|
8948
8958
|
const setters = [];
|
|
8949
8959
|
let starExcludes = null;
|
|
@@ -8977,7 +8987,7 @@ function analyzeDependencies(dependencies, exports$1, t, { _, cnst, getObject, g
|
|
|
8977
8987
|
if (reexportedNames.length > 1 || hasStarReexport) {
|
|
8978
8988
|
if (hasStarReexport) {
|
|
8979
8989
|
if (!starExcludes) {
|
|
8980
|
-
starExcludes = getStarExcludes({ dependencies, exports
|
|
8990
|
+
starExcludes = getStarExcludes({ dependencies, exports });
|
|
8981
8991
|
}
|
|
8982
8992
|
reexportedNames.unshift([null, `__proto__:${_}null`]);
|
|
8983
8993
|
const exportMapping = getObject(reexportedNames, { lineBreakIndent: null });
|
|
@@ -8997,8 +9007,8 @@ function analyzeDependencies(dependencies, exports$1, t, { _, cnst, getObject, g
|
|
|
8997
9007
|
}
|
|
8998
9008
|
return { importBindings, setters, starExcludes };
|
|
8999
9009
|
}
|
|
9000
|
-
const getStarExcludes = ({ dependencies, exports
|
|
9001
|
-
const starExcludes = new Set(exports
|
|
9010
|
+
const getStarExcludes = ({ dependencies, exports }) => {
|
|
9011
|
+
const starExcludes = new Set(exports.map(expt => expt.exported));
|
|
9002
9012
|
starExcludes.add('default');
|
|
9003
9013
|
for (const { reexports } of dependencies) {
|
|
9004
9014
|
if (reexports) {
|
|
@@ -9024,24 +9034,24 @@ const getStarExcludesBlock = (starExcludes, t, { _, cnst, getObject, n }) => {
|
|
|
9024
9034
|
return '';
|
|
9025
9035
|
};
|
|
9026
9036
|
const getImportBindingsBlock = (importBindings, t, { _, n }) => (importBindings.length > 0 ? `${n}${t}var ${importBindings.join(`,${_}`)};` : '');
|
|
9027
|
-
const getHoistedExportsBlock = (exports
|
|
9028
|
-
function getExportsBlock(exports
|
|
9029
|
-
if (exports
|
|
9037
|
+
const getHoistedExportsBlock = (exports, t, snippets) => getExportsBlock(exports.filter(expt => expt.hoisted).map(expt => ({ name: expt.exported, value: expt.local })), t, snippets);
|
|
9038
|
+
function getExportsBlock(exports, t, { _, n }) {
|
|
9039
|
+
if (exports.length === 0) {
|
|
9030
9040
|
return '';
|
|
9031
9041
|
}
|
|
9032
|
-
if (exports
|
|
9033
|
-
return `exports(${JSON.stringify(exports
|
|
9042
|
+
if (exports.length === 1) {
|
|
9043
|
+
return `exports(${JSON.stringify(exports[0].name)},${_}${exports[0].value});${n}${n}`;
|
|
9034
9044
|
}
|
|
9035
9045
|
return (`exports({${n}` +
|
|
9036
|
-
exports
|
|
9046
|
+
exports
|
|
9037
9047
|
.map(({ name, value }) => `${t}${stringifyObjectKeyIfNeeded(name)}:${_}${value}`)
|
|
9038
9048
|
.join(`,${n}`) +
|
|
9039
9049
|
`${n}});${n}${n}`);
|
|
9040
9050
|
}
|
|
9041
|
-
const getSyntheticExportsBlock = (exports
|
|
9051
|
+
const getSyntheticExportsBlock = (exports, t, snippets) => getExportsBlock(exports
|
|
9042
9052
|
.filter(expt => expt.expression)
|
|
9043
9053
|
.map(expt => ({ name: expt.exported, value: expt.local })), t, snippets);
|
|
9044
|
-
const getMissingExportsBlock = (exports
|
|
9054
|
+
const getMissingExportsBlock = (exports, t, snippets) => getExportsBlock(exports
|
|
9045
9055
|
.filter(expt => expt.local === MISSING_EXPORT_SHIM_VARIABLE)
|
|
9046
9056
|
.map(expt => ({ name: expt.exported, value: MISSING_EXPORT_SHIM_VARIABLE })), t, snippets);
|
|
9047
9057
|
|
|
@@ -9057,7 +9067,7 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
9057
9067
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
9058
9068
|
.join(`${_}&&${_}`);
|
|
9059
9069
|
}
|
|
9060
|
-
function umd(magicString, { accessedGlobals, dependencies, exports
|
|
9070
|
+
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 }) {
|
|
9061
9071
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
9062
9072
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
9063
9073
|
const globalVariable = compact ? 'g' : 'global';
|
|
@@ -9072,7 +9082,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
9072
9082
|
const globalDeps = trimmedImports.map(module => globalProperty(module.globalName, globalVariable, getPropertyAccess));
|
|
9073
9083
|
const factoryParameters = trimmedImports.map(m => m.name);
|
|
9074
9084
|
if ((hasExports || noConflict) &&
|
|
9075
|
-
(namedExportsMode || (hasExports && exports
|
|
9085
|
+
(namedExportsMode || (hasExports && exports[0]?.local === 'exports.default'))) {
|
|
9076
9086
|
amdDeps.unshift(`'exports'`);
|
|
9077
9087
|
cjsDeps.unshift(`exports`);
|
|
9078
9088
|
globalDeps.unshift(assignToDeepVariable(name, globalVariable, globals, `${extend ? `${globalProperty(name, globalVariable, getPropertyAccess)}${_}||${_}` : ''}{}`, snippets, log));
|
|
@@ -9140,7 +9150,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports: exports$1, h
|
|
|
9140
9150
|
})}{${useStrict}${n}`;
|
|
9141
9151
|
const wrapperOutro = n + n + '}));';
|
|
9142
9152
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
9143
|
-
const exportBlock = getExportBlock$1(exports
|
|
9153
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
9144
9154
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
9145
9155
|
if (namespaceMarkers) {
|
|
9146
9156
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -9389,7 +9399,7 @@ var hasRequiredUtils;
|
|
|
9389
9399
|
function requireUtils () {
|
|
9390
9400
|
if (hasRequiredUtils) return utils;
|
|
9391
9401
|
hasRequiredUtils = 1;
|
|
9392
|
-
(function (exports
|
|
9402
|
+
(function (exports) {
|
|
9393
9403
|
|
|
9394
9404
|
const {
|
|
9395
9405
|
REGEX_BACKSLASH,
|
|
@@ -9398,13 +9408,13 @@ function requireUtils () {
|
|
|
9398
9408
|
REGEX_SPECIAL_CHARS_GLOBAL
|
|
9399
9409
|
} = /*@__PURE__*/ requireConstants();
|
|
9400
9410
|
|
|
9401
|
-
exports
|
|
9402
|
-
exports
|
|
9403
|
-
exports
|
|
9404
|
-
exports
|
|
9405
|
-
exports
|
|
9411
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
9412
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
9413
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
9414
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
9415
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
9406
9416
|
|
|
9407
|
-
exports
|
|
9417
|
+
exports.isWindows = () => {
|
|
9408
9418
|
if (typeof navigator !== 'undefined' && navigator.platform) {
|
|
9409
9419
|
const platform = navigator.platform.toLowerCase();
|
|
9410
9420
|
return platform === 'win32' || platform === 'windows';
|
|
@@ -9417,20 +9427,20 @@ function requireUtils () {
|
|
|
9417
9427
|
return false;
|
|
9418
9428
|
};
|
|
9419
9429
|
|
|
9420
|
-
exports
|
|
9430
|
+
exports.removeBackslashes = str => {
|
|
9421
9431
|
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
9422
9432
|
return match === '\\' ? '' : match;
|
|
9423
9433
|
});
|
|
9424
9434
|
};
|
|
9425
9435
|
|
|
9426
|
-
exports
|
|
9436
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
9427
9437
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
9428
9438
|
if (idx === -1) return input;
|
|
9429
|
-
if (input[idx - 1] === '\\') return exports
|
|
9439
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
9430
9440
|
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
9431
9441
|
};
|
|
9432
9442
|
|
|
9433
|
-
exports
|
|
9443
|
+
exports.removePrefix = (input, state = {}) => {
|
|
9434
9444
|
let output = input;
|
|
9435
9445
|
if (output.startsWith('./')) {
|
|
9436
9446
|
output = output.slice(2);
|
|
@@ -9439,7 +9449,7 @@ function requireUtils () {
|
|
|
9439
9449
|
return output;
|
|
9440
9450
|
};
|
|
9441
9451
|
|
|
9442
|
-
exports
|
|
9452
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
9443
9453
|
const prepend = options.contains ? '' : '^';
|
|
9444
9454
|
const append = options.contains ? '' : '$';
|
|
9445
9455
|
|
|
@@ -9450,7 +9460,7 @@ function requireUtils () {
|
|
|
9450
9460
|
return output;
|
|
9451
9461
|
};
|
|
9452
9462
|
|
|
9453
|
-
exports
|
|
9463
|
+
exports.basename = (path, { windows } = {}) => {
|
|
9454
9464
|
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
9455
9465
|
const last = segs[segs.length - 1];
|
|
9456
9466
|
|
|
@@ -18210,7 +18220,7 @@ const DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT = {
|
|
|
18210
18220
|
function deconflictChunk(modules, dependenciesToBeDeconflicted, imports, usedNames, format, interop, preserveModules, externalLiveBindings, chunkByModule, externalChunkByModule, syntheticExports, exportNamesByVariable, accessedGlobalsByScope, includedNamespaces) {
|
|
18211
18221
|
const reversedModules = [...modules].reverse();
|
|
18212
18222
|
for (const module of reversedModules) {
|
|
18213
|
-
module.scope.addUsedOutsideNames(usedNames, accessedGlobalsByScope);
|
|
18223
|
+
module.scope.addUsedOutsideNames(usedNames, format, exportNamesByVariable, accessedGlobalsByScope);
|
|
18214
18224
|
}
|
|
18215
18225
|
deconflictTopLevelVariables(usedNames, reversedModules, includedNamespaces);
|
|
18216
18226
|
DECONFLICT_IMPORTED_VARIABLES_BY_FORMAT[format](usedNames, imports, dependenciesToBeDeconflicted, interop, preserveModules, externalLiveBindings, chunkByModule, externalChunkByModule, syntheticExports);
|
|
@@ -18331,9 +18341,9 @@ function deconflictTopLevelVariables(usedNames, modules, includedNamespaces) {
|
|
|
18331
18341
|
}
|
|
18332
18342
|
}
|
|
18333
18343
|
|
|
18334
|
-
function assignExportsToMangledNames(exports
|
|
18344
|
+
function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariable) {
|
|
18335
18345
|
let nameIndex = 0;
|
|
18336
|
-
for (const variable of exports
|
|
18346
|
+
for (const variable of exports) {
|
|
18337
18347
|
let [exportName] = variable.name;
|
|
18338
18348
|
if (exportsByName.has(exportName)) {
|
|
18339
18349
|
do {
|
|
@@ -18349,8 +18359,8 @@ function assignExportsToMangledNames(exports$1, exportsByName, exportNamesByVari
|
|
|
18349
18359
|
exportNamesByVariable.set(variable, [exportName]);
|
|
18350
18360
|
}
|
|
18351
18361
|
}
|
|
18352
|
-
function assignExportsToNames(exports
|
|
18353
|
-
for (const variable of exports
|
|
18362
|
+
function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
18363
|
+
for (const variable of exports) {
|
|
18354
18364
|
let nameIndex = 0;
|
|
18355
18365
|
let exportName = variable.name;
|
|
18356
18366
|
while (exportsByName.has(exportName)) {
|
|
@@ -19132,7 +19142,7 @@ class Chunk {
|
|
|
19132
19142
|
return 'chunk';
|
|
19133
19143
|
}
|
|
19134
19144
|
getChunkExportDeclarations(format) {
|
|
19135
|
-
const exports
|
|
19145
|
+
const exports = [];
|
|
19136
19146
|
for (const exportName of this.getExportNames()) {
|
|
19137
19147
|
if (exportName[0] === '*')
|
|
19138
19148
|
continue;
|
|
@@ -19177,14 +19187,14 @@ class Chunk {
|
|
|
19177
19187
|
local = variable.renderName;
|
|
19178
19188
|
}
|
|
19179
19189
|
}
|
|
19180
|
-
exports
|
|
19190
|
+
exports.push({
|
|
19181
19191
|
exported: exportName,
|
|
19182
19192
|
expression,
|
|
19183
19193
|
hoisted,
|
|
19184
19194
|
local
|
|
19185
19195
|
});
|
|
19186
19196
|
}
|
|
19187
|
-
return exports
|
|
19197
|
+
return exports;
|
|
19188
19198
|
}
|
|
19189
19199
|
getDependenciesToBeDeconflicted(addNonNamespacesAndInteropHelpers, addDependenciesWithoutBindings, interop) {
|
|
19190
19200
|
const dependencies = new Set();
|
|
@@ -19589,6 +19599,16 @@ class Chunk {
|
|
|
19589
19599
|
}
|
|
19590
19600
|
setIdentifierRenderResolutions() {
|
|
19591
19601
|
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
19602
|
+
// Reset stale render names from previous output renderings of the same
|
|
19603
|
+
// module graph. Without this, variables that were renamed during a prior
|
|
19604
|
+
// output's import deconfliction (e.g. given a chunk-prefixed
|
|
19605
|
+
// `renderBaseName` like `vendor`) would carry that name into the next
|
|
19606
|
+
// output, producing invalid identifiers such as `function vendor.foo()`.
|
|
19607
|
+
for (const module of this.orderedModules) {
|
|
19608
|
+
for (const variable of module.scope.variables.values()) {
|
|
19609
|
+
variable.setRenderNames(null, null);
|
|
19610
|
+
}
|
|
19611
|
+
}
|
|
19592
19612
|
const syntheticExports = new Set();
|
|
19593
19613
|
for (const exportName of this.getExportNames()) {
|
|
19594
19614
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -21818,8 +21838,8 @@ class ModuleLoader {
|
|
|
21818
21838
|
for (const module of implicitlyLoadedAfterModules) {
|
|
21819
21839
|
entryModule.implicitlyLoadedAfter.add(module);
|
|
21820
21840
|
}
|
|
21821
|
-
for (const
|
|
21822
|
-
|
|
21841
|
+
for (const dependent of entryModule.implicitlyLoadedAfter) {
|
|
21842
|
+
dependent.implicitlyLoadedBefore.add(entryModule);
|
|
21823
21843
|
}
|
|
21824
21844
|
}
|
|
21825
21845
|
}
|
|
@@ -22093,8 +22113,8 @@ class ModuleLoader {
|
|
|
22093
22113
|
// be performed atomically
|
|
22094
22114
|
module.info.isEntry = true;
|
|
22095
22115
|
this.implicitEntryModules.delete(module);
|
|
22096
|
-
for (const
|
|
22097
|
-
|
|
22116
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
22117
|
+
dependent.implicitlyLoadedBefore.delete(module);
|
|
22098
22118
|
}
|
|
22099
22119
|
module.implicitlyLoadedAfter.clear();
|
|
22100
22120
|
}
|
|
@@ -22997,7 +23017,7 @@ class PluginDriver {
|
|
|
22997
23017
|
* Run a sync plugin hook and return the result.
|
|
22998
23018
|
* @param hookName Name of the plugin hook. Must be in `PluginHooks`.
|
|
22999
23019
|
* @param args Arguments passed to the plugin hook.
|
|
23000
|
-
* @param plugin The
|
|
23020
|
+
* @param plugin The actual plugin
|
|
23001
23021
|
* @param replaceContext When passed, the plugin context can be overridden.
|
|
23002
23022
|
*/
|
|
23003
23023
|
runHookSync(hookName, parameters, plugin, replaceContext) {
|
|
@@ -23245,9 +23265,9 @@ class Graph {
|
|
|
23245
23265
|
for (const externalModule of this.externalModules)
|
|
23246
23266
|
externalModule.warnUnusedImports();
|
|
23247
23267
|
for (const module of this.implicitEntryModules) {
|
|
23248
|
-
for (const
|
|
23249
|
-
if (!(
|
|
23250
|
-
error(logImplicitDependantIsNotIncluded(
|
|
23268
|
+
for (const dependent of module.implicitlyLoadedAfter) {
|
|
23269
|
+
if (!(dependent.info.isEntry || dependent.isIncluded())) {
|
|
23270
|
+
error(logImplicitDependantIsNotIncluded(dependent));
|
|
23251
23271
|
}
|
|
23252
23272
|
}
|
|
23253
23273
|
}
|