rollup 3.17.3-1 → 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 +13 -84
- 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 +13 -84
- 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,9 +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
5852
|
|
|
5858
5853
|
class SpreadElement extends NodeBase {
|
|
5859
5854
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -11286,6 +11281,8 @@ const getGenericImportMetaMechanism = (getUrl) => (property, { chunkId }) => {
|
|
|
11286
11281
|
? urlMechanism
|
|
11287
11282
|
: 'undefined';
|
|
11288
11283
|
};
|
|
11284
|
+
const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
|
11285
|
+
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
|
|
11289
11286
|
const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${escapeId(chunkId)}', document.baseURI).href)`;
|
|
11290
11287
|
const relativeUrlMechanisms = {
|
|
11291
11288
|
amd: relativePath => {
|
|
@@ -11293,18 +11290,18 @@ const relativeUrlMechanisms = {
|
|
|
11293
11290
|
relativePath = './' + relativePath;
|
|
11294
11291
|
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
|
11295
11292
|
},
|
|
11296
|
-
cjs: relativePath => `(typeof document === 'undefined' ? ${
|
|
11293
|
+
cjs: relativePath => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
11297
11294
|
es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
11298
11295
|
iife: relativePath => getRelativeUrlFromDocument(relativePath),
|
|
11299
11296
|
system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
11300
|
-
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11297
|
+
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
11301
11298
|
};
|
|
11302
11299
|
const importMetaMechanisms = {
|
|
11303
11300
|
amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
|
|
11304
|
-
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${
|
|
11301
|
+
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId)})`),
|
|
11305
11302
|
iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
|
|
11306
11303
|
system: (property, { snippets: { getPropertyAccess } }) => property === null ? `module.meta` : `module.meta${getPropertyAccess(property)}`,
|
|
11307
|
-
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11304
|
+
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId, true)})`)
|
|
11308
11305
|
};
|
|
11309
11306
|
|
|
11310
11307
|
class NewExpression extends NodeBase {
|
|
@@ -11443,7 +11440,6 @@ class Program extends NodeBase {
|
|
|
11443
11440
|
constructor() {
|
|
11444
11441
|
super(...arguments);
|
|
11445
11442
|
this.hasCachedEffect = null;
|
|
11446
|
-
this.hasLoggedEffect = false;
|
|
11447
11443
|
}
|
|
11448
11444
|
hasCachedEffects() {
|
|
11449
11445
|
return this.hasCachedEffect === null
|
|
@@ -11453,18 +11449,6 @@ class Program extends NodeBase {
|
|
|
11453
11449
|
hasEffects(context) {
|
|
11454
11450
|
for (const node of this.body) {
|
|
11455
11451
|
if (node.hasEffects(context)) {
|
|
11456
|
-
if (!this.hasLoggedEffect) {
|
|
11457
|
-
this.hasLoggedEffect = true;
|
|
11458
|
-
let effect = logNode(node);
|
|
11459
|
-
let truncated = false;
|
|
11460
|
-
if (effect.length > 150) {
|
|
11461
|
-
truncated = true;
|
|
11462
|
-
effect = effect.slice(0, 150) + '...';
|
|
11463
|
-
}
|
|
11464
|
-
console.log(`==> First side effect in ${relativeId(this.context.module.id)}${truncated ? ' (truncated)' : ''}:`);
|
|
11465
|
-
console.log(effect);
|
|
11466
|
-
console.log('<==\n');
|
|
11467
|
-
}
|
|
11468
11452
|
return (this.hasCachedEffect = true);
|
|
11469
11453
|
}
|
|
11470
11454
|
}
|
|
@@ -16572,8 +16556,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
16572
16556
|
return sizeA - sizeB;
|
|
16573
16557
|
}
|
|
16574
16558
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
16575
|
-
console.log('---- Initial chunks');
|
|
16576
|
-
printConsistencyCheck(chunkPartition);
|
|
16577
16559
|
for (const allowArbitraryMerges of [false, true]) {
|
|
16578
16560
|
for (const mergedChunk of chunkPartition.small) {
|
|
16579
16561
|
let closestChunk = null;
|
|
@@ -16625,8 +16607,6 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
16625
16607
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16626
16608
|
}
|
|
16627
16609
|
}
|
|
16628
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
16629
|
-
printConsistencyCheck(chunkPartition);
|
|
16630
16610
|
}
|
|
16631
16611
|
}
|
|
16632
16612
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -16682,57 +16662,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
16682
16662
|
}
|
|
16683
16663
|
return distance;
|
|
16684
16664
|
}
|
|
16685
|
-
function printConsistencyCheck(partition) {
|
|
16686
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
16687
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
16688
|
-
let missingDependencies = 0;
|
|
16689
|
-
let missingDependentChunks = 0;
|
|
16690
|
-
const seenModules = new Set();
|
|
16691
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
16692
|
-
for (const module of modules) {
|
|
16693
|
-
if (seenModules.has(module)) {
|
|
16694
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
16695
|
-
}
|
|
16696
|
-
seenModules.add(module);
|
|
16697
|
-
}
|
|
16698
|
-
for (const dependency of dependencies) {
|
|
16699
|
-
if (!chunks.has(dependency)) {
|
|
16700
|
-
missingDependencies++;
|
|
16701
|
-
}
|
|
16702
|
-
}
|
|
16703
|
-
for (const dependency of dependentChunks) {
|
|
16704
|
-
if (!chunks.has(dependency)) {
|
|
16705
|
-
missingDependentChunks++;
|
|
16706
|
-
}
|
|
16707
|
-
}
|
|
16708
|
-
}
|
|
16709
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
|
|
16710
|
-
}
|
|
16711
|
-
function getNumberOfCycles(chunks) {
|
|
16712
|
-
const parents = new Set();
|
|
16713
|
-
const analysedChunks = new Set();
|
|
16714
|
-
let cycles = 0;
|
|
16715
|
-
const analyseChunk = (chunk) => {
|
|
16716
|
-
for (const dependency of chunk.dependencies) {
|
|
16717
|
-
if (parents.has(dependency)) {
|
|
16718
|
-
if (!analysedChunks.has(dependency)) {
|
|
16719
|
-
cycles++;
|
|
16720
|
-
}
|
|
16721
|
-
continue;
|
|
16722
|
-
}
|
|
16723
|
-
parents.add(dependency);
|
|
16724
|
-
analyseChunk(dependency);
|
|
16725
|
-
}
|
|
16726
|
-
analysedChunks.add(chunk);
|
|
16727
|
-
};
|
|
16728
|
-
for (const chunk of chunks) {
|
|
16729
|
-
if (!parents.has(chunk)) {
|
|
16730
|
-
parents.add(chunk);
|
|
16731
|
-
analyseChunk(chunk);
|
|
16732
|
-
}
|
|
16733
|
-
}
|
|
16734
|
-
return cycles;
|
|
16735
|
-
}
|
|
16736
16665
|
|
|
16737
16666
|
// ported from https://github.com/substack/node-commondir
|
|
16738
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,9 +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
6349
|
|
|
6355
6350
|
class SpreadElement extends NodeBase {
|
|
6356
6351
|
deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -11783,6 +11778,8 @@ const getGenericImportMetaMechanism = (getUrl) => (property, { chunkId }) => {
|
|
|
11783
11778
|
? urlMechanism
|
|
11784
11779
|
: 'undefined';
|
|
11785
11780
|
};
|
|
11781
|
+
const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
|
11782
|
+
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
|
|
11786
11783
|
const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${escapeId(chunkId)}', document.baseURI).href)`;
|
|
11787
11784
|
const relativeUrlMechanisms = {
|
|
11788
11785
|
amd: relativePath => {
|
|
@@ -11790,18 +11787,18 @@ const relativeUrlMechanisms = {
|
|
|
11790
11787
|
relativePath = './' + relativePath;
|
|
11791
11788
|
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
|
11792
11789
|
},
|
|
11793
|
-
cjs: relativePath => `(typeof document === 'undefined' ? ${
|
|
11790
|
+
cjs: relativePath => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
11794
11791
|
es: relativePath => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
11795
11792
|
iife: relativePath => getRelativeUrlFromDocument(relativePath),
|
|
11796
11793
|
system: relativePath => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
11797
|
-
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11794
|
+
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
11798
11795
|
};
|
|
11799
11796
|
const importMetaMechanisms = {
|
|
11800
11797
|
amd: getGenericImportMetaMechanism(() => getResolveUrl(`module.uri, document.baseURI`)),
|
|
11801
|
-
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${
|
|
11798
|
+
cjs: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId)})`),
|
|
11802
11799
|
iife: getGenericImportMetaMechanism(chunkId => getUrlFromDocument(chunkId)),
|
|
11803
11800
|
system: (property, { snippets: { getPropertyAccess } }) => property === null ? `module.meta` : `module.meta${getPropertyAccess(property)}`,
|
|
11804
|
-
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${
|
|
11801
|
+
umd: getGenericImportMetaMechanism(chunkId => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromFullPath('__filename')} : ${getUrlFromDocument(chunkId, true)})`)
|
|
11805
11802
|
};
|
|
11806
11803
|
|
|
11807
11804
|
class NewExpression extends NodeBase {
|
|
@@ -11940,7 +11937,6 @@ class Program extends NodeBase {
|
|
|
11940
11937
|
constructor() {
|
|
11941
11938
|
super(...arguments);
|
|
11942
11939
|
this.hasCachedEffect = null;
|
|
11943
|
-
this.hasLoggedEffect = false;
|
|
11944
11940
|
}
|
|
11945
11941
|
hasCachedEffects() {
|
|
11946
11942
|
return this.hasCachedEffect === null
|
|
@@ -11950,18 +11946,6 @@ class Program extends NodeBase {
|
|
|
11950
11946
|
hasEffects(context) {
|
|
11951
11947
|
for (const node of this.body) {
|
|
11952
11948
|
if (node.hasEffects(context)) {
|
|
11953
|
-
if (!this.hasLoggedEffect) {
|
|
11954
|
-
this.hasLoggedEffect = true;
|
|
11955
|
-
let effect = logNode(node);
|
|
11956
|
-
let truncated = false;
|
|
11957
|
-
if (effect.length > 150) {
|
|
11958
|
-
truncated = true;
|
|
11959
|
-
effect = effect.slice(0, 150) + '...';
|
|
11960
|
-
}
|
|
11961
|
-
console.log(`==> First side effect in ${relativeId(this.context.module.id)}${truncated ? ' (truncated)' : ''}:`);
|
|
11962
|
-
console.log(effect);
|
|
11963
|
-
console.log('<==\n');
|
|
11964
|
-
}
|
|
11965
11949
|
return (this.hasCachedEffect = true);
|
|
11966
11950
|
}
|
|
11967
11951
|
}
|
|
@@ -17069,8 +17053,6 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
|
17069
17053
|
return sizeA - sizeB;
|
|
17070
17054
|
}
|
|
17071
17055
|
function mergeChunks(chunkPartition, minChunkSize) {
|
|
17072
|
-
console.log('---- Initial chunks');
|
|
17073
|
-
printConsistencyCheck(chunkPartition);
|
|
17074
17056
|
for (const allowArbitraryMerges of [false, true]) {
|
|
17075
17057
|
for (const mergedChunk of chunkPartition.small) {
|
|
17076
17058
|
let closestChunk = null;
|
|
@@ -17122,8 +17104,6 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
17122
17104
|
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
17123
17105
|
}
|
|
17124
17106
|
}
|
|
17125
|
-
console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
|
|
17126
|
-
printConsistencyCheck(chunkPartition);
|
|
17127
17107
|
}
|
|
17128
17108
|
}
|
|
17129
17109
|
// Merging will not produce cycles if none of the direct non-merged dependencies
|
|
@@ -17179,57 +17159,6 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
|
|
|
17179
17159
|
}
|
|
17180
17160
|
return distance;
|
|
17181
17161
|
}
|
|
17182
|
-
function printConsistencyCheck(partition) {
|
|
17183
|
-
const chunks = new Set([...partition.big, ...partition.small]);
|
|
17184
|
-
console.log('Number of cycles:', getNumberOfCycles(chunks));
|
|
17185
|
-
let missingDependencies = 0;
|
|
17186
|
-
let missingDependentChunks = 0;
|
|
17187
|
-
const seenModules = new Set();
|
|
17188
|
-
for (const { modules, dependencies, dependentChunks } of chunks) {
|
|
17189
|
-
for (const module of modules) {
|
|
17190
|
-
if (seenModules.has(module)) {
|
|
17191
|
-
console.log(`Module ${module.id} is duplicated between chunks.`);
|
|
17192
|
-
}
|
|
17193
|
-
seenModules.add(module);
|
|
17194
|
-
}
|
|
17195
|
-
for (const dependency of dependencies) {
|
|
17196
|
-
if (!chunks.has(dependency)) {
|
|
17197
|
-
missingDependencies++;
|
|
17198
|
-
}
|
|
17199
|
-
}
|
|
17200
|
-
for (const dependency of dependentChunks) {
|
|
17201
|
-
if (!chunks.has(dependency)) {
|
|
17202
|
-
missingDependentChunks++;
|
|
17203
|
-
}
|
|
17204
|
-
}
|
|
17205
|
-
}
|
|
17206
|
-
console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
|
|
17207
|
-
}
|
|
17208
|
-
function getNumberOfCycles(chunks) {
|
|
17209
|
-
const parents = new Set();
|
|
17210
|
-
const analysedChunks = new Set();
|
|
17211
|
-
let cycles = 0;
|
|
17212
|
-
const analyseChunk = (chunk) => {
|
|
17213
|
-
for (const dependency of chunk.dependencies) {
|
|
17214
|
-
if (parents.has(dependency)) {
|
|
17215
|
-
if (!analysedChunks.has(dependency)) {
|
|
17216
|
-
cycles++;
|
|
17217
|
-
}
|
|
17218
|
-
continue;
|
|
17219
|
-
}
|
|
17220
|
-
parents.add(dependency);
|
|
17221
|
-
analyseChunk(dependency);
|
|
17222
|
-
}
|
|
17223
|
-
analysedChunks.add(chunk);
|
|
17224
|
-
};
|
|
17225
|
-
for (const chunk of chunks) {
|
|
17226
|
-
if (!parents.has(chunk)) {
|
|
17227
|
-
parents.add(chunk);
|
|
17228
|
-
analyseChunk(chunk);
|
|
17229
|
-
}
|
|
17230
|
-
}
|
|
17231
|
-
return cycles;
|
|
17232
|
-
}
|
|
17233
17162
|
|
|
17234
17163
|
// ported from https://github.com/substack/node-commondir
|
|
17235
17164
|
function commondir(files) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED