rollup-plugin-filesize
Advanced tools
Comparing version 1.0.1 to 1.2.0
@@ -7,8 +7,11 @@ 'use strict'; | ||
var boxen = _interopDefault(require('boxen')); | ||
var chalk = _interopDefault(require('chalk')); | ||
var colors = _interopDefault(require('colors')); | ||
var deepAssign = _interopDefault(require('deep-assign')); | ||
var gzip = _interopDefault(require('gzip-size')); | ||
function render(opt, size, gzip$$1) { | ||
return opt.theme == 'dark' ? boxen(chalk.green.bold('Bundle size: ') + chalk.yellow.bold(size) + ', ' + chalk.green.bold('Gzipped size: ') + chalk.yellow.bold(gzip$$1), { padding: 1 }) : boxen(chalk.black.bold('Bundle size: ') + chalk.blue.bold(size) + ', ' + chalk.black.bold('Gzipped size: ') + chalk.blue.bold(gzip$$1), { padding: 1 }); | ||
function render(opt, size, gzip$$1, bundle) { | ||
var primaryColor = opt.theme === 'dark' ? 'green' : 'black'; | ||
var secondaryColor = opt.theme === 'dark' ? 'yellow' : 'blue'; | ||
return boxen(colors[primaryColor].bold('Destination: ') + colors[secondaryColor](bundle.dest) + '\n' + colors[primaryColor].bold('Bundle size: ') + colors[secondaryColor](size) + ', ' + colors[primaryColor].bold('Gzipped size: ') + colors[secondaryColor](gzip$$1), { padding: 1 }); | ||
} | ||
@@ -32,6 +35,6 @@ | ||
return { | ||
getData: function getData(code) { | ||
getData: function getData(bundle, code) { | ||
var size = fileSize(Buffer.byteLength(code), opts.format); | ||
var gzipSize = fileSize(gzip.sync(code), opts.format); | ||
return opts.render(opts, size, gzipSize); | ||
return opts.render(opts, size, gzipSize, bundle); | ||
}, | ||
@@ -41,3 +44,3 @@ ongenerate: function ongenerate(bundle, _ref) { | ||
console.log(this.getData(code)); | ||
console.log(this.getData(bundle, code)); | ||
} | ||
@@ -44,0 +47,0 @@ }; |
{ | ||
"name": "rollup-plugin-filesize", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "A rollup plugin to show filesize in the cli", | ||
@@ -33,5 +33,5 @@ "main": "dist/index.js", | ||
"boxen": "^0.2.0", | ||
"chalk": "^1.1.1", | ||
"colors": "^1.1.2", | ||
"deep-assign": "^2.0.0", | ||
"filesize": "^3.2.0", | ||
"filesize": "^3.5.6", | ||
"gzip-size": "^3.0.0" | ||
@@ -38,0 +38,0 @@ }, |
import fileSize from 'filesize'; | ||
import boxen from 'boxen'; | ||
import chalk from 'chalk'; | ||
import colors from 'colors'; | ||
import deepAssign from 'deep-assign'; | ||
import gzip from 'gzip-size'; | ||
function render (opt, size, gzip) { | ||
return opt.theme == 'dark' ? ( | ||
boxen(chalk.green.bold('Bundle size: ') + chalk.yellow.bold(size) + ', ' + | ||
chalk.green.bold('Gzipped size: ') + chalk.yellow.bold(gzip), { padding: 1 }) | ||
) : ( | ||
boxen(chalk.black.bold('Bundle size: ') + chalk.blue.bold(size) + ', ' + | ||
chalk.black.bold('Gzipped size: ') + chalk.blue.bold(gzip), { padding: 1 }) | ||
); | ||
function render (opt, size, gzip, bundle) { | ||
const primaryColor = opt.theme === 'dark' ? 'green' : 'black' | ||
const secondaryColor = opt.theme === 'dark' ? 'yellow' : 'blue' | ||
return boxen( | ||
colors[primaryColor].bold('Destination: ') + colors[secondaryColor](bundle.dest) + '\n' + | ||
colors[primaryColor].bold('Bundle size: ') + colors[secondaryColor](size) + ', ' + | ||
colors[primaryColor].bold('Gzipped size: ') + colors[secondaryColor](gzip), { padding: 1 } | ||
) | ||
} | ||
@@ -31,12 +32,12 @@ | ||
return { | ||
getData (code) { | ||
getData (bundle, code) { | ||
let size = fileSize(Buffer.byteLength(code), opts.format); | ||
let gzipSize = fileSize(gzip.sync(code), opts.format); | ||
return opts.render(opts, size, gzipSize); | ||
return opts.render(opts, size, gzipSize, bundle); | ||
}, | ||
ongenerate(bundle, { code }){ | ||
console.log(this.getData(code)); | ||
console.log(this.getData(bundle, code)); | ||
} | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4671
71
+ Addedcolors@^1.1.2
+ Addedcolors@1.4.0(transitive)
- Removedchalk@^1.1.1
Updatedfilesize@^3.5.6