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

@lopatnov/namespace

v3.0.1

Published

Lightweight namespace kernel — service registry, event bus, scoped namespaces. Tree-shakeable pure functions, ES2024.

Readme

@lopatnov/namespace

npm license

Service registry, event bus, dependency injection, and scoped namespaces. Foundation for the @lopatnov ecosystem — works standalone or with any of the companion packages.

Install

npm install @lopatnov/namespace

Quick start

import { createNamespace, set, get, on } from '@lopatnov/namespace';

const ns = createNamespace();

set(ns, 'config.apiUrl', '/api/v1');
get<string>(ns, 'config.apiUrl'); // '/api/v1'

on(ns, 'change', (key, next, prev) => console.log(key, prev, '→', next));

App API (fluent)

import { createApp } from '@lopatnov/namespace';

const app = createApp()
  .use('config', { apiUrl: '/api/v1' })
  .use(RouterPlugin, { mode: 'hash' })
  .on('error', console.error);

const config = app.use<Config>('config'); // get

API

Service registry

| Function | Description | |----------|-------------| | createNamespace() | Create a new root namespace | | set(ns, key, value) | Store a value (supports dot-paths) | | get<T>(ns, key) | Retrieve a value | | has(ns, key) | Check existence | | remove(ns, key) | Delete a key | | keys(ns) | List all top-level keys | | entries(ns) | All [key, value] pairs |

Scoped namespaces

| Function | Description | |----------|-------------| | scope(ns, path) | Create / retrieve a child namespace | | root(ns) | Walk to the root | | parent(ns) | Parent namespace or null | | path(ns) | Dot-path from root |

Event bus

| Function | Description | |----------|-------------| | on(ns, event, handler) | Subscribe; returns unsubscribe function | | off(ns, event, handler) | Unsubscribe | | emit(ns, event, ...args) | Emit synchronously |

Built-in events: change, plugin:installed, plugin:uninstalled, router:before, router:after.

Serialisation

| Function | Description | |----------|-------------| | toJSON(ns) | Snapshot to plain object | | fromJSON(ns, json) | Restore from snapshot | | clone(ns) | Deep copy | | extend(ns, source) | Merge keys from object or another namespace |

App class

createApp() returns an App instance with a .ns namespace and a single use() method:

  • app.use(key) → get
  • app.use(key, value) → set (chainable)
  • app.use(plugin) → install plugin (chainable, idempotent)
  • app.use(plugin, options) → install plugin with options

Each createApp() is fully isolated — safe for micro-frontend pages sharing a document.

Ecosystem

| Package | Purpose | |---------|---------| | @lopatnov/namespace-router | SPA routing | | @lopatnov/namespace-plugin | Plugin system for pure-function users | | @lopatnov/namespace-storage | Persistent storage | | @lopatnov/namespace-guards | Route & service guards | | @lopatnov/namespace-mvvm | Reactive DOM bindings | | @lopatnov/namespace-pwa | PWA utilities | | @lopatnov/namespace-component | Reusable components | | @lopatnov/namespace-microfrontends | Cross-tab bus + leader election |

License

Apache-2.0 © lopatnov