| 
									
										
										
										
											2018-07-17 22:41:07 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | const util = require("util"); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | const ModuleGraphConnection = require("./ModuleGraphConnection"); | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | const SortableSet = require("./util/SortableSet"); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | /** @typedef {import("./DependenciesBlock")} DependenciesBlock */ | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | /** @typedef {import("./Dependency")} Dependency */ | 
					
						
							|  |  |  | /** @typedef {import("./Module")} Module */ | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | /** @typedef {import("./ModuleProfile")} ModuleProfile */ | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | /** @typedef {import("./RequestShortener")} RequestShortener */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @callback OptimizationBailoutFunction | 
					
						
							|  |  |  |  * @param {RequestShortener} requestShortener | 
					
						
							|  |  |  |  * @returns {string} | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** @typedef {0|1|2|3|4} UsageStateType */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const UsageState = Object.freeze({ | 
					
						
							|  |  |  | 	NoInfo: /** @type {0} */ (0), | 
					
						
							|  |  |  | 	Unused: /** @type {1} */ (1), | 
					
						
							|  |  |  | 	Unknown: /** @type {2} */ (2), | 
					
						
							|  |  |  | 	OnlyPropertiesUsed: /** @type {3} */ (3), | 
					
						
							|  |  |  | 	Used: /** @type {4} */ (4) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | class ExportsInfo { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		/** @type {Map<string, ExportInfo>} */ | 
					
						
							|  |  |  | 		this._exports = new Map(); | 
					
						
							|  |  |  | 		this._otherExportsInfo = new ExportInfo(null); | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*"); | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		this._exportsAreOrdered = false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setTo(exportsInfo) { | 
					
						
							|  |  |  | 		this._otherExportsInfo = new ExportInfo( | 
					
						
							|  |  |  | 			null, | 
					
						
							|  |  |  | 			exportsInfo._otherExportsInfo | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		this._sideEffectsOnlyInfo = new ExportInfo( | 
					
						
							|  |  |  | 			"*side effects only*", | 
					
						
							|  |  |  | 			exportsInfo._sideEffectsOnlyInfo | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		this._exportsAreOrdered = exportsInfo._exportsAreOrdered; | 
					
						
							|  |  |  | 		this._exports.clear(); | 
					
						
							|  |  |  | 		for (const exportInfo of exportsInfo.exports) { | 
					
						
							|  |  |  | 			this._exports.set( | 
					
						
							|  |  |  | 				exportInfo.name, | 
					
						
							|  |  |  | 				new ExportInfo(exportInfo.name, exportInfo) | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get exports() { | 
					
						
							|  |  |  | 		return this._exports.values(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	get orderedExports() { | 
					
						
							|  |  |  | 		if (!this._exportsAreOrdered) { | 
					
						
							|  |  |  | 			this._sortExports(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return this._exports.values(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	get otherExportsInfo() { | 
					
						
							|  |  |  | 		return this._otherExportsInfo; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	_sortExports() { | 
					
						
							| 
									
										
										
										
											2019-08-07 17:54:36 +08:00
										 |  |  | 		const exports = this._exports; | 
					
						
							|  |  |  | 		if (exports.size > 1) { | 
					
						
							|  |  |  | 			const entriesInOrder = Array.from(exports.values()); | 
					
						
							|  |  |  | 			if ( | 
					
						
							|  |  |  | 				entriesInOrder.length !== 2 || | 
					
						
							|  |  |  | 				entriesInOrder[0].name > entriesInOrder[1].name | 
					
						
							|  |  |  | 			) { | 
					
						
							|  |  |  | 				entriesInOrder.sort((a, b) => { | 
					
						
							|  |  |  | 					return a.name < b.name ? -1 : 1; | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 				exports.clear(); | 
					
						
							|  |  |  | 				for (const entry of entriesInOrder) { | 
					
						
							|  |  |  | 					exports.set(entry.name, entry); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		this._exportsAreOrdered = true; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setHasProvideInfo() { | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			if (exportInfo.provided === undefined) { | 
					
						
							|  |  |  | 				exportInfo.provided = false; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			if (exportInfo.canMangleProvide === undefined) { | 
					
						
							|  |  |  | 				exportInfo.canMangleProvide = true; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (this._otherExportsInfo.provided === undefined) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.provided = false; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (this._otherExportsInfo.canMangleProvide === undefined) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.canMangleProvide = true; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 	setHasUseInfo() { | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (exportInfo.used === UsageState.NoInfo) { | 
					
						
							|  |  |  | 				exportInfo.used = UsageState.Unused; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			if (exportInfo.canMangleUse === undefined) { | 
					
						
							|  |  |  | 				exportInfo.canMangleUse = true; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._otherExportsInfo.used === UsageState.NoInfo) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.used = UsageState.Unused; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (this._otherExportsInfo.canMangleUse === undefined) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.canMangleUse = true; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._sideEffectsOnlyInfo.used === UsageState.NoInfo) { | 
					
						
							|  |  |  | 			this._sideEffectsOnlyInfo.used = UsageState.Unused; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	getExportInfo(name) { | 
					
						
							|  |  |  | 		const info = this._exports.get(name); | 
					
						
							|  |  |  | 		if (info !== undefined) return info; | 
					
						
							| 
									
										
										
										
											2019-02-01 18:45:24 +08:00
										 |  |  | 		if (!name) | 
					
						
							|  |  |  | 			throw new Error("ModuleGraph.getExportInfo name must be a valid string"); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		const newInfo = new ExportInfo(name, this._otherExportsInfo); | 
					
						
							|  |  |  | 		this._exports.set(name, newInfo); | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		this._exportsAreOrdered = false; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		return newInfo; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getReadOnlyExportInfo(name) { | 
					
						
							|  |  |  | 		const info = this._exports.get(name); | 
					
						
							|  |  |  | 		if (info !== undefined) return info; | 
					
						
							|  |  |  | 		return this._otherExportsInfo; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string[]=} name the export name | 
					
						
							|  |  |  | 	 * @returns {ExportsInfo | undefined} the nested exports info | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getNestedExportsInfo(name) { | 
					
						
							|  |  |  | 		if (Array.isArray(name) && name.length > 0) { | 
					
						
							|  |  |  | 			let info = this._exports.get(name[0]); | 
					
						
							|  |  |  | 			if (info === undefined) info = this._otherExportsInfo; | 
					
						
							|  |  |  | 			if (!info.exportsInfo) return undefined; | 
					
						
							|  |  |  | 			return info.exportsInfo.getNestedExportsInfo(name.slice(1)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return this; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if this call changed something | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setUnknownExportsProvided() { | 
					
						
							|  |  |  | 		let changed = false; | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			if (exportInfo.provided !== true && exportInfo.provided !== null) { | 
					
						
							|  |  |  | 				exportInfo.provided = null; | 
					
						
							|  |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			if (exportInfo.canMangleProvide !== false) { | 
					
						
							|  |  |  | 				exportInfo.canMangleProvide = false; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if ( | 
					
						
							|  |  |  | 			this._otherExportsInfo.provided !== true && | 
					
						
							|  |  |  | 			this._otherExportsInfo.provided !== null | 
					
						
							|  |  |  | 		) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.provided = null; | 
					
						
							|  |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (this._otherExportsInfo.canMangleProvide !== false) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.canMangleProvide = false; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return changed; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 	setUsedInUnknownWay() { | 
					
						
							|  |  |  | 		let changed = false; | 
					
						
							|  |  |  | 		if (this._isUsed === false) { | 
					
						
							|  |  |  | 			this._isUsed = true; | 
					
						
							|  |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (exportInfo.used < UsageState.Unknown) { | 
					
						
							|  |  |  | 				exportInfo.used = UsageState.Unknown; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			if (exportInfo.canMangleUse !== false) { | 
					
						
							|  |  |  | 				exportInfo.canMangleUse = false; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._otherExportsInfo.used < UsageState.Unknown) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.used = UsageState.Unknown; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (this._otherExportsInfo.canMangleUse !== false) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.canMangleUse = false; | 
					
						
							|  |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return changed; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	setAllKnownExportsUsed() { | 
					
						
							|  |  |  | 		let changed = false; | 
					
						
							|  |  |  | 		if (this._isUsed === false) { | 
					
						
							|  |  |  | 			this._isUsed = true; | 
					
						
							|  |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			if (exportInfo.used !== UsageState.Used) { | 
					
						
							|  |  |  | 				exportInfo.used = UsageState.Used; | 
					
						
							|  |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return changed; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	setUsedAsNamedExportType() { | 
					
						
							|  |  |  | 		let changed = false; | 
					
						
							|  |  |  | 		if (this._isUsed === false) { | 
					
						
							|  |  |  | 			this._isUsed = true; | 
					
						
							|  |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		this.getExportInfo("default").used = UsageState.Used; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (exportInfo.used < UsageState.Unknown) { | 
					
						
							|  |  |  | 				exportInfo.used = UsageState.Unknown; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (exportInfo.name !== "default" && exportInfo.canMangleUse !== false) { | 
					
						
							|  |  |  | 				exportInfo.canMangleUse = false; | 
					
						
							|  |  |  | 				changed = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._otherExportsInfo.used < UsageState.Unknown) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.used = UsageState.Unknown; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (this._otherExportsInfo.canMangleUse !== false) { | 
					
						
							|  |  |  | 			this._otherExportsInfo.canMangleUse = false; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			changed = true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return changed; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setUsedForSideEffectsOnly() { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._sideEffectsOnlyInfo.used === UsageState.Unused) { | 
					
						
							|  |  |  | 			this._sideEffectsOnlyInfo.used = UsageState.Used; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	isUsed() { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._otherExportsInfo.used !== UsageState.Unused) { | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this._sideEffectsOnlyInfo.used !== UsageState.Unused) { | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (exportInfo.used !== UsageState.Unused) { | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-02-05 01:52:39 +08:00
										 |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getUsedExports() { | 
					
						
							|  |  |  | 		switch (this._otherExportsInfo.used) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.NoInfo: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return null; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.Unknown: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return true; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.OnlyPropertiesUsed: | 
					
						
							|  |  |  | 			case UsageState.Used: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		const array = []; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (!this._exportsAreOrdered) this._sortExports(); | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			switch (exportInfo.used) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				case UsageState.NoInfo: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 					return null; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				case UsageState.Unknown: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 					return true; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				case UsageState.OnlyPropertiesUsed: | 
					
						
							|  |  |  | 				case UsageState.Used: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 					array.push(exportInfo.name); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (array.length === 0) { | 
					
						
							|  |  |  | 			switch (this._sideEffectsOnlyInfo.used) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				case UsageState.NoInfo: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 					return null; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				case UsageState.Unused: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 					return false; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return new SortableSet(array); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	getProvidedExports() { | 
					
						
							|  |  |  | 		switch (this._otherExportsInfo.provided) { | 
					
						
							|  |  |  | 			case undefined: | 
					
						
							|  |  |  | 				return null; | 
					
						
							|  |  |  | 			case null: | 
					
						
							|  |  |  | 				return true; | 
					
						
							|  |  |  | 			case true: | 
					
						
							|  |  |  | 				return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		const array = []; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		if (!this._exportsAreOrdered) this._sortExports(); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			switch (exportInfo.provided) { | 
					
						
							|  |  |  | 				case undefined: | 
					
						
							|  |  |  | 					return null; | 
					
						
							|  |  |  | 				case null: | 
					
						
							|  |  |  | 					return true; | 
					
						
							|  |  |  | 				case true: | 
					
						
							|  |  |  | 					array.push(exportInfo.name); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return array; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string | string[]} name the name of the export | 
					
						
							|  |  |  | 	 * @returns {boolean | undefined | null} if the export is provided | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	isExportProvided(name) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (Array.isArray(name)) { | 
					
						
							| 
									
										
										
										
											2019-08-22 22:59:37 +08:00
										 |  |  | 			let info = this._exports.get(name[0]); | 
					
						
							|  |  |  | 			if (info === undefined) info = this._otherExportsInfo; | 
					
						
							|  |  |  | 			if (info.exportsInfo && name.length > 1) { | 
					
						
							|  |  |  | 				return info.exportsInfo.isExportProvided(name.slice(1)); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return info.provided; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		let info = this._exports.get(name); | 
					
						
							|  |  |  | 		if (info === undefined) info = this._otherExportsInfo; | 
					
						
							|  |  |  | 		return info.provided; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string | string[]} name export name | 
					
						
							|  |  |  | 	 * @returns {UsageStateType} usage status | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	isExportUsed(name) { | 
					
						
							|  |  |  | 		if (Array.isArray(name)) { | 
					
						
							|  |  |  | 			if (name.length === 0) return this.otherExportsInfo.used; | 
					
						
							| 
									
										
										
										
											2019-08-22 22:59:37 +08:00
										 |  |  | 			let info = this._exports.get(name[0]); | 
					
						
							|  |  |  | 			if (info === undefined) info = this._otherExportsInfo; | 
					
						
							|  |  |  | 			if (info.exportsInfo && name.length > 1) { | 
					
						
							|  |  |  | 				return info.exportsInfo.isExportUsed(name.slice(1)); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return info.used; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		let info = this._exports.get(name); | 
					
						
							|  |  |  | 		if (info === undefined) info = this._otherExportsInfo; | 
					
						
							|  |  |  | 		return info.used; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string | string[]} name the export name | 
					
						
							|  |  |  | 	 * @returns {string | string[] | false} the used name | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getUsedName(name) { | 
					
						
							|  |  |  | 		if (Array.isArray(name)) { | 
					
						
							|  |  |  | 			// TODO improve this
 | 
					
						
							|  |  |  | 			if (name.length === 0) return name; | 
					
						
							|  |  |  | 			let info = this._exports.get(name[0]); | 
					
						
							|  |  |  | 			if (info === undefined) info = this._otherExportsInfo; | 
					
						
							| 
									
										
										
										
											2019-05-29 19:47:18 +08:00
										 |  |  | 			const x = info.getUsedName(name[0]); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (!x) return false; | 
					
						
							| 
									
										
										
										
											2019-08-07 16:25:23 +08:00
										 |  |  | 			if (name.length === 1) { | 
					
						
							|  |  |  | 				if (x === name[0]) return name; | 
					
						
							|  |  |  | 				return [x]; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			if (info.exportsInfo) { | 
					
						
							|  |  |  | 				const nested = info.exportsInfo.getUsedName(name.slice(1)); | 
					
						
							|  |  |  | 				if (!nested) return false; | 
					
						
							|  |  |  | 				return [x].concat(nested); | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				return [x].concat(name.slice(1)); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			let info = this._exports.get(name); | 
					
						
							|  |  |  | 			if (info === undefined) info = this._otherExportsInfo; | 
					
						
							| 
									
										
										
										
											2019-05-29 19:47:18 +08:00
										 |  |  | 			return info.getUsedName(name); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	getRestoreProvidedData() { | 
					
						
							|  |  |  | 		const otherProvided = this._otherExportsInfo.provided; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		const exports = []; | 
					
						
							|  |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			if ( | 
					
						
							|  |  |  | 				exportInfo.provided !== otherProvided || | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 				exportInfo.canMangleProvide !== otherCanMangleProvide | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			) { | 
					
						
							|  |  |  | 				exports.push({ | 
					
						
							|  |  |  | 					name: exportInfo.name, | 
					
						
							|  |  |  | 					provided: exportInfo.provided, | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 					canMangleProvide: exportInfo.canMangleProvide | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return { | 
					
						
							|  |  |  | 			exports, | 
					
						
							|  |  |  | 			otherProvided, | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			otherCanMangleProvide | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		}; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	restoreProvided({ otherProvided, otherCanMangleProvide, exports }) { | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		for (const exportInfo of this._exports.values()) { | 
					
						
							|  |  |  | 			exportInfo.provided = otherProvided; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			exportInfo.canMangleProvide = otherCanMangleProvide; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		this._otherExportsInfo.provided = otherProvided; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		this._otherExportsInfo.canMangleProvide = otherCanMangleProvide; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		for (const exp of exports) { | 
					
						
							|  |  |  | 			const exportInfo = this.getExportInfo(exp.name); | 
					
						
							|  |  |  | 			exportInfo.provided = exp.provided; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 			exportInfo.canMangleProvide = exp.canMangleProvide; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ExportInfo { | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string} name the original name of the export | 
					
						
							|  |  |  | 	 * @param {ExportInfo=} initFrom init values from this ExportInfo | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	constructor(name, initFrom) { | 
					
						
							|  |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this.name = name; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		/** @type {string | null} */ | 
					
						
							|  |  |  | 		this.usedName = initFrom ? initFrom.usedName : null; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		/** @type {UsageStateType} */ | 
					
						
							|  |  |  | 		this.used = initFrom ? initFrom.used : UsageState.NoInfo; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		/** | 
					
						
							|  |  |  | 		 * true: it is provided | 
					
						
							|  |  |  | 		 * false: it is not provided | 
					
						
							|  |  |  | 		 * null: only the runtime knows if it is provided | 
					
						
							|  |  |  | 		 * undefined: it was not determined if it is provided | 
					
						
							|  |  |  | 		 * @type {boolean | null | undefined} | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		this.provided = initFrom ? initFrom.provided : undefined; | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * true: it can be mangled | 
					
						
							|  |  |  | 		 * false: is can not be mangled | 
					
						
							|  |  |  | 		 * undefined: it was not determined if it can be mangled | 
					
						
							|  |  |  | 		 * @type {boolean | undefined} | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		this.canMangleProvide = initFrom ? initFrom.canMangleProvide : undefined; | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * true: it can be mangled | 
					
						
							|  |  |  | 		 * false: is can not be mangled | 
					
						
							|  |  |  | 		 * undefined: it was not determined if it can be mangled | 
					
						
							|  |  |  | 		 * @type {boolean | undefined} | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		this.canMangleUse = initFrom ? initFrom.canMangleUse : undefined; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		/** @type {ExportsInfo=} */ | 
					
						
							|  |  |  | 		this.exportsInfo = undefined; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get canMangle() { | 
					
						
							|  |  |  | 		switch (this.canMangleProvide) { | 
					
						
							|  |  |  | 			case undefined: | 
					
						
							|  |  |  | 				return this.canMangleUse === false ? false : undefined; | 
					
						
							|  |  |  | 			case false: | 
					
						
							|  |  |  | 				return false; | 
					
						
							|  |  |  | 			case true: | 
					
						
							|  |  |  | 				switch (this.canMangleUse) { | 
					
						
							|  |  |  | 					case undefined: | 
					
						
							|  |  |  | 						return undefined; | 
					
						
							|  |  |  | 					case false: | 
					
						
							|  |  |  | 						return false; | 
					
						
							|  |  |  | 					case true: | 
					
						
							|  |  |  | 						return true; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							| 
									
										
										
										
											2019-06-13 16:51:12 +08:00
										 |  |  | 			`Unexpected flags for canMangle ${this.canMangleProvide} ${this.canMangleUse}` | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-29 19:47:18 +08:00
										 |  |  | 	getUsedName(fallbackName) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if (this.used === UsageState.Unused) return false; | 
					
						
							| 
									
										
										
										
											2019-05-29 19:47:18 +08:00
										 |  |  | 		return this.usedName || this.name || fallbackName; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getUsedInfo() { | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		switch (this.used) { | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.NoInfo: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return "no usage info"; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.Unknown: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return "maybe used (runtime-defined)"; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.Used: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return "used"; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.Unused: | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 				return "unused"; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case UsageState.OnlyPropertiesUsed: | 
					
						
							|  |  |  | 				return "only properties used"; | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	getProvidedInfo() { | 
					
						
							|  |  |  | 		switch (this.provided) { | 
					
						
							|  |  |  | 			case undefined: | 
					
						
							|  |  |  | 				return "no provided info"; | 
					
						
							|  |  |  | 			case null: | 
					
						
							|  |  |  | 				return "maybe provided (runtime-defined)"; | 
					
						
							|  |  |  | 			case true: | 
					
						
							|  |  |  | 				return "provided"; | 
					
						
							|  |  |  | 			case false: | 
					
						
							|  |  |  | 				return "not provided"; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	getRenameInfo() { | 
					
						
							|  |  |  | 		switch (this.canMangleProvide) { | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			case undefined: | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 				switch (this.canMangleUse) { | 
					
						
							|  |  |  | 					case undefined: | 
					
						
							|  |  |  | 						return "missing provision and use info prevents renaming"; | 
					
						
							|  |  |  | 					case false: | 
					
						
							|  |  |  | 						return "usage prevents renaming (no provision info)"; | 
					
						
							|  |  |  | 					case true: | 
					
						
							|  |  |  | 						return "missing provision info prevents renaming"; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			case true: | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 				switch (this.canMangleUse) { | 
					
						
							|  |  |  | 					case undefined: | 
					
						
							|  |  |  | 						return "missing usage info prevents renaming"; | 
					
						
							|  |  |  | 					case false: | 
					
						
							|  |  |  | 						return "usage prevents renaming"; | 
					
						
							|  |  |  | 					case true: | 
					
						
							|  |  |  | 						if (this.usedName && this.usedName !== this.name) { | 
					
						
							|  |  |  | 							return `renamed to ${this.usedName}`; | 
					
						
							|  |  |  | 						} else { | 
					
						
							|  |  |  | 							return "can be renamed"; | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 			case false: | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 				switch (this.canMangleUse) { | 
					
						
							|  |  |  | 					case undefined: | 
					
						
							|  |  |  | 						return "provision prevents renaming (no use info)"; | 
					
						
							|  |  |  | 					case false: | 
					
						
							|  |  |  | 						return "usage and provision prevents renaming"; | 
					
						
							|  |  |  | 					case true: | 
					
						
							|  |  |  | 						return "provision prevents renaming"; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		throw new Error( | 
					
						
							| 
									
										
										
										
											2019-06-13 16:51:12 +08:00
										 |  |  | 			`Unexpected flags for getRenameInfo ${this.canMangleProvide} ${this.canMangleUse}` | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | class ModuleGraphModule { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		/** @type {Set<ModuleGraphConnection>} */ | 
					
						
							|  |  |  | 		this.incomingConnections = new Set(); | 
					
						
							|  |  |  | 		/** @type {Set<ModuleGraphConnection>} */ | 
					
						
							|  |  |  | 		this.outgoingConnections = new Set(); | 
					
						
							|  |  |  | 		/** @type {Module | null} */ | 
					
						
							| 
									
										
										
										
											2018-10-09 20:30:59 +08:00
										 |  |  | 		this.issuer = undefined; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		/** @type {(string | OptimizationBailoutFunction)[]} */ | 
					
						
							|  |  |  | 		this.optimizationBailout = []; | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		/** @type {ExportsInfo} */ | 
					
						
							|  |  |  | 		this.exports = new ExportsInfo(); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 		/** @type {number} */ | 
					
						
							|  |  |  | 		this.preOrderIndex = null; | 
					
						
							|  |  |  | 		/** @type {number} */ | 
					
						
							|  |  |  | 		this.postOrderIndex = null; | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 		/** @type {number} */ | 
					
						
							|  |  |  | 		this.depth = null; | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 		/** @type {ModuleProfile} */ | 
					
						
							|  |  |  | 		this.profile = undefined; | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  | 		/** @type {boolean} */ | 
					
						
							|  |  |  | 		this.async = false; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | class ModuleGraphDependency { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		/** @type {ModuleGraphConnection} */ | 
					
						
							|  |  |  | 		this.connection = undefined; | 
					
						
							|  |  |  | 		/** @type {Module} */ | 
					
						
							|  |  |  | 		this.parentModule = undefined; | 
					
						
							|  |  |  | 		/** @type {DependenciesBlock} */ | 
					
						
							|  |  |  | 		this.parentBlock = undefined; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 22:41:07 +08:00
										 |  |  | class ModuleGraph { | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	constructor() { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		/** @type {Map<Dependency, ModuleGraphDependency>} */ | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		this._dependencyMap = new Map(); | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		/** @type {Map<Module, ModuleGraphModule>} */ | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		this._moduleMap = new Map(); | 
					
						
							|  |  |  | 		/** @type {Map<Module, Set<ModuleGraphConnection>>} */ | 
					
						
							|  |  |  | 		this._originMap = new Map(); | 
					
						
							|  |  |  | 		/** @type {Map<any, Object>} */ | 
					
						
							|  |  |  | 		this._metaMap = new Map(); | 
					
						
							| 
									
										
										
										
											2019-08-07 17:55:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Caching
 | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleKey1 = undefined; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleValue1 = undefined; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleKey2 = undefined; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleValue2 = undefined; | 
					
						
							|  |  |  | 		this._cacheModuleGraphDependencyKey = undefined; | 
					
						
							|  |  |  | 		this._cacheModuleGraphDependencyValue = undefined; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {ModuleGraphModule} the internal module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	_getModuleGraphModule(module) { | 
					
						
							| 
									
										
										
										
											2019-08-07 17:55:18 +08:00
										 |  |  | 		if (this._cacheModuleGraphModuleKey1 === module) | 
					
						
							|  |  |  | 			return this._cacheModuleGraphModuleValue1; | 
					
						
							|  |  |  | 		if (this._cacheModuleGraphModuleKey2 === module) | 
					
						
							|  |  |  | 			return this._cacheModuleGraphModuleValue2; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		let mgm = this._moduleMap.get(module); | 
					
						
							|  |  |  | 		if (mgm === undefined) { | 
					
						
							|  |  |  | 			mgm = new ModuleGraphModule(); | 
					
						
							|  |  |  | 			this._moduleMap.set(module, mgm); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-08-07 17:55:18 +08:00
										 |  |  | 		this._cacheModuleGraphModuleKey2 = this._cacheModuleGraphModuleKey1; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleValue2 = this._cacheModuleGraphModuleValue1; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleKey1 = module; | 
					
						
							|  |  |  | 		this._cacheModuleGraphModuleValue1 = mgm; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		return mgm; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency | 
					
						
							|  |  |  | 	 * @returns {ModuleGraphDependency} the internal dependency | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	_getModuleGraphDependency(dependency) { | 
					
						
							| 
									
										
										
										
											2019-08-07 17:55:18 +08:00
										 |  |  | 		if (this._cacheModuleGraphDependencyKey === dependency) | 
					
						
							|  |  |  | 			return this._cacheModuleGraphDependencyValue; | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		let mgd = this._dependencyMap.get(dependency); | 
					
						
							|  |  |  | 		if (mgd === undefined) { | 
					
						
							|  |  |  | 			mgd = new ModuleGraphDependency(); | 
					
						
							|  |  |  | 			this._dependencyMap.set(dependency, mgd); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-08-07 17:55:18 +08:00
										 |  |  | 		this._cacheModuleGraphDependencyKey = dependency; | 
					
						
							|  |  |  | 		this._cacheModuleGraphDependencyValue = mgd; | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		return mgd; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency | 
					
						
							|  |  |  | 	 * @param {DependenciesBlock} block parent block | 
					
						
							|  |  |  | 	 * @param {Module} module parent module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setParents(dependency, block, module) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const mgd = this._getModuleGraphDependency(dependency); | 
					
						
							|  |  |  | 		mgd.parentBlock = block; | 
					
						
							|  |  |  | 		mgd.parentModule = module; | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency | 
					
						
							|  |  |  | 	 * @returns {Module} parent module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getParentModule(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const mgd = this._getModuleGraphDependency(dependency); | 
					
						
							|  |  |  | 		return mgd.parentModule; | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency | 
					
						
							|  |  |  | 	 * @returns {DependenciesBlock} parent block | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getParentBlock(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const mgd = this._getModuleGraphDependency(dependency); | 
					
						
							|  |  |  | 		return mgd.parentBlock; | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} originModule the referencing module | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the referencing dependency | 
					
						
							|  |  |  | 	 * @param {Module} module the referenced module | 
					
						
							|  |  |  | 	 * @returns {void}} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setResolvedModule(originModule, dependency, module) { | 
					
						
							|  |  |  | 		const connection = new ModuleGraphConnection( | 
					
						
							|  |  |  | 			originModule, | 
					
						
							|  |  |  | 			dependency, | 
					
						
							|  |  |  | 			module | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const mgd = this._getModuleGraphDependency(dependency); | 
					
						
							|  |  |  | 		mgd.connection = connection; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const connections = this._getModuleGraphModule(module).incomingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		connections.add(connection); | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const originConnections = this._getModuleGraphModule(originModule) | 
					
						
							|  |  |  | 			.outgoingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		originConnections.add(connection); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the referencing dependency | 
					
						
							|  |  |  | 	 * @param {Module} module the referenced module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	updateModule(dependency, module) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		if (connection.module === module) return; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const oldMgm = this._getModuleGraphModule(connection.module); | 
					
						
							|  |  |  | 		oldMgm.incomingConnections.delete(connection); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		connection.module = module; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const newMgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		newMgm.incomingConnections.add(connection); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the referencing dependency | 
					
						
							|  |  |  | 	 * @param {string} explanation an explanation | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	addExplanation(dependency, explanation) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		connection.addExplanation(explanation); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-09-03 19:49:00 +08:00
										 |  |  | 	 * @param {Module} sourceModule the source module | 
					
						
							|  |  |  | 	 * @param {Module} targetModule the target module | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-09-03 19:49:00 +08:00
										 |  |  | 	cloneModuleAttributes(sourceModule, targetModule) { | 
					
						
							|  |  |  | 		const oldMgm = this._getModuleGraphModule(sourceModule); | 
					
						
							|  |  |  | 		const newMgm = this._getModuleGraphModule(targetModule); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 		newMgm.postOrderIndex = oldMgm.postOrderIndex; | 
					
						
							|  |  |  | 		newMgm.preOrderIndex = oldMgm.preOrderIndex; | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 		newMgm.depth = oldMgm.depth; | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 		newMgm.exports = oldMgm.exports; | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  | 		newMgm.async = oldMgm.async; | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	removeModuleAttributes(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.postOrderIndex = null; | 
					
						
							|  |  |  | 		mgm.preOrderIndex = null; | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 		mgm.depth = null; | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  | 		mgm.async = false; | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	removeAllModuleAttributes() { | 
					
						
							|  |  |  | 		for (const mgm of this._moduleMap.values()) { | 
					
						
							|  |  |  | 			mgm.postOrderIndex = null; | 
					
						
							|  |  |  | 			mgm.preOrderIndex = null; | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 			mgm.depth = null; | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  | 			mgm.async = false; | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} oldModule the old referencing module | 
					
						
							|  |  |  | 	 * @param {Module} newModule the new referencing module | 
					
						
							| 
									
										
										
										
											2018-07-27 21:57:44 +08:00
										 |  |  | 	 * @param {function(ModuleGraphConnection): boolean} filterConnection filter predicate for replacement | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	moveModuleConnections(oldModule, newModule, filterConnection) { | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		if (oldModule === newModule) return; | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const oldMgm = this._getModuleGraphModule(oldModule); | 
					
						
							|  |  |  | 		const newMgm = this._getModuleGraphModule(newModule); | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 		// Outgoing connections
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const oldConnections = oldMgm.outgoingConnections; | 
					
						
							|  |  |  | 		const newConnections = newMgm.outgoingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		for (const connection of oldConnections) { | 
					
						
							| 
									
										
										
										
											2018-07-27 21:57:44 +08:00
										 |  |  | 			if (filterConnection(connection)) { | 
					
						
							|  |  |  | 				connection.originModule = newModule; | 
					
						
							|  |  |  | 				newConnections.add(connection); | 
					
						
							|  |  |  | 				oldConnections.delete(connection); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 		// Incoming connections
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const oldConnections2 = oldMgm.incomingConnections; | 
					
						
							|  |  |  | 		const newConnections2 = newMgm.incomingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		for (const connection of oldConnections2) { | 
					
						
							| 
									
										
										
										
											2018-07-27 21:57:44 +08:00
										 |  |  | 			if (filterConnection(connection)) { | 
					
						
							|  |  |  | 				connection.module = newModule; | 
					
						
							|  |  |  | 				newConnections2.add(connection); | 
					
						
							|  |  |  | 				oldConnections2.delete(connection); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the referenced module | 
					
						
							|  |  |  | 	 * @param {string} explanation an explanation why it's referenced | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	addExtraReason(module, explanation) { | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const connections = this._getModuleGraphModule(module).incomingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		connections.add(new ModuleGraphConnection(null, null, module, explanation)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency to look for a referenced module | 
					
						
							|  |  |  | 	 * @returns {Module} the referenced module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getResolvedModule(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return connection !== undefined ? connection.resolvedModule : null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency to look for a referenced module | 
					
						
							|  |  |  | 	 * @returns {ModuleGraphConnection | undefined} the connection | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getConnection(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return connection; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency to look for a referenced module | 
					
						
							|  |  |  | 	 * @returns {Module} the referenced module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getModule(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return connection !== undefined ? connection.module : null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency to look for a referencing module | 
					
						
							|  |  |  | 	 * @returns {Module} the referencing module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getOrigin(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return connection !== undefined ? connection.originModule : null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency to look for a referencing module | 
					
						
							|  |  |  | 	 * @returns {Module} the original referencing module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getResolvedOrigin(dependency) { | 
					
						
							| 
									
										
										
										
											2018-08-16 20:04:37 +08:00
										 |  |  | 		const { connection } = this._getModuleGraphDependency(dependency); | 
					
						
							| 
									
										
										
										
											2018-08-07 20:20:53 +08:00
										 |  |  | 		return connection !== undefined ? connection.resolvedOriginModule : null; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {ModuleGraphConnection[]} reasons why a module is included | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getIncomingConnections(module) { | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const connections = this._getModuleGraphModule(module).incomingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return Array.from(connections); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {ModuleGraphConnection[]} list of outgoing connections | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-12-06 19:30:22 +08:00
										 |  |  | 	getOutgoingConnections(module) { | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 		const connections = this._getModuleGraphModule(module).outgoingConnections; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 		return Array.from(connections); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-22 20:54:28 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {ModuleProfile | null} the module profile | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getProfile(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.profile; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {ModuleProfile | null} profile the module profile | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setProfile(module, profile) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.profile = profile; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {Module | null} the issuer module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getIssuer(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.issuer; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {Module | null} issuer the issuer module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setIssuer(module, issuer) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.issuer = issuer; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-07 17:56:26 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {Module | null} issuer the issuer module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setIssuerIfUnset(module, issuer) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		if (mgm.issuer === undefined) mgm.issuer = issuer; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getOptimizationBailout(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.optimizationBailout; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							| 
									
										
										
										
											2018-12-31 19:43:03 +08:00
										 |  |  | 	 * @returns {true | string[] | null} the provided exports | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	getProvidedExports(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		return mgm.exports.getProvidedExports(); | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	 * @param {string | string[]} exportName a name of an export | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	 * @returns {boolean | null} true, if the export is provided by the module. | 
					
						
							|  |  |  | 	 *                           null, if it's unknown. | 
					
						
							|  |  |  | 	 *                           false, if it's not provided. | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	isExportProvided(module, exportName) { | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		const result = mgm.exports.isExportProvided(exportName); | 
					
						
							|  |  |  | 		return result === undefined ? null : result; | 
					
						
							| 
									
										
										
										
											2018-12-30 16:03:42 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	 * @returns {ExportsInfo} info about the exports | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 	getExportsInfo(module) { | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							| 
									
										
										
										
											2019-01-23 17:05:32 +08:00
										 |  |  | 		return mgm.exports; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {string} exportName the export | 
					
						
							|  |  |  | 	 * @returns {ExportInfo} info about the export | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getExportInfo(module, exportName) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.exports.getExportInfo(exportName); | 
					
						
							| 
									
										
										
										
											2018-12-31 19:51:35 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-28 17:40:32 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {string} exportName the export | 
					
						
							|  |  |  | 	 * @returns {ExportInfo} info about the export (do not modify) | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getReadOnlyExportInfo(module, exportName) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.exports.getReadOnlyExportInfo(exportName); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {false | true | SortableSet<string> | null} the used exports | 
					
						
							|  |  |  | 	 * false: module is not used at all. | 
					
						
							|  |  |  | 	 * true: the module namespace/object export is used. | 
					
						
							|  |  |  | 	 * SortableSet<string>: these export names are used. | 
					
						
							|  |  |  | 	 * empty SortableSet<string>: module is used but no export. | 
					
						
							|  |  |  | 	 * null: unknown, worst case should be assumed. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getUsedExports(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							| 
									
										
										
										
											2019-01-23 19:12:44 +08:00
										 |  |  | 		return mgm.exports.getUsedExports(); | 
					
						
							| 
									
										
										
										
											2018-08-16 19:55:41 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:12:00 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {number} the index of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getPreOrderIndex(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.preOrderIndex; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {number} the index of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getPostOrderIndex(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.postOrderIndex; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} index the index of the module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setPreOrderIndex(module, index) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.preOrderIndex = index; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} index the index of the module | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the index was set | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setPreOrderIndexIfUnset(module, index) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		if (mgm.preOrderIndex === null) { | 
					
						
							|  |  |  | 			mgm.preOrderIndex = index; | 
					
						
							|  |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} index the index of the module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setPostOrderIndex(module, index) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.postOrderIndex = index; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} index the index of the module | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the index was set | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setPostOrderIndexIfUnset(module, index) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		if (mgm.postOrderIndex === null) { | 
					
						
							|  |  |  | 			mgm.postOrderIndex = index; | 
					
						
							|  |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-22 01:16:02 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {number} the depth of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getDepth(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.depth; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} depth the depth of the module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setDepth(module, depth) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.depth = depth; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {number} depth the depth of the module | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the depth was set | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setDepthIfLower(module, depth) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		if (mgm.depth === null || mgm.depth > depth) { | 
					
						
							|  |  |  | 			mgm.depth = depth; | 
					
						
							|  |  |  | 			return true; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-05 17:15:25 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {boolean} true, if the module is async | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	isAsync(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		return mgm.async; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	setAsync(module) { | 
					
						
							|  |  |  | 		const mgm = this._getModuleGraphModule(module); | 
					
						
							|  |  |  | 		mgm.async = true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {any} thing any thing | 
					
						
							|  |  |  | 	 * @returns {Object} metadata | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getMeta(thing) { | 
					
						
							|  |  |  | 		let meta = this._metaMap.get(thing); | 
					
						
							|  |  |  | 		if (meta === undefined) { | 
					
						
							|  |  |  | 			meta = Object.create(null); | 
					
						
							|  |  |  | 			this._metaMap.set(thing, meta); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return meta; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// TODO remove in webpack 6
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {string} deprecateMessage message for the deprecation message | 
					
						
							|  |  |  | 	 * @returns {ModuleGraph} the module graph | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	static getModuleGraphForModule(module, deprecateMessage) { | 
					
						
							|  |  |  | 		const fn = deprecateMap.get(deprecateMessage); | 
					
						
							|  |  |  | 		if (fn) return fn(module); | 
					
						
							|  |  |  | 		const newFn = util.deprecate( | 
					
						
							|  |  |  | 			/** | 
					
						
							|  |  |  | 			 * @param {Module} module the module | 
					
						
							|  |  |  | 			 * @returns {ModuleGraph} the module graph | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			module => { | 
					
						
							|  |  |  | 				const moduleGraph = moduleGraphForModuleMap.get(module); | 
					
						
							|  |  |  | 				if (!moduleGraph) | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							|  |  |  | 						deprecateMessage + | 
					
						
							|  |  |  | 							"There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)" | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				return moduleGraph; | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			deprecateMessage + ": Use new ModuleGraph API" | 
					
						
							|  |  |  | 		); | 
					
						
							|  |  |  | 		deprecateMap.set(deprecateMessage, newFn); | 
					
						
							|  |  |  | 		return newFn(module); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// TODO remove in webpack 6
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} module the module | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	static setModuleGraphForModule(module, moduleGraph) { | 
					
						
							|  |  |  | 		moduleGraphForModuleMap.set(module, moduleGraph); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-17 22:41:07 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-21 22:15:48 +08:00
										 |  |  | // TODO remove in webpack 6
 | 
					
						
							|  |  |  | /** @type {WeakMap<Module, ModuleGraph>} */ | 
					
						
							|  |  |  | const moduleGraphForModuleMap = new WeakMap(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // TODO remove in webpack 6
 | 
					
						
							|  |  |  | /** @type {Map<string, (module: Module) => ModuleGraph>} */ | 
					
						
							|  |  |  | const deprecateMap = new Map(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 22:41:07 +08:00
										 |  |  | module.exports = ModuleGraph; | 
					
						
							| 
									
										
										
										
											2018-07-24 21:30:37 +08:00
										 |  |  | module.exports.ModuleGraphConnection = ModuleGraphConnection; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | module.exports.ExportsInfo = ExportsInfo; | 
					
						
							|  |  |  | module.exports.ExportInfo = ExportInfo; | 
					
						
							|  |  |  | module.exports.UsageState = UsageState; |