Skip to content

Reads a source file and extracts a sourcemap for consumption (inline or external)

License

Notifications You must be signed in to change notification settings

rexxars/load-source-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

load-source-map

Version npm

Given a source file location, will load any referenced (or inline) source map.
Result is a SourceMapConsumer.

Installation

$ npm install --save load-source-map

Usage

var loadSourceMap = require('load-source-map')

loadSourceMap(__filename, function (err, sourcemap) {
  if (err) {
    throw err
  }

  if (!sourcemap) {
    // No source map found
    return
  }

  console.log(sourcemap.originalPositionFor({
    line: 3,
    column: 10,
  }))

  // { source: 'some-file.js',
  //   line: 2,
  //   column: 2,
  //   name: null }
})

License

MIT-licensed. See LICENSE.

About

Reads a source file and extracts a sourcemap for consumption (inline or external)

Resources

License

Stars

Watchers

Forks