* Creates an instance of MainTemplate. * @param {OutputOptions} outputOptions output options for the MainTemplate * @param {Compilation} compilation the compilation
(outputOptions, compilation)
| 49 | * @param {Compilation} compilation the compilation |
| 50 | */ |
| 51 | constructor(outputOptions, compilation) { |
| 52 | /** @type {OutputOptions} */ |
| 53 | this._outputOptions = outputOptions || {}; |
| 54 | this.hooks = Object.freeze({ |
| 55 | renderManifest: { |
| 56 | tap: util.deprecate( |
| 57 | /** |
| 58 | * Handles the callback logic for this hook. |
| 59 | * @template AdditionalOptions |
| 60 | * @param {string | Tap & IfSet<AdditionalOptions>} options options |
| 61 | * @param {(renderManifestEntries: RenderManifestEntry[], renderManifestOptions: RenderManifestOptions) => RenderManifestEntry[]} fn fn |
| 62 | */ |
| 63 | (options, fn) => { |
| 64 | compilation.hooks.renderManifest.tap( |
| 65 | options, |
| 66 | (entries, options) => { |
| 67 | if (!options.chunk.hasRuntime()) return entries; |
| 68 | return fn(entries, options); |
| 69 | } |
| 70 | ); |
| 71 | }, |
| 72 | "MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", |
| 73 | "DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" |
| 74 | ) |
| 75 | }, |
| 76 | modules: { |
| 77 | tap: () => { |
| 78 | throw new Error( |
| 79 | "MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" |
| 80 | ); |
| 81 | } |
| 82 | }, |
| 83 | moduleObj: { |
| 84 | tap: () => { |
| 85 | throw new Error( |
| 86 | "MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" |
| 87 | ); |
| 88 | } |
| 89 | }, |
| 90 | require: { |
| 91 | tap: util.deprecate( |
| 92 | /** |
| 93 | * Handles the callback logic for this hook. |
| 94 | * @template AdditionalOptions |
| 95 | * @param {string | Tap & IfSet<AdditionalOptions>} options options |
| 96 | * @param {(value: string, renderBootstrapContext: RenderBootstrapContext) => string} fn fn |
| 97 | */ |
| 98 | (options, fn) => { |
| 99 | getJavascriptModulesPlugin() |
| 100 | .getCompilationHooks(compilation) |
| 101 | .renderRequire.tap(options, fn); |
| 102 | }, |
| 103 | "MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", |
| 104 | "DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" |
| 105 | ) |
| 106 | }, |
| 107 | beforeStartup: { |
| 108 | tap: () => { |
nothing calls this directly
no test coverage detected