source-list-map

WebJar for source-list-map

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

source-list-map
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

source-list-map
WebJar for source-list-map
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/webpack/source-list-map

Download source-list-map

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/source-list-map/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>source-list-map</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/source-list-map/
implementation 'org.webjars.npm:source-list-map:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/source-list-map/
implementation ("org.webjars.npm:source-list-map:2.0.1")
'org.webjars.npm:source-list-map:jar:2.0.1'
<dependency org="org.webjars.npm" name="source-list-map" rev="2.0.1">
  <artifact name="source-list-map" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='source-list-map', version='2.0.1')
)
libraryDependencies += "org.webjars.npm" % "source-list-map" % "2.0.1"
[org.webjars.npm/source-list-map "2.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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)

org.webjars.npm

webpack

Versions

Version
2.0.1
2.0.0
1.1.2
1.1.1
0.1.8
0.1.5