rollup 3.28.0 → 3.29.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/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.28.0
6
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
5
+ Rollup.js v3.29.0
6
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
@@ -28,7 +28,7 @@ require('node:crypto');
28
28
  require('node:url');
29
29
  require('../getLogFilter.js');
30
30
 
31
- const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAssertions Omit import assertions in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
31
+ const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAssertions Omit import assertions in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
32
32
 
33
33
  /**
34
34
  * @license
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'node:crypto';
15
15
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
16
16
  import * as tty from 'tty';
17
17
 
18
- var version$1 = "3.28.0";
18
+ var version$1 = "3.29.0";
19
19
 
20
20
  const comma = ','.charCodeAt(0);
21
21
  const semicolon = ';'.charCodeAt(0);
@@ -288,6 +288,13 @@ let Chunk$1 = class Chunk {
288
288
  this.end = index;
289
289
 
290
290
  if (this.edited) {
291
+ // after split we should save the edit content record into the correct chunk
292
+ // to make sure sourcemap correct
293
+ // For example:
294
+ // ' test'.trim()
295
+ // split -> ' ' + 'test'
296
+ // ✔️ edit -> '' + 'test'
297
+ // ✖️ edit -> 'test' + ''
291
298
  // TODO is this block necessary?...
292
299
  newChunk.edit('', false);
293
300
  this.content = '';
@@ -316,6 +323,10 @@ let Chunk$1 = class Chunk {
316
323
  if (trimmed.length) {
317
324
  if (trimmed !== this.content) {
318
325
  this.split(this.start + trimmed.length).edit('', undefined, true);
326
+ if (this.edited) {
327
+ // save the change, if it has been edited
328
+ this.edit(trimmed, this.storeName, true);
329
+ }
319
330
  }
320
331
  return true;
321
332
  } else {
@@ -334,7 +345,11 @@ let Chunk$1 = class Chunk {
334
345
 
335
346
  if (trimmed.length) {
336
347
  if (trimmed !== this.content) {
337
- this.split(this.end - trimmed.length);
348
+ const newChunk = this.split(this.end - trimmed.length);
349
+ if (this.edited) {
350
+ // save the change, if it has been edited
351
+ newChunk.edit(trimmed, this.storeName, true);
352
+ }
338
353
  this.edit('', undefined, true);
339
354
  }
340
355
  return true;
@@ -347,7 +362,7 @@ let Chunk$1 = class Chunk {
347
362
  }
348
363
  };
349
364
 
350
- function getBtoa () {
365
+ function getBtoa() {
351
366
  if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
352
367
  return (str) => window.btoa(unescape(encodeURIComponent(str)));
353
368
  } else if (typeof Buffer === 'function') {
@@ -460,6 +475,8 @@ function getLocator$1(source) {
460
475
  };
461
476
  }
462
477
 
478
+ const wordRegex = /\w/;
479
+
463
480
  class Mappings {
464
481
  constructor(hires) {
465
482
  this.hires = hires;
@@ -488,10 +505,29 @@ class Mappings {
488
505
  addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
489
506
  let originalCharIndex = chunk.start;
490
507
  let first = true;
508
+ // when iterating each char, check if it's in a word boundary
509
+ let charInHiresBoundary = false;
491
510
 
492
511
  while (originalCharIndex < chunk.end) {
493
512
  if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
494
- this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
513
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
514
+
515
+ if (this.hires === 'boundary') {
516
+ // in hires "boundary", group segments per word boundary than per char
517
+ if (wordRegex.test(original[originalCharIndex])) {
518
+ // for first char in the boundary found, start the boundary by pushing a segment
519
+ if (!charInHiresBoundary) {
520
+ this.rawSegments.push(segment);
521
+ charInHiresBoundary = true;
522
+ }
523
+ } else {
524
+ // for non-word char, end the boundary by pushing a segment
525
+ this.rawSegments.push(segment);
526
+ charInHiresBoundary = false;
527
+ }
528
+ } else {
529
+ this.rawSegments.push(segment);
530
+ }
495
531
  }
496
532
 
497
533
  if (original[originalCharIndex] === '\n') {
@@ -664,7 +700,7 @@ class MagicString {
664
700
  sourceIndex,
665
701
  chunk.content,
666
702
  loc,
667
- chunk.storeName ? names.indexOf(chunk.original) : -1
703
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
668
704
  );
669
705
  } else {
670
706
  mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
@@ -675,11 +711,13 @@ class MagicString {
675
711
 
676
712
  return {
677
713
  file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
678
- sources: [options.source ? getRelativePath(options.file || '', options.source) : (options.file || '')],
714
+ sources: [
715
+ options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
716
+ ],
679
717
  sourcesContent: options.includeContent ? [this.original] : undefined,
680
718
  names,
681
719
  mappings: mappings.raw,
682
- x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
720
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
683
721
  };
684
722
  }
685
723
 
@@ -793,14 +831,14 @@ class MagicString {
793
831
 
794
832
  insert() {
795
833
  throw new Error(
796
- 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
834
+ 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
797
835
  );
798
836
  }
799
837
 
800
838
  insertLeft(index, content) {
801
839
  if (!warned.insertLeft) {
802
840
  console.warn(
803
- 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
841
+ 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
804
842
  ); // eslint-disable-line no-console
805
843
  warned.insertLeft = true;
806
844
  }
@@ -811,7 +849,7 @@ class MagicString {
811
849
  insertRight(index, content) {
812
850
  if (!warned.insertRight) {
813
851
  console.warn(
814
- 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
852
+ 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
815
853
  ); // eslint-disable-line no-console
816
854
  warned.insertRight = true;
817
855
  }
@@ -870,7 +908,7 @@ class MagicString {
870
908
  if (end > this.original.length) throw new Error('end is out of bounds');
871
909
  if (start === end)
872
910
  throw new Error(
873
- 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
911
+ 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
874
912
  );
875
913
 
876
914
  this._split(start);
@@ -879,7 +917,7 @@ class MagicString {
879
917
  if (options === true) {
880
918
  if (!warned.storeName) {
881
919
  console.warn(
882
- 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
920
+ 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
883
921
  ); // eslint-disable-line no-console
884
922
  warned.storeName = true;
885
923
  }
@@ -1101,7 +1139,7 @@ class MagicString {
1101
1139
  // zero-length edited chunks are a special case (overlapping replacements)
1102
1140
  const loc = getLocator$1(this.original)(index);
1103
1141
  throw new Error(
1104
- `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
1142
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
1105
1143
  );
1106
1144
  }
1107
1145
 
@@ -1260,7 +1298,7 @@ class MagicString {
1260
1298
  this.overwrite(
1261
1299
  match.index,
1262
1300
  match.index + match[0].length,
1263
- getReplacement(match, this.original)
1301
+ getReplacement(match, this.original),
1264
1302
  );
1265
1303
  });
1266
1304
  } else {
@@ -1269,7 +1307,7 @@ class MagicString {
1269
1307
  this.overwrite(
1270
1308
  match.index,
1271
1309
  match.index + match[0].length,
1272
- getReplacement(match, this.original)
1310
+ getReplacement(match, this.original),
1273
1311
  );
1274
1312
  }
1275
1313
  return this;
@@ -1315,7 +1353,7 @@ class MagicString {
1315
1353
 
1316
1354
  if (!searchValue.global) {
1317
1355
  throw new TypeError(
1318
- 'MagicString.prototype.replaceAll called with a non-global RegExp argument'
1356
+ 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
1319
1357
  );
1320
1358
  }
1321
1359
 
@@ -1345,7 +1383,7 @@ let Bundle$1 = class Bundle {
1345
1383
 
1346
1384
  if (!isObject$1(source) || !source.content) {
1347
1385
  throw new Error(
1348
- 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`'
1386
+ 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',
1349
1387
  );
1350
1388
  }
1351
1389
 
@@ -1439,7 +1477,7 @@ let Bundle$1 = class Bundle {
1439
1477
  sourceIndex,
1440
1478
  chunk.content,
1441
1479
  loc,
1442
- chunk.storeName ? names.indexOf(chunk.original) : -1
1480
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
1443
1481
  );
1444
1482
  } else {
1445
1483
  mappings.addUneditedChunk(
@@ -1447,7 +1485,7 @@ let Bundle$1 = class Bundle {
1447
1485
  chunk,
1448
1486
  magicString.original,
1449
1487
  loc,
1450
- magicString.sourcemapLocations
1488
+ magicString.sourcemapLocations,
1451
1489
  );
1452
1490
  }
1453
1491
  } else {
@@ -1565,7 +1603,7 @@ let Bundle$1 = class Bundle {
1565
1603
  length() {
1566
1604
  return this.sources.reduce(
1567
1605
  (length, source) => length + source.content.length(),
1568
- this.intro.length
1606
+ this.intro.length,
1569
1607
  );
1570
1608
  }
1571
1609
 
@@ -1673,6 +1711,10 @@ function isPathFragment(name) {
1673
1711
  }
1674
1712
  const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
1675
1713
  function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
1714
+ while (targetPath.startsWith('../')) {
1715
+ targetPath = targetPath.slice(3);
1716
+ importerId = '_/' + importerId;
1717
+ }
1676
1718
  let relativePath = normalize(relative(dirname(importerId), targetPath));
1677
1719
  if (stripJsExtension && relativePath.endsWith('.js')) {
1678
1720
  relativePath = relativePath.slice(0, -3);
@@ -5056,7 +5098,7 @@ const normalizePath = function normalizePath(filename) {
5056
5098
  };
5057
5099
 
5058
5100
  function getMatcherString(id, resolutionBase) {
5059
- if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('*')) {
5101
+ if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('**')) {
5060
5102
  return normalizePath(id);
5061
5103
  }
5062
5104
  // resolve('') is valid and will default to process.cwd()
@@ -7671,7 +7713,17 @@ const knownGlobals = {
7671
7713
  CSSSupportsRule: C,
7672
7714
  CustomElementRegistry: C,
7673
7715
  customElements: O,
7674
- CustomEvent: C,
7716
+ CustomEvent: {
7717
+ __proto__: null,
7718
+ [ValueProperties]: {
7719
+ deoptimizeArgumentsOnCall({ args }) {
7720
+ args[2]?.deoptimizePath(['detail']);
7721
+ },
7722
+ getLiteralValue: getTruthyLiteralValue,
7723
+ hasEffectsWhenCalled: returnFalse
7724
+ },
7725
+ prototype: O
7726
+ },
7675
7727
  DataTransfer: C,
7676
7728
  DataTransferItem: C,
7677
7729
  DataTransferItemList: C,
@@ -15674,6 +15726,7 @@ class Chunk {
15674
15726
  this.needsExportsShim = false;
15675
15727
  this.preRenderedChunkInfo = null;
15676
15728
  this.preliminaryFileName = null;
15729
+ this.preliminarySourcemapFileName = null;
15677
15730
  this.renderedChunkInfo = null;
15678
15731
  this.renderedDependencies = null;
15679
15732
  this.renderedModules = Object.create(null);
@@ -15748,7 +15801,7 @@ class Chunk {
15748
15801
  }
15749
15802
  return true;
15750
15803
  }
15751
- finalizeChunk(code, map, hashesByPlaceholder) {
15804
+ finalizeChunk(code, map, sourcemapFileName, hashesByPlaceholder) {
15752
15805
  const renderedChunkInfo = this.getRenderedChunkInfo();
15753
15806
  const finalize = (code) => replacePlaceholders(code, hashesByPlaceholder);
15754
15807
  const preliminaryFileName = renderedChunkInfo.fileName;
@@ -15766,7 +15819,8 @@ class Chunk {
15766
15819
  imports: renderedChunkInfo.imports.map(finalize),
15767
15820
  map,
15768
15821
  preliminaryFileName,
15769
- referencedFiles: renderedChunkInfo.referencedFiles.map(finalize)
15822
+ referencedFiles: renderedChunkInfo.referencedFiles.map(finalize),
15823
+ sourcemapFileName
15770
15824
  };
15771
15825
  }
15772
15826
  generateExports() {
@@ -15907,6 +15961,30 @@ class Chunk {
15907
15961
  // Caching is essential to not conflict with the file name reservation above
15908
15962
  return (this.preliminaryFileName = { fileName, hashPlaceholder });
15909
15963
  }
15964
+ getPreliminarySourcemapFileName() {
15965
+ if (this.preliminarySourcemapFileName) {
15966
+ return this.preliminarySourcemapFileName;
15967
+ }
15968
+ let sourcemapFileName = null;
15969
+ let hashPlaceholder = null;
15970
+ const { sourcemapFileNames, format } = this.outputOptions;
15971
+ if (sourcemapFileNames) {
15972
+ const [pattern, patternName] = [sourcemapFileNames, 'output.sourcemapFileNames'];
15973
+ sourcemapFileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
15974
+ chunkhash: () => this.getPreliminaryFileName().hashPlaceholder || '',
15975
+ format: () => format,
15976
+ hash: size => hashPlaceholder || (hashPlaceholder = this.getPlaceholder(patternName, size)),
15977
+ name: () => this.getChunkName()
15978
+ });
15979
+ if (!hashPlaceholder) {
15980
+ sourcemapFileName = makeUnique(sourcemapFileName, this.bundle);
15981
+ }
15982
+ }
15983
+ else {
15984
+ return null;
15985
+ }
15986
+ return (this.preliminarySourcemapFileName = { fileName: sourcemapFileName, hashPlaceholder });
15987
+ }
15910
15988
  getRenderedChunkInfo() {
15911
15989
  if (this.renderedChunkInfo) {
15912
15990
  return this.renderedChunkInfo;
@@ -15949,6 +16027,7 @@ class Chunk {
15949
16027
  }
15950
16028
  }
15951
16029
  const preliminaryFileName = this.getPreliminaryFileName();
16030
+ const preliminarySourcemapFileName = this.getPreliminarySourcemapFileName();
15952
16031
  const { accessedGlobals, indent, magicString, renderedSource, usedModules, usesTopLevelAwait } = this.renderModules(preliminaryFileName.fileName);
15953
16032
  const renderedDependencies = [...this.getRenderedDependencies().values()];
15954
16033
  const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
@@ -16002,6 +16081,7 @@ class Chunk {
16002
16081
  chunk: this,
16003
16082
  magicString,
16004
16083
  preliminaryFileName,
16084
+ preliminarySourcemapFileName,
16005
16085
  usedModules
16006
16086
  };
16007
16087
  }
@@ -17577,8 +17657,8 @@ async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
17577
17657
  timeEnd('render chunks', 2);
17578
17658
  timeStart('transform chunks', 2);
17579
17659
  const chunkGraph = getChunkGraph(chunks);
17580
- const { nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
17581
- const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, bundle);
17660
+ const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
17661
+ const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle);
17582
17662
  addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, outputOptions);
17583
17663
  timeEnd('transform chunks', 2);
17584
17664
  }
@@ -17662,18 +17742,20 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
17662
17742
  const nonHashedChunksWithPlaceholders = [];
17663
17743
  const renderedChunksByPlaceholder = new Map();
17664
17744
  const hashDependenciesByPlaceholder = new Map();
17745
+ const initialHashesByPlaceholder = new Map();
17665
17746
  const placeholders = new Set();
17666
17747
  for (const { preliminaryFileName: { hashPlaceholder } } of renderedChunks) {
17667
17748
  if (hashPlaceholder)
17668
17749
  placeholders.add(hashPlaceholder);
17669
17750
  }
17670
- await Promise.all(renderedChunks.map(async ({ chunk, preliminaryFileName: { fileName, hashPlaceholder }, magicString, usedModules }) => {
17751
+ await Promise.all(renderedChunks.map(async ({ chunk, preliminaryFileName: { fileName, hashPlaceholder }, preliminarySourcemapFileName, magicString, usedModules }) => {
17671
17752
  const transformedChunk = {
17672
17753
  chunk,
17673
17754
  fileName,
17755
+ sourcemapFileName: preliminarySourcemapFileName?.fileName ?? null,
17674
17756
  ...(await transformChunk(magicString, fileName, usedModules, chunkGraph, outputOptions, pluginDriver, log))
17675
17757
  };
17676
- const { code } = transformedChunk;
17758
+ const { code, map } = transformedChunk;
17677
17759
  if (hashPlaceholder) {
17678
17760
  // To create a reproducible content-only hash, all placeholders are
17679
17761
  // replaced with the same value before hashing
@@ -17697,15 +17779,23 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
17697
17779
  else {
17698
17780
  nonHashedChunksWithPlaceholders.push(transformedChunk);
17699
17781
  }
17782
+ const sourcemapHashPlaceholder = preliminarySourcemapFileName?.hashPlaceholder;
17783
+ if (map && sourcemapHashPlaceholder) {
17784
+ initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder, createHash()
17785
+ .update(map.toString())
17786
+ .digest('hex')
17787
+ .slice(0, preliminarySourcemapFileName.hashPlaceholder.length));
17788
+ }
17700
17789
  }));
17701
17790
  return {
17702
17791
  hashDependenciesByPlaceholder,
17792
+ initialHashesByPlaceholder,
17703
17793
  nonHashedChunksWithPlaceholders,
17704
17794
  renderedChunksByPlaceholder
17705
17795
  };
17706
17796
  }
17707
- function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, bundle) {
17708
- const hashesByPlaceholder = new Map();
17797
+ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle) {
17798
+ const hashesByPlaceholder = new Map(initialHashesByPlaceholder);
17709
17799
  for (const [placeholder, { fileName }] of renderedChunksByPlaceholder) {
17710
17800
  let hash = createHash();
17711
17801
  const hashDependencyPlaceholders = new Set([placeholder]);
@@ -17733,21 +17823,29 @@ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlac
17733
17823
  return hashesByPlaceholder;
17734
17824
  }
17735
17825
  function addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, options) {
17736
- for (const { chunk, code, fileName, map } of renderedChunksByPlaceholder.values()) {
17826
+ for (const { chunk, code, fileName, sourcemapFileName, map } of renderedChunksByPlaceholder.values()) {
17737
17827
  let updatedCode = replacePlaceholders(code, hashesByPlaceholder);
17738
17828
  const finalFileName = replacePlaceholders(fileName, hashesByPlaceholder);
17829
+ let finalSourcemapFileName = null;
17739
17830
  if (map) {
17831
+ finalSourcemapFileName = sourcemapFileName
17832
+ ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
17833
+ : `${finalFileName}.map`;
17740
17834
  map.file = replacePlaceholders(map.file, hashesByPlaceholder);
17741
- updatedCode += emitSourceMapAndGetComment(finalFileName, map, pluginDriver, options);
17835
+ updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options);
17742
17836
  }
17743
- bundle[finalFileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder);
17837
+ bundle[finalFileName] = chunk.finalizeChunk(updatedCode, map, finalSourcemapFileName, hashesByPlaceholder);
17744
17838
  }
17745
- for (const { chunk, code, fileName, map } of nonHashedChunksWithPlaceholders) {
17839
+ for (const { chunk, code, fileName, sourcemapFileName, map } of nonHashedChunksWithPlaceholders) {
17746
17840
  let updatedCode = hashesByPlaceholder.size > 0 ? replacePlaceholders(code, hashesByPlaceholder) : code;
17841
+ let finalSourcemapFileName = null;
17747
17842
  if (map) {
17748
- updatedCode += emitSourceMapAndGetComment(fileName, map, pluginDriver, options);
17843
+ finalSourcemapFileName = sourcemapFileName
17844
+ ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
17845
+ : `${fileName}.map`;
17846
+ updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options);
17749
17847
  }
17750
- bundle[fileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder);
17848
+ bundle[fileName] = chunk.finalizeChunk(updatedCode, map, finalSourcemapFileName, hashesByPlaceholder);
17751
17849
  }
17752
17850
  }
17753
17851
  function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, sourcemapBaseUrl }) {
@@ -17756,11 +17854,11 @@ function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, so
17756
17854
  url = map.toUrl();
17757
17855
  }
17758
17856
  else {
17759
- const sourcemapFileName = `${basename(fileName)}.map`;
17857
+ const sourcemapFileName = basename(fileName);
17760
17858
  url = sourcemapBaseUrl
17761
17859
  ? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
17762
17860
  : sourcemapFileName;
17763
- pluginDriver.emitFile({ fileName: `${fileName}.map`, source: map.toString(), type: 'asset' });
17861
+ pluginDriver.emitFile({ fileName, source: map.toString(), type: 'asset' });
17764
17862
  }
17765
17863
  return sourcemap === 'hidden' ? '' : `//# ${SOURCEMAPPING_URL}=${url}\n`;
17766
17864
  }
@@ -25031,6 +25129,7 @@ class FileEmitter {
25031
25129
  name: prebuiltChunk.fileName,
25032
25130
  preliminaryFileName: prebuiltChunk.fileName,
25033
25131
  referencedFiles: [],
25132
+ sourcemapFileName: prebuiltChunk.sourcemapFileName || null,
25034
25133
  type: 'chunk'
25035
25134
  };
25036
25135
  }
@@ -26313,6 +26412,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
26313
26412
  sourcemapBaseUrl: getSourcemapBaseUrl(config),
26314
26413
  sourcemapExcludeSources: config.sourcemapExcludeSources || false,
26315
26414
  sourcemapFile: config.sourcemapFile,
26415
+ sourcemapFileNames: getSourcemapFileNames(config, unsetOptions),
26316
26416
  sourcemapIgnoreList: typeof config.sourcemapIgnoreList === 'function'
26317
26417
  ? config.sourcemapIgnoreList
26318
26418
  : config.sourcemapIgnoreList === false
@@ -26541,6 +26641,13 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
26541
26641
  }
26542
26642
  return generatedCode.symbols || false;
26543
26643
  };
26644
+ const getSourcemapFileNames = (config, unsetOptions) => {
26645
+ const configSourcemapFileNames = config.sourcemapFileNames;
26646
+ if (configSourcemapFileNames == null) {
26647
+ unsetOptions.add('sourcemapFileNames');
26648
+ }
26649
+ return configSourcemapFileNames;
26650
+ };
26544
26651
  const getSourcemapBaseUrl = (config) => {
26545
26652
  const { sourcemapBaseUrl } = config;
26546
26653
  if (sourcemapBaseUrl) {
@@ -27032,6 +27139,7 @@ async function mergeOutputOptions(config, overrides, log) {
27032
27139
  sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
27033
27140
  sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
27034
27141
  sourcemapFile: getOption('sourcemapFile'),
27142
+ sourcemapFileNames: getOption('sourcemapFileNames'),
27035
27143
  sourcemapIgnoreList: getOption('sourcemapIgnoreList'),
27036
27144
  sourcemapPathTransform: getOption('sourcemapPathTransform'),
27037
27145
  strict: getOption('strict'),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -164,6 +164,7 @@ export interface EmittedPrebuiltChunk {
164
164
  exports?: string[];
165
165
  fileName: string;
166
166
  map?: SourceMap;
167
+ sourcemapFileName?: string;
167
168
  type: 'prebuilt-chunk';
168
169
  }
169
170
 
@@ -369,7 +370,7 @@ export type WatchChangeHook = (
369
370
  * ```
370
371
  */
371
372
  // eslint-disable-next-line @typescript-eslint/ban-types
372
- export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
373
+ export type PluginImpl<O extends object = object, A = any> = (options?: O) => Plugin<A>;
373
374
 
374
375
  export interface OutputBundle {
375
376
  [fileName: string]: OutputAsset | OutputChunk;
@@ -497,9 +498,9 @@ export interface OutputPlugin
497
498
  version?: string;
498
499
  }
499
500
 
500
- export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
501
+ export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
501
502
  // for inter-plugin communication
502
- api?: any;
503
+ api?: A;
503
504
  }
504
505
 
505
506
  type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
@@ -744,6 +745,7 @@ export interface OutputOptions {
744
745
  sourcemapBaseUrl?: string;
745
746
  sourcemapExcludeSources?: boolean;
746
747
  sourcemapFile?: string;
748
+ sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
747
749
  sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;
748
750
  sourcemapPathTransform?: SourcemapPathTransformOption;
749
751
  strict?: boolean;
@@ -799,6 +801,7 @@ export interface NormalizedOutputOptions {
799
801
  sourcemapBaseUrl: string | undefined;
800
802
  sourcemapExcludeSources: boolean;
801
803
  sourcemapFile: string | undefined;
804
+ sourcemapFileNames: string | ((chunkInfo: PreRenderedChunk) => string) | undefined;
802
805
  sourcemapIgnoreList: SourcemapIgnoreListOption;
803
806
  sourcemapPathTransform: SourcemapPathTransformOption | undefined;
804
807
  strict: boolean;
@@ -862,6 +865,7 @@ export interface RenderedChunk extends PreRenderedChunk {
862
865
  export interface OutputChunk extends RenderedChunk {
863
866
  code: string;
864
867
  map: SourceMap | null;
868
+ sourcemapFileName: string | null;
865
869
  preliminaryFileName: string;
866
870
  }
867
871
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.28.0
4
- Wed, 09 Aug 2023 05:34:03 GMT - commit e3b614c9d4555248caa43d062f4003859b388434
3
+ Rollup.js v3.29.0
4
+ Wed, 06 Sep 2023 05:32:40 GMT - commit 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5
5
5
 
6
6
  https://github.com/rollup/rollup
7
7