Skip to content

alloc/resolve-stack-sources

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resolve-stack-sources

Rewrite a stack trace with source maps. This package was extracted from wrangler to be used by other frameworks.

pnpm add resolve-stack-sources

Usage

import { getSourceMappedString } from 'resolve-stack-sources'

const sourceMappedStackTrace = getSourceMappedString(error.stack)
// => string

You may pass a custom retrieveSourceMap function to the getSourceMappedString function.

import { getSourceMappedString } from 'resolve-stack-sources'

function retrieveSourceMap(source: string) {
  // The `source` is the path to the source file.
  // You must return either null or a { url, map } object.
}

const sourceMappedStackTrace = getSourceMappedString(
  error.stack,
  retrieveSourceMap
)

About

Resolve source files in a stack trace using sourcemaps.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published