rollup 4.14.3 → 4.16.0

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.14.3
5
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
4
+ Rollup.js v4.16.0
5
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -28,7 +28,7 @@ require('node:perf_hooks');
28
28
  require('node:url');
29
29
  require('../getLogFilter.js');
30
30
 
31
- const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to 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--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--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.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
+ const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to 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--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.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";
32
32
 
33
33
  /**
34
34
  * @license
@@ -1246,7 +1246,6 @@ yargsParser.detailed = function (args, opts) {
1246
1246
  yargsParser.camelCase = camelCase;
1247
1247
  yargsParser.decamelize = decamelize;
1248
1248
  yargsParser.looksLikeNumber = looksLikeNumber;
1249
- const argParser = yargsParser;
1250
1249
 
1251
1250
  const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
1252
1251
 
@@ -1731,7 +1730,7 @@ async function getConfigs(command) {
1731
1730
  return await loadConfigFromCommand(command, false);
1732
1731
  }
1733
1732
 
1734
- const command = argParser(process$1.argv.slice(2), {
1733
+ const command = yargsParser(process$1.argv.slice(2), {
1735
1734
  alias: rollup.commandAliases,
1736
1735
  configuration: { 'camel-case-expansion': false }
1737
1736
  });
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.14.3
4
- Mon, 15 Apr 2024 07:18:00 GMT - commit e64f3d8d0cdc561f00d3efe503e3081f81889679
3
+ Rollup.js v4.16.0
4
+ Sun, 21 Apr 2024 04:41:09 GMT - commit 38fe70780cb7e374b47da99e3a3dca6b2a2170d2
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import { normalize, getImportPath, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, CallExpression as CallExpression$1, BLANK, logIllegalImportReassignment, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, Property as Property$1, logConstVariableReassignError, ExpressionStatement as ExpressionStatement$1, ArrowFunctionExpression as ArrowFunctionExpression$1, logMissingExport, EMPTY_SET, logCannotCallNamespace, logEval, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, error, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getReadStringFunction, convertString, convertAnnotations, FIXED_STRINGS, convertNode as convertNode$1, EMPTY_OBJECT, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logSyntheticNamedExportsNeedNamespaceExport, logMissingEntryExport, logInvalidFormatForTopLevelAwait, logDuplicateExportError, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logCircularReexport, TemplateLiteral as TemplateLiteral$1, Literal as Literal$1, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, LOGLEVEL_ERROR, logLevelPriority, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, relativeId, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, augmentLogMessage, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
10
+ import { normalize, getImportPath, ExportDefaultDeclaration as ExportDefaultDeclaration$1, CallExpression as CallExpression$1, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, BLANK, logIllegalImportReassignment, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, VariableDeclarator as VariableDeclarator$1, Property as Property$1, logConstVariableReassignError, ExpressionStatement as ExpressionStatement$1, ArrowFunctionExpression as ArrowFunctionExpression$1, logMissingExport, EMPTY_SET, logCannotCallNamespace, logEval, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, error, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getReadStringFunction, convertString, convertAnnotations, FIXED_STRINGS, convertNode as convertNode$1, EMPTY_OBJECT, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logSyntheticNamedExportsNeedNamespaceExport, logMissingEntryExport, logInvalidFormatForTopLevelAwait, logDuplicateExportError, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logCircularReexport, TemplateLiteral as TemplateLiteral$1, Literal as Literal$1, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, LOGLEVEL_ERROR, logLevelPriority, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, relativeId, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, augmentLogMessage, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
11
11
  import { relative, dirname, basename, extname, resolve as resolve$1 } from 'node:path';
12
12
  import require$$0$1, { win32, posix, isAbsolute, resolve } from 'path';
13
13
  import { parseAsync, xxhashBase64Url, xxhashBase36, xxhashBase16 } from '../../native.js';
@@ -16,7 +16,7 @@ import { performance } from 'node:perf_hooks';
16
16
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version = "4.14.3";
19
+ var version = "4.16.0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -1937,6 +1937,9 @@ const NODE_INTERACTION_UNKNOWN_CALL = {
1937
1937
  };
1938
1938
 
1939
1939
  class Variable extends ExpressionEntity {
1940
+ markReassigned() {
1941
+ this.isReassigned = true;
1942
+ }
1940
1943
  constructor(name) {
1941
1944
  super();
1942
1945
  this.name = name;
@@ -1944,16 +1947,36 @@ class Variable extends ExpressionEntity {
1944
1947
  this.forbiddenNames = null;
1945
1948
  this.initReached = false;
1946
1949
  this.isId = false;
1947
- this.isReassigned = false;
1948
1950
  this.kind = null;
1949
1951
  this.renderBaseName = null;
1950
1952
  this.renderName = null;
1953
+ this.isReassigned = false;
1954
+ this.onlyFunctionCallUsed = true;
1951
1955
  }
1952
1956
  /**
1953
1957
  * Binds identifiers that reference this variable to this variable.
1954
1958
  * Necessary to be able to change variable names.
1955
1959
  */
1956
1960
  addReference(_identifier) { }
1961
+ /**
1962
+ * Check if the identifier variable is only used as function call
1963
+ * Forward the check to the export default variable if it is only used once
1964
+ * @returns true if the variable is only used as function call
1965
+ */
1966
+ getOnlyFunctionCallUsed() {
1967
+ return this.onlyFunctionCallUsed;
1968
+ }
1969
+ /**
1970
+ * Collect the places where the identifier variable is used
1971
+ * @param usedPlace Where the variable is used
1972
+ */
1973
+ addUsedPlace(usedPlace) {
1974
+ const isFunctionCall = usedPlace.parent.type === CallExpression$1 &&
1975
+ usedPlace.parent.callee === usedPlace;
1976
+ if (!isFunctionCall && usedPlace.parent.type !== ExportDefaultDeclaration$1) {
1977
+ this.onlyFunctionCallUsed = false;
1978
+ }
1979
+ }
1957
1980
  /**
1958
1981
  * Prevent this variable from being renamed to this name to avoid name
1959
1982
  * collisions
@@ -5691,7 +5714,7 @@ class LocalVariable extends Variable {
5691
5714
  return;
5692
5715
  }
5693
5716
  if (path.length === 0) {
5694
- this.isReassigned = true;
5717
+ this.markReassigned();
5695
5718
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
5696
5719
  this.expressionsToBeDeoptimized = EMPTY_ARRAY;
5697
5720
  for (const expression of expressionsToBeDeoptimized) {
@@ -5785,7 +5808,7 @@ class LocalVariable extends Variable {
5785
5808
  if (this.additionalInitializers === null) {
5786
5809
  this.additionalInitializers = [this.init];
5787
5810
  this.init = UNKNOWN_EXPRESSION;
5788
- this.isReassigned = true;
5811
+ this.markReassigned();
5789
5812
  }
5790
5813
  return this.additionalInitializers;
5791
5814
  }
@@ -5803,6 +5826,8 @@ class ParameterVariable extends LocalVariable {
5803
5826
  this.deoptimizations = new PathTracker();
5804
5827
  this.deoptimizedFields = new Set();
5805
5828
  this.entitiesToBeDeoptimized = new Set();
5829
+ this.knownExpressionsToBeDeoptimized = [];
5830
+ this.knownValue = UNKNOWN_EXPRESSION;
5806
5831
  }
5807
5832
  addEntityToBeDeoptimized(entity) {
5808
5833
  if (entity === UNKNOWN_EXPRESSION) {
@@ -5832,6 +5857,47 @@ class ParameterVariable extends LocalVariable {
5832
5857
  }
5833
5858
  }
5834
5859
  }
5860
+ markReassigned() {
5861
+ if (this.isReassigned) {
5862
+ return;
5863
+ }
5864
+ super.markReassigned();
5865
+ for (const expression of this.knownExpressionsToBeDeoptimized) {
5866
+ expression.deoptimizeCache();
5867
+ }
5868
+ this.knownExpressionsToBeDeoptimized = [];
5869
+ }
5870
+ /**
5871
+ * If we are sure about the value of this parameter, we can set it here.
5872
+ * It can be a literal or the only possible value of the parameter.
5873
+ * an undefined value means that the parameter is not known.
5874
+ * @param value The known value of the parameter to be set.
5875
+ */
5876
+ setKnownValue(value) {
5877
+ if (this.isReassigned) {
5878
+ return;
5879
+ }
5880
+ if (this.knownValue !== value) {
5881
+ for (const expression of this.knownExpressionsToBeDeoptimized) {
5882
+ expression.deoptimizeCache();
5883
+ }
5884
+ this.knownExpressionsToBeDeoptimized = [];
5885
+ }
5886
+ this.knownValue = value;
5887
+ }
5888
+ getLiteralValueAtPath(path, recursionTracker, origin) {
5889
+ if (this.isReassigned) {
5890
+ return UnknownValue;
5891
+ }
5892
+ this.knownExpressionsToBeDeoptimized.push(origin);
5893
+ return recursionTracker.withTrackedEntityAtPath(path, this.knownValue, () => this.knownValue.getLiteralValueAtPath(path, recursionTracker, origin), UnknownValue);
5894
+ }
5895
+ hasEffectsOnInteractionAtPath(path, interaction, context) {
5896
+ // assigned is a bit different, since the value has a new name (the parameter)
5897
+ return interaction.type === INTERACTION_ASSIGNED
5898
+ ? super.hasEffectsOnInteractionAtPath(path, interaction, context)
5899
+ : this.knownValue.hasEffectsOnInteractionAtPath(path, interaction, context);
5900
+ }
5835
5901
  deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
5836
5902
  // For performance reasons, we fully deoptimize all deeper interactions
5837
5903
  if (path.length >= 2 ||
@@ -5856,7 +5922,11 @@ class ParameterVariable extends LocalVariable {
5856
5922
  }
5857
5923
  }
5858
5924
  deoptimizePath(path) {
5859
- if (path.length === 0 || this.deoptimizedFields.has(UnknownKey)) {
5925
+ if (this.deoptimizedFields.has(UnknownKey)) {
5926
+ return;
5927
+ }
5928
+ if (path.length === 0) {
5929
+ this.markReassigned();
5860
5930
  return;
5861
5931
  }
5862
5932
  const key = path[0];
@@ -7232,11 +7302,11 @@ function getGlobalAtPath(path) {
7232
7302
  }
7233
7303
 
7234
7304
  class GlobalVariable extends Variable {
7235
- constructor() {
7236
- super(...arguments);
7305
+ constructor(name) {
7306
+ super(name);
7237
7307
  // Ensure we use live-bindings for globals as we do not know if they have
7238
7308
  // been reassigned
7239
- this.isReassigned = true;
7309
+ this.markReassigned();
7240
7310
  }
7241
7311
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
7242
7312
  switch (interaction.type) {
@@ -7290,6 +7360,7 @@ class Identifier extends NodeBase {
7290
7360
  constructor() {
7291
7361
  super(...arguments);
7292
7362
  this.variable = null;
7363
+ this.isReferenceVariable = false;
7293
7364
  }
7294
7365
  get isTDZAccess() {
7295
7366
  if (!isFlagSet(this.flags, 4 /* Flag.tdzAccessDefined */)) {
@@ -7310,6 +7381,7 @@ class Identifier extends NodeBase {
7310
7381
  if (!this.variable && is_reference(this, this.parent)) {
7311
7382
  this.variable = this.scope.findVariable(this.name);
7312
7383
  this.variable.addReference(this);
7384
+ this.isReferenceVariable = true;
7313
7385
  }
7314
7386
  }
7315
7387
  declare(kind, init) {
@@ -7472,6 +7544,9 @@ class Identifier extends NodeBase {
7472
7544
  this.variable.consolidateInitializers();
7473
7545
  this.scope.context.requestTreeshakingPass();
7474
7546
  }
7547
+ if (this.isReferenceVariable) {
7548
+ this.variable.addUsedPlace(this);
7549
+ }
7475
7550
  }
7476
7551
  getVariableRespectingTDZ() {
7477
7552
  if (this.isPossibleTDZ()) {
@@ -7791,10 +7866,17 @@ class RestElement extends NodeBase {
7791
7866
  }
7792
7867
  }
7793
7868
 
7869
+ // This handler does nothing.
7870
+ // Since we always re-evaluate argument values in a new tree-shaking pass,
7871
+ // we don't need to get notified if it is deoptimized.
7872
+ const EMPTY_DEOPTIMIZABLE_HANDLER = { deoptimizeCache() { } };
7794
7873
  class FunctionBase extends NodeBase {
7795
7874
  constructor() {
7796
7875
  super(...arguments);
7876
+ this.knownParameterValues = [];
7877
+ this.allArguments = [];
7797
7878
  this.objectEntity = null;
7879
+ this.functionParametersOptimized = false;
7798
7880
  }
7799
7881
  get async() {
7800
7882
  return isFlagSet(this.flags, 256 /* Flag.async */);
@@ -7814,6 +7896,87 @@ class FunctionBase extends NodeBase {
7814
7896
  set generator(value) {
7815
7897
  this.flags = setFlag(this.flags, 4194304 /* Flag.generator */, value);
7816
7898
  }
7899
+ /**
7900
+ * update knownParameterValues when a call is made to this function
7901
+ * @param newArguments arguments of the call
7902
+ */
7903
+ updateKnownParameterValues(newArguments) {
7904
+ for (let position = 0; position < this.params.length; position++) {
7905
+ // only the "this" argument newArguments[0] can be null
7906
+ // it's possible that some arguments are empty, so the value is undefined
7907
+ const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
7908
+ const parameter = this.params[position];
7909
+ // RestElement can be, and can only be, the last parameter
7910
+ if (parameter instanceof RestElement) {
7911
+ return;
7912
+ }
7913
+ const knownParameterValue = this.knownParameterValues[position];
7914
+ if (knownParameterValue === undefined) {
7915
+ this.knownParameterValues[position] = argument;
7916
+ continue;
7917
+ }
7918
+ if (knownParameterValue === UNKNOWN_EXPRESSION ||
7919
+ knownParameterValue === argument ||
7920
+ (knownParameterValue instanceof Identifier &&
7921
+ argument instanceof Identifier &&
7922
+ knownParameterValue.variable === argument.variable)) {
7923
+ continue;
7924
+ }
7925
+ const oldValue = knownParameterValue.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
7926
+ const newValue = argument.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
7927
+ if (oldValue !== newValue || typeof oldValue === 'symbol') {
7928
+ this.knownParameterValues[position] = UNKNOWN_EXPRESSION;
7929
+ } // else both are the same literal, no need to update
7930
+ }
7931
+ }
7932
+ forwardArgumentsForFunctionCalledOnce(newArguments) {
7933
+ for (let position = 0; position < this.params.length; position++) {
7934
+ const parameter = this.params[position];
7935
+ if (parameter instanceof Identifier) {
7936
+ const ParameterVariable = parameter.variable;
7937
+ const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
7938
+ ParameterVariable?.setKnownValue(argument);
7939
+ }
7940
+ }
7941
+ }
7942
+ /**
7943
+ * each time tree-shake starts, this method should be called to reoptimize the parameters
7944
+ * a parameter's state will change at most twice:
7945
+ * `undefined` (no call is made) -> an expression -> `UnknownArgument`
7946
+ * we are sure it will converge, and can use state from last iteration
7947
+ */
7948
+ applyFunctionParameterOptimization() {
7949
+ if (this.allArguments.length === 0) {
7950
+ return;
7951
+ }
7952
+ if (this.allArguments.length === 1) {
7953
+ // we are sure what knownParameterValues will be, so skip it and do setKnownValue
7954
+ this.forwardArgumentsForFunctionCalledOnce(this.allArguments[0]);
7955
+ return;
7956
+ }
7957
+ // reoptimize all arguments, that's why we save them
7958
+ for (const argumentsList of this.allArguments) {
7959
+ this.updateKnownParameterValues(argumentsList);
7960
+ }
7961
+ for (let position = 0; position < this.params.length; position++) {
7962
+ const parameter = this.params[position];
7963
+ // Parameters without default values
7964
+ if (parameter instanceof Identifier) {
7965
+ const parameterVariable = parameter.variable;
7966
+ // Only the RestElement may be undefined
7967
+ const knownParameterValue = this.knownParameterValues[position];
7968
+ parameterVariable?.setKnownValue(knownParameterValue);
7969
+ }
7970
+ }
7971
+ }
7972
+ deoptimizeFunctionParameters() {
7973
+ for (const parameter of this.params) {
7974
+ if (parameter instanceof Identifier) {
7975
+ const parameterVariable = parameter.variable;
7976
+ parameterVariable?.markReassigned();
7977
+ }
7978
+ }
7979
+ }
7817
7980
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
7818
7981
  if (interaction.type === INTERACTION_CALLED) {
7819
7982
  const { parameters } = this.scope;
@@ -7838,6 +8001,7 @@ class FunctionBase extends NodeBase {
7838
8001
  this.addArgumentToBeDeoptimized(argument);
7839
8002
  }
7840
8003
  }
8004
+ this.allArguments.push(args);
7841
8005
  }
7842
8006
  else {
7843
8007
  this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
@@ -7852,6 +8016,7 @@ class FunctionBase extends NodeBase {
7852
8016
  for (const parameterList of this.scope.parameters) {
7853
8017
  for (const parameter of parameterList) {
7854
8018
  parameter.deoptimizePath(UNKNOWN_PATH);
8019
+ parameter.markReassigned();
7855
8020
  }
7856
8021
  }
7857
8022
  }
@@ -7897,7 +8062,30 @@ class FunctionBase extends NodeBase {
7897
8062
  }
7898
8063
  return false;
7899
8064
  }
8065
+ /**
8066
+ * If the function (expression or declaration) is only used as function calls
8067
+ */
8068
+ onlyFunctionCallUsed() {
8069
+ let variable = null;
8070
+ if (this.parent.type === VariableDeclarator$1) {
8071
+ variable = this.parent.id.variable ?? null;
8072
+ }
8073
+ if (this.parent.type === ExportDefaultDeclaration$1) {
8074
+ variable = this.parent.variable;
8075
+ }
8076
+ return variable?.getOnlyFunctionCallUsed() ?? false;
8077
+ }
7900
8078
  include(context, includeChildrenRecursively) {
8079
+ const isIIFE = this.parent.type === CallExpression$1 &&
8080
+ this.parent.callee === this;
8081
+ const shoulOptimizeFunctionParameters = isIIFE || this.onlyFunctionCallUsed();
8082
+ if (shoulOptimizeFunctionParameters) {
8083
+ this.applyFunctionParameterOptimization();
8084
+ }
8085
+ else if (this.functionParametersOptimized) {
8086
+ this.deoptimizeFunctionParameters();
8087
+ }
8088
+ this.functionParametersOptimized = shoulOptimizeFunctionParameters;
7901
8089
  if (!this.deoptimized)
7902
8090
  this.applyDeoptimizations();
7903
8091
  this.included = true;
@@ -8647,7 +8835,7 @@ class MemberExpression extends NodeBase {
8647
8835
  }
8648
8836
  deoptimizeCache() {
8649
8837
  const { expressionsToBeDeoptimized, object } = this;
8650
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
8838
+ this.expressionsToBeDeoptimized = [];
8651
8839
  this.propertyKey = UnknownKey;
8652
8840
  object.deoptimizePath(UNKNOWN_PATH);
8653
8841
  for (const expression of expressionsToBeDeoptimized) {
@@ -8796,6 +8984,9 @@ class MemberExpression extends NodeBase {
8796
8984
  this.object.deoptimizeArgumentsOnInteractionAtPath(this.accessInteraction, [propertyKey], SHARED_RECURSION_TRACKER);
8797
8985
  this.scope.context.requestTreeshakingPass();
8798
8986
  }
8987
+ if (this.variable) {
8988
+ this.variable.addUsedPlace(this);
8989
+ }
8799
8990
  }
8800
8991
  applyAssignmentDeoptimization() {
8801
8992
  this.assignmentDeoptimized = true;
@@ -9445,15 +9636,16 @@ class ConditionalExpression extends NodeBase {
9445
9636
  this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
9446
9637
  }
9447
9638
  deoptimizeCache() {
9639
+ this.isBranchResolutionAnalysed = false;
9640
+ const { expressionsToBeDeoptimized } = this;
9641
+ this.expressionsToBeDeoptimized = [];
9642
+ for (const expression of expressionsToBeDeoptimized) {
9643
+ expression.deoptimizeCache();
9644
+ }
9448
9645
  if (this.usedBranch !== null) {
9449
9646
  const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
9450
9647
  this.usedBranch = null;
9451
9648
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
9452
- const { expressionsToBeDeoptimized } = this;
9453
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
9454
- for (const expression of expressionsToBeDeoptimized) {
9455
- expression.deoptimizeCache();
9456
- }
9457
9649
  }
9458
9650
  }
9459
9651
  deoptimizePath(path) {
@@ -9467,10 +9659,10 @@ class ConditionalExpression extends NodeBase {
9467
9659
  }
9468
9660
  }
9469
9661
  getLiteralValueAtPath(path, recursionTracker, origin) {
9662
+ this.expressionsToBeDeoptimized.push(origin);
9470
9663
  const usedBranch = this.getUsedBranch();
9471
9664
  if (!usedBranch)
9472
9665
  return UnknownValue;
9473
- this.expressionsToBeDeoptimized.push(origin);
9474
9666
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
9475
9667
  }
9476
9668
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -9669,6 +9861,10 @@ class FunctionDeclaration extends FunctionNode {
9669
9861
  this.id.variable.isId = true;
9670
9862
  }
9671
9863
  }
9864
+ onlyFunctionCallUsed() {
9865
+ // call super.onlyFunctionCallUsed for export default anonymous function
9866
+ return this.id?.variable.getOnlyFunctionCallUsed() ?? super.onlyFunctionCallUsed();
9867
+ }
9672
9868
  parseNode(esTreeNode) {
9673
9869
  if (esTreeNode.id !== null) {
9674
9870
  this.id = new Identifier(this, this.scope.parent).parseNode(esTreeNode.id);
@@ -9957,7 +10153,7 @@ class IfStatement extends NodeBase {
9957
10153
  this.testValue = unset;
9958
10154
  }
9959
10155
  deoptimizeCache() {
9960
- this.testValue = UnknownValue;
10156
+ this.testValue = unset;
9961
10157
  }
9962
10158
  hasEffects(context) {
9963
10159
  if (this.test.hasEffects(context)) {
@@ -10765,12 +10961,10 @@ class LogicalExpression extends NodeBase {
10765
10961
  this.right.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
10766
10962
  }
10767
10963
  deoptimizeCache() {
10768
- if (this.usedBranch) {
10769
- const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
10770
- this.usedBranch = null;
10771
- unusedBranch.deoptimizePath(UNKNOWN_PATH);
10964
+ this.isBranchResolutionAnalysed = false;
10965
+ if (this.expressionsToBeDeoptimized.length > 0) {
10772
10966
  const { scope: { context }, expressionsToBeDeoptimized } = this;
10773
- this.expressionsToBeDeoptimized = EMPTY_ARRAY;
10967
+ this.expressionsToBeDeoptimized = [];
10774
10968
  for (const expression of expressionsToBeDeoptimized) {
10775
10969
  expression.deoptimizeCache();
10776
10970
  }
@@ -10778,6 +10972,11 @@ class LogicalExpression extends NodeBase {
10778
10972
  // it is rendered
10779
10973
  context.requestTreeshakingPass();
10780
10974
  }
10975
+ if (this.usedBranch) {
10976
+ const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
10977
+ this.usedBranch = null;
10978
+ unusedBranch.deoptimizePath(UNKNOWN_PATH);
10979
+ }
10781
10980
  }
10782
10981
  deoptimizePath(path) {
10783
10982
  const usedBranch = this.getUsedBranch();
@@ -10790,10 +10989,10 @@ class LogicalExpression extends NodeBase {
10790
10989
  }
10791
10990
  }
10792
10991
  getLiteralValueAtPath(path, recursionTracker, origin) {
10992
+ this.expressionsToBeDeoptimized.push(origin);
10793
10993
  const usedBranch = this.getUsedBranch();
10794
10994
  if (!usedBranch)
10795
10995
  return UnknownValue;
10796
- this.expressionsToBeDeoptimized.push(origin);
10797
10996
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
10798
10997
  }
10799
10998
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -11735,6 +11934,15 @@ class ExportDefaultVariable extends LocalVariable {
11735
11934
  this.name = identifier.name;
11736
11935
  }
11737
11936
  }
11937
+ addUsedPlace(usedPlace) {
11938
+ const original = this.getOriginalVariable();
11939
+ if (original === this) {
11940
+ super.addUsedPlace(usedPlace);
11941
+ }
11942
+ else {
11943
+ original.addUsedPlace(usedPlace);
11944
+ }
11945
+ }
11738
11946
  forbidName(name) {
11739
11947
  const original = this.getOriginalVariable();
11740
11948
  if (original === this) {
@@ -12008,7 +12216,7 @@ class UpdateExpression extends NodeBase {
12008
12216
  this.argument.deoptimizePath(EMPTY_PATH);
12009
12217
  if (this.argument instanceof Identifier) {
12010
12218
  const variable = this.scope.findVariable(this.argument.name);
12011
- variable.isReassigned = true;
12219
+ variable.markReassigned();
12012
12220
  }
12013
12221
  this.scope.context.requestTreeshakingPass();
12014
12222
  }
@@ -14857,9 +15065,9 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
14857
15065
  return '';
14858
15066
  }
14859
15067
 
14860
- function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols } }) {
15068
+ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols }, importAttributesKey }) {
14861
15069
  const { n } = snippets;
14862
- const importBlock = getImportBlock(dependencies, snippets);
15070
+ const importBlock = getImportBlock(dependencies, importAttributesKey, snippets);
14863
15071
  if (importBlock.length > 0)
14864
15072
  intro += importBlock.join(n) + n + n;
14865
15073
  intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
@@ -14872,10 +15080,10 @@ function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencie
14872
15080
  magicString.append(outro);
14873
15081
  magicString.trim();
14874
15082
  }
14875
- function getImportBlock(dependencies, { _ }) {
15083
+ function getImportBlock(dependencies, importAttributesKey, { _ }) {
14876
15084
  const importBlock = [];
14877
15085
  for (const { importPath, reexports, imports, name, attributes } of dependencies) {
14878
- const assertion = attributes ? `${_}assert${_}${attributes}` : '';
15086
+ const assertion = attributes ? `${_}${importAttributesKey}${_}${attributes}` : '';
14879
15087
  const pathWithAssertion = `'${importPath}'${assertion};`;
14880
15088
  if (!reexports && !imports) {
14881
15089
  importBlock.push(`import${_}${pathWithAssertion}`);
@@ -18125,7 +18333,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
18125
18333
 
18126
18334
  function flru (max) {
18127
18335
  var num, curr, prev;
18128
- var limit = max || 1;
18336
+ var limit = max ;
18129
18337
 
18130
18338
  function keep(key, value) {
18131
18339
  if (++num > limit) {
@@ -20181,6 +20389,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
20181
20389
  globals: config.globals || {},
20182
20390
  hashCharacters: config.hashCharacters ?? 'base64',
20183
20391
  hoistTransitiveImports: config.hoistTransitiveImports ?? true,
20392
+ importAttributesKey: config.importAttributesKey ?? 'assert',
20184
20393
  indent: getIndent(config, compact),
20185
20394
  inlineDynamicImports,
20186
20395
  interop: getInterop(config),
@@ -20896,6 +21105,7 @@ async function mergeOutputOptions(config, overrides, log) {
20896
21105
  globals: getOption('globals'),
20897
21106
  hashCharacters: getOption('hashCharacters'),
20898
21107
  hoistTransitiveImports: getOption('hoistTransitiveImports'),
21108
+ importAttributesKey: getOption('importAttributesKey'),
20899
21109
  indent: getOption('indent'),
20900
21110
  inlineDynamicImports: getOption('inlineDynamicImports'),
20901
21111
  interop: getOption('interop'),