rollup 2.76.0 → 2.77.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.76.0
4
- Fri, 08 Jul 2022 08:35:58 GMT - commit 0eb042740eb41812b9e96e0e7b6ed8aa4cab04a7
3
+ Rollup.js v2.77.0
4
+ Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,20 +1,20 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.76.0
4
- Fri, 08 Jul 2022 08:35:58 GMT - commit 0eb042740eb41812b9e96e0e7b6ed8aa4cab04a7
3
+ Rollup.js v2.77.0
4
+ Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import require$$0, { resolve, extname, basename, dirname, relative as relative$1, win32, posix, isAbsolute as isAbsolute$1 } from 'path';
10
+ import require$$0, { resolve, basename, extname, dirname, relative as relative$1, win32, posix, isAbsolute as isAbsolute$1 } from 'path';
11
11
  import process$1 from 'process';
12
12
  import { performance } from 'perf_hooks';
13
13
  import { createHash as createHash$1 } from 'crypto';
14
14
  import { promises } from 'fs';
15
15
  import { EventEmitter } from 'events';
16
16
 
17
- var version$1 = "2.76.0";
17
+ var version$1 = "2.77.0";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -8974,10 +8974,6 @@ class CallExpression extends CallExpressionBase {
8974
8974
  this.callee.include(context, false);
8975
8975
  }
8976
8976
  this.callee.includeCallArguments(context, this.arguments);
8977
- const returnExpression = this.getReturnExpression();
8978
- if (!returnExpression.included) {
8979
- returnExpression.include(context, false);
8980
- }
8981
8977
  }
8982
8978
  render(code, options, { renderedSurroundingElement } = BLANK) {
8983
8979
  this.callee.render(code, options, {
@@ -9347,15 +9343,6 @@ class MultiExpression extends ExpressionEntity {
9347
9343
  }
9348
9344
  return false;
9349
9345
  }
9350
- include(context, includeChildrenRecursively) {
9351
- // This is only relevant to include values that do not have an AST representation,
9352
- // such as UnknownArrayExpression. Thus we only need to include them once.
9353
- for (const expression of this.expressions) {
9354
- if (!expression.included) {
9355
- expression.include(context, includeChildrenRecursively);
9356
- }
9357
- }
9358
- }
9359
9346
  }
9360
9347
 
9361
9348
  class ConditionalExpression extends NodeBase {
@@ -21701,37 +21688,6 @@ Parser.acorn = {
21701
21688
  nonASCIIwhitespace: nonASCIIwhitespace
21702
21689
  };
21703
21690
 
21704
- class Queue {
21705
- constructor(maxParallel) {
21706
- this.maxParallel = maxParallel;
21707
- this.queue = [];
21708
- this.workerCount = 0;
21709
- }
21710
- run(task) {
21711
- return new Promise((resolve, reject) => {
21712
- this.queue.push({ reject, resolve, task });
21713
- this.work();
21714
- });
21715
- }
21716
- async work() {
21717
- if (this.workerCount >= this.maxParallel)
21718
- return;
21719
- this.workerCount++;
21720
- let entry;
21721
- while ((entry = this.queue.shift())) {
21722
- const { reject, resolve, task } = entry;
21723
- try {
21724
- const result = await task();
21725
- resolve(result);
21726
- }
21727
- catch (err) {
21728
- reject(err);
21729
- }
21730
- }
21731
- this.workerCount--;
21732
- }
21733
- }
21734
-
21735
21691
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
21736
21692
  let skipped = null;
21737
21693
  let replaceContext = null;
@@ -22058,7 +22014,6 @@ class ModuleLoader {
22058
22014
  this.hasModuleSideEffects = options.treeshake
22059
22015
  ? options.treeshake.moduleSideEffects
22060
22016
  : () => true;
22061
- this.readQueue = new Queue(options.maxParallelFileReads);
22062
22017
  }
22063
22018
  async addAdditionalModules(unresolvedModules) {
22064
22019
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -22137,7 +22092,7 @@ class ModuleLoader {
22137
22092
  timeStart('load modules', 3);
22138
22093
  let source;
22139
22094
  try {
22140
- source = await this.readQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await promises.readFile(id, 'utf8')); });
22095
+ source = await this.graph.fileOperationQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await promises.readFile(id, 'utf8')); });
22141
22096
  }
22142
22097
  catch (err) {
22143
22098
  timeEnd('load modules', 3);
@@ -22794,6 +22749,37 @@ class PluginDriver {
22794
22749
  }
22795
22750
  }
22796
22751
 
22752
+ class Queue {
22753
+ constructor(maxParallel) {
22754
+ this.maxParallel = maxParallel;
22755
+ this.queue = [];
22756
+ this.workerCount = 0;
22757
+ }
22758
+ run(task) {
22759
+ return new Promise((resolve, reject) => {
22760
+ this.queue.push({ reject, resolve, task });
22761
+ this.work();
22762
+ });
22763
+ }
22764
+ async work() {
22765
+ if (this.workerCount >= this.maxParallel)
22766
+ return;
22767
+ this.workerCount++;
22768
+ let entry;
22769
+ while ((entry = this.queue.shift())) {
22770
+ const { reject, resolve, task } = entry;
22771
+ try {
22772
+ const result = await task();
22773
+ resolve(result);
22774
+ }
22775
+ catch (err) {
22776
+ reject(err);
22777
+ }
22778
+ }
22779
+ this.workerCount--;
22780
+ }
22781
+ }
22782
+
22797
22783
  function normalizeEntryModules(entryModules) {
22798
22784
  if (Array.isArray(entryModules)) {
22799
22785
  return entryModules.map(id => ({
@@ -22857,6 +22843,7 @@ class Graph {
22857
22843
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
22858
22844
  this.acornParser = Parser.extend(...options.acornInjectPlugins);
22859
22845
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
22846
+ this.fileOperationQueue = new Queue(options.maxParallelFileOps);
22860
22847
  }
22861
22848
  async build() {
22862
22849
  timeStart('generate module graph', 2);
@@ -23146,6 +23133,7 @@ function normalizeInputOptions(config) {
23146
23133
  const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
23147
23134
  const onwarn = getOnwarn(config);
23148
23135
  const strictDeprecations = config.strictDeprecations || false;
23136
+ const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
23149
23137
  const options = {
23150
23138
  acorn: getAcorn(config),
23151
23139
  acornInjectPlugins: getAcornInjectPlugins(config),
@@ -23157,7 +23145,8 @@ function normalizeInputOptions(config) {
23157
23145
  input: getInput(config),
23158
23146
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
23159
23147
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
23160
- maxParallelFileReads: getMaxParallelFileReads(config),
23148
+ maxParallelFileOps,
23149
+ maxParallelFileReads: maxParallelFileOps,
23161
23150
  moduleContext: getModuleContext(config, context),
23162
23151
  onwarn,
23163
23152
  perf: config.perf || false,
@@ -23238,12 +23227,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
23238
23227
  }
23239
23228
  return configManualChunks;
23240
23229
  };
23241
- const getMaxParallelFileReads = (config) => {
23230
+ const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
23231
+ var _a;
23242
23232
  const maxParallelFileReads = config.maxParallelFileReads;
23243
23233
  if (typeof maxParallelFileReads === 'number') {
23244
- if (maxParallelFileReads <= 0)
23234
+ warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', false, warn, strictDeprecations);
23235
+ }
23236
+ const maxParallelFileOps = (_a = config.maxParallelFileOps) !== null && _a !== void 0 ? _a : maxParallelFileReads;
23237
+ if (typeof maxParallelFileOps === 'number') {
23238
+ if (maxParallelFileOps <= 0)
23245
23239
  return Infinity;
23246
- return maxParallelFileReads;
23240
+ return maxParallelFileOps;
23247
23241
  }
23248
23242
  return 20;
23249
23243
  };
@@ -23719,7 +23713,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
23719
23713
  message: 'You must specify "output.file" or "output.dir" for the build.'
23720
23714
  });
23721
23715
  }
23722
- await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
23716
+ await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
23723
23717
  await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
23724
23718
  }
23725
23719
  return createOutput(generated);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.76.0
4
- Fri, 08 Jul 2022 08:35:58 GMT - commit 0eb042740eb41812b9e96e0e7b6ed8aa4cab04a7
3
+ Rollup.js v2.77.0
4
+ Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -80,6 +80,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
80
80
  input: getOption('input') || [],
81
81
  makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
82
82
  manualChunks: getOption('manualChunks'),
83
+ maxParallelFileOps: getOption('maxParallelFileOps'),
83
84
  maxParallelFileReads: getOption('maxParallelFileReads'),
84
85
  moduleContext: getOption('moduleContext'),
85
86
  onwarn: getOnWarn(config, defaultOnWarnHandler),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.76.0
4
- Fri, 08 Jul 2022 08:35:58 GMT - commit 0eb042740eb41812b9e96e0e7b6ed8aa4cab04a7
3
+ Rollup.js v2.77.0
4
+ Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7