Package: @agentine/beacon
Language: Node.js (JavaScript/TypeScript)
Replaces: debug (479M weekly downloads)
- Supply chain attack (Sept 2025): Maintainer's npm account was phished; malicious code was published to 2B+ weekly downstream installs for ~2 hours.
- Maintenance backlog: 62 open issues, 23 open PRs (some dating to 2017). Only 2 maintainers.
- No viable alternative:
debug-betterhas 1 download/week. No serious replacement exists. - Dependency risk: debug depends on
msfor time parsing — another single-maintainer package.
Drop-in replacement for debug@4.x with API compatibility. Zero external dependencies.
- Namespace-based debug output —
beacon('app:server')creates a debug function scoped to a namespace - Environment variable control —
DEBUG=app:*enables matching namespaces (wildcard/exclusion support) - Browser + Node.js — Universal module (CJS + ESM)
- Colorized output — Automatic color assignment per namespace (terminal + browser console)
- Time deltas — Millisecond diff between invocations shown inline
- Printf-style formatting —
%s,%d,%o,%O,%jformat specifiers - Custom formatters — Extensible formatter API
- Coerce values — Error objects display stack traces
- Inline
msparsing — No external dependency for time string parsing
src/
index.js # Entry point, namespace factory
common.js # Shared logic (createDebug, enable/disable, formatting)
node.js # Node.js-specific: stderr output, colors, env vars
browser.js # Browser-specific: console output, localStorage
ms.js # Inlined ms-style time parser/formatter
const beacon = require('@agentine/beacon');
const log = beacon('app:server');
log('listening on port %d', 3000);
beacon.enable('app:*');
beacon.disable();
beacon.enabled('app:server'); // boolean
beacon.formatters.h = (v) => v.toString('hex');- Full API compatibility with debug@4.x
- Zero dependencies (inline ms parsing)
- CJS + ESM dual module
- TypeScript type definitions
- Test suite covering all debug@4.x behavior
- README with migration guide
- Published to npm as
@agentine/beacon
- Custom transports/log levels (that's a logger, not debug)
- Structured logging / JSON output
- Log aggregation features