| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-13 04:38:38 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | const { SyncWaterfallHook } = require("tapable"); | 
					
						
							|  |  |  | const util = require("util"); | 
					
						
							| 
									
										
										
										
											2018-11-05 21:36:15 +08:00
										 |  |  | const RuntimeGlobals = require("./RuntimeGlobals"); | 
					
						
							| 
									
										
										
										
											2020-12-27 05:32:57 +08:00
										 |  |  | const memoize = require("./util/memoize"); | 
					
						
							| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-21 08:35:02 +08:00
										 |  |  | /** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ | 
					
						
							| 
									
										
										
										
											2018-07-02 22:18:49 +08:00
										 |  |  | /** @typedef {import("webpack-sources").Source} Source */ | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | /** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */ | 
					
						
							| 
									
										
										
										
											2018-04-24 21:44:50 +08:00
										 |  |  | /** @typedef {import("./ModuleTemplate")} ModuleTemplate */ | 
					
						
							|  |  |  | /** @typedef {import("./Chunk")} Chunk */ | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | /** @typedef {import("./Compilation")} Compilation */ | 
					
						
							| 
									
										
										
										
											2019-09-13 17:12:26 +08:00
										 |  |  | /** @typedef {import("./Compilation").AssetInfo} AssetInfo */ | 
					
						
							| 
									
										
										
										
											2018-04-24 21:44:50 +08:00
										 |  |  | /** @typedef {import("./Module")} Module} */ | 
					
						
							| 
									
										
										
										
											2019-07-17 22:02:33 +08:00
										 |  |  | /** @typedef {import("./util/Hash")} Hash} */ | 
					
						
							| 
									
										
										
										
											2018-07-11 19:05:13 +08:00
										 |  |  | /** @typedef {import("./DependencyTemplates")} DependencyTemplates} */ | 
					
						
							| 
									
										
										
										
											2021-06-24 22:44:14 +08:00
										 |  |  | /** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */ | 
					
						
							| 
									
										
										
										
											2018-08-14 22:40:37 +08:00
										 |  |  | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */ | 
					
						
							|  |  |  | /** @typedef {import("./ModuleGraph")} ModuleGraph} */ | 
					
						
							|  |  |  | /** @typedef {import("./ChunkGraph")} ChunkGraph} */ | 
					
						
							|  |  |  | /** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */ | 
					
						
							|  |  |  | /** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */ | 
					
						
							| 
									
										
										
										
											2018-05-01 23:47:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 05:32:57 +08:00
										 |  |  | const getJavascriptModulesPlugin = memoize(() => | 
					
						
							| 
									
										
										
										
											2019-10-11 21:46:57 +08:00
										 |  |  | 	require("./javascript/JavascriptModulesPlugin") | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | ); | 
					
						
							| 
									
										
										
										
											2020-12-27 05:32:57 +08:00
										 |  |  | const getJsonpTemplatePlugin = memoize(() => | 
					
						
							| 
									
										
										
										
											2020-07-02 23:02:48 +08:00
										 |  |  | 	require("./web/JsonpTemplatePlugin") | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2020-12-27 05:32:57 +08:00
										 |  |  | const getLoadScriptRuntimeModule = memoize(() => | 
					
						
							| 
									
										
										
										
											2020-08-19 21:05:49 +08:00
										 |  |  | 	require("./runtime/LoadScriptRuntimeModule") | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2018-04-21 08:35:02 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | // TODO webpack 6 remove this class
 | 
					
						
							|  |  |  | class MainTemplate { | 
					
						
							| 
									
										
										
										
											2018-04-21 08:35:02 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | 	 * @param {OutputOptions} outputOptions output options for the MainTemplate | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							| 
									
										
										
										
											2018-04-21 08:35:02 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 	constructor(outputOptions, compilation) { | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | 		/** @type {OutputOptions} */ | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		this._outputOptions = outputOptions || {}; | 
					
						
							| 
									
										
										
										
											2018-07-30 20:25:40 +08:00
										 |  |  | 		this.hooks = Object.freeze({ | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 			renderManifest: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						compilation.hooks.renderManifest.tap( | 
					
						
							|  |  |  | 							options, | 
					
						
							|  |  |  | 							(entries, options) => { | 
					
						
							|  |  |  | 								if (!options.chunk.hasRuntime()) return entries; | 
					
						
							|  |  |  | 								return fn(entries, options); | 
					
						
							|  |  |  | 							} | 
					
						
							|  |  |  | 						); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-10-09 19:26:00 +08:00
										 |  |  | 			modules: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							|  |  |  | 						"MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)" | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			moduleObj: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							|  |  |  | 						"MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)" | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 			require: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						getJavascriptModulesPlugin() | 
					
						
							|  |  |  | 							.getCompilationHooks(compilation) | 
					
						
							|  |  |  | 							.renderRequire.tap(options, fn); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-10-09 19:26:00 +08:00
										 |  |  | 			beforeStartup: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							| 
									
										
										
										
											2020-12-11 21:32:42 +08:00
										 |  |  | 						"MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)" | 
					
						
							| 
									
										
										
										
											2019-10-09 19:26:00 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			startup: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							|  |  |  | 						"MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)" | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			afterStartup: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							| 
									
										
										
										
											2020-12-11 21:32:42 +08:00
										 |  |  | 						"MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)" | 
					
						
							| 
									
										
										
										
											2019-10-09 19:26:00 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			render: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						getJavascriptModulesPlugin() | 
					
						
							|  |  |  | 							.getCompilationHooks(compilation) | 
					
						
							|  |  |  | 							.render.tap(options, (source, renderContext) => { | 
					
						
							|  |  |  | 								if ( | 
					
						
							|  |  |  | 									renderContext.chunkGraph.getNumberOfEntryModules( | 
					
						
							|  |  |  | 										renderContext.chunk | 
					
						
							|  |  |  | 									) === 0 || | 
					
						
							|  |  |  | 									!renderContext.chunk.hasRuntime() | 
					
						
							|  |  |  | 								) { | 
					
						
							|  |  |  | 									return source; | 
					
						
							|  |  |  | 								} | 
					
						
							|  |  |  | 								return fn( | 
					
						
							|  |  |  | 									source, | 
					
						
							|  |  |  | 									renderContext.chunk, | 
					
						
							|  |  |  | 									compilation.hash, | 
					
						
							|  |  |  | 									compilation.moduleTemplates.javascript, | 
					
						
							|  |  |  | 									compilation.dependencyTemplates | 
					
						
							|  |  |  | 								); | 
					
						
							|  |  |  | 							}); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_RENDER" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 			renderWithEntry: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						getJavascriptModulesPlugin() | 
					
						
							|  |  |  | 							.getCompilationHooks(compilation) | 
					
						
							| 
									
										
										
										
											2019-10-09 17:55:56 +08:00
										 |  |  | 							.render.tap(options, (source, renderContext) => { | 
					
						
							|  |  |  | 								if ( | 
					
						
							|  |  |  | 									renderContext.chunkGraph.getNumberOfEntryModules( | 
					
						
							|  |  |  | 										renderContext.chunk | 
					
						
							|  |  |  | 									) === 0 || | 
					
						
							|  |  |  | 									!renderContext.chunk.hasRuntime() | 
					
						
							|  |  |  | 								) { | 
					
						
							|  |  |  | 									return source; | 
					
						
							|  |  |  | 								} | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 								return fn(source, renderContext.chunk, compilation.hash); | 
					
						
							|  |  |  | 							}); | 
					
						
							|  |  |  | 					}, | 
					
						
							| 
									
										
										
										
											2019-10-09 17:55:56 +08:00
										 |  |  | 					"MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)", | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			assetPath: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						compilation.hooks.assetPath.tap(options, fn); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" | 
					
						
							| 
									
										
										
										
											2019-10-10 19:48:56 +08:00
										 |  |  | 				), | 
					
						
							|  |  |  | 				call: util.deprecate( | 
					
						
							|  |  |  | 					(filename, options) => { | 
					
						
							|  |  |  | 						return compilation.getAssetPath(filename, options); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH" | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			hash: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						compilation.hooks.fullHash.tap(options, fn); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_HASH" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			hashForChunk: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					(options, fn) => { | 
					
						
							|  |  |  | 						getJavascriptModulesPlugin() | 
					
						
							|  |  |  | 							.getCompilationHooks(compilation) | 
					
						
							|  |  |  | 							.chunkHash.tap(options, (chunk, hash) => { | 
					
						
							|  |  |  | 								if (!chunk.hasRuntime()) return; | 
					
						
							|  |  |  | 								return fn(hash, chunk); | 
					
						
							|  |  |  | 							}); | 
					
						
							|  |  |  | 					}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-10-09 19:26:00 +08:00
										 |  |  | 			globalHashPaths: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					() => {}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			globalHash: { | 
					
						
							|  |  |  | 				tap: util.deprecate( | 
					
						
							|  |  |  | 					() => {}, | 
					
						
							|  |  |  | 					"MainTemplate.hooks.globalHash has been removed (it's no longer needed)", | 
					
						
							|  |  |  | 					"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK" | 
					
						
							|  |  |  | 				) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			hotBootstrap: { | 
					
						
							|  |  |  | 				tap: () => { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							|  |  |  | 						"MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)" | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// for compatibility:
 | 
					
						
							| 
									
										
										
										
											2019-09-30 16:08:08 +08:00
										 |  |  | 			/** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */ | 
					
						
							|  |  |  | 			bootstrap: new SyncWaterfallHook([ | 
					
						
							|  |  |  | 				"source", | 
					
						
							|  |  |  | 				"chunk", | 
					
						
							|  |  |  | 				"hash", | 
					
						
							|  |  |  | 				"moduleTemplate", | 
					
						
							|  |  |  | 				"dependencyTemplates" | 
					
						
							|  |  |  | 			]), | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 			/** @type {SyncWaterfallHook<[string, Chunk, string]>} */ | 
					
						
							|  |  |  | 			localVars: new SyncWaterfallHook(["source", "chunk", "hash"]), | 
					
						
							|  |  |  | 			/** @type {SyncWaterfallHook<[string, Chunk, string]>} */ | 
					
						
							|  |  |  | 			requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]), | 
					
						
							|  |  |  | 			/** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */ | 
					
						
							|  |  |  | 			requireEnsure: new SyncWaterfallHook([ | 
					
						
							|  |  |  | 				"source", | 
					
						
							|  |  |  | 				"chunk", | 
					
						
							|  |  |  | 				"hash", | 
					
						
							|  |  |  | 				"chunkIdExpression" | 
					
						
							| 
									
										
										
										
											2020-07-02 23:02:48 +08:00
										 |  |  | 			]), | 
					
						
							|  |  |  | 			get jsonpScript() { | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 				const hooks = | 
					
						
							|  |  |  | 					getLoadScriptRuntimeModule().getCompilationHooks(compilation); | 
					
						
							| 
									
										
										
										
											2020-08-19 21:05:49 +08:00
										 |  |  | 				return hooks.createScript; | 
					
						
							| 
									
										
										
										
											2020-07-02 23:02:48 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			get linkPrefetch() { | 
					
						
							|  |  |  | 				const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); | 
					
						
							|  |  |  | 				return hooks.linkPrefetch; | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			get linkPreload() { | 
					
						
							|  |  |  | 				const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation); | 
					
						
							|  |  |  | 				return hooks.linkPreload; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-07-30 20:25:40 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		this.renderCurrentHashCode = util.deprecate( | 
					
						
							|  |  |  | 			/** | 
					
						
							|  |  |  | 			 * @deprecated | 
					
						
							|  |  |  | 			 * @param {string} hash the hash | 
					
						
							|  |  |  | 			 * @param {number=} length length of the hash | 
					
						
							|  |  |  | 			 * @returns {string} generated code | 
					
						
							|  |  |  | 			 */ (hash, length) => { | 
					
						
							|  |  |  | 				if (length) { | 
					
						
							|  |  |  | 					return `${RuntimeGlobals.getFullHash} ? ${ | 
					
						
							|  |  |  | 						RuntimeGlobals.getFullHash | 
					
						
							|  |  |  | 					}().slice(0, ${length}) : ${hash.slice(0, length)}`;
 | 
					
						
							| 
									
										
										
										
											2019-09-30 16:08:08 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 				return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`; | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			"MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE" | 
					
						
							| 
									
										
										
										
											2019-09-30 16:08:08 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		this.getPublicPath = util.deprecate( | 
					
						
							|  |  |  | 			/** | 
					
						
							|  |  |  | 			 * | 
					
						
							|  |  |  | 			 * @param {object} options get public path options | 
					
						
							|  |  |  | 			 * @returns {string} hook call | 
					
						
							|  |  |  | 			 */ options => { | 
					
						
							|  |  |  | 				return compilation.getAssetPath( | 
					
						
							|  |  |  | 					compilation.outputOptions.publicPath, | 
					
						
							|  |  |  | 					options | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2020-03-13 00:51:26 +08:00
										 |  |  | 			"MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)", | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 			"DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH" | 
					
						
							| 
									
										
										
										
											2019-09-30 16:08:08 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		this.getAssetPath = util.deprecate( | 
					
						
							|  |  |  | 			(path, options) => { | 
					
						
							|  |  |  | 				return compilation.getAssetPath(path, options); | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			"MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH" | 
					
						
							| 
									
										
										
										
											2019-09-30 16:08:08 +08:00
										 |  |  | 		); | 
					
						
							| 
									
										
										
										
											2013-06-12 22:16:06 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		this.getAssetPathWithInfo = util.deprecate( | 
					
						
							|  |  |  | 			(path, options) => { | 
					
						
							|  |  |  | 				return compilation.getAssetPathWithInfo(path, options); | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			"MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO" | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		); | 
					
						
							| 
									
										
										
										
											2017-11-29 01:43:01 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Object.defineProperty(MainTemplate.prototype, "requireFn", { | 
					
						
							|  |  |  | 	get: util.deprecate( | 
					
						
							| 
									
										
										
										
											2023-05-20 00:00:54 +08:00
										 |  |  | 		() => RuntimeGlobals.require, | 
					
						
							|  |  |  | 		`MainTemplate.requireFn is deprecated (use "${RuntimeGlobals.require}")`, | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN" | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Object.defineProperty(MainTemplate.prototype, "outputOptions", { | 
					
						
							|  |  |  | 	get: util.deprecate( | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * @this {MainTemplate} | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | 		 * @returns {OutputOptions} output options | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2020-03-29 06:10:15 +08:00
										 |  |  | 		function () { | 
					
						
							| 
									
										
										
										
											2019-10-02 14:54:21 +08:00
										 |  |  | 			return this._outputOptions; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		"MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", | 
					
						
							|  |  |  | 		"DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS" | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = MainTemplate; |