| 
									
										
										
										
											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-01-08 14:15:46 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2018-04-04 15:17:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-28 23:23:23 +08:00
										 |  |  | const memoize = require("./util/memoize"); | 
					
						
							| 
									
										
										
										
											2021-03-11 22:04:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-28 17:50:33 +08:00
										 |  |  | /** @typedef {import("./ChunkGraph")} ChunkGraph */ | 
					
						
							| 
									
										
										
										
											2021-04-18 03:12:50 +08:00
										 |  |  | /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("./Module")} Module */ | 
					
						
							| 
									
										
										
										
											2018-07-17 22:42:05 +08:00
										 |  |  | /** @typedef {import("./ModuleGraph")} ModuleGraph */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */ | 
					
						
							| 
									
										
										
										
											2020-10-05 22:57:31 +08:00
										 |  |  | /** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | /** @typedef {import("./WebpackError")} WebpackError */ | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | /** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ | 
					
						
							|  |  |  | /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ | 
					
						
							| 
									
										
										
										
											2019-07-17 22:02:33 +08:00
										 |  |  | /** @typedef {import("./util/Hash")} Hash */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} UpdateHashContext | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  |  * @property {ChunkGraph} chunkGraph | 
					
						
							|  |  |  |  * @property {RuntimeSpec} runtime | 
					
						
							| 
									
										
										
										
											2020-10-26 21:00:11 +08:00
										 |  |  |  * @property {RuntimeTemplate=} runtimeTemplate | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-05-15 18:20:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} SourcePosition | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  |  * @property {number} line | 
					
						
							|  |  |  |  * @property {number=} column | 
					
						
							| 
									
										
										
										
											2018-06-22 02:58:54 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} RealDependencyLocation | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  |  * @property {SourcePosition} start | 
					
						
							|  |  |  |  * @property {SourcePosition=} end | 
					
						
							|  |  |  |  * @property {number=} index | 
					
						
							| 
									
										
										
										
											2018-06-25 16:43:59 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} SyntheticDependencyLocation | 
					
						
							| 
									
										
										
										
											2020-03-03 20:37:18 +08:00
										 |  |  |  * @property {string} name | 
					
						
							|  |  |  |  * @property {number=} index | 
					
						
							| 
									
										
										
										
											2018-05-15 18:20:17 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-21 20:09:45 +08:00
										 |  |  | /** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */ | 
					
						
							| 
									
										
										
										
											2018-06-25 16:43:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ExportSpec | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @property {string} name the name of the export | 
					
						
							| 
									
										
										
										
											2019-06-12 20:00:34 +08:00
										 |  |  |  * @property {boolean=} canMangle can the export be renamed (defaults to true) | 
					
						
							| 
									
										
										
										
											2020-08-12 00:06:27 +08:00
										 |  |  |  * @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts | 
					
						
							| 
									
										
										
										
											2019-10-31 06:24:13 +08:00
										 |  |  |  * @property {(string | ExportSpec)[]=} exports nested exports | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @property {ModuleGraphConnection=} from when reexported: from which module | 
					
						
							| 
									
										
										
										
											2019-06-12 20:00:34 +08:00
										 |  |  |  * @property {string[] | null=} export when reexported: from which export | 
					
						
							| 
									
										
										
										
											2021-04-07 03:14:54 +08:00
										 |  |  |  * @property {number=} priority when reexported: with which priority | 
					
						
							| 
									
										
										
										
											2021-02-23 04:55:35 +08:00
										 |  |  |  * @property {boolean=} hidden export is not visible, because another export blends over it | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | /** @typedef {Set<string>} ExportsSpecExcludeExports */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ExportsSpec | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  |  * @property {ExportsSpecExcludeExports=} excludeExports when exports = true, list of unaffected exports | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  |  * @property {(Set<string> | null)=} hideExports list of maybe prior exposed, but now hidden exports | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @property {ModuleGraphConnection=} from when reexported: from which module | 
					
						
							| 
									
										
										
										
											2021-04-07 03:14:54 +08:00
										 |  |  |  * @property {number=} priority when reexported: with which priority | 
					
						
							| 
									
										
										
										
											2020-03-05 20:31:58 +08:00
										 |  |  |  * @property {boolean=} canMangle can the export be renamed (defaults to true) | 
					
						
							| 
									
										
										
										
											2020-08-12 00:06:27 +08:00
										 |  |  |  * @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  |  * @property {Module[]=} dependencies module on which the result depends on | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-28 02:34:55 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ReferencedExport | 
					
						
							| 
									
										
										
										
											2020-06-10 19:31:01 +08:00
										 |  |  |  * @property {string[]} name name of the referenced export | 
					
						
							|  |  |  |  * @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true | 
					
						
							| 
									
										
										
										
											2020-05-28 02:34:55 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-11 08:10:10 +08:00
										 |  |  | /** @typedef {string[][]} RawReferencedExports */ | 
					
						
							|  |  |  | /** @typedef {(string[] | ReferencedExport)[]} ReferencedExports */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | /** @typedef {(moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState} GetConditionFn */ | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | const TRANSITIVE = Symbol("transitive"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-10 21:23:05 +08:00
										 |  |  | const getIgnoredModule = memoize(() => { | 
					
						
							| 
									
										
										
										
											2025-08-04 22:38:42 +08:00
										 |  |  | 	const RawModule = require("./RawModule"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-10 21:23:05 +08:00
										 |  |  | 	const module = new RawModule("/* (ignored) */", "ignored", "(ignored)"); | 
					
						
							|  |  |  | 	module.factoryMeta = { sideEffectFree: true }; | 
					
						
							|  |  |  | 	return module; | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2021-03-11 22:04:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | class Dependency { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							| 
									
										
										
										
											2023-06-17 02:24:34 +08:00
										 |  |  | 		/** @type {Module | undefined} */ | 
					
						
							| 
									
										
										
										
											2021-04-18 03:12:50 +08:00
										 |  |  | 		this._parentModule = undefined; | 
					
						
							| 
									
										
										
										
											2023-06-17 02:24:34 +08:00
										 |  |  | 		/** @type {DependenciesBlock | undefined} */ | 
					
						
							| 
									
										
										
										
											2021-04-18 03:12:50 +08:00
										 |  |  | 		this._parentDependenciesBlock = undefined; | 
					
						
							| 
									
										
										
										
											2021-10-05 23:25:33 +08:00
										 |  |  | 		/** @type {number} */ | 
					
						
							|  |  |  | 		this._parentDependenciesBlockIndex = -1; | 
					
						
							| 
									
										
										
										
											2019-10-29 18:04:50 +08:00
										 |  |  | 		// TODO check if this can be moved into ModuleDependency
 | 
					
						
							| 
									
										
										
										
											2018-06-25 16:43:59 +08:00
										 |  |  | 		/** @type {boolean} */ | 
					
						
							| 
									
										
										
										
											2017-08-08 15:28:34 +08:00
										 |  |  | 		this.weak = false; | 
					
						
							| 
									
										
										
										
											2019-10-29 18:04:50 +08:00
										 |  |  | 		// TODO check if this can be moved into ModuleDependency
 | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 		/** @type {boolean | undefined} */ | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 		this.optional = false; | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		this._locSL = 0; | 
					
						
							|  |  |  | 		this._locSC = 0; | 
					
						
							|  |  |  | 		this._locEL = 0; | 
					
						
							|  |  |  | 		this._locEC = 0; | 
					
						
							|  |  |  | 		this._locI = undefined; | 
					
						
							|  |  |  | 		this._locN = undefined; | 
					
						
							|  |  |  | 		this._loc = undefined; | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string} a display name for the type of dependency | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	get type() { | 
					
						
							|  |  |  | 		return "unknown"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-27 04:56:24 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2020-05-28 03:57:45 +08:00
										 |  |  | 	 * @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm" | 
					
						
							| 
									
										
										
										
											2020-05-27 04:56:24 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	get category() { | 
					
						
							| 
									
										
										
										
											2020-05-28 03:57:45 +08:00
										 |  |  | 		return "unknown"; | 
					
						
							| 
									
										
										
										
											2020-05-27 04:56:24 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {DependencyLocation} location | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	get loc() { | 
					
						
							|  |  |  | 		if (this._loc !== undefined) return this._loc; | 
					
						
							| 
									
										
										
										
											2025-05-15 00:04:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		/** @type {SyntheticDependencyLocation & RealDependencyLocation} */ | 
					
						
							| 
									
										
										
										
											2025-05-15 00:04:17 +08:00
										 |  |  | 		const loc = {}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		if (this._locSL > 0) { | 
					
						
							|  |  |  | 			loc.start = { line: this._locSL, column: this._locSC }; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (this._locEL > 0) { | 
					
						
							|  |  |  | 			loc.end = { line: this._locEL, column: this._locEC }; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-05-15 00:04:17 +08:00
										 |  |  | 		if (this._locN !== undefined) { | 
					
						
							|  |  |  | 			loc.name = this._locN; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (this._locI !== undefined) { | 
					
						
							|  |  |  | 			loc.index = this._locI; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-03-13 22:51:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		return (this._loc = loc); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	set loc(loc) { | 
					
						
							|  |  |  | 		if ("start" in loc && typeof loc.start === "object") { | 
					
						
							|  |  |  | 			this._locSL = loc.start.line || 0; | 
					
						
							|  |  |  | 			this._locSC = loc.start.column || 0; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			this._locSL = 0; | 
					
						
							|  |  |  | 			this._locSC = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if ("end" in loc && typeof loc.end === "object") { | 
					
						
							|  |  |  | 			this._locEL = loc.end.line || 0; | 
					
						
							|  |  |  | 			this._locEC = loc.end.column || 0; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			this._locEL = 0; | 
					
						
							|  |  |  | 			this._locEC = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2024-08-02 02:36:27 +08:00
										 |  |  | 		this._locI = "index" in loc ? loc.index : undefined; | 
					
						
							|  |  |  | 		this._locN = "name" in loc ? loc.name : undefined; | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		this._loc = loc; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-17 02:24:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {number} startLine start line | 
					
						
							|  |  |  | 	 * @param {number} startColumn start column | 
					
						
							|  |  |  | 	 * @param {number} endLine end line | 
					
						
							|  |  |  | 	 * @param {number} endColumn end column | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 	setLoc(startLine, startColumn, endLine, endColumn) { | 
					
						
							|  |  |  | 		this._locSL = startLine; | 
					
						
							|  |  |  | 		this._locSC = startColumn; | 
					
						
							|  |  |  | 		this._locEL = endLine; | 
					
						
							|  |  |  | 		this._locEC = endColumn; | 
					
						
							|  |  |  | 		this._locI = undefined; | 
					
						
							|  |  |  | 		this._locN = undefined; | 
					
						
							|  |  |  | 		this._loc = undefined; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-25 21:28:18 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string | undefined} a request context | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getContext() { | 
					
						
							|  |  |  | 		return undefined; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string | null} an identifier to merge equal requests | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2017-11-19 07:22:38 +08:00
										 |  |  | 	getResourceIdentifier() { | 
					
						
							|  |  |  | 		return null; | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	couldAffectReferencingModule() { | 
					
						
							|  |  |  | 		return TRANSITIVE; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns the referenced module and export | 
					
						
							| 
									
										
										
										
											2020-10-13 02:16:58 +08:00
										 |  |  | 	 * @deprecated | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 	 * @returns {never} throws error | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	getReference(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns list of exports referenced by this dependency | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {RuntimeSpec} runtime the runtime for which the module is analysed | 
					
						
							| 
									
										
										
										
											2025-09-11 08:10:10 +08:00
										 |  |  | 	 * @returns {ReferencedExports} referenced exports | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	getReferencedExports(moduleGraph, runtime) { | 
					
						
							| 
									
										
										
										
											2020-04-23 02:31:26 +08:00
										 |  |  | 		return Dependency.EXPORTS_OBJECT_REFERENCED; | 
					
						
							| 
									
										
										
										
											2019-10-30 04:37:59 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 	 * @returns {null | false | GetConditionFn} function to determine if the connection is active | 
					
						
							| 
									
										
										
										
											2019-10-30 04:37:59 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	getCondition(moduleGraph) { | 
					
						
							|  |  |  | 		return null; | 
					
						
							| 
									
										
										
										
											2015-10-22 03:05:01 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-06-24 07:51:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns the exported names | 
					
						
							| 
									
										
										
										
											2018-07-17 22:34:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 * @returns {ExportsSpec | undefined} export names | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-17 22:34:36 +08:00
										 |  |  | 	getExports(moduleGraph) { | 
					
						
							|  |  |  | 		return undefined; | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-09-06 05:41:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns warnings | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2023-06-17 02:24:34 +08:00
										 |  |  | 	 * @returns {WebpackError[] | null | undefined} warnings | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	getWarnings(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-10-22 03:05:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns errors | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2023-06-17 02:24:34 +08:00
										 |  |  | 	 * @returns {WebpackError[] | null | undefined} errors | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	getErrors(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2017-01-10 00:11:34 +08:00
										 |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Update the hash | 
					
						
							|  |  |  | 	 * @param {Hash} hash hash to be updated | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {UpdateHashContext} context context | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2021-01-25 00:14:13 +08:00
										 |  |  | 	updateHash(hash, context) {} | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-20 22:13:22 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * implement this method to allow the occurrence order plugin to count correctly | 
					
						
							|  |  |  | 	 * @returns {number} count how often the id is used in this dependency | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getNumberOfIdOccurrences() { | 
					
						
							|  |  |  | 		return 1; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 22:57:31 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  | 	 * @returns {ConnectionState} how this dependency connects the module to referencing modules | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getModuleEvaluationSideEffectsState(moduleGraph) { | 
					
						
							|  |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 22:04:53 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string} context context directory | 
					
						
							| 
									
										
										
										
											2025-05-13 21:03:58 +08:00
										 |  |  | 	 * @returns {Module} ignored module | 
					
						
							| 
									
										
										
										
											2021-03-11 22:04:53 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	createIgnoredModule(context) { | 
					
						
							|  |  |  | 		return getIgnoredModule(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectSerializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 	serialize({ write }) { | 
					
						
							|  |  |  | 		write(this.weak); | 
					
						
							|  |  |  | 		write(this.optional); | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		write(this._locSL); | 
					
						
							|  |  |  | 		write(this._locSC); | 
					
						
							|  |  |  | 		write(this._locEL); | 
					
						
							|  |  |  | 		write(this._locEC); | 
					
						
							|  |  |  | 		write(this._locI); | 
					
						
							|  |  |  | 		write(this._locN); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectDeserializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 	deserialize({ read }) { | 
					
						
							|  |  |  | 		this.weak = read(); | 
					
						
							|  |  |  | 		this.optional = read(); | 
					
						
							| 
									
										
										
										
											2021-04-27 07:21:22 +08:00
										 |  |  | 		this._locSL = read(); | 
					
						
							|  |  |  | 		this._locSC = read(); | 
					
						
							|  |  |  | 		this._locEL = read(); | 
					
						
							|  |  |  | 		this._locEC = read(); | 
					
						
							|  |  |  | 		this._locI = read(); | 
					
						
							|  |  |  | 		this._locN = read(); | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-20 22:13:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-11 08:10:10 +08:00
										 |  |  | /** @type {RawReferencedExports} */ | 
					
						
							| 
									
										
										
										
											2019-10-30 14:57:55 +08:00
										 |  |  | Dependency.NO_EXPORTS_REFERENCED = []; | 
					
						
							| 
									
										
										
										
											2025-09-11 08:10:10 +08:00
										 |  |  | /** @type {RawReferencedExports} */ | 
					
						
							| 
									
										
										
										
											2020-04-23 02:31:26 +08:00
										 |  |  | Dependency.EXPORTS_OBJECT_REFERENCED = [[]]; | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | Object.defineProperty(Dependency.prototype, "module", { | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	 * @deprecated | 
					
						
							| 
									
										
										
										
											2025-04-03 00:02:22 +08:00
										 |  |  | 	 * @returns {EXPECTED_ANY} throws | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	get() { | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @deprecated | 
					
						
							|  |  |  | 	 * @returns {never} throws | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	set() { | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)" | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | Object.defineProperty(Dependency.prototype, "disconnect", { | 
					
						
							| 
									
										
										
										
											2025-04-03 00:02:22 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @deprecated | 
					
						
							|  |  |  | 	 * @returns {EXPECTED_ANY} throws | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	get() { | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							|  |  |  | 			"disconnect was removed from Dependency (Dependency no longer carries graph specific information)" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2018-07-09 14:48:34 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | Dependency.TRANSITIVE = TRANSITIVE; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-08 14:15:46 +08:00
										 |  |  | module.exports = Dependency; |