rollup 2.52.8 → 2.53.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
@@ -537,6 +537,7 @@ export interface InputOptions {
537
537
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
538
538
  /** @deprecated Use the "manualChunks" output option instead. */
539
539
  manualChunks?: ManualChunksOption;
540
+ maxParallelFileReads?: number;
540
541
  moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
541
542
  onwarn?: WarningHandlerWithDefault;
542
543
  perf?: boolean;
@@ -564,6 +565,7 @@ export interface NormalizedInputOptions {
564
565
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
565
566
  /** @deprecated Use the "manualChunks" output option instead. */
566
567
  manualChunks: ManualChunksOption | undefined;
568
+ maxParallelFileReads: number;
567
569
  moduleContext: (id: string) => string;
568
570
  onwarn: WarningHandler;
569
571
  perf: boolean;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -74,6 +74,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
74
74
  input: getOption('input') || [],
75
75
  makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
76
76
  manualChunks: getOption('manualChunks'),
77
+ maxParallelFileReads: getOption('maxParallelFileReads'),
77
78
  moduleContext: getOption('moduleContext'),
78
79
  onwarn: getOnWarn(config, defaultOnWarnHandler),
79
80
  perf: getOption('perf'),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -19,20 +19,7 @@ function _interopNamespaceDefaultOnly(e) {
19
19
  return {__proto__: null, 'default': e};
20
20
  }
21
21
 
22
- function _interopNamespaceDefault(e) {
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- n[k] = e[k];
27
- });
28
- }
29
- n['default'] = e;
30
- return n;
31
- }
32
-
33
- var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
-
35
- var version$1 = "2.52.8";
22
+ var version$1 = "2.53.0";
36
23
 
37
24
  function ensureArray(items) {
38
25
  if (Array.isArray(items)) {
@@ -19164,16 +19151,16 @@ Parser.acorn = {
19164
19151
  nonASCIIwhitespace: nonASCIIwhitespace
19165
19152
  };
19166
19153
 
19167
- const readFile = (file) => new Promise((fulfil, reject) => fs__namespace.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19154
+ const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
19168
19155
  function mkdirpath(path$1) {
19169
19156
  const dir = path.dirname(path$1);
19170
19157
  try {
19171
- fs__namespace.readdirSync(dir);
19158
+ fs.readdirSync(dir);
19172
19159
  }
19173
19160
  catch (err) {
19174
19161
  mkdirpath(dir);
19175
19162
  try {
19176
- fs__namespace.mkdirSync(dir);
19163
+ fs.mkdirSync(dir);
19177
19164
  }
19178
19165
  catch (err2) {
19179
19166
  if (err2.code !== 'EEXIST') {
@@ -19185,7 +19172,7 @@ function mkdirpath(path$1) {
19185
19172
  function writeFile(dest, data) {
19186
19173
  return new Promise((fulfil, reject) => {
19187
19174
  mkdirpath(dest);
19188
- fs__namespace.writeFile(dest, data, err => {
19175
+ fs.writeFile(dest, data, err => {
19189
19176
  if (err) {
19190
19177
  reject(err);
19191
19178
  }
@@ -19196,6 +19183,37 @@ function writeFile(dest, data) {
19196
19183
  });
19197
19184
  }
19198
19185
 
19186
+ class Queue {
19187
+ constructor(maxParallel = 1) {
19188
+ this.maxParallel = maxParallel;
19189
+ this.queue = new Array();
19190
+ this.workerCount = 0;
19191
+ }
19192
+ run(task) {
19193
+ return new Promise((resolve, reject) => {
19194
+ this.queue.push({ reject, resolve, task });
19195
+ this.work();
19196
+ });
19197
+ }
19198
+ async work() {
19199
+ if (this.workerCount >= this.maxParallel)
19200
+ return;
19201
+ this.workerCount++;
19202
+ let entry;
19203
+ while ((entry = this.queue.shift())) {
19204
+ const { reject, resolve, task } = entry;
19205
+ try {
19206
+ const result = await task();
19207
+ resolve(result);
19208
+ }
19209
+ catch (err) {
19210
+ reject(err);
19211
+ }
19212
+ }
19213
+ this.workerCount--;
19214
+ }
19215
+ }
19216
+
19199
19217
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
19200
19218
  let skipped = null;
19201
19219
  let replaceContext = null;
@@ -19515,6 +19533,7 @@ class ModuleLoader {
19515
19533
  this.indexedEntryModules = [];
19516
19534
  this.latestLoadModulesPromise = Promise.resolve();
19517
19535
  this.nextEntryModuleIndex = 0;
19536
+ this.readQueue = new Queue();
19518
19537
  this.resolveId = async (source, importer, customOptions, skip = null) => {
19519
19538
  return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
19520
19539
  ? false
@@ -19523,6 +19542,7 @@ class ModuleLoader {
19523
19542
  this.hasModuleSideEffects = options.treeshake
19524
19543
  ? options.treeshake.moduleSideEffects
19525
19544
  : () => true;
19545
+ this.readQueue.maxParallel = options.maxParallelFileReads;
19526
19546
  }
19527
19547
  async addAdditionalModules(unresolvedModules) {
19528
19548
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -19608,7 +19628,8 @@ class ModuleLoader {
19608
19628
  timeStart('load modules', 3);
19609
19629
  let source;
19610
19630
  try {
19611
- source = (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await readFile(id));
19631
+ source =
19632
+ (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
19612
19633
  }
19613
19634
  catch (err) {
19614
19635
  timeEnd('load modules', 3);
@@ -20397,6 +20418,7 @@ function normalizeInputOptions(config) {
20397
20418
  input: getInput(config),
20398
20419
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
20399
20420
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
20421
+ maxParallelFileReads: getMaxParallelFileReads(config),
20400
20422
  moduleContext: getModuleContext(config, context),
20401
20423
  onwarn,
20402
20424
  perf: config.perf || false,
@@ -20477,6 +20499,15 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
20477
20499
  }
20478
20500
  return configManualChunks;
20479
20501
  };
20502
+ const getMaxParallelFileReads = (config) => {
20503
+ const maxParallelFileReads = config.maxParallelFileReads;
20504
+ if (typeof maxParallelFileReads === 'number') {
20505
+ if (maxParallelFileReads <= 0)
20506
+ return Infinity;
20507
+ return maxParallelFileReads;
20508
+ }
20509
+ return 20;
20510
+ };
20480
20511
  const getModuleContext = (config, context) => {
20481
20512
  const configModuleContext = config.moduleContext;
20482
20513
  if (typeof configModuleContext === 'function') {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.52.8
4
- Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
3
+ Rollup.js v2.53.0
4
+ Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
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.52.8",
3
+ "version": "2.53.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",