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

dumbug

v0.0.4

Published

A custom JavaScript instrumentation tool for detailed runtime logging

Readme

dumbug

The Zero-Config JavaScript Runtime Visualizer.

dumbug automates the process of debugging by instrumenting your code on the fly. It injects logging execution paths, variable states, and timing metrics without you having to write a single console.log.

It handles ES Modules, CommonJS, Async/Await flows, and Recursive calls with beautiful, indented, and colored output.


Features

  • Zero Setup: Runs directly via npx. No config files required.
  • Visual Call Stack: Auto-indents logs based on call depth.
  • Async Aware: Correctly tracks await points, measuring the duration of promises and maintaining indentation when execution resumes.
  • Data Inspection: Automatically color-codes and formats arguments and return values.
  • Granular Control: Use JSDoc-style annotations to trace specific files, functions, lines, or variables.
  • Line-by-Line Tracing: Option to log every single line of code executed within a function.
  • Variable Snapshots: Dump all local variables at any specific point in time.

Get Started

Method 1: The Quickest Way (npx)

Run any Node.js script immediately without installing anything:

npx dumbug path/to/script.js

Method 2: Global Installation

Install it globally to use the dumbug command anywhere:

npm install -g dumbug

dumbug server.js

Method 3: Local Dependency

Add it to your project for your team to use:

npm install --save-dev dumbug

Then add to your package.json scripts:

"scripts": {
  "debug": "dumbug src/index.js"
}

Annotations Guide

Control exactly what gets traced using simple comments.

1. File-Level Tracing

Add this to the top of any file to trace every function inside it.

/** @debug-file */

export function calculate(a, b) {
  return a + b;
}

2. Function-Level Tracing

Trace specific functions without enabling the whole file.

/** @debug-function */
function complexAlgo(data) {
  // Only this function entry/exit will be logged
  return process(data);
}

3. Step-by-Step Tracing

Log every executed line of code inside a function. Great for debugging control flow loops and conditionals.

/** @debug-function-step */
function loopTest() {
  for (let i = 0; i < 3; i++) {
    if (i === 1) continue;
    doWork(i);
  }
}

Output:

  entered loopTest() [file.js:10]
    step: for(let i=0; i<3; i++) [file.js:12]
    step: if(i===1) continue; [file.js:13]
    step: doWork(i); [file.js:14]
  exited loopTest returned undefined

4. Variable Dumping

Dump all locally visible variables (arguments, let, const, var) at a specific line. Objects are expanded (up to 128 chars) for easier reading.

function processUser(id) {
  const user = { name: "Alice", meta: { admin: true } };
  const active = true;

  // @debug-vars
  
  return user;
}

Output:

  local variables [file.js:5]
    active = true
    id = 42
    user = {"name":"Alice","meta":{"admin":true}}

5. Class Tracing

Trace all methods within a class.

/** @debug-class */
class UserService {
  constructor() { ... }
  find() { ... }
  delete() { ... }
}

The Output Format

dumbug uses a color-coded format to make logs readable:

  • Indentation: Represents the call stack depth.
  • Light Blue: Function names and executed code snippets.
  • Light Green: Return values and variable values.
  • Dimmed Gray: File paths, line numbers, and execution timing (5ms).
  • Orange: Thrown errors.

Example Output

entered main() [app.js:10]
  entered getUser(1) [services/user.js:5]
    #a1b2c awaiting db.find({id: 1}) [services/user.js:6]
    ----------------------------------------
    #a1b2c resumed getUser (15ms) [services/user.js:6]
  exited getUser returned {"id":1,"name":"Alice"} (16ms) [services/user.js:7]
  local variables [app.js:12]
    user = {"id":1,"name":"Alice"}
exited main returned undefined (20ms) [app.js:15]

How it Works

dumbug is a runtime instrumentation tool. When you run dumbug script.js:

  1. It spawns a Node.js child process.
  2. It hooks into Node's module loading system (via import loaders and require extensions).
  3. As files are loaded, it intercepts the source code.
  4. It uses Babel to parse the code into an AST (Abstract Syntax Tree).
  5. It inserts console.log statements with ANSI colors at entry points, exit points, await expressions, and annotation markers.
  6. The modified code is executed by Node.js.

This means you are debugging the actual code behavior without manually cluttering your source files with logs.


Limitations

  • Performance: Because every function call involves logging to stdout, execution will be slower. Do not use this in production.
  • Source Maps: Currently, line numbers point to the original source location, but stack traces from errors might slightly differ due to code injection.