| 
									
										
										
										
											2017-05-10 19:15:14 +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-05-10 19:15:14 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 07:47:01 +08:00
										 |  |  | const eslintScope = require("eslint-scope"); | 
					
						
							| 
									
										
										
										
											2024-03-14 23:50:52 +08:00
										 |  |  | const Referencer = require("eslint-scope/lib/referencer"); | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | const { SyncBailHook } = require("tapable"); | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | const { | 
					
						
							|  |  |  | 	CachedSource, | 
					
						
							|  |  |  | 	ConcatSource, | 
					
						
							|  |  |  | 	ReplaceSource | 
					
						
							|  |  |  | } = require("webpack-sources"); | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | const ConcatenationScope = require("../ConcatenationScope"); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | const { UsageState } = require("../ExportsInfo"); | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | const Module = require("../Module"); | 
					
						
							| 
									
										
										
										
											2024-11-01 04:19:07 +08:00
										 |  |  | const { JS_TYPES } = require("../ModuleSourceTypesConstants"); | 
					
						
							| 
									
										
										
										
											2023-04-01 01:56:32 +08:00
										 |  |  | const { JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants"); | 
					
						
							| 
									
										
										
										
											2018-11-05 21:36:15 +08:00
										 |  |  | const RuntimeGlobals = require("../RuntimeGlobals"); | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | const Template = require("../Template"); | 
					
						
							| 
									
										
										
										
											2025-03-14 03:39:02 +08:00
										 |  |  | const { DEFAULTS } = require("../config/defaults"); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency"); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency"); | 
					
						
							| 
									
										
										
										
											2019-10-11 21:46:57 +08:00
										 |  |  | const JavascriptParser = require("../javascript/JavascriptParser"); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | const { | 
					
						
							|  |  |  | 	getMakeDeferredNamespaceModeFromExportsType, | 
					
						
							|  |  |  | 	getOptimizedDeferredModule | 
					
						
							|  |  |  | } = require("../runtime/MakeDeferredNamespaceObjectRuntime"); | 
					
						
							| 
									
										
										
										
											2020-08-12 00:06:27 +08:00
										 |  |  | const { equals } = require("../util/ArrayHelpers"); | 
					
						
							| 
									
										
										
										
											2019-08-07 15:54:43 +08:00
										 |  |  | const LazySet = require("../util/LazySet"); | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | const { concatComparators } = require("../util/comparators"); | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | const { | 
					
						
							|  |  |  | 	RESERVED_NAMES, | 
					
						
							|  |  |  | 	addScopeSymbols, | 
					
						
							| 
									
										
										
										
											2025-07-03 17:06:45 +08:00
										 |  |  | 	findNewName, | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 	getAllReferences, | 
					
						
							|  |  |  | 	getPathInAst, | 
					
						
							|  |  |  | 	getUsedNamesInScopeInfo | 
					
						
							|  |  |  | } = require("../util/concatenate"); | 
					
						
							| 
									
										
										
										
											2017-11-23 17:59:29 +08:00
										 |  |  | const createHash = require("../util/createHash"); | 
					
						
							| 
									
										
										
										
											2021-08-19 20:01:44 +08:00
										 |  |  | const { makePathsRelative } = require("../util/identifier"); | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | const makeSerializable = require("../util/makeSerializable"); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | const propertyAccess = require("../util/propertyAccess"); | 
					
						
							| 
									
										
										
										
											2023-05-05 12:36:03 +08:00
										 |  |  | const { propertyName } = require("../util/propertyName"); | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | const { | 
					
						
							|  |  |  | 	filterRuntime, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 	intersectRuntime, | 
					
						
							|  |  |  | 	mergeRuntimeCondition, | 
					
						
							|  |  |  | 	mergeRuntimeConditionNonFalse, | 
					
						
							|  |  |  | 	runtimeConditionToString, | 
					
						
							|  |  |  | 	subtractRuntimeCondition | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | } = require("../util/runtime"); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("eslint-scope").Reference} Reference */ | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | /** @typedef {import("eslint-scope").Scope} Scope */ | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | /** @typedef {import("eslint-scope").Variable} Variable */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("webpack-sources").Source} Source */ | 
					
						
							| 
									
										
										
										
											2025-08-20 18:50:12 +08:00
										 |  |  | /** @typedef {import("../config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */ | 
					
						
							| 
									
										
										
										
											2018-08-23 23:07:23 +08:00
										 |  |  | /** @typedef {import("../ChunkGraph")} ChunkGraph */ | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | /** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */ | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | /** @typedef {import("../Compilation")} Compilation */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("../Dependency")} Dependency */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ | 
					
						
							| 
									
										
										
										
											2018-07-18 01:38:42 +08:00
										 |  |  | /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ | 
					
						
							| 
									
										
										
										
											2018-07-11 19:05:13 +08:00
										 |  |  | /** @typedef {import("../DependencyTemplates")} DependencyTemplates */ | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | /** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */ | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | /** @typedef {import("../ExternalModule")} ExternalModule */ | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | /** @typedef {import("../Module").BuildCallback} BuildCallback */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("../Module").BuildInfo} BuildInfo */ | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | /** @typedef {import("../Module").FileSystemDependencies} FileSystemDependencies */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("../Module").BuildMeta} BuildMeta */ | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | /** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ | 
					
						
							|  |  |  | /** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ | 
					
						
							| 
									
										
										
										
											2018-07-20 22:24:35 +08:00
										 |  |  | /** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */ | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | /** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */ | 
					
						
							| 
									
										
										
										
											2024-02-17 01:39:12 +08:00
										 |  |  | /** @typedef {import("../Module").SourceTypes} SourceTypes */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | /** @typedef {import("../ModuleGraph")} ModuleGraph */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */ | 
					
						
							| 
									
										
										
										
											2020-12-05 00:03:12 +08:00
										 |  |  | /** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */ | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | /** @typedef {import("../ModuleParseError")} ModuleParseError */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("../RequestShortener")} RequestShortener */ | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | /** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */ | 
					
						
							| 
									
										
										
										
											2018-07-11 19:05:13 +08:00
										 |  |  | /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ | 
					
						
							| 
									
										
										
										
											2018-09-12 00:47:55 +08:00
										 |  |  | /** @typedef {import("../WebpackError")} WebpackError */ | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | /** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("../javascript/JavascriptParser").Program} Program */ | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | /** @typedef {import("../javascript/JavascriptParser").Range} Range */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ | 
					
						
							| 
									
										
										
										
											2019-07-17 22:02:33 +08:00
										 |  |  | /** @typedef {import("../util/Hash")} Hash */ | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | /** @typedef {typeof import("../util/Hash")} HashConstructor */ | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | /** @typedef {import("../util/concatenate").ScopeInfo} ScopeInfo */ | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | /** @typedef {import("../util/concatenate").UsedNames} UsedNames */ | 
					
						
							| 
									
										
										
										
											2019-11-11 22:25:03 +08:00
										 |  |  | /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */ | 
					
						
							| 
									
										
										
										
											2025-04-03 00:02:22 +08:00
										 |  |  | /** @typedef {import("../util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */ | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @template T | 
					
						
							|  |  |  |  * @typedef {import("../InitFragment")<T>} InitFragment | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @template T | 
					
						
							|  |  |  |  * @typedef {import("../util/comparators").Comparator<T>} Comparator | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-19 18:55:00 +08:00
										 |  |  | // fix eslint-scope to support class properties correctly
 | 
					
						
							|  |  |  | // cspell:word Referencer
 | 
					
						
							| 
									
										
										
										
											2025-03-07 21:12:22 +08:00
										 |  |  | const ReferencerClass = /** @type {EXPECTED_ANY} */ (Referencer); | 
					
						
							| 
									
										
										
										
											2021-05-19 18:55:00 +08:00
										 |  |  | if (!ReferencerClass.prototype.PropertyDefinition) { | 
					
						
							|  |  |  | 	ReferencerClass.prototype.PropertyDefinition = | 
					
						
							|  |  |  | 		ReferencerClass.prototype.Property; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ReexportInfo | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @property {Module} module | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @property {string[]} export | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | /** @typedef {RawBinding | SymbolBinding} Binding */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} RawBinding | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  |  * @property {ModuleInfo} info | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @property {string} rawName | 
					
						
							|  |  |  |  * @property {string=} comment | 
					
						
							|  |  |  |  * @property {string[]} ids | 
					
						
							|  |  |  |  * @property {string[]} exportName | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} SymbolBinding | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @property {ConcatenatedModuleInfo} info | 
					
						
							|  |  |  |  * @property {string} name | 
					
						
							|  |  |  |  * @property {string=} comment | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  |  * @property {string[]} ids | 
					
						
							|  |  |  |  * @property {string[]} exportName | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | /** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo } ModuleInfo */ | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | /** @typedef {ConcatenatedModuleInfo | ExternalModuleInfo | ReferenceToModuleInfo } ModuleInfoOrReference */ | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ConcatenatedModuleInfo | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  |  * @property {"concatenated"} type | 
					
						
							|  |  |  |  * @property {Module} module | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @property {number} index | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  |  * @property {Program | undefined} ast | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  |  * @property {Source | undefined} internalSource | 
					
						
							| 
									
										
										
										
											2024-10-25 02:13:59 +08:00
										 |  |  |  * @property {ReplaceSource | undefined} source | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  |  * @property {InitFragment<ChunkRenderContext>[]=} chunkInitFragments | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  |  * @property {ReadOnlyRuntimeRequirements | undefined} runtimeRequirements | 
					
						
							|  |  |  |  * @property {Scope | undefined} globalScope | 
					
						
							|  |  |  |  * @property {Scope | undefined} moduleScope | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  |  * @property {Map<string, string>} internalNames | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  |  * @property {Map<string, string> | undefined} exportMap | 
					
						
							|  |  |  |  * @property {Map<string, string> | undefined} rawExportMap | 
					
						
							| 
									
										
										
										
											2020-09-15 17:43:06 +08:00
										 |  |  |  * @property {string=} namespaceExportSymbol | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  |  * @property {string | undefined} namespaceObjectName | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  |  * @property {ConcatenationScope | undefined} concatenationScope | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  |  * @property {boolean} interopNamespaceObjectUsed "default-with-named" namespace | 
					
						
							|  |  |  |  * @property {string | undefined} interopNamespaceObjectName "default-with-named" namespace | 
					
						
							|  |  |  |  * @property {boolean} interopNamespaceObject2Used "default-only" namespace | 
					
						
							|  |  |  |  * @property {string | undefined} interopNamespaceObject2Name "default-only" namespace | 
					
						
							|  |  |  |  * @property {boolean} interopDefaultAccessUsed runtime namespace object that detects "__esModule" | 
					
						
							|  |  |  |  * @property {string | undefined} interopDefaultAccessName runtime namespace object that detects "__esModule" | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ExternalModuleInfo | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  |  * @property {"external"} type | 
					
						
							|  |  |  |  * @property {Module} module | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  |  * @property {RuntimeSpec | boolean} runtimeCondition | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @property {number} index | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  |  * @property {string | undefined} name module.exports / harmony namespace object | 
					
						
							|  |  |  |  * @property {string | undefined} deferredName deferred module.exports / harmony namespace object | 
					
						
							|  |  |  |  * @property {boolean} deferred the module is deferred at least once | 
					
						
							|  |  |  |  * @property {boolean} deferredNamespaceObjectUsed deferred namespace object that being used in a not-analyzable way so it must be materialized | 
					
						
							|  |  |  |  * @property {string | undefined} deferredNamespaceObjectName deferred namespace object that being used in a not-analyzable way so it must be materialized | 
					
						
							|  |  |  |  * @property {boolean} interopNamespaceObjectUsed "default-with-named" namespace | 
					
						
							|  |  |  |  * @property {string | undefined} interopNamespaceObjectName "default-with-named" namespace | 
					
						
							|  |  |  |  * @property {boolean} interopNamespaceObject2Used "default-only" namespace | 
					
						
							|  |  |  |  * @property {string | undefined} interopNamespaceObject2Name "default-only" namespace | 
					
						
							|  |  |  |  * @property {boolean} interopDefaultAccessUsed runtime namespace object that detects "__esModule" | 
					
						
							|  |  |  |  * @property {string | undefined} interopDefaultAccessName runtime namespace object that detects "__esModule" | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ReferenceToModuleInfo | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  |  * @property {"reference"} type | 
					
						
							|  |  |  |  * @property {RuntimeSpec | boolean} runtimeCondition | 
					
						
							| 
									
										
										
										
											2024-10-25 02:13:59 +08:00
										 |  |  |  * @property {ModuleInfo} target | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @template T | 
					
						
							|  |  |  |  * @param {string} property property | 
					
						
							|  |  |  |  * @param {function(T[keyof T], T[keyof T]): 0 | 1 | -1} comparator comparator | 
					
						
							|  |  |  |  * @returns {Comparator<T>} comparator | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | const createComparator = (property, comparator) => (a, b) => | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | 	comparator( | 
					
						
							|  |  |  | 		a[/** @type {keyof T} */ (property)], | 
					
						
							|  |  |  | 		b[/** @type {keyof T} */ (property)] | 
					
						
							|  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * @param {number} a a | 
					
						
							|  |  |  |  * @param {number} b b | 
					
						
							|  |  |  |  * @returns {0 | 1 | -1} result | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | const compareNumbers = (a, b) => { | 
					
						
							| 
									
										
										
										
											2024-08-02 02:36:27 +08:00
										 |  |  | 	if (Number.isNaN(a)) { | 
					
						
							|  |  |  | 		if (!Number.isNaN(b)) { | 
					
						
							| 
									
										
										
										
											2019-10-30 05:02:22 +08:00
										 |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2024-08-02 02:36:27 +08:00
										 |  |  | 		if (Number.isNaN(b)) { | 
					
						
							| 
									
										
										
										
											2019-10-30 05:02:22 +08:00
										 |  |  | 			return -1; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 		if (a !== b) { | 
					
						
							|  |  |  | 			return a < b ? -1 : 1; | 
					
						
							| 
									
										
										
										
											2019-10-30 05:02:22 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | const bySourceOrder = createComparator("sourceOrder", compareNumbers); | 
					
						
							|  |  |  | const byRangeStart = createComparator("rangeStart", compareNumbers); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | const moveDeferToLast = ( | 
					
						
							|  |  |  | 	/** @type {{ defer?: boolean }} */ a, | 
					
						
							|  |  |  | 	/** @type {{ defer?: boolean }} */ b | 
					
						
							|  |  |  | ) => { | 
					
						
							|  |  |  | 	if (a.defer === b.defer) return 0; | 
					
						
							|  |  |  | 	if (a.defer) return 1; | 
					
						
							|  |  |  | 	return -1; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-10-30 05:02:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-01 21:49:53 +08:00
										 |  |  | const INITIAL_USED_NAMES = new Set(RESERVED_NAMES); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @param {Iterable<string>} iterable iterable object | 
					
						
							|  |  |  |  * @returns {string} joined iterable object | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | const joinIterableWithComma = (iterable) => { | 
					
						
							| 
									
										
										
										
											2020-02-21 19:08:15 +08:00
										 |  |  | 	// This is more performant than Array.from().join(", ")
 | 
					
						
							|  |  |  | 	// as it doesn't create an array
 | 
					
						
							|  |  |  | 	let str = ""; | 
					
						
							|  |  |  | 	let first = true; | 
					
						
							|  |  |  | 	for (const item of iterable) { | 
					
						
							|  |  |  | 		if (first) { | 
					
						
							|  |  |  | 			first = false; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			str += ", "; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		str += item; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return str; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  |  * @typedef {object} ConcatenationEntry | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  |  * @property {"concatenated" | "external"} type | 
					
						
							|  |  |  |  * @property {Module} module | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  |  * @property {RuntimeSpec | boolean} runtimeCondition | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-06-08 19:20:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | /** @typedef {Set<ConcatenatedModuleInfo>} NeededNamespaceObjects */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** @typedef {Map<Module, ModuleInfo>} ModuleToInfoMap */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @param {ModuleInfo} info module info | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @param {string[]} exportName exportName | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  |  * @param {ModuleToInfoMap} moduleToInfoMap moduleToInfoMap | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  |  * @param {RuntimeSpec} runtime for which runtime | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @param {RequestShortener} requestShortener the request shortener | 
					
						
							|  |  |  |  * @param {RuntimeTemplate} runtimeTemplate the runtime template | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  |  * @param {NeededNamespaceObjects} neededNamespaceObjects modules for which a namespace object should be generated | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @param {boolean} asCall asCall | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  |  * @param {boolean} depDeferred the dependency is deferred | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  |  * @param {boolean | undefined} strictHarmonyModule strictHarmonyModule | 
					
						
							| 
									
										
										
										
											2020-08-29 22:00:03 +08:00
										 |  |  |  * @param {boolean | undefined} asiSafe asiSafe | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  |  * @param {Set<ExportInfo>} alreadyVisited alreadyVisited | 
					
						
							|  |  |  |  * @returns {Binding} the final variable | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | const getFinalBinding = ( | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 	moduleGraph, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	info, | 
					
						
							|  |  |  | 	exportName, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	runtime, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	requestShortener, | 
					
						
							|  |  |  | 	runtimeTemplate, | 
					
						
							|  |  |  | 	neededNamespaceObjects, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	asCall, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 	depDeferred, | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 	strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	asiSafe, | 
					
						
							|  |  |  | 	alreadyVisited = new Set() | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | ) => { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	const exportsType = info.module.getExportsType( | 
					
						
							| 
									
										
										
										
											2020-08-18 03:32:47 +08:00
										 |  |  | 		moduleGraph, | 
					
						
							|  |  |  | 		strictHarmonyModule | 
					
						
							|  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 	const deferred = | 
					
						
							|  |  |  | 		depDeferred && | 
					
						
							|  |  |  | 		info.type === "external" && | 
					
						
							|  |  |  | 		info.deferred && | 
					
						
							|  |  |  | 		!moduleGraph.isAsync(info.module); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 	if (exportName.length === 0) { | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 		switch (exportsType) { | 
					
						
							|  |  |  | 			case "default-only": | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 				if (deferred) info.deferredNamespaceObjectUsed = true; | 
					
						
							|  |  |  | 				else info.interopNamespaceObject2Used = true; | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					rawName: /** @type {string} */ ( | 
					
						
							|  |  |  | 						deferred | 
					
						
							|  |  |  | 							? info.deferredNamespaceObjectName | 
					
						
							|  |  |  | 							: info.interopNamespaceObject2Name | 
					
						
							|  |  |  | 					), | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 					ids: exportName, | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 			case "default-with-named": | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 				if (deferred) info.deferredNamespaceObjectUsed = true; | 
					
						
							|  |  |  | 				else info.interopNamespaceObjectUsed = true; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					rawName: /** @type {string} */ ( | 
					
						
							|  |  |  | 						deferred | 
					
						
							|  |  |  | 							? info.deferredNamespaceObjectName | 
					
						
							|  |  |  | 							: info.interopNamespaceObjectName | 
					
						
							|  |  |  | 					), | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					ids: exportName, | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			case "namespace": | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 			case "dynamic": | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			default: | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 				throw new Error(`Unexpected exportsType ${exportsType}`); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 		switch (exportsType) { | 
					
						
							| 
									
										
										
										
											2019-08-21 21:08:07 +08:00
										 |  |  | 			case "namespace": | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2020-04-23 02:31:26 +08:00
										 |  |  | 			case "default-with-named": | 
					
						
							| 
									
										
										
										
											2020-11-17 00:19:36 +08:00
										 |  |  | 				switch (exportName[0]) { | 
					
						
							|  |  |  | 					case "default": | 
					
						
							|  |  |  | 						exportName = exportName.slice(1); | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					case "__esModule": | 
					
						
							|  |  |  | 						return { | 
					
						
							|  |  |  | 							info, | 
					
						
							|  |  |  | 							rawName: "/* __esModule */true", | 
					
						
							|  |  |  | 							ids: exportName.slice(1), | 
					
						
							|  |  |  | 							exportName | 
					
						
							|  |  |  | 						}; | 
					
						
							| 
									
										
										
										
											2020-04-23 02:31:26 +08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			case "default-only": { | 
					
						
							|  |  |  | 				const exportId = exportName[0]; | 
					
						
							| 
									
										
										
										
											2020-11-17 00:19:36 +08:00
										 |  |  | 				if (exportId === "__esModule") { | 
					
						
							|  |  |  | 					return { | 
					
						
							|  |  |  | 						info, | 
					
						
							|  |  |  | 						rawName: "/* __esModule */true", | 
					
						
							|  |  |  | 						ids: exportName.slice(1), | 
					
						
							|  |  |  | 						exportName | 
					
						
							|  |  |  | 					}; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-04-23 02:31:26 +08:00
										 |  |  | 				exportName = exportName.slice(1); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				if (exportId !== "default") { | 
					
						
							|  |  |  | 					return { | 
					
						
							|  |  |  | 						info, | 
					
						
							|  |  |  | 						rawName: | 
					
						
							|  |  |  | 							"/* non-default import from default-exporting module */undefined", | 
					
						
							|  |  |  | 						ids: exportName, | 
					
						
							|  |  |  | 						exportName | 
					
						
							|  |  |  | 					}; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 			case "dynamic": | 
					
						
							| 
									
										
										
										
											2020-11-17 00:19:36 +08:00
										 |  |  | 				switch (exportName[0]) { | 
					
						
							|  |  |  | 					case "default": { | 
					
						
							|  |  |  | 						exportName = exportName.slice(1); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 						if (deferred) { | 
					
						
							|  |  |  | 							return { | 
					
						
							|  |  |  | 								info, | 
					
						
							|  |  |  | 								rawName: `${info.deferredName}.a`, | 
					
						
							|  |  |  | 								ids: exportName, | 
					
						
							|  |  |  | 								exportName | 
					
						
							|  |  |  | 							}; | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2020-11-17 00:19:36 +08:00
										 |  |  | 						info.interopDefaultAccessUsed = true; | 
					
						
							|  |  |  | 						const defaultExport = asCall | 
					
						
							|  |  |  | 							? `${info.interopDefaultAccessName}()` | 
					
						
							|  |  |  | 							: asiSafe | 
					
						
							| 
									
										
										
										
											2024-07-31 05:43:19 +08:00
										 |  |  | 								? `(${info.interopDefaultAccessName}())` | 
					
						
							|  |  |  | 								: asiSafe === false | 
					
						
							|  |  |  | 									? `;(${info.interopDefaultAccessName}())` | 
					
						
							|  |  |  | 									: `${info.interopDefaultAccessName}.a`; | 
					
						
							| 
									
										
										
										
											2020-11-17 00:19:36 +08:00
										 |  |  | 						return { | 
					
						
							|  |  |  | 							info, | 
					
						
							|  |  |  | 							rawName: defaultExport, | 
					
						
							|  |  |  | 							ids: exportName, | 
					
						
							|  |  |  | 							exportName | 
					
						
							|  |  |  | 						}; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					case "__esModule": | 
					
						
							|  |  |  | 						return { | 
					
						
							|  |  |  | 							info, | 
					
						
							|  |  |  | 							rawName: "/* __esModule */true", | 
					
						
							|  |  |  | 							ids: exportName.slice(1), | 
					
						
							|  |  |  | 							exportName | 
					
						
							|  |  |  | 						}; | 
					
						
							| 
									
										
										
										
											2019-12-05 05:54:26 +08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				throw new Error(`Unexpected exportsType ${exportsType}`); | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	if (exportName.length === 0) { | 
					
						
							|  |  |  | 		switch (info.type) { | 
					
						
							|  |  |  | 			case "concatenated": | 
					
						
							|  |  |  | 				neededNamespaceObjects.add(info); | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | 					rawName: | 
					
						
							|  |  |  | 						/** @type {NonNullable<ConcatenatedModuleInfo["namespaceObjectName"]>} */ | 
					
						
							|  |  |  | 						(info.namespaceObjectName), | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					ids: exportName, | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			case "external": | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 				if (deferred) { | 
					
						
							|  |  |  | 					info.deferredNamespaceObjectUsed = true; | 
					
						
							|  |  |  | 					return { | 
					
						
							|  |  |  | 						info, | 
					
						
							|  |  |  | 						rawName: /** @type {string} */ (info.deferredNamespaceObjectName), | 
					
						
							|  |  |  | 						ids: exportName, | 
					
						
							|  |  |  | 						exportName | 
					
						
							|  |  |  | 					}; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							|  |  |  | 					rawName: | 
					
						
							|  |  |  | 						/** @type {NonNullable<ExternalModuleInfo["name"]>} */ | 
					
						
							|  |  |  | 						(info.name), | 
					
						
							|  |  |  | 					ids: exportName, | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	const exportsInfo = moduleGraph.getExportsInfo(info.module); | 
					
						
							|  |  |  | 	const exportInfo = exportsInfo.getExportInfo(exportName[0]); | 
					
						
							|  |  |  | 	if (alreadyVisited.has(exportInfo)) { | 
					
						
							|  |  |  | 		return { | 
					
						
							|  |  |  | 			info, | 
					
						
							|  |  |  | 			rawName: "/* circular reexport */ Object(function x() { x() }())", | 
					
						
							|  |  |  | 			ids: [], | 
					
						
							|  |  |  | 			exportName | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	alreadyVisited.add(exportInfo); | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 	switch (info.type) { | 
					
						
							|  |  |  | 		case "concatenated": { | 
					
						
							|  |  |  | 			const exportId = exportName[0]; | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 			if (exportInfo.provided === false) { | 
					
						
							|  |  |  | 				// It's not provided, but it could be on the prototype
 | 
					
						
							|  |  |  | 				neededNamespaceObjects.add(info); | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | 					rawName: /** @type {string} */ (info.namespaceObjectName), | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 					ids: exportName, | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 18:21:37 +08:00
										 |  |  | 			const directExport = info.exportMap && info.exportMap.get(exportId); | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 			if (directExport) { | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 				const usedName = /** @type {string[]} */ ( | 
					
						
							|  |  |  | 					exportsInfo.getUsedName(exportName, runtime) | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-10-13 16:01:54 +08:00
										 |  |  | 				if (!usedName) { | 
					
						
							|  |  |  | 					return { | 
					
						
							|  |  |  | 						info, | 
					
						
							|  |  |  | 						rawName: "/* unused export */ undefined", | 
					
						
							|  |  |  | 						ids: exportName.slice(1), | 
					
						
							|  |  |  | 						exportName | 
					
						
							|  |  |  | 					}; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					name: directExport, | 
					
						
							| 
									
										
										
										
											2020-09-15 17:45:29 +08:00
										 |  |  | 					ids: usedName.slice(1), | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 18:21:37 +08:00
										 |  |  | 			const rawExport = info.rawExportMap && info.rawExportMap.get(exportId); | 
					
						
							|  |  |  | 			if (rawExport) { | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							|  |  |  | 					rawName: rawExport, | 
					
						
							|  |  |  | 					ids: exportName.slice(1), | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 			const reexport = exportInfo.findTarget(moduleGraph, (module) => | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				moduleToInfoMap.has(module) | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 			if (reexport === false) { | 
					
						
							|  |  |  | 				throw new Error( | 
					
						
							|  |  |  | 					`Target module of reexport from '${info.module.readableIdentifier( | 
					
						
							|  |  |  | 						requestShortener | 
					
						
							| 
									
										
										
										
											2020-11-30 17:18:38 +08:00
										 |  |  | 					)}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from( | 
					
						
							|  |  |  | 						moduleToInfoMap, | 
					
						
							|  |  |  | 						([m, info]) => | 
					
						
							|  |  |  | 							` * ${info.type} ${m.readableIdentifier(requestShortener)}` | 
					
						
							|  |  |  | 					).join("\n")}`
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 			if (reexport) { | 
					
						
							|  |  |  | 				const refInfo = moduleToInfoMap.get(reexport.module); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				return getFinalBinding( | 
					
						
							|  |  |  | 					moduleGraph, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					/** @type {ModuleInfo} */ (refInfo), | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					reexport.export | 
					
						
							|  |  |  | 						? [...reexport.export, ...exportName.slice(1)] | 
					
						
							|  |  |  | 						: exportName.slice(1), | 
					
						
							|  |  |  | 					moduleToInfoMap, | 
					
						
							|  |  |  | 					runtime, | 
					
						
							|  |  |  | 					requestShortener, | 
					
						
							|  |  |  | 					runtimeTemplate, | 
					
						
							|  |  |  | 					neededNamespaceObjects, | 
					
						
							|  |  |  | 					asCall, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					reexport.deferred, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 					(info.module.buildMeta).strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					asiSafe, | 
					
						
							|  |  |  | 					alreadyVisited | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 17:43:06 +08:00
										 |  |  | 			if (info.namespaceExportSymbol) { | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 				const usedName = /** @type {string[]} */ ( | 
					
						
							|  |  |  | 					exportsInfo.getUsedName(exportName, runtime) | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | 					rawName: /** @type {string} */ (info.namespaceObjectName), | 
					
						
							| 
									
										
										
										
											2020-09-15 17:45:29 +08:00
										 |  |  | 					ids: usedName, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			throw new Error( | 
					
						
							|  |  |  | 				`Cannot get final name for export '${exportName.join( | 
					
						
							|  |  |  | 					"." | 
					
						
							|  |  |  | 				)}' of ${info.module.readableIdentifier(requestShortener)}`
 | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 		case "external": { | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 			const used = /** @type {string[]} */ ( | 
					
						
							|  |  |  | 				exportsInfo.getUsedName(exportName, runtime) | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2020-10-13 16:01:54 +08:00
										 |  |  | 			if (!used) { | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					info, | 
					
						
							|  |  |  | 					rawName: "/* unused export */ undefined", | 
					
						
							|  |  |  | 					ids: exportName.slice(1), | 
					
						
							|  |  |  | 					exportName | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			const comment = equals(used, exportName) | 
					
						
							|  |  |  | 				? "" | 
					
						
							|  |  |  | 				: Template.toNormalComment(`${exportName.join(".")}`); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 			return { | 
					
						
							|  |  |  | 				info, | 
					
						
							|  |  |  | 				rawName: | 
					
						
							|  |  |  | 					(deferred ? info.deferredName : info.name) + | 
					
						
							|  |  |  | 					(deferred ? ".a" : "") + | 
					
						
							|  |  |  | 					comment, | 
					
						
							|  |  |  | 				ids: used, | 
					
						
							|  |  |  | 				exportName | 
					
						
							|  |  |  | 			}; | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  |  * @param {ModuleInfo} info module info | 
					
						
							|  |  |  |  * @param {string[]} exportName exportName | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  |  * @param {ModuleToInfoMap} moduleToInfoMap moduleToInfoMap | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  |  * @param {RuntimeSpec} runtime for which runtime | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @param {RequestShortener} requestShortener the request shortener | 
					
						
							| 
									
										
										
										
											2019-08-27 02:21:07 +08:00
										 |  |  |  * @param {RuntimeTemplate} runtimeTemplate the runtime template | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  |  * @param {NeededNamespaceObjects} neededNamespaceObjects modules for which a namespace object should be generated | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @param {boolean} asCall asCall | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  |  * @param {boolean} depDeferred the dependency is deferred | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  |  * @param {boolean | undefined} callContext callContext | 
					
						
							|  |  |  |  * @param {boolean | undefined} strictHarmonyModule strictHarmonyModule | 
					
						
							| 
									
										
										
										
											2020-08-29 22:00:03 +08:00
										 |  |  |  * @param {boolean | undefined} asiSafe asiSafe | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  |  * @returns {string} the final name | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | const getFinalName = ( | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 	moduleGraph, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	info, | 
					
						
							|  |  |  | 	exportName, | 
					
						
							|  |  |  | 	moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	runtime, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	requestShortener, | 
					
						
							| 
									
										
										
										
											2019-08-27 02:21:07 +08:00
										 |  |  | 	runtimeTemplate, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	neededNamespaceObjects, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 	asCall, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 	depDeferred, | 
					
						
							| 
									
										
										
										
											2019-07-31 22:01:35 +08:00
										 |  |  | 	callContext, | 
					
						
							| 
									
										
										
										
											2018-06-20 05:19:28 +08:00
										 |  |  | 	strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 	asiSafe | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | ) => { | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 	const binding = getFinalBinding( | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		moduleGraph, | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 		info, | 
					
						
							|  |  |  | 		exportName, | 
					
						
							|  |  |  | 		moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		runtime, | 
					
						
							|  |  |  | 		requestShortener, | 
					
						
							|  |  |  | 		runtimeTemplate, | 
					
						
							|  |  |  | 		neededNamespaceObjects, | 
					
						
							|  |  |  | 		asCall, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 		depDeferred, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		strictHarmonyModule, | 
					
						
							|  |  |  | 		asiSafe | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 	); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		const { ids, comment } = binding; | 
					
						
							|  |  |  | 		let reference; | 
					
						
							|  |  |  | 		let isPropertyAccess; | 
					
						
							|  |  |  | 		if ("rawName" in binding) { | 
					
						
							|  |  |  | 			reference = `${binding.rawName}${comment || ""}${propertyAccess(ids)}`; | 
					
						
							|  |  |  | 			isPropertyAccess = ids.length > 0; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			const { info, name: exportId } = binding; | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 			const name = info.internalNames.get(exportId); | 
					
						
							|  |  |  | 			if (!name) { | 
					
						
							|  |  |  | 				throw new Error( | 
					
						
							|  |  |  | 					`The export "${exportId}" in "${info.module.readableIdentifier( | 
					
						
							|  |  |  | 						requestShortener | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					)}" has no internal name (existing names: ${ | 
					
						
							|  |  |  | 						Array.from( | 
					
						
							|  |  |  | 							info.internalNames, | 
					
						
							|  |  |  | 							([name, symbol]) => `${name}: ${symbol}` | 
					
						
							|  |  |  | 						).join(", ") || "none" | 
					
						
							|  |  |  | 					})`
 | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 				); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			reference = `${name}${comment || ""}${propertyAccess(ids)}`; | 
					
						
							|  |  |  | 			isPropertyAccess = ids.length > 1; | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		if (isPropertyAccess && asCall && callContext === false) { | 
					
						
							|  |  |  | 			return asiSafe | 
					
						
							|  |  |  | 				? `(0,${reference})` | 
					
						
							|  |  |  | 				: asiSafe === false | 
					
						
							| 
									
										
										
										
											2024-07-31 05:43:19 +08:00
										 |  |  | 					? `;(0,${reference})` | 
					
						
							|  |  |  | 					: `/*#__PURE__*/Object(${reference})`; | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		return reference; | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-11-08 18:32:05 +08:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @typedef {object} ConcatenateModuleHooks | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  |  * @property {SyncBailHook<[ConcatenatedModule], boolean>} onDemandExportsGeneration | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  |  * @property {SyncBailHook<[Partial<ConcatenatedModuleInfo>, ConcatenatedModuleInfo], boolean | void>} concatenatedModuleInfo | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | /** @typedef {BuildInfo["topLevelDeclarations"]} TopLevelDeclarations */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | /** @type {WeakMap<Compilation, ConcatenateModuleHooks>} */ | 
					
						
							|  |  |  | const compilationHooksMap = new WeakMap(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | class ConcatenatedModule extends Module { | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} rootModule the root module of the concatenation | 
					
						
							| 
									
										
										
										
											2020-03-13 00:51:26 +08:00
										 |  |  | 	 * @param {Set<Module>} modules all modules in the concatenation (including the root module) | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 	 * @param {RuntimeSpec} runtime the runtime | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							| 
									
										
										
										
											2025-04-03 00:02:22 +08:00
										 |  |  | 	 * @param {AssociatedObjectForCache=} associatedObjectForCache object for caching | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	 * @param {string | HashConstructor=} hashFunction hash function to use | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 * @returns {ConcatenatedModule} the module | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	static create( | 
					
						
							|  |  |  | 		rootModule, | 
					
						
							|  |  |  | 		modules, | 
					
						
							|  |  |  | 		runtime, | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 		compilation, | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 		associatedObjectForCache, | 
					
						
							| 
									
										
										
										
											2025-03-14 03:39:02 +08:00
										 |  |  | 		hashFunction = DEFAULTS.HASH_FUNCTION | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	) { | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		const identifier = ConcatenatedModule._createIdentifier( | 
					
						
							|  |  |  | 			rootModule, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			modules, | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 			associatedObjectForCache, | 
					
						
							|  |  |  | 			hashFunction | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 		return new ConcatenatedModule({ | 
					
						
							|  |  |  | 			identifier, | 
					
						
							|  |  |  | 			rootModule, | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			modules, | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 			runtime, | 
					
						
							|  |  |  | 			compilation | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		}); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							|  |  |  | 	 * @returns {ConcatenateModuleHooks} the attached hooks | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	static getCompilationHooks(compilation) { | 
					
						
							|  |  |  | 		let hooks = compilationHooksMap.get(compilation); | 
					
						
							|  |  |  | 		if (hooks === undefined) { | 
					
						
							|  |  |  | 			hooks = { | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  | 				onDemandExportsGeneration: new SyncBailHook(["module"]), | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 				concatenatedModuleInfo: new SyncBailHook([ | 
					
						
							|  |  |  | 					"updatedInfo", | 
					
						
							|  |  |  | 					"concatenatedModuleInfo" | 
					
						
							|  |  |  | 				]) | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 			}; | 
					
						
							|  |  |  | 			compilationHooksMap.set(compilation, hooks); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return hooks; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2024-06-11 21:09:50 +08:00
										 |  |  | 	 * @param {object} options options | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 * @param {string} options.identifier the identifier of the module | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | 	 * @param {Module} options.rootModule the root module of the concatenation | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 	 * @param {RuntimeSpec} options.runtime the selected runtime | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | 	 * @param {Set<Module>} options.modules all concatenated modules | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 	 * @param {Compilation} options.compilation the compilation | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 	constructor({ identifier, rootModule, modules, runtime, compilation }) { | 
					
						
							| 
									
										
										
										
											2023-04-01 01:56:32 +08:00
										 |  |  | 		super(JAVASCRIPT_MODULE_TYPE_ESM, null, rootModule && rootModule.layer); | 
					
						
							| 
									
										
										
										
											2017-11-06 20:02:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Info from Factory
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this._identifier = identifier; | 
					
						
							|  |  |  | 		/** @type {Module} */ | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		this.rootModule = rootModule; | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		/** @type {Set<Module>} */ | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 		this._modules = modules; | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 		this._runtime = runtime; | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		this.factoryMeta = rootModule && rootModule.factoryMeta; | 
					
						
							| 
									
										
										
										
											2025-08-30 01:28:23 +08:00
										 |  |  | 		/** @type {Compilation} */ | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 		this.compilation = compilation; | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-06-18 20:46:06 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Assuming this module is in the cache. Update the (cached) module with | 
					
						
							|  |  |  | 	 * the fresh module from the factory. Usually updates internal references | 
					
						
							|  |  |  | 	 * and properties. | 
					
						
							|  |  |  | 	 * @param {Module} module fresh module | 
					
						
							|  |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	updateCacheModule(module) { | 
					
						
							| 
									
										
										
										
											2021-03-15 17:29:51 +08:00
										 |  |  | 		throw new Error("Must not be called"); | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-03-15 17:29:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2024-02-17 01:39:12 +08:00
										 |  |  | 	 * @returns {SourceTypes} types available (do not mutate) | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	getSourceTypes() { | 
					
						
							| 
									
										
										
										
											2024-11-01 04:19:07 +08:00
										 |  |  | 		return JS_TYPES; | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-06 19:09:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	get modules() { | 
					
						
							| 
									
										
										
										
											2025-07-03 17:06:45 +08:00
										 |  |  | 		return [...this._modules]; | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 * @returns {string} a unique identifier of the module | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	identifier() { | 
					
						
							|  |  |  | 		return this._identifier; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {RequestShortener} requestShortener the request shortener | 
					
						
							|  |  |  | 	 * @returns {string} a user readable identifier of the module | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	readableIdentifier(requestShortener) { | 
					
						
							| 
									
										
										
										
											2024-07-31 10:39:30 +08:00
										 |  |  | 		return `${this.rootModule.readableIdentifier( | 
					
						
							|  |  |  | 			requestShortener | 
					
						
							|  |  |  | 		)} + ${this._modules.size - 1} modules`;
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {LibIdentOptions} options options | 
					
						
							|  |  |  | 	 * @returns {string | null} an identifier for library inclusion | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	libIdent(options) { | 
					
						
							|  |  |  | 		return this.rootModule.libIdent(options); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @returns {string | null} absolute path which should be used for condition matching (usually the resource path) | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	nameForCondition() { | 
					
						
							|  |  |  | 		return this.rootModule.nameForCondition(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-05 00:03:12 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							|  |  |  | 	 * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	getSideEffectsConnectionState(moduleGraph) { | 
					
						
							|  |  |  | 		return this.rootModule.getSideEffectsConnectionState(moduleGraph); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {WebpackOptions} options webpack options | 
					
						
							|  |  |  | 	 * @param {Compilation} compilation the compilation | 
					
						
							|  |  |  | 	 * @param {ResolverWithOptions} resolver the resolver | 
					
						
							|  |  |  | 	 * @param {InputFileSystem} fs the file system | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | 	 * @param {BuildCallback} callback callback function | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	build(options, compilation, resolver, fs, callback) { | 
					
						
							|  |  |  | 		const { rootModule } = this; | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 		const { moduleArgument, exportsArgument } = | 
					
						
							|  |  |  | 			/** @type {BuildInfo} */ | 
					
						
							|  |  |  | 			(rootModule.buildInfo); | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		this.buildInfo = { | 
					
						
							|  |  |  | 			strict: true, | 
					
						
							|  |  |  | 			cacheable: true, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			moduleArgument, | 
					
						
							|  |  |  | 			exportsArgument, | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 			fileDependencies: new LazySet(), | 
					
						
							|  |  |  | 			contextDependencies: new LazySet(), | 
					
						
							|  |  |  | 			missingDependencies: new LazySet(), | 
					
						
							| 
									
										
										
										
											2021-02-11 02:14:50 +08:00
										 |  |  | 			topLevelDeclarations: new Set(), | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 			assets: undefined | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 		this.buildMeta = rootModule.buildMeta; | 
					
						
							|  |  |  | 		this.clearDependenciesAndBlocks(); | 
					
						
							|  |  |  | 		this.clearWarningsAndErrors(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		for (const m of this._modules) { | 
					
						
							|  |  |  | 			// populate cacheable
 | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			if (!(/** @type {BuildInfo} */ (m.buildInfo).cacheable)) { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 				/** @type {BuildInfo} */ | 
					
						
							|  |  |  | 				(this.buildInfo).cacheable = false; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			// populate dependencies
 | 
					
						
							|  |  |  | 			for (const d of m.dependencies.filter( | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 				(dep) => | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					!(dep instanceof HarmonyImportDependency) || | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					!this._modules.has( | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 						/** @type {Module} */ | 
					
						
							|  |  |  | 						(compilation.moduleGraph.getModule(dep)) | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					) | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			)) { | 
					
						
							|  |  |  | 				this.dependencies.push(d); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// populate blocks
 | 
					
						
							|  |  |  | 			for (const d of m.blocks) { | 
					
						
							|  |  |  | 				this.blocks.push(d); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			// populate warnings
 | 
					
						
							|  |  |  | 			const warnings = m.getWarnings(); | 
					
						
							|  |  |  | 			if (warnings !== undefined) { | 
					
						
							|  |  |  | 				for (const warning of warnings) { | 
					
						
							|  |  |  | 					this.addWarning(warning); | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			// populate errors
 | 
					
						
							|  |  |  | 			const errors = m.getErrors(); | 
					
						
							|  |  |  | 			if (errors !== undefined) { | 
					
						
							|  |  |  | 				for (const error of errors) { | 
					
						
							|  |  |  | 					this.addError(error); | 
					
						
							| 
									
										
										
										
											2018-05-29 20:50:40 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-26 02:23:34 +08:00
										 |  |  | 			const { assets, assetsInfo, topLevelDeclarations, needCreateRequire } = | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				/** @type {BuildInfo} */ (m.buildInfo); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 			const buildInfo = /** @type {BuildInfo} */ (this.buildInfo); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-11 02:14:50 +08:00
										 |  |  | 			// populate topLevelDeclarations
 | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			if (topLevelDeclarations) { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 				const topLevelDeclarations = buildInfo.topLevelDeclarations; | 
					
						
							| 
									
										
										
										
											2021-02-11 02:14:50 +08:00
										 |  |  | 				if (topLevelDeclarations !== undefined) { | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					for (const decl of topLevelDeclarations) { | 
					
						
							| 
									
										
										
										
											2021-02-11 02:14:50 +08:00
										 |  |  | 						topLevelDeclarations.add(decl); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-02-07 22:21:36 +08:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 				buildInfo.topLevelDeclarations = undefined; | 
					
						
							| 
									
										
										
										
											2021-02-11 02:14:50 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-26 02:23:34 +08:00
										 |  |  | 			// populate needCreateRequire
 | 
					
						
							|  |  |  | 			if (needCreateRequire) { | 
					
						
							|  |  |  | 				this.buildInfo.needCreateRequire = true; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			// populate assets
 | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			if (assets) { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 				if (buildInfo.assets === undefined) { | 
					
						
							|  |  |  | 					buildInfo.assets = Object.create(null); | 
					
						
							| 
									
										
										
										
											2018-05-29 20:50:40 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  | 				Object.assign( | 
					
						
							|  |  |  | 					/** @type {NonNullable<BuildInfo["assets"]>} */ | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 					(buildInfo.assets), | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  | 					assets | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			if (assetsInfo) { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 				if (buildInfo.assetsInfo === undefined) { | 
					
						
							|  |  |  | 					buildInfo.assetsInfo = new Map(); | 
					
						
							| 
									
										
										
										
											2017-11-06 23:41:26 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				for (const [key, value] of assetsInfo) { | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 					buildInfo.assetsInfo.set(key, value); | 
					
						
							| 
									
										
										
										
											2019-09-11 17:13:46 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-06-18 20:46:06 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		callback(); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-12-04 18:23:40 +08:00
										 |  |  | 	 * @param {string=} type the source type for which the size should be estimated | 
					
						
							| 
									
										
										
										
											2019-05-13 18:29:29 +08:00
										 |  |  | 	 * @returns {number} the estimated size of the module (must be non-zero) | 
					
						
							| 
									
										
										
										
											2018-07-25 18:12:17 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-12-04 18:23:40 +08:00
										 |  |  | 	size(type) { | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		// Guess size from embedded modules
 | 
					
						
							| 
									
										
										
										
											2020-01-19 01:54:56 +08:00
										 |  |  | 		let size = 0; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		for (const module of this._modules) { | 
					
						
							|  |  |  | 			size += module.size(type); | 
					
						
							| 
									
										
										
										
											2020-01-19 01:54:56 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		return size; | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | 	 * @private | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | 	 * @param {Module} rootModule the root of the concatenation | 
					
						
							|  |  |  | 	 * @param {Set<Module>} modulesSet a set of modules which should be concatenated | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {RuntimeSpec} runtime for this runtime | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-06-08 16:34:38 +08:00
										 |  |  | 	 * @returns {ConcatenationEntry[]} concatenation list | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	_createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) { | 
					
						
							|  |  |  | 		/** @type {ConcatenationEntry[]} */ | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 		const list = []; | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		/** @type {Map<Module, RuntimeSpec | true>} */ | 
					
						
							|  |  |  | 		const existingEntries = new Map(); | 
					
						
							| 
									
										
										
										
											2025-08-30 01:28:23 +08:00
										 |  |  | 		const deferEnabled = this.compilation.options.experiments.deferImport; | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-08 19:20:57 +08:00
										 |  |  | 		/** | 
					
						
							|  |  |  | 		 * @param {Module} module a module | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		 * @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order | 
					
						
							| 
									
										
										
										
											2018-06-08 19:20:57 +08:00
										 |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 		const getConcatenatedImports = (module) => { | 
					
						
							| 
									
										
										
										
											2025-07-03 17:06:45 +08:00
										 |  |  | 			const connections = [...moduleGraph.getOutgoingConnections(module)]; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			if (module === rootModule) { | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 				for (const c of moduleGraph.getOutgoingConnections(this)) { | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					connections.push(c); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 			/** | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 			 * @type {{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number | undefined, defer?: boolean }[]} | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 			 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			const references = connections | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 				.filter((connection) => { | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 					if (!(connection.dependency instanceof HarmonyImportDependency)) { | 
					
						
							| 
									
										
										
										
											2019-10-30 05:02:22 +08:00
										 |  |  | 						return false; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					return ( | 
					
						
							| 
									
										
										
										
											2020-10-07 15:10:29 +08:00
										 |  |  | 						connection && | 
					
						
							| 
									
										
										
										
											2020-10-10 07:14:00 +08:00
										 |  |  | 						connection.resolvedOriginModule === module && | 
					
						
							| 
									
										
										
										
											2020-10-07 15:10:29 +08:00
										 |  |  | 						connection.module && | 
					
						
							|  |  |  | 						connection.isTargetActive(runtime) | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					); | 
					
						
							| 
									
										
										
										
											2019-10-30 04:37:59 +08:00
										 |  |  | 				}) | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 				.map((connection) => { | 
					
						
							| 
									
										
										
										
											2025-08-21 21:23:01 +08:00
										 |  |  | 					const dep = | 
					
						
							|  |  |  | 						/** @type {HarmonyImportDependency} */ | 
					
						
							|  |  |  | 						(connection.dependency); | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 					return { | 
					
						
							|  |  |  | 						connection, | 
					
						
							|  |  |  | 						sourceOrder: dep.sourceOrder, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 						rangeStart: dep.range && dep.range[0], | 
					
						
							|  |  |  | 						defer: dep.defer | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 					}; | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			/** | 
					
						
							|  |  |  | 			 * bySourceOrder | 
					
						
							|  |  |  | 			 * @example | 
					
						
							|  |  |  | 			 * import a from "a"; // sourceOrder=1
 | 
					
						
							|  |  |  | 			 * import b from "b"; // sourceOrder=2
 | 
					
						
							|  |  |  | 			 * | 
					
						
							|  |  |  | 			 * byRangeStart | 
					
						
							|  |  |  | 			 * @example | 
					
						
							|  |  |  | 			 * import {a, b} from "a"; // sourceOrder=1
 | 
					
						
							|  |  |  | 			 * a.a(); // first range
 | 
					
						
							|  |  |  | 			 * b.b(); // second range
 | 
					
						
							|  |  |  | 			 * | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 			 * If the import is deferred, we always move it to the last. | 
					
						
							| 
									
										
										
										
											2022-05-27 19:22:05 +08:00
										 |  |  | 			 * If there is no reexport, we have the same source. | 
					
						
							|  |  |  | 			 * If there is reexport, but module has side effects, this will lead to reexport module only. | 
					
						
							|  |  |  | 			 * If there is side-effects-free reexport, we can get simple deterministic result with range start comparison. | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			references.sort(concatComparators(bySourceOrder, byRangeStart)); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 			if (deferEnabled) { | 
					
						
							|  |  |  | 				// do not combine those two sorts. defer is not the same as source or range which has a comparable number, defer is only moving them.
 | 
					
						
							|  |  |  | 				references.sort(moveDeferToLast); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 			/** @type {Map<Module, { connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} */ | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			const referencesMap = new Map(); | 
					
						
							|  |  |  | 			for (const { connection } of references) { | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 				const runtimeCondition = filterRuntime(runtime, (r) => | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					connection.isTargetActive(r) | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 				if (runtimeCondition === false) continue; | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 				const module = connection.module; | 
					
						
							|  |  |  | 				const entry = referencesMap.get(module); | 
					
						
							|  |  |  | 				if (entry === undefined) { | 
					
						
							|  |  |  | 					referencesMap.set(module, { connection, runtimeCondition }); | 
					
						
							|  |  |  | 					continue; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 				entry.runtimeCondition = mergeRuntimeConditionNonFalse( | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					entry.runtimeCondition, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 					runtimeCondition, | 
					
						
							|  |  |  | 					runtime | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return referencesMap.values(); | 
					
						
							| 
									
										
										
										
											2017-11-08 18:32:05 +08:00
										 |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		/** | 
					
						
							|  |  |  | 		 * @param {ModuleGraphConnection} connection graph connection | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		 * @param {RuntimeSpec | true} runtimeCondition runtime condition | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		 * @returns {void} | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 		const enterModule = (connection, runtimeCondition) => { | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			const module = connection.module; | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			if (!module) return; | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 			const existingEntry = existingEntries.get(module); | 
					
						
							|  |  |  | 			if (existingEntry === true) { | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				return; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			if (modulesSet.has(module)) { | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 				existingEntries.set(module, true); | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 				if (runtimeCondition !== true) { | 
					
						
							|  |  |  | 					throw new Error( | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 						`Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString( | 
					
						
							|  |  |  | 							runtimeCondition | 
					
						
							|  |  |  | 						)}). This should not happen.`
 | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				const imports = getConcatenatedImports(module); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 				for (const { connection, runtimeCondition } of imports) { | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					enterModule(connection, runtimeCondition); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				list.push({ | 
					
						
							|  |  |  | 					type: "concatenated", | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					module: connection.module, | 
					
						
							|  |  |  | 					runtimeCondition | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				}); | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 				if (existingEntry !== undefined) { | 
					
						
							|  |  |  | 					const reducedRuntimeCondition = subtractRuntimeCondition( | 
					
						
							|  |  |  | 						runtimeCondition, | 
					
						
							|  |  |  | 						existingEntry, | 
					
						
							|  |  |  | 						runtime | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					if (reducedRuntimeCondition === false) return; | 
					
						
							|  |  |  | 					runtimeCondition = reducedRuntimeCondition; | 
					
						
							|  |  |  | 					existingEntries.set( | 
					
						
							|  |  |  | 						connection.module, | 
					
						
							|  |  |  | 						mergeRuntimeConditionNonFalse( | 
					
						
							|  |  |  | 							existingEntry, | 
					
						
							|  |  |  | 							runtimeCondition, | 
					
						
							|  |  |  | 							runtime | 
					
						
							|  |  |  | 						) | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					existingEntries.set(connection.module, runtimeCondition); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				if (list.length > 0) { | 
					
						
							|  |  |  | 					const lastItem = list[list.length - 1]; | 
					
						
							|  |  |  | 					if ( | 
					
						
							|  |  |  | 						lastItem.type === "external" && | 
					
						
							|  |  |  | 						lastItem.module === connection.module | 
					
						
							|  |  |  | 					) { | 
					
						
							|  |  |  | 						lastItem.runtimeCondition = mergeRuntimeCondition( | 
					
						
							|  |  |  | 							lastItem.runtimeCondition, | 
					
						
							|  |  |  | 							runtimeCondition, | 
					
						
							|  |  |  | 							runtime | 
					
						
							|  |  |  | 						); | 
					
						
							|  |  |  | 						return; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				list.push({ | 
					
						
							|  |  |  | 					type: "external", | 
					
						
							| 
									
										
										
										
											2017-08-07 19:56:50 +08:00
										 |  |  | 					get module() { | 
					
						
							|  |  |  | 						// We need to use a getter here, because the module in the dependency
 | 
					
						
							|  |  |  | 						// could be replaced by some other process (i. e. also replaced with a
 | 
					
						
							|  |  |  | 						// concatenated module)
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 						return connection.module; | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					}, | 
					
						
							|  |  |  | 					runtimeCondition | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				}); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-11-08 18:32:05 +08:00
										 |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		existingEntries.set(rootModule, true); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		const imports = getConcatenatedImports(rootModule); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 		for (const { connection, runtimeCondition } of imports) { | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			enterModule(connection, runtimeCondition); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		list.push({ | 
					
						
							|  |  |  | 			type: "concatenated", | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			module: rootModule, | 
					
						
							|  |  |  | 			runtimeCondition: true | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return list; | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Module} rootModule the root module of the concatenation | 
					
						
							|  |  |  | 	 * @param {Set<Module>} modules all modules in the concatenation (including the root module) | 
					
						
							| 
									
										
										
										
											2025-04-03 00:02:22 +08:00
										 |  |  | 	 * @param {AssociatedObjectForCache=} associatedObjectForCache object for caching | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	 * @param {string | HashConstructor=} hashFunction hash function to use | 
					
						
							|  |  |  | 	 * @returns {string} the identifier | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	static _createIdentifier( | 
					
						
							|  |  |  | 		rootModule, | 
					
						
							|  |  |  | 		modules, | 
					
						
							|  |  |  | 		associatedObjectForCache, | 
					
						
							| 
									
										
										
										
											2025-03-14 03:39:02 +08:00
										 |  |  | 		hashFunction = DEFAULTS.HASH_FUNCTION | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 	) { | 
					
						
							| 
									
										
										
										
											2021-08-19 20:01:44 +08:00
										 |  |  | 		const cachedMakePathsRelative = makePathsRelative.bindContextCache( | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			/** @type {string} */ (rootModule.context), | 
					
						
							| 
									
										
										
										
											2020-01-15 06:14:47 +08:00
										 |  |  | 			associatedObjectForCache | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2024-07-31 04:09:42 +08:00
										 |  |  | 		const identifiers = []; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		for (const module of modules) { | 
					
						
							| 
									
										
										
										
											2021-08-19 20:01:44 +08:00
										 |  |  | 			identifiers.push(cachedMakePathsRelative(module.identifier())); | 
					
						
							| 
									
										
										
										
											2017-11-23 23:57:07 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		identifiers.sort(); | 
					
						
							| 
									
										
										
										
											2021-09-22 18:12:46 +08:00
										 |  |  | 		const hash = createHash(hashFunction); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		hash.update(identifiers.join(" ")); | 
					
						
							| 
									
										
										
										
											2024-07-31 10:39:30 +08:00
										 |  |  | 		return `${rootModule.identifier()}|${hash.digest("hex")}`; | 
					
						
							| 
									
										
										
										
											2017-11-23 00:14:39 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-23 03:54:34 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 	 * @param {FileSystemDependencies} fileDependencies set where file dependencies are added to | 
					
						
							|  |  |  | 	 * @param {FileSystemDependencies} contextDependencies set where context dependencies are added to | 
					
						
							|  |  |  | 	 * @param {FileSystemDependencies} missingDependencies set where missing dependencies are added to | 
					
						
							|  |  |  | 	 * @param {FileSystemDependencies} buildDependencies set where build dependencies are added to | 
					
						
							| 
									
										
										
										
											2020-08-23 03:54:34 +08:00
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	addCacheDependencies( | 
					
						
							|  |  |  | 		fileDependencies, | 
					
						
							|  |  |  | 		contextDependencies, | 
					
						
							|  |  |  | 		missingDependencies, | 
					
						
							|  |  |  | 		buildDependencies | 
					
						
							|  |  |  | 	) { | 
					
						
							|  |  |  | 		for (const module of this._modules) { | 
					
						
							|  |  |  | 			module.addCacheDependencies( | 
					
						
							|  |  |  | 				fileDependencies, | 
					
						
							|  |  |  | 				contextDependencies, | 
					
						
							|  |  |  | 				missingDependencies, | 
					
						
							|  |  |  | 				buildDependencies | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 19:05:13 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	 * @param {CodeGenerationContext} context context for code generation | 
					
						
							|  |  |  | 	 * @returns {CodeGenerationResult} result | 
					
						
							| 
									
										
										
										
											2018-07-11 19:05:13 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	codeGeneration({ | 
					
						
							|  |  |  | 		dependencyTemplates, | 
					
						
							|  |  |  | 		runtimeTemplate, | 
					
						
							|  |  |  | 		moduleGraph, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		chunkGraph, | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 		runtime: generationRuntime, | 
					
						
							|  |  |  | 		codeGenerationResults | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 	}) { | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 		const { concatenatedModuleInfo } = ConcatenatedModule.getCompilationHooks( | 
					
						
							| 
									
										
										
										
											2025-08-30 01:28:23 +08:00
										 |  |  | 			this.compilation | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | 		/** @type {RuntimeRequirements} */ | 
					
						
							| 
									
										
										
										
											2019-10-09 17:49:48 +08:00
										 |  |  | 		const runtimeRequirements = new Set(); | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 		const runtime = intersectRuntime(generationRuntime, this._runtime); | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 17:31:00 +08:00
										 |  |  | 		const requestShortener = runtimeTemplate.requestShortener; | 
					
						
							| 
									
										
										
										
											2020-03-13 00:51:26 +08:00
										 |  |  | 		// Meta info for each module
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo( | 
					
						
							|  |  |  | 			moduleGraph, | 
					
						
							|  |  |  | 			runtime | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		// Set with modules that need a generated namespace object
 | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 		/** @type {NeededNamespaceObjects} */ | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		const neededNamespaceObjects = new Set(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-01 21:49:53 +08:00
										 |  |  | 		// Default disallowed names
 | 
					
						
							|  |  |  | 		const allUsedNames = new Set(INITIAL_USED_NAMES); | 
					
						
							|  |  |  | 		const chunks = chunkGraph.getModuleChunks(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Add names already used in the current chunk scope
 | 
					
						
							|  |  |  | 		for (const chunk of chunks) { | 
					
						
							|  |  |  | 			if (ConcatenationScope.chunkUsedNames.has(chunk)) { | 
					
						
							|  |  |  | 				for (const name of ConcatenationScope.chunkUsedNames.get(chunk) || []) { | 
					
						
							|  |  |  | 					allUsedNames.add(name); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		// Generate source code and analyse scopes
 | 
					
						
							|  |  |  | 		// Prepare a ReplaceSource for the final source
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		for (const info of moduleToInfoMap.values()) { | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 			this._analyseModule( | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 				moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				info, | 
					
						
							| 
									
										
										
										
											2020-09-11 15:41:54 +08:00
										 |  |  | 				dependencyTemplates, | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				runtimeTemplate, | 
					
						
							|  |  |  | 				moduleGraph, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				chunkGraph, | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 				runtime, | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | 				/** @type {CodeGenerationResults} */ | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 				(codeGenerationResults), | 
					
						
							|  |  |  | 				allUsedNames | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 			); | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-01 21:49:53 +08:00
										 |  |  | 		// Record the names registered by the current ConcatenatedModule into the chunk scope
 | 
					
						
							|  |  |  | 		if (INITIAL_USED_NAMES.size !== allUsedNames.size) { | 
					
						
							|  |  |  | 			for (const name of allUsedNames) { | 
					
						
							|  |  |  | 				if (INITIAL_USED_NAMES.has(name)) continue; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				for (const chunk of chunks) { | 
					
						
							|  |  |  | 					if (!ConcatenationScope.chunkUsedNames.has(chunk)) { | 
					
						
							|  |  |  | 						ConcatenationScope.chunkUsedNames.set(chunk, new Set([name])); | 
					
						
							|  |  |  | 					} else { | 
					
						
							|  |  |  | 						/** @type {Set<string>} */ ( | 
					
						
							|  |  |  | 							ConcatenationScope.chunkUsedNames.get(chunk) | 
					
						
							|  |  |  | 						).add(name); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-14 18:53:19 +08:00
										 |  |  | 		// Updated Top level declarations are created by renaming
 | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 		/** @type {TopLevelDeclarations} */ | 
					
						
							| 
									
										
										
										
											2022-02-14 18:53:19 +08:00
										 |  |  | 		const topLevelDeclarations = new Set(); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 		// List of additional names in scope for module references
 | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 		/** @type {Map<string, ScopeInfo>} */ | 
					
						
							| 
									
										
										
										
											2020-01-30 03:57:44 +08:00
										 |  |  | 		const usedNamesInScopeInfo = new Map(); | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 20:43:01 +08:00
										 |  |  | 		// Set of already checked scopes
 | 
					
						
							| 
									
										
										
										
											2020-01-30 03:57:44 +08:00
										 |  |  | 		const ignoredScopes = new Set(); | 
					
						
							| 
									
										
										
										
											2018-03-29 20:43:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		// get all global names
 | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		for (const info of modulesWithInfo) { | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 			if (info.type === "concatenated") { | 
					
						
							|  |  |  | 				// ignore symbols from moduleScope
 | 
					
						
							|  |  |  | 				if (info.moduleScope) { | 
					
						
							| 
									
										
										
										
											2020-01-30 03:57:44 +08:00
										 |  |  | 					ignoredScopes.add(info.moduleScope); | 
					
						
							| 
									
										
										
										
											2020-11-02 18:26:33 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-02 18:26:33 +08:00
										 |  |  | 				// The super class expression in class scopes behaves weird
 | 
					
						
							|  |  |  | 				// We get ranges of all super class expressions to make
 | 
					
						
							|  |  |  | 				// renaming to work correctly
 | 
					
						
							|  |  |  | 				const superClassCache = new WeakMap(); | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				/** | 
					
						
							|  |  |  | 				 * @param {Scope} scope scope | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 				 * @returns {{ range: Range, variables: Variable[] }[]} result | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				 */ | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 				const getSuperClassExpressions = (scope) => { | 
					
						
							| 
									
										
										
										
											2020-11-02 18:26:33 +08:00
										 |  |  | 					const cacheEntry = superClassCache.get(scope); | 
					
						
							|  |  |  | 					if (cacheEntry !== undefined) return cacheEntry; | 
					
						
							|  |  |  | 					const superClassExpressions = []; | 
					
						
							|  |  |  | 					for (const childScope of scope.childScopes) { | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 						if (childScope.type !== "class") continue; | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | 						const block = childScope.block; | 
					
						
							|  |  |  | 						if ( | 
					
						
							|  |  |  | 							(block.type === "ClassDeclaration" || | 
					
						
							|  |  |  | 								block.type === "ClassExpression") && | 
					
						
							|  |  |  | 							block.superClass | 
					
						
							|  |  |  | 						) { | 
					
						
							|  |  |  | 							superClassExpressions.push({ | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 								range: /** @type {Range} */ (block.superClass.range), | 
					
						
							| 
									
										
										
										
											2020-08-03 02:09:36 +08:00
										 |  |  | 								variables: childScope.variables | 
					
						
							|  |  |  | 							}); | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2020-11-02 18:26:33 +08:00
										 |  |  | 					superClassCache.set(scope, superClassExpressions); | 
					
						
							|  |  |  | 					return superClassExpressions; | 
					
						
							|  |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2018-03-29 20:43:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				// add global symbols
 | 
					
						
							|  |  |  | 				if (info.globalScope) { | 
					
						
							|  |  |  | 					for (const reference of info.globalScope.through) { | 
					
						
							|  |  |  | 						const name = reference.identifier.name; | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | 						if (ConcatenationScope.isModuleReference(name)) { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:56:06 +08:00
										 |  |  | 							const match = ConcatenationScope.matchModuleReference(name); | 
					
						
							| 
									
										
										
										
											2020-10-20 19:49:48 +08:00
										 |  |  | 							if (!match) continue; | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							const referencedInfo = modulesWithInfo[match.index]; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 							if (referencedInfo.type === "reference") { | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 								throw new Error("Module reference can't point to a reference"); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 							} | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 							const binding = getFinalBinding( | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 								moduleGraph, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 								referencedInfo, | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 								match.ids, | 
					
						
							|  |  |  | 								moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 								runtime, | 
					
						
							|  |  |  | 								requestShortener, | 
					
						
							|  |  |  | 								runtimeTemplate, | 
					
						
							|  |  |  | 								neededNamespaceObjects, | 
					
						
							|  |  |  | 								false, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 								match.deferredImport, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 								/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 								(info.module.buildMeta).strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 								true | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 							); | 
					
						
							|  |  |  | 							if (!binding.ids) continue; | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 							const { usedNames, alreadyCheckedScopes } = | 
					
						
							|  |  |  | 								getUsedNamesInScopeInfo( | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 									usedNamesInScopeInfo, | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 									binding.info.module.identifier(), | 
					
						
							|  |  |  | 									"name" in binding ? binding.name : "" | 
					
						
							|  |  |  | 								); | 
					
						
							| 
									
										
										
										
											2020-11-02 18:26:33 +08:00
										 |  |  | 							for (const expr of getSuperClassExpressions(reference.from)) { | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 								if ( | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 									expr.range[0] <= | 
					
						
							|  |  |  | 										/** @type {Range} */ (reference.identifier.range)[0] && | 
					
						
							|  |  |  | 									expr.range[1] >= | 
					
						
							|  |  |  | 										/** @type {Range} */ (reference.identifier.range)[1] | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 								) { | 
					
						
							|  |  |  | 									for (const variable of expr.variables) { | 
					
						
							| 
									
										
										
										
											2019-12-24 04:54:57 +08:00
										 |  |  | 										usedNames.add(variable.name); | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 									} | 
					
						
							| 
									
										
										
										
											2018-03-29 20:43:01 +08:00
										 |  |  | 								} | 
					
						
							|  |  |  | 							} | 
					
						
							| 
									
										
										
										
											2020-01-30 03:57:44 +08:00
										 |  |  | 							addScopeSymbols( | 
					
						
							|  |  |  | 								reference.from, | 
					
						
							|  |  |  | 								usedNames, | 
					
						
							|  |  |  | 								alreadyCheckedScopes, | 
					
						
							|  |  |  | 								ignoredScopes | 
					
						
							|  |  |  | 							); | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 						} else { | 
					
						
							|  |  |  | 							allUsedNames.add(name); | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2017-05-31 22:46:25 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-08-20 16:34:58 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 		/** | 
					
						
							|  |  |  | 		 * @param {string} name the name to find a new name for | 
					
						
							|  |  |  | 		 * @param {ConcatenatedModuleInfo} info the info of the module | 
					
						
							|  |  |  | 		 * @param {Reference[]} references the references to the name | 
					
						
							|  |  |  | 		 * @returns {string|undefined} the new name or undefined if the name is not found | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		const _findNewName = (name, info, references) => { | 
					
						
							|  |  |  | 			const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo( | 
					
						
							|  |  |  | 				usedNamesInScopeInfo, | 
					
						
							|  |  |  | 				info.module.identifier(), | 
					
						
							|  |  |  | 				name | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 			if (allUsedNames.has(name) || usedNames.has(name)) { | 
					
						
							|  |  |  | 				for (const ref of references) { | 
					
						
							|  |  |  | 					addScopeSymbols( | 
					
						
							|  |  |  | 						ref.from, | 
					
						
							|  |  |  | 						usedNames, | 
					
						
							|  |  |  | 						alreadyCheckedScopes, | 
					
						
							|  |  |  | 						ignoredScopes | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				const newName = findNewName( | 
					
						
							|  |  |  | 					name, | 
					
						
							|  |  |  | 					allUsedNames, | 
					
						
							|  |  |  | 					usedNames, | 
					
						
							|  |  |  | 					info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				allUsedNames.add(newName); | 
					
						
							|  |  |  | 				info.internalNames.set(name, newName); | 
					
						
							|  |  |  | 				topLevelDeclarations.add(newName); | 
					
						
							|  |  |  | 				return newName; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * @param {string} name the name to find a new name for | 
					
						
							|  |  |  | 		 * @param {ConcatenatedModuleInfo} info the info of the module | 
					
						
							|  |  |  | 		 * @param {Reference[]} references the references to the name | 
					
						
							|  |  |  | 		 * @returns {string|undefined} the new name or undefined if the name is not found | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		const _findNewNameForSpecifier = (name, info, references) => { | 
					
						
							|  |  |  | 			const { usedNames: moduleUsedNames, alreadyCheckedScopes } = | 
					
						
							|  |  |  | 				getUsedNamesInScopeInfo( | 
					
						
							|  |  |  | 					usedNamesInScopeInfo, | 
					
						
							|  |  |  | 					info.module.identifier(), | 
					
						
							|  |  |  | 					name | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			const referencesUsedNames = new Set(); | 
					
						
							|  |  |  | 			for (const ref of references) { | 
					
						
							|  |  |  | 				addScopeSymbols( | 
					
						
							|  |  |  | 					ref.from, | 
					
						
							|  |  |  | 					referencesUsedNames, | 
					
						
							|  |  |  | 					alreadyCheckedScopes, | 
					
						
							|  |  |  | 					ignoredScopes | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (moduleUsedNames.has(name) || referencesUsedNames.has(name)) { | 
					
						
							|  |  |  | 				const newName = findNewName( | 
					
						
							|  |  |  | 					name, | 
					
						
							|  |  |  | 					allUsedNames, | 
					
						
							|  |  |  | 					new Set([...moduleUsedNames, ...referencesUsedNames]), | 
					
						
							|  |  |  | 					info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				allUsedNames.add(newName); | 
					
						
							|  |  |  | 				topLevelDeclarations.add(newName); | 
					
						
							|  |  |  | 				return newName; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 		// generate names for symbols
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		for (const info of moduleToInfoMap.values()) { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo( | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 				usedNamesInScopeInfo, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				info.module.identifier(), | 
					
						
							|  |  |  | 				"" | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			switch (info.type) { | 
					
						
							|  |  |  | 				case "concatenated": { | 
					
						
							| 
									
										
										
										
											2024-10-25 02:13:59 +08:00
										 |  |  | 					const variables = /** @type {Scope} */ (info.moduleScope).variables; | 
					
						
							|  |  |  | 					for (const variable of variables) { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						const name = variable.name; | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 						const references = getAllReferences(variable); | 
					
						
							|  |  |  | 						const newName = _findNewName(name, info, references); | 
					
						
							|  |  |  | 						if (newName) { | 
					
						
							| 
									
										
										
										
											2024-10-25 02:13:59 +08:00
										 |  |  | 							const source = /** @type {ReplaceSource} */ (info.source); | 
					
						
							| 
									
										
										
										
											2025-07-03 17:06:45 +08:00
										 |  |  | 							const allIdentifiers = new Set([ | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 								...references.map((r) => r.identifier), | 
					
						
							| 
									
										
										
										
											2025-07-03 17:06:45 +08:00
										 |  |  | 								...variable.identifiers | 
					
						
							|  |  |  | 							]); | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 							for (const identifier of allIdentifiers) { | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 								const r = /** @type {Range} */ (identifier.range); | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | 								const path = getPathInAst( | 
					
						
							|  |  |  | 									/** @type {NonNullable<ConcatenatedModuleInfo["ast"]>} */ | 
					
						
							|  |  |  | 									(info.ast), | 
					
						
							|  |  |  | 									identifier | 
					
						
							|  |  |  | 								); | 
					
						
							| 
									
										
										
										
											2021-02-20 02:32:23 +08:00
										 |  |  | 								if (path && path.length > 1) { | 
					
						
							|  |  |  | 									const maybeProperty = | 
					
						
							| 
									
										
										
										
											2021-02-24 19:54:17 +08:00
										 |  |  | 										path[1].type === "AssignmentPattern" && | 
					
						
							|  |  |  | 										path[1].left === path[0] | 
					
						
							|  |  |  | 											? path[2] | 
					
						
							|  |  |  | 											: path[1]; | 
					
						
							| 
									
										
										
										
											2021-02-20 02:32:23 +08:00
										 |  |  | 									if ( | 
					
						
							|  |  |  | 										maybeProperty.type === "Property" && | 
					
						
							|  |  |  | 										maybeProperty.shorthand | 
					
						
							|  |  |  | 									) { | 
					
						
							|  |  |  | 										source.insert(r[1], `: ${newName}`); | 
					
						
							|  |  |  | 										continue; | 
					
						
							|  |  |  | 									} | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 								} | 
					
						
							| 
									
										
										
										
											2021-02-20 02:32:23 +08:00
										 |  |  | 								source.replace(r[0], r[1] - 1, newName); | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 							} | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						} else { | 
					
						
							|  |  |  | 							allUsedNames.add(name); | 
					
						
							|  |  |  | 							info.internalNames.set(name, name); | 
					
						
							| 
									
										
										
										
											2022-02-04 20:17:09 +08:00
										 |  |  | 							topLevelDeclarations.add(name); | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2020-09-15 17:43:06 +08:00
										 |  |  | 					let namespaceObjectName; | 
					
						
							|  |  |  | 					if (info.namespaceExportSymbol) { | 
					
						
							|  |  |  | 						namespaceObjectName = info.internalNames.get( | 
					
						
							|  |  |  | 							info.namespaceExportSymbol | 
					
						
							|  |  |  | 						); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:56:06 +08:00
										 |  |  | 					} else { | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 						namespaceObjectName = findNewName( | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 							"namespaceObject", | 
					
						
							|  |  |  | 							allUsedNames, | 
					
						
							|  |  |  | 							namespaceObjectUsedNames, | 
					
						
							|  |  |  | 							info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 						); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:56:06 +08:00
										 |  |  | 						allUsedNames.add(namespaceObjectName); | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | 					info.namespaceObjectName = | 
					
						
							|  |  |  | 						/** @type {string} */ | 
					
						
							|  |  |  | 						(namespaceObjectName); | 
					
						
							| 
									
										
										
										
											2025-06-24 22:43:58 +08:00
										 |  |  | 					topLevelDeclarations.add( | 
					
						
							|  |  |  | 						/** @type {string} */ | 
					
						
							|  |  |  | 						(namespaceObjectName) | 
					
						
							|  |  |  | 					); | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					break; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				case "external": { | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 					const externalName = findNewName( | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						"", | 
					
						
							|  |  |  | 						allUsedNames, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 						namespaceObjectUsedNames, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					allUsedNames.add(externalName); | 
					
						
							| 
									
										
										
										
											2020-10-20 19:49:48 +08:00
										 |  |  | 					info.name = externalName; | 
					
						
							| 
									
										
										
										
											2022-02-04 20:17:09 +08:00
										 |  |  | 					topLevelDeclarations.add(externalName); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					if (info.deferred) { | 
					
						
							|  |  |  | 						const externalName = findNewName( | 
					
						
							|  |  |  | 							"deferred", | 
					
						
							|  |  |  | 							allUsedNames, | 
					
						
							|  |  |  | 							namespaceObjectUsedNames, | 
					
						
							|  |  |  | 							info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 						); | 
					
						
							|  |  |  | 						allUsedNames.add(externalName); | 
					
						
							|  |  |  | 						info.deferredName = externalName; | 
					
						
							|  |  |  | 						topLevelDeclarations.add(externalName); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						const externalNameInterop = findNewName( | 
					
						
							|  |  |  | 							"deferredNamespaceObject", | 
					
						
							|  |  |  | 							allUsedNames, | 
					
						
							|  |  |  | 							namespaceObjectUsedNames, | 
					
						
							|  |  |  | 							info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 						); | 
					
						
							|  |  |  | 						allUsedNames.add(externalNameInterop); | 
					
						
							|  |  |  | 						info.deferredNamespaceObjectName = externalNameInterop; | 
					
						
							|  |  |  | 						topLevelDeclarations.add(externalNameInterop); | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					break; | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			const buildMeta = /** @type {BuildMeta} */ (info.module.buildMeta); | 
					
						
							|  |  |  | 			if (buildMeta.exportsType !== "namespace") { | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 				const externalNameInterop = findNewName( | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					"namespaceObject", | 
					
						
							|  |  |  | 					allUsedNames, | 
					
						
							|  |  |  | 					namespaceObjectUsedNames, | 
					
						
							|  |  |  | 					info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				allUsedNames.add(externalNameInterop); | 
					
						
							|  |  |  | 				info.interopNamespaceObjectName = externalNameInterop; | 
					
						
							| 
									
										
										
										
											2022-02-04 20:17:09 +08:00
										 |  |  | 				topLevelDeclarations.add(externalNameInterop); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 			if ( | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				buildMeta.exportsType === "default" && | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 				buildMeta.defaultObject !== "redirect" && | 
					
						
							|  |  |  | 				info.interopNamespaceObject2Used | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 			) { | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 				const externalNameInterop = findNewName( | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 					"namespaceObject2", | 
					
						
							|  |  |  | 					allUsedNames, | 
					
						
							|  |  |  | 					namespaceObjectUsedNames, | 
					
						
							|  |  |  | 					info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				allUsedNames.add(externalNameInterop); | 
					
						
							|  |  |  | 				info.interopNamespaceObject2Name = externalNameInterop; | 
					
						
							| 
									
										
										
										
											2022-02-04 20:17:09 +08:00
										 |  |  | 				topLevelDeclarations.add(externalNameInterop); | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 			if (buildMeta.exportsType === "dynamic" || !buildMeta.exportsType) { | 
					
						
							| 
									
										
										
										
											2024-06-06 17:36:17 +08:00
										 |  |  | 				const externalNameInterop = findNewName( | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					"default", | 
					
						
							|  |  |  | 					allUsedNames, | 
					
						
							|  |  |  | 					namespaceObjectUsedNames, | 
					
						
							|  |  |  | 					info.module.readableIdentifier(requestShortener) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 				allUsedNames.add(externalNameInterop); | 
					
						
							|  |  |  | 				info.interopDefaultAccessName = externalNameInterop; | 
					
						
							| 
									
										
										
										
											2022-02-04 20:17:09 +08:00
										 |  |  | 				topLevelDeclarations.add(externalNameInterop); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | 		// Find and replace references to modules
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		for (const info of moduleToInfoMap.values()) { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			if (info.type === "concatenated") { | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  | 				const globalScope = /** @type {Scope} */ (info.globalScope); | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 				// group references by name
 | 
					
						
							|  |  |  | 				const referencesByName = new Map(); | 
					
						
							| 
									
										
										
										
											2024-08-09 23:42:37 +08:00
										 |  |  | 				for (const reference of globalScope.through) { | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 					const name = reference.identifier.name; | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 					if (!referencesByName.has(name)) { | 
					
						
							|  |  |  | 						referencesByName.set(name, []); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					referencesByName.get(name).push(reference); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				for (const [name, references] of referencesByName) { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:56:06 +08:00
										 |  |  | 					const match = ConcatenationScope.matchModuleReference(name); | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					if (match) { | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 						const referencedInfo = modulesWithInfo[match.index]; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 						if (referencedInfo.type === "reference") { | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							throw new Error("Module reference can't point to a reference"); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 						const concatenationScope = /** @type {ConcatenatedModuleInfo} */ ( | 
					
						
							|  |  |  | 							referencedInfo | 
					
						
							|  |  |  | 						).concatenationScope; | 
					
						
							|  |  |  | 						const exportId = match.ids[0]; | 
					
						
							|  |  |  | 						const specifier = | 
					
						
							|  |  |  | 							concatenationScope && concatenationScope.getRawExport(exportId); | 
					
						
							|  |  |  | 						if (specifier) { | 
					
						
							|  |  |  | 							const newName = _findNewNameForSpecifier( | 
					
						
							|  |  |  | 								specifier, | 
					
						
							|  |  |  | 								info, | 
					
						
							|  |  |  | 								references | 
					
						
							|  |  |  | 							); | 
					
						
							|  |  |  | 							const initFragmentChanged = | 
					
						
							|  |  |  | 								newName && | 
					
						
							|  |  |  | 								concatenatedModuleInfo.call( | 
					
						
							|  |  |  | 									{ | 
					
						
							|  |  |  | 										rawExportMap: new Map([ | 
					
						
							|  |  |  | 											[exportId, /** @type {string} */ (newName)] | 
					
						
							|  |  |  | 										]) | 
					
						
							|  |  |  | 									}, | 
					
						
							|  |  |  | 									/** @type {ConcatenatedModuleInfo} */ (referencedInfo) | 
					
						
							|  |  |  | 								); | 
					
						
							|  |  |  | 							if (initFragmentChanged) { | 
					
						
							|  |  |  | 								concatenationScope.setRawExportMap(exportId, newName); | 
					
						
							|  |  |  | 							} | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						const finalName = getFinalName( | 
					
						
							| 
									
										
										
										
											2018-08-07 01:39:43 +08:00
										 |  |  | 							moduleGraph, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							referencedInfo, | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 							match.ids, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 							moduleToInfoMap, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 							runtime, | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 							requestShortener, | 
					
						
							| 
									
										
										
										
											2019-08-27 02:21:07 +08:00
										 |  |  | 							runtimeTemplate, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 							neededNamespaceObjects, | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 							match.call, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 							match.deferredImport, | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 							!match.directImport, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 							/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 							(info.module.buildMeta).strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2019-08-23 14:46:42 +08:00
										 |  |  | 							match.asiSafe | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 						); | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 						for (const reference of references) { | 
					
						
							|  |  |  | 							const r = /** @type {Range} */ (reference.identifier.range); | 
					
						
							|  |  |  | 							const source = /** @type {ReplaceSource} */ (info.source); | 
					
						
							|  |  |  | 							// range is extended by 2 chars to cover the appended "._"
 | 
					
						
							|  |  |  | 							source.replace(r[0], r[1] + 1, finalName); | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 03:57:48 +08:00
										 |  |  | 		// Map with all root exposed used exports
 | 
					
						
							| 
									
										
										
										
											2025-03-12 09:56:14 +08:00
										 |  |  | 		/** @type {Map<string, (requestShortener: RequestShortener) => string>} */ | 
					
						
							| 
									
										
										
										
											2020-02-22 03:57:48 +08:00
										 |  |  | 		const exportsMap = new Map(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Set with all root exposed unused exports
 | 
					
						
							|  |  |  | 		/** @type {Set<string>} */ | 
					
						
							|  |  |  | 		const unusedExports = new Set(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 		const rootInfo = | 
					
						
							|  |  |  | 			/** @type {ConcatenatedModuleInfo} */ | 
					
						
							|  |  |  | 			(moduleToInfoMap.get(this.rootModule)); | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 		const strictHarmonyModule = | 
					
						
							|  |  |  | 			/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 			(rootInfo.module.buildMeta).strictHarmonyModule; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module); | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 		/** @type {Record<string, string>} */ | 
					
						
							| 
									
										
										
										
											2024-06-05 16:09:03 +08:00
										 |  |  | 		const exportsFinalName = {}; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		for (const exportInfo of exportsInfo.orderedExports) { | 
					
						
							|  |  |  | 			const name = exportInfo.name; | 
					
						
							|  |  |  | 			if (exportInfo.provided === false) continue; | 
					
						
							|  |  |  | 			const used = exportInfo.getUsedName(undefined, runtime); | 
					
						
							|  |  |  | 			if (!used) { | 
					
						
							| 
									
										
										
										
											2020-09-11 17:32:07 +08:00
										 |  |  | 				unusedExports.add(name); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				continue; | 
					
						
							| 
									
										
										
										
											2020-02-22 03:57:48 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 			exportsMap.set(used, (requestShortener) => { | 
					
						
							| 
									
										
										
										
											2020-11-30 17:18:38 +08:00
										 |  |  | 				try { | 
					
						
							|  |  |  | 					const finalName = getFinalName( | 
					
						
							|  |  |  | 						moduleGraph, | 
					
						
							|  |  |  | 						rootInfo, | 
					
						
							|  |  |  | 						[name], | 
					
						
							|  |  |  | 						moduleToInfoMap, | 
					
						
							|  |  |  | 						runtime, | 
					
						
							|  |  |  | 						requestShortener, | 
					
						
							|  |  |  | 						runtimeTemplate, | 
					
						
							|  |  |  | 						neededNamespaceObjects, | 
					
						
							|  |  |  | 						false, | 
					
						
							|  |  |  | 						false, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 						false, | 
					
						
							| 
									
										
										
										
											2020-11-30 17:18:38 +08:00
										 |  |  | 						strictHarmonyModule, | 
					
						
							|  |  |  | 						true | 
					
						
							|  |  |  | 					); | 
					
						
							| 
									
										
										
										
											2024-06-05 16:09:03 +08:00
										 |  |  | 					exportsFinalName[used] = finalName; | 
					
						
							| 
									
										
										
										
											2020-11-30 17:18:38 +08:00
										 |  |  | 					return `/* ${ | 
					
						
							|  |  |  | 						exportInfo.isReexport() ? "reexport" : "binding" | 
					
						
							|  |  |  | 					} */ ${finalName}`; | 
					
						
							| 
									
										
										
										
											2024-07-31 15:37:05 +08:00
										 |  |  | 				} catch (err) { | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 					/** @type {Error} */ | 
					
						
							| 
									
										
										
										
											2024-07-31 15:37:05 +08:00
										 |  |  | 					(err).message += | 
					
						
							| 
									
										
										
										
											2024-07-31 05:43:19 +08:00
										 |  |  | 						`\nwhile generating the root export '${name}' (used name: '${used}')`; | 
					
						
							| 
									
										
										
										
											2024-07-31 15:37:05 +08:00
										 |  |  | 					throw err; | 
					
						
							| 
									
										
										
										
											2020-11-30 17:18:38 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			}); | 
					
						
							| 
									
										
										
										
											2020-02-22 03:57:48 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		const result = new ConcatSource(); | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// add harmony compatibility flag (must be first because of possible circular dependencies)
 | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 		let shouldAddHarmonyFlag = false; | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 		if ( | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== | 
					
						
							| 
									
										
										
										
											2019-03-14 19:06:59 +08:00
										 |  |  | 			UsageState.Unused | 
					
						
							|  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 			shouldAddHarmonyFlag = true; | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-21 19:08:15 +08:00
										 |  |  | 		// define exports
 | 
					
						
							|  |  |  | 		if (exportsMap.size > 0) { | 
					
						
							|  |  |  | 			const definitions = []; | 
					
						
							|  |  |  | 			for (const [key, value] of exportsMap) { | 
					
						
							|  |  |  | 				definitions.push( | 
					
						
							| 
									
										
										
										
											2023-05-05 11:41:15 +08:00
										 |  |  | 					`\n  ${propertyName(key)}: ${runtimeTemplate.returningFunction( | 
					
						
							| 
									
										
										
										
											2020-02-21 19:08:15 +08:00
										 |  |  | 						value(requestShortener) | 
					
						
							|  |  |  | 					)}`
 | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-04-06 22:53:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  | 			const { onDemandExportsGeneration } = | 
					
						
							| 
									
										
										
										
											2025-08-30 01:28:23 +08:00
										 |  |  | 				ConcatenatedModule.getCompilationHooks(this.compilation); | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  | 			runtimeRequirements.add(RuntimeGlobals.exports); | 
					
						
							|  |  |  | 			runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (shouldAddHarmonyFlag) { | 
					
						
							|  |  |  | 				result.add("// ESM COMPAT FLAG\n"); | 
					
						
							|  |  |  | 				result.add( | 
					
						
							|  |  |  | 					runtimeTemplate.defineEsModuleFlagStatement({ | 
					
						
							|  |  |  | 						exportsArgument: this.exportsArgument, | 
					
						
							|  |  |  | 						runtimeRequirements | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  | 			if (onDemandExportsGeneration.call(this)) { | 
					
						
							|  |  |  | 				/** @type {BuildMeta} */ (this.buildMeta).factoryExportsBinding = | 
					
						
							| 
									
										
										
										
											2025-08-14 23:51:50 +08:00
										 |  |  | 					"\n// EXPORTS\n" + | 
					
						
							| 
									
										
										
										
											2025-08-04 23:50:05 +08:00
										 |  |  | 					`${RuntimeGlobals.definePropertyGetters}(${ | 
					
						
							|  |  |  | 						this.exportsArgument | 
					
						
							|  |  |  | 					}, {${definitions.join(",")}\n});\n`;
 | 
					
						
							|  |  |  | 				/** @type {BuildMeta} */ (this.buildMeta).exportsFinalName = | 
					
						
							|  |  |  | 					exportsFinalName; | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2024-07-31 12:23:44 +08:00
										 |  |  | 				result.add("\n// EXPORTS\n"); | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 				result.add( | 
					
						
							|  |  |  | 					`${RuntimeGlobals.definePropertyGetters}(${ | 
					
						
							|  |  |  | 						this.exportsArgument | 
					
						
							|  |  |  | 					}, {${definitions.join(",")}\n});\n`
 | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-02-21 19:08:15 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// list unused exports
 | 
					
						
							|  |  |  | 		if (unusedExports.size > 0) { | 
					
						
							|  |  |  | 			result.add( | 
					
						
							|  |  |  | 				`\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n` | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 		// generate namespace objects
 | 
					
						
							|  |  |  | 		const namespaceObjectSources = new Map(); | 
					
						
							|  |  |  | 		for (const info of neededNamespaceObjects) { | 
					
						
							| 
									
										
										
										
											2020-09-15 17:43:06 +08:00
										 |  |  | 			if (info.namespaceExportSymbol) continue; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			const nsObj = []; | 
					
						
							|  |  |  | 			const exportsInfo = moduleGraph.getExportsInfo(info.module); | 
					
						
							|  |  |  | 			for (const exportInfo of exportsInfo.orderedExports) { | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 				if (exportInfo.provided === false) continue; | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				const usedName = exportInfo.getUsedName(undefined, runtime); | 
					
						
							|  |  |  | 				if (usedName) { | 
					
						
							|  |  |  | 					const finalName = getFinalName( | 
					
						
							|  |  |  | 						moduleGraph, | 
					
						
							|  |  |  | 						info, | 
					
						
							|  |  |  | 						[exportInfo.name], | 
					
						
							|  |  |  | 						moduleToInfoMap, | 
					
						
							|  |  |  | 						runtime, | 
					
						
							|  |  |  | 						requestShortener, | 
					
						
							|  |  |  | 						runtimeTemplate, | 
					
						
							|  |  |  | 						neededNamespaceObjects, | 
					
						
							|  |  |  | 						false, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 						false, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 						undefined, | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 						/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 						(info.module.buildMeta).strictHarmonyModule, | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 						true | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					nsObj.push( | 
					
						
							| 
									
										
										
										
											2023-05-05 11:41:15 +08:00
										 |  |  | 						`\n  ${propertyName(usedName)}: ${runtimeTemplate.returningFunction( | 
					
						
							|  |  |  | 							finalName | 
					
						
							|  |  |  | 						)}`
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			const name = info.namespaceObjectName; | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 			const defineGetters = | 
					
						
							|  |  |  | 				nsObj.length > 0 | 
					
						
							|  |  |  | 					? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join( | 
					
						
							|  |  |  | 							"," | 
					
						
							| 
									
										
										
										
											2024-07-31 05:43:19 +08:00
										 |  |  | 						)}\n});\n`
 | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 					: ""; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 			if (nsObj.length > 0) { | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 				runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			namespaceObjectSources.set( | 
					
						
							|  |  |  | 				info, | 
					
						
							| 
									
										
										
										
											2020-10-06 18:04:43 +08:00
										 |  |  | 				`
 | 
					
						
							|  |  |  | // NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)}
 | 
					
						
							|  |  |  | var ${name} = {}; | 
					
						
							|  |  |  | ${RuntimeGlobals.makeNamespaceObject}(${name}); | 
					
						
							|  |  |  | ${defineGetters}`
 | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			); | 
					
						
							|  |  |  | 			runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 		// define required namespace objects (must be before evaluation modules)
 | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		for (const info of modulesWithInfo) { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			if (info.type === "concatenated") { | 
					
						
							|  |  |  | 				const source = namespaceObjectSources.get(info); | 
					
						
							|  |  |  | 				if (!source) continue; | 
					
						
							|  |  |  | 				result.add(source); | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 		/** @type {InitFragment<ChunkRenderContext>[]} */ | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 		const chunkInitFragments = []; | 
					
						
							| 
									
										
										
										
											2025-08-30 01:28:23 +08:00
										 |  |  | 		const deferEnabled = this.compilation.options.experiments.deferImport; | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-07 20:12:31 +08:00
										 |  |  | 		// evaluate modules in order
 | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		for (const rawInfo of modulesWithInfo) { | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			let name; | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			let isConditional = false; | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 			const info = rawInfo.type === "reference" ? rawInfo.target : rawInfo; | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			switch (info.type) { | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 				case "concatenated": { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					result.add( | 
					
						
							| 
									
										
										
										
											2024-08-28 02:00:15 +08:00
										 |  |  | 						`\n;// ${info.module.readableIdentifier(requestShortener)}\n` | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					// If a module is deferred in other places, but used as non-deferred here,
 | 
					
						
							|  |  |  | 					// the module itself will be emitted as mod_deferred (in the case "external"),
 | 
					
						
							|  |  |  | 					// we need to emit an extra import declaration to evaluate it in order.
 | 
					
						
							|  |  |  | 					if (deferEnabled) { | 
					
						
							|  |  |  | 						for (const dep of info.module.dependencies) { | 
					
						
							|  |  |  | 							if ( | 
					
						
							|  |  |  | 								!dep.defer && | 
					
						
							|  |  |  | 								dep instanceof HarmonyImportSideEffectDependency | 
					
						
							|  |  |  | 							) { | 
					
						
							|  |  |  | 								const referredModule = moduleGraph.getModule(dep); | 
					
						
							|  |  |  | 								if (!referredModule) continue; | 
					
						
							|  |  |  | 								if (moduleGraph.isDeferred(referredModule)) { | 
					
						
							|  |  |  | 									const deferredModuleInfo = /** @type {ExternalModuleInfo} */ ( | 
					
						
							|  |  |  | 										modulesWithInfo.find( | 
					
						
							| 
									
										
										
										
											2025-07-17 00:13:14 +08:00
										 |  |  | 											(i) => | 
					
						
							|  |  |  | 												i.type === "external" && i.module === referredModule | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 										) | 
					
						
							|  |  |  | 									); | 
					
						
							|  |  |  | 									if (!deferredModuleInfo) continue; | 
					
						
							|  |  |  | 									result.add( | 
					
						
							|  |  |  | 										`\n// non-deferred import to a deferred module (${referredModule.readableIdentifier(requestShortener)})\nvar ${deferredModuleInfo.name} = ${deferredModuleInfo.deferredName}.a;` | 
					
						
							|  |  |  | 									); | 
					
						
							|  |  |  | 								} | 
					
						
							|  |  |  | 							} | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2024-10-25 02:13:59 +08:00
										 |  |  | 					result.add(/** @type {ReplaceSource} */ (info.source)); | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 					if (info.chunkInitFragments) { | 
					
						
							|  |  |  | 						for (const f of info.chunkInitFragments) chunkInitFragments.push(f); | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 					if (info.runtimeRequirements) { | 
					
						
							|  |  |  | 						for (const r of info.runtimeRequirements) { | 
					
						
							|  |  |  | 							runtimeRequirements.add(r); | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 					name = info.namespaceObjectName; | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 					break; | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 				case "external": { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 					result.add( | 
					
						
							|  |  |  | 						`\n// EXTERNAL MODULE: ${info.module.readableIdentifier( | 
					
						
							|  |  |  | 							requestShortener | 
					
						
							|  |  |  | 						)}\n`
 | 
					
						
							|  |  |  | 					); | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 					runtimeRequirements.add(RuntimeGlobals.require); | 
					
						
							| 
									
										
										
										
											2021-05-11 15:31:46 +08:00
										 |  |  | 					const { runtimeCondition } = | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 						/** @type {ExternalModuleInfo | ReferenceToModuleInfo} */ | 
					
						
							|  |  |  | 						(rawInfo); | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					const condition = runtimeTemplate.runtimeConditionExpression({ | 
					
						
							|  |  |  | 						chunkGraph, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 						runtimeCondition, | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 						runtime, | 
					
						
							|  |  |  | 						runtimeRequirements | 
					
						
							|  |  |  | 					}); | 
					
						
							|  |  |  | 					if (condition !== "true") { | 
					
						
							|  |  |  | 						isConditional = true; | 
					
						
							|  |  |  | 						result.add(`if (${condition}) {\n`); | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					const moduleId = JSON.stringify(chunkGraph.getModuleId(info.module)); | 
					
						
							|  |  |  | 					if (info.deferred) { | 
					
						
							|  |  |  | 						const loader = getOptimizedDeferredModule( | 
					
						
							|  |  |  | 							runtimeTemplate, | 
					
						
							|  |  |  | 							info.module.getExportsType( | 
					
						
							|  |  |  | 								moduleGraph, | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 								/** @type {BuildMeta} */ | 
					
						
							|  |  |  | 								(this.rootModule.buildMeta).strictHarmonyModule | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 							), | 
					
						
							|  |  |  | 							moduleId, | 
					
						
							|  |  |  | 							// an async module will opt-out of the concat module optimization.
 | 
					
						
							|  |  |  | 							[] | 
					
						
							|  |  |  | 						); | 
					
						
							|  |  |  | 						result.add(`var ${info.deferredName} = ${loader};`); | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 						name = info.deferredName; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					} else { | 
					
						
							|  |  |  | 						result.add(`var ${info.name} = __webpack_require__(${moduleId});`); | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 						name = info.name; | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 					break; | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				default: | 
					
						
							| 
									
										
										
										
											2020-03-30 23:56:37 +08:00
										 |  |  | 					// @ts-expect-error never is expected here
 | 
					
						
							| 
									
										
										
										
											2017-08-07 19:19:24 +08:00
										 |  |  | 					throw new Error(`Unsupported concatenation entry type ${info.type}`); | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 			if (info.type === "external" && info.deferredNamespaceObjectUsed) { | 
					
						
							|  |  |  | 				runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject); | 
					
						
							|  |  |  | 				result.add( | 
					
						
							|  |  |  | 					`\nvar ${info.deferredNamespaceObjectName} = /*#__PURE__*/${ | 
					
						
							|  |  |  | 						RuntimeGlobals.makeDeferredNamespaceObject | 
					
						
							|  |  |  | 					}(${JSON.stringify( | 
					
						
							|  |  |  | 						chunkGraph.getModuleId(info.module) | 
					
						
							|  |  |  | 					)}, ${getMakeDeferredNamespaceModeFromExportsType( | 
					
						
							|  |  |  | 						info.module.getExportsType(moduleGraph, strictHarmonyModule) | 
					
						
							|  |  |  | 					)});`
 | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			if (info.interopNamespaceObjectUsed) { | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 				runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); | 
					
						
							|  |  |  | 				result.add( | 
					
						
							|  |  |  | 					`\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);` | 
					
						
							|  |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (info.interopNamespaceObject2Used) { | 
					
						
							|  |  |  | 				runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); | 
					
						
							|  |  |  | 				result.add( | 
					
						
							|  |  |  | 					`\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});` | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			if (info.interopDefaultAccessUsed) { | 
					
						
							|  |  |  | 				runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); | 
					
						
							|  |  |  | 				result.add( | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 					`\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});` | 
					
						
							| 
									
										
										
										
											2020-09-15 16:07:04 +08:00
										 |  |  | 				); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			if (isConditional) { | 
					
						
							|  |  |  | 				result.add("\n}"); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-01-22 20:52:43 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 		const data = new Map(); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 		if (chunkInitFragments.length > 0) { | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 			data.set("chunkInitFragments", chunkInitFragments); | 
					
						
							| 
									
										
										
										
											2025-07-02 20:10:54 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-02-14 18:53:19 +08:00
										 |  |  | 		data.set("topLevelDeclarations", topLevelDeclarations); | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 		/** @type {CodeGenerationResult} */ | 
					
						
							|  |  |  | 		const resultEntry = { | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 			sources: new Map([["javascript", new CachedSource(result)]]), | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 			data, | 
					
						
							| 
									
										
										
										
											2019-10-09 04:29:46 +08:00
										 |  |  | 			runtimeRequirements | 
					
						
							|  |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return resultEntry; | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	/** | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 	 * @param {ModuleToInfoMap} modulesMap modulesMap | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {ModuleInfo} info info | 
					
						
							| 
									
										
										
										
											2020-09-11 15:41:54 +08:00
										 |  |  | 	 * @param {DependencyTemplates} dependencyTemplates dependencyTemplates | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {RuntimeTemplate} runtimeTemplate runtimeTemplate | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph moduleGraph | 
					
						
							|  |  |  | 	 * @param {ChunkGraph} chunkGraph chunkGraph | 
					
						
							|  |  |  | 	 * @param {RuntimeSpec} runtime runtime | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 	 * @param {CodeGenerationResults} codeGenerationResults codeGenerationResults | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 	 * @param {Set<string>} usedNames used names | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	_analyseModule( | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		modulesMap, | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 		info, | 
					
						
							| 
									
										
										
										
											2020-09-11 15:41:54 +08:00
										 |  |  | 		dependencyTemplates, | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 		runtimeTemplate, | 
					
						
							|  |  |  | 		moduleGraph, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		chunkGraph, | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 		runtime, | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 		codeGenerationResults, | 
					
						
							|  |  |  | 		usedNames | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	) { | 
					
						
							|  |  |  | 		if (info.type === "concatenated") { | 
					
						
							|  |  |  | 			const m = info.module; | 
					
						
							|  |  |  | 			try { | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | 				// Create a concatenation scope to track and capture information
 | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 				const concatenationScope = new ConcatenationScope( | 
					
						
							|  |  |  | 					modulesMap, | 
					
						
							|  |  |  | 					info, | 
					
						
							|  |  |  | 					usedNames | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				// TODO cache codeGeneration results
 | 
					
						
							|  |  |  | 				const codeGenResult = m.codeGeneration({ | 
					
						
							| 
									
										
										
										
											2020-09-11 15:41:54 +08:00
										 |  |  | 					dependencyTemplates, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					runtimeTemplate, | 
					
						
							|  |  |  | 					moduleGraph, | 
					
						
							|  |  |  | 					chunkGraph, | 
					
						
							| 
									
										
										
										
											2020-09-11 15:06:24 +08:00
										 |  |  | 					runtime, | 
					
						
							| 
									
										
										
										
											2021-12-01 21:15:19 +08:00
										 |  |  | 					concatenationScope, | 
					
						
							| 
									
										
										
										
											2022-03-17 16:44:50 +08:00
										 |  |  | 					codeGenerationResults, | 
					
						
							| 
									
										
										
										
											2024-11-01 04:19:07 +08:00
										 |  |  | 					sourceTypes: JS_TYPES | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				}); | 
					
						
							| 
									
										
										
										
											2025-04-24 23:51:17 +08:00
										 |  |  | 				const source = | 
					
						
							|  |  |  | 					/** @type {Source} */ | 
					
						
							|  |  |  | 					(codeGenResult.sources.get("javascript")); | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 				const data = codeGenResult.data; | 
					
						
							|  |  |  | 				const chunkInitFragments = data && data.get("chunkInitFragments"); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				const code = source.source().toString(); | 
					
						
							|  |  |  | 				let ast; | 
					
						
							|  |  |  | 				try { | 
					
						
							| 
									
										
										
										
											2020-08-28 07:25:34 +08:00
										 |  |  | 					ast = JavascriptParser._parse(code, { | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 						sourceType: "module" | 
					
						
							|  |  |  | 					}); | 
					
						
							| 
									
										
										
										
											2024-08-15 02:38:08 +08:00
										 |  |  | 				} catch (_err) { | 
					
						
							| 
									
										
										
										
											2025-04-26 01:43:01 +08:00
										 |  |  | 					const err = | 
					
						
							|  |  |  | 						/** @type {Error & { loc?: { line: number, column: number } }} */ | 
					
						
							|  |  |  | 						(_err); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					if ( | 
					
						
							|  |  |  | 						err.loc && | 
					
						
							|  |  |  | 						typeof err.loc === "object" && | 
					
						
							|  |  |  | 						typeof err.loc.line === "number" | 
					
						
							|  |  |  | 					) { | 
					
						
							|  |  |  | 						const lineNumber = err.loc.line; | 
					
						
							|  |  |  | 						const lines = code.split("\n"); | 
					
						
							| 
									
										
										
										
											2024-07-31 10:39:30 +08:00
										 |  |  | 						err.message += `\n| ${lines | 
					
						
							|  |  |  | 							.slice(Math.max(0, lineNumber - 3), lineNumber + 2) | 
					
						
							|  |  |  | 							.join("\n| ")}`;
 | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					} | 
					
						
							|  |  |  | 					throw err; | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				const scopeManager = eslintScope.analyze(ast, { | 
					
						
							|  |  |  | 					ecmaVersion: 6, | 
					
						
							|  |  |  | 					sourceType: "module", | 
					
						
							|  |  |  | 					optimistic: true, | 
					
						
							|  |  |  | 					ignoreEval: true, | 
					
						
							|  |  |  | 					impliedStrict: true | 
					
						
							|  |  |  | 				}); | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				const globalScope = /** @type {Scope} */ (scopeManager.acquire(ast)); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				const moduleScope = globalScope.childScopes[0]; | 
					
						
							|  |  |  | 				const resultSource = new ReplaceSource(source); | 
					
						
							| 
									
										
										
										
											2024-10-02 05:18:10 +08:00
										 |  |  | 				info.runtimeRequirements = | 
					
						
							|  |  |  | 					/** @type {ReadOnlyRuntimeRequirements} */ | 
					
						
							|  |  |  | 					(codeGenResult.runtimeRequirements); | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				info.ast = ast; | 
					
						
							|  |  |  | 				info.internalSource = source; | 
					
						
							|  |  |  | 				info.source = resultSource; | 
					
						
							| 
									
										
										
										
											2021-07-06 06:18:11 +08:00
										 |  |  | 				info.chunkInitFragments = chunkInitFragments; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 				info.globalScope = globalScope; | 
					
						
							|  |  |  | 				info.moduleScope = moduleScope; | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 				info.concatenationScope = concatenationScope; | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			} catch (err) { | 
					
						
							| 
									
										
										
										
											2024-02-22 22:20:17 +08:00
										 |  |  | 				/** @type {Error} */ | 
					
						
							| 
									
										
										
										
											2024-07-31 05:43:19 +08:00
										 |  |  | 				(err).message += | 
					
						
							|  |  |  | 					`\nwhile analyzing module ${m.identifier()} for concatenation`; | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				throw err; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {RuntimeSpec} runtime the runtime | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 	 * @returns {[ModuleInfoOrReference[], ModuleToInfoMap]} module info items | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	_getModulesWithInfo(moduleGraph, runtime) { | 
					
						
							|  |  |  | 		const orderedConcatenationList = this._createConcatenationList( | 
					
						
							|  |  |  | 			this.rootModule, | 
					
						
							|  |  |  | 			this._modules, | 
					
						
							| 
									
										
										
										
											2020-10-15 02:58:15 +08:00
										 |  |  | 			runtime, | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			moduleGraph | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2025-08-28 18:34:30 +08:00
										 |  |  | 		/** @type {ModuleToInfoMap} */ | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		const map = new Map(); | 
					
						
							|  |  |  | 		const list = orderedConcatenationList.map((info, index) => { | 
					
						
							|  |  |  | 			let item = map.get(info.module); | 
					
						
							|  |  |  | 			if (item === undefined) { | 
					
						
							|  |  |  | 				switch (info.type) { | 
					
						
							|  |  |  | 					case "concatenated": | 
					
						
							|  |  |  | 						item = { | 
					
						
							|  |  |  | 							type: "concatenated", | 
					
						
							|  |  |  | 							module: info.module, | 
					
						
							|  |  |  | 							index, | 
					
						
							|  |  |  | 							ast: undefined, | 
					
						
							|  |  |  | 							internalSource: undefined, | 
					
						
							|  |  |  | 							runtimeRequirements: undefined, | 
					
						
							|  |  |  | 							source: undefined, | 
					
						
							|  |  |  | 							globalScope: undefined, | 
					
						
							|  |  |  | 							moduleScope: undefined, | 
					
						
							|  |  |  | 							internalNames: new Map(), | 
					
						
							|  |  |  | 							exportMap: undefined, | 
					
						
							|  |  |  | 							rawExportMap: undefined, | 
					
						
							|  |  |  | 							namespaceExportSymbol: undefined, | 
					
						
							|  |  |  | 							namespaceObjectName: undefined, | 
					
						
							|  |  |  | 							interopNamespaceObjectUsed: false, | 
					
						
							|  |  |  | 							interopNamespaceObjectName: undefined, | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 							interopNamespaceObject2Used: false, | 
					
						
							|  |  |  | 							interopNamespaceObject2Name: undefined, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							interopDefaultAccessUsed: false, | 
					
						
							| 
									
										
										
										
											2025-07-25 23:22:02 +08:00
										 |  |  | 							interopDefaultAccessName: undefined, | 
					
						
							|  |  |  | 							concatenationScope: undefined | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 						}; | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					case "external": | 
					
						
							|  |  |  | 						item = { | 
					
						
							|  |  |  | 							type: "external", | 
					
						
							|  |  |  | 							module: info.module, | 
					
						
							|  |  |  | 							runtimeCondition: info.runtimeCondition, | 
					
						
							|  |  |  | 							index, | 
					
						
							|  |  |  | 							name: undefined, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 							deferredName: undefined, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							interopNamespaceObjectUsed: false, | 
					
						
							|  |  |  | 							interopNamespaceObjectName: undefined, | 
					
						
							| 
									
										
										
										
											2020-11-03 17:40:39 +08:00
										 |  |  | 							interopNamespaceObject2Used: false, | 
					
						
							|  |  |  | 							interopNamespaceObject2Name: undefined, | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 							interopDefaultAccessUsed: false, | 
					
						
							| 
									
										
										
										
											2025-07-02 20:02:03 +08:00
										 |  |  | 							interopDefaultAccessName: undefined, | 
					
						
							|  |  |  | 							deferred: moduleGraph.isDeferred(info.module), | 
					
						
							|  |  |  | 							deferredNamespaceObjectName: undefined, | 
					
						
							|  |  |  | 							deferredNamespaceObjectUsed: false | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 						}; | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					default: | 
					
						
							|  |  |  | 						throw new Error( | 
					
						
							|  |  |  | 							`Unsupported concatenation entry type ${info.type}` | 
					
						
							|  |  |  | 						); | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | 				map.set( | 
					
						
							|  |  |  | 					/** @type {ModuleInfo} */ (item).module, | 
					
						
							|  |  |  | 					/** @type {ModuleInfo} */ (item) | 
					
						
							|  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2024-08-06 11:08:48 +08:00
										 |  |  | 				return /** @type {ModuleInfo} */ (item); | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-07-31 04:21:27 +08:00
										 |  |  | 			/** @type {ReferenceToModuleInfo} */ | 
					
						
							|  |  |  | 			const ref = { | 
					
						
							|  |  |  | 				type: "reference", | 
					
						
							|  |  |  | 				runtimeCondition: info.runtimeCondition, | 
					
						
							|  |  |  | 				target: item | 
					
						
							|  |  |  | 			}; | 
					
						
							|  |  |  | 			return ref; | 
					
						
							| 
									
										
										
										
											2020-09-11 17:32:07 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 		return [list, map]; | 
					
						
							| 
									
										
										
										
											2018-11-15 00:31:32 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-21 00:17:51 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Hash} hash the hash used to track dependencies | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	 * @param {UpdateHashContext} context context | 
					
						
							| 
									
										
										
										
											2018-07-21 00:17:51 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 	updateHash(hash, context) { | 
					
						
							|  |  |  | 		const { chunkGraph, runtime } = context; | 
					
						
							|  |  |  | 		for (const info of this._createConcatenationList( | 
					
						
							|  |  |  | 			this.rootModule, | 
					
						
							|  |  |  | 			this._modules, | 
					
						
							| 
									
										
										
										
											2020-10-27 18:18:20 +08:00
										 |  |  | 			intersectRuntime(runtime, this._runtime), | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 			chunkGraph.moduleGraph | 
					
						
							|  |  |  | 		)) { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 			switch (info.type) { | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 				case "concatenated": | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 					info.module.updateHash(hash, context); | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 					break; | 
					
						
							|  |  |  | 				case "external": | 
					
						
							| 
									
										
										
										
											2018-08-28 17:56:48 +08:00
										 |  |  | 					hash.update(`${chunkGraph.getModuleId(info.module)}`); | 
					
						
							| 
									
										
										
										
											2020-10-30 00:53:56 +08:00
										 |  |  | 					// TODO runtimeCondition
 | 
					
						
							| 
									
										
										
										
											2017-08-07 17:53:07 +08:00
										 |  |  | 					break; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-07-07 17:48:52 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-07-28 00:09:48 +08:00
										 |  |  | 		super.updateHash(hash, context); | 
					
						
							| 
									
										
										
										
											2017-07-07 17:48:52 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-18 23:28:40 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectDeserializerContext} context context | 
					
						
							|  |  |  | 	 * @returns {ConcatenatedModule} ConcatenatedModule | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 	static deserialize(context) { | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		const obj = new ConcatenatedModule({ | 
					
						
							| 
									
										
										
										
											2024-10-24 11:02:20 +08:00
										 |  |  | 			identifier: /** @type {EXPECTED_ANY} */ (undefined), | 
					
						
							|  |  |  | 			rootModule: /** @type {EXPECTED_ANY} */ (undefined), | 
					
						
							|  |  |  | 			modules: /** @type {EXPECTED_ANY} */ (undefined), | 
					
						
							| 
									
										
										
										
											2024-04-02 16:26:56 +08:00
										 |  |  | 			runtime: undefined, | 
					
						
							| 
									
										
										
										
											2024-10-24 11:02:20 +08:00
										 |  |  | 			compilation: /** @type {EXPECTED_ANY} */ (undefined) | 
					
						
							| 
									
										
										
										
											2019-12-17 01:44:33 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | 		obj.deserialize(context); | 
					
						
							|  |  |  | 		return obj; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-11 05:58:26 +08:00
										 |  |  | makeSerializable(ConcatenatedModule, "webpack/lib/optimize/ConcatenatedModule"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 19:15:14 +08:00
										 |  |  | module.exports = ConcatenatedModule; |