rollup 2.54.0 → 2.56.1

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.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -3508,7 +3508,7 @@ var picomatch_1 = picomatch$3;
3508
3508
 
3509
3509
  var picomatch$2 = picomatch_1;
3510
3510
 
3511
- var chokidar = {};
3511
+ var chokidar$1 = {};
3512
3512
 
3513
3513
  const fs$3 = fs$4;
3514
3514
  const { Readable } = require$$1;
@@ -6505,7 +6505,7 @@ _readdirp(root, opts) {
6505
6505
  }
6506
6506
 
6507
6507
  // Export FSWatcher class
6508
- chokidar.FSWatcher = FSWatcher;
6508
+ chokidar$1.FSWatcher = FSWatcher;
6509
6509
 
6510
6510
  /**
6511
6511
  * Instantiates watcher with paths to be tracked.
@@ -6519,7 +6519,9 @@ const watch = (paths, options) => {
6519
6519
  return watcher;
6520
6520
  };
6521
6521
 
6522
- chokidar.watch = watch;
6522
+ chokidar$1.watch = watch;
6523
+
6524
+ var chokidar = chokidar$1;
6523
6525
 
6524
6526
  exports.braces_1 = braces_1;
6525
6527
  exports.chokidar = chokidar;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -272,7 +272,11 @@ const deferredHandlers = {
272
272
  UNUSED_EXTERNAL_IMPORT(warnings) {
273
273
  title('Unused external imports');
274
274
  for (const warning of warnings) {
275
- stderr(`${warning.names} imported from external module '${warning.source}' but never used`);
275
+ stderr(warning.names +
276
+ ' imported from external module "' +
277
+ warning.source +
278
+ '" but never used in ' +
279
+ rollup.printQuotedStringList(warning.sources.map(id => rollup.relativeId(id))));
276
280
  }
277
281
  }
278
282
  };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
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$1 = "2.54.0";
22
+ var version$1 = "2.56.1";
23
23
 
24
24
  function ensureArray(items) {
25
25
  if (Array.isArray(items)) {
@@ -1982,6 +1982,8 @@ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
1982
1982
  return this;
1983
1983
  };
1984
1984
 
1985
+ var MagicString$1 = MagicString;
1986
+
1985
1987
  function relative(from, to) {
1986
1988
  const fromParts = from.split(/[/\\]/).filter(Boolean);
1987
1989
  const toParts = to.split(/[/\\]/).filter(Boolean);
@@ -3164,35 +3166,54 @@ function removeLineBreaks(code, start, end) {
3164
3166
  }
3165
3167
  }
3166
3168
 
3167
- function getSystemExportStatement(exportedVariables, options) {
3168
- const _ = options.compact ? '' : ' ';
3169
+ function getSystemExportStatement(exportedVariables, { compact, exportNamesByVariable }, modifier = '') {
3170
+ const _ = compact ? '' : ' ';
3169
3171
  if (exportedVariables.length === 1 &&
3170
- options.exportNamesByVariable.get(exportedVariables[0]).length === 1) {
3172
+ exportNamesByVariable.get(exportedVariables[0]).length === 1) {
3171
3173
  const variable = exportedVariables[0];
3172
- return `exports('${options.exportNamesByVariable.get(variable)}',${_}${variable.getName()})`;
3174
+ return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName()}${modifier})`;
3173
3175
  }
3174
3176
  else {
3175
3177
  return `exports({${_}${exportedVariables
3176
3178
  .map(variable => {
3177
- return options.exportNamesByVariable
3179
+ return exportNamesByVariable
3178
3180
  .get(variable)
3179
- .map(exportName => `${exportName}:${_}${variable.getName()}`)
3181
+ .map(exportName => `${exportName}:${_}${variable.getName()}${modifier}`)
3180
3182
  .join(`,${_}`);
3181
3183
  })
3182
3184
  .join(`,${_}`)}${_}})`;
3183
3185
  }
3184
3186
  }
3185
- function getSystemExportFunctionLeft(exportedVariables, setFromExpression, options) {
3187
+ function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { compact, exportNamesByVariable }) {
3188
+ const _ = compact ? '' : ' ';
3189
+ code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
3190
+ code.appendLeft(expressionEnd, ')');
3191
+ }
3192
+ function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
3186
3193
  const _ = options.compact ? '' : ' ';
3187
3194
  const s = options.compact ? '' : ';';
3188
- return `function${_}(v)${_}{${_}return exports({${_}${exportedVariables
3189
- .map(variable => {
3190
- return options.exportNamesByVariable
3191
- .get(variable)
3192
- .map(exportName => `${exportName}:${_}${setFromExpression ? variable.getName() : 'v'}`)
3193
- .join(`,${_}`);
3194
- })
3195
- .join(`,${_}`)}${_}}),${_}v${s}${_}}(`;
3195
+ code.prependRight(expressionStart, `function${_}(v)${_}{${_}return ${getSystemExportStatement(exportedVariables, options)},${_}v${s}${_}}(`);
3196
+ code.appendLeft(expressionEnd, ')');
3197
+ if (needsParens) {
3198
+ code.prependRight(expressionStart, '(');
3199
+ code.appendLeft(expressionEnd, ')');
3200
+ }
3201
+ }
3202
+ function renderSystemExportSequenceAfterExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options) {
3203
+ const _ = options.compact ? '' : ' ';
3204
+ code.appendLeft(expressionEnd, `,${_}${getSystemExportStatement([exportedVariable], options)},${_}${exportedVariable.getName()}`);
3205
+ if (needsParens) {
3206
+ code.prependRight(expressionStart, '(');
3207
+ code.appendLeft(expressionEnd, ')');
3208
+ }
3209
+ }
3210
+ function renderSystemExportSequenceBeforeExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options, modifier) {
3211
+ const _ = options.compact ? '' : ' ';
3212
+ code.prependRight(expressionStart, `${getSystemExportStatement([exportedVariable], options, modifier)},${_}`);
3213
+ if (needsParens) {
3214
+ code.prependRight(expressionStart, '(');
3215
+ code.appendLeft(expressionEnd, ')');
3216
+ }
3196
3217
  }
3197
3218
 
3198
3219
  const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
@@ -4654,6 +4675,32 @@ class Identifier extends NodeBase {
4654
4675
  includeCallArguments(context, args) {
4655
4676
  this.getVariableRespectingTDZ().includeCallArguments(context, args);
4656
4677
  }
4678
+ isPossibleTDZ() {
4679
+ // return cached value to avoid issues with the next tree-shaking pass
4680
+ if (this.isTDZAccess !== null)
4681
+ return this.isTDZAccess;
4682
+ if (!(this.variable instanceof LocalVariable) ||
4683
+ !this.variable.kind ||
4684
+ !(this.variable.kind in tdzVariableKinds)) {
4685
+ return (this.isTDZAccess = false);
4686
+ }
4687
+ let decl_id;
4688
+ if (this.variable.declarations &&
4689
+ this.variable.declarations.length === 1 &&
4690
+ (decl_id = this.variable.declarations[0]) &&
4691
+ this.start < decl_id.start &&
4692
+ closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
4693
+ // a variable accessed before its declaration
4694
+ // in the same function or at top level of module
4695
+ return (this.isTDZAccess = true);
4696
+ }
4697
+ if (!this.variable.initReached) {
4698
+ // Either a const/let TDZ violation or
4699
+ // var use before declaration was encountered.
4700
+ return (this.isTDZAccess = true);
4701
+ }
4702
+ return (this.isTDZAccess = false);
4703
+ }
4657
4704
  markDeclarationReached() {
4658
4705
  this.variable.initReached = true;
4659
4706
  }
@@ -4696,32 +4743,6 @@ class Identifier extends NodeBase {
4696
4743
  }
4697
4744
  return this.variable;
4698
4745
  }
4699
- isPossibleTDZ() {
4700
- // return cached value to avoid issues with the next tree-shaking pass
4701
- if (this.isTDZAccess !== null)
4702
- return this.isTDZAccess;
4703
- if (!(this.variable instanceof LocalVariable) ||
4704
- !this.variable.kind ||
4705
- !(this.variable.kind in tdzVariableKinds)) {
4706
- return (this.isTDZAccess = false);
4707
- }
4708
- let decl_id;
4709
- if (this.variable.declarations &&
4710
- this.variable.declarations.length === 1 &&
4711
- (decl_id = this.variable.declarations[0]) &&
4712
- this.start < decl_id.start &&
4713
- closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
4714
- // a variable accessed before its declaration
4715
- // in the same function or at top level of module
4716
- return (this.isTDZAccess = true);
4717
- }
4718
- if (!this.variable.initReached) {
4719
- // Either a const/let TDZ violation or
4720
- // var use before declaration was encountered.
4721
- return (this.isTDZAccess = true);
4722
- }
4723
- return (this.isTDZAccess = false);
4724
- }
4725
4746
  }
4726
4747
  function closestParentFunctionOrProgram(node) {
4727
4748
  while (node && !/^Program|Function/.test(node.type)) {
@@ -6128,12 +6149,14 @@ class VariableDeclaration extends NodeBase {
6128
6149
  let isInDeclaration = false;
6129
6150
  let hasRenderedContent = false;
6130
6151
  let separatorString = '', leadingString, nextSeparatorString;
6131
- const systemPatternExports = [];
6152
+ const aggregatedSystemExports = [];
6153
+ const singleSystemExport = gatherSystemExportsAndGetSingleExport(separatedNodes, options, aggregatedSystemExports);
6132
6154
  for (const { node, start, separator, contentEnd, end } of separatedNodes) {
6133
6155
  if (!node.included) {
6134
6156
  code.remove(start, end);
6135
6157
  continue;
6136
6158
  }
6159
+ node.render(code, options);
6137
6160
  leadingString = '';
6138
6161
  nextSeparatorString = '';
6139
6162
  if (!node.id.included ||
@@ -6145,21 +6168,9 @@ class VariableDeclaration extends NodeBase {
6145
6168
  isInDeclaration = false;
6146
6169
  }
6147
6170
  else {
6148
- if (options.format === 'system' && node.init !== null) {
6149
- if (node.id.type !== Identifier$1) {
6150
- node.id.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
6151
- }
6152
- else {
6153
- const exportNames = options.exportNamesByVariable.get(node.id.variable);
6154
- if (exportNames) {
6155
- const _ = options.compact ? '' : ' ';
6156
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', node.id.end);
6157
- code.prependLeft(findNonWhiteSpace(code.original, operatorPos + 1), exportNames.length === 1
6158
- ? `exports('${exportNames[0]}',${_}`
6159
- : getSystemExportFunctionLeft([node.id.variable], false, options));
6160
- nextSeparatorString += ')';
6161
- }
6162
- }
6171
+ if (singleSystemExport && singleSystemExport === node.id.variable) {
6172
+ const operatorPos = findFirstOccurrenceOutsideComment(code.original, '=', node.id.end);
6173
+ renderSystemExportExpression(singleSystemExport, findNonWhiteSpace(code.original, operatorPos + 1), separator === null ? contentEnd : separator, code, options);
6163
6174
  }
6164
6175
  if (isInDeclaration) {
6165
6176
  separatorString += ',';
@@ -6179,15 +6190,39 @@ class VariableDeclaration extends NodeBase {
6179
6190
  code.overwrite(lastSeparatorPos, lastSeparatorPos + 1, separatorString);
6180
6191
  code.appendLeft(renderedContentEnd, leadingString);
6181
6192
  }
6182
- node.render(code, options);
6183
6193
  actualContentEnd = contentEnd;
6184
6194
  renderedContentEnd = end;
6185
6195
  hasRenderedContent = true;
6186
6196
  lastSeparatorPos = separator;
6187
6197
  separatorString = nextSeparatorString;
6188
6198
  }
6189
- this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options, isNoStatement);
6199
+ this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, aggregatedSystemExports, options, isNoStatement);
6200
+ }
6201
+ }
6202
+ function gatherSystemExportsAndGetSingleExport(separatedNodes, options, aggregatedSystemExports) {
6203
+ var _a;
6204
+ let singleSystemExport = null;
6205
+ if (options.format === 'system') {
6206
+ for (const { node } of separatedNodes) {
6207
+ if (node.id instanceof Identifier &&
6208
+ node.init &&
6209
+ aggregatedSystemExports.length === 0 &&
6210
+ ((_a = options.exportNamesByVariable.get(node.id.variable)) === null || _a === void 0 ? void 0 : _a.length) === 1) {
6211
+ singleSystemExport = node.id.variable;
6212
+ aggregatedSystemExports.push(singleSystemExport);
6213
+ }
6214
+ else {
6215
+ node.id.addExportedVariables(aggregatedSystemExports, options.exportNamesByVariable);
6216
+ }
6217
+ }
6218
+ if (aggregatedSystemExports.length > 1) {
6219
+ singleSystemExport = null;
6220
+ }
6221
+ else if (singleSystemExport) {
6222
+ aggregatedSystemExports.length = 0;
6223
+ }
6190
6224
  }
6225
+ return singleSystemExport;
6191
6226
  }
6192
6227
 
6193
6228
  const NEW_ARRAY_PROPERTIES = [
@@ -6641,7 +6676,7 @@ class AssignmentExpression extends NodeBase {
6641
6676
  }
6642
6677
  this.right.include(context, includeChildrenRecursively);
6643
6678
  }
6644
- render(code, options, { preventASI, renderedParentType } = BLANK) {
6679
+ render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
6645
6680
  if (this.left.included) {
6646
6681
  this.left.render(code, options);
6647
6682
  this.right.render(code, options);
@@ -6653,26 +6688,27 @@ class AssignmentExpression extends NodeBase {
6653
6688
  removeLineBreaks(code, inclusionStart, this.right.start);
6654
6689
  }
6655
6690
  this.right.render(code, options, {
6656
- renderedParentType: renderedParentType || this.parent.type
6691
+ renderedParentType: renderedParentType || renderedSurroundingElement || this.parent.type
6657
6692
  });
6658
6693
  }
6659
6694
  if (options.format === 'system') {
6660
- const exportNames = this.left.variable && options.exportNamesByVariable.get(this.left.variable);
6661
- if (this.left.type === 'Identifier' && exportNames) {
6662
- const _ = options.compact ? '' : ' ';
6663
- const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
6664
- const operation = this.operator.length > 1 ? `${exportNames[0]}${_}${this.operator.slice(0, -1)}${_}` : '';
6665
- code.overwrite(operatorPos, findNonWhiteSpace(code.original, operatorPos + this.operator.length), `=${_}${exportNames.length === 1
6666
- ? `exports('${exportNames[0]}',${_}`
6667
- : getSystemExportFunctionLeft([this.left.variable], false, options)}${operation}`);
6668
- code.appendLeft(this.right.end, ')');
6695
+ if (this.left instanceof Identifier) {
6696
+ const variable = this.left.variable;
6697
+ const exportNames = options.exportNamesByVariable.get(variable);
6698
+ if (exportNames) {
6699
+ if (exportNames.length === 1) {
6700
+ renderSystemExportExpression(variable, this.start, this.end, code, options);
6701
+ }
6702
+ else {
6703
+ renderSystemExportSequenceAfterExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options);
6704
+ }
6705
+ }
6669
6706
  }
6670
6707
  else {
6671
6708
  const systemPatternExports = [];
6672
6709
  this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
6673
6710
  if (systemPatternExports.length > 0) {
6674
- code.prependRight(this.start, `(${getSystemExportFunctionLeft(systemPatternExports, true, options)}`);
6675
- code.appendLeft(this.end, '))');
6711
+ renderSystemExportFunction(systemPatternExports, this.start, this.end, (renderedParentType || renderedSurroundingElement) === ExpressionStatement$1, code, options);
6676
6712
  }
6677
6713
  }
6678
6714
  }
@@ -8125,12 +8161,12 @@ class ImportExpression extends NodeBase {
8125
8161
  if (this.inlineNamespace) {
8126
8162
  const _ = options.compact ? '' : ' ';
8127
8163
  const s = options.compact ? '' : ';';
8128
- code.overwrite(this.start, this.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})`);
8164
+ code.overwrite(this.start, this.end, `Promise.resolve().then(function${_}()${_}{${_}return ${this.inlineNamespace.getName()}${s}${_}})`, { contentOnly: true });
8129
8165
  return;
8130
8166
  }
8131
8167
  if (this.mechanism) {
8132
- code.overwrite(this.start, findFirstOccurrenceOutsideComment(code.original, '(', this.start + 6) + 1, this.mechanism.left);
8133
- code.overwrite(this.end - 1, this.end, this.mechanism.right);
8168
+ code.overwrite(this.start, findFirstOccurrenceOutsideComment(code.original, '(', this.start + 6) + 1, this.mechanism.left, { contentOnly: true });
8169
+ code.overwrite(this.end - 1, this.end, this.mechanism.right, { contentOnly: true });
8134
8170
  }
8135
8171
  this.source.render(code, options);
8136
8172
  }
@@ -9137,7 +9173,8 @@ class ExportDefaultVariable extends LocalVariable {
9137
9173
  getDirectOriginalVariable() {
9138
9174
  return this.originalId &&
9139
9175
  (this.hasId ||
9140
- !(this.originalId.variable.isReassigned ||
9176
+ !(this.originalId.isPossibleTDZ() ||
9177
+ this.originalId.variable.isReassigned ||
9141
9178
  this.originalId.variable instanceof UndefinedVariable ||
9142
9179
  // this avoids a circular dependency
9143
9180
  'syntheticNamespace' in this.originalId.variable))
@@ -9378,31 +9415,19 @@ class UpdateExpression extends NodeBase {
9378
9415
  if (options.format === 'system') {
9379
9416
  const variable = this.argument.variable;
9380
9417
  const exportNames = options.exportNamesByVariable.get(variable);
9381
- if (exportNames && exportNames.length) {
9418
+ if (exportNames) {
9382
9419
  const _ = options.compact ? '' : ' ';
9383
- const name = variable.getName();
9384
9420
  if (this.prefix) {
9385
9421
  if (exportNames.length === 1) {
9386
- code.overwrite(this.start, this.end, `exports('${exportNames[0]}',${_}${this.operator}${name})`);
9422
+ renderSystemExportExpression(variable, this.start, this.end, code, options);
9387
9423
  }
9388
9424
  else {
9389
- code.overwrite(this.start, this.end, `(${this.operator}${name},${_}${getSystemExportStatement([variable], options)},${_}${name})`);
9425
+ renderSystemExportSequenceAfterExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options);
9390
9426
  }
9391
9427
  }
9392
- else if (exportNames.length > 1) {
9393
- code.overwrite(this.start, this.end, `(${getSystemExportFunctionLeft([variable], false, options)}${this.operator}${name}))`);
9394
- }
9395
9428
  else {
9396
- let op;
9397
- switch (this.operator) {
9398
- case '++':
9399
- op = `${name}${_}+${_}1`;
9400
- break;
9401
- case '--':
9402
- op = `${name}${_}-${_}1`;
9403
- break;
9404
- }
9405
- code.overwrite(this.start, this.end, `(exports('${exportNames[0]}',${_}${op}),${_}${name}${this.operator})`);
9429
+ const operator = this.operator[0];
9430
+ renderSystemExportSequenceBeforeExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options, `${_}${operator}${_}1`);
9406
9431
  }
9407
9432
  }
9408
9433
  }
@@ -10351,7 +10376,7 @@ class Module {
10351
10376
  // By default, `id` is the file name. Custom resolvers and loaders
10352
10377
  // can change that, but it makes sense to use it for the source file name
10353
10378
  const fileName = this.id;
10354
- this.magicString = new MagicString(code, {
10379
+ this.magicString = new MagicString$1(code, {
10355
10380
  filename: (this.excludeFromSourcemap ? null : fileName),
10356
10381
  indentExclusionRanges: []
10357
10382
  });
@@ -10785,9 +10810,9 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, comp
10785
10810
  }
10786
10811
  }
10787
10812
  }
10788
- for (const chunkExport of exports) {
10789
- const lhs = `exports.${chunkExport.exported}`;
10790
- const rhs = chunkExport.local;
10813
+ for (const { exported, local } of exports) {
10814
+ const lhs = `exports${RESERVED_NAMES[exported] ? `['${exported}']` : `.${exported}`}`;
10815
+ const rhs = local;
10791
10816
  if (lhs !== rhs) {
10792
10817
  if (exportBlock)
10793
10818
  exportBlock += n;
@@ -11154,17 +11179,12 @@ function getExportBlock(exports, _, varOrConst) {
11154
11179
  const exportBlock = [];
11155
11180
  const exportDeclaration = [];
11156
11181
  for (const specifier of exports) {
11157
- if (specifier.exported === 'default') {
11158
- exportBlock.push(`export default ${specifier.local};`);
11159
- }
11160
- else {
11161
- if (specifier.expression) {
11162
- exportBlock.push(`${varOrConst} ${specifier.local}${_}=${_}${specifier.expression};`);
11163
- }
11164
- exportDeclaration.push(specifier.exported === specifier.local
11165
- ? specifier.local
11166
- : `${specifier.local} as ${specifier.exported}`);
11182
+ if (specifier.expression) {
11183
+ exportBlock.push(`${varOrConst} ${specifier.local}${_}=${_}${specifier.expression};`);
11167
11184
  }
11185
+ exportDeclaration.push(specifier.exported === specifier.local
11186
+ ? specifier.local
11187
+ : `${specifier.local} as ${specifier.exported}`);
11168
11188
  }
11169
11189
  if (exportDeclaration.length) {
11170
11190
  exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
@@ -11282,13 +11302,11 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
11282
11302
 
11283
11303
  function getStarExcludes({ dependencies, exports }) {
11284
11304
  const starExcludes = new Set(exports.map(expt => expt.exported));
11285
- if (!starExcludes.has('default'))
11286
- starExcludes.add('default');
11287
- // also include reexport names
11305
+ starExcludes.add('default');
11288
11306
  for (const { reexports } of dependencies) {
11289
11307
  if (reexports) {
11290
11308
  for (const reexport of reexports) {
11291
- if (reexport.imported !== '*' && !starExcludes.has(reexport.reexported))
11309
+ if (reexport.imported !== '*')
11292
11310
  starExcludes.add(reexport.reexported);
11293
11311
  }
11294
11312
  }
@@ -11312,9 +11330,7 @@ function getExportsBlock(exports, _, t, n) {
11312
11330
  exports.map(({ name, value }) => `${t}${t}${t}${t}${name}:${_}${value}`).join(`,${n}`) +
11313
11331
  `${n}${t}${t}${t}});${n}${n}`);
11314
11332
  }
11315
- const getHoistedExportsBlock = (exports, _, t, n) => getExportsBlock(exports
11316
- .filter(expt => expt.hoisted || expt.uninitialized)
11317
- .map(expt => ({ name: expt.exported, value: expt.uninitialized ? 'void 0' : expt.local })), _, t, n);
11333
+ const getHoistedExportsBlock = (exports, _, t, n) => getExportsBlock(exports.filter(expt => expt.hoisted).map(expt => ({ name: expt.exported, value: expt.local })), _, t, n);
11318
11334
  const getMissingExportsBlock = (exports, _, t, n) => getExportsBlock(exports
11319
11335
  .filter(expt => expt.local === MISSING_EXPORT_SHIM_VARIABLE)
11320
11336
  .map(expt => ({ name: expt.exported, value: MISSING_EXPORT_SHIM_VARIABLE })), _, t, n);
@@ -11355,10 +11371,8 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
11355
11371
  if (!starExcludes) {
11356
11372
  starExcludes = getStarExcludes({ dependencies, exports });
11357
11373
  }
11358
- if (!createdSetter) {
11359
- setter.push(`${varOrConst} _setter${_}=${_}{};`);
11360
- createdSetter = true;
11361
- }
11374
+ createdSetter = true;
11375
+ setter.push(`${varOrConst} _setter${_}=${_}{};`);
11362
11376
  setter.push(`for${_}(var _$p${_}in${_}module)${_}{`);
11363
11377
  setter.push(`${t}if${_}(!_starExcludes[_$p])${_}_setter[_$p]${_}=${_}module[_$p];`);
11364
11378
  setter.push('}');
@@ -12388,7 +12402,7 @@ class Chunk {
12388
12402
  if (namespace.renderFirst())
12389
12403
  hoistedSource += n + rendered;
12390
12404
  else
12391
- magicString.addSource(new MagicString(rendered));
12405
+ magicString.addSource(new MagicString$1(rendered));
12392
12406
  }
12393
12407
  }
12394
12408
  const { renderedExports, removedExports } = module.getRenderedExports();
@@ -12701,12 +12715,8 @@ class Chunk {
12701
12715
  }
12702
12716
  let expression = null;
12703
12717
  let hoisted = false;
12704
- let uninitialized = false;
12705
12718
  let local = variable.getName();
12706
12719
  if (variable instanceof LocalVariable) {
12707
- if (variable.init === UNDEFINED_EXPRESSION) {
12708
- uninitialized = true;
12709
- }
12710
12720
  for (const declaration of variable.declarations) {
12711
12721
  if (declaration.parent instanceof FunctionDeclaration ||
12712
12722
  (declaration instanceof ExportDefaultDeclaration &&
@@ -12718,7 +12728,7 @@ class Chunk {
12718
12728
  }
12719
12729
  else if (variable instanceof SyntheticNamedExportVariable) {
12720
12730
  expression = local;
12721
- if (format === 'es' && exportName !== 'default') {
12731
+ if (format === 'es') {
12722
12732
  local = variable.renderName;
12723
12733
  }
12724
12734
  }
@@ -12726,8 +12736,7 @@ class Chunk {
12726
12736
  exported: exportName,
12727
12737
  expression,
12728
12738
  hoisted,
12729
- local,
12730
- uninitialized
12739
+ local
12731
12740
  });
12732
12741
  }
12733
12742
  return exports;
@@ -19520,7 +19529,7 @@ function transform(source, module, pluginDriver, warn) {
19520
19529
  getCombinedSourcemap() {
19521
19530
  const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
19522
19531
  if (!combinedMap) {
19523
- const magicString = new MagicString(originalCode);
19532
+ const magicString = new MagicString$1(originalCode);
19524
19533
  return magicString.generateMap({ hires: true, includeContent: true, source: id });
19525
19534
  }
19526
19535
  if (originalSourcemap !== combinedMap) {
@@ -19671,12 +19680,10 @@ class ModuleLoader {
19671
19680
  }));
19672
19681
  }
19673
19682
  async addModuleSource(id, importer, module) {
19674
- var _a;
19675
19683
  timeStart('load modules', 3);
19676
19684
  let source;
19677
19685
  try {
19678
- source =
19679
- (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
19686
+ source = await this.readQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id)); });
19680
19687
  }
19681
19688
  catch (err) {
19682
19689
  timeEnd('load modules', 3);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -406,7 +406,7 @@ async function watch(command) {
406
406
  case 'BUNDLE_END':
407
407
  warnings.flush();
408
408
  if (!silent)
409
- loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.prettyMs(event.duration))}`));
409
+ loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.ms(event.duration))}`));
410
410
  if (event.result && event.result.getTimings) {
411
411
  cli.printTimings(event.result.getTimings());
412
412
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.54.0
4
- Sun, 25 Jul 2021 05:15:03 GMT - commit f90e1a2d9a1822b70ffb532a25404e2f45f17f5b
3
+ Rollup.js v2.56.1
4
+ Sun, 08 Aug 2021 11:58:39 GMT - commit 2a097a809d7976d0684370fb14b61b3c2fa86bca
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -500,6 +500,8 @@ micromatch.braceExpand = (pattern, options) => {
500
500
 
501
501
  var micromatch_1 = micromatch;
502
502
 
503
+ var mm = micromatch_1;
504
+
503
505
  function ensureArray(thing) {
504
506
  if (Array.isArray(thing))
505
507
  return thing;
@@ -520,7 +522,7 @@ const createFilter = function createFilter(include, exclude, options) {
520
522
  return id instanceof RegExp
521
523
  ? id
522
524
  : {
523
- test: micromatch_1.matcher(getMatcherString(id, resolutionBase)
525
+ test: mm.matcher(getMatcherString(id, resolutionBase)
524
526
  .split(path.sep)
525
527
  .join('/'), { dot: true })
526
528
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.54.0",
3
+ "version": "2.56.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",