rollup 2.50.1 → 2.50.5

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/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -32,7 +32,7 @@ function _interopNamespaceDefault(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.50.1";
35
+ var version$1 = "2.50.5";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -3465,10 +3465,11 @@ const knownGlobals = {
3465
3465
  Promise: {
3466
3466
  __proto__: null,
3467
3467
  [ValueProperties]: IMPURE,
3468
- all: PF,
3468
+ all: O,
3469
3469
  prototype: O,
3470
- race: PF,
3471
- resolve: PF
3470
+ race: O,
3471
+ reject: O,
3472
+ resolve: O
3472
3473
  },
3473
3474
  propertyIsEnumerable: O,
3474
3475
  Proxy: O,
@@ -4262,6 +4263,7 @@ class Identifier extends NodeBase {
4262
4263
  this.deoptimized = true;
4263
4264
  if (this.variable !== null && this.variable instanceof LocalVariable) {
4264
4265
  this.variable.consolidateInitializers();
4266
+ this.context.requestTreeshakingPass();
4265
4267
  }
4266
4268
  }
4267
4269
  disallowImportReassignment() {
@@ -4788,7 +4790,7 @@ class Method extends ExpressionEntity {
4788
4790
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
4789
4791
  var _a, _b;
4790
4792
  if (path.length > 0 ||
4791
- (this.description.mutatesSelfAsArray &&
4793
+ (this.description.mutatesSelfAsArray === true &&
4792
4794
  ((_a = callOptions.thisParam) === null || _a === void 0 ? void 0 : _a.hasEffectsWhenAssignedAtPath(UNKNOWN_INTEGER_PATH, context)))) {
4793
4795
  return true;
4794
4796
  }
@@ -5053,11 +5055,16 @@ class SpreadElement extends NodeBase {
5053
5055
  this.argument.deoptimizeThisOnEventAtPath(event, [UnknownKey, ...path], thisParameter, recursionTracker);
5054
5056
  }
5055
5057
  }
5058
+ hasEffects(context) {
5059
+ return (this.argument.hasEffects(context) ||
5060
+ this.argument.hasEffectsWhenAccessedAtPath(UNKNOWN_PATH, context));
5061
+ }
5056
5062
  applyDeoptimizations() {
5057
5063
  this.deoptimized = true;
5058
5064
  // Only properties of properties of the argument could become subject to reassignment
5059
5065
  // This will also reassign the return values of iterators
5060
5066
  this.argument.deoptimizePath([UnknownKey, UnknownKey]);
5067
+ this.context.requestTreeshakingPass();
5061
5068
  }
5062
5069
  }
5063
5070
 
@@ -5207,6 +5214,7 @@ class RestElement extends NodeBase {
5207
5214
  this.deoptimized = true;
5208
5215
  if (this.declarationInit !== null) {
5209
5216
  this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
5217
+ this.context.requestTreeshakingPass();
5210
5218
  }
5211
5219
  }
5212
5220
  }
@@ -5244,7 +5252,7 @@ class FunctionNode extends NodeBase {
5244
5252
  }
5245
5253
  }
5246
5254
  getReturnExpressionWhenCalledAtPath(path) {
5247
- return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5255
+ return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5248
5256
  }
5249
5257
  hasEffects() {
5250
5258
  return this.id !== null && this.id.hasEffects();
@@ -5263,6 +5271,12 @@ class FunctionNode extends NodeBase {
5263
5271
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
5264
5272
  if (path.length > 0)
5265
5273
  return true;
5274
+ if (this.async &&
5275
+ this.scope
5276
+ .getReturnExpression()
5277
+ .hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context)) {
5278
+ return true;
5279
+ }
5266
5280
  for (const param of this.params) {
5267
5281
  if (param.hasEffects(context))
5268
5282
  return true;
@@ -5690,42 +5704,42 @@ const NEW_ARRAY_PROPERTIES = [
5690
5704
  { key: UnknownInteger, kind: 'init', property: UNKNOWN_EXPRESSION },
5691
5705
  { key: 'length', kind: 'init', property: UNKNOWN_LITERAL_NUMBER }
5692
5706
  ];
5693
- const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_BOOLEAN = [
5707
+ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN = [
5694
5708
  new Method({
5695
5709
  callsArgs: [0],
5696
- mutatesSelfAsArray: true,
5710
+ mutatesSelfAsArray: 'deopt-only',
5697
5711
  returns: null,
5698
5712
  returnsPrimitive: UNKNOWN_LITERAL_BOOLEAN
5699
5713
  })
5700
5714
  ];
5701
- const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_NUMBER = [
5715
+ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER = [
5702
5716
  new Method({
5703
5717
  callsArgs: [0],
5704
- mutatesSelfAsArray: true,
5718
+ mutatesSelfAsArray: 'deopt-only',
5705
5719
  returns: null,
5706
5720
  returnsPrimitive: UNKNOWN_LITERAL_NUMBER
5707
5721
  })
5708
5722
  ];
5709
- const METHOD_RETURNS_NEW_ARRAY = [
5723
+ const METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY = [
5710
5724
  new Method({
5711
5725
  callsArgs: null,
5712
- mutatesSelfAsArray: false,
5726
+ mutatesSelfAsArray: true,
5713
5727
  returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
5714
5728
  returnsPrimitive: null
5715
5729
  })
5716
5730
  ];
5717
- const METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY = [
5731
+ const METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY = [
5718
5732
  new Method({
5719
5733
  callsArgs: null,
5720
- mutatesSelfAsArray: true,
5734
+ mutatesSelfAsArray: 'deopt-only',
5721
5735
  returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
5722
5736
  returnsPrimitive: null
5723
5737
  })
5724
5738
  ];
5725
- const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_NEW_ARRAY = [
5739
+ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY = [
5726
5740
  new Method({
5727
5741
  callsArgs: [0],
5728
- mutatesSelfAsArray: true,
5742
+ mutatesSelfAsArray: 'deopt-only',
5729
5743
  returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
5730
5744
  returnsPrimitive: null
5731
5745
  })
@@ -5746,10 +5760,18 @@ const METHOD_MUTATES_SELF_RETURNS_UNKNOWN = [
5746
5760
  returnsPrimitive: UNKNOWN_EXPRESSION
5747
5761
  })
5748
5762
  ];
5749
- const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_UNKNOWN = [
5763
+ const METHOD_DEOPTS_SELF_RETURNS_UNKNOWN = [
5764
+ new Method({
5765
+ callsArgs: null,
5766
+ mutatesSelfAsArray: 'deopt-only',
5767
+ returns: null,
5768
+ returnsPrimitive: UNKNOWN_EXPRESSION
5769
+ })
5770
+ ];
5771
+ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN = [
5750
5772
  new Method({
5751
5773
  callsArgs: [0],
5752
- mutatesSelfAsArray: true,
5774
+ mutatesSelfAsArray: 'deopt-only',
5753
5775
  returns: null,
5754
5776
  returnsPrimitive: UNKNOWN_EXPRESSION
5755
5777
  })
@@ -5773,34 +5795,34 @@ const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF = [
5773
5795
  const ARRAY_PROTOTYPE = new ObjectEntity({
5774
5796
  __proto__: null,
5775
5797
  // We assume that accessors have effects as we do not track the accessed value afterwards
5776
- at: METHOD_MUTATES_SELF_RETURNS_UNKNOWN,
5777
- concat: METHOD_RETURNS_NEW_ARRAY,
5798
+ at: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN,
5799
+ concat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
5778
5800
  copyWithin: METHOD_MUTATES_SELF_RETURNS_SELF,
5779
- entries: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
5780
- every: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_BOOLEAN,
5801
+ entries: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
5802
+ every: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
5781
5803
  fill: METHOD_MUTATES_SELF_RETURNS_SELF,
5782
- filter: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_NEW_ARRAY,
5783
- find: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_UNKNOWN,
5784
- findIndex: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_NUMBER,
5785
- forEach: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_UNKNOWN,
5804
+ filter: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
5805
+ find: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
5806
+ findIndex: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER,
5807
+ forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
5786
5808
  includes: METHOD_RETURNS_BOOLEAN,
5787
5809
  indexOf: METHOD_RETURNS_NUMBER,
5788
5810
  join: METHOD_RETURNS_STRING,
5789
5811
  keys: METHOD_RETURNS_UNKNOWN,
5790
5812
  lastIndexOf: METHOD_RETURNS_NUMBER,
5791
- map: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_NEW_ARRAY,
5813
+ map: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
5792
5814
  pop: METHOD_MUTATES_SELF_RETURNS_UNKNOWN,
5793
5815
  push: METHOD_MUTATES_SELF_RETURNS_NUMBER,
5794
- reduce: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_UNKNOWN,
5795
- reduceRight: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_UNKNOWN,
5816
+ reduce: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
5817
+ reduceRight: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
5796
5818
  reverse: METHOD_MUTATES_SELF_RETURNS_SELF,
5797
5819
  shift: METHOD_MUTATES_SELF_RETURNS_UNKNOWN,
5798
- slice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
5799
- some: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_BOOLEAN,
5820
+ slice: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
5821
+ some: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN,
5800
5822
  sort: METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF,
5801
5823
  splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
5802
5824
  unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
5803
- values: METHOD_MUTATES_SELF_RETURNS_UNKNOWN
5825
+ values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
5804
5826
  }, OBJECT_PROTOTYPE);
5805
5827
 
5806
5828
  class ArrayExpression extends NodeBase {
@@ -6128,6 +6150,7 @@ class AssignmentExpression extends NodeBase {
6128
6150
  this.deoptimized = true;
6129
6151
  this.left.deoptimizePath(EMPTY_PATH);
6130
6152
  this.right.deoptimizePath(UNKNOWN_PATH);
6153
+ this.context.requestTreeshakingPass();
6131
6154
  }
6132
6155
  }
6133
6156
 
@@ -6156,12 +6179,20 @@ class AssignmentPattern extends NodeBase {
6156
6179
  this.deoptimized = true;
6157
6180
  this.left.deoptimizePath(EMPTY_PATH);
6158
6181
  this.right.deoptimizePath(UNKNOWN_PATH);
6182
+ this.context.requestTreeshakingPass();
6159
6183
  }
6160
6184
  }
6161
6185
 
6162
6186
  class AwaitExpression extends NodeBase {
6163
6187
  hasEffects(context) {
6164
- return !context.ignore.returnAwaitYield || this.argument.hasEffects(context);
6188
+ const { propertyReadSideEffects } = this.context.options
6189
+ .treeshake;
6190
+ return (!context.ignore.returnAwaitYield ||
6191
+ this.argument.hasEffects(context) ||
6192
+ this.argument.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
6193
+ (propertyReadSideEffects &&
6194
+ (propertyReadSideEffects === 'always' ||
6195
+ this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
6165
6196
  }
6166
6197
  include(context, includeChildrenRecursively) {
6167
6198
  if (!this.included) {
@@ -6442,10 +6473,9 @@ class MemberExpression extends NodeBase {
6442
6473
  this.propertyKey = getResolvablePropertyKey(this);
6443
6474
  }
6444
6475
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
6445
- const isCalleeOfDifferentParent = renderedParentType === CallExpression$1 && isCalleeOfRenderedParent;
6446
6476
  if (this.variable || this.replacement) {
6447
6477
  let replacement = this.variable ? this.variable.getName() : this.replacement;
6448
- if (isCalleeOfDifferentParent)
6478
+ if (renderedParentType && isCalleeOfRenderedParent)
6449
6479
  replacement = '0, ' + replacement;
6450
6480
  code.overwrite(this.start, this.end, replacement, {
6451
6481
  contentOnly: true,
@@ -6453,7 +6483,7 @@ class MemberExpression extends NodeBase {
6453
6483
  });
6454
6484
  }
6455
6485
  else {
6456
- if (isCalleeOfDifferentParent) {
6486
+ if (renderedParentType && isCalleeOfRenderedParent) {
6457
6487
  code.appendRight(this.start, '0, ');
6458
6488
  }
6459
6489
  const surroundingElement = renderedParentType || renderedSurroundingElement;
@@ -6477,6 +6507,7 @@ class MemberExpression extends NodeBase {
6477
6507
  if (this.parent instanceof AssignmentExpression) {
6478
6508
  this.object.deoptimizeThisOnEventAtPath(EVENT_ASSIGNED, [this.propertyKey], this.object, SHARED_RECURSION_TRACKER);
6479
6509
  }
6510
+ this.context.requestTreeshakingPass();
6480
6511
  }
6481
6512
  }
6482
6513
  disallowNamespaceReassignment() {
@@ -6661,7 +6692,10 @@ class CallExpression extends NodeBase {
6661
6692
  }
6662
6693
  render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
6663
6694
  const surroundingELement = renderedParentType || renderedSurroundingElement;
6664
- this.callee.render(code, options, surroundingELement ? { renderedSurroundingElement: surroundingELement } : BLANK);
6695
+ this.callee.render(code, options, {
6696
+ isCalleeOfRenderedParent: true,
6697
+ renderedSurroundingElement: surroundingELement
6698
+ });
6665
6699
  if (this.arguments.length > 0) {
6666
6700
  if (this.arguments[this.arguments.length - 1].included) {
6667
6701
  for (const arg of this.arguments) {
@@ -6695,6 +6729,7 @@ class CallExpression extends NodeBase {
6695
6729
  // This will make sure all properties of parameters behave as "unknown"
6696
6730
  argument.deoptimizePath(UNKNOWN_PATH);
6697
6731
  }
6732
+ this.context.requestTreeshakingPass();
6698
6733
  }
6699
6734
  getReturnExpression(recursionTracker = SHARED_RECURSION_TRACKER) {
6700
6735
  if (this.returnExpression === null) {
@@ -6707,12 +6742,14 @@ class CallExpression extends NodeBase {
6707
6742
 
6708
6743
  class CatchScope extends ParameterScope {
6709
6744
  addDeclaration(identifier, context, init, isHoisted) {
6710
- if (isHoisted) {
6711
- return this.parent.addDeclaration(identifier, context, init, isHoisted);
6712
- }
6713
- else {
6714
- return super.addDeclaration(identifier, context, init, false);
6745
+ const existingParameter = this.variables.get(identifier.name);
6746
+ if (existingParameter) {
6747
+ existingParameter.addDeclaration(identifier, init);
6748
+ return existingParameter;
6715
6749
  }
6750
+ // as parameters are handled differently, all remaining declarations are
6751
+ // hoisted
6752
+ return this.parent.addDeclaration(identifier, context, init, isHoisted);
6716
6753
  }
6717
6754
  }
6718
6755
 
@@ -6720,17 +6757,19 @@ class CatchClause extends NodeBase {
6720
6757
  createScope(parentScope) {
6721
6758
  this.scope = new CatchScope(parentScope, this.context);
6722
6759
  }
6723
- initialise() {
6724
- if (this.param) {
6760
+ parseNode(esTreeNode) {
6761
+ // Parameters need to be declared first as the logic is that hoisted body
6762
+ // variables are associated with outside vars unless there is a parameter,
6763
+ // in which case they are associated with the parameter
6764
+ const { param } = esTreeNode;
6765
+ if (param) {
6766
+ this.param = new (this.context.nodeConstructors[param.type] ||
6767
+ this.context.nodeConstructors.UnknownNode)(param, this, this.scope);
6725
6768
  this.param.declare('parameter', UNKNOWN_EXPRESSION);
6726
6769
  }
6727
- }
6728
- parseNode(esTreeNode) {
6729
- this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope);
6730
6770
  super.parseNode(esTreeNode);
6731
6771
  }
6732
6772
  }
6733
- CatchClause.prototype.preventChildBlockScope = true;
6734
6773
 
6735
6774
  class ChainExpression extends NodeBase {
6736
6775
  }
@@ -6927,7 +6966,7 @@ class ConditionalExpression extends NodeBase {
6927
6966
  usedBranch.includeCallArguments(context, args);
6928
6967
  }
6929
6968
  }
6930
- render(code, options, { isCalleeOfRenderedParent, renderedParentType, preventASI } = BLANK) {
6969
+ render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
6931
6970
  const usedBranch = this.getUsedBranch();
6932
6971
  if (!this.test.included) {
6933
6972
  const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
@@ -6943,16 +6982,16 @@ class ConditionalExpression extends NodeBase {
6943
6982
  }
6944
6983
  removeAnnotations(this, code);
6945
6984
  usedBranch.render(code, options, {
6946
- isCalleeOfRenderedParent: renderedParentType
6947
- ? isCalleeOfRenderedParent
6948
- : this.parent.callee === this,
6985
+ isCalleeOfRenderedParent,
6949
6986
  preventASI: true,
6950
- renderedParentType: renderedParentType || this.parent.type
6987
+ ...(renderedSurroundingElement
6988
+ ? { renderedSurroundingElement }
6989
+ : { renderedParentType: renderedParentType || this.parent.type })
6951
6990
  });
6952
6991
  }
6953
6992
  else {
6954
6993
  this.test.render(code, options, {
6955
- renderedSurroundingElement: renderedParentType
6994
+ renderedSurroundingElement: renderedParentType || renderedSurroundingElement
6956
6995
  });
6957
6996
  this.consequent.render(code, options);
6958
6997
  this.alternate.render(code, options);
@@ -7100,6 +7139,7 @@ class ForInStatement extends NodeBase {
7100
7139
  applyDeoptimizations() {
7101
7140
  this.deoptimized = true;
7102
7141
  this.left.deoptimizePath(EMPTY_PATH);
7142
+ this.context.requestTreeshakingPass();
7103
7143
  }
7104
7144
  }
7105
7145
 
@@ -7139,6 +7179,7 @@ class ForOfStatement extends NodeBase {
7139
7179
  applyDeoptimizations() {
7140
7180
  this.deoptimized = true;
7141
7181
  this.left.deoptimizePath(EMPTY_PATH);
7182
+ this.context.requestTreeshakingPass();
7142
7183
  }
7143
7184
  }
7144
7185
 
@@ -7780,11 +7821,11 @@ class LogicalExpression extends NodeBase {
7780
7821
  }
7781
7822
  removeAnnotations(this, code);
7782
7823
  this.getUsedBranch().render(code, options, {
7783
- isCalleeOfRenderedParent: renderedParentType
7784
- ? isCalleeOfRenderedParent
7785
- : this.parent.callee === this,
7824
+ isCalleeOfRenderedParent,
7786
7825
  preventASI,
7787
- renderedParentType: renderedParentType || this.parent.type
7826
+ ...(renderedSurroundingElement
7827
+ ? { renderedSurroundingElement }
7828
+ : { renderedParentType: renderedParentType || this.parent.type })
7788
7829
  });
7789
7830
  }
7790
7831
  else {
@@ -8388,6 +8429,7 @@ class NewExpression extends NodeBase {
8388
8429
  // This will make sure all properties of parameters behave as "unknown"
8389
8430
  argument.deoptimizePath(UNKNOWN_PATH);
8390
8431
  }
8432
+ this.context.requestTreeshakingPass();
8391
8433
  }
8392
8434
  }
8393
8435
 
@@ -8433,6 +8475,7 @@ class ObjectExpression extends NodeBase {
8433
8475
  if (this.objectEntity !== null) {
8434
8476
  return this.objectEntity;
8435
8477
  }
8478
+ let prototype = OBJECT_PROTOTYPE;
8436
8479
  const properties = [];
8437
8480
  for (const property of this.properties) {
8438
8481
  if (property instanceof SpreadElement) {
@@ -8456,13 +8499,16 @@ class ObjectExpression extends NodeBase {
8456
8499
  ? property.key.name
8457
8500
  : String(property.key.value);
8458
8501
  if (key === '__proto__' && property.kind === 'init') {
8459
- properties.unshift({ key: UnknownKey, kind: 'init', property: UNKNOWN_EXPRESSION });
8502
+ prototype =
8503
+ property.value instanceof Literal && property.value.value === null
8504
+ ? null
8505
+ : property.value;
8460
8506
  continue;
8461
8507
  }
8462
8508
  }
8463
8509
  properties.push({ key, kind: property.kind, property });
8464
8510
  }
8465
- return (this.objectEntity = new ObjectEntity(properties, OBJECT_PROTOTYPE));
8511
+ return (this.objectEntity = new ObjectEntity(properties, prototype));
8466
8512
  }
8467
8513
  }
8468
8514
 
@@ -8534,6 +8580,7 @@ class Property extends MethodBase {
8534
8580
  this.deoptimized = true;
8535
8581
  if (this.declarationInit !== null) {
8536
8582
  this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
8583
+ this.context.requestTreeshakingPass();
8537
8584
  }
8538
8585
  }
8539
8586
  }
@@ -8602,13 +8649,10 @@ class ReturnStatement extends NodeBase {
8602
8649
 
8603
8650
  class SequenceExpression extends NodeBase {
8604
8651
  deoptimizePath(path) {
8605
- if (path.length > 0)
8606
- this.expressions[this.expressions.length - 1].deoptimizePath(path);
8652
+ this.expressions[this.expressions.length - 1].deoptimizePath(path);
8607
8653
  }
8608
8654
  deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
8609
- if (event === EVENT_CALLED || path.length > 0) {
8610
- this.expressions[this.expressions.length - 1].deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
8611
- }
8655
+ this.expressions[this.expressions.length - 1].deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
8612
8656
  }
8613
8657
  getLiteralValueAtPath(path, recursionTracker, origin) {
8614
8658
  return this.expressions[this.expressions.length - 1].getLiteralValueAtPath(path, recursionTracker, origin);
@@ -8625,8 +8669,7 @@ class SequenceExpression extends NodeBase {
8625
8669
  this.expressions[this.expressions.length - 1].hasEffectsWhenAccessedAtPath(path, context));
8626
8670
  }
8627
8671
  hasEffectsWhenAssignedAtPath(path, context) {
8628
- return (path.length === 0 ||
8629
- this.expressions[this.expressions.length - 1].hasEffectsWhenAssignedAtPath(path, context));
8672
+ return this.expressions[this.expressions.length - 1].hasEffectsWhenAssignedAtPath(path, context);
8630
8673
  }
8631
8674
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
8632
8675
  return this.expressions[this.expressions.length - 1].hasEffectsWhenCalledAtPath(path, callOptions, context);
@@ -8655,13 +8698,18 @@ class SequenceExpression extends NodeBase {
8655
8698
  if (includedNodes === 1 && preventASI) {
8656
8699
  removeLineBreaks(code, start, node.start);
8657
8700
  }
8658
- if (node === lastNode && includedNodes === 1) {
8659
- node.render(code, options, {
8660
- isCalleeOfRenderedParent: renderedParentType
8661
- ? isCalleeOfRenderedParent
8662
- : this.parent.callee === this,
8663
- renderedParentType: renderedParentType || this.parent.type
8664
- });
8701
+ if (includedNodes === 1) {
8702
+ if (node === lastNode) {
8703
+ node.render(code, options, {
8704
+ isCalleeOfRenderedParent,
8705
+ renderedParentType: renderedParentType || this.parent.type
8706
+ });
8707
+ }
8708
+ else {
8709
+ node.render(code, options, {
8710
+ renderedSurroundingElement: renderedParentType || this.parent.type
8711
+ });
8712
+ }
8665
8713
  }
8666
8714
  else {
8667
8715
  node.render(code, options);
@@ -8808,13 +8856,6 @@ class TaggedTemplateExpression extends NodeBase {
8808
8856
  message: `Cannot call a namespace ('${name}')`
8809
8857
  }, this.start);
8810
8858
  }
8811
- if (name === 'eval') {
8812
- this.context.warn({
8813
- code: 'EVAL',
8814
- message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
8815
- url: 'https://rollupjs.org/guide/en/#avoiding-eval'
8816
- }, this.start);
8817
- }
8818
8859
  }
8819
8860
  }
8820
8861
  hasEffects(context) {
@@ -8828,6 +8869,10 @@ class TaggedTemplateExpression extends NodeBase {
8828
8869
  withNew: false
8829
8870
  };
8830
8871
  }
8872
+ render(code, options) {
8873
+ this.tag.render(code, options, { isCalleeOfRenderedParent: true });
8874
+ this.quasi.render(code, options);
8875
+ }
8831
8876
  }
8832
8877
 
8833
8878
  class TemplateElement extends NodeBase {
@@ -9099,6 +9144,7 @@ class UnaryExpression extends NodeBase {
9099
9144
  this.deoptimized = true;
9100
9145
  if (this.operator === 'delete') {
9101
9146
  this.argument.deoptimizePath(EMPTY_PATH);
9147
+ this.context.requestTreeshakingPass();
9102
9148
  }
9103
9149
  }
9104
9150
  }
@@ -9167,6 +9213,7 @@ class UpdateExpression extends NodeBase {
9167
9213
  const variable = this.scope.findVariable(this.argument.name);
9168
9214
  variable.isReassigned = true;
9169
9215
  }
9216
+ this.context.requestTreeshakingPass();
9170
9217
  }
9171
9218
  }
9172
9219
 
@@ -9252,9 +9299,12 @@ class YieldExpression extends NodeBase {
9252
9299
  }
9253
9300
  }
9254
9301
  applyDeoptimizations() {
9255
- var _a;
9256
9302
  this.deoptimized = true;
9257
- (_a = this.argument) === null || _a === void 0 ? void 0 : _a.deoptimizePath(UNKNOWN_PATH);
9303
+ const { argument } = this;
9304
+ if (argument) {
9305
+ argument.deoptimizePath(UNKNOWN_PATH);
9306
+ this.context.requestTreeshakingPass();
9307
+ }
9258
9308
  }
9259
9309
  }
9260
9310
 
@@ -9843,14 +9893,14 @@ class Module {
9843
9893
  }
9844
9894
  necessaryDependencies.add(variable.module);
9845
9895
  }
9846
- if (this.options.treeshake && this.info.hasModuleSideEffects !== 'no-treeshake') {
9847
- this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
9848
- }
9849
- else {
9896
+ if (!this.options.treeshake || this.info.hasModuleSideEffects === 'no-treeshake') {
9850
9897
  for (const dependency of this.dependencies) {
9851
- relevantDependencies.add(dependency);
9898
+ if (dependency instanceof ExternalModule || dependency.isIncluded()) {
9899
+ relevantDependencies.add(dependency);
9900
+ }
9852
9901
  }
9853
9902
  }
9903
+ this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
9854
9904
  for (const dependency of necessaryDependencies) {
9855
9905
  relevantDependencies.add(dependency);
9856
9906
  }
@@ -10120,6 +10170,7 @@ class Module {
10120
10170
  moduleContext: this.context,
10121
10171
  nodeConstructors,
10122
10172
  options: this.options,
10173
+ requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true),
10123
10174
  traceExport: this.getVariableForExportName.bind(this),
10124
10175
  traceVariable: this.traceVariable.bind(this),
10125
10176
  usesTopLevelAwait: false,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.1
4
- Wed, 26 May 2021 07:27:41 GMT - commit 9a50fbb35a0c5be4fc0a6ec37a06827bab99923b
3
+ Rollup.js v2.50.5
4
+ Sun, 30 May 2021 18:56:20 GMT - commit b3d130b1a5448a2abc07fa3d7cde749c3169d220
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.50.1",
3
+ "version": "2.50.5",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",