From 96767e2f355647d8beba8334d4f5080e489b3328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C5=A3iu=20Macovei?= Date: Thu, 16 Oct 2014 22:27:07 +0300 Subject: [PATCH] Fixes #563 Fixes #152 Somehow addresses #145 by preserving the original sources in the inSourceMap (if they are there) --- lib/sourcemap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sourcemap.js b/lib/sourcemap.js index 663ef12e..4a314931 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -53,11 +53,13 @@ function SourceMap(options) { orig_line_diff : 0, dest_line_diff : 0, }); - var generator = new MOZ_SourceMap.SourceMapGenerator({ + var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); + var generator = options.orig + ? MOZ_SourceMap.SourceMapGenerator.fromSourceMap(orig_map) + : new MOZ_SourceMap.SourceMapGenerator({ file : options.file, sourceRoot : options.root }); - var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); function add(source, gen_line, gen_col, orig_line, orig_col, name) { if (orig_map) { var info = orig_map.originalPositionFor({