rollup 2.38.3 → 2.38.4

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.38.3
4
- Mon, 01 Feb 2021 06:15:21 GMT - commit 683cf48a5278987f08ff3958074c49a80b1ae3eb
3
+ Rollup.js v2.38.4
4
+ Tue, 02 Feb 2021 05:54:38 GMT - commit 991bb98fad1f3f76226bfe6243fd6cc45a19a39b
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.38.3
4
- Mon, 01 Feb 2021 06:15:21 GMT - commit 683cf48a5278987f08ff3958074c49a80b1ae3eb
3
+ Rollup.js v2.38.4
4
+ Tue, 02 Feb 2021 05:54:38 GMT - commit 991bb98fad1f3f76226bfe6243fd6cc45a19a39b
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
13
13
  import { writeFile as writeFile$1, readdirSync, mkdirSync, readFile as readFile$1, lstatSync, realpathSync } from 'fs';
14
14
  import { EventEmitter } from 'events';
15
15
 
16
- var version = "2.38.3";
16
+ var version = "2.38.4";
17
17
 
18
18
  var charToInteger = {};
19
19
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -2674,7 +2674,7 @@ class NodeBase {
2674
2674
  }
2675
2675
  }
2676
2676
  }
2677
- includeAllDeclaredVariables(context, includeChildrenRecursively) {
2677
+ includeAsSingleStatement(context, includeChildrenRecursively) {
2678
2678
  this.include(context, includeChildrenRecursively);
2679
2679
  }
2680
2680
  includeCallArguments(context, args) {
@@ -7120,7 +7120,7 @@ class DoWhileStatement extends NodeBase {
7120
7120
  this.included = true;
7121
7121
  this.test.include(context, includeChildrenRecursively);
7122
7122
  const { brokenFlow } = context;
7123
- this.body.include(context, includeChildrenRecursively);
7123
+ this.body.includeAsSingleStatement(context, includeChildrenRecursively);
7124
7124
  context.brokenFlow = brokenFlow;
7125
7125
  }
7126
7126
  }
@@ -7194,11 +7194,11 @@ class ForInStatement extends NodeBase {
7194
7194
  }
7195
7195
  include(context, includeChildrenRecursively) {
7196
7196
  this.included = true;
7197
- this.left.includeAllDeclaredVariables(context, includeChildrenRecursively);
7197
+ this.left.include(context, includeChildrenRecursively || true);
7198
7198
  this.left.deoptimizePath(EMPTY_PATH);
7199
7199
  this.right.include(context, includeChildrenRecursively);
7200
7200
  const { brokenFlow } = context;
7201
- this.body.include(context, includeChildrenRecursively);
7201
+ this.body.includeAsSingleStatement(context, includeChildrenRecursively);
7202
7202
  context.brokenFlow = brokenFlow;
7203
7203
  }
7204
7204
  render(code, options) {
@@ -7228,11 +7228,11 @@ class ForOfStatement extends NodeBase {
7228
7228
  }
7229
7229
  include(context, includeChildrenRecursively) {
7230
7230
  this.included = true;
7231
- this.left.includeAllDeclaredVariables(context, includeChildrenRecursively);
7231
+ this.left.include(context, includeChildrenRecursively || true);
7232
7232
  this.left.deoptimizePath(EMPTY_PATH);
7233
7233
  this.right.include(context, includeChildrenRecursively);
7234
7234
  const { brokenFlow } = context;
7235
- this.body.include(context, includeChildrenRecursively);
7235
+ this.body.includeAsSingleStatement(context, includeChildrenRecursively);
7236
7236
  context.brokenFlow = brokenFlow;
7237
7237
  }
7238
7238
  render(code, options) {
@@ -7268,13 +7268,13 @@ class ForStatement extends NodeBase {
7268
7268
  include(context, includeChildrenRecursively) {
7269
7269
  this.included = true;
7270
7270
  if (this.init)
7271
- this.init.includeAllDeclaredVariables(context, includeChildrenRecursively);
7271
+ this.init.includeAsSingleStatement(context, includeChildrenRecursively);
7272
7272
  if (this.test)
7273
7273
  this.test.include(context, includeChildrenRecursively);
7274
7274
  const { brokenFlow } = context;
7275
7275
  if (this.update)
7276
7276
  this.update.include(context, includeChildrenRecursively);
7277
- this.body.include(context, includeChildrenRecursively);
7277
+ this.body.includeAsSingleStatement(context, includeChildrenRecursively);
7278
7278
  context.brokenFlow = brokenFlow;
7279
7279
  }
7280
7280
  render(code, options) {
@@ -7415,10 +7415,10 @@ class IfStatement extends NodeBase {
7415
7415
  this.test.include(context, false);
7416
7416
  }
7417
7417
  if (testValue && this.consequent.shouldBeIncluded(context)) {
7418
- this.consequent.include(context, false);
7418
+ this.consequent.includeAsSingleStatement(context, false);
7419
7419
  }
7420
7420
  if (this.alternate !== null && !testValue && this.alternate.shouldBeIncluded(context)) {
7421
- this.alternate.include(context, false);
7421
+ this.alternate.includeAsSingleStatement(context, false);
7422
7422
  }
7423
7423
  }
7424
7424
  includeRecursively(includeChildrenRecursively, context) {
@@ -7433,12 +7433,12 @@ class IfStatement extends NodeBase {
7433
7433
  const { brokenFlow } = context;
7434
7434
  let consequentBrokenFlow = BROKEN_FLOW_NONE;
7435
7435
  if (this.consequent.shouldBeIncluded(context)) {
7436
- this.consequent.include(context, false);
7436
+ this.consequent.includeAsSingleStatement(context, false);
7437
7437
  consequentBrokenFlow = context.brokenFlow;
7438
7438
  context.brokenFlow = brokenFlow;
7439
7439
  }
7440
7440
  if (this.alternate !== null && this.alternate.shouldBeIncluded(context)) {
7441
- this.alternate.include(context, false);
7441
+ this.alternate.includeAsSingleStatement(context, false);
7442
7442
  context.brokenFlow =
7443
7443
  context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
7444
7444
  }
@@ -8954,11 +8954,13 @@ class VariableDeclaration extends NodeBase {
8954
8954
  declarator.include(context, includeChildrenRecursively);
8955
8955
  }
8956
8956
  }
8957
- includeAllDeclaredVariables(context, includeChildrenRecursively) {
8957
+ includeAsSingleStatement(context, includeChildrenRecursively) {
8958
8958
  this.included = true;
8959
8959
  for (const declarator of this.declarations) {
8960
- declarator.id.included = true;
8961
- declarator.includeAllDeclaredVariables(context, includeChildrenRecursively);
8960
+ if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) {
8961
+ declarator.include(context, includeChildrenRecursively);
8962
+ declarator.id.include(context, includeChildrenRecursively);
8963
+ }
8962
8964
  }
8963
8965
  }
8964
8966
  initialise() {
@@ -8967,8 +8969,7 @@ class VariableDeclaration extends NodeBase {
8967
8969
  }
8968
8970
  }
8969
8971
  render(code, options, nodeRenderOptions = BLANK) {
8970
- if (nodeRenderOptions.isNoStatement ||
8971
- areAllDeclarationsIncludedAndNotExported(this.declarations, options.exportNamesByVariable)) {
8972
+ if (areAllDeclarationsIncludedAndNotExported(this.declarations, options.exportNamesByVariable)) {
8972
8973
  for (const declarator of this.declarations) {
8973
8974
  declarator.render(code, options);
8974
8975
  }
@@ -8981,11 +8982,13 @@ class VariableDeclaration extends NodeBase {
8981
8982
  this.renderReplacedDeclarations(code, options, nodeRenderOptions);
8982
8983
  }
8983
8984
  }
8984
- renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options) {
8985
+ renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement) {
8985
8986
  if (code.original.charCodeAt(this.end - 1) === 59 /*";"*/) {
8986
8987
  code.remove(this.end - 1, this.end);
8987
8988
  }
8988
- separatorString += ';';
8989
+ if (!isNoStatement) {
8990
+ separatorString += ';';
8991
+ }
8989
8992
  if (lastSeparatorPos !== null) {
8990
8993
  if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
8991
8994
  (code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
@@ -9010,7 +9013,7 @@ class VariableDeclaration extends NodeBase {
9010
9013
  code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
9011
9014
  }
9012
9015
  }
9013
- renderReplacedDeclarations(code, options, { start = this.start, end = this.end }) {
9016
+ renderReplacedDeclarations(code, options, { start = this.start, end = this.end, isNoStatement }) {
9014
9017
  const separatedNodes = getCommaSeparatedNodesWithBoundaries(this.declarations, code, this.start + this.kind.length, this.end - (code.original.charCodeAt(this.end - 1) === 59 /*";"*/ ? 1 : 0));
9015
9018
  let actualContentEnd, renderedContentEnd;
9016
9019
  renderedContentEnd = findNonWhiteSpace(code.original, this.start + this.kind.length);
@@ -9081,7 +9084,7 @@ class VariableDeclaration extends NodeBase {
9081
9084
  separatorString = nextSeparatorString;
9082
9085
  }
9083
9086
  if (hasRenderedContent) {
9084
- this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options);
9087
+ this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement);
9085
9088
  }
9086
9089
  else {
9087
9090
  code.remove(start, end);
@@ -9108,13 +9111,6 @@ class VariableDeclarator extends NodeBase {
9108
9111
  this.init.include(context, includeChildrenRecursively);
9109
9112
  }
9110
9113
  }
9111
- includeAllDeclaredVariables(context, includeChildrenRecursively) {
9112
- this.included = true;
9113
- this.id.include(context, includeChildrenRecursively);
9114
- if (this.init) {
9115
- this.init.include(context, includeChildrenRecursively);
9116
- }
9117
- }
9118
9114
  render(code, options) {
9119
9115
  const renderId = this.id.included;
9120
9116
  if (renderId) {
@@ -9148,7 +9144,7 @@ class WhileStatement extends NodeBase {
9148
9144
  this.included = true;
9149
9145
  this.test.include(context, includeChildrenRecursively);
9150
9146
  const { brokenFlow } = context;
9151
- this.body.include(context, includeChildrenRecursively);
9147
+ this.body.includeAsSingleStatement(context, includeChildrenRecursively);
9152
9148
  context.brokenFlow = brokenFlow;
9153
9149
  }
9154
9150
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.38.3
4
- Mon, 01 Feb 2021 06:15:21 GMT - commit 683cf48a5278987f08ff3958074c49a80b1ae3eb
3
+ Rollup.js v2.38.4
4
+ Tue, 02 Feb 2021 05:54:38 GMT - commit 991bb98fad1f3f76226bfe6243fd6cc45a19a39b
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.38.3
4
- Mon, 01 Feb 2021 06:15:21 GMT - commit 683cf48a5278987f08ff3958074c49a80b1ae3eb
3
+ Rollup.js v2.38.4
4
+ Tue, 02 Feb 2021 05:54:38 GMT - commit 991bb98fad1f3f76226bfe6243fd6cc45a19a39b
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup