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.
@@ -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
 
@@ -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
 
@@ -30,7 +30,7 @@ function _interopNamespaceDefault(e) {
30
30
 
31
31
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
32
32
 
33
- var version$1 = "3.28.0";
33
+ var version$1 = "3.29.0";
34
34
 
35
35
  function ensureArray$1(items) {
36
36
  if (Array.isArray(items)) {
@@ -273,6 +273,10 @@ function isPathFragment(name) {
273
273
  }
274
274
  const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
275
275
  function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
276
+ while (targetPath.startsWith('../')) {
277
+ targetPath = targetPath.slice(3);
278
+ importerId = '_/' + importerId;
279
+ }
276
280
  let relativePath = normalize(relative(node_path.dirname(importerId), targetPath));
277
281
  if (stripJsExtension && relativePath.endsWith('.js')) {
278
282
  relativePath = relativePath.slice(0, -3);
@@ -1280,6 +1284,7 @@ class FileEmitter {
1280
1284
  name: prebuiltChunk.fileName,
1281
1285
  preliminaryFileName: prebuiltChunk.fileName,
1282
1286
  referencedFiles: [],
1287
+ sourcemapFileName: prebuiltChunk.sourcemapFileName || null,
1283
1288
  type: 'chunk'
1284
1289
  };
1285
1290
  }
@@ -2206,6 +2211,7 @@ async function mergeOutputOptions(config, overrides, log) {
2206
2211
  sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
2207
2212
  sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
2208
2213
  sourcemapFile: getOption('sourcemapFile'),
2214
+ sourcemapFileNames: getOption('sourcemapFileNames'),
2209
2215
  sourcemapIgnoreList: getOption('sourcemapIgnoreList'),
2210
2216
  sourcemapPathTransform: getOption('sourcemapPathTransform'),
2211
2217
  strict: getOption('strict'),
@@ -2671,6 +2677,13 @@ let Chunk$1 = class Chunk {
2671
2677
  this.end = index;
2672
2678
 
2673
2679
  if (this.edited) {
2680
+ // after split we should save the edit content record into the correct chunk
2681
+ // to make sure sourcemap correct
2682
+ // For example:
2683
+ // ' test'.trim()
2684
+ // split -> ' ' + 'test'
2685
+ // ✔️ edit -> '' + 'test'
2686
+ // ✖️ edit -> 'test' + ''
2674
2687
  // TODO is this block necessary?...
2675
2688
  newChunk.edit('', false);
2676
2689
  this.content = '';
@@ -2699,6 +2712,10 @@ let Chunk$1 = class Chunk {
2699
2712
  if (trimmed.length) {
2700
2713
  if (trimmed !== this.content) {
2701
2714
  this.split(this.start + trimmed.length).edit('', undefined, true);
2715
+ if (this.edited) {
2716
+ // save the change, if it has been edited
2717
+ this.edit(trimmed, this.storeName, true);
2718
+ }
2702
2719
  }
2703
2720
  return true;
2704
2721
  } else {
@@ -2717,7 +2734,11 @@ let Chunk$1 = class Chunk {
2717
2734
 
2718
2735
  if (trimmed.length) {
2719
2736
  if (trimmed !== this.content) {
2720
- this.split(this.end - trimmed.length);
2737
+ const newChunk = this.split(this.end - trimmed.length);
2738
+ if (this.edited) {
2739
+ // save the change, if it has been edited
2740
+ newChunk.edit(trimmed, this.storeName, true);
2741
+ }
2721
2742
  this.edit('', undefined, true);
2722
2743
  }
2723
2744
  return true;
@@ -2730,7 +2751,7 @@ let Chunk$1 = class Chunk {
2730
2751
  }
2731
2752
  };
2732
2753
 
2733
- function getBtoa () {
2754
+ function getBtoa() {
2734
2755
  if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
2735
2756
  return (str) => window.btoa(unescape(encodeURIComponent(str)));
2736
2757
  } else if (typeof Buffer === 'function') {
@@ -2843,6 +2864,8 @@ function getLocator(source) {
2843
2864
  };
2844
2865
  }
2845
2866
 
2867
+ const wordRegex = /\w/;
2868
+
2846
2869
  class Mappings {
2847
2870
  constructor(hires) {
2848
2871
  this.hires = hires;
@@ -2871,10 +2894,29 @@ class Mappings {
2871
2894
  addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
2872
2895
  let originalCharIndex = chunk.start;
2873
2896
  let first = true;
2897
+ // when iterating each char, check if it's in a word boundary
2898
+ let charInHiresBoundary = false;
2874
2899
 
2875
2900
  while (originalCharIndex < chunk.end) {
2876
2901
  if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
2877
- this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
2902
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
2903
+
2904
+ if (this.hires === 'boundary') {
2905
+ // in hires "boundary", group segments per word boundary than per char
2906
+ if (wordRegex.test(original[originalCharIndex])) {
2907
+ // for first char in the boundary found, start the boundary by pushing a segment
2908
+ if (!charInHiresBoundary) {
2909
+ this.rawSegments.push(segment);
2910
+ charInHiresBoundary = true;
2911
+ }
2912
+ } else {
2913
+ // for non-word char, end the boundary by pushing a segment
2914
+ this.rawSegments.push(segment);
2915
+ charInHiresBoundary = false;
2916
+ }
2917
+ } else {
2918
+ this.rawSegments.push(segment);
2919
+ }
2878
2920
  }
2879
2921
 
2880
2922
  if (original[originalCharIndex] === '\n') {
@@ -3047,7 +3089,7 @@ class MagicString {
3047
3089
  sourceIndex,
3048
3090
  chunk.content,
3049
3091
  loc,
3050
- chunk.storeName ? names.indexOf(chunk.original) : -1
3092
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
3051
3093
  );
3052
3094
  } else {
3053
3095
  mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
@@ -3058,11 +3100,13 @@ class MagicString {
3058
3100
 
3059
3101
  return {
3060
3102
  file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
3061
- sources: [options.source ? getRelativePath(options.file || '', options.source) : (options.file || '')],
3103
+ sources: [
3104
+ options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
3105
+ ],
3062
3106
  sourcesContent: options.includeContent ? [this.original] : undefined,
3063
3107
  names,
3064
3108
  mappings: mappings.raw,
3065
- x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
3109
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
3066
3110
  };
3067
3111
  }
3068
3112
 
@@ -3176,14 +3220,14 @@ class MagicString {
3176
3220
 
3177
3221
  insert() {
3178
3222
  throw new Error(
3179
- 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
3223
+ 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
3180
3224
  );
3181
3225
  }
3182
3226
 
3183
3227
  insertLeft(index, content) {
3184
3228
  if (!warned.insertLeft) {
3185
3229
  console.warn(
3186
- 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
3230
+ 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
3187
3231
  ); // eslint-disable-line no-console
3188
3232
  warned.insertLeft = true;
3189
3233
  }
@@ -3194,7 +3238,7 @@ class MagicString {
3194
3238
  insertRight(index, content) {
3195
3239
  if (!warned.insertRight) {
3196
3240
  console.warn(
3197
- 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
3241
+ 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
3198
3242
  ); // eslint-disable-line no-console
3199
3243
  warned.insertRight = true;
3200
3244
  }
@@ -3253,7 +3297,7 @@ class MagicString {
3253
3297
  if (end > this.original.length) throw new Error('end is out of bounds');
3254
3298
  if (start === end)
3255
3299
  throw new Error(
3256
- 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
3300
+ 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
3257
3301
  );
3258
3302
 
3259
3303
  this._split(start);
@@ -3262,7 +3306,7 @@ class MagicString {
3262
3306
  if (options === true) {
3263
3307
  if (!warned.storeName) {
3264
3308
  console.warn(
3265
- 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
3309
+ 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
3266
3310
  ); // eslint-disable-line no-console
3267
3311
  warned.storeName = true;
3268
3312
  }
@@ -3484,7 +3528,7 @@ class MagicString {
3484
3528
  // zero-length edited chunks are a special case (overlapping replacements)
3485
3529
  const loc = getLocator(this.original)(index);
3486
3530
  throw new Error(
3487
- `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
3531
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
3488
3532
  );
3489
3533
  }
3490
3534
 
@@ -3643,7 +3687,7 @@ class MagicString {
3643
3687
  this.overwrite(
3644
3688
  match.index,
3645
3689
  match.index + match[0].length,
3646
- getReplacement(match, this.original)
3690
+ getReplacement(match, this.original),
3647
3691
  );
3648
3692
  });
3649
3693
  } else {
@@ -3652,7 +3696,7 @@ class MagicString {
3652
3696
  this.overwrite(
3653
3697
  match.index,
3654
3698
  match.index + match[0].length,
3655
- getReplacement(match, this.original)
3699
+ getReplacement(match, this.original),
3656
3700
  );
3657
3701
  }
3658
3702
  return this;
@@ -3698,7 +3742,7 @@ class MagicString {
3698
3742
 
3699
3743
  if (!searchValue.global) {
3700
3744
  throw new TypeError(
3701
- 'MagicString.prototype.replaceAll called with a non-global RegExp argument'
3745
+ 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
3702
3746
  );
3703
3747
  }
3704
3748
 
@@ -3728,7 +3772,7 @@ let Bundle$1 = class Bundle {
3728
3772
 
3729
3773
  if (!isObject$1(source) || !source.content) {
3730
3774
  throw new Error(
3731
- 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`'
3775
+ 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',
3732
3776
  );
3733
3777
  }
3734
3778
 
@@ -3822,7 +3866,7 @@ let Bundle$1 = class Bundle {
3822
3866
  sourceIndex,
3823
3867
  chunk.content,
3824
3868
  loc,
3825
- chunk.storeName ? names.indexOf(chunk.original) : -1
3869
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
3826
3870
  );
3827
3871
  } else {
3828
3872
  mappings.addUneditedChunk(
@@ -3830,7 +3874,7 @@ let Bundle$1 = class Bundle {
3830
3874
  chunk,
3831
3875
  magicString.original,
3832
3876
  loc,
3833
- magicString.sourcemapLocations
3877
+ magicString.sourcemapLocations,
3834
3878
  );
3835
3879
  }
3836
3880
  } else {
@@ -3948,7 +3992,7 @@ let Bundle$1 = class Bundle {
3948
3992
  length() {
3949
3993
  return this.sources.reduce(
3950
3994
  (length, source) => length + source.content.length(),
3951
- this.intro.length
3995
+ this.intro.length,
3952
3996
  );
3953
3997
  }
3954
3998
 
@@ -6567,7 +6611,7 @@ const normalizePath = function normalizePath(filename) {
6567
6611
  };
6568
6612
 
6569
6613
  function getMatcherString(id, resolutionBase) {
6570
- if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('*')) {
6614
+ if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('**')) {
6571
6615
  return normalizePath(id);
6572
6616
  }
6573
6617
  // resolve('') is valid and will default to process.cwd()
@@ -9168,7 +9212,17 @@ const knownGlobals = {
9168
9212
  CSSSupportsRule: C,
9169
9213
  CustomElementRegistry: C,
9170
9214
  customElements: O,
9171
- CustomEvent: C,
9215
+ CustomEvent: {
9216
+ __proto__: null,
9217
+ [ValueProperties]: {
9218
+ deoptimizeArgumentsOnCall({ args }) {
9219
+ args[2]?.deoptimizePath(['detail']);
9220
+ },
9221
+ getLiteralValue: getTruthyLiteralValue,
9222
+ hasEffectsWhenCalled: returnFalse
9223
+ },
9224
+ prototype: O
9225
+ },
9172
9226
  DataTransfer: C,
9173
9227
  DataTransferItem: C,
9174
9228
  DataTransferItemList: C,
@@ -17059,6 +17113,7 @@ class Chunk {
17059
17113
  this.needsExportsShim = false;
17060
17114
  this.preRenderedChunkInfo = null;
17061
17115
  this.preliminaryFileName = null;
17116
+ this.preliminarySourcemapFileName = null;
17062
17117
  this.renderedChunkInfo = null;
17063
17118
  this.renderedDependencies = null;
17064
17119
  this.renderedModules = Object.create(null);
@@ -17133,7 +17188,7 @@ class Chunk {
17133
17188
  }
17134
17189
  return true;
17135
17190
  }
17136
- finalizeChunk(code, map, hashesByPlaceholder) {
17191
+ finalizeChunk(code, map, sourcemapFileName, hashesByPlaceholder) {
17137
17192
  const renderedChunkInfo = this.getRenderedChunkInfo();
17138
17193
  const finalize = (code) => replacePlaceholders(code, hashesByPlaceholder);
17139
17194
  const preliminaryFileName = renderedChunkInfo.fileName;
@@ -17151,7 +17206,8 @@ class Chunk {
17151
17206
  imports: renderedChunkInfo.imports.map(finalize),
17152
17207
  map,
17153
17208
  preliminaryFileName,
17154
- referencedFiles: renderedChunkInfo.referencedFiles.map(finalize)
17209
+ referencedFiles: renderedChunkInfo.referencedFiles.map(finalize),
17210
+ sourcemapFileName
17155
17211
  };
17156
17212
  }
17157
17213
  generateExports() {
@@ -17292,6 +17348,30 @@ class Chunk {
17292
17348
  // Caching is essential to not conflict with the file name reservation above
17293
17349
  return (this.preliminaryFileName = { fileName, hashPlaceholder });
17294
17350
  }
17351
+ getPreliminarySourcemapFileName() {
17352
+ if (this.preliminarySourcemapFileName) {
17353
+ return this.preliminarySourcemapFileName;
17354
+ }
17355
+ let sourcemapFileName = null;
17356
+ let hashPlaceholder = null;
17357
+ const { sourcemapFileNames, format } = this.outputOptions;
17358
+ if (sourcemapFileNames) {
17359
+ const [pattern, patternName] = [sourcemapFileNames, 'output.sourcemapFileNames'];
17360
+ sourcemapFileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
17361
+ chunkhash: () => this.getPreliminaryFileName().hashPlaceholder || '',
17362
+ format: () => format,
17363
+ hash: size => hashPlaceholder || (hashPlaceholder = this.getPlaceholder(patternName, size)),
17364
+ name: () => this.getChunkName()
17365
+ });
17366
+ if (!hashPlaceholder) {
17367
+ sourcemapFileName = makeUnique(sourcemapFileName, this.bundle);
17368
+ }
17369
+ }
17370
+ else {
17371
+ return null;
17372
+ }
17373
+ return (this.preliminarySourcemapFileName = { fileName: sourcemapFileName, hashPlaceholder });
17374
+ }
17295
17375
  getRenderedChunkInfo() {
17296
17376
  if (this.renderedChunkInfo) {
17297
17377
  return this.renderedChunkInfo;
@@ -17334,6 +17414,7 @@ class Chunk {
17334
17414
  }
17335
17415
  }
17336
17416
  const preliminaryFileName = this.getPreliminaryFileName();
17417
+ const preliminarySourcemapFileName = this.getPreliminarySourcemapFileName();
17337
17418
  const { accessedGlobals, indent, magicString, renderedSource, usedModules, usesTopLevelAwait } = this.renderModules(preliminaryFileName.fileName);
17338
17419
  const renderedDependencies = [...this.getRenderedDependencies().values()];
17339
17420
  const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
@@ -17387,6 +17468,7 @@ class Chunk {
17387
17468
  chunk: this,
17388
17469
  magicString,
17389
17470
  preliminaryFileName,
17471
+ preliminarySourcemapFileName,
17390
17472
  usedModules
17391
17473
  };
17392
17474
  }
@@ -18960,8 +19042,8 @@ async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
18960
19042
  timeEnd('render chunks', 2);
18961
19043
  timeStart('transform chunks', 2);
18962
19044
  const chunkGraph = getChunkGraph(chunks);
18963
- const { nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
18964
- const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, bundle);
19045
+ const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
19046
+ const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle);
18965
19047
  addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, outputOptions);
18966
19048
  timeEnd('transform chunks', 2);
18967
19049
  }
@@ -19045,18 +19127,20 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
19045
19127
  const nonHashedChunksWithPlaceholders = [];
19046
19128
  const renderedChunksByPlaceholder = new Map();
19047
19129
  const hashDependenciesByPlaceholder = new Map();
19130
+ const initialHashesByPlaceholder = new Map();
19048
19131
  const placeholders = new Set();
19049
19132
  for (const { preliminaryFileName: { hashPlaceholder } } of renderedChunks) {
19050
19133
  if (hashPlaceholder)
19051
19134
  placeholders.add(hashPlaceholder);
19052
19135
  }
19053
- await Promise.all(renderedChunks.map(async ({ chunk, preliminaryFileName: { fileName, hashPlaceholder }, magicString, usedModules }) => {
19136
+ await Promise.all(renderedChunks.map(async ({ chunk, preliminaryFileName: { fileName, hashPlaceholder }, preliminarySourcemapFileName, magicString, usedModules }) => {
19054
19137
  const transformedChunk = {
19055
19138
  chunk,
19056
19139
  fileName,
19140
+ sourcemapFileName: preliminarySourcemapFileName?.fileName ?? null,
19057
19141
  ...(await transformChunk(magicString, fileName, usedModules, chunkGraph, outputOptions, pluginDriver, log))
19058
19142
  };
19059
- const { code } = transformedChunk;
19143
+ const { code, map } = transformedChunk;
19060
19144
  if (hashPlaceholder) {
19061
19145
  // To create a reproducible content-only hash, all placeholders are
19062
19146
  // replaced with the same value before hashing
@@ -19080,15 +19164,23 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
19080
19164
  else {
19081
19165
  nonHashedChunksWithPlaceholders.push(transformedChunk);
19082
19166
  }
19167
+ const sourcemapHashPlaceholder = preliminarySourcemapFileName?.hashPlaceholder;
19168
+ if (map && sourcemapHashPlaceholder) {
19169
+ initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder, createHash()
19170
+ .update(map.toString())
19171
+ .digest('hex')
19172
+ .slice(0, preliminarySourcemapFileName.hashPlaceholder.length));
19173
+ }
19083
19174
  }));
19084
19175
  return {
19085
19176
  hashDependenciesByPlaceholder,
19177
+ initialHashesByPlaceholder,
19086
19178
  nonHashedChunksWithPlaceholders,
19087
19179
  renderedChunksByPlaceholder
19088
19180
  };
19089
19181
  }
19090
- function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, bundle) {
19091
- const hashesByPlaceholder = new Map();
19182
+ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle) {
19183
+ const hashesByPlaceholder = new Map(initialHashesByPlaceholder);
19092
19184
  for (const [placeholder, { fileName }] of renderedChunksByPlaceholder) {
19093
19185
  let hash = createHash();
19094
19186
  const hashDependencyPlaceholders = new Set([placeholder]);
@@ -19116,21 +19208,29 @@ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlac
19116
19208
  return hashesByPlaceholder;
19117
19209
  }
19118
19210
  function addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, options) {
19119
- for (const { chunk, code, fileName, map } of renderedChunksByPlaceholder.values()) {
19211
+ for (const { chunk, code, fileName, sourcemapFileName, map } of renderedChunksByPlaceholder.values()) {
19120
19212
  let updatedCode = replacePlaceholders(code, hashesByPlaceholder);
19121
19213
  const finalFileName = replacePlaceholders(fileName, hashesByPlaceholder);
19214
+ let finalSourcemapFileName = null;
19122
19215
  if (map) {
19216
+ finalSourcemapFileName = sourcemapFileName
19217
+ ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
19218
+ : `${finalFileName}.map`;
19123
19219
  map.file = replacePlaceholders(map.file, hashesByPlaceholder);
19124
- updatedCode += emitSourceMapAndGetComment(finalFileName, map, pluginDriver, options);
19220
+ updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options);
19125
19221
  }
19126
- bundle[finalFileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder);
19222
+ bundle[finalFileName] = chunk.finalizeChunk(updatedCode, map, finalSourcemapFileName, hashesByPlaceholder);
19127
19223
  }
19128
- for (const { chunk, code, fileName, map } of nonHashedChunksWithPlaceholders) {
19224
+ for (const { chunk, code, fileName, sourcemapFileName, map } of nonHashedChunksWithPlaceholders) {
19129
19225
  let updatedCode = hashesByPlaceholder.size > 0 ? replacePlaceholders(code, hashesByPlaceholder) : code;
19226
+ let finalSourcemapFileName = null;
19130
19227
  if (map) {
19131
- updatedCode += emitSourceMapAndGetComment(fileName, map, pluginDriver, options);
19228
+ finalSourcemapFileName = sourcemapFileName
19229
+ ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder)
19230
+ : `${fileName}.map`;
19231
+ updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options);
19132
19232
  }
19133
- bundle[fileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder);
19233
+ bundle[fileName] = chunk.finalizeChunk(updatedCode, map, finalSourcemapFileName, hashesByPlaceholder);
19134
19234
  }
19135
19235
  }
19136
19236
  function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, sourcemapBaseUrl }) {
@@ -19139,11 +19239,11 @@ function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, so
19139
19239
  url = map.toUrl();
19140
19240
  }
19141
19241
  else {
19142
- const sourcemapFileName = `${node_path.basename(fileName)}.map`;
19242
+ const sourcemapFileName = node_path.basename(fileName);
19143
19243
  url = sourcemapBaseUrl
19144
19244
  ? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
19145
19245
  : sourcemapFileName;
19146
- pluginDriver.emitFile({ fileName: `${fileName}.map`, source: map.toString(), type: 'asset' });
19246
+ pluginDriver.emitFile({ fileName, source: map.toString(), type: 'asset' });
19147
19247
  }
19148
19248
  return sourcemap === 'hidden' ? '' : `//# ${SOURCEMAPPING_URL}=${url}\n`;
19149
19249
  }
@@ -26759,6 +26859,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
26759
26859
  sourcemapBaseUrl: getSourcemapBaseUrl(config),
26760
26860
  sourcemapExcludeSources: config.sourcemapExcludeSources || false,
26761
26861
  sourcemapFile: config.sourcemapFile,
26862
+ sourcemapFileNames: getSourcemapFileNames(config, unsetOptions),
26762
26863
  sourcemapIgnoreList: typeof config.sourcemapIgnoreList === 'function'
26763
26864
  ? config.sourcemapIgnoreList
26764
26865
  : config.sourcemapIgnoreList === false
@@ -26987,6 +27088,13 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
26987
27088
  }
26988
27089
  return generatedCode.symbols || false;
26989
27090
  };
27091
+ const getSourcemapFileNames = (config, unsetOptions) => {
27092
+ const configSourcemapFileNames = config.sourcemapFileNames;
27093
+ if (configSourcemapFileNames == null) {
27094
+ unsetOptions.add('sourcemapFileNames');
27095
+ }
27096
+ return configSourcemapFileNames;
27097
+ };
26990
27098
  const getSourcemapBaseUrl = (config) => {
26991
27099
  const { sourcemapBaseUrl } = config;
26992
27100
  if (sourcemapBaseUrl) {
@@ -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
 
@@ -126,7 +126,7 @@ const processOk = (process) => !!process &&
126
126
  const kExitEmitter = Symbol.for('signal-exit emitter');
127
127
  const global = globalThis;
128
128
  const ObjectDefineProperty = Object.defineProperty.bind(Object);
129
- // teeny tiny ee
129
+ // teeny special purpose ee
130
130
  class Emitter {
131
131
  emitted = {
132
132
  afterExit: false,
@@ -169,12 +169,17 @@ class Emitter {
169
169
  }
170
170
  emit(ev, code, signal) {
171
171
  if (this.emitted[ev]) {
172
- return;
172
+ return false;
173
173
  }
174
174
  this.emitted[ev] = true;
175
+ let ret = false;
175
176
  for (const fn of this.listeners[ev]) {
176
- fn(code, signal);
177
+ ret = fn(code, signal) === true || ret;
178
+ }
179
+ if (ev === 'exit') {
180
+ ret = this.emit('afterExit', code, signal) || ret;
177
181
  }
182
+ return ret;
178
183
  }
179
184
  }
180
185
  class SignalExitBase {
@@ -228,18 +233,22 @@ class SignalExit extends SignalExitBase {
228
233
  // exit v4 are not aware of each other, and each will attempt to let
229
234
  // the other handle it, so neither of them do. To correct this, we
230
235
  // detect if we're the only handler *except* for previous versions
231
- // of signal-exit.
236
+ // of signal-exit, and increment by the count of listeners it has
237
+ // created.
232
238
  /* c8 ignore start */
233
- //@ts-ignore
234
- if (typeof process.__signal_exit_emitter__ === 'object')
235
- count++;
239
+ const p = process;
240
+ if (typeof p.__signal_exit_emitter__ === 'object' &&
241
+ typeof p.__signal_exit_emitter__.count === 'number') {
242
+ count += p.__signal_exit_emitter__.count;
243
+ }
236
244
  /* c8 ignore stop */
237
245
  if (listeners.length === count) {
238
246
  this.unload();
239
- this.#emitter.emit('exit', null, sig);
240
- this.#emitter.emit('afterExit', null, sig);
247
+ const ret = this.#emitter.emit('exit', null, sig);
241
248
  /* c8 ignore start */
242
- process.kill(process.pid, sig === 'SIGHUP' ? this.#hupSig : sig);
249
+ const s = sig === 'SIGHUP' ? this.#hupSig : sig;
250
+ if (!ret)
251
+ process.kill(process.pid, s);
243
252
  /* c8 ignore stop */
244
253
  }
245
254
  };
@@ -322,7 +331,6 @@ class SignalExit extends SignalExitBase {
322
331
  this.#process.exitCode = code || 0;
323
332
  /* c8 ignore stop */
324
333
  this.#emitter.emit('exit', this.#process.exitCode, null);
325
- this.#emitter.emit('afterExit', this.#process.exitCode, null);
326
334
  return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
327
335
  }
328
336
  #processEmit(ev, ...args) {
@@ -336,7 +344,6 @@ class SignalExit extends SignalExitBase {
336
344
  const ret = og.call(this.#process, ev, ...args);
337
345
  /* c8 ignore start */
338
346
  this.#emitter.emit('exit', this.#process.exitCode, null);
339
- this.#emitter.emit('afterExit', this.#process.exitCode, null);
340
347
  /* c8 ignore stop */
341
348
  return ret;
342
349
  }
@@ -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