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

@agentine/beacon

v0.1.0

Published

Drop-in replacement for debug — namespace-based debug logging for Node.js and browsers

Readme

@agentine/beacon

Drop-in replacement for debug. Namespace-based debug logging for Node.js and browsers with zero dependencies.

Install

npm install @agentine/beacon

Usage

const beacon = require('@agentine/beacon');
const log = beacon('app:server');

log('listening on port %d', 3000);
// app:server listening on port 3000 +0ms

ESM:

import beacon from '@agentine/beacon';
const log = beacon('app:server');

Enabling namespaces

Set the DEBUG environment variable:

DEBUG=app:* node app.js        # enable all app:* namespaces
DEBUG=app:server node app.js   # enable only app:server
DEBUG=*,-app:db node app.js    # enable all except app:db
DEBUG=app,db node app.js       # enable app and db

In the browser, use localStorage:

localStorage.debug = 'app:*';

API

beacon(namespace)

Create a debug function for the given namespace.

const debug = beacon('myapp:server');
debug('listening');        // only outputs if 'myapp:server' is enabled

beacon.enable(namespaces)

Enable debug output for the given namespace string.

beacon.enable('app:*');
beacon.enable('app:server,app:db');
beacon.enable('*,-app:secret');

beacon.disable()

Disable all namespaces. Returns the previously enabled namespaces string.

const prev = beacon.disable();

beacon.enabled(namespace)

Check if a namespace is enabled.

if (beacon.enabled('app:server')) {
  // ...
}

debug.extend(sub, [delimiter])

Create a sub-namespace.

const debug = beacon('app');
const server = debug.extend('server');  // app:server
const api = debug.extend('api', '/');   // app/api

debug.destroy()

Remove the debugger instance.

Format specifiers

  • %s — String
  • %d — Number
  • %o — Object (compact)
  • %O — Object (full)
  • %j — JSON (browser only)
  • %% — Literal %

Custom formatters

beacon.formatters.h = (v) => v.toString('hex');

const debug = beacon('app');
debug('buffer: %h', Buffer.from([0xde, 0xad]));
// app buffer: dead +0ms

beacon.humanize

Access the built-in ms parser/formatter:

beacon.humanize('1h');      // 3600000
beacon.humanize(60000);     // '1m'

Migrating from debug

Replace the package name in your imports:

- const debug = require('debug');
+ const debug = require('@agentine/beacon');

Or with ESM:

- import debug from 'debug';
+ import debug from '@agentine/beacon';

Everything else works the same — namespaces, environment variables, wildcards, formatters, and the full API are compatible with [email protected].

Environment variables

| Variable | Description | |---|---| | DEBUG | Comma/space-separated namespace patterns to enable | | DEBUG_COLORS | Force enable/disable colors (true/false) | | DEBUG_HIDE_DATE | Hide ISO date prefix in non-color mode (true/false) |

Features

  • Full [email protected] API compatibility
  • Zero dependencies (ms parsing is inlined)
  • CJS + ESM dual module
  • TypeScript type definitions included
  • Node.js: stderr output with 256-color support
  • Browser: console output with CSS colors
  • Automatic color assignment per namespace
  • Time deltas between log calls

License

MIT