rollup 3.20.1 → 3.20.3-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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
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$1 = "3.20.1";
34
+ var version$1 = "3.20.3-0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -91,6 +91,11 @@ async function asyncFlatten(array) {
91
91
  const BLANK = Object.freeze(Object.create(null));
92
92
  const EMPTY_OBJECT = Object.freeze({});
93
93
  const EMPTY_ARRAY = Object.freeze([]);
94
+ const EMPTY_SET = Object.freeze(new (class extends Set {
95
+ add() {
96
+ throw new Error('Cannot add to empty set');
97
+ }
98
+ })());
94
99
 
95
100
  function getLocator$1(source, options) {
96
101
  if (options === void 0) { options = {}; }
@@ -147,6 +152,9 @@ const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
147
152
  const ELLIPSIS = '...';
148
153
  function getCodeFrame(source, line, column) {
149
154
  let lines = source.split('\n');
155
+ // Needed if a plugin did not generate correct sourcemaps
156
+ if (line > lines.length)
157
+ return '';
150
158
  const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length +
151
159
  MIN_CHARACTERS_SHOWN_AFTER_LOCATION +
152
160
  ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
@@ -3057,11 +3065,8 @@ const UNKNOWN_RETURN_EXPRESSION = [
3057
3065
  false
3058
3066
  ];
3059
3067
  const deoptimizeInteraction = (interaction) => {
3060
- interaction.thisArg?.deoptimizePath(UNKNOWN_PATH);
3061
- if (interaction.args) {
3062
- for (const argument of interaction.args) {
3063
- argument.deoptimizePath(UNKNOWN_PATH);
3064
- }
3068
+ for (const argument of interaction.args) {
3069
+ argument?.deoptimizePath(UNKNOWN_PATH);
3065
3070
  }
3066
3071
  };
3067
3072
 
@@ -3069,23 +3074,18 @@ const INTERACTION_ACCESSED = 0;
3069
3074
  const INTERACTION_ASSIGNED = 1;
3070
3075
  const INTERACTION_CALLED = 2;
3071
3076
  const NODE_INTERACTION_UNKNOWN_ACCESS = {
3072
- args: null,
3073
- thisArg: null,
3077
+ args: [null],
3074
3078
  type: INTERACTION_ACCESSED
3075
3079
  };
3076
- const UNKNOWN_ARG = [UNKNOWN_EXPRESSION];
3077
3080
  const NODE_INTERACTION_UNKNOWN_ASSIGNMENT = {
3078
- args: UNKNOWN_ARG,
3079
- thisArg: null,
3081
+ args: [null, UNKNOWN_EXPRESSION],
3080
3082
  type: INTERACTION_ASSIGNED
3081
3083
  };
3082
- const NO_ARGS = [];
3083
3084
  // While this is technically a call without arguments, we can compare against
3084
- // this reference in places where precise values or thisArg would make a
3085
+ // this reference in places where precise values or this argument would make a
3085
3086
  // difference
3086
3087
  const NODE_INTERACTION_UNKNOWN_CALL = {
3087
- args: NO_ARGS,
3088
- thisArg: null,
3088
+ args: [null],
3089
3089
  type: INTERACTION_CALLED,
3090
3090
  withNew: false
3091
3091
  };
@@ -5652,8 +5652,8 @@ const returnsString = {
5652
5652
  const stringReplace = {
5653
5653
  value: {
5654
5654
  hasEffectsWhenCalled({ args }, context) {
5655
- const argument1 = args[1];
5656
- return (args.length < 2 ||
5655
+ const argument1 = args[2];
5656
+ return (args.length < 3 ||
5657
5657
  (typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
5658
5658
  deoptimizeCache() { }
5659
5659
  }) === 'symbol' &&
@@ -6351,7 +6351,7 @@ class NodeBase extends ExpressionEntity {
6351
6351
  }
6352
6352
  }
6353
6353
  setAssignedValue(value) {
6354
- this.assignmentInteraction = { args: [value], thisArg: null, type: INTERACTION_ASSIGNED };
6354
+ this.assignmentInteraction = { args: [null, value], type: INTERACTION_ASSIGNED };
6355
6355
  }
6356
6356
  shouldBeIncluded(context) {
6357
6357
  return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
@@ -6410,19 +6410,19 @@ class Method extends ExpressionEntity {
6410
6410
  super();
6411
6411
  this.description = description;
6412
6412
  }
6413
- deoptimizeArgumentsOnInteractionAtPath({ type, thisArg }, path) {
6413
+ deoptimizeArgumentsOnInteractionAtPath({ args, type }, path) {
6414
6414
  if (type === INTERACTION_CALLED && path.length === 0 && this.description.mutatesSelfAsArray) {
6415
- thisArg?.deoptimizePath(UNKNOWN_INTEGER_PATH);
6415
+ args[0]?.deoptimizePath(UNKNOWN_INTEGER_PATH);
6416
6416
  }
6417
6417
  }
6418
- getReturnExpressionWhenCalledAtPath(path, { thisArg }) {
6418
+ getReturnExpressionWhenCalledAtPath(path, { args }) {
6419
6419
  if (path.length > 0) {
6420
6420
  return UNKNOWN_RETURN_EXPRESSION;
6421
6421
  }
6422
6422
  return [
6423
6423
  this.description.returnsPrimitive ||
6424
6424
  (this.description.returns === 'self'
6425
- ? thisArg || UNKNOWN_EXPRESSION
6425
+ ? args[0] || UNKNOWN_EXPRESSION
6426
6426
  : this.description.returns()),
6427
6427
  false
6428
6428
  ];
@@ -6433,14 +6433,14 @@ class Method extends ExpressionEntity {
6433
6433
  return true;
6434
6434
  }
6435
6435
  if (type === INTERACTION_CALLED) {
6436
- const { args, thisArg } = interaction;
6436
+ const { args } = interaction;
6437
6437
  if (this.description.mutatesSelfAsArray === true &&
6438
- thisArg?.hasEffectsOnInteractionAtPath(UNKNOWN_INTEGER_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context)) {
6438
+ args[0]?.hasEffectsOnInteractionAtPath(UNKNOWN_INTEGER_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context)) {
6439
6439
  return true;
6440
6440
  }
6441
6441
  if (this.description.callsArgs) {
6442
6442
  for (const argumentIndex of this.description.callsArgs) {
6443
- if (args[argumentIndex]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
6443
+ if (args[argumentIndex + 1]?.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)) {
6444
6444
  return true;
6445
6445
  }
6446
6446
  }
@@ -6540,18 +6540,13 @@ class ObjectEntity extends ExpressionEntity {
6540
6540
  }
6541
6541
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
6542
6542
  const [key, ...subPath] = path;
6543
- const { args, thisArg, type } = interaction;
6543
+ const { args, type } = interaction;
6544
6544
  if (this.hasLostTrack ||
6545
6545
  // single paths that are deoptimized will not become getters or setters
6546
6546
  ((type === INTERACTION_CALLED || path.length > 1) &&
6547
6547
  (this.hasUnknownDeoptimizedProperty ||
6548
6548
  (typeof key === 'string' && this.deoptimizedPaths[key])))) {
6549
- thisArg?.deoptimizePath(UNKNOWN_PATH);
6550
- if (args) {
6551
- for (const argument of args) {
6552
- argument.deoptimizePath(UNKNOWN_PATH);
6553
- }
6554
- }
6549
+ deoptimizeInteraction(interaction);
6555
6550
  return;
6556
6551
  }
6557
6552
  const [propertiesForExactMatchByKey, relevantPropertiesByKey, relevantUnmatchableProperties] = type === INTERACTION_CALLED || path.length > 1
@@ -6572,11 +6567,8 @@ class ObjectEntity extends ExpressionEntity {
6572
6567
  }
6573
6568
  }
6574
6569
  if (!this.immutable) {
6575
- if (thisArg) {
6576
- this.additionalExpressionsToBeDeoptimized.add(thisArg);
6577
- }
6578
- if (args) {
6579
- for (const argument of args) {
6570
+ for (const argument of args) {
6571
+ if (argument) {
6580
6572
  this.additionalExpressionsToBeDeoptimized.add(argument);
6581
6573
  }
6582
6574
  }
@@ -6606,11 +6598,8 @@ class ObjectEntity extends ExpressionEntity {
6606
6598
  }
6607
6599
  }
6608
6600
  if (!this.immutable) {
6609
- if (thisArg) {
6610
- this.additionalExpressionsToBeDeoptimized.add(thisArg);
6611
- }
6612
- if (args) {
6613
- for (const argument of args) {
6601
+ for (const argument of args) {
6602
+ if (argument) {
6614
6603
  this.additionalExpressionsToBeDeoptimized.add(argument);
6615
6604
  }
6616
6605
  }
@@ -7144,7 +7133,7 @@ class LocalVariable extends Variable {
7144
7133
  if (!this.isReassigned) {
7145
7134
  this.isReassigned = true;
7146
7135
  const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
7147
- this.expressionsToBeDeoptimized = [];
7136
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
7148
7137
  for (const expression of expressionsToBeDeoptimized) {
7149
7138
  expression.deoptimizeCache();
7150
7139
  }
@@ -7256,43 +7245,68 @@ class LocalVariable extends Variable {
7256
7245
  }
7257
7246
  }
7258
7247
 
7248
+ const MAX_TRACKED_INTERACTIONS = 20;
7249
+ const NO_INTERACTIONS = EMPTY_ARRAY;
7250
+ const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]);
7251
+ const EMPTY_PATH_TRACKER = new PathTracker();
7252
+ const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]);
7259
7253
  class ParameterVariable extends LocalVariable {
7260
7254
  constructor(name, declarator, context) {
7261
7255
  super(name, declarator, UNKNOWN_EXPRESSION, context);
7262
7256
  this.deoptimizationInteractions = [];
7263
- this.deoptimizations = new DiscriminatedPathTracker();
7257
+ this.deoptimizations = new PathTracker();
7264
7258
  this.deoptimizedFields = new Set();
7265
7259
  this.entitiesToBeDeoptimized = new Set();
7266
7260
  }
7267
7261
  addEntityToBeDeoptimized(entity) {
7268
- if (this.deoptimizedFields.has(UnknownKey)) {
7262
+ if (entity === UNKNOWN_EXPRESSION) {
7263
+ // As unknown expressions fully deoptimize all interactions, we can clear
7264
+ // the interaction cache at this point provided we keep this optimization
7265
+ // in mind when adding new interactions
7266
+ if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
7267
+ this.entitiesToBeDeoptimized.add(UNKNOWN_EXPRESSION);
7268
+ for (const { interaction } of this.deoptimizationInteractions) {
7269
+ deoptimizeInteraction(interaction);
7270
+ }
7271
+ this.deoptimizationInteractions = NO_INTERACTIONS;
7272
+ }
7273
+ }
7274
+ else if (this.deoptimizedFields.has(UnknownKey)) {
7275
+ // This means that we already deoptimized all interactions and no longer
7276
+ // track them
7269
7277
  entity.deoptimizePath(UNKNOWN_PATH);
7270
7278
  }
7271
- else {
7279
+ else if (!this.entitiesToBeDeoptimized.has(entity)) {
7280
+ this.entitiesToBeDeoptimized.add(entity);
7272
7281
  for (const field of this.deoptimizedFields) {
7273
7282
  entity.deoptimizePath([field]);
7274
7283
  }
7284
+ for (const { interaction, path } of this.deoptimizationInteractions) {
7285
+ entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
7286
+ }
7275
7287
  }
7276
- for (const { interaction, path } of this.deoptimizationInteractions) {
7277
- entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
7278
- }
7279
- this.entitiesToBeDeoptimized.add(entity);
7280
7288
  }
7281
7289
  deoptimizeArgumentsOnInteractionAtPath(interaction, path) {
7282
7290
  // For performance reasons, we fully deoptimize all deeper interactions
7283
- if (path.length >= 2) {
7291
+ if (path.length >= 2 ||
7292
+ this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION) ||
7293
+ this.deoptimizationInteractions.length >= MAX_TRACKED_INTERACTIONS ||
7294
+ (path.length === 1 &&
7295
+ (this.deoptimizedFields.has(UnknownKey) ||
7296
+ (interaction.type === INTERACTION_CALLED && this.deoptimizedFields.has(path[0]))))) {
7284
7297
  deoptimizeInteraction(interaction);
7285
7298
  return;
7286
7299
  }
7287
- if (interaction.thisArg &&
7288
- !this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args, interaction.thisArg)) {
7300
+ if (!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args)) {
7289
7301
  for (const entity of this.entitiesToBeDeoptimized) {
7290
7302
  entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER);
7291
7303
  }
7292
- this.deoptimizationInteractions.push({
7293
- interaction,
7294
- path
7295
- });
7304
+ if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) {
7305
+ this.deoptimizationInteractions.push({
7306
+ interaction,
7307
+ path
7308
+ });
7309
+ }
7296
7310
  }
7297
7311
  }
7298
7312
  deoptimizePath(path) {
@@ -7305,8 +7319,17 @@ class ParameterVariable extends LocalVariable {
7305
7319
  }
7306
7320
  this.deoptimizedFields.add(key);
7307
7321
  for (const entity of this.entitiesToBeDeoptimized) {
7322
+ // We do not need a recursion tracker here as we already track whether
7323
+ // this field is deoptimized
7308
7324
  entity.deoptimizePath(path);
7309
7325
  }
7326
+ if (key === UnknownKey) {
7327
+ // save some memory
7328
+ this.deoptimizationInteractions = NO_INTERACTIONS;
7329
+ this.deoptimizations = EMPTY_PATH_TRACKER;
7330
+ this.deoptimizedFields = UNKNOWN_DEOPTIMIZED_FIELD;
7331
+ this.entitiesToBeDeoptimized = UNKNOWN_DEOPTIMIZED_ENTITY;
7332
+ }
7310
7333
  }
7311
7334
  getReturnExpressionWhenCalledAtPath(path) {
7312
7335
  // We deoptimize everything that is called as that will trivially deoptimize
@@ -7316,7 +7339,7 @@ class ParameterVariable extends LocalVariable {
7316
7339
  this.deoptimizePath(UNKNOWN_PATH);
7317
7340
  }
7318
7341
  else if (!this.deoptimizedFields.has(path[0])) {
7319
- this.deoptimizePath(path.slice(0, 1));
7342
+ this.deoptimizePath([path[0]]);
7320
7343
  }
7321
7344
  return UNKNOWN_RETURN_EXPRESSION;
7322
7345
  }
@@ -7647,13 +7670,13 @@ const PF = {
7647
7670
  const MUTATES_ARG_WITHOUT_ACCESSOR = {
7648
7671
  __proto__: null,
7649
7672
  [ValueProperties]: {
7650
- deoptimizeArgumentsOnCall({ args: [firstArgument] }) {
7673
+ deoptimizeArgumentsOnCall({ args: [, firstArgument] }) {
7651
7674
  firstArgument?.deoptimizePath(UNKNOWN_PATH);
7652
7675
  },
7653
7676
  getLiteralValue: getTruthyLiteralValue,
7654
7677
  hasEffectsWhenCalled({ args }, context) {
7655
- return (args.length === 0 ||
7656
- args[0].hasEffectsOnInteractionAtPath(UNKNOWN_NON_ACCESSOR_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context));
7678
+ return (args.length <= 1 ||
7679
+ args[1].hasEffectsOnInteractionAtPath(UNKNOWN_NON_ACCESSOR_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context));
7657
7680
  }
7658
7681
  }
7659
7682
  };
@@ -9076,18 +9099,19 @@ class FunctionBase extends NodeBase {
9076
9099
  const { parameters } = this.scope;
9077
9100
  const { args } = interaction;
9078
9101
  let hasRest = false;
9079
- for (let position = 0; position < args.length; position++) {
9102
+ for (let position = 0; position < args.length - 1; position++) {
9080
9103
  const parameter = this.params[position];
9104
+ // Only the "this" argument arg[0] can be null
9105
+ const argument = args[position + 1];
9081
9106
  if (hasRest || parameter instanceof RestElement) {
9082
9107
  hasRest = true;
9083
- args[position].deoptimizePath(UNKNOWN_PATH);
9108
+ argument.deoptimizePath(UNKNOWN_PATH);
9084
9109
  }
9085
9110
  else if (parameter instanceof Identifier) {
9086
- // args[position].deoptimizePath(UNKNOWN_PATH);
9087
- parameters[position][0].addEntityToBeDeoptimized(args[position]);
9111
+ parameters[position][0].addEntityToBeDeoptimized(argument);
9088
9112
  }
9089
9113
  else if (parameter) {
9090
- args[position].deoptimizePath(UNKNOWN_PATH);
9114
+ argument.deoptimizePath(UNKNOWN_PATH);
9091
9115
  }
9092
9116
  }
9093
9117
  }
@@ -9469,8 +9493,9 @@ class FunctionNode extends FunctionBase {
9469
9493
  }
9470
9494
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
9471
9495
  super.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
9472
- if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.thisArg) {
9473
- this.scope.thisVariable.addEntityToBeDeoptimized(interaction.thisArg);
9496
+ if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.args[0]) {
9497
+ // args[0] is the "this" argument
9498
+ this.scope.thisVariable.addEntityToBeDeoptimized(interaction.args[0]);
9474
9499
  }
9475
9500
  }
9476
9501
  hasEffects(context) {
@@ -9800,10 +9825,10 @@ class MemberExpression extends NodeBase {
9800
9825
  }
9801
9826
  }
9802
9827
  deoptimizeCache() {
9803
- const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
9804
- this.expressionsToBeDeoptimized = [];
9828
+ const { expressionsToBeDeoptimized, object } = this;
9829
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
9805
9830
  this.propertyKey = UnknownKey;
9806
- this.object.deoptimizePath(UNKNOWN_PATH);
9831
+ object.deoptimizePath(UNKNOWN_PATH);
9807
9832
  for (const expression of expressionsToBeDeoptimized) {
9808
9833
  expression.deoptimizeCache();
9809
9834
  }
@@ -9829,8 +9854,8 @@ class MemberExpression extends NodeBase {
9829
9854
  if (this.isUndefined) {
9830
9855
  return undefined;
9831
9856
  }
9832
- this.expressionsToBeDeoptimized.push(origin);
9833
- if (path.length < MAX_PATH_DEPTH) {
9857
+ if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
9858
+ this.expressionsToBeDeoptimized.push(origin);
9834
9859
  return this.object.getLiteralValueAtPath([this.getPropertyKey(), ...path], recursionTracker, origin);
9835
9860
  }
9836
9861
  return UnknownValue;
@@ -9842,8 +9867,8 @@ class MemberExpression extends NodeBase {
9842
9867
  if (this.isUndefined) {
9843
9868
  return [UNDEFINED_EXPRESSION, false];
9844
9869
  }
9845
- this.expressionsToBeDeoptimized.push(origin);
9846
- if (path.length < MAX_PATH_DEPTH) {
9870
+ if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) {
9871
+ this.expressionsToBeDeoptimized.push(origin);
9847
9872
  return this.object.getReturnExpressionWhenCalledAtPath([this.getPropertyKey(), ...path], interaction, recursionTracker, origin);
9848
9873
  }
9849
9874
  return UNKNOWN_RETURN_EXPRESSION;
@@ -9902,7 +9927,7 @@ class MemberExpression extends NodeBase {
9902
9927
  }
9903
9928
  initialise() {
9904
9929
  this.propertyKey = getResolvablePropertyKey(this);
9905
- this.accessInteraction = { args: null, thisArg: this.object, type: INTERACTION_ACCESSED };
9930
+ this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
9906
9931
  }
9907
9932
  isSkippedAsOptional(origin) {
9908
9933
  return (!this.variable &&
@@ -9932,8 +9957,7 @@ class MemberExpression extends NodeBase {
9932
9957
  }
9933
9958
  setAssignedValue(value) {
9934
9959
  this.assignmentInteraction = {
9935
- args: [value],
9936
- thisArg: this.object,
9960
+ args: [this.object, value],
9937
9961
  type: INTERACTION_ASSIGNED
9938
9962
  };
9939
9963
  }
@@ -10033,27 +10057,22 @@ class CallExpressionBase extends NodeBase {
10033
10057
  this.expressionsToBeDeoptimized = new Set();
10034
10058
  }
10035
10059
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
10036
- const { args, thisArg } = interaction;
10060
+ const { args } = interaction;
10037
10061
  const [returnExpression, isPure] = this.getReturnExpression(recursionTracker);
10038
10062
  if (isPure)
10039
10063
  return;
10064
+ const deoptimizedExpressions = args.filter(expression => !!expression && expression !== UNKNOWN_EXPRESSION);
10065
+ if (deoptimizedExpressions.length === 0)
10066
+ return;
10040
10067
  if (returnExpression === UNKNOWN_EXPRESSION) {
10041
- thisArg?.deoptimizePath(UNKNOWN_PATH);
10042
- if (args) {
10043
- for (const argument of args) {
10044
- argument.deoptimizePath(UNKNOWN_PATH);
10045
- }
10068
+ for (const expression of deoptimizedExpressions) {
10069
+ expression.deoptimizePath(UNKNOWN_PATH);
10046
10070
  }
10047
10071
  }
10048
10072
  else {
10049
10073
  recursionTracker.withTrackedEntityAtPath(path, returnExpression, () => {
10050
- if (thisArg) {
10051
- this.expressionsToBeDeoptimized.add(thisArg);
10052
- }
10053
- if (args) {
10054
- for (const argument of args) {
10055
- this.expressionsToBeDeoptimized.add(argument);
10056
- }
10074
+ for (const expression of deoptimizedExpressions) {
10075
+ this.expressionsToBeDeoptimized.add(expression);
10057
10076
  }
10058
10077
  returnExpression.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
10059
10078
  }, null);
@@ -10062,10 +10081,13 @@ class CallExpressionBase extends NodeBase {
10062
10081
  deoptimizeCache() {
10063
10082
  if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
10064
10083
  this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
10065
- for (const expression of this.deoptimizableDependentExpressions) {
10084
+ const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
10085
+ this.expressionsToBeDeoptimized = EMPTY_SET;
10086
+ this.deoptimizableDependentExpressions = EMPTY_ARRAY;
10087
+ for (const expression of deoptimizableDependentExpressions) {
10066
10088
  expression.deoptimizeCache();
10067
10089
  }
10068
- for (const expression of this.expressionsToBeDeoptimized) {
10090
+ for (const expression of expressionsToBeDeoptimized) {
10069
10091
  expression.deoptimizePath(UNKNOWN_PATH);
10070
10092
  }
10071
10093
  }
@@ -10133,10 +10155,12 @@ class CallExpression extends CallExpressionBase {
10133
10155
  }
10134
10156
  }
10135
10157
  this.interaction = {
10136
- args: this.arguments,
10137
- thisArg: this.callee instanceof MemberExpression && !this.callee.variable
10138
- ? this.callee.object
10139
- : null,
10158
+ args: [
10159
+ this.callee instanceof MemberExpression && !this.callee.variable
10160
+ ? this.callee.object
10161
+ : null,
10162
+ ...this.arguments
10163
+ ],
10140
10164
  type: INTERACTION_CALLED,
10141
10165
  withNew: false
10142
10166
  };
@@ -10289,8 +10313,7 @@ class MethodBase extends NodeBase {
10289
10313
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
10290
10314
  if (interaction.type === INTERACTION_ACCESSED && this.kind === 'get' && path.length === 0) {
10291
10315
  return this.value.deoptimizeArgumentsOnInteractionAtPath({
10292
- args: NO_ARGS,
10293
- thisArg: interaction.thisArg,
10316
+ args: interaction.args,
10294
10317
  type: INTERACTION_CALLED,
10295
10318
  withNew: false
10296
10319
  }, EMPTY_PATH, recursionTracker);
@@ -10298,7 +10321,6 @@ class MethodBase extends NodeBase {
10298
10321
  if (interaction.type === INTERACTION_ASSIGNED && this.kind === 'set' && path.length === 0) {
10299
10322
  return this.value.deoptimizeArgumentsOnInteractionAtPath({
10300
10323
  args: interaction.args,
10301
- thisArg: interaction.thisArg,
10302
10324
  type: INTERACTION_CALLED,
10303
10325
  withNew: false
10304
10326
  }, EMPTY_PATH, recursionTracker);
@@ -10323,8 +10345,7 @@ class MethodBase extends NodeBase {
10323
10345
  hasEffectsOnInteractionAtPath(path, interaction, context) {
10324
10346
  if (this.kind === 'get' && interaction.type === INTERACTION_ACCESSED && path.length === 0) {
10325
10347
  return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
10326
- args: NO_ARGS,
10327
- thisArg: interaction.thisArg,
10348
+ args: interaction.args,
10328
10349
  type: INTERACTION_CALLED,
10329
10350
  withNew: false
10330
10351
  }, context);
@@ -10333,7 +10354,6 @@ class MethodBase extends NodeBase {
10333
10354
  if (this.kind === 'set' && interaction.type === INTERACTION_ASSIGNED) {
10334
10355
  return this.value.hasEffectsOnInteractionAtPath(EMPTY_PATH, {
10335
10356
  args: interaction.args,
10336
- thisArg: interaction.thisArg,
10337
10357
  type: INTERACTION_CALLED,
10338
10358
  withNew: false
10339
10359
  }, context);
@@ -10594,7 +10614,9 @@ class ConditionalExpression extends NodeBase {
10594
10614
  const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
10595
10615
  this.usedBranch = null;
10596
10616
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
10597
- for (const expression of this.expressionsToBeDeoptimized) {
10617
+ const { expressionsToBeDeoptimized } = this;
10618
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
10619
+ for (const expression of expressionsToBeDeoptimized) {
10598
10620
  expression.deoptimizeCache();
10599
10621
  }
10600
10622
  }
@@ -11726,12 +11748,14 @@ class LogicalExpression extends NodeBase {
11726
11748
  const unusedBranch = this.usedBranch === this.left ? this.right : this.left;
11727
11749
  this.usedBranch = null;
11728
11750
  unusedBranch.deoptimizePath(UNKNOWN_PATH);
11729
- for (const expression of this.expressionsToBeDeoptimized) {
11751
+ const { context, expressionsToBeDeoptimized } = this;
11752
+ this.expressionsToBeDeoptimized = EMPTY_ARRAY;
11753
+ for (const expression of expressionsToBeDeoptimized) {
11730
11754
  expression.deoptimizeCache();
11731
11755
  }
11732
11756
  // Request another pass because we need to ensure "include" runs again if
11733
11757
  // it is rendered
11734
- this.context.requestTreeshakingPass();
11758
+ context.requestTreeshakingPass();
11735
11759
  }
11736
11760
  }
11737
11761
  deoptimizePath(path) {
@@ -12001,8 +12025,7 @@ class NewExpression extends NodeBase {
12001
12025
  }
12002
12026
  initialise() {
12003
12027
  this.interaction = {
12004
- args: this.arguments,
12005
- thisArg: null,
12028
+ args: [null, ...this.arguments],
12006
12029
  type: INTERACTION_CALLED,
12007
12030
  withNew: true
12008
12031
  };
@@ -12124,6 +12147,9 @@ class Program extends NodeBase {
12124
12147
  this.hasLoggedEffect = false;
12125
12148
  }
12126
12149
  hasCachedEffects() {
12150
+ if (!this.included) {
12151
+ return false;
12152
+ }
12127
12153
  return this.hasCachedEffect === null
12128
12154
  ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
12129
12155
  : this.hasCachedEffect;
@@ -12518,16 +12544,19 @@ class TaggedTemplateExpression extends CallExpressionBase {
12518
12544
  this.tag.include(context, includeChildrenRecursively);
12519
12545
  this.quasi.include(context, includeChildrenRecursively);
12520
12546
  }
12521
- this.tag.includeCallArguments(context, this.interaction.args);
12547
+ this.tag.includeCallArguments(context, this.args);
12522
12548
  const [returnExpression] = this.getReturnExpression();
12523
12549
  if (!returnExpression.included) {
12524
12550
  returnExpression.include(context, false);
12525
12551
  }
12526
12552
  }
12527
12553
  initialise() {
12554
+ this.args = [UNKNOWN_EXPRESSION, ...this.quasi.expressions];
12528
12555
  this.interaction = {
12529
- args: [UNKNOWN_EXPRESSION, ...this.quasi.expressions],
12530
- thisArg: this.tag instanceof MemberExpression && !this.tag.variable ? this.tag.object : null,
12556
+ args: [
12557
+ this.tag instanceof MemberExpression && !this.tag.variable ? this.tag.object : null,
12558
+ ...this.args
12559
+ ],
12531
12560
  type: INTERACTION_CALLED,
12532
12561
  withNew: false
12533
12562
  };
@@ -12712,8 +12741,7 @@ class ThisExpression extends NodeBase {
12712
12741
  this.variable = this.scope.findVariable('this');
12713
12742
  }
12714
12743
  deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
12715
- // We rewrite the parameter so that a ThisVariable can detect self-mutations
12716
- this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction.thisArg === this ? { ...interaction, thisArg: this.variable } : interaction, path, recursionTracker);
12744
+ this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
12717
12745
  }
12718
12746
  deoptimizePath(path) {
12719
12747
  this.variable.deoptimizePath(path);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.20.1
4
- Thu, 23 Mar 2023 08:52:57 GMT - commit 75c5113e24f5857abf845776423f55f70b8d1c13
3
+ Rollup.js v3.20.3-0
4
+ Fri, 14 Apr 2023 05:11:57 GMT - commit 80c2fcb882e8a5ec2be167784d8ab14654f69379
5
5
 
6
6
  https://github.com/rollup/rollup
7
7