From 42e3dc7a7094859c6b6c95f437f78d3e6057466b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 7 Mar 2015 02:28:33 +1100 Subject: [PATCH] inherit all options from input source map --- src/babel/transformation/file.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/babel/transformation/file.js b/src/babel/transformation/file.js index a6d2d1f4df..e4d0de2391 100644 --- a/src/babel/transformation/file.js +++ b/src/babel/transformation/file.js @@ -285,7 +285,7 @@ export default class File { var inputMap = convertSourceMap.fromSource(code); if (inputMap) { - opts.inputSourceMap = inputMap; + opts.inputSourceMap = inputMap.toObject(); code = convertSourceMap.removeComments(code); } @@ -479,14 +479,16 @@ export default class File { var inputMap = opts.inputSourceMap; if (inputMap) { + map.sources[0] = inputMap.file; + var inputMapConsumer = new sourceMap.SourceMapConsumer(inputMap); var outputMapConsumer = new sourceMap.SourceMapConsumer(map); var outputMapGenerator = sourceMap.SourceMapGenerator.fromSourceMap(outputMapConsumer); outputMapGenerator.applySourceMap(inputMapConsumer); var mergedMap = outputMapGenerator.toJSON(); - mergedMap.sources = map.sources - mergedMap.file = map.file; + mergedMap.sources = inputMap.sources + mergedMap.file = inputMap.file; return mergedMap; }