diff options
author | Lauri Pokka <larpo@iki.fi> | 2016-07-05 02:06:14 +0900 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-07-17 19:36:15 +0200 |
commit | 41a9329409ca0f1273b6ccdcc9770713f44ec55a (patch) | |
tree | d310b22a0beac37397dd3c6314851b2406415893 /lib | |
parent | 7eb52d2837c9d77a389457ae84bfddd28f86cf27 (diff) | |
download | tracifyjs-41a9329409ca0f1273b6ccdcc9770713f44ec55a.tar.gz tracifyjs-41a9329409ca0f1273b6ccdcc9770713f44ec55a.zip |
lib/sourcemap.js: Copy sourceContent from old souce-map to the new source-map. Should fix #882
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sourcemap.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sourcemap.js b/lib/sourcemap.js index e5d7df60..3714027e 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -58,6 +58,16 @@ function SourceMap(options) { sourceRoot : options.root }); var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); + + if (orig_map && Array.isArray(options.orig.sources)) { + options.orig.sources.forEach(function(source) { + var sourceContent = orig_map.sourceContentFor(source, true); + if (sourceContent) { + generator.setSourceContent(source, sourceContent); + } + }); + } + function add(source, gen_line, gen_col, orig_line, orig_col, name) { if (orig_map) { var info = orig_map.originalPositionFor({ |