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/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
@@ -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,8 +12,8 @@
12
12
 
13
13
  const require$$0$1 = require('fs');
14
14
  const require$$0 = require('path');
15
- const url = require('url');
16
15
  const process$1 = require('process');
16
+ const url = require('url');
17
17
  const tty = require('tty');
18
18
  const rollup = require('./rollup.js');
19
19
  const mergeOptions = require('./mergeOptions.js');
@@ -29,7 +29,6 @@ function _interopNamespaceDefault(e) {
29
29
  return n;
30
30
  }
31
31
 
32
- const require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0);
33
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
34
33
 
35
34
  const env = process.env || {};
@@ -143,7 +142,7 @@ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
143
142
  });
144
143
 
145
144
  // log to stderr to keep `rollup main.js > bundle.js` from breaking
146
- const stderr = (...args) => process.stderr.write(`${args.join('')}\n`);
145
+ const stderr = (...args) => process$1.stderr.write(`${args.join('')}\n`);
147
146
  function handleError(err, recover = false) {
148
147
  let description = err.message || err;
149
148
  if (err.name)
@@ -167,7 +166,7 @@ function handleError(err, recover = false) {
167
166
  }
168
167
  stderr('');
169
168
  if (!recover)
170
- process.exit(1);
169
+ process$1.exit(1);
171
170
  }
172
171
 
173
172
  function batchWarnings() {
@@ -267,6 +266,7 @@ const deferredHandlers = {
267
266
  title('Mixing named and default exports');
268
267
  info(`https://rollupjs.org/guide/en/#outputexports`);
269
268
  stderr(bold('The following entry modules are using named and default exports together:'));
269
+ warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
270
270
  const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
271
271
  for (const warning of displayedWarnings) {
272
272
  stderr(rollup.relativeId(warning.id));
@@ -405,8 +405,8 @@ function stdinPlugin(arg) {
405
405
  function readStdin() {
406
406
  return new Promise((resolve, reject) => {
407
407
  const chunks = [];
408
- process.stdin.setEncoding('utf8');
409
- process.stdin
408
+ process$1.stdin.setEncoding('utf8');
409
+ process$1.stdin
410
410
  .on('data', chunk => chunks.push(chunk))
411
411
  .on('end', () => {
412
412
  const result = chunks.join('');
@@ -505,7 +505,7 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
505
505
  if (!plugin) {
506
506
  try {
507
507
  if (pluginText[0] == '.')
508
- pluginText = require$$0__namespace.resolve(pluginText);
508
+ pluginText = require$$0.resolve(pluginText);
509
509
  plugin = await requireOrImport(pluginText);
510
510
  }
511
511
  catch (err) {
@@ -543,7 +543,7 @@ async function requireOrImport(pluginPath) {
543
543
  }
544
544
 
545
545
  function supportsNativeESM() {
546
- return Number(/^v(\d+)/.exec(process.version)[1]) >= 13;
546
+ return Number(/^v(\d+)/.exec(process$1.version)[1]) >= 13;
547
547
  }
548
548
  async function loadAndParseConfigFile(fileName, commandOptions = {}) {
549
549
  const configs = await loadConfigFile(fileName, commandOptions);
@@ -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
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
28
28
  return n;
29
29
  }
30
30
 
31
- var version$1 = "2.67.0";
31
+ var version$1 = "2.67.1";
32
32
 
33
33
  function ensureArray$1(items) {
34
34
  if (Array.isArray(items)) {
@@ -12320,7 +12320,7 @@ class Module {
12320
12320
  this.alternativeReexportModules = new Map();
12321
12321
  this.ast = null;
12322
12322
  this.chunkFileNames = new Set();
12323
- this.chunkName = null;
12323
+ this.chunkNames = [];
12324
12324
  this.cycles = new Set();
12325
12325
  this.dependencies = new Set();
12326
12326
  this.dynamicDependencies = new Set();
@@ -12343,7 +12343,6 @@ class Module {
12343
12343
  this.reexportDescriptions = Object.create(null);
12344
12344
  this.sideEffectDependenciesByVariable = new Map();
12345
12345
  this.sources = new Set();
12346
- this.userChunkNames = new Set();
12347
12346
  this.usesTopLevelAwait = false;
12348
12347
  this.allExportNames = null;
12349
12348
  this.exportAllModules = [];
@@ -13131,12 +13130,10 @@ function removeJsExtension(name) {
13131
13130
  }
13132
13131
 
13133
13132
  function getCompleteAmdId(options, chunkId) {
13134
- if (!options.autoId) {
13135
- return options.id || '';
13136
- }
13137
- else {
13133
+ if (options.autoId) {
13138
13134
  return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`;
13139
13135
  }
13136
+ return options.id || '';
13140
13137
  }
13141
13138
 
13142
13139
  function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
@@ -14546,7 +14543,7 @@ class Chunk {
14546
14543
  }
14547
14544
  }
14548
14545
  for (const module of entryModules) {
14549
- const requiredFacades = Array.from(module.userChunkNames, name => ({
14546
+ const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)), name => ({
14550
14547
  name
14551
14548
  }));
14552
14549
  if (requiredFacades.length === 0 && module.isUserDefinedEntryPoint) {
@@ -15039,7 +15036,7 @@ class Chunk {
15039
15036
  this.dynamicEntryModules[0] ||
15040
15037
  this.orderedModules[this.orderedModules.length - 1];
15041
15038
  if (moduleForNaming) {
15042
- return moduleForNaming.chunkName || getAliasName(moduleForNaming.id);
15039
+ return getChunkNameFromModule(moduleForNaming);
15043
15040
  }
15044
15041
  return 'chunk';
15045
15042
  }
@@ -15411,7 +15408,8 @@ class Chunk {
15411
15408
  }
15412
15409
  }
15413
15410
  function getChunkNameFromModule(module) {
15414
- return module.chunkName || getAliasName(module.id);
15411
+ var _a, _b, _c, _d;
15412
+ 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));
15415
15413
  }
15416
15414
  const QUERY_HASH_REGEX = /[?#]/;
15417
15415
 
@@ -21787,19 +21785,19 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
21787
21785
  // See https://nodejs.org/api/path.html#path_path_resolve_paths
21788
21786
  return addJsExtensionIfNecessary(importer ? require$$0.resolve(require$$0.dirname(importer), source) : require$$0.resolve(source), preserveSymlinks);
21789
21787
  }
21790
- function addJsExtensionIfNecessary(file, preserveSymlinks) {
21788
+ async function addJsExtensionIfNecessary(file, preserveSymlinks) {
21791
21789
  var _a, _b;
21792
- return ((_b = (_a = findFile(file, preserveSymlinks)) !== null && _a !== void 0 ? _a : findFile(file + '.mjs', preserveSymlinks)) !== null && _b !== void 0 ? _b : findFile(file + '.js', preserveSymlinks));
21790
+ 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)));
21793
21791
  }
21794
- function findFile(file, preserveSymlinks) {
21792
+ async function findFile(file, preserveSymlinks) {
21795
21793
  try {
21796
- const stats = require$$0$1.lstatSync(file);
21794
+ const stats = await require$$0$1.promises.lstat(file);
21797
21795
  if (!preserveSymlinks && stats.isSymbolicLink())
21798
- return findFile(require$$0$1.realpathSync(file), preserveSymlinks);
21796
+ return await findFile(await require$$0$1.promises.realpath(file), preserveSymlinks);
21799
21797
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
21800
21798
  // check case
21801
21799
  const name = require$$0.basename(file);
21802
- const files = require$$0$1.readdirSync(require$$0.dirname(file));
21800
+ const files = await require$$0$1.promises.readdir(require$$0.dirname(file));
21803
21801
  if (files.includes(name))
21804
21802
  return file;
21805
21803
  }
@@ -22069,6 +22067,7 @@ class ModuleLoader {
22069
22067
  this.latestLoadModulesPromise = Promise.resolve();
22070
22068
  this.moduleLoadPromises = new Map();
22071
22069
  this.modulesWithLoadedDependencies = new Set();
22070
+ this.nextChunkNamePriority = 0;
22072
22071
  this.nextEntryModuleIndex = 0;
22073
22072
  this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
22074
22073
  return this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
@@ -22088,21 +22087,24 @@ class ModuleLoader {
22088
22087
  async addEntryModules(unresolvedEntryModules, isUserDefined) {
22089
22088
  const firstEntryModuleIndex = this.nextEntryModuleIndex;
22090
22089
  this.nextEntryModuleIndex += unresolvedEntryModules.length;
22090
+ const firstChunkNamePriority = this.nextChunkNamePriority;
22091
+ this.nextChunkNamePriority += unresolvedEntryModules.length;
22091
22092
  const newEntryModules = await this.extendLoadModulesPromise(Promise.all(unresolvedEntryModules.map(({ id, importer }) => this.loadEntryModule(id, true, importer, null))).then(entryModules => {
22092
- let moduleIndex = firstEntryModuleIndex;
22093
22093
  for (let index = 0; index < entryModules.length; index++) {
22094
22094
  const entryModule = entryModules[index];
22095
22095
  entryModule.isUserDefinedEntryPoint =
22096
22096
  entryModule.isUserDefinedEntryPoint || isUserDefined;
22097
- addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined);
22097
+ addChunkNamesToModule(entryModule, unresolvedEntryModules[index], isUserDefined, firstChunkNamePriority + index);
22098
22098
  const existingIndexedModule = this.indexedEntryModules.find(indexedModule => indexedModule.module === entryModule);
22099
22099
  if (!existingIndexedModule) {
22100
- this.indexedEntryModules.push({ index: moduleIndex, module: entryModule });
22100
+ this.indexedEntryModules.push({
22101
+ index: firstEntryModuleIndex + index,
22102
+ module: entryModule
22103
+ });
22101
22104
  }
22102
22105
  else {
22103
- existingIndexedModule.index = Math.min(existingIndexedModule.index, moduleIndex);
22106
+ existingIndexedModule.index = Math.min(existingIndexedModule.index, firstEntryModuleIndex + index);
22104
22107
  }
22105
- moduleIndex++;
22106
22108
  }
22107
22109
  this.indexedEntryModules.sort(({ index: indexA }, { index: indexB }) => indexA > indexB ? 1 : -1);
22108
22110
  return entryModules;
@@ -22134,8 +22136,9 @@ class ModuleLoader {
22134
22136
  return module.info;
22135
22137
  }
22136
22138
  addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
22139
+ const chunkNamePriority = this.nextChunkNamePriority++;
22137
22140
  return this.extendLoadModulesPromise(this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then(async (entryModule) => {
22138
- addChunkNamesToModule(entryModule, unresolvedModule, false);
22141
+ addChunkNamesToModule(entryModule, unresolvedModule, false, chunkNamePriority);
22139
22142
  if (!entryModule.info.isEntry) {
22140
22143
  this.implicitEntryModules.add(entryModule);
22141
22144
  const implicitlyLoadedAfterModules = await Promise.all(implicitlyLoadedAfter.map(id => this.loadEntryModule(id, false, unresolvedModule.importer, entryModule.id)));
@@ -22457,17 +22460,17 @@ function normalizeRelativeExternalId(source, importer) {
22457
22460
  : require$$0.resolve(source)
22458
22461
  : source;
22459
22462
  }
22460
- function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
22463
+ function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priority) {
22464
+ var _a;
22461
22465
  if (fileName !== null) {
22462
22466
  module.chunkFileNames.add(fileName);
22463
22467
  }
22464
22468
  else if (name !== null) {
22465
- if (module.chunkName === null) {
22466
- module.chunkName = name;
22467
- }
22468
- if (isUserDefined) {
22469
- module.userChunkNames.add(name);
22470
- }
22469
+ // Always keep chunkNames sorted by priority
22470
+ let namePosition = 0;
22471
+ while (((_a = module.chunkNames[namePosition]) === null || _a === void 0 ? void 0 : _a.priority) < priority)
22472
+ namePosition++;
22473
+ module.chunkNames.splice(namePosition, 0, { isUserDefined, name, priority });
22471
22474
  }
22472
22475
  }
22473
22476
  function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
@@ -22617,14 +22620,14 @@ function formatAction([pluginName, hookName, args]) {
22617
22620
  }
22618
22621
  return action;
22619
22622
  }
22620
- process.on('exit', () => {
22623
+ process$1.on('exit', () => {
22621
22624
  if (unfulfilledActions.size) {
22622
22625
  let err = '[!] Error: unfinished hook action(s) on exit:\n';
22623
22626
  for (const action of unfulfilledActions) {
22624
22627
  err += formatAction(action) + '\n';
22625
22628
  }
22626
22629
  console.error('%s', err);
22627
- process.exit(1);
22630
+ process$1.exit(1);
22628
22631
  }
22629
22632
  });
22630
22633
 
@@ -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
@@ -147,7 +147,9 @@ const processOk = function (process) {
147
147
  // some kind of non-node environment, just no-op
148
148
  /* istanbul ignore if */
149
149
  if (!processOk(process$1)) {
150
- signalExit.exports = function () {};
150
+ signalExit.exports = function () {
151
+ return function () {}
152
+ };
151
153
  } else {
152
154
  var assert = require$$0;
153
155
  var signals = signals$1.exports;
@@ -180,7 +182,7 @@ if (!processOk(process$1)) {
180
182
  signalExit.exports = function (cb, opts) {
181
183
  /* istanbul ignore if */
182
184
  if (!processOk(rollup.commonjsGlobal.process)) {
183
- return
185
+ return function () {}
184
186
  }
185
187
  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
186
188
 
@@ -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
@@ -11,11 +11,11 @@
11
11
  'use strict';
12
12
 
13
13
  const require$$0 = require('path');
14
+ const process = require('process');
14
15
  const rollup = require('./rollup.js');
15
16
  const mergeOptions = require('./mergeOptions.js');
16
17
  const require$$2 = require('os');
17
18
  const index = require('./index.js');
18
- require('process');
19
19
  require('perf_hooks');
20
20
  require('crypto');
21
21
  require('fs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.67.0",
3
+ "version": "2.67.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -69,19 +69,19 @@
69
69
  "@types/node": "^10.17.60",
70
70
  "@types/signal-exit": "^3.0.1",
71
71
  "@types/yargs-parser": "^20.2.1",
72
- "@typescript-eslint/eslint-plugin": "^5.10.0",
73
- "@typescript-eslint/parser": "^5.10.0",
72
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
73
+ "@typescript-eslint/parser": "^5.10.2",
74
74
  "acorn": "^8.7.0",
75
75
  "acorn-jsx": "^5.3.2",
76
76
  "acorn-walk": "^8.2.0",
77
77
  "buble": "^0.20.0",
78
78
  "chokidar": "^3.5.3",
79
79
  "colorette": "^2.0.16",
80
- "core-js": "^3.20.3",
80
+ "core-js": "^3.21.0",
81
81
  "date-time": "^4.0.0",
82
82
  "es5-shim": "^4.6.4",
83
83
  "es6-shim": "^0.35.6",
84
- "eslint": "^8.7.0",
84
+ "eslint": "^8.8.0",
85
85
  "eslint-config-prettier": "^8.3.0",
86
86
  "eslint-plugin-import": "^2.25.4",
87
87
  "eslint-plugin-prettier": "^4.0.0",
@@ -94,20 +94,20 @@
94
94
  "lint-staged": "^10.5.4",
95
95
  "locate-character": "^2.0.5",
96
96
  "magic-string": "^0.25.7",
97
- "mocha": "^9.1.4",
97
+ "mocha": "^9.2.0",
98
98
  "nyc": "^15.1.0",
99
99
  "pinst": "^2.1.6",
100
100
  "prettier": "^2.5.1",
101
101
  "pretty-bytes": "^5.6.0",
102
102
  "pretty-ms": "^7.0.1",
103
103
  "requirejs": "^2.3.6",
104
- "rollup": "^2.65.0",
104
+ "rollup": "^2.67.0",
105
105
  "rollup-plugin-license": "^2.6.1",
106
106
  "rollup-plugin-string": "^3.0.0",
107
107
  "rollup-plugin-terser": "^7.0.2",
108
108
  "rollup-plugin-thatworks": "^1.0.4",
109
109
  "shx": "^0.3.4",
110
- "signal-exit": "^3.0.6",
110
+ "signal-exit": "^3.0.7",
111
111
  "source-map": "^0.7.3",
112
112
  "source-map-support": "^0.5.21",
113
113
  "sourcemap-codec": "^1.4.8",