Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Support inline source maps (#36)
Browse files Browse the repository at this point in the history
➕ inline source maps (fix #35)
  • Loading branch information
sshev authored and Kir Belevich committed Dec 23, 2016
1 parent 87700b6 commit 6caa1ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
var istanbulLibInstrument = require('istanbul-lib-instrument');
var loaderUtils = require('loader-utils');
var assign = require('object-assign');
var convert = require('convert-source-map');

module.exports = function(source, sourceMap) {
// use inline source map, if any
var inlineSourceMap = convert.fromSource(source);
if (!sourceMap && inlineSourceMap) {
sourceMap = inlineSourceMap.sourcemap;
}

var userOptions = loaderUtils.parseQuery(this.query);
var instrumenter = istanbulLibInstrument.createInstrumenter(
assign({ produceSourceMap: this.sourceMap }, userOptions)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"index.js"
],
"dependencies": {
"convert-source-map": "^1.3.0",
"istanbul-lib-instrument": "^1.1.3",
"loader-utils": "^0.2.16",
"object-assign": "^4.1.0"
Expand Down

0 comments on commit 6caa1ff

Please sign in to comment.