rollup 3.10.1 → 3.11.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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.1
4
- Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
3
+ Rollup.js v3.11.0
4
+ Thu, 26 Jan 2023 12:06:32 GMT - commit 9ff0128634106710ba884be319804d232581670f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -89,12 +89,12 @@ const deferredHandlers = {
89
89
  },
90
90
  EVAL(warnings) {
91
91
  title('Use of eval is strongly discouraged');
92
- info('https://rollupjs.org/guide/en/#avoiding-eval');
92
+ info(rollup.getRollupUrl(rollup.URL_AVOIDING_EVAL));
93
93
  showTruncatedWarnings(warnings);
94
94
  },
95
95
  MISSING_EXPORT(warnings) {
96
96
  title('Missing exports');
97
- info('https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module');
97
+ info(rollup.getRollupUrl(rollup.URL_NAME_IS_NOT_EXPORTED));
98
98
  for (const warning of warnings) {
99
99
  rollup.stderr(rollup.bold(rollup.relativeId(warning.id)));
100
100
  rollup.stderr(`${warning.binding} is not exported by ${rollup.relativeId(warning.exporter)}`);
@@ -103,7 +103,7 @@ const deferredHandlers = {
103
103
  },
104
104
  MISSING_GLOBAL_NAME(warnings) {
105
105
  title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
106
- info('https://rollupjs.org/guide/en/#outputglobals');
106
+ info(rollup.getRollupUrl(rollup.URL_OUTPUT_GLOBALS));
107
107
  rollup.stderr(`Use "output.globals" to specify browser global variable names corresponding to external modules:`);
108
108
  for (const warning of warnings) {
109
109
  rollup.stderr(`${rollup.bold(warning.id)} (guessing "${warning.names[0]}")`);
@@ -111,7 +111,7 @@ const deferredHandlers = {
111
111
  },
112
112
  MIXED_EXPORTS(warnings) {
113
113
  title('Mixing named and default exports');
114
- info(`https://rollupjs.org/guide/en/#outputexports`);
114
+ info(rollup.getRollupUrl(rollup.URL_OUTPUT_EXPORTS));
115
115
  rollup.stderr(rollup.bold('The following entry modules are using named and default exports together:'));
116
116
  warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
117
117
  const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
@@ -155,18 +155,18 @@ const deferredHandlers = {
155
155
  },
156
156
  SOURCEMAP_BROKEN(warnings) {
157
157
  title(`Broken sourcemap`);
158
- info('https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect');
158
+ info(rollup.getRollupUrl(rollup.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT));
159
159
  const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
160
160
  rollup.stderr(`Plugins that transform code (such as ${rollup.printQuotedStringList(plugins)}) should generate accompanying sourcemaps.`);
161
161
  },
162
162
  THIS_IS_UNDEFINED(warnings) {
163
163
  title('"this" has been rewritten to "undefined"');
164
- info('https://rollupjs.org/guide/en/#error-this-is-undefined');
164
+ info(rollup.getRollupUrl(rollup.URL_THIS_IS_UNDEFINED));
165
165
  showTruncatedWarnings(warnings);
166
166
  },
167
167
  UNRESOLVED_IMPORT(warnings) {
168
168
  title('Unresolved dependencies');
169
- info('https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency');
169
+ info(rollup.getRollupUrl(rollup.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY));
170
170
  const dependencies = new Map();
171
171
  for (const warning of warnings) {
172
172
  rollup.getOrCreate(dependencies, rollup.relativeId(warning.exporter), rollup.getNewArray).push(rollup.relativeId(warning.id));
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.1
4
- Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
3
+ Rollup.js v3.11.0
4
+ Thu, 26 Jan 2023 12:06:32 GMT - commit 9ff0128634106710ba884be319804d232581670f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version$1 = "3.10.1";
34
+ var version$1 = "3.11.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -43,6 +43,34 @@ function ensureArray$1(items) {
43
43
  return [];
44
44
  }
45
45
 
46
+ // troubleshooting
47
+ const URL_AVOIDING_EVAL = 'troubleshooting/#avoiding-eval';
48
+ const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by-module';
49
+ const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
50
+ const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
51
+ const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
52
+ // configuration-options
53
+ const URL_OUTPUT_AMD = 'configuration-options/#output-amd';
54
+ const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
55
+ const URL_OUTPUT_DYNAMICIMPORTFUNCTION = 'configuration-options/#output-dynamicimportfunction';
56
+ const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
57
+ const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
58
+ const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
59
+ const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
60
+ const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
61
+ const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
62
+ const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
63
+ const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
64
+ const URL_OUTPUT_NAME = 'configuration-options/#output-name';
65
+ const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
66
+ const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
67
+ const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
68
+ const URL_TREESHAKE = 'configuration-options/#treeshake';
69
+ const URL_WATCH = 'configuration-options/#watch';
70
+ // command-line-interface
71
+ const URL_BUNDLE_CONFIG_AS_CJS = 'command-line-interface/#bundleconfigascjs';
72
+ const URL_CONFIGURATION_FILES = 'command-line-interface/#configuration-files';
73
+
46
74
  async function asyncFlatten(array) {
47
75
  do {
48
76
  array = (await Promise.all(array)).flat(Infinity);
@@ -205,6 +233,19 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
205
233
  return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
206
234
  }
207
235
 
236
+ function isValidUrl(url) {
237
+ try {
238
+ new URL(url);
239
+ }
240
+ catch {
241
+ return false;
242
+ }
243
+ return true;
244
+ }
245
+ function getRollupUrl(snippet) {
246
+ return `https://rollupjs.org/${snippet}`;
247
+ }
248
+
208
249
  function error(base) {
209
250
  if (!(base instanceof Error)) {
210
251
  base = Object.assign(new Error(base.message), base);
@@ -367,7 +408,7 @@ function errorEval(id) {
367
408
  code: EVAL,
368
409
  id,
369
410
  message: `Use of eval in "${relativeId(id)}" is strongly discouraged as it poses security risks and may cause issues with minification.`,
370
- url: 'https://rollupjs.org/guide/en/#avoiding-eval'
411
+ url: getRollupUrl(URL_AVOIDING_EVAL)
371
412
  };
372
413
  }
373
414
  function errorExternalSyntheticExports(id, importer) {
@@ -399,7 +440,7 @@ function errorIllegalIdentifierAsName(name) {
399
440
  return {
400
441
  code: ILLEGAL_IDENTIFIER_AS_NAME,
401
442
  message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`,
402
- url: 'https://rollupjs.org/guide/en/#outputextend'
443
+ url: getRollupUrl(URL_OUTPUT_EXTEND)
403
444
  };
404
445
  }
405
446
  function errorIllegalImportReassignment(name, importingId) {
@@ -438,7 +479,7 @@ function errorCannotBundleConfigAsEsm(originalError) {
438
479
  code: INVALID_CONFIG_MODULE_FORMAT,
439
480
  message: `Rollup transpiled your configuration to an ES module even though it appears to contain CommonJS elements. To resolve this, you can pass the "--bundleConfigAsCjs" flag to Rollup or change your configuration to only contain valid ESM code.\n\nOriginal error: ${originalError.message}`,
440
481
  stack: originalError.stack,
441
- url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
482
+ url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
442
483
  };
443
484
  }
444
485
  function errorCannotLoadConfigAsCjs(originalError) {
@@ -447,7 +488,7 @@ function errorCannotLoadConfigAsCjs(originalError) {
447
488
  code: INVALID_CONFIG_MODULE_FORMAT,
448
489
  message: `Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
449
490
  stack: originalError.stack,
450
- url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
491
+ url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
451
492
  };
452
493
  }
453
494
  function errorCannotLoadConfigAsEsm(originalError) {
@@ -456,21 +497,21 @@ function errorCannotLoadConfigAsEsm(originalError) {
456
497
  code: INVALID_CONFIG_MODULE_FORMAT,
457
498
  message: `Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to ".cjs" or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
458
499
  stack: originalError.stack,
459
- url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
500
+ url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
460
501
  };
461
502
  }
462
503
  function errorInvalidExportOptionValue(optionValue) {
463
504
  return {
464
505
  code: INVALID_EXPORT_OPTION,
465
506
  message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}".`,
466
- url: `https://rollupjs.org/guide/en/#outputexports`
507
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
467
508
  };
468
509
  }
469
510
  function errorIncompatibleExportOptionValue(optionValue, keys, entryModule) {
470
511
  return {
471
512
  code: INVALID_EXPORT_OPTION,
472
513
  message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${printQuotedStringList(keys)}`,
473
- url: 'https://rollupjs.org/guide/en/#outputexports'
514
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
474
515
  };
475
516
  }
476
517
  function errorInternalIdCannotBeExternal(source, importer) {
@@ -479,11 +520,11 @@ function errorInternalIdCannotBeExternal(source, importer) {
479
520
  message: `"${source}" is imported as an external by "${relativeId(importer)}", but is already an existing non-external module id.`
480
521
  };
481
522
  }
482
- function errorInvalidOption(option, urlHash, explanation, value) {
523
+ function errorInvalidOption(option, urlSnippet, explanation, value) {
483
524
  return {
484
525
  code: INVALID_OPTION,
485
526
  message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
486
- url: `https://rollupjs.org/guide/en/#${urlHash}`
527
+ url: getRollupUrl(urlSnippet)
487
528
  };
488
529
  }
489
530
  function errorInvalidAddonPluginHook(hook, plugin) {
@@ -531,7 +572,7 @@ function errorMissingConfig() {
531
572
  return {
532
573
  code: MISSING_CONFIG,
533
574
  message: 'Config file must export an options object, or an array of options objects',
534
- url: 'https://rollupjs.org/guide/en/#configuration-files'
575
+ url: getRollupUrl(URL_CONFIGURATION_FILES)
535
576
  };
536
577
  }
537
578
  function errorMissingExport(binding, importingModule, exporter) {
@@ -542,7 +583,7 @@ function errorMissingExport(binding, importingModule, exporter) {
542
583
  exporter,
543
584
  id: importingModule,
544
585
  message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`,
545
- url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
586
+ url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
546
587
  };
547
588
  }
548
589
  function errorMissingExternalConfig(file) {
@@ -557,7 +598,7 @@ function errorMissingGlobalName(externalId, guess) {
557
598
  id: externalId,
558
599
  message: `No name was provided for external module "${externalId}" in "output.globals" – guessing "${guess}".`,
559
600
  names: [guess],
560
- url: 'https://rollupjs.org/guide/en/#outputglobals'
601
+ url: getRollupUrl(URL_OUTPUT_GLOBALS)
561
602
  };
562
603
  }
563
604
  function errorImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
@@ -585,14 +626,14 @@ function errorMissingNameOptionForIifeExport() {
585
626
  return {
586
627
  code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
587
628
  message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`,
588
- url: 'https://rollupjs.org/guide/en/#outputname'
629
+ url: getRollupUrl(URL_OUTPUT_NAME)
589
630
  };
590
631
  }
591
632
  function errorMissingNameOptionForUmdExport() {
592
633
  return {
593
634
  code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
594
635
  message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.',
595
- url: 'https://rollupjs.org/guide/en/#outputname'
636
+ url: getRollupUrl(URL_OUTPUT_NAME)
596
637
  };
597
638
  }
598
639
  function errorMissingNodeBuiltins(externalBuiltins) {
@@ -607,7 +648,7 @@ function errorMissingFileOrDirOption() {
607
648
  return {
608
649
  code: MISSING_OPTION,
609
650
  message: 'You must specify "output.file" or "output.dir" for the build.',
610
- url: 'https://rollupjs.org/guide/en/#outputdir'
651
+ url: getRollupUrl(URL_OUTPUT_DIR)
611
652
  };
612
653
  }
613
654
  function errorMixedExport(facadeModuleId, name) {
@@ -615,7 +656,7 @@ function errorMixedExport(facadeModuleId, name) {
615
656
  code: MIXED_EXPORTS,
616
657
  id: facadeModuleId,
617
658
  message: `Entry module "${relativeId(facadeModuleId)}" is using named and default exports together. Consumers of your bundle will have to use \`${name || 'chunk'}.default\` to access the default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning.`,
618
- url: `https://rollupjs.org/guide/en/#outputexports`
659
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
619
660
  };
620
661
  }
621
662
  function errorModuleLevelDirective(directive, id) {
@@ -691,7 +732,13 @@ function errorSourcemapBroken(plugin) {
691
732
  code: SOURCEMAP_BROKEN,
692
733
  message: `Sourcemap is likely to be incorrect: a plugin (${plugin}) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
693
734
  plugin,
694
- url: `https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect`
735
+ url: getRollupUrl(URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT)
736
+ };
737
+ }
738
+ function errorConflictingSourcemapSources(filename) {
739
+ return {
740
+ code: SOURCEMAP_BROKEN,
741
+ message: `Multiple conflicting contents for sourcemap source ${filename}`
695
742
  };
696
743
  }
697
744
  function errorInvalidSourcemapForError(error, id, column, line, pos) {
@@ -721,7 +768,7 @@ function errorThisIsUndefined() {
721
768
  return {
722
769
  code: THIS_IS_UNDEFINED,
723
770
  message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
724
- url: `https://rollupjs.org/guide/en/#error-this-is-undefined`
771
+ url: getRollupUrl(URL_THIS_IS_UNDEFINED)
725
772
  };
726
773
  }
727
774
  function errorUnexpectedNamedImport(id, imported, isReexport) {
@@ -730,7 +777,7 @@ function errorUnexpectedNamedImport(id, imported, isReexport) {
730
777
  code: UNEXPECTED_NAMED_IMPORT,
731
778
  exporter: id,
732
779
  message: `The named export "${imported}" was ${importType}ed from the external module "${relativeId(id)}" even though its interop type is "defaultOnly". Either remove or change this ${importType} or change the value of the "output.interop" option.`,
733
- url: 'https://rollupjs.org/guide/en/#outputinterop'
780
+ url: getRollupUrl(URL_OUTPUT_INTEROP)
734
781
  };
735
782
  }
736
783
  function errorUnexpectedNamespaceReexport(id) {
@@ -738,7 +785,7 @@ function errorUnexpectedNamespaceReexport(id) {
738
785
  code: UNEXPECTED_NAMED_IMPORT,
739
786
  exporter: id,
740
787
  message: `There was a namespace "*" reexport from the external module "${relativeId(id)}" even though its interop type is "defaultOnly". This will be ignored as namespace reexports only reexport named exports. If this is not intended, either remove or change this reexport or change the value of the "output.interop" option.`,
741
- url: 'https://rollupjs.org/guide/en/#outputinterop'
788
+ url: getRollupUrl(URL_OUTPUT_INTEROP)
742
789
  };
743
790
  }
744
791
  function errorUnknownOption(optionType, unknownOptions, validOptions) {
@@ -773,7 +820,7 @@ function errorUnresolvedImportTreatedAsExternal(source, importer) {
773
820
  exporter: source,
774
821
  id: importer,
775
822
  message: `"${source}" is imported by "${relativeId(importer)}", but could not be resolved – treating it as an external dependency.`,
776
- url: 'https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency'
823
+ url: getRollupUrl(URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY)
777
824
  };
778
825
  }
779
826
  function errorUnusedExternalImports(externalId, names, importers) {
@@ -861,17 +908,17 @@ const generatedCodePresets = {
861
908
  }
862
909
  };
863
910
  const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
864
- const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (value) => {
911
+ const objectifyOptionWithPresets = (presets, optionName, urlSnippet, additionalValues) => (value) => {
865
912
  if (typeof value === 'string') {
866
913
  const preset = presets[value];
867
914
  if (preset) {
868
915
  return preset;
869
916
  }
870
- error(errorInvalidOption(optionName, getHashFromObjectOption(optionName), `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
917
+ error(errorInvalidOption(optionName, urlSnippet, `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
871
918
  }
872
919
  return objectifyOption(value);
873
920
  };
874
- const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
921
+ const getOptionWithPreset = (value, presets, optionName, urlSnippet, additionalValues) => {
875
922
  const presetName = value?.preset;
876
923
  if (presetName) {
877
924
  const preset = presets[presetName];
@@ -879,12 +926,11 @@ const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
879
926
  return { ...preset, ...value };
880
927
  }
881
928
  else {
882
- error(errorInvalidOption(`${optionName}.preset`, getHashFromObjectOption(optionName), `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
929
+ error(errorInvalidOption(`${optionName}.preset`, urlSnippet, `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
883
930
  }
884
931
  }
885
- return objectifyOptionWithPresets(presets, optionName, additionalValues)(value);
932
+ return objectifyOptionWithPresets(presets, optionName, urlSnippet, additionalValues)(value);
886
933
  };
887
- const getHashFromObjectOption = (optionName) => optionName.split('.').join('').toLowerCase();
888
934
  const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
889
935
 
890
936
  const commandAliases = {
@@ -974,7 +1020,7 @@ async function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
974
1020
  preserveSymlinks: getOption('preserveSymlinks'),
975
1021
  shimMissingExports: getOption('shimMissingExports'),
976
1022
  strictDeprecations: getOption('strictDeprecations'),
977
- treeshake: getObjectOption(config, overrides, 'treeshake', objectifyOptionWithPresets(treeshakePresets, 'treeshake', 'false, true, ')),
1023
+ treeshake: getObjectOption(config, overrides, 'treeshake', objectifyOptionWithPresets(treeshakePresets, 'treeshake', URL_TREESHAKE, 'false, true, ')),
978
1024
  watch: getWatch(config, overrides)
979
1025
  };
980
1026
  warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
@@ -1033,7 +1079,7 @@ async function mergeOutputOptions(config, overrides, warn) {
1033
1079
  footer: getOption('footer'),
1034
1080
  format: getOption('format'),
1035
1081
  freeze: getOption('freeze'),
1036
- generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', '')),
1082
+ generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '')),
1037
1083
  globals: getOption('globals'),
1038
1084
  hoistTransitiveImports: getOption('hoistTransitiveImports'),
1039
1085
  indent: getOption('indent'),
@@ -15429,6 +15475,23 @@ const getOutputBundle = (outputBundleBase) => {
15429
15475
  }
15430
15476
  });
15431
15477
  };
15478
+ const removeUnreferencedAssets = (outputBundle) => {
15479
+ const unreferencedAssets = new Set();
15480
+ const bundleEntries = Object.values(outputBundle);
15481
+ for (const asset of bundleEntries) {
15482
+ asset.type === 'asset' && asset.needsCodeReference && unreferencedAssets.add(asset.fileName);
15483
+ }
15484
+ for (const chunk of bundleEntries) {
15485
+ if (chunk.type === 'chunk') {
15486
+ for (const referencedFile of chunk.referencedFiles) {
15487
+ unreferencedAssets.has(referencedFile) && unreferencedAssets.delete(referencedFile);
15488
+ }
15489
+ }
15490
+ }
15491
+ for (const file of unreferencedAssets) {
15492
+ delete outputBundle[file];
15493
+ }
15494
+ };
15432
15495
 
15433
15496
  function renderNamePattern(pattern, patternName, replacements) {
15434
15497
  if (isPathFragment(pattern))
@@ -16913,9 +16976,7 @@ class Link {
16913
16976
  sourcesContent[sourceIndex] = content;
16914
16977
  }
16915
16978
  else if (content != null && sourcesContent[sourceIndex] !== content) {
16916
- return error({
16917
- message: `Multiple conflicting contents for sourcemap source ${filename}`
16918
- });
16979
+ return error(errorConflictingSourcemapSources(filename));
16919
16980
  }
16920
16981
  const tracedSegment = [segment[0], sourceIndex, line, column];
16921
16982
  if (name) {
@@ -17259,6 +17320,7 @@ class Bundle {
17259
17320
  await this.pluginDriver.hookParallel('renderError', [error_]);
17260
17321
  throw error_;
17261
17322
  }
17323
+ removeUnreferencedAssets(outputBundle);
17262
17324
  timeStart('generate bundle', 2);
17263
17325
  await this.pluginDriver.hookSeq('generateBundle', [
17264
17326
  this.outputOptions,
@@ -17354,13 +17416,13 @@ class Bundle {
17354
17416
  }
17355
17417
  function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
17356
17418
  if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
17357
- return error(errorInvalidOption('output.format', 'outputformat', 'UMD and IIFE output formats are not supported for code-splitting builds', outputOptions.format));
17419
+ return error(errorInvalidOption('output.format', URL_OUTPUT_FORMAT, 'UMD and IIFE output formats are not supported for code-splitting builds', outputOptions.format));
17358
17420
  if (typeof outputOptions.file === 'string')
17359
- return error(errorInvalidOption('output.file', 'outputdir', 'when building multiple chunks, the "output.dir" option must be used, not "output.file". To inline dynamic imports, set the "inlineDynamicImports" option'));
17421
+ return error(errorInvalidOption('output.file', URL_OUTPUT_DIR, 'when building multiple chunks, the "output.dir" option must be used, not "output.file". To inline dynamic imports, set the "inlineDynamicImports" option'));
17360
17422
  if (outputOptions.sourcemapFile)
17361
- return error(errorInvalidOption('output.sourcemapFile', 'outputsourcemapfile', '"output.sourcemapFile" is only supported for single-file builds'));
17423
+ return error(errorInvalidOption('output.sourcemapFile', URL_OUTPUT_SOURCEMAPFILE, '"output.sourcemapFile" is only supported for single-file builds'));
17362
17424
  if (!outputOptions.amd.autoId && outputOptions.amd.id)
17363
- onWarn(errorInvalidOption('output.amd.id', 'outputamd', 'this option is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath" instead'));
17425
+ onWarn(errorInvalidOption('output.amd.id', URL_OUTPUT_AMD, 'this option is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath" instead'));
17364
17426
  }
17365
17427
  function getIncludedModules(modulesById) {
17366
17428
  const includedModules = [];
@@ -23914,6 +23976,7 @@ class FileEmitter {
23914
23976
  const consumedAsset = {
23915
23977
  fileName: emittedAsset.fileName,
23916
23978
  name: emittedAsset.name,
23979
+ needsCodeReference: !!emittedAsset.needsCodeReference,
23917
23980
  source,
23918
23981
  type: 'asset'
23919
23982
  };
@@ -23976,6 +24039,7 @@ class FileEmitter {
23976
24039
  bundle[fileName] = {
23977
24040
  fileName,
23978
24041
  name: consumedFile.name,
24042
+ needsCodeReference: consumedFile.needsCodeReference,
23979
24043
  source,
23980
24044
  type: 'asset'
23981
24045
  };
@@ -24966,7 +25030,7 @@ const getTreeshake = (config) => {
24966
25030
  if (configTreeshake === false) {
24967
25031
  return false;
24968
25032
  }
24969
- const configWithPreset = getOptionWithPreset(config.treeshake, treeshakePresets, 'treeshake', 'false, true, ');
25033
+ const configWithPreset = getOptionWithPreset(config.treeshake, treeshakePresets, 'treeshake', URL_TREESHAKE, 'false, true, ');
24970
25034
  return {
24971
25035
  annotations: configWithPreset.annotations !== false,
24972
25036
  correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
@@ -24994,7 +25058,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24994
25058
  return id => ids.has(id);
24995
25059
  }
24996
25060
  if (moduleSideEffectsOption) {
24997
- error(errorInvalidOption('treeshake.moduleSideEffects', 'treeshake', 'please use one of false, "no-external", a function or an array'));
25061
+ error(errorInvalidOption('treeshake.moduleSideEffects', URL_TREESHAKE, 'please use one of false, "no-external", a function or an array'));
24998
25062
  }
24999
25063
  return () => true;
25000
25064
  };
@@ -25011,16 +25075,6 @@ function sanitizeFileName(name) {
25011
25075
  return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
25012
25076
  }
25013
25077
 
25014
- function isValidUrl(url) {
25015
- try {
25016
- new URL(url);
25017
- }
25018
- catch {
25019
- return false;
25020
- }
25021
- return true;
25022
- }
25023
-
25024
25078
  async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
25025
25079
  // These are options that may trigger special warnings or behaviour later
25026
25080
  // if the user did not select an explicit value
@@ -25091,10 +25145,10 @@ const getFile = (config, preserveModules, inputOptions) => {
25091
25145
  const { file } = config;
25092
25146
  if (typeof file === 'string') {
25093
25147
  if (preserveModules) {
25094
- return error(errorInvalidOption('output.file', 'outputdir', 'you must set "output.dir" instead of "output.file" when using the "output.preserveModules" option'));
25148
+ return error(errorInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when using the "output.preserveModules" option'));
25095
25149
  }
25096
25150
  if (!Array.isArray(inputOptions.input))
25097
- return error(errorInvalidOption('output.file', 'outputdir', 'you must set "output.dir" instead of "output.file" when providing named inputs'));
25151
+ return error(errorInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when providing named inputs'));
25098
25152
  }
25099
25153
  return file;
25100
25154
  };
@@ -25121,10 +25175,7 @@ const getFormat = (config) => {
25121
25175
  return configFormat;
25122
25176
  }
25123
25177
  default: {
25124
- return error({
25125
- message: `You must specify "output.format", which can be one of "amd", "cjs", "system", "es", "iife" or "umd".`,
25126
- url: `https://rollupjs.org/guide/en/#outputformat`
25127
- });
25178
+ return error(errorInvalidOption('output.format', URL_OUTPUT_FORMAT, `Valid values are "amd", "cjs", "system", "es", "iife" or "umd"`, configFormat));
25128
25179
  }
25129
25180
  }
25130
25181
  };
@@ -25132,7 +25183,7 @@ const getInlineDynamicImports = (config, inputOptions) => {
25132
25183
  const inlineDynamicImports = (config.inlineDynamicImports ?? inputOptions.inlineDynamicImports) || false;
25133
25184
  const { input } = inputOptions;
25134
25185
  if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
25135
- return error(errorInvalidOption('output.inlineDynamicImports', 'outputinlinedynamicimports', 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
25186
+ return error(errorInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
25136
25187
  }
25137
25188
  return inlineDynamicImports;
25138
25189
  };
@@ -25140,10 +25191,10 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
25140
25191
  const preserveModules = (config.preserveModules ?? inputOptions.preserveModules) || false;
25141
25192
  if (preserveModules) {
25142
25193
  if (inlineDynamicImports) {
25143
- return error(errorInvalidOption('output.inlineDynamicImports', 'outputinlinedynamicimports', `this option is not supported for "output.preserveModules"`));
25194
+ return error(errorInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, `this option is not supported for "output.preserveModules"`));
25144
25195
  }
25145
25196
  if (inputOptions.preserveEntrySignatures === false) {
25146
- return error(errorInvalidOption('preserveEntrySignatures', 'preserveentrysignatures', 'setting this option to false is not supported for "output.preserveModules"'));
25197
+ return error(errorInvalidOption('preserveEntrySignatures', URL_PRESERVEENTRYSIGNATURES, 'setting this option to false is not supported for "output.preserveModules"'));
25147
25198
  }
25148
25199
  }
25149
25200
  return preserveModules;
@@ -25171,10 +25222,10 @@ const getAmd = (config) => {
25171
25222
  ...config.amd
25172
25223
  };
25173
25224
  if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
25174
- return error(errorInvalidOption('output.amd.id', 'outputamd', 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'));
25225
+ return error(errorInvalidOption('output.amd.id', URL_OUTPUT_AMD, 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'));
25175
25226
  }
25176
25227
  if (mergedOption.basePath && !mergedOption.autoId) {
25177
- return error(errorInvalidOption('output.amd.basePath', 'outputamd', 'this option only works with "output.amd.autoId"'));
25228
+ return error(errorInvalidOption('output.amd.basePath', URL_OUTPUT_AMD, 'this option only works with "output.amd.autoId"'));
25178
25229
  }
25179
25230
  return mergedOption.autoId
25180
25231
  ? {
@@ -25201,7 +25252,7 @@ const getAddon = (config, name) => {
25201
25252
  const getDir = (config, file) => {
25202
25253
  const { dir } = config;
25203
25254
  if (typeof dir === 'string' && typeof file === 'string') {
25204
- return error(errorInvalidOption('output.dir', 'outputdir', 'you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks'));
25255
+ return error(errorInvalidOption('output.dir', URL_OUTPUT_DIR, 'you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks'));
25205
25256
  }
25206
25257
  return dir;
25207
25258
  };
@@ -25210,7 +25261,7 @@ const getDynamicImportFunction = (config, inputOptions, format) => {
25210
25261
  if (configDynamicImportFunction) {
25211
25262
  warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, true, inputOptions);
25212
25263
  if (format !== 'es') {
25213
- inputOptions.onwarn(errorInvalidOption('output.dynamicImportFunction', 'outputdynamicImportFunction', 'this option is ignored for formats other than "es"'));
25264
+ inputOptions.onwarn(errorInvalidOption('output.dynamicImportFunction', URL_OUTPUT_DYNAMICIMPORTFUNCTION, 'this option is ignored for formats other than "es"'));
25214
25265
  }
25215
25266
  }
25216
25267
  return configDynamicImportFunction;
@@ -25233,7 +25284,7 @@ function getExports(config, unsetOptions) {
25233
25284
  return configExports || 'auto';
25234
25285
  }
25235
25286
  const getGeneratedCode = (config, preferConst) => {
25236
- const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', '');
25287
+ const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '');
25237
25288
  return {
25238
25289
  arrowFunctions: configWithPreset.arrowFunctions === true,
25239
25290
  constBindings: configWithPreset.constBindings === true || preferConst,
@@ -25271,7 +25322,7 @@ const getInterop = (config) => {
25271
25322
  };
25272
25323
  const validateInterop = (interop) => {
25273
25324
  if (!ALLOWED_INTEROP_TYPES.has(interop)) {
25274
- return error(errorInvalidOption('output.interop', 'outputinterop',
25325
+ return error(errorInvalidOption('output.interop', URL_OUTPUT_INTEROP,
25275
25326
  // eslint-disable-next-line unicorn/prefer-spread
25276
25327
  `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
25277
25328
  }
@@ -25281,10 +25332,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
25281
25332
  const configManualChunks = config.manualChunks || inputOptions.manualChunks;
25282
25333
  if (configManualChunks) {
25283
25334
  if (inlineDynamicImports) {
25284
- return error(errorInvalidOption('output.manualChunks', 'outputmanualchunks', 'this option is not supported for "output.inlineDynamicImports"'));
25335
+ return error(errorInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.inlineDynamicImports"'));
25285
25336
  }
25286
25337
  if (preserveModules) {
25287
- return error(errorInvalidOption('output.manualChunks', 'outputmanualchunks', 'this option is not supported for "output.preserveModules"'));
25338
+ return error(errorInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.preserveModules"'));
25288
25339
  }
25289
25340
  }
25290
25341
  return configManualChunks || {};
@@ -25304,7 +25355,7 @@ const getSourcemapBaseUrl = (config) => {
25304
25355
  if (isValidUrl(sourcemapBaseUrl)) {
25305
25356
  return sourcemapBaseUrl;
25306
25357
  }
25307
- return error(errorInvalidOption('output.sourcemapBaseUrl', 'outputsourcemapbaseurl', `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
25358
+ return error(errorInvalidOption('output.sourcemapBaseUrl', URL_OUTPUT_SOURCEMAPBASEURL, `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
25308
25359
  }
25309
25360
  };
25310
25361
 
@@ -25527,13 +25578,20 @@ async function watchInternal(configs, emitter) {
25527
25578
  const optionsList = await Promise.all(ensureArray$1(configs).map(config => mergeOptions(config)));
25528
25579
  const watchOptionsList = optionsList.filter(config => config.watch !== false);
25529
25580
  if (watchOptionsList.length === 0) {
25530
- return error(errorInvalidOption('watch', 'watch', 'there must be at least one config where "watch" is not set to "false"'));
25581
+ return error(errorInvalidOption('watch', URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
25531
25582
  }
25532
25583
  await loadFsEvents();
25533
25584
  const { Watcher } = await Promise.resolve().then(() => require('./watch.js'));
25534
25585
  new Watcher(watchOptionsList, emitter);
25535
25586
  }
25536
25587
 
25588
+ exports.URL_AVOIDING_EVAL = URL_AVOIDING_EVAL;
25589
+ exports.URL_NAME_IS_NOT_EXPORTED = URL_NAME_IS_NOT_EXPORTED;
25590
+ exports.URL_OUTPUT_EXPORTS = URL_OUTPUT_EXPORTS;
25591
+ exports.URL_OUTPUT_GLOBALS = URL_OUTPUT_GLOBALS;
25592
+ exports.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT;
25593
+ exports.URL_THIS_IS_UNDEFINED = URL_THIS_IS_UNDEFINED;
25594
+ exports.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY;
25537
25595
  exports.bold = bold;
25538
25596
  exports.commandAliases = commandAliases;
25539
25597
  exports.commonjsGlobal = commonjsGlobal;
@@ -25554,6 +25612,7 @@ exports.getAliasName = getAliasName;
25554
25612
  exports.getAugmentedNamespace = getAugmentedNamespace;
25555
25613
  exports.getNewArray = getNewArray;
25556
25614
  exports.getOrCreate = getOrCreate;
25615
+ exports.getRollupUrl = getRollupUrl;
25557
25616
  exports.gray = gray;
25558
25617
  exports.green = green;
25559
25618
  exports.handleError = handleError;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.1
4
- Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
3
+ Rollup.js v3.11.0
4
+ Thu, 26 Jan 2023 12:06:32 GMT - commit 9ff0128634106710ba884be319804d232581670f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.1
4
- Fri, 20 Jan 2023 15:10:53 GMT - commit c8c40c8fbb05a58b318231f9d8df6c6fee0c1447
3
+ Rollup.js v3.11.0
4
+ Thu, 26 Jan 2023 12:06:32 GMT - commit 9ff0128634106710ba884be319804d232581670f
5
5
 
6
6
  https://github.com/rollup/rollup
7
7