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

@whatitbroke/core

v1.0.4

Published

Core debug engine, stack parser, sourcemap resolver, timeline, and root-cause analyzer

Readme

@whatitbroke/core

Framework-Agnostic Core Debug Engine, Stack Trace Parser, Sourcemap Resolver, and Root-Cause Analyzer

npm version License: MIT

@whatitbroke/core is the central engine of the WhatItBroke ecosystem. It orchestrates framework adapters, decodes minified stack traces, records chronological execution timelines, computes deterministic root causes, generates unified diff patches, and outputs interactive HTML reports.


Installation

npm install @whatitbroke/core @whatitbroke/shared

Key Modules & APIs

1. WhatItBrokeCore

The central debugger orchestrator:

import { WhatItBrokeCore } from '@whatitbroke/core';

const debuggerInstance = new WhatItBrokeCore({
  maxTimelineEvents: 100,
  redact: ['password', 'authorization', 'token']
});

// Record execution steps
debuggerInstance.recordStep('Incoming HTTP request', 'api_request', { path: '/api/users' });

// Analyze an uncaught error
try {
  riskyOperation();
} catch (error) {
  const report = await debuggerInstance.analyze(error, {
    framework: 'node',
    environment: 'production'
  });

  console.log(report.rootCause.summary);
  console.log(report.fix.patch); // Unified code diff
}

2. StackParser

Cross-platform stack trace parser supporting V8 (Node, Chrome, Edge), Gecko (Firefox), and WebKit (Safari) traces:

import { StackParser } from '@whatitbroke/core';

const frames = StackParser.parse(error.stack);
console.log(frames[0]);
// {
//   file: '/src/services/user.service.ts',
//   line: 82,
//   column: 15,
//   methodName: 'UserService.getProfile',
//   isAsync: true,
//   isInternal: false
// }

// Automatically filter out node_modules and framework internals:
const primaryFrame = StackParser.getPrimaryFrame(frames);

3. SourceMapResolver

Decodes disk sourcemaps (.map) and inline base64 sourcemaps to extract original code snippets with line numbers:

import { SourceMapResolver } from '@whatitbroke/core';

const snippet = SourceMapResolver.extractSnippet({
  filePath: '/src/services/user.service.ts',
  targetLine: 82,
  contextLines: 3 // Surrounding lines
});

console.log(snippet);
// [
//   { line: 80, content: '    const user = await db.query(...);', isErrorLine: false },
//   { line: 81, content: '', isErrorLine: false },
//   { line: 82, content: '    return user.profile.name;', isErrorLine: true },
//   { line: 83, content: '  }', isErrorLine: false }
// ]

4. TimelineRecorder

Memory-bounded ring buffer tracking chronological events immediately preceding a crash:

import { TimelineRecorder } from '@whatitbroke/core';

const timeline = new TimelineRecorder(100);

timeline.record('request_start', 'GET /api/users/42');
timeline.recordDbQuery('SELECT * FROM users WHERE id = 42', 12, null); // Tracks empty result
timeline.record('exception', 'TypeError: Cannot read properties of undefined');

const events = timeline.getEvents();

5. RootCauseEngine & FixGenerator

Multi-stage causal heuristic analyzer:

import { RootCauseEngine, FixGenerator } from '@whatitbroke/core';

// Compute 4 questions: What, Where, Why, How
const rootCause = RootCauseEngine.analyze(debugContext);
const fix = FixGenerator.generate(rootCause, debugContext);

console.log(`Confidence: ${fix.confidence}%`);
console.log(`Explanation: ${fix.explanation}`);
console.log(`Patch:\n${fix.patch}`);

6. HtmlReporter

Exports standalone, zero-dependency interactive dark-mode HTML reports with embedded tabs:

import { HtmlReporter } from '@whatitbroke/core';

const html = HtmlReporter.generate(report);
fs.writeFileSync('whatitbroke-report.html', html);

License

MIT © WhatItBroke Team