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/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
@@ -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
@@ -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
@@ -32,7 +32,7 @@ function _interopNamespaceDefault(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.52.4";
35
+ var version$1 = "2.52.8";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -2184,8 +2184,10 @@ class Variable extends ExpressionEntity {
2184
2184
  super();
2185
2185
  this.name = name;
2186
2186
  this.alwaysRendered = false;
2187
+ this.initReached = false;
2187
2188
  this.isId = false;
2188
2189
  this.isReassigned = false;
2190
+ this.kind = null;
2189
2191
  this.renderBaseName = null;
2190
2192
  this.renderName = null;
2191
2193
  }
@@ -2417,7 +2419,7 @@ function createHasEffectsContext() {
2417
2419
  breaks: false,
2418
2420
  continues: false,
2419
2421
  labels: new Set(),
2420
- returnAwaitYield: false
2422
+ returnYield: false
2421
2423
  },
2422
2424
  includedLabels: new Set(),
2423
2425
  instantiated: new DiscriminatedPathTracker(),
@@ -4556,11 +4558,19 @@ class GlobalVariable extends Variable {
4556
4558
  }
4557
4559
  }
4558
4560
 
4561
+ const tdzVariableKinds = {
4562
+ __proto__: null,
4563
+ class: true,
4564
+ const: true,
4565
+ let: true,
4566
+ var: true
4567
+ };
4559
4568
  class Identifier extends NodeBase {
4560
4569
  constructor() {
4561
4570
  super(...arguments);
4562
4571
  this.variable = null;
4563
4572
  this.deoptimized = false;
4573
+ this.isTDZAccess = null;
4564
4574
  }
4565
4575
  addExportedVariables(variables, exportNamesByVariable) {
4566
4576
  if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
@@ -4601,6 +4611,7 @@ class Identifier extends NodeBase {
4601
4611
  /* istanbul ignore next */
4602
4612
  throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
4603
4613
  }
4614
+ variable.kind = kind;
4604
4615
  return [(this.variable = variable)];
4605
4616
  }
4606
4617
  deoptimizePath(path) {
@@ -4613,26 +4624,34 @@ class Identifier extends NodeBase {
4613
4624
  this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
4614
4625
  }
4615
4626
  getLiteralValueAtPath(path, recursionTracker, origin) {
4616
- return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
4627
+ return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
4617
4628
  }
4618
4629
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
4619
- return this.variable.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4630
+ return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4620
4631
  }
4621
4632
  hasEffects() {
4622
4633
  if (!this.deoptimized)
4623
4634
  this.applyDeoptimizations();
4635
+ if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
4636
+ return true;
4637
+ }
4624
4638
  return (this.context.options.treeshake.unknownGlobalSideEffects &&
4625
4639
  this.variable instanceof GlobalVariable &&
4626
4640
  this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
4627
4641
  }
4628
4642
  hasEffectsWhenAccessedAtPath(path, context) {
4629
- return this.variable !== null && this.variable.hasEffectsWhenAccessedAtPath(path, context);
4643
+ return (this.variable !== null &&
4644
+ this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
4630
4645
  }
4631
4646
  hasEffectsWhenAssignedAtPath(path, context) {
4632
- return !this.variable || this.variable.hasEffectsWhenAssignedAtPath(path, context);
4647
+ return (!this.variable ||
4648
+ (path.length > 0
4649
+ ? this.getVariableRespectingTDZ()
4650
+ : this.variable).hasEffectsWhenAssignedAtPath(path, context));
4633
4651
  }
4634
4652
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
4635
- return !this.variable || this.variable.hasEffectsWhenCalledAtPath(path, callOptions, context);
4653
+ return (!this.variable ||
4654
+ this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context));
4636
4655
  }
4637
4656
  include() {
4638
4657
  if (!this.deoptimized)
@@ -4645,7 +4664,10 @@ class Identifier extends NodeBase {
4645
4664
  }
4646
4665
  }
4647
4666
  includeCallArguments(context, args) {
4648
- this.variable.includeCallArguments(context, args);
4667
+ this.getVariableRespectingTDZ().includeCallArguments(context, args);
4668
+ }
4669
+ markDeclarationReached() {
4670
+ this.variable.initReached = true;
4649
4671
  }
4650
4672
  render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
4651
4673
  if (this.variable) {
@@ -4680,6 +4702,28 @@ class Identifier extends NodeBase {
4680
4702
  message: `Illegal reassignment to import '${this.name}'`
4681
4703
  }, this.start);
4682
4704
  }
4705
+ getVariableRespectingTDZ() {
4706
+ if (this.isPossibleTDZ()) {
4707
+ return UNKNOWN_EXPRESSION;
4708
+ }
4709
+ return this.variable;
4710
+ }
4711
+ isPossibleTDZ() {
4712
+ // return cached value to avoid issues with the next tree-shaking pass
4713
+ if (this.isTDZAccess !== null)
4714
+ return this.isTDZAccess;
4715
+ if (!(this.variable instanceof LocalVariable) ||
4716
+ !this.variable.kind ||
4717
+ !(this.variable.kind in tdzVariableKinds)) {
4718
+ return (this.isTDZAccess = false);
4719
+ }
4720
+ if (!this.variable.initReached) {
4721
+ // Either a const/let TDZ violation or
4722
+ // var use before declaration was encountered.
4723
+ return (this.isTDZAccess = true);
4724
+ }
4725
+ return (this.isTDZAccess = false);
4726
+ }
4683
4727
  }
4684
4728
 
4685
4729
  const EVENT_ACCESSED = 0;
@@ -5280,6 +5324,12 @@ class ClassNode extends NodeBase {
5280
5324
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
5281
5325
  return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
5282
5326
  }
5327
+ hasEffects(context) {
5328
+ var _a, _b;
5329
+ const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
5330
+ (_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
5331
+ return initEffect || super.hasEffects(context);
5332
+ }
5283
5333
  hasEffectsWhenAccessedAtPath(path, context) {
5284
5334
  return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
5285
5335
  }
@@ -5298,10 +5348,19 @@ class ClassNode extends NodeBase {
5298
5348
  return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
5299
5349
  }
5300
5350
  }
5301
- initialise() {
5302
- if (this.id !== null) {
5303
- this.id.declare('class', this);
5351
+ include(context, includeChildrenRecursively) {
5352
+ var _a;
5353
+ this.included = true;
5354
+ (_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
5355
+ this.body.include(context, includeChildrenRecursively);
5356
+ if (this.id) {
5357
+ this.id.markDeclarationReached();
5358
+ this.id.include();
5304
5359
  }
5360
+ }
5361
+ initialise() {
5362
+ var _a;
5363
+ (_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
5305
5364
  for (const method of this.body.body) {
5306
5365
  if (method instanceof MethodDefinition && method.kind === 'constructor') {
5307
5366
  this.classConstructor = method;
@@ -5616,6 +5675,9 @@ class RestElement extends NodeBase {
5616
5675
  hasEffectsWhenAssignedAtPath(path, context) {
5617
5676
  return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
5618
5677
  }
5678
+ markDeclarationReached() {
5679
+ this.argument.markDeclarationReached();
5680
+ }
5619
5681
  applyDeoptimizations() {
5620
5682
  this.deoptimized = true;
5621
5683
  if (this.declarationInit !== null) {
@@ -5628,6 +5690,7 @@ class RestElement extends NodeBase {
5628
5690
  class FunctionNode extends NodeBase {
5629
5691
  constructor() {
5630
5692
  super(...arguments);
5693
+ this.deoptimizedReturn = false;
5631
5694
  this.isPrototypeDeoptimized = false;
5632
5695
  }
5633
5696
  createScope(parentScope) {
@@ -5658,7 +5721,18 @@ class FunctionNode extends NodeBase {
5658
5721
  }
5659
5722
  }
5660
5723
  getReturnExpressionWhenCalledAtPath(path) {
5661
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5724
+ if (path.length !== 0) {
5725
+ return UNKNOWN_EXPRESSION;
5726
+ }
5727
+ if (this.async) {
5728
+ if (!this.deoptimizedReturn) {
5729
+ this.deoptimizedReturn = true;
5730
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5731
+ this.context.requestTreeshakingPass();
5732
+ }
5733
+ return UNKNOWN_EXPRESSION;
5734
+ }
5735
+ return this.scope.getReturnExpression();
5662
5736
  }
5663
5737
  hasEffects() {
5664
5738
  return this.id !== null && this.id.hasEffects();
@@ -5701,7 +5775,7 @@ class FunctionNode extends NodeBase {
5701
5775
  breaks: false,
5702
5776
  continues: false,
5703
5777
  labels: new Set(),
5704
- returnAwaitYield: true
5778
+ returnYield: true
5705
5779
  };
5706
5780
  if (this.body.hasEffects(context))
5707
5781
  return true;
@@ -6324,13 +6398,21 @@ class ArrayPattern extends NodeBase {
6324
6398
  }
6325
6399
  return false;
6326
6400
  }
6401
+ markDeclarationReached() {
6402
+ for (const element of this.elements) {
6403
+ if (element !== null) {
6404
+ element.markDeclarationReached();
6405
+ }
6406
+ }
6407
+ }
6327
6408
  }
6328
6409
 
6329
6410
  class BlockScope extends ChildScope {
6330
6411
  addDeclaration(identifier, context, init, isHoisted) {
6331
6412
  if (isHoisted) {
6332
6413
  this.parent.addDeclaration(identifier, context, init, isHoisted);
6333
- // Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
6414
+ // Necessary to make sure the init is deoptimized for conditional declarations.
6415
+ // We cannot call deoptimizePath here.
6334
6416
  return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
6335
6417
  }
6336
6418
  else {
@@ -6420,6 +6502,10 @@ class BlockStatement extends NodeBase {
6420
6502
  }
6421
6503
 
6422
6504
  class ArrowFunctionExpression extends NodeBase {
6505
+ constructor() {
6506
+ super(...arguments);
6507
+ this.deoptimizedReturn = false;
6508
+ }
6423
6509
  createScope(parentScope) {
6424
6510
  this.scope = new ReturnValueScope(parentScope, this.context);
6425
6511
  }
@@ -6433,7 +6519,18 @@ class ArrowFunctionExpression extends NodeBase {
6433
6519
  // Arrow functions do not mutate their context
6434
6520
  deoptimizeThisOnEventAtPath() { }
6435
6521
  getReturnExpressionWhenCalledAtPath(path) {
6436
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6522
+ if (path.length !== 0) {
6523
+ return UNKNOWN_EXPRESSION;
6524
+ }
6525
+ if (this.async) {
6526
+ if (!this.deoptimizedReturn) {
6527
+ this.deoptimizedReturn = true;
6528
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
6529
+ this.context.requestTreeshakingPass();
6530
+ }
6531
+ return UNKNOWN_EXPRESSION;
6532
+ }
6533
+ return this.scope.getReturnExpression();
6437
6534
  }
6438
6535
  hasEffects() {
6439
6536
  return false;
@@ -6467,7 +6564,7 @@ class ArrowFunctionExpression extends NodeBase {
6467
6564
  breaks: false,
6468
6565
  continues: false,
6469
6566
  labels: new Set(),
6470
- returnAwaitYield: true
6567
+ returnYield: true
6471
6568
  };
6472
6569
  if (this.body.hasEffects(context))
6473
6570
  return true;
@@ -6599,6 +6696,9 @@ class AssignmentPattern extends NodeBase {
6599
6696
  hasEffectsWhenAssignedAtPath(path, context) {
6600
6697
  return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
6601
6698
  }
6699
+ markDeclarationReached() {
6700
+ this.left.markDeclarationReached();
6701
+ }
6602
6702
  render(code, options, { isShorthandProperty } = BLANK) {
6603
6703
  this.left.render(code, options, { isShorthandProperty });
6604
6704
  this.right.render(code, options);
@@ -6612,17 +6712,18 @@ class AssignmentPattern extends NodeBase {
6612
6712
  }
6613
6713
 
6614
6714
  class AwaitExpression extends NodeBase {
6615
- hasEffects(context) {
6616
- const { propertyReadSideEffects } = this.context.options
6617
- .treeshake;
6618
- return (!context.ignore.returnAwaitYield ||
6619
- this.argument.hasEffects(context) ||
6620
- this.argument.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
6621
- (propertyReadSideEffects &&
6622
- (propertyReadSideEffects === 'always' ||
6623
- this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
6715
+ constructor() {
6716
+ super(...arguments);
6717
+ this.deoptimized = false;
6718
+ }
6719
+ hasEffects() {
6720
+ if (!this.deoptimized)
6721
+ this.applyDeoptimizations();
6722
+ return true;
6624
6723
  }
6625
6724
  include(context, includeChildrenRecursively) {
6725
+ if (!this.deoptimized)
6726
+ this.applyDeoptimizations();
6626
6727
  if (!this.included) {
6627
6728
  this.included = true;
6628
6729
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
@@ -6636,6 +6737,11 @@ class AwaitExpression extends NodeBase {
6636
6737
  }
6637
6738
  this.argument.include(context, includeChildrenRecursively);
6638
6739
  }
6740
+ applyDeoptimizations() {
6741
+ this.deoptimized = true;
6742
+ this.argument.deoptimizePath(UNKNOWN_PATH);
6743
+ this.context.requestTreeshakingPass();
6744
+ }
6639
6745
  }
6640
6746
 
6641
6747
  const binaryOperators = {
@@ -7071,17 +7177,21 @@ class CallExpression extends NodeBase {
7071
7177
  }, UNKNOWN_EXPRESSION);
7072
7178
  }
7073
7179
  hasEffects(context) {
7074
- if (!this.deoptimized)
7075
- this.applyDeoptimizations();
7076
- for (const argument of this.arguments) {
7077
- if (argument.hasEffects(context))
7078
- return true;
7180
+ try {
7181
+ for (const argument of this.arguments) {
7182
+ if (argument.hasEffects(context))
7183
+ return true;
7184
+ }
7185
+ if (this.context.options.treeshake.annotations &&
7186
+ this.annotations)
7187
+ return false;
7188
+ return (this.callee.hasEffects(context) ||
7189
+ this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
7190
+ }
7191
+ finally {
7192
+ if (!this.deoptimized)
7193
+ this.applyDeoptimizations();
7079
7194
  }
7080
- if (this.context.options.treeshake.annotations &&
7081
- this.annotations)
7082
- return false;
7083
- return (this.callee.hasEffects(context) ||
7084
- this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
7085
7195
  }
7086
7196
  hasEffectsWhenAccessedAtPath(path, context) {
7087
7197
  return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
@@ -8596,6 +8706,11 @@ class ObjectPattern extends NodeBase {
8596
8706
  }
8597
8707
  return false;
8598
8708
  }
8709
+ markDeclarationReached() {
8710
+ for (const property of this.properties) {
8711
+ property.markDeclarationReached();
8712
+ }
8713
+ }
8599
8714
  }
8600
8715
 
8601
8716
  class PrivateIdentifier extends NodeBase {
@@ -8620,6 +8735,9 @@ class Property extends MethodBase {
8620
8735
  this.key.hasEffects(context) ||
8621
8736
  this.value.hasEffects(context));
8622
8737
  }
8738
+ markDeclarationReached() {
8739
+ this.value.markDeclarationReached();
8740
+ }
8623
8741
  render(code, options) {
8624
8742
  if (!this.shorthand) {
8625
8743
  this.key.render(code, options);
@@ -8671,7 +8789,7 @@ class PropertyDefinition extends NodeBase {
8671
8789
 
8672
8790
  class ReturnStatement extends NodeBase {
8673
8791
  hasEffects(context) {
8674
- if (!context.ignore.returnAwaitYield ||
8792
+ if (!context.ignore.returnYield ||
8675
8793
  (this.argument !== null && this.argument.hasEffects(context)))
8676
8794
  return true;
8677
8795
  context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
@@ -9275,16 +9393,19 @@ class VariableDeclarator extends NodeBase {
9275
9393
  this.id.deoptimizePath(path);
9276
9394
  }
9277
9395
  hasEffects(context) {
9278
- return this.id.hasEffects(context) || (this.init !== null && this.init.hasEffects(context));
9396
+ const initEffect = this.init !== null && this.init.hasEffects(context);
9397
+ this.id.markDeclarationReached();
9398
+ return initEffect || this.id.hasEffects(context);
9279
9399
  }
9280
9400
  include(context, includeChildrenRecursively) {
9281
9401
  this.included = true;
9282
- if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9283
- this.id.include(context, includeChildrenRecursively);
9284
- }
9285
9402
  if (this.init) {
9286
9403
  this.init.include(context, includeChildrenRecursively);
9287
9404
  }
9405
+ this.id.markDeclarationReached();
9406
+ if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9407
+ this.id.include(context, includeChildrenRecursively);
9408
+ }
9288
9409
  }
9289
9410
  render(code, options) {
9290
9411
  const renderId = this.id.included;
@@ -9337,8 +9458,7 @@ class YieldExpression extends NodeBase {
9337
9458
  hasEffects(context) {
9338
9459
  if (!this.deoptimized)
9339
9460
  this.applyDeoptimizations();
9340
- return (!context.ignore.returnAwaitYield ||
9341
- (this.argument !== null && this.argument.hasEffects(context)));
9461
+ return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
9342
9462
  }
9343
9463
  render(code, options) {
9344
9464
  if (this.argument) {
@@ -10110,8 +10230,8 @@ class Module {
10110
10230
  }
10111
10231
  includeAllExports(includeNamespaceMembers) {
10112
10232
  if (!this.isExecuted) {
10113
- this.graph.needsTreeshakingPass = true;
10114
10233
  markModuleAndImpureDependenciesAsExecuted(this);
10234
+ this.graph.needsTreeshakingPass = true;
10115
10235
  }
10116
10236
  for (const exportName of this.getExports()) {
10117
10237
  if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
@@ -10413,25 +10533,28 @@ class Module {
10413
10533
  props.id = this.id;
10414
10534
  props.pos = pos;
10415
10535
  let code = this.info.code;
10416
- let { column, line } = locate(code, pos, { offsetLine: 1 });
10417
- try {
10418
- ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10419
- code = this.originalCode;
10420
- }
10421
- catch (e) {
10422
- this.options.onwarn({
10423
- code: 'SOURCEMAP_ERROR',
10424
- id: this.id,
10425
- loc: {
10426
- column,
10427
- file: this.id,
10428
- line
10429
- },
10430
- message: `Error when using sourcemap for reporting an error: ${e.message}`,
10431
- pos
10432
- });
10536
+ const location = locate(code, pos, { offsetLine: 1 });
10537
+ if (location) {
10538
+ let { column, line } = location;
10539
+ try {
10540
+ ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10541
+ code = this.originalCode;
10542
+ }
10543
+ catch (e) {
10544
+ this.options.onwarn({
10545
+ code: 'SOURCEMAP_ERROR',
10546
+ id: this.id,
10547
+ loc: {
10548
+ column,
10549
+ file: this.id,
10550
+ line
10551
+ },
10552
+ message: `Error when using sourcemap for reporting an error: ${e.message}`,
10553
+ pos
10554
+ });
10555
+ }
10556
+ augmentCodeLocation(props, { column, line }, code, this.id);
10433
10557
  }
10434
- augmentCodeLocation(props, { column, line }, code, this.id);
10435
10558
  }
10436
10559
  addModulesToImportDescriptions(importDescription) {
10437
10560
  for (const specifier of Object.values(importDescription)) {
@@ -20178,12 +20301,7 @@ class Graph {
20178
20301
  }
20179
20302
  includeStatements() {
20180
20303
  for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20181
- if (module.preserveSignature !== false) {
20182
- module.includeAllExports(false);
20183
- }
20184
- else {
20185
- markModuleAndImpureDependenciesAsExecuted(module);
20186
- }
20304
+ markModuleAndImpureDependenciesAsExecuted(module);
20187
20305
  }
20188
20306
  if (this.options.treeshake) {
20189
20307
  let treeshakingPass = 1;
@@ -20200,6 +20318,16 @@ class Graph {
20200
20318
  }
20201
20319
  }
20202
20320
  }
20321
+ if (treeshakingPass === 1) {
20322
+ // We only include exports after the first pass to avoid issues with
20323
+ // the TDZ detection logic
20324
+ for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20325
+ if (module.preserveSignature !== false) {
20326
+ module.includeAllExports(false);
20327
+ this.needsTreeshakingPass = true;
20328
+ }
20329
+ }
20330
+ }
20203
20331
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
20204
20332
  } while (this.needsTreeshakingPass);
20205
20333
  }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.52.4",
3
+ "version": "2.52.8",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",