JSPM

offset-sourcemap-lines

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5803
  • Score
    100M100P100Q137185F
  • License MIT

offset each generated lines in SourceMap

Package Exports

  • offset-sourcemap-lines

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (offset-sourcemap-lines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

offset-sourcemap-lines

Offset each generated lines in SourceMap

Build Status NPM version Dependency Status License

DESCRIPTION

offset-sourcemap-lines is a module to generate new SourceMap object from original SourceMap with specified offset for each generated lines applied.

API

var offsettedMap = offsetLines(originalMap, offset)

var offsetLines = require('offset-sourcemap-lines');
var conv = require('convert-source-map');
var fs = require('fs');

var codeWithSourceMapComment = fs.readFileSync('/path/to/code-with-sourcemap-comment.js', 'utf-8');
var originalMap = conv.fromSource(codeWithSourceMapComment).toObject();

var header = '/**\n * \n * YOUR\n * CODE\n * HEADER\n */\n';
var offset = header.match(/\n/g).length;

var offsettedMap = offsetLines(originalMap, offset);

var codeBody = conv.removeComments(codeWithSourceMapComment);
var newSourceMapComment = conv.fromObject(offsettedMap).toComment();
console.log(header + codeBody + '\n' + newSourceMapComment);

INSTALL

$ npm install offset-sourcemap-lines

AUTHOR

LICENSE

Licensed under the MIT license.