@@ -21,7 +21,7 @@ const {
2121/** @typedef  {import("webpack").Compilation } Compilation */ 
2222/** @typedef  {import("webpack").ChunkGraph } ChunkGraph */ 
2323/** @typedef  {import("webpack").Chunk } Chunk */ 
24- /** @typedef  {Parameters< import("webpack").Chunk["isInGroup"]>[0]  } ChunkGroup */ 
24+ /** @typedef  {import("webpack").ChunkGroup  } ChunkGroup */ 
2525/** @typedef  {import("webpack").Module } Module */ 
2626/** @typedef  {import("webpack").Dependency } Dependency */ 
2727/** @typedef  {import("webpack").sources.Source } Source */ 
@@ -30,6 +30,9 @@ const {
3030/** @typedef  {import("webpack").AssetInfo } AssetInfo */ 
3131/** @typedef  {import("./loader.js").Dependency } LoaderDependency */ 
3232
33+ /** @typedef  {NonNullable<Required<Configuration>['output']['filename']> } Filename */ 
34+ /** @typedef  {NonNullable<Required<Configuration>['output']['chunkFilename']> } ChunkFilename */ 
35+ 
3336/** 
3437 * @typedef  {object } LoaderOptions 
3538 * @property  {string | ((resourcePath: string, rootContext: string) => string)= } publicPath public path 
@@ -41,8 +44,8 @@ const {
4144
4245/** 
4346 * @typedef  {object } PluginOptions 
44-  * @property  {Required<Configuration>['output']['filename'] = } filename filename 
45-  * @property  {Required<Configuration>['output']['chunkFilename'] = } chunkFilename chunk filename 
47+  * @property  {Filename = } filename filename 
48+  * @property  {ChunkFilename = } chunkFilename chunk filename 
4649 * @property  {boolean= } ignoreOrder true when need to ignore order, otherwise false 
4750 * @property  {string | ((linkTag: HTMLLinkElement) => void)= } insert link insert place or a custom insert function 
4851 * @property  {Record<string, string>= } attributes link attributes 
@@ -53,8 +56,8 @@ const {
5356
5457/** 
5558 * @typedef  {object } NormalizedPluginOptions 
56-  * @property  {Required<Configuration>['output']['filename'] } filename filename 
57-  * @property  {Required<Configuration>['output']['chunkFilename'] = } chunkFilename chunk filename 
59+  * @property  {Filename } filename filename 
60+  * @property  {ChunkFilename = } chunkFilename chunk filename 
5861 * @property  {boolean } ignoreOrder true when need to ignore order, otherwise false 
5962 * @property  {string | ((linkTag: HTMLLinkElement) => void)= } insert a link insert place or a custom insert function 
6063 * @property  {Record<string, string>= } attributes link attributes 
@@ -70,9 +73,6 @@ const {
7073 * @property  {Record<string, string>= } attributes link attributes 
7174 */ 
7275
73- // eslint-disable-next-line jsdoc/no-restricted-syntax 
74- /** @typedef  {any } TODO */ 
75- 
7676const  pluginName  =  "mini-css-extract-plugin" ; 
7777const  pluginSymbol  =  Symbol ( pluginName ) ; 
7878
@@ -89,8 +89,9 @@ const CODE_GENERATION_RESULT = {
8989  runtimeRequirements : new  Set ( ) , 
9090} ; 
9191
92- /** @typedef  {Module & { content: Buffer, media?: string, sourceMap?: Buffer, supports?: string, layer?: string, assets?: { [key: string]: TODO }, assetsInfo?: Map<string, AssetInfo> } } CssModule */ 
93- /** @typedef  {{ context: string | null, identifier: string, identifierIndex: number, content: Buffer, sourceMap?: Buffer, media?: string, supports?: string, layer?: TODO, assetsInfo?: Map<string, AssetInfo>, assets?: { [key: string]: TODO }} } CssModuleDependency */ 
92+ // eslint-disable-next-line jsdoc/no-restricted-syntax 
93+ /** @typedef  {{ context: string | null, identifier: string, identifierIndex: number, content: Buffer, sourceMap?: Buffer, media?: string, supports?: string, layer?: any, assetsInfo?: Map<string, AssetInfo>, assets?: { [key: string]: Source }} } CssModuleDependency */ 
94+ /** @typedef  {Module & { content: Buffer, media?: string, sourceMap?: Buffer, supports?: string, layer?: string, assets?: { [key: string]: Source }, assetsInfo?: Map<string, AssetInfo> } } CssModule */ 
9495/** @typedef  {{ new(dependency: CssModuleDependency): CssModule } } CssModuleConstructor */ 
9596/** @typedef  {Dependency & CssModuleDependency } CssDependency */ 
9697/** @typedef  {Omit<LoaderDependency, "context"> } CssDependencyOptions */ 
@@ -437,10 +438,8 @@ class MiniCssExtractPlugin {
437438        this . sourceMap  =  sourceMap ; 
438439        this . context  =  context ; 
439440        /** @type  {{ [key: string]: Source } | undefined }} */ 
440- 
441441        this . assets  =  undefined ; 
442442        /** @type  {Map<string, AssetInfo> | undefined } */ 
443- 
444443        this . assetsInfo  =  undefined ; 
445444      } 
446445
@@ -486,7 +485,6 @@ class MiniCssExtractPlugin {
486485      } 
487486    } 
488487
489-     // @ts -expect-error 
490488    cssDependencyCache . set ( webpack ,  CssDependency ) ; 
491489
492490    webpack . util . serialization . register ( 
@@ -525,7 +523,6 @@ class MiniCssExtractPlugin {
525523      } , 
526524    ) ; 
527525
528-     // @ts -expect-error 
529526    return  CssDependency ; 
530527  } 
531528
@@ -574,7 +571,6 @@ class MiniCssExtractPlugin {
574571      filename : DEFAULT_FILENAME , 
575572      ignoreOrder : false , 
576573      // TODO remove in the next major release 
577- 
578574      experimentalUseImportModule : undefined , 
579575      runtime : true , 
580576      ...options , 
@@ -639,7 +635,7 @@ class MiniCssExtractPlugin {
639635    )  { 
640636      /** @type  {Compiler["options"]["experiments"] & { executeModule?: boolean } } */ 
641637
642-       // @ts -expect-error 
638+       // @ts -expect-error TODO remove in the next major release  
643639      compiler . options . experiments . executeModule  =  true ; 
644640    } 
645641
@@ -692,7 +688,7 @@ class MiniCssExtractPlugin {
692688      class  CssModuleFactory  { 
693689        /** 
694690         * @param  {{ dependencies: Dependency[] } } dependencies 
695-          * @param  {(arg0 ?: Error, arg1 ?: TODO ) => void } callback 
691+          * @param  {(err ?: null |  Error, result ?: CssModule ) => void } callback 
696692         */ 
697693
698694        create ( {  dependencies : [ dependency ]  } ,  callback )  { 
@@ -705,6 +701,7 @@ class MiniCssExtractPlugin {
705701
706702      compilation . dependencyFactories . set ( 
707703        CssDependency , 
704+         // @ts -expect-error TODO fix in the next major release and fix using `CssModuleFactory extends webpack.ModuleFactory` 
708705        new  CssModuleFactory ( ) , 
709706      ) ; 
710707
@@ -722,7 +719,7 @@ class MiniCssExtractPlugin {
722719        /** 
723720         * @param  {ReturnType<Compilation["getRenderManifest"]> } result result 
724721         * @param  {Parameters<Compilation["getRenderManifest"]>[0] } chunk chunk 
725-          * @returns  {TODO } a rendered manifest 
722+          * @returns  {ReturnType<Compilation["getRenderManifest"]> } a rendered manifest 
726723         */ 
727724        ( result ,  {  chunk } )  =>  { 
728725          const  {  chunkGraph }  =  compilation ; 
@@ -731,7 +728,7 @@ class MiniCssExtractPlugin {
731728          // We don't need hot update chunks for css 
732729          // We will use the real asset instead to update 
733730          if  ( chunk  instanceof  HotUpdateChunk )  { 
734-             return ; 
731+             return   result ; 
735732          } 
736733
737734          const  renderedModules  = 
@@ -774,6 +771,8 @@ class MiniCssExtractPlugin {
774771              hash : chunk . contentHash [ MODULE_TYPE ] , 
775772            } ) ; 
776773          } 
774+ 
775+           return  result ; 
777776        } , 
778777      ) ; 
779778
@@ -1232,16 +1231,16 @@ class MiniCssExtractPlugin {
12321231            `${ RuntimeGlobals . require }  .miniCssF` , 
12331232            /** 
12341233             * @param  {Chunk } referencedChunk a referenced chunk 
1235-              * @returns  {TODO } a template value 
1234+              * @returns  {ReturnType<import("webpack").runtime.GetChunkFilenameRuntimeModule["getFilenameForChunk"]> } a template value 
12361235             */ 
12371236            ( referencedChunk )  =>  { 
12381237              if  ( ! referencedChunk . contentHash [ MODULE_TYPE ] )  { 
12391238                return  false ; 
12401239              } 
12411240
12421241              return  referencedChunk . canBeInitial ( ) 
1243-                 ? this . options . filename 
1244-                 : this . options . chunkFilename ; 
1242+                 ? /**  @type  { Filename } */   ( this . options . filename ) 
1243+                 : /**  @type  { ChunkFilename } */   ( this . options . chunkFilename ) ; 
12451244            } , 
12461245            set . has ( RuntimeGlobals . hmrDownloadUpdateHandlers ) , 
12471246          ) , 
0 commit comments