Socket
Socket
Sign inDemoInstall

rollup-plugin-filesize

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-filesize - npm Package Compare versions

Comparing version 1.5.0 to 2.0.0

18

dist/index.js

@@ -20,2 +20,3 @@ 'use strict';

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var env = arguments[1];

@@ -34,12 +35,17 @@ var defaultOptions = {

var getData = function getData(bundle, code) {
var size = fileSize(Buffer.byteLength(code), opts.format);
var gzipSize = opts.showGzippedSize ? fileSize(gzip.sync(code), opts.format) : "";
return opts.render(opts, size, gzipSize, bundle);
};
if (env === "test") {
return getData;
}
return {
getData: function getData(bundle, code) {
var size = fileSize(Buffer.byteLength(code), opts.format);
var gzipSize = opts.showGzippedSize ? fileSize(gzip.sync(code), opts.format) : "";
return opts.render(opts, size, gzipSize, bundle);
},
ongenerate: function ongenerate(bundle, _ref) {
var code = _ref.code;
console.log(this.getData(bundle, code));
console.log(getData(bundle, code));
}

@@ -46,0 +52,0 @@ };

{
"name": "rollup-plugin-filesize",
"version": "1.5.0",
"version": "2.0.0",
"description": "A rollup plugin to show filesize in the cli",

@@ -43,4 +43,4 @@ "main": "dist/index.js",

"babel-register": "^6.7.2",
"rollup": "^0.48.0",
"rollup-plugin-babel": "^2.3.9"
"rollup": "^0.60.1",
"rollup-plugin-babel": "^3.0.4"
},

@@ -47,0 +47,0 @@ "ava": {

@@ -27,3 +27,3 @@ import fileSize from "filesize";

export default function filesize(options = {}) {
export default function filesize(options = {}, env) {
let defaultOptions = {

@@ -41,15 +41,19 @@ format: {},

const getData = function(bundle, code) {
let size = fileSize(Buffer.byteLength(code), opts.format);
let gzipSize = opts.showGzippedSize
? fileSize(gzip.sync(code), opts.format)
: "";
return opts.render(opts, size, gzipSize, bundle);
};
if (env === "test") {
return getData
}
return {
getData(bundle, code) {
let size = fileSize(Buffer.byteLength(code), opts.format);
let gzipSize = opts.showGzippedSize
? fileSize(gzip.sync(code), opts.format)
: "";
return opts.render(opts, size, gzipSize, bundle);
},
ongenerate(bundle, { code }) {
console.log(this.getData(bundle, code));
console.log(getData(bundle, code));
}
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc