You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
446 B

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