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/es/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
@@ -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.3";
17
+ var version$1 = "2.52.7";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -1944,7 +1944,7 @@ function createHasEffectsContext() {
1944
1944
  breaks: false,
1945
1945
  continues: false,
1946
1946
  labels: new Set(),
1947
- returnAwaitYield: false
1947
+ returnYield: false
1948
1948
  },
1949
1949
  includedLabels: new Set(),
1950
1950
  instantiated: new DiscriminatedPathTracker(),
@@ -5155,6 +5155,7 @@ class RestElement extends NodeBase {
5155
5155
  class FunctionNode extends NodeBase {
5156
5156
  constructor() {
5157
5157
  super(...arguments);
5158
+ this.deoptimizedReturn = false;
5158
5159
  this.isPrototypeDeoptimized = false;
5159
5160
  }
5160
5161
  createScope(parentScope) {
@@ -5185,7 +5186,18 @@ class FunctionNode extends NodeBase {
5185
5186
  }
5186
5187
  }
5187
5188
  getReturnExpressionWhenCalledAtPath(path) {
5188
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5189
+ if (path.length !== 0) {
5190
+ return UNKNOWN_EXPRESSION;
5191
+ }
5192
+ if (this.async) {
5193
+ if (!this.deoptimizedReturn) {
5194
+ this.deoptimizedReturn = true;
5195
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5196
+ this.context.requestTreeshakingPass();
5197
+ }
5198
+ return UNKNOWN_EXPRESSION;
5199
+ }
5200
+ return this.scope.getReturnExpression();
5189
5201
  }
5190
5202
  hasEffects() {
5191
5203
  return this.id !== null && this.id.hasEffects();
@@ -5228,7 +5240,7 @@ class FunctionNode extends NodeBase {
5228
5240
  breaks: false,
5229
5241
  continues: false,
5230
5242
  labels: new Set(),
5231
- returnAwaitYield: true
5243
+ returnYield: true
5232
5244
  };
5233
5245
  if (this.body.hasEffects(context))
5234
5246
  return true;
@@ -5947,6 +5959,10 @@ class BlockStatement extends NodeBase {
5947
5959
  }
5948
5960
 
5949
5961
  class ArrowFunctionExpression extends NodeBase {
5962
+ constructor() {
5963
+ super(...arguments);
5964
+ this.deoptimizedReturn = false;
5965
+ }
5950
5966
  createScope(parentScope) {
5951
5967
  this.scope = new ReturnValueScope(parentScope, this.context);
5952
5968
  }
@@ -5960,7 +5976,18 @@ class ArrowFunctionExpression extends NodeBase {
5960
5976
  // Arrow functions do not mutate their context
5961
5977
  deoptimizeThisOnEventAtPath() { }
5962
5978
  getReturnExpressionWhenCalledAtPath(path) {
5963
- return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5979
+ if (path.length !== 0) {
5980
+ return UNKNOWN_EXPRESSION;
5981
+ }
5982
+ if (this.async) {
5983
+ if (!this.deoptimizedReturn) {
5984
+ this.deoptimizedReturn = true;
5985
+ this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
5986
+ this.context.requestTreeshakingPass();
5987
+ }
5988
+ return UNKNOWN_EXPRESSION;
5989
+ }
5990
+ return this.scope.getReturnExpression();
5964
5991
  }
5965
5992
  hasEffects() {
5966
5993
  return false;
@@ -5994,7 +6021,7 @@ class ArrowFunctionExpression extends NodeBase {
5994
6021
  breaks: false,
5995
6022
  continues: false,
5996
6023
  labels: new Set(),
5997
- returnAwaitYield: true
6024
+ returnYield: true
5998
6025
  };
5999
6026
  if (this.body.hasEffects(context))
6000
6027
  return true;
@@ -6139,17 +6166,18 @@ class AssignmentPattern extends NodeBase {
6139
6166
  }
6140
6167
 
6141
6168
  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))));
6169
+ constructor() {
6170
+ super(...arguments);
6171
+ this.deoptimized = false;
6172
+ }
6173
+ hasEffects() {
6174
+ if (!this.deoptimized)
6175
+ this.applyDeoptimizations();
6176
+ return true;
6151
6177
  }
6152
6178
  include(context, includeChildrenRecursively) {
6179
+ if (!this.deoptimized)
6180
+ this.applyDeoptimizations();
6153
6181
  if (!this.included) {
6154
6182
  this.included = true;
6155
6183
  checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
@@ -6163,6 +6191,11 @@ class AwaitExpression extends NodeBase {
6163
6191
  }
6164
6192
  this.argument.include(context, includeChildrenRecursively);
6165
6193
  }
6194
+ applyDeoptimizations() {
6195
+ this.deoptimized = true;
6196
+ this.argument.deoptimizePath(UNKNOWN_PATH);
6197
+ this.context.requestTreeshakingPass();
6198
+ }
6166
6199
  }
6167
6200
 
6168
6201
  const binaryOperators = {
@@ -8577,7 +8610,7 @@ class PropertyDefinition extends NodeBase {
8577
8610
 
8578
8611
  class ReturnStatement extends NodeBase {
8579
8612
  hasEffects(context) {
8580
- if (!context.ignore.returnAwaitYield ||
8613
+ if (!context.ignore.returnYield ||
8581
8614
  (this.argument !== null && this.argument.hasEffects(context)))
8582
8615
  return true;
8583
8616
  context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
@@ -9243,8 +9276,7 @@ class YieldExpression extends NodeBase {
9243
9276
  hasEffects(context) {
9244
9277
  if (!this.deoptimized)
9245
9278
  this.applyDeoptimizations();
9246
- return (!context.ignore.returnAwaitYield ||
9247
- (this.argument !== null && this.argument.hasEffects(context)));
9279
+ return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
9248
9280
  }
9249
9281
  render(code, options) {
9250
9282
  if (this.argument) {
@@ -9977,7 +10009,10 @@ class Module {
9977
10009
  if (name !== 'default') {
9978
10010
  const foundNamespaceReexport = name in this.namespaceReexportsByName
9979
10011
  ? this.namespaceReexportsByName[name]
9980
- : (this.namespaceReexportsByName[name] = this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports));
10012
+ : this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports);
10013
+ if (!skipExternalNamespaceReexports) {
10014
+ this.namespaceReexportsByName[name] = foundNamespaceReexport;
10015
+ }
9981
10016
  if (foundNamespaceReexport) {
9982
10017
  return foundNamespaceReexport;
9983
10018
  }
@@ -10316,25 +10351,28 @@ class Module {
10316
10351
  props.id = this.id;
10317
10352
  props.pos = pos;
10318
10353
  let code = this.info.code;
10319
- let { column, line } = locate(code, pos, { offsetLine: 1 });
10320
- try {
10321
- ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10322
- code = this.originalCode;
10323
- }
10324
- catch (e) {
10325
- this.options.onwarn({
10326
- code: 'SOURCEMAP_ERROR',
10327
- id: this.id,
10328
- loc: {
10329
- column,
10330
- file: this.id,
10331
- line
10332
- },
10333
- message: `Error when using sourcemap for reporting an error: ${e.message}`,
10334
- pos
10335
- });
10354
+ const location = locate(code, pos, { offsetLine: 1 });
10355
+ if (location) {
10356
+ let { column, line } = location;
10357
+ try {
10358
+ ({ column, line } = getOriginalLocation(this.sourcemapChain, { column, line }));
10359
+ code = this.originalCode;
10360
+ }
10361
+ catch (e) {
10362
+ this.options.onwarn({
10363
+ code: 'SOURCEMAP_ERROR',
10364
+ id: this.id,
10365
+ loc: {
10366
+ column,
10367
+ file: this.id,
10368
+ line
10369
+ },
10370
+ message: `Error when using sourcemap for reporting an error: ${e.message}`,
10371
+ pos
10372
+ });
10373
+ }
10374
+ augmentCodeLocation(props, { column, line }, code, this.id);
10336
10375
  }
10337
- augmentCodeLocation(props, { column, line }, code, this.id);
10338
10376
  }
10339
10377
  addModulesToImportDescriptions(importDescription) {
10340
10378
  for (const specifier of Object.values(importDescription)) {
@@ -10369,8 +10407,18 @@ class Module {
10369
10407
  }
10370
10408
  getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports = false) {
10371
10409
  let foundSyntheticDeclaration = null;
10372
- const skipExternalNamespaceValues = new Set([true, skipExternalNamespaceReexports]);
10373
- for (const skipExternalNamespaces of skipExternalNamespaceValues) {
10410
+ const skipExternalNamespaceValues = [{ searchedNamesAndModules, skipExternalNamespaces: true }];
10411
+ if (!skipExternalNamespaceReexports) {
10412
+ const clonedSearchedNamesAndModules = new Map();
10413
+ for (const [name, modules] of searchedNamesAndModules || []) {
10414
+ clonedSearchedNamesAndModules.set(name, new Set(modules));
10415
+ }
10416
+ skipExternalNamespaceValues.push({
10417
+ searchedNamesAndModules: clonedSearchedNamesAndModules,
10418
+ skipExternalNamespaces: false
10419
+ });
10420
+ }
10421
+ for (const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues) {
10374
10422
  const foundDeclarations = new Set();
10375
10423
  for (const module of this.exportAllModules) {
10376
10424
  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