npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@idirdev/bundlecheck

v1.0.0

Published

Analyze JavaScript bundle sizes with gzip/brotli estimates.

Readme

bundlecheck

[EN] Analyze JavaScript and CSS bundle sizes — raw, gzip, and Brotli — and enforce size budgets in CI pipelines. [FR] Analysez la taille de vos bundles JavaScript et CSS — brut, gzip et Brotli — et appliquez des budgets de taille dans vos pipelines CI.


Features / Fonctionnalités

[EN]

  • Reports raw size, gzip, and Brotli compressed sizes for every asset
  • Recursively walks build output directories (dist, build, etc.)
  • Supports .js, .css, and .mjs files by default
  • Configurable size budget in kilobytes via --budget
  • Exits with code 1 when any file exceeds the budget — perfect for CI
  • --json flag for structured output in automation pipelines
  • Sorts results by raw file size (largest first)

[FR]

  • Affiche la taille brute, gzip et Brotli pour chaque asset
  • Parcourt récursivement les répertoires de build (dist, build, etc.)
  • Prend en charge .js, .css et .mjs par défaut
  • Budget de taille configurable en kilo-octets via --budget
  • Quitte avec le code 1 si un fichier dépasse le budget — idéal pour CI
  • Flag --json pour une sortie structurée dans les pipelines d'automatisation
  • Résultats triés par taille brute (les plus grands en premier)

Installation

npm install -g @idirdev/bundlecheck

CLI Usage / Utilisation CLI

# Analyze default ./dist folder
# Analyser le dossier ./dist par défaut
bundlecheck

# Analyze a custom build output folder
# Analyser un dossier de build personnalisé
bundlecheck ./build

# Set a 200 KB budget per file
# Définir un budget de 200 Ko par fichier
bundlecheck ./dist --budget 200

# Output JSON for CI tooling or dashboards
# Retourner JSON pour les outils CI ou tableaux de bord
bundlecheck ./dist --json

# CI usage: fail the build if bundle is too large
# Usage CI : faire échouer le build si le bundle est trop grand
bundlecheck ./dist --budget 150 || exit 1

Example Output / Exemple de sortie

File                                         Raw      Gzip    Brotli
main.chunk.js                             245.3KB    78.1KB    62.4KB
vendor.chunk.js                           198.7KB    61.2KB    49.8KB
styles.css                                 34.2KB    11.8KB     9.3KB
runtime.js                                  3.1KB     1.4KB     1.1KB

Total: 481.3KB (gzip: 152.5KB)
Budget exceeded!

API (Programmatic) / API (Programmation)

const { analyzeFile, analyzeDir, checkBudget, formatSize } = require('@idirdev/bundlecheck');

// Analyze a single file
// Analyser un seul fichier
const result = analyzeFile('./dist/main.js');
// => { file: 'main.js', raw: 251187, gzipped: 79921, brotli: 63840,
//      rawStr: '245.3KB', gzipStr: '78.1KB', brotliStr: '62.4KB' }

// Analyze an entire directory
// Analyser un répertoire entier
const files = analyzeDir('./dist');
// => Array of file result objects, sorted by raw size (largest first)

// Custom extensions
// Extensions personnalisées
const files2 = analyzeDir('./dist', { extensions: ['.js', '.css', '.mjs'] });

// Check against a size budget
// Vérifier par rapport à un budget de taille
const budget = checkBudget(files, { maxRaw: 300 * 1024, maxGzip: 100 * 1024 });
// => { ok: false, violations: [...], totalRaw: 481300, totalGzip: 156340 }

// Format bytes to human-readable string
// Formater les octets en chaîne lisible
formatSize(1048576); // => '1.00MB'
formatSize(2048);    // => '2.0KB'

License

MIT © idirdev