You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

combine-source-map

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combine-source-map

Add source maps of multiple files, offset them and then combine them into one source map

0.8.0
latest
Version published
Weekly downloads
1.4M
15.76%
Maintainers
2
Weekly downloads
 
Created

What is combine-source-map?

The combine-source-map npm package is used to create and modify source maps, which are files that map from the transformed source to the original source, allowing developers to debug their code more easily. This package is particularly useful when dealing with multiple source files that need to be combined into a single file, while still maintaining accurate source maps.

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

Create a new source map

This feature allows you to create a new source map for a given file. In this example, a new source map is created for 'bundle.js'.

const combine = require('combine-source-map');
const map = combine.create('bundle.js');
console.log(map);

Add a file to the source map

This feature allows you to add a file to the source map. In this example, 'file1.js' is added to the source map with its content and starting line number.

const combine = require('combine-source-map');
const map = combine.create('bundle.js');
map.addFile({ sourceFile: 'file1.js', source: 'console.log("file1");' }, { line: 0 });
console.log(map);

Generate the source map

This feature allows you to generate the source map in base64 format. In this example, after adding 'file1.js' to the source map, the source map is generated and logged in base64 format.

const combine = require('combine-source-map');
const map = combine.create('bundle.js');
map.addFile({ sourceFile: 'file1.js', source: 'console.log("file1");' }, { line: 0 });
const sourceMap = map.base64();
console.log(sourceMap);

Other packages similar to combine-source-map

FAQs

Package last updated on 20 Mar 2017

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