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

bini-export

v1.0.2

Published

Static SPA export for bini-router — pre-renders routes, generates 404.html, and strips platform files for GitHub Pages and other fully static hosts

Downloads

65

Readme

bini-export

npm version license vite bini-router typescript PRs Welcome

Pure static SPA export for bini-router projects.
Pre-renders every static route, generates the right 404.html, and strips all platform server files — leaving dist/ ready for GitHub Pages, S3, Firebase, Surge, and any other fully static host.


Install

npm install -D bini-export

Setup

1. vite.config.ts

import { defineConfig } from 'vite'
import react            from '@vitejs/plugin-react'
import { biniroute }    from 'bini-router'
import { biniExport }   from 'bini-export'

export default defineConfig({
  base: '/your-repo-name/', // 👈 see note below
  plugins: [
    react(),
    biniroute({ platform: 'node' }),
    biniExport(),
  ],
})

Do you need base?

| Situation | base | |---|---| | GitHub Pages without a custom domain | '/your-repo-name/' | | GitHub Pages with a custom domain | not needed — remove it | | S3, Firebase, Surge, or any other static host | not needed — remove it |

If you use the function form of defineConfig, base goes at the top level of the returned object:

export default defineConfig(({ command, mode }) => {
  return {
    base: '/your-repo-name/', // top-level, same level as plugins and build
    plugins: [ ... ],
    build: { ... },
  }
})

2. package.json

{
  "scripts": {
    "dev"    : "vite --host --open",
    "build"  : "vite build",
    "export" : "vite build --mode export",
    "preview": "vite preview --host --open"
  }
}

Usage

| Command | When to use | |---|---| | npm run build | Node servers, Netlify, Vercel, Cloudflare — any platform with server support | | npm run export | Fully static hosts — GitHub Pages, S3, Firebase, Surge, etc. |

Export output

dist/
  index.html
  about/
    index.html
  dashboard/
    index.html
  404.html

404 Handling

| Situation | What gets written to 404.html | |---|---| | src/app/not-found.tsx exists (also .jsx / .ts / .js) | A copy of index.html — React Router renders your custom not-found page | | No custom not-found file | A redirect script that saves the original URL and sends the user to the repo root, where the SPA restores it automatically |


Options

biniExport({
  cleanPaths: ['some/generated/file.ts'], // extra files to delete after export (default: [])
  mode      : 'export',                   // vite --mode flag that activates this plugin (default: 'export')
  copy404   : true,                       // write 404.html (default: true)
  prerender : true,                       // copy index.html into each route folder (default: true)
})

Files cleaned after export

| Platform | File(s) removed | |---|---| | Netlify | netlify/edge-functions/api.ts · api.js | | Cloudflare Workers | worker.ts · worker.js | | Node / Deno / Bun | server/index.ts · server/index.js | | AWS Lambda | handler.ts · handler.js | | Vercel | api/index.ts · api/index.js |

Empty parent directories are pruned automatically.


Works on any fully static host

| Host | Static routes | Dynamic routes | |---|---|---| | GitHub Pages | ✅ | ✅ via 404.html | | AWS S3 + CloudFront | ✅ | ✅ set error page to 404.html | | Firebase Hosting | ✅ | ✅ via 404.html | | Surge.sh | ✅ | ✅ via 404.html |


License

MIT © Binidu Ranasinghe