Skip to content

Commit 0206949

Browse files
committed
remove unused code
1 parent 826becb commit 0206949

File tree

7 files changed

+4
-76
lines changed

7 files changed

+4
-76
lines changed

lib/Chunk.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -403,24 +403,6 @@ class Chunk {
403403
return false;
404404
}
405405

406-
hasChunkInGraph(filterFn) {
407-
const queue = new Set(this.groupsIterable);
408-
const chunksProcessed = new Set();
409-
410-
for(const chunkGroup of queue) {
411-
for(const chunk of chunkGroup.chunks) {
412-
if(!chunksProcessed.has(chunk)) {
413-
chunksProcessed.add(chunk);
414-
if(filterFn(chunk))
415-
return true;
416-
}
417-
}
418-
for(const child of chunkGroup.childrenIterable)
419-
queue.add(child);
420-
}
421-
return false;
422-
}
423-
424406
toString() {
425407
return `Chunk[${Array.from(this._modules).join()}]`;
426408
}

lib/ChunkGroup.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ChunkGroup {
3636
this.origins = [];
3737
}
3838

39+
/* istanbul ignore next */
3940
get debugId() {
4041
return Array.from(this.chunks, x => x.debugId).join("+");
4142
}
@@ -112,13 +113,6 @@ class ChunkGroup {
112113
return false;
113114
}
114115

115-
hasEntryModule() {
116-
for(const chunk of this.chunks)
117-
if(chunk.hasEntryModule())
118-
return true;
119-
return false;
120-
}
121-
122116
addChild(chunk) {
123117
if(this._children.has(chunk)) {
124118
return false;
@@ -167,11 +161,6 @@ class ChunkGroup {
167161
this._parents.add(p);
168162
}
169163

170-
// TODO remove and replace calls with Array.from
171-
mapParents(fn) {
172-
return Array.from(this._parents, fn);
173-
}
174-
175164
getNumberOfParents() {
176165
return this._parents.size;
177166
}
@@ -199,17 +188,6 @@ class ChunkGroup {
199188
return this._blocks.getFromCache(getArray);
200189
}
201190

202-
setBlocks(newBlocks) {
203-
this._blocks.clear();
204-
for(const p of newBlocks)
205-
this._blocks.add(p);
206-
}
207-
208-
// TODO remove and replace calls with Array.from
209-
mapBlocks(fn) {
210-
return Array.from(this._blocks, fn);
211-
}
212-
213191
getNumberOfBlocks() {
214192
return this._blocks.size;
215193
}
@@ -289,10 +267,6 @@ class ChunkGroup {
289267

290268
sortItems() {
291269
this.origins.sort(sortOrigin);
292-
this.origins.forEach(origin => {
293-
if(origin.reasons)
294-
origin.reasons.sort();
295-
});
296270
this._parents.sort();
297271
this._children.sort();
298272
}

lib/ChunkTemplate.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ module.exports = class ChunkTemplate extends Tapable {
3131

3232
const result = [];
3333

34-
let filenameTemplate;
35-
if(chunk.filenameTemplate)
36-
filenameTemplate = chunk.filenameTemplate;
37-
else
38-
filenameTemplate = outputOptions.chunkFilename;
34+
const filenameTemplate = outputOptions.chunkFilename;
3935

4036
result.push({
4137
render: () => this.renderJavascript(chunk, moduleTemplates.javascript, dependencyTemplates),

lib/GraphHelpers.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,27 @@
1-
// TODO remove this function
2-
function assert(value, typeName, name) {
3-
const Type = require(`./${typeName}`);
4-
if(value instanceof Type) return;
5-
throw new Error(`${name} is not a ${Type.name}`);
6-
}
7-
81
exports.connectChunkGroupAndChunk = (chunkGroup, chunk) => {
9-
assert(chunkGroup, "ChunkGroup", "chunkGroup");
10-
assert(chunk, "Chunk", "chunk");
112
if(chunkGroup.pushChunk(chunk)) {
123
chunk.addGroup(chunkGroup);
134
}
145
};
156

167
exports.connectChunkGroupParentAndChild = (parent, child) => {
17-
assert(parent, "ChunkGroup", "parent");
18-
assert(child, "ChunkGroup", "child");
198
if(parent.addChild(child)) {
209
child.addParent(parent);
2110
}
2211
};
2312

2413
exports.connectChunkAndModule = (chunk, module) => {
25-
assert(chunk, "Chunk", "chunk");
26-
assert(module, "Module", "module");
2714
if(module.addChunk(chunk)) {
2815
chunk.addModule(module);
2916
}
3017
};
3118

3219
exports.disconnectChunkAndModule = (chunk, module) => {
33-
assert(chunk, "Chunk", "chunk");
34-
assert(module, "Module", "module");
3520
chunk.removeModule(module);
3621
module.removeChunk(chunk);
3722
};
3823

3924
exports.connectDependenciesBlockAndChunkGroup = (depBlock, chunkGroup) => {
40-
assert(depBlock, "DependenciesBlock", "depBlock");
41-
assert(chunkGroup, "ChunkGroup", "chunkGroup");
4225
if(chunkGroup.addBlock(depBlock)) {
4326
depBlock.chunkGroup = chunkGroup;
4427
}

lib/MainTemplate.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,6 @@ module.exports = class MainTemplate extends Tapable {
274274
return this.hooks.currentHash.call(JSON.stringify(hash.substr(0, length)), length);
275275
}
276276

277-
// TODO remove and call hasChunkInGraph directly
278-
entryPointInChildren(chunk) {
279-
return chunk.hasChunkInGraph(chunk => chunk.hasEntryModule());
280-
}
281-
282277
getPublicPath(options) {
283278
return this.hooks.assetPath.call(this.outputOptions.publicPath || "", options);
284279
}

lib/Module.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const sortByDebugId = (a, b) => {
2525

2626
const getFrozenArray = set => Object.freeze(Array.from(set));
2727

28+
/* istanbul ignore next */
2829
const getDebugIdent = set => {
2930
set.sortWith(sortByDebugId);
3031
const chunks = set;
@@ -153,10 +154,6 @@ class Module extends DependenciesBlock {
153154
return this._chunks.has(chunk);
154155
}
155156

156-
getChunkIdsIdent() {
157-
return this._chunks.getFromUnorderedCache(getDebugIdent);
158-
}
159-
160157
isEntryModule() {
161158
for(const chunk of this._chunks) {
162159
if(chunk.entryModule === this)

lib/util/createHash.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class BulkUpdateDecorator {
3838
}
3939
}
4040

41+
/* istanbul ignore next */
4142
class DebugHash {
4243
constructor() {
4344
this.string = "";

0 commit comments

Comments
 (0)