rollup 2.41.5 → 2.42.3

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.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -514,7 +514,20 @@ async function getDefaultFromTranspiledConfigFile(fileName, silent) {
514
514
  }
515
515
  const { output: [{ code }] } = await bundle.generate({
516
516
  exports: 'named',
517
- format: 'cjs'
517
+ format: 'cjs',
518
+ plugins: [
519
+ {
520
+ name: 'transpile-import-meta',
521
+ resolveImportMeta(property, { moduleId }) {
522
+ if (property === 'url') {
523
+ return `'${url.pathToFileURL(moduleId).href}'`;
524
+ }
525
+ if (property == null) {
526
+ return `{url:'${url.pathToFileURL(moduleId).href}'}`;
527
+ }
528
+ }
529
+ }
530
+ ]
518
531
  });
519
532
  return loadConfigFromBundledFile(fileName, code);
520
533
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -32,7 +32,7 @@ function _interopNamespaceDefaultOnly(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.41.5";
35
+ var version$1 = "2.42.3";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -1587,6 +1587,7 @@ function relative(from, to) {
1587
1587
  const ArrowFunctionExpression$1 = 'ArrowFunctionExpression';
1588
1588
  const BlockStatement$1 = 'BlockStatement';
1589
1589
  const CallExpression$1 = 'CallExpression';
1590
+ const ChainExpression$1 = 'ChainExpression';
1590
1591
  const ExpressionStatement$1 = 'ExpressionStatement';
1591
1592
  const Identifier$1 = 'Identifier';
1592
1593
  const ImportDefaultSpecifier$1 = 'ImportDefaultSpecifier';
@@ -9513,11 +9514,11 @@ function getPluginWithTimers(plugin, index) {
9513
9514
  timerLabel += ` - ${hook}`;
9514
9515
  timedPlugin[hook] = function () {
9515
9516
  timeStart(timerLabel, 4);
9516
- const result = plugin[hook].apply(this === timedPlugin ? plugin : this, arguments);
9517
+ let result = plugin[hook].apply(this === timedPlugin ? plugin : this, arguments);
9517
9518
  timeEnd(timerLabel, 4);
9518
9519
  if (result && typeof result.then === 'function') {
9519
9520
  timeStart(`${timerLabel} (async)`, 4);
9520
- result.then(() => timeEnd(`${timerLabel} (async)`, 4));
9521
+ result = result.then(() => timeEnd(`${timerLabel} (async)`, 4));
9521
9522
  }
9522
9523
  return result;
9523
9524
  };
@@ -17913,8 +17914,28 @@ function writeFile(dest, data) {
17913
17914
  });
17914
17915
  }
17915
17916
 
17916
- async function resolveId(source, importer, preserveSymlinks, pluginDriver, skip, customOptions) {
17917
- const pluginResult = await pluginDriver.hookFirst('resolveId', [source, importer, { custom: customOptions }], null, skip);
17917
+ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
17918
+ let skipped = null;
17919
+ let replaceContext = null;
17920
+ if (skip) {
17921
+ skipped = new Set();
17922
+ for (const skippedCall of skip) {
17923
+ if (source === skippedCall.source && importer === skippedCall.importer) {
17924
+ skipped.add(skippedCall.plugin);
17925
+ }
17926
+ }
17927
+ replaceContext = (pluginContext, plugin) => ({
17928
+ ...pluginContext,
17929
+ resolve: (source, importer, { custom, skipSelf } = BLANK) => {
17930
+ return moduleLoaderResolveId(source, importer, custom, skipSelf ? [...skip, { importer, plugin, source }] : skip);
17931
+ }
17932
+ });
17933
+ }
17934
+ return pluginDriver.hookFirst('resolveId', [source, importer, { custom: customOptions }], replaceContext, skipped);
17935
+ }
17936
+
17937
+ async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
17938
+ const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions);
17918
17939
  if (pluginResult != null)
17919
17940
  return pluginResult;
17920
17941
  // external modules (non-entry modules that start with neither '.' or '/')
@@ -18212,6 +18233,11 @@ class ModuleLoader {
18212
18233
  this.indexedEntryModules = [];
18213
18234
  this.latestLoadModulesPromise = Promise.resolve();
18214
18235
  this.nextEntryModuleIndex = 0;
18236
+ this.resolveId = async (source, importer, customOptions, skip = null) => {
18237
+ return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
18238
+ ? false
18239
+ : await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions), importer, source));
18240
+ };
18215
18241
  this.hasModuleSideEffects = options.treeshake
18216
18242
  ? options.treeshake.moduleSideEffects
18217
18243
  : () => true;
@@ -18265,11 +18291,6 @@ class ModuleLoader {
18265
18291
  }
18266
18292
  return module;
18267
18293
  }
18268
- async resolveId(source, importer, customOptions, skip = null) {
18269
- return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
18270
- ? false
18271
- : await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, skip, customOptions), importer, source));
18272
- }
18273
18294
  addDefaultsToResolvedId(resolvedId) {
18274
18295
  var _a, _b;
18275
18296
  if (!resolvedId) {
@@ -18467,7 +18488,7 @@ class ModuleLoader {
18467
18488
  return resolvedId;
18468
18489
  }
18469
18490
  async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore) {
18470
- const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, null, EMPTY_OBJECT);
18491
+ const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT);
18471
18492
  if (resolveIdResult == null) {
18472
18493
  return error(implicitlyLoadedBefore === null
18473
18494
  ? errUnresolvedEntry(unresolvedId)
@@ -18541,87 +18562,84 @@ function getDeprecatedContextHandler(handler, handlerName, newHandlerName, plugi
18541
18562
  return handler(...args);
18542
18563
  });
18543
18564
  }
18544
- function getPluginContexts(pluginCache, graph, options, fileEmitter) {
18545
- const existingPluginNames = new Set();
18546
- return (plugin, pidx) => {
18547
- let cacheable = true;
18548
- if (typeof plugin.cacheKey !== 'string') {
18549
- if (plugin.name.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
18550
- plugin.name.startsWith(ANONYMOUS_OUTPUT_PLUGIN_PREFIX) ||
18551
- existingPluginNames.has(plugin.name)) {
18552
- cacheable = false;
18553
- }
18554
- else {
18555
- existingPluginNames.add(plugin.name);
18556
- }
18557
- }
18558
- let cacheInstance;
18559
- if (!pluginCache) {
18560
- cacheInstance = NO_CACHE;
18561
- }
18562
- else if (cacheable) {
18563
- const cacheKey = plugin.cacheKey || plugin.name;
18564
- cacheInstance = createPluginCache(pluginCache[cacheKey] || (pluginCache[cacheKey] = Object.create(null)));
18565
+ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, existingPluginNames) {
18566
+ let cacheable = true;
18567
+ if (typeof plugin.cacheKey !== 'string') {
18568
+ if (plugin.name.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
18569
+ plugin.name.startsWith(ANONYMOUS_OUTPUT_PLUGIN_PREFIX) ||
18570
+ existingPluginNames.has(plugin.name)) {
18571
+ cacheable = false;
18565
18572
  }
18566
18573
  else {
18567
- cacheInstance = getCacheForUncacheablePlugin(plugin.name);
18574
+ existingPluginNames.add(plugin.name);
18568
18575
  }
18569
- const context = {
18570
- addWatchFile(id) {
18571
- if (graph.phase >= BuildPhase.GENERATE) {
18572
- return this.error(errInvalidRollupPhaseForAddWatchFile());
18573
- }
18574
- graph.watchFiles[id] = true;
18575
- },
18576
- cache: cacheInstance,
18577
- emitAsset: getDeprecatedContextHandler((name, source) => fileEmitter.emitFile({ type: 'asset', name, source }), 'emitAsset', 'emitFile', plugin.name, true, options),
18578
- emitChunk: getDeprecatedContextHandler((id, options) => fileEmitter.emitFile({ type: 'chunk', id, name: options && options.name }), 'emitChunk', 'emitFile', plugin.name, true, options),
18579
- emitFile: fileEmitter.emitFile,
18580
- error(err) {
18581
- return throwPluginError(err, plugin.name);
18582
- },
18583
- getAssetFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getAssetFileName', 'getFileName', plugin.name, true, options),
18584
- getChunkFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getChunkFileName', 'getFileName', plugin.name, true, options),
18585
- getFileName: fileEmitter.getFileName,
18586
- getModuleIds: () => graph.modulesById.keys(),
18587
- getModuleInfo: graph.getModuleInfo,
18588
- getWatchFiles: () => Object.keys(graph.watchFiles),
18589
- isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
18590
- meta: {
18591
- rollupVersion: version$1,
18592
- watchMode: graph.watchMode
18593
- },
18594
- get moduleIds() {
18595
- function* wrappedModuleIds() {
18596
- warnDeprecation({
18597
- message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
18598
- plugin: plugin.name
18599
- }, false, options);
18600
- yield* moduleIds;
18601
- }
18602
- const moduleIds = graph.modulesById.keys();
18603
- return wrappedModuleIds();
18604
- },
18605
- parse: graph.contextParse.bind(graph),
18606
- resolve(source, importer, { custom, skipSelf } = BLANK) {
18607
- return graph.moduleLoader.resolveId(source, importer, custom, skipSelf ? pidx : null);
18608
- },
18609
- resolveId: getDeprecatedContextHandler((source, importer) => graph.moduleLoader
18610
- .resolveId(source, importer, BLANK)
18611
- .then(resolveId => resolveId && resolveId.id), 'resolveId', 'resolve', plugin.name, true, options),
18612
- setAssetSource: fileEmitter.setAssetSource,
18613
- warn(warning) {
18614
- if (typeof warning === 'string')
18615
- warning = { message: warning };
18616
- if (warning.code)
18617
- warning.pluginCode = warning.code;
18618
- warning.code = 'PLUGIN_WARNING';
18619
- warning.plugin = plugin.name;
18620
- options.onwarn(warning);
18576
+ }
18577
+ let cacheInstance;
18578
+ if (!pluginCache) {
18579
+ cacheInstance = NO_CACHE;
18580
+ }
18581
+ else if (cacheable) {
18582
+ const cacheKey = plugin.cacheKey || plugin.name;
18583
+ cacheInstance = createPluginCache(pluginCache[cacheKey] || (pluginCache[cacheKey] = Object.create(null)));
18584
+ }
18585
+ else {
18586
+ cacheInstance = getCacheForUncacheablePlugin(plugin.name);
18587
+ }
18588
+ const context = {
18589
+ addWatchFile(id) {
18590
+ if (graph.phase >= BuildPhase.GENERATE) {
18591
+ return this.error(errInvalidRollupPhaseForAddWatchFile());
18621
18592
  }
18622
- };
18623
- return context;
18593
+ graph.watchFiles[id] = true;
18594
+ },
18595
+ cache: cacheInstance,
18596
+ emitAsset: getDeprecatedContextHandler((name, source) => fileEmitter.emitFile({ type: 'asset', name, source }), 'emitAsset', 'emitFile', plugin.name, true, options),
18597
+ emitChunk: getDeprecatedContextHandler((id, options) => fileEmitter.emitFile({ type: 'chunk', id, name: options && options.name }), 'emitChunk', 'emitFile', plugin.name, true, options),
18598
+ emitFile: fileEmitter.emitFile,
18599
+ error(err) {
18600
+ return throwPluginError(err, plugin.name);
18601
+ },
18602
+ getAssetFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getAssetFileName', 'getFileName', plugin.name, true, options),
18603
+ getChunkFileName: getDeprecatedContextHandler(fileEmitter.getFileName, 'getChunkFileName', 'getFileName', plugin.name, true, options),
18604
+ getFileName: fileEmitter.getFileName,
18605
+ getModuleIds: () => graph.modulesById.keys(),
18606
+ getModuleInfo: graph.getModuleInfo,
18607
+ getWatchFiles: () => Object.keys(graph.watchFiles),
18608
+ isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
18609
+ meta: {
18610
+ rollupVersion: version$1,
18611
+ watchMode: graph.watchMode
18612
+ },
18613
+ get moduleIds() {
18614
+ function* wrappedModuleIds() {
18615
+ warnDeprecation({
18616
+ message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
18617
+ plugin: plugin.name
18618
+ }, false, options);
18619
+ yield* moduleIds;
18620
+ }
18621
+ const moduleIds = graph.modulesById.keys();
18622
+ return wrappedModuleIds();
18623
+ },
18624
+ parse: graph.contextParse.bind(graph),
18625
+ resolve(source, importer, { custom, skipSelf } = BLANK) {
18626
+ return graph.moduleLoader.resolveId(source, importer, custom, skipSelf ? [{ importer, plugin, source }] : null);
18627
+ },
18628
+ resolveId: getDeprecatedContextHandler((source, importer) => graph.moduleLoader
18629
+ .resolveId(source, importer, BLANK)
18630
+ .then(resolveId => resolveId && resolveId.id), 'resolveId', 'resolve', plugin.name, true, options),
18631
+ setAssetSource: fileEmitter.setAssetSource,
18632
+ warn(warning) {
18633
+ if (typeof warning === 'string')
18634
+ warning = { message: warning };
18635
+ if (warning.code)
18636
+ warning.pluginCode = warning.code;
18637
+ warning.code = 'PLUGIN_WARNING';
18638
+ warning.plugin = plugin.name;
18639
+ options.onwarn(warning);
18640
+ }
18624
18641
  };
18642
+ return context;
18625
18643
  }
18626
18644
 
18627
18645
  const inputHookNames = {
@@ -18648,6 +18666,7 @@ class PluginDriver {
18648
18666
  constructor(graph, options, userPlugins, pluginCache, basePluginDriver) {
18649
18667
  this.graph = graph;
18650
18668
  this.options = options;
18669
+ this.pluginContexts = new Map();
18651
18670
  warnDeprecatedHooks(userPlugins, options);
18652
18671
  this.pluginCache = pluginCache;
18653
18672
  this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
@@ -18656,7 +18675,10 @@ class PluginDriver {
18656
18675
  this.finaliseAssets = this.fileEmitter.assertAssetsFinalized;
18657
18676
  this.setOutputBundle = this.fileEmitter.setOutputBundle;
18658
18677
  this.plugins = userPlugins.concat(basePluginDriver ? basePluginDriver.plugins : []);
18659
- this.pluginContexts = this.plugins.map(getPluginContexts(pluginCache, graph, options, this.fileEmitter));
18678
+ const existingPluginNames = new Set();
18679
+ for (const plugin of this.plugins) {
18680
+ this.pluginContexts.set(plugin, getPluginContext(plugin, pluginCache, graph, options, this.fileEmitter, existingPluginNames));
18681
+ }
18660
18682
  if (basePluginDriver) {
18661
18683
  for (const plugin of userPlugins) {
18662
18684
  for (const hook of inputHooks) {
@@ -18671,23 +18693,23 @@ class PluginDriver {
18671
18693
  return new PluginDriver(this.graph, this.options, plugins, this.pluginCache, this);
18672
18694
  }
18673
18695
  // chains, first non-null result stops and returns
18674
- hookFirst(hookName, args, replaceContext, skip) {
18696
+ hookFirst(hookName, args, replaceContext, skipped) {
18675
18697
  let promise = Promise.resolve(undefined);
18676
- for (let i = 0; i < this.plugins.length; i++) {
18677
- if (skip === i)
18698
+ for (const plugin of this.plugins) {
18699
+ if (skipped && skipped.has(plugin))
18678
18700
  continue;
18679
18701
  promise = promise.then(result => {
18680
18702
  if (result != null)
18681
18703
  return result;
18682
- return this.runHook(hookName, args, i, false, replaceContext);
18704
+ return this.runHook(hookName, args, plugin, false, replaceContext);
18683
18705
  });
18684
18706
  }
18685
18707
  return promise;
18686
18708
  }
18687
18709
  // chains synchronously, first non-null result stops and returns
18688
18710
  hookFirstSync(hookName, args, replaceContext) {
18689
- for (let i = 0; i < this.plugins.length; i++) {
18690
- const result = this.runHookSync(hookName, args, i, replaceContext);
18711
+ for (const plugin of this.plugins) {
18712
+ const result = this.runHookSync(hookName, args, plugin, replaceContext);
18691
18713
  if (result != null)
18692
18714
  return result;
18693
18715
  }
@@ -18696,8 +18718,8 @@ class PluginDriver {
18696
18718
  // parallel, ignores returns
18697
18719
  hookParallel(hookName, args, replaceContext) {
18698
18720
  const promises = [];
18699
- for (let i = 0; i < this.plugins.length; i++) {
18700
- const hookPromise = this.runHook(hookName, args, i, false, replaceContext);
18721
+ for (const plugin of this.plugins) {
18722
+ const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
18701
18723
  if (!hookPromise)
18702
18724
  continue;
18703
18725
  promises.push(hookPromise);
@@ -18707,35 +18729,35 @@ class PluginDriver {
18707
18729
  // chains, reduces returned value, handling the reduced value as the first hook argument
18708
18730
  hookReduceArg0(hookName, [arg0, ...rest], reduce, replaceContext) {
18709
18731
  let promise = Promise.resolve(arg0);
18710
- for (let i = 0; i < this.plugins.length; i++) {
18732
+ for (const plugin of this.plugins) {
18711
18733
  promise = promise.then(arg0 => {
18712
18734
  const args = [arg0, ...rest];
18713
- const hookPromise = this.runHook(hookName, args, i, false, replaceContext);
18735
+ const hookPromise = this.runHook(hookName, args, plugin, false, replaceContext);
18714
18736
  if (!hookPromise)
18715
18737
  return arg0;
18716
- return hookPromise.then(result => reduce.call(this.pluginContexts[i], arg0, result, this.plugins[i]));
18738
+ return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin));
18717
18739
  });
18718
18740
  }
18719
18741
  return promise;
18720
18742
  }
18721
18743
  // chains synchronously, reduces returned value, handling the reduced value as the first hook argument
18722
18744
  hookReduceArg0Sync(hookName, [arg0, ...rest], reduce, replaceContext) {
18723
- for (let i = 0; i < this.plugins.length; i++) {
18745
+ for (const plugin of this.plugins) {
18724
18746
  const args = [arg0, ...rest];
18725
- const result = this.runHookSync(hookName, args, i, replaceContext);
18726
- arg0 = reduce.call(this.pluginContexts[i], arg0, result, this.plugins[i]);
18747
+ const result = this.runHookSync(hookName, args, plugin, replaceContext);
18748
+ arg0 = reduce.call(this.pluginContexts.get(plugin), arg0, result, plugin);
18727
18749
  }
18728
18750
  return arg0;
18729
18751
  }
18730
18752
  // chains, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
18731
18753
  hookReduceValue(hookName, initialValue, args, reduce, replaceContext) {
18732
18754
  let promise = Promise.resolve(initialValue);
18733
- for (let i = 0; i < this.plugins.length; i++) {
18755
+ for (const plugin of this.plugins) {
18734
18756
  promise = promise.then(value => {
18735
- const hookPromise = this.runHook(hookName, args, i, true, replaceContext);
18757
+ const hookPromise = this.runHook(hookName, args, plugin, true, replaceContext);
18736
18758
  if (!hookPromise)
18737
18759
  return value;
18738
- return hookPromise.then(result => reduce.call(this.pluginContexts[i], value, result, this.plugins[i]));
18760
+ return hookPromise.then(result => reduce.call(this.pluginContexts.get(plugin), value, result, plugin));
18739
18761
  });
18740
18762
  }
18741
18763
  return promise;
@@ -18743,32 +18765,31 @@ class PluginDriver {
18743
18765
  // chains synchronously, reduces returned value to type T, handling the reduced value separately. permits hooks as values.
18744
18766
  hookReduceValueSync(hookName, initialValue, args, reduce, replaceContext) {
18745
18767
  let acc = initialValue;
18746
- for (let i = 0; i < this.plugins.length; i++) {
18747
- const result = this.runHookSync(hookName, args, i, replaceContext);
18748
- acc = reduce.call(this.pluginContexts[i], acc, result, this.plugins[i]);
18768
+ for (const plugin of this.plugins) {
18769
+ const result = this.runHookSync(hookName, args, plugin, replaceContext);
18770
+ acc = reduce.call(this.pluginContexts.get(plugin), acc, result, plugin);
18749
18771
  }
18750
18772
  return acc;
18751
18773
  }
18752
18774
  // chains, ignores returns
18753
18775
  hookSeq(hookName, args, replaceContext) {
18754
18776
  let promise = Promise.resolve();
18755
- for (let i = 0; i < this.plugins.length; i++) {
18756
- promise = promise.then(() => this.runHook(hookName, args, i, false, replaceContext));
18777
+ for (const plugin of this.plugins) {
18778
+ promise = promise.then(() => this.runHook(hookName, args, plugin, false, replaceContext));
18757
18779
  }
18758
18780
  return promise;
18759
18781
  }
18760
18782
  // chains synchronously, ignores returns
18761
18783
  hookSeqSync(hookName, args, replaceContext) {
18762
- for (let i = 0; i < this.plugins.length; i++) {
18763
- this.runHookSync(hookName, args, i, replaceContext);
18784
+ for (const plugin of this.plugins) {
18785
+ this.runHookSync(hookName, args, plugin, replaceContext);
18764
18786
  }
18765
18787
  }
18766
- runHook(hookName, args, pluginIndex, permitValues, hookContext) {
18767
- const plugin = this.plugins[pluginIndex];
18788
+ runHook(hookName, args, plugin, permitValues, hookContext) {
18768
18789
  const hook = plugin[hookName];
18769
18790
  if (!hook)
18770
18791
  return undefined;
18771
- let context = this.pluginContexts[pluginIndex];
18792
+ let context = this.pluginContexts.get(plugin);
18772
18793
  if (hookContext) {
18773
18794
  context = hookContext(context, plugin);
18774
18795
  }
@@ -18788,15 +18809,14 @@ class PluginDriver {
18788
18809
  * Run a sync plugin hook and return the result.
18789
18810
  * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
18790
18811
  * @param args Arguments passed to the plugin hook.
18791
- * @param pluginIndex Index of the plugin inside `this.plugins[]`.
18812
+ * @param plugin The acutal plugin
18792
18813
  * @param hookContext When passed, the plugin context can be overridden.
18793
18814
  */
18794
- runHookSync(hookName, args, pluginIndex, hookContext) {
18795
- const plugin = this.plugins[pluginIndex];
18815
+ runHookSync(hookName, args, plugin, hookContext) {
18796
18816
  const hook = plugin[hookName];
18797
18817
  if (!hook)
18798
18818
  return undefined;
18799
- let context = this.pluginContexts[pluginIndex];
18819
+ let context = this.pluginContexts.get(plugin);
18800
18820
  if (hookContext) {
18801
18821
  context = hookContext(context, plugin);
18802
18822
  }
@@ -19104,7 +19124,7 @@ function markPureNode(node, comment) {
19104
19124
  else {
19105
19125
  node._rollupAnnotations = [{ comment }];
19106
19126
  }
19107
- if (node.type === ExpressionStatement$1) {
19127
+ while (node.type === ExpressionStatement$1 || node.type === ChainExpression$1) {
19108
19128
  node = node.expression;
19109
19129
  }
19110
19130
  if (node.type === CallExpression$1 || node.type === NewExpression$1) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.41.5
4
- Thu, 18 Mar 2021 05:07:55 GMT - commit e2ae914dfe84fd9601743e7ce15841bb483146c4
3
+ Rollup.js v2.42.3
4
+ Mon, 22 Mar 2021 14:48:44 GMT - commit f67e6c9b2cb4066f2ddcdb6d45308f840b2ac62f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.41.5",
3
+ "version": "2.42.3",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",