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

minimize-js

v1.4.1

Published

Minimize your files without making a bundle

Downloads

2,990

Readme

  ███╗   ███╗██╗███╗   ██╗██╗███╗   ███╗██╗███████╗███████╗      ██╗███████╗
  ████╗ ████║██║████╗  ██║██║████╗ ████║██║╚══███╔╝██╔════╝      ██║██╔════╝
  ██╔████╔██║██║██╔██╗ ██║██║██╔████╔██║██║  ███╔╝ █████╗   ████╗██║███████╗
  ██║╚██╔╝██║██║██║╚██╗██║██║██║╚██╔╝██║██║ ███╔╝  ██╔══╝   ╚═══╝██║╚════██║
  ██║ ╚═╝ ██║██║██║ ╚████║██║██║ ╚═╝ ██║██║███████╗███████╗      ██║███████║
  ╚═╝     ╚═╝╚═╝╚═╝  ╚═══╝╚═╝╚═╝     ╚═╝╚═╝╚══════╝╚══════╝      ╚═╝╚══════╝

Minimize your JS files post-build — without creating a bundle.

npm version npm downloads license CI


Overview

minimize-js strips whitespace, rewrites identifiers, and collapses syntax across every file in a directory — powered by esbuild. No bundling, no module graph, no entry points. Just smaller files.

Perfect as a post-build step for libraries that compile TypeScript to CommonJS before publishing.

# Before
dist/index.js   →   42 kB
# After
dist/index.js   →   18 kB

Packages

This project is a monorepo. Two packages, one purpose.

| Package | Description | Install | |---------|-------------|---------| | minimize-js | CLI tool | npm i -D minimize-js | | @minimize-js/core | Programmatic API | npm i @minimize-js/core |


Installation

# npm
npm install minimize-js --save-dev

# pnpm
pnpm add minimize-js -D

# yarn
yarn add minimize-js --dev

Usage

CLI

minimize-js <directory> [options]

Run it on your compiled output directory:

minimize-js lib
minimize-js dist --minifyDeclaration
minimize-js lib --banner "/* Copyright 2024 */"

Combine with your build script in package.json:

{
  "scripts": {
    "build": "tsc -b && minimize-js lib"
  }
}

Options

| Flag | Alias | Description | Default | |------|-------|-------------|---------| | --minifyWhitespace | -w | Remove all whitespace | true | | --minifyIdentifiers | -i | Shorten variable names | true | | --minifySyntax | -s | Collapse syntax patterns | true | | --minifyDeclaration | -d | Minify .d.ts files | false | | --banner <string> | -b | Prepend a string to each JS file | — |


Programmatic API

Use @minimize-js/core directly in your build scripts or tooling:

import { minimization } from '@minimize-js/core'

const results = minimization(['dist/index.js', 'dist/utils.js'], {
  minifyWhitespace: true,
  minifyIdentifiers: true,
  minifySyntax: true,
  minifyDeclaration: false,
  banner: '/* my lib v1.0.0 */',
})

Returns an array of results — no file I/O, no side effects, fully testable.


How It Works

your directory
      │
      ▼
  glob *.js
      │
      ├──▶  .js files  ──▶  esbuild transformSync  ──▶  write back
      │
      └──▶  .d.ts files ──▶  dts-minify  ──▶  write back

Shebang lines (#!/usr/bin/env node) are preserved automatically.


Contributing

Contributions are welcome. Fork → branch → PR.

git clone https://github.com/Randagio13/minimize-js
cd minimize-js
pnpm install
pnpm build
pnpm test

Commits follow Conventional Commits — this drives automatic versioning via Lerna.

feat: add new option
fix: handle edge case in shebang detection
chore: update deps

License

MIT — Alessandro Casazza


:heart: Sponsor this project