rollup 3.27.0 → 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 +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +86 -26
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +2 -3
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +86 -26
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.27.
|
|
4
|
-
|
|
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.27.
|
|
18
|
+
var version$1 = "3.27.1";
|
|
19
19
|
|
|
20
20
|
const comma = ','.charCodeAt(0);
|
|
21
21
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -13217,12 +13217,82 @@ 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
|
+
|
|
13220
13290
|
function getId(m) {
|
|
13221
13291
|
return m.id;
|
|
13222
13292
|
}
|
|
13223
13293
|
|
|
13224
13294
|
function getOriginalLocation(sourcemapChain, location) {
|
|
13225
|
-
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) =>
|
|
13295
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
|
|
13226
13296
|
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
13227
13297
|
const sourcemap = filteredSourcemapChain.pop();
|
|
13228
13298
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -13920,8 +13990,13 @@ class Module {
|
|
|
13920
13990
|
timeStart('generate ast', 3);
|
|
13921
13991
|
this.info.code = code;
|
|
13922
13992
|
this.originalCode = originalCode;
|
|
13923
|
-
|
|
13924
|
-
|
|
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);
|
|
13925
14000
|
if (transformFiles) {
|
|
13926
14001
|
this.transformFiles = transformFiles;
|
|
13927
14002
|
}
|
|
@@ -17438,7 +17513,7 @@ class Link {
|
|
|
17438
17513
|
}
|
|
17439
17514
|
function getLinkMap(log) {
|
|
17440
17515
|
return function linkMap(source, map) {
|
|
17441
|
-
if (map.
|
|
17516
|
+
if (!map.missing) {
|
|
17442
17517
|
return new Link(map, [source]);
|
|
17443
17518
|
}
|
|
17444
17519
|
log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
|
|
@@ -17477,6 +17552,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
|
|
|
17477
17552
|
file = basename(file);
|
|
17478
17553
|
}
|
|
17479
17554
|
sourcesContent = (excludeContent ? null : sourcesContent);
|
|
17555
|
+
for (const module of modules) {
|
|
17556
|
+
resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
|
|
17557
|
+
}
|
|
17480
17558
|
return new SourceMap({ file, mappings, names, sources, sourcesContent });
|
|
17481
17559
|
}
|
|
17482
17560
|
function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
|
|
@@ -17485,29 +17563,11 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
|
|
|
17485
17563
|
}
|
|
17486
17564
|
const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
|
|
17487
17565
|
const map = source.traceMappings();
|
|
17488
|
-
return { version: 3, ...map };
|
|
17566
|
+
return decodedSourcemap({ version: 3, ...map });
|
|
17489
17567
|
}
|
|
17490
17568
|
|
|
17491
17569
|
const createHash = () => createHash$1('sha256');
|
|
17492
17570
|
|
|
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
|
-
|
|
17511
17571
|
async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
|
|
17512
17572
|
timeStart('render chunks', 2);
|
|
17513
17573
|
reserveEntryChunksInBundle(chunks);
|
package/dist/es/shared/watch.js
CHANGED
package/dist/getLogFilter.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
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
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.27.
|
|
4
|
-
|
|
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.27.
|
|
33
|
+
var version$1 = "3.27.1";
|
|
34
34
|
|
|
35
35
|
function ensureArray$1(items) {
|
|
36
36
|
if (Array.isArray(items)) {
|
|
@@ -14706,12 +14706,82 @@ 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
|
+
|
|
14709
14779
|
function getId(m) {
|
|
14710
14780
|
return m.id;
|
|
14711
14781
|
}
|
|
14712
14782
|
|
|
14713
14783
|
function getOriginalLocation(sourcemapChain, location) {
|
|
14714
|
-
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) =>
|
|
14784
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !sourcemap.missing);
|
|
14715
14785
|
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
14716
14786
|
const sourcemap = filteredSourcemapChain.pop();
|
|
14717
14787
|
const line = sourcemap.mappings[location.line - 1];
|
|
@@ -15409,8 +15479,13 @@ class Module {
|
|
|
15409
15479
|
timeStart('generate ast', 3);
|
|
15410
15480
|
this.info.code = code;
|
|
15411
15481
|
this.originalCode = originalCode;
|
|
15412
|
-
|
|
15413
|
-
|
|
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);
|
|
15414
15489
|
if (transformFiles) {
|
|
15415
15490
|
this.transformFiles = transformFiles;
|
|
15416
15491
|
}
|
|
@@ -18822,7 +18897,7 @@ class Link {
|
|
|
18822
18897
|
}
|
|
18823
18898
|
function getLinkMap(log) {
|
|
18824
18899
|
return function linkMap(source, map) {
|
|
18825
|
-
if (map.
|
|
18900
|
+
if (!map.missing) {
|
|
18826
18901
|
return new Link(map, [source]);
|
|
18827
18902
|
}
|
|
18828
18903
|
log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
|
|
@@ -18861,6 +18936,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
|
|
|
18861
18936
|
file = node_path.basename(file);
|
|
18862
18937
|
}
|
|
18863
18938
|
sourcesContent = (excludeContent ? null : sourcesContent);
|
|
18939
|
+
for (const module of modules) {
|
|
18940
|
+
resetSourcemapCache(module.originalSourcemap, module.sourcemapChain);
|
|
18941
|
+
}
|
|
18864
18942
|
return new SourceMap({ file, mappings, names, sources, sourcesContent });
|
|
18865
18943
|
}
|
|
18866
18944
|
function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
|
|
@@ -18869,25 +18947,7 @@ function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
|
|
|
18869
18947
|
}
|
|
18870
18948
|
const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
|
|
18871
18949
|
const map = source.traceMappings();
|
|
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 };
|
|
18950
|
+
return decodedSourcemap({ version: 3, ...map });
|
|
18891
18951
|
}
|
|
18892
18952
|
|
|
18893
18953
|
async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED