rollup 2.52.5 → 2.53.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.
package/dist/rollup.d.ts CHANGED
@@ -537,6 +537,7 @@ export interface InputOptions {
537
537
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
538
538
  /** @deprecated Use the "manualChunks" output option instead. */
539
539
  manualChunks?: ManualChunksOption;
540
+ maxParallelFileReads?: number;
540
541
  moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
541
542
  onwarn?: WarningHandlerWithDefault;
542
543
  perf?: boolean;
@@ -564,6 +565,7 @@ export interface NormalizedInputOptions {
564
565
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
565
566
  /** @deprecated Use the "manualChunks" output option instead. */
566
567
  manualChunks: ManualChunksOption | undefined;
568
+ maxParallelFileReads: number;
567
569
  moduleContext: (id: string) => string;
568
570
  onwarn: WarningHandler;
569
571
  perf: boolean;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
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.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
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.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
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.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -74,6 +74,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
74
74
  input: getOption('input') || [],
75
75
  makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
76
76
  manualChunks: getOption('manualChunks'),
77
+ maxParallelFileReads: getOption('maxParallelFileReads'),
77
78
  moduleContext: getOption('moduleContext'),
78
79
  onwarn: getOnWarn(config, defaultOnWarnHandler),
79
80
  perf: getOption('perf'),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -19,20 +19,7 @@ function _interopNamespaceDefaultOnly(e) {
19
19
  return {__proto__: null, 'default': e};
20
20
  }
21
21
 
22
- function _interopNamespaceDefault(e) {
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- n[k] = e[k];
27
- });
28
- }
29
- n['default'] = e;
30
- return n;
31
- }
32
-
33
- var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
-
35
- var version$1 = "2.52.5";
22
+ var version$1 = "2.53.0";
36
23
 
37
24
  function ensureArray(items) {
38
25
  if (Array.isArray(items)) {
@@ -2184,8 +2171,10 @@ class Variable extends ExpressionEntity {
2184
2171
  super();
2185
2172
  this.name = name;
2186
2173
  this.alwaysRendered = false;
2174
+ this.initReached = false;
2187
2175
  this.isId = false;
2188
2176
  this.isReassigned = false;
2177
+ this.kind = null;
2189
2178
  this.renderBaseName = null;
2190
2179
  this.renderName = null;
2191
2180
  }
@@ -2417,7 +2406,7 @@ function createHasEffectsContext() {
2417
2406
  breaks: false,
2418
2407
  continues: false,
2419
2408
  labels: new Set(),
2420
- returnAwaitYield: false
2409
+ returnYield: false
2421
2410
  },
2422
2411
  includedLabels: new Set(),
2423
2412
  instantiated: new DiscriminatedPathTracker(),
@@ -4556,11 +4545,19 @@ class GlobalVariable extends Variable {
4556
4545
  }
4557
4546
  }
4558
4547
 
4548
+ const tdzVariableKinds = {
4549
+ __proto__: null,
4550
+ class: true,
4551
+ const: true,
4552
+ let: true,
4553
+ var: true
4554
+ };
4559
4555
  class Identifier extends NodeBase {
4560
4556
  constructor() {
4561
4557
  super(...arguments);
4562
4558
  this.variable = null;
4563
4559
  this.deoptimized = false;
4560
+ this.isTDZAccess = null;
4564
4561
  }
4565
4562
  addExportedVariables(variables, exportNamesByVariable) {
4566
4563
  if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
@@ -4601,6 +4598,7 @@ class Identifier extends NodeBase {
4601
4598
  /* istanbul ignore next */
4602
4599
  throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
4603
4600
  }
4601
+ variable.kind = kind;
4604
4602
  return [(this.variable = variable)];
4605
4603
  }
4606
4604
  deoptimizePath(path) {
@@ -4613,26 +4611,34 @@ class Identifier extends NodeBase {
4613
4611
  this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
4614
4612
  }
4615
4613
  getLiteralValueAtPath(path, recursionTracker, origin) {
4616
- return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
4614
+ return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
4617
4615
  }
4618
4616
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
4619
- return this.variable.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4617
+ return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
4620
4618
  }
4621
4619
  hasEffects() {
4622
4620
  if (!this.deoptimized)
4623
4621
  this.applyDeoptimizations();
4622
+ if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
4623
+ return true;
4624
+ }
4624
4625
  return (this.context.options.treeshake.unknownGlobalSideEffects &&
4625
4626
  this.variable instanceof GlobalVariable &&
4626
4627
  this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
4627
4628
  }
4628
4629
  hasEffectsWhenAccessedAtPath(path, context) {
4629
- return this.variable !== null && this.variable.hasEffectsWhenAccessedAtPath(path, context);
4630
+ return (this.variable !== null &&
4631
+ this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
4630
4632
  }
4631
4633
  hasEffectsWhenAssignedAtPath(path, context) {
4632
- return !this.variable || this.variable.hasEffectsWhenAssignedAtPath(path, context);
4634
+ return (!this.variable ||
4635
+ (path.length > 0
4636
+ ? this.getVariableRespectingTDZ()
4637
+ : this.variable).hasEffectsWhenAssignedAtPath(path, context));
4633
4638
  }
4634
4639
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
4635
- return !this.variable || this.variable.hasEffectsWhenCalledAtPath(path, callOptions, context);
4640
+ return (!this.variable ||
4641
+ this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context));
4636
4642
  }
4637
4643
  include() {
4638
4644
  if (!this.deoptimized)
@@ -4645,7 +4651,10 @@ class Identifier extends NodeBase {
4645
4651
  }
4646
4652
  }
4647
4653
  includeCallArguments(context, args) {
4648
- this.variable.includeCallArguments(context, args);
4654
+ this.getVariableRespectingTDZ().includeCallArguments(context, args);
4655
+ }
4656
+ markDeclarationReached() {
4657
+ this.variable.initReached = true;
4649
4658
  }
4650
4659
  render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
4651
4660
  if (this.variable) {
@@ -4680,6 +4689,28 @@ class Identifier extends NodeBase {
4680
4689
  message: `Illegal reassignment to import '${this.name}'`
4681
4690
  }, this.start);
4682
4691
  }
4692
+ getVariableRespectingTDZ() {
4693
+ if (this.isPossibleTDZ()) {
4694
+ return UNKNOWN_EXPRESSION;
4695
+ }
4696
+ return this.variable;
4697
+ }
4698
+ isPossibleTDZ() {
4699
+ // return cached value to avoid issues with the next tree-shaking pass
4700
+ if (this.isTDZAccess !== null)
4701
+ return this.isTDZAccess;
4702
+ if (!(this.variable instanceof LocalVariable) ||
4703
+ !this.variable.kind ||
4704
+ !(this.variable.kind in tdzVariableKinds)) {
4705
+ return (this.isTDZAccess = false);
4706
+ }
4707
+ if (!this.variable.initReached) {
4708
+ // Either a const/let TDZ violation or
4709
+ // var use before declaration was encountered.
4710
+ return (this.isTDZAccess = true);
4711
+ }
4712
+ return (this.isTDZAccess = false);
4713
+ }
4683
4714
  }
4684
4715
 
4685
4716
  const EVENT_ACCESSED = 0;
@@ -5280,6 +5311,12 @@ class ClassNode extends NodeBase {
5280
5311
  getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
5281
5312
  return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
5282
5313
  }
5314
+ hasEffects(context) {
5315
+ var _a, _b;
5316
+ const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
5317
+ (_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
5318
+ return initEffect || super.hasEffects(context);
5319
+ }
5283
5320
  hasEffectsWhenAccessedAtPath(path, context) {
5284
5321
  return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
5285
5322
  }
@@ -5298,10 +5335,19 @@ class ClassNode extends NodeBase {
5298
5335
  return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
5299
5336
  }
5300
5337
  }
5301
- initialise() {
5302
- if (this.id !== null) {
5303
- this.id.declare('class', this);
5338
+ include(context, includeChildrenRecursively) {
5339
+ var _a;
5340
+ this.included = true;
5341
+ (_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
5342
+ this.body.include(context, includeChildrenRecursively);
5343
+ if (this.id) {
5344
+ this.id.markDeclarationReached();
5345
+ this.id.include();
5304
5346
  }
5347
+ }
5348
+ initialise() {
5349
+ var _a;
5350
+ (_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
5305
5351
  for (const method of this.body.body) {
5306
5352
  if (method instanceof MethodDefinition && method.kind === 'constructor') {
5307
5353
  this.classConstructor = method;
@@ -5616,6 +5662,9 @@ class RestElement extends NodeBase {
5616
5662
  hasEffectsWhenAssignedAtPath(path, context) {
5617
5663
  return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
5618
5664
  }
5665
+ markDeclarationReached() {
5666
+ this.argument.markDeclarationReached();
5667
+ }
5619
5668
  applyDeoptimizations() {
5620
5669
  this.deoptimized = true;
5621
5670
  if (this.declarationInit !== null) {
@@ -5628,6 +5677,7 @@ class RestElement extends NodeBase {
5628
5677
  class FunctionNode extends NodeBase {
5629
5678
  constructor() {
5630
5679
  super(...arguments);
5680
+ this.deoptimizedReturn = false;
5631
5681
  this.isPrototypeDeoptimized = false;
5632
5682
  }
5633
5683
  createScope(parentScope) {
@@ -5658,7 +5708,18 @@ class FunctionNode extends NodeBase {
5658
5708
  }
5659
5709
  }
5660
5710
  getReturnExpressionWhenCalledAtPath(path) {
5661
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5711
+ if (path.length !== 0) {
5712
+ return UNKNOWN_EXPRESSION;
5713
+ }
5714
+ if (this.async) {
5715
+ if (!this.deoptimizedReturn) {
5716
+ this.deoptimizedReturn = true;
5717
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5718
+ this.context.requestTreeshakingPass();
5719
+ }
5720
+ return UNKNOWN_EXPRESSION;
5721
+ }
5722
+ return this.scope.getReturnExpression();
5662
5723
  }
5663
5724
  hasEffects() {
5664
5725
  return this.id !== null && this.id.hasEffects();
@@ -5701,7 +5762,7 @@ class FunctionNode extends NodeBase {
5701
5762
  breaks: false,
5702
5763
  continues: false,
5703
5764
  labels: new Set(),
5704
- returnAwaitYield: true
5765
+ returnYield: true
5705
5766
  };
5706
5767
  if (this.body.hasEffects(context))
5707
5768
  return true;
@@ -6324,13 +6385,21 @@ class ArrayPattern extends NodeBase {
6324
6385
  }
6325
6386
  return false;
6326
6387
  }
6388
+ markDeclarationReached() {
6389
+ for (const element of this.elements) {
6390
+ if (element !== null) {
6391
+ element.markDeclarationReached();
6392
+ }
6393
+ }
6394
+ }
6327
6395
  }
6328
6396
 
6329
6397
  class BlockScope extends ChildScope {
6330
6398
  addDeclaration(identifier, context, init, isHoisted) {
6331
6399
  if (isHoisted) {
6332
6400
  this.parent.addDeclaration(identifier, context, init, isHoisted);
6333
- // Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
6401
+ // Necessary to make sure the init is deoptimized for conditional declarations.
6402
+ // We cannot call deoptimizePath here.
6334
6403
  return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
6335
6404
  }
6336
6405
  else {
@@ -6420,6 +6489,10 @@ class BlockStatement extends NodeBase {
6420
6489
  }
6421
6490
 
6422
6491
  class ArrowFunctionExpression extends NodeBase {
6492
+ constructor() {
6493
+ super(...arguments);
6494
+ this.deoptimizedReturn = false;
6495
+ }
6423
6496
  createScope(parentScope) {
6424
6497
  this.scope = new ReturnValueScope(parentScope, this.context);
6425
6498
  }
@@ -6433,7 +6506,18 @@ class ArrowFunctionExpression extends NodeBase {
6433
6506
  // Arrow functions do not mutate their context
6434
6507
  deoptimizeThisOnEventAtPath() { }
6435
6508
  getReturnExpressionWhenCalledAtPath(path) {
6436
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6509
+ if (path.length !== 0) {
6510
+ return UNKNOWN_EXPRESSION;
6511
+ }
6512
+ if (this.async) {
6513
+ if (!this.deoptimizedReturn) {
6514
+ this.deoptimizedReturn = true;
6515
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
6516
+ this.context.requestTreeshakingPass();
6517
+ }
6518
+ return UNKNOWN_EXPRESSION;
6519
+ }
6520
+ return this.scope.getReturnExpression();
6437
6521
  }
6438
6522
  hasEffects() {
6439
6523
  return false;
@@ -6467,7 +6551,7 @@ class ArrowFunctionExpression extends NodeBase {
6467
6551
  breaks: false,
6468
6552
  continues: false,
6469
6553
  labels: new Set(),
6470
- returnAwaitYield: true
6554
+ returnYield: true
6471
6555
  };
6472
6556
  if (this.body.hasEffects(context))
6473
6557
  return true;
@@ -6599,6 +6683,9 @@ class AssignmentPattern extends NodeBase {
6599
6683
  hasEffectsWhenAssignedAtPath(path, context) {
6600
6684
  return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
6601
6685
  }
6686
+ markDeclarationReached() {
6687
+ this.left.markDeclarationReached();
6688
+ }
6602
6689
  render(code, options, { isShorthandProperty } = BLANK) {
6603
6690
  this.left.render(code, options, { isShorthandProperty });
6604
6691
  this.right.render(code, options);
@@ -6612,17 +6699,18 @@ class AssignmentPattern extends NodeBase {
6612
6699
  }
6613
6700
 
6614
6701
  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))));
6702
+ constructor() {
6703
+ super(...arguments);
6704
+ this.deoptimized = false;
6705
+ }
6706
+ hasEffects() {
6707
+ if (!this.deoptimized)
6708
+ this.applyDeoptimizations();
6709
+ return true;
6624
6710
  }
6625
6711
  include(context, includeChildrenRecursively) {
6712
+ if (!this.deoptimized)
6713
+ this.applyDeoptimizations();
6626
6714
  if (!this.included) {
6627
6715
  this.included = true;
6628
6716
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
@@ -6636,6 +6724,11 @@ class AwaitExpression extends NodeBase {
6636
6724
  }
6637
6725
  this.argument.include(context, includeChildrenRecursively);
6638
6726
  }
6727
+ applyDeoptimizations() {
6728
+ this.deoptimized = true;
6729
+ this.argument.deoptimizePath(UNKNOWN_PATH);
6730
+ this.context.requestTreeshakingPass();
6731
+ }
6639
6732
  }
6640
6733
 
6641
6734
  const binaryOperators = {
@@ -7071,17 +7164,21 @@ class CallExpression extends NodeBase {
7071
7164
  }, UNKNOWN_EXPRESSION);
7072
7165
  }
7073
7166
  hasEffects(context) {
7074
- if (!this.deoptimized)
7075
- this.applyDeoptimizations();
7076
- for (const argument of this.arguments) {
7077
- if (argument.hasEffects(context))
7078
- return true;
7167
+ try {
7168
+ for (const argument of this.arguments) {
7169
+ if (argument.hasEffects(context))
7170
+ return true;
7171
+ }
7172
+ if (this.context.options.treeshake.annotations &&
7173
+ this.annotations)
7174
+ return false;
7175
+ return (this.callee.hasEffects(context) ||
7176
+ this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
7177
+ }
7178
+ finally {
7179
+ if (!this.deoptimized)
7180
+ this.applyDeoptimizations();
7079
7181
  }
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
7182
  }
7086
7183
  hasEffectsWhenAccessedAtPath(path, context) {
7087
7184
  return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
@@ -8596,6 +8693,11 @@ class ObjectPattern extends NodeBase {
8596
8693
  }
8597
8694
  return false;
8598
8695
  }
8696
+ markDeclarationReached() {
8697
+ for (const property of this.properties) {
8698
+ property.markDeclarationReached();
8699
+ }
8700
+ }
8599
8701
  }
8600
8702
 
8601
8703
  class PrivateIdentifier extends NodeBase {
@@ -8620,6 +8722,9 @@ class Property extends MethodBase {
8620
8722
  this.key.hasEffects(context) ||
8621
8723
  this.value.hasEffects(context));
8622
8724
  }
8725
+ markDeclarationReached() {
8726
+ this.value.markDeclarationReached();
8727
+ }
8623
8728
  render(code, options) {
8624
8729
  if (!this.shorthand) {
8625
8730
  this.key.render(code, options);
@@ -8671,7 +8776,7 @@ class PropertyDefinition extends NodeBase {
8671
8776
 
8672
8777
  class ReturnStatement extends NodeBase {
8673
8778
  hasEffects(context) {
8674
- if (!context.ignore.returnAwaitYield ||
8779
+ if (!context.ignore.returnYield ||
8675
8780
  (this.argument !== null && this.argument.hasEffects(context)))
8676
8781
  return true;
8677
8782
  context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
@@ -9275,16 +9380,19 @@ class VariableDeclarator extends NodeBase {
9275
9380
  this.id.deoptimizePath(path);
9276
9381
  }
9277
9382
  hasEffects(context) {
9278
- return this.id.hasEffects(context) || (this.init !== null && this.init.hasEffects(context));
9383
+ const initEffect = this.init !== null && this.init.hasEffects(context);
9384
+ this.id.markDeclarationReached();
9385
+ return initEffect || this.id.hasEffects(context);
9279
9386
  }
9280
9387
  include(context, includeChildrenRecursively) {
9281
9388
  this.included = true;
9282
- if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9283
- this.id.include(context, includeChildrenRecursively);
9284
- }
9285
9389
  if (this.init) {
9286
9390
  this.init.include(context, includeChildrenRecursively);
9287
9391
  }
9392
+ this.id.markDeclarationReached();
9393
+ if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9394
+ this.id.include(context, includeChildrenRecursively);
9395
+ }
9288
9396
  }
9289
9397
  render(code, options) {
9290
9398
  const renderId = this.id.included;
@@ -9337,8 +9445,7 @@ class YieldExpression extends NodeBase {
9337
9445
  hasEffects(context) {
9338
9446
  if (!this.deoptimized)
9339
9447
  this.applyDeoptimizations();
9340
- return (!context.ignore.returnAwaitYield ||
9341
- (this.argument !== null && this.argument.hasEffects(context)));
9448
+ return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
9342
9449
  }
9343
9450
  render(code, options) {
9344
9451
  if (this.argument) {
@@ -10110,8 +10217,8 @@ class Module {
10110
10217
  }
10111
10218
  includeAllExports(includeNamespaceMembers) {
10112
10219
  if (!this.isExecuted) {
10113
- this.graph.needsTreeshakingPass = true;
10114
10220
  markModuleAndImpureDependenciesAsExecuted(this);
10221
+ this.graph.needsTreeshakingPass = true;
10115
10222
  }
10116
10223
  for (const exportName of this.getExports()) {
10117
10224
  if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
@@ -19044,16 +19151,16 @@ Parser.acorn = {
19044
19151
  nonASCIIwhitespace: nonASCIIwhitespace
19045
19152
  };
19046
19153
 
19047
- const readFile = (file) => new Promise((fulfil, reject) => fs__namespace.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19154
+ const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19048
19155
  function mkdirpath(path$1) {
19049
19156
  const dir = path.dirname(path$1);
19050
19157
  try {
19051
- fs__namespace.readdirSync(dir);
19158
+ fs.readdirSync(dir);
19052
19159
  }
19053
19160
  catch (err) {
19054
19161
  mkdirpath(dir);
19055
19162
  try {
19056
- fs__namespace.mkdirSync(dir);
19163
+ fs.mkdirSync(dir);
19057
19164
  }
19058
19165
  catch (err2) {
19059
19166
  if (err2.code !== 'EEXIST') {
@@ -19065,7 +19172,7 @@ function mkdirpath(path$1) {
19065
19172
  function writeFile(dest, data) {
19066
19173
  return new Promise((fulfil, reject) => {
19067
19174
  mkdirpath(dest);
19068
- fs__namespace.writeFile(dest, data, err => {
19175
+ fs.writeFile(dest, data, err => {
19069
19176
  if (err) {
19070
19177
  reject(err);
19071
19178
  }
@@ -19076,6 +19183,37 @@ function writeFile(dest, data) {
19076
19183
  });
19077
19184
  }
19078
19185
 
19186
+ class Queue {
19187
+ constructor(maxParallel = 1) {
19188
+ this.maxParallel = maxParallel;
19189
+ this.queue = new Array();
19190
+ this.workerCount = 0;
19191
+ }
19192
+ run(task) {
19193
+ return new Promise((resolve, reject) => {
19194
+ this.queue.push({ reject, resolve, task });
19195
+ this.work();
19196
+ });
19197
+ }
19198
+ async work() {
19199
+ if (this.workerCount >= this.maxParallel)
19200
+ return;
19201
+ this.workerCount++;
19202
+ let entry;
19203
+ while ((entry = this.queue.shift())) {
19204
+ const { reject, resolve, task } = entry;
19205
+ try {
19206
+ const result = await task();
19207
+ resolve(result);
19208
+ }
19209
+ catch (err) {
19210
+ reject(err);
19211
+ }
19212
+ }
19213
+ this.workerCount--;
19214
+ }
19215
+ }
19216
+
19079
19217
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
19080
19218
  let skipped = null;
19081
19219
  let replaceContext = null;
@@ -19395,6 +19533,7 @@ class ModuleLoader {
19395
19533
  this.indexedEntryModules = [];
19396
19534
  this.latestLoadModulesPromise = Promise.resolve();
19397
19535
  this.nextEntryModuleIndex = 0;
19536
+ this.readQueue = new Queue();
19398
19537
  this.resolveId = async (source, importer, customOptions, skip = null) => {
19399
19538
  return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
19400
19539
  ? false
@@ -19403,6 +19542,7 @@ class ModuleLoader {
19403
19542
  this.hasModuleSideEffects = options.treeshake
19404
19543
  ? options.treeshake.moduleSideEffects
19405
19544
  : () => true;
19545
+ this.readQueue.maxParallel = options.maxParallelFileReads;
19406
19546
  }
19407
19547
  async addAdditionalModules(unresolvedModules) {
19408
19548
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -19488,7 +19628,8 @@ class ModuleLoader {
19488
19628
  timeStart('load modules', 3);
19489
19629
  let source;
19490
19630
  try {
19491
- source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
19631
+ source =
19632
+ (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
19492
19633
  }
19493
19634
  catch (err) {
19494
19635
  timeEnd('load modules', 3);
@@ -20181,12 +20322,7 @@ class Graph {
20181
20322
  }
20182
20323
  includeStatements() {
20183
20324
  for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20184
- if (module.preserveSignature !== false) {
20185
- module.includeAllExports(false);
20186
- }
20187
- else {
20188
- markModuleAndImpureDependenciesAsExecuted(module);
20189
- }
20325
+ markModuleAndImpureDependenciesAsExecuted(module);
20190
20326
  }
20191
20327
  if (this.options.treeshake) {
20192
20328
  let treeshakingPass = 1;
@@ -20203,6 +20339,16 @@ class Graph {
20203
20339
  }
20204
20340
  }
20205
20341
  }
20342
+ if (treeshakingPass === 1) {
20343
+ // We only include exports after the first pass to avoid issues with
20344
+ // the TDZ detection logic
20345
+ for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20346
+ if (module.preserveSignature !== false) {
20347
+ module.includeAllExports(false);
20348
+ this.needsTreeshakingPass = true;
20349
+ }
20350
+ }
20351
+ }
20206
20352
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
20207
20353
  } while (this.needsTreeshakingPass);
20208
20354
  }
@@ -20272,6 +20418,7 @@ function normalizeInputOptions(config) {
20272
20418
  input: getInput(config),
20273
20419
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
20274
20420
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
20421
+ maxParallelFileReads: getMaxParallelFileReads(config),
20275
20422
  moduleContext: getModuleContext(config, context),
20276
20423
  onwarn,
20277
20424
  perf: config.perf || false,
@@ -20352,6 +20499,15 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
20352
20499
  }
20353
20500
  return configManualChunks;
20354
20501
  };
20502
+ const getMaxParallelFileReads = (config) => {
20503
+ const maxParallelFileReads = config.maxParallelFileReads;
20504
+ if (typeof maxParallelFileReads === 'number') {
20505
+ if (maxParallelFileReads <= 0)
20506
+ return Infinity;
20507
+ return maxParallelFileReads;
20508
+ }
20509
+ return 20;
20510
+ };
20355
20511
  const getModuleContext = (config, context) => {
20356
20512
  const configModuleContext = config.moduleContext;
20357
20513
  if (typeof configModuleContext === 'function') {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.5
4
- Thu, 01 Jul 2021 04:41:25 GMT - commit 5b55f9937685279c16243b37d858e6ddcd2aeaff
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup