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

bundle-handler

v1.0.1

Published

CLI tool to format, analyze, and remove packages from JS files

Readme

Bundle Handler 🛠️

A fast and simple CLI tool for analyzing, cleaning, formatting, and bundling JavaScript/TypeScript files.

🚀 Features

  • 📊 Analyze – Detect packages, usage stats, and file info
  • 🗑️ Remove – Remove packages safely or forcefully from files
  • Format / Minify – Format with Prettier or minify with Terser
  • 📦 Bundle – Create browser-ready bundles using esbuild
  • 🔍 Force Mode – Handle bundled/minified files with deep scanning

📦 Installation

Global (Recommended)

npm install -g bundle-handler

Local

npm install bundle-handler

From Source

git clone https://github.com/yourusername/bundle-handler.git
cd bundle-handler
npm install
npm run install-global

🛠️ Usage

Analyze Files 📊

# Analyze a file
kz analyze myfile.js

Example Output:

📄 File: myfile.js
📏 Lines: 14,056
💾 Size: 5436.96 KB
📦 Packages detected: 8
  - jquery v3.7.1 (252 times)
  - moment v2.30.1 (43 times)
🏆 Most used: jquery
📊 Total references: 321

Remove Packages 🗑️

# Normal removal
kz remove myfile.js moment

# Force removal (minified/bundled files)
kz remove myfile.js moment --force

Normal Mode: Precise AST parsing
Force Mode: Aggressive regex-based removal


Format & Minify ✨

# Format with Prettier
kz format myfile.js

# Minify with Terser
kz format myfile.js --minify

Bundle Packages 📦

# Create a vendor bundle
kz bundle jquery moment lodash

# Custom output
kz bundle jquery moment --out vendor.js

# Minified bundle
kz bundle jquery moment --minify

🔖 Commands

| Command | Description | | ---------------------------- | --------------------------------------------------- | | kz analyze <file> | Analyze JS/TS file for package usage | | kz remove <file> <package> | Remove a package (use --force for minified files) | | kz format <file> | Format with Prettier (add --minify for Terser) | | kz bundle [packages...] | Bundle npm packages into one file |


⚙️ Configuration

  • Respects your Prettier config (.prettierrc, prettier.config.js, or package.json)
  • Default settings if no config found:
{
  "parser": "babel",
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "printWidth": 100
}

🐛 Troubleshooting

  • Package not found → Run npm install <package>
  • AST parsing fails → Use --force
  • Permission issues → Check file permissions
  • Large files → Use --max-old-space-size=4096

Enable debug mode:

DEBUG=kz kz analyze myfile.js

👩‍💻 Contributing

  1. Fork & clone
  2. Create a branch
  3. Make changes + add tests
  4. Submit PR

Local setup:

git clone https://github.com/yourusername/bundle-handler.git
cd bundle-handler
npm install
npm link

📜 License

MIT License – see LICENSE


Made with ❤️ for the JavaScript community