replaceScript = async (scriptTag, { sourceScript, forceUpdate = false } = {}) => {
  sourceScript = sourceScript ?? scriptTag;

  if (!isScriptValid(scriptTag, forceUpdate)) return;
  if (sourceScript !== scriptTag && !isScriptValid(sourceScript, forceUpdate)) return;

  return swapScripts(scriptTag, sourceScript);
}
@param {HTMLScriptElement} scriptTag
@param {Function} onReplace