rollup-plugin-filesize
Advanced tools
Comparing version 5.0.1 to 6.0.0
@@ -23,3 +23,3 @@ 'use strict'; | ||
function render(opt, bundle, sizes) { | ||
function render(opt, outputOptions, sizes) { | ||
var primaryColor = opt.theme === "dark" ? "green" : "black"; | ||
@@ -31,3 +31,3 @@ var secondaryColor = opt.theme === "dark" ? "yellow" : "blue"; | ||
var values = [].concat(toConsumableArray(bundle.file ? ["" + title("Destination: ") + value(bundle.file)] : []), [title("Bundle Size: ") + " " + value(sizes.bundleSize)], toConsumableArray(sizes.minSize ? [title("Minified Size: ") + " " + value(sizes.minSize)] : []), toConsumableArray(sizes.gzipSize ? [title("Gzipped Size: ") + " " + value(sizes.gzipSize)] : []), toConsumableArray(sizes.brotliSize ? ["" + title("Brotli size: ") + value(sizes.brotliSize)] : [])); | ||
var values = [].concat(toConsumableArray(outputOptions.file ? ["" + title("Destination: ") + value(outputOptions.file)] : []), [title("Bundle Size: ") + " " + value(sizes.bundleSize)], toConsumableArray(sizes.minSize ? [title("Minified Size: ") + " " + value(sizes.minSize)] : []), toConsumableArray(sizes.gzipSize ? [title("Gzipped Size: ") + " " + value(sizes.gzipSize)] : []), toConsumableArray(sizes.brotliSize ? ["" + title("Brotli size: ") + value(sizes.brotliSize)] : [])); | ||
@@ -55,3 +55,3 @@ return boxen(values.join("\n"), { padding: 1 }); | ||
var getData = function getData(bundle, code) { | ||
var getData = function getData(outputOptions, code) { | ||
var sizes = {}; | ||
@@ -68,3 +68,3 @@ sizes.bundleSize = fileSize(Buffer.byteLength(code), opts.format); | ||
return opts.render(opts, bundle, sizes); | ||
return opts.render(opts, outputOptions, sizes); | ||
}; | ||
@@ -78,6 +78,8 @@ | ||
name: "filesize", | ||
ongenerate: function ongenerate(bundle, _ref) { | ||
var code = _ref.code; | ||
console.log(getData(bundle, code)); | ||
generateBundle: function generateBundle(outputOptions, bundle, isWrite) { | ||
Object.keys(bundle).map(function (fileName) { | ||
return bundle[fileName]; | ||
}).forEach(function (bundle) { | ||
return console.log(getData(outputOptions, bundle.code)); | ||
}); | ||
} | ||
@@ -84,0 +86,0 @@ }; |
{ | ||
"name": "rollup-plugin-filesize", | ||
"version": "5.0.1", | ||
"version": "6.0.0", | ||
"description": "A rollup plugin to show filesize in the cli", | ||
@@ -46,3 +46,3 @@ "main": "dist/index.js", | ||
"prettier": "^1.13.7", | ||
"rollup": "^0.60.1", | ||
"rollup": "^1.0.0", | ||
"rollup-plugin-babel": "^3.0.4" | ||
@@ -49,0 +49,0 @@ }, |
@@ -9,3 +9,3 @@ import fileSize from "filesize"; | ||
function render(opt, bundle, sizes) { | ||
function render(opt, outputOptions, sizes) { | ||
const primaryColor = opt.theme === "dark" ? "green" : "black"; | ||
@@ -18,3 +18,3 @@ const secondaryColor = opt.theme === "dark" ? "yellow" : "blue"; | ||
const values = [ | ||
...(bundle.file ? [`${title("Destination: ")}${value(bundle.file)}`] : []), | ||
...(outputOptions.file ? [`${title("Destination: ")}${value(outputOptions.file)}`] : []), | ||
...[`${title("Bundle Size: ")} ${value(sizes.bundleSize)}`], | ||
@@ -44,3 +44,3 @@ ...(sizes.minSize ? [`${title("Minified Size: ")} ${value(sizes.minSize)}`] : []), | ||
const getData = function(bundle, code) { | ||
const getData = function(outputOptions, code) { | ||
const sizes = {}; | ||
@@ -63,3 +63,3 @@ sizes.bundleSize = fileSize(Buffer.byteLength(code), opts.format); | ||
return opts.render(opts, bundle, sizes); | ||
return opts.render(opts, outputOptions, sizes); | ||
}; | ||
@@ -73,6 +73,8 @@ | ||
name: "filesize", | ||
ongenerate(bundle, { code }) { | ||
console.log(getData(bundle, code)); | ||
generateBundle(outputOptions, bundle, isWrite) { | ||
Object.keys(bundle) | ||
.map(fileName => bundle[fileName]) | ||
.forEach(bundle => console.log(getData(outputOptions, 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
7442
130