Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

source-list-map

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Issues
File Explorer

Advanced tools

source-list-map

Fast line to line SourceMap generator.

    2.0.1latest

Version published
Maintainers
1
Weekly downloads
12,904,289
decreased by-1.81%

Weekly downloads

Changelog

Source

  • added LICENSE file
  • stylistic code changes

Readme

Source

source-list-map

API

Example

var SourceListMap = require("source-list-map").SourceListMap; // Create a new map var map = new SourceListMap(); // Add generated code that is map line to line to some soure map.add("Generated\ncode1\n", "source-code.js", "Orginal\nsource"); // Add generated code that isn't mapped map.add("Generated\ncode2\n"); // Get SourceMap and generated source map.toStringWithSourceMap({ file: "generated-code.js" }); // { // source: 'Generated\ncode1\nGenerated\ncode2\n', // map: { // version: 3, // file: 'generated-code.js', // sources: [ 'source-code.js' ], // sourcesContent: [ 'Orginal\nsource' ], // mappings: 'AAAA;AACA;;;' // } // } // Convert existing SourceMap into SourceListMap // (Only the first mapping per line is preserved) var fromStringWithSourceMap = require("source-list-map").fromStringWithSourceMap; var map = fromStringWithSourceMap("Generated\ncode", { version: 3, ... });

new SourceListMap()

SourceListMap.prototype.add

SourceListMap.prototype.add(generatedCode: string) SourceListMap.prototype.add(generatedCode: string, source: string, originalSource: string) SourceListMap.prototype.add(sourceListMap: SourceListMap)

Append some stuff.

SourceListMap.prototype.prepend

SourceListMap.prototype.prepend(generatedCode: string) SourceListMap.prototype.prepend(generatedCode: string, source: string, originalSource: string) SourceListMap.prototype.prepend(sourceListMap: SourceListMap)

Prepend some stuff.

SourceListMap.prototype.toString()

Get generated code.

SourceListMap.prototype.toStringWithSourceMap

SourceListMap.prototype.toStringWithSourceMap(options: object)

Get generated code and SourceMap. options can contains file property which defines the file property of the SourceMap.

SourceListMap.prototype.mapGeneratedCode

SourceListMap.prototype.mapGeneratedCode(fn: function) : SourceListMap

Applies fn to each generated code block (per line). The returned value is set as new generated code. Returns a new SourceListMap.

Removing and adding lines is supported. The SourceMap complexity will increase when doing this.

Test

Build Status

License

Copyright (c) 2017 JS Foundation

MIT (http://www.opensource.org/licenses/mit-license.php)

Keywords

FAQs

What is source-list-map?

Fast line to line SourceMap generator.

Is source-list-map popular?

The npm package source-list-map receives a total of 11,183,689 weekly downloads. As such, source-list-map popularity was classified as popular.

Is source-list-map well maintained?

We found that source-list-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 10 Oct 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc