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/rollup.d.ts CHANGED
@@ -553,6 +553,8 @@ export interface InputOptions {
553
553
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
554
554
  /** @deprecated Use the "manualChunks" output option instead. */
555
555
  manualChunks?: ManualChunksOption;
556
+ maxParallelFileOps?: number;
557
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
556
558
  maxParallelFileReads?: number;
557
559
  moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
558
560
  onwarn?: WarningHandlerWithDefault;
@@ -581,6 +583,8 @@ export interface NormalizedInputOptions {
581
583
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
582
584
  /** @deprecated Use the "manualChunks" output option instead. */
583
585
  manualChunks: ManualChunksOption | undefined;
586
+ maxParallelFileOps: number;
587
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
584
588
  maxParallelFileReads: number;
585
589
  moduleContext: (id: string) => string;
586
590
  onwarn: WarningHandler;
package/dist/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,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,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,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
 
@@ -73,6 +73,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
73
73
  input: getOption('input') || [],
74
74
  makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
75
75
  manualChunks: getOption('manualChunks'),
76
+ maxParallelFileOps: getOption('maxParallelFileOps'),
76
77
  maxParallelFileReads: getOption('maxParallelFileReads'),
77
78
  moduleContext: getOption('moduleContext'),
78
79
  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
 
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
27
27
  return n;
28
28
  }
29
29
 
30
- var version$1 = "2.76.0";
30
+ var version$1 = "2.77.0";
31
31
 
32
32
  function ensureArray$1(items) {
33
33
  if (Array.isArray(items)) {
@@ -9105,10 +9105,6 @@ class CallExpression extends CallExpressionBase {
9105
9105
  this.callee.include(context, false);
9106
9106
  }
9107
9107
  this.callee.includeCallArguments(context, this.arguments);
9108
- const returnExpression = this.getReturnExpression();
9109
- if (!returnExpression.included) {
9110
- returnExpression.include(context, false);
9111
- }
9112
9108
  }
9113
9109
  render(code, options, { renderedSurroundingElement } = BLANK) {
9114
9110
  this.callee.render(code, options, {
@@ -9478,15 +9474,6 @@ class MultiExpression extends ExpressionEntity {
9478
9474
  }
9479
9475
  return false;
9480
9476
  }
9481
- include(context, includeChildrenRecursively) {
9482
- // This is only relevant to include values that do not have an AST representation,
9483
- // such as UnknownArrayExpression. Thus we only need to include them once.
9484
- for (const expression of this.expressions) {
9485
- if (!expression.included) {
9486
- expression.include(context, includeChildrenRecursively);
9487
- }
9488
- }
9489
- }
9490
9477
  }
9491
9478
 
9492
9479
  class ConditionalExpression extends NodeBase {
@@ -21832,37 +21819,6 @@ Parser.acorn = {
21832
21819
  nonASCIIwhitespace: nonASCIIwhitespace
21833
21820
  };
21834
21821
 
21835
- class Queue {
21836
- constructor(maxParallel) {
21837
- this.maxParallel = maxParallel;
21838
- this.queue = [];
21839
- this.workerCount = 0;
21840
- }
21841
- run(task) {
21842
- return new Promise((resolve, reject) => {
21843
- this.queue.push({ reject, resolve, task });
21844
- this.work();
21845
- });
21846
- }
21847
- async work() {
21848
- if (this.workerCount >= this.maxParallel)
21849
- return;
21850
- this.workerCount++;
21851
- let entry;
21852
- while ((entry = this.queue.shift())) {
21853
- const { reject, resolve, task } = entry;
21854
- try {
21855
- const result = await task();
21856
- resolve(result);
21857
- }
21858
- catch (err) {
21859
- reject(err);
21860
- }
21861
- }
21862
- this.workerCount--;
21863
- }
21864
- }
21865
-
21866
21822
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
21867
21823
  let skipped = null;
21868
21824
  let replaceContext = null;
@@ -22189,7 +22145,6 @@ class ModuleLoader {
22189
22145
  this.hasModuleSideEffects = options.treeshake
22190
22146
  ? options.treeshake.moduleSideEffects
22191
22147
  : () => true;
22192
- this.readQueue = new Queue(options.maxParallelFileReads);
22193
22148
  }
22194
22149
  async addAdditionalModules(unresolvedModules) {
22195
22150
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -22268,7 +22223,7 @@ class ModuleLoader {
22268
22223
  timeStart('load modules', 3);
22269
22224
  let source;
22270
22225
  try {
22271
- source = await this.readQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await require$$0$1.promises.readFile(id, 'utf8')); });
22226
+ source = await this.graph.fileOperationQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await require$$0$1.promises.readFile(id, 'utf8')); });
22272
22227
  }
22273
22228
  catch (err) {
22274
22229
  timeEnd('load modules', 3);
@@ -22925,6 +22880,37 @@ class PluginDriver {
22925
22880
  }
22926
22881
  }
22927
22882
 
22883
+ class Queue {
22884
+ constructor(maxParallel) {
22885
+ this.maxParallel = maxParallel;
22886
+ this.queue = [];
22887
+ this.workerCount = 0;
22888
+ }
22889
+ run(task) {
22890
+ return new Promise((resolve, reject) => {
22891
+ this.queue.push({ reject, resolve, task });
22892
+ this.work();
22893
+ });
22894
+ }
22895
+ async work() {
22896
+ if (this.workerCount >= this.maxParallel)
22897
+ return;
22898
+ this.workerCount++;
22899
+ let entry;
22900
+ while ((entry = this.queue.shift())) {
22901
+ const { reject, resolve, task } = entry;
22902
+ try {
22903
+ const result = await task();
22904
+ resolve(result);
22905
+ }
22906
+ catch (err) {
22907
+ reject(err);
22908
+ }
22909
+ }
22910
+ this.workerCount--;
22911
+ }
22912
+ }
22913
+
22928
22914
  function normalizeEntryModules(entryModules) {
22929
22915
  if (Array.isArray(entryModules)) {
22930
22916
  return entryModules.map(id => ({
@@ -22988,6 +22974,7 @@ class Graph {
22988
22974
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
22989
22975
  this.acornParser = Parser.extend(...options.acornInjectPlugins);
22990
22976
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
22977
+ this.fileOperationQueue = new Queue(options.maxParallelFileOps);
22991
22978
  }
22992
22979
  async build() {
22993
22980
  timeStart('generate module graph', 2);
@@ -23184,6 +23171,7 @@ function normalizeInputOptions(config) {
23184
23171
  const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
23185
23172
  const onwarn = getOnwarn(config);
23186
23173
  const strictDeprecations = config.strictDeprecations || false;
23174
+ const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
23187
23175
  const options = {
23188
23176
  acorn: getAcorn(config),
23189
23177
  acornInjectPlugins: getAcornInjectPlugins(config),
@@ -23195,7 +23183,8 @@ function normalizeInputOptions(config) {
23195
23183
  input: getInput(config),
23196
23184
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
23197
23185
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
23198
- maxParallelFileReads: getMaxParallelFileReads(config),
23186
+ maxParallelFileOps,
23187
+ maxParallelFileReads: maxParallelFileOps,
23199
23188
  moduleContext: getModuleContext(config, context),
23200
23189
  onwarn,
23201
23190
  perf: config.perf || false,
@@ -23276,12 +23265,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
23276
23265
  }
23277
23266
  return configManualChunks;
23278
23267
  };
23279
- const getMaxParallelFileReads = (config) => {
23268
+ const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
23269
+ var _a;
23280
23270
  const maxParallelFileReads = config.maxParallelFileReads;
23281
23271
  if (typeof maxParallelFileReads === 'number') {
23282
- if (maxParallelFileReads <= 0)
23272
+ warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', false, warn, strictDeprecations);
23273
+ }
23274
+ const maxParallelFileOps = (_a = config.maxParallelFileOps) !== null && _a !== void 0 ? _a : maxParallelFileReads;
23275
+ if (typeof maxParallelFileOps === 'number') {
23276
+ if (maxParallelFileOps <= 0)
23283
23277
  return Infinity;
23284
- return maxParallelFileReads;
23278
+ return maxParallelFileOps;
23285
23279
  }
23286
23280
  return 20;
23287
23281
  };
@@ -23757,7 +23751,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
23757
23751
  message: 'You must specify "output.file" or "output.dir" for the build.'
23758
23752
  });
23759
23753
  }
23760
- await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
23754
+ await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
23761
23755
  await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
23762
23756
  }
23763
23757
  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
 
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.76.0",
3
+ "version": "2.77.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",