webpack 5.107.0 → 5.107.2

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 (64) hide show
  1. package/lib/BannerPlugin.js +3 -4
  2. package/lib/Chunk.js +21 -25
  3. package/lib/ChunkGroup.js +57 -15
  4. package/lib/Compilation.js +33 -11
  5. package/lib/Compiler.js +27 -3
  6. package/lib/ContextModuleFactory.js +45 -38
  7. package/lib/EvalSourceMapDevToolPlugin.js +0 -1
  8. package/lib/ExportsInfo.js +30 -34
  9. package/lib/ExternalModule.js +15 -11
  10. package/lib/ExternalModuleFactoryPlugin.js +2 -1
  11. package/lib/Module.js +1 -1
  12. package/lib/ModuleNotFoundError.js +10 -0
  13. package/lib/ModuleSourceTypeConstants.js +24 -22
  14. package/lib/MultiCompiler.js +14 -0
  15. package/lib/NormalModule.js +531 -53
  16. package/lib/NormalModuleFactory.js +38 -26
  17. package/lib/ProgressPlugin.js +1 -1
  18. package/lib/RuntimePlugin.js +1 -1
  19. package/lib/SourceMapDevToolPlugin.js +335 -57
  20. package/lib/Template.js +1 -1
  21. package/lib/TemplatedPathPlugin.js +22 -4
  22. package/lib/asset/AssetBytesGenerator.js +6 -6
  23. package/lib/asset/AssetGenerator.js +14 -14
  24. package/lib/asset/AssetModulesPlugin.js +3 -7
  25. package/lib/asset/AssetSourceGenerator.js +6 -6
  26. package/lib/buildChunkGraph.js +24 -2
  27. package/lib/cache/getLazyHashedEtag.js +9 -2
  28. package/lib/css/CssModulesPlugin.js +2 -2
  29. package/lib/dependencies/CommonJsImportsParserPlugin.js +108 -1
  30. package/lib/dependencies/CssUrlDependency.js +3 -2
  31. package/lib/dependencies/HarmonyDetectionParserPlugin.js +21 -1
  32. package/lib/dependencies/HarmonyExportInitFragment.js +8 -9
  33. package/lib/dependencies/HtmlInlineScriptDependency.js +3 -14
  34. package/lib/dependencies/HtmlInlineStyleDependency.js +17 -0
  35. package/lib/dependencies/HtmlScriptSrcDependency.js +265 -65
  36. package/lib/dependencies/HtmlSourceDependency.js +21 -2
  37. package/lib/dependencies/WorkerPlugin.js +18 -4
  38. package/lib/hmr/LazyCompilationPlugin.js +104 -0
  39. package/lib/html/HtmlGenerator.js +81 -33
  40. package/lib/html/HtmlModulesPlugin.js +87 -28
  41. package/lib/html/walkHtmlTokens.js +641 -125
  42. package/lib/index.js +2 -0
  43. package/lib/javascript/JavascriptModulesPlugin.js +2 -2
  44. package/lib/javascript/JavascriptParser.js +1 -1
  45. package/lib/library/ModuleLibraryPlugin.js +30 -24
  46. package/lib/node/NodeWatchFileSystem.js +37 -22
  47. package/lib/optimize/ConcatenatedModule.js +3 -2
  48. package/lib/optimize/SideEffectsFlagPlugin.js +1 -2
  49. package/lib/optimize/SplitChunksPlugin.js +4 -4
  50. package/lib/runtime/AutoPublicPathRuntimeModule.js +3 -3
  51. package/lib/runtime/GetChunkFilenameRuntimeModule.js +5 -5
  52. package/lib/sharing/ConsumeSharedPlugin.js +2 -8
  53. package/lib/sharing/ProvideSharedPlugin.js +4 -4
  54. package/lib/util/fs.js +6 -1
  55. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +1 -2
  56. package/package.json +5 -5
  57. package/schemas/WebpackOptions.check.js +1 -1
  58. package/schemas/WebpackOptions.json +11 -9
  59. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  60. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  61. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  62. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  63. package/schemas/plugins/container/ModuleFederationPlugin.json +1 -0
  64. package/types.d.ts +472 -149
package/types.d.ts CHANGED
@@ -327,9 +327,9 @@ declare interface AllCodeGenerationSchemas {
327
327
  chunkInitFragments: InitFragment<any>[];
328
328
 
329
329
  /**
330
- * url for css and javascript modules
330
+ * url for asset modules
331
331
  */
332
- url: { javascript?: string; "css-url"?: string };
332
+ url: { javascript?: string; "asset-url"?: string };
333
333
 
334
334
  /**
335
335
  * a filename for asset modules
@@ -435,7 +435,7 @@ declare abstract class AssetBytesGenerator extends Generator {
435
435
  }
436
436
  declare abstract class AssetBytesParser extends ParserClass {}
437
437
  declare interface AssetDependencyMeta {
438
- sourceType: "css-url";
438
+ sourceType: "asset-url" | "css-url";
439
439
  }
440
440
 
441
441
  /**
@@ -459,9 +459,9 @@ declare abstract class AssetGenerator extends Generator {
459
459
  source: string | Buffer,
460
460
  context: { filename: string; module: Module }
461
461
  ) => string);
462
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
463
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
464
- outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
462
+ filename?: string | TemplatePathFn<PathDataModule>;
463
+ publicPath?: string | TemplatePathFn<PathData>;
464
+ outputPath?: string | TemplatePathFn<PathDataModule>;
465
465
  emit?: boolean;
466
466
 
467
467
  /**
@@ -571,19 +571,19 @@ declare interface AssetResourceGeneratorOptions {
571
571
  emit?: boolean;
572
572
 
573
573
  /**
574
- * Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
574
+ * The filename of asset modules as relative path inside the 'output.path' directory.
575
575
  */
576
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
576
+ filename?: string | TemplatePathFn<PathDataModule>;
577
577
 
578
578
  /**
579
579
  * Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
580
580
  */
581
- outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
581
+ outputPath?: string | TemplatePathFn<PathDataModule>;
582
582
 
583
583
  /**
584
584
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
585
585
  */
586
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
586
+ publicPath?: string | TemplatePathFn<PathData>;
587
587
  }
588
588
  declare abstract class AssetSourceGenerator extends Generator {
589
589
  /**
@@ -1426,7 +1426,9 @@ declare interface CacheGroupSource {
1426
1426
  minChunks?: number;
1427
1427
  maxAsyncRequests?: number;
1428
1428
  maxInitialRequests?: number;
1429
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
1429
+ filename?:
1430
+ | string
1431
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
1430
1432
  idHint?: string;
1431
1433
  automaticNameDelimiter?: string;
1432
1434
  reuseExistingChunk?: boolean;
@@ -1563,10 +1565,10 @@ declare class Chunk {
1563
1565
  preventIntegration: boolean;
1564
1566
  filenameTemplate?:
1565
1567
  | string
1566
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
1568
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
1567
1569
  cssFilenameTemplate?:
1568
1570
  | string
1569
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
1571
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
1570
1572
  runtime: RuntimeSpec;
1571
1573
  files: Set<string>;
1572
1574
  auxiliaryFiles: Set<string>;
@@ -1833,6 +1835,9 @@ declare interface ChunkConditionMap {
1833
1835
  [index: number]: boolean;
1834
1836
  [index: string]: boolean;
1835
1837
  }
1838
+ type ChunkFilenameTemplate =
1839
+ | string
1840
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
1836
1841
  declare class ChunkGraph {
1837
1842
  /**
1838
1843
  * Creates an instance of ChunkGraph.
@@ -2525,6 +2530,18 @@ declare abstract class ChunkGroup {
2525
2530
  */
2526
2531
  compareTo(chunkGraph: ChunkGraph, otherGroup: ChunkGroup): 0 | 1 | -1;
2527
2532
 
2533
+ /**
2534
+ * Aggregates per-block `*Order` options for the blocks that bridge this
2535
+ * chunk group to the given child chunk group. `*Order` options are tied to
2536
+ * the originating `import()` call and must not be sourced from the child's
2537
+ * shared options, otherwise a webpackPrefetch/Preload directive from one
2538
+ * parent would leak into other parents that share the child by name.
2539
+ */
2540
+ getChildOrderOptions(
2541
+ childGroup: ChunkGroup,
2542
+ chunkGraph: ChunkGraph
2543
+ ): Record<string, number>;
2544
+
2528
2545
  /**
2529
2546
  * Groups child chunk groups by their `*Order` options and sorts each group
2530
2547
  * by descending order and deterministic chunk-group comparison.
@@ -2869,6 +2886,22 @@ declare interface CleanPluginCompilationHooks {
2869
2886
  */
2870
2887
  keep: SyncBailHook<[string], boolean | void>;
2871
2888
  }
2889
+ declare interface ClearCacheOptions {
2890
+ /**
2891
+ * drop cached source maps (default `true`)
2892
+ */
2893
+ maps?: boolean;
2894
+
2895
+ /**
2896
+ * drop cached source/buffer copies (default `true`)
2897
+ */
2898
+ source?: boolean;
2899
+
2900
+ /**
2901
+ * drop the parsed object form of cached source maps on `SourceMapSource` instances (default `false` — re-parsing JSON is significantly more expensive than `toString`). Only takes effect when a serialized form (buffer or string) is also retained, so the data remains recoverable.
2902
+ */
2903
+ parsedMap?: boolean;
2904
+ }
2872
2905
  declare interface CodeGenMapOverloads {
2873
2906
  get: <K extends string>(key: K) => undefined | CodeGenValue<K>;
2874
2907
  set: <K extends string>(
@@ -3740,27 +3773,33 @@ declare class Compilation {
3740
3773
  /**
3741
3774
  * Returns interpolated path.
3742
3775
  */
3743
- getPath(filename: TemplatePath, data?: PathData): string;
3776
+ getPath<T extends PathData = PathData>(
3777
+ filename: string | TemplatePathFn<T>,
3778
+ data?: T
3779
+ ): string;
3744
3780
 
3745
3781
  /**
3746
3782
  * Gets path with info.
3747
3783
  */
3748
- getPathWithInfo(
3749
- filename: TemplatePath,
3750
- data?: PathData
3784
+ getPathWithInfo<T extends PathData = PathData>(
3785
+ filename: string | TemplatePathFn<T>,
3786
+ data?: T
3751
3787
  ): InterpolatedPathAndAssetInfo;
3752
3788
 
3753
3789
  /**
3754
3790
  * Returns interpolated path.
3755
3791
  */
3756
- getAssetPath(filename: TemplatePath, data: PathData): string;
3792
+ getAssetPath<T extends PathData = PathData>(
3793
+ filename: string | TemplatePathFn<T>,
3794
+ data: T
3795
+ ): string;
3757
3796
 
3758
3797
  /**
3759
3798
  * Gets asset path with info.
3760
3799
  */
3761
- getAssetPathWithInfo(
3762
- filename: TemplatePath,
3763
- data: PathData
3800
+ getAssetPathWithInfo<T extends PathData = PathData>(
3801
+ filename: string | TemplatePathFn<T>,
3802
+ data: T
3764
3803
  ): InterpolatedPathAndAssetInfo;
3765
3804
  getWarnings(): Error[];
3766
3805
  getErrors(): Error[];
@@ -4015,6 +4054,27 @@ declare interface CompiledAliasOption {
4015
4054
  */
4016
4055
  arrayAlias: boolean;
4017
4056
  }
4057
+ declare interface CompiledAliasOptions {
4058
+ /**
4059
+ * declaration-ordered list
4060
+ */
4061
+ all: CompiledAliasOption[];
4062
+
4063
+ /**
4064
+ * bucketed by first char code
4065
+ */
4066
+ byFirstChar: Map<number, CompiledAliasOption[]>;
4067
+
4068
+ /**
4069
+ * true when an empty-prefix wildcard is present
4070
+ */
4071
+ hasAnyFirstChar: boolean;
4072
+
4073
+ /**
4074
+ * true when the bucket fast-path should be used at resolve time
4075
+ */
4076
+ useBuckets: boolean;
4077
+ }
4018
4078
  declare class Compiler {
4019
4079
  /**
4020
4080
  * Creates an instance of Compiler.
@@ -4417,7 +4477,7 @@ declare interface Configuration {
4417
4477
  /**
4418
4478
  * Which asset type should receive this devtool value.
4419
4479
  */
4420
- type: "all" | "javascript" | "css";
4480
+ type: "css" | "all" | "javascript";
4421
4481
  /**
4422
4482
  * A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
4423
4483
  */
@@ -4497,6 +4557,7 @@ declare interface Configuration {
4497
4557
  | "script"
4498
4558
  | "node-commonjs"
4499
4559
  | "asset"
4560
+ | "asset-url"
4500
4561
  | "css-import"
4501
4562
  | "css-url";
4502
4563
 
@@ -5021,6 +5082,89 @@ declare interface ContextTimestampAndHash {
5021
5082
  symlinks?: Set<string>;
5022
5083
  }
5023
5084
  type ContextTypes = KnownContext & Record<any, any>;
5085
+
5086
+ declare interface CreateData {
5087
+ /**
5088
+ * an optional layer in which the module is
5089
+ */
5090
+ layer?: string;
5091
+
5092
+ /**
5093
+ * module type. When deserializing, this is set to an empty string "".
5094
+ */
5095
+ type: string;
5096
+
5097
+ /**
5098
+ * request string
5099
+ */
5100
+ request: string;
5101
+
5102
+ /**
5103
+ * request intended by user (without loaders from config)
5104
+ */
5105
+ userRequest: string;
5106
+
5107
+ /**
5108
+ * request without resolving
5109
+ */
5110
+ rawRequest: string;
5111
+
5112
+ /**
5113
+ * list of loaders
5114
+ */
5115
+ loaders: LoaderItem[];
5116
+
5117
+ /**
5118
+ * path + query of the real resource
5119
+ */
5120
+ resource: string;
5121
+
5122
+ /**
5123
+ * resource resolve data
5124
+ */
5125
+ resourceResolveData?: ResourceSchemeData & Partial<ResolveRequest>;
5126
+
5127
+ /**
5128
+ * context directory for resolving
5129
+ */
5130
+ context: string;
5131
+
5132
+ /**
5133
+ * path + query of the matched resource (virtual)
5134
+ */
5135
+ matchResource?: string;
5136
+
5137
+ /**
5138
+ * the parser used
5139
+ */
5140
+ parser: ParserClass;
5141
+
5142
+ /**
5143
+ * the options of the parser used
5144
+ */
5145
+ parserOptions?: ParserOptions;
5146
+
5147
+ /**
5148
+ * the generator used
5149
+ */
5150
+ generator: Generator;
5151
+
5152
+ /**
5153
+ * the options of the generator used
5154
+ */
5155
+ generatorOptions?: GeneratorOptions;
5156
+
5157
+ /**
5158
+ * options used for resolving requests from this module
5159
+ */
5160
+ resolveOptions?: ResolveOptions;
5161
+
5162
+ /**
5163
+ * enable/disable extracting source map
5164
+ */
5165
+ extractSourceMap: boolean;
5166
+ settings: ModuleSettings;
5167
+ }
5024
5168
  type CreateReadStreamFSImplementation = FSImplementation & {
5025
5169
  read: (...args: any[]) => any;
5026
5170
  };
@@ -5264,9 +5408,7 @@ declare interface CssModuleGeneratorOptions {
5264
5408
  /**
5265
5409
  * Configure the generated local ident name.
5266
5410
  */
5267
- localIdentName?:
5268
- | string
5269
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
5411
+ localIdentName?: string | TemplatePathFn<PathDataModule>;
5270
5412
  }
5271
5413
 
5272
5414
  /**
@@ -5379,7 +5521,7 @@ declare class CssModulesPlugin {
5379
5521
  static getChunkFilenameTemplate(
5380
5522
  chunk: Chunk,
5381
5523
  outputOptions: OutputNormalizedWithDefaults
5382
- ): TemplatePath;
5524
+ ): ChunkFilenameTemplate;
5383
5525
 
5384
5526
  /**
5385
5527
  * Returns true, when the chunk has css.
@@ -6480,7 +6622,7 @@ declare interface EntryDescription {
6480
6622
  /**
6481
6623
  * Specifies the filename of the output file on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
6482
6624
  */
6483
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
6625
+ filename?: string | TemplatePathFn<PathDataChunk>;
6484
6626
 
6485
6627
  /**
6486
6628
  * Module(s) that are loaded upon startup.
@@ -6500,7 +6642,7 @@ declare interface EntryDescription {
6500
6642
  /**
6501
6643
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
6502
6644
  */
6503
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
6645
+ publicPath?: string | TemplatePathFn<PathData>;
6504
6646
 
6505
6647
  /**
6506
6648
  * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
@@ -6540,7 +6682,7 @@ declare interface EntryDescriptionNormalized {
6540
6682
  /**
6541
6683
  * Specifies the filename of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
6542
6684
  */
6543
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
6685
+ filename?: string | TemplatePathFn<PathDataChunk>;
6544
6686
 
6545
6687
  /**
6546
6688
  * Module(s) that are loaded upon startup. The last one is exported.
@@ -6560,7 +6702,7 @@ declare interface EntryDescriptionNormalized {
6560
6702
  /**
6561
6703
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
6562
6704
  */
6563
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
6705
+ publicPath?: string | TemplatePathFn<PathData>;
6564
6706
 
6565
6707
  /**
6566
6708
  * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
@@ -7114,6 +7256,7 @@ declare abstract class ExportInfo {
7114
7256
  * Sets used without info.
7115
7257
  */
7116
7258
  setUsedWithoutInfo(runtime: RuntimeSpec): boolean;
7259
+ setHasProvideInfo(): void;
7117
7260
  setHasUseInfo(): void;
7118
7261
 
7119
7262
  /**
@@ -7788,6 +7931,7 @@ declare class ExternalsPlugin {
7788
7931
  | "script"
7789
7932
  | "node-commonjs"
7790
7933
  | "asset"
7934
+ | "asset-url"
7791
7935
  | "css-import"
7792
7936
  | "css-url"
7793
7937
  | ((dependency: Dependency) => ExternalsType),
@@ -7817,6 +7961,7 @@ declare class ExternalsPlugin {
7817
7961
  | "script"
7818
7962
  | "node-commonjs"
7819
7963
  | "asset"
7964
+ | "asset-url"
7820
7965
  | "css-import"
7821
7966
  | "css-url"
7822
7967
  | ((dependency: Dependency) => ExternalsType);
@@ -7905,6 +8050,7 @@ type ExternalsType =
7905
8050
  | "script"
7906
8051
  | "node-commonjs"
7907
8052
  | "asset"
8053
+ | "asset-url"
7908
8054
  | "css-import"
7909
8055
  | "css-url";
7910
8056
 
@@ -8482,14 +8628,17 @@ declare class GetChunkFilenameRuntimeModule extends RuntimeModule {
8482
8628
  ) =>
8483
8629
  | string
8484
8630
  | false
8485
- | ((pathData: PathData, assetInfo?: AssetInfo) => string),
8631
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string),
8486
8632
  allChunks: boolean
8487
8633
  );
8488
8634
  contentType: string;
8489
8635
  global: string;
8490
8636
  getFilenameForChunk: (
8491
8637
  chunk: Chunk
8492
- ) => string | false | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8638
+ ) =>
8639
+ | string
8640
+ | false
8641
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
8493
8642
  allChunks: boolean;
8494
8643
 
8495
8644
  /**
@@ -9546,7 +9695,10 @@ declare interface InputFileSystem {
9546
9695
  ) => void
9547
9696
  ) => void;
9548
9697
  readJsonSync?: (pathOrFileDescriptor: PathOrFileDescriptorFs) => JsonObjectFs;
9549
- purge?: (value?: string | string[] | Set<string>) => void;
9698
+ purge?: (
9699
+ value?: string | string[] | Set<string>,
9700
+ options?: { exact?: boolean }
9701
+ ) => void;
9550
9702
  join?: (path1: string, path2: string) => string;
9551
9703
  relative?: (from: string, to: string) => string;
9552
9704
  dirname?: (dirname: string) => string;
@@ -9756,7 +9908,7 @@ declare class JavascriptModulesPlugin {
9756
9908
  static getChunkFilenameTemplate(
9757
9909
  chunk: Chunk,
9758
9910
  outputOptions: OutputNormalizedWithDefaults
9759
- ): TemplatePath;
9911
+ ): ChunkFilenameTemplate;
9760
9912
  static chunkHasJs: (chunk: Chunk, chunkGraph: ChunkGraph) => boolean;
9761
9913
  }
9762
9914
  declare class JavascriptParser extends ParserClass {
@@ -14595,6 +14747,7 @@ declare interface ModuleFederationPluginOptions {
14595
14747
  | "script"
14596
14748
  | "node-commonjs"
14597
14749
  | "asset"
14750
+ | "asset-url"
14598
14751
  | "css-import"
14599
14752
  | "css-url";
14600
14753
 
@@ -15910,7 +16063,7 @@ declare interface NodeTemplatePluginOptions {
15910
16063
  type NodeWebpackOptions = false | NodeOptions;
15911
16064
  type NonNullable<T> = T & {};
15912
16065
  declare class NormalModule extends Module {
15913
- constructor(__0: NormalModuleCreateData);
16066
+ constructor(__0: NormalModuleCreateDataNormalModuleObject_1<string>);
15914
16067
  request: string;
15915
16068
  userRequest: string;
15916
16069
  rawRequest: string;
@@ -16006,7 +16159,9 @@ declare interface NormalModuleCompilationHooks {
16006
16159
  >;
16007
16160
  needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
16008
16161
  }
16009
- declare interface NormalModuleCreateData {
16162
+ declare interface NormalModuleCreateDataNormalModuleObject_1<
16163
+ T extends string = string
16164
+ > {
16010
16165
  /**
16011
16166
  * an optional layer in which the module is
16012
16167
  */
@@ -16015,7 +16170,7 @@ declare interface NormalModuleCreateData {
16015
16170
  /**
16016
16171
  * module type. When deserializing, this is set to an empty string "".
16017
16172
  */
16018
- type: string;
16173
+ type: T;
16019
16174
 
16020
16175
  /**
16021
16176
  * request string
@@ -16060,22 +16215,86 @@ declare interface NormalModuleCreateData {
16060
16215
  /**
16061
16216
  * the parser used
16062
16217
  */
16063
- parser: ParserClass;
16218
+ parser: (Record<"javascript/auto", JavascriptParser> &
16219
+ Record<"javascript/dynamic", JavascriptParser> &
16220
+ Record<"javascript/esm", JavascriptParser> &
16221
+ Record<"json", JsonParser> &
16222
+ Record<"asset", AssetParser> &
16223
+ Record<"asset/inline", AssetParser> &
16224
+ Record<"asset/resource", AssetParser> &
16225
+ Record<"asset/source", AssetSourceParser> &
16226
+ Record<"asset/bytes", AssetBytesParser> &
16227
+ Record<"webassembly/async", AsyncWebAssemblyParser> &
16228
+ Record<"webassembly/sync", WebAssemblyParser> &
16229
+ Record<"css", CssParser> &
16230
+ Record<"css/auto", CssParser> &
16231
+ Record<"css/module", CssParser> &
16232
+ Record<"css/global", CssParser> &
16233
+ Record<"html", HtmlParser> &
16234
+ Record<string, ParserClass>)[T];
16064
16235
 
16065
16236
  /**
16066
16237
  * the options of the parser used
16067
16238
  */
16068
- parserOptions?: ParserOptions;
16239
+ parserOptions?: (Record<"javascript/auto", JavascriptParserOptions> &
16240
+ Record<"javascript/dynamic", JavascriptParserOptions> &
16241
+ Record<"javascript/esm", JavascriptParserOptions> &
16242
+ Record<"json", JsonParserOptions> &
16243
+ Record<"asset", AssetParserOptions> &
16244
+ Record<"asset/inline", EmptyParserOptions> &
16245
+ Record<"asset/resource", EmptyParserOptions> &
16246
+ Record<"asset/source", EmptyParserOptions> &
16247
+ Record<"asset/bytes", EmptyParserOptions> &
16248
+ Record<"webassembly/async", EmptyParserOptions> &
16249
+ Record<"webassembly/sync", EmptyParserOptions> &
16250
+ Record<"css", CssParserOptions> &
16251
+ Record<"css/auto", CssModuleParserOptions> &
16252
+ Record<"css/module", CssModuleParserOptions> &
16253
+ Record<"css/global", CssModuleParserOptions> &
16254
+ Record<"html", EmptyParserOptions> &
16255
+ Record<string, ParserOptions>)[T];
16069
16256
 
16070
16257
  /**
16071
16258
  * the generator used
16072
16259
  */
16073
- generator: Generator;
16260
+ generator: (Record<"javascript/auto", JavascriptGenerator> &
16261
+ Record<"javascript/dynamic", JavascriptGenerator> &
16262
+ Record<"javascript/esm", JavascriptGenerator> &
16263
+ Record<"json", JsonGenerator> &
16264
+ Record<"asset", AssetGenerator> &
16265
+ Record<"asset/inline", AssetGenerator> &
16266
+ Record<"asset/resource", AssetGenerator> &
16267
+ Record<"asset/source", AssetSourceGenerator> &
16268
+ Record<"asset/bytes", AssetBytesGenerator> &
16269
+ Record<"webassembly/async", Generator> &
16270
+ Record<"webassembly/sync", Generator> &
16271
+ Record<"css", CssGenerator> &
16272
+ Record<"css/auto", CssGenerator> &
16273
+ Record<"css/module", CssGenerator> &
16274
+ Record<"css/global", CssGenerator> &
16275
+ Record<"html", HtmlGenerator> &
16276
+ Record<string, Generator>)[T];
16074
16277
 
16075
16278
  /**
16076
16279
  * the options of the generator used
16077
16280
  */
16078
- generatorOptions?: GeneratorOptions;
16281
+ generatorOptions?: (Record<"javascript/auto", EmptyGeneratorOptions> &
16282
+ Record<"javascript/dynamic", EmptyGeneratorOptions> &
16283
+ Record<"javascript/esm", EmptyGeneratorOptions> &
16284
+ Record<"json", JsonGeneratorOptions> &
16285
+ Record<"asset", AssetGeneratorOptions> &
16286
+ Record<"asset/inline", AssetGeneratorOptions> &
16287
+ Record<"asset/resource", AssetGeneratorOptions> &
16288
+ Record<"asset/source", EmptyGeneratorOptions> &
16289
+ Record<"asset/bytes", EmptyGeneratorOptions> &
16290
+ Record<"webassembly/async", EmptyGeneratorOptions> &
16291
+ Record<"webassembly/sync", EmptyGeneratorOptions> &
16292
+ Record<"css", CssGeneratorOptions> &
16293
+ Record<"css/auto", CssModuleGeneratorOptions> &
16294
+ Record<"css/module", CssModuleGeneratorOptions> &
16295
+ Record<"css/global", CssModuleGeneratorOptions> &
16296
+ Record<"html", HtmlGeneratorOptions> &
16297
+ Record<string, GeneratorOptions>)[T];
16079
16298
 
16080
16299
  /**
16081
16300
  * options used for resolving requests from this module
@@ -16099,21 +16318,8 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16099
16318
  factorize: AsyncSeriesBailHook<[ResolveData], undefined | Module>;
16100
16319
  beforeResolve: AsyncSeriesBailHook<[ResolveData], false | void>;
16101
16320
  afterResolve: AsyncSeriesBailHook<[ResolveData], false | void>;
16102
- createModule: AsyncSeriesBailHook<
16103
- [
16104
- Partial<NormalModuleCreateData & { settings: ModuleSettings }>,
16105
- ResolveData
16106
- ],
16107
- void | Module
16108
- >;
16109
- module: SyncWaterfallHook<
16110
- [
16111
- Module,
16112
- Partial<NormalModuleCreateData & { settings: ModuleSettings }>,
16113
- ResolveData
16114
- ],
16115
- Module
16116
- >;
16321
+ createModule: AsyncSeriesBailHook<[CreateData, ResolveData], void | Module>;
16322
+ module: SyncWaterfallHook<[Module, CreateData, ResolveData], Module>;
16117
16323
  createParser: TypedHookMap<
16118
16324
  Record<
16119
16325
  "javascript/auto",
@@ -16254,11 +16460,11 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16254
16460
  > &
16255
16461
  Record<
16256
16462
  "webassembly/async",
16257
- SyncBailHook<[EmptyParserOptions], Generator>
16463
+ SyncBailHook<[EmptyGeneratorOptions], Generator>
16258
16464
  > &
16259
16465
  Record<
16260
16466
  "webassembly/sync",
16261
- SyncBailHook<[EmptyParserOptions], Generator>
16467
+ SyncBailHook<[EmptyGeneratorOptions], Generator>
16262
16468
  > &
16263
16469
  Record<"css", SyncBailHook<[CssGeneratorOptions], CssGenerator>> &
16264
16470
  Record<
@@ -16273,7 +16479,7 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16273
16479
  "css/global",
16274
16480
  SyncBailHook<[CssModuleGeneratorOptions], CssGenerator>
16275
16481
  > &
16276
- Record<"html", SyncBailHook<[EmptyGeneratorOptions], HtmlGenerator>> &
16482
+ Record<"html", SyncBailHook<[HtmlGeneratorOptions], HtmlGenerator>> &
16277
16483
  Record<string, SyncBailHook<[GeneratorOptions], Generator>>
16278
16484
  >;
16279
16485
  generator: TypedHookMap<
@@ -16315,11 +16521,11 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16315
16521
  > &
16316
16522
  Record<
16317
16523
  "webassembly/async",
16318
- SyncBailHook<[Generator, EmptyParserOptions], void>
16524
+ SyncBailHook<[Generator, EmptyGeneratorOptions], void>
16319
16525
  > &
16320
16526
  Record<
16321
16527
  "webassembly/sync",
16322
- SyncBailHook<[Generator, EmptyParserOptions], void>
16528
+ SyncBailHook<[Generator, EmptyGeneratorOptions], void>
16323
16529
  > &
16324
16530
  Record<"css", SyncBailHook<[CssGenerator, CssGeneratorOptions], void>> &
16325
16531
  Record<
@@ -16336,18 +16542,12 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16336
16542
  > &
16337
16543
  Record<
16338
16544
  "html",
16339
- SyncBailHook<[HtmlGenerator, EmptyGeneratorOptions], void>
16545
+ SyncBailHook<[HtmlGenerator, HtmlGeneratorOptions], void>
16340
16546
  > &
16341
16547
  Record<string, SyncBailHook<[Generator, GeneratorOptions], void>>
16342
16548
  >;
16343
16549
  createModuleClass: HookMap<
16344
- SyncBailHook<
16345
- [
16346
- Partial<NormalModuleCreateData & { settings: ModuleSettings }>,
16347
- ResolveData
16348
- ],
16349
- void | Module
16350
- >
16550
+ SyncBailHook<[CreateData, ResolveData], void | Module>
16351
16551
  >;
16352
16552
  }>;
16353
16553
  resolverFactory: ResolverFactory;
@@ -16389,22 +16589,98 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16389
16589
  /**
16390
16590
  * Returns parser.
16391
16591
  */
16392
- getParser(type: string, parserOptions?: ParserOptions): ParserClass;
16592
+ getParser<T extends string>(
16593
+ type: T,
16594
+ parserOptions?: ParserOptions
16595
+ ): (Record<"javascript/auto", JavascriptParser> &
16596
+ Record<"javascript/dynamic", JavascriptParser> &
16597
+ Record<"javascript/esm", JavascriptParser> &
16598
+ Record<"json", JsonParser> &
16599
+ Record<"asset", AssetParser> &
16600
+ Record<"asset/inline", AssetParser> &
16601
+ Record<"asset/resource", AssetParser> &
16602
+ Record<"asset/source", AssetSourceParser> &
16603
+ Record<"asset/bytes", AssetBytesParser> &
16604
+ Record<"webassembly/async", AsyncWebAssemblyParser> &
16605
+ Record<"webassembly/sync", WebAssemblyParser> &
16606
+ Record<"css", CssParser> &
16607
+ Record<"css/auto", CssParser> &
16608
+ Record<"css/module", CssParser> &
16609
+ Record<"css/global", CssParser> &
16610
+ Record<"html", HtmlParser> &
16611
+ Record<string, ParserClass>)[T];
16393
16612
 
16394
16613
  /**
16395
16614
  * Creates a parser from the provided type.
16396
16615
  */
16397
- createParser(type: string, parserOptions?: ParserOptions): ParserClass;
16616
+ createParser<T extends string>(
16617
+ type: T,
16618
+ parserOptions?: ParserOptions
16619
+ ): (Record<"javascript/auto", JavascriptParser> &
16620
+ Record<"javascript/dynamic", JavascriptParser> &
16621
+ Record<"javascript/esm", JavascriptParser> &
16622
+ Record<"json", JsonParser> &
16623
+ Record<"asset", AssetParser> &
16624
+ Record<"asset/inline", AssetParser> &
16625
+ Record<"asset/resource", AssetParser> &
16626
+ Record<"asset/source", AssetSourceParser> &
16627
+ Record<"asset/bytes", AssetBytesParser> &
16628
+ Record<"webassembly/async", AsyncWebAssemblyParser> &
16629
+ Record<"webassembly/sync", WebAssemblyParser> &
16630
+ Record<"css", CssParser> &
16631
+ Record<"css/auto", CssParser> &
16632
+ Record<"css/module", CssParser> &
16633
+ Record<"css/global", CssParser> &
16634
+ Record<"html", HtmlParser> &
16635
+ Record<string, ParserClass>)[T];
16398
16636
 
16399
16637
  /**
16400
16638
  * Returns generator.
16401
16639
  */
16402
- getGenerator(type: string, generatorOptions?: GeneratorOptions): Generator;
16640
+ getGenerator<T extends string>(
16641
+ type: T,
16642
+ generatorOptions?: GeneratorOptions
16643
+ ): (Record<"javascript/auto", JavascriptGenerator> &
16644
+ Record<"javascript/dynamic", JavascriptGenerator> &
16645
+ Record<"javascript/esm", JavascriptGenerator> &
16646
+ Record<"json", JsonGenerator> &
16647
+ Record<"asset", AssetGenerator> &
16648
+ Record<"asset/inline", AssetGenerator> &
16649
+ Record<"asset/resource", AssetGenerator> &
16650
+ Record<"asset/source", AssetSourceGenerator> &
16651
+ Record<"asset/bytes", AssetBytesGenerator> &
16652
+ Record<"webassembly/async", Generator> &
16653
+ Record<"webassembly/sync", Generator> &
16654
+ Record<"css", CssGenerator> &
16655
+ Record<"css/auto", CssGenerator> &
16656
+ Record<"css/module", CssGenerator> &
16657
+ Record<"css/global", CssGenerator> &
16658
+ Record<"html", HtmlGenerator> &
16659
+ Record<string, Generator>)[T];
16403
16660
 
16404
16661
  /**
16405
16662
  * Creates a generator.
16406
16663
  */
16407
- createGenerator(type: string, generatorOptions?: GeneratorOptions): Generator;
16664
+ createGenerator<T extends string>(
16665
+ type: T,
16666
+ generatorOptions?: GeneratorOptions
16667
+ ): (Record<"javascript/auto", JavascriptGenerator> &
16668
+ Record<"javascript/dynamic", JavascriptGenerator> &
16669
+ Record<"javascript/esm", JavascriptGenerator> &
16670
+ Record<"json", JsonGenerator> &
16671
+ Record<"asset", AssetGenerator> &
16672
+ Record<"asset/inline", AssetGenerator> &
16673
+ Record<"asset/resource", AssetGenerator> &
16674
+ Record<"asset/source", AssetSourceGenerator> &
16675
+ Record<"asset/bytes", AssetBytesGenerator> &
16676
+ Record<"webassembly/async", Generator> &
16677
+ Record<"webassembly/sync", Generator> &
16678
+ Record<"css", CssGenerator> &
16679
+ Record<"css/auto", CssGenerator> &
16680
+ Record<"css/module", CssGenerator> &
16681
+ Record<"css/global", CssGenerator> &
16682
+ Record<"html", HtmlGenerator> &
16683
+ Record<string, Generator>)[T];
16408
16684
 
16409
16685
  /**
16410
16686
  * Returns the resolver.
@@ -16420,11 +16696,55 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
16420
16696
  */
16421
16697
  declare interface NormalModuleLoaderContext<OptionsType> {
16422
16698
  version: number;
16699
+
16700
+ /**
16701
+ * Extracts and parses the options of the current loader.
16702
+ * Parses string options as JSON or a query string.
16703
+ * Extracts and parses the options of the current loader.
16704
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16705
+ */
16706
+
16707
+ /**
16708
+ * Extracts and parses the options of the current loader.
16709
+ * Parses string options as JSON or a query string.
16710
+ */
16423
16711
  getOptions(): OptionsType;
16712
+
16713
+ /**
16714
+ * Extracts and parses the options of the current loader.
16715
+ * Parses string options as JSON or a query string.
16716
+ * Extracts and parses the options of the current loader.
16717
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16718
+ */
16719
+
16720
+ /**
16721
+ * Extracts and parses the options of the current loader.
16722
+ * Parses string options as JSON or a query string, and optionally validates them against a provided schema.
16723
+ */
16424
16724
  getOptions(schema: Parameters<typeof validateFunction>[0]): OptionsType;
16425
- emitWarning(warning: Error): void;
16426
- emitError(error: Error): void;
16725
+
16726
+ /**
16727
+ * Emits a warning for this module.
16728
+ * The warning will be displayed to the user during compilation.
16729
+ */
16730
+ emitWarning(warning: string | Error): void;
16731
+
16732
+ /**
16733
+ * Emits an error for this module.
16734
+ * The error will be displayed to the user and typically causes the compilation to fail.
16735
+ */
16736
+ emitError(error: string | Error): void;
16737
+
16738
+ /**
16739
+ * Gets a logger instance scoped to this loader and module.
16740
+ * Useful for emitting debug or compilation information in a structured way.
16741
+ */
16427
16742
  getLogger(name?: string): WebpackLogger;
16743
+
16744
+ /**
16745
+ * Resolves a module request (e.g., a relative path or module name) to an absolute file path.
16746
+ * It uses Webpack's internal resolver, taking into account configured aliases and extensions.
16747
+ */
16428
16748
  resolve(
16429
16749
  context: string,
16430
16750
  request: string,
@@ -16434,6 +16754,11 @@ declare interface NormalModuleLoaderContext<OptionsType> {
16434
16754
  req?: ResolveRequest
16435
16755
  ) => void
16436
16756
  ): void;
16757
+
16758
+ /**
16759
+ * Creates a resolve function with specific options.
16760
+ * The returned function can be used as a Promise-based resolver or a callback-based resolver.
16761
+ */
16437
16762
  getResolve(options?: ResolveOptionsWithDependencyType): {
16438
16763
  (
16439
16764
  context: string,
@@ -16446,6 +16771,11 @@ declare interface NormalModuleLoaderContext<OptionsType> {
16446
16771
  ): void;
16447
16772
  (context: string, request: string): Promise<string>;
16448
16773
  };
16774
+
16775
+ /**
16776
+ * Emits a new file (asset) to the compilation output directory.
16777
+ * This allows loaders to generate additional files alongside the main module output.
16778
+ */
16449
16779
  emitFile(
16450
16780
  name: string,
16451
16781
  content: string | Buffer,
@@ -17081,7 +17411,7 @@ declare interface OptimizationSplitChunksCacheGroup {
17081
17411
  /**
17082
17412
  * Sets the template for the filename for created chunks.
17083
17413
  */
17084
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17414
+ filename?: string | TemplatePathFn<PathDataChunk>;
17085
17415
 
17086
17416
  /**
17087
17417
  * Sets the hint for chunk id.
@@ -17263,7 +17593,7 @@ declare interface OptimizationSplitChunksOptions {
17263
17593
  /**
17264
17594
  * Sets the template for the filename for created chunks.
17265
17595
  */
17266
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17596
+ filename?: string | TemplatePathFn<PathDataChunk>;
17267
17597
 
17268
17598
  /**
17269
17599
  * Prevents exposing path info when creating names for parts splitted by maxSize.
@@ -17414,9 +17744,7 @@ declare interface Output {
17414
17744
  /**
17415
17745
  * The filename of asset modules as relative path inside the 'output.path' directory.
17416
17746
  */
17417
- assetModuleFilename?:
17418
- | string
17419
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17747
+ assetModuleFilename?: string | TemplatePathFn<PathDataModule>;
17420
17748
 
17421
17749
  /**
17422
17750
  * Enable/disable creating async chunks that are loaded on demand.
@@ -17436,9 +17764,7 @@ declare interface Output {
17436
17764
  /**
17437
17765
  * Specifies the filename template of output files of non-initial chunks on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17438
17766
  */
17439
- chunkFilename?:
17440
- | string
17441
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17767
+ chunkFilename?: string | TemplatePathFn<PathDataChunk>;
17442
17768
 
17443
17769
  /**
17444
17770
  * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
@@ -17478,16 +17804,12 @@ declare interface Output {
17478
17804
  /**
17479
17805
  * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17480
17806
  */
17481
- cssChunkFilename?:
17482
- | string
17483
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17807
+ cssChunkFilename?: string | TemplatePathFn<PathDataChunk>;
17484
17808
 
17485
17809
  /**
17486
17810
  * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17487
17811
  */
17488
- cssFilename?:
17489
- | string
17490
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17812
+ cssFilename?: string | TemplatePathFn<PathDataChunk>;
17491
17813
 
17492
17814
  /**
17493
17815
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
@@ -17531,7 +17853,7 @@ declare interface Output {
17531
17853
  /**
17532
17854
  * Specifies the filename of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17533
17855
  */
17534
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17856
+ filename?: string | TemplatePathFn<PathDataChunk>;
17535
17857
 
17536
17858
  /**
17537
17859
  * An expression which is used to address the global object/scope in runtime code.
@@ -17576,16 +17898,12 @@ declare interface Output {
17576
17898
  /**
17577
17899
  * Specifies the filename template of non-initial output html files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17578
17900
  */
17579
- htmlChunkFilename?:
17580
- | string
17581
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17901
+ htmlChunkFilename?: string | TemplatePathFn<PathDataChunk>;
17582
17902
 
17583
17903
  /**
17584
17904
  * Specifies the filename template of output html files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17585
17905
  */
17586
- htmlFilename?:
17587
- | string
17588
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17906
+ htmlFilename?: string | TemplatePathFn<PathDataChunk>;
17589
17907
 
17590
17908
  /**
17591
17909
  * Ignore warnings in the browser.
@@ -17640,7 +17958,7 @@ declare interface Output {
17640
17958
  /**
17641
17959
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
17642
17960
  */
17643
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
17961
+ publicPath?: string | TemplatePathFn<PathData>;
17644
17962
 
17645
17963
  /**
17646
17964
  * This option enables loading async chunks via a custom script type, such as script type="module".
@@ -17756,9 +18074,7 @@ declare interface OutputNormalized {
17756
18074
  /**
17757
18075
  * The filename of asset modules as relative path inside the 'output.path' directory.
17758
18076
  */
17759
- assetModuleFilename?:
17760
- | string
17761
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18077
+ assetModuleFilename?: string | TemplatePathFn<PathDataModule>;
17762
18078
 
17763
18079
  /**
17764
18080
  * Enable/disable creating async chunks that are loaded on demand.
@@ -17773,9 +18089,7 @@ declare interface OutputNormalized {
17773
18089
  /**
17774
18090
  * Specifies the filename template of output files of non-initial chunks on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17775
18091
  */
17776
- chunkFilename?:
17777
- | string
17778
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18092
+ chunkFilename?: string | TemplatePathFn<PathDataChunk>;
17779
18093
 
17780
18094
  /**
17781
18095
  * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
@@ -17815,16 +18129,12 @@ declare interface OutputNormalized {
17815
18129
  /**
17816
18130
  * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17817
18131
  */
17818
- cssChunkFilename?:
17819
- | string
17820
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18132
+ cssChunkFilename?: string | TemplatePathFn<PathDataChunk>;
17821
18133
 
17822
18134
  /**
17823
18135
  * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17824
18136
  */
17825
- cssFilename?:
17826
- | string
17827
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18137
+ cssFilename?: string | TemplatePathFn<PathDataChunk>;
17828
18138
 
17829
18139
  /**
17830
18140
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
@@ -17868,7 +18178,7 @@ declare interface OutputNormalized {
17868
18178
  /**
17869
18179
  * Specifies the filename of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17870
18180
  */
17871
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18181
+ filename?: string | TemplatePathFn<PathDataChunk>;
17872
18182
 
17873
18183
  /**
17874
18184
  * An expression which is used to address the global object/scope in runtime code.
@@ -17913,16 +18223,12 @@ declare interface OutputNormalized {
17913
18223
  /**
17914
18224
  * Specifies the filename template of non-initial output html files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17915
18225
  */
17916
- htmlChunkFilename?:
17917
- | string
17918
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18226
+ htmlChunkFilename?: string | TemplatePathFn<PathDataChunk>;
17919
18227
 
17920
18228
  /**
17921
18229
  * Specifies the filename template of output html files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
17922
18230
  */
17923
- htmlFilename?:
17924
- | string
17925
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18231
+ htmlFilename?: string | TemplatePathFn<PathDataChunk>;
17926
18232
 
17927
18233
  /**
17928
18234
  * Ignore warnings in the browser.
@@ -17967,7 +18273,7 @@ declare interface OutputNormalized {
17967
18273
  /**
17968
18274
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
17969
18275
  */
17970
- publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
18276
+ publicPath?: string | TemplatePathFn<PathData>;
17971
18277
 
17972
18278
  /**
17973
18279
  * This option enables loading async chunks via a custom script type, such as script type="module".
@@ -18032,30 +18338,24 @@ declare interface OutputNormalized {
18032
18338
  }
18033
18339
  type OutputNormalizedWithDefaults = OutputNormalized & {
18034
18340
  uniqueName: string;
18035
- filename: NonNullable<
18036
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18037
- >;
18038
- cssFilename: NonNullable<
18039
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18040
- >;
18341
+ filename: NonNullable<undefined | string | TemplatePathFn<PathDataChunk>>;
18342
+ cssFilename: NonNullable<undefined | string | TemplatePathFn<PathDataChunk>>;
18041
18343
  chunkFilename: NonNullable<
18042
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18344
+ undefined | string | TemplatePathFn<PathDataChunk>
18043
18345
  >;
18044
18346
  cssChunkFilename: NonNullable<
18045
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18347
+ undefined | string | TemplatePathFn<PathDataChunk>
18046
18348
  >;
18047
18349
  hotUpdateChunkFilename: string;
18048
18350
  hotUpdateGlobal: string;
18049
18351
  assetModuleFilename: NonNullable<
18050
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18352
+ undefined | string | TemplatePathFn<PathDataModule>
18051
18353
  >;
18052
18354
  webassemblyModuleFilename: string;
18053
18355
  sourceMapFilename: string;
18054
18356
  hotUpdateMainFilename: string;
18055
18357
  devtoolNamespace: string;
18056
- publicPath: NonNullable<
18057
- undefined | string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
18058
- >;
18358
+ publicPath: NonNullable<undefined | string | TemplatePathFn<PathData>>;
18059
18359
  workerPublicPath: string;
18060
18360
  workerWasmLoading: NonNullable<undefined | string | false>;
18061
18361
  workerChunkLoading: NonNullable<undefined | string | false>;
@@ -18279,6 +18579,11 @@ declare interface PathData {
18279
18579
  local?: string;
18280
18580
  prepareId?: (id: string | number) => string | number;
18281
18581
  }
18582
+ type PathDataChunk = PathData & { chunk: Chunk | ChunkPathData };
18583
+ type PathDataModule = PathData & {
18584
+ module: Module | ModulePathData;
18585
+ chunkGraph: ChunkGraph;
18586
+ };
18282
18587
  type PathLikeFs = string | Buffer | URL;
18283
18588
  type PathLikeTypes = string | URL_url | Buffer;
18284
18589
  type PathOrFileDescriptorFs = string | number | Buffer | URL;
@@ -18546,7 +18851,7 @@ declare class ProgressPlugin {
18546
18851
  static createDefaultHandler: (
18547
18852
  profile: undefined | null | boolean,
18548
18853
  logger: WebpackLogger,
18549
- progressBar:
18854
+ progressBar?:
18550
18855
  | false
18551
18856
  | Required<{
18552
18857
  /**
@@ -19696,7 +20001,7 @@ declare interface RenderManifestEntryStatic {
19696
20001
  }
19697
20002
  declare interface RenderManifestEntryTemplated {
19698
20003
  render: () => Source;
19699
- filenameTemplate: TemplatePath;
20004
+ filenameTemplate: string | TemplatePathFn<any>;
19700
20005
  pathOptions?: PathData;
19701
20006
  info?: AssetInfo;
19702
20007
  identifier: string;
@@ -19831,7 +20136,7 @@ declare interface ResolveData {
19831
20136
  attributes?: ImportAttributes;
19832
20137
  dependencies: ModuleDependency[];
19833
20138
  dependencyType: string;
19834
- createData: Partial<NormalModuleCreateData & { settings: ModuleSettings }>;
20139
+ createData: Partial<CreateData>;
19835
20140
  fileDependencies: LazySet<string>;
19836
20141
  missingDependencies: LazySet<string>;
19837
20142
  contextDependencies: LazySet<string>;
@@ -22259,6 +22564,19 @@ declare class Source {
22259
22564
  map(options?: MapOptions): null | RawSourceMap;
22260
22565
  sourceAndMap(options?: MapOptions): SourceAndMap;
22261
22566
  updateHash(hash: HashLike): void;
22567
+
22568
+ /**
22569
+ * Release cached data held by this source. clearCache is a memory
22570
+ * hint: it never affects correctness or output, only how expensive
22571
+ * the next read is. Subclasses override; the base is a no-op so
22572
+ * every Source supports the call. Composite sources always recurse
22573
+ * into wrapped sources. When the same child is reachable via several
22574
+ * parents (e.g. modules shared across webpack chunks), pass a shared
22575
+ * `visited` WeakSet so each subtree is walked at most once.
22576
+ * Not safe to call concurrently with source/map/sourceAndMap/
22577
+ * streamChunks/updateHash on the same instance.
22578
+ */
22579
+ clearCache(options?: ClearCacheOptions, visited?: WeakSet<Source>): void;
22262
22580
  }
22263
22581
  declare interface SourceAndMap {
22264
22582
  /**
@@ -22306,6 +22624,11 @@ declare interface SourceLike {
22306
22624
  * hash updater
22307
22625
  */
22308
22626
  updateHash?: (hash: HashLike) => void;
22627
+
22628
+ /**
22629
+ * clear cache
22630
+ */
22631
+ clearCache?: (options?: ClearCacheOptions, visited?: WeakSet<Source>) => void;
22309
22632
  }
22310
22633
  declare class SourceMapDevToolPlugin {
22311
22634
  /**
@@ -22313,10 +22636,7 @@ declare class SourceMapDevToolPlugin {
22313
22636
  */
22314
22637
  constructor(options?: SourceMapDevToolPluginOptions);
22315
22638
  sourceMapFilename?: null | string | false;
22316
- sourceMappingURLComment:
22317
- | string
22318
- | false
22319
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
22639
+ sourceMappingURLComment: string | false | TemplatePathFn<PathData>;
22320
22640
  moduleFilenameTemplate: DevtoolModuleFilenameTemplate;
22321
22641
  fallbackModuleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate;
22322
22642
  namespace: string;
@@ -22331,11 +22651,7 @@ declare interface SourceMapDevToolPluginOptions {
22331
22651
  /**
22332
22652
  * Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending.
22333
22653
  */
22334
- append?:
22335
- | null
22336
- | string
22337
- | false
22338
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
22654
+ append?: null | string | false | TemplatePathFn<PathData>;
22339
22655
 
22340
22656
  /**
22341
22657
  * Indicates whether column mappings should be used (defaults to true).
@@ -22470,7 +22786,9 @@ declare interface SplitChunksOptions {
22470
22786
  maxAsyncRequests: number;
22471
22787
  maxInitialRequests: number;
22472
22788
  hidePathInfo: boolean;
22473
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
22789
+ filename?:
22790
+ | string
22791
+ | ((pathData: PathDataChunk, assetInfo?: AssetInfo) => string);
22474
22792
  automaticNameDelimiter: string;
22475
22793
  getCacheGroups: (
22476
22794
  module: Module,
@@ -23678,9 +23996,10 @@ declare class Template {
23678
23996
  static NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number;
23679
23997
  static NUMBER_OF_IDENTIFIER_START_CHARS: number;
23680
23998
  }
23681
- type TemplatePath =
23682
- | string
23683
- | ((pathData: PathData, assetInfo?: AssetInfo) => string);
23999
+ type TemplatePath = string | TemplatePathFn<PathData>;
24000
+ declare interface TemplatePathFn<T extends PathData = PathData> {
24001
+ (pathData: T, assetInfo?: AssetInfo): string;
24002
+ }
23684
24003
  declare interface TimestampAndHash {
23685
24004
  safeTime: number;
23686
24005
  timestamp?: number;
@@ -23728,7 +24047,7 @@ declare interface TsconfigPathsData {
23728
24047
  /**
23729
24048
  * tsconfig file data
23730
24049
  */
23731
- alias: CompiledAliasOption[];
24050
+ alias: CompiledAliasOptions;
23732
24051
 
23733
24052
  /**
23734
24053
  * tsconfig file data
@@ -24378,7 +24697,7 @@ declare interface WebpackOptionsInterception {
24378
24697
  /**
24379
24698
  * Which asset type should receive this devtool value.
24380
24699
  */
24381
- type: "all" | "javascript" | "css";
24700
+ type: "css" | "all" | "javascript";
24382
24701
  /**
24383
24702
  * A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
24384
24703
  */
@@ -24430,7 +24749,7 @@ declare interface WebpackOptionsNormalized {
24430
24749
  /**
24431
24750
  * Which asset type should receive this devtool value.
24432
24751
  */
24433
- type: "all" | "javascript" | "css";
24752
+ type: "css" | "all" | "javascript";
24434
24753
  /**
24435
24754
  * A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
24436
24755
  */
@@ -24489,6 +24808,7 @@ declare interface WebpackOptionsNormalized {
24489
24808
  | "script"
24490
24809
  | "node-commonjs"
24491
24810
  | "asset"
24811
+ | "asset-url"
24492
24812
  | "css-import"
24493
24813
  | "css-url";
24494
24814
 
@@ -24625,7 +24945,7 @@ type WebpackOptionsNormalizedWithDefaults = WebpackOptionsNormalized & {
24625
24945
  /**
24626
24946
  * Which asset type should receive this devtool value.
24627
24947
  */
24628
- type: "all" | "javascript" | "css";
24948
+ type: "css" | "all" | "javascript";
24629
24949
  /**
24630
24950
  * A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
24631
24951
  */
@@ -24662,6 +24982,7 @@ type WebpackOptionsNormalizedWithDefaults = WebpackOptionsNormalized & {
24662
24982
  | "script"
24663
24983
  | "node-commonjs"
24664
24984
  | "asset"
24985
+ | "asset-url"
24665
24986
  | "css-import"
24666
24987
  | "css-url"
24667
24988
  >;
@@ -25535,6 +25856,8 @@ declare namespace exports {
25535
25856
  AssetInfo,
25536
25857
  EntryOptions,
25537
25858
  PathData,
25859
+ PathDataChunk,
25860
+ PathDataModule,
25538
25861
  CodeGenerationResults,
25539
25862
  Entrypoint,
25540
25863
  ExternalItemFunctionData,