rollup 3.10.0 → 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.
package/README.md CHANGED
@@ -35,7 +35,7 @@ Rollup is a module bundler for JavaScript which compiles small pieces of code in
35
35
 
36
36
  ## Quick Start Guide
37
37
 
38
- Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/guide/en/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/).
38
+ Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/command-line-interface/) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/javascript-api/). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/introduction/).
39
39
 
40
40
  ### Commands
41
41
 
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.10.0
6
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
5
+ Rollup.js v3.11.0
6
+ Thu, 26 Jan 2023 12:06:32 GMT - commit 9ff0128634106710ba884be319804d232581670f
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
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.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
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
 
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.10.0";
19
+ var version$1 = "3.11.0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -2036,6 +2036,44 @@ function printQuotedStringList(list, verbs) {
2036
2036
  return output;
2037
2037
  }
2038
2038
 
2039
+ function isValidUrl(url) {
2040
+ try {
2041
+ new URL(url);
2042
+ }
2043
+ catch {
2044
+ return false;
2045
+ }
2046
+ return true;
2047
+ }
2048
+ function getRollupUrl(snippet) {
2049
+ return `https://rollupjs.org/${snippet}`;
2050
+ }
2051
+
2052
+ // troubleshooting
2053
+ const URL_AVOIDING_EVAL = 'troubleshooting/#avoiding-eval';
2054
+ const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by-module';
2055
+ const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
2056
+ const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
2057
+ const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
2058
+ // configuration-options
2059
+ const URL_OUTPUT_AMD = 'configuration-options/#output-amd';
2060
+ const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
2061
+ const URL_OUTPUT_DYNAMICIMPORTFUNCTION = 'configuration-options/#output-dynamicimportfunction';
2062
+ const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
2063
+ const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
2064
+ const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
2065
+ const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
2066
+ const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
2067
+ const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
2068
+ const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
2069
+ const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
2070
+ const URL_OUTPUT_NAME = 'configuration-options/#output-name';
2071
+ const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
2072
+ const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
2073
+ const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
2074
+ const URL_TREESHAKE = 'configuration-options/#treeshake';
2075
+ const URL_WATCH = 'configuration-options/#watch';
2076
+
2039
2077
  function error(base) {
2040
2078
  if (!(base instanceof Error)) {
2041
2079
  base = Object.assign(new Error(base.message), base);
@@ -2192,7 +2230,7 @@ function errorEval(id) {
2192
2230
  code: EVAL,
2193
2231
  id,
2194
2232
  message: `Use of eval in "${relativeId(id)}" is strongly discouraged as it poses security risks and may cause issues with minification.`,
2195
- url: 'https://rollupjs.org/guide/en/#avoiding-eval'
2233
+ url: getRollupUrl(URL_AVOIDING_EVAL)
2196
2234
  };
2197
2235
  }
2198
2236
  function errorExternalSyntheticExports(id, importer) {
@@ -2218,7 +2256,7 @@ function errorIllegalIdentifierAsName(name) {
2218
2256
  return {
2219
2257
  code: ILLEGAL_IDENTIFIER_AS_NAME,
2220
2258
  message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`,
2221
- url: 'https://rollupjs.org/guide/en/#outputextend'
2259
+ url: getRollupUrl(URL_OUTPUT_EXTEND)
2222
2260
  };
2223
2261
  }
2224
2262
  function errorIllegalImportReassignment(name, importingId) {
@@ -2255,14 +2293,14 @@ function errorInvalidExportOptionValue(optionValue) {
2255
2293
  return {
2256
2294
  code: INVALID_EXPORT_OPTION,
2257
2295
  message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}".`,
2258
- url: `https://rollupjs.org/guide/en/#outputexports`
2296
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
2259
2297
  };
2260
2298
  }
2261
2299
  function errorIncompatibleExportOptionValue(optionValue, keys, entryModule) {
2262
2300
  return {
2263
2301
  code: INVALID_EXPORT_OPTION,
2264
2302
  message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${printQuotedStringList(keys)}`,
2265
- url: 'https://rollupjs.org/guide/en/#outputexports'
2303
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
2266
2304
  };
2267
2305
  }
2268
2306
  function errorInternalIdCannotBeExternal(source, importer) {
@@ -2271,11 +2309,11 @@ function errorInternalIdCannotBeExternal(source, importer) {
2271
2309
  message: `"${source}" is imported as an external by "${relativeId(importer)}", but is already an existing non-external module id.`
2272
2310
  };
2273
2311
  }
2274
- function errorInvalidOption(option, urlHash, explanation, value) {
2312
+ function errorInvalidOption(option, urlSnippet, explanation, value) {
2275
2313
  return {
2276
2314
  code: INVALID_OPTION,
2277
2315
  message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
2278
- url: `https://rollupjs.org/guide/en/#${urlHash}`
2316
+ url: getRollupUrl(urlSnippet)
2279
2317
  };
2280
2318
  }
2281
2319
  function errorInvalidAddonPluginHook(hook, plugin) {
@@ -2327,7 +2365,7 @@ function errorMissingExport(binding, importingModule, exporter) {
2327
2365
  exporter,
2328
2366
  id: importingModule,
2329
2367
  message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`,
2330
- url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
2368
+ url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
2331
2369
  };
2332
2370
  }
2333
2371
  function errorMissingGlobalName(externalId, guess) {
@@ -2336,7 +2374,7 @@ function errorMissingGlobalName(externalId, guess) {
2336
2374
  id: externalId,
2337
2375
  message: `No name was provided for external module "${externalId}" in "output.globals" – guessing "${guess}".`,
2338
2376
  names: [guess],
2339
- url: 'https://rollupjs.org/guide/en/#outputglobals'
2377
+ url: getRollupUrl(URL_OUTPUT_GLOBALS)
2340
2378
  };
2341
2379
  }
2342
2380
  function errorImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
@@ -2364,14 +2402,14 @@ function errorMissingNameOptionForIifeExport() {
2364
2402
  return {
2365
2403
  code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
2366
2404
  message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`,
2367
- url: 'https://rollupjs.org/guide/en/#outputname'
2405
+ url: getRollupUrl(URL_OUTPUT_NAME)
2368
2406
  };
2369
2407
  }
2370
2408
  function errorMissingNameOptionForUmdExport() {
2371
2409
  return {
2372
2410
  code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
2373
2411
  message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.',
2374
- url: 'https://rollupjs.org/guide/en/#outputname'
2412
+ url: getRollupUrl(URL_OUTPUT_NAME)
2375
2413
  };
2376
2414
  }
2377
2415
  function errorMissingNodeBuiltins(externalBuiltins) {
@@ -2386,7 +2424,7 @@ function errorMissingFileOrDirOption() {
2386
2424
  return {
2387
2425
  code: MISSING_OPTION,
2388
2426
  message: 'You must specify "output.file" or "output.dir" for the build.',
2389
- url: 'https://rollupjs.org/guide/en/#outputdir'
2427
+ url: getRollupUrl(URL_OUTPUT_DIR)
2390
2428
  };
2391
2429
  }
2392
2430
  function errorMixedExport(facadeModuleId, name) {
@@ -2394,7 +2432,7 @@ function errorMixedExport(facadeModuleId, name) {
2394
2432
  code: MIXED_EXPORTS,
2395
2433
  id: facadeModuleId,
2396
2434
  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.`,
2397
- url: `https://rollupjs.org/guide/en/#outputexports`
2435
+ url: getRollupUrl(URL_OUTPUT_EXPORTS)
2398
2436
  };
2399
2437
  }
2400
2438
  function errorModuleLevelDirective(directive, id) {
@@ -2464,7 +2502,13 @@ function errorSourcemapBroken(plugin) {
2464
2502
  code: SOURCEMAP_BROKEN,
2465
2503
  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`,
2466
2504
  plugin,
2467
- url: `https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect`
2505
+ url: getRollupUrl(URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT)
2506
+ };
2507
+ }
2508
+ function errorConflictingSourcemapSources(filename) {
2509
+ return {
2510
+ code: SOURCEMAP_BROKEN,
2511
+ message: `Multiple conflicting contents for sourcemap source ${filename}`
2468
2512
  };
2469
2513
  }
2470
2514
  function errorInvalidSourcemapForError(error, id, column, line, pos) {
@@ -2494,7 +2538,7 @@ function errorThisIsUndefined() {
2494
2538
  return {
2495
2539
  code: THIS_IS_UNDEFINED,
2496
2540
  message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
2497
- url: `https://rollupjs.org/guide/en/#error-this-is-undefined`
2541
+ url: getRollupUrl(URL_THIS_IS_UNDEFINED)
2498
2542
  };
2499
2543
  }
2500
2544
  function errorUnexpectedNamedImport(id, imported, isReexport) {
@@ -2503,7 +2547,7 @@ function errorUnexpectedNamedImport(id, imported, isReexport) {
2503
2547
  code: UNEXPECTED_NAMED_IMPORT,
2504
2548
  exporter: id,
2505
2549
  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.`,
2506
- url: 'https://rollupjs.org/guide/en/#outputinterop'
2550
+ url: getRollupUrl(URL_OUTPUT_INTEROP)
2507
2551
  };
2508
2552
  }
2509
2553
  function errorUnexpectedNamespaceReexport(id) {
@@ -2511,7 +2555,7 @@ function errorUnexpectedNamespaceReexport(id) {
2511
2555
  code: UNEXPECTED_NAMED_IMPORT,
2512
2556
  exporter: id,
2513
2557
  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.`,
2514
- url: 'https://rollupjs.org/guide/en/#outputinterop'
2558
+ url: getRollupUrl(URL_OUTPUT_INTEROP)
2515
2559
  };
2516
2560
  }
2517
2561
  function errorUnknownOption(optionType, unknownOptions, validOptions) {
@@ -2546,7 +2590,7 @@ function errorUnresolvedImportTreatedAsExternal(source, importer) {
2546
2590
  exporter: source,
2547
2591
  id: importer,
2548
2592
  message: `"${source}" is imported by "${relativeId(importer)}", but could not be resolved – treating it as an external dependency.`,
2549
- url: 'https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency'
2593
+ url: getRollupUrl(URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY)
2550
2594
  };
2551
2595
  }
2552
2596
  function errorUnusedExternalImports(externalId, names, importers) {
@@ -9039,7 +9083,7 @@ class MemberExpression extends NodeBase {
9039
9083
  this.bound = true;
9040
9084
  const path = getPathIfNotComputed(this);
9041
9085
  const baseVariable = path && this.scope.findVariable(path[0].key);
9042
- if (baseVariable && baseVariable.isNamespace) {
9086
+ if (baseVariable?.isNamespace) {
9043
9087
  const resolvedVariable = resolveNamespaceVariables(baseVariable, path.slice(1), this.context);
9044
9088
  if (!resolvedVariable) {
9045
9089
  super.bind();
@@ -9174,6 +9218,13 @@ class MemberExpression extends NodeBase {
9174
9218
  this.propertyKey = getResolvablePropertyKey(this);
9175
9219
  this.accessInteraction = { thisArg: this.object, type: INTERACTION_ACCESSED };
9176
9220
  }
9221
+ isSkippedAsOptional(origin) {
9222
+ return (!this.variable &&
9223
+ !this.isUndefined &&
9224
+ (this.object.isSkippedAsOptional?.(origin) ||
9225
+ (this.optional &&
9226
+ this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
9227
+ }
9177
9228
  render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
9178
9229
  if (this.variable || this.isUndefined) {
9179
9230
  const { snippets: { getPropertyAccess } } = options;
@@ -9278,9 +9329,12 @@ function resolveNamespaceVariables(baseVariable, path, astContext) {
9278
9329
  const exportName = path[0].key;
9279
9330
  const variable = baseVariable.context.traceExport(exportName);
9280
9331
  if (!variable) {
9281
- const fileName = baseVariable.context.fileName;
9282
- astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9283
- return 'undefined';
9332
+ if (path.length === 1) {
9333
+ const fileName = baseVariable.context.fileName;
9334
+ astContext.warn(errorMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
9335
+ return 'undefined';
9336
+ }
9337
+ return null;
9284
9338
  }
9285
9339
  return resolveNamespaceVariables(variable, path.slice(1), astContext);
9286
9340
  }
@@ -9422,6 +9476,11 @@ class CallExpression extends CallExpressionBase {
9422
9476
  }
9423
9477
  this.callee.includeCallArguments(context, this.arguments);
9424
9478
  }
9479
+ isSkippedAsOptional(origin) {
9480
+ return (this.callee.isSkippedAsOptional?.(origin) ||
9481
+ (this.optional &&
9482
+ this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
9483
+ }
9425
9484
  render(code, options, { renderedSurroundingElement } = BLANK) {
9426
9485
  this.callee.render(code, options, {
9427
9486
  isCalleeOfRenderedParent: true,
@@ -9481,34 +9540,19 @@ class CatchClause extends NodeBase {
9481
9540
  }
9482
9541
  }
9483
9542
 
9484
- const unset$1 = Symbol('unset');
9485
9543
  class ChainExpression extends NodeBase {
9486
- constructor() {
9487
- super(...arguments);
9488
- this.objectValue = unset$1;
9489
- }
9490
- deoptimizeCache() {
9491
- this.objectValue = UnknownValue;
9492
- }
9493
- getLiteralValueAtPath() {
9494
- if (this.getObjectValue() == null)
9544
+ // deoptimizations are not relevant as we are not caching values
9545
+ deoptimizeCache() { }
9546
+ getLiteralValueAtPath(path, recursionTracker, origin) {
9547
+ if (this.expression.isSkippedAsOptional(origin))
9495
9548
  return undefined;
9496
- return UnknownValue;
9549
+ return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
9497
9550
  }
9498
9551
  hasEffects(context) {
9499
- if (this.getObjectValue() == null)
9552
+ if (this.expression.isSkippedAsOptional(this))
9500
9553
  return false;
9501
9554
  return this.expression.hasEffects(context);
9502
9555
  }
9503
- getObjectValue() {
9504
- if (this.objectValue === unset$1) {
9505
- let object = this.expression.type === 'CallExpression' ? this.expression.callee : this.expression.object;
9506
- if (object.type === 'MemberExpression')
9507
- object = object.object;
9508
- this.objectValue = object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
9509
- }
9510
- return this.objectValue;
9511
- }
9512
9556
  }
9513
9557
 
9514
9558
  class ClassBodyScope extends ChildScope {
@@ -14913,6 +14957,23 @@ const getOutputBundle = (outputBundleBase) => {
14913
14957
  }
14914
14958
  });
14915
14959
  };
14960
+ const removeUnreferencedAssets = (outputBundle) => {
14961
+ const unreferencedAssets = new Set();
14962
+ const bundleEntries = Object.values(outputBundle);
14963
+ for (const asset of bundleEntries) {
14964
+ asset.type === 'asset' && asset.needsCodeReference && unreferencedAssets.add(asset.fileName);
14965
+ }
14966
+ for (const chunk of bundleEntries) {
14967
+ if (chunk.type === 'chunk') {
14968
+ for (const referencedFile of chunk.referencedFiles) {
14969
+ unreferencedAssets.has(referencedFile) && unreferencedAssets.delete(referencedFile);
14970
+ }
14971
+ }
14972
+ }
14973
+ for (const file of unreferencedAssets) {
14974
+ delete outputBundle[file];
14975
+ }
14976
+ };
14916
14977
 
14917
14978
  function renderNamePattern(pattern, patternName, replacements) {
14918
14979
  if (isPathFragment(pattern))
@@ -16397,9 +16458,7 @@ class Link {
16397
16458
  sourcesContent[sourceIndex] = content;
16398
16459
  }
16399
16460
  else if (content != null && sourcesContent[sourceIndex] !== content) {
16400
- return error({
16401
- message: `Multiple conflicting contents for sourcemap source ${filename}`
16402
- });
16461
+ return error(errorConflictingSourcemapSources(filename));
16403
16462
  }
16404
16463
  const tracedSegment = [segment[0], sourceIndex, line, column];
16405
16464
  if (name) {
@@ -16743,6 +16802,7 @@ class Bundle {
16743
16802
  await this.pluginDriver.hookParallel('renderError', [error_]);
16744
16803
  throw error_;
16745
16804
  }
16805
+ removeUnreferencedAssets(outputBundle);
16746
16806
  timeStart('generate bundle', 2);
16747
16807
  await this.pluginDriver.hookSeq('generateBundle', [
16748
16808
  this.outputOptions,
@@ -16838,13 +16898,13 @@ class Bundle {
16838
16898
  }
16839
16899
  function validateOptionsForMultiChunkOutput(outputOptions, onWarn) {
16840
16900
  if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
16841
- return error(errorInvalidOption('output.format', 'outputformat', 'UMD and IIFE output formats are not supported for code-splitting builds', outputOptions.format));
16901
+ return error(errorInvalidOption('output.format', URL_OUTPUT_FORMAT, 'UMD and IIFE output formats are not supported for code-splitting builds', outputOptions.format));
16842
16902
  if (typeof outputOptions.file === 'string')
16843
- 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'));
16903
+ 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'));
16844
16904
  if (outputOptions.sourcemapFile)
16845
- return error(errorInvalidOption('output.sourcemapFile', 'outputsourcemapfile', '"output.sourcemapFile" is only supported for single-file builds'));
16905
+ return error(errorInvalidOption('output.sourcemapFile', URL_OUTPUT_SOURCEMAPFILE, '"output.sourcemapFile" is only supported for single-file builds'));
16846
16906
  if (!outputOptions.amd.autoId && outputOptions.amd.id)
16847
- 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'));
16907
+ 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'));
16848
16908
  }
16849
16909
  function getIncludedModules(modulesById) {
16850
16910
  const includedModules = [];
@@ -23398,6 +23458,7 @@ class FileEmitter {
23398
23458
  const consumedAsset = {
23399
23459
  fileName: emittedAsset.fileName,
23400
23460
  name: emittedAsset.name,
23461
+ needsCodeReference: !!emittedAsset.needsCodeReference,
23401
23462
  source,
23402
23463
  type: 'asset'
23403
23464
  };
@@ -23460,6 +23521,7 @@ class FileEmitter {
23460
23521
  bundle[fileName] = {
23461
23522
  fileName,
23462
23523
  name: consumedFile.name,
23524
+ needsCodeReference: consumedFile.needsCodeReference,
23463
23525
  source,
23464
23526
  type: 'asset'
23465
23527
  };
@@ -24380,17 +24442,17 @@ const generatedCodePresets = {
24380
24442
  }
24381
24443
  };
24382
24444
  const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
24383
- const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (value) => {
24445
+ const objectifyOptionWithPresets = (presets, optionName, urlSnippet, additionalValues) => (value) => {
24384
24446
  if (typeof value === 'string') {
24385
24447
  const preset = presets[value];
24386
24448
  if (preset) {
24387
24449
  return preset;
24388
24450
  }
24389
- 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));
24451
+ error(errorInvalidOption(optionName, urlSnippet, `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
24390
24452
  }
24391
24453
  return objectifyOption(value);
24392
24454
  };
24393
- const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
24455
+ const getOptionWithPreset = (value, presets, optionName, urlSnippet, additionalValues) => {
24394
24456
  const presetName = value?.preset;
24395
24457
  if (presetName) {
24396
24458
  const preset = presets[presetName];
@@ -24398,12 +24460,11 @@ const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
24398
24460
  return { ...preset, ...value };
24399
24461
  }
24400
24462
  else {
24401
- error(errorInvalidOption(`${optionName}.preset`, getHashFromObjectOption(optionName), `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
24463
+ error(errorInvalidOption(`${optionName}.preset`, urlSnippet, `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
24402
24464
  }
24403
24465
  }
24404
- return objectifyOptionWithPresets(presets, optionName, additionalValues)(value);
24466
+ return objectifyOptionWithPresets(presets, optionName, urlSnippet, additionalValues)(value);
24405
24467
  };
24406
- const getHashFromObjectOption = (optionName) => optionName.split('.').join('').toLowerCase();
24407
24468
  const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
24408
24469
 
24409
24470
  async function normalizeInputOptions(config) {
@@ -24547,7 +24608,7 @@ const getTreeshake = (config) => {
24547
24608
  if (configTreeshake === false) {
24548
24609
  return false;
24549
24610
  }
24550
- const configWithPreset = getOptionWithPreset(config.treeshake, treeshakePresets, 'treeshake', 'false, true, ');
24611
+ const configWithPreset = getOptionWithPreset(config.treeshake, treeshakePresets, 'treeshake', URL_TREESHAKE, 'false, true, ');
24551
24612
  return {
24552
24613
  annotations: configWithPreset.annotations !== false,
24553
24614
  correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
@@ -24575,7 +24636,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
24575
24636
  return id => ids.has(id);
24576
24637
  }
24577
24638
  if (moduleSideEffectsOption) {
24578
- error(errorInvalidOption('treeshake.moduleSideEffects', 'treeshake', 'please use one of false, "no-external", a function or an array'));
24639
+ error(errorInvalidOption('treeshake.moduleSideEffects', URL_TREESHAKE, 'please use one of false, "no-external", a function or an array'));
24579
24640
  }
24580
24641
  return () => true;
24581
24642
  };
@@ -24592,16 +24653,6 @@ function sanitizeFileName(name) {
24592
24653
  return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
24593
24654
  }
24594
24655
 
24595
- function isValidUrl(url) {
24596
- try {
24597
- new URL(url);
24598
- }
24599
- catch {
24600
- return false;
24601
- }
24602
- return true;
24603
- }
24604
-
24605
24656
  async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
24606
24657
  // These are options that may trigger special warnings or behaviour later
24607
24658
  // if the user did not select an explicit value
@@ -24672,10 +24723,10 @@ const getFile = (config, preserveModules, inputOptions) => {
24672
24723
  const { file } = config;
24673
24724
  if (typeof file === 'string') {
24674
24725
  if (preserveModules) {
24675
- return error(errorInvalidOption('output.file', 'outputdir', 'you must set "output.dir" instead of "output.file" when using the "output.preserveModules" option'));
24726
+ return error(errorInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when using the "output.preserveModules" option'));
24676
24727
  }
24677
24728
  if (!Array.isArray(inputOptions.input))
24678
- return error(errorInvalidOption('output.file', 'outputdir', 'you must set "output.dir" instead of "output.file" when providing named inputs'));
24729
+ return error(errorInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when providing named inputs'));
24679
24730
  }
24680
24731
  return file;
24681
24732
  };
@@ -24702,10 +24753,7 @@ const getFormat = (config) => {
24702
24753
  return configFormat;
24703
24754
  }
24704
24755
  default: {
24705
- return error({
24706
- message: `You must specify "output.format", which can be one of "amd", "cjs", "system", "es", "iife" or "umd".`,
24707
- url: `https://rollupjs.org/guide/en/#outputformat`
24708
- });
24756
+ return error(errorInvalidOption('output.format', URL_OUTPUT_FORMAT, `Valid values are "amd", "cjs", "system", "es", "iife" or "umd"`, configFormat));
24709
24757
  }
24710
24758
  }
24711
24759
  };
@@ -24713,7 +24761,7 @@ const getInlineDynamicImports = (config, inputOptions) => {
24713
24761
  const inlineDynamicImports = (config.inlineDynamicImports ?? inputOptions.inlineDynamicImports) || false;
24714
24762
  const { input } = inputOptions;
24715
24763
  if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
24716
- return error(errorInvalidOption('output.inlineDynamicImports', 'outputinlinedynamicimports', 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
24764
+ return error(errorInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
24717
24765
  }
24718
24766
  return inlineDynamicImports;
24719
24767
  };
@@ -24721,10 +24769,10 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
24721
24769
  const preserveModules = (config.preserveModules ?? inputOptions.preserveModules) || false;
24722
24770
  if (preserveModules) {
24723
24771
  if (inlineDynamicImports) {
24724
- return error(errorInvalidOption('output.inlineDynamicImports', 'outputinlinedynamicimports', `this option is not supported for "output.preserveModules"`));
24772
+ return error(errorInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, `this option is not supported for "output.preserveModules"`));
24725
24773
  }
24726
24774
  if (inputOptions.preserveEntrySignatures === false) {
24727
- return error(errorInvalidOption('preserveEntrySignatures', 'preserveentrysignatures', 'setting this option to false is not supported for "output.preserveModules"'));
24775
+ return error(errorInvalidOption('preserveEntrySignatures', URL_PRESERVEENTRYSIGNATURES, 'setting this option to false is not supported for "output.preserveModules"'));
24728
24776
  }
24729
24777
  }
24730
24778
  return preserveModules;
@@ -24752,10 +24800,10 @@ const getAmd = (config) => {
24752
24800
  ...config.amd
24753
24801
  };
24754
24802
  if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
24755
- return error(errorInvalidOption('output.amd.id', 'outputamd', 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'));
24803
+ return error(errorInvalidOption('output.amd.id', URL_OUTPUT_AMD, 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'));
24756
24804
  }
24757
24805
  if (mergedOption.basePath && !mergedOption.autoId) {
24758
- return error(errorInvalidOption('output.amd.basePath', 'outputamd', 'this option only works with "output.amd.autoId"'));
24806
+ return error(errorInvalidOption('output.amd.basePath', URL_OUTPUT_AMD, 'this option only works with "output.amd.autoId"'));
24759
24807
  }
24760
24808
  return mergedOption.autoId
24761
24809
  ? {
@@ -24782,7 +24830,7 @@ const getAddon = (config, name) => {
24782
24830
  const getDir = (config, file) => {
24783
24831
  const { dir } = config;
24784
24832
  if (typeof dir === 'string' && typeof file === 'string') {
24785
- return error(errorInvalidOption('output.dir', 'outputdir', 'you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks'));
24833
+ 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'));
24786
24834
  }
24787
24835
  return dir;
24788
24836
  };
@@ -24791,7 +24839,7 @@ const getDynamicImportFunction = (config, inputOptions, format) => {
24791
24839
  if (configDynamicImportFunction) {
24792
24840
  warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, true, inputOptions);
24793
24841
  if (format !== 'es') {
24794
- inputOptions.onwarn(errorInvalidOption('output.dynamicImportFunction', 'outputdynamicImportFunction', 'this option is ignored for formats other than "es"'));
24842
+ inputOptions.onwarn(errorInvalidOption('output.dynamicImportFunction', URL_OUTPUT_DYNAMICIMPORTFUNCTION, 'this option is ignored for formats other than "es"'));
24795
24843
  }
24796
24844
  }
24797
24845
  return configDynamicImportFunction;
@@ -24814,7 +24862,7 @@ function getExports(config, unsetOptions) {
24814
24862
  return configExports || 'auto';
24815
24863
  }
24816
24864
  const getGeneratedCode = (config, preferConst) => {
24817
- const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', '');
24865
+ const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '');
24818
24866
  return {
24819
24867
  arrowFunctions: configWithPreset.arrowFunctions === true,
24820
24868
  constBindings: configWithPreset.constBindings === true || preferConst,
@@ -24852,7 +24900,7 @@ const getInterop = (config) => {
24852
24900
  };
24853
24901
  const validateInterop = (interop) => {
24854
24902
  if (!ALLOWED_INTEROP_TYPES.has(interop)) {
24855
- return error(errorInvalidOption('output.interop', 'outputinterop',
24903
+ return error(errorInvalidOption('output.interop', URL_OUTPUT_INTEROP,
24856
24904
  // eslint-disable-next-line unicorn/prefer-spread
24857
24905
  `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
24858
24906
  }
@@ -24862,10 +24910,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
24862
24910
  const configManualChunks = config.manualChunks || inputOptions.manualChunks;
24863
24911
  if (configManualChunks) {
24864
24912
  if (inlineDynamicImports) {
24865
- return error(errorInvalidOption('output.manualChunks', 'outputmanualchunks', 'this option is not supported for "output.inlineDynamicImports"'));
24913
+ return error(errorInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.inlineDynamicImports"'));
24866
24914
  }
24867
24915
  if (preserveModules) {
24868
- return error(errorInvalidOption('output.manualChunks', 'outputmanualchunks', 'this option is not supported for "output.preserveModules"'));
24916
+ return error(errorInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.preserveModules"'));
24869
24917
  }
24870
24918
  }
24871
24919
  return configManualChunks || {};
@@ -24885,7 +24933,7 @@ const getSourcemapBaseUrl = (config) => {
24885
24933
  if (isValidUrl(sourcemapBaseUrl)) {
24886
24934
  return sourcemapBaseUrl;
24887
24935
  }
24888
- return error(errorInvalidOption('output.sourcemapBaseUrl', 'outputsourcemapbaseurl', `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
24936
+ return error(errorInvalidOption('output.sourcemapBaseUrl', URL_OUTPUT_SOURCEMAPBASEURL, `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
24889
24937
  }
24890
24938
  };
24891
24939
 
@@ -25274,7 +25322,7 @@ async function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
25274
25322
  preserveSymlinks: getOption('preserveSymlinks'),
25275
25323
  shimMissingExports: getOption('shimMissingExports'),
25276
25324
  strictDeprecations: getOption('strictDeprecations'),
25277
- treeshake: getObjectOption(config, overrides, 'treeshake', objectifyOptionWithPresets(treeshakePresets, 'treeshake', 'false, true, ')),
25325
+ treeshake: getObjectOption(config, overrides, 'treeshake', objectifyOptionWithPresets(treeshakePresets, 'treeshake', URL_TREESHAKE, 'false, true, ')),
25278
25326
  watch: getWatch(config, overrides)
25279
25327
  };
25280
25328
  warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
@@ -25327,7 +25375,7 @@ async function mergeOutputOptions(config, overrides, warn) {
25327
25375
  footer: getOption('footer'),
25328
25376
  format: getOption('format'),
25329
25377
  freeze: getOption('freeze'),
25330
- generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', '')),
25378
+ generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '')),
25331
25379
  globals: getOption('globals'),
25332
25380
  hoistTransitiveImports: getOption('hoistTransitiveImports'),
25333
25381
  indent: getOption('indent'),
@@ -25446,7 +25494,7 @@ async function watchInternal(configs, emitter) {
25446
25494
  const optionsList = await Promise.all(ensureArray(configs).map(config => mergeOptions(config)));
25447
25495
  const watchOptionsList = optionsList.filter(config => config.watch !== false);
25448
25496
  if (watchOptionsList.length === 0) {
25449
- return error(errorInvalidOption('watch', 'watch', 'there must be at least one config where "watch" is not set to "false"'));
25497
+ return error(errorInvalidOption('watch', URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
25450
25498
  }
25451
25499
  await loadFsEvents();
25452
25500
  const { Watcher } = await import('./watch.js');
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.10.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
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.0
4
- Thu, 12 Jan 2023 07:56:20 GMT - commit ffc19b0091267d9bf5072b16969599e457a63f5c
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