New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-sizes

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-sizes - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

.eslintignore

66

index.js

@@ -5,3 +5,2 @@ "use strict";

assign = require("lodash.assign"),
each = require("lodash.foreach"),

@@ -12,3 +11,3 @@ sum = require("lodash.sumby"),

module.exports = function(options) {
module.exports = (options) => {
var entry, base;

@@ -24,3 +23,3 @@

// Grab some needed bits out of the options
options : function(config) {
options : (config) => {
entry = config.entry;

@@ -31,19 +30,22 @@ base = path.dirname(config.entry);

// Spit out stats during bundle generation
ongenerate : function(details, result) {
ongenerate : (details) => {
var data = {},
totals = [];
totals = [],
total = 0;
details.bundle.modules.forEach(function(module) {
var parsed = parse(module.id);
details.bundle.modules.forEach((module) => {
var parsed;
if(!parsed) {
// Handle rollup-injected helpers
if(module.id.indexOf("\u0000") === 0) {
// Handle rollup-injected helpers
if(module.id.indexOf("\u0000") === 0) {
parsed = {
name : "rollup helpers",
basedir : "",
path : module.id.replace("\u0000", "")
};
} else {
parsed = parse(module.id);
if(!parsed) {
parsed = {
name : "rollup helpers",
basedir : "",
path : module.id.replace("\u0000", "")
};
} else {
parsed = {
name : "app",

@@ -60,13 +62,14 @@ basedir : base,

data[parsed.name].push(assign(parsed, { size : module.code.length }));
data[parsed.name].push(Object.assign(parsed, { size : module.code.length }));
});
// Sum all files in each chunk
each(data, function(files, name) {
each(data, (files, name) => {
var size = sum(files, "size");
total += size;
totals.push({
name : name,
size : size,
percent : (size / result.code.length) * 100
name,
size
});

@@ -76,9 +79,7 @@ });

// Sort
totals.sort(function(a, b) {
return b.size - a.size;
});
totals.sort((a, b) => b.size - a.size);
console.log("%s:", entry);
totals.forEach(function(item) {
totals.forEach((item) => {
console.log(

@@ -88,11 +89,9 @@ "%s - %s (%s%%)",

filesize(item.size),
item.percent.toFixed(2)
((item.size / total) * 100).toFixed(2)
);
if(options.details) {
data[item.name].sort(function(a, b) {
return b.size - a.size;
})
.forEach(function(file) {
console.log(
data[item.name]
.sort((a, b) => b.size - a.size)
.forEach((file) => console.log(
"\t%s - %s (%s%%)",

@@ -102,4 +101,3 @@ file.path,

((file.size / item.size) * 100).toFixed(2)
);
});
));
}

@@ -106,0 +104,0 @@ });

{
"name": "rollup-plugin-sizes",
"version": "0.2.3",
"version": "0.3.0",
"description": "Show info about files/packages included with your rollup bundle",

@@ -27,3 +27,4 @@ "main": "index.js",

"eslint-config-arenanet": "^3.0.1",
"publish-please": "^2.2.0"
"publish-please": "^2.2.0",
"rollup": "^0.41.4"
},

@@ -30,0 +31,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

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