rollup 2.52.6 → 2.53.1

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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6";
22
+ var version$1 = "2.53.1";
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
  }
@@ -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();
@@ -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;
@@ -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);
@@ -6640,6 +6727,7 @@ class AwaitExpression extends NodeBase {
6640
6727
  applyDeoptimizations() {
6641
6728
  this.deoptimized = true;
6642
6729
  this.argument.deoptimizePath(UNKNOWN_PATH);
6730
+ this.context.requestTreeshakingPass();
6643
6731
  }
6644
6732
  }
6645
6733
 
@@ -7076,17 +7164,21 @@ class CallExpression extends NodeBase {
7076
7164
  }, UNKNOWN_EXPRESSION);
7077
7165
  }
7078
7166
  hasEffects(context) {
7079
- if (!this.deoptimized)
7080
- this.applyDeoptimizations();
7081
- for (const argument of this.arguments) {
7082
- if (argument.hasEffects(context))
7083
- 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();
7084
7181
  }
7085
- if (this.context.options.treeshake.annotations &&
7086
- this.annotations)
7087
- return false;
7088
- return (this.callee.hasEffects(context) ||
7089
- this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
7090
7182
  }
7091
7183
  hasEffectsWhenAccessedAtPath(path, context) {
7092
7184
  return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
@@ -8601,6 +8693,11 @@ class ObjectPattern extends NodeBase {
8601
8693
  }
8602
8694
  return false;
8603
8695
  }
8696
+ markDeclarationReached() {
8697
+ for (const property of this.properties) {
8698
+ property.markDeclarationReached();
8699
+ }
8700
+ }
8604
8701
  }
8605
8702
 
8606
8703
  class PrivateIdentifier extends NodeBase {
@@ -8625,6 +8722,9 @@ class Property extends MethodBase {
8625
8722
  this.key.hasEffects(context) ||
8626
8723
  this.value.hasEffects(context));
8627
8724
  }
8725
+ markDeclarationReached() {
8726
+ this.value.markDeclarationReached();
8727
+ }
8628
8728
  render(code, options) {
8629
8729
  if (!this.shorthand) {
8630
8730
  this.key.render(code, options);
@@ -9280,16 +9380,19 @@ class VariableDeclarator extends NodeBase {
9280
9380
  this.id.deoptimizePath(path);
9281
9381
  }
9282
9382
  hasEffects(context) {
9283
- 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);
9284
9386
  }
9285
9387
  include(context, includeChildrenRecursively) {
9286
9388
  this.included = true;
9287
- if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9288
- this.id.include(context, includeChildrenRecursively);
9289
- }
9290
9389
  if (this.init) {
9291
9390
  this.init.include(context, includeChildrenRecursively);
9292
9391
  }
9392
+ this.id.markDeclarationReached();
9393
+ if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9394
+ this.id.include(context, includeChildrenRecursively);
9395
+ }
9293
9396
  }
9294
9397
  render(code, options) {
9295
9398
  const renderId = this.id.included;
@@ -10114,8 +10217,8 @@ class Module {
10114
10217
  }
10115
10218
  includeAllExports(includeNamespaceMembers) {
10116
10219
  if (!this.isExecuted) {
10117
- this.graph.needsTreeshakingPass = true;
10118
10220
  markModuleAndImpureDependenciesAsExecuted(this);
10221
+ this.graph.needsTreeshakingPass = true;
10119
10222
  }
10120
10223
  for (const exportName of this.getExports()) {
10121
10224
  if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
@@ -10144,6 +10247,7 @@ class Module {
10144
10247
  }
10145
10248
  includeAllInBundle() {
10146
10249
  this.ast.include(createInclusionContext(), true);
10250
+ this.includeAllExports(false);
10147
10251
  }
10148
10252
  isIncluded() {
10149
10253
  return this.ast.included || this.namespace.included || this.importedFromNotTreeshaken;
@@ -19048,16 +19152,16 @@ Parser.acorn = {
19048
19152
  nonASCIIwhitespace: nonASCIIwhitespace
19049
19153
  };
19050
19154
 
19051
- const readFile = (file) => new Promise((fulfil, reject) => fs__namespace.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19155
+ const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19052
19156
  function mkdirpath(path$1) {
19053
19157
  const dir = path.dirname(path$1);
19054
19158
  try {
19055
- fs__namespace.readdirSync(dir);
19159
+ fs.readdirSync(dir);
19056
19160
  }
19057
19161
  catch (err) {
19058
19162
  mkdirpath(dir);
19059
19163
  try {
19060
- fs__namespace.mkdirSync(dir);
19164
+ fs.mkdirSync(dir);
19061
19165
  }
19062
19166
  catch (err2) {
19063
19167
  if (err2.code !== 'EEXIST') {
@@ -19069,7 +19173,7 @@ function mkdirpath(path$1) {
19069
19173
  function writeFile(dest, data) {
19070
19174
  return new Promise((fulfil, reject) => {
19071
19175
  mkdirpath(dest);
19072
- fs__namespace.writeFile(dest, data, err => {
19176
+ fs.writeFile(dest, data, err => {
19073
19177
  if (err) {
19074
19178
  reject(err);
19075
19179
  }
@@ -19080,6 +19184,37 @@ function writeFile(dest, data) {
19080
19184
  });
19081
19185
  }
19082
19186
 
19187
+ class Queue {
19188
+ constructor(maxParallel = 1) {
19189
+ this.maxParallel = maxParallel;
19190
+ this.queue = new Array();
19191
+ this.workerCount = 0;
19192
+ }
19193
+ run(task) {
19194
+ return new Promise((resolve, reject) => {
19195
+ this.queue.push({ reject, resolve, task });
19196
+ this.work();
19197
+ });
19198
+ }
19199
+ async work() {
19200
+ if (this.workerCount >= this.maxParallel)
19201
+ return;
19202
+ this.workerCount++;
19203
+ let entry;
19204
+ while ((entry = this.queue.shift())) {
19205
+ const { reject, resolve, task } = entry;
19206
+ try {
19207
+ const result = await task();
19208
+ resolve(result);
19209
+ }
19210
+ catch (err) {
19211
+ reject(err);
19212
+ }
19213
+ }
19214
+ this.workerCount--;
19215
+ }
19216
+ }
19217
+
19083
19218
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
19084
19219
  let skipped = null;
19085
19220
  let replaceContext = null;
@@ -19399,6 +19534,7 @@ class ModuleLoader {
19399
19534
  this.indexedEntryModules = [];
19400
19535
  this.latestLoadModulesPromise = Promise.resolve();
19401
19536
  this.nextEntryModuleIndex = 0;
19537
+ this.readQueue = new Queue();
19402
19538
  this.resolveId = async (source, importer, customOptions, skip = null) => {
19403
19539
  return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
19404
19540
  ? false
@@ -19407,6 +19543,7 @@ class ModuleLoader {
19407
19543
  this.hasModuleSideEffects = options.treeshake
19408
19544
  ? options.treeshake.moduleSideEffects
19409
19545
  : () => true;
19546
+ this.readQueue.maxParallel = options.maxParallelFileReads;
19410
19547
  }
19411
19548
  async addAdditionalModules(unresolvedModules) {
19412
19549
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -19492,7 +19629,8 @@ class ModuleLoader {
19492
19629
  timeStart('load modules', 3);
19493
19630
  let source;
19494
19631
  try {
19495
- source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
19632
+ source =
19633
+ (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
19496
19634
  }
19497
19635
  catch (err) {
19498
19636
  timeEnd('load modules', 3);
@@ -20185,12 +20323,7 @@ class Graph {
20185
20323
  }
20186
20324
  includeStatements() {
20187
20325
  for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20188
- if (module.preserveSignature !== false) {
20189
- module.includeAllExports(false);
20190
- }
20191
- else {
20192
- markModuleAndImpureDependenciesAsExecuted(module);
20193
- }
20326
+ markModuleAndImpureDependenciesAsExecuted(module);
20194
20327
  }
20195
20328
  if (this.options.treeshake) {
20196
20329
  let treeshakingPass = 1;
@@ -20207,6 +20340,16 @@ class Graph {
20207
20340
  }
20208
20341
  }
20209
20342
  }
20343
+ if (treeshakingPass === 1) {
20344
+ // We only include exports after the first pass to avoid issues with
20345
+ // the TDZ detection logic
20346
+ for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
20347
+ if (module.preserveSignature !== false) {
20348
+ module.includeAllExports(false);
20349
+ this.needsTreeshakingPass = true;
20350
+ }
20351
+ }
20352
+ }
20210
20353
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
20211
20354
  } while (this.needsTreeshakingPass);
20212
20355
  }
@@ -20276,6 +20419,7 @@ function normalizeInputOptions(config) {
20276
20419
  input: getInput(config),
20277
20420
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
20278
20421
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
20422
+ maxParallelFileReads: getMaxParallelFileReads(config),
20279
20423
  moduleContext: getModuleContext(config, context),
20280
20424
  onwarn,
20281
20425
  perf: config.perf || false,
@@ -20356,6 +20500,15 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
20356
20500
  }
20357
20501
  return configManualChunks;
20358
20502
  };
20503
+ const getMaxParallelFileReads = (config) => {
20504
+ const maxParallelFileReads = config.maxParallelFileReads;
20505
+ if (typeof maxParallelFileReads === 'number') {
20506
+ if (maxParallelFileReads <= 0)
20507
+ return Infinity;
20508
+ return maxParallelFileReads;
20509
+ }
20510
+ return 20;
20511
+ };
20359
20512
  const getModuleContext = (config, context) => {
20360
20513
  const configModuleContext = config.moduleContext;
20361
20514
  if (typeof configModuleContext === 'function') {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6
4
- Thu, 01 Jul 2021 05:19:49 GMT - commit 9cb15d65bb023d32ae0180f0db583ea992c475b9
3
+ Rollup.js v2.53.1
4
+ Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
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.6",
3
+ "version": "2.53.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",