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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bugsplat/stack-converter

v1.2.5

Published

[![bugsplat-github-banner-basic-outline](https://user-images.githubusercontent.com/20464226/149019306-3186103c-5315-4dad-a499-4fd1df408475.png)](https://bugsplat.com) <br/> # <div align="center">BugSplat</div> ### **<div align="center">Crash and error re

Downloads

14

Readme

bugsplat-github-banner-basic-outline

BugSplat

Crash and error reporting built for busy developers.

🥞 stack-converter

stack-converter is a utility for translating function names, file names and line numbers in uglified JavaScript Error stack frames to the corresponding values in the original source. stack-converter is distributed as both a package and a library and is used by the BugSplat backend to deliver crash reporting as a service for JavaScript and TypeScript applications.

The following is an example JavaScript Error stack converted to its TypeScript equivalent using stack-converter:

Error: BugSplat rocks!
    at crash (/Users/bobby/Desktop/bugsplat/stack-converter/dist/bin/cmd.js:16:11)
    at /Users/bobby/Desktop/bugsplat/stack-converter/dist/bin/cmd.js:6:9
    at Object.<anonymous> (/Users/bobby/Desktop/bugsplat/stack-converter/dist/bin/cmd.js:14:3)
Error: BugSplat rocks!
    at crash (../../bin/cmd.ts:15:10)
    at <unknown> (../../bin/cmd.ts:5:8)
    at Object.<anonymous> (../../bin/cmd.ts:12:2)

🖥 Command Line

  1. Install this package globally npm i -g @bugsplat/stack-converter
  2. Run stack-converter -h to see the latest usage information:
bobby@BugSplat % ~ % stack-converter -h

    @bugsplat/stack-converter contains a command line utility and set of libraries to help you demangle JavaScript stack frames.

    stack-converter command line usage:

        stack-converter [ [ "/source-map-directory" OR "/source.map.js" ] [ "/stack-trace.txt" ] ]
    
    * Optionally provide either a path to a directory containing source maps or a .map.js file - Defaults to current directory
    * Optionally provide a path to a .txt file containing a JavaScript Error stack trace - Defaults to value in clipboard
    
    ❤️ [email protected]
  1. Run stack-converter and optionally specify a path to a directory containing .map files, path to a single .map file, and a path to a .txt file containing a stringified JavaScript Error. If no options are provided stack-converter will default to looking in the current directory for source maps and attempt to read the stringified JavaScript error stack from the system clipboard.

🧩 API

  1. Install this package locally npm i @bugsplat/stack-converter
  2. Import StackConverter from @bugsplat/stack-converter
import { StackConverter } from '@bugsplat/stack-converter';
  1. Create a new instance of StackConverter passing it an array of paths to source map files. You can also await the static factory function createFromDirectory(directory: string): Promise<StackConverter> which takes a path to a directory and creates a new StackConverter with an array of source map file paths it finds in the specified directory
const converter = new StackConverter(sourceMapFilePaths);
const converter = await StackConverter.createFromDirectory(directory);
  1. Await the call to convert passing it the stack property from a JavaScript Error object
const result = await converter.convert(error.stack);

Thanks for using BugSplat!