2.0.1 • Published 6 years ago

source-list-map v2.0.1

Weekly downloads
12,141,276
License
MIT
Repository
github
Last release
6 years ago

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)

vuedragdropuploadimagespopsmart-common-auth@arisageha/react-lazyload@arisageha/react-lazyload-fixbb-chat@frxf/frxf@texttree/demo-bsa-reference-rcl@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewercthpb-plugin-socialjs4cytoscape@saaspe/componentssklif-ui-kitsklif-api@everything-registry/sub-chunk-2800@314oner_npm/universal-components-libraryp149-tablesklif-uireact-lightbox-pack-18supportdesign-system-fitbank-450demo-component-skyflyer86react-misc-toolboxsequelcomponentsearch-input-reactsearch-list-reactsipengine-modaleditorjs-alerticonssmtrstock-ticker-react-widgetstnenopmoc-iuspinjsera-ckeditor5start-starwars-libdfeuk-frontenddfeuk-frontend-manualdiscord.js-bycondiscordjs-con-selfreact-redux-demo1react-otp-input-uptddigital-keyboard-demoscrm-1.0.1qa_hddrtlcss-loaderrtl-css-loadersamc2samc3samc4samc5sam-carouselregression-external-dtoreactofy-css-libraryresponsis-gantt-task-reactresponsive-react-appreact-solid-gradient-pickerreact-websocketsreyhan-projecteasyplayer-mysolregex2ejs-nextcss-less-loadercss-loader-1css-loader-bbqcss-loader-cssclean-paramscss-loader-fixercss-loader-jnrdtcss-loader-xcss-loader-modify-kstn@ddder/css-loadercss-fast-loadercss-flat-loadercss-source-map-loadercanvas-fingerprintp147-tablep148-tablecampus-carosellocampus1campus2campus3campus4outils-rencar-cmp-2caropcarop2carop3carop4carousel-reactcarosello-campus-opacitacarosello-tribuscarosello-tribus-2case-gg-editor@beldore/react-otp-input@caneco/siemaperfect-css-loader@carhoo/widget-dealerspickupbiz-npm-package@cdevine49/react-numeric-inputplaykit-js-hls-sondq@southcn/ckeditor5-build-inline@synthit/nested-list
2.0.1

6 years ago

2.0.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

8 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago