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

rollup-plugin-webpack-stats

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-webpack-stats - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

16

dist/rollup-plugin-webpack-stats.cjs.development.js

@@ -9,2 +9,8 @@ 'use strict';

var getByteSize = function getByteSize(content) {
if (typeof content === 'string') {
return Buffer.from(content).length;
}
return (content == null ? void 0 : content.length) || 0;
};
var bundleToWebpackStats = function bundleToWebpackStats(bundle) {

@@ -17,6 +23,5 @@ var items = Object.values(bundle);

if (item.type === 'chunk') {
var _item$code;
assets.push({
name: item.fileName,
size: (_item$code = item.code) == null ? void 0 : _item$code.length
size: getByteSize(item.code)
});

@@ -27,3 +32,3 @@ var chunkId = item.name;

entry: item.isEntry,
initial: false,
initial: item.isEntry,
files: [item.fileName],

@@ -47,7 +52,6 @@ names: [item.name]

});
} else {
var _item$source;
} else if (item.type === 'asset') {
assets.push({
name: item.fileName,
size: (_item$source = item.source) == null ? void 0 : _item$source.length
size: getByteSize(item.source)
});

@@ -54,0 +58,0 @@ }

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("node:path"))&&"object"==typeof e&&"default"in e?e.default:e;exports.webpackStats=function(){return{name:"webpackStats",generateBundle:function(e,n){var s=function(e){var n=Object.values(e),s=[],a=[],i={};return n.forEach((function(e){if("chunk"===e.type){var n;s.push({name:e.fileName,size:null==(n=e.code)?void 0:n.length});var r=e.name;a.push({id:r,entry:e.isEntry,initial:!1,files:[e.fileName],names:[e.name]}),Object.entries(e.modules).forEach((function(e){var n=e[0],s=e[1],a=t.relative(process.cwd(),n.replace("\0","")),u=i[a];u?u.chunks.push(r):i[a]={name:a,size:s.originalLength,chunks:[r]}}))}else{var u;s.push({name:e.fileName,size:null==(u=e.source)?void 0:u.length})}})),{assets:s,chunks:a,modules:Object.values(i)}}(n);this.emitFile({type:"asset",fileName:"webpack-stats.json",source:JSON.stringify(s)})}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("node:path"))&&"object"==typeof e&&"default"in e?e.default:e,n=function(e){return"string"==typeof e?Buffer.from(e).length:(null==e?void 0:e.length)||0};exports.webpackStats=function(){return{name:"webpackStats",generateBundle:function(e,s){var a=function(e){var s=Object.values(e),a=[],i=[],r={};return s.forEach((function(e){if("chunk"===e.type){a.push({name:e.fileName,size:n(e.code)});var s=e.name;i.push({id:s,entry:e.isEntry,initial:e.isEntry,files:[e.fileName],names:[e.name]}),Object.entries(e.modules).forEach((function(e){var n=e[0],a=e[1],i=t.relative(process.cwd(),n.replace("\0","")),u=r[i];u?u.chunks.push(s):r[i]={name:i,size:a.originalLength,chunks:[s]}}))}else"asset"===e.type&&a.push({name:e.fileName,size:n(e.source)})})),{assets:a,chunks:i,modules:Object.values(r)}}(s);this.emitFile({type:"asset",fileName:"webpack-stats.json",source:JSON.stringify(a)})}}};
//# sourceMappingURL=rollup-plugin-webpack-stats.cjs.production.min.js.map
import path from 'node:path';
var getByteSize = function getByteSize(content) {
if (typeof content === 'string') {
return Buffer.from(content).length;
}
return (content == null ? void 0 : content.length) || 0;
};
var bundleToWebpackStats = function bundleToWebpackStats(bundle) {

@@ -10,6 +16,5 @@ var items = Object.values(bundle);

if (item.type === 'chunk') {
var _item$code;
assets.push({
name: item.fileName,
size: (_item$code = item.code) == null ? void 0 : _item$code.length
size: getByteSize(item.code)
});

@@ -20,3 +25,3 @@ var chunkId = item.name;

entry: item.isEntry,
initial: false,
initial: item.isEntry,
files: [item.fileName],

@@ -40,7 +45,6 @@ names: [item.name]

});
} else {
var _item$source;
} else if (item.type === 'asset') {
assets.push({
name: item.fileName,
size: (_item$source = item.source) == null ? void 0 : _item$source.length
size: getByteSize(item.source)
});

@@ -47,0 +51,0 @@ }

{
"name": "rollup-plugin-webpack-stats",
"version": "0.0.1",
"version": "0.0.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# rollup-plugin-webpack-stats
> > **Warning**
> Under active development
> **Warning**
Under active development
[![](https://img.shields.io/npm/v/rollup-plugin-webpack-stats.svg)](https://www.npmjs.com/package/rollup-plugin-webpack-stats)
![](https://img.shields.io/node/v/rollup-plugin-webpack-stats.svg)

@@ -6,0 +9,0 @@ Generate rollup stats JSON file with a [bundle-stats](https://github.com/relative-ci/bundle-stats/tree/master/packages/cli) webpack [supported sructure](https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter/src/index.ts).

@@ -41,2 +41,10 @@ import path from 'node:path';

const getByteSize = (content: string | Buffer): number => {
if (typeof content === 'string') {
return Buffer.from(content).length;
}
return content?.length || 0;
};
export const bundleToWebpackStats = (bundle: OutputBundle): WebpackStatsFiltered => {

@@ -54,3 +62,3 @@ const items = Object.values(bundle);

name: item.fileName,
size: item.code?.length,
size: getByteSize(item.code),
});

@@ -63,3 +71,3 @@

entry: item.isEntry,
initial: false,
initial: item.isEntry,
files: [item.fileName],

@@ -84,7 +92,9 @@ names: [item.name]

});
} else {
} else if (item.type === 'asset') {
assets.push({
name: item.fileName,
size: item.source?.length,
size: getByteSize(item.source),
});
} else {
// noop for unknown types
}

@@ -91,0 +101,0 @@ });

Sorry, the diff of this file is not supported yet

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