If the input source map has inline source content (e.g. from Browserify in debug mode), copy that across to the new source map so it continues to be inline after minification.

This commit is contained in:
Andy Wood 2014-05-12 11:01:07 +01:00
parent 7bf59b5bcd
commit b2e9d5a02d

View File

@ -58,6 +58,15 @@ function SourceMap(options) {
sourceRoot : options.root
});
var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);
// Copy across inline sourcesContent, if any
if (options.orig.sourcesContent) {
var len = options.orig.sourcesContent.length;
for (var i = 0; i < len; i++) {
generator.setSourceContent(options.orig.sources[i], options.orig.sourcesContent[i]);
}
}
function add(source, gen_line, gen_col, orig_line, orig_col, name) {
if (orig_map) {
var info = orig_map.originalPositionFor({