code: function calculateNewBaseUrls(filePath, root, lookUp) {
    if (!path.isAbsolute(filePath)) {
      throw new Error(`Non-absolute path given to calculateNewBaseUrls: '${filePath}'`);
    }
    if (!pathIsInside(filePath, root)) {
      throw new Error(`Path given '${filePath}' is not in root '${root}'`);
    }
    function calculate(file, result) {
      if (file === root) {
        return { relative: path.relative(root, root), parent: root };
      }
      const parent = path.dirname(file);
      if (lookUp[parent] && result.length === 1) {
        return { relative: path.relative(parent, result[0]), parent };
      } else if (lookUp[parent]) {
        return calculate(parent, [parent]);
      }
      return calculate(parent, result);
    }
  
    return calculate(filePath, []);
  }
docs: /*
  Utils
   
  @throws Will throw an error if a non-absolute path or path outside the root is given