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

pixcrush

v1.0.4

Published

A CLI tool that converts PNG and JPG images to WebP and rewrites React and Next.js code references automatically.

Downloads

484

Readme

pixcrush

npm version npm downloads license node

pixcrush is a CLI tool that converts PNG and JPG images to optimized WebP, compresses them, and safely rewrites your source code references so nothing breaks.

Why pixcrush?

Most real-world React and Next.js codebases have hundreds of PNG and JPG images sitting in /public or scattered across the repo. Converting them to modern formats is boring, risky, and time-consuming because you also have to update imports and src paths everywhere.

pixcrush automates this entire migration safely and repeatably.

Quickstart

Run once with no install required:

npx pixcrush .

Or install globally for repeated use:

npm install -g pixcrush
pixcrush .

If you don't pass any flags, pixcrush will ask you two quick questions before running.


Flags

| Flag | Description | | -------------------- | ---------------------------------------------------- | | --dry-run | Preview what would change without writing any files | | --delete-originals | Delete original .png/.jpg files after conversion | | --quality <number> | WebP compression quality, 1-100 (default: 80) | | --help | Show usage info | | --version | Show version |

# Preview what would happen with no files modified
pixcrush . --dry-run

# Convert images and remove the originals afterwards
pixcrush . --delete-originals

# Convert at a higher quality
pixcrush . --quality 90

# Non-interactive full run
pixcrush . --delete-originals --quality 85

Features

  • Safe AST rewrites - Uses Babel to update imports and JSX src attributes to .webp without reformatting your files.
  • Smart compression - Skips conversion if the resulting WebP would be larger than the original.
  • Next.js and Turborepo support - Resolves deeply nested apps/web/public/ paths so absolute image links like src="/images/hero.png" are matched correctly.
  • Orphan detection - Reports any image that is never referenced in your source code.
  • Garbage collection - With --delete-originals, also removes unused orphaned images automatically.
  • SEO safe - Ignores framework metadata assets like favicon*.png, apple-icon*.png, opengraph-image*.png, and PWA manifest icons so critical metadata images are never touched.

How It Works

  1. Scan - Discovers all .png/.jpg and .js/.ts/.jsx/.tsx files using fast-glob.
  2. Analyze - Parses your source code with Babel AST to identify which images are actually used.
  3. Convert - Compresses used images to WebP using sharp (in-memory, only writes if smaller).
  4. Rewrite - Updates import paths and src attributes in your source code.
  5. Report - Prints a summary of images converted, space saved, files updated, and any warnings.

Limitations

  • Dynamic image paths like `images/${name}.png` are detected and warned about but not automatically rewritten.
  • CSS files are not parsed. Only .js, .ts, .jsx, and .tsx are supported.

Debugging

Run with DEBUG_CRUSH=1 to see verbose path resolution output:

DEBUG_CRUSH=1 pixcrush .

Author

Built by Karishma Garg — Product Engineer


License

MIT. See LICENSE for details.