webpack 5.98.0 → 5.99.1

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 (251) hide show
  1. package/README.md +7 -3
  2. package/lib/AsyncDependenciesBlock.js +3 -1
  3. package/lib/BannerPlugin.js +1 -1
  4. package/lib/Cache.js +9 -7
  5. package/lib/CacheFacade.js +5 -5
  6. package/lib/Chunk.js +2 -2
  7. package/lib/ChunkGraph.js +21 -16
  8. package/lib/ChunkTemplate.js +6 -6
  9. package/lib/CleanPlugin.js +10 -10
  10. package/lib/CodeGenerationResults.js +4 -3
  11. package/lib/CompatibilityPlugin.js +4 -1
  12. package/lib/Compilation.js +326 -152
  13. package/lib/Compiler.js +13 -18
  14. package/lib/ConditionalInitFragment.js +1 -1
  15. package/lib/ConstPlugin.js +5 -3
  16. package/lib/ContextModule.js +4 -2
  17. package/lib/ContextModuleFactory.js +3 -3
  18. package/lib/ContextReplacementPlugin.js +43 -16
  19. package/lib/DefinePlugin.js +25 -24
  20. package/lib/DelegatedModule.js +4 -2
  21. package/lib/DelegatedModuleFactoryPlugin.js +2 -1
  22. package/lib/Dependency.js +19 -13
  23. package/lib/DependencyTemplates.js +4 -3
  24. package/lib/DllModule.js +4 -2
  25. package/lib/DllModuleFactory.js +2 -2
  26. package/lib/DllReferencePlugin.js +2 -1
  27. package/lib/DynamicEntryPlugin.js +1 -1
  28. package/lib/EnvironmentPlugin.js +4 -2
  29. package/lib/ExportsInfo.js +72 -40
  30. package/lib/ExternalModule.js +14 -5
  31. package/lib/ExternalModuleFactoryPlugin.js +24 -12
  32. package/lib/FileSystemInfo.js +129 -94
  33. package/lib/FlagDependencyExportsPlugin.js +6 -4
  34. package/lib/FlagDependencyUsagePlugin.js +1 -1
  35. package/lib/Generator.js +29 -1
  36. package/lib/HookWebpackError.js +2 -2
  37. package/lib/HotModuleReplacementPlugin.js +3 -9
  38. package/lib/IgnoreErrorModuleFactory.js +2 -2
  39. package/lib/IgnorePlugin.js +0 -5
  40. package/lib/InitFragment.js +1 -1
  41. package/lib/LoaderOptionsPlugin.js +8 -5
  42. package/lib/MainTemplate.js +7 -7
  43. package/lib/Module.js +40 -17
  44. package/lib/ModuleBuildError.js +3 -1
  45. package/lib/ModuleDependencyError.js +4 -3
  46. package/lib/ModuleDependencyWarning.js +4 -3
  47. package/lib/ModuleFactory.js +9 -3
  48. package/lib/ModuleFilenameHelpers.js +13 -13
  49. package/lib/ModuleGraph.js +20 -14
  50. package/lib/ModuleGraphConnection.js +7 -13
  51. package/lib/ModuleNotFoundError.js +1 -1
  52. package/lib/ModuleParseError.js +2 -1
  53. package/lib/ModuleSourceTypesConstants.js +11 -0
  54. package/lib/ModuleTemplate.js +5 -5
  55. package/lib/ModuleTypeConstants.js +15 -0
  56. package/lib/MultiCompiler.js +4 -4
  57. package/lib/MultiStats.js +1 -1
  58. package/lib/NormalModule.js +101 -54
  59. package/lib/NormalModuleFactory.js +38 -33
  60. package/lib/NormalModuleReplacementPlugin.js +3 -2
  61. package/lib/NullFactory.js +2 -2
  62. package/lib/Parser.js +4 -3
  63. package/lib/ProgressPlugin.js +1 -2
  64. package/lib/RawModule.js +4 -2
  65. package/lib/RecordIdsPlugin.js +6 -2
  66. package/lib/RequestShortener.js +3 -1
  67. package/lib/ResolverFactory.js +12 -9
  68. package/lib/RuntimeModule.js +4 -2
  69. package/lib/RuntimeTemplate.js +2 -1
  70. package/lib/SelfModuleFactory.js +2 -2
  71. package/lib/SourceMapDevToolPlugin.js +0 -8
  72. package/lib/Template.js +6 -5
  73. package/lib/TemplatedPathPlugin.js +15 -12
  74. package/lib/WebpackOptionsApply.js +1 -1
  75. package/lib/asset/AssetGenerator.js +237 -170
  76. package/lib/asset/AssetModulesPlugin.js +50 -8
  77. package/lib/asset/AssetSourceGenerator.js +18 -0
  78. package/lib/asset/RawDataUrlModule.js +4 -2
  79. package/lib/buildChunkGraph.js +14 -4
  80. package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
  81. package/lib/cache/PackFileCacheStrategy.js +137 -121
  82. package/lib/cache/ResolverCachePlugin.js +15 -7
  83. package/lib/cache/getLazyHashedEtag.js +4 -3
  84. package/lib/cli.js +23 -15
  85. package/lib/config/defaults.js +93 -26
  86. package/lib/config/normalization.js +14 -13
  87. package/lib/config/target.js +8 -8
  88. package/lib/container/ContainerEntryModule.js +4 -2
  89. package/lib/container/ContainerEntryModuleFactory.js +2 -2
  90. package/lib/container/FallbackModule.js +4 -2
  91. package/lib/container/FallbackModuleFactory.js +2 -2
  92. package/lib/container/RemoteModule.js +4 -2
  93. package/lib/container/options.js +5 -5
  94. package/lib/css/CssGenerator.js +71 -9
  95. package/lib/css/CssModulesPlugin.js +30 -5
  96. package/lib/css/CssParser.js +37 -17
  97. package/lib/css/walkCssTokens.js +17 -17
  98. package/lib/debug/ProfilingPlugin.js +98 -38
  99. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +10 -4
  100. package/lib/dependencies/AMDPlugin.js +5 -2
  101. package/lib/dependencies/AMDRequireArrayDependency.js +4 -3
  102. package/lib/dependencies/AMDRequireContextDependency.js +2 -1
  103. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +15 -7
  104. package/lib/dependencies/AMDRuntimeModules.js +3 -1
  105. package/lib/dependencies/CommonJsExportRequireDependency.js +4 -5
  106. package/lib/dependencies/CommonJsExportsParserPlugin.js +3 -3
  107. package/lib/dependencies/CommonJsImportsParserPlugin.js +8 -7
  108. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -1
  109. package/lib/dependencies/ContextDependencyHelpers.js +13 -6
  110. package/lib/dependencies/CssIcssExportDependency.js +15 -12
  111. package/lib/dependencies/CssIcssImportDependency.js +4 -1
  112. package/lib/dependencies/CssLocalIdentifierDependency.js +17 -14
  113. package/lib/dependencies/ExportsInfoDependency.js +6 -1
  114. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +5 -5
  115. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +22 -15
  116. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +23 -8
  117. package/lib/dependencies/HarmonyExportSpecifierDependency.js +2 -2
  118. package/lib/dependencies/HarmonyImportDependency.js +8 -6
  119. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -14
  120. package/lib/dependencies/HarmonyImportSpecifierDependency.js +5 -5
  121. package/lib/dependencies/ImportContextDependency.js +2 -1
  122. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -4
  123. package/lib/dependencies/JsonExportsDependency.js +24 -8
  124. package/lib/dependencies/LoaderPlugin.js +4 -14
  125. package/lib/dependencies/RequireContextDependency.js +2 -1
  126. package/lib/dependencies/RequireContextDependencyParserPlugin.js +6 -3
  127. package/lib/dependencies/RequireEnsureDependenciesBlock.js +3 -2
  128. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +11 -5
  129. package/lib/dependencies/RequireResolveContextDependency.js +1 -1
  130. package/lib/dependencies/WebAssemblyExportImportedDependency.js +1 -1
  131. package/lib/dependencies/WorkerDependency.js +6 -3
  132. package/lib/dependencies/WorkerPlugin.js +100 -41
  133. package/lib/esm/ModuleChunkFormatPlugin.js +5 -0
  134. package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
  135. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -0
  136. package/lib/hmr/LazyCompilationPlugin.js +32 -24
  137. package/lib/hmr/lazyCompilationBackend.js +1 -1
  138. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  139. package/lib/ids/HashedModuleIdsPlugin.js +2 -1
  140. package/lib/ids/IdHelpers.js +15 -14
  141. package/lib/ids/SyncModuleIdsPlugin.js +9 -5
  142. package/lib/index.js +5 -5
  143. package/lib/javascript/BasicEvaluatedExpression.js +6 -6
  144. package/lib/javascript/JavascriptGenerator.js +11 -1
  145. package/lib/javascript/JavascriptModulesPlugin.js +51 -31
  146. package/lib/javascript/JavascriptParser.js +287 -188
  147. package/lib/javascript/JavascriptParserHelpers.js +10 -9
  148. package/lib/javascript/StartupHelpers.js +4 -1
  149. package/lib/json/JsonData.js +4 -4
  150. package/lib/json/JsonGenerator.js +54 -22
  151. package/lib/json/JsonModulesPlugin.js +16 -2
  152. package/lib/json/JsonParser.js +8 -4
  153. package/lib/library/AbstractLibraryPlugin.js +7 -3
  154. package/lib/library/AssignLibraryPlugin.js +29 -1
  155. package/lib/library/EnableLibraryPlugin.js +7 -10
  156. package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
  157. package/lib/library/ModuleLibraryPlugin.js +121 -15
  158. package/lib/logging/Logger.js +2 -2
  159. package/lib/logging/createConsoleLogger.js +4 -4
  160. package/lib/node/NodeEnvironmentPlugin.js +6 -2
  161. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -2
  162. package/lib/node/ReadFileCompileWasmPlugin.js +1 -2
  163. package/lib/node/nodeConsole.js +3 -1
  164. package/lib/optimize/AggressiveSplittingPlugin.js +1 -1
  165. package/lib/optimize/ConcatenatedModule.js +19 -12
  166. package/lib/optimize/InnerGraph.js +3 -2
  167. package/lib/optimize/InnerGraphPlugin.js +13 -7
  168. package/lib/optimize/LimitChunkCountPlugin.js +20 -0
  169. package/lib/optimize/ModuleConcatenationPlugin.js +10 -7
  170. package/lib/optimize/RealContentHashPlugin.js +8 -4
  171. package/lib/optimize/SideEffectsFlagPlugin.js +4 -2
  172. package/lib/optimize/SplitChunksPlugin.js +87 -65
  173. package/lib/rules/BasicEffectRulePlugin.js +9 -1
  174. package/lib/rules/BasicMatcherRulePlugin.js +15 -4
  175. package/lib/rules/ObjectMatcherRulePlugin.js +12 -3
  176. package/lib/rules/RuleSetCompiler.js +25 -14
  177. package/lib/rules/UseEffectRulePlugin.js +47 -17
  178. package/lib/runtime/GetChunkFilenameRuntimeModule.js +6 -6
  179. package/lib/schemes/HttpUriPlugin.js +38 -17
  180. package/lib/serialization/BinaryMiddleware.js +52 -19
  181. package/lib/serialization/FileMiddleware.js +78 -48
  182. package/lib/serialization/ObjectMiddleware.js +78 -29
  183. package/lib/serialization/PlainObjectSerializer.js +1 -1
  184. package/lib/serialization/Serializer.js +15 -10
  185. package/lib/serialization/SerializerMiddleware.js +80 -41
  186. package/lib/serialization/SingleItemMiddleware.js +10 -7
  187. package/lib/serialization/types.js +1 -1
  188. package/lib/sharing/ConsumeSharedModule.js +4 -2
  189. package/lib/sharing/ProvideSharedModule.js +4 -2
  190. package/lib/sharing/ProvideSharedModuleFactory.js +5 -3
  191. package/lib/sharing/utils.js +2 -2
  192. package/lib/stats/DefaultStatsFactoryPlugin.js +80 -78
  193. package/lib/stats/DefaultStatsPresetPlugin.js +43 -23
  194. package/lib/stats/DefaultStatsPrinterPlugin.js +85 -43
  195. package/lib/stats/StatsFactory.js +11 -11
  196. package/lib/stats/StatsPrinter.js +7 -7
  197. package/lib/util/ArrayHelpers.js +2 -4
  198. package/lib/util/ArrayQueue.js +1 -1
  199. package/lib/util/AsyncQueue.js +4 -4
  200. package/lib/util/IterableHelpers.js +1 -1
  201. package/lib/util/LazyBucketSortedSet.js +41 -23
  202. package/lib/util/LazySet.js +3 -2
  203. package/lib/util/MapHelpers.js +1 -1
  204. package/lib/util/ParallelismFactorCalculator.js +1 -1
  205. package/lib/util/Semaphore.js +3 -3
  206. package/lib/util/SetHelpers.js +1 -1
  207. package/lib/util/SortableSet.js +9 -7
  208. package/lib/util/TupleQueue.js +9 -8
  209. package/lib/util/TupleSet.js +2 -2
  210. package/lib/util/WeakTupleMap.js +12 -11
  211. package/lib/util/binarySearchBounds.js +2 -1
  212. package/lib/util/cleverMerge.js +84 -54
  213. package/lib/util/comparators.js +22 -21
  214. package/lib/util/compileBooleanMatcher.js +3 -3
  215. package/lib/util/concatenate.js +6 -4
  216. package/lib/util/create-schema-validation.js +4 -4
  217. package/lib/util/createHash.js +2 -2
  218. package/lib/util/deprecation.js +35 -33
  219. package/lib/util/deterministicGrouping.js +6 -6
  220. package/lib/util/findGraphRoots.js +1 -1
  221. package/lib/util/fs.js +39 -39
  222. package/lib/util/hash/wasm-hash.js +2 -2
  223. package/lib/util/identifier.js +15 -18
  224. package/lib/util/makeSerializable.js +1 -1
  225. package/lib/util/memoize.js +4 -1
  226. package/lib/util/objectToMap.js +3 -2
  227. package/lib/util/processAsyncTree.js +2 -2
  228. package/lib/util/propertyName.js +0 -1
  229. package/lib/util/registerExternalSerializer.js +15 -18
  230. package/lib/util/removeBOM.js +25 -0
  231. package/lib/util/runtime.js +34 -27
  232. package/lib/util/serialization.js +5 -16
  233. package/lib/util/smartGrouping.js +3 -3
  234. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
  235. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +11 -0
  236. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +10 -0
  237. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -0
  238. package/lib/wasm-sync/WebAssemblyGenerator.js +28 -12
  239. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +10 -0
  240. package/lib/wasm-sync/WebAssemblyParser.js +9 -4
  241. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -0
  242. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +30 -25
  243. package/package.json +19 -17
  244. package/schemas/WebpackOptions.check.js +1 -1
  245. package/schemas/WebpackOptions.json +48 -13
  246. package/schemas/plugins/JsonModulesPluginGenerator.check.d.ts +7 -0
  247. package/schemas/plugins/JsonModulesPluginGenerator.check.js +6 -0
  248. package/schemas/plugins/JsonModulesPluginGenerator.json +11 -0
  249. package/schemas/plugins/SourceMapDevToolPlugin.json +2 -2
  250. package/types.d.ts +918 -615
  251. package/lib/library/ModernModuleLibraryPlugin.js +0 -144
@@ -9,6 +9,7 @@ const { create: createResolver } = require("enhanced-resolve");
9
9
  const nodeModule = require("module");
10
10
  const asyncLib = require("neo-async");
11
11
  const { isAbsolute } = require("path");
12
+ const { DEFAULTS } = require("./config/defaults");
12
13
  const AsyncQueue = require("./util/AsyncQueue");
13
14
  const StackedCacheMap = require("./util/StackedCacheMap");
14
15
  const createHash = require("./util/createHash");
@@ -73,12 +74,14 @@ const INVALID = Symbol("invalid");
73
74
  * @property {string=} timestampHash
74
75
  */
75
76
 
77
+ /** @typedef {Set<string>} Symlinks */
78
+
76
79
  /**
77
80
  * @typedef {object} ContextFileSystemInfoEntry
78
81
  * @property {number} safeTime
79
82
  * @property {string=} timestampHash
80
83
  * @property {ResolvedContextFileSystemInfoEntry=} resolved
81
- * @property {Set<string>=} symlinks
84
+ * @property {Symlinks=} symlinks
82
85
  */
83
86
 
84
87
  /**
@@ -95,8 +98,6 @@ const INVALID = Symbol("invalid");
95
98
  * @property {string} hash
96
99
  */
97
100
 
98
- /** @typedef {Set<string>} Symlinks */
99
-
100
101
  /**
101
102
  * @typedef {object} ContextTimestampAndHash
102
103
  * @property {number} safeTime
@@ -123,16 +124,26 @@ const INVALID = Symbol("invalid");
123
124
  * @property {Set<SnapshotOptimizationEntry> | undefined} children
124
125
  */
125
126
 
127
+ /** @typedef {Map<string, string | false | undefined>} ResolveResults */
128
+
129
+ /** @typedef {Set<string>} Files */
130
+ /** @typedef {Set<string>} Directories */
131
+ /** @typedef {Set<string>} Missing */
132
+
133
+ /**
134
+ * @typedef {object} ResolveDependencies
135
+ * @property {Files} files list of files
136
+ * @property {Directories} directories list of directories
137
+ * @property {Missing} missing list of missing entries
138
+ */
139
+
126
140
  /**
127
141
  * @typedef {object} ResolveBuildDependenciesResult
128
- * @property {Set<string>} files list of files
129
- * @property {Set<string>} directories list of directories
130
- * @property {Set<string>} missing list of missing entries
131
- * @property {Map<string, string | false | undefined>} resolveResults stored resolve results
132
- * @property {object} resolveDependencies dependencies of the resolving
133
- * @property {Set<string>} resolveDependencies.files list of files
134
- * @property {Set<string>} resolveDependencies.directories list of directories
135
- * @property {Set<string>} resolveDependencies.missing list of missing entries
142
+ * @property {Files} files list of files
143
+ * @property {Directories} directories list of directories
144
+ * @property {Missing} missing list of missing entries
145
+ * @property {ResolveResults} resolveResults stored resolve results
146
+ * @property {ResolveDependencies} resolveDependencies dependencies of the resolving
136
147
  */
137
148
 
138
149
  /**
@@ -156,9 +167,8 @@ class SnapshotIterator {
156
167
  }
157
168
  }
158
169
 
159
- /**
160
- * @typedef {(snapshot: Snapshot) => (Map<string, any> | Set<string> | undefined)[]} GetMapsFunction
161
- */
170
+ /** @typedef {Map<string, TODO> | Set<string> | undefined} SnapshotMap */
171
+ /** @typedef {(snapshot: Snapshot) => SnapshotMap[]} GetMapsFunction */
162
172
 
163
173
  class SnapshotIterable {
164
174
  /**
@@ -174,9 +184,9 @@ class SnapshotIterable {
174
184
  let state = 0;
175
185
  /** @type {IterableIterator<string>} */
176
186
  let it;
177
- /** @type {(snapshot: Snapshot) => (Map<string, any> | Set<string> | undefined)[]} */
187
+ /** @type {GetMapsFunction} */
178
188
  let getMaps;
179
- /** @type {(Map<string, any> | Set<string> | undefined)[]} */
189
+ /** @type {SnapshotMap[]} */
180
190
  let maps;
181
191
  /** @type {Snapshot} */
182
192
  let snapshot;
@@ -594,9 +604,9 @@ const MIN_COMMON_SNAPSHOT_SIZE = 3;
594
604
  */
595
605
  class SnapshotOptimization {
596
606
  /**
597
- * @param {function(Snapshot): boolean} has has value
598
- * @param {function(Snapshot): SnapshotOptimizationValue<U, T> | undefined} get get value
599
- * @param {function(Snapshot, SnapshotOptimizationValue<U, T>): void} set set value
607
+ * @param {(snapshot: Snapshot) => boolean} has has value
608
+ * @param {(snapshot: Snapshot) => SnapshotOptimizationValue<U, T> | undefined} get get value
609
+ * @param {(snapshot: Snapshot, value: SnapshotOptimizationValue<U, T>) => void} set set value
600
610
  * @param {boolean=} useStartTime use the start time of snapshots
601
611
  * @param {U=} isSet value is an Set instead of a Map
602
612
  */
@@ -1031,6 +1041,12 @@ const addAll = (source, target) => {
1031
1041
 
1032
1042
  /** @typedef {Set<string>} LoggedPaths */
1033
1043
 
1044
+ /** @typedef {FileSystemInfoEntry | "ignore" | null} FileTimestamp */
1045
+ /** @typedef {ContextFileSystemInfoEntry | "ignore" | null} ContextTimestamp */
1046
+ /** @typedef {ResolvedContextFileSystemInfoEntry | "ignore" | null} ResolvedContextTimestamp */
1047
+
1048
+ /** @typedef {(err?: WebpackError | null, result?: boolean) => void} CheckSnapshotValidCallback */
1049
+
1034
1050
  /**
1035
1051
  * Used to access information about the filesystem in a cached way
1036
1052
  */
@@ -1051,7 +1067,7 @@ class FileSystemInfo {
1051
1067
  managedPaths = [],
1052
1068
  immutablePaths = [],
1053
1069
  logger,
1054
- hashFunction = "md4"
1070
+ hashFunction = DEFAULTS.HASH_FUNCTION
1055
1071
  } = {}
1056
1072
  ) {
1057
1073
  this.fs = fs;
@@ -1060,7 +1076,7 @@ class FileSystemInfo {
1060
1076
  /** @type {LoggedPaths | undefined} */
1061
1077
  this._loggedPaths = logger ? new Set() : undefined;
1062
1078
  this._hashFunction = hashFunction;
1063
- /** @type {WeakMap<Snapshot, boolean | (function((WebpackError | null)=, boolean=): void)[]>} */
1079
+ /** @type {WeakMap<Snapshot, boolean | CheckSnapshotValidCallback[]>} */
1064
1080
  this._snapshotCache = new WeakMap();
1065
1081
  this._fileTimestampsOptimization = new SnapshotOptimization(
1066
1082
  s => s.hasFileTimestamps(),
@@ -1127,13 +1143,13 @@ class FileSystemInfo {
1127
1143
  false,
1128
1144
  true
1129
1145
  );
1130
- /** @type {StackedCacheMap<string, FileSystemInfoEntry | "ignore" | null>} */
1146
+ /** @type {StackedCacheMap<string, FileTimestamp>} */
1131
1147
  this._fileTimestamps = new StackedCacheMap();
1132
1148
  /** @type {Map<string, string | null>} */
1133
1149
  this._fileHashes = new Map();
1134
1150
  /** @type {Map<string, TimestampAndHash | string>} */
1135
1151
  this._fileTshs = new Map();
1136
- /** @type {StackedCacheMap<string, ContextFileSystemInfoEntry | "ignore" | null>} */
1152
+ /** @type {StackedCacheMap<string, ContextTimestamp>} */
1137
1153
  this._contextTimestamps = new StackedCacheMap();
1138
1154
  /** @type {Map<string, ContextHash>} */
1139
1155
  this._contextHashes = new Map();
@@ -1184,28 +1200,34 @@ class FileSystemInfo {
1184
1200
  processor: this._getManagedItemDirectoryInfo.bind(this)
1185
1201
  });
1186
1202
  const _unmanagedPaths = Array.from(unmanagedPaths);
1187
- this.unmanagedPathsWithSlash = /** @type {string[]} */ (
1188
- _unmanagedPaths.filter(p => typeof p === "string")
1189
- ).map(p => join(fs, p, "_").slice(0, -1));
1190
- this.unmanagedPathsRegExps = /** @type {RegExp[]} */ (
1191
- _unmanagedPaths.filter(p => typeof p !== "string")
1192
- );
1203
+ this.unmanagedPathsWithSlash =
1204
+ /** @type {string[]} */
1205
+ (_unmanagedPaths.filter(p => typeof p === "string")).map(p =>
1206
+ join(fs, p, "_").slice(0, -1)
1207
+ );
1208
+ this.unmanagedPathsRegExps =
1209
+ /** @type {RegExp[]} */
1210
+ (_unmanagedPaths.filter(p => typeof p !== "string"));
1193
1211
 
1194
1212
  this.managedPaths = Array.from(managedPaths);
1195
- this.managedPathsWithSlash = /** @type {string[]} */ (
1196
- this.managedPaths.filter(p => typeof p === "string")
1197
- ).map(p => join(fs, p, "_").slice(0, -1));
1213
+ this.managedPathsWithSlash =
1214
+ /** @type {string[]} */
1215
+ (this.managedPaths.filter(p => typeof p === "string")).map(p =>
1216
+ join(fs, p, "_").slice(0, -1)
1217
+ );
1198
1218
 
1199
- this.managedPathsRegExps = /** @type {RegExp[]} */ (
1200
- this.managedPaths.filter(p => typeof p !== "string")
1201
- );
1219
+ this.managedPathsRegExps =
1220
+ /** @type {RegExp[]} */
1221
+ (this.managedPaths.filter(p => typeof p !== "string"));
1202
1222
  this.immutablePaths = Array.from(immutablePaths);
1203
- this.immutablePathsWithSlash = /** @type {string[]} */ (
1204
- this.immutablePaths.filter(p => typeof p === "string")
1205
- ).map(p => join(fs, p, "_").slice(0, -1));
1206
- this.immutablePathsRegExps = /** @type {RegExp[]} */ (
1207
- this.immutablePaths.filter(p => typeof p !== "string")
1208
- );
1223
+ this.immutablePathsWithSlash =
1224
+ /** @type {string[]} */
1225
+ (this.immutablePaths.filter(p => typeof p === "string")).map(p =>
1226
+ join(fs, p, "_").slice(0, -1)
1227
+ );
1228
+ this.immutablePathsRegExps =
1229
+ /** @type {RegExp[]} */
1230
+ (this.immutablePaths.filter(p => typeof p !== "string"));
1209
1231
 
1210
1232
  this._cachedDeprecatedFileTimestamps = undefined;
1211
1233
  this._cachedDeprecatedContextTimestamps = undefined;
@@ -1310,9 +1332,10 @@ class FileSystemInfo {
1310
1332
  }
1311
1333
 
1312
1334
  /**
1335
+ * @private
1313
1336
  * @param {string} path path
1314
1337
  * @param {string} reason reason
1315
- * @param {any[]} args arguments
1338
+ * @param {EXPECTED_ANY[]} args arguments
1316
1339
  */
1317
1340
  _log(path, reason, ...args) {
1318
1341
  const key = path + reason;
@@ -1366,7 +1389,7 @@ class FileSystemInfo {
1366
1389
  }
1367
1390
 
1368
1391
  /**
1369
- * @param {ReadonlyMap<string, FileSystemInfoEntry | "ignore" | null>} map timestamps
1392
+ * @param {ReadonlyMap<string, FileTimestamp>} map timestamps
1370
1393
  * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it
1371
1394
  * @returns {void}
1372
1395
  */
@@ -1376,7 +1399,7 @@ class FileSystemInfo {
1376
1399
  }
1377
1400
 
1378
1401
  /**
1379
- * @param {ReadonlyMap<string, FileSystemInfoEntry | "ignore" | null>} map timestamps
1402
+ * @param {ReadonlyMap<string, ContextTimestamp>} map timestamps
1380
1403
  * @param {boolean=} immutable if 'map' is immutable and FileSystemInfo can keep referencing it
1381
1404
  * @returns {void}
1382
1405
  */
@@ -1387,7 +1410,7 @@ class FileSystemInfo {
1387
1410
 
1388
1411
  /**
1389
1412
  * @param {string} path file path
1390
- * @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function
1413
+ * @param {(err?: WebpackError | null, fileTimestamp?: FileTimestamp) => void} callback callback function
1391
1414
  * @returns {void}
1392
1415
  */
1393
1416
  getFileTimestamp(path, callback) {
@@ -1398,7 +1421,7 @@ class FileSystemInfo {
1398
1421
 
1399
1422
  /**
1400
1423
  * @param {string} path context path
1401
- * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
1424
+ * @param {(err?: WebpackError | null, resolvedContextTimestamp?: ResolvedContextTimestamp) => void} callback callback function
1402
1425
  * @returns {void}
1403
1426
  */
1404
1427
  getContextTimestamp(path, callback) {
@@ -1423,8 +1446,9 @@ class FileSystemInfo {
1423
1446
  }
1424
1447
 
1425
1448
  /**
1449
+ * @private
1426
1450
  * @param {string} path context path
1427
- * @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
1451
+ * @param {(err?: WebpackError | null, contextTimestamp?: ContextTimestamp) => void} callback callback function
1428
1452
  * @returns {void}
1429
1453
  */
1430
1454
  _getUnresolvedContextTimestamp(path, callback) {
@@ -1435,7 +1459,7 @@ class FileSystemInfo {
1435
1459
 
1436
1460
  /**
1437
1461
  * @param {string} path file path
1438
- * @param {function((WebpackError | null)=, (string | null)=): void} callback callback function
1462
+ * @param {(err?: WebpackError | null, hash?: string | null) => void} callback callback function
1439
1463
  * @returns {void}
1440
1464
  */
1441
1465
  getFileHash(path, callback) {
@@ -1446,7 +1470,7 @@ class FileSystemInfo {
1446
1470
 
1447
1471
  /**
1448
1472
  * @param {string} path context path
1449
- * @param {function((WebpackError | null)=, string=): void} callback callback function
1473
+ * @param {(err?: WebpackError | null, contextHash?: string) => void} callback callback function
1450
1474
  * @returns {void}
1451
1475
  */
1452
1476
  getContextHash(path, callback) {
@@ -1468,8 +1492,9 @@ class FileSystemInfo {
1468
1492
  }
1469
1493
 
1470
1494
  /**
1495
+ * @private
1471
1496
  * @param {string} path context path
1472
- * @param {function((WebpackError | null)=, (ContextHash | null)=): void} callback callback function
1497
+ * @param {(err?: WebpackError | null, contextHash?: ContextHash | null) => void} callback callback function
1473
1498
  * @returns {void}
1474
1499
  */
1475
1500
  _getUnresolvedContextHash(path, callback) {
@@ -1480,7 +1505,7 @@ class FileSystemInfo {
1480
1505
 
1481
1506
  /**
1482
1507
  * @param {string} path context path
1483
- * @param {function((WebpackError | null)=, (ResolvedContextTimestampAndHash | null)=): void} callback callback function
1508
+ * @param {(err?: WebpackError | null, resolvedContextTimestampAndHash?: ResolvedContextTimestampAndHash | null) => void} callback callback function
1484
1509
  * @returns {void}
1485
1510
  */
1486
1511
  getContextTsh(path, callback) {
@@ -1500,8 +1525,9 @@ class FileSystemInfo {
1500
1525
  }
1501
1526
 
1502
1527
  /**
1528
+ * @private
1503
1529
  * @param {string} path context path
1504
- * @param {function((WebpackError | null)=, (ContextTimestampAndHash | null)=): void} callback callback function
1530
+ * @param {(err?: WebpackError | null, contextTimestampAndHash?: ContextTimestampAndHash | null) => void} callback callback function
1505
1531
  * @returns {void}
1506
1532
  */
1507
1533
  _getUnresolvedContextTsh(path, callback) {
@@ -1541,31 +1567,32 @@ class FileSystemInfo {
1541
1567
  /**
1542
1568
  * @param {string} context context directory
1543
1569
  * @param {Iterable<string>} deps dependencies
1544
- * @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function
1570
+ * @param {(err?: Error | null, resolveBuildDependenciesResult?: ResolveBuildDependenciesResult) => void} callback callback function
1545
1571
  * @returns {void}
1546
1572
  */
1547
1573
  resolveBuildDependencies(context, deps, callback) {
1548
1574
  const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } =
1549
1575
  this._createBuildDependenciesResolvers();
1550
1576
 
1551
- /** @type {Set<string>} */
1577
+ /** @type {Files} */
1552
1578
  const files = new Set();
1553
- /** @type {Set<string>} */
1579
+ /** @type {Symlinks} */
1554
1580
  const fileSymlinks = new Set();
1555
- /** @type {Set<string>} */
1581
+ /** @type {Directories} */
1556
1582
  const directories = new Set();
1557
- /** @type {Set<string>} */
1583
+ /** @type {Symlinks} */
1558
1584
  const directorySymlinks = new Set();
1559
- /** @type {Set<string>} */
1585
+ /** @type {Missing} */
1560
1586
  const missing = new Set();
1561
- /** @type {Set<string>} */
1587
+ /** @type {ResolveDependencies["files"]} */
1562
1588
  const resolveFiles = new Set();
1563
- /** @type {Set<string>} */
1589
+ /** @type {ResolveDependencies["directories"]} */
1564
1590
  const resolveDirectories = new Set();
1565
- /** @type {Set<string>} */
1591
+ /** @type {ResolveDependencies["missing"]} */
1566
1592
  const resolveMissing = new Set();
1567
- /** @type {Map<string, string | false | undefined>} */
1593
+ /** @type {ResolveResults} */
1568
1594
  const resolveResults = new Map();
1595
+ /** @type {Set<string>} */
1569
1596
  const invalidResolveResults = new Set();
1570
1597
  const resolverContext = {
1571
1598
  fileDependencies: resolveFiles,
@@ -2059,8 +2086,8 @@ class FileSystemInfo {
2059
2086
  }
2060
2087
 
2061
2088
  /**
2062
- * @param {Map<string, string | false>} resolveResults results from resolving
2063
- * @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way
2089
+ * @param {ResolveResults} resolveResults results from resolving
2090
+ * @param {(err?: Error | null, result?: boolean) => void} callback callback with true when resolveResults resolve the same way
2064
2091
  * @returns {void}
2065
2092
  */
2066
2093
  checkResolveResultsValid(resolveResults, callback) {
@@ -2139,7 +2166,7 @@ class FileSystemInfo {
2139
2166
  * @param {Iterable<string> | null} directories all directories
2140
2167
  * @param {Iterable<string> | null} missing all missing files or directories
2141
2168
  * @param {SnapshotOptions | null | undefined} options options object (for future extensions)
2142
- * @param {function(WebpackError | null, Snapshot | null): void} callback callback function
2169
+ * @param {(err: WebpackError | null, snapshot: Snapshot | null) => void} callback callback function
2143
2170
  * @returns {void}
2144
2171
  */
2145
2172
  createSnapshot(startTime, files, directories, missing, options, callback) {
@@ -2234,7 +2261,7 @@ class FileSystemInfo {
2234
2261
  };
2235
2262
  /**
2236
2263
  * @param {string} path path
2237
- * @param {Set<string>} managedSet managed set
2264
+ * @param {ManagedFiles} managedSet managed set
2238
2265
  * @returns {boolean} true when managed
2239
2266
  */
2240
2267
  const checkManaged = (path, managedSet) => {
@@ -2285,6 +2312,7 @@ class FileSystemInfo {
2285
2312
  * @returns {Set<string>} result
2286
2313
  */
2287
2314
  const captureNonManaged = (items, managedSet) => {
2315
+ /** @type {Set<string>} */
2288
2316
  const capturedItems = new Set();
2289
2317
  for (const path of items) {
2290
2318
  if (!checkManaged(path, managedSet)) capturedItems.add(path);
@@ -2292,7 +2320,7 @@ class FileSystemInfo {
2292
2320
  return capturedItems;
2293
2321
  };
2294
2322
  /**
2295
- * @param {Set<string>} capturedFiles captured files
2323
+ * @param {ManagedFiles} capturedFiles captured files
2296
2324
  */
2297
2325
  const processCapturedFiles = capturedFiles => {
2298
2326
  switch (mode) {
@@ -2380,7 +2408,7 @@ class FileSystemInfo {
2380
2408
  processCapturedFiles(captureNonManaged(files, managedFiles));
2381
2409
  }
2382
2410
  /**
2383
- * @param {Set<string>} capturedDirectories captured directories
2411
+ * @param {ManagedContexts} capturedDirectories captured directories
2384
2412
  */
2385
2413
  const processCapturedDirectories = capturedDirectories => {
2386
2414
  switch (mode) {
@@ -2485,7 +2513,7 @@ class FileSystemInfo {
2485
2513
  jobs++;
2486
2514
  /**
2487
2515
  * @param {(Error | null)=} err error
2488
- * @param {(FileSystemInfoEntry | "ignore" | null)=} entry entry
2516
+ * @param {FileTimestamp=} entry entry
2489
2517
  * @returns {void}
2490
2518
  */
2491
2519
  const callback = (err, entry) => {
@@ -2525,7 +2553,7 @@ class FileSystemInfo {
2525
2553
  );
2526
2554
  }
2527
2555
  /**
2528
- * @param {Set<string>} capturedMissing captured missing
2556
+ * @param {ManagedMissing} capturedMissing captured missing
2529
2557
  */
2530
2558
  const processCapturedMissing = capturedMissing => {
2531
2559
  this._missingExistenceOptimization.optimize(snapshot, capturedMissing);
@@ -2588,7 +2616,7 @@ class FileSystemInfo {
2588
2616
  // Fallback to normal snapshotting
2589
2617
  /**
2590
2618
  * @param {Set<string>} set set
2591
- * @param {function(Set<string>): void} fn fn
2619
+ * @param {(set: Set<string>) => void} fn fn
2592
2620
  */
2593
2621
  const process = (set, fn) => {
2594
2622
  if (set.size === 0) return;
@@ -2697,7 +2725,7 @@ class FileSystemInfo {
2697
2725
 
2698
2726
  /**
2699
2727
  * @param {Snapshot} snapshot the snapshot made
2700
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function
2728
+ * @param {CheckSnapshotValidCallback} callback callback function
2701
2729
  * @returns {void}
2702
2730
  */
2703
2731
  checkSnapshotValid(snapshot, callback) {
@@ -2716,8 +2744,9 @@ class FileSystemInfo {
2716
2744
  }
2717
2745
 
2718
2746
  /**
2747
+ * @private
2719
2748
  * @param {Snapshot} snapshot the snapshot made
2720
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function
2749
+ * @param {CheckSnapshotValidCallback} callback callback function
2721
2750
  * @returns {void}
2722
2751
  */
2723
2752
  _checkSnapshotValidNoCache(snapshot, callback) {
@@ -3019,7 +3048,7 @@ class FileSystemInfo {
3019
3048
  jobs++;
3020
3049
  /**
3021
3050
  * @param {(WebpackError | null)=} err error
3022
- * @param {(ResolvedContextFileSystemInfoEntry | "ignore" | null)=} entry entry
3051
+ * @param {ResolvedContextTimestamp=} entry entry
3023
3052
  * @returns {void}
3024
3053
  */
3025
3054
  const callback = (err, entry) => {
@@ -3123,7 +3152,7 @@ class FileSystemInfo {
3123
3152
  jobs++;
3124
3153
  /**
3125
3154
  * @param {(WebpackError | null)=} err error
3126
- * @param {(ResolvedContextFileSystemInfoEntry | "ignore" | null)=} entry entry
3155
+ * @param {ResolvedContextTimestamp=} entry entry
3127
3156
  * @returns {void}
3128
3157
  */
3129
3158
  const callback = (err, entry) => {
@@ -3222,8 +3251,8 @@ class FileSystemInfo {
3222
3251
  }
3223
3252
 
3224
3253
  /**
3225
- * @type {Processor<string, FileSystemInfoEntry>}
3226
3254
  * @private
3255
+ * @type {Processor<string, FileSystemInfoEntry>}
3227
3256
  */
3228
3257
  _readFileTimestamp(path, callback) {
3229
3258
  this.fs.stat(path, (err, _stat) => {
@@ -3261,8 +3290,8 @@ class FileSystemInfo {
3261
3290
  }
3262
3291
 
3263
3292
  /**
3264
- * @type {Processor<string, string>}
3265
3293
  * @private
3294
+ * @type {Processor<string, string>}
3266
3295
  */
3267
3296
  _readFileHash(path, callback) {
3268
3297
  this.fs.readFile(path, (err, content) => {
@@ -3297,9 +3326,9 @@ class FileSystemInfo {
3297
3326
  }
3298
3327
 
3299
3328
  /**
3300
- * @param {string} path path
3301
- * @param {function(WebpackError | null, TimestampAndHash=) : void} callback callback
3302
3329
  * @private
3330
+ * @param {string} path path
3331
+ * @param {(err: WebpackError | null, timestampAndHash?: TimestampAndHash) => void} callback callback
3303
3332
  */
3304
3333
  _getFileTimestampAndHash(path, callback) {
3305
3334
  /**
@@ -3349,17 +3378,18 @@ class FileSystemInfo {
3349
3378
  }
3350
3379
 
3351
3380
  /**
3381
+ * @private
3352
3382
  * @template T
3353
3383
  * @template ItemType
3354
3384
  * @param {object} options options
3355
3385
  * @param {string} options.path path
3356
- * @param {function(string): ItemType} options.fromImmutablePath called when context item is an immutable path
3357
- * @param {function(string): ItemType} options.fromManagedItem called when context item is a managed path
3358
- * @param {function(string, string, function((WebpackError | null)=, ItemType=): void): void} options.fromSymlink called when context item is a symlink
3359
- * @param {function(string, IStats, function((WebpackError | null)=, (ItemType | null)=): void): void} options.fromFile called when context item is a file
3360
- * @param {function(string, IStats, function((WebpackError | null)=, ItemType=): void): void} options.fromDirectory called when context item is a directory
3361
- * @param {function(string[], ItemType[]): T} options.reduce called from all context items
3362
- * @param {function((Error | null)=, (T | null)=): void} callback callback
3386
+ * @param {(value: string) => ItemType} options.fromImmutablePath called when context item is an immutable path
3387
+ * @param {(value: string) => ItemType} options.fromManagedItem called when context item is a managed path
3388
+ * @param {(value: string, result: string, callback: (err?: WebpackError | null, itemType?: ItemType) => void) => void} options.fromSymlink called when context item is a symlink
3389
+ * @param {(value: string, stats: IStats, callback: (err?: WebpackError | null, itemType?: ItemType | null) => void) => void} options.fromFile called when context item is a file
3390
+ * @param {(value: string, stats: IStats, callback: (err?: WebpackError | null, itemType?: ItemType) => void) => void} options.fromDirectory called when context item is a directory
3391
+ * @param {(arr: string[], arr1: ItemType[]) => T} options.reduce called from all context items
3392
+ * @param {(err?: Error | null, result?: T | null) => void} callback callback
3363
3393
  */
3364
3394
  _readContext(
3365
3395
  {
@@ -3460,8 +3490,8 @@ class FileSystemInfo {
3460
3490
  }
3461
3491
 
3462
3492
  /**
3463
- * @type {Processor<string, ContextFileSystemInfoEntry>}
3464
3493
  * @private
3494
+ * @type {Processor<string, ContextFileSystemInfoEntry>}
3465
3495
  */
3466
3496
  _readContextTimestamp(path, callback) {
3467
3497
  this._readContext(
@@ -3575,8 +3605,9 @@ class FileSystemInfo {
3575
3605
  }
3576
3606
 
3577
3607
  /**
3608
+ * @private
3578
3609
  * @param {ContextFileSystemInfoEntry} entry entry
3579
- * @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback
3610
+ * @param {(err?: WebpackError | null, resolvedContextTimestamp?: ResolvedContextTimestamp) => void} callback callback
3580
3611
  * @returns {void}
3581
3612
  */
3582
3613
  _resolveContextTimestamp(entry, callback) {
@@ -3624,8 +3655,8 @@ class FileSystemInfo {
3624
3655
  }
3625
3656
 
3626
3657
  /**
3627
- * @type {Processor<string, ContextHash>}
3628
3658
  * @private
3659
+ * @type {Processor<string, ContextHash>}
3629
3660
  */
3630
3661
  _readContextHash(path, callback) {
3631
3662
  this._readContext(
@@ -3694,8 +3725,9 @@ class FileSystemInfo {
3694
3725
  }
3695
3726
 
3696
3727
  /**
3728
+ * @private
3697
3729
  * @param {ContextHash} entry context hash
3698
- * @param {function(WebpackError | null, string=): void} callback callback
3730
+ * @param {(err: WebpackError | null, contextHash?: string) => void} callback callback
3699
3731
  * @returns {void}
3700
3732
  */
3701
3733
  _resolveContextHash(entry, callback) {
@@ -3733,12 +3765,12 @@ class FileSystemInfo {
3733
3765
  }
3734
3766
 
3735
3767
  /**
3736
- * @type {Processor<string, ContextTimestampAndHash>}
3737
3768
  * @private
3769
+ * @type {Processor<string, ContextTimestampAndHash>}
3738
3770
  */
3739
3771
  _readContextTimestampAndHash(path, callback) {
3740
3772
  /**
3741
- * @param {ContextFileSystemInfoEntry | "ignore" | null} timestamp timestamp
3773
+ * @param {ContextTimestamp} timestamp timestamp
3742
3774
  * @param {ContextHash} hash hash
3743
3775
  */
3744
3776
  const finalize = (timestamp, hash) => {
@@ -3864,6 +3896,7 @@ class FileSystemInfo {
3864
3896
  }
3865
3897
 
3866
3898
  /**
3899
+ * @private
3867
3900
  * @param {ContextTimestampAndHash} entry entry
3868
3901
  * @param {ProcessorCallback<ResolvedContextTimestampAndHash>} callback callback
3869
3902
  * @returns {void}
@@ -3923,8 +3956,8 @@ class FileSystemInfo {
3923
3956
  }
3924
3957
 
3925
3958
  /**
3926
- * @type {Processor<string, Set<string>>}
3927
3959
  * @private
3960
+ * @type {Processor<string, Set<string>>}
3928
3961
  */
3929
3962
  _getManagedItemDirectoryInfo(path, callback) {
3930
3963
  this.fs.readdir(path, (err, elements) => {
@@ -3944,8 +3977,8 @@ class FileSystemInfo {
3944
3977
  }
3945
3978
 
3946
3979
  /**
3947
- * @type {Processor<string, string>}
3948
3980
  * @private
3981
+ * @type {Processor<string, string>}
3949
3982
  */
3950
3983
  _getManagedItemInfo(path, callback) {
3951
3984
  const dir = dirname(this.fs, path);
@@ -4019,6 +4052,7 @@ class FileSystemInfo {
4019
4052
  getDeprecatedFileTimestamps() {
4020
4053
  if (this._cachedDeprecatedFileTimestamps !== undefined)
4021
4054
  return this._cachedDeprecatedFileTimestamps;
4055
+ /** @type {Map<string, number | null>} */
4022
4056
  const map = new Map();
4023
4057
  for (const [path, info] of this._fileTimestamps) {
4024
4058
  if (info) map.set(path, typeof info === "object" ? info.safeTime : null);
@@ -4029,6 +4063,7 @@ class FileSystemInfo {
4029
4063
  getDeprecatedContextTimestamps() {
4030
4064
  if (this._cachedDeprecatedContextTimestamps !== undefined)
4031
4065
  return this._cachedDeprecatedContextTimestamps;
4066
+ /** @type {Map<string, number | null>} */
4032
4067
  const map = new Map();
4033
4068
  for (const [path, info] of this._contextTimestamps) {
4034
4069
  if (info) map.set(path, typeof info === "object" ? info.safeTime : null);
@@ -14,6 +14,7 @@ const Queue = require("./util/Queue");
14
14
  /** @typedef {import("./Dependency").ExportSpec} ExportSpec */
15
15
  /** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */
16
16
  /** @typedef {import("./ExportsInfo")} ExportsInfo */
17
+ /** @typedef {import("./ExportsInfo").RestoreProvidedData} RestoreProvidedData */
17
18
  /** @typedef {import("./Module")} Module */
18
19
  /** @typedef {import("./Module").BuildInfo} BuildInfo */
19
20
 
@@ -400,7 +401,7 @@ class FlagDependencyExportsPlugin {
400
401
  }
401
402
  );
402
403
 
403
- /** @type {WeakMap<Module, any>} */
404
+ /** @type {WeakMap<Module, RestoreProvidedData>} */
404
405
  const providedExportsCache = new WeakMap();
405
406
  compilation.hooks.rebuildModule.tap(PLUGIN_NAME, module => {
406
407
  providedExportsCache.set(
@@ -409,9 +410,10 @@ class FlagDependencyExportsPlugin {
409
410
  );
410
411
  });
411
412
  compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, module => {
412
- moduleGraph
413
- .getExportsInfo(module)
414
- .restoreProvided(providedExportsCache.get(module));
413
+ moduleGraph.getExportsInfo(module).restoreProvided(
414
+ /** @type {RestoreProvidedData} */
415
+ (providedExportsCache.get(module))
416
+ );
415
417
  });
416
418
  });
417
419
  }
@@ -56,7 +56,7 @@ class FlagDependencyUsagePlugin {
56
56
  /** @type {Map<ExportsInfo, Module>} */
57
57
  const exportInfoToModuleMap = new Map();
58
58
 
59
- /** @type {TupleQueue<[Module, RuntimeSpec]>} */
59
+ /** @type {TupleQueue<Module, RuntimeSpec>} */
60
60
  const queue = new TupleQueue();
61
61
 
62
62
  /**