rollup 2.18.1 → 2.21.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/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.18.1
4
- Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.18.1
4
- Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
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.18.1";
16
+ var version = "2.21.0";
17
17
 
18
18
  var charToInteger = {};
19
19
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -2990,6 +2990,15 @@ class ThisVariable extends LocalVariable {
2990
2990
  }
2991
2991
  }
2992
2992
 
2993
+ class SpreadElement extends NodeBase {
2994
+ bind() {
2995
+ super.bind();
2996
+ // Only properties of properties of the argument could become subject to reassignment
2997
+ // This will also reassign the return values of iterators
2998
+ this.argument.deoptimizePath([UnknownKey, UnknownKey]);
2999
+ }
3000
+ }
3001
+
2993
3002
  class ParameterScope extends ChildScope {
2994
3003
  constructor(parent, context) {
2995
3004
  super(parent);
@@ -3027,6 +3036,14 @@ class ParameterScope extends ChildScope {
3027
3036
  let calledFromTryStatement = false;
3028
3037
  let argIncluded = false;
3029
3038
  const restParam = this.hasRest && this.parameters[this.parameters.length - 1];
3039
+ for (const checkedArg of args) {
3040
+ if (checkedArg instanceof SpreadElement) {
3041
+ for (const arg of args) {
3042
+ arg.include(context, false);
3043
+ }
3044
+ break;
3045
+ }
3046
+ }
3030
3047
  for (let index = args.length - 1; index >= 0; index--) {
3031
3048
  const paramVars = this.parameters[index] || restParam;
3032
3049
  const arg = args[index];
@@ -7540,6 +7557,13 @@ const ASSET_PREFIX = 'ROLLUP_ASSET_URL_';
7540
7557
  const CHUNK_PREFIX = 'ROLLUP_CHUNK_URL_';
7541
7558
  const FILE_PREFIX = 'ROLLUP_FILE_URL_';
7542
7559
  class MetaProperty extends NodeBase {
7560
+ getReferencedFileName(outputPluginDriver) {
7561
+ const metaProperty = this.metaProperty;
7562
+ if (metaProperty && metaProperty.startsWith(FILE_PREFIX)) {
7563
+ return outputPluginDriver.getFileName(metaProperty.substr(FILE_PREFIX.length));
7564
+ }
7565
+ return null;
7566
+ }
7543
7567
  hasEffects() {
7544
7568
  return false;
7545
7569
  }
@@ -7549,30 +7573,26 @@ class MetaProperty extends NodeBase {
7549
7573
  include() {
7550
7574
  if (!this.included) {
7551
7575
  this.included = true;
7552
- const parent = this.parent;
7553
- const metaProperty = (this.metaProperty =
7554
- parent instanceof MemberExpression && typeof parent.propertyKey === 'string'
7555
- ? parent.propertyKey
7556
- : null);
7557
- if (metaProperty &&
7558
- (metaProperty.startsWith(FILE_PREFIX) ||
7559
- metaProperty.startsWith(ASSET_PREFIX) ||
7560
- metaProperty.startsWith(CHUNK_PREFIX))) {
7561
- this.scope.addAccessedGlobalsByFormat(accessedFileUrlGlobals);
7562
- }
7563
- else {
7564
- this.scope.addAccessedGlobalsByFormat(accessedMetaUrlGlobals);
7576
+ if (this.meta.name === 'import') {
7577
+ this.context.addImportMeta(this);
7578
+ const parent = this.parent;
7579
+ const metaProperty = (this.metaProperty =
7580
+ parent instanceof MemberExpression && typeof parent.propertyKey === 'string'
7581
+ ? parent.propertyKey
7582
+ : null);
7583
+ if (metaProperty &&
7584
+ (metaProperty.startsWith(FILE_PREFIX) ||
7585
+ metaProperty.startsWith(ASSET_PREFIX) ||
7586
+ metaProperty.startsWith(CHUNK_PREFIX))) {
7587
+ this.scope.addAccessedGlobalsByFormat(accessedFileUrlGlobals);
7588
+ }
7589
+ else {
7590
+ this.scope.addAccessedGlobalsByFormat(accessedMetaUrlGlobals);
7591
+ }
7565
7592
  }
7566
7593
  }
7567
7594
  }
7568
- initialise() {
7569
- if (this.meta.name === 'import') {
7570
- this.context.addImportMeta(this);
7571
- }
7572
- }
7573
7595
  renderFinalMechanism(code, chunkId, format, outputPluginDriver) {
7574
- if (!this.included)
7575
- return;
7576
7596
  const parent = this.parent;
7577
7597
  const metaProperty = this.metaProperty;
7578
7598
  if (metaProperty &&
@@ -7718,15 +7738,6 @@ class NewExpression extends NodeBase {
7718
7738
  }
7719
7739
  }
7720
7740
 
7721
- class SpreadElement extends NodeBase {
7722
- bind() {
7723
- super.bind();
7724
- // Only properties of properties of the argument could become subject to reassignment
7725
- // This will also reassign the return values of iterators
7726
- this.argument.deoptimizePath([UnknownKey, UnknownKey]);
7727
- }
7728
- }
7729
-
7730
7741
  class ObjectExpression extends NodeBase {
7731
7742
  constructor() {
7732
7743
  super(...arguments);
@@ -9572,7 +9583,7 @@ class Module {
9572
9583
  }
9573
9584
  relevantDependencies.add(variable.module);
9574
9585
  }
9575
- if (this.options.treeshake) {
9586
+ if (this.options.treeshake && this.moduleSideEffects !== 'no-treeshake') {
9576
9587
  for (const dependency of possibleDependencies) {
9577
9588
  if (!(dependency.moduleSideEffects || additionalSideEffectModules.has(dependency)) ||
9578
9589
  relevantDependencies.has(dependency)) {
@@ -9711,7 +9722,8 @@ class Module {
9711
9722
  return null;
9712
9723
  }
9713
9724
  hasEffects() {
9714
- return this.ast.included && this.ast.hasEffects(createHasEffectsContext());
9725
+ return (this.moduleSideEffects === 'no-treeshake' ||
9726
+ (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
9715
9727
  }
9716
9728
  include() {
9717
9729
  const context = createInclusionContext();
@@ -9792,10 +9804,10 @@ class Module {
9792
9804
  }
9793
9805
  this.transformDependencies = transformDependencies;
9794
9806
  this.customTransformCache = customTransformCache;
9795
- if (typeof moduleSideEffects === 'boolean') {
9807
+ if (moduleSideEffects != null) {
9796
9808
  this.moduleSideEffects = moduleSideEffects;
9797
9809
  }
9798
- if (typeof syntheticNamedExports === 'boolean') {
9810
+ if (syntheticNamedExports != null) {
9799
9811
  this.syntheticNamedExports = syntheticNamedExports;
9800
9812
  }
9801
9813
  timeStart('generate ast', 3);
@@ -10536,7 +10548,10 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
10536
10548
  return outputPluginDriver.hookReduceArg0('renderChunk', [code, renderChunk, options], renderChunkReducer);
10537
10549
  }
10538
10550
 
10539
- function renderNamePattern(pattern, patternName, replacements) {
10551
+ function renderNamePattern(pattern, patternName, replacements, getFileInfo) {
10552
+ if (typeof pattern === 'function') {
10553
+ pattern = pattern(getFileInfo());
10554
+ }
10540
10555
  if (!isPlainPathFragment(pattern))
10541
10556
  return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths and must not contain invalid characters.`));
10542
10557
  return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
@@ -10578,11 +10593,12 @@ function getGlobalName(module, globals, hasExports, warn) {
10578
10593
  }
10579
10594
  }
10580
10595
  class Chunk$1 {
10581
- constructor(orderedModules, inputOptions, outputOptions, unsetOptions, modulesById, chunkByModule, facadeChunkByModule, manualChunkAlias) {
10596
+ constructor(orderedModules, inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, manualChunkAlias) {
10582
10597
  this.orderedModules = orderedModules;
10583
10598
  this.inputOptions = inputOptions;
10584
10599
  this.outputOptions = outputOptions;
10585
10600
  this.unsetOptions = unsetOptions;
10601
+ this.pluginDriver = pluginDriver;
10586
10602
  this.modulesById = modulesById;
10587
10603
  this.chunkByModule = chunkByModule;
10588
10604
  this.facadeChunkByModule = facadeChunkByModule;
@@ -10638,8 +10654,8 @@ class Chunk$1 {
10638
10654
  }
10639
10655
  this.variableName = makeLegal(this.generateVariableName());
10640
10656
  }
10641
- static generateFacade(inputOptions, outputOptions, unsetOptions, modulesById, chunkByModule, facadeChunkByModule, facadedModule, facadeName) {
10642
- const chunk = new Chunk$1([], inputOptions, outputOptions, unsetOptions, modulesById, chunkByModule, facadeChunkByModule, null);
10657
+ static generateFacade(inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, facadedModule, facadeName) {
10658
+ const chunk = new Chunk$1([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, facadeChunkByModule, null);
10643
10659
  chunk.assignFacadeName(facadeName, facadedModule);
10644
10660
  if (!facadeChunkByModule.has(facadedModule)) {
10645
10661
  facadeChunkByModule.set(facadedModule, chunk);
@@ -10743,7 +10759,7 @@ class Chunk$1 {
10743
10759
  this.assignFacadeName(requiredFacades.shift(), module);
10744
10760
  }
10745
10761
  for (const facadeName of requiredFacades) {
10746
- facades.push(Chunk$1.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.modulesById, this.chunkByModule, this.facadeChunkByModule, module, facadeName));
10762
+ facades.push(Chunk$1.generateFacade(this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.modulesById, this.chunkByModule, this.facadeChunkByModule, module, facadeName));
10747
10763
  }
10748
10764
  }
10749
10765
  for (const module of this.dynamicEntryModules) {
@@ -10767,7 +10783,7 @@ class Chunk$1 {
10767
10783
  }
10768
10784
  return facades;
10769
10785
  }
10770
- generateId(addons, options, existingNames, includeHash, outputPluginDriver) {
10786
+ generateId(addons, options, existingNames, includeHash) {
10771
10787
  if (this.fileName !== null) {
10772
10788
  return this.fileName;
10773
10789
  }
@@ -10777,10 +10793,10 @@ class Chunk$1 {
10777
10793
  return makeUnique(renderNamePattern(pattern, patternName, {
10778
10794
  format: () => options.format,
10779
10795
  hash: () => includeHash
10780
- ? this.computeContentHashWithDependencies(addons, options, existingNames, outputPluginDriver)
10796
+ ? this.computeContentHashWithDependencies(addons, options, existingNames)
10781
10797
  : '[hash]',
10782
10798
  name: () => this.getChunkName()
10783
- }), existingNames);
10799
+ }, this.getChunkInfo.bind(this)), existingNames);
10784
10800
  }
10785
10801
  generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
10786
10802
  const id = this.orderedModules[0].id;
@@ -10798,34 +10814,22 @@ class Chunk$1 {
10798
10814
  extname: () => extension,
10799
10815
  format: () => options.format,
10800
10816
  name: () => this.getChunkName()
10801
- })}`);
10817
+ }, this.getChunkInfo.bind(this))}`);
10802
10818
  }
10803
10819
  else {
10804
10820
  path = `_virtual/${basename(sanitizedId)}`;
10805
10821
  }
10806
10822
  return makeUnique(normalize(path), existingNames);
10807
10823
  }
10808
- getChunkName() {
10809
- return this.name || (this.name = sanitizeFileName(this.getFallbackChunkName()));
10810
- }
10811
- getExportNames() {
10812
- return (this.sortedExportNames || (this.sortedExportNames = Object.keys(this.exportsByName).sort()));
10813
- }
10814
- getPrerenderedChunk() {
10824
+ getChunkInfo() {
10815
10825
  const facadeModule = this.facadeModule;
10816
10826
  const getChunkName = this.getChunkName.bind(this);
10817
10827
  return {
10818
- code: undefined,
10819
- dynamicImports: Array.from(this.dynamicDependencies, getId),
10820
10828
  exports: this.getExportNames(),
10821
10829
  facadeModuleId: facadeModule && facadeModule.id,
10822
- fileName: undefined,
10823
- implicitlyLoadedBefore: Array.from(this.implicitlyLoadedBefore, getId),
10824
- imports: Array.from(this.dependencies, getId),
10825
10830
  isDynamicEntry: this.dynamicEntryModules.length > 0,
10826
10831
  isEntry: facadeModule !== null && facadeModule.isEntryPoint,
10827
10832
  isImplicitEntry: this.implicitEntryModules.length > 0,
10828
- map: undefined,
10829
10833
  modules: this.renderedModules,
10830
10834
  get name() {
10831
10835
  return getChunkName();
@@ -10833,11 +10837,28 @@ class Chunk$1 {
10833
10837
  type: 'chunk'
10834
10838
  };
10835
10839
  }
10836
- getRenderedHash(outputPluginDriver) {
10840
+ getChunkInfoWithFileNames() {
10841
+ return Object.assign(this.getChunkInfo(), {
10842
+ code: undefined,
10843
+ dynamicImports: Array.from(this.dynamicDependencies, getId),
10844
+ fileName: this.id,
10845
+ implicitlyLoadedBefore: Array.from(this.implicitlyLoadedBefore, getId),
10846
+ imports: Array.from(this.dependencies, getId),
10847
+ map: undefined,
10848
+ referencedFiles: this.getReferencedFiles()
10849
+ });
10850
+ }
10851
+ getChunkName() {
10852
+ return this.name || (this.name = sanitizeFileName(this.getFallbackChunkName()));
10853
+ }
10854
+ getExportNames() {
10855
+ return (this.sortedExportNames || (this.sortedExportNames = Object.keys(this.exportsByName).sort()));
10856
+ }
10857
+ getRenderedHash() {
10837
10858
  if (this.renderedHash)
10838
10859
  return this.renderedHash;
10839
10860
  const hash = createHash();
10840
- const hashAugmentation = outputPluginDriver.hookReduceValueSync('augmentChunkHash', '', [this.getPrerenderedChunk()], (hashAugmentation, pluginHash) => {
10861
+ const hashAugmentation = this.pluginDriver.hookReduceValueSync('augmentChunkHash', '', [this.getChunkInfo()], (hashAugmentation, pluginHash) => {
10841
10862
  if (pluginHash) {
10842
10863
  hashAugmentation += pluginHash;
10843
10864
  }
@@ -10868,7 +10889,7 @@ class Chunk$1 {
10868
10889
  }
10869
10890
  }
10870
10891
  // prerender allows chunk hashes and names to be generated before finalizing
10871
- preRender(options, inputBase, outputPluginDriver) {
10892
+ preRender(options, inputBase) {
10872
10893
  const magicString = new Bundle({ separator: options.compact ? '' : '\n\n' });
10873
10894
  this.usedModules = [];
10874
10895
  this.indentString = getIndentString(this.orderedModules, options);
@@ -10882,7 +10903,7 @@ class Chunk$1 {
10882
10903
  freeze: options.freeze,
10883
10904
  indent: this.indentString,
10884
10905
  namespaceToStringTag: options.namespaceToStringTag,
10885
- outputPluginDriver,
10906
+ outputPluginDriver: this.pluginDriver,
10886
10907
  varOrConst: options.preferConst ? 'const' : 'var'
10887
10908
  };
10888
10909
  // for static and dynamic entry points, inline the execution list to avoid loading latency
@@ -10955,7 +10976,7 @@ class Chunk$1 {
10955
10976
  this.renderedExports =
10956
10977
  this.exportMode === 'none' ? [] : this.getChunkExportDeclarations(options.format);
10957
10978
  }
10958
- async render(options, addons, outputChunk, outputPluginDriver) {
10979
+ async render(options, addons, outputChunk) {
10959
10980
  timeStart('render format', 2);
10960
10981
  const format = options.format;
10961
10982
  const finalise = finalisers[format];
@@ -10979,7 +11000,7 @@ class Chunk$1 {
10979
11000
  }
10980
11001
  }
10981
11002
  this.finaliseDynamicImports(options);
10982
- this.finaliseImportMetas(format, outputPluginDriver);
11003
+ this.finaliseImportMetas(format);
10983
11004
  const hasExports = this.renderedExports.length !== 0 ||
10984
11005
  [...this.renderedDependencies.values()].some(dep => (dep.reexports && dep.reexports.length !== 0));
10985
11006
  let usesTopLevelAwait = false;
@@ -11028,7 +11049,7 @@ class Chunk$1 {
11028
11049
  let code = await renderChunk({
11029
11050
  code: prevCode,
11030
11051
  options,
11031
- outputPluginDriver,
11052
+ outputPluginDriver: this.pluginDriver,
11032
11053
  renderChunk: outputChunk,
11033
11054
  sourcemapChain: chunkSourcemapChain
11034
11055
  });
@@ -11083,7 +11104,7 @@ class Chunk$1 {
11083
11104
  this.name = sanitizeFileName(name || facadedModule.chunkName || getAliasName(facadedModule.id));
11084
11105
  }
11085
11106
  }
11086
- computeContentHashWithDependencies(addons, options, existingNames, outputPluginDriver) {
11107
+ computeContentHashWithDependencies(addons, options, existingNames) {
11087
11108
  const hash = createHash();
11088
11109
  hash.update([addons.intro, addons.outro, addons.banner, addons.footer].map(addon => addon || '').join(':'));
11089
11110
  hash.update(options.format);
@@ -11093,8 +11114,8 @@ class Chunk$1 {
11093
11114
  hash.update(':' + current.renderPath);
11094
11115
  }
11095
11116
  else {
11096
- hash.update(current.getRenderedHash(outputPluginDriver));
11097
- hash.update(current.generateId(addons, options, existingNames, false, outputPluginDriver));
11117
+ hash.update(current.getRenderedHash());
11118
+ hash.update(current.generateId(addons, options, existingNames, false));
11098
11119
  }
11099
11120
  if (current instanceof ExternalModule)
11100
11121
  continue;
@@ -11147,10 +11168,10 @@ class Chunk$1 {
11147
11168
  }
11148
11169
  }
11149
11170
  }
11150
- finaliseImportMetas(format, outputPluginDriver) {
11171
+ finaliseImportMetas(format) {
11151
11172
  for (const [module, code] of this.renderedModuleSources) {
11152
11173
  for (const importMeta of module.importMetas) {
11153
- importMeta.renderFinalMechanism(code, this.id, format, outputPluginDriver);
11174
+ importMeta.renderFinalMechanism(code, this.id, format, this.pluginDriver);
11154
11175
  }
11155
11176
  }
11156
11177
  }
@@ -11301,6 +11322,18 @@ class Chunk$1 {
11301
11322
  }
11302
11323
  return getAliasName(this.orderedModules[this.orderedModules.length - 1].id);
11303
11324
  }
11325
+ getReferencedFiles() {
11326
+ const referencedFiles = [];
11327
+ for (const module of this.orderedModules) {
11328
+ for (const meta of module.importMetas) {
11329
+ const fileName = meta.getReferencedFileName(this.pluginDriver);
11330
+ if (fileName) {
11331
+ referencedFiles.push(fileName);
11332
+ }
11333
+ }
11334
+ }
11335
+ return referencedFiles;
11336
+ }
11304
11337
  getRelativePath(targetPath, stripJsExtension) {
11305
11338
  let relativePath = normalize(relative(dirname(this.id), targetPath));
11306
11339
  if (stripJsExtension && relativePath.endsWith('.js')) {
@@ -11641,7 +11674,7 @@ function generateAssetFileName(name, source, output) {
11641
11674
  ext: () => extname(emittedName).substr(1),
11642
11675
  extname: () => extname(emittedName),
11643
11676
  name: () => emittedName.substr(0, emittedName.length - extname(emittedName).length)
11644
- }), output.bundle);
11677
+ }, () => ({ name, source, type: 'asset' })), output.bundle);
11645
11678
  }
11646
11679
  function reserveFileNameInBundle(fileName, bundle, warn) {
11647
11680
  if (fileName in bundle) {
@@ -11825,6 +11858,7 @@ class FileEmitter {
11825
11858
  const options = this.options;
11826
11859
  output.bundle[fileName] = {
11827
11860
  fileName,
11861
+ name: consumedFile.name,
11828
11862
  get isAsset() {
11829
11863
  warnDeprecation('Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead', true, options);
11830
11864
  return true;
@@ -11909,17 +11943,11 @@ class Bundle$1 {
11909
11943
  async addFinalizedChunksToBundle(chunks, inputBase, addons, outputBundle) {
11910
11944
  this.assignChunkIds(chunks, inputBase, addons, outputBundle);
11911
11945
  for (const chunk of chunks) {
11912
- const chunkDescription = (outputBundle[chunk.id] = chunk.getPrerenderedChunk());
11913
- chunkDescription.fileName = chunk.id;
11946
+ outputBundle[chunk.id] = chunk.getChunkInfoWithFileNames();
11914
11947
  }
11915
- await Promise.all(chunks.map(chunk => {
11948
+ await Promise.all(chunks.map(async (chunk) => {
11916
11949
  const outputChunk = outputBundle[chunk.id];
11917
- return chunk
11918
- .render(this.outputOptions, addons, outputChunk, this.pluginDriver)
11919
- .then(rendered => {
11920
- outputChunk.code = rendered.code;
11921
- outputChunk.map = rendered.map;
11922
- });
11950
+ Object.assign(outputChunk, await chunk.render(this.outputOptions, addons, outputChunk));
11923
11951
  }));
11924
11952
  }
11925
11953
  async addManualChunks(manualChunks) {
@@ -11953,7 +11981,7 @@ class Bundle$1 {
11953
11981
  chunk.id = chunk.generateIdPreserveModules(inputBase, this.outputOptions, bundle, this.unsetOptions);
11954
11982
  }
11955
11983
  else {
11956
- chunk.id = chunk.generateId(addons, this.outputOptions, bundle, true, this.pluginDriver);
11984
+ chunk.id = chunk.generateId(addons, this.outputOptions, bundle, true);
11957
11985
  }
11958
11986
  bundle[chunk.id] = FILE_PLACEHOLDER;
11959
11987
  }
@@ -12000,7 +12028,7 @@ class Bundle$1 {
12000
12028
  }))
12001
12029
  : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry)) {
12002
12030
  sortByExecutionOrder(modules);
12003
- const chunk = new Chunk$1(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, alias);
12031
+ const chunk = new Chunk$1(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, this.facadeChunkByModule, alias);
12004
12032
  chunks.push(chunk);
12005
12033
  for (const module of modules) {
12006
12034
  chunkByModule.set(module, chunk);
@@ -12020,7 +12048,7 @@ class Bundle$1 {
12020
12048
  chunk.generateExports();
12021
12049
  }
12022
12050
  for (const chunk of chunks) {
12023
- chunk.preRender(this.outputOptions, inputBase, this.pluginDriver);
12051
+ chunk.preRender(this.outputOptions, inputBase);
12024
12052
  }
12025
12053
  }
12026
12054
  }
@@ -17432,10 +17460,10 @@ function transform(source, module, pluginDriver, warn) {
17432
17460
  if (typeof result.map === 'string') {
17433
17461
  result.map = JSON.parse(result.map);
17434
17462
  }
17435
- if (typeof result.moduleSideEffects === 'boolean') {
17463
+ if (result.moduleSideEffects != null) {
17436
17464
  moduleSideEffects = result.moduleSideEffects;
17437
17465
  }
17438
- if (typeof result.syntheticNamedExports === 'boolean') {
17466
+ if (result.syntheticNamedExports != null) {
17439
17467
  syntheticNamedExports = result.syntheticNamedExports;
17440
17468
  }
17441
17469
  }
@@ -17657,10 +17685,10 @@ class ModuleLoader {
17657
17685
  module.setSource(cachedModule);
17658
17686
  }
17659
17687
  else {
17660
- if (typeof sourceDescription.moduleSideEffects === 'boolean') {
17688
+ if (sourceDescription.moduleSideEffects != null) {
17661
17689
  module.moduleSideEffects = sourceDescription.moduleSideEffects;
17662
17690
  }
17663
- if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
17691
+ if (sourceDescription.syntheticNamedExports != null) {
17664
17692
  module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
17665
17693
  }
17666
17694
  module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onwarn));
@@ -17795,10 +17823,10 @@ class ModuleLoader {
17795
17823
  if (resolveIdResult.external) {
17796
17824
  external = true;
17797
17825
  }
17798
- if (typeof resolveIdResult.moduleSideEffects === 'boolean') {
17826
+ if (resolveIdResult.moduleSideEffects != null) {
17799
17827
  moduleSideEffects = resolveIdResult.moduleSideEffects;
17800
17828
  }
17801
- if (typeof resolveIdResult.syntheticNamedExports === 'boolean') {
17829
+ if (resolveIdResult.syntheticNamedExports != null) {
17802
17830
  syntheticNamedExports = resolveIdResult.syntheticNamedExports;
17803
17831
  }
17804
17832
  }
@@ -17819,9 +17847,7 @@ class ModuleLoader {
17819
17847
  return {
17820
17848
  external,
17821
17849
  id,
17822
- moduleSideEffects: typeof moduleSideEffects === 'boolean'
17823
- ? moduleSideEffects
17824
- : this.hasModuleSideEffects(id, external),
17850
+ moduleSideEffects: moduleSideEffects !== null && moduleSideEffects !== void 0 ? moduleSideEffects : this.hasModuleSideEffects(id, external),
17825
17851
  syntheticNamedExports
17826
17852
  };
17827
17853
  }
@@ -18311,8 +18337,14 @@ class Graph {
18311
18337
  timeStart(`treeshaking pass ${treeshakingPass}`, 3);
18312
18338
  this.needsTreeshakingPass = false;
18313
18339
  for (const module of this.modules) {
18314
- if (module.isExecuted)
18315
- module.include();
18340
+ if (module.isExecuted) {
18341
+ if (module.moduleSideEffects === 'no-treeshake') {
18342
+ module.includeAllInBundle();
18343
+ }
18344
+ else {
18345
+ module.include();
18346
+ }
18347
+ }
18316
18348
  }
18317
18349
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
18318
18350
  } while (this.needsTreeshakingPass);
@@ -19242,7 +19274,7 @@ function rollup(rawInputOptions) {
19242
19274
  return rollupInternal(rawInputOptions, null);
19243
19275
  }
19244
19276
  async function rollupInternal(rawInputOptions, watcher) {
19245
- const { options: inputOptions, unsetOptions: unsetInputOptions } = getInputOptions(rawInputOptions, watcher !== null);
19277
+ const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, watcher !== null);
19246
19278
  initialiseTimers(inputOptions);
19247
19279
  const graph = new Graph(inputOptions, watcher);
19248
19280
  // remove the cache option from the memory after graph creation (cache is not used anymore)
@@ -19278,19 +19310,19 @@ async function rollupInternal(rawInputOptions, watcher) {
19278
19310
  result.getTimings = getTimings;
19279
19311
  return result;
19280
19312
  }
19281
- function getInputOptions(rawInputOptions, watchMode) {
19313
+ async function getInputOptions(rawInputOptions, watchMode) {
19282
19314
  if (!rawInputOptions) {
19283
19315
  throw new Error('You must supply an options object to rollup');
19284
19316
  }
19285
19317
  const rawPlugins = ensureArray(rawInputOptions.plugins);
19286
- const { options, unsetOptions } = normalizeInputOptions(rawPlugins.reduce(applyOptionHook(watchMode), rawInputOptions));
19318
+ const { options, unsetOptions } = normalizeInputOptions(await rawPlugins.reduce(applyOptionHook(watchMode), Promise.resolve(rawInputOptions)));
19287
19319
  normalizePlugins(options.plugins, ANONYMOUS_PLUGIN_PREFIX);
19288
19320
  return { options, unsetOptions };
19289
19321
  }
19290
19322
  function applyOptionHook(watchMode) {
19291
- return (inputOptions, plugin) => {
19323
+ return async (inputOptions, plugin) => {
19292
19324
  if (plugin.options)
19293
- return (plugin.options.call({ meta: { rollupVersion: version, watchMode } }, inputOptions) || inputOptions);
19325
+ return (plugin.options.call({ meta: { rollupVersion: version, watchMode } }, await inputOptions) || inputOptions);
19294
19326
  return inputOptions;
19295
19327
  };
19296
19328
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.18.1
4
- Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.18.1
4
- Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup