webpack 5.93.0 → 5.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/README.md +8 -5
  2. package/bin/webpack.js +6 -7
  3. package/hot/log.js +1 -2
  4. package/hot/only-dev-server.js +1 -1
  5. package/hot/poll.js +1 -1
  6. package/hot/signal.js +1 -1
  7. package/lib/APIPlugin.js +4 -3
  8. package/lib/AbstractMethodError.js +10 -5
  9. package/lib/AutomaticPrefetchPlugin.js +1 -1
  10. package/lib/BannerPlugin.js +12 -6
  11. package/lib/Cache.js +8 -10
  12. package/lib/CacheFacade.js +3 -3
  13. package/lib/CaseSensitiveModulesWarning.js +5 -7
  14. package/lib/Chunk.js +14 -11
  15. package/lib/ChunkGraph.js +58 -36
  16. package/lib/ChunkGroup.js +2 -3
  17. package/lib/ChunkTemplate.js +43 -0
  18. package/lib/CleanPlugin.js +10 -11
  19. package/lib/CodeGenerationResults.js +6 -5
  20. package/lib/CommentCompilationWarning.js +0 -1
  21. package/lib/Compilation.js +223 -191
  22. package/lib/Compiler.js +81 -82
  23. package/lib/ConcatenationScope.js +3 -6
  24. package/lib/ConditionalInitFragment.js +6 -7
  25. package/lib/ConstPlugin.js +7 -15
  26. package/lib/ContextExclusionPlugin.js +3 -3
  27. package/lib/ContextModule.js +33 -20
  28. package/lib/ContextModuleFactory.js +89 -44
  29. package/lib/ContextReplacementPlugin.js +10 -9
  30. package/lib/DefinePlugin.js +75 -68
  31. package/lib/DelegatedModule.js +7 -3
  32. package/lib/DelegatedModuleFactoryPlugin.js +36 -22
  33. package/lib/DelegatedPlugin.js +4 -0
  34. package/lib/DependenciesBlock.js +0 -1
  35. package/lib/Dependency.js +10 -14
  36. package/lib/DllEntryPlugin.js +4 -2
  37. package/lib/DllModuleFactory.js +1 -0
  38. package/lib/DllPlugin.js +9 -7
  39. package/lib/DllReferencePlugin.js +30 -15
  40. package/lib/EntryPlugin.js +1 -3
  41. package/lib/EnvironmentPlugin.js +6 -2
  42. package/lib/ErrorHelpers.js +11 -12
  43. package/lib/EvalDevToolModulePlugin.js +10 -12
  44. package/lib/EvalSourceMapDevToolPlugin.js +15 -13
  45. package/lib/ExportsInfo.js +185 -120
  46. package/lib/ExternalModule.js +41 -15
  47. package/lib/ExternalModuleFactoryPlugin.js +23 -10
  48. package/lib/FileSystemInfo.js +791 -422
  49. package/lib/FlagAllModulesAsUsedPlugin.js +1 -1
  50. package/lib/FlagDependencyExportsPlugin.js +12 -11
  51. package/lib/FlagDependencyUsagePlugin.js +1 -1
  52. package/lib/Generator.js +2 -5
  53. package/lib/GraphHelpers.js +3 -2
  54. package/lib/HookWebpackError.js +8 -10
  55. package/lib/HotModuleReplacementPlugin.js +78 -64
  56. package/lib/IgnoreErrorModuleFactory.js +3 -3
  57. package/lib/IgnorePlugin.js +1 -3
  58. package/lib/IgnoreWarningsPlugin.js +6 -9
  59. package/lib/InitFragment.js +2 -3
  60. package/lib/LibManifestPlugin.js +4 -3
  61. package/lib/MainTemplate.js +72 -19
  62. package/lib/Module.js +25 -9
  63. package/lib/ModuleBuildError.js +4 -11
  64. package/lib/ModuleDependencyError.js +5 -5
  65. package/lib/ModuleDependencyWarning.js +5 -5
  66. package/lib/ModuleError.js +1 -5
  67. package/lib/ModuleFilenameHelpers.js +29 -46
  68. package/lib/ModuleGraph.js +7 -6
  69. package/lib/ModuleGraphConnection.js +6 -6
  70. package/lib/ModuleInfoHeaderPlugin.js +82 -30
  71. package/lib/ModuleParseError.js +8 -9
  72. package/lib/ModuleRestoreError.js +1 -1
  73. package/lib/ModuleStoreError.js +1 -1
  74. package/lib/ModuleTemplate.js +33 -1
  75. package/lib/ModuleTypeConstants.js +21 -22
  76. package/lib/ModuleWarning.js +1 -5
  77. package/lib/MultiCompiler.js +24 -26
  78. package/lib/MultiStats.js +73 -31
  79. package/lib/MultiWatching.js +1 -1
  80. package/lib/NormalModule.js +130 -69
  81. package/lib/NormalModuleFactory.js +53 -49
  82. package/lib/OptimizationStages.js +3 -3
  83. package/lib/ProgressPlugin.js +9 -9
  84. package/lib/ProvidePlugin.js +4 -4
  85. package/lib/RuntimeGlobals.js +71 -70
  86. package/lib/RuntimeModule.js +1 -1
  87. package/lib/RuntimePlugin.js +24 -12
  88. package/lib/RuntimeTemplate.js +40 -44
  89. package/lib/SizeFormatHelpers.js +2 -4
  90. package/lib/SourceMapDevToolPlugin.js +42 -34
  91. package/lib/Stats.js +5 -11
  92. package/lib/Template.js +18 -24
  93. package/lib/TemplatedPathPlugin.js +21 -13
  94. package/lib/WarnDeprecatedOptionPlugin.js +0 -1
  95. package/lib/WatchIgnorePlugin.js +26 -9
  96. package/lib/Watching.js +10 -5
  97. package/lib/WebpackOptionsApply.js +84 -62
  98. package/lib/asset/AssetGenerator.js +107 -42
  99. package/lib/asset/AssetModulesPlugin.js +29 -23
  100. package/lib/asset/AssetSourceGenerator.js +2 -7
  101. package/lib/async-modules/AwaitDependenciesInitFragment.js +6 -7
  102. package/lib/buildChunkGraph.js +93 -81
  103. package/lib/cache/IdleFileCachePlugin.js +4 -4
  104. package/lib/cache/MemoryWithGcCachePlugin.js +5 -5
  105. package/lib/cache/PackFileCacheStrategy.js +51 -50
  106. package/lib/cache/ResolverCachePlugin.js +6 -6
  107. package/lib/cache/mergeEtags.js +16 -21
  108. package/lib/cli.js +148 -104
  109. package/lib/config/browserslistTargetHandler.js +16 -13
  110. package/lib/config/defaults.js +32 -28
  111. package/lib/config/normalization.js +335 -344
  112. package/lib/config/target.js +42 -52
  113. package/lib/container/ContainerEntryModule.js +2 -2
  114. package/lib/container/ContainerPlugin.js +1 -1
  115. package/lib/container/RemoteRuntimeModule.js +11 -8
  116. package/lib/container/options.js +18 -4
  117. package/lib/css/CssExportsGenerator.js +26 -24
  118. package/lib/css/CssGenerator.js +9 -4
  119. package/lib/css/CssLoadingRuntimeModule.js +10 -10
  120. package/lib/css/CssModulesPlugin.js +127 -47
  121. package/lib/css/CssParser.js +20 -18
  122. package/lib/css/walkCssTokens.js +80 -95
  123. package/lib/debug/ProfilingPlugin.js +19 -20
  124. package/lib/dependencies/AMDDefineDependency.js +1 -1
  125. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +83 -47
  126. package/lib/dependencies/AMDRequireArrayDependency.js +9 -10
  127. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +22 -16
  128. package/lib/dependencies/AMDRuntimeModules.js +2 -2
  129. package/lib/dependencies/CommonJsDependencyHelpers.js +6 -2
  130. package/lib/dependencies/CommonJsExportRequireDependency.js +37 -41
  131. package/lib/dependencies/CommonJsExportsDependency.js +0 -1
  132. package/lib/dependencies/CommonJsExportsParserPlugin.js +19 -23
  133. package/lib/dependencies/CommonJsFullRequireDependency.js +1 -1
  134. package/lib/dependencies/CommonJsImportsParserPlugin.js +52 -61
  135. package/lib/dependencies/CommonJsSelfReferenceDependency.js +6 -8
  136. package/lib/dependencies/ConstDependency.js +1 -1
  137. package/lib/dependencies/ContextDependency.js +7 -2
  138. package/lib/dependencies/ContextDependencyHelpers.js +31 -34
  139. package/lib/dependencies/ContextElementDependency.js +35 -8
  140. package/lib/dependencies/CriticalDependencyWarning.js +1 -1
  141. package/lib/dependencies/CssExportDependency.js +7 -7
  142. package/lib/dependencies/CssImportDependency.js +0 -2
  143. package/lib/dependencies/CssLocalIdentifierDependency.js +3 -3
  144. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
  145. package/lib/dependencies/CssUrlDependency.js +4 -5
  146. package/lib/dependencies/DynamicExports.js +5 -5
  147. package/lib/dependencies/ExportsInfoDependency.js +1 -2
  148. package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -1
  149. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -5
  150. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +27 -16
  151. package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
  152. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +107 -64
  153. package/lib/dependencies/HarmonyExports.js +2 -2
  154. package/lib/dependencies/HarmonyImportDependency.js +2 -4
  155. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -4
  156. package/lib/dependencies/HarmonyImportSpecifierDependency.js +40 -15
  157. package/lib/dependencies/ImportDependency.js +1 -1
  158. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +5 -5
  159. package/lib/dependencies/ImportMetaPlugin.js +11 -13
  160. package/lib/dependencies/ImportParserPlugin.js +39 -44
  161. package/lib/dependencies/JsonExportsDependency.js +22 -18
  162. package/lib/dependencies/LoaderPlugin.js +47 -36
  163. package/lib/dependencies/LocalModule.js +1 -1
  164. package/lib/dependencies/LocalModulesHelpers.js +4 -4
  165. package/lib/dependencies/ModuleDecoratorDependency.js +1 -1
  166. package/lib/dependencies/ProvidedDependency.js +1 -1
  167. package/lib/dependencies/PureExpressionDependency.js +6 -6
  168. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  169. package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
  170. package/lib/dependencies/SystemPlugin.js +1 -1
  171. package/lib/dependencies/URLDependency.js +3 -3
  172. package/lib/dependencies/URLPlugin.js +66 -12
  173. package/lib/dependencies/WorkerPlugin.js +25 -24
  174. package/lib/dependencies/processExportInfo.js +3 -1
  175. package/lib/electron/ElectronTargetPlugin.js +1 -0
  176. package/lib/esm/ModuleChunkFormatPlugin.js +3 -3
  177. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -3
  178. package/lib/formatLocation.js +1 -2
  179. package/lib/hmr/HotModuleReplacement.runtime.js +4 -5
  180. package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
  181. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +9 -12
  182. package/lib/hmr/LazyCompilationPlugin.js +27 -12
  183. package/lib/hmr/lazyCompilationBackend.js +64 -40
  184. package/lib/ids/ChunkModuleIdRangePlugin.js +1 -3
  185. package/lib/ids/DeterministicChunkIdsPlugin.js +2 -4
  186. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  187. package/lib/ids/HashedModuleIdsPlugin.js +5 -1
  188. package/lib/ids/IdHelpers.js +29 -39
  189. package/lib/ids/SyncModuleIdsPlugin.js +7 -2
  190. package/lib/index.js +1 -5
  191. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +5 -4
  192. package/lib/javascript/BasicEvaluatedExpression.js +4 -19
  193. package/lib/javascript/ChunkHelpers.js +1 -1
  194. package/lib/javascript/CommonJsChunkFormatPlugin.js +3 -2
  195. package/lib/javascript/EnableChunkLoadingPlugin.js +7 -6
  196. package/lib/javascript/JavascriptGenerator.js +23 -7
  197. package/lib/javascript/JavascriptModulesPlugin.js +133 -86
  198. package/lib/javascript/JavascriptParser.js +179 -200
  199. package/lib/javascript/JavascriptParserHelpers.js +20 -21
  200. package/lib/javascript/StartupHelpers.js +41 -13
  201. package/lib/json/JsonGenerator.js +7 -13
  202. package/lib/json/JsonModulesPlugin.js +1 -4
  203. package/lib/json/JsonParser.js +5 -3
  204. package/lib/library/AmdLibraryPlugin.js +12 -16
  205. package/lib/library/AssignLibraryPlugin.js +8 -10
  206. package/lib/library/EnableLibraryPlugin.js +15 -14
  207. package/lib/library/JsonpLibraryPlugin.js +2 -1
  208. package/lib/library/ModernModuleLibraryPlugin.js +8 -6
  209. package/lib/library/ModuleLibraryPlugin.js +2 -1
  210. package/lib/library/SystemLibraryPlugin.js +2 -1
  211. package/lib/library/UmdLibraryPlugin.js +66 -92
  212. package/lib/logging/Logger.js +32 -4
  213. package/lib/logging/createConsoleLogger.js +12 -13
  214. package/lib/logging/runtime.js +7 -8
  215. package/lib/logging/truncateArgs.js +5 -8
  216. package/lib/node/NodeWatchFileSystem.js +3 -18
  217. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
  218. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
  219. package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -2
  220. package/lib/node/nodeConsole.js +22 -22
  221. package/lib/optimize/AggressiveMergingPlugin.js +2 -4
  222. package/lib/optimize/AggressiveSplittingPlugin.js +16 -19
  223. package/lib/optimize/ConcatenatedModule.js +81 -51
  224. package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
  225. package/lib/optimize/FlagIncludedChunksPlugin.js +3 -3
  226. package/lib/optimize/InnerGraph.js +17 -17
  227. package/lib/optimize/InnerGraphPlugin.js +8 -7
  228. package/lib/optimize/LimitChunkCountPlugin.js +2 -3
  229. package/lib/optimize/MangleExportsPlugin.js +1 -0
  230. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
  231. package/lib/optimize/MinMaxSizeWarning.js +1 -1
  232. package/lib/optimize/ModuleConcatenationPlugin.js +54 -78
  233. package/lib/optimize/RealContentHashPlugin.js +7 -10
  234. package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
  235. package/lib/optimize/SideEffectsFlagPlugin.js +6 -2
  236. package/lib/optimize/SplitChunksPlugin.js +34 -30
  237. package/lib/performance/SizeLimitsPlugin.js +2 -2
  238. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -1
  239. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -1
  240. package/lib/rules/BasicEffectRulePlugin.js +3 -1
  241. package/lib/rules/BasicMatcherRulePlugin.js +3 -1
  242. package/lib/rules/ObjectMatcherRulePlugin.js +4 -1
  243. package/lib/rules/RuleSetCompiler.js +41 -22
  244. package/lib/rules/UseEffectRulePlugin.js +36 -32
  245. package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
  246. package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
  247. package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +2 -2
  248. package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -1
  249. package/lib/runtime/EnsureChunkRuntimeModule.js +10 -11
  250. package/lib/runtime/GetChunkFilenameRuntimeModule.js +11 -17
  251. package/lib/runtime/LoadScriptRuntimeModule.js +17 -18
  252. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -3
  253. package/lib/schemes/DataUriPlugin.js +1 -1
  254. package/lib/schemes/HttpUriPlugin.js +241 -126
  255. package/lib/serialization/BinaryMiddleware.js +44 -28
  256. package/lib/serialization/DateObjectSerializer.js +1 -0
  257. package/lib/serialization/ErrorObjectSerializer.js +2 -0
  258. package/lib/serialization/FileMiddleware.js +154 -106
  259. package/lib/serialization/MapObjectSerializer.js +2 -1
  260. package/lib/serialization/NullPrototypeObjectSerializer.js +3 -2
  261. package/lib/serialization/ObjectMiddleware.js +52 -56
  262. package/lib/serialization/PlainObjectSerializer.js +32 -6
  263. package/lib/serialization/RegExpObjectSerializer.js +1 -0
  264. package/lib/serialization/Serializer.js +4 -5
  265. package/lib/serialization/SerializerMiddleware.js +6 -6
  266. package/lib/serialization/SetObjectSerializer.js +2 -1
  267. package/lib/sharing/ConsumeSharedPlugin.js +116 -97
  268. package/lib/sharing/ConsumeSharedRuntimeModule.js +4 -4
  269. package/lib/sharing/ProvideForSharedDependency.js +0 -1
  270. package/lib/sharing/ProvideSharedPlugin.js +2 -2
  271. package/lib/sharing/resolveMatchedConfigs.js +2 -1
  272. package/lib/sharing/utils.js +15 -27
  273. package/lib/stats/DefaultStatsFactoryPlugin.js +424 -281
  274. package/lib/stats/DefaultStatsPresetPlugin.js +73 -18
  275. package/lib/stats/DefaultStatsPrinterPlugin.js +370 -101
  276. package/lib/stats/StatsFactory.js +127 -56
  277. package/lib/stats/StatsPrinter.js +75 -44
  278. package/lib/util/ArrayHelpers.js +8 -4
  279. package/lib/util/ArrayQueue.js +1 -1
  280. package/lib/util/AsyncQueue.js +31 -12
  281. package/lib/util/IterableHelpers.js +3 -4
  282. package/lib/util/LazyBucketSortedSet.js +60 -44
  283. package/lib/util/LazySet.js +13 -0
  284. package/lib/util/MapHelpers.js +1 -3
  285. package/lib/util/ParallelismFactorCalculator.js +1 -1
  286. package/lib/util/Queue.js +1 -1
  287. package/lib/util/Semaphore.js +4 -7
  288. package/lib/util/SetHelpers.js +5 -5
  289. package/lib/util/SortableSet.js +4 -3
  290. package/lib/util/StackedCacheMap.js +4 -6
  291. package/lib/util/StackedMap.js +1 -3
  292. package/lib/util/StringXor.js +0 -5
  293. package/lib/util/TupleQueue.js +1 -1
  294. package/lib/util/TupleSet.js +15 -5
  295. package/lib/util/URLAbsoluteSpecifier.js +7 -7
  296. package/lib/util/WeakTupleMap.js +19 -21
  297. package/lib/util/binarySearchBounds.js +5 -12
  298. package/lib/util/chainedImports.js +1 -1
  299. package/lib/util/cleverMerge.js +21 -19
  300. package/lib/util/comparators.js +57 -52
  301. package/lib/util/compileBooleanMatcher.js +3 -6
  302. package/lib/util/conventions.js +8 -11
  303. package/lib/util/createHash.js +9 -6
  304. package/lib/util/deprecation.js +22 -12
  305. package/lib/util/deterministicGrouping.js +19 -26
  306. package/lib/util/findGraphRoots.js +2 -2
  307. package/lib/util/fs.js +32 -32
  308. package/lib/util/hash/md4.js +2 -2
  309. package/lib/util/hash/wasm-hash.js +7 -7
  310. package/lib/util/hash/xxhash64.js +2 -2
  311. package/lib/util/identifier.js +81 -59
  312. package/lib/util/memoize.js +8 -10
  313. package/lib/util/mergeScope.js +6 -9
  314. package/lib/util/nonNumericOnlyHash.js +2 -2
  315. package/lib/util/numberHash.js +1 -6
  316. package/lib/util/objectToMap.js +0 -1
  317. package/lib/util/propertyAccess.js +2 -5
  318. package/lib/util/propertyName.js +1 -3
  319. package/lib/util/registerExternalSerializer.js +1 -1
  320. package/lib/util/runtime.js +109 -113
  321. package/lib/util/semver.js +29 -27
  322. package/lib/util/serialization.js +16 -1
  323. package/lib/util/smartGrouping.js +5 -5
  324. package/lib/util/source.js +1 -1
  325. package/lib/wasm/EnableWasmLoadingPlugin.js +5 -4
  326. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
  327. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -6
  328. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
  329. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +20 -19
  330. package/lib/wasm-sync/WebAssemblyGenerator.js +14 -29
  331. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
  332. package/lib/wasm-sync/WebAssemblyUtils.js +2 -2
  333. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -3
  334. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -1
  335. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  336. package/package.json +18 -17
  337. package/schemas/WebpackOptions.check.js +1 -1
  338. package/schemas/WebpackOptions.json +5 -0
  339. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  340. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  341. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  342. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  343. package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
  344. package/types.d.ts +681 -355
@@ -8,157 +8,158 @@
8
8
  /**
9
9
  * the internal require function
10
10
  */
11
- exports.require = "__webpack_require__";
11
+ module.exports.require = "__webpack_require__";
12
12
 
13
13
  /**
14
14
  * access to properties of the internal require function/object
15
15
  */
16
- exports.requireScope = "__webpack_require__.*";
16
+ module.exports.requireScope = "__webpack_require__.*";
17
17
 
18
18
  /**
19
19
  * the internal exports object
20
20
  */
21
- exports.exports = "__webpack_exports__";
21
+ module.exports.exports = "__webpack_exports__";
22
22
 
23
23
  /**
24
24
  * top-level this need to be the exports object
25
25
  */
26
- exports.thisAsExports = "top-level-this-exports";
26
+ module.exports.thisAsExports = "top-level-this-exports";
27
27
 
28
28
  /**
29
29
  * runtime need to return the exports of the last entry module
30
30
  */
31
- exports.returnExportsFromRuntime = "return-exports-from-runtime";
31
+ module.exports.returnExportsFromRuntime = "return-exports-from-runtime";
32
32
 
33
33
  /**
34
34
  * the internal module object
35
35
  */
36
- exports.module = "module";
36
+ module.exports.module = "module";
37
37
 
38
38
  /**
39
39
  * the internal module object
40
40
  */
41
- exports.moduleId = "module.id";
41
+ module.exports.moduleId = "module.id";
42
42
 
43
43
  /**
44
44
  * the internal module object
45
45
  */
46
- exports.moduleLoaded = "module.loaded";
46
+ module.exports.moduleLoaded = "module.loaded";
47
47
 
48
48
  /**
49
49
  * the bundle public path
50
50
  */
51
- exports.publicPath = "__webpack_require__.p";
51
+ module.exports.publicPath = "__webpack_require__.p";
52
52
 
53
53
  /**
54
54
  * the module id of the entry point
55
55
  */
56
- exports.entryModuleId = "__webpack_require__.s";
56
+ module.exports.entryModuleId = "__webpack_require__.s";
57
57
 
58
58
  /**
59
59
  * the module cache
60
60
  */
61
- exports.moduleCache = "__webpack_require__.c";
61
+ module.exports.moduleCache = "__webpack_require__.c";
62
62
 
63
63
  /**
64
64
  * the module functions
65
65
  */
66
- exports.moduleFactories = "__webpack_require__.m";
66
+ module.exports.moduleFactories = "__webpack_require__.m";
67
67
 
68
68
  /**
69
69
  * the module functions, with only write access
70
70
  */
71
- exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)";
71
+ module.exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)";
72
72
 
73
73
  /**
74
74
  * the chunk ensure function
75
75
  */
76
- exports.ensureChunk = "__webpack_require__.e";
76
+ module.exports.ensureChunk = "__webpack_require__.e";
77
77
 
78
78
  /**
79
79
  * an object with handlers to ensure a chunk
80
80
  */
81
- exports.ensureChunkHandlers = "__webpack_require__.f";
81
+ module.exports.ensureChunkHandlers = "__webpack_require__.f";
82
82
 
83
83
  /**
84
84
  * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries
85
85
  */
86
- exports.ensureChunkIncludeEntries = "__webpack_require__.f (include entries)";
86
+ module.exports.ensureChunkIncludeEntries =
87
+ "__webpack_require__.f (include entries)";
87
88
 
88
89
  /**
89
90
  * the chunk prefetch function
90
91
  */
91
- exports.prefetchChunk = "__webpack_require__.E";
92
+ module.exports.prefetchChunk = "__webpack_require__.E";
92
93
 
93
94
  /**
94
95
  * an object with handlers to prefetch a chunk
95
96
  */
96
- exports.prefetchChunkHandlers = "__webpack_require__.F";
97
+ module.exports.prefetchChunkHandlers = "__webpack_require__.F";
97
98
 
98
99
  /**
99
100
  * the chunk preload function
100
101
  */
101
- exports.preloadChunk = "__webpack_require__.G";
102
+ module.exports.preloadChunk = "__webpack_require__.G";
102
103
 
103
104
  /**
104
105
  * an object with handlers to preload a chunk
105
106
  */
106
- exports.preloadChunkHandlers = "__webpack_require__.H";
107
+ module.exports.preloadChunkHandlers = "__webpack_require__.H";
107
108
 
108
109
  /**
109
110
  * the exported property define getters function
110
111
  */
111
- exports.definePropertyGetters = "__webpack_require__.d";
112
+ module.exports.definePropertyGetters = "__webpack_require__.d";
112
113
 
113
114
  /**
114
115
  * define compatibility on export
115
116
  */
116
- exports.makeNamespaceObject = "__webpack_require__.r";
117
+ module.exports.makeNamespaceObject = "__webpack_require__.r";
117
118
 
118
119
  /**
119
120
  * create a fake namespace object
120
121
  */
121
- exports.createFakeNamespaceObject = "__webpack_require__.t";
122
+ module.exports.createFakeNamespaceObject = "__webpack_require__.t";
122
123
 
123
124
  /**
124
125
  * compatibility get default export
125
126
  */
126
- exports.compatGetDefaultExport = "__webpack_require__.n";
127
+ module.exports.compatGetDefaultExport = "__webpack_require__.n";
127
128
 
128
129
  /**
129
130
  * harmony module decorator
130
131
  */
131
- exports.harmonyModuleDecorator = "__webpack_require__.hmd";
132
+ module.exports.harmonyModuleDecorator = "__webpack_require__.hmd";
132
133
 
133
134
  /**
134
135
  * node.js module decorator
135
136
  */
136
- exports.nodeModuleDecorator = "__webpack_require__.nmd";
137
+ module.exports.nodeModuleDecorator = "__webpack_require__.nmd";
137
138
 
138
139
  /**
139
140
  * the webpack hash
140
141
  */
141
- exports.getFullHash = "__webpack_require__.h";
142
+ module.exports.getFullHash = "__webpack_require__.h";
142
143
 
143
144
  /**
144
145
  * an object containing all installed WebAssembly.Instance export objects keyed by module id
145
146
  */
146
- exports.wasmInstances = "__webpack_require__.w";
147
+ module.exports.wasmInstances = "__webpack_require__.w";
147
148
 
148
149
  /**
149
150
  * instantiate a wasm instance from module exports object, id, hash and importsObject
150
151
  */
151
- exports.instantiateWasm = "__webpack_require__.v";
152
+ module.exports.instantiateWasm = "__webpack_require__.v";
152
153
 
153
154
  /**
154
155
  * the uncaught error handler for the webpack runtime
155
156
  */
156
- exports.uncaughtErrorHandler = "__webpack_require__.oe";
157
+ module.exports.uncaughtErrorHandler = "__webpack_require__.oe";
157
158
 
158
159
  /**
159
160
  * the script nonce
160
161
  */
161
- exports.scriptNonce = "__webpack_require__.nc";
162
+ module.exports.scriptNonce = "__webpack_require__.nc";
162
163
 
163
164
  /**
164
165
  * function to load a script tag.
@@ -166,101 +167,101 @@ exports.scriptNonce = "__webpack_require__.nc";
166
167
  * done function is called when loading has finished or timeout occurred.
167
168
  * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url.
168
169
  */
169
- exports.loadScript = "__webpack_require__.l";
170
+ module.exports.loadScript = "__webpack_require__.l";
170
171
 
171
172
  /**
172
173
  * function to promote a string to a TrustedScript using webpack's Trusted
173
174
  * Types policy
174
175
  * Arguments: (script: string) => TrustedScript
175
176
  */
176
- exports.createScript = "__webpack_require__.ts";
177
+ module.exports.createScript = "__webpack_require__.ts";
177
178
 
178
179
  /**
179
180
  * function to promote a string to a TrustedScriptURL using webpack's Trusted
180
181
  * Types policy
181
182
  * Arguments: (url: string) => TrustedScriptURL
182
183
  */
183
- exports.createScriptUrl = "__webpack_require__.tu";
184
+ module.exports.createScriptUrl = "__webpack_require__.tu";
184
185
 
185
186
  /**
186
187
  * function to return webpack's Trusted Types policy
187
188
  * Arguments: () => TrustedTypePolicy
188
189
  */
189
- exports.getTrustedTypesPolicy = "__webpack_require__.tt";
190
+ module.exports.getTrustedTypesPolicy = "__webpack_require__.tt";
190
191
 
191
192
  /**
192
193
  * a flag when a chunk has a fetch priority
193
194
  */
194
- exports.hasFetchPriority = "has fetch priority";
195
+ module.exports.hasFetchPriority = "has fetch priority";
195
196
 
196
197
  /**
197
198
  * the chunk name of the chunk with the runtime
198
199
  */
199
- exports.chunkName = "__webpack_require__.cn";
200
+ module.exports.chunkName = "__webpack_require__.cn";
200
201
 
201
202
  /**
202
203
  * the runtime id of the current runtime
203
204
  */
204
- exports.runtimeId = "__webpack_require__.j";
205
+ module.exports.runtimeId = "__webpack_require__.j";
205
206
 
206
207
  /**
207
208
  * the filename of the script part of the chunk
208
209
  */
209
- exports.getChunkScriptFilename = "__webpack_require__.u";
210
+ module.exports.getChunkScriptFilename = "__webpack_require__.u";
210
211
 
211
212
  /**
212
213
  * the filename of the css part of the chunk
213
214
  */
214
- exports.getChunkCssFilename = "__webpack_require__.k";
215
+ module.exports.getChunkCssFilename = "__webpack_require__.k";
215
216
 
216
217
  /**
217
218
  * a flag when a module/chunk/tree has css modules
218
219
  */
219
- exports.hasCssModules = "has css modules";
220
+ module.exports.hasCssModules = "has css modules";
220
221
 
221
222
  /**
222
223
  * the filename of the script part of the hot update chunk
223
224
  */
224
- exports.getChunkUpdateScriptFilename = "__webpack_require__.hu";
225
+ module.exports.getChunkUpdateScriptFilename = "__webpack_require__.hu";
225
226
 
226
227
  /**
227
228
  * the filename of the css part of the hot update chunk
228
229
  */
229
- exports.getChunkUpdateCssFilename = "__webpack_require__.hk";
230
+ module.exports.getChunkUpdateCssFilename = "__webpack_require__.hk";
230
231
 
231
232
  /**
232
233
  * startup signal from runtime
233
234
  * This will be called when the runtime chunk has been loaded.
234
235
  */
235
- exports.startup = "__webpack_require__.x";
236
+ module.exports.startup = "__webpack_require__.x";
236
237
 
237
238
  /**
238
239
  * @deprecated
239
240
  * creating a default startup function with the entry modules
240
241
  */
241
- exports.startupNoDefault = "__webpack_require__.x (no default handler)";
242
+ module.exports.startupNoDefault = "__webpack_require__.x (no default handler)";
242
243
 
243
244
  /**
244
245
  * startup signal from runtime but only used to add logic after the startup
245
246
  */
246
- exports.startupOnlyAfter = "__webpack_require__.x (only after)";
247
+ module.exports.startupOnlyAfter = "__webpack_require__.x (only after)";
247
248
 
248
249
  /**
249
250
  * startup signal from runtime but only used to add sync logic before the startup
250
251
  */
251
- exports.startupOnlyBefore = "__webpack_require__.x (only before)";
252
+ module.exports.startupOnlyBefore = "__webpack_require__.x (only before)";
252
253
 
253
254
  /**
254
255
  * global callback functions for installing chunks
255
256
  */
256
- exports.chunkCallback = "webpackChunk";
257
+ module.exports.chunkCallback = "webpackChunk";
257
258
 
258
259
  /**
259
260
  * method to startup an entrypoint with needed chunks.
260
261
  * Signature: (moduleId: Id, chunkIds: Id[]) => any.
261
262
  * Returns the exports of the module or a Promise
262
263
  */
263
- exports.startupEntrypoint = "__webpack_require__.X";
264
+ module.exports.startupEntrypoint = "__webpack_require__.X";
264
265
 
265
266
  /**
266
267
  * register deferred code, which will run when certain
@@ -270,106 +271,106 @@ exports.startupEntrypoint = "__webpack_require__.X";
270
271
  * When (priority & 1) it will wait for all other handlers with lower priority to
271
272
  * be executed before itself is executed
272
273
  */
273
- exports.onChunksLoaded = "__webpack_require__.O";
274
+ module.exports.onChunksLoaded = "__webpack_require__.O";
274
275
 
275
276
  /**
276
277
  * method to install a chunk that was loaded somehow
277
278
  * Signature: ({ id, ids, modules, runtime }) => void
278
279
  */
279
- exports.externalInstallChunk = "__webpack_require__.C";
280
+ module.exports.externalInstallChunk = "__webpack_require__.C";
280
281
 
281
282
  /**
282
283
  * interceptor for module executions
283
284
  */
284
- exports.interceptModuleExecution = "__webpack_require__.i";
285
+ module.exports.interceptModuleExecution = "__webpack_require__.i";
285
286
 
286
287
  /**
287
288
  * the global object
288
289
  */
289
- exports.global = "__webpack_require__.g";
290
+ module.exports.global = "__webpack_require__.g";
290
291
 
291
292
  /**
292
293
  * an object with all share scopes
293
294
  */
294
- exports.shareScopeMap = "__webpack_require__.S";
295
+ module.exports.shareScopeMap = "__webpack_require__.S";
295
296
 
296
297
  /**
297
298
  * The sharing init sequence function (only runs once per share scope).
298
299
  * Has one argument, the name of the share scope.
299
300
  * Creates a share scope if not existing
300
301
  */
301
- exports.initializeSharing = "__webpack_require__.I";
302
+ module.exports.initializeSharing = "__webpack_require__.I";
302
303
 
303
304
  /**
304
305
  * The current scope when getting a module from a remote
305
306
  */
306
- exports.currentRemoteGetScope = "__webpack_require__.R";
307
+ module.exports.currentRemoteGetScope = "__webpack_require__.R";
307
308
 
308
309
  /**
309
310
  * the filename of the HMR manifest
310
311
  */
311
- exports.getUpdateManifestFilename = "__webpack_require__.hmrF";
312
+ module.exports.getUpdateManifestFilename = "__webpack_require__.hmrF";
312
313
 
313
314
  /**
314
315
  * function downloading the update manifest
315
316
  */
316
- exports.hmrDownloadManifest = "__webpack_require__.hmrM";
317
+ module.exports.hmrDownloadManifest = "__webpack_require__.hmrM";
317
318
 
318
319
  /**
319
320
  * array with handler functions to download chunk updates
320
321
  */
321
- exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC";
322
+ module.exports.hmrDownloadUpdateHandlers = "__webpack_require__.hmrC";
322
323
 
323
324
  /**
324
325
  * object with all hmr module data for all modules
325
326
  */
326
- exports.hmrModuleData = "__webpack_require__.hmrD";
327
+ module.exports.hmrModuleData = "__webpack_require__.hmrD";
327
328
 
328
329
  /**
329
330
  * array with handler functions when a module should be invalidated
330
331
  */
331
- exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI";
332
+ module.exports.hmrInvalidateModuleHandlers = "__webpack_require__.hmrI";
332
333
 
333
334
  /**
334
335
  * the prefix for storing state of runtime modules when hmr is enabled
335
336
  */
336
- exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS";
337
+ module.exports.hmrRuntimeStatePrefix = "__webpack_require__.hmrS";
337
338
 
338
339
  /**
339
340
  * the AMD define function
340
341
  */
341
- exports.amdDefine = "__webpack_require__.amdD";
342
+ module.exports.amdDefine = "__webpack_require__.amdD";
342
343
 
343
344
  /**
344
345
  * the AMD options
345
346
  */
346
- exports.amdOptions = "__webpack_require__.amdO";
347
+ module.exports.amdOptions = "__webpack_require__.amdO";
347
348
 
348
349
  /**
349
350
  * the System polyfill object
350
351
  */
351
- exports.system = "__webpack_require__.System";
352
+ module.exports.system = "__webpack_require__.System";
352
353
 
353
354
  /**
354
355
  * the shorthand for Object.prototype.hasOwnProperty
355
356
  * using of it decreases the compiled bundle size
356
357
  */
357
- exports.hasOwnProperty = "__webpack_require__.o";
358
+ module.exports.hasOwnProperty = "__webpack_require__.o";
358
359
 
359
360
  /**
360
361
  * the System.register context object
361
362
  */
362
- exports.systemContext = "__webpack_require__.y";
363
+ module.exports.systemContext = "__webpack_require__.y";
363
364
 
364
365
  /**
365
366
  * the baseURI of current document
366
367
  */
367
- exports.baseURI = "__webpack_require__.b";
368
+ module.exports.baseURI = "__webpack_require__.b";
368
369
 
369
370
  /**
370
371
  * a RelativeURL class when relative URLs are used
371
372
  */
372
- exports.relativeUrl = "__webpack_require__.U";
373
+ module.exports.relativeUrl = "__webpack_require__.U";
373
374
 
374
375
  /**
375
376
  * Creates an async module. The body function must be a async function.
@@ -383,4 +384,4 @@ exports.relativeUrl = "__webpack_require__.U";
383
384
  * hasAwaitAfterDependencies?: boolean
384
385
  * ) => void
385
386
  */
386
- exports.asyncModule = "__webpack_require__.a";
387
+ module.exports.asyncModule = "__webpack_require__.a";
@@ -159,7 +159,7 @@ class RuntimeModule extends Module {
159
159
  try {
160
160
  const source = this.getGeneratedCode();
161
161
  return source ? source.length : 0;
162
- } catch (e) {
162
+ } catch (_err) {
163
163
  return 0;
164
164
  }
165
165
  }
@@ -35,9 +35,12 @@ const SystemContextRuntimeModule = require("./runtime/SystemContextRuntimeModule
35
35
  const ShareRuntimeModule = require("./sharing/ShareRuntimeModule");
36
36
  const StringXor = require("./util/StringXor");
37
37
 
38
+ /** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
39
+ /** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputNormalized */
38
40
  /** @typedef {import("./Chunk")} Chunk */
39
41
  /** @typedef {import("./Compiler")} Compiler */
40
42
  /** @typedef {import("./Module")} Module */
43
+ /** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
41
44
 
42
45
  const GLOBALS_ON_REQUIRE = [
43
46
  RuntimeGlobals.chunkName,
@@ -241,13 +244,12 @@ class RuntimePlugin {
241
244
  compilation.hooks.runtimeRequirementInTree
242
245
  .for(RuntimeGlobals.systemContext)
243
246
  .tap("RuntimePlugin", chunk => {
244
- const { outputOptions } = compilation;
245
- const { library: globalLibrary } = outputOptions;
246
247
  const entryOptions = chunk.getEntryOptions();
247
248
  const libraryType =
248
249
  entryOptions && entryOptions.library !== undefined
249
250
  ? entryOptions.library.type
250
- : globalLibrary.type;
251
+ : /** @type {LibraryOptions} */
252
+ (compilation.outputOptions.library).type;
251
253
 
252
254
  if (libraryType === "system") {
253
255
  compilation.addRuntimeModule(
@@ -275,10 +277,13 @@ class RuntimePlugin {
275
277
  "javascript",
276
278
  RuntimeGlobals.getChunkScriptFilename,
277
279
  chunk =>
278
- chunk.filenameTemplate ||
279
- (chunk.canBeInitial()
280
- ? compilation.outputOptions.filename
281
- : compilation.outputOptions.chunkFilename),
280
+ /** @type {TemplatePath} */
281
+ (
282
+ chunk.filenameTemplate ||
283
+ (chunk.canBeInitial()
284
+ ? compilation.outputOptions.filename
285
+ : compilation.outputOptions.chunkFilename)
286
+ ),
282
287
  false
283
288
  )
284
289
  );
@@ -313,7 +318,8 @@ class RuntimePlugin {
313
318
  .tap("RuntimePlugin", (chunk, set) => {
314
319
  if (
315
320
  /\[(full)?hash(:\d+)?\]/.test(
316
- compilation.outputOptions.hotUpdateChunkFilename
321
+ /** @type {NonNullable<OutputNormalized["hotUpdateChunkFilename"]>} */
322
+ (compilation.outputOptions.hotUpdateChunkFilename)
317
323
  )
318
324
  )
319
325
  set.add(RuntimeGlobals.getFullHash);
@@ -323,7 +329,9 @@ class RuntimePlugin {
323
329
  "javascript",
324
330
  "javascript update",
325
331
  RuntimeGlobals.getChunkUpdateScriptFilename,
326
- c => compilation.outputOptions.hotUpdateChunkFilename,
332
+ c =>
333
+ /** @type {NonNullable<OutputNormalized["hotUpdateChunkFilename"]>} */
334
+ (compilation.outputOptions.hotUpdateChunkFilename),
327
335
  true
328
336
  )
329
337
  );
@@ -334,7 +342,8 @@ class RuntimePlugin {
334
342
  .tap("RuntimePlugin", (chunk, set) => {
335
343
  if (
336
344
  /\[(full)?hash(:\d+)?\]/.test(
337
- compilation.outputOptions.hotUpdateMainFilename
345
+ /** @type {NonNullable<OutputNormalized["hotUpdateMainFilename"]>} */
346
+ (compilation.outputOptions.hotUpdateMainFilename)
338
347
  )
339
348
  ) {
340
349
  set.add(RuntimeGlobals.getFullHash);
@@ -344,7 +353,8 @@ class RuntimePlugin {
344
353
  new GetMainFilenameRuntimeModule(
345
354
  "update manifest",
346
355
  RuntimeGlobals.getUpdateManifestFilename,
347
- compilation.outputOptions.hotUpdateMainFilename
356
+ /** @type {NonNullable<OutputNormalized["hotUpdateMainFilename"]>} */
357
+ (compilation.outputOptions.hotUpdateMainFilename)
348
358
  )
349
359
  );
350
360
  return true;
@@ -376,7 +386,9 @@ class RuntimePlugin {
376
386
  compilation.hooks.runtimeRequirementInTree
377
387
  .for(RuntimeGlobals.loadScript)
378
388
  .tap("RuntimePlugin", (chunk, set) => {
379
- const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes;
389
+ const withCreateScriptUrl = Boolean(
390
+ compilation.outputOptions.trustedTypes
391
+ );
380
392
  if (withCreateScriptUrl) {
381
393
  set.add(RuntimeGlobals.createScriptUrl);
382
394
  }