Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@bundle-stats/utils
Advanced tools
@bundle-stats/utils is a utility library for analyzing and comparing webpack bundle stats. It provides various functions to parse, normalize, and compare bundle stats, making it easier to understand the performance and size of your webpack bundles.
Parsing Webpack Stats
This feature allows you to parse raw webpack stats into a more manageable format. The `parseStats` function takes the raw stats JSON and converts it into a structured object.
const { parseStats } = require('@bundle-stats/utils');
const stats = require('./path/to/webpack-stats.json');
const parsedStats = parseStats(stats);
console.log(parsedStats);
Normalizing Webpack Stats
This feature normalizes the webpack stats, making it easier to compare different builds. The `normalizeStats` function takes the raw stats JSON and returns a normalized version.
const { normalizeStats } = require('@bundle-stats/utils');
const stats = require('./path/to/webpack-stats.json');
const normalizedStats = normalizeStats(stats);
console.log(normalizedStats);
Comparing Webpack Stats
This feature allows you to compare two sets of webpack stats. The `compareStats` function takes the current and baseline stats JSON and returns a comparison object highlighting the differences.
const { compareStats } = require('@bundle-stats/utils');
const currentStats = require('./path/to/current-stats.json');
const baselineStats = require('./path/to/baseline-stats.json');
const comparison = compareStats(currentStats, baselineStats);
console.log(comparison);
webpack-bundle-analyzer is a tool that visualizes the size of webpack output files with an interactive zoomable treemap. It provides a graphical representation of your bundle, making it easier to identify large modules and optimize your bundle size. Unlike @bundle-stats/utils, which focuses on parsing and comparing stats, webpack-bundle-analyzer provides a visual analysis.
source-map-explorer analyzes JavaScript bundles using source maps to determine which file each byte in your minified code came from. It helps you understand the composition of your bundle and identify large dependencies. While @bundle-stats/utils focuses on stats comparison, source-map-explorer provides a detailed breakdown of the bundle content.
bundlesize is a tool that lets you set a limit on the size of your JavaScript bundles and fails your build if the bundle size exceeds the specified limit. It is useful for enforcing size constraints on your bundles. Unlike @bundle-stats/utils, which provides detailed stats analysis, bundlesize focuses on enforcing size limits.
Common utilities for bundle-stats packages.
import { createJobs, createReport } from '@bundle-stats/utils';
import * as webpack from '@bundle-stats/utils/lib/webpack';
// Get webpack stats data
const WEBPACK_STATS_CURRENT = {/* ... */};
const WEBPACK_STATS_BASELINE = {/* ... */};
// Create jobs
const jobs = createJobs([
{ webpack: WEBPACK_STATS_CURRENT },
{ webpack: WEBPACK_STATS_BASELINE }
]);
// Create report
const report = createReport(jobs);
console.log(report.insights.webpack.assetsSizeTotal.data.text);
>> Bundle size increased to 9.77KB (+100%).
bundle-stats
CLI to generate bundle stats report.
bundle-stats-webpack-plugin
Webpack plugin to generate bundle stats report.
gatsby-plugin-bundle-stats
Gatsby plugin for bundle-stats.
next-plugin-bundle-stats
Next.js plugin for bundle-stats.
rollup-plugin-bundle-stats
Rollup plugin to generate bundle stats report.
Standalone web application to compare Webpack/Lighthouse/Browsertime stats.
Github Action that generates bundle-stats reports.
FAQs
BundleStats utils
The npm package @bundle-stats/utils receives a total of 69,968 weekly downloads. As such, @bundle-stats/utils popularity was classified as popular.
We found that @bundle-stats/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.