rollup-plugin-filesize
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -13,9 +13,9 @@ 'use strict'; | ||
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 filesize() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
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 }); | ||
} | ||
var defaultOptions = { | ||
@@ -33,16 +33,11 @@ format: {}, | ||
return { | ||
getData: function getData(code) { | ||
var size = fileSize(Buffer.byteLength(code), opts.format); | ||
var gzipSize = fileSize(gzip.sync(code), opts.format); | ||
return opts.render(opts, size, gzipSize); | ||
}, | ||
ongenerate: function ongenerate(bundle, _ref) { | ||
var code = _ref.code; | ||
var size = fileSize(Buffer.byteLength(code), opts.format); | ||
var gzipSize = fileSize(gzip.sync(code), opts.format); | ||
console.log(opts.render(opts, size, gzipSize)); | ||
return { | ||
log: opts.render(opts, size, gzipSize), | ||
code: code, | ||
map: { | ||
mappings: '' | ||
} | ||
}; | ||
console.log(this.getData(code)); | ||
} | ||
@@ -49,0 +44,0 @@ }; |
{ | ||
"name": "rollup-plugin-filesize", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "A rollup plugin to show filesize in the cli", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,14 +9,14 @@ import fileSize from 'filesize'; | ||
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 }) | ||
); | ||
} | ||
export default function filesize (options = {}) { | ||
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 }) | ||
); | ||
} | ||
let defaultOptions = { | ||
@@ -34,16 +34,12 @@ format: {}, | ||
return { | ||
ongenerate(bundle, { code }){ | ||
getData (code) { | ||
let size = fileSize(Buffer.byteLength(code), opts.format); | ||
let gzipSize = fileSize(gzip.sync(code), opts.format); | ||
return opts.render(opts, size, gzipSize); | ||
}, | ||
console.log(opts.render(opts, size, gzipSize)); | ||
return { | ||
log: opts.render(opts, size, gzipSize), | ||
code: code, | ||
map: { | ||
mappings: '' | ||
} | ||
} | ||
ongenerate(bundle, { code }){ | ||
console.log(this.getData(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
4567
71