| 
									
										
										
										
											2013-01-31 01:49:25 +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-04-04 05:22:23 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | const util = require("util"); | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | const AbstractMethodError = require("./AbstractMethodError"); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | const ChunkGraph = require("./ChunkGraph"); | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | const DependenciesBlock = require("./DependenciesBlock"); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | const ModuleGraph = require("./ModuleGraph"); | 
					
						
							|  |  |  | const { compareChunksById } = require("./util/comparators"); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | const makeSerializable = require("./util/makeSerializable"); | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("webpack-sources").Source} Source */ | 
					
						
							| 
									
										
										
										
											2020-02-17 17:27:46 +08:00
										 |  |  | /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */ | 
					
						
							| 
									
										
										
										
											2018-04-21 07:51:40 +08:00
										 |  |  | /** @typedef {import("./Chunk")} Chunk */ | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | /** @typedef {import("./ChunkGroup")} ChunkGroup */ | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | /** @typedef {import("./Compilation")} Compilation */ | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | /** @typedef {import("./Dependency")} Dependency */ | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ | 
					
						
							| 
									
										
										
										
											2018-09-27 13:22:19 +08:00
										 |  |  | /** @typedef {import("./FileSystemInfo")} FileSystemInfo */ | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** @typedef {import("./ModuleGraph").UsageStateType} UsageStateType */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("./RequestShortener")} RequestShortener */ | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | /** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */ | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | /** @typedef {import("./WebpackError")} WebpackError */ | 
					
						
							| 
									
										
										
										
											2019-07-17 22:02:33 +08:00
										 |  |  | /** @typedef {import("./util/Hash")} Hash */ | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | /** @template T @typedef {import("./util/SortableSet")<T>} SortableSet<T> */ | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */ | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 00:57:03 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} SourceContext | 
					
						
							|  |  |  |  * @property {DependencyTemplates} dependencyTemplates the dependency templates | 
					
						
							|  |  |  |  * @property {RuntimeTemplate} runtimeTemplate the runtime template | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  |  * @property {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  |  * @property {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-18 00:57:03 +08:00
										 |  |  |  * @property {string=} type the type of source that should be generated | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} CodeGenerationContext | 
					
						
							|  |  |  |  * @property {DependencyTemplates} dependencyTemplates the dependency templates | 
					
						
							|  |  |  |  * @property {RuntimeTemplate} runtimeTemplate the runtime template | 
					
						
							|  |  |  |  * @property {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  |  * @property {ChunkGraph} chunkGraph the chunk graph | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} CodeGenerationResult | 
					
						
							|  |  |  |  * @property {Map<string, Source>} sources the resulting sources for all source types | 
					
						
							| 
									
										
										
										
											2020-01-29 17:28:33 +08:00
										 |  |  |  * @property {ReadonlySet<string>} runtimeRequirements the runtime requirements | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-20 22:24:35 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} LibIdentOptions | 
					
						
							|  |  |  |  * @property {string} context absolute context path to which lib ident is relative to | 
					
						
							| 
									
										
										
										
											2019-01-19 19:40:00 +08:00
										 |  |  |  * @property {Object=} associatedObjectForCache object for caching | 
					
						
							| 
									
										
										
										
											2018-07-20 22:24:35 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} KnownBuildMeta | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  |  * @property {string=} moduleArgument | 
					
						
							|  |  |  |  * @property {string=} exportsArgument | 
					
						
							|  |  |  |  * @property {boolean=} strict | 
					
						
							|  |  |  |  * @property {string=} moduleConcatenationBailout | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  |  * @property {("default" | "namespace" | "flagged")=} exportsType | 
					
						
							|  |  |  |  * @property {(boolean | "redirect" | "redirect-warn")=} defaultObject | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  |  * @property {boolean=} strictHarmonyModule | 
					
						
							|  |  |  |  * @property {boolean=} async | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-26 15:14:44 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {Object} NeedBuildContext | 
					
						
							| 
									
										
										
										
											2018-09-27 13:22:19 +08:00
										 |  |  |  * @property {FileSystemInfo} fileSystemInfo | 
					
						
							| 
									
										
										
										
											2018-09-26 15:14:44 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | /** @typedef {KnownBuildMeta & Record<string, any>} BuildMeta */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-17 21:26:23 +08:00
										 |  |  | const EMPTY_RESOLVE_OPTIONS = {}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | let debugId = 1000; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | const DEFAULT_TYPES_UNKNOWN = new Set(["unknown"]); | 
					
						
							|  |  |  | const DEFAULT_TYPES_JS = new Set(["javascript"]); | 
					
						
							| 
									
										
										
										
											2018-12-03 22:00:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | /** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-19 20:13:44 +08:00
										 |  |  | class Module extends DependenciesBlock { | 
					
						
							| 
									
										
										
										
											2018-11-07 21:03:25 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string} type the module type | 
					
						
							|  |  |  | 	 * @param {string=} context an optional context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-01-31 04:40:44 +08:00
										 |  |  | 	constructor(type, context = null) { | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 		super(); | 
					
						
							| 
									
										
										
										
											2018-11-07 21:03:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | 		/** @type {string} */ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 		this.type = type; | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | 		/** @type {string} */ | 
					
						
							| 
									
										
										
										
											2018-01-31 04:40:44 +08:00
										 |  |  | 		this.context = context; | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 		/** @type {boolean} */ | 
					
						
							|  |  |  | 		this.needId = true; | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Unique Id
 | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | 		/** @type {number} */ | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 		this.debugId = debugId++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Info from Factory
 | 
					
						
							| 
									
										
										
										
											2018-05-15 18:20:17 +08:00
										 |  |  | 		/** @type {TODO} */ | 
					
						
							| 
									
										
										
										
											2017-11-17 21:26:23 +08:00
										 |  |  | 		this.resolveOptions = EMPTY_RESOLVE_OPTIONS; | 
					
						
							| 
									
										
										
										
											2019-11-08 19:52:32 +08:00
										 |  |  | 		/** @type {object | undefined} */ | 
					
						
							|  |  |  | 		this.factoryMeta = undefined; | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Info from Build
 | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | 		/** @type {WebpackError[] | undefined} */ | 
					
						
							|  |  |  | 		this._warnings = undefined; | 
					
						
							|  |  |  | 		/** @type {WebpackError[] | undefined} */ | 
					
						
							|  |  |  | 		this._errors = undefined; | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 		/** @type {BuildMeta} */ | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 		this.buildMeta = undefined; | 
					
						
							| 
									
										
										
										
											2018-04-12 15:18:53 +08:00
										 |  |  | 		/** @type {object} */ | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 		this.buildInfo = undefined; | 
					
						
							| 
									
										
										
										
											2019-11-08 22:39:44 +08:00
										 |  |  | 		/** @type {Dependency[] | undefined} */ | 
					
						
							|  |  |  | 		this.presentationalDependencies = undefined; | 
					
						
							| 
									
										
										
										
											2016-07-13 17:03:14 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	// TODO remove in webpack 6
 | 
					
						
							|  |  |  | 	// BACKWARD-COMPAT START
 | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 	get id() { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							|  |  |  | 			"Module.id", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_ID" | 
					
						
							|  |  |  | 		).getModuleId(this); | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set id(value) { | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 		if (value === "") { | 
					
						
							|  |  |  | 			this.needId = false; | 
					
						
							|  |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		ChunkGraph.getChunkGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.id", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_ID" | 
					
						
							|  |  |  | 		).setModuleId(this, value); | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 01:23:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string} the hash of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	get hash() { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							|  |  |  | 			"Module.hash", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_HASH" | 
					
						
							|  |  |  | 		).getModuleHash(this); | 
					
						
							| 
									
										
										
										
											2018-08-23 01:23:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string} the shortened hash of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	get renderedHash() { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.renderedHash", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_RENDERED_HASHED" | 
					
						
							| 
									
										
										
										
											2018-08-23 01:23:48 +08:00
										 |  |  | 		).getRenderedModuleHash(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 	get profile() { | 
					
						
							|  |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.profile", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_PROFILE" | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 		).getProfile(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set profile(value) { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		ModuleGraph.getModuleGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.profile", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_PROFILE" | 
					
						
							|  |  |  | 		).setProfile(this, value); | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	get index() { | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.index", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_INDEX" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getPreOrderIndex(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set index(value) { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		ModuleGraph.getModuleGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.index", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_INDEX" | 
					
						
							|  |  |  | 		).setPreOrderIndex(this, value); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get index2() { | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.index2", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_INDEX2" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getPostOrderIndex(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set index2(value) { | 
					
						
							|  |  |  | 		ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.index2", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_INDEX2" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).setPostOrderIndex(this, value); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 	get depth() { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							|  |  |  | 			"Module.depth", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_DEPTH" | 
					
						
							|  |  |  | 		).getDepth(this); | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set depth(value) { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		ModuleGraph.getModuleGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.depth", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_DEPTH" | 
					
						
							|  |  |  | 		).setDepth(this, value); | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	get issuer() { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							|  |  |  | 			"Module.issuer", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_ISSUER" | 
					
						
							|  |  |  | 		).getIssuer(this); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set issuer(value) { | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		ModuleGraph.getModuleGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.issuer", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_ISSUER" | 
					
						
							|  |  |  | 		).setIssuer(this, value); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get usedExports() { | 
					
						
							|  |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.usedExports", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_USED_EXPORTS" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getUsedExports(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get optimizationBailout() { | 
					
						
							|  |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.optimizationBailout", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_OPTIMIZATION_BAILOUT" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getOptimizationBailout(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get optional() { | 
					
						
							|  |  |  | 		return this.isOptional( | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 				this, | 
					
						
							|  |  |  | 				"Module.optional", | 
					
						
							|  |  |  | 				"DEP_WEBPACK_MODULE_OPTIONAL" | 
					
						
							|  |  |  | 			) | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	addChunk(chunk) { | 
					
						
							| 
									
										
										
										
											2019-11-08 20:21:21 +08:00
										 |  |  | 		const chunkGraph = ChunkGraph.getChunkGraphForModule( | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.addChunk", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_ADD_CHUNK" | 
					
						
							| 
									
										
										
										
											2019-11-08 20:21:21 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 		if (chunkGraph.isModuleInChunk(this, chunk)) return false; | 
					
						
							|  |  |  | 		chunkGraph.connectChunkAndModule(chunk, this); | 
					
						
							|  |  |  | 		return true; | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	removeChunk(chunk) { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.removeChunk", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_REMOVE_CHUNK" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).disconnectChunkAndModule(chunk, this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	isInChunk(chunk) { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.isInChunk", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_IS_IN_CHUNK" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).isModuleInChunk(this, chunk); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	isEntryModule() { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.isEntryModule", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_IS_ENTRY_MODULE" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).isEntryModule(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getChunks() { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.getChunks", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_GET_CHUNKS" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getModuleChunks(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getNumberOfChunks() { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.getNumberOfChunks", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_GET_NUMBER_OF_CHUNKS" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getNumberOfModuleChunks(this); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get chunksIterable() { | 
					
						
							|  |  |  | 		return ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.chunksIterable", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_CHUNKS_ITERABLE" | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 		).getOrderedModuleChunksIterable(this, compareChunksById); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string} exportName a name of an export | 
					
						
							|  |  |  | 	 * @returns {boolean | null} true, if the export is provided why the module. | 
					
						
							|  |  |  | 	 *                           null, if it's unknown. | 
					
						
							|  |  |  | 	 *                           false, if it's not provided. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	isProvided(exportName) { | 
					
						
							|  |  |  | 		return ModuleGraph.getModuleGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 			"Module.usedExports", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_USED_EXPORTS" | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 		).isExportProvided(this, exportName); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 	// BACKWARD-COMPAT END
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @deprecated moved to .buildInfo.exportsArgument | 
					
						
							|  |  |  | 	 * @returns {string} name of the exports argument | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 	get exportsArgument() { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		return (this.buildInfo && this.buildInfo.exportsArgument) || "exports"; | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @deprecated moved to .buildInfo.moduleArgument | 
					
						
							|  |  |  | 	 * @returns {string} name of the module argument | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 	get moduleArgument() { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		return (this.buildInfo && this.buildInfo.moduleArgument) || "module"; | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {boolean} strict the importing module is strict | 
					
						
							|  |  |  | 	 * @returns {"dynamic" | "dynamic-default" | "namespace" | "default-only" | "default-with-named"} export type | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getExportsType(strict) { | 
					
						
							|  |  |  | 		switch (this.buildMeta && this.buildMeta.exportsType) { | 
					
						
							|  |  |  | 			case "flagged": | 
					
						
							|  |  |  | 				return strict ? "dynamic-default" : "namespace"; | 
					
						
							|  |  |  | 			case "namespace": | 
					
						
							|  |  |  | 				return "namespace"; | 
					
						
							|  |  |  | 			case "default": | 
					
						
							|  |  |  | 				switch (this.buildMeta.defaultObject) { | 
					
						
							|  |  |  | 					case "redirect": | 
					
						
							|  |  |  | 					case "redirect-warn": | 
					
						
							|  |  |  | 						return strict ? "default-only" : "default-with-named"; | 
					
						
							|  |  |  | 					default: | 
					
						
							|  |  |  | 						return "default-only"; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				return strict ? "dynamic-default" : "dynamic"; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-30 13:40:40 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} presentationalDependency dependency being tied to module. | 
					
						
							|  |  |  | 	 * This is a Dependency without edge in the module graph. It's only for presentation. | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	addPresentationalDependency(presentationalDependency) { | 
					
						
							| 
									
										
										
										
											2019-11-08 22:39:44 +08:00
										 |  |  | 		if (this.presentationalDependencies === undefined) { | 
					
						
							|  |  |  | 			this.presentationalDependencies = []; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-10-30 13:40:40 +08:00
										 |  |  | 		this.presentationalDependencies.push(presentationalDependency); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-08 22:39:44 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Removes all dependencies and blocks | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	clearDependenciesAndBlocks() { | 
					
						
							|  |  |  | 		if (this.presentationalDependencies !== undefined) { | 
					
						
							|  |  |  | 			this.presentationalDependencies.length = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		super.clearDependenciesAndBlocks(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {WebpackError} warning the warning | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	addWarning(warning) { | 
					
						
							|  |  |  | 		if (this._warnings === undefined) { | 
					
						
							|  |  |  | 			this._warnings = []; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		this._warnings.push(warning); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {Iterable<WebpackError> | undefined} list of warnings if any | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getWarnings() { | 
					
						
							|  |  |  | 		return this._warnings; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {WebpackError} error the error | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	addError(error) { | 
					
						
							|  |  |  | 		if (this._errors === undefined) { | 
					
						
							|  |  |  | 			this._errors = []; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		this._errors.push(error); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {Iterable<WebpackError> | undefined} list of errors if any | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getErrors() { | 
					
						
							|  |  |  | 		return this._errors; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * removes all warnings and errors | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	clearWarningsAndErrors() { | 
					
						
							|  |  |  | 		if (this._warnings !== undefined) { | 
					
						
							|  |  |  | 			this._warnings.length = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (this._errors !== undefined) { | 
					
						
							|  |  |  | 			this._errors.length = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 * @returns {boolean} true, if the module is optional | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	isOptional(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2019-11-08 05:12:31 +08:00
										 |  |  | 		let hasConnections = false; | 
					
						
							|  |  |  | 		for (const r of moduleGraph.getIncomingConnections(this)) { | 
					
						
							|  |  |  | 			if (!r.dependency || !r.dependency.optional || !r.active) return false; | 
					
						
							|  |  |  | 			hasConnections = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return hasConnections; | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-02 22:18:49 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	 * @param {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 * @param {Chunk} chunk a chunk | 
					
						
							|  |  |  | 	 * @param {Chunk=} ignoreChunk chunk to be ignored | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the module is accessible from "chunk" when ignoring "ignoreChunk" | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	isAccessibleInChunk(chunkGraph, chunk, ignoreChunk) { | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		// Check if module is accessible in ALL chunk groups
 | 
					
						
							|  |  |  | 		for (const chunkGroup of chunk.groupsIterable) { | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 			if (!this.isAccessibleInChunkGroup(chunkGraph, chunkGroup)) return false; | 
					
						
							| 
									
										
										
										
											2014-09-08 04:54:38 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		return true; | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-05-17 06:31:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	 * @param {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 * @param {ChunkGroup} chunkGroup a chunk group | 
					
						
							|  |  |  | 	 * @param {Chunk=} ignoreChunk chunk to be ignored | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the module is accessible from "chunkGroup" when ignoring "ignoreChunk" | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	isAccessibleInChunkGroup(chunkGraph, chunkGroup, ignoreChunk) { | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		const queue = new Set([chunkGroup]); | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		// Check if module is accessible from all items of the queue
 | 
					
						
							|  |  |  | 		queueFor: for (const cg of queue) { | 
					
						
							|  |  |  | 			// 1. If module is in one of the chunks of the group we can continue checking the next items
 | 
					
						
							|  |  |  | 			//    because it's accessible.
 | 
					
						
							|  |  |  | 			for (const chunk of cg.chunks) { | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 				if (chunk !== ignoreChunk && chunkGraph.isModuleInChunk(this, chunk)) | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 					continue queueFor; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// 2. If the chunk group is initial, we can break here because it's not accessible.
 | 
					
						
							|  |  |  | 			if (chunkGroup.isInitial()) return false; | 
					
						
							|  |  |  | 			// 3. Enqueue all parents because it must be accessible from ALL parents
 | 
					
						
							|  |  |  | 			for (const parent of chunkGroup.parentsIterable) queue.add(parent); | 
					
						
							| 
									
										
										
										
											2018-05-29 20:50:40 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		// When we processed through the whole list and we didn't bailout, the module is accessible
 | 
					
						
							|  |  |  | 		return true; | 
					
						
							| 
									
										
										
										
											2017-11-25 00:22:58 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Chunk} chunk a chunk | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	 * @param {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 * @returns {boolean} true, if the module has any reason why "chunk" should be included | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 	hasReasonForChunk(chunk, moduleGraph, chunkGraph) { | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		// check for each reason if we need the chunk
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		for (const connection of moduleGraph.getIncomingConnections(this)) { | 
					
						
							| 
									
										
										
										
											2019-10-30 04:37:59 +08:00
										 |  |  | 			if (!connection.active) continue; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 			const fromModule = connection.originModule; | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 			for (const originChunk of chunkGraph.getModuleChunksIterable( | 
					
						
							|  |  |  | 				fromModule | 
					
						
							|  |  |  | 			)) { | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 				// return true if module this is not reachable from originChunk when ignoring cunk
 | 
					
						
							| 
									
										
										
										
											2018-08-14 17:18:22 +08:00
										 |  |  | 				if (!this.isAccessibleInChunk(chunkGraph, originChunk, chunk)) | 
					
						
							|  |  |  | 					return true; | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-06-14 00:58:14 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-01-22 19:34:34 +08:00
										 |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  | 	 * @returns {boolean} true if at least one other module depends on this module | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	hasReasons(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2019-11-08 05:12:31 +08:00
										 |  |  | 		for (const c of moduleGraph.getIncomingConnections(this)) { | 
					
						
							|  |  |  | 			if (c.active) return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-07-13 17:03:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	 * @returns {boolean} true, if the module is used | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	isModuleUsed(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		return moduleGraph.getExportsInfo(this).isUsed() !== false; | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	 * @param {string | string[]} exportName a name of an export | 
					
						
							|  |  |  | 	 * @returns {UsageStateType} state of the export | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	isExportUsed(moduleGraph, exportName) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		return moduleGraph.getExportsInfo(this).isExportUsed(exportName); | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 	// TODO move to ModuleGraph
 | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	 * @param {string | string[]} exportName a name of an export | 
					
						
							|  |  |  | 	 * @returns {string | string[] | false} false, when module or referenced export is unused. | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	 *                           string, the mangled export name when used. | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:24 +08:00
										 |  |  | 	getUsedName(moduleGraph, exportName) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		return moduleGraph.getExportsInfo(this).getUsedName(exportName); | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-07-13 17:03:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string} for debugging | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	toString() { | 
					
						
							| 
									
										
										
										
											2018-08-28 17:50:33 +08:00
										 |  |  | 		return `Module[${this.debugId}: ${this.identifier()}]`; | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-09-26 15:14:44 +08:00
										 |  |  | 	 * @param {NeedBuildContext} context context info | 
					
						
							|  |  |  | 	 * @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-09-26 15:14:44 +08:00
										 |  |  | 	needBuild(context, callback) { | 
					
						
							|  |  |  | 		callback( | 
					
						
							|  |  |  | 			null, | 
					
						
							|  |  |  | 			!this.buildMeta || | 
					
						
							| 
									
										
										
										
											2018-09-27 13:22:19 +08:00
										 |  |  | 				this.needRebuild === Module.prototype.needRebuild || | 
					
						
							|  |  |  | 				this.needRebuild( | 
					
						
							|  |  |  | 					context.fileSystemInfo.getDeprecatedFileTimestamps(), | 
					
						
							|  |  |  | 					context.fileSystemInfo.getDeprecatedContextTimestamps() | 
					
						
							|  |  |  | 				) | 
					
						
							| 
									
										
										
										
											2018-09-12 00:47:55 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @deprecated Use needBuild instead | 
					
						
							|  |  |  | 	 * @param {TODO} fileTimestamps timestamps of files | 
					
						
							|  |  |  | 	 * @param {TODO} contextTimestamps timestamps of directories | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the module needs a rebuild | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	needRebuild(fileTimestamps, contextTimestamps) { | 
					
						
							|  |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-21 00:17:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Hash} hash the hash used to track dependencies | 
					
						
							| 
									
										
										
										
											2018-08-23 23:07:23 +08:00
										 |  |  | 	 * @param {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-21 00:17:51 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 	updateHash( | 
					
						
							|  |  |  | 		hash, | 
					
						
							| 
									
										
										
										
											2019-11-15 17:07:41 +08:00
										 |  |  | 		chunkGraph = ChunkGraph.getChunkGraphForModule( | 
					
						
							|  |  |  | 			this, | 
					
						
							|  |  |  | 			"Module.updateHash", | 
					
						
							|  |  |  | 			"DEP_WEBPACK_MODULE_UPDATE_HASH" | 
					
						
							|  |  |  | 		) | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 	) { | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 		hash.update(`${chunkGraph.getModuleId(this)}`); | 
					
						
							| 
									
										
										
										
											2019-02-20 18:32:12 +08:00
										 |  |  | 		const exportsInfo = chunkGraph.moduleGraph.getExportsInfo(this); | 
					
						
							|  |  |  | 		for (const exportInfo of exportsInfo.orderedExports) { | 
					
						
							|  |  |  | 			hash.update(exportInfo.name); | 
					
						
							|  |  |  | 			hash.update(exportInfo.used + ""); | 
					
						
							| 
									
										
										
										
											2019-12-06 14:10:25 +08:00
										 |  |  | 			hash.update( | 
					
						
							|  |  |  | 				exportInfo.usedName === ModuleGraph.SKIP_OVER_NAME | 
					
						
							|  |  |  | 					? "<skip-over-name>" | 
					
						
							|  |  |  | 					: exportInfo.usedName + "" | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-11-08 22:39:44 +08:00
										 |  |  | 		if (this.presentationalDependencies !== undefined) { | 
					
						
							|  |  |  | 			for (const dep of this.presentationalDependencies) { | 
					
						
							|  |  |  | 				dep.updateHash(hash, chunkGraph); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-10-30 13:40:40 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-08-23 23:07:23 +08:00
										 |  |  | 		super.updateHash(hash, chunkGraph); | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-12-05 06:47:19 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:38:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-09-12 00:47:55 +08:00
										 |  |  | 	invalidateBuild() { | 
					
						
							|  |  |  | 		// should be overriden to support this feature
 | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							|  |  |  | 	 * @returns {string} a unique identifier of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	identifier() { | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | 		throw new AbstractMethodError(); | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							|  |  |  | 	 * @param {RequestShortener} requestShortener the request shortener | 
					
						
							|  |  |  | 	 * @returns {string} a user readable identifier of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	readableIdentifier(requestShortener) { | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | 		throw new AbstractMethodError(); | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | 	 * @param {WebpackOptions} options webpack options | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | 	 * @param {ResolverWithOptions} resolver the resolver | 
					
						
							|  |  |  | 	 * @param {InputFileSystem} fs the file system | 
					
						
							| 
									
										
										
										
											2018-09-12 00:47:55 +08:00
										 |  |  | 	 * @param {function(WebpackError=): void} callback callback function | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	build(options, compilation, resolver, fs, callback) { | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | 		throw new AbstractMethodError(); | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-03 22:00:32 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							|  |  |  | 	 * @returns {Set<string>} types availiable (do not mutate) | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getSourceTypes() { | 
					
						
							| 
									
										
										
										
											2019-09-26 21:51:40 +08:00
										 |  |  | 		// Better override this method to return the correct types
 | 
					
						
							|  |  |  | 		if (this.source === Module.prototype.source) { | 
					
						
							|  |  |  | 			return DEFAULT_TYPES_UNKNOWN; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			return DEFAULT_TYPES_JS; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-12-03 22:00:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	 * @deprecated Use codeGeneration() instead | 
					
						
							| 
									
										
										
										
											2018-07-18 00:57:03 +08:00
										 |  |  | 	 * @param {SourceContext} sourceContext source context | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 * @returns {Source} generated source | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-18 00:57:03 +08:00
										 |  |  | 	source(sourceContext) { | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 		if (this.codeGeneration === Module.prototype.codeGeneration) { | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | 			throw new AbstractMethodError(); | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		const sources = this.codeGeneration(sourceContext).sources; | 
					
						
							|  |  |  | 		return sourceContext.type | 
					
						
							|  |  |  | 			? sources.get(sourceContext.type) | 
					
						
							|  |  |  | 			: sources.get( | 
					
						
							|  |  |  | 					this.getSourceTypes() | 
					
						
							|  |  |  | 						.values() | 
					
						
							|  |  |  | 						.next().value | 
					
						
							|  |  |  | 			  ); | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							| 
									
										
										
										
											2018-12-04 18:23:40 +08:00
										 |  |  | 	 * @param {string=} type the source type for which the size should be estimated | 
					
						
							| 
									
										
										
										
											2019-05-13 18:29:29 +08:00
										 |  |  | 	 * @returns {number} the estimated size of the module (must be non-zero) | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-12-04 18:23:40 +08:00
										 |  |  | 	size(type) { | 
					
						
							| 
									
										
										
										
											2019-09-28 01:50:23 +08:00
										 |  |  | 		throw new AbstractMethodError(); | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-06-06 22:37:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-20 22:24:35 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {LibIdentOptions} options options | 
					
						
							|  |  |  | 	 * @returns {string | null} an identifier for library inclusion | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	libIdent(options) { | 
					
						
							|  |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	nameForCondition() { | 
					
						
							|  |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-06-06 22:37:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-06 02:03:12 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	 * @abstract | 
					
						
							|  |  |  | 	 * @deprecated Use codeGeneration() instead | 
					
						
							| 
									
										
										
										
											2018-11-06 02:03:12 +08:00
										 |  |  | 	 * Get a list of runtime requirements | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	 * @param {SourceContext} context context for code generation | 
					
						
							| 
									
										
										
										
											2020-01-29 17:28:33 +08:00
										 |  |  | 	 * @returns {ReadonlySet<string> | null} required runtime modules | 
					
						
							| 
									
										
										
										
											2018-11-06 02:03:12 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	getRuntimeRequirements(context) { | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 		if (this.codeGeneration === Module.prototype.codeGeneration) { | 
					
						
							|  |  |  | 			return null; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return this.codeGeneration(context).runtimeRequirements; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {CodeGenerationContext} context context for code generation | 
					
						
							|  |  |  | 	 * @returns {CodeGenerationResult} result | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	codeGeneration(context) { | 
					
						
							|  |  |  | 		// Best override this method
 | 
					
						
							|  |  |  | 		const sources = new Map(); | 
					
						
							|  |  |  | 		for (const type of this.getSourceTypes()) { | 
					
						
							|  |  |  | 			if (type !== "unknown") { | 
					
						
							|  |  |  | 				sources.set( | 
					
						
							|  |  |  | 					type, | 
					
						
							|  |  |  | 					this.source({ | 
					
						
							|  |  |  | 						...context, | 
					
						
							|  |  |  | 						type | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return { | 
					
						
							|  |  |  | 			sources, | 
					
						
							|  |  |  | 			runtimeRequirements: this.getRuntimeRequirements(context) | 
					
						
							|  |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2018-11-06 02:03:12 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Chunk} chunk the chunk which condition should be checked | 
					
						
							| 
									
										
										
										
											2018-08-14 22:40:37 +08:00
										 |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 * @returns {boolean} true, if the chunk is ok for the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-14 22:40:37 +08:00
										 |  |  | 	chunkCondition(chunk, compilation) { | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Assuming this module is in the cache. Update the (cached) module with | 
					
						
							|  |  |  | 	 * the fresh module from the factory. Usually updates internal references | 
					
						
							|  |  |  | 	 * and properties. | 
					
						
							|  |  |  | 	 * @param {Module} module fresh module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	updateCacheModule(module) { | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		this.type = module.type; | 
					
						
							|  |  |  | 		this.context = module.context; | 
					
						
							|  |  |  | 		this.factoryMeta = module.factoryMeta; | 
					
						
							|  |  |  | 		this.resolveOptions = module.resolveOptions; | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-25 18:20:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {Source | null} the original source for the module before webpack transformation | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	originalSource() { | 
					
						
							|  |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	serialize(context) { | 
					
						
							|  |  |  | 		const { write } = context; | 
					
						
							|  |  |  | 		write(this.type); | 
					
						
							|  |  |  | 		write(this.context); | 
					
						
							|  |  |  | 		write(this.resolveOptions); | 
					
						
							|  |  |  | 		write(this.factoryMeta); | 
					
						
							|  |  |  | 		write(this.useSourceMap); | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | 		write( | 
					
						
							|  |  |  | 			this._warnings !== undefined && this._warnings.length === 0 | 
					
						
							|  |  |  | 				? undefined | 
					
						
							|  |  |  | 				: this._warnings | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		write( | 
					
						
							|  |  |  | 			this._errors !== undefined && this._errors.length === 0 | 
					
						
							|  |  |  | 				? undefined | 
					
						
							|  |  |  | 				: this._errors | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		write(this.buildMeta); | 
					
						
							|  |  |  | 		write(this.buildInfo); | 
					
						
							| 
									
										
										
										
											2019-10-30 13:40:40 +08:00
										 |  |  | 		write(this.presentationalDependencies); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		super.serialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	deserialize(context) { | 
					
						
							|  |  |  | 		const { read } = context; | 
					
						
							|  |  |  | 		this.type = read(); | 
					
						
							|  |  |  | 		this.context = read(); | 
					
						
							|  |  |  | 		this.resolveOptions = read(); | 
					
						
							|  |  |  | 		this.factoryMeta = read(); | 
					
						
							|  |  |  | 		this.useSourceMap = read(); | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | 		this._warnings = read(); | 
					
						
							|  |  |  | 		this._errors = read(); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		this.buildMeta = read(); | 
					
						
							|  |  |  | 		this.buildInfo = read(); | 
					
						
							| 
									
										
										
										
											2019-10-30 13:40:40 +08:00
										 |  |  | 		this.presentationalDependencies = read(); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		super.deserialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | makeSerializable(Module, "webpack/lib/Module"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-15 19:17:36 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							| 
									
										
										
										
											2018-08-08 22:29:15 +08:00
										 |  |  | Object.defineProperty(Module.prototype, "hasEqualsChunks", { | 
					
						
							|  |  |  | 	get() { | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"Module.hasEqualsChunks was renamed (use hasEqualChunks instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-15 19:17:36 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:46 +08:00
										 |  |  | Object.defineProperty(Module.prototype, "isUsed", { | 
					
						
							|  |  |  | 	get() { | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"Module.isUsed was renamed (use getUsedName, isExportUsed or isModuleUsed instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-08 19:43:05 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							|  |  |  | Object.defineProperty(Module.prototype, "errors", { | 
					
						
							|  |  |  | 	get: util.deprecate( | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * @this {Module} | 
					
						
							|  |  |  | 		 * @returns {WebpackError[]} array | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		function() { | 
					
						
							|  |  |  | 			if (this._errors === undefined) { | 
					
						
							|  |  |  | 				this._errors = []; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return this._errors; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		"Module.errors was removed (use getErrors instead)", | 
					
						
							|  |  |  | 		"DEP_WEBPACK_MODULE_ERRORS" | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // TODO remove in webpack 6
 | 
					
						
							|  |  |  | Object.defineProperty(Module.prototype, "warnings", { | 
					
						
							|  |  |  | 	get: util.deprecate( | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * @this {Module} | 
					
						
							|  |  |  | 		 * @returns {WebpackError[]} array | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		function() { | 
					
						
							|  |  |  | 			if (this._warnings === undefined) { | 
					
						
							|  |  |  | 				this._warnings = []; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return this._warnings; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		"Module.warnings was removed (use getWarnings instead)", | 
					
						
							|  |  |  | 		"DEP_WEBPACK_MODULE_WARNINGS" | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-15 19:17:36 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:46 +08:00
										 |  |  | Object.defineProperty(Module.prototype, "used", { | 
					
						
							|  |  |  | 	get() { | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"Module.used was refactored (use ModuleGraph.getUsedExports instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:46 +08:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	set(value) { | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"Module.used was refactored (use ModuleGraph.setUsedExports instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-08-07 03:01:46 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-04 05:22:23 +08:00
										 |  |  | module.exports = Module; |