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

monosize

v0.9.0

Published

<div align="center"> <img width="600" alt="A sample report produced by monosize" src="https://raw.githubusercontent.com/microsoft/monosize/main/.github/images/gh-report.png"> <h1>monosize πŸ“¦</h1> <b>Mono</b>repo + bundle<b>size</b> <br/> <span>M

Readme

  • πŸ“š Designed to be used in CI/CD pipelines
  • 🎱 Designed to represent real-world scenarios
  • 🧰 Supports single packages & monorepos
  • 🍿 Supports various bundlers (Webpack, Rspack, Vite, implement your own? 🐱)
  • ☁️ Supports various storage adapters

Install

# yarn
yarn add --dev monosize

# npm
npm install --save-dev monosize

Usage

Note: monosize requires building packages first before doing any kind of measurements. Make sure to accommodate this in your pipeline

Fixtures

Fixtures declare exports that should be measured by the monosize tool. Fixtures are created inside each package.

For example:

import { Component } from '@library/component';

export { Component };
// πŸ‘† "export" is required to be able to measure the size of the component

export default {
  name: 'Component',
  // πŸ‘† defines a name for a fixture that will be used in output
};

Configuration

You need to create a monosize.config.mjs in the root of your project directory (next to package.json) to configure storage and bundler adapters.

my-proj/
β”œβ”€ src/
β”œβ”€ monosize.config.mjs
β”œβ”€ node_modules/
β”œβ”€ bundle-size/
β”‚  β”œβ”€ Fixture.fixture.js
β”œβ”€ package.json

A global configuration can also be used for monorepo scenarios:

my-proj-a/
β”œβ”€ src/
β”œβ”€ node_modules/
β”œβ”€ bundle-size/
β”‚  β”œβ”€ Fixture.fixture.js
β”œβ”€ package.json
my-proj-b/
β”œβ”€ src/
β”œβ”€ node_modules/
β”œβ”€ bundle-size/
β”‚  β”œβ”€ Fixture.fixture.js
β”œβ”€ package.json
monosize.config.mjs

Config API

// monosize.config.mjs
import storageAdapter from 'monosize-storage-*';
import webpackBundler from 'monosize-bundler-webpack';

/** @type {import('monosize').MonoSizeConfig} */
const config = {
  repository: 'https://github.com/__ORG__/__REPOSITORY__',
  storage: storageAdapter(),
  bundler: webpackBundler(config => {
    // customize config here
    return config;
  }),

  // Optional `compare-reports`/`upload-reports` commands config overrides
  reportResolvers: {
    packageRoot: async reportFile => {
      // provide custom logic on how to resolve package root
      return '...';
    },
    packageName: async packageRoot => {
      // provide custom logic on how to resolve packageName used within reports
      return '...';
    },
  },

  threshold: '10kB', // default is "10%"

  // Optional: which asset types to measure. Default: ['js'] β€” opt in to
  // 'css' / 'json' by listing them explicitly. Files in the bundler output
  // dir whose extension is not in the allowlist are ignored. Each entry
  // must be one of the known AssetType values.
  assetTypes: ['js', 'css', 'json'],
};

export default config;

Measuring CSS, JSON, and other assets

Each fixture's bundler output is treated as a directory; the CLI walks it non-recursively, classifies files by extension against assetTypes, and reports a per-type breakdown alongside top-level totals. Threshold gates on totals only.

To measure CSS or other non-JS assets, configure your bundler (via the adapter's config-enhancer callback) to extract them. monosize itself does not bundle a CSS plugin β€” install whatever your bundler needs (e.g. mini-css-extract-plugin for webpack) in your own project and wire it through the enhancer. Rspack / vite handle CSS extraction natively.

Bundler adapters

To build fixtures and produce artifacts you need to use a bundler adapter. Following adapters are available:

Storage adapters

To store reference results and run comparisons you need to use a storage adapter. Following adapters are available:

Threshold

The threshold is used to determine if the bundle size is acceptable. It can be set in the configuration file and can be a percentage (e.g., 10%) or an absolute size (e.g., 10kB). The default value is 10%.

If the bundle size exceeds the threshold, the compare-reports command will fail with exit code 1.

Commands

measure

monosize measure [--debug] [--artifacts-location] [--fixtures] [--build-mode] [--quiet]

Builds fixtures and produces artifacts. For each fixture:

  • [fixture].fixture.js - a modified fixture without a default export, used by a bundler
  • [fixture].output/ - a directory containing the bundler's output for this fixture (at minimum index.js, plus extracted CSS / JSON sidecars when configured). The CLI walks this directory, classifies files by extension against assetTypes, and produces a per-type breakdown plus totals.
  • [fixture].debug.js - a partially minified file alongside (not inside) [fixture].output/, useful for debugging (optional, if --debug is passed)

Produces a report file (dist/bundle-size/monosize.json) that is used by other steps.

Options

  • artifacts-location - defines relative path from the package root where the artifact files will be stored (monosize.json & bundler output). If specified, --report-files-glob in monosize compare-reports & monosize upload-report should be set accordingly.
  • fixtures - optional argument to pass a fixture filename or globbing pattern. If not specified, all fixture files matching a *.fixture.js pattern will be measured.
  • build-mode - controls how fixtures are built. batch builds all fixtures in a single bundler run with multiple entry points (3-15x faster). sequential builds one at a time. Default: batch.

Examples

monosize measure --fixtures ba* - matches any fixtures with filenames starting with ba monosize measure --fixtures Fixture.fixture.js - matches a fixture with the exact filename monosize measure --build-mode=sequential - builds fixtures one at a time (slower but useful for debugging)

compare-reports

Compares local (requires call of monosize measure first) and remote results, provides output to CLI or to a Markdown file.

monosize compare-reports --branch=main --output=["cli"|"markdown"] [--deltaFormat=["delta"|"percent"]] [--report-files-glob] [--quiet]

[!TIP] In order to resolve package name used within report, we look for package.json or project.json by default to identify project root and use #name property from obtained configuration. If you have custom solution that needs changes please use monosize configuration API (MonoSizeConfig.reportResolvers).

Options

  • branch - the branch to compare the results with, usually main
  • output - defines the output formatter, either cli or markdown
  • deltaFormat - defines the format of the delta column, either delta or percent
  • report-files-glob - defines a glob pattern to search for report files, defaults to packages/**/dist/bundle-size/monosize.json

upload-report

[!CAUTION] Should be called only during CI builds.

[!TIP] Requires a configured storage adapter.

[!TIP] In order to resolve package name used within report, we look for package.json or project.json by default to identify project root and use #name property from obtained configuration. If you have custom solution that needs changes please use monosize configuration API (MonoSizeConfig.reportResolvers).

monosize upload-report --branch=main --commit-sha=HASH [--report-files-glob] [--quiet]

Aggregates local results to a single report and uploads data using the configured storage adapter.

Options

  • branch - the branch to compare the results with, usually main
  • commit-sha - the commit SHA to associate the report with
  • report-files-glob - defines a glob pattern to search for report files, defaults to packages/**/dist/bundle-size/monosize.json

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.