DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
raw
history blame
557 Bytes
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 );
}
}