🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

source-map-support

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
n

source-map-support

Fixes stack traces for files with source maps

0.5.21
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

80

Maintenance

100

License

Version published
Weekly downloads
68M
3.26%
Maintainers
3
Weekly downloads
 
Created
Issues
127

What is source-map-support?

The source-map-support package provides source map support for stack traces in Node.js. This means that when an error stack trace is printed, it can show the original source locations instead of the transpiled or bundled code locations, which is especially useful when working with TypeScript or modern JavaScript that has been transpiled to an older version for compatibility.

What are source-map-support's main functionalities?

Error Stack Trace Remapping

By installing source-map-support, error stack traces will be remapped to the original source files. This is useful when debugging errors in transpiled or minified code.

require('source-map-support').install();
throw new Error('This is a test error');

Retrieve Original Source Position

This feature allows you to manually retrieve the original source position of a specific line and column in a compiled file.

const sourceMapSupport = require('source-map-support');
const position = sourceMapSupport.mapSourcePosition({
  source: 'compiled.js',
  line: 1,
  column: 100
});
console.log(position);

Retrieve Source Content

This feature enables you to retrieve the content of the original source file given the path to the compiled file.

const sourceMapSupport = require('source-map-support');
const content = sourceMapSupport.retrieveSource('compiled.js');
console.log(content);

Other packages similar to source-map-support

FAQs

Package last updated on 19 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts