This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Micha Reiser
committed
Sep 6, 2016
1 parent
8d8d1f3
commit 1d0356b
Showing
2 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
'use strict'; | ||
|
||
var istanbul = require('istanbul'); | ||
var istanbulLibInstrument = require('istanbul-lib-instrument'); | ||
var loaderUtils = require('loader-utils'); | ||
var assign = require('object-assign'); | ||
|
||
var defaultOptions = { | ||
embedSource: true, | ||
noAutoWrap: true | ||
autoWrap: true | ||
}; | ||
|
||
module.exports = function(source) { | ||
module.exports = function(source, sourceMap) { | ||
var userOptions = loaderUtils.parseQuery(this.query); | ||
var instrumenter = new istanbul.Instrumenter( | ||
assign({}, defaultOptions, userOptions) | ||
var instrumenter = istanbulLibInstrument.createInstrumenter( | ||
assign({ produceSourceMap: this.sourceMap }, defaultOptions, userOptions) | ||
); | ||
|
||
if (this.cacheable) { | ||
this.cacheable(); | ||
} | ||
|
||
return instrumenter.instrumentSync(source, this.resourcePath); | ||
var that = this; | ||
return instrumenter.instrument(source, this.resourcePath, function (error, source) { | ||
that.callback(error, source, instrumenter.lastSourceMap()); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,21 @@ | |
"name": "istanbul-instrumenter-loader", | ||
"version": "0.2.0", | ||
"description": "Istanbul instrumenter loader for webpack", | ||
"keywords": [ "webpack", "loader", "istanbul", "coverage" ], | ||
"keywords": [ | ||
"webpack", | ||
"loader", | ||
"istanbul", | ||
"coverage" | ||
], | ||
"homepage": "https://github.com/deepsweet/istanbul-instrumenter-loader", | ||
"repository": "deepsweet/istanbul-instrumenter-loader", | ||
"author": "Kir Belevich <[email protected]> (https://github.com/deepsweet)", | ||
"main": "index.js", | ||
"files": [ "index.js" ], | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"istanbul": "0.x.x", | ||
"istanbul-lib-instrument": "^1.1.1", | ||
"loader-utils": "0.x.x", | ||
"object-assign": "4.x.x" | ||
}, | ||
|