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.
@@ -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/parseAst.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
 
package/dist/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,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
 
@@ -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
 
@@ -438,7 +438,7 @@ function logDeprecation(deprecation, urlSnippet, plugin) {
438
438
  code: DEPRECATED_FEATURE,
439
439
  message: deprecation,
440
440
  url: getRollupUrl(urlSnippet),
441
- ...({})
441
+ ...(plugin ? { plugin } : {})
442
442
  };
443
443
  }
444
444
  function logConstVariableReassignError() {
@@ -980,11 +980,11 @@ function logFailedValidation(message) {
980
980
  };
981
981
  }
982
982
  function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
983
- warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations);
983
+ warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations, plugin);
984
984
  }
985
985
  function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
986
- {
987
- const warning = logDeprecation(deprecation, urlSnippet);
986
+ if (activeDeprecation || strictDeprecations) {
987
+ const warning = logDeprecation(deprecation, urlSnippet, plugin);
988
988
  if (strictDeprecations) {
989
989
  return error(warning);
990
990
  }
@@ -1005,7 +1005,6 @@ const ArrowFunctionExpression = 'ArrowFunctionExpression';
1005
1005
  const BlockStatement = 'BlockStatement';
1006
1006
  const CallExpression = 'CallExpression';
1007
1007
  const CatchClause = 'CatchClause';
1008
- const ExportDefaultDeclaration = 'ExportDefaultDeclaration';
1009
1008
  const ExpressionStatement = 'ExpressionStatement';
1010
1009
  const Identifier = 'Identifier';
1011
1010
  const Literal = 'Literal';
@@ -1015,7 +1014,6 @@ const Program = 'Program';
1015
1014
  const Property = 'Property';
1016
1015
  const ReturnStatement = 'ReturnStatement';
1017
1016
  const TemplateLiteral = 'TemplateLiteral';
1018
- const VariableDeclarator = 'VariableDeclarator';
1019
1017
 
1020
1018
  // This file is generated by scripts/generate-string-constants.js.
1021
1019
  // Do not edit this file directly.
@@ -2278,7 +2276,6 @@ exports.CatchClause = CatchClause;
2278
2276
  exports.EMPTY_ARRAY = EMPTY_ARRAY;
2279
2277
  exports.EMPTY_OBJECT = EMPTY_OBJECT;
2280
2278
  exports.EMPTY_SET = EMPTY_SET;
2281
- exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
2282
2279
  exports.ExpressionStatement = ExpressionStatement;
2283
2280
  exports.FIXED_STRINGS = FIXED_STRINGS;
2284
2281
  exports.INVALID_ANNOTATION_KEY = INVALID_ANNOTATION_KEY;
@@ -2314,7 +2311,6 @@ exports.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = URL_TREATING_MODULE_AS_EXTE
2314
2311
  exports.URL_TREESHAKE = URL_TREESHAKE;
2315
2312
  exports.URL_TREESHAKE_MODULESIDEEFFECTS = URL_TREESHAKE_MODULESIDEEFFECTS;
2316
2313
  exports.URL_WATCH = URL_WATCH;
2317
- exports.VariableDeclarator = VariableDeclarator;
2318
2314
  exports.addTrailingSlashIfMissed = addTrailingSlashIfMissed;
2319
2315
  exports.augmentCodeLocation = augmentCodeLocation;
2320
2316
  exports.augmentLogMessage = augmentLogMessage;
@@ -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
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version = "4.16.2";
34
+ var version = "4.16.4";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -3393,9 +3393,6 @@ const NODE_INTERACTION_UNKNOWN_CALL = {
3393
3393
  };
3394
3394
 
3395
3395
  class Variable extends ExpressionEntity {
3396
- markReassigned() {
3397
- this.isReassigned = true;
3398
- }
3399
3396
  constructor(name) {
3400
3397
  super();
3401
3398
  this.name = name;
@@ -3403,36 +3400,16 @@ class Variable extends ExpressionEntity {
3403
3400
  this.forbiddenNames = null;
3404
3401
  this.initReached = false;
3405
3402
  this.isId = false;
3403
+ this.isReassigned = false;
3406
3404
  this.kind = null;
3407
3405
  this.renderBaseName = null;
3408
3406
  this.renderName = null;
3409
- this.isReassigned = false;
3410
- this.onlyFunctionCallUsed = true;
3411
3407
  }
3412
3408
  /**
3413
3409
  * Binds identifiers that reference this variable to this variable.
3414
3410
  * Necessary to be able to change variable names.
3415
3411
  */
3416
3412
  addReference(_identifier) { }
3417
- /**
3418
- * Check if the identifier variable is only used as function call
3419
- * Forward the check to the export default variable if it is only used once
3420
- * @returns true if the variable is only used as function call
3421
- */
3422
- getOnlyFunctionCallUsed() {
3423
- return this.onlyFunctionCallUsed;
3424
- }
3425
- /**
3426
- * Collect the places where the identifier variable is used
3427
- * @param usedPlace Where the variable is used
3428
- */
3429
- addUsedPlace(usedPlace) {
3430
- const isFunctionCall = usedPlace.parent.type === parseAst_js.CallExpression &&
3431
- usedPlace.parent.callee === usedPlace;
3432
- if (!isFunctionCall && usedPlace.parent.type !== parseAst_js.ExportDefaultDeclaration) {
3433
- this.onlyFunctionCallUsed = false;
3434
- }
3435
- }
3436
3413
  /**
3437
3414
  * Prevent this variable from being renamed to this name to avoid name
3438
3415
  * collisions
@@ -7170,7 +7147,7 @@ class LocalVariable extends Variable {
7170
7147
  return;
7171
7148
  }
7172
7149
  if (path.length === 0) {
7173
- this.markReassigned();
7150
+ this.isReassigned = true;
7174
7151
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
7175
7152
  this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
7176
7153
  for (const expression of expressionsToBeDeoptimized) {
@@ -7264,7 +7241,7 @@ class LocalVariable extends Variable {
7264
7241
  if (this.additionalInitializers === null) {
7265
7242
  this.additionalInitializers = [this.init];
7266
7243
  this.init = UNKNOWN_EXPRESSION;
7267
- this.markReassigned();
7244
+ this.isReassigned = true;
7268
7245
  }
7269
7246
  return this.additionalInitializers;
7270
7247
  }
@@ -7282,8 +7259,6 @@ class ParameterVariable extends LocalVariable {
7282
7259
  this.deoptimizations = new PathTracker();
7283
7260
  this.deoptimizedFields = new Set();
7284
7261
  this.entitiesToBeDeoptimized = new Set();
7285
- this.knownExpressionsToBeDeoptimized = [];
7286
- this.knownValue = UNKNOWN_EXPRESSION;
7287
7262
  }
7288
7263
  addEntityToBeDeoptimized(entity) {
7289
7264
  if (entity === UNKNOWN_EXPRESSION) {
@@ -7313,47 +7288,6 @@ class ParameterVariable extends LocalVariable {
7313
7288
  }
7314
7289
  }
7315
7290
  }
7316
- markReassigned() {
7317
- if (this.isReassigned) {
7318
- return;
7319
- }
7320
- super.markReassigned();
7321
- for (const expression of this.knownExpressionsToBeDeoptimized) {
7322
- expression.deoptimizeCache();
7323
- }
7324
- this.knownExpressionsToBeDeoptimized = [];
7325
- }
7326
- /**
7327
- * If we are sure about the value of this parameter, we can set it here.
7328
- * It can be a literal or the only possible value of the parameter.
7329
- * an undefined value means that the parameter is not known.
7330
- * @param value The known value of the parameter to be set.
7331
- */
7332
- setKnownValue(value) {
7333
- if (this.isReassigned) {
7334
- return;
7335
- }
7336
- if (this.knownValue !== value) {
7337
- for (const expression of this.knownExpressionsToBeDeoptimized) {
7338
- expression.deoptimizeCache();
7339
- }
7340
- this.knownExpressionsToBeDeoptimized = [];
7341
- }
7342
- this.knownValue = value;
7343
- }
7344
- getLiteralValueAtPath(path, recursionTracker, origin) {
7345
- if (this.isReassigned) {
7346
- return UnknownValue;
7347
- }
7348
- this.knownExpressionsToBeDeoptimized.push(origin);
7349
- return recursionTracker.withTrackedEntityAtPath(path, this.knownValue, () => this.knownValue.getLiteralValueAtPath(path, recursionTracker, origin), UnknownValue);
7350
- }
7351
- hasEffectsOnInteractionAtPath(path, interaction, context) {
7352
- // assigned is a bit different, since the value has a new name (the parameter)
7353
- return interaction.type === INTERACTION_ASSIGNED
7354
- ? super.hasEffectsOnInteractionAtPath(path, interaction, context)
7355
- : this.knownValue.hasEffectsOnInteractionAtPath(path, interaction, context);
7356
- }
7357
7291
  deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
7358
7292
  // For performance reasons, we fully deoptimize all deeper interactions
7359
7293
  if (path.length >= 2 ||
@@ -7378,11 +7312,7 @@ class ParameterVariable extends LocalVariable {
7378
7312
  }
7379
7313
  }
7380
7314
  deoptimizePath(path) {
7381
- if (path.length === 0) {
7382
- this.markReassigned();
7383
- return;
7384
- }
7385
- if (this.deoptimizedFields.has(UnknownKey)) {
7315
+ if (path.length === 0 || this.deoptimizedFields.has(UnknownKey)) {
7386
7316
  return;
7387
7317
  }
7388
7318
  const key = path[0];
@@ -8744,11 +8674,11 @@ function getGlobalAtPath(path) {
8744
8674
  }
8745
8675
 
8746
8676
  class GlobalVariable extends Variable {
8747
- constructor(name) {
8748
- super(name);
8677
+ constructor() {
8678
+ super(...arguments);
8749
8679
  // Ensure we use live-bindings for globals as we do not know if they have
8750
8680
  // been reassigned
8751
- this.markReassigned();
8681
+ this.isReassigned = true;
8752
8682
  }
8753
8683
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
8754
8684
  switch (interaction.type) {
@@ -8802,7 +8732,6 @@ class Identifier extends NodeBase {
8802
8732
  constructor() {
8803
8733
  super(...arguments);
8804
8734
  this.variable = null;
8805
- this.isReferenceVariable = false;
8806
8735
  }
8807
8736
  get isTDZAccess() {
8808
8737
  if (!isFlagSet(this.flags, 4 /* Flag.tdzAccessDefined */)) {
@@ -8823,7 +8752,6 @@ class Identifier extends NodeBase {
8823
8752
  if (!this.variable && is_reference(this, this.parent)) {
8824
8753
  this.variable = this.scope.findVariable(this.name);
8825
8754
  this.variable.addReference(this);
8826
- this.isReferenceVariable = true;
8827
8755
  }
8828
8756
  }
8829
8757
  declare(kind, init) {
@@ -8986,9 +8914,6 @@ class Identifier extends NodeBase {
8986
8914
  this.variable.consolidateInitializers();
8987
8915
  this.scope.context.requestTreeshakingPass();
8988
8916
  }
8989
- if (this.isReferenceVariable) {
8990
- this.variable.addUsedPlace(this);
8991
- }
8992
8917
  }
8993
8918
  getVariableRespectingTDZ() {
8994
8919
  if (this.isPossibleTDZ()) {
@@ -9308,17 +9233,10 @@ class RestElement extends NodeBase {
9308
9233
  }
9309
9234
  }
9310
9235
 
9311
- // This handler does nothing.
9312
- // Since we always re-evaluate argument values in a new tree-shaking pass,
9313
- // we don't need to get notified if it is deoptimized.
9314
- const EMPTY_DEOPTIMIZABLE_HANDLER = { deoptimizeCache() { } };
9315
9236
  class FunctionBase extends NodeBase {
9316
9237
  constructor() {
9317
9238
  super(...arguments);
9318
- this.knownParameterValues = [];
9319
- this.allArguments = [];
9320
9239
  this.objectEntity = null;
9321
- this.functionParametersOptimized = false;
9322
9240
  }
9323
9241
  get async() {
9324
9242
  return isFlagSet(this.flags, 256 /* Flag.async */);
@@ -9338,87 +9256,6 @@ class FunctionBase extends NodeBase {
9338
9256
  set generator(value) {
9339
9257
  this.flags = setFlag(this.flags, 4194304 /* Flag.generator */, value);
9340
9258
  }
9341
- /**
9342
- * update knownParameterValues when a call is made to this function
9343
- * @param newArguments arguments of the call
9344
- */
9345
- updateKnownParameterValues(newArguments) {
9346
- for (let position = 0; position < this.params.length; position++) {
9347
- // only the "this" argument newArguments[0] can be null
9348
- // it's possible that some arguments are empty, so the value is undefined
9349
- const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
9350
- const parameter = this.params[position];
9351
- // RestElement can be, and can only be, the last parameter
9352
- if (parameter instanceof RestElement) {
9353
- return;
9354
- }
9355
- const knownParameterValue = this.knownParameterValues[position];
9356
- if (knownParameterValue === undefined) {
9357
- this.knownParameterValues[position] = argument;
9358
- continue;
9359
- }
9360
- if (knownParameterValue === UNKNOWN_EXPRESSION ||
9361
- knownParameterValue === argument ||
9362
- (knownParameterValue instanceof Identifier &&
9363
- argument instanceof Identifier &&
9364
- knownParameterValue.variable === argument.variable)) {
9365
- continue;
9366
- }
9367
- const oldValue = knownParameterValue.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
9368
- const newValue = argument.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, EMPTY_DEOPTIMIZABLE_HANDLER);
9369
- if (oldValue !== newValue || typeof oldValue === 'symbol') {
9370
- this.knownParameterValues[position] = UNKNOWN_EXPRESSION;
9371
- } // else both are the same literal, no need to update
9372
- }
9373
- }
9374
- forwardArgumentsForFunctionCalledOnce(newArguments) {
9375
- for (let position = 0; position < this.params.length; position++) {
9376
- const parameter = this.params[position];
9377
- if (parameter instanceof Identifier) {
9378
- const ParameterVariable = parameter.variable;
9379
- const argument = newArguments[position + 1] ?? UNDEFINED_EXPRESSION;
9380
- ParameterVariable?.setKnownValue(argument);
9381
- }
9382
- }
9383
- }
9384
- /**
9385
- * each time tree-shake starts, this method should be called to reoptimize the parameters
9386
- * a parameter's state will change at most twice:
9387
- * `undefined` (no call is made) -> an expression -> `UnknownArgument`
9388
- * we are sure it will converge, and can use state from last iteration
9389
- */
9390
- applyFunctionParameterOptimization() {
9391
- if (this.allArguments.length === 0) {
9392
- return;
9393
- }
9394
- if (this.allArguments.length === 1) {
9395
- // we are sure what knownParameterValues will be, so skip it and do setKnownValue
9396
- this.forwardArgumentsForFunctionCalledOnce(this.allArguments[0]);
9397
- return;
9398
- }
9399
- // reoptimize all arguments, that's why we save them
9400
- for (const argumentsList of this.allArguments) {
9401
- this.updateKnownParameterValues(argumentsList);
9402
- }
9403
- for (let position = 0; position < this.params.length; position++) {
9404
- const parameter = this.params[position];
9405
- // Parameters without default values
9406
- if (parameter instanceof Identifier) {
9407
- const parameterVariable = parameter.variable;
9408
- // Only the RestElement may be undefined
9409
- const knownParameterValue = this.knownParameterValues[position];
9410
- parameterVariable?.setKnownValue(knownParameterValue);
9411
- }
9412
- }
9413
- }
9414
- deoptimizeFunctionParameters() {
9415
- for (const parameter of this.params) {
9416
- if (parameter instanceof Identifier) {
9417
- const parameterVariable = parameter.variable;
9418
- parameterVariable?.markReassigned();
9419
- }
9420
- }
9421
- }
9422
9259
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
9423
9260
  if (interaction.type === INTERACTION_CALLED) {
9424
9261
  const { parameters } = this.scope;
@@ -9443,7 +9280,6 @@ class FunctionBase extends NodeBase {
9443
9280
  this.addArgumentToBeDeoptimized(argument);
9444
9281
  }
9445
9282
  }
9446
- this.allArguments.push(args);
9447
9283
  }
9448
9284
  else {
9449
9285
  this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
@@ -9458,7 +9294,6 @@ class FunctionBase extends NodeBase {
9458
9294
  for (const parameterList of this.scope.parameters) {
9459
9295
  for (const parameter of parameterList) {
9460
9296
  parameter.deoptimizePath(UNKNOWN_PATH);
9461
- parameter.markReassigned();
9462
9297
  }
9463
9298
  }
9464
9299
  }
@@ -9504,30 +9339,7 @@ class FunctionBase extends NodeBase {
9504
9339
  }
9505
9340
  return false;
9506
9341
  }
9507
- /**
9508
- * If the function (expression or declaration) is only used as function calls
9509
- */
9510
- onlyFunctionCallUsed() {
9511
- let variable = null;
9512
- if (this.parent.type === parseAst_js.VariableDeclarator) {
9513
- variable = this.parent.id.variable ?? null;
9514
- }
9515
- if (this.parent.type === parseAst_js.ExportDefaultDeclaration) {
9516
- variable = this.parent.variable;
9517
- }
9518
- return variable?.getOnlyFunctionCallUsed() ?? false;
9519
- }
9520
9342
  include(context, includeChildrenRecursively) {
9521
- const isIIFE = this.parent.type === parseAst_js.CallExpression &&
9522
- this.parent.callee === this;
9523
- const shoulOptimizeFunctionParameters = isIIFE || this.onlyFunctionCallUsed();
9524
- if (shoulOptimizeFunctionParameters) {
9525
- this.applyFunctionParameterOptimization();
9526
- }
9527
- else if (this.functionParametersOptimized) {
9528
- this.deoptimizeFunctionParameters();
9529
- }
9530
- this.functionParametersOptimized = shoulOptimizeFunctionParameters;
9531
9343
  if (!this.deoptimized)
9532
9344
  this.applyDeoptimizations();
9533
9345
  this.included = true;
@@ -10277,7 +10089,7 @@ class MemberExpression extends NodeBase {
10277
10089
  }
10278
10090
  deoptimizeCache() {
10279
10091
  const { expressionsToBeDeoptimized, object } = this;
10280
- this.expressionsToBeDeoptimized = [];
10092
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10281
10093
  this.propertyKey = UnknownKey;
10282
10094
  object.deoptimizePath(UNKNOWN_PATH);
10283
10095
  for (const expression of expressionsToBeDeoptimized) {
@@ -10426,9 +10238,6 @@ class MemberExpression extends NodeBase {
10426
10238
  this.object.deoptimizeArgumentsOnInteractionAtPath(this.accessInteraction, [propertyKey], SHARED_RECURSION_TRACKER);
10427
10239
  this.scope.context.requestTreeshakingPass();
10428
10240
  }
10429
- if (this.variable) {
10430
- this.variable.addUsedPlace(this);
10431
- }
10432
10241
  }
10433
10242
  applyAssignmentDeoptimization() {
10434
10243
  this.assignmentDeoptimized = true;
@@ -11078,24 +10887,15 @@ class ConditionalExpression extends NodeBase {
11078
10887
  this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
11079
10888
  }
11080
10889
  deoptimizeCache() {
11081
- if (this.usedBranch ||
11082
- this.isBranchResolutionAnalysed ||
11083
- this.expressionsToBeDeoptimized.length > 0) {
11084
- // Request another pass because we need to ensure "include" runs again if it is rendered
11085
- this.scope.context.requestTreeshakingPass();
11086
- }
11087
- const { expressionsToBeDeoptimized } = this;
11088
- if (expressionsToBeDeoptimized.length > 0) {
11089
- this.expressionsToBeDeoptimized = [];
11090
- for (const expression of expressionsToBeDeoptimized) {
11091
- expression.deoptimizeCache();
11092
- }
11093
- }
11094
- this.isBranchResolutionAnalysed = false;
11095
10890
  if (this.usedBranch !== null) {
11096
10891
  const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
11097
10892
  this.usedBranch = null;
11098
10893
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
10894
+ const { expressionsToBeDeoptimized } = this;
10895
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
10896
+ for (const expression of expressionsToBeDeoptimized) {
10897
+ expression.deoptimizeCache();
10898
+ }
11099
10899
  }
11100
10900
  }
11101
10901
  deoptimizePath(path) {
@@ -11109,10 +10909,10 @@ class ConditionalExpression extends NodeBase {
11109
10909
  }
11110
10910
  }
11111
10911
  getLiteralValueAtPath(path, recursionTracker, origin) {
11112
- this.expressionsToBeDeoptimized.push(origin);
11113
10912
  const usedBranch = this.getUsedBranch();
11114
10913
  if (!usedBranch)
11115
10914
  return UnknownValue;
10915
+ this.expressionsToBeDeoptimized.push(origin);
11116
10916
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
11117
10917
  }
11118
10918
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -11311,10 +11111,6 @@ class FunctionDeclaration extends FunctionNode {
11311
11111
  this.id.variable.isId = true;
11312
11112
  }
11313
11113
  }
11314
- onlyFunctionCallUsed() {
11315
- // call super.onlyFunctionCallUsed for export default anonymous function
11316
- return this.id?.variable.getOnlyFunctionCallUsed() ?? super.onlyFunctionCallUsed();
11317
- }
11318
11114
  parseNode(esTreeNode) {
11319
11115
  if (esTreeNode.id !== null) {
11320
11116
  this.id = new Identifier(this, this.scope.parent).parseNode(esTreeNode.id);
@@ -11603,7 +11399,7 @@ class IfStatement extends NodeBase {
11603
11399
  this.testValue = unset;
11604
11400
  }
11605
11401
  deoptimizeCache() {
11606
- this.testValue = unset;
11402
+ this.testValue = UnknownValue;
11607
11403
  }
11608
11404
  hasEffects(context) {
11609
11405
  if (this.test.hasEffects(context)) {
@@ -12411,24 +12207,18 @@ class LogicalExpression extends NodeBase {
12411
12207
  this.right.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
12412
12208
  }
12413
12209
  deoptimizeCache() {
12414
- if (this.usedBranch ||
12415
- this.isBranchResolutionAnalysed ||
12416
- this.expressionsToBeDeoptimized.length > 0) {
12417
- // Request another pass because we need to ensure "include" runs again if it is rendered
12418
- this.scope.context.requestTreeshakingPass();
12419
- }
12420
- const { expressionsToBeDeoptimized } = this;
12421
- if (expressionsToBeDeoptimized.length > 0) {
12422
- this.expressionsToBeDeoptimized = [];
12423
- for (const expression of expressionsToBeDeoptimized) {
12424
- expression.deoptimizeCache();
12425
- }
12426
- }
12427
- this.isBranchResolutionAnalysed = false;
12428
12210
  if (this.usedBranch) {
12429
12211
  const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
12430
12212
  this.usedBranch = null;
12431
12213
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
12214
+ const { scope: { context }, expressionsToBeDeoptimized } = this;
12215
+ this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
12216
+ for (const expression of expressionsToBeDeoptimized) {
12217
+ expression.deoptimizeCache();
12218
+ }
12219
+ // Request another pass because we need to ensure "include" runs again if
12220
+ // it is rendered
12221
+ context.requestTreeshakingPass();
12432
12222
  }
12433
12223
  }
12434
12224
  deoptimizePath(path) {
@@ -12442,10 +12232,10 @@ class LogicalExpression extends NodeBase {
12442
12232
  }
12443
12233
  }
12444
12234
  getLiteralValueAtPath(path, recursionTracker, origin) {
12445
- this.expressionsToBeDeoptimized.push(origin);
12446
12235
  const usedBranch = this.getUsedBranch();
12447
12236
  if (!usedBranch)
12448
12237
  return UnknownValue;
12238
+ this.expressionsToBeDeoptimized.push(origin);
12449
12239
  return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
12450
12240
  }
12451
12241
  getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
@@ -13387,15 +13177,6 @@ class ExportDefaultVariable extends LocalVariable {
13387
13177
  this.name = identifier.name;
13388
13178
  }
13389
13179
  }
13390
- addUsedPlace(usedPlace) {
13391
- const original = this.getOriginalVariable();
13392
- if (original === this) {
13393
- super.addUsedPlace(usedPlace);
13394
- }
13395
- else {
13396
- original.addUsedPlace(usedPlace);
13397
- }
13398
- }
13399
13180
  forbidName(name) {
13400
13181
  const original = this.getOriginalVariable();
13401
13182
  if (original === this) {
@@ -13669,7 +13450,7 @@ class UpdateExpression extends NodeBase {
13669
13450
  this.argument.deoptimizePath(EMPTY_PATH);
13670
13451
  if (this.argument instanceof Identifier) {
13671
13452
  const variable = this.scope.findVariable(this.argument.name);
13672
- variable.markReassigned();
13453
+ variable.isReassigned = true;
13673
13454
  }
13674
13455
  this.scope.context.requestTreeshakingPass();
13675
13456
  }
@@ -19654,7 +19435,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
19654
19435
 
19655
19436
  function flru (max) {
19656
19437
  var num, curr, prev;
19657
- var limit = max ;
19438
+ var limit = max || 1;
19658
19439
 
19659
19440
  function keep(key, value) {
19660
19441
  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
 
@@ -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