rollup 2.76.0 → 2.77.2

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.2
4
+ Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
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.2
4
+ Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
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.2";
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 {
@@ -10272,6 +10259,7 @@ class ImportExpression extends NodeBase {
10272
10259
  }
10273
10260
  setExternalResolution(exportMode, resolution, options, snippets, pluginDriver, accessedGlobalsByScope) {
10274
10261
  const { format } = options;
10262
+ this.inlineNamespace = null;
10275
10263
  this.resolution = resolution;
10276
10264
  const accessedGlobals = [...(accessedImportGlobals[format] || [])];
10277
10265
  let helper;
@@ -13586,7 +13574,7 @@ function trimEmptyImports(dependencies) {
13586
13574
  }
13587
13575
 
13588
13576
  function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
13589
- const { _, cnst, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
13577
+ const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
13590
13578
  const isNamespaced = name && name.includes('.');
13591
13579
  const useVariableAssignment = !extend && !isNamespaced;
13592
13580
  if (name && useVariableAssignment && !isLegal(name)) {
@@ -13625,7 +13613,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
13625
13613
  if (hasExports) {
13626
13614
  if (name && !(extend && namedExportsMode)) {
13627
13615
  wrapperIntro =
13628
- (useVariableAssignment ? `${cnst} ${name}` : `this${keypath(name, getPropertyAccess)}`) +
13616
+ (useVariableAssignment ? `var ${name}` : `this${keypath(name, getPropertyAccess)}`) +
13629
13617
  `${_}=${_}${wrapperIntro}`;
13630
13618
  }
13631
13619
  if (isNamespaced) {
@@ -21701,37 +21689,6 @@ Parser.acorn = {
21701
21689
  nonASCIIwhitespace: nonASCIIwhitespace
21702
21690
  };
21703
21691
 
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
21692
  function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
21736
21693
  let skipped = null;
21737
21694
  let replaceContext = null;
@@ -22058,7 +22015,6 @@ class ModuleLoader {
22058
22015
  this.hasModuleSideEffects = options.treeshake
22059
22016
  ? options.treeshake.moduleSideEffects
22060
22017
  : () => true;
22061
- this.readQueue = new Queue(options.maxParallelFileReads);
22062
22018
  }
22063
22019
  async addAdditionalModules(unresolvedModules) {
22064
22020
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -22137,7 +22093,7 @@ class ModuleLoader {
22137
22093
  timeStart('load modules', 3);
22138
22094
  let source;
22139
22095
  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')); });
22096
+ 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
22097
  }
22142
22098
  catch (err) {
22143
22099
  timeEnd('load modules', 3);
@@ -22794,6 +22750,37 @@ class PluginDriver {
22794
22750
  }
22795
22751
  }
22796
22752
 
22753
+ class Queue {
22754
+ constructor(maxParallel) {
22755
+ this.maxParallel = maxParallel;
22756
+ this.queue = [];
22757
+ this.workerCount = 0;
22758
+ }
22759
+ run(task) {
22760
+ return new Promise((resolve, reject) => {
22761
+ this.queue.push({ reject, resolve, task });
22762
+ this.work();
22763
+ });
22764
+ }
22765
+ async work() {
22766
+ if (this.workerCount >= this.maxParallel)
22767
+ return;
22768
+ this.workerCount++;
22769
+ let entry;
22770
+ while ((entry = this.queue.shift())) {
22771
+ const { reject, resolve, task } = entry;
22772
+ try {
22773
+ const result = await task();
22774
+ resolve(result);
22775
+ }
22776
+ catch (err) {
22777
+ reject(err);
22778
+ }
22779
+ }
22780
+ this.workerCount--;
22781
+ }
22782
+ }
22783
+
22797
22784
  function normalizeEntryModules(entryModules) {
22798
22785
  if (Array.isArray(entryModules)) {
22799
22786
  return entryModules.map(id => ({
@@ -22857,6 +22844,7 @@ class Graph {
22857
22844
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
22858
22845
  this.acornParser = Parser.extend(...options.acornInjectPlugins);
22859
22846
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
22847
+ this.fileOperationQueue = new Queue(options.maxParallelFileOps);
22860
22848
  }
22861
22849
  async build() {
22862
22850
  timeStart('generate module graph', 2);
@@ -23146,6 +23134,7 @@ function normalizeInputOptions(config) {
23146
23134
  const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
23147
23135
  const onwarn = getOnwarn(config);
23148
23136
  const strictDeprecations = config.strictDeprecations || false;
23137
+ const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
23149
23138
  const options = {
23150
23139
  acorn: getAcorn(config),
23151
23140
  acornInjectPlugins: getAcornInjectPlugins(config),
@@ -23157,7 +23146,8 @@ function normalizeInputOptions(config) {
23157
23146
  input: getInput(config),
23158
23147
  makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
23159
23148
  manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
23160
- maxParallelFileReads: getMaxParallelFileReads(config),
23149
+ maxParallelFileOps,
23150
+ maxParallelFileReads: maxParallelFileOps,
23161
23151
  moduleContext: getModuleContext(config, context),
23162
23152
  onwarn,
23163
23153
  perf: config.perf || false,
@@ -23238,12 +23228,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
23238
23228
  }
23239
23229
  return configManualChunks;
23240
23230
  };
23241
- const getMaxParallelFileReads = (config) => {
23231
+ const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
23232
+ var _a;
23242
23233
  const maxParallelFileReads = config.maxParallelFileReads;
23243
23234
  if (typeof maxParallelFileReads === 'number') {
23244
- if (maxParallelFileReads <= 0)
23235
+ warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', false, warn, strictDeprecations);
23236
+ }
23237
+ const maxParallelFileOps = (_a = config.maxParallelFileOps) !== null && _a !== void 0 ? _a : maxParallelFileReads;
23238
+ if (typeof maxParallelFileOps === 'number') {
23239
+ if (maxParallelFileOps <= 0)
23245
23240
  return Infinity;
23246
- return maxParallelFileReads;
23241
+ return maxParallelFileOps;
23247
23242
  }
23248
23243
  return 20;
23249
23244
  };
@@ -23719,7 +23714,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
23719
23714
  message: 'You must specify "output.file" or "output.dir" for the build.'
23720
23715
  });
23721
23716
  }
23722
- await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
23717
+ await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
23723
23718
  await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
23724
23719
  }
23725
23720
  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.2
4
+ Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
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.2
4
+ Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
5
5
 
6
6
  https://github.com/rollup/rollup
7
7