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

istanbul-lib-source-maps

Package Overview
Dependencies
Maintainers
0
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istanbul-lib-source-maps

Source maps support for istanbul

  • 5.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32M
increased by4.05%
Maintainers
0
Weekly downloads
 
Created

What is istanbul-lib-source-maps?

The istanbul-lib-source-maps package is used for handling source maps in the context of the Istanbul code coverage tool. It allows for the generation, manipulation, and consumption of source maps, which are files that map from the transformed source to the original source, enabling the accurate reporting of code coverage for projects that use transpilers or minifiers.

What are istanbul-lib-source-maps's main functionalities?

Source Map Consumption

This feature allows for the consumption of source maps by registering them with a source map store. This is useful for tools that need to map coverage information back to the original source files.

const sourceMaps = require('istanbul-lib-source-maps');
const mapStore = sourceMaps.createSourceMapStore();
mapStore.registerURL('compiled.js', 'compiled.js.map');

Source Map Generation

This feature enables the generation of source maps. It's particularly useful for developers who are compiling or transforming their code and need to produce source maps for accurate code coverage reporting.

const {SourceMapGenerator} = require('istanbul-lib-source-maps');
let generator = new SourceMapGenerator({file: 'output.js'});
generator.addMapping({
  generated: {line: 1, column: 0},
  source: 'input.js',
  original: {line: 1, column: 0}
});
let map = generator.toString();

Applying Source Maps to Coverage Data

This feature involves applying source maps to coverage data to remap coverage reports back to the original source code. This is crucial for accurate coverage reporting in projects that use transpilation or other code transformations.

const sourceMaps = require('istanbul-lib-source-maps');
const mapStore = sourceMaps.createSourceMapStore();
mapStore.registerURL('compiled.js', 'compiled.js.map');
const transformedCoverage = mapStore.transformCoverage(mapStore.loadCoverage(coverageObject));

Other packages similar to istanbul-lib-source-maps

Keywords

FAQs

Package last updated on 02 Jul 2024

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