File size: 557 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import { Promise } from 'sander';
import getMapFromUrl from './getMapFromUrl.js';
import getSourceMappingUrl from './getSourceMappingUrl.js';
export default function getMap ( node, sourceMapByPath, sync ) {
if ( node.file in sourceMapByPath ) {
const map = sourceMapByPath[ node.file ];
return sync ? map : Promise.resolve( map );
}
else {
const url = getSourceMappingUrl( node.content );
if ( !url ) {
node.isOriginalSource = true;
return sync ? null : Promise.resolve( null );
}
return getMapFromUrl( url, node.file, sync );
}
}
|