rollup 2.67.0 → 2.67.1

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.67.0
4
- Wed, 02 Feb 2022 06:19:08 GMT - commit 61d772ba59be605e53e72613ae51cee4b72aee64
3
+ Rollup.js v2.67.1
4
+ Mon, 07 Feb 2022 05:29:30 GMT - commit efd71e930e86ab30f4911ed8caa7f78aca005729
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.67.0
4
- Wed, 02 Feb 2022 06:19:08 GMT - commit 61d772ba59be605e53e72613ae51cee4b72aee64
3
+ Rollup.js v2.67.1
4
+ Mon, 07 Feb 2022 05:29:30 GMT - commit efd71e930e86ab30f4911ed8caa7f78aca005729
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -12,10 +12,10 @@ import require$$0, { relative as relative$1, resolve, extname, basename, win32,
12
12
  import process$1 from 'process';
13
13
  import { performance } from 'perf_hooks';
14
14
  import { createHash as createHash$1 } from 'crypto';
15
- import { lstatSync, realpathSync, readdirSync, promises } from 'fs';
15
+ import { promises } from 'fs';
16
16
  import { EventEmitter } from 'events';
17
17
 
18
- var version$1 = "2.67.0";
18
+ var version$1 = "2.67.1";
19
19
 
20
20
  var charToInteger = {};
21
21
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -12190,7 +12190,7 @@ class Module {
12190
12190
  this.alternativeReexportModules = new Map();
12191
12191
  this.ast = null;
12192
12192
  this.chunkFileNames = new Set();
12193
- this.chunkName = null;
12193
+ this.chunkNames = [];
12194
12194
  this.cycles = new Set();
12195
12195
  this.dependencies = new Set();
12196
12196
  this.dynamicDependencies = new Set();
@@ -12213,7 +12213,6 @@ class Module {
12213
12213
  this.reexportDescriptions = Object.create(null);
12214
12214
  this.sideEffectDependenciesByVariable = new Map();
12215
12215
  this.sources = new Set();
12216
- this.userChunkNames = new Set();
12217
12216
  this.usesTopLevelAwait = false;
12218
12217
  this.allExportNames = null;
12219
12218
  this.exportAllModules = [];
@@ -13001,12 +13000,10 @@ function removeJsExtension(name) {
13001
13000
  }
13002
13001
 
13003
13002
  function getCompleteAmdId(options, chunkId) {
13004
- if (!options.autoId) {
13005
- return options.id || '';
13006
- }
13007
- else {
13003
+ if (options.autoId) {
13008
13004
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
13009
13005
  }
13006
+ return options.id || '';
13010
13007
  }
13011
13008
 
13012
13009
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -14416,7 +14413,7 @@ class Chunk {
14416
14413
  }
14417
14414
  }
14418
14415
  for (const module of entryModules) {
14419
- const requiredFacades = Array.from(module.userChunkNames, name => ({
14416
+ const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)), name => ({
14420
14417
  name
14421
14418
  }));
14422
14419
  if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
@@ -14909,7 +14906,7 @@ class Chunk {
14909
14906
  this.dynamicEntryModules[0] ||
14910
14907
  this.orderedModules[this.orderedModules.length - 1];
14911
14908
  if (moduleForNaming) {
14912
- return moduleForNaming.chunkName || getAliasName(moduleForNaming.id);
14909
+ return getChunkNameFromModule(moduleForNaming);
14913
14910
  }
14914
14911
  return 'chunk';
14915
14912
  }
@@ -15281,7 +15278,8 @@ class Chunk {
15281
15278
  }
15282
15279
  }
15283
15280
  function getChunkNameFromModule(module) {
15284
- return module.chunkName || getAliasName(module.id);
15281
+ var _a, _b, _c, _d;
15282
+ return ((_d = (_b = (_a = module.chunkNames.find(({ isUserDefined }) => isUserDefined)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = module.chunkNames[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : getAliasName(module.id));
15285
15283
  }
15286
15284
  const QUERY_HASH_REGEX = /[?#]/;
15287
15285
 
@@ -21657,19 +21655,19 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
21657
21655
  // See https://nodejs.org/api/path.html#path_path_resolve_paths
21658
21656
  return addJsExtensionIfNecessary(importer ? resolve(dirname(importer), source) : resolve(source), preserveSymlinks);
21659
21657
  }
21660
- function addJsExtensionIfNecessary(file, preserveSymlinks) {
21658
+ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
21661
21659
  var _a, _b;
21662
- return ((_b = (_a = findFile(file, preserveSymlinks)) !== null && _a !== void 0 ? _a : findFile(file + '.mjs', preserveSymlinks)) !== null && _b !== void 0 ? _b : findFile(file + '.js', preserveSymlinks));
21660
+ return ((_b = (_a = (await findFile(file, preserveSymlinks))) !== null && _a !== void 0 ? _a : (await findFile(file + '.mjs', preserveSymlinks))) !== null && _b !== void 0 ? _b : (await findFile(file + '.js', preserveSymlinks)));
21663
21661
  }
21664
- function findFile(file, preserveSymlinks) {
21662
+ async function findFile(file, preserveSymlinks) {
21665
21663
  try {
21666
- const stats = lstatSync(file);
21664
+ const stats = await promises.lstat(file);
21667
21665
  if (!preserveSymlinks && stats.isSymbolicLink())
21668
- return findFile(realpathSync(file), preserveSymlinks);
21666
+ return await findFile(await promises.realpath(file), preserveSymlinks);
21669
21667
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
21670
21668
  // check case
21671
21669
  const name = basename(file);
21672
- const files = readdirSync(dirname(file));
21670
+ const files = await promises.readdir(dirname(file));
21673
21671
  if (files.includes(name))
21674
21672
  return file;
21675
21673
  }
@@ -21939,6 +21937,7 @@ class ModuleLoader {
21939
21937
  this.latestLoadModulesPromise = Promise.resolve();
21940
21938
  this.moduleLoadPromises = new Map();
21941
21939
  this.modulesWithLoadedDependencies = new Set();
21940
+ this.nextChunkNamePriority = 0;
21942
21941
  this.nextEntryModuleIndex = 0;
21943
21942
  this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
21944
21943
  return this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
@@ -21958,21 +21957,24 @@ class ModuleLoader {
21958
21957
  async addEntryModules(unresolvedEntryModules, isUserDefined) {
21959
21958
  const firstEntryModuleIndex = this.nextEntryModuleIndex;
21960
21959
  this.nextEntryModuleIndex += unresolvedEntryModules.length;
21960
+ const firstChunkNamePriority = this.nextChunkNamePriority;
21961
+ this.nextChunkNamePriority += unresolvedEntryModules.length;
21961
21962
  const newEntryModules = await this.extendLoadModulesPromise(Promise.all(unresolvedEntryModules.map(({ id, importer }) => this.loadEntryModule(id, true, importer, null))).then(entryModules => {
21962
- let moduleIndex = firstEntryModuleIndex;
21963
21963
  for (let index = 0; index < entryModules.length; index++) {
21964
21964
  const entryModule = entryModules[index];
21965
21965
  entryModule.isUserDefinedEntryPoint =
21966
21966
  entryModule.isUserDefinedEntryPoint || isUserDefined;
21967
- addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined);
21967
+ addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
21968
21968
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
21969
21969
  if (!existingIndexedModule) {
21970
- this.indexedEntryModules.push({ index: moduleIndex, module: entryModule });
21970
+ this.indexedEntryModules.push({
21971
+ index: firstEntryModuleIndex + index,
21972
+ module: entryModule
21973
+ });
21971
21974
  }
21972
21975
  else {
21973
- existingIndexedModule.index = Math.min(existingIndexedModule.index, moduleIndex);
21976
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
21974
21977
  }
21975
- moduleIndex++;
21976
21978
  }
21977
21979
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
21978
21980
  return entryModules;
@@ -22004,8 +22006,9 @@ class ModuleLoader {
22004
22006
  return module.info;
22005
22007
  }
22006
22008
  addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
22009
+ const chunkNamePriority = this.nextChunkNamePriority++;
22007
22010
  return this.extendLoadModulesPromise(this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then(async (entryModule) => {
22008
- addChunkNamesToModule(entryModule, unresolvedModule, false);
22011
+ addChunkNamesToModule(entryModule, unresolvedModule, false, chunkNamePriority);
22009
22012
  if (!entryModule.info.isEntry) {
22010
22013
  this.implicitEntryModules.add(entryModule);
22011
22014
  const implicitlyLoadedAfterModules = await Promise.all(implicitlyLoadedAfter.map(id => this.loadEntryModule(id, false, unresolvedModule.importer, entryModule.id)));
@@ -22327,17 +22330,17 @@ function normalizeRelativeExternalId(source, importer) {
22327
22330
  : resolve(source)
22328
22331
  : source;
22329
22332
  }
22330
- function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
22333
+ function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priority) {
22334
+ var _a;
22331
22335
  if (fileName !== null) {
22332
22336
  module.chunkFileNames.add(fileName);
22333
22337
  }
22334
22338
  else if (name !== null) {
22335
- if (module.chunkName === null) {
22336
- module.chunkName = name;
22337
- }
22338
- if (isUserDefined) {
22339
- module.userChunkNames.add(name);
22340
- }
22339
+ // Always keep chunkNames sorted by priority
22340
+ let namePosition = 0;
22341
+ while (((_a = module.chunkNames[namePosition]) === null || _a === void 0 ? void 0 : _a.priority) < priority)
22342
+ namePosition++;
22343
+ module.chunkNames.splice(namePosition, 0, { isUserDefined, name, priority });
22341
22344
  }
22342
22345
  }
22343
22346
  function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
@@ -22487,14 +22490,14 @@ function formatAction([pluginName, hookName, args]) {
22487
22490
  }
22488
22491
  return action;
22489
22492
  }
22490
- process.on('exit', () => {
22493
+ process$1.on('exit', () => {
22491
22494
  if (unfulfilledActions.size) {
22492
22495
  let err = '[!] Error: unfinished hook action(s) on exit:\n';
22493
22496
  for (const action of unfulfilledActions) {
22494
22497
  err += formatAction(action) + '\n';
22495
22498
  }
22496
22499
  console.error('%s', err);
22497
- process.exit(1);
22500
+ process$1.exit(1);
22498
22501
  }
22499
22502
  });
22500
22503
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.67.0
4
- Wed, 02 Feb 2022 06:19:08 GMT - commit 61d772ba59be605e53e72613ae51cee4b72aee64
3
+ Rollup.js v2.67.1
4
+ Mon, 07 Feb 2022 05:29:30 GMT - commit efd71e930e86ab30f4911ed8caa7f78aca005729
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -9,13 +9,13 @@
9
9
  Released under the MIT License.
10
10
  */
11
11
  import require$$0$2, { resolve } from 'path';
12
+ import process$1 from 'process';
12
13
  import { defaultOnWarn, ensureArray, warnUnknownOptions, objectifyOptionWithPresets, treeshakePresets, objectifyOption, generatedCodePresets, picomatch as picomatch$2, getAugmentedNamespace, fseventsImporter, createFilter, rollupInternal } from './rollup.js';
13
14
  import require$$2$1, { platform } from 'os';
14
15
  import require$$0$3 from 'events';
15
16
  import require$$0$1 from 'fs';
16
17
  import require$$2 from 'util';
17
18
  import require$$1 from 'stream';
18
- import 'process';
19
19
  import 'perf_hooks';
20
20
  import 'crypto';
21
21
 
@@ -4805,7 +4805,7 @@ class Watcher {
4805
4805
  this.buildDelay = configs.reduce((buildDelay, { watch }) => watch && typeof watch.buildDelay === 'number'
4806
4806
  ? Math.max(buildDelay, watch.buildDelay)
4807
4807
  : buildDelay, this.buildDelay);
4808
- process.nextTick(() => this.run());
4808
+ process$1.nextTick(() => this.run());
4809
4809
  }
4810
4810
  close() {
4811
4811
  if (this.buildTimeout)
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.67.0
4
- Wed, 02 Feb 2022 06:19:08 GMT - commit 61d772ba59be605e53e72613ae51cee4b72aee64
3
+ Rollup.js v2.67.1
4
+ Mon, 07 Feb 2022 05:29:30 GMT - commit efd71e930e86ab30f4911ed8caa7f78aca005729
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -12,11 +12,11 @@
12
12
 
13
13
  require('fs');
14
14
  require('path');
15
+ require('process');
15
16
  require('url');
16
17
  const loadConfigFile_js = require('./shared/loadConfigFile.js');
17
18
  require('./shared/rollup.js');
18
19
  require('./shared/mergeOptions.js');
19
- require('process');
20
20
  require('tty');
21
21
  require('perf_hooks');
22
22
  require('crypto');