-
-
Notifications
You must be signed in to change notification settings - Fork 591
/
CompilerOutput.js
32 lines (28 loc) · 916 Bytes
/
CompilerOutput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class CompilerOutput {
generateRawOutput(stats, options) {
process.stdout.write(stats.toString(options.stats));
}
generateJsonOutput() {}
/**
* Given an array of entry points from webpack compiler,
* it builds a string with a simple information
*
* @param {object[]} chunks Chunks emitted by compilation
* @private
* @returns {string} An array of strings with information of the entry points
*/
_createChunksOutput(chunks) {
return chunks
.map((chunk) => {
const moduleString = chunk.modules
.map((module) => {
return `${module.name} [size: ${module.size} bytes]`;
})
.join('\n');
return moduleString;
})
.slice(0, 15)
.join('\n');
}
}
module.exports = { CompilerOutput };