|
|
@ -1,8 +1,14 @@ |
|
|
|
import { decode } from 'sourcemap-codec'; |
|
|
|
|
|
|
|
export default function transform ( source, id, plugins ) { |
|
|
|
const sourceMapChain = []; |
|
|
|
|
|
|
|
const originalSourceMap = typeof source.map === 'string' ? JSON.parse( source.map ) : source.map; |
|
|
|
|
|
|
|
if ( originalSourceMap && typeof originalSourceMap.mappings === 'string' ) { |
|
|
|
originalSourceMap.mappings = decode( originalSourceMap.mappings ); |
|
|
|
} |
|
|
|
|
|
|
|
const originalCode = source.code; |
|
|
|
let ast = source.ast; |
|
|
|
|
|
|
@ -25,6 +31,10 @@ export default function transform ( source, id, plugins ) { |
|
|
|
result.map = JSON.parse( result.map ); |
|
|
|
} |
|
|
|
|
|
|
|
if ( result.map && typeof result.map.mappings === 'string' ) { |
|
|
|
result.map.mappings = decode( result.map.mappings ); |
|
|
|
} |
|
|
|
|
|
|
|
sourceMapChain.push( result.map || { missing: true, plugin: plugin.name }); // lil' bit hacky but it works
|
|
|
|
ast = result.ast; |
|
|
|
|
|
|
|