rollup 2.7.2 → 2.7.6

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.7.2
4
- Wed, 22 Apr 2020 19:00:15 GMT - commit 97e6fa89d2ad14603094af77bad461a1aa81df3b
3
+ Rollup.js v2.7.6
4
+ Thu, 30 Apr 2020 18:55:10 GMT - commit 468010ba801b1e59573b6aa7319461a449aa43df
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.7.2
4
- Wed, 22 Apr 2020 19:00:15 GMT - commit 97e6fa89d2ad14603094af77bad461a1aa81df3b
3
+ Rollup.js v2.7.6
4
+ Thu, 30 Apr 2020 18:55:10 GMT - commit 468010ba801b1e59573b6aa7319461a449aa43df
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.7.2";
16
+ var version = "2.7.6";
17
17
 
18
18
  // Reserved word lists for various dialects of the language
19
19
 
@@ -5041,13 +5041,28 @@ function getCjsExportFromNamespace (n) {
5041
5041
  return n && n['default'] || n;
5042
5042
  }
5043
5043
 
5044
- var acorn$1 = getCjsExportFromNamespace(acorn);
5044
+ var require$$0 = getCjsExportFromNamespace(acorn);
5045
5045
 
5046
- if (acorn$1.version.indexOf("6.") != 0 && acorn$1.version.indexOf("6.0.") == 0 && acorn$1.version.indexOf("7.") != 0) {
5047
- throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn$1.version}`)
5048
- }
5049
- const tt = acorn$1.tokTypes;
5050
- const TokenType$1 = acorn$1.TokenType;
5046
+ const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
5047
+
5048
+ const getAcorn = Parser => {
5049
+ if (Parser.acorn) return Parser.acorn
5050
+
5051
+ const acorn = require$$0;
5052
+
5053
+ if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
5054
+ throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
5055
+ }
5056
+
5057
+ // Make sure `Parser` comes from the same acorn as we `require`d,
5058
+ // otherwise the comparisons fail.
5059
+ for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
5060
+ if (cur !== acorn.Parser) {
5061
+ throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
5062
+ }
5063
+ }
5064
+ return acorn
5065
+ };
5051
5066
 
5052
5067
  var acornPrivateClassElements = function(Parser) {
5053
5068
  // Only load this plugin once.
@@ -5055,15 +5070,7 @@ var acornPrivateClassElements = function(Parser) {
5055
5070
  return Parser
5056
5071
  }
5057
5072
 
5058
- // Make sure `Parser` comes from the same acorn as our `tt`,
5059
- // otherwise the comparisons fail.
5060
- let cur = Parser;
5061
- while (cur && cur !== acorn$1.Parser) {
5062
- cur = cur.__proto__;
5063
- }
5064
- if (cur !== acorn$1.Parser) {
5065
- throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
5066
- }
5073
+ const acorn = getAcorn(Parser);
5067
5074
 
5068
5075
  Parser = class extends Parser {
5069
5076
  _branch() {
@@ -5081,12 +5088,12 @@ var acornPrivateClassElements = function(Parser) {
5081
5088
  element.key = this.parsePrivateName();
5082
5089
  if (element.key.name == "constructor") this.raise(element.key.start, "Classes may not have a private element named constructor");
5083
5090
  const accept = {get: "set", set: "get"}[element.kind];
5084
- const privateBoundNames = this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1];
5091
+ const privateBoundNames = this._privateBoundNames;
5085
5092
  if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
5086
5093
  this.raise(element.start, "Duplicate private element");
5087
5094
  }
5088
5095
  privateBoundNames[element.key.name] = element.kind || true;
5089
- delete this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][element.key.name];
5096
+ delete this._unresolvedPrivateNames[element.key.name];
5090
5097
  return element.key
5091
5098
  }
5092
5099
 
@@ -5111,37 +5118,60 @@ var acornPrivateClassElements = function(Parser) {
5111
5118
 
5112
5119
  // Manage stacks and check for undeclared private names
5113
5120
  parseClass(node, isStatement) {
5114
- this._privateBoundNamesStack = this._privateBoundNamesStack || [];
5115
- const privateBoundNames = Object.create(this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] || null);
5116
- this._privateBoundNamesStack.push(privateBoundNames);
5117
- this._unresolvedPrivateNamesStack = this._unresolvedPrivateNamesStack || [];
5118
- const unresolvedPrivateNames = Object.create(null);
5119
- this._unresolvedPrivateNamesStack.push(unresolvedPrivateNames);
5121
+ const oldOuterPrivateBoundNames = this._outerPrivateBoundNames;
5122
+ this._outerPrivateBoundNames = this._privateBoundNames;
5123
+ this._privateBoundNames = Object.create(this._privateBoundNames || null);
5124
+ const oldOuterUnresolvedPrivateNames = this._outerUnresolvedPrivateNames;
5125
+ this._outerUnresolvedPrivateNames = this._unresolvedPrivateNames;
5126
+ this._unresolvedPrivateNames = Object.create(null);
5127
+
5120
5128
  const _return = super.parseClass(node, isStatement);
5121
- this._privateBoundNamesStack.pop();
5122
- this._unresolvedPrivateNamesStack.pop();
5123
- if (!this._unresolvedPrivateNamesStack.length) {
5129
+
5130
+ const unresolvedPrivateNames = this._unresolvedPrivateNames;
5131
+ this._privateBoundNames = this._outerPrivateBoundNames;
5132
+ this._outerPrivateBoundNames = oldOuterPrivateBoundNames;
5133
+ this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
5134
+ this._outerUnresolvedPrivateNames = oldOuterUnresolvedPrivateNames;
5135
+ if (!this._unresolvedPrivateNames) {
5124
5136
  const names = Object.keys(unresolvedPrivateNames);
5125
5137
  if (names.length) {
5126
5138
  names.sort((n1, n2) => unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]);
5127
5139
  this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name");
5128
5140
  }
5129
- } else Object.assign(this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1], unresolvedPrivateNames);
5141
+ } else Object.assign(this._unresolvedPrivateNames, unresolvedPrivateNames);
5142
+ return _return
5143
+ }
5144
+
5145
+ // Class heritage is evaluated with outer private environment
5146
+ parseClassSuper(node) {
5147
+ const privateBoundNames = this._privateBoundNames;
5148
+ this._privateBoundNames = this._outerPrivateBoundNames;
5149
+ const unresolvedPrivateNames = this._unresolvedPrivateNames;
5150
+ this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
5151
+ const _return = super.parseClassSuper(node);
5152
+ this._privateBoundNames = privateBoundNames;
5153
+ this._unresolvedPrivateNames = unresolvedPrivateNames;
5130
5154
  return _return
5131
5155
  }
5132
5156
 
5133
5157
  // Parse private element access
5134
5158
  parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
5135
- if (!this.eat(tt.dot)) {
5159
+ if (!this.eat(acorn.tokTypes.dot)) {
5136
5160
  return super.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow)
5137
5161
  }
5138
5162
  let node = this.startNodeAt(startPos, startLoc);
5139
5163
  node.object = base;
5140
5164
  node.computed = false;
5141
5165
  if (this.type == this.privateNameToken) {
5166
+ if (base.type == "Super") {
5167
+ this.raise(this.start, "Cannot access private element on super");
5168
+ }
5142
5169
  node.property = this.parsePrivateName();
5143
- if (!this._privateBoundNamesStack.length || !this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1][node.property.name]) {
5144
- this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][node.property.name] = node.property.start;
5170
+ if (!this._privateBoundNames || !this._privateBoundNames[node.property.name]) {
5171
+ if (!this._unresolvedPrivateNames) {
5172
+ this.raise(node.property.start, "Usage of undeclared private name");
5173
+ }
5174
+ this._unresolvedPrivateNames[node.property.name] = node.property.start;
5145
5175
  }
5146
5176
  } else {
5147
5177
  node.property = this.parseIdent(true);
@@ -5160,38 +5190,38 @@ var acornPrivateClassElements = function(Parser) {
5160
5190
  return _return
5161
5191
  }
5162
5192
  };
5163
- Parser.prototype.privateNameToken = new TokenType$1("privateName");
5193
+ Parser.prototype.privateNameToken = new acorn.TokenType("privateName");
5164
5194
  return Parser
5165
5195
  };
5166
5196
 
5167
- const tt$1 = acorn$1.tokTypes;
5168
-
5169
-
5170
- function maybeParseFieldValue(field) {
5171
- if (this.eat(tt$1.eq)) {
5172
- const oldInFieldValue = this._inFieldValue;
5173
- this._inFieldValue = true;
5174
- field.value = this.parseExpression();
5175
- this._inFieldValue = oldInFieldValue;
5176
- } else field.value = null;
5177
- }
5178
-
5179
5197
  var acornClassFields = function(Parser) {
5198
+ const acorn = Parser.acorn || require$$0;
5199
+ const tt = acorn.tokTypes;
5200
+
5180
5201
  Parser = acornPrivateClassElements(Parser);
5181
5202
  return class extends Parser {
5203
+ _maybeParseFieldValue(field) {
5204
+ if (this.eat(tt.eq)) {
5205
+ const oldInFieldValue = this._inFieldValue;
5206
+ this._inFieldValue = true;
5207
+ field.value = this.parseExpression();
5208
+ this._inFieldValue = oldInFieldValue;
5209
+ } else field.value = null;
5210
+ }
5211
+
5182
5212
  // Parse fields
5183
5213
  parseClassElement(_constructorAllowsSuper) {
5184
- if (this.options.ecmaVersion >= 8 && (this.type == tt$1.name || this.type == this.privateNameToken || this.type == tt$1.bracketL || this.type == tt$1.string)) {
5214
+ if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string)) {
5185
5215
  const branch = this._branch();
5186
- if (branch.type == tt$1.bracketL) {
5216
+ if (branch.type == tt.bracketL) {
5187
5217
  let count = 0;
5188
5218
  do {
5189
- if (branch.eat(tt$1.bracketL)) ++count;
5190
- else if (branch.eat(tt$1.bracketR)) --count;
5219
+ if (branch.eat(tt.bracketL)) ++count;
5220
+ else if (branch.eat(tt.bracketR)) --count;
5191
5221
  else branch.next();
5192
5222
  } while (count > 0)
5193
5223
  } else branch.next();
5194
- if (branch.type == tt$1.eq || branch.canInsertSemicolon() || branch.type == tt$1.semi) {
5224
+ if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) {
5195
5225
  const node = this.startNode();
5196
5226
  if (this.type == this.privateNameToken) {
5197
5227
  this.parsePrivateClassElementName(node);
@@ -5202,8 +5232,8 @@ var acornClassFields = function(Parser) {
5202
5232
  (node.key.type === "Literal" && node.key.value === "constructor")) {
5203
5233
  this.raise(node.key.start, "Classes may not have a field called constructor");
5204
5234
  }
5205
- this.enterScope(67);
5206
- maybeParseFieldValue.call(this, node);
5235
+ this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
5236
+ this._maybeParseFieldValue(node);
5207
5237
  this.exitScope();
5208
5238
  this.finishNode(node, "FieldDefinition");
5209
5239
  this.semicolon();
@@ -5225,7 +5255,7 @@ var acornClassFields = function(Parser) {
5225
5255
 
5226
5256
  const skipWhiteSpace$1 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
5227
5257
 
5228
- const tt$2 = acorn$1.tokTypes;
5258
+ const tt = require$$0.tokTypes;
5229
5259
 
5230
5260
  var acornExportNsFrom = function(Parser) {
5231
5261
  return class extends Parser {
@@ -5237,7 +5267,7 @@ var acornExportNsFrom = function(Parser) {
5237
5267
 
5238
5268
  this.next();
5239
5269
  const specifier = this.startNode();
5240
- this.expect(tt$2.star);
5270
+ this.expect(tt.star);
5241
5271
  if (this.eatContextual("as")) {
5242
5272
  node.declaration = null;
5243
5273
  specifier.exported = this.parseIdent(true);
@@ -5245,7 +5275,7 @@ var acornExportNsFrom = function(Parser) {
5245
5275
  node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
5246
5276
  }
5247
5277
  this.expectContextual("from");
5248
- if (this.type !== tt$2.string) this.unexpected();
5278
+ if (this.type !== tt.string) this.unexpected();
5249
5279
  node.source = this.parseExprAtom();
5250
5280
  this.semicolon();
5251
5281
  return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration")
@@ -5253,7 +5283,7 @@ var acornExportNsFrom = function(Parser) {
5253
5283
  }
5254
5284
  };
5255
5285
 
5256
- const tt$3 = acorn$1.tokTypes;
5286
+ const tt$1 = require$$0.tokTypes;
5257
5287
 
5258
5288
  const skipWhiteSpace$2 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
5259
5289
 
@@ -5267,7 +5297,7 @@ const nextTokenIsDot = parser => {
5267
5297
  var acornImportMeta = function(Parser) {
5268
5298
  return class extends Parser {
5269
5299
  parseExprAtom(refDestructuringErrors) {
5270
- if (this.type !== tt$3._import || !nextTokenIsDot(this)) return super.parseExprAtom(refDestructuringErrors)
5300
+ if (this.type !== tt$1._import || !nextTokenIsDot(this)) return super.parseExprAtom(refDestructuringErrors)
5271
5301
 
5272
5302
  if (!this.options.allowImportExportEverywhere && !this.inModule) {
5273
5303
  this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
@@ -5276,7 +5306,7 @@ var acornImportMeta = function(Parser) {
5276
5306
  let node = this.startNode();
5277
5307
  if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword import");
5278
5308
  node.meta = this.parseIdent(true);
5279
- this.expect(tt$3.dot);
5309
+ this.expect(tt$1.dot);
5280
5310
  node.property = this.parseIdent(true);
5281
5311
  if (node.property.name !== "meta") {
5282
5312
  this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta");
@@ -5288,7 +5318,7 @@ var acornImportMeta = function(Parser) {
5288
5318
  }
5289
5319
 
5290
5320
  parseStatement(context, topLevel, exports) {
5291
- if (this.type !== tt$3._import || !nextTokenIsDot(this)) {
5321
+ if (this.type !== tt$1._import || !nextTokenIsDot(this)) {
5292
5322
  return super.parseStatement(context, topLevel, exports)
5293
5323
  }
5294
5324
 
@@ -5299,23 +5329,22 @@ var acornImportMeta = function(Parser) {
5299
5329
  }
5300
5330
  };
5301
5331
 
5302
- const tt$4 = acorn$1.tokTypes;
5303
-
5304
- function maybeParseFieldValue$1(field) {
5305
- if (this.eat(tt$4.eq)) {
5306
- const oldInFieldValue = this._inStaticFieldValue;
5307
- this._inStaticFieldValue = true;
5308
- field.value = this.parseExpression();
5309
- this._inStaticFieldValue = oldInFieldValue;
5310
- } else field.value = null;
5311
- }
5312
-
5313
-
5314
-
5315
5332
  var acornStaticClassFeatures = function(Parser) {
5316
5333
  const ExtendedParser = acornPrivateClassElements(Parser);
5317
5334
 
5335
+ const acorn = Parser.acorn || require$$0;
5336
+ const tt = acorn.tokTypes;
5337
+
5318
5338
  return class extends ExtendedParser {
5339
+ _maybeParseFieldValue(field) {
5340
+ if (this.eat(tt.eq)) {
5341
+ const oldInFieldValue = this._inStaticFieldValue;
5342
+ this._inStaticFieldValue = true;
5343
+ field.value = this.parseExpression();
5344
+ this._inStaticFieldValue = oldInFieldValue;
5345
+ } else field.value = null;
5346
+ }
5347
+
5319
5348
  // Parse fields
5320
5349
  parseClassElement(_constructorAllowsSuper) {
5321
5350
  if (this.options.ecmaVersion < 8 || !this.isContextual("static")) {
@@ -5324,18 +5353,18 @@ var acornStaticClassFeatures = function(Parser) {
5324
5353
 
5325
5354
  const branch = this._branch();
5326
5355
  branch.next();
5327
- if ([tt$4.name, tt$4.bracketL, tt$4.string, this.privateNameToken].indexOf(branch.type) == -1) {
5356
+ if ([tt.name, tt.bracketL, tt.string, this.privateNameToken].indexOf(branch.type) == -1) {
5328
5357
  return super.parseClassElement.apply(this, arguments)
5329
5358
  }
5330
- if (branch.type == tt$4.bracketL) {
5359
+ if (branch.type == tt.bracketL) {
5331
5360
  let count = 0;
5332
5361
  do {
5333
- if (branch.eat(tt$4.bracketL)) ++count;
5334
- else if (branch.eat(tt$4.bracketR)) --count;
5362
+ if (branch.eat(tt.bracketL)) ++count;
5363
+ else if (branch.eat(tt.bracketR)) --count;
5335
5364
  else branch.next();
5336
5365
  } while (count > 0)
5337
5366
  } else branch.next();
5338
- if (branch.type != tt$4.eq && !branch.canInsertSemicolon() && branch.type != tt$4.semi) {
5367
+ if (branch.type != tt.eq && !branch.canInsertSemicolon() && branch.type != tt.semi) {
5339
5368
  return super.parseClassElement.apply(this, arguments)
5340
5369
  }
5341
5370
 
@@ -5354,7 +5383,7 @@ var acornStaticClassFeatures = function(Parser) {
5354
5383
  this.raise(node.key.start, "Classes may not have a static property named prototype");
5355
5384
  }
5356
5385
 
5357
- maybeParseFieldValue$1.call(this, node);
5386
+ this._maybeParseFieldValue(node);
5358
5387
  this.finishNode(node, "FieldDefinition");
5359
5388
  this.semicolon();
5360
5389
  return node
@@ -9594,15 +9623,15 @@ class FunctionDeclaration extends FunctionNode {
9594
9623
 
9595
9624
  const WHITESPACE = /\s/;
9596
9625
  // The header ends at the first non-white-space after "default"
9597
- function getDeclarationStart(code, start = 0) {
9626
+ function getDeclarationStart(code, start) {
9598
9627
  start = findFirstOccurrenceOutsideComment(code, 'default', start) + 7;
9599
9628
  while (WHITESPACE.test(code[start]))
9600
9629
  start++;
9601
9630
  return start;
9602
9631
  }
9603
- function getIdInsertPosition(code, declarationKeyword, start = 0) {
9632
+ function getIdInsertPosition(code, declarationKeyword, endMarker, start) {
9604
9633
  const declarationEnd = findFirstOccurrenceOutsideComment(code, declarationKeyword, start) + declarationKeyword.length;
9605
- code = code.slice(declarationEnd, findFirstOccurrenceOutsideComment(code, '{', declarationEnd));
9634
+ code = code.slice(declarationEnd, findFirstOccurrenceOutsideComment(code, endMarker, declarationEnd));
9606
9635
  const generatorStarPos = findFirstOccurrenceOutsideComment(code, '*');
9607
9636
  if (generatorStarPos === -1) {
9608
9637
  return declarationEnd;
@@ -9627,19 +9656,14 @@ class ExportDefaultDeclaration extends NodeBase {
9627
9656
  const { start, end } = nodeRenderOptions;
9628
9657
  const declarationStart = getDeclarationStart(code.original, this.start);
9629
9658
  if (this.declaration instanceof FunctionDeclaration) {
9630
- this.renderNamedDeclaration(code, declarationStart, 'function', this.declaration.id === null, options);
9659
+ this.renderNamedDeclaration(code, declarationStart, 'function', '(', this.declaration.id === null, options);
9631
9660
  }
9632
9661
  else if (this.declaration instanceof ClassDeclaration) {
9633
- this.renderNamedDeclaration(code, declarationStart, 'class', this.declaration.id === null, options);
9662
+ this.renderNamedDeclaration(code, declarationStart, 'class', '{', this.declaration.id === null, options);
9634
9663
  }
9635
9664
  else if (this.variable.getOriginalVariable() !== this.variable) {
9636
9665
  // Remove altogether to prevent re-declaring the same variable
9637
- if (options.format === 'system' && this.variable.exportName) {
9638
- code.overwrite(start, end, `exports('${this.variable.exportName}', ${this.variable.getName()});`);
9639
- }
9640
- else {
9641
- treeshakeNode(this, code, start, end);
9642
- }
9666
+ treeshakeNode(this, code, start, end);
9643
9667
  return;
9644
9668
  }
9645
9669
  else if (this.variable.included) {
@@ -9658,12 +9682,12 @@ class ExportDefaultDeclaration extends NodeBase {
9658
9682
  }
9659
9683
  this.declaration.render(code, options);
9660
9684
  }
9661
- renderNamedDeclaration(code, declarationStart, declarationKeyword, needsId, options) {
9685
+ renderNamedDeclaration(code, declarationStart, declarationKeyword, endMarker, needsId, options) {
9662
9686
  const name = this.variable.getName();
9663
9687
  // Remove `export default`
9664
9688
  code.remove(this.start, declarationStart);
9665
9689
  if (needsId) {
9666
- code.appendLeft(getIdInsertPosition(code.original, declarationKeyword, declarationStart), ` ${name}`);
9690
+ code.appendLeft(getIdInsertPosition(code.original, declarationKeyword, endMarker, declarationStart), ` ${name}`);
9667
9691
  }
9668
9692
  if (options.format === 'system' &&
9669
9693
  this.declaration instanceof ClassDeclaration &&
@@ -9745,24 +9769,6 @@ class ExportDefaultVariable extends LocalVariable {
9745
9769
  }
9746
9770
  return this.originalVariable;
9747
9771
  }
9748
- setRenderNames(baseName, name) {
9749
- const original = this.getOriginalVariable();
9750
- if (original === this) {
9751
- super.setRenderNames(baseName, name);
9752
- }
9753
- else {
9754
- original.setRenderNames(baseName, name);
9755
- }
9756
- }
9757
- setSafeName(name) {
9758
- const original = this.getOriginalVariable();
9759
- if (original === this) {
9760
- super.setSafeName(name);
9761
- }
9762
- else {
9763
- original.setSafeName(name);
9764
- }
9765
- }
9766
9772
  }
9767
9773
 
9768
9774
  const MISSING_EXPORT_SHIM_VARIABLE = '_missingExportShim';
@@ -9882,14 +9888,16 @@ class SyntheticNamedExportVariable extends Variable {
9882
9888
  this.module = context.module;
9883
9889
  this.defaultVariable = defaultVariable;
9884
9890
  }
9891
+ getBaseVariable() {
9892
+ return this.defaultVariable instanceof SyntheticNamedExportVariable
9893
+ ? this.defaultVariable.getBaseVariable()
9894
+ : this.defaultVariable;
9895
+ }
9885
9896
  getName() {
9886
9897
  const name = this.name;
9887
9898
  const renderBaseName = this.defaultVariable.getName();
9888
9899
  return `${renderBaseName}${getPropertyAccess(name)}`;
9889
9900
  }
9890
- getOriginalVariable() {
9891
- return this.defaultVariable.getOriginalVariable();
9892
- }
9893
9901
  include() {
9894
9902
  if (!this.included) {
9895
9903
  this.included = true;
@@ -14817,17 +14825,29 @@ class Module {
14817
14825
  if (this.relevantDependencies)
14818
14826
  return this.relevantDependencies;
14819
14827
  const relevantDependencies = new Set();
14820
- for (const variable of this.imports) {
14821
- relevantDependencies.add(variable instanceof SyntheticNamedExportVariable
14822
- ? variable.getOriginalVariable().module
14823
- : variable.module);
14828
+ for (let variable of this.imports) {
14829
+ if (variable instanceof SyntheticNamedExportVariable) {
14830
+ variable = variable.getBaseVariable();
14831
+ }
14832
+ else if (variable instanceof ExportDefaultVariable) {
14833
+ variable = variable.getOriginalVariable();
14834
+ }
14835
+ if (variable.module) {
14836
+ relevantDependencies.add(variable.module);
14837
+ }
14824
14838
  }
14825
14839
  if (this.isEntryPoint || this.dynamicallyImportedBy.length > 0 || this.graph.preserveModules) {
14826
14840
  for (const exportName of [...this.getReexports(), ...this.getExports()]) {
14827
- const variable = this.getVariableForExportName(exportName);
14828
- relevantDependencies.add(variable instanceof SyntheticNamedExportVariable
14829
- ? variable.getOriginalVariable().module
14830
- : variable.module);
14841
+ let variable = this.getVariableForExportName(exportName);
14842
+ if (variable instanceof SyntheticNamedExportVariable) {
14843
+ variable = variable.getBaseVariable();
14844
+ }
14845
+ else if (variable instanceof ExportDefaultVariable) {
14846
+ variable = variable.getOriginalVariable();
14847
+ }
14848
+ if (variable.module) {
14849
+ relevantDependencies.add(variable.module);
14850
+ }
14831
14851
  }
14832
14852
  }
14833
14853
  if (this.graph.treeshakingOptions) {
@@ -14873,7 +14893,10 @@ class Module {
14873
14893
  }
14874
14894
  const exportNamesByVariable = new Map();
14875
14895
  for (const exportName of this.getAllExportNames()) {
14876
- const tracedVariable = this.getVariableForExportName(exportName);
14896
+ let tracedVariable = this.getVariableForExportName(exportName);
14897
+ if (tracedVariable instanceof ExportDefaultVariable) {
14898
+ tracedVariable = tracedVariable.getOriginalVariable();
14899
+ }
14877
14900
  if (!tracedVariable ||
14878
14901
  !(tracedVariable.included || tracedVariable instanceof ExternalVariable)) {
14879
14902
  continue;
@@ -16284,12 +16307,11 @@ class Chunk$1 {
16284
16307
  for (const dep of this.dependencies) {
16285
16308
  const imports = [];
16286
16309
  for (const variable of this.imports) {
16287
- const renderedVariable = variable instanceof ExportDefaultVariable ? variable.getOriginalVariable() : variable;
16288
16310
  if ((variable.module instanceof Module
16289
16311
  ? variable.module.chunk === dep
16290
16312
  : variable.module === dep) &&
16291
- !renderedImports.has(renderedVariable)) {
16292
- renderedImports.add(renderedVariable);
16313
+ !renderedImports.has(variable)) {
16314
+ renderedImports.add(variable);
16293
16315
  imports.push({
16294
16316
  imported: variable.module instanceof ExternalModule
16295
16317
  ? variable.name
@@ -16493,10 +16515,13 @@ class Chunk$1 {
16493
16515
  }
16494
16516
  setUpChunkImportsAndExportsForModule(module) {
16495
16517
  for (let variable of module.imports) {
16496
- if (variable.module.chunk !== this) {
16497
- if (variable instanceof SyntheticNamedExportVariable) {
16498
- variable = variable.getOriginalVariable();
16499
- }
16518
+ if (variable instanceof SyntheticNamedExportVariable) {
16519
+ variable = variable.getBaseVariable();
16520
+ }
16521
+ else if (variable instanceof ExportDefaultVariable) {
16522
+ variable = variable.getOriginalVariable();
16523
+ }
16524
+ if (variable.module && variable.module.chunk !== this) {
16500
16525
  this.imports.add(variable);
16501
16526
  if (!(variable instanceof NamespaceVariable && this.graph.preserveModules) &&
16502
16527
  variable.module instanceof Module) {
@@ -16511,7 +16536,7 @@ class Chunk$1 {
16511
16536
  this.exports.add(exportedVariable);
16512
16537
  const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable;
16513
16538
  const importedVariable = isSynthetic
16514
- ? exportedVariable.getOriginalVariable()
16539
+ ? exportedVariable.getBaseVariable()
16515
16540
  : exportedVariable;
16516
16541
  const exportingModule = importedVariable.module;
16517
16542
  if (exportingModule &&