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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@paulmillr/jsbt

v0.4.5

Published

JS Build Tools: build, benchmark, test libs and apps

Readme

@paulmillr/jsbt

JS Build Tools: helpers for building, benchmarking & testing secure JS apps.

  • 🏋🏻 bench: Benchmark JS projects with nanosecond resolution.
  • 🏗️ jsbt.js: Auto-produce single-file output for all package exports
  • 📝 test: Multi-env testing framework with familiar syntax & parallel execution
  • ⚙️ tsconfig: Strict typescript configs, friendly to type stripping
  • 🤖 workflows: Secure GitHub CI configs for testing & publishing JS packages.
  • 🪶 As minimal as possible, no dependencies

Used by noble cryptography and others.

Usage

npm install @paulmillr/jsbt

jsr add jsr:@paulmillr/jsbt

bench

Benchmark JS projects with nanosecond resolution.

  • Precise: 1ns resolution using process.hrtime
  • Lightweight: ~200 lines of code, no dependencies - to not interfere with benchmarked code
  • Readable: utilizes colors and nice units, shows rel. margin of error only if it's high
import bench from '@paulmillr/jsbt/bench.js';
(async () => {
  await bench('printing', () => Promise.resolve(0));
  await bench('base', () => Promise.resolve(1));
  await bench('sqrt', 10000, () => Math.sqrt(2));
})();

Example output:

getPublicKey x 6,072 ops/sec @ 164μs/op ± 8.22% [143μs..17ms]
sign x 4,980 ops/sec @ 200μs/op
verify x 969 ops/sec @ 1ms/op
recoverPublicKey x 890 ops/sec @ 1ms/op
getSharedSecret x 585 ops/sec @ 1ms/op

jsbt.js

jsbt.js calls esbuild to produce single-file package output.

Usage (add this as "build:release" step in package.json scripts section):

npx --no @paulmillr/jsbt esbuild test/build

The command would execute following subcommands and produce several files:

cd test/build
npm install
npx esbuild --bundle input.js --outfile=out/noble-hashes.js --global-name=nobleHashes
npx esbuild --bundle input.js --outfile=out/noble-hashes.min.js --global-name=nobleHashes --minify
wc -l < out/noble-hashes.js
wc -c < out/noble-hashes.min.js
gzip -c8 < out/noble-hashes.min.js > out/noble-hashes.min.js.gz
wc -c < out/noble-hashes.min.js.gz
rm out/noble-hashes.min.js.gz
shasum -a 256 out/*
# build done: test/build/input.js => test/build/out
# 64edcb68e6fe5924f37e65c9c38eee2a631f9aad6cba697675970bb4ca34fa41  noble-hashes.js
# 798f32aa84880b3e4fd7db77a5e3dd680c1aa166cc431141e18f61b467e8db18  noble-hashes.min.js

test

Multi-env testing framework with familiar syntax & parallel execution.

  • Familiar syntax: similar to Mocha / Jest / Vitest
  • Multi-env: runs on node.js, deno, bun, cloudflare, browsers and others
  • No "global" magic: it.run() in the end simplifies logic and browser runs
  • Parallel: easily run in node.js and bun
  • Great UI: beautiful tree reporter, optional "quiet" dot reporter

node a.test.js

MSHOULD_FAST=1 MSHOULD_QUIET=1 node a.test.js

import { should } from 'micro-should';
import { equal } from 'node:assert';
// Any assertion library can be used e.g. Chai or Expect.js
should('add', () => {
  equal(2 + 2, 4);
});
should('work in async env', async () => {
  equal(await Promise.resolve(123), 123);
});
describe('nested', () => {
  describe('nested 2', () => {
    should('multiply', () => {
      equal(2 * 2, 4);
    });
    should.skip('disable test by using skip', () => {
      equal(true, false); // skip
    });
    // should.only('execute only one test', () => {
    //   equal(true, true);
    // });
  });
});

should.runWhen(import.meta.url);
// or
// should.run();
// should.opts.STOP_AT_ERROR = false; // default=true
// should.opts.MSHOULD_QUIET = true; // same as env var

Usage:

  • should(title, case) or it(title, case) syntax to register a test function
  • should.only, should.skip allows to limit tests to one case / skip tests
  • beforeEach, afterEach execute code before / after function in describe block
  • should.runWhen(import.meta.url) must be executed in the end
    • The helper ensures tests are not ran when imported from other file
    • It compares import.meta.url to CLI argument
  • should.run() or it.run() must always be executed in the end

ENV variables, specifiable via command line or through code:

  • MSHOULD_FAST=1 enables parallel execution in node.js and Bun. Values >1 will set worker count.
  • MSHOULD_QUIET=1 enables "quiet" dot reporter

tsconfig

Strict typescript configs, friendly to type stripping.

  • tsconfig.test.json is for typescript tests, with looser checks

Option descriptions:

  • isolatedDeclarations ensures types are "fast" and friendly to JSR.io
  • verbatimModuleSyntax - ensures files are friendly to "type erasure" / "type ignore" node.js and others

workflows

Secure GitHub CI configs for testing & publishing JS packages.

The files reside in .github/workflows:

  • test-js.yml: runs tests on LTS node.js, bun, deno, linter, and calculates coverage
  • test-ts.yml: the same, but runs typescript instead of js on supported node.js (v22+) On node.js v20, it executes test:nodeold to compile files instead.
  • release.yml publishes package on NPM, JSR and creates single-file output if it exists
    • build-path: string - path to build directory, which contains out dir, from which files would be uploaded to github releases
    • slow-types: true / false (default) - whether to allow slow types on JSR.io

repo-template

Contains project skeleton, which can be used to create a new package. Replace EDIT_ME with proper value.

License

MIT License