| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | const makeSerializable = require("../util/makeSerializable"); | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | const NullDependency = require("./NullDependency"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-20 18:32:12 +08:00
										 |  |  | /** @typedef {import("../ChunkGraph")} ChunkGraph */ | 
					
						
							| 
									
										
										
										
											2019-06-12 20:00:34 +08:00
										 |  |  | /** @typedef {import("../Dependency").ExportSpec} ExportSpec */ | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ | 
					
						
							| 
									
										
										
										
											2018-07-17 22:34:36 +08:00
										 |  |  | /** @typedef {import("../ModuleGraph")} ModuleGraph */ | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ | 
					
						
							|  |  |  | /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ | 
					
						
							| 
									
										
										
										
											2019-07-17 22:02:33 +08:00
										 |  |  | /** @typedef {import("../util/Hash")} Hash */ | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-30 18:50:04 +08:00
										 |  |  | class StaticExportsDependency extends NullDependency { | 
					
						
							| 
									
										
										
										
											2018-11-24 04:52:05 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-12-30 20:21:55 +08:00
										 |  |  | 	 * @param {string[] | true} exports export names | 
					
						
							|  |  |  | 	 * @param {boolean} canMangle true, if mangling exports names is allowed | 
					
						
							| 
									
										
										
										
											2018-11-24 04:52:05 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-12-30 20:21:55 +08:00
										 |  |  | 	constructor(exports, canMangle) { | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | 		super(); | 
					
						
							|  |  |  | 		this.exports = exports; | 
					
						
							| 
									
										
										
										
											2018-12-30 20:21:55 +08:00
										 |  |  | 		this.canMangle = canMangle; | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get type() { | 
					
						
							| 
									
										
										
										
											2018-12-30 18:50:04 +08:00
										 |  |  | 		return "static exports"; | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Returns the exported names | 
					
						
							| 
									
										
										
										
											2018-07-17 22:34:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 * @returns {ExportsSpec | undefined} export names | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-17 22:34:36 +08:00
										 |  |  | 	getExports(moduleGraph) { | 
					
						
							| 
									
										
										
										
											2020-03-05 20:31:58 +08:00
										 |  |  | 		return { | 
					
						
							|  |  |  | 			exports: this.exports, | 
					
						
							|  |  |  | 			canMangle: this.canMangle, | 
					
						
							|  |  |  | 			dependencies: undefined | 
					
						
							|  |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectSerializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | 	serialize(context) { | 
					
						
							|  |  |  | 		const { write } = context; | 
					
						
							|  |  |  | 		write(this.exports); | 
					
						
							| 
									
										
										
										
											2019-02-20 18:32:12 +08:00
										 |  |  | 		write(this.canMangle); | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | 		super.serialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectDeserializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | 	deserialize(context) { | 
					
						
							|  |  |  | 		const { read } = context; | 
					
						
							|  |  |  | 		this.exports = read(); | 
					
						
							| 
									
										
										
										
											2019-02-20 18:32:12 +08:00
										 |  |  | 		this.canMangle = read(); | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | 		super.deserialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-07 03:37:58 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | makeSerializable( | 
					
						
							| 
									
										
										
										
											2018-12-30 18:50:04 +08:00
										 |  |  | 	StaticExportsDependency, | 
					
						
							|  |  |  | 	"webpack/lib/dependencies/StaticExportsDependency" | 
					
						
							| 
									
										
										
										
											2018-10-11 01:28:07 +08:00
										 |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-30 18:50:04 +08:00
										 |  |  | module.exports = StaticExportsDependency; |