rollup 4.16.2 → 4.16.4

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.16.2
5
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
4
+ Rollup.js v4.16.4
5
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -1246,6 +1246,7 @@ yargsParser.detailed = function (args, opts) {
1246
1246
  yargsParser.camelCase = camelCase;
1247
1247
  yargsParser.decamelize = decamelize;
1248
1248
  yargsParser.looksLikeNumber = looksLikeNumber;
1249
+ const argParser = yargsParser;
1249
1250
 
1250
1251
  const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
1251
1252
 
@@ -1730,7 +1731,7 @@ async function getConfigs(command) {
1730
1731
  return await loadConfigFromCommand(command, false);
1731
1732
  }
1732
1733
 
1733
- const command = yargsParser(process$1.argv.slice(2), {
1734
+ const command = argParser(process$1.argv.slice(2), {
1734
1735
  alias: rollup.commandAliases,
1735
1736
  configuration: { 'camel-case-expansion': false }
1736
1737
  });
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
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.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
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';
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';
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.16.2";
19
+ var version = "4.16.4";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -1937,9 +1937,6 @@ const NODE_INTERACTION_UNKNOWN_CALL = {
1937
1937
  };
1938
1938
 
1939
1939
  class Variable extends ExpressionEntity {
1940
- markReassigned() {
1941
- this.isReassigned = true;
1942
- }
1943
1940
  constructor(name) {
1944
1941
  super();
1945
1942
  this.name = name;
@@ -1947,36 +1944,16 @@ class Variable extends ExpressionEntity {
1947
1944
  this.forbiddenNames = null;
1948
1945
  this.initReached = false;
1949
1946
  this.isId = false;
1947
+ this.isReassigned = false;
1950
1948
  this.kind = null;
1951
1949
  this.renderBaseName = null;
1952
1950
  this.renderName = null;
1953
- this.isReassigned = false;
1954
- this.onlyFunctionCallUsed = true;
1955
1951
  }
1956
1952
  /**
1957
1953
  * Binds identifiers that reference this variable to this variable.
1958
1954
  * Necessary to be able to change variable names.
1959
1955
  */
1960
1956
  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
- }
1980
1957
  /**
1981
1958
  * Prevent this variable from being renamed to this name to avoid name
1982
1959
  * collisions
@@ -5714,7 +5691,7 @@ class LocalVariable extends Variable {
5714
5691
  return;
5715
5692
  }
5716
5693
  if (path.length === 0) {
5717
- this.markReassigned();
5694
+ this.isReassigned = true;
5718
5695
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
5719
5696
  this.expressionsToBeDeoptimized = EMPTY_ARRAY;
5720
5697
  for (const expression of expressionsToBeDeoptimized) {
@@ -5808,7 +5785,7 @@ class LocalVariable extends Variable {
5808
5785
  if (this.additionalInitializers === null) {
5809
5786
  this.additionalInitializers = [this.init];
5810
5787
  this.init = UNKNOWN_EXPRESSION;
5811
- this.markReassigned();
5788
+ this.isReassigned = true;
5812
5789
  }
5813
5790
  return this.additionalInitializers;
5814
5791
  }
@@ -5826,8 +5803,6 @@ class ParameterVariable extends LocalVariable {
5826
5803
  this.deoptimizations = new PathTracker();
5827
5804
  this.deoptimizedFields = new Set();
5828
5805
  this.entitiesToBeDeoptimized = new Set();
5829
- this.knownExpressionsToBeDeoptimized = [];
5830
- this.knownValue = UNKNOWN_EXPRESSION;
5831
5806
  }
5832
5807
  addEntityToBeDeoptimized(entity) {
5833
5808
  if (entity === UNKNOWN_EXPRESSION) {
@@ -5857,47 +5832,6 @@ class ParameterVariable extends LocalVariable {
5857
5832
  }
5858
5833
  }
5859
5834
  }
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
- }
5901
5835
  deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
5902
5836
  // For performance reasons, we fully deoptimize all deeper interactions
5903
5837
  if (path.length >= 2 ||
@@ -5922,11 +5856,7 @@ class ParameterVariable extends LocalVariable {
5922
5856
  }
5923
5857
  }
5924
5858
  deoptimizePath(path) {
5925
- if (path.length === 0) {
5926
- this.markReassigned();
5927
- return;
5928
- }
5929
- if (this.deoptimizedFields.has(UnknownKey)) {
5859
+ if (path.length === 0 || this.deoptimizedFields.has(UnknownKey)) {
5930
5860
  return;
5931
5861
  }
5932
5862
  const key = path[0];
@@ -7302,11 +7232,11 @@ function getGlobalAtPath(path) {
7302
7232
  }
7303
7233
 
7304
7234
  class GlobalVariable extends Variable {
7305
- constructor(name) {
7306
- super(name);
7235
+ constructor() {
7236
+ super(...arguments);
7307
7237
  // Ensure we use live-bindings for globals as we do not know if they have
7308
7238
  // been reassigned
7309
- this.markReassigned();
7239
+ this.isReassigned = true;
7310
7240
  }
7311
7241
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
7312
7242
  switch (interaction.type) {
@@ -7360,7 +7290,6 @@ class Identifier extends NodeBase {
7360
7290
  constructor() {
7361
7291
  super(...arguments);
7362
7292
  this.variable = null;
7363
- this.isReferenceVariable = false;
7364
7293
  }
7365
7294
  get isTDZAccess() {
7366
7295
  if (!isFlagSet(this.flags, 4 /* Flag.tdzAccessDefined */)) {
@@ -7381,7 +7310,6 @@ class Identifier extends NodeBase {
7381
7310
  if (!this.variable && is_reference(this, this.parent)) {
7382
7311
  this.variable = this.scope.findVariable(this.name);
7383
7312
  this.variable.addReference(this);
7384
- this.isReferenceVariable = true;
7385
7313
  }
7386
7314
  }
7387
7315
  declare(kind, init) {
@@ -7544,9 +7472,6 @@ class Identifier extends NodeBase {
7544
7472
  this.variable.consolidateInitializers();
7545
7473
  this.scope.context.requestTreeshakingPass();
7546
7474
  }
7547
- if (this.isReferenceVariable) {
7548
- this.variable.addUsedPlace(this);
7549
- }
7550
7475
  }
7551
7476
  getVariableRespectingTDZ() {
7552
7477
  if (this.isPossibleTDZ()) {
@@ -7866,17 +7791,10 @@ class RestElement extends NodeBase {
7866
7791
  }
7867
7792
  }
7868
7793
 
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() { } };
7873
7794
  class FunctionBase extends NodeBase {
7874
7795
  constructor() {
7875
7796
  super(...arguments);
7876
- this.knownParameterValues = [];
7877
- this.allArguments = [];
7878
7797
  this.objectEntity = null;
7879
- this.functionParametersOptimized = false;
7880
7798
  }
7881
7799
  get async() {
7882
7800
  return isFlagSet(this.flags, 256 /* Flag.async */);
@@ -7896,87 +7814,6 @@ class FunctionBase extends NodeBase {
7896
7814
  set generator(value) {
7897
7815
  this.flags = setFlag(this.flags, 4194304 /* Flag.generator */, value);
7898
7816
  }
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
- }
7980
7817
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
7981
7818
  if (interaction.type === INTERACTION_CALLED) {
7982
7819
  const { parameters } = this.scope;
@@ -8001,7 +7838,6 @@ class FunctionBase extends NodeBase {
8001
7838
  this.addArgumentToBeDeoptimized(argument);
8002
7839
  }
8003
7840
  }
8004
- this.allArguments.push(args);
8005
7841
  }
8006
7842
  else {
8007
7843
  this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
@@ -8016,7 +7852,6 @@ class FunctionBase extends NodeBase {
8016
7852
  for (const parameterList of this.scope.parameters) {
8017
7853
  for (const parameter of parameterList) {
8018
7854
  parameter.deoptimizePath(UNKNOWN_PATH);
8019
- parameter.markReassigned();
8020
7855
  }
8021
7856
  }
8022
7857
  }
@@ -8062,30 +7897,7 @@ class FunctionBase extends NodeBase {
8062
7897
  }
8063
7898
  return false;
8064
7899
  }
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
- }
8078
7900
  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;
8089
7901
  if (!this.deoptimized)
8090
7902
  this.applyDeoptimizations();
8091
7903
  this.included = true;
@@ -8835,7 +8647,7 @@ class MemberExpression extends NodeBase {
8835
8647
  }
8836
8648
  deoptimizeCache() {
8837
8649
  const { expressionsToBeDeoptimized, object } = this;
8838
- this.expressionsToBeDeoptimized = [];
8650
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
8839
8651
  this.propertyKey = UnknownKey;
8840
8652
  object.deoptimizePath(UNKNOWN_PATH);
8841
8653
  for (const expression of expressionsToBeDeoptimized) {
@@ -8984,9 +8796,6 @@ class MemberExpression extends NodeBase {
8984
8796
  this.object.deoptimizeArgumentsOnInteractionAtPath(this.accessInteraction, [propertyKey], SHARED_RECURSION_TRACKER);
8985
8797
  this.scope.context.requestTreeshakingPass();
8986
8798
  }
8987
- if (this.variable) {
8988
- this.variable.addUsedPlace(this);
8989
- }
8990
8799
  }
8991
8800
  applyAssignmentDeoptimization() {
8992
8801
  this.assignmentDeoptimized = true;
@@ -9636,24 +9445,15 @@ class ConditionalExpression extends NodeBase {
9636
9445
  this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
9637
9446
  }
9638
9447
  deoptimizeCache() {
9639
- if (this.usedBranch ||
9640
- this.isBranchResolutionAnalysed ||
9641
- this.expressionsToBeDeoptimized.length > 0) {
9642
- // Request another pass because we need to ensure "include" runs again if it is rendered
9643
- this.scope.context.requestTreeshakingPass();
9644
- }
9645
- const { expressionsToBeDeoptimized } = this;
9646
- if (expressionsToBeDeoptimized.length > 0) {
9647
- this.expressionsToBeDeoptimized = [];
9648
- for (const expression of expressionsToBeDeoptimized) {
9649
- expression.deoptimizeCache();
9650
- }
9651
- }
9652
- this.isBranchResolutionAnalysed = false;
9653
9448
  if (this.usedBranch !== null) {
9654
9449
  const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
9655
9450
  this.usedBranch = null;
9656
9451
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
9452
+ const { expressionsToBeDeoptimized } = this;
9453
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
9454
+ for (const expression of expressionsToBeDeoptimized) {
9455
+ expression.deoptimizeCache();
9456
+ }
9657
9457
  }
9658
9458
  }
9659
9459
  deoptimizePath(path) {
@@ -9667,10 +9467,10 @@ class ConditionalExpression extends NodeBase {
9667
9467
  }
9668
9468
  }
9669
9469
  getLiteralValueAtPath(path, recursionTracker, origin) {
9670
- this.expressionsToBeDeoptimized.push(origin);
9671
9470
  const usedBranch = this.getUsedBranch();
9672
9471
  if (!usedBranch)
9673
9472
  return UnknownValue;
9473
+ this.expressionsToBeDeoptimized.push(origin);
9674
9474
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
9675
9475
  }
9676
9476
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -9869,10 +9669,6 @@ class FunctionDeclaration extends FunctionNode {
9869
9669
  this.id.variable.isId = true;
9870
9670
  }
9871
9671
  }
9872
- onlyFunctionCallUsed() {
9873
- // call super.onlyFunctionCallUsed for export default anonymous function
9874
- return this.id?.variable.getOnlyFunctionCallUsed() ?? super.onlyFunctionCallUsed();
9875
- }
9876
9672
  parseNode(esTreeNode) {
9877
9673
  if (esTreeNode.id !== null) {
9878
9674
  this.id = new Identifier(this, this.scope.parent).parseNode(esTreeNode.id);
@@ -10161,7 +9957,7 @@ class IfStatement extends NodeBase {
10161
9957
  this.testValue = unset;
10162
9958
  }
10163
9959
  deoptimizeCache() {
10164
- this.testValue = unset;
9960
+ this.testValue = UnknownValue;
10165
9961
  }
10166
9962
  hasEffects(context) {
10167
9963
  if (this.test.hasEffects(context)) {
@@ -10969,24 +10765,18 @@ class LogicalExpression extends NodeBase {
10969
10765
  this.right.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
10970
10766
  }
10971
10767
  deoptimizeCache() {
10972
- if (this.usedBranch ||
10973
- this.isBranchResolutionAnalysed ||
10974
- this.expressionsToBeDeoptimized.length > 0) {
10975
- // Request another pass because we need to ensure "include" runs again if it is rendered
10976
- this.scope.context.requestTreeshakingPass();
10977
- }
10978
- const { expressionsToBeDeoptimized } = this;
10979
- if (expressionsToBeDeoptimized.length > 0) {
10980
- this.expressionsToBeDeoptimized = [];
10981
- for (const expression of expressionsToBeDeoptimized) {
10982
- expression.deoptimizeCache();
10983
- }
10984
- }
10985
- this.isBranchResolutionAnalysed = false;
10986
10768
  if (this.usedBranch) {
10987
10769
  const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
10988
10770
  this.usedBranch = null;
10989
10771
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
10772
+ const { scope: { context }, expressionsToBeDeoptimized } = this;
10773
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
10774
+ for (const expression of expressionsToBeDeoptimized) {
10775
+ expression.deoptimizeCache();
10776
+ }
10777
+ // Request another pass because we need to ensure "include" runs again if
10778
+ // it is rendered
10779
+ context.requestTreeshakingPass();
10990
10780
  }
10991
10781
  }
10992
10782
  deoptimizePath(path) {
@@ -11000,10 +10790,10 @@ class LogicalExpression extends NodeBase {
11000
10790
  }
11001
10791
  }
11002
10792
  getLiteralValueAtPath(path, recursionTracker, origin) {
11003
- this.expressionsToBeDeoptimized.push(origin);
11004
10793
  const usedBranch = this.getUsedBranch();
11005
10794
  if (!usedBranch)
11006
10795
  return UnknownValue;
10796
+ this.expressionsToBeDeoptimized.push(origin);
11007
10797
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
11008
10798
  }
11009
10799
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -11945,15 +11735,6 @@ class ExportDefaultVariable extends LocalVariable {
11945
11735
  this.name = identifier.name;
11946
11736
  }
11947
11737
  }
11948
- addUsedPlace(usedPlace) {
11949
- const original = this.getOriginalVariable();
11950
- if (original === this) {
11951
- super.addUsedPlace(usedPlace);
11952
- }
11953
- else {
11954
- original.addUsedPlace(usedPlace);
11955
- }
11956
- }
11957
11738
  forbidName(name) {
11958
11739
  const original = this.getOriginalVariable();
11959
11740
  if (original === this) {
@@ -12227,7 +12008,7 @@ class UpdateExpression extends NodeBase {
12227
12008
  this.argument.deoptimizePath(EMPTY_PATH);
12228
12009
  if (this.argument instanceof Identifier) {
12229
12010
  const variable = this.scope.findVariable(this.argument.name);
12230
- variable.markReassigned();
12011
+ variable.isReassigned = true;
12231
12012
  }
12232
12013
  this.scope.context.requestTreeshakingPass();
12233
12014
  }
@@ -18344,7 +18125,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
18344
18125
 
18345
18126
  function flru (max) {
18346
18127
  var num, curr, prev;
18347
- var limit = max ;
18128
+ var limit = max || 1;
18348
18129
 
18349
18130
  function keep(key, value) {
18350
18131
  if (++num > limit) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -14,7 +14,6 @@ const ArrowFunctionExpression = 'ArrowFunctionExpression';
14
14
  const BlockStatement = 'BlockStatement';
15
15
  const CallExpression = 'CallExpression';
16
16
  const CatchClause = 'CatchClause';
17
- const ExportDefaultDeclaration = 'ExportDefaultDeclaration';
18
17
  const ExpressionStatement = 'ExpressionStatement';
19
18
  const Identifier = 'Identifier';
20
19
  const Literal = 'Literal';
@@ -24,7 +23,6 @@ const Program = 'Program';
24
23
  const Property = 'Property';
25
24
  const ReturnStatement = 'ReturnStatement';
26
25
  const TemplateLiteral = 'TemplateLiteral';
27
- const VariableDeclarator = 'VariableDeclarator';
28
26
 
29
27
  const BLANK = Object.freeze(Object.create(null));
30
28
  const EMPTY_OBJECT = Object.freeze({});
@@ -550,7 +548,7 @@ function logDeprecation(deprecation, urlSnippet, plugin) {
550
548
  code: DEPRECATED_FEATURE,
551
549
  message: deprecation,
552
550
  url: getRollupUrl(urlSnippet),
553
- ...({})
551
+ ...(plugin ? { plugin } : {})
554
552
  };
555
553
  }
556
554
  function logConstVariableReassignError() {
@@ -1034,11 +1032,11 @@ function logFailedValidation(message) {
1034
1032
  };
1035
1033
  }
1036
1034
  function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
1037
- warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations);
1035
+ warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations, plugin);
1038
1036
  }
1039
1037
  function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
1040
- {
1041
- const warning = logDeprecation(deprecation, urlSnippet);
1038
+ if (activeDeprecation || strictDeprecations) {
1039
+ const warning = logDeprecation(deprecation, urlSnippet, plugin);
1042
1040
  if (strictDeprecations) {
1043
1041
  return error(warning);
1044
1042
  }
@@ -2206,4 +2204,4 @@ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal
2206
2204
  return convertProgram(astBuffer.buffer, getReadStringFunction(astBuffer));
2207
2205
  };
2208
2206
 
2209
- export { ANNOTATION_KEY, ArrowFunctionExpression, BLANK, BlockStatement, CallExpression, CatchClause, EMPTY_ARRAY, EMPTY_OBJECT, EMPTY_SET, ExportDefaultDeclaration, ExpressionStatement, FIXED_STRINGS, INVALID_ANNOTATION_KEY, Identifier, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, Literal, Program, Property, ReturnStatement, TemplateLiteral, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, VariableDeclarator, addTrailingSlashIfMissed, augmentCodeLocation, augmentLogMessage, convertAnnotations, convertNode, convertString, error, getAliasName, getImportPath, getReadStringFunction, getRollupError, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logConstVariableReassignError, logCyclicCrossChunkReexport, logDuplicateArgumentNameError, logDuplicateExportError, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingEntryExport, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logParseError, logPluginError, logRedeclarationError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, parseAstAsync, printQuotedStringList, relative, relativeId, warnDeprecation };
2207
+ export { ANNOTATION_KEY, ArrowFunctionExpression, BLANK, BlockStatement, CallExpression, CatchClause, EMPTY_ARRAY, EMPTY_OBJECT, EMPTY_SET, ExpressionStatement, FIXED_STRINGS, INVALID_ANNOTATION_KEY, Identifier, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, Literal, Program, Property, ReturnStatement, TemplateLiteral, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, addTrailingSlashIfMissed, augmentCodeLocation, augmentLogMessage, convertAnnotations, convertNode, convertString, error, getAliasName, getImportPath, getReadStringFunction, getRollupError, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logConstVariableReassignError, logCyclicCrossChunkReexport, logDuplicateArgumentNameError, logDuplicateExportError, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingEntryExport, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logParseError, logPluginError, logRedeclarationError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, parseAstAsync, printQuotedStringList, relative, relativeId, warnDeprecation };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.16.2
4
- Mon, 22 Apr 2024 15:18:39 GMT - commit 18839eb234f79adc44a591e355fd7b3243a4cd21
3
+ Rollup.js v4.16.4
4
+ Tue, 23 Apr 2024 13:14:37 GMT - commit 1c404fa352b70007066e94ff4c1981f8046f8cef
5
5
 
6
6
  https://github.com/rollup/rollup
7
7