@tmbr/bundler 1.8.1 → 1.9.0
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/cli.js +8 -12
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
const esbuild = require('esbuild');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const exec = require('child_process').execSync;
|
|
6
5
|
const chalk = require('chalk');
|
|
7
6
|
const server = require('browser-sync').create();
|
|
8
7
|
const styles = require('esbuild-sass-plugin').sassPlugin;
|
|
@@ -22,8 +21,8 @@ const logger = (options = {}) => ({
|
|
|
22
21
|
name: 'logger',
|
|
23
22
|
setup(context) {
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const path = context.initialOptions.outdir;
|
|
25
|
+
const slug = Object.keys(context.initialOptions.entryPoints)[0];
|
|
27
26
|
|
|
28
27
|
context.onStart(() => {
|
|
29
28
|
server.instance.active && server.info();
|
|
@@ -31,15 +30,12 @@ const logger = (options = {}) => ({
|
|
|
31
30
|
|
|
32
31
|
context.onEnd(result => {
|
|
33
32
|
if (result.warnings.length || result.errors.length) return console.log('\007');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// console.log(`build ended with ${result.errors.length} errors`);
|
|
41
|
-
// build/main.min.css 47KB
|
|
42
|
-
// build/main.min.js 170KB
|
|
33
|
+
|
|
34
|
+
const css = `${path}/${slug}.css`;
|
|
35
|
+
console.log(`${css} ${Math.round(fs.statSync(css).size / 1000)} KB`);
|
|
36
|
+
|
|
37
|
+
const js = `${path}/${slug}.js`;
|
|
38
|
+
console.log(`${js} ${Math.round(fs.statSync(js).size / 1000)} KB`);
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
41
|
});
|