@@ -286,7 +286,7 @@ const { isSourceEqual } = require("./util/source");
286286
287287/**
288288 * @typedef {object } LogEntry
289- * @property {string } type
289+ * @property {keyof LogType } type
290290 * @property {EXPECTED_ANY[]= } args
291291 * @property {number } time
292292 * @property {string[]= } trace
@@ -514,6 +514,7 @@ class Compilation {
514514 /** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions> } */
515515 const processAssetsHook = new AsyncSeriesHook ( [ "assets" ] ) ;
516516
517+ /** @type {Set<string> } */
517518 let savedAssets = new Set ( ) ;
518519 /**
519520 * @param {CompilationAssets } assets assets
@@ -2292,6 +2293,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
22922293 ( originModule )
22932294 ) ;
22942295 if ( creatingModuleDuringBuildSet === undefined ) {
2296+ /** @type {Set<Module> } */
22952297 creatingModuleDuringBuildSet = new Set ( ) ;
22962298 this . creatingModuleDuringBuild . set (
22972299 /** @type {Module } */
@@ -2598,7 +2600,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
25982600 this . moduleGraph . setModuleMemCaches ( this . moduleMemCaches ) ;
25992601 }
26002602 const { moduleGraph, moduleMemCaches } = this ;
2603+ /** @type {Set<Module> } */
26012604 const affectedModules = new Set ( ) ;
2605+ /** @type {Set<Module> } */
26022606 const infectedModules = new Set ( ) ;
26032607 let statNew = 0 ;
26042608 let statChanged = 0 ;
@@ -2714,6 +2718,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
27142718 }
27152719 return affected ;
27162720 } ;
2721+ /** @type {Set<Module> } */
27172722 const directOnlyInfectedModules = new Set ( ) ;
27182723 for ( const module of infectedModules ) {
27192724 for ( const [
@@ -2732,6 +2737,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
27322737 }
27332738 }
27342739 for ( const module of directOnlyInfectedModules ) infectedModules . add ( module ) ;
2740+ /** @type {Set<Module> } */
27352741 const directOnlyAffectModules = new Set ( ) ;
27362742 for ( const module of affectedModules ) {
27372743 for ( const [
@@ -2994,6 +3000,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
29943000 * @param {(profile: ModuleProfile) => number } getParallelism get parallelism callback
29953001 */
29963002 const logByLoadersSummary = ( category , getDuration , getParallelism ) => {
3003+ /** @type {Map<string, { module: Module, profile: ModuleProfile }[]> } */
29973004 const map = new Map ( ) ;
29983005 for ( const [ module , profile ] of modulesWithProfiles ) {
29993006 const list = getOrInsert (
@@ -3205,6 +3212,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
32053212 this . chunkGroups . push ( entrypoint ) ;
32063213 connectChunkGroupAndChunk ( entrypoint , chunk ) ;
32073214
3215+ /** @type {Set<Module> } */
32083216 const entryModules = new Set ( ) ;
32093217 for ( const dep of [ ...this . globalEntry . dependencies , ...dependencies ] ) {
32103218 entrypoint . addOrigin (
@@ -3252,6 +3260,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
32523260 modulesList . push ( module ) ;
32533261 }
32543262 }
3263+ /** @type {Set<Chunk> } */
32553264 const runtimeChunks = new Set ( ) ;
32563265 outer: for ( const [
32573266 name ,
@@ -3625,6 +3634,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
36253634 const runIteration = ( ) => {
36263635 /** @type {CodeGenerationJobs } */
36273636 let delayedJobs = [ ] ;
3637+ /** @type {Set<Module> } */
36283638 let delayedModules = new Set ( ) ;
36293639 asyncLib . eachLimit (
36303640 jobs ,
@@ -3746,6 +3756,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
37463756 ) ;
37473757 cache . get ( ( err , cachedResult ) => {
37483758 if ( err ) return callback ( /** @type {WebpackError } */ ( err ) ) ;
3759+ /** @type {CodeGenerationResult } */
37493760 let result ;
37503761 if ( ! cachedResult ) {
37513762 try {
@@ -3845,6 +3856,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
38453856 continue ;
38463857 }
38473858 }
3859+ /** @type {RuntimeRequirements } */
38483860 let set ;
38493861 const runtimeRequirements =
38503862 codeGenerationResults . getRuntimeRequirements ( module , runtime ) ;
@@ -4574,6 +4586,7 @@ This prevents using hashes of each other and should be avoided.`);
45744586 }
45754587 this . logger . timeEnd ( "hashing: sort chunks" ) ;
45764588
4589+ /** @type {Set<Chunk> } */
45774590 const fullHashChunks = new Set ( ) ;
45784591 /** @type {CodeGenerationJobs } */
45794592 const codeGenerationJobs = [ ] ;
@@ -4702,7 +4715,7 @@ This prevents using hashes of each other and should be avoided.`);
47024715 ) . hash = moduleHashDigest ;
47034716 }
47044717 const chunkHash = createHash ( hashFunction ) ;
4705- chunkHash . update ( chunk . hash ) ;
4718+ chunkHash . update ( /** @type { string } */ ( chunk . hash ) ) ;
47064719 chunkHash . update ( this . hash ) ;
47074720 const chunkHashDigest = chunkHash . digest ( hashDigest ) ;
47084721 chunk . hash = chunkHashDigest ;
@@ -5026,6 +5039,7 @@ This prevents using hashes of each other and should be avoided.`);
50265039 */
50275040 createChunkAssets ( callback ) {
50285041 const outputOptions = this . outputOptions ;
5042+ /** @type {WeakMap<Source, CachedSource> } */
50295043 const cachedSourceMap = new WeakMap ( ) ;
50305044 /** @type {Map<string, {hash: string, source: Source, chunk: Chunk}> } */
50315045 const alreadyWrittenFiles = new Map ( ) ;
0 commit comments