rollup-plugin-filesize
Advanced tools
Comparing version 4.0.1 to 5.0.0
@@ -11,3 +11,3 @@ 'use strict'; | ||
var brotli = _interopDefault(require('brotli-size')); | ||
var terser = _interopDefault(require('terser')); | ||
var minify = _interopDefault(require('babel-minify')); | ||
@@ -24,3 +24,3 @@ var toConsumableArray = function (arr) { | ||
function render(opt, size, gzip$$1, brotliSize, minifiedSize, bundle) { | ||
function render(opt, bundle, sizes) { | ||
var primaryColor = opt.theme === "dark" ? "green" : "black"; | ||
@@ -32,3 +32,3 @@ var secondaryColor = opt.theme === "dark" ? "yellow" : "blue"; | ||
var values = [].concat(toConsumableArray(bundle.file ? ["" + title("Destination: ") + value(bundle.file)] : []), [title("Bundle Size: ") + " " + value(size)], [title("Minified and Gzipped Size: ") + " " + value(minifiedSize)], toConsumableArray(opt.showBrotliSize ? ["" + title("Brothli size: ") + value(brotliSize)] : [])); | ||
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("Brothli size: ") + value(sizes.brotliSize)] : [])); | ||
@@ -47,3 +47,4 @@ return boxen(values.join("\n"), { padding: 1 }); | ||
showGzippedSize: true, | ||
showBrotliSize: false | ||
showBrotliSize: false, | ||
showMinifiedSize: true | ||
}; | ||
@@ -57,9 +58,14 @@ | ||
var getData = function getData(bundle, code) { | ||
var size = fileSize(Buffer.byteLength(code), opts.format); | ||
var gzipSize = opts.showGzippedSize ? fileSize(gzip.sync(code), opts.format) : ""; | ||
var brotliSize = opts.showBrotliSize ? fileSize(brotli.sync(code), opts.format) : ""; | ||
var sizes = {}; | ||
sizes.bundleSize = fileSize(Buffer.byteLength(code), opts.format); | ||
var minifiedSize = fileSize(gzip.sync(terser.minify(code).code)); | ||
sizes.brotliSize = opts.showBrotliSize ? fileSize(brotli.sync(code), opts.format) : ""; | ||
return opts.render(opts, size, gzipSize, brotliSize, minifiedSize, bundle); | ||
if (opts.showMinifiedSize || opts.showGzippedSize) { | ||
var minifiedCode = minify(code).code; | ||
sizes.minSize = opts.showMinifiedSize ? fileSize(minifiedCode.length, opts.format) : ""; | ||
sizes.gzipSize = opts.showGzippedSize ? fileSize(gzip.sync(minifiedCode), opts.format) : ""; | ||
} | ||
return opts.render(opts, bundle, sizes); | ||
}; | ||
@@ -72,2 +78,3 @@ | ||
return { | ||
name: "filesize", | ||
ongenerate: function ongenerate(bundle, _ref) { | ||
@@ -74,0 +81,0 @@ var code = _ref.code; |
{ | ||
"name": "rollup-plugin-filesize", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "A rollup plugin to show filesize in the cli", | ||
@@ -32,9 +32,9 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"boxen": "^1.1.0", | ||
"brotli-size": "0.0.2", | ||
"colors": "^1.1.2", | ||
"babel-minify": "^0.5.0", | ||
"boxen": "^2.0.0", | ||
"brotli-size": "0.0.3", | ||
"colors": "^1.3.2", | ||
"deep-assign": "^2.0.0", | ||
"filesize": "^3.5.6", | ||
"gzip-size": "^3.0.0", | ||
"terser": "^3.8.0" | ||
"filesize": "^3.6.1", | ||
"gzip-size": "^5.0.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
@@ -29,2 +29,8 @@ # rollup-plugin-filesize | ||
#### showMinifiedSize | ||
type: `boolean` | ||
default: true | ||
Whether to show minified size or not | ||
#### showGzippedSize | ||
@@ -56,4 +62,4 @@ type: `boolean` | ||
filesize({ | ||
render : function (options, size){ | ||
return size; | ||
render : function (options, bundle, { minSize, gzipSize, brotliSize, bundleSize }){ | ||
return minSize; | ||
} | ||
@@ -60,0 +66,0 @@ }) |
@@ -7,5 +7,5 @@ import fileSize from "filesize"; | ||
import brotli from "brotli-size"; | ||
import terser from "terser"; | ||
import minify from "babel-minify"; | ||
function render(opt, size, gzip, brotliSize, minifiedSize, bundle) { | ||
function render(opt, bundle, sizes) { | ||
const primaryColor = opt.theme === "dark" ? "green" : "black"; | ||
@@ -19,7 +19,6 @@ const secondaryColor = opt.theme === "dark" ? "yellow" : "blue"; | ||
...(bundle.file ? [`${title("Destination: ")}${value(bundle.file)}`] : []), | ||
...[`${title("Bundle Size: ")} ${value(size)}`], | ||
...[`${title("Minified and Gzipped Size: ")} ${value(minifiedSize)}`], | ||
...(opt.showBrotliSize | ||
? [`${title("Brothli size: ")}${value(brotliSize)}`] | ||
: []) | ||
...[`${title("Bundle Size: ")} ${value(sizes.bundleSize)}`], | ||
...(sizes.minSize ? [`${title("Minified Size: ")} ${value(sizes.minSize)}`] : []), | ||
...(sizes.gzipSize ? [`${title("Gzipped Size: ")} ${value(sizes.gzipSize)}`] : []), | ||
...(sizes.brotliSize ? [`${title("Brothli size: ")}${value(sizes.brotliSize)}`] : []) | ||
]; | ||
@@ -36,3 +35,4 @@ | ||
showGzippedSize: true, | ||
showBrotliSize: false | ||
showBrotliSize: false, | ||
showMinifiedSize: true | ||
}; | ||
@@ -46,13 +46,20 @@ | ||
const getData = function(bundle, code) { | ||
let size = fileSize(Buffer.byteLength(code), opts.format); | ||
let gzipSize = opts.showGzippedSize | ||
? fileSize(gzip.sync(code), opts.format) | ||
: ""; | ||
let brotliSize = opts.showBrotliSize | ||
const sizes = {}; | ||
sizes.bundleSize = fileSize(Buffer.byteLength(code), opts.format); | ||
sizes.brotliSize = opts.showBrotliSize | ||
? fileSize(brotli.sync(code), opts.format) | ||
: ""; | ||
let minifiedSize = fileSize(gzip.sync(terser.minify(code).code)); | ||
if (opts.showMinifiedSize || opts.showGzippedSize) { | ||
const minifiedCode = minify(code).code; | ||
sizes.minSize = opts.showMinifiedSize | ||
? fileSize(minifiedCode.length, opts.format) | ||
: ""; | ||
sizes.gzipSize = opts.showGzippedSize | ||
? fileSize(gzip.sync(minifiedCode), opts.format) | ||
: ""; | ||
} | ||
return opts.render(opts, size, gzipSize, brotliSize, minifiedSize, bundle); | ||
return opts.render(opts, bundle, sizes); | ||
}; | ||
@@ -65,2 +72,3 @@ | ||
return { | ||
name: "filesize", | ||
ongenerate(bundle, { code }) { | ||
@@ -67,0 +75,0 @@ console.log(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
7122
125
82
+ Addedbabel-minify@^0.5.0
+ Added@ampproject/remapping@2.3.0(transitive)
+ Added@babel/code-frame@7.25.7(transitive)
+ Added@babel/compat-data@7.25.8(transitive)
+ Added@babel/core@7.25.8(transitive)
+ Added@babel/generator@7.25.7(transitive)
+ Added@babel/helper-compilation-targets@7.25.7(transitive)
+ Added@babel/helper-module-imports@7.25.7(transitive)
+ Added@babel/helper-module-transforms@7.25.7(transitive)
+ Added@babel/helper-simple-access@7.25.7(transitive)
+ Added@babel/helper-string-parser@7.25.7(transitive)
+ Added@babel/helper-validator-identifier@7.25.7(transitive)
+ Added@babel/helper-validator-option@7.25.7(transitive)
+ Added@babel/helpers@7.25.7(transitive)
+ Added@babel/highlight@7.25.7(transitive)
+ Added@babel/parser@7.25.8(transitive)
+ Added@babel/template@7.25.7(transitive)
+ Added@babel/traverse@7.25.7(transitive)
+ Added@babel/types@7.25.8(transitive)
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Addedansi-align@3.0.1(transitive)
+ Addedansi-regex@4.1.15.0.1(transitive)
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarray.prototype.reduce@1.0.7(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedbabel-helper-evaluate-path@0.5.0(transitive)
+ Addedbabel-helper-flip-expressions@0.4.3(transitive)
+ Addedbabel-helper-is-nodes-equiv@0.0.1(transitive)
+ Addedbabel-helper-is-void-0@0.4.3(transitive)
+ Addedbabel-helper-mark-eval-scopes@0.4.3(transitive)
+ Addedbabel-helper-remove-or-void@0.4.3(transitive)
+ Addedbabel-helper-to-multiple-sequence-expressions@0.5.0(transitive)
+ Addedbabel-minify@0.5.2(transitive)
+ Addedbabel-plugin-minify-builtins@0.5.0(transitive)
+ Addedbabel-plugin-minify-constant-folding@0.5.0(transitive)
+ Addedbabel-plugin-minify-dead-code-elimination@0.5.2(transitive)
+ Addedbabel-plugin-minify-flip-comparisons@0.4.3(transitive)
+ Addedbabel-plugin-minify-guarded-expressions@0.4.4(transitive)
+ Addedbabel-plugin-minify-infinity@0.4.3(transitive)
+ Addedbabel-plugin-minify-mangle-names@0.5.1(transitive)
+ Addedbabel-plugin-minify-numeric-literals@0.4.3(transitive)
+ Addedbabel-plugin-minify-replace@0.5.0(transitive)
+ Addedbabel-plugin-minify-simplify@0.5.1(transitive)
+ Addedbabel-plugin-minify-type-constructors@0.4.3(transitive)
+ Addedbabel-plugin-transform-inline-consecutive-adds@0.4.3(transitive)
+ Addedbabel-plugin-transform-member-expression-literals@6.9.4(transitive)
+ Addedbabel-plugin-transform-merge-sibling-variables@6.9.5(transitive)
+ Addedbabel-plugin-transform-minify-booleans@6.9.4(transitive)
+ Addedbabel-plugin-transform-property-literals@6.9.4(transitive)
+ Addedbabel-plugin-transform-regexp-constructors@0.4.3(transitive)
+ Addedbabel-plugin-transform-remove-console@6.9.4(transitive)
+ Addedbabel-plugin-transform-remove-debugger@6.9.4(transitive)
+ Addedbabel-plugin-transform-remove-undefined@0.5.0(transitive)
+ Addedbabel-plugin-transform-simplify-comparison-operators@6.9.4(transitive)
+ Addedbabel-plugin-transform-undefined-to-void@6.9.4(transitive)
+ Addedbabel-preset-minify@0.5.2(transitive)
+ Addedboxen@2.1.0(transitive)
+ Addedbrotli-size@0.0.3(transitive)
+ Addedbrowserslist@4.24.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcaniuse-lite@1.0.30001669(transitive)
+ Addedconvert-source-map@2.0.0(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedelectron-to-chromium@1.5.41(transitive)
+ Addedemoji-regex@7.0.38.0.0(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedes-array-method-boxes-properly@1.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfs-readdir-recursive@1.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedgensync@1.0.0-beta.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedgzip-size@5.1.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsesc@3.0.2(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-releases@2.0.18(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedobject.getownpropertydescriptors@2.1.8(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring-width@3.1.04.2.3(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedstrip-ansi@5.2.06.0.1(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addedutil.promisify@1.1.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
+ Addedyallist@3.1.1(transitive)
+ Addedyargs-parser@10.1.0(transitive)
- Removedterser@^3.8.0
- Removedansi-align@2.0.0(transitive)
- Removedboxen@1.3.0(transitive)
- Removedbrotli-size@0.0.2(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcommander@2.20.3(transitive)
- Removedgzip-size@3.0.0(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedterser@3.17.0(transitive)
Updatedboxen@^2.0.0
Updatedbrotli-size@0.0.3
Updatedcolors@^1.3.2
Updatedfilesize@^3.6.1
Updatedgzip-size@^5.0.0