function replaceReferences(contents, migrationData, identifier) {
  return contents.replace(dottedIdentifier, (match) => {
    if (match.startsWith(identifier)) {
      return migrationData.newIdentifier + match.slice(identifier.length);
    }
    return match;
  });
}
Replaces references to where an import used to exist on the namespace tree
with references to the actual import (if any references are found).
@param {string} contents The string contents of the file to migrate.
@param {MigrationData} migrationData Data defining what to migrate and how.
@param {string} identifier The string to be replaced in the file contents.
@returns {string} The migrated contents of the file.