Skip to content

Commit 64aa63d

Browse files
committed
increase coverage with test case
remove unused code
1 parent 086a4c1 commit 64aa63d

5 files changed

Lines changed: 94 additions & 43 deletions

File tree

lib/Entrypoint.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ class Entrypoint {
1010
this.chunks = [];
1111
}
1212

13-
removeChunk(chunk) {
14-
var idx = this.chunks.indexOf(chunk);
15-
if(idx >= 0) this.chunks.splice(idx, 1);
16-
idx = chunk.entrypoints.indexOf(this);
17-
if(idx >= 0) chunk.entrypoints.splice(idx, 1);
18-
}
19-
2013
unshiftChunk(chunk) {
2114
this.chunks.unshift(chunk);
2215
chunk.entrypoints.push(this);
@@ -37,14 +30,6 @@ class Entrypoint {
3730
}
3831
}
3932

40-
appendChunk(chunk) {
41-
const idx = this.chunks.indexOf(chunk);
42-
if(idx < 0) {
43-
this.chunks.push(chunk);
44-
chunk.entrypoints.push(this);
45-
}
46-
}
47-
4833
getFiles() {
4934
const files = [];
5035

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,51 @@
1-
Hash: c55fcf171c46cbd1e5a1
2-
Time: Xms
3-
Asset Size Chunks Chunk Names
4-
9748a8a04a5102209105.js 2.29 kB 1 [emitted]
5-
79e8b67b4f31cdb0299f.js 1.99 kB 2 [emitted]
6-
628e75ea29b4a779b369.js 1.03 kB 3 [emitted]
7-
dd43a4ed55c20668ec9b.js 5.72 kB 444 [emitted]
8-
Entrypoint main = dd43a4ed55c20668ec9b.js 79e8b67b4f31cdb0299f.js 628e75ea29b4a779b369.js 9748a8a04a5102209105.js
9-
chunk {1} 9748a8a04a5102209105.js 1.91 kB [initial] [rendered]
10-
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
11-
[4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {1} [built]
12-
[6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {1} [built]
13-
[7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {1} [built]
14-
chunk {2} 79e8b67b4f31cdb0299f.js 1.8 kB [initial] [rendered] [recorded]
15-
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
16-
[2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {2} [built]
17-
[5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {2} [built]
18-
chunk {3} 628e75ea29b4a779b369.js 899 bytes [initial] [rendered]
19-
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
20-
[3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {3} [built]
21-
chunk {444} dd43a4ed55c20668ec9b.js 1.8 kB [entry] [rendered]
22-
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
23-
[0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {444} [built]
24-
[1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {444} [built]
1+
Hash: c55fcf171c46cbd1e5a1939ef65085fe14a681ab
2+
Child fitting:
3+
Hash: c55fcf171c46cbd1e5a1
4+
Time: Xms
5+
Asset Size Chunks Chunk Names
6+
9748a8a04a5102209105.js 2.29 kB 1 [emitted]
7+
79e8b67b4f31cdb0299f.js 1.99 kB 2 [emitted]
8+
628e75ea29b4a779b369.js 1.03 kB 3 [emitted]
9+
dd43a4ed55c20668ec9b.js 5.72 kB 444 [emitted]
10+
Entrypoint main = dd43a4ed55c20668ec9b.js 79e8b67b4f31cdb0299f.js 628e75ea29b4a779b369.js 9748a8a04a5102209105.js
11+
chunk {1} 9748a8a04a5102209105.js 1.91 kB [initial] [rendered]
12+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
13+
[4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {1} [built]
14+
[6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {1} [built]
15+
[7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {1} [built]
16+
chunk {2} 79e8b67b4f31cdb0299f.js 1.8 kB [initial] [rendered] [recorded]
17+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
18+
[2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {2} [built]
19+
[5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {2} [built]
20+
chunk {3} 628e75ea29b4a779b369.js 899 bytes [initial] [rendered]
21+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
22+
[3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {3} [built]
23+
chunk {444} dd43a4ed55c20668ec9b.js 1.8 kB [entry] [rendered]
24+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
25+
[0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {444} [built]
26+
[1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {444} [built]
27+
Child content-change:
28+
Hash: 939ef65085fe14a681ab
29+
Time: Xms
30+
Asset Size Chunks Chunk Names
31+
20c5ea99991f201dd831.js 2.29 kB 0 [emitted]
32+
f4d1e8f97994a643b1c9.js 1.98 kB 4 [emitted]
33+
8cd5c0e735c517a0371e.js 5.72 kB 5 [emitted]
34+
ec77f695b8be7fca93f2.js 1.03 kB 6 [emitted]
35+
Entrypoint main = 8cd5c0e735c517a0371e.js ec77f695b8be7fca93f2.js f4d1e8f97994a643b1c9.js 20c5ea99991f201dd831.js
36+
chunk {0} 20c5ea99991f201dd831.js 1.91 kB [initial] [rendered]
37+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
38+
[4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js 112 bytes {0} [built]
39+
[6] (webpack)/test/statsCases/aggressive-splitting-entry/f.js 899 bytes {0} [built]
40+
[7] (webpack)/test/statsCases/aggressive-splitting-entry/g.js 899 bytes {0} [built]
41+
chunk {4} f4d1e8f97994a643b1c9.js 1.8 kB [initial] [rendered] [recorded]
42+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
43+
[0] (webpack)/test/statsCases/aggressive-splitting-entry/b.js 899 bytes {4} [built]
44+
[1] (webpack)/test/statsCases/aggressive-splitting-entry/c.js 899 bytes {4} [built]
45+
chunk {5} 8cd5c0e735c517a0371e.js 1.8 kB [entry] [rendered] [recorded]
46+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
47+
[2] (webpack)/test/statsCases/aggressive-splitting-entry/d.js 899 bytes {5} [built]
48+
[5] (webpack)/test/statsCases/aggressive-splitting-entry/a.js 899 bytes {5} [built]
49+
chunk {6} ec77f695b8be7fca93f2.js 899 bytes [initial] [rendered]
50+
> aggressive-splitted main [4] (webpack)/test/statsCases/aggressive-splitting-entry/index.js
51+
[3] (webpack)/test/statsCases/aggressive-splitting-entry/e.js 899 bytes {6} [built]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"modules": {
3+
"byIdentifier": {
4+
"b.js": 0,
5+
"c.js": 1,
6+
"d.js": 2,
7+
"e.js": 3,
8+
"index.js": 4,
9+
"a.js": 5
10+
},
11+
"usedIds": {
12+
"0": 0,
13+
"1": 1,
14+
"2": 2,
15+
"3": 3,
16+
"4": 4,
17+
"5": 5
18+
}
19+
},
20+
"chunks": {
21+
"byName": {},
22+
"byBlocks": {},
23+
"usedIds": {
24+
"0": 0,
25+
"444": 444
26+
}
27+
},
28+
"aggressiveSplits": [
29+
{
30+
"modules": [
31+
"b.js",
32+
"c.js"
33+
],
34+
"hash": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
35+
"id": 444
36+
}
37+
]
38+
}

test/statsCases/aggressive-splitting-entry/input-records.json renamed to test/statsCases/aggressive-splitting-entry/input-records-fitting.json

File renamed without changes.

test/statsCases/aggressive-splitting-entry/webpack.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var webpack = require("../../../");
2-
module.exports = {
2+
module.exports = ["fitting", "content-change"].map(type => ({
3+
name: type,
34
entry: "./index",
45
output: {
56
filename: "[chunkhash].js",
@@ -13,8 +14,8 @@ module.exports = {
1314
maxSize: 2500
1415
})
1516
],
16-
recordsInputPath: __dirname + "/input-records.json",
17-
//recordsOutputPath: __dirname + "/records.json",
17+
recordsInputPath: __dirname + `/input-records-${type}.json`,
18+
//recordsOutputPath: __dirname + `/records-${type}.json`,
1819
stats: {
1920
chunks: true,
2021
chunkModules: true,
@@ -23,4 +24,4 @@ module.exports = {
2324
modules: false,
2425
publicPath: true
2526
}
26-
};
27+
}));

0 commit comments

Comments
 (0)