rollup 3.27.1 → 3.27.2

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.27.1
6
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
5
+ Rollup.js v3.27.2
6
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
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.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
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.27.1";
18
+ var version$1 = "3.27.2";
19
19
 
20
20
  const comma = ','.charCodeAt(0);
21
21
  const semicolon = ';'.charCodeAt(0);
@@ -13217,82 +13217,12 @@ var BuildPhase;
13217
13217
  BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
13218
13218
  })(BuildPhase || (BuildPhase = {}));
13219
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
-
13290
13220
  function getId(m) {
13291
13221
  return m.id;
13292
13222
  }
13293
13223
 
13294
13224
  function getOriginalLocation(sourcemapChain, location) {
13295
- const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
13225
+ const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
13296
13226
  traceSourcemap: while (filteredSourcemapChain.length > 0) {
13297
13227
  const sourcemap = filteredSourcemapChain.pop();
13298
13228
  const line = sourcemap.mappings[location.line - 1];
@@ -13990,13 +13920,8 @@ class Module {
13990
13920
  timeStart('generate ast', 3);
13991
13921
  this.info.code = code;
13992
13922
  this.originalCode = originalCode;
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);
13923
+ this.originalSourcemap = originalSourcemap;
13924
+ this.sourcemapChain = sourcemapChain;
14000
13925
  if (transformFiles) {
14001
13926
  this.transformFiles = transformFiles;
14002
13927
  }
@@ -17513,7 +17438,7 @@ class Link {
17513
17438
  }
17514
17439
  function getLinkMap(log) {
17515
17440
  return function linkMap(source, map) {
17516
- if (!map.missing) {
17441
+ if (map.mappings) {
17517
17442
  return new Link(map, [source]);
17518
17443
  }
17519
17444
  log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
@@ -17552,9 +17477,6 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
17552
17477
  file = basename(file);
17553
17478
  }
17554
17479
  sourcesContent = (excludeContent ? null : sourcesContent);
17555
- for (const module of modules) {
17556
- resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
17557
- }
17558
17480
  return new SourceMap({ file, mappings, names, sources, sourcesContent });
17559
17481
  }
17560
17482
  function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
@@ -17563,11 +17485,29 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
17563
17485
  }
17564
17486
  const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
17565
17487
  const map = source.traceMappings();
17566
- return decodedSourcemap({ version: 3, ...map });
17488
+ return { version: 3, ...map };
17567
17489
  }
17568
17490
 
17569
17491
  const createHash = () => createHash$1('sha256');
17570
17492
 
17493
+ function decodedSourcemap(map) {
17494
+ if (!map)
17495
+ return null;
17496
+ if (typeof map === 'string') {
17497
+ map = JSON.parse(map);
17498
+ }
17499
+ if (map.mappings === '') {
17500
+ return {
17501
+ mappings: [],
17502
+ names: [],
17503
+ sources: [],
17504
+ version: 3
17505
+ };
17506
+ }
17507
+ const mappings = typeof map.mappings === 'string' ? decode(map.mappings) : map.mappings;
17508
+ return { ...map, mappings };
17509
+ }
17510
+
17571
17511
  async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
17572
17512
  timeStart('render chunks', 2);
17573
17513
  reserveEntryChunksInBundle(chunks);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
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
- readonly mappings: SourceMapSegment[][];
55
+ mappings: SourceMapSegment[][];
56
56
  names: string[];
57
57
  sourceRoot?: string;
58
58
  sources: string[];
@@ -74,10 +74,11 @@ export interface ExistingRawSourceMap {
74
74
 
75
75
  export type DecodedSourceMapOrMissing =
76
76
  | {
77
+ mappings?: never;
77
78
  missing: true;
78
79
  plugin: string;
79
80
  }
80
- | (ExistingDecodedSourceMap & { missing?: false });
81
+ | ExistingDecodedSourceMap;
81
82
 
82
83
  export interface SourceMap {
83
84
  file: string;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
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.27.1";
33
+ var version$1 = "3.27.2";
34
34
 
35
35
  function ensureArray$1(items) {
36
36
  if (Array.isArray(items)) {
@@ -14706,82 +14706,12 @@ class SyntheticNamedExportVariable extends Variable {
14706
14706
  }
14707
14707
  }
14708
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
-
14779
14709
  function getId(m) {
14780
14710
  return m.id;
14781
14711
  }
14782
14712
 
14783
14713
  function getOriginalLocation(sourcemapChain, location) {
14784
- const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
14714
+ const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
14785
14715
  traceSourcemap: while (filteredSourcemapChain.length > 0) {
14786
14716
  const sourcemap = filteredSourcemapChain.pop();
14787
14717
  const line = sourcemap.mappings[location.line - 1];
@@ -15479,13 +15409,8 @@ class Module {
15479
15409
  timeStart('generate ast', 3);
15480
15410
  this.info.code = code;
15481
15411
  this.originalCode = originalCode;
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);
15412
+ this.originalSourcemap = originalSourcemap;
15413
+ this.sourcemapChain = sourcemapChain;
15489
15414
  if (transformFiles) {
15490
15415
  this.transformFiles = transformFiles;
15491
15416
  }
@@ -18897,7 +18822,7 @@ class Link {
18897
18822
  }
18898
18823
  function getLinkMap(log) {
18899
18824
  return function linkMap(source, map) {
18900
- if (!map.missing) {
18825
+ if (map.mappings) {
18901
18826
  return new Link(map, [source]);
18902
18827
  }
18903
18828
  log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
@@ -18936,9 +18861,6 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
18936
18861
  file = node_path.basename(file);
18937
18862
  }
18938
18863
  sourcesContent = (excludeContent ? null : sourcesContent);
18939
- for (const module of modules) {
18940
- resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
18941
- }
18942
18864
  return new SourceMap({ file, mappings, names, sources, sourcesContent });
18943
18865
  }
18944
18866
  function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
@@ -18947,7 +18869,25 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
18947
18869
  }
18948
18870
  const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
18949
18871
  const map = source.traceMappings();
18950
- return decodedSourcemap({ version: 3, ...map });
18872
+ return { version: 3, ...map };
18873
+ }
18874
+
18875
+ function decodedSourcemap(map) {
18876
+ if (!map)
18877
+ return null;
18878
+ if (typeof map === 'string') {
18879
+ map = JSON.parse(map);
18880
+ }
18881
+ if (map.mappings === '') {
18882
+ return {
18883
+ mappings: [],
18884
+ names: [],
18885
+ sources: [],
18886
+ version: 3
18887
+ };
18888
+ }
18889
+ const mappings = typeof map.mappings === 'string' ? decode(map.mappings) : map.mappings;
18890
+ return { ...map, mappings };
18951
18891
  }
18952
18892
 
18953
18893
  async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.27.1
4
- Thu, 03 Aug 2023 09:46:16 GMT - commit cf7cb338653d34947d39848d6bf6f9b74415a07d
3
+ Rollup.js v3.27.2
4
+ Fri, 04 Aug 2023 11:31:37 GMT - commit ffd2239d550a22988f864316d294fcaab3b4bdae
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.27.1",
3
+ "version": "3.27.2",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",