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

mapstrace

v1.0.0

Published

Print useful stack-traces for combined/minified/compiled files

Readme

Mapstrace

A really simple library for printing human-readable stack-traces for combined, minified and/or compiled javascript files.

It assumes that your javascript file(s) have source maps (index.js -> index.js.map etc).

For example the following stack-trace:

TypeError: Cannot read property 'length' of null
    at $extend.index (/Users/janekp/Documents/wixe/trunk/server/api/web/index.js:103:7)
    at Application.main.wixe1.route.ctx.template (/Users/janekp/Documents/wixe/trunk/server/api/web/index.js:12:24)
    at Object.wixe.Server.handle (/Users/janekp/Documents/wixe/trunk/server/api/web/index.js:253:5)
    at Object.handle (/Users/janekp/Documents/wixe/trunk/server/api/web/index.js:197:8)
    at next (/Users/janekp/Documents/wixe/trunk/server/api/web/node_modules/connect/lib/proto.js:190:15)
    at Function.app.handle (/Users/janekp/Documents/wixe/trunk/server/api/web/node_modules/connect/lib/proto.js:198:3)
    at Server.app (/Users/janekp/Documents/wixe/trunk/server/api/web/node_modules/connect/lib/connect.js:66:31)
    at Server.EventEmitter.emit (events.js:91:17)
    at HTTPParser.parser.onIncoming (http.js:1785:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)

becomes developer-friendly:

TypeError: Cannot read property 'length' of null:
    at 'if(x.length == 0) {' (.../trunk/server/api/src/RecipesPage.hx:45:25)
    at 'wixe.start(3000)' (.../trunk/server/api/src/Application.hx:18:26)
    at 'handler(ctx)' (.../server/api/src/wixe/Server.hx:290:23)
    at 'this.handle(req, res, next)' (.../server/api/src/wixe/Server.hx:306:37)
    ... (omitted 6 rows)

Installation and Dependencies

Install node.js for your platform

npm install source-map
npm install stack-trace

It can be used with or without Connect

var mapstrace = require('mapstrace');

// Connect
var connect = require('connect');
connect.createServer().use(connect.static('public')).use(mapstrace()).listen(3000);

// Stand-alone
mapstrace.build(err, true, function(result) {
    console.log(err.toString() + ':\n' + mapstrace.stringify(result));
});

The library can also be used to manually build a list of items and convert them into a string.

// err  - javascript Error object
// full - if true, then it will parse source files to fill missing fields.
// fn   - asynchronous callback that returns a list of items.
//        The list can contain objects and integers. Integers are used for unknown external items.
//        Every item has lineNumber, columnNumber, source and name fields.
mapstrace.build(err : Error, full : Bool, fn : Array -> Void) : Void;

// items  - A list of stack items (either numbers or objects).
// prefix - If not null then prefix is removed from paths. Optional, default is null
// limit  - The max number of path components. Optional, default is 5
// Returns a string.
mapstrace.stringify(items : Array, prefix : String, limit : Int) : String;