Projekt

Obecné

Profil

Stáhnout (1.93 KB) Statistiky
| Větev: | Revize:
1
/** @typedef {import("./Chunk")} Chunk */
2
/** @typedef {import("./ChunkGroup")} ChunkGroup */
3
/** @typedef {import("./Module")} Module */
4
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
5
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
6

    
7
/**
8
 * @param {ChunkGroup} chunkGroup the ChunkGroup to connect
9
 * @param {Chunk} chunk chunk to tie to ChunkGroup
10
 * @returns {void}
11
 */
12
const connectChunkGroupAndChunk = (chunkGroup, chunk) => {
13
	if (chunkGroup.pushChunk(chunk)) {
14
		chunk.addGroup(chunkGroup);
15
	}
16
};
17

    
18
/**
19
 * @param {ChunkGroup} parent parent ChunkGroup to connect
20
 * @param {ChunkGroup} child child ChunkGroup to connect
21
 * @returns {void}
22
 */
23
const connectChunkGroupParentAndChild = (parent, child) => {
24
	if (parent.addChild(child)) {
25
		child.addParent(parent);
26
	}
27
};
28

    
29
/**
30
 * @param {Chunk} chunk Chunk to connect to Module
31
 * @param {Module} module Module to connect to Chunk
32
 * @returns {void}
33
 */
34
const connectChunkAndModule = (chunk, module) => {
35
	if (module.addChunk(chunk)) {
36
		chunk.addModule(module);
37
	}
38
};
39

    
40
/**
41
 * @param {Chunk} chunk Chunk being disconnected
42
 * @param {Module} module Module being disconnected
43
 * @returns {void}
44
 */
45
const disconnectChunkAndModule = (chunk, module) => {
46
	chunk.removeModule(module);
47
	module.removeChunk(chunk);
48
};
49

    
50
/**
51
 * @param {AsyncDependenciesBlock} depBlock DepBlock being tied to ChunkGroup
52
 * @param {ChunkGroup} chunkGroup ChunkGroup being tied to DepBlock
53
 * @returns {void}
54
 */
55
const connectDependenciesBlockAndChunkGroup = (depBlock, chunkGroup) => {
56
	if (chunkGroup.addBlock(depBlock)) {
57
		depBlock.chunkGroup = chunkGroup;
58
	}
59
};
60

    
61
exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk;
62
exports.connectChunkGroupParentAndChild = connectChunkGroupParentAndChild;
63
exports.connectChunkAndModule = connectChunkAndModule;
64
exports.disconnectChunkAndModule = disconnectChunkAndModule;
65
exports.connectDependenciesBlockAndChunkGroup = connectDependenciesBlockAndChunkGroup;
(60-60/145)