| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | const Dependency = require("../Dependency"); | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | const makeSerializable = require("../util/makeSerializable"); | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | const ModuleDependency = require("./ModuleDependency"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-28 02:34:55 +08:00
										 |  |  | /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | /** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35: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 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | class WebAssemblyExportImportedDependency extends ModuleDependency { | 
					
						
							| 
									
										
										
										
											2023-05-22 04:31:30 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {string} exportName export name | 
					
						
							|  |  |  | 	 * @param {string} request request | 
					
						
							|  |  |  | 	 * @param {string} name name | 
					
						
							|  |  |  | 	 * @param {TODO} valueType value type | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-24 17:24:39 +08:00
										 |  |  | 	constructor(exportName, request, name, valueType) { | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | 		super(request); | 
					
						
							|  |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this.exportName = exportName; | 
					
						
							|  |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this.name = name; | 
					
						
							| 
									
										
										
										
											2018-10-24 17:24:39 +08:00
										 |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this.valueType = valueType; | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-27 22:43:34 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	couldAffectReferencingModule() { | 
					
						
							|  |  |  | 		return Dependency.TRANSITIVE; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 	 * Returns list of exports referenced by this dependency | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph module graph | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {RuntimeSpec} runtime the runtime for which the module is analysed | 
					
						
							| 
									
										
										
										
											2020-05-28 02:34:55 +08:00
										 |  |  | 	 * @returns {(string[] | ReferencedExport)[]} referenced exports | 
					
						
							| 
									
										
										
										
											2018-07-25 15:33:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	getReferencedExports(moduleGraph, runtime) { | 
					
						
							| 
									
										
										
										
											2019-10-30 05:28:42 +08:00
										 |  |  | 		return [[this.name]]; | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	get type() { | 
					
						
							|  |  |  | 		return "wasm export import"; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-31 17:48:45 +08:00
										 |  |  | 	get category() { | 
					
						
							|  |  |  | 		return "wasm"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectSerializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | 	serialize(context) { | 
					
						
							|  |  |  | 		const { write } = context; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		write(this.exportName); | 
					
						
							|  |  |  | 		write(this.name); | 
					
						
							| 
									
										
										
										
											2018-10-24 17:24:39 +08:00
										 |  |  | 		write(this.valueType); | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		super.serialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 03:22:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectDeserializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | 	deserialize(context) { | 
					
						
							|  |  |  | 		const { read } = context; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		this.exportName = read(); | 
					
						
							|  |  |  | 		this.name = read(); | 
					
						
							| 
									
										
										
										
											2018-10-24 17:24:39 +08:00
										 |  |  | 		this.valueType = read(); | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		super.deserialize(context); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-12 00:36:52 +08:00
										 |  |  | makeSerializable( | 
					
						
							|  |  |  | 	WebAssemblyExportImportedDependency, | 
					
						
							|  |  |  | 	"webpack/lib/dependencies/WebAssemblyExportImportedDependency" | 
					
						
							|  |  |  | ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-02 15:53:35 +08:00
										 |  |  | module.exports = WebAssemblyExportImportedDependency; |