rollup 3.17.3-0 → 3.17.3
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/node-entry.js +14 -90
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- 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 +14 -90
- 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/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.17.3
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.17.3
|
|
4
|
+
Sat, 25 Feb 2023 20:27:53 GMT - commit fa4e9a5fd037e94759390595f867220fa0af8a3e
|
|
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.17.3
|
|
19
|
+
var version$1 = "3.17.3";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -5701,8 +5701,8 @@ class NodeBase extends ExpressionEntity {
|
|
|
5701
5701
|
}
|
|
5702
5702
|
addExportedVariables(_variables, _exportNamesByVariable) { }
|
|
5703
5703
|
/**
|
|
5704
|
-
* Override this to bind assignments to variables and do any initialisations
|
|
5705
|
-
*
|
|
5704
|
+
* Override this to bind assignments to variables and do any initialisations that
|
|
5705
|
+
* require the scopes to be populated with variables.
|
|
5706
5706
|
*/
|
|
5707
5707
|
bind() {
|
|
5708
5708
|
for (const key of this.keys) {
|
|
@@ -5718,8 +5718,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5718
5718
|
}
|
|
5719
5719
|
}
|
|
5720
5720
|
/**
|
|
5721
|
-
* Override if this node should receive a different scope than the parent
|
|
5722
|
-
* scope.
|
|
5721
|
+
* Override if this node should receive a different scope than the parent scope.
|
|
5723
5722
|
*/
|
|
5724
5723
|
createScope(parentScope) {
|
|
5725
5724
|
this.scope = parentScope;
|
|
@@ -5768,8 +5767,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5768
5767
|
this.include(context, includeChildrenRecursively);
|
|
5769
5768
|
}
|
|
5770
5769
|
/**
|
|
5771
|
-
* Override to perform special initialisation steps after the scope is
|
|
5772
|
-
* initialised
|
|
5770
|
+
* Override to perform special initialisation steps after the scope is initialised
|
|
5773
5771
|
*/
|
|
5774
5772
|
initialise() { }
|
|
5775
5773
|
insertSemicolon(code) {
|
|
@@ -5851,23 +5849,6 @@ class NodeBase extends ExpressionEntity {
|
|
|
5851
5849
|
this.context.requestTreeshakingPass();
|
|
5852
5850
|
}
|
|
5853
5851
|
}
|
|
5854
|
-
function logNode(node) {
|
|
5855
|
-
return node.context.code.slice(node.start, node.end);
|
|
5856
|
-
}
|
|
5857
|
-
function logEffect(node, module) {
|
|
5858
|
-
if (!module.hasLoggedEffect) {
|
|
5859
|
-
module.hasLoggedEffect = true;
|
|
5860
|
-
let effect = logNode(node);
|
|
5861
|
-
let truncated = false;
|
|
5862
|
-
if (effect.length > 150) {
|
|
5863
|
-
truncated = true;
|
|
5864
|
-
effect = effect.slice(0, 150) + '...';
|
|
5865
|
-
}
|
|
5866
|
-
console.log(`==> First side effect in ${relativeId(module.id)}${truncated ? ' (truncated)' : ''}:`);
|
|
5867
|
-
console.log(effect);
|
|
5868
|
-
console.log('<==\n');
|
|
5869
|
-
}
|
|
5870
|
-
}
|
|
5871
5852
|
|
|
5872
5853
|
class SpreadElement extends NodeBase {
|
|
5873
5854
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -8343,10 +8324,8 @@ class BlockStatement extends NodeBase {
|
|
|
8343
8324
|
for (const node of this.body) {
|
|
8344
8325
|
if (context.brokenFlow)
|
|
8345
8326
|
break;
|
|
8346
|
-
if (node.hasEffects(context))
|
|
8347
|
-
logEffect(node, this.context.module);
|
|
8327
|
+
if (node.hasEffects(context))
|
|
8348
8328
|
return true;
|
|
8349
|
-
}
|
|
8350
8329
|
}
|
|
8351
8330
|
return false;
|
|
8352
8331
|
}
|
|
@@ -11302,6 +11281,8 @@ const getGenericImportMetaMechanism = (getUrl) => (property, { chunkId }) => {
|
|
|
11302
11281
|
? urlMechanism
|
|
11303
11282
|
: 'undefined';
|
|
11304
11283
|
};
|
|
11284
|
+
const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
|
11285
|
+
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
|
|
11305
11286
|
const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${escapeId(chunkId)}', document.baseURI).href)`;
|
|
11306
11287
|
const relativeUrlMechanisms = {
|
|
11307
11288
|
amd: relativePath => {
|
|
@@ -11309,18 +11290,18 @@ const relativeUrlMechanisms = {
|
|
|
11309
11290
|
relativePath = './' + relativePath;
|
|
11310
11291
|
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
|
11311
11292
|
},
|
|
11312
|
-
cjs: relativePath => `(typeof document === 'undefined' ? ${
|
|
11293
|
+
cjs: relativePath => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
11313
11294
|
es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
11314
11295
|
iife: relativePath => getRelativeUrlFromDocument(relativePath),
|
|
11315
11296
|
system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
11316
|
-
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11297
|
+
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
11317
11298
|
};
|
|
11318
11299
|
const importMetaMechanisms = {
|
|
11319
11300
|
amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
|
|
11320
|
-
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${
|
|
11301
|
+
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId)})`),
|
|
11321
11302
|
iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
|
|
11322
11303
|
system: (property, { snippets: { getPropertyAccess } }) => property === null ? `module.meta` : `module.meta${getPropertyAccess(property)}`,
|
|
11323
|
-
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11304
|
+
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId, true)})`)
|
|
11324
11305
|
};
|
|
11325
11306
|
|
|
11326
11307
|
class NewExpression extends NodeBase {
|
|
@@ -11468,7 +11449,6 @@ class Program extends NodeBase {
|
|
|
11468
11449
|
hasEffects(context) {
|
|
11469
11450
|
for (const node of this.body) {
|
|
11470
11451
|
if (node.hasEffects(context)) {
|
|
11471
|
-
logEffect(node, this.context.module);
|
|
11472
11452
|
return (this.hasCachedEffect = true);
|
|
11473
11453
|
}
|
|
11474
11454
|
}
|
|
@@ -13034,7 +13014,6 @@ class Module {
|
|
|
13034
13014
|
this.dynamicImporters = [];
|
|
13035
13015
|
this.dynamicImports = [];
|
|
13036
13016
|
this.execIndex = Infinity;
|
|
13037
|
-
this.hasLoggedEffect = false;
|
|
13038
13017
|
this.implicitlyLoadedAfter = new Set();
|
|
13039
13018
|
this.implicitlyLoadedBefore = new Set();
|
|
13040
13019
|
this.importDescriptions = new Map();
|
|
@@ -16577,8 +16556,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
16577
16556
|
return sizeA - sizeB;
|
|
16578
16557
|
}
|
|
16579
16558
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
16580
|
-
console.log('---- Initial chunks');
|
|
16581
|
-
printConsistencyCheck(chunkPartition);
|
|
16582
16559
|
for (const allowArbitraryMerges of [false, true]) {
|
|
16583
16560
|
for (const mergedChunk of chunkPartition.small) {
|
|
16584
16561
|
let closestChunk = null;
|
|
@@ -16630,8 +16607,6 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
16630
16607
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16631
16608
|
}
|
|
16632
16609
|
}
|
|
16633
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
16634
|
-
printConsistencyCheck(chunkPartition);
|
|
16635
16610
|
}
|
|
16636
16611
|
}
|
|
16637
16612
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -16687,57 +16662,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
16687
16662
|
}
|
|
16688
16663
|
return distance;
|
|
16689
16664
|
}
|
|
16690
|
-
function printConsistencyCheck(partition) {
|
|
16691
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
16692
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
16693
|
-
let missingDependencies = 0;
|
|
16694
|
-
let missingDependentChunks = 0;
|
|
16695
|
-
const seenModules = new Set();
|
|
16696
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
16697
|
-
for (const module of modules) {
|
|
16698
|
-
if (seenModules.has(module)) {
|
|
16699
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
16700
|
-
}
|
|
16701
|
-
seenModules.add(module);
|
|
16702
|
-
}
|
|
16703
|
-
for (const dependency of dependencies) {
|
|
16704
|
-
if (!chunks.has(dependency)) {
|
|
16705
|
-
missingDependencies++;
|
|
16706
|
-
}
|
|
16707
|
-
}
|
|
16708
|
-
for (const dependency of dependentChunks) {
|
|
16709
|
-
if (!chunks.has(dependency)) {
|
|
16710
|
-
missingDependentChunks++;
|
|
16711
|
-
}
|
|
16712
|
-
}
|
|
16713
|
-
}
|
|
16714
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
|
|
16715
|
-
}
|
|
16716
|
-
function getNumberOfCycles(chunks) {
|
|
16717
|
-
const parents = new Set();
|
|
16718
|
-
const analysedChunks = new Set();
|
|
16719
|
-
let cycles = 0;
|
|
16720
|
-
const analyseChunk = (chunk) => {
|
|
16721
|
-
for (const dependency of chunk.dependencies) {
|
|
16722
|
-
if (parents.has(dependency)) {
|
|
16723
|
-
if (!analysedChunks.has(dependency)) {
|
|
16724
|
-
cycles++;
|
|
16725
|
-
}
|
|
16726
|
-
continue;
|
|
16727
|
-
}
|
|
16728
|
-
parents.add(dependency);
|
|
16729
|
-
analyseChunk(dependency);
|
|
16730
|
-
}
|
|
16731
|
-
analysedChunks.add(chunk);
|
|
16732
|
-
};
|
|
16733
|
-
for (const chunk of chunks) {
|
|
16734
|
-
if (!parents.has(chunk)) {
|
|
16735
|
-
parents.add(chunk);
|
|
16736
|
-
analyseChunk(chunk);
|
|
16737
|
-
}
|
|
16738
|
-
}
|
|
16739
|
-
return cycles;
|
|
16740
|
-
}
|
|
16741
16665
|
|
|
16742
16666
|
// ported from https://github.com/substack/node-commondir
|
|
16743
16667
|
function commondir(files) {
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
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.17.3
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.17.3
|
|
4
|
+
Sat, 25 Feb 2023 20:27:53 GMT - commit fa4e9a5fd037e94759390595f867220fa0af8a3e
|
|
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.17.3
|
|
34
|
+
var version$1 = "3.17.3";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -6198,8 +6198,8 @@ class NodeBase extends ExpressionEntity {
|
|
|
6198
6198
|
}
|
|
6199
6199
|
addExportedVariables(_variables, _exportNamesByVariable) { }
|
|
6200
6200
|
/**
|
|
6201
|
-
* Override this to bind assignments to variables and do any initialisations
|
|
6202
|
-
*
|
|
6201
|
+
* Override this to bind assignments to variables and do any initialisations that
|
|
6202
|
+
* require the scopes to be populated with variables.
|
|
6203
6203
|
*/
|
|
6204
6204
|
bind() {
|
|
6205
6205
|
for (const key of this.keys) {
|
|
@@ -6215,8 +6215,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
6215
6215
|
}
|
|
6216
6216
|
}
|
|
6217
6217
|
/**
|
|
6218
|
-
* Override if this node should receive a different scope than the parent
|
|
6219
|
-
* scope.
|
|
6218
|
+
* Override if this node should receive a different scope than the parent scope.
|
|
6220
6219
|
*/
|
|
6221
6220
|
createScope(parentScope) {
|
|
6222
6221
|
this.scope = parentScope;
|
|
@@ -6265,8 +6264,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
6265
6264
|
this.include(context, includeChildrenRecursively);
|
|
6266
6265
|
}
|
|
6267
6266
|
/**
|
|
6268
|
-
* Override to perform special initialisation steps after the scope is
|
|
6269
|
-
* initialised
|
|
6267
|
+
* Override to perform special initialisation steps after the scope is initialised
|
|
6270
6268
|
*/
|
|
6271
6269
|
initialise() { }
|
|
6272
6270
|
insertSemicolon(code) {
|
|
@@ -6348,23 +6346,6 @@ class NodeBase extends ExpressionEntity {
|
|
|
6348
6346
|
this.context.requestTreeshakingPass();
|
|
6349
6347
|
}
|
|
6350
6348
|
}
|
|
6351
|
-
function logNode(node) {
|
|
6352
|
-
return node.context.code.slice(node.start, node.end);
|
|
6353
|
-
}
|
|
6354
|
-
function logEffect(node, module) {
|
|
6355
|
-
if (!module.hasLoggedEffect) {
|
|
6356
|
-
module.hasLoggedEffect = true;
|
|
6357
|
-
let effect = logNode(node);
|
|
6358
|
-
let truncated = false;
|
|
6359
|
-
if (effect.length > 150) {
|
|
6360
|
-
truncated = true;
|
|
6361
|
-
effect = effect.slice(0, 150) + '...';
|
|
6362
|
-
}
|
|
6363
|
-
console.log(`==> First side effect in ${relativeId(module.id)}${truncated ? ' (truncated)' : ''}:`);
|
|
6364
|
-
console.log(effect);
|
|
6365
|
-
console.log('<==\n');
|
|
6366
|
-
}
|
|
6367
|
-
}
|
|
6368
6349
|
|
|
6369
6350
|
class SpreadElement extends NodeBase {
|
|
6370
6351
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -8840,10 +8821,8 @@ class BlockStatement extends NodeBase {
|
|
|
8840
8821
|
for (const node of this.body) {
|
|
8841
8822
|
if (context.brokenFlow)
|
|
8842
8823
|
break;
|
|
8843
|
-
if (node.hasEffects(context))
|
|
8844
|
-
logEffect(node, this.context.module);
|
|
8824
|
+
if (node.hasEffects(context))
|
|
8845
8825
|
return true;
|
|
8846
|
-
}
|
|
8847
8826
|
}
|
|
8848
8827
|
return false;
|
|
8849
8828
|
}
|
|
@@ -11799,6 +11778,8 @@ const getGenericImportMetaMechanism = (getUrl) => (property, { chunkId }) => {
|
|
|
11799
11778
|
? urlMechanism
|
|
11800
11779
|
: 'undefined';
|
|
11801
11780
|
};
|
|
11781
|
+
const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
|
11782
|
+
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
|
|
11802
11783
|
const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${escapeId(chunkId)}', document.baseURI).href)`;
|
|
11803
11784
|
const relativeUrlMechanisms = {
|
|
11804
11785
|
amd: relativePath => {
|
|
@@ -11806,18 +11787,18 @@ const relativeUrlMechanisms = {
|
|
|
11806
11787
|
relativePath = './' + relativePath;
|
|
11807
11788
|
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
|
11808
11789
|
},
|
|
11809
|
-
cjs: relativePath => `(typeof document === 'undefined' ? ${
|
|
11790
|
+
cjs: relativePath => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
11810
11791
|
es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
11811
11792
|
iife: relativePath => getRelativeUrlFromDocument(relativePath),
|
|
11812
11793
|
system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
11813
|
-
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11794
|
+
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
11814
11795
|
};
|
|
11815
11796
|
const importMetaMechanisms = {
|
|
11816
11797
|
amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
|
|
11817
|
-
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${
|
|
11798
|
+
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId)})`),
|
|
11818
11799
|
iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
|
|
11819
11800
|
system: (property, { snippets: { getPropertyAccess } }) => property === null ? `module.meta` : `module.meta${getPropertyAccess(property)}`,
|
|
11820
|
-
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11801
|
+
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId, true)})`)
|
|
11821
11802
|
};
|
|
11822
11803
|
|
|
11823
11804
|
class NewExpression extends NodeBase {
|
|
@@ -11965,7 +11946,6 @@ class Program extends NodeBase {
|
|
|
11965
11946
|
hasEffects(context) {
|
|
11966
11947
|
for (const node of this.body) {
|
|
11967
11948
|
if (node.hasEffects(context)) {
|
|
11968
|
-
logEffect(node, this.context.module);
|
|
11969
11949
|
return (this.hasCachedEffect = true);
|
|
11970
11950
|
}
|
|
11971
11951
|
}
|
|
@@ -13531,7 +13511,6 @@ class Module {
|
|
|
13531
13511
|
this.dynamicImporters = [];
|
|
13532
13512
|
this.dynamicImports = [];
|
|
13533
13513
|
this.execIndex = Infinity;
|
|
13534
|
-
this.hasLoggedEffect = false;
|
|
13535
13514
|
this.implicitlyLoadedAfter = new Set();
|
|
13536
13515
|
this.implicitlyLoadedBefore = new Set();
|
|
13537
13516
|
this.importDescriptions = new Map();
|
|
@@ -17074,8 +17053,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
17074
17053
|
return sizeA - sizeB;
|
|
17075
17054
|
}
|
|
17076
17055
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
17077
|
-
console.log('---- Initial chunks');
|
|
17078
|
-
printConsistencyCheck(chunkPartition);
|
|
17079
17056
|
for (const allowArbitraryMerges of [false, true]) {
|
|
17080
17057
|
for (const mergedChunk of chunkPartition.small) {
|
|
17081
17058
|
let closestChunk = null;
|
|
@@ -17127,8 +17104,6 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
17127
17104
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
17128
17105
|
}
|
|
17129
17106
|
}
|
|
17130
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
17131
|
-
printConsistencyCheck(chunkPartition);
|
|
17132
17107
|
}
|
|
17133
17108
|
}
|
|
17134
17109
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -17184,57 +17159,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
17184
17159
|
}
|
|
17185
17160
|
return distance;
|
|
17186
17161
|
}
|
|
17187
|
-
function printConsistencyCheck(partition) {
|
|
17188
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
17189
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
17190
|
-
let missingDependencies = 0;
|
|
17191
|
-
let missingDependentChunks = 0;
|
|
17192
|
-
const seenModules = new Set();
|
|
17193
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
17194
|
-
for (const module of modules) {
|
|
17195
|
-
if (seenModules.has(module)) {
|
|
17196
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
17197
|
-
}
|
|
17198
|
-
seenModules.add(module);
|
|
17199
|
-
}
|
|
17200
|
-
for (const dependency of dependencies) {
|
|
17201
|
-
if (!chunks.has(dependency)) {
|
|
17202
|
-
missingDependencies++;
|
|
17203
|
-
}
|
|
17204
|
-
}
|
|
17205
|
-
for (const dependency of dependentChunks) {
|
|
17206
|
-
if (!chunks.has(dependency)) {
|
|
17207
|
-
missingDependentChunks++;
|
|
17208
|
-
}
|
|
17209
|
-
}
|
|
17210
|
-
}
|
|
17211
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
|
|
17212
|
-
}
|
|
17213
|
-
function getNumberOfCycles(chunks) {
|
|
17214
|
-
const parents = new Set();
|
|
17215
|
-
const analysedChunks = new Set();
|
|
17216
|
-
let cycles = 0;
|
|
17217
|
-
const analyseChunk = (chunk) => {
|
|
17218
|
-
for (const dependency of chunk.dependencies) {
|
|
17219
|
-
if (parents.has(dependency)) {
|
|
17220
|
-
if (!analysedChunks.has(dependency)) {
|
|
17221
|
-
cycles++;
|
|
17222
|
-
}
|
|
17223
|
-
continue;
|
|
17224
|
-
}
|
|
17225
|
-
parents.add(dependency);
|
|
17226
|
-
analyseChunk(dependency);
|
|
17227
|
-
}
|
|
17228
|
-
analysedChunks.add(chunk);
|
|
17229
|
-
};
|
|
17230
|
-
for (const chunk of chunks) {
|
|
17231
|
-
if (!parents.has(chunk)) {
|
|
17232
|
-
parents.add(chunk);
|
|
17233
|
-
analyseChunk(chunk);
|
|
17234
|
-
}
|
|
17235
|
-
}
|
|
17236
|
-
return cycles;
|
|
17237
|
-
}
|
|
17238
17162
|
|
|
17239
17163
|
// ported from https://github.com/substack/node-commondir
|
|
17240
17164
|
function commondir(files) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED