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

@papit/build

v0.0.3

Published

Build tool for @papit packages — opinionated, fast, and designed to work seamlessly inside any Papit-based workspace.

Readme

@papit/build

Build tool for @papit packages — opinionated, fast, and designed to work seamlessly inside any Papit-based workspace.

This package is intended to be used from within another package, where you simply run:

npx @papit/build

and get a fully bundled JavaScript output plus rolled-up TypeScript declarations, with zero or minimal configuration.


Type Tests NPM version


Installation

npm install @papit/build

Or use it directly without installing:

npx @papit/build

This is the recommended usage.


Usage

Inside any package that follows the Papit conventions, simply run:

npx @papit/build

The build tool will:

  1. Detect entry points automatically
  2. Bundle JavaScript using esbuild
  3. Generate and roll up TypeScript declarations using TypeScript + API Extractor
  4. Respect package.json exports, bin, and custom entry definitions
  5. Output files into lib/
  6. Automatically handle CLI binaries (shebang + permissions)

What gets built?

JavaScript

  • Bundled via esbuild

  • Minified

  • Output format is determined by:

    • package.json → type (esm or cjs)
    • package.json → papit.type (node or browser)
  • External dependencies are automatically inferred from:

    • dependencies
    • peerDependencies

TypeScript declarations

  • Generated with tsc --emitDeclarationOnly
  • Rolled up into a single .d.ts file per entry
  • Powered by @microsoft/api-extractor

Entry points resolution

Entry points are resolved in the following order:

  1. --entry CLI flag
  2. package.json → entryPoints
  3. package.json → exports
  4. package.json → bin
  5. Fallback: src/index.ts

Examples

Using exports

{
  "exports": {
    ".": {
      "import": "./lib/bundle.js",
      "types": "./lib/bundle.d.ts"
    }
  }
}

This will map to:

src/index.ts → lib/bundle.js

CLI binaries

{
  "bin": {
    "@papit/build": "./lib/bundle.js"
  }
}

The build tool will:

  • Add the Node shebang automatically
  • Ensure executable permissions
  • Reinstall the bin when needed (non-CI only)

Configuration

.config (required)

A .config file must exist in the package root.

It is used to determine things like:

  • Target platform (node vs browser)
  • Template behavior
  • Build assumptions

If missing, the build will fail.


CLI Flags

| Flag | Description | | ----------- | ------------------------------------------ | | --dev | Use development mode | | --prod | Use production mode (default) | | --verbose | Show detailed build output | | --clean | Ignore cached build metadata | | --force | Force rebuild even if metadata exists | | --ci | CI mode (no bin reinstall, no cache write) | | --entry | Override entry points |


Caching & performance

  • Build metadata is cached in:

    .papit/build-meta/{dev|prod}.json
  • Cache is skipped when using:

    • --clean
    • --force
    • --ci

This keeps builds fast during local development.


Requirements

  • Node.js >= 18
  • TypeScript project

Contributing

Contributions are welcome! Please ensure:

  • Code follows existing patterns
  • Tests pass
  • Changes align with Papit conventions

Open a pull request when ready 🚀


License

Licensed under the @Papit License 1.0 Copyright (c) 2024 Henry Pap (@onkelhoy)

Key points:

  • ✅ Free to use in commercial projects
  • ✅ Free to modify and distribute
  • ✅ Attribution required
  • ❌ Cannot resell the component itself as a standalone product

See the LICENSE file for full details.


Support

For issues, questions, or contributions, please visit the GitHub repository.