Urara-Blog/node_modules/.pnpm-store/v3/files/d3/79a89c1ba8d3fe382a7982d470264ea3940fd0e8b3694582d572106bba13bae8db6a002a59dec4bb6b635c6f3e59dca04dd6a97347d18713c1b305eaf7c94a
2022-08-14 01:14:53 +08:00

21 lines
557 B
Text

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 );
}
}