rollup 3.26.3 → 3.27.1

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.26.3
6
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
5
+ Rollup.js v3.27.1
6
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
@@ -1403,7 +1403,7 @@ const BYTE_UNITS = [
1403
1403
 
1404
1404
  const BIBYTE_UNITS = [
1405
1405
  'B',
1406
- 'kiB',
1406
+ 'KiB',
1407
1407
  'MiB',
1408
1408
  'GiB',
1409
1409
  'TiB',
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
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.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
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.26.3";
18
+ var version$1 = "3.27.1";
19
19
 
20
20
  const comma = ','.charCodeAt(0);
21
21
  const semicolon = ';'.charCodeAt(0);
@@ -2921,10 +2921,7 @@ function getAugmentedNamespace(n) {
2921
2921
  if (typeof f == "function") {
2922
2922
  var a = function a () {
2923
2923
  if (this instanceof a) {
2924
- var args = [null];
2925
- args.push.apply(args, arguments);
2926
- var Ctor = Function.bind.apply(f, args);
2927
- return new Ctor();
2924
+ return Reflect.construct(f, arguments, this.constructor);
2928
2925
  }
2929
2926
  return f.apply(this, arguments);
2930
2927
  };
@@ -7276,6 +7273,15 @@ const PURE_WITH_ARRAY = {
7276
7273
  return args.length > 1 && !(args[1] instanceof ArrayExpression);
7277
7274
  }
7278
7275
  };
7276
+ const GETTER_ACCESS = {
7277
+ deoptimizeArgumentsOnCall: doNothing,
7278
+ getLiteralValue: getTruthyLiteralValue,
7279
+ hasEffectsWhenCalled({ args }, context) {
7280
+ const [_thisArgument, firstArgument] = args;
7281
+ return (!(firstArgument instanceof ExpressionEntity) ||
7282
+ firstArgument.hasEffectsOnInteractionAtPath(UNKNOWN_PATH, NODE_INTERACTION_UNKNOWN_ACCESS, context));
7283
+ }
7284
+ };
7279
7285
  // We use shortened variables to reduce file size here
7280
7286
  /* OBJECT */
7281
7287
  const O = {
@@ -7287,6 +7293,11 @@ const PF = {
7287
7293
  __proto__: null,
7288
7294
  [ValueProperties]: PURE
7289
7295
  };
7296
+ /* PURE FUNCTION IF FIRST ARG DOES NOT CONTAIN A GETTER */
7297
+ const PF_NO_GETTER = {
7298
+ __proto__: null,
7299
+ [ValueProperties]: GETTER_ACCESS
7300
+ };
7290
7301
  /* FUNCTION THAT MUTATES FIRST ARG WITHOUT TRIGGERING ACCESSORS */
7291
7302
  const MUTATES_ARG_WITHOUT_ACCESSOR = {
7292
7303
  __proto__: null,
@@ -7462,7 +7473,8 @@ const knownGlobals = {
7462
7473
  isSealed: PF,
7463
7474
  keys: PF,
7464
7475
  fromEntries: O,
7465
- entries: PF,
7476
+ entries: PF_NO_GETTER,
7477
+ values: PF_NO_GETTER,
7466
7478
  prototype: O
7467
7479
  },
7468
7480
  parseFloat: PF,
@@ -7558,16 +7570,24 @@ const knownGlobals = {
7558
7570
  [ValueProperties]: IMPURE,
7559
7571
  Collator: INTL_MEMBER,
7560
7572
  DateTimeFormat: INTL_MEMBER,
7573
+ DisplayNames: INTL_MEMBER,
7561
7574
  ListFormat: INTL_MEMBER,
7575
+ Locale: INTL_MEMBER,
7562
7576
  NumberFormat: INTL_MEMBER,
7563
7577
  PluralRules: INTL_MEMBER,
7564
- RelativeTimeFormat: INTL_MEMBER
7578
+ RelativeTimeFormat: INTL_MEMBER,
7579
+ Segmenter: INTL_MEMBER
7565
7580
  },
7566
7581
  setInterval: C,
7567
7582
  setTimeout: C,
7568
7583
  TextDecoder: C,
7569
7584
  TextEncoder: C,
7570
- URL: C,
7585
+ URL: {
7586
+ __proto__: null,
7587
+ [ValueProperties]: IMPURE,
7588
+ prototype: O,
7589
+ canParse: PF
7590
+ },
7571
7591
  URLSearchParams: C,
7572
7592
  // Browser specific globals
7573
7593
  AbortController: C,
@@ -13197,12 +13217,82 @@ var BuildPhase;
13197
13217
  BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
13198
13218
  })(BuildPhase || (BuildPhase = {}));
13199
13219
 
13220
+ const sourceMapCache = new WeakMap();
13221
+ /**
13222
+ * This clears the decoded array and falls back to the encoded string form.
13223
+ * Sourcemap mappings arrays can be very large and holding on to them for longer
13224
+ * than is necessary leads to poor heap utilization.
13225
+ */
13226
+ function resetCacheToEncoded(cache) {
13227
+ if (cache.encodedMappings === undefined && cache.decodedMappings) {
13228
+ cache.encodedMappings = encode(cache.decodedMappings);
13229
+ }
13230
+ cache.decodedMappings = undefined;
13231
+ }
13232
+ function resetSourcemapCache(map, sourcemapChain) {
13233
+ if (map) {
13234
+ const cache = sourceMapCache.get(map);
13235
+ if (cache) {
13236
+ resetCacheToEncoded(cache);
13237
+ }
13238
+ }
13239
+ if (!sourcemapChain) {
13240
+ return;
13241
+ }
13242
+ for (const map of sourcemapChain) {
13243
+ if (map.missing)
13244
+ continue;
13245
+ resetSourcemapCache(map);
13246
+ }
13247
+ }
13248
+ function decodedSourcemap(map) {
13249
+ if (!map)
13250
+ return null;
13251
+ if (typeof map === 'string') {
13252
+ map = JSON.parse(map);
13253
+ }
13254
+ if (map.mappings === '') {
13255
+ return {
13256
+ mappings: [],
13257
+ names: [],
13258
+ sources: [],
13259
+ version: 3
13260
+ };
13261
+ }
13262
+ const originalMappings = map.mappings;
13263
+ const isAlreadyDecoded = typeof originalMappings !== 'string';
13264
+ const cache = {
13265
+ decodedMappings: isAlreadyDecoded ? originalMappings : undefined,
13266
+ encodedMappings: isAlreadyDecoded ? undefined : originalMappings
13267
+ };
13268
+ const decodedMap = {
13269
+ ...map,
13270
+ // By moving mappings behind an accessor, we can avoid unneeded computation for cases
13271
+ // where the mappings field is never actually accessed. This appears to greatly reduce
13272
+ // the overhead of sourcemap decoding in terms of both compute time and memory usage.
13273
+ get mappings() {
13274
+ if (cache.decodedMappings) {
13275
+ return cache.decodedMappings;
13276
+ }
13277
+ // If decodedMappings doesn't exist then encodedMappings should.
13278
+ // The only scenario where cache.encodedMappings should be undefined is if the map
13279
+ // this was constructed from was already decoded, or if mappings was set to a new
13280
+ // decoded string. In either case, this line shouldn't get hit.
13281
+ cache.decodedMappings = decode(cache.encodedMappings);
13282
+ cache.encodedMappings = undefined;
13283
+ return cache.decodedMappings;
13284
+ }
13285
+ };
13286
+ sourceMapCache.set(decodedMap, cache);
13287
+ return decodedMap;
13288
+ }
13289
+
13200
13290
  function getId(m) {
13201
13291
  return m.id;
13202
13292
  }
13203
13293
 
13204
13294
  function getOriginalLocation(sourcemapChain, location) {
13205
- const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
13295
+ const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
13206
13296
  traceSourcemap: while (filteredSourcemapChain.length > 0) {
13207
13297
  const sourcemap = filteredSourcemapChain.pop();
13208
13298
  const line = sourcemap.mappings[location.line - 1];
@@ -13900,8 +13990,13 @@ class Module {
13900
13990
  timeStart('generate ast', 3);
13901
13991
  this.info.code = code;
13902
13992
  this.originalCode = originalCode;
13903
- this.originalSourcemap = originalSourcemap;
13904
- this.sourcemapChain = sourcemapChain;
13993
+ // We need to call decodedSourcemap on the input in case they were hydrated from json in the cache and don't
13994
+ // have the lazy evaluation cache configured. Right now this isn't enforced by the type system because the
13995
+ // RollupCache stores `ExistingDecodedSourcemap` instead of `ExistingRawSourcemap`
13996
+ this.originalSourcemap = decodedSourcemap(originalSourcemap);
13997
+ this.sourcemapChain = sourcemapChain.map(mapOrMissing => mapOrMissing.missing ? mapOrMissing : decodedSourcemap(mapOrMissing));
13998
+ // If coming from cache and this value is already fully decoded, we want to re-encode here to save memory.
13999
+ resetSourcemapCache(this.originalSourcemap, this.sourcemapChain);
13905
14000
  if (transformFiles) {
13906
14001
  this.transformFiles = transformFiles;
13907
14002
  }
@@ -17418,7 +17513,7 @@ class Link {
17418
17513
  }
17419
17514
  function getLinkMap(log) {
17420
17515
  return function linkMap(source, map) {
17421
- if (map.mappings) {
17516
+ if (!map.missing) {
17422
17517
  return new Link(map, [source]);
17423
17518
  }
17424
17519
  log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
@@ -17457,6 +17552,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
17457
17552
  file = basename(file);
17458
17553
  }
17459
17554
  sourcesContent = (excludeContent ? null : sourcesContent);
17555
+ for (const module of modules) {
17556
+ resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
17557
+ }
17460
17558
  return new SourceMap({ file, mappings, names, sources, sourcesContent });
17461
17559
  }
17462
17560
  function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
@@ -17465,29 +17563,11 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
17465
17563
  }
17466
17564
  const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
17467
17565
  const map = source.traceMappings();
17468
- return { version: 3, ...map };
17566
+ return decodedSourcemap({ version: 3, ...map });
17469
17567
  }
17470
17568
 
17471
17569
  const createHash = () => createHash$1('sha256');
17472
17570
 
17473
- function decodedSourcemap(map) {
17474
- if (!map)
17475
- return null;
17476
- if (typeof map === 'string') {
17477
- map = JSON.parse(map);
17478
- }
17479
- if (map.mappings === '') {
17480
- return {
17481
- mappings: [],
17482
- names: [],
17483
- sources: [],
17484
- version: 3
17485
- };
17486
- }
17487
- const mappings = typeof map.mappings === 'string' ? decode(map.mappings) : map.mappings;
17488
- return { ...map, mappings };
17489
- }
17490
-
17491
17571
  async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
17492
17572
  timeStart('render chunks', 2);
17493
17573
  reserveEntryChunksInBundle(chunks);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -52,7 +52,7 @@ export type SourceMapSegment =
52
52
 
53
53
  export interface ExistingDecodedSourceMap {
54
54
  file?: string;
55
- mappings: SourceMapSegment[][];
55
+ readonly mappings: SourceMapSegment[][];
56
56
  names: string[];
57
57
  sourceRoot?: string;
58
58
  sources: string[];
@@ -74,11 +74,10 @@ export interface ExistingRawSourceMap {
74
74
 
75
75
  export type DecodedSourceMapOrMissing =
76
76
  | {
77
- mappings?: never;
78
77
  missing: true;
79
78
  plugin: string;
80
79
  }
81
- | ExistingDecodedSourceMap;
80
+ | (ExistingDecodedSourceMap & { missing?: false });
82
81
 
83
82
  export interface SourceMap {
84
83
  file: string;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
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.26.3";
33
+ var version$1 = "3.27.1";
34
34
 
35
35
  function ensureArray$1(items) {
36
36
  if (Array.isArray(items)) {
@@ -4431,10 +4431,7 @@ function getAugmentedNamespace(n) {
4431
4431
  if (typeof f == "function") {
4432
4432
  var a = function a () {
4433
4433
  if (this instanceof a) {
4434
- var args = [null];
4435
- args.push.apply(args, arguments);
4436
- var Ctor = Function.bind.apply(f, args);
4437
- return new Ctor();
4434
+ return Reflect.construct(f, arguments, this.constructor);
4438
4435
  }
4439
4436
  return f.apply(this, arguments);
4440
4437
  };
@@ -8772,6 +8769,15 @@ const PURE_WITH_ARRAY = {
8772
8769
  return args.length > 1 && !(args[1] instanceof ArrayExpression);
8773
8770
  }
8774
8771
  };
8772
+ const GETTER_ACCESS = {
8773
+ deoptimizeArgumentsOnCall: doNothing,
8774
+ getLiteralValue: getTruthyLiteralValue,
8775
+ hasEffectsWhenCalled({ args }, context) {
8776
+ const [_thisArgument, firstArgument] = args;
8777
+ return (!(firstArgument instanceof ExpressionEntity) ||
8778
+ firstArgument.hasEffectsOnInteractionAtPath(UNKNOWN_PATH, NODE_INTERACTION_UNKNOWN_ACCESS, context));
8779
+ }
8780
+ };
8775
8781
  // We use shortened variables to reduce file size here
8776
8782
  /* OBJECT */
8777
8783
  const O = {
@@ -8783,6 +8789,11 @@ const PF = {
8783
8789
  __proto__: null,
8784
8790
  [ValueProperties]: PURE
8785
8791
  };
8792
+ /* PURE FUNCTION IF FIRST ARG DOES NOT CONTAIN A GETTER */
8793
+ const PF_NO_GETTER = {
8794
+ __proto__: null,
8795
+ [ValueProperties]: GETTER_ACCESS
8796
+ };
8786
8797
  /* FUNCTION THAT MUTATES FIRST ARG WITHOUT TRIGGERING ACCESSORS */
8787
8798
  const MUTATES_ARG_WITHOUT_ACCESSOR = {
8788
8799
  __proto__: null,
@@ -8958,7 +8969,8 @@ const knownGlobals = {
8958
8969
  isSealed: PF,
8959
8970
  keys: PF,
8960
8971
  fromEntries: O,
8961
- entries: PF,
8972
+ entries: PF_NO_GETTER,
8973
+ values: PF_NO_GETTER,
8962
8974
  prototype: O
8963
8975
  },
8964
8976
  parseFloat: PF,
@@ -9054,16 +9066,24 @@ const knownGlobals = {
9054
9066
  [ValueProperties]: IMPURE,
9055
9067
  Collator: INTL_MEMBER,
9056
9068
  DateTimeFormat: INTL_MEMBER,
9069
+ DisplayNames: INTL_MEMBER,
9057
9070
  ListFormat: INTL_MEMBER,
9071
+ Locale: INTL_MEMBER,
9058
9072
  NumberFormat: INTL_MEMBER,
9059
9073
  PluralRules: INTL_MEMBER,
9060
- RelativeTimeFormat: INTL_MEMBER
9074
+ RelativeTimeFormat: INTL_MEMBER,
9075
+ Segmenter: INTL_MEMBER
9061
9076
  },
9062
9077
  setInterval: C,
9063
9078
  setTimeout: C,
9064
9079
  TextDecoder: C,
9065
9080
  TextEncoder: C,
9066
- URL: C,
9081
+ URL: {
9082
+ __proto__: null,
9083
+ [ValueProperties]: IMPURE,
9084
+ prototype: O,
9085
+ canParse: PF
9086
+ },
9067
9087
  URLSearchParams: C,
9068
9088
  // Browser specific globals
9069
9089
  AbortController: C,
@@ -14686,12 +14706,82 @@ class SyntheticNamedExportVariable extends Variable {
14686
14706
  }
14687
14707
  }
14688
14708
 
14709
+ const sourceMapCache = new WeakMap();
14710
+ /**
14711
+ * This clears the decoded array and falls back to the encoded string form.
14712
+ * Sourcemap mappings arrays can be very large and holding on to them for longer
14713
+ * than is necessary leads to poor heap utilization.
14714
+ */
14715
+ function resetCacheToEncoded(cache) {
14716
+ if (cache.encodedMappings === undefined && cache.decodedMappings) {
14717
+ cache.encodedMappings = encode(cache.decodedMappings);
14718
+ }
14719
+ cache.decodedMappings = undefined;
14720
+ }
14721
+ function resetSourcemapCache(map, sourcemapChain) {
14722
+ if (map) {
14723
+ const cache = sourceMapCache.get(map);
14724
+ if (cache) {
14725
+ resetCacheToEncoded(cache);
14726
+ }
14727
+ }
14728
+ if (!sourcemapChain) {
14729
+ return;
14730
+ }
14731
+ for (const map of sourcemapChain) {
14732
+ if (map.missing)
14733
+ continue;
14734
+ resetSourcemapCache(map);
14735
+ }
14736
+ }
14737
+ function decodedSourcemap(map) {
14738
+ if (!map)
14739
+ return null;
14740
+ if (typeof map === 'string') {
14741
+ map = JSON.parse(map);
14742
+ }
14743
+ if (map.mappings === '') {
14744
+ return {
14745
+ mappings: [],
14746
+ names: [],
14747
+ sources: [],
14748
+ version: 3
14749
+ };
14750
+ }
14751
+ const originalMappings = map.mappings;
14752
+ const isAlreadyDecoded = typeof originalMappings !== 'string';
14753
+ const cache = {
14754
+ decodedMappings: isAlreadyDecoded ? originalMappings : undefined,
14755
+ encodedMappings: isAlreadyDecoded ? undefined : originalMappings
14756
+ };
14757
+ const decodedMap = {
14758
+ ...map,
14759
+ // By moving mappings behind an accessor, we can avoid unneeded computation for cases
14760
+ // where the mappings field is never actually accessed. This appears to greatly reduce
14761
+ // the overhead of sourcemap decoding in terms of both compute time and memory usage.
14762
+ get mappings() {
14763
+ if (cache.decodedMappings) {
14764
+ return cache.decodedMappings;
14765
+ }
14766
+ // If decodedMappings doesn't exist then encodedMappings should.
14767
+ // The only scenario where cache.encodedMappings should be undefined is if the map
14768
+ // this was constructed from was already decoded, or if mappings was set to a new
14769
+ // decoded string. In either case, this line shouldn't get hit.
14770
+ cache.decodedMappings = decode(cache.encodedMappings);
14771
+ cache.encodedMappings = undefined;
14772
+ return cache.decodedMappings;
14773
+ }
14774
+ };
14775
+ sourceMapCache.set(decodedMap, cache);
14776
+ return decodedMap;
14777
+ }
14778
+
14689
14779
  function getId(m) {
14690
14780
  return m.id;
14691
14781
  }
14692
14782
 
14693
14783
  function getOriginalLocation(sourcemapChain, location) {
14694
- const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
14784
+ const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
14695
14785
  traceSourcemap: while (filteredSourcemapChain.length > 0) {
14696
14786
  const sourcemap = filteredSourcemapChain.pop();
14697
14787
  const line = sourcemap.mappings[location.line - 1];
@@ -15389,8 +15479,13 @@ class Module {
15389
15479
  timeStart('generate ast', 3);
15390
15480
  this.info.code = code;
15391
15481
  this.originalCode = originalCode;
15392
- this.originalSourcemap = originalSourcemap;
15393
- this.sourcemapChain = sourcemapChain;
15482
+ // We need to call decodedSourcemap on the input in case they were hydrated from json in the cache and don't
15483
+ // have the lazy evaluation cache configured. Right now this isn't enforced by the type system because the
15484
+ // RollupCache stores `ExistingDecodedSourcemap` instead of `ExistingRawSourcemap`
15485
+ this.originalSourcemap = decodedSourcemap(originalSourcemap);
15486
+ this.sourcemapChain = sourcemapChain.map(mapOrMissing => mapOrMissing.missing ? mapOrMissing : decodedSourcemap(mapOrMissing));
15487
+ // If coming from cache and this value is already fully decoded, we want to re-encode here to save memory.
15488
+ resetSourcemapCache(this.originalSourcemap, this.sourcemapChain);
15394
15489
  if (transformFiles) {
15395
15490
  this.transformFiles = transformFiles;
15396
15491
  }
@@ -18802,7 +18897,7 @@ class Link {
18802
18897
  }
18803
18898
  function getLinkMap(log) {
18804
18899
  return function linkMap(source, map) {
18805
- if (map.mappings) {
18900
+ if (!map.missing) {
18806
18901
  return new Link(map, [source]);
18807
18902
  }
18808
18903
  log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
@@ -18841,6 +18936,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
18841
18936
  file = node_path.basename(file);
18842
18937
  }
18843
18938
  sourcesContent = (excludeContent ? null : sourcesContent);
18939
+ for (const module of modules) {
18940
+ resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
18941
+ }
18844
18942
  return new SourceMap({ file, mappings, names, sources, sourcesContent });
18845
18943
  }
18846
18944
  function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
@@ -18849,25 +18947,7 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
18849
18947
  }
18850
18948
  const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
18851
18949
  const map = source.traceMappings();
18852
- return { version: 3, ...map };
18853
- }
18854
-
18855
- function decodedSourcemap(map) {
18856
- if (!map)
18857
- return null;
18858
- if (typeof map === 'string') {
18859
- map = JSON.parse(map);
18860
- }
18861
- if (map.mappings === '') {
18862
- return {
18863
- mappings: [],
18864
- names: [],
18865
- sources: [],
18866
- version: 3
18867
- };
18868
- }
18869
- const mappings = typeof map.mappings === 'string' ? decode(map.mappings) : map.mappings;
18870
- return { ...map, mappings };
18950
+ return decodedSourcemap({ version: 3, ...map });
18871
18951
  }
18872
18952
 
18873
18953
  async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.26.3
4
- Mon, 17 Jul 2023 10:32:34 GMT - commit ce6f05843f6af9545fb2321c7ec99387ac1e2df0
3
+ Rollup.js v3.27.1
4
+ Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.26.3",
3
+ "version": "3.27.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -68,12 +68,12 @@
68
68
  "@codemirror/language": "^6.8.0",
69
69
  "@codemirror/search": "^6.5.0",
70
70
  "@codemirror/state": "^6.2.1",
71
- "@codemirror/view": "^6.14.0",
71
+ "@codemirror/view": "^6.14.1",
72
72
  "@jridgewell/sourcemap-codec": "^1.4.15",
73
- "@mermaid-js/mermaid-cli": "^10.2.2",
73
+ "@mermaid-js/mermaid-cli": "^10.2.4",
74
74
  "@rollup/plugin-alias": "^5.0.0",
75
75
  "@rollup/plugin-buble": "^1.0.2",
76
- "@rollup/plugin-commonjs": "^25.0.2",
76
+ "@rollup/plugin-commonjs": "^25.0.3",
77
77
  "@rollup/plugin-json": "^6.0.0",
78
78
  "@rollup/plugin-node-resolve": "^15.1.0",
79
79
  "@rollup/plugin-replace": "^5.0.2",
@@ -82,13 +82,13 @@
82
82
  "@rollup/pluginutils": "^5.0.2",
83
83
  "@types/estree": "1.0.1",
84
84
  "@types/mocha": "^10.0.1",
85
- "@types/node": "~14.18.53",
85
+ "@types/node": "~14.18.54",
86
86
  "@types/yargs-parser": "^21.0.0",
87
- "@typescript-eslint/eslint-plugin": "^6.0.0",
88
- "@typescript-eslint/parser": "^6.0.0",
89
- "@vue/eslint-config-prettier": "^7.1.0",
87
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
88
+ "@typescript-eslint/parser": "^6.2.0",
89
+ "@vue/eslint-config-prettier": "^8.0.0",
90
90
  "@vue/eslint-config-typescript": "^11.0.3",
91
- "acorn": "^8.9.0",
91
+ "acorn": "^8.10.0",
92
92
  "acorn-import-assertions": "^1.9.0",
93
93
  "acorn-jsx": "^5.3.2",
94
94
  "acorn-walk": "^8.2.0",
@@ -97,7 +97,7 @@
97
97
  "chokidar": "^3.5.3",
98
98
  "colorette": "^2.0.20",
99
99
  "concurrently": "^8.2.0",
100
- "core-js": "^3.31.0",
100
+ "core-js": "^3.31.1",
101
101
  "date-time": "^4.0.0",
102
102
  "es5-shim": "^4.6.7",
103
103
  "es6-shim": "^0.35.8",
@@ -113,7 +113,7 @@
113
113
  "github-api": "^3.4.0",
114
114
  "hash.js": "^1.1.7",
115
115
  "husky": "^8.0.3",
116
- "inquirer": "^9.2.7",
116
+ "inquirer": "^9.2.8",
117
117
  "is-reference": "^3.0.1",
118
118
  "lint-staged": "^13.2.3",
119
119
  "locate-character": "^3.0.0",
@@ -122,30 +122,30 @@
122
122
  "nyc": "^15.1.0",
123
123
  "pinia": "^2.1.4",
124
124
  "prettier": "^3.0.0",
125
- "pretty-bytes": "^6.1.0",
125
+ "pretty-bytes": "^6.1.1",
126
126
  "pretty-ms": "^8.0.0",
127
127
  "requirejs": "^2.3.6",
128
- "rollup": "^3.26.0",
128
+ "rollup": "^3.26.3",
129
129
  "rollup-plugin-license": "^3.0.1",
130
130
  "rollup-plugin-string": "^3.0.0",
131
131
  "rollup-plugin-thatworks": "^1.0.4",
132
- "semver": "^7.5.3",
132
+ "semver": "^7.5.4",
133
133
  "shx": "^0.3.4",
134
134
  "signal-exit": "^4.0.2",
135
135
  "source-map": "^0.7.4",
136
136
  "source-map-support": "^0.5.21",
137
137
  "systemjs": "^6.14.1",
138
- "terser": "^5.18.2",
139
- "tslib": "^2.6.0",
138
+ "terser": "^5.19.2",
139
+ "tslib": "^2.6.1",
140
140
  "typescript": "^5.1.6",
141
- "vite": "^4.4.2",
142
- "vitepress": "^1.0.0-beta.5",
141
+ "vite": "^4.4.7",
142
+ "vitepress": "^1.0.0-beta.6",
143
143
  "vue": "^3.3.4",
144
144
  "weak-napi": "^2.0.2",
145
145
  "yargs-parser": "^21.1.1"
146
146
  },
147
147
  "overrides": {
148
- "semver": "^7.5.3"
148
+ "semver": "^7.5.4"
149
149
  },
150
150
  "files": [
151
151
  "dist/**/*.js",