rollup 2.52.4 → 2.52.8

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/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.4
4
- Wed, 30 Jun 2021 04:06:36 GMT - commit c3ad218caeeafa8a1b6ff8d4dde0db2556a3309a
3
+ Rollup.js v2.52.8
4
+ Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.4
4
- Wed, 30 Jun 2021 04:06:36 GMT - commit c3ad218caeeafa8a1b6ff8d4dde0db2556a3309a
3
+ Rollup.js v2.52.8
4
+ Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -14,7 +14,7 @@ import * as fs from 'fs';
14
14
  import { lstatSync, realpathSync, readdirSync } from 'fs';
15
15
  import { EventEmitter } from 'events';
16
16
 
17
- var version$1 = "2.52.4";
17
+ var version$1 = "2.52.8";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -1630,8 +1630,10 @@ class Variable extends ExpressionEntity {
1630
1630
  super();
1631
1631
  this.name = name;
1632
1632
  this.alwaysRendered = false;
1633
+ this.initReached = false;
1633
1634
  this.isId = false;
1634
1635
  this.isReassigned = false;
1636
+ this.kind = null;
1635
1637
  this.renderBaseName = null;
1636
1638
  this.renderName = null;
1637
1639
  }
@@ -1944,7 +1946,7 @@ function createHasEffectsContext() {
1944
1946
  breaks: false,
1945
1947
  continues: false,
1946
1948
  labels: new Set(),
1947
- returnAwaitYield: false
1949
+ returnYield: false
1948
1950
  },
1949
1951
  includedLabels: new Set(),
1950
1952
  instantiated: new DiscriminatedPathTracker(),
@@ -4083,11 +4085,19 @@ class GlobalVariable extends Variable {
4083
4085
  }
4084
4086
  }
4085
4087
 
4088
+ const tdzVariableKinds = {
4089
+ __proto__: null,
4090
+ class: true,
4091
+ const: true,
4092
+ let: true,
4093
+ var: true
4094
+ };
4086
4095
  class Identifier extends NodeBase {
4087
4096
  constructor() {
4088
4097
  super(...arguments);
4089
4098
  this.variable = null;
4090
4099
  this.deoptimized = false;
4100
+ this.isTDZAccess = null;
4091
4101
  }
4092
4102
  addExportedVariables(variables, exportNamesByVariable) {
4093
4103
  if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
@@ -4128,6 +4138,7 @@ class Identifier extends NodeBase {
4128
4138
  /* istanbul ignore next */
4129
4139
  throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
4130
4140
  }
4141
+ variable.kind = kind;
4131
4142
  return [(this.variable = variable)];
4132
4143
  }
4133
4144
  deoptimizePath(path) {
@@ -4140,26 +4151,34 @@ class Identifier extends NodeBase {
4140
4151
  this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
4141
4152
  }
4142
4153
  getLiteralValueAtPath(path, recursionTracker, origin) {
4143
- return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
4154
+ return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
4144
4155
  }
4145
4156
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
4146
- return this.variable.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4157
+ return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4147
4158
  }
4148
4159
  hasEffects() {
4149
4160
  if (!this.deoptimized)
4150
4161
  this.applyDeoptimizations();
4162
+ if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
4163
+ return true;
4164
+ }
4151
4165
  return (this.context.options.treeshake.unknownGlobalSideEffects &&
4152
4166
  this.variable instanceof GlobalVariable &&
4153
4167
  this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
4154
4168
  }
4155
4169
  hasEffectsWhenAccessedAtPath(path, context) {
4156
- return this.variable !== null && this.variable.hasEffectsWhenAccessedAtPath(path, context);
4170
+ return (this.variable !== null &&
4171
+ this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
4157
4172
  }
4158
4173
  hasEffectsWhenAssignedAtPath(path, context) {
4159
- return !this.variable || this.variable.hasEffectsWhenAssignedAtPath(path, context);
4174
+ return (!this.variable ||
4175
+ (path.length > 0
4176
+ ? this.getVariableRespectingTDZ()
4177
+ : this.variable).hasEffectsWhenAssignedAtPath(path, context));
4160
4178
  }
4161
4179
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
4162
- return !this.variable || this.variable.hasEffectsWhenCalledAtPath(path, callOptions, context);
4180
+ return (!this.variable ||
4181
+ this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context));
4163
4182
  }
4164
4183
  include() {
4165
4184
  if (!this.deoptimized)
@@ -4172,7 +4191,10 @@ class Identifier extends NodeBase {
4172
4191
  }
4173
4192
  }
4174
4193
  includeCallArguments(context, args) {
4175
- this.variable.includeCallArguments(context, args);
4194
+ this.getVariableRespectingTDZ().includeCallArguments(context, args);
4195
+ }
4196
+ markDeclarationReached() {
4197
+ this.variable.initReached = true;
4176
4198
  }
4177
4199
  render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
4178
4200
  if (this.variable) {
@@ -4207,6 +4229,28 @@ class Identifier extends NodeBase {
4207
4229
  message: `Illegal reassignment to import '${this.name}'`
4208
4230
  }, this.start);
4209
4231
  }
4232
+ getVariableRespectingTDZ() {
4233
+ if (this.isPossibleTDZ()) {
4234
+ return UNKNOWN_EXPRESSION;
4235
+ }
4236
+ return this.variable;
4237
+ }
4238
+ isPossibleTDZ() {
4239
+ // return cached value to avoid issues with the next tree-shaking pass
4240
+ if (this.isTDZAccess !== null)
4241
+ return this.isTDZAccess;
4242
+ if (!(this.variable instanceof LocalVariable) ||
4243
+ !this.variable.kind ||
4244
+ !(this.variable.kind in tdzVariableKinds)) {
4245
+ return (this.isTDZAccess = false);
4246
+ }
4247
+ if (!this.variable.initReached) {
4248
+ // Either a const/let TDZ violation or
4249
+ // var use before declaration was encountered.
4250
+ return (this.isTDZAccess = true);
4251
+ }
4252
+ return (this.isTDZAccess = false);
4253
+ }
4210
4254
  }
4211
4255
 
4212
4256
  const EVENT_ACCESSED = 0;
@@ -4807,6 +4851,12 @@ class ClassNode extends NodeBase {
4807
4851
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
4808
4852
  return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4809
4853
  }
4854
+ hasEffects(context) {
4855
+ var _a, _b;
4856
+ const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
4857
+ (_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
4858
+ return initEffect || super.hasEffects(context);
4859
+ }
4810
4860
  hasEffectsWhenAccessedAtPath(path, context) {
4811
4861
  return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
4812
4862
  }
@@ -4825,10 +4875,19 @@ class ClassNode extends NodeBase {
4825
4875
  return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
4826
4876
  }
4827
4877
  }
4828
- initialise() {
4829
- if (this.id !== null) {
4830
- this.id.declare('class', this);
4878
+ include(context, includeChildrenRecursively) {
4879
+ var _a;
4880
+ this.included = true;
4881
+ (_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
4882
+ this.body.include(context, includeChildrenRecursively);
4883
+ if (this.id) {
4884
+ this.id.markDeclarationReached();
4885
+ this.id.include();
4831
4886
  }
4887
+ }
4888
+ initialise() {
4889
+ var _a;
4890
+ (_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
4832
4891
  for (const method of this.body.body) {
4833
4892
  if (method instanceof MethodDefinition && method.kind === 'constructor') {
4834
4893
  this.classConstructor = method;
@@ -5143,6 +5202,9 @@ class RestElement extends NodeBase {
5143
5202
  hasEffectsWhenAssignedAtPath(path, context) {
5144
5203
  return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
5145
5204
  }
5205
+ markDeclarationReached() {
5206
+ this.argument.markDeclarationReached();
5207
+ }
5146
5208
  applyDeoptimizations() {
5147
5209
  this.deoptimized = true;
5148
5210
  if (this.declarationInit !== null) {
@@ -5155,6 +5217,7 @@ class RestElement extends NodeBase {
5155
5217
  class FunctionNode extends NodeBase {
5156
5218
  constructor() {
5157
5219
  super(...arguments);
5220
+ this.deoptimizedReturn = false;
5158
5221
  this.isPrototypeDeoptimized = false;
5159
5222
  }
5160
5223
  createScope(parentScope) {
@@ -5185,7 +5248,18 @@ class FunctionNode extends NodeBase {
5185
5248
  }
5186
5249
  }
5187
5250
  getReturnExpressionWhenCalledAtPath(path) {
5188
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5251
+ if (path.length !== 0) {
5252
+ return UNKNOWN_EXPRESSION;
5253
+ }
5254
+ if (this.async) {
5255
+ if (!this.deoptimizedReturn) {
5256
+ this.deoptimizedReturn = true;
5257
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5258
+ this.context.requestTreeshakingPass();
5259
+ }
5260
+ return UNKNOWN_EXPRESSION;
5261
+ }
5262
+ return this.scope.getReturnExpression();
5189
5263
  }
5190
5264
  hasEffects() {
5191
5265
  return this.id !== null && this.id.hasEffects();
@@ -5228,7 +5302,7 @@ class FunctionNode extends NodeBase {
5228
5302
  breaks: false,
5229
5303
  continues: false,
5230
5304
  labels: new Set(),
5231
- returnAwaitYield: true
5305
+ returnYield: true
5232
5306
  };
5233
5307
  if (this.body.hasEffects(context))
5234
5308
  return true;
@@ -5851,13 +5925,21 @@ class ArrayPattern extends NodeBase {
5851
5925
  }
5852
5926
  return false;
5853
5927
  }
5928
+ markDeclarationReached() {
5929
+ for (const element of this.elements) {
5930
+ if (element !== null) {
5931
+ element.markDeclarationReached();
5932
+ }
5933
+ }
5934
+ }
5854
5935
  }
5855
5936
 
5856
5937
  class BlockScope extends ChildScope {
5857
5938
  addDeclaration(identifier, context, init, isHoisted) {
5858
5939
  if (isHoisted) {
5859
5940
  this.parent.addDeclaration(identifier, context, init, isHoisted);
5860
- // Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
5941
+ // Necessary to make sure the init is deoptimized for conditional declarations.
5942
+ // We cannot call deoptimizePath here.
5861
5943
  return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
5862
5944
  }
5863
5945
  else {
@@ -5947,6 +6029,10 @@ class BlockStatement extends NodeBase {
5947
6029
  }
5948
6030
 
5949
6031
  class ArrowFunctionExpression extends NodeBase {
6032
+ constructor() {
6033
+ super(...arguments);
6034
+ this.deoptimizedReturn = false;
6035
+ }
5950
6036
  createScope(parentScope) {
5951
6037
  this.scope = new ReturnValueScope(parentScope, this.context);
5952
6038
  }
@@ -5960,7 +6046,18 @@ class ArrowFunctionExpression extends NodeBase {
5960
6046
  // Arrow functions do not mutate their context
5961
6047
  deoptimizeThisOnEventAtPath() { }
5962
6048
  getReturnExpressionWhenCalledAtPath(path) {
5963
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6049
+ if (path.length !== 0) {
6050
+ return UNKNOWN_EXPRESSION;
6051
+ }
6052
+ if (this.async) {
6053
+ if (!this.deoptimizedReturn) {
6054
+ this.deoptimizedReturn = true;
6055
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
6056
+ this.context.requestTreeshakingPass();
6057
+ }
6058
+ return UNKNOWN_EXPRESSION;
6059
+ }
6060
+ return this.scope.getReturnExpression();
5964
6061
  }
5965
6062
  hasEffects() {
5966
6063
  return false;
@@ -5994,7 +6091,7 @@ class ArrowFunctionExpression extends NodeBase {
5994
6091
  breaks: false,
5995
6092
  continues: false,
5996
6093
  labels: new Set(),
5997
- returnAwaitYield: true
6094
+ returnYield: true
5998
6095
  };
5999
6096
  if (this.body.hasEffects(context))
6000
6097
  return true;
@@ -6126,6 +6223,9 @@ class AssignmentPattern extends NodeBase {
6126
6223
  hasEffectsWhenAssignedAtPath(path, context) {
6127
6224
  return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
6128
6225
  }
6226
+ markDeclarationReached() {
6227
+ this.left.markDeclarationReached();
6228
+ }
6129
6229
  render(code, options, { isShorthandProperty } = BLANK) {
6130
6230
  this.left.render(code, options, { isShorthandProperty });
6131
6231
  this.right.render(code, options);
@@ -6139,17 +6239,18 @@ class AssignmentPattern extends NodeBase {
6139
6239
  }
6140
6240
 
6141
6241
  class AwaitExpression extends NodeBase {
6142
- hasEffects(context) {
6143
- const { propertyReadSideEffects } = this.context.options
6144
- .treeshake;
6145
- return (!context.ignore.returnAwaitYield ||
6146
- this.argument.hasEffects(context) ||
6147
- this.argument.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
6148
- (propertyReadSideEffects &&
6149
- (propertyReadSideEffects === 'always' ||
6150
- this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
6242
+ constructor() {
6243
+ super(...arguments);
6244
+ this.deoptimized = false;
6245
+ }
6246
+ hasEffects() {
6247
+ if (!this.deoptimized)
6248
+ this.applyDeoptimizations();
6249
+ return true;
6151
6250
  }
6152
6251
  include(context, includeChildrenRecursively) {
6252
+ if (!this.deoptimized)
6253
+ this.applyDeoptimizations();
6153
6254
  if (!this.included) {
6154
6255
  this.included = true;
6155
6256
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
@@ -6163,6 +6264,11 @@ class AwaitExpression extends NodeBase {
6163
6264
  }
6164
6265
  this.argument.include(context, includeChildrenRecursively);
6165
6266
  }
6267
+ applyDeoptimizations() {
6268
+ this.deoptimized = true;
6269
+ this.argument.deoptimizePath(UNKNOWN_PATH);
6270
+ this.context.requestTreeshakingPass();
6271
+ }
6166
6272
  }
6167
6273
 
6168
6274
  const binaryOperators = {
@@ -6598,17 +6704,21 @@ class CallExpression extends NodeBase {
6598
6704
  }, UNKNOWN_EXPRESSION);
6599
6705
  }
6600
6706
  hasEffects(context) {
6601
- if (!this.deoptimized)
6602
- this.applyDeoptimizations();
6603
- for (const argument of this.arguments) {
6604
- if (argument.hasEffects(context))
6605
- return true;
6707
+ try {
6708
+ for (const argument of this.arguments) {
6709
+ if (argument.hasEffects(context))
6710
+ return true;
6711
+ }
6712
+ if (this.context.options.treeshake.annotations &&
6713
+ this.annotations)
6714
+ return false;
6715
+ return (this.callee.hasEffects(context) ||
6716
+ this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
6717
+ }
6718
+ finally {
6719
+ if (!this.deoptimized)
6720
+ this.applyDeoptimizations();
6606
6721
  }
6607
- if (this.context.options.treeshake.annotations &&
6608
- this.annotations)
6609
- return false;
6610
- return (this.callee.hasEffects(context) ||
6611
- this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
6612
6722
  }
6613
6723
  hasEffectsWhenAccessedAtPath(path, context) {
6614
6724
  return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
@@ -8502,6 +8612,11 @@ class ObjectPattern extends NodeBase {
8502
8612
  }
8503
8613
  return false;
8504
8614
  }
8615
+ markDeclarationReached() {
8616
+ for (const property of this.properties) {
8617
+ property.markDeclarationReached();
8618
+ }
8619
+ }
8505
8620
  }
8506
8621
 
8507
8622
  class PrivateIdentifier extends NodeBase {
@@ -8526,6 +8641,9 @@ class Property extends MethodBase {
8526
8641
  this.key.hasEffects(context) ||
8527
8642
  this.value.hasEffects(context));
8528
8643
  }
8644
+ markDeclarationReached() {
8645
+ this.value.markDeclarationReached();
8646
+ }
8529
8647
  render(code, options) {
8530
8648
  if (!this.shorthand) {
8531
8649
  this.key.render(code, options);
@@ -8577,7 +8695,7 @@ class PropertyDefinition extends NodeBase {
8577
8695
 
8578
8696
  class ReturnStatement extends NodeBase {
8579
8697
  hasEffects(context) {
8580
- if (!context.ignore.returnAwaitYield ||
8698
+ if (!context.ignore.returnYield ||
8581
8699
  (this.argument !== null && this.argument.hasEffects(context)))
8582
8700
  return true;
8583
8701
  context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
@@ -9181,16 +9299,19 @@ class VariableDeclarator extends NodeBase {
9181
9299
  this.id.deoptimizePath(path);
9182
9300
  }
9183
9301
  hasEffects(context) {
9184
- return this.id.hasEffects(context) || (this.init !== null && this.init.hasEffects(context));
9302
+ const initEffect = this.init !== null && this.init.hasEffects(context);
9303
+ this.id.markDeclarationReached();
9304
+ return initEffect || this.id.hasEffects(context);
9185
9305
  }
9186
9306
  include(context, includeChildrenRecursively) {
9187
9307
  this.included = true;
9188
- if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9189
- this.id.include(context, includeChildrenRecursively);
9190
- }
9191
9308
  if (this.init) {
9192
9309
  this.init.include(context, includeChildrenRecursively);
9193
9310
  }
9311
+ this.id.markDeclarationReached();
9312
+ if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9313
+ this.id.include(context, includeChildrenRecursively);
9314
+ }
9194
9315
  }
9195
9316
  render(code, options) {
9196
9317
  const renderId = this.id.included;
@@ -9243,8 +9364,7 @@ class YieldExpression extends NodeBase {
9243
9364
  hasEffects(context) {
9244
9365
  if (!this.deoptimized)
9245
9366
  this.applyDeoptimizations();
9246
- return (!context.ignore.returnAwaitYield ||
9247
- (this.argument !== null && this.argument.hasEffects(context)));
9367
+ return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
9248
9368
  }
9249
9369
  render(code, options) {
9250
9370
  if (this.argument) {
@@ -10016,8 +10136,8 @@ class Module {
10016
10136
  }
10017
10137
  includeAllExports(includeNamespaceMembers) {
10018
10138
  if (!this.isExecuted) {
10019
- this.graph.needsTreeshakingPass = true;
10020
10139
  markModuleAndImpureDependenciesAsExecuted(this);
10140
+ this.graph.needsTreeshakingPass = true;
10021
10141
  }
10022
10142
  for (const exportName of this.getExports()) {
10023
10143
  if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
@@ -10319,25 +10439,28 @@ class Module {
10319
10439
  props.id = this.id;
10320
10440
  props.pos = pos;
10321
10441
  let code = this.info.code;
10322
- let { column, line } = locate(code, pos, { offsetLine: 1 });
10323
- try {
10324
- ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10325
- code = this.originalCode;
10326
- }
10327
- catch (e) {
10328
- this.options.onwarn({
10329
- code: 'SOURCEMAP_ERROR',
10330
- id: this.id,
10331
- loc: {
10332
- column,
10333
- file: this.id,
10334
- line
10335
- },
10336
- message: `Error when using sourcemap for reporting an error: ${e.message}`,
10337
- pos
10338
- });
10442
+ const location = locate(code, pos, { offsetLine: 1 });
10443
+ if (location) {
10444
+ let { column, line } = location;
10445
+ try {
10446
+ ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10447
+ code = this.originalCode;
10448
+ }
10449
+ catch (e) {
10450
+ this.options.onwarn({
10451
+ code: 'SOURCEMAP_ERROR',
10452
+ id: this.id,
10453
+ loc: {
10454
+ column,
10455
+ file: this.id,
10456
+ line
10457
+ },
10458
+ message: `Error when using sourcemap for reporting an error: ${e.message}`,
10459
+ pos
10460
+ });
10461
+ }
10462
+ augmentCodeLocation(props, { column, line }, code, this.id);
10339
10463
  }
10340
- augmentCodeLocation(props, { column, line }, code, this.id);
10341
10464
  }
10342
10465
  addModulesToImportDescriptions(importDescription) {
10343
10466
  for (const specifier of Object.values(importDescription)) {
@@ -20084,12 +20207,7 @@ class Graph {
20084
20207
  }
20085
20208
  includeStatements() {
20086
20209
  for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20087
- if (module.preserveSignature !== false) {
20088
- module.includeAllExports(false);
20089
- }
20090
- else {
20091
- markModuleAndImpureDependenciesAsExecuted(module);
20092
- }
20210
+ markModuleAndImpureDependenciesAsExecuted(module);
20093
20211
  }
20094
20212
  if (this.options.treeshake) {
20095
20213
  let treeshakingPass = 1;
@@ -20106,6 +20224,16 @@ class Graph {
20106
20224
  }
20107
20225
  }
20108
20226
  }
20227
+ if (treeshakingPass === 1) {
20228
+ // We only include exports after the first pass to avoid issues with
20229
+ // the TDZ detection logic
20230
+ for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20231
+ if (module.preserveSignature !== false) {
20232
+ module.includeAllExports(false);
20233
+ this.needsTreeshakingPass = true;
20234
+ }
20235
+ }
20236
+ }
20109
20237
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
20110
20238
  } while (this.needsTreeshakingPass);
20111
20239
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.4
4
- Wed, 30 Jun 2021 04:06:36 GMT - commit c3ad218caeeafa8a1b6ff8d4dde0db2556a3309a
3
+ Rollup.js v2.52.8
4
+ Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -11,7 +11,7 @@
11
11
  import * as require$$0$1 from 'path';
12
12
  import require$$0__default, { sep, resolve } from 'path';
13
13
  import require$$0$2 from 'util';
14
- import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, error, errInvalidOption, printQuotedStringList, treeshakePresets, fseventsImporter, rollupInternal } from './rollup.js';
14
+ import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, treeshakePresets, error, errInvalidOption, printQuotedStringList, fseventsImporter, rollupInternal } from './rollup.js';
15
15
  import require$$2, { platform } from 'os';
16
16
  import require$$0$3 from 'events';
17
17
  import fs__default from 'fs';
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.4
4
- Wed, 30 Jun 2021 04:06:36 GMT - commit c3ad218caeeafa8a1b6ff8d4dde0db2556a3309a
3
+ Rollup.js v2.52.8
4
+ Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup