rollup 3.0.0-2 → 3.0.0-3

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -9,6 +9,8 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
13
+
12
14
  require('path');
13
15
  require('url');
14
16
  const loadConfigFile_js = require('./shared/loadConfigFile.js');
@@ -24,5 +26,5 @@ require('events');
24
26
 
25
27
 
26
28
 
27
- module.exports = loadConfigFile_js.loadAndParseConfigFile;
29
+ exports.loadConfigFile = loadConfigFile_js.loadConfigFile;
28
30
  //# sourceMappingURL=loadConfigFile.js.map
package/dist/rollup.d.ts CHANGED
@@ -1,41 +1,33 @@
1
1
  export const VERSION: string;
2
2
 
3
- export interface RollupError extends RollupLogProps {
4
- parserError?: Error;
3
+ export interface RollupError extends RollupLog {
4
+ name?: string;
5
5
  stack?: string;
6
6
  watchFiles?: string[];
7
7
  }
8
8
 
9
- export interface RollupWarning extends RollupLogProps {
10
- chunkName?: string;
11
- cycle?: string[];
12
- exportName?: string;
13
- exporter?: string;
14
- guess?: string;
15
- importer?: string;
16
- missing?: string;
17
- modules?: string[];
18
- names?: string[];
19
- reexporter?: string;
20
- source?: string;
21
- sources?: string[];
22
- }
9
+ export type RollupWarning = RollupLog;
23
10
 
24
- export interface RollupLogProps {
11
+ export interface RollupLog {
12
+ binding?: string;
13
+ cause?: Error;
25
14
  code?: string;
15
+ exporter?: string;
26
16
  frame?: string;
27
17
  hook?: string;
28
18
  id?: string;
19
+ ids?: string[];
29
20
  loc?: {
30
21
  column: number;
31
22
  file?: string;
32
23
  line: number;
33
24
  };
34
25
  message: string;
35
- name?: string;
26
+ names?: string[];
36
27
  plugin?: string;
37
28
  pluginCode?: string;
38
29
  pos?: number;
30
+ reexporter?: string;
39
31
  url?: string;
40
32
  }
41
33
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -147,10 +147,11 @@ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
147
147
  // log to stderr to keep `rollup main.js > bundle.js` from breaking
148
148
  const stderr = (...args) => process$1.stderr.write(`${args.join('')}\n`);
149
149
  function handleError(err, recover = false) {
150
- let description = err.message || err;
151
- if (err.name)
152
- description = `${err.name}: ${description}`;
153
- const message = (err.plugin ? `(plugin ${err.plugin}) ${description}` : description) || err;
150
+ var _a;
151
+ const name = err.name || ((_a = err.cause) === null || _a === void 0 ? void 0 : _a.name);
152
+ const nameSection = name ? `${name}: ` : '';
153
+ const pluginSection = err.plugin ? `(plugin ${err.plugin}) ` : '';
154
+ const message = `${pluginSection}${nameSection}${err.message}`;
154
155
  stderr(bold(red(`[!] ${bold(message.toString())}`)));
155
156
  if (err.url) {
156
157
  stderr(cyan(err.url));
@@ -294,6 +295,7 @@ function batchWarnings() {
294
295
  let warningOccurred = false;
295
296
  return {
296
297
  add(warning) {
298
+ var _a;
297
299
  count += 1;
298
300
  warningOccurred = true;
299
301
  if (warning.code in deferredHandlers) {
@@ -306,7 +308,7 @@ function batchWarnings() {
306
308
  title(warning.message);
307
309
  if (warning.url)
308
310
  info(warning.url);
309
- const id = (warning.loc && warning.loc.file) || warning.id;
311
+ const id = ((_a = warning.loc) === null || _a === void 0 ? void 0 : _a.file) || warning.id;
310
312
  if (id) {
311
313
  const loc = warning.loc
312
314
  ? `${rollup.relativeId(id)} (${warning.loc.line}:${warning.loc.column})`
@@ -338,7 +340,7 @@ function batchWarnings() {
338
340
  const immediateHandlers = {
339
341
  MISSING_NODE_BUILTINS(warning) {
340
342
  title(`Missing shims for Node.js built-ins`);
341
- stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.modules)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
343
+ stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.ids)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
342
344
  },
343
345
  UNKNOWN_OPTION(warning) {
344
346
  title(`You have passed an unrecognized option`);
@@ -350,7 +352,7 @@ const deferredHandlers = {
350
352
  title(`Circular dependenc${warnings.length > 1 ? 'ies' : 'y'}`);
351
353
  const displayed = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
352
354
  for (const warning of displayed) {
353
- stderr(warning.cycle.join(' -> '));
355
+ stderr(warning.ids.map(rollup.relativeId).join(' -> '));
354
356
  }
355
357
  if (warnings.length > displayed.length) {
356
358
  stderr(`...and ${warnings.length - displayed.length} more`);
@@ -358,7 +360,7 @@ const deferredHandlers = {
358
360
  },
359
361
  EMPTY_BUNDLE(warnings) {
360
362
  title(`Generated${warnings.length === 1 ? ' an' : ''} empty ${warnings.length > 1 ? 'chunks' : 'chunk'}`);
361
- stderr(warnings.map(warning => warning.chunkName).join(', '));
363
+ stderr(rollup.printQuotedStringList(warnings.map(warning => warning.names[0])));
362
364
  },
363
365
  EVAL(warnings) {
364
366
  title('Use of eval is strongly discouraged');
@@ -369,16 +371,17 @@ const deferredHandlers = {
369
371
  title('Missing exports');
370
372
  info('https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module');
371
373
  for (const warning of warnings) {
372
- stderr(bold(warning.importer));
373
- stderr(`${warning.missing} is not exported by ${warning.exporter}`);
374
+ stderr(bold(rollup.relativeId(warning.id)));
375
+ stderr(`${warning.binding} is not exported by ${rollup.relativeId(warning.exporter)}`);
374
376
  stderr(gray(warning.frame));
375
377
  }
376
378
  },
377
379
  MISSING_GLOBAL_NAME(warnings) {
378
380
  title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
379
- stderr(`Use output.globals to specify browser global variable names corresponding to external modules`);
381
+ info('https://rollupjs.org/guide/en/#outputglobals');
382
+ stderr(`Use "output.globals" to specify browser global variable names corresponding to external modules:`);
380
383
  for (const warning of warnings) {
381
- stderr(`${bold(warning.source)} (guessing '${warning.guess}')`);
384
+ stderr(`${bold(warning.id)} (guessing "${warning.names[0]}")`);
382
385
  }
383
386
  },
384
387
  MIXED_EXPORTS(warnings) {
@@ -393,18 +396,14 @@ const deferredHandlers = {
393
396
  if (displayedWarnings.length < warnings.length) {
394
397
  stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
395
398
  }
396
- stderr(`\nConsumers of your bundle will have to use chunk['default'] to access their default export, which may not be what you want. Use \`output.exports: 'named'\` to disable this warning`);
399
+ stderr(`\nConsumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning.`);
397
400
  },
398
401
  NAMESPACE_CONFLICT(warnings) {
399
402
  title(`Conflicting re-exports`);
400
403
  for (const warning of warnings) {
401
- stderr(`"${bold(rollup.relativeId(warning.reexporter))}" re-exports "${warning.name}" from both "${rollup.relativeId(warning.sources[0])}" and "${rollup.relativeId(warning.sources[1])}" (will be ignored)`);
404
+ stderr(`"${bold(rollup.relativeId(warning.reexporter))}" re-exports "${warning.binding}" from both "${rollup.relativeId(warning.ids[0])}" and "${rollup.relativeId(warning.ids[1])}" (will be ignored).`);
402
405
  }
403
406
  },
404
- NON_EXISTENT_EXPORT(warnings) {
405
- title(`Import of non-existent ${warnings.length > 1 ? 'exports' : 'export'}`);
406
- showTruncatedWarnings(warnings);
407
- },
408
407
  PLUGIN_WARNING(warnings) {
409
408
  var _a;
410
409
  const nestedByPlugin = nest(warnings, 'plugin');
@@ -434,10 +433,10 @@ const deferredHandlers = {
434
433
  title(`Broken sourcemap`);
435
434
  info('https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect');
436
435
  const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
437
- stderr(`Plugins that transform code (such as ${rollup.printQuotedStringList(plugins)}) should generate accompanying sourcemaps`);
436
+ stderr(`Plugins that transform code (such as ${rollup.printQuotedStringList(plugins)}) should generate accompanying sourcemaps.`);
438
437
  },
439
438
  THIS_IS_UNDEFINED(warnings) {
440
- title('`this` has been rewritten to `undefined`');
439
+ title('"this" has been rewritten to "undefined"');
441
440
  info('https://rollupjs.org/guide/en/#error-this-is-undefined');
442
441
  showTruncatedWarnings(warnings);
443
442
  },
@@ -446,10 +445,10 @@ const deferredHandlers = {
446
445
  info('https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency');
447
446
  const dependencies = new Map();
448
447
  for (const warning of warnings) {
449
- rollup.getOrCreate(dependencies, warning.source, () => []).push(warning.importer);
448
+ rollup.getOrCreate(dependencies, rollup.relativeId(warning.exporter), () => []).push(rollup.relativeId(warning.id));
450
449
  }
451
450
  for (const [dependency, importers] of dependencies) {
452
- stderr(`${bold(dependency)} (imported by ${importers.join(', ')})`);
451
+ stderr(`${bold(dependency)} (imported by ${rollup.printQuotedStringList(importers)})`);
453
452
  }
454
453
  },
455
454
  UNUSED_EXTERNAL_IMPORT(warnings) {
@@ -457,9 +456,10 @@ const deferredHandlers = {
457
456
  for (const warning of warnings) {
458
457
  stderr(warning.names +
459
458
  ' imported from external module "' +
460
- warning.source +
459
+ warning.exporter +
461
460
  '" but never used in ' +
462
- rollup.printQuotedStringList(warning.sources.map(id => rollup.relativeId(id))));
461
+ rollup.printQuotedStringList(warning.ids.map(rollup.relativeId)) +
462
+ '.');
463
463
  }
464
464
  }
465
465
  };
@@ -663,8 +663,8 @@ async function requireOrImport(pluginPath) {
663
663
  }
664
664
  }
665
665
 
666
- async function loadAndParseConfigFile(fileName, commandOptions = {}) {
667
- const configs = await loadConfigFile(fileName, commandOptions);
666
+ async function loadConfigFile(fileName, commandOptions = {}) {
667
+ const configs = await loadConfigsFromFile(fileName, commandOptions);
668
668
  const warnings = batchWarnings();
669
669
  try {
670
670
  const normalizedConfigs = [];
@@ -680,7 +680,7 @@ async function loadAndParseConfigFile(fileName, commandOptions = {}) {
680
680
  throw err;
681
681
  }
682
682
  }
683
- async function loadConfigFile(fileName, commandOptions) {
683
+ async function loadConfigsFromFile(fileName, commandOptions) {
684
684
  const extension = require$$0.extname(fileName);
685
685
  const configFileExport = commandOptions.configPlugin ||
686
686
  // We always transpile the .js non-module case because many legacy code bases rely on this
@@ -748,11 +748,7 @@ function loadConfigFromBundledFile(fileName, bundledCode) {
748
748
  }
749
749
  catch (err) {
750
750
  if (err.code === 'ERR_REQUIRE_ESM') {
751
- return rollup.error({
752
- code: 'TRANSPILED_ESM_CONFIG',
753
- message: `While loading the Rollup configuration from "${rollup.relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`,
754
- url: 'https://rollupjs.org/guide/en/#using-untranspiled-config-files'
755
- });
751
+ return rollup.error(rollup.errTranspiledEsmConfig(fileName));
756
752
  }
757
753
  throw err;
758
754
  }
@@ -762,11 +758,7 @@ async function getConfigList(configFileExport, commandOptions) {
762
758
  ? configFileExport(commandOptions)
763
759
  : configFileExport);
764
760
  if (Object.keys(config).length === 0) {
765
- return rollup.error({
766
- code: 'MISSING_CONFIG',
767
- message: 'Config file must export an options object, or an array of options objects',
768
- url: 'https://rollupjs.org/guide/en/#configuration-files'
769
- });
761
+ return rollup.error(rollup.errMissingConfig());
770
762
  }
771
763
  return Array.isArray(config) ? config : [config];
772
764
  }
@@ -777,7 +769,7 @@ exports.bold = bold;
777
769
  exports.cyan = cyan;
778
770
  exports.green = green;
779
771
  exports.handleError = handleError;
780
- exports.loadAndParseConfigFile = loadAndParseConfigFile;
772
+ exports.loadConfigFile = loadConfigFile;
781
773
  exports.stderr = stderr;
782
774
  exports.stdinName = stdinName;
783
775
  exports.underline = underline;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
3
  Rollup.js v3.0.0-2
4
- Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
4
+ Sat, 30 Jul 2022 12:51:34 GMT - commit 41906cedefbc03640d6e8ca23ce6975f3bb5c6a1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7