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

@lotuz/jsminify

v0.0.20

Published

A javascript minifier written in C, using tree-sitter-javascript parser

Readme

jsminify

"jsminfy" is a JS minifier written in C. It uses tree-sitter-javascript grammar to create a parser and uses tree-sitter-visitor to visit each node of a JavaScript AST. For each visited node it generates javascript code that is minified.

Installing

npm i @lotuz/jsminify

Usage

jsminify [OPTIONS] [FILE]

FILE must always come last

OPTIONS

  • -h, --help: For printing jsminify help
  • -v, --version: For printing jsminify version
  • -d, --debug: For debugging minification, also helpful for bug report
  • -o, --output: Sets the output file
  • (WIP) -c, --keep-comments: Keeps comments while minifying
  • (WIP) -b, --beautify: For pretty printing file

Building

Initialize git submodules with: git submodules init --recursive --update

Install node-gyp dependencies according to platform and run:

node-gyp configure node-gyp build

Debugging

Debugging relies on gdb

Change require inside index.js to the one with DEBUG in the path

node-gyp rebuild --debug gdb node run index.js [OPTIONS] [FILE]

Dependencies (all installed as git submodules under libs/)

tree-sitter tree-sitter-javascript tree-sitter-visitor hashmap

Publishing

  • Bump version on jsminify.c and package.json
  • Create git tag
  • Push tag
  • Wait for CI builds
  • run prebuildify-ci download
  • run npm publish

How I tested this (for now)

I used jsminify to minify:

  • angular.js
  • bootstrap.js
  • d3.js
  • ember.prod.js
  • htmlminifier.js
  • jquery-3.4.1.js
  • lodash.js
  • math.js
  • phaser.js
  • react.js
  • particles.js

then I used prettier to beautify the code and diffed the files against the same process done by Uglifyjs.

The diffs shows what other minifications are done by uglifyjs that could be implemented by jsminify, missing minificaiton opportunities and bugs.

Better tests are currently being written in test/

Improvements

Due to how tree-sitter works it might be possible to only re-minify edited parts of a file while developing. Not sure about this.

Roadmap

  • [ ] 1.0.0

    • [ ] MINIFICATION
      • [ ] Write article about jsminify 1.0.0
      • [x] Write enough tests for common javascript
      • [x] Improve scientific number printing
      • [x] Improve operator spacing
      • [x] Improve decimal digits precision printing: ECMA-256 only requires up to 21 digits. Chrome apparently crops at 16. So: 0.89081309152928522810 becomes 0.8908130915292852
      • [x] Remove comma dangle
      • [x] Check memory allocation/deallocation
      • [x] Check "includes"
      • [x] Test in Windows
      • [x] Test in Mac
  • [ ] 1.1.0

    • [ ] COMPRESSION
      • [ ] Transform scoped parameters identifiers in shorter versions. ex.: function(foo){foo()} => function(a){a()}
      • [ ] Remove unnecessary ";" on last statement in a block statement
    • [ ] BEAUTIFY (should this be part of jsminify or another minimal library?)
      • [ ] Ensure beatiful output