Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

source-map-support

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-support

Fixes stack traces for files with source maps

  • 0.5.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52M
decreased by-23.07%
Maintainers
3
Weekly downloads
 
Created

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc