rollup 2.37.1 → 2.38.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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -19,7 +19,7 @@ function _interopNamespaceDefaultOnly(e) {
19
19
  return {__proto__: null, 'default': e};
20
20
  }
21
21
 
22
- var version = "2.37.1";
22
+ var version = "2.38.0";
23
23
 
24
24
  function ensureArray(items) {
25
25
  if (Array.isArray(items)) {
@@ -2689,6 +2689,7 @@ class NodeBase {
2689
2689
  this.context.magicString.addSourcemapLocation(this.start);
2690
2690
  this.context.magicString.addSourcemapLocation(this.end);
2691
2691
  }
2692
+ addExportedVariables(_variables, _exportNamesByVariable) { }
2692
2693
  /**
2693
2694
  * Override this to bind assignments to variables and do any initialisations that
2694
2695
  * require the scopes to be populated with variables.
@@ -2715,9 +2716,6 @@ class NodeBase {
2715
2716
  createScope(parentScope) {
2716
2717
  this.scope = parentScope;
2717
2718
  }
2718
- declare(_kind, _init) {
2719
- return [];
2720
- }
2721
2719
  deoptimizePath(_path) { }
2722
2720
  getLiteralValueAtPath(_path, _recursionTracker, _origin) {
2723
2721
  return UnknownValue;
@@ -2767,14 +2765,14 @@ class NodeBase {
2767
2765
  }
2768
2766
  }
2769
2767
  }
2768
+ includeAllDeclaredVariables(context, includeChildrenRecursively) {
2769
+ this.include(context, includeChildrenRecursively);
2770
+ }
2770
2771
  includeCallArguments(context, args) {
2771
2772
  for (const arg of args) {
2772
2773
  arg.include(context, false);
2773
2774
  }
2774
2775
  }
2775
- includeWithAllDeclaredVariables(includeChildrenRecursively, context) {
2776
- this.include(context, includeChildrenRecursively);
2777
- }
2778
2776
  /**
2779
2777
  * Override to perform special initialisation steps after the scope is initialised
2780
2778
  */
@@ -2827,9 +2825,6 @@ class NodeBase {
2827
2825
  shouldBeIncluded(context) {
2828
2826
  return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
2829
2827
  }
2830
- toString() {
2831
- return this.context.code.slice(this.start, this.end);
2832
- }
2833
2828
  }
2834
2829
 
2835
2830
  class ClassNode extends NodeBase {
@@ -6484,7 +6479,6 @@ class MemberExpression extends NodeBase {
6484
6479
  this.replacement = null;
6485
6480
  this.wasPathDeoptimizedWhileOptimized = false;
6486
6481
  }
6487
- addExportedVariables() { }
6488
6482
  bind() {
6489
6483
  if (this.bound)
6490
6484
  return;
@@ -7259,7 +7253,7 @@ class ForInStatement extends NodeBase {
7259
7253
  }
7260
7254
  include(context, includeChildrenRecursively) {
7261
7255
  this.included = true;
7262
- this.left.includeWithAllDeclaredVariables(includeChildrenRecursively, context);
7256
+ this.left.includeAllDeclaredVariables(context, includeChildrenRecursively);
7263
7257
  this.left.deoptimizePath(EMPTY_PATH);
7264
7258
  this.right.include(context, includeChildrenRecursively);
7265
7259
  const { brokenFlow } = context;
@@ -7293,7 +7287,7 @@ class ForOfStatement extends NodeBase {
7293
7287
  }
7294
7288
  include(context, includeChildrenRecursively) {
7295
7289
  this.included = true;
7296
- this.left.includeWithAllDeclaredVariables(includeChildrenRecursively, context);
7290
+ this.left.includeAllDeclaredVariables(context, includeChildrenRecursively);
7297
7291
  this.left.deoptimizePath(EMPTY_PATH);
7298
7292
  this.right.include(context, includeChildrenRecursively);
7299
7293
  const { brokenFlow } = context;
@@ -8988,7 +8982,7 @@ function isReassignedExportsMember(variable, exportNamesByVariable) {
8988
8982
  }
8989
8983
  function areAllDeclarationsIncludedAndNotExported(declarations, exportNamesByVariable) {
8990
8984
  for (const declarator of declarations) {
8991
- if (!declarator.included)
8985
+ if (!declarator.id.included)
8992
8986
  return false;
8993
8987
  if (declarator.id.type === Identifier) {
8994
8988
  if (exportNamesByVariable.has(declarator.id.variable))
@@ -9019,10 +9013,11 @@ class VariableDeclaration extends NodeBase {
9019
9013
  declarator.include(context, includeChildrenRecursively);
9020
9014
  }
9021
9015
  }
9022
- includeWithAllDeclaredVariables(includeChildrenRecursively, context) {
9016
+ includeAllDeclaredVariables(context, includeChildrenRecursively) {
9023
9017
  this.included = true;
9024
9018
  for (const declarator of this.declarations) {
9025
- declarator.include(context, includeChildrenRecursively);
9019
+ declarator.id.included = true;
9020
+ declarator.includeAllDeclaredVariables(context, includeChildrenRecursively);
9026
9021
  }
9027
9022
  }
9028
9023
  initialise() {
@@ -9044,13 +9039,11 @@ class VariableDeclaration extends NodeBase {
9044
9039
  this.renderReplacedDeclarations(code, options, nodeRenderOptions);
9045
9040
  }
9046
9041
  }
9047
- renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, addSemicolon, systemPatternExports, options) {
9042
+ renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options) {
9048
9043
  if (code.original.charCodeAt(this.end - 1) === 59 /*";"*/) {
9049
9044
  code.remove(this.end - 1, this.end);
9050
9045
  }
9051
- if (addSemicolon) {
9052
- separatorString += ';';
9053
- }
9046
+ separatorString += ';';
9054
9047
  if (lastSeparatorPos !== null) {
9055
9048
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
9056
9049
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
@@ -9075,15 +9068,10 @@ class VariableDeclaration extends NodeBase {
9075
9068
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
9076
9069
  }
9077
9070
  }
9078
- renderReplacedDeclarations(code, options, { start = this.start, end = this.end, isNoStatement }) {
9071
+ renderReplacedDeclarations(code, options, { start = this.start, end = this.end }) {
9079
9072
  const separatedNodes = getCommaSeparatedNodesWithBoundaries(this.declarations, code, this.start + this.kind.length, this.end - (code.original.charCodeAt(this.end - 1) === 59 /*";"*/ ? 1 : 0));
9080
9073
  let actualContentEnd, renderedContentEnd;
9081
- if (/\n\s*$/.test(code.slice(this.start, separatedNodes[0].start))) {
9082
- renderedContentEnd = this.start + this.kind.length;
9083
- }
9084
- else {
9085
- renderedContentEnd = separatedNodes[0].start;
9086
- }
9074
+ renderedContentEnd = findNonWhiteSpace(code.original, this.start + this.kind.length);
9087
9075
  let lastSeparatorPos = renderedContentEnd - 1;
9088
9076
  code.remove(this.start, lastSeparatorPos);
9089
9077
  let isInDeclaration = false;
@@ -9100,8 +9088,9 @@ class VariableDeclaration extends NodeBase {
9100
9088
  }
9101
9089
  leadingString = '';
9102
9090
  nextSeparatorString = '';
9103
- if (node.id instanceof Identifier$1 &&
9104
- isReassignedExportsMember(node.id.variable, options.exportNamesByVariable)) {
9091
+ if (!node.id.included ||
9092
+ (node.id instanceof Identifier$1 &&
9093
+ isReassignedExportsMember(node.id.variable, options.exportNamesByVariable))) {
9105
9094
  if (hasRenderedContent) {
9106
9095
  separatorString += ';';
9107
9096
  }
@@ -9150,7 +9139,7 @@ class VariableDeclaration extends NodeBase {
9150
9139
  separatorString = nextSeparatorString;
9151
9140
  }
9152
9141
  if (hasRenderedContent) {
9153
- this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, !isNoStatement, systemPatternExports, options);
9142
+ this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options);
9154
9143
  }
9155
9144
  else {
9156
9145
  code.remove(start, end);
@@ -9165,6 +9154,35 @@ class VariableDeclarator extends NodeBase {
9165
9154
  deoptimizePath(path) {
9166
9155
  this.id.deoptimizePath(path);
9167
9156
  }
9157
+ hasEffects(context) {
9158
+ return this.id.hasEffects(context) || (this.init !== null && this.init.hasEffects(context));
9159
+ }
9160
+ include(context, includeChildrenRecursively) {
9161
+ this.included = true;
9162
+ if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
9163
+ this.id.include(context, includeChildrenRecursively);
9164
+ }
9165
+ if (this.init) {
9166
+ this.init.include(context, includeChildrenRecursively);
9167
+ }
9168
+ }
9169
+ includeAllDeclaredVariables(context, includeChildrenRecursively) {
9170
+ this.included = true;
9171
+ this.id.include(context, includeChildrenRecursively);
9172
+ }
9173
+ render(code, options) {
9174
+ const renderId = this.id.included;
9175
+ if (renderId) {
9176
+ this.id.render(code, options);
9177
+ }
9178
+ else {
9179
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', this.id.end);
9180
+ code.remove(this.start, findNonWhiteSpace(code.original, operatorPos + 1));
9181
+ }
9182
+ if (this.init) {
9183
+ this.init.render(code, options, renderId ? BLANK : { renderedParentType: ExpressionStatement });
9184
+ }
9185
+ }
9168
9186
  }
9169
9187
 
9170
9188
  class WhileStatement extends NodeBase {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.37.1
4
- Wed, 20 Jan 2021 11:53:42 GMT - commit e23bb354cca08dbe32e3f6a3ba5c63d015e91ff9
3
+ Rollup.js v2.38.0
4
+ Fri, 22 Jan 2021 16:26:00 GMT - commit 889fa5267ad93cc706fdbff2024e9c4d4f273749
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.37.1",
3
+ "version": "2.38.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",