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B,oBACvB,GACA,uBAAuB,QAAQ,EAAW,IAE7C,MAAK,EAAG,OAAM,WAAU,cAChB,KAAK,gBAAgB,EAAU,EAAM,EAA2B,CACrE,WACA,eAMH,MAAM,IACL,MAAM,EAAa,CAAE,OAAM,OAAQ,KAAM,cACzC,OAAO,kBAAkB,oBAAoB,GAC1C,WAAW,QAAQ,GACnB,MAAM,GAAW,EAAO,MAAK,IAEjC,OAAO,IAGN,EAAY,OAAO,KACjB,IAAI,MAAM,YAAY,EAAK,EAAS,SAAS,aAExC,KAAK,QAAQ,WAChB,YAAY,EAAK,EAAS,SAAS,SACnC,WAEL,MAAM,IACL,MAAM,EAAW,EAAW,QAC1B,4BACA,QAAQ,QAAQ,WACd,CAAC,EAAO,IAAY,eAAe,MACnC,wCAGE,EAAmB,KAAK,8BAC5B,EACA,EACA,EACA,GAEI,EAAS,IAAI,EAAS,QAAQ,QAAQ,UAAU,GAAM,GAU5D,OAPA,EAAY,UACV,EAAiB,KACjB,EACA,EAAiB,MAEnB,EAAsB,KAAK,CAAE,KAAM,EAAiB,KAAM,WAEnD,EAAiB,IAAI,IAE7B,MAAM,GACL,kBAAkB,oBAAoB,GACnC,UAAU,QAAQ,CACjB,WAAY,EACZ,OAAQ,OAET,OAAO,IAEL,KAAW,OAAE,MAAM,GACb,QAER,MAAK,IAAM,SAKF,MAAK,KACnB,GAAU,GAEd,EAiBF,SAAS,4BAA4B,EAAa,EAAQ,EAAW,GACnE,MAAO,CACL,YAAa,EACb,cAAe,EAAY,QAC3B,kBAAmB,CACjB,KAAM,EACN,MAAO,EACP,QAAS,GAGf,CAMA,kBAAkB,QAAU,EAQ5B,kBAAkB,SAAW,kBAAkB,oBAC/C,kBAAkB,oBAAsB,oBAExC,OAAO,QAAU","file":"/npm/html-webpack-plugin@5.6.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/html-webpack-plugin@5.6.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// @ts-check\n\"use strict\";\n\nconst promisify = require(\"util\").promisify;\n\nconst vm = require(\"vm\");\nconst fs = require(\"fs\");\nconst _uniq = require(\"lodash/uniq\");\nconst path = require(\"path\");\nconst { CachedChildCompilation } = require(\"./lib/cached-child-compiler\");\n\nconst {\n  createHtmlTagObject,\n  htmlTagObjectToString,\n  HtmlTagArray,\n} = require(\"./lib/html-tags\");\nconst prettyError = require(\"./lib/errors.js\");\nconst chunkSorter = require(\"./lib/chunksorter.js\");\nconst { AsyncSeriesWaterfallHook } = require(\"tapable\");\n\n/** @typedef {import(\"./typings\").HtmlTagObject} HtmlTagObject */\n/** @typedef {import(\"./typings\").Options} HtmlWebpackOptions */\n/** @typedef {import(\"./typings\").ProcessedOptions} ProcessedHtmlWebpackOptions */\n/** @typedef {import(\"./typings\").TemplateParameter} TemplateParameter */\n/** @typedef {import(\"webpack\").Compiler} Compiler */\n/** @typedef {import(\"webpack\").Compilation} Compilation */\n/** @typedef {Required<Compilation[\"outputOptions\"][\"publicPath\"]>} PublicPath */\n/** @typedef {ReturnType<Compiler[\"getInfrastructureLogger\"]>} Logger */\n/** @typedef {Compilation[\"entrypoints\"] extends Map<string, infer I> ? I : never} Entrypoint */\n/** @typedef {Array<{ name: string, source: import('webpack').sources.Source, info?: import('webpack').AssetInfo }>} PreviousEmittedAssets */\n/** @typedef {{ publicPath: string, js: Array<string>, css: Array<string>, manifest?: string, favicon?: string }} AssetsInformationByGroups */\n/** @typedef {import(\"./typings\").Hooks} HtmlWebpackPluginHooks */\n/**\n * @type {WeakMap<Compilation, HtmlWebpackPluginHooks>}}\n */\nconst compilationHooksMap = new WeakMap();\n\nclass HtmlWebpackPlugin {\n  // The following is the API definition for all available hooks\n  // For the TypeScript definition, see the Hooks type in typings.d.ts\n  /**\n   beforeAssetTagGeneration:\n   AsyncSeriesWaterfallHook<{\n      assets: {\n        publicPath: string,\n        js: Array<string>,\n        css: Array<string>,\n        favicon?: string | undefined,\n        manifest?: string | undefined\n      },\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   alterAssetTags:\n   AsyncSeriesWaterfallHook<{\n      assetTags: {\n        scripts: Array<HtmlTagObject>,\n        styles: Array<HtmlTagObject>,\n        meta: Array<HtmlTagObject>,\n      },\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   alterAssetTagGroups:\n   AsyncSeriesWaterfallHook<{\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      publicPath: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>,\n   afterTemplateExecution:\n   AsyncSeriesWaterfallHook<{\n      html: string,\n      headTags: Array<HtmlTagObject | HtmlTagObject>,\n      bodyTags: Array<HtmlTagObject | HtmlTagObject>,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>,\n   beforeEmit:\n   AsyncSeriesWaterfallHook<{\n      html: string,\n      outputName: string,\n      plugin: HtmlWebpackPlugin,\n    }>,\n   afterEmit:\n   AsyncSeriesWaterfallHook<{\n      outputName: string,\n      plugin: HtmlWebpackPlugin\n    }>\n   */\n\n  /**\n   * Returns all public hooks of the html webpack plugin for the given compilation\n   *\n   * @param {Compilation} compilation\n   * @returns {HtmlWebpackPluginHooks}\n   */\n  static getCompilationHooks(compilation) {\n    let hooks = compilationHooksMap.get(compilation);\n\n    if (!hooks) {\n      hooks = {\n        beforeAssetTagGeneration: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        alterAssetTags: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        alterAssetTagGroups: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        afterTemplateExecution: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        beforeEmit: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n        afterEmit: new AsyncSeriesWaterfallHook([\"pluginArgs\"]),\n      };\n      compilationHooksMap.set(compilation, hooks);\n    }\n\n    return hooks;\n  }\n\n  /**\n   * @param {HtmlWebpackOptions} [options]\n   */\n  constructor(options) {\n    /** @type {HtmlWebpackOptions} */\n    // TODO remove me in the next major release\n    this.userOptions = options || {};\n    this.version = HtmlWebpackPlugin.version;\n\n    // Default options\n    /** @type {ProcessedHtmlWebpackOptions} */\n    const defaultOptions = {\n      template: \"auto\",\n      templateContent: false,\n      templateParameters: templateParametersGenerator,\n      filename: \"index.html\",\n      publicPath:\n        this.userOptions.publicPath === undefined\n          ? \"auto\"\n          : this.userOptions.publicPath,\n      hash: false,\n      inject: this.userOptions.scriptLoading === \"blocking\" ? \"body\" : \"head\",\n      scriptLoading: \"defer\",\n      compile: true,\n      favicon: false,\n      minify: \"auto\",\n      cache: true,\n      showErrors: true,\n      chunks: \"all\",\n      excludeChunks: [],\n      chunksSortMode: \"auto\",\n      meta: {},\n      base: false,\n      title: \"Webpack App\",\n      xhtml: false,\n    };\n\n    /** @type {ProcessedHtmlWebpackOptions} */\n    this.options = Object.assign(defaultOptions, this.userOptions);\n  }\n\n  /**\n   *\n   * @param {Compiler} compiler\n   * @returns {void}\n   */\n  apply(compiler) {\n    this.logger = compiler.getInfrastructureLogger(\"HtmlWebpackPlugin\");\n\n    const options = this.options;\n\n    options.template = this.getTemplatePath(\n      this.options.template,\n      compiler.context,\n    );\n\n    // Assert correct option spelling\n    if (\n      options.scriptLoading !== \"defer\" &&\n      options.scriptLoading !== \"blocking\" &&\n      options.scriptLoading !== \"module\" &&\n      options.scriptLoading !== \"systemjs-module\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        'The \"scriptLoading\" option need to be set to \"defer\", \"blocking\" or \"module\" or \"systemjs-module\"',\n      );\n    }\n\n    if (\n      options.inject !== true &&\n      options.inject !== false &&\n      options.inject !== \"head\" &&\n      options.inject !== \"body\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        'The `inject` option needs to be set to true, false, \"head\" or \"body',\n      );\n    }\n\n    if (\n      this.options.templateParameters !== false &&\n      typeof this.options.templateParameters !== \"function\" &&\n      typeof this.options.templateParameters !== \"object\"\n    ) {\n      /** @type {Logger} */\n      (this.logger).error(\n        \"The `templateParameters` has to be either a function or an object or false\",\n      );\n    }\n\n    // Default metaOptions if no template is provided\n    if (\n      !this.userOptions.template &&\n      options.templateContent === false &&\n      options.meta\n    ) {\n      options.meta = Object.assign(\n        {},\n        options.meta,\n        {\n          // TODO remove in the next major release\n          // From https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag\n          viewport: \"width=device-width, initial-scale=1\",\n        },\n        this.userOptions.meta,\n      );\n    }\n\n    // entryName to fileName conversion function\n    const userOptionFilename =\n      this.userOptions.filename || this.options.filename;\n    const filenameFunction =\n      typeof userOptionFilename === \"function\"\n        ? userOptionFilename\n        : // Replace '[name]' with entry name\n          (entryName) => userOptionFilename.replace(/\\[name\\]/g, entryName);\n\n    /** output filenames for the given entry names */\n    const entryNames = Object.keys(compiler.options.entry);\n    const outputFileNames = new Set(\n      (entryNames.length ? entryNames : [\"main\"]).map(filenameFunction),\n    );\n\n    // Hook all options into the webpack compiler\n    outputFileNames.forEach((outputFileName) => {\n      // Instance variables to keep caching information for multiple builds\n      const assetJson = { value: undefined };\n      /**\n       * store the previous generated asset to emit them even if the content did not change\n       * to support watch mode for third party plugins like the clean-webpack-plugin or the compression plugin\n       * @type {PreviousEmittedAssets}\n       */\n      const previousEmittedAssets = [];\n\n      // Inject child compiler plugin\n      const childCompilerPlugin = new CachedChildCompilation(compiler);\n\n      if (!this.options.templateContent) {\n        childCompilerPlugin.addEntry(this.options.template);\n      }\n\n      // convert absolute filename into relative so that webpack can\n      // generate it at correct location\n      let filename = outputFileName;\n\n      if (path.resolve(filename) === path.normalize(filename)) {\n        const outputPath =\n          /** @type {string} - Once initialized the path is always a string */ (\n            compiler.options.output.path\n          );\n\n        filename = path.relative(outputPath, filename);\n      }\n\n      compiler.hooks.thisCompilation.tap(\n        \"HtmlWebpackPlugin\",\n        /**\n         * Hook into the webpack compilation\n         * @param {Compilation} compilation\n         */\n        (compilation) => {\n          compilation.hooks.processAssets.tapAsync(\n            {\n              name: \"HtmlWebpackPlugin\",\n              stage:\n                /**\n                 * Generate the html after minification and dev tooling is done\n                 */\n                compiler.webpack.Compilation\n                  .PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,\n            },\n            /**\n             * Hook into the process assets hook\n             * @param {any} _\n             * @param {(err?: Error) => void} callback\n             */\n            (_, callback) => {\n              this.generateHTML(\n                compiler,\n                compilation,\n                filename,\n                childCompilerPlugin,\n                previousEmittedAssets,\n                assetJson,\n                callback,\n              );\n            },\n          );\n        },\n      );\n    });\n  }\n\n  /**\n   * Helper to return the absolute template path with a fallback loader\n   *\n   * @private\n   * @param {string} template The path to the template e.g. './index.html'\n   * @param {string} context The webpack base resolution path for relative paths e.g. process.cwd()\n   */\n  getTemplatePath(template, context) {\n    if (template === \"auto\") {\n      template = path.resolve(context, \"src/index.ejs\");\n      if (!fs.existsSync(template)) {\n        template = path.join(__dirname, \"default_index.ejs\");\n      }\n    }\n\n    // If the template doesn't use a loader use the lodash template loader\n    if (template.indexOf(\"!\") === -1) {\n      template =\n        require.resolve(\"./lib/loader.js\") +\n        \"!\" +\n        path.resolve(context, template);\n    }\n\n    // Resolve template path\n    return template.replace(\n      /([!])([^/\\\\][^!?]+|[^/\\\\!?])($|\\?[^!?\\n]+$)/,\n      (match, prefix, filepath, postfix) =>\n        prefix + path.resolve(filepath) + postfix,\n    );\n  }\n\n  /**\n   * Return all chunks from the compilation result which match the exclude and include filters\n   *\n   * @private\n   * @param {any} chunks\n   * @param {string[]|'all'} includedChunks\n   * @param {string[]} excludedChunks\n   */\n  filterEntryChunks(chunks, includedChunks, excludedChunks) {\n    return chunks.filter((chunkName) => {\n      // Skip if the chunks should be filtered and the given chunk was not added explicity\n      if (\n        Array.isArray(includedChunks) &&\n        includedChunks.indexOf(chunkName) === -1\n      ) {\n        return false;\n      }\n\n      // Skip if the chunks should be filtered and the given chunk was excluded explicity\n      if (\n        Array.isArray(excludedChunks) &&\n        excludedChunks.indexOf(chunkName) !== -1\n      ) {\n        return false;\n      }\n\n      // Add otherwise\n      return true;\n    });\n  }\n\n  /**\n   * Helper to sort chunks\n   *\n   * @private\n   * @param {string[]} entryNames\n   * @param {string|((entryNameA: string, entryNameB: string) => number)} sortMode\n   * @param {Compilation} compilation\n   */\n  sortEntryChunks(entryNames, sortMode, compilation) {\n    // Custom function\n    if (typeof sortMode === \"function\") {\n      return entryNames.sort(sortMode);\n    }\n    // Check if the given sort mode is a valid chunkSorter sort mode\n    if (typeof chunkSorter[sortMode] !== \"undefined\") {\n      return chunkSorter[sortMode](entryNames, compilation, this.options);\n    }\n    throw new Error('\"' + sortMode + '\" is not a valid chunk sort mode');\n  }\n\n  /**\n   * Encode each path component using `encodeURIComponent` as files can contain characters\n   * which needs special encoding in URLs like `+ `.\n   *\n   * Valid filesystem characters which need to be encoded for urls:\n   *\n   * # pound, % percent, & ampersand, { left curly bracket, } right curly bracket,\n   * \\ back slash, < left angle bracket, > right angle bracket, * asterisk, ? question mark,\n   * blank spaces, $ dollar sign, ! exclamation point, ' single quotes, \" double quotes,\n   * : colon, @ at sign, + plus sign, ` backtick, | pipe, = equal sign\n   *\n   * However the query string must not be encoded:\n   *\n   *  fo:demonstration-path/very fancy+name.js?path=/home?value=abc&value=def#zzz\n   *    ^             ^    ^    ^     ^    ^  ^    ^^    ^     ^   ^     ^   ^\n   *    |             |    |    |     |    |  |    ||    |     |   |     |   |\n   *    encoded       |    |    encoded    |  |    ||    |     |   |     |   |\n   *                 ignored              ignored  ignored     ignored   ignored\n   *\n   * @private\n   * @param {string} filePath\n   */\n  urlencodePath(filePath) {\n    // People use the filepath in quite unexpected ways.\n    // Try to extract the first querystring of the url:\n    //\n    // some+path/demo.html?value=abc?def\n    //\n    const queryStringStart = filePath.indexOf(\"?\");\n    const urlPath =\n      queryStringStart === -1 ? filePath : filePath.substr(0, queryStringStart);\n    const queryString = filePath.substr(urlPath.length);\n    // Encode all parts except '/' which are not part of the querystring:\n    const encodedUrlPath = urlPath.split(\"/\").map(encodeURIComponent).join(\"/\");\n    return encodedUrlPath + queryString;\n  }\n\n  /**\n   * Appends a cache busting hash to the query string of the url\n   * E.g. http://localhost:8080/ -> http://localhost:8080/?50c9096ba6183fd728eeb065a26ec175\n   *\n   * @private\n   * @param {string | undefined} url\n   * @param {string} hash\n   */\n  appendHash(url, hash) {\n    if (!url) {\n      return url;\n    }\n\n    return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + hash;\n  }\n\n  /**\n   * Generate the relative or absolute base url to reference images, css, and javascript files\n   * from within the html file - the publicPath\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {string} filename\n   * @param {string | 'auto'} customPublicPath\n   * @returns {string}\n   */\n  getPublicPath(compilation, filename, customPublicPath) {\n    /**\n     * @type {string} the configured public path to the asset root\n     * if a path publicPath is set in the current webpack config use it otherwise\n     * fallback to a relative path\n     */\n    const webpackPublicPath = compilation.getAssetPath(\n      /** @type {NonNullable<Compilation[\"outputOptions\"][\"publicPath\"]>} */ (\n        compilation.outputOptions.publicPath\n      ),\n      { hash: compilation.hash },\n    );\n    // Webpack 5 introduced \"auto\" as default value\n    const isPublicPathDefined = webpackPublicPath !== \"auto\";\n\n    let publicPath =\n      // If the html-webpack-plugin options contain a custom public path unset it\n      customPublicPath !== \"auto\"\n        ? customPublicPath\n        : isPublicPathDefined\n          ? // If a hard coded public path exists use it\n            webpackPublicPath\n          : // If no public path was set get a relative url path\n            path\n              .relative(\n                path.resolve(\n                  /** @type {string} */ (compilation.options.output.path),\n                  path.dirname(filename),\n                ),\n                /** @type {string} */ (compilation.options.output.path),\n              )\n              .split(path.sep)\n              .join(\"/\");\n\n    if (publicPath.length && publicPath.substr(-1, 1) !== \"/\") {\n      publicPath += \"/\";\n    }\n\n    return publicPath;\n  }\n\n  /**\n   * The getAssetsForHTML extracts the asset information of a webpack compilation for all given entry names.\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {string} outputName\n   * @param {string[]} entryNames\n   * @returns {AssetsInformationByGroups}\n   */\n  getAssetsInformationByGroups(compilation, outputName, entryNames) {\n    /** The public path used inside the html file */\n    const publicPath = this.getPublicPath(\n      compilation,\n      outputName,\n      this.options.publicPath,\n    );\n    /**\n     * @type {AssetsInformationByGroups}\n     */\n    const assets = {\n      // The public path\n      publicPath,\n      // Will contain all js and mjs files\n      js: [],\n      // Will contain all css files\n      css: [],\n      // Will contain the html5 appcache manifest files if it exists\n      manifest: Object.keys(compilation.assets).find(\n        (assetFile) => path.extname(assetFile) === \".appcache\",\n      ),\n      // Favicon\n      favicon: undefined,\n    };\n\n    // Append a hash for cache busting\n    if (this.options.hash && assets.manifest) {\n      assets.manifest = this.appendHash(\n        assets.manifest,\n        /** @type {string} */ (compilation.hash),\n      );\n    }\n\n    // Extract paths to .js, .mjs and .css files from the current compilation\n    const entryPointPublicPathMap = {};\n    const extensionRegexp = /\\.(css|js|mjs)(\\?|$)/;\n\n    for (let i = 0; i < entryNames.length; i++) {\n      const entryName = entryNames[i];\n      /** entryPointUnfilteredFiles - also includes hot module update files */\n      const entryPointUnfilteredFiles = /** @type {Entrypoint} */ (\n        compilation.entrypoints.get(entryName)\n      ).getFiles();\n      const entryPointFiles = entryPointUnfilteredFiles.filter((chunkFile) => {\n        const asset = compilation.getAsset(chunkFile);\n\n        if (!asset) {\n          return true;\n        }\n\n        // Prevent hot-module files from being included:\n        const assetMetaInformation = asset.info || {};\n\n        return !(\n          assetMetaInformation.hotModuleReplacement ||\n          assetMetaInformation.development\n        );\n      });\n      // Prepend the publicPath and append the hash depending on the\n      // webpack.output.publicPath and hashOptions\n      // E.g. bundle.js -> /bundle.js?hash\n      const entryPointPublicPaths = entryPointFiles.map((chunkFile) => {\n        const entryPointPublicPath = publicPath + this.urlencodePath(chunkFile);\n        return this.options.hash\n          ? this.appendHash(\n              entryPointPublicPath,\n              /** @type {string} */ (compilation.hash),\n            )\n          : entryPointPublicPath;\n      });\n\n      entryPointPublicPaths.forEach((entryPointPublicPath) => {\n        const extMatch = extensionRegexp.exec(\n          /** @type {string} */ (entryPointPublicPath),\n        );\n\n        // Skip if the public path is not a .css, .mjs or .js file\n        if (!extMatch) {\n          return;\n        }\n\n        // Skip if this file is already known\n        // (e.g. because of common chunk optimizations)\n        if (entryPointPublicPathMap[entryPointPublicPath]) {\n          return;\n        }\n\n        entryPointPublicPathMap[entryPointPublicPath] = true;\n\n        // ext will contain .js or .css, because .mjs recognizes as .js\n        const ext = extMatch[1] === \"mjs\" ? \"js\" : extMatch[1];\n\n        assets[ext].push(entryPointPublicPath);\n      });\n    }\n\n    return assets;\n  }\n\n  /**\n   * Once webpack is done with compiling the template into a NodeJS code this function\n   * evaluates it to generate the html result\n   *\n   * The evaluateCompilationResult is only a class function to allow spying during testing.\n   * Please change that in a further refactoring\n   *\n   * @param {string} source\n   * @param {string} publicPath\n   * @param {string} templateFilename\n   * @returns {Promise<string | (() => string | Promise<string>)>}\n   */\n  evaluateCompilationResult(source, publicPath, templateFilename) {\n    if (!source) {\n      return Promise.reject(\n        new Error(\"The child compilation didn't provide a result\"),\n      );\n    }\n\n    // The LibraryTemplatePlugin stores the template result in a local variable.\n    // By adding it to the end the value gets extracted during evaluation\n    if (source.indexOf(\"HTML_WEBPACK_PLUGIN_RESULT\") >= 0) {\n      source += \";\\nHTML_WEBPACK_PLUGIN_RESULT\";\n    }\n\n    const templateWithoutLoaders = templateFilename\n      .replace(/^.+!/, \"\")\n      .replace(/\\?.+$/, \"\");\n    const globalClone = Object.create(\n      Object.getPrototypeOf(global),\n      Object.getOwnPropertyDescriptors(global),\n    );\n    // Presence of `eval` breaks template's explicit `eval` call, might be a bug in Node\n    delete globalClone.eval;\n    // Not using `...global` as it throws when localStorage is not explicitly enabled in Node 25+\n    const vmContext = vm.createContext(\n      Object.assign(globalClone, {\n        HTML_WEBPACK_PLUGIN: true,\n        // Copying nonstandard globals like `require` explicitly as they may be absent from `global`\n        require: require,\n        htmlWebpackPluginPublicPath: publicPath,\n        __filename: templateWithoutLoaders,\n        __dirname: path.dirname(templateWithoutLoaders),\n      }),\n    );\n\n    const vmScript = new vm.Script(source, {\n      filename: templateWithoutLoaders,\n    });\n\n    // Evaluate code and cast to string\n    let newSource;\n\n    try {\n      newSource = vmScript.runInContext(vmContext);\n    } catch (e) {\n      return Promise.reject(e);\n    }\n\n    if (\n      typeof newSource === \"object\" &&\n      newSource.__esModule &&\n      newSource.default !== undefined\n    ) {\n      newSource = newSource.default;\n    }\n\n    return typeof newSource === \"string\" || typeof newSource === \"function\"\n      ? Promise.resolve(newSource)\n      : Promise.reject(\n          new Error(\n            'The loader \"' + templateWithoutLoaders + \"\\\" didn't return html.\",\n          ),\n        );\n  }\n\n  /**\n   * Add toString methods for easier rendering inside the template\n   *\n   * @private\n   * @param {Array<HtmlTagObject>} assetTagGroup\n   * @returns {Array<HtmlTagObject>}\n   */\n  prepareAssetTagGroupForRendering(assetTagGroup) {\n    const xhtml = this.options.xhtml;\n    return HtmlTagArray.from(\n      assetTagGroup.map((assetTag) => {\n        const copiedAssetTag = Object.assign({}, assetTag);\n        copiedAssetTag.toString = function () {\n          return htmlTagObjectToString(this, xhtml);\n        };\n        return copiedAssetTag;\n      }),\n    );\n  }\n\n  /**\n   * Generate the template parameters for the template function\n   *\n   * @private\n   * @param {Compilation} compilation\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{\n       headTags: HtmlTagObject[],\n       bodyTags: HtmlTagObject[]\n     }} assetTags\n   * @returns {Promise<{[key: any]: any}>}\n   */\n  getTemplateParameters(compilation, assetsInformationByGroups, assetTags) {\n    const templateParameters = this.options.templateParameters;\n\n    if (templateParameters === false) {\n      return Promise.resolve({});\n    }\n\n    if (\n      typeof templateParameters !== \"function\" &&\n      typeof templateParameters !== \"object\"\n    ) {\n      throw new Error(\n        \"templateParameters has to be either a function or an object\",\n      );\n    }\n\n    const templateParameterFunction =\n      typeof templateParameters === \"function\"\n        ? // A custom function can overwrite the entire template parameter preparation\n          templateParameters\n        : // If the template parameters is an object merge it with the default values\n          (compilation, assetsInformationByGroups, assetTags, options) =>\n            Object.assign(\n              {},\n              templateParametersGenerator(\n                compilation,\n                assetsInformationByGroups,\n                assetTags,\n                options,\n              ),\n              templateParameters,\n            );\n    const preparedAssetTags = {\n      headTags: this.prepareAssetTagGroupForRendering(assetTags.headTags),\n      bodyTags: this.prepareAssetTagGroupForRendering(assetTags.bodyTags),\n    };\n    return Promise.resolve().then(() =>\n      templateParameterFunction(\n        compilation,\n        assetsInformationByGroups,\n        preparedAssetTags,\n        this.options,\n      ),\n    );\n  }\n\n  /**\n   * This function renders the actual html by executing the template function\n   *\n   * @private\n   * @param {(templateParameters) => string | Promise<string>} templateFunction\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{\n       headTags: HtmlTagObject[],\n       bodyTags: HtmlTagObject[]\n     }} assetTags\n   * @param {Compilation} compilation\n   * @returns Promise<string>\n   */\n  executeTemplate(\n    templateFunction,\n    assetsInformationByGroups,\n    assetTags,\n    compilation,\n  ) {\n    // Template processing\n    const templateParamsPromise = this.getTemplateParameters(\n      compilation,\n      assetsInformationByGroups,\n      assetTags,\n    );\n\n    return templateParamsPromise.then((templateParams) => {\n      try {\n        // If html is a promise return the promise\n        // If html is a string turn it into a promise\n        return templateFunction(templateParams);\n      } catch (e) {\n        // @ts-ignore\n        compilation.errors.push(new Error(\"Template execution failed: \" + e));\n        return Promise.reject(e);\n      }\n    });\n  }\n\n  /**\n   * Html Post processing\n   *\n   * @private\n   * @param {Compiler} compiler The compiler instance\n   * @param {any} originalHtml The input html\n   * @param {AssetsInformationByGroups} assetsInformationByGroups\n   * @param {{headTags: HtmlTagObject[], bodyTags: HtmlTagObject[]}} assetTags The asset tags to inject\n   * @returns {Promise<string>}\n   */\n  postProcessHtml(\n    compiler,\n    originalHtml,\n    assetsInformationByGroups,\n    assetTags,\n  ) {\n    let html = originalHtml;\n\n    if (typeof html !== \"string\") {\n      return Promise.reject(\n        new Error(\n          \"Expected html to be a string but got \" + JSON.stringify(html),\n        ),\n      );\n    }\n\n    if (this.options.inject) {\n      const htmlRegExp = /(<html[^>]*>)/i;\n      const headRegExp = /(<\\/head\\s*>)/i;\n      const bodyRegExp = /(<\\/body\\s*>)/i;\n      const metaViewportRegExp = /<meta[^>]+name=[\"']viewport[\"'][^>]*>/i;\n      const body = assetTags.bodyTags.map((assetTagObject) =>\n        htmlTagObjectToString(assetTagObject, this.options.xhtml),\n      );\n      const head = assetTags.headTags\n        .filter((item) => {\n          if (\n            item.tagName === \"meta\" &&\n            item.attributes &&\n            item.attributes.name === \"viewport\" &&\n            metaViewportRegExp.test(html)\n          ) {\n            return false;\n          }\n\n          return true;\n        })\n        .map((assetTagObject) =>\n          htmlTagObjectToString(assetTagObject, this.options.xhtml),\n        );\n\n      if (body.length) {\n        if (bodyRegExp.test(html)) {\n          // Append assets to body element\n          html = html.replace(bodyRegExp, (match) => body.join(\"\") + match);\n        } else {\n          // Append scripts to the end of the file if no <body> element exists:\n          html += body.join(\"\");\n        }\n      }\n\n      if (head.length) {\n        // Create a head tag if none exists\n        if (!headRegExp.test(html)) {\n          if (!htmlRegExp.test(html)) {\n            html = \"<head></head>\" + html;\n          } else {\n            html = html.replace(htmlRegExp, (match) => match + \"<head></head>\");\n          }\n        }\n\n        // Append assets to head element\n        html = html.replace(headRegExp, (match) => head.join(\"\") + match);\n      }\n\n      // Inject manifest into the opening html tag\n      if (assetsInformationByGroups.manifest) {\n        html = html.replace(/(<html[^>]*)(>)/i, (match, start, end) => {\n          // Append the manifest only if no manifest was specified\n          if (/\\smanifest\\s*=/.test(match)) {\n            return match;\n          }\n          return (\n            start +\n            ' manifest=\"' +\n            assetsInformationByGroups.manifest +\n            '\"' +\n            end\n          );\n        });\n      }\n    }\n\n    // TODO avoid this logic and use https://github.com/webpack-contrib/html-minimizer-webpack-plugin under the hood in the next major version\n    // Check if webpack is running in production mode\n    // @see https://github.com/webpack/webpack/blob/3366421f1784c449f415cda5930a8e445086f688/lib/WebpackOptionsDefaulter.js#L12-L14\n    const isProductionLikeMode =\n      compiler.options.mode === \"production\" || !compiler.options.mode;\n    const needMinify =\n      this.options.minify === true ||\n      typeof this.options.minify === \"object\" ||\n      (this.options.minify === \"auto\" && isProductionLikeMode);\n\n    if (!needMinify) {\n      return Promise.resolve(html);\n    }\n\n    const minifyOptions =\n      typeof this.options.minify === \"object\"\n        ? this.options.minify\n        : {\n            // https://www.npmjs.com/package/html-minifier-terser#options-quick-reference\n            collapseWhitespace: true,\n            keepClosingSlash: true,\n            removeComments: true,\n            removeRedundantAttributes: true,\n            removeScriptTypeAttributes: true,\n            removeStyleLinkTypeAttributes: true,\n            useShortDoctype: true,\n          };\n\n    try {\n      html = require(\"html-minifier-terser\").minify(html, minifyOptions);\n    } catch (e) {\n      const isParseError = String(e.message).indexOf(\"Parse Error\") === 0;\n\n      if (isParseError) {\n        e.message =\n          \"html-webpack-plugin could not minify the generated output.\\n\" +\n          \"In production mode the html minification is enabled by default.\\n\" +\n          \"If you are not generating a valid html output please disable it manually.\\n\" +\n          \"You can do so by adding the following setting to your HtmlWebpackPlugin config:\\n|\\n|\" +\n          \"    minify: false\\n|\\n\" +\n          \"See https://github.com/jantimon/html-webpack-plugin#options for details.\\n\\n\" +\n          \"For parser dedicated bugs please create an issue here:\\n\" +\n          \"https://danielruf.github.io/html-minifier-terser/\" +\n          \"\\n\" +\n          e.message;\n      }\n\n      return Promise.reject(e);\n    }\n\n    return Promise.resolve(html);\n  }\n\n  /**\n   * Helper to return a sorted unique array of all asset files out of the asset object\n   * @private\n   */\n  getAssetFiles(assets) {\n    const files = _uniq(\n      Object.keys(assets)\n        .filter((assetType) => assetType !== \"chunks\" && assets[assetType])\n        .reduce((files, assetType) => files.concat(assets[assetType]), []),\n    );\n    files.sort();\n    return files;\n  }\n\n  /**\n   * Converts a favicon file from disk to a webpack resource and returns the url to the resource\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {string|false} favicon\n   * @param {Compilation} compilation\n   * @param {string} publicPath\n   * @param {PreviousEmittedAssets} previousEmittedAssets\n   * @returns {Promise<string|undefined>}\n   */\n  generateFavicon(\n    compiler,\n    favicon,\n    compilation,\n    publicPath,\n    previousEmittedAssets,\n  ) {\n    if (!favicon) {\n      return Promise.resolve(undefined);\n    }\n\n    const filename = path.resolve(compilation.compiler.context, favicon);\n\n    return promisify(compilation.inputFileSystem.readFile)(filename)\n      .then((buf) => {\n        const source = new compiler.webpack.sources.RawSource(\n          /** @type {string | Buffer} */ (buf),\n          false,\n        );\n        const name = path.basename(filename);\n\n        compilation.fileDependencies.add(filename);\n        compilation.emitAsset(name, source);\n        previousEmittedAssets.push({ name, source });\n\n        const faviconPath = publicPath + name;\n\n        if (this.options.hash) {\n          return this.appendHash(\n            faviconPath,\n            /** @type {string} */ (compilation.hash),\n          );\n        }\n\n        return faviconPath;\n      })\n      .catch(() =>\n        Promise.reject(\n          new Error(\"HtmlWebpackPlugin: could not load file \" + filename),\n        ),\n      );\n  }\n\n  /**\n   * Generate all tags script for the given file paths\n   *\n   * @private\n   * @param {Array<string>} jsAssets\n   * @returns {Array<HtmlTagObject>}\n   */\n  generatedScriptTags(jsAssets) {\n    // @ts-ignore\n    return jsAssets.map((src) => {\n      const attributes = {};\n\n      if (this.options.scriptLoading === \"defer\") {\n        attributes.defer = true;\n      } else if (this.options.scriptLoading === \"module\") {\n        attributes.type = \"module\";\n      } else if (this.options.scriptLoading === \"systemjs-module\") {\n        attributes.type = \"systemjs-module\";\n      }\n\n      attributes.src = src;\n\n      return {\n        tagName: \"script\",\n        voidTag: false,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes,\n      };\n    });\n  }\n\n  /**\n   * Generate all style tags for the given file paths\n   *\n   * @private\n   * @param {Array<string>} cssAssets\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateStyleTags(cssAssets) {\n    return cssAssets.map((styleAsset) => ({\n      tagName: \"link\",\n      voidTag: true,\n      meta: { plugin: \"html-webpack-plugin\" },\n      attributes: {\n        href: styleAsset,\n        rel: \"stylesheet\",\n      },\n    }));\n  }\n\n  /**\n   * Generate an optional base tag\n   *\n   * @param {string | {[attributeName: string]: string}} base\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateBaseTag(base) {\n    return [\n      {\n        tagName: \"base\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        // attributes e.g. { href:\"http://example.com/page.html\" target:\"_blank\" }\n        attributes:\n          typeof base === \"string\"\n            ? {\n                href: base,\n              }\n            : base,\n      },\n    ];\n  }\n\n  /**\n   * Generate all meta tags for the given meta configuration\n   *\n   * @private\n   * @param {false | {[name: string]:  false | string | {[attributeName: string]: string|boolean}}} metaOptions\n   * @returns {Array<HtmlTagObject>}\n   */\n  generatedMetaTags(metaOptions) {\n    if (metaOptions === false) {\n      return [];\n    }\n\n    // Make tags self-closing in case of xhtml\n    // Turn { \"viewport\" : \"width=500, initial-scale=1\" } into\n    // [{ name:\"viewport\" content:\"width=500, initial-scale=1\" }]\n    const metaTagAttributeObjects = Object.keys(metaOptions)\n      .map((metaName) => {\n        const metaTagContent = metaOptions[metaName];\n        return typeof metaTagContent === \"string\"\n          ? {\n              name: metaName,\n              content: metaTagContent,\n            }\n          : metaTagContent;\n      })\n      .filter((attribute) => attribute !== false);\n\n    // Turn [{ name:\"viewport\" content:\"width=500, initial-scale=1\" }] into\n    // the html-webpack-plugin tag structure\n    return metaTagAttributeObjects.map((metaTagAttributes) => {\n      if (metaTagAttributes === false) {\n        throw new Error(\"Invalid meta tag\");\n      }\n      return {\n        tagName: \"meta\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes: metaTagAttributes,\n      };\n    });\n  }\n\n  /**\n   * Generate a favicon tag for the given file path\n   *\n   * @private\n   * @param {string} favicon\n   * @returns {Array<HtmlTagObject>}\n   */\n  generateFaviconTag(favicon) {\n    return [\n      {\n        tagName: \"link\",\n        voidTag: true,\n        meta: { plugin: \"html-webpack-plugin\" },\n        attributes: {\n          rel: \"icon\",\n          href: favicon,\n        },\n      },\n    ];\n  }\n\n  /**\n   * Group assets to head and body tags\n   *\n   * @param {{\n      scripts: Array<HtmlTagObject>;\n      styles: Array<HtmlTagObject>;\n      meta: Array<HtmlTagObject>;\n    }} assetTags\n   * @param {\"body\" | \"head\"} scriptTarget\n   * @returns {{\n      headTags: Array<HtmlTagObject>;\n      bodyTags: Array<HtmlTagObject>;\n    }}\n   */\n  groupAssetsByElements(assetTags, scriptTarget) {\n    /** @type {{ headTags: Array<HtmlTagObject>; bodyTags: Array<HtmlTagObject>; }} */\n    const result = {\n      headTags: [...assetTags.meta, ...assetTags.styles],\n      bodyTags: [],\n    };\n\n    // Add script tags to head or body depending on\n    // the htmlPluginOptions\n    if (scriptTarget === \"body\") {\n      result.bodyTags.push(...assetTags.scripts);\n    } else {\n      // If script loading is blocking add the scripts to the end of the head\n      // If script loading is non-blocking add the scripts in front of the css files\n      const insertPosition =\n        this.options.scriptLoading === \"blocking\"\n          ? result.headTags.length\n          : assetTags.meta.length;\n\n      result.headTags.splice(insertPosition, 0, ...assetTags.scripts);\n    }\n\n    return result;\n  }\n\n  /**\n   * Replace [contenthash] in filename\n   *\n   * @see https://survivejs.com/webpack/optimizing/adding-hashes-to-filenames/\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {string} filename\n   * @param {string|Buffer} fileContent\n   * @param {Compilation} compilation\n   * @returns {{ path: string, info: {} }}\n   */\n  replacePlaceholdersInFilename(compiler, filename, fileContent, compilation) {\n    if (/\\[\\\\*([\\w:]+)\\\\*\\]/i.test(filename) === false) {\n      return { path: filename, info: {} };\n    }\n\n    const hash = compiler.webpack.util.createHash(\n      compilation.outputOptions.hashFunction,\n    );\n\n    hash.update(fileContent);\n\n    if (compilation.outputOptions.hashSalt) {\n      hash.update(compilation.outputOptions.hashSalt);\n    }\n\n    const contentHash = /** @type {string} */ (\n      hash\n        .digest(compilation.outputOptions.hashDigest)\n        .slice(0, compilation.outputOptions.hashDigestLength)\n    );\n\n    return compilation.getPathWithInfo(filename, {\n      contentHash,\n      chunk: {\n        hash: contentHash,\n        // @ts-ignore\n        contentHash,\n      },\n    });\n  }\n\n  /**\n   * Function to generate HTML file.\n   *\n   * @private\n   * @param {Compiler} compiler\n   * @param {Compilation} compilation\n   * @param {string} outputName\n   * @param {CachedChildCompilation} childCompilerPlugin\n   * @param {PreviousEmittedAssets} previousEmittedAssets\n   * @param {{ value: string | undefined }} assetJson\n   * @param {(err?: Error) => void} callback\n   */\n  generateHTML(\n    compiler,\n    compilation,\n    outputName,\n    childCompilerPlugin,\n    previousEmittedAssets,\n    assetJson,\n    callback,\n  ) {\n    // Get all entry point names for this html file\n    const entryNames = Array.from(compilation.entrypoints.keys());\n    const filteredEntryNames = this.filterEntryChunks(\n      entryNames,\n      this.options.chunks,\n      this.options.excludeChunks,\n    );\n    const sortedEntryNames = this.sortEntryChunks(\n      filteredEntryNames,\n      this.options.chunksSortMode,\n      compilation,\n    );\n    const templateResult = this.options.templateContent\n      ? { mainCompilationHash: compilation.hash }\n      : childCompilerPlugin.getCompilationEntryResult(this.options.template);\n\n    if (\"error\" in templateResult) {\n      compilation.errors.push(\n        new Error(\n          prettyError(templateResult.error, compiler.context).toString(),\n        ),\n      );\n    }\n\n    // If the child compilation was not executed during a previous main compile run\n    // it is a cached result\n    const isCompilationCached =\n      templateResult.mainCompilationHash !== compilation.hash;\n    /** Generated file paths from the entry point names */\n    const assetsInformationByGroups = this.getAssetsInformationByGroups(\n      compilation,\n      outputName,\n      sortedEntryNames,\n    );\n    // If the template and the assets did not change we don't have to emit the html\n    const newAssetJson = JSON.stringify(\n      this.getAssetFiles(assetsInformationByGroups),\n    );\n\n    if (\n      isCompilationCached &&\n      this.options.cache &&\n      assetJson.value === newAssetJson\n    ) {\n      previousEmittedAssets.forEach(({ name, source, info }) => {\n        compilation.emitAsset(name, source, info);\n      });\n      return callback();\n    } else {\n      previousEmittedAssets.length = 0;\n      assetJson.value = newAssetJson;\n    }\n\n    // The html-webpack plugin uses a object representation for the html-tags which will be injected\n    // to allow altering them more easily\n    // Just before they are converted a third-party-plugin author might change the order and content\n    const assetsPromise = this.generateFavicon(\n      compiler,\n      this.options.favicon,\n      compilation,\n      assetsInformationByGroups.publicPath,\n      previousEmittedAssets,\n    ).then((faviconPath) => {\n      assetsInformationByGroups.favicon = faviconPath;\n      return HtmlWebpackPlugin.getCompilationHooks(\n        compilation,\n      ).beforeAssetTagGeneration.promise({\n        assets: assetsInformationByGroups,\n        outputName,\n        plugin: this,\n      });\n    });\n\n    // Turn the js and css paths into grouped HtmlTagObjects\n    const assetTagGroupsPromise = assetsPromise\n      // And allow third-party-plugin authors to reorder and change the assetTags before they are grouped\n      .then(({ assets }) =>\n        HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).alterAssetTags.promise({\n          assetTags: {\n            scripts: this.generatedScriptTags(assets.js),\n            styles: this.generateStyleTags(assets.css),\n            meta: [\n              ...(this.options.base !== false\n                ? this.generateBaseTag(this.options.base)\n                : []),\n              ...this.generatedMetaTags(this.options.meta),\n              ...(assets.favicon\n                ? this.generateFaviconTag(assets.favicon)\n                : []),\n            ],\n          },\n          outputName,\n          publicPath: assetsInformationByGroups.publicPath,\n          plugin: this,\n        }),\n      )\n      .then(({ assetTags }) => {\n        // Inject scripts to body unless it set explicitly to head\n        const scriptTarget =\n          this.options.inject === \"head\" ||\n          (this.options.inject !== \"body\" &&\n            this.options.scriptLoading !== \"blocking\")\n            ? \"head\"\n            : \"body\";\n        // Group assets to `head` and `body` tag arrays\n        const assetGroups = this.groupAssetsByElements(assetTags, scriptTarget);\n        // Allow third-party-plugin authors to reorder and change the assetTags once they are grouped\n        return HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).alterAssetTagGroups.promise({\n          headTags: assetGroups.headTags,\n          bodyTags: assetGroups.bodyTags,\n          outputName,\n          publicPath: assetsInformationByGroups.publicPath,\n          plugin: this,\n        });\n      });\n\n    // Turn the compiled template into a nodejs function or into a nodejs string\n    const templateEvaluationPromise = Promise.resolve().then(() => {\n      if (\"error\" in templateResult) {\n        return this.options.showErrors\n          ? prettyError(templateResult.error, compiler.context).toHtml()\n          : \"ERROR\";\n      }\n\n      // Allow to use a custom function / string instead\n      if (this.options.templateContent !== false) {\n        return this.options.templateContent;\n      }\n\n      // Once everything is compiled evaluate the html factory and replace it with its content\n      if (\"compiledEntry\" in templateResult) {\n        const compiledEntry = templateResult.compiledEntry;\n        const assets = compiledEntry.assets;\n\n        // Store assets from child compiler to re-emit them later\n        for (const name in assets) {\n          previousEmittedAssets.push({\n            name,\n            source: assets[name].source,\n            info: assets[name].info,\n          });\n        }\n\n        return this.evaluateCompilationResult(\n          compiledEntry.content,\n          assetsInformationByGroups.publicPath,\n          this.options.template,\n        );\n      }\n\n      return Promise.reject(\n        new Error(\"Child compilation contained no compiledEntry\"),\n      );\n    });\n    const templateExecutionPromise = Promise.all([\n      assetsPromise,\n      assetTagGroupsPromise,\n      templateEvaluationPromise,\n    ])\n      // Execute the template\n      .then(([assetsHookResult, assetTags, compilationResult]) =>\n        typeof compilationResult !== \"function\"\n          ? compilationResult\n          : this.executeTemplate(\n              compilationResult,\n              assetsHookResult.assets,\n              { headTags: assetTags.headTags, bodyTags: assetTags.bodyTags },\n              compilation,\n            ),\n      );\n\n    const injectedHtmlPromise = Promise.all([\n      assetTagGroupsPromise,\n      templateExecutionPromise,\n    ])\n      // Allow plugins to change the html before assets are injected\n      .then(([assetTags, html]) => {\n        const pluginArgs = {\n          html,\n          headTags: assetTags.headTags,\n          bodyTags: assetTags.bodyTags,\n          plugin: this,\n          outputName,\n        };\n        return HtmlWebpackPlugin.getCompilationHooks(\n          compilation,\n        ).afterTemplateExecution.promise(pluginArgs);\n      })\n      .then(({ html, headTags, bodyTags }) => {\n        return this.postProcessHtml(compiler, html, assetsInformationByGroups, {\n          headTags,\n          bodyTags,\n        });\n      });\n\n    const emitHtmlPromise = injectedHtmlPromise\n      // Allow plugins to change the html after assets are injected\n      .then((html) => {\n        const pluginArgs = { html, plugin: this, outputName };\n        return HtmlWebpackPlugin.getCompilationHooks(compilation)\n          .beforeEmit.promise(pluginArgs)\n          .then((result) => result.html);\n      })\n      .catch((err) => {\n        // In case anything went wrong the promise is resolved\n        // with the error message and an error is logged\n        compilation.errors.push(\n          new Error(prettyError(err, compiler.context).toString()),\n        );\n        return this.options.showErrors\n          ? prettyError(err, compiler.context).toHtml()\n          : \"ERROR\";\n      })\n      .then((html) => {\n        const filename = outputName.replace(\n          /\\[templatehash([^\\]]*)\\]/g,\n          require(\"util\").deprecate(\n            (match, options) => `[contenthash${options}]`,\n            \"[templatehash] is now [contenthash]\",\n          ),\n        );\n        const replacedFilename = this.replacePlaceholdersInFilename(\n          compiler,\n          filename,\n          html,\n          compilation,\n        );\n        const source = new compiler.webpack.sources.RawSource(html, false);\n\n        // Add the evaluated html code to the webpack assets\n        compilation.emitAsset(\n          replacedFilename.path,\n          source,\n          replacedFilename.info,\n        );\n        previousEmittedAssets.push({ name: replacedFilename.path, source });\n\n        return replacedFilename.path;\n      })\n      .then((finalOutputName) =>\n        HtmlWebpackPlugin.getCompilationHooks(compilation)\n          .afterEmit.promise({\n            outputName: finalOutputName,\n            plugin: this,\n          })\n          .catch((err) => {\n            /** @type {Logger} */\n            (this.logger).error(err);\n            return null;\n          })\n          .then(() => null),\n      );\n\n    // Once all files are added to the webpack compilation\n    // let the webpack compiler continue\n    emitHtmlPromise.then(() => {\n      callback();\n    });\n  }\n}\n\n/**\n * The default for options.templateParameter\n * Generate the template parameters\n *\n * Generate the template parameters for the template function\n * @param {Compilation} compilation\n * @param {AssetsInformationByGroups} assets\n * @param {{\n     headTags: HtmlTagObject[],\n     bodyTags: HtmlTagObject[]\n   }} assetTags\n * @param {ProcessedHtmlWebpackOptions} options\n * @returns {TemplateParameter}\n */\nfunction templateParametersGenerator(compilation, assets, assetTags, options) {\n  return {\n    compilation: compilation,\n    webpackConfig: compilation.options,\n    htmlWebpackPlugin: {\n      tags: assetTags,\n      files: assets,\n      options: options,\n    },\n  };\n}\n\n// Statics:\n/**\n * The major version number of this plugin\n */\nHtmlWebpackPlugin.version = 5;\n\n/**\n * A static helper to get the hooks for this plugin\n *\n * Usage: HtmlWebpackPlugin.getHooks(compilation).HOOK_NAME.tapAsync('YourPluginName', () => { ... });\n */\n// TODO remove me in the next major release in favor getCompilationHooks\nHtmlWebpackPlugin.getHooks = HtmlWebpackPlugin.getCompilationHooks;\nHtmlWebpackPlugin.createHtmlTagObject = createHtmlTagObject;\n\nmodule.exports = HtmlWebpackPlugin;\n"]}