rollup 3.15.1-1 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +40 -72
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +9 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +40 -72
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
package/dist/es/rollup.js
CHANGED
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.16.0
|
|
4
|
+
Fri, 17 Feb 2023 13:26:29 GMT - commit 8ba73f4f643e5ffe01fc9ad846748f6d5b7963c2
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version$1 = "3.
|
|
19
|
+
var version$1 = "3.16.0";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -16289,12 +16289,17 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
|
|
|
16289
16289
|
* following the above rules (a) and (b), starting with the smallest chunks
|
|
16290
16290
|
* to look for possible merge targets.
|
|
16291
16291
|
*/
|
|
16292
|
+
// TODO instead of picking the "closest" chunk, we could actually use a
|
|
16293
|
+
// technique similar to what we do for side effects to compare the size of the
|
|
16294
|
+
// static dependencies that are not part of the correlated dependencies
|
|
16292
16295
|
function getOptimizedChunks(chunkModulesBySignature, numberOfEntries, minChunkSize) {
|
|
16293
16296
|
timeStart('optimize chunks', 3);
|
|
16294
16297
|
const chunkPartition = getPartitionedChunks(chunkModulesBySignature, numberOfEntries, minChunkSize);
|
|
16298
|
+
console.log('Before eliminating small chunks, there were\n', Object.keys(chunkModulesBySignature).length, 'chunks, of which\n', chunkPartition.small.size, 'were below minChunkSize.');
|
|
16295
16299
|
if (chunkPartition.small.size > 0) {
|
|
16296
16300
|
mergeChunks(chunkPartition, minChunkSize);
|
|
16297
16301
|
}
|
|
16302
|
+
console.log('After merging chunks,\n', chunkPartition.small.size + chunkPartition.big.size, 'chunks remain, of which\n', chunkPartition.small.size, 'are below minChunkSize.');
|
|
16298
16303
|
timeEnd('optimize chunks', 3);
|
|
16299
16304
|
return [...chunkPartition.small, ...chunkPartition.big];
|
|
16300
16305
|
}
|
|
@@ -16391,8 +16396,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
16391
16396
|
return sizeA - sizeB;
|
|
16392
16397
|
}
|
|
16393
16398
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
16394
|
-
console.log('---- Initial chunks');
|
|
16395
|
-
printConsistencyCheck(chunkPartition);
|
|
16396
16399
|
for (const allowArbitraryMerges of [false, true]) {
|
|
16397
16400
|
for (const mergedChunk of chunkPartition.small) {
|
|
16398
16401
|
let closestChunk = null;
|
|
@@ -16440,11 +16443,10 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
16440
16443
|
dependentChunk.dependencies.add(closestChunk);
|
|
16441
16444
|
}
|
|
16442
16445
|
dependencies.delete(closestChunk);
|
|
16446
|
+
dependentChunks.delete(closestChunk);
|
|
16443
16447
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16444
16448
|
}
|
|
16445
16449
|
}
|
|
16446
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
16447
|
-
printConsistencyCheck(chunkPartition);
|
|
16448
16450
|
}
|
|
16449
16451
|
}
|
|
16450
16452
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -16500,58 +16502,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
16500
16502
|
}
|
|
16501
16503
|
return distance;
|
|
16502
16504
|
}
|
|
16503
|
-
function printConsistencyCheck(partition) {
|
|
16504
|
-
console.log(`Chunks\n small: ${partition.small.size},\n large: ${partition.big.size}`);
|
|
16505
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
16506
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
16507
|
-
let missingDependencies = 0;
|
|
16508
|
-
let missingDependentChunks = 0;
|
|
16509
|
-
const seenModules = new Set();
|
|
16510
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
16511
|
-
for (const module of modules) {
|
|
16512
|
-
if (seenModules.has(module)) {
|
|
16513
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
16514
|
-
}
|
|
16515
|
-
seenModules.add(module);
|
|
16516
|
-
}
|
|
16517
|
-
for (const dependency of dependencies) {
|
|
16518
|
-
if (!chunks.has(dependency)) {
|
|
16519
|
-
missingDependencies++;
|
|
16520
|
-
}
|
|
16521
|
-
}
|
|
16522
|
-
for (const dependency of dependentChunks) {
|
|
16523
|
-
if (!chunks.has(dependency)) {
|
|
16524
|
-
missingDependentChunks++;
|
|
16525
|
-
}
|
|
16526
|
-
}
|
|
16527
|
-
}
|
|
16528
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n dependent chunks: ${missingDependentChunks}\n`);
|
|
16529
|
-
}
|
|
16530
|
-
function getNumberOfCycles(chunks) {
|
|
16531
|
-
const parents = new Set();
|
|
16532
|
-
const analysedChunks = new Set();
|
|
16533
|
-
let cycles = 0;
|
|
16534
|
-
const analyseChunk = (chunk) => {
|
|
16535
|
-
for (const dependency of chunk.dependencies) {
|
|
16536
|
-
if (parents.has(dependency)) {
|
|
16537
|
-
if (!analysedChunks.has(dependency)) {
|
|
16538
|
-
cycles++;
|
|
16539
|
-
}
|
|
16540
|
-
continue;
|
|
16541
|
-
}
|
|
16542
|
-
parents.add(dependency);
|
|
16543
|
-
analyseChunk(dependency);
|
|
16544
|
-
}
|
|
16545
|
-
analysedChunks.add(chunk);
|
|
16546
|
-
};
|
|
16547
|
-
for (const chunk of chunks) {
|
|
16548
|
-
if (!parents.has(chunk)) {
|
|
16549
|
-
parents.add(chunk);
|
|
16550
|
-
analyseChunk(chunk);
|
|
16551
|
-
}
|
|
16552
|
-
}
|
|
16553
|
-
return cycles;
|
|
16554
|
-
}
|
|
16555
16505
|
|
|
16556
16506
|
// ported from https://github.com/substack/node-commondir
|
|
16557
16507
|
function commondir(files) {
|
|
@@ -16909,7 +16859,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
16909
16859
|
}
|
|
16910
16860
|
return result.code;
|
|
16911
16861
|
});
|
|
16912
|
-
const { compact, dir, file, sourcemap, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform } = options;
|
|
16862
|
+
const { compact, dir, file, sourcemap, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, sourcemapIgnoreList } = options;
|
|
16913
16863
|
if (!compact && code[code.length - 1] !== '\n')
|
|
16914
16864
|
code += '\n';
|
|
16915
16865
|
if (sourcemap) {
|
|
@@ -16923,18 +16873,31 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
16923
16873
|
resultingFile = resolve(fileName);
|
|
16924
16874
|
const decodedMap = magicString.generateDecodedMap({});
|
|
16925
16875
|
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, onwarn);
|
|
16926
|
-
|
|
16927
|
-
|
|
16876
|
+
for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
|
|
16877
|
+
let sourcePath = map.sources[sourcesIndex];
|
|
16878
|
+
const sourcemapPath = `${resultingFile}.map`;
|
|
16879
|
+
if (sourcemapIgnoreList) {
|
|
16880
|
+
const ignoreList = sourcemapIgnoreList(sourcePath, sourcemapPath);
|
|
16881
|
+
if (typeof ignoreList !== 'boolean') {
|
|
16882
|
+
error(errorFailedValidation('sourcemapIgnoreList function must return a boolean.'));
|
|
16883
|
+
}
|
|
16884
|
+
if (ignoreList) {
|
|
16885
|
+
if (map.x_google_ignoreList === undefined) {
|
|
16886
|
+
map.x_google_ignoreList = [];
|
|
16887
|
+
}
|
|
16888
|
+
if (!map.x_google_ignoreList.includes(sourcesIndex)) {
|
|
16889
|
+
map.x_google_ignoreList.push(sourcesIndex);
|
|
16890
|
+
}
|
|
16891
|
+
}
|
|
16892
|
+
}
|
|
16928
16893
|
if (sourcemapPathTransform) {
|
|
16929
|
-
|
|
16930
|
-
if (typeof
|
|
16894
|
+
sourcePath = sourcemapPathTransform(sourcePath, sourcemapPath);
|
|
16895
|
+
if (typeof sourcePath !== 'string') {
|
|
16931
16896
|
error(errorFailedValidation(`sourcemapPathTransform function must return a string.`));
|
|
16932
16897
|
}
|
|
16933
|
-
return newSourcePath;
|
|
16934
16898
|
}
|
|
16935
|
-
|
|
16936
|
-
}
|
|
16937
|
-
.map(normalize);
|
|
16899
|
+
map.sources[sourcesIndex] = normalize(sourcePath);
|
|
16900
|
+
}
|
|
16938
16901
|
timeEnd('sourcemaps', 3);
|
|
16939
16902
|
}
|
|
16940
16903
|
return {
|
|
@@ -24301,7 +24264,8 @@ class Graph {
|
|
|
24301
24264
|
}
|
|
24302
24265
|
}
|
|
24303
24266
|
includeStatements() {
|
|
24304
|
-
|
|
24267
|
+
const entryModules = [...this.entryModules, ...this.implicitEntryModules];
|
|
24268
|
+
for (const module of entryModules) {
|
|
24305
24269
|
markModuleAndImpureDependenciesAsExecuted(module);
|
|
24306
24270
|
}
|
|
24307
24271
|
if (this.options.treeshake) {
|
|
@@ -24322,7 +24286,7 @@ class Graph {
|
|
|
24322
24286
|
if (treeshakingPass === 1) {
|
|
24323
24287
|
// We only include exports after the first pass to avoid issues with
|
|
24324
24288
|
// the TDZ detection logic
|
|
24325
|
-
for (const module of
|
|
24289
|
+
for (const module of entryModules) {
|
|
24326
24290
|
if (module.preserveSignature !== false) {
|
|
24327
24291
|
module.includeAllExports(false);
|
|
24328
24292
|
this.needsTreeshakingPass = true;
|
|
@@ -24810,7 +24774,9 @@ const getAcornInjectPlugins = (config) => [
|
|
|
24810
24774
|
importAssertions,
|
|
24811
24775
|
...ensureArray(config.acornInjectPlugins)
|
|
24812
24776
|
];
|
|
24813
|
-
const getCache = (config) => config.cache
|
|
24777
|
+
const getCache = (config) => config.cache === true // `true` is the default
|
|
24778
|
+
? undefined
|
|
24779
|
+
: config.cache?.cache || config.cache;
|
|
24814
24780
|
const getIdMatcher = (option) => {
|
|
24815
24781
|
if (option === true) {
|
|
24816
24782
|
return () => true;
|
|
@@ -24994,6 +24960,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
24994
24960
|
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
24995
24961
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
24996
24962
|
sourcemapFile: config.sourcemapFile,
|
|
24963
|
+
sourcemapIgnoreList: config.sourcemapIgnoreList,
|
|
24997
24964
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
24998
24965
|
strict: config.strict ?? true,
|
|
24999
24966
|
systemNullSetters: config.systemNullSetters ?? true,
|
|
@@ -25547,7 +25514,7 @@ async function mergeOptions(config, rawCommandOptions = EMPTY_COMMAND_OPTIONS, d
|
|
|
25547
25514
|
const outputOptions = await Promise.all(outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn)));
|
|
25548
25515
|
warnUnknownOptions(command, [
|
|
25549
25516
|
...Object.keys(inputOptions),
|
|
25550
|
-
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'),
|
|
25517
|
+
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapIgnoreList' && option !== 'sourcemapPathTransform'),
|
|
25551
25518
|
...Object.keys(commandAliases),
|
|
25552
25519
|
'bundleConfigAsCjs',
|
|
25553
25520
|
'config',
|
|
@@ -25682,6 +25649,7 @@ async function mergeOutputOptions(config, overrides, warn) {
|
|
|
25682
25649
|
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
|
|
25683
25650
|
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
|
|
25684
25651
|
sourcemapFile: getOption('sourcemapFile'),
|
|
25652
|
+
sourcemapIgnoreList: getOption('sourcemapIgnoreList'),
|
|
25685
25653
|
sourcemapPathTransform: getOption('sourcemapPathTransform'),
|
|
25686
25654
|
strict: getOption('strict'),
|
|
25687
25655
|
systemNullSetters: getOption('systemNullSetters'),
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export interface ExistingDecodedSourceMap {
|
|
|
54
54
|
sources: string[];
|
|
55
55
|
sourcesContent?: (string | null)[];
|
|
56
56
|
version: number;
|
|
57
|
+
x_google_ignoreList?: number[];
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export interface ExistingRawSourceMap {
|
|
@@ -64,6 +65,7 @@ export interface ExistingRawSourceMap {
|
|
|
64
65
|
sources: string[];
|
|
65
66
|
sourcesContent?: (string | null)[];
|
|
66
67
|
version: number;
|
|
68
|
+
x_google_ignoreList?: number[];
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
export type DecodedSourceMapOrMissing =
|
|
@@ -507,13 +509,17 @@ export type SourcemapPathTransformOption = (
|
|
|
507
509
|
relativeSourcePath: string,
|
|
508
510
|
sourcemapPath: string
|
|
509
511
|
) => string;
|
|
512
|
+
export type SourcemapIgnoreListOption = (
|
|
513
|
+
relativeSourcePath: string,
|
|
514
|
+
sourcemapPath: string
|
|
515
|
+
) => boolean;
|
|
510
516
|
|
|
511
517
|
export type InputPluginOption = MaybePromise<Plugin | NullValue | false | InputPluginOption[]>;
|
|
512
518
|
|
|
513
519
|
export interface InputOptions {
|
|
514
520
|
acorn?: Record<string, unknown>;
|
|
515
521
|
acornInjectPlugins?: (() => unknown)[] | (() => unknown);
|
|
516
|
-
cache?:
|
|
522
|
+
cache?: boolean | RollupCache;
|
|
517
523
|
context?: string;
|
|
518
524
|
experimentalCacheExpiry?: number;
|
|
519
525
|
external?: ExternalOption;
|
|
@@ -683,6 +689,7 @@ export interface OutputOptions {
|
|
|
683
689
|
sourcemapBaseUrl?: string;
|
|
684
690
|
sourcemapExcludeSources?: boolean;
|
|
685
691
|
sourcemapFile?: string;
|
|
692
|
+
sourcemapIgnoreList?: SourcemapIgnoreListOption;
|
|
686
693
|
sourcemapPathTransform?: SourcemapPathTransformOption;
|
|
687
694
|
strict?: boolean;
|
|
688
695
|
systemNullSetters?: boolean;
|
|
@@ -736,6 +743,7 @@ export interface NormalizedOutputOptions {
|
|
|
736
743
|
sourcemapBaseUrl: string | undefined;
|
|
737
744
|
sourcemapExcludeSources: boolean;
|
|
738
745
|
sourcemapFile: string | undefined;
|
|
746
|
+
sourcemapIgnoreList: SourcemapIgnoreListOption | undefined;
|
|
739
747
|
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
|
740
748
|
strict: boolean;
|
|
741
749
|
systemNullSetters: boolean;
|
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.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.16.0
|
|
4
|
+
Fri, 17 Feb 2023 13:26:29 GMT - commit 8ba73f4f643e5ffe01fc9ad846748f6d5b7963c2
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.
|
|
34
|
+
var version$1 = "3.16.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -973,7 +973,7 @@ async function mergeOptions(config, rawCommandOptions = EMPTY_COMMAND_OPTIONS, d
|
|
|
973
973
|
const outputOptions = await Promise.all(outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn)));
|
|
974
974
|
warnUnknownOptions(command, [
|
|
975
975
|
...Object.keys(inputOptions),
|
|
976
|
-
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'),
|
|
976
|
+
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapIgnoreList' && option !== 'sourcemapPathTransform'),
|
|
977
977
|
...Object.keys(commandAliases),
|
|
978
978
|
'bundleConfigAsCjs',
|
|
979
979
|
'config',
|
|
@@ -1114,6 +1114,7 @@ async function mergeOutputOptions(config, overrides, warn) {
|
|
|
1114
1114
|
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
|
|
1115
1115
|
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
|
|
1116
1116
|
sourcemapFile: getOption('sourcemapFile'),
|
|
1117
|
+
sourcemapIgnoreList: getOption('sourcemapIgnoreList'),
|
|
1117
1118
|
sourcemapPathTransform: getOption('sourcemapPathTransform'),
|
|
1118
1119
|
strict: getOption('strict'),
|
|
1119
1120
|
systemNullSetters: getOption('systemNullSetters'),
|
|
@@ -16808,12 +16809,17 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
|
|
|
16808
16809
|
* following the above rules (a) and (b), starting with the smallest chunks
|
|
16809
16810
|
* to look for possible merge targets.
|
|
16810
16811
|
*/
|
|
16812
|
+
// TODO instead of picking the "closest" chunk, we could actually use a
|
|
16813
|
+
// technique similar to what we do for side effects to compare the size of the
|
|
16814
|
+
// static dependencies that are not part of the correlated dependencies
|
|
16811
16815
|
function getOptimizedChunks(chunkModulesBySignature, numberOfEntries, minChunkSize) {
|
|
16812
16816
|
timeStart('optimize chunks', 3);
|
|
16813
16817
|
const chunkPartition = getPartitionedChunks(chunkModulesBySignature, numberOfEntries, minChunkSize);
|
|
16818
|
+
console.log('Before eliminating small chunks, there were\n', Object.keys(chunkModulesBySignature).length, 'chunks, of which\n', chunkPartition.small.size, 'were below minChunkSize.');
|
|
16814
16819
|
if (chunkPartition.small.size > 0) {
|
|
16815
16820
|
mergeChunks(chunkPartition, minChunkSize);
|
|
16816
16821
|
}
|
|
16822
|
+
console.log('After merging chunks,\n', chunkPartition.small.size + chunkPartition.big.size, 'chunks remain, of which\n', chunkPartition.small.size, 'are below minChunkSize.');
|
|
16817
16823
|
timeEnd('optimize chunks', 3);
|
|
16818
16824
|
return [...chunkPartition.small, ...chunkPartition.big];
|
|
16819
16825
|
}
|
|
@@ -16910,8 +16916,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
16910
16916
|
return sizeA - sizeB;
|
|
16911
16917
|
}
|
|
16912
16918
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
16913
|
-
console.log('---- Initial chunks');
|
|
16914
|
-
printConsistencyCheck(chunkPartition);
|
|
16915
16919
|
for (const allowArbitraryMerges of [false, true]) {
|
|
16916
16920
|
for (const mergedChunk of chunkPartition.small) {
|
|
16917
16921
|
let closestChunk = null;
|
|
@@ -16959,11 +16963,10 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
16959
16963
|
dependentChunk.dependencies.add(closestChunk);
|
|
16960
16964
|
}
|
|
16961
16965
|
dependencies.delete(closestChunk);
|
|
16966
|
+
dependentChunks.delete(closestChunk);
|
|
16962
16967
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16963
16968
|
}
|
|
16964
16969
|
}
|
|
16965
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
16966
|
-
printConsistencyCheck(chunkPartition);
|
|
16967
16970
|
}
|
|
16968
16971
|
}
|
|
16969
16972
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -17019,58 +17022,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
17019
17022
|
}
|
|
17020
17023
|
return distance;
|
|
17021
17024
|
}
|
|
17022
|
-
function printConsistencyCheck(partition) {
|
|
17023
|
-
console.log(`Chunks\n small: ${partition.small.size},\n large: ${partition.big.size}`);
|
|
17024
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
17025
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
17026
|
-
let missingDependencies = 0;
|
|
17027
|
-
let missingDependentChunks = 0;
|
|
17028
|
-
const seenModules = new Set();
|
|
17029
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
17030
|
-
for (const module of modules) {
|
|
17031
|
-
if (seenModules.has(module)) {
|
|
17032
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
17033
|
-
}
|
|
17034
|
-
seenModules.add(module);
|
|
17035
|
-
}
|
|
17036
|
-
for (const dependency of dependencies) {
|
|
17037
|
-
if (!chunks.has(dependency)) {
|
|
17038
|
-
missingDependencies++;
|
|
17039
|
-
}
|
|
17040
|
-
}
|
|
17041
|
-
for (const dependency of dependentChunks) {
|
|
17042
|
-
if (!chunks.has(dependency)) {
|
|
17043
|
-
missingDependentChunks++;
|
|
17044
|
-
}
|
|
17045
|
-
}
|
|
17046
|
-
}
|
|
17047
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n dependent chunks: ${missingDependentChunks}\n`);
|
|
17048
|
-
}
|
|
17049
|
-
function getNumberOfCycles(chunks) {
|
|
17050
|
-
const parents = new Set();
|
|
17051
|
-
const analysedChunks = new Set();
|
|
17052
|
-
let cycles = 0;
|
|
17053
|
-
const analyseChunk = (chunk) => {
|
|
17054
|
-
for (const dependency of chunk.dependencies) {
|
|
17055
|
-
if (parents.has(dependency)) {
|
|
17056
|
-
if (!analysedChunks.has(dependency)) {
|
|
17057
|
-
cycles++;
|
|
17058
|
-
}
|
|
17059
|
-
continue;
|
|
17060
|
-
}
|
|
17061
|
-
parents.add(dependency);
|
|
17062
|
-
analyseChunk(dependency);
|
|
17063
|
-
}
|
|
17064
|
-
analysedChunks.add(chunk);
|
|
17065
|
-
};
|
|
17066
|
-
for (const chunk of chunks) {
|
|
17067
|
-
if (!parents.has(chunk)) {
|
|
17068
|
-
parents.add(chunk);
|
|
17069
|
-
analyseChunk(chunk);
|
|
17070
|
-
}
|
|
17071
|
-
}
|
|
17072
|
-
return cycles;
|
|
17073
|
-
}
|
|
17074
17025
|
|
|
17075
17026
|
// ported from https://github.com/substack/node-commondir
|
|
17076
17027
|
function commondir(files) {
|
|
@@ -17428,7 +17379,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
17428
17379
|
}
|
|
17429
17380
|
return result.code;
|
|
17430
17381
|
});
|
|
17431
|
-
const { compact, dir, file, sourcemap, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform } = options;
|
|
17382
|
+
const { compact, dir, file, sourcemap, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, sourcemapIgnoreList } = options;
|
|
17432
17383
|
if (!compact && code[code.length - 1] !== '\n')
|
|
17433
17384
|
code += '\n';
|
|
17434
17385
|
if (sourcemap) {
|
|
@@ -17442,18 +17393,31 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
17442
17393
|
resultingFile = node_path.resolve(fileName);
|
|
17443
17394
|
const decodedMap = magicString.generateDecodedMap({});
|
|
17444
17395
|
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, onwarn);
|
|
17445
|
-
|
|
17446
|
-
|
|
17396
|
+
for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
|
|
17397
|
+
let sourcePath = map.sources[sourcesIndex];
|
|
17398
|
+
const sourcemapPath = `${resultingFile}.map`;
|
|
17399
|
+
if (sourcemapIgnoreList) {
|
|
17400
|
+
const ignoreList = sourcemapIgnoreList(sourcePath, sourcemapPath);
|
|
17401
|
+
if (typeof ignoreList !== 'boolean') {
|
|
17402
|
+
error(errorFailedValidation('sourcemapIgnoreList function must return a boolean.'));
|
|
17403
|
+
}
|
|
17404
|
+
if (ignoreList) {
|
|
17405
|
+
if (map.x_google_ignoreList === undefined) {
|
|
17406
|
+
map.x_google_ignoreList = [];
|
|
17407
|
+
}
|
|
17408
|
+
if (!map.x_google_ignoreList.includes(sourcesIndex)) {
|
|
17409
|
+
map.x_google_ignoreList.push(sourcesIndex);
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17412
|
+
}
|
|
17447
17413
|
if (sourcemapPathTransform) {
|
|
17448
|
-
|
|
17449
|
-
if (typeof
|
|
17414
|
+
sourcePath = sourcemapPathTransform(sourcePath, sourcemapPath);
|
|
17415
|
+
if (typeof sourcePath !== 'string') {
|
|
17450
17416
|
error(errorFailedValidation(`sourcemapPathTransform function must return a string.`));
|
|
17451
17417
|
}
|
|
17452
|
-
return newSourcePath;
|
|
17453
17418
|
}
|
|
17454
|
-
|
|
17455
|
-
}
|
|
17456
|
-
.map(normalize);
|
|
17419
|
+
map.sources[sourcesIndex] = normalize(sourcePath);
|
|
17420
|
+
}
|
|
17457
17421
|
timeEnd('sourcemaps', 3);
|
|
17458
17422
|
}
|
|
17459
17423
|
return {
|
|
@@ -24820,7 +24784,8 @@ class Graph {
|
|
|
24820
24784
|
}
|
|
24821
24785
|
}
|
|
24822
24786
|
includeStatements() {
|
|
24823
|
-
|
|
24787
|
+
const entryModules = [...this.entryModules, ...this.implicitEntryModules];
|
|
24788
|
+
for (const module of entryModules) {
|
|
24824
24789
|
markModuleAndImpureDependenciesAsExecuted(module);
|
|
24825
24790
|
}
|
|
24826
24791
|
if (this.options.treeshake) {
|
|
@@ -24841,7 +24806,7 @@ class Graph {
|
|
|
24841
24806
|
if (treeshakingPass === 1) {
|
|
24842
24807
|
// We only include exports after the first pass to avoid issues with
|
|
24843
24808
|
// the TDZ detection logic
|
|
24844
|
-
for (const module of
|
|
24809
|
+
for (const module of entryModules) {
|
|
24845
24810
|
if (module.preserveSignature !== false) {
|
|
24846
24811
|
module.includeAllExports(false);
|
|
24847
24812
|
this.needsTreeshakingPass = true;
|
|
@@ -25233,7 +25198,9 @@ const getAcornInjectPlugins = (config) => [
|
|
|
25233
25198
|
importAssertions,
|
|
25234
25199
|
...ensureArray$1(config.acornInjectPlugins)
|
|
25235
25200
|
];
|
|
25236
|
-
const getCache = (config) => config.cache
|
|
25201
|
+
const getCache = (config) => config.cache === true // `true` is the default
|
|
25202
|
+
? undefined
|
|
25203
|
+
: config.cache?.cache || config.cache;
|
|
25237
25204
|
const getIdMatcher = (option) => {
|
|
25238
25205
|
if (option === true) {
|
|
25239
25206
|
return () => true;
|
|
@@ -25417,6 +25384,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
25417
25384
|
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
25418
25385
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
25419
25386
|
sourcemapFile: config.sourcemapFile,
|
|
25387
|
+
sourcemapIgnoreList: config.sourcemapIgnoreList,
|
|
25420
25388
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
25421
25389
|
strict: config.strict ?? true,
|
|
25422
25390
|
systemNullSetters: config.systemNullSetters ?? true,
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED