UNPKG

446 BJavaScriptView Raw
1var path = require('path');
2
3function rebaseLocalMap(sourceMap, sourceUri, rebaseTo) {
4 var currentPath = path.resolve('');
5 var absoluteUri = path.resolve(currentPath, sourceUri);
6 var absoluteUriDirectory = path.dirname(absoluteUri);
7
8 sourceMap.sources = sourceMap.sources.map(function(source) {
9 return path.relative(rebaseTo, path.resolve(absoluteUriDirectory, source));
10 });
11
12 return sourceMap;
13}
14
15module.exports = rebaseLocalMap;