getMatchingPatternAndReplacement = (source, fileDir, packageDir, importMap) => {
  const [pattern, replacement] =
    Object.entries(importMap).find(([key]) => source.includes(key)) || [];
  if (!pattern || !replacement) {
    return { pattern: '', replacement: '' };
  }
  const fileToPackageRelativeDir = path.relative(fileDir, packageDir) || '.';
  // TODO: Is there a case where replacement does not start with ./, check spec.
  const updatedReplacement = replacement.replace('./', `${fileToPackageRelativeDir}/`);
  return { pattern, replacement: updatedReplacement };
}
Gets the matching pattern and replacement from importMap for the given source

@param {string} source
@param {string} fileDir
@param {string} packageDir
@param {object} importMap
@returns