diff options
author | Martijn Swaagman <info@martijnswaagman.nl> | 2016-11-04 19:49:59 +0100 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-11-29 20:42:56 +0100 |
commit | 98f330658f5cd0dfb3004815d05f123f4110c2e0 (patch) | |
tree | 208ff5d9da4c2ea568cd22104ce0ffba635aacac /lib/sourcemap.js | |
parent | a7b3b0d3a55e2c48b63102dd111f27f8b9717788 (diff) | |
download | tracifyjs-98f330658f5cd0dfb3004815d05f123f4110c2e0.tar.gz tracifyjs-98f330658f5cd0dfb3004815d05f123f4110c2e0.zip |
Generate source map data from normalized files
If using `inSourceMap` this fix will ensure the copying of `sourcesContent` is based on potentially normalized `sources` values (https://github.com/mozilla/source-map/blob/master/lib/source-map-consumer.js#L304-L309).
For example `normalize` (https://github.com/mozilla/source-map/blob/master/lib/util.js#L80-L123) will rewrite `./dist/mySource.js` to `dist/mySource.js` in the target `_sources` of the `SourceMapConsumer`. As a result `orig_map.sourceContentFor(source, true);` would return `null` since the orginal `source` was no longer available in the consumer. By using the keys generating from the `SourceMapConsumer.constructor` consistency is ensured.
Diffstat (limited to 'lib/sourcemap.js')
-rw-r--r-- | lib/sourcemap.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sourcemap.js b/lib/sourcemap.js index 3714027e..0be16bfc 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -60,7 +60,7 @@ function SourceMap(options) { 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) { + orig_map._sources.toArray().forEach(function(source) { var sourceContent = orig_map.sourceContentFor(source, true); if (sourceContent) { generator.setSourceContent(source, sourceContent); |