Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0.1 to 1.2.0

15

dist/index.js

@@ -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 @@ };

6

package.json
{
"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));
}
}
};
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