rollup 2.52.3 → 2.52.7

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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3";
35
+ var version$1 = "2.52.7";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -2417,7 +2417,7 @@ function createHasEffectsContext() {
2417
2417
  breaks: false,
2418
2418
  continues: false,
2419
2419
  labels: new Set(),
2420
- returnAwaitYield: false
2420
+ returnYield: false
2421
2421
  },
2422
2422
  includedLabels: new Set(),
2423
2423
  instantiated: new DiscriminatedPathTracker(),
@@ -5628,6 +5628,7 @@ class RestElement extends NodeBase {
5628
5628
  class FunctionNode extends NodeBase {
5629
5629
  constructor() {
5630
5630
  super(...arguments);
5631
+ this.deoptimizedReturn = false;
5631
5632
  this.isPrototypeDeoptimized = false;
5632
5633
  }
5633
5634
  createScope(parentScope) {
@@ -5658,7 +5659,18 @@ class FunctionNode extends NodeBase {
5658
5659
  }
5659
5660
  }
5660
5661
  getReturnExpressionWhenCalledAtPath(path) {
5661
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5662
+ if (path.length !== 0) {
5663
+ return UNKNOWN_EXPRESSION;
5664
+ }
5665
+ if (this.async) {
5666
+ if (!this.deoptimizedReturn) {
5667
+ this.deoptimizedReturn = true;
5668
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5669
+ this.context.requestTreeshakingPass();
5670
+ }
5671
+ return UNKNOWN_EXPRESSION;
5672
+ }
5673
+ return this.scope.getReturnExpression();
5662
5674
  }
5663
5675
  hasEffects() {
5664
5676
  return this.id !== null && this.id.hasEffects();
@@ -5701,7 +5713,7 @@ class FunctionNode extends NodeBase {
5701
5713
  breaks: false,
5702
5714
  continues: false,
5703
5715
  labels: new Set(),
5704
- returnAwaitYield: true
5716
+ returnYield: true
5705
5717
  };
5706
5718
  if (this.body.hasEffects(context))
5707
5719
  return true;
@@ -6420,6 +6432,10 @@ class BlockStatement extends NodeBase {
6420
6432
  }
6421
6433
 
6422
6434
  class ArrowFunctionExpression extends NodeBase {
6435
+ constructor() {
6436
+ super(...arguments);
6437
+ this.deoptimizedReturn = false;
6438
+ }
6423
6439
  createScope(parentScope) {
6424
6440
  this.scope = new ReturnValueScope(parentScope, this.context);
6425
6441
  }
@@ -6433,7 +6449,18 @@ class ArrowFunctionExpression extends NodeBase {
6433
6449
  // Arrow functions do not mutate their context
6434
6450
  deoptimizeThisOnEventAtPath() { }
6435
6451
  getReturnExpressionWhenCalledAtPath(path) {
6436
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6452
+ if (path.length !== 0) {
6453
+ return UNKNOWN_EXPRESSION;
6454
+ }
6455
+ if (this.async) {
6456
+ if (!this.deoptimizedReturn) {
6457
+ this.deoptimizedReturn = true;
6458
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
6459
+ this.context.requestTreeshakingPass();
6460
+ }
6461
+ return UNKNOWN_EXPRESSION;
6462
+ }
6463
+ return this.scope.getReturnExpression();
6437
6464
  }
6438
6465
  hasEffects() {
6439
6466
  return false;
@@ -6467,7 +6494,7 @@ class ArrowFunctionExpression extends NodeBase {
6467
6494
  breaks: false,
6468
6495
  continues: false,
6469
6496
  labels: new Set(),
6470
- returnAwaitYield: true
6497
+ returnYield: true
6471
6498
  };
6472
6499
  if (this.body.hasEffects(context))
6473
6500
  return true;
@@ -6612,17 +6639,18 @@ class AssignmentPattern extends NodeBase {
6612
6639
  }
6613
6640
 
6614
6641
  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))));
6642
+ constructor() {
6643
+ super(...arguments);
6644
+ this.deoptimized = false;
6645
+ }
6646
+ hasEffects() {
6647
+ if (!this.deoptimized)
6648
+ this.applyDeoptimizations();
6649
+ return true;
6624
6650
  }
6625
6651
  include(context, includeChildrenRecursively) {
6652
+ if (!this.deoptimized)
6653
+ this.applyDeoptimizations();
6626
6654
  if (!this.included) {
6627
6655
  this.included = true;
6628
6656
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
@@ -6636,6 +6664,11 @@ class AwaitExpression extends NodeBase {
6636
6664
  }
6637
6665
  this.argument.include(context, includeChildrenRecursively);
6638
6666
  }
6667
+ applyDeoptimizations() {
6668
+ this.deoptimized = true;
6669
+ this.argument.deoptimizePath(UNKNOWN_PATH);
6670
+ this.context.requestTreeshakingPass();
6671
+ }
6639
6672
  }
6640
6673
 
6641
6674
  const binaryOperators = {
@@ -8671,7 +8704,7 @@ class PropertyDefinition extends NodeBase {
8671
8704
 
8672
8705
  class ReturnStatement extends NodeBase {
8673
8706
  hasEffects(context) {
8674
- if (!context.ignore.returnAwaitYield ||
8707
+ if (!context.ignore.returnYield ||
8675
8708
  (this.argument !== null && this.argument.hasEffects(context)))
8676
8709
  return true;
8677
8710
  context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
@@ -9337,8 +9370,7 @@ class YieldExpression extends NodeBase {
9337
9370
  hasEffects(context) {
9338
9371
  if (!this.deoptimized)
9339
9372
  this.applyDeoptimizations();
9340
- return (!context.ignore.returnAwaitYield ||
9341
- (this.argument !== null && this.argument.hasEffects(context)));
9373
+ return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
9342
9374
  }
9343
9375
  render(code, options) {
9344
9376
  if (this.argument) {
@@ -10071,7 +10103,10 @@ class Module {
10071
10103
  if (name !== 'default') {
10072
10104
  const foundNamespaceReexport = name in this.namespaceReexportsByName
10073
10105
  ? this.namespaceReexportsByName[name]
10074
- : (this.namespaceReexportsByName[name] = this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports));
10106
+ : this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports);
10107
+ if (!skipExternalNamespaceReexports) {
10108
+ this.namespaceReexportsByName[name] = foundNamespaceReexport;
10109
+ }
10075
10110
  if (foundNamespaceReexport) {
10076
10111
  return foundNamespaceReexport;
10077
10112
  }
@@ -10410,25 +10445,28 @@ class Module {
10410
10445
  props.id = this.id;
10411
10446
  props.pos = pos;
10412
10447
  let code = this.info.code;
10413
- let { column, line } = locate(code, pos, { offsetLine: 1 });
10414
- try {
10415
- ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10416
- code = this.originalCode;
10417
- }
10418
- catch (e) {
10419
- this.options.onwarn({
10420
- code: 'SOURCEMAP_ERROR',
10421
- id: this.id,
10422
- loc: {
10423
- column,
10424
- file: this.id,
10425
- line
10426
- },
10427
- message: `Error when using sourcemap for reporting an error: ${e.message}`,
10428
- pos
10429
- });
10448
+ const location = locate(code, pos, { offsetLine: 1 });
10449
+ if (location) {
10450
+ let { column, line } = location;
10451
+ try {
10452
+ ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10453
+ code = this.originalCode;
10454
+ }
10455
+ catch (e) {
10456
+ this.options.onwarn({
10457
+ code: 'SOURCEMAP_ERROR',
10458
+ id: this.id,
10459
+ loc: {
10460
+ column,
10461
+ file: this.id,
10462
+ line
10463
+ },
10464
+ message: `Error when using sourcemap for reporting an error: ${e.message}`,
10465
+ pos
10466
+ });
10467
+ }
10468
+ augmentCodeLocation(props, { column, line }, code, this.id);
10430
10469
  }
10431
- augmentCodeLocation(props, { column, line }, code, this.id);
10432
10470
  }
10433
10471
  addModulesToImportDescriptions(importDescription) {
10434
10472
  for (const specifier of Object.values(importDescription)) {
@@ -10463,8 +10501,18 @@ class Module {
10463
10501
  }
10464
10502
  getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports = false) {
10465
10503
  let foundSyntheticDeclaration = null;
10466
- const skipExternalNamespaceValues = new Set([true, skipExternalNamespaceReexports]);
10467
- for (const skipExternalNamespaces of skipExternalNamespaceValues) {
10504
+ const skipExternalNamespaceValues = [{ searchedNamesAndModules, skipExternalNamespaces: true }];
10505
+ if (!skipExternalNamespaceReexports) {
10506
+ const clonedSearchedNamesAndModules = new Map();
10507
+ for (const [name, modules] of searchedNamesAndModules || []) {
10508
+ clonedSearchedNamesAndModules.set(name, new Set(modules));
10509
+ }
10510
+ skipExternalNamespaceValues.push({
10511
+ searchedNamesAndModules: clonedSearchedNamesAndModules,
10512
+ skipExternalNamespaces: false
10513
+ });
10514
+ }
10515
+ for (const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues) {
10468
10516
  const foundDeclarations = new Set();
10469
10517
  for (const module of this.exportAllModules) {
10470
10518
  if (module instanceof Module || !skipExternalNamespaces) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3
4
- Fri, 25 Jun 2021 13:12:43 GMT - commit 9c436a7c7c368f2ff840735a30119899513ff4bd
3
+ Rollup.js v2.52.7
4
+ Fri, 02 Jul 2021 03:59:47 GMT - commit b2218ccda2765c48ae1db8bade9ec6889aaab250
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.3",
3
+ "version": "2.52.7",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",