async function normalizeSourcePath(oldSource, relativePath, rootPath = process.cwd()) {
  const currentFilePath = /** @type {PathFromSystemRoot} */ (path.resolve(rootPath, relativePath));
  const currentDirPath = /** @type {PathFromSystemRoot} */ (path.dirname(currentFilePath));

  if (isRelativeSourcePath(oldSource) && relativePath) {
    // This will be a source like '../my/file.js' or './file.js'
    const resolvedPath = /** @type {PathFromSystemRoot} */ (
      await resolveImportPath(oldSource, currentFilePath)
    );
    return resolvedPath && toLocalPath(currentDirPath, resolvedPath);
  }
  // This will be a source from a project, like 'lion-based-ui/x.js' or '@open-wc/testing/y.js'
  return oldSource;
}
Resolves and converts to normalized local/absolute path, based on file-system information.
- from:  '../../relative/file'
- to: './src/relative/file.js'
@param {string} oldSource
@param {string} relativePath
@param {string} rootPath