Skip to content

Commit 96767e2

Browse files
committed
Fixes mishoo#563
Fixes mishoo#152 Somehow addresses mishoo#145 by preserving the original sources in the inSourceMap (if they are there)
1 parent a64bdda commit 96767e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/sourcemap.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ function SourceMap(options) {
5353
orig_line_diff : 0,
5454
dest_line_diff : 0,
5555
});
56-
var generator = new MOZ_SourceMap.SourceMapGenerator({
56+
var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);
57+
var generator = options.orig
58+
? MOZ_SourceMap.SourceMapGenerator.fromSourceMap(orig_map)
59+
: new MOZ_SourceMap.SourceMapGenerator({
5760
file : options.file,
5861
sourceRoot : options.root
5962
});
60-
var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);
6163
function add(source, gen_line, gen_col, orig_line, orig_col, name) {
6264
if (orig_map) {
6365
var info = orig_map.originalPositionFor({

0 commit comments

Comments
 (0)