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.4.2 to 0.5.0

.eslintrc.js

60

index.js

@@ -0,13 +1,12 @@

/* eslint-disable no-console */
"use strict";
var path = require("path"),
const path = require("path");
each = require("lodash.foreach"),
sum = require("lodash.sumby"),
parse = require("module-details-from-path"),
filesize = require("filesize");
const parse = require("module-details-from-path");
const filesize = require("filesize");
function defaultReport(details) {
var args = Object.assign({}, details);
const args = Object.assign({}, details);
// Sort

@@ -18,7 +17,9 @@ args.totals.sort((a, b) => b.size - a.size);

args.totals.forEach((item) => {
const itemSize = item.size || 0;
console.log(
"%s - %s (%s%%)",
item.name,
filesize(item.size),
((item.size / args.total) * 100).toFixed(2)
filesize(itemSize),
((itemSize / args.total) * 100).toFixed(2)
);

@@ -32,4 +33,4 @@

file.path,
filesize(file.size),
((file.size / item.size) * 100).toFixed(2)
filesize(file.size || 0),
((file.size / itemSize) * 100).toFixed(2)
));

@@ -41,3 +42,4 @@ }

module.exports = (options) => {
var input, base, report;
let input;
let base;

@@ -48,3 +50,3 @@ if(!options) {

report = (options && options.report) || defaultReport;
const report = (options && options.report) || defaultReport;

@@ -57,3 +59,3 @@ return {

input = config.input;
base = path.dirname(config.input);
base = path.dirname(config.input);
},

@@ -63,18 +65,20 @@

ongenerate : (details) => {
var data = {},
totals = [],
total = 0;
let total = 0;
const data = {};
const totals = [];
const ids = Object.keys(details.bundle.modules);
details.bundle.modules.forEach((module) => {
var parsed;
ids.forEach((id) => {
const module = details.bundle.modules[id];
let parsed;
// Handle rollup-injected helpers
if(module.id.indexOf("\u0000") === 0) {
if(id.indexOf("\u0000") === 0) {
parsed = {
name : "rollup helpers",
basedir : "",
path : module.id.replace("\u0000", "")
path : id.replace("\u0000", "")
};
} else {
parsed = parse(module.id);
parsed = parse(id);

@@ -85,3 +89,3 @@ if(!parsed) {

basedir : base,
path : path.relative(base, module.id)
path : path.relative(base, id)
};

@@ -95,14 +99,14 @@ }

data[parsed.name].push(Object.assign(parsed, { size : module.code.length }));
data[parsed.name].push(Object.assign(parsed, { size : module.originalLength }));
});
// Sum all files in each chunk
each(data, (files, name) => {
var size = sum(files, "size");
Object.entries(data).forEach(([ name, files ]) => {
const sum = files.reduce((out, { size }) => out + size, 0);
total += size;
total += sum;
totals.push({
name,
size
size : sum
});

@@ -109,0 +113,0 @@ });

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

@@ -13,3 +13,3 @@ "main": "index.js",

"release": "npm version -m \"v%s\"",
"test": "node ./test/test.js",
"test": "node ./test/test.js && npm run lint",
"preversion": "npm test"

@@ -26,22 +26,13 @@ },

"devDependencies": {
"eslint": "^4.10.0",
"eslint-config-arenanet": "^3.3.1",
"rollup": "^0.50.0"
"@tivac/eslint-config": "^2.3.1",
"eslint": "^5.14.1",
"rollup": "^1.2.2"
},
"dependencies": {
"filesize": "^3.5.11",
"lodash.foreach": "^4.5.0",
"lodash.sumby": "^4.6.0",
"filesize": "^4.1.2",
"module-details-from-path": "^1.0.3"
},
"eslintConfig": {
"extends": "arenanet",
"env": {
"node": true
},
"rules": {
"no-console": "off",
"prefer-template": "off"
}
"peerDependencies": {
"rollup": "^1.0.0"
}
}

@@ -0,4 +1,5 @@

/* eslint-disable no-console */
"use strict";
var rollup = require("rollup").rollup;
const { rollup } = require("rollup");

@@ -5,0 +6,0 @@ rollup({

Sorry, the diff of this file is not supported yet

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