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

@luwiostack/registry

v0.1.0

Published

The shared registry + Vite auto-discovery primitive behind @luwiostack/router and @luwiostack/translations: a tiny module-singleton registry (add/get/all, dedup by id) and a Vite plugin factory that scans suffixed files and self-registers their exports.

Readme

@luwiostack/registry

The shared registry + Vite auto-discovery primitive behind @luwiostack/router and @luwiostack/translations. Two small pieces give a package the "define it in a file, and it registers itself" ergonomics:

  • createModuleRegistry({ idOf, match }) — a module-singleton registry: add / get / all / clear, dedup by id, and registerModules() to collect items out of bundler module namespaces.
  • createRegistryPlugin(config) — a Vite plugin factory that scans suffixed files (*.route, *.catalog, …) and emits a virtual module handing their exports to your registerModules. Lives at the Node-only ./vite subpath, so the runtime entry stays dependency-free.

Reach for it when a package's items are genuinely consumed as a whole set — the router must enumerate every route to match a URL, and @luwiostack/translations loads every catalog into its store. (@luwiostack/http deliberately does not build on this: an endpoint is a leaf you import and call, so it stays a plain callable with no registry.) You rarely install this directly — you use @luwiostack/router / @luwiostack/translations, which build on it.

The registry

import { createModuleRegistry } from '@luwiostack/registry'

interface RouteBuilder {
  id: string /* … */
}
const isRoute = (v: unknown): v is RouteBuilder => typeof v === 'object' && v !== null && 'id' in v

export const routeRegistry = createModuleRegistry<RouteBuilder>({
  idOf: (r) => r.id,
  match: isRoute,
  onDuplicate: 'throw', // 'replace' (console.warn + swap) is the other option
  label: 'route', // used in the error / warning text
})

Re-adding the same instance is always a silent no-op, so a factory that self-registers stays compatible with a plugin that re-collects the same exports. A different item on a taken id follows onDuplicate: 'throw' (default) or 'replace' (console.warn + swap).

The Vite plugin

Wrap the factory so your package exposes a named plugin with its own option names:

// @luwiostack/router/vite
import { createRegistryPlugin } from '@luwiostack/registry/vite'
import type { Plugin } from 'vite'

export function luwioRouter(options: { routesDir?: string } = {}): Plugin {
  return createRegistryPlugin({
    name: '@luwiostack/router',
    dir: options.routesDir ?? 'src',
    suffix: '.route',
    virtualId: 'virtual:@luwiostack/router/routes',
    registerImport: '@luwiostack/router', // must export `registerModules`
  })
}

The generated virtual module imports every *.route.{ts,tsx,js,jsx} under dir and passes them to registerModules. Editing, adding, or removing a matched file triggers a full reload so the registry rebuilds cleanly — keep matched files thin (export the item; put components elsewhere) for fast HMR.

API

| Export | What it does | | --- | --- | | createModuleRegistry({ idOf, match, onDuplicate?, label? }) | Build a registry: add / get / all / clear / registerModules. | | collectModules(modules, match) | Pull matching values (default + named exports) out of module namespaces. | | createRegistryPlugin(config) | (./vite) The Vite scanner that emits a self-registering virtual module. |