function toESModules(source) {
  if (typeof source !== 'string') {
    return source;
  }

  return replaceRequires(replaceModuleExports(source));
}
Convert CommonJS exports to ES modules exports
@param source Source code to convert
@returns The converted source code