webpack 5.64.4 → 5.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (123) hide show
  1. package/README.md +1 -1
  2. package/lib/APIPlugin.js +33 -0
  3. package/lib/Cache.js +1 -1
  4. package/lib/CacheFacade.js +4 -11
  5. package/lib/Chunk.js +2 -0
  6. package/lib/CleanPlugin.js +1 -1
  7. package/lib/Compilation.js +91 -47
  8. package/lib/Compiler.js +57 -3
  9. package/lib/ContextModule.js +21 -17
  10. package/lib/DelegatedModule.js +1 -1
  11. package/lib/Dependency.js +10 -0
  12. package/lib/DependencyTemplate.js +9 -0
  13. package/lib/DependencyTemplates.js +1 -1
  14. package/lib/DllModule.js +1 -1
  15. package/lib/EvalDevToolModulePlugin.js +16 -1
  16. package/lib/EvalSourceMapDevToolPlugin.js +18 -1
  17. package/lib/ExternalModule.js +94 -54
  18. package/lib/ExternalModuleFactoryPlugin.js +1 -1
  19. package/lib/FileSystemInfo.js +29 -25
  20. package/lib/Generator.js +2 -0
  21. package/lib/HookWebpackError.js +1 -1
  22. package/lib/Module.js +25 -4
  23. package/lib/ModuleFilenameHelpers.js +5 -1
  24. package/lib/MultiCompiler.js +1 -1
  25. package/lib/MultiWatching.js +1 -1
  26. package/lib/NormalModule.js +9 -5
  27. package/lib/RawModule.js +1 -1
  28. package/lib/RuntimeGlobals.js +29 -1
  29. package/lib/RuntimeModule.js +1 -1
  30. package/lib/RuntimePlugin.js +50 -0
  31. package/lib/RuntimeTemplate.js +113 -2
  32. package/lib/Template.js +2 -1
  33. package/lib/Watching.js +2 -2
  34. package/lib/WebpackOptionsApply.js +43 -2
  35. package/lib/asset/AssetGenerator.js +71 -30
  36. package/lib/asset/AssetModulesPlugin.js +3 -0
  37. package/lib/asset/RawDataUrlModule.js +148 -0
  38. package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -4
  39. package/lib/cache/ResolverCachePlugin.js +1 -1
  40. package/lib/cli.js +44 -3
  41. package/lib/config/browserslistTargetHandler.js +38 -1
  42. package/lib/config/defaults.js +80 -6
  43. package/lib/config/normalization.js +5 -0
  44. package/lib/config/target.js +10 -0
  45. package/lib/container/ContainerEntryModule.js +5 -5
  46. package/lib/container/FallbackModule.js +4 -4
  47. package/lib/container/RemoteModule.js +4 -2
  48. package/lib/css/CssExportsGenerator.js +139 -0
  49. package/lib/css/CssGenerator.js +109 -0
  50. package/lib/css/CssLoadingRuntimeModule.js +447 -0
  51. package/lib/css/CssModulesPlugin.js +461 -0
  52. package/lib/css/CssParser.js +618 -0
  53. package/lib/css/walkCssTokens.js +659 -0
  54. package/lib/debug/ProfilingPlugin.js +12 -10
  55. package/lib/dependencies/CreateScriptUrlDependency.js +12 -0
  56. package/lib/dependencies/CssExportDependency.js +85 -0
  57. package/lib/dependencies/CssImportDependency.js +75 -0
  58. package/lib/dependencies/CssLocalIdentifierDependency.js +119 -0
  59. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +101 -0
  60. package/lib/dependencies/CssUrlDependency.js +132 -0
  61. package/lib/dependencies/HarmonyCompatibilityDependency.js +5 -5
  62. package/lib/dependencies/ImportMetaPlugin.js +22 -3
  63. package/lib/dependencies/LoaderPlugin.js +2 -2
  64. package/lib/dependencies/URLDependency.js +3 -8
  65. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -1
  66. package/lib/hmr/LazyCompilationPlugin.js +45 -21
  67. package/lib/hmr/lazyCompilationBackend.js +4 -2
  68. package/lib/ids/DeterministicModuleIdsPlugin.js +55 -35
  69. package/lib/ids/HashedModuleIdsPlugin.js +9 -12
  70. package/lib/ids/IdHelpers.js +24 -10
  71. package/lib/ids/NamedModuleIdsPlugin.js +6 -9
  72. package/lib/ids/NaturalModuleIdsPlugin.js +10 -13
  73. package/lib/ids/OccurrenceModuleIdsPlugin.js +13 -10
  74. package/lib/ids/SyncModuleIdsPlugin.js +140 -0
  75. package/lib/index.js +8 -0
  76. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -2
  77. package/lib/javascript/JavascriptGenerator.js +1 -0
  78. package/lib/javascript/JavascriptParser.js +7 -0
  79. package/lib/javascript/StartupHelpers.js +3 -3
  80. package/lib/library/AssignLibraryPlugin.js +31 -13
  81. package/lib/library/EnableLibraryPlugin.js +11 -0
  82. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +1 -1
  83. package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -1
  84. package/lib/optimize/ConcatenatedModule.js +11 -5
  85. package/lib/runtime/AsyncModuleRuntimeModule.js +25 -15
  86. package/lib/runtime/CreateScriptRuntimeModule.js +36 -0
  87. package/lib/runtime/CreateScriptUrlRuntimeModule.js +9 -34
  88. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +76 -0
  89. package/lib/schemes/HttpUriPlugin.js +8 -8
  90. package/lib/sharing/ConsumeSharedModule.js +8 -2
  91. package/lib/sharing/ConsumeSharedRuntimeModule.js +21 -0
  92. package/lib/sharing/ProvideSharedModule.js +4 -2
  93. package/lib/sharing/utils.js +1 -1
  94. package/lib/stats/DefaultStatsFactoryPlugin.js +112 -67
  95. package/lib/stats/DefaultStatsPrinterPlugin.js +89 -24
  96. package/lib/util/ArrayHelpers.js +18 -4
  97. package/lib/util/AsyncQueue.js +1 -1
  98. package/lib/util/extractUrlAndGlobal.js +3 -0
  99. package/lib/util/hash/xxhash64.js +2 -2
  100. package/lib/util/internalSerializables.js +11 -0
  101. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +9 -3
  102. package/lib/web/JsonpChunkLoadingRuntimeModule.js +3 -3
  103. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -11
  104. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +3 -2
  105. package/package.json +5 -12
  106. package/schemas/WebpackOptions.check.js +1 -1
  107. package/schemas/WebpackOptions.json +104 -1
  108. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
  109. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
  110. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  111. package/schemas/plugins/container/ContainerPlugin.json +2 -1
  112. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  113. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  114. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  115. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  116. package/schemas/plugins/container/ModuleFederationPlugin.json +3 -1
  117. package/schemas/plugins/css/CssGeneratorOptions.check.d.ts +7 -0
  118. package/schemas/plugins/css/CssGeneratorOptions.check.js +6 -0
  119. package/schemas/plugins/css/CssGeneratorOptions.json +3 -0
  120. package/schemas/plugins/css/CssParserOptions.check.d.ts +7 -0
  121. package/schemas/plugins/css/CssParserOptions.check.js +6 -0
  122. package/schemas/plugins/css/CssParserOptions.json +3 -0
  123. package/types.d.ts +284 -58
package/types.d.ts CHANGED
@@ -215,6 +215,7 @@ declare interface Argument {
215
215
  }
216
216
  declare interface ArgumentConfig {
217
217
  description: string;
218
+ negatedDescription?: string;
218
219
  path: string;
219
220
  multiple: boolean;
220
221
  type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset";
@@ -320,6 +321,11 @@ declare interface AssetResourceGeneratorOptions {
320
321
  */
321
322
  filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
322
323
 
324
+ /**
325
+ * 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.
326
+ */
327
+ outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
328
+
323
329
  /**
324
330
  * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
325
331
  */
@@ -675,16 +681,16 @@ declare interface CallExpressionInfo {
675
681
  getMembers: () => string[];
676
682
  }
677
683
  declare interface CallbackAsyncQueue<T> {
678
- (err?: WebpackError, result?: T): any;
684
+ (err?: null | WebpackError, result?: T): any;
679
685
  }
680
686
  declare interface CallbackCache<T> {
681
- (err?: WebpackError, result?: T): void;
687
+ (err?: null | WebpackError, result?: T): void;
682
688
  }
683
689
  declare interface CallbackFunction<T> {
684
- (err?: Error, result?: T): any;
690
+ (err?: null | Error, result?: T): any;
685
691
  }
686
692
  declare interface CallbackNormalErrorCache<T> {
687
- (err?: Error, result?: T): void;
693
+ (err?: null | Error, result?: T): void;
688
694
  }
689
695
  declare interface CallbackWebpack<T> {
690
696
  (err?: Error, stats?: T): void;
@@ -702,6 +708,10 @@ declare class Chunk {
702
708
  | null
703
709
  | string
704
710
  | ((arg0: PathData, arg1?: AssetInfo) => string);
711
+ cssFilenameTemplate:
712
+ | null
713
+ | string
714
+ | ((arg0: PathData, arg1?: AssetInfo) => string);
705
715
  runtime: RuntimeSpec;
706
716
  files: Set<string>;
707
717
  auxiliaryFiles: Set<string>;
@@ -1217,6 +1227,11 @@ declare interface CodeGenerationContext {
1217
1227
  * when in concatenated module, information about other concatenated modules
1218
1228
  */
1219
1229
  concatenationScope?: ConcatenationScope;
1230
+
1231
+ /**
1232
+ * code generation results of other modules (need to have a codeGenerationDependency to use that)
1233
+ */
1234
+ codeGenerationResults: CodeGenerationResults;
1220
1235
  }
1221
1236
  declare interface CodeGenerationResult {
1222
1237
  /**
@@ -1532,7 +1547,7 @@ declare class Compilation {
1532
1547
  getLogger(name: string | (() => string)): WebpackLogger;
1533
1548
  addModule(
1534
1549
  module: Module,
1535
- callback: (err?: WebpackError, result?: Module) => void
1550
+ callback: (err?: null | WebpackError, result?: Module) => void
1536
1551
  ): void;
1537
1552
 
1538
1553
  /**
@@ -1550,21 +1565,21 @@ declare class Compilation {
1550
1565
  */
1551
1566
  buildModule(
1552
1567
  module: Module,
1553
- callback: (err?: WebpackError, result?: Module) => void
1568
+ callback: (err?: null | WebpackError, result?: Module) => void
1554
1569
  ): void;
1555
1570
  processModuleDependencies(
1556
1571
  module: Module,
1557
- callback: (err?: WebpackError, result?: Module) => void
1572
+ callback: (err?: null | WebpackError, result?: Module) => void
1558
1573
  ): void;
1559
1574
  processModuleDependenciesNonRecursive(module: Module): void;
1560
1575
  handleModuleCreation(
1561
1576
  __0: HandleModuleCreationOptions,
1562
- callback: (err?: WebpackError, result?: Module) => void
1577
+ callback: (err?: null | WebpackError, result?: Module) => void
1563
1578
  ): void;
1564
1579
  addModuleChain(
1565
1580
  context: string,
1566
1581
  dependency: Dependency,
1567
- callback: (err?: WebpackError, result?: Module) => void
1582
+ callback: (err?: null | WebpackError, result?: Module) => void
1568
1583
  ): void;
1569
1584
  addModuleTree(
1570
1585
  __0: {
@@ -1581,27 +1596,27 @@ declare class Compilation {
1581
1596
  */
1582
1597
  contextInfo?: Partial<ModuleFactoryCreateDataContextInfo>;
1583
1598
  },
1584
- callback: (err?: WebpackError, result?: Module) => void
1599
+ callback: (err?: null | WebpackError, result?: Module) => void
1585
1600
  ): void;
1586
1601
  addEntry(
1587
1602
  context: string,
1588
1603
  entry: Dependency,
1589
1604
  optionsOrName: string | EntryOptions,
1590
- callback: (err?: WebpackError, result?: Module) => void
1605
+ callback: (err?: null | WebpackError, result?: Module) => void
1591
1606
  ): void;
1592
1607
  addInclude(
1593
1608
  context: string,
1594
1609
  dependency: Dependency,
1595
1610
  options: EntryOptions,
1596
- callback: (err?: WebpackError, result?: Module) => void
1611
+ callback: (err?: null | WebpackError, result?: Module) => void
1597
1612
  ): void;
1598
1613
  rebuildModule(
1599
1614
  module: Module,
1600
- callback: (err?: WebpackError, result?: Module) => void
1615
+ callback: (err?: null | WebpackError, result?: Module) => void
1601
1616
  ): void;
1602
1617
  finish(callback?: any): void;
1603
1618
  unseal(): void;
1604
- seal(callback: (err?: WebpackError) => void): void;
1619
+ seal(callback: (err?: null | WebpackError) => void): void;
1605
1620
  reportDependencyErrorsAndWarnings(
1606
1621
  module: Module,
1607
1622
  blocks: DependenciesBlock[]
@@ -1634,11 +1649,15 @@ declare class Compilation {
1634
1649
  module: RuntimeModule,
1635
1650
  chunkGraph?: ChunkGraph
1636
1651
  ): void;
1652
+
1653
+ /**
1654
+ * If `module` is passed, `loc` and `request` must also be passed.
1655
+ */
1637
1656
  addChunkInGroup(
1638
1657
  groupOptions: string | ChunkGroupOptions,
1639
- module: Module,
1640
- loc: DependencyLocation,
1641
- request: string
1658
+ module?: Module,
1659
+ loc?: SyntheticDependencyLocation | RealDependencyLocation,
1660
+ request?: string
1642
1661
  ): ChunkGroup;
1643
1662
  addAsyncEntrypoint(
1644
1663
  options: EntryOptions,
@@ -1689,7 +1708,7 @@ declare class Compilation {
1689
1708
  clearAssets(): void;
1690
1709
  createModuleAssets(): void;
1691
1710
  getRenderManifest(options: RenderManifestOptions): RenderManifestEntry[];
1692
- createChunkAssets(callback: (err?: WebpackError) => void): void;
1711
+ createChunkAssets(callback: (err?: null | WebpackError) => void): void;
1693
1712
  getPath(
1694
1713
  filename: string | ((arg0: PathData, arg1?: AssetInfo) => string),
1695
1714
  data?: PathData
@@ -1725,17 +1744,20 @@ declare class Compilation {
1725
1744
  executeModule(
1726
1745
  module: Module,
1727
1746
  options: ExecuteModuleOptions,
1728
- callback: (err?: WebpackError, result?: ExecuteModuleResult) => void
1747
+ callback: (err?: null | WebpackError, result?: ExecuteModuleResult) => void
1729
1748
  ): void;
1730
1749
  checkConstraints(): void;
1731
1750
  factorizeModule: {
1732
1751
  (
1733
1752
  options: FactorizeModuleOptions & { factoryResult?: false },
1734
- callback: (err?: WebpackError, result?: Module) => void
1753
+ callback: (err?: null | WebpackError, result?: Module) => void
1735
1754
  ): void;
1736
1755
  (
1737
1756
  options: FactorizeModuleOptions & { factoryResult: true },
1738
- callback: (err?: WebpackError, result?: ModuleFactoryResult) => void
1757
+ callback: (
1758
+ err?: null | WebpackError,
1759
+ result?: ModuleFactoryResult
1760
+ ) => void
1739
1761
  ): void;
1740
1762
  };
1741
1763
 
@@ -1878,6 +1900,8 @@ declare class Compiler {
1878
1900
  make: AsyncParallelHook<[Compilation]>;
1879
1901
  finishMake: AsyncParallelHook<[Compilation]>;
1880
1902
  afterCompile: AsyncSeriesHook<[Compilation]>;
1903
+ readRecords: AsyncSeriesHook<[]>;
1904
+ emitRecords: AsyncSeriesHook<[]>;
1881
1905
  watchRun: AsyncSeriesHook<[Compiler]>;
1882
1906
  failed: SyncHook<[Error]>;
1883
1907
  invalid: SyncHook<[null | string, number]>;
@@ -1933,7 +1957,11 @@ declare class Compiler {
1933
1957
  watch(watchOptions: WatchOptions, handler: CallbackFunction<Stats>): Watching;
1934
1958
  run(callback: CallbackFunction<Stats>): void;
1935
1959
  runAsChild(
1936
- callback: (err?: Error, entries?: Chunk[], compilation?: Compilation) => any
1960
+ callback: (
1961
+ err?: null | Error,
1962
+ entries?: Chunk[],
1963
+ compilation?: Compilation
1964
+ ) => any
1937
1965
  ): void;
1938
1966
  purgeInputFileSystem(): void;
1939
1967
  emitAssets(compilation: Compilation, callback: CallbackFunction<void>): void;
@@ -2095,6 +2123,7 @@ declare interface Configuration {
2095
2123
  | "commonjs"
2096
2124
  | "commonjs2"
2097
2125
  | "commonjs-module"
2126
+ | "commonjs-static"
2098
2127
  | "amd"
2099
2128
  | "amd-require"
2100
2129
  | "umd"
@@ -2141,7 +2170,7 @@ declare interface Configuration {
2141
2170
  /**
2142
2171
  * Enable production optimizations or development hints.
2143
2172
  */
2144
- mode?: "development" | "production" | "none";
2173
+ mode?: "none" | "development" | "production";
2145
2174
 
2146
2175
  /**
2147
2176
  * Options affecting the normal modules (`NormalModuleFactory`).
@@ -2226,15 +2255,15 @@ declare interface Configuration {
2226
2255
  */
2227
2256
  stats?:
2228
2257
  | boolean
2258
+ | StatsOptions
2229
2259
  | "none"
2260
+ | "verbose"
2230
2261
  | "summary"
2231
2262
  | "errors-only"
2232
2263
  | "errors-warnings"
2233
2264
  | "minimal"
2234
2265
  | "normal"
2235
- | "detailed"
2236
- | "verbose"
2237
- | StatsOptions;
2266
+ | "detailed";
2238
2267
 
2239
2268
  /**
2240
2269
  * Environment to build for. An array of environments to build for all of them when possible.
@@ -2466,7 +2495,10 @@ declare abstract class ContextModuleFactory extends ModuleFactory {
2466
2495
  resolveDependencies(
2467
2496
  fs: InputFileSystem,
2468
2497
  options: ContextModuleOptions,
2469
- callback: (err?: Error, dependencies?: ContextElementDependency[]) => any
2498
+ callback: (
2499
+ err?: null | Error,
2500
+ dependencies?: ContextElementDependency[]
2501
+ ) => any
2470
2502
  ): void;
2471
2503
  }
2472
2504
 
@@ -2516,6 +2548,16 @@ declare interface ContextTimestampAndHash {
2516
2548
  }
2517
2549
  type CreateStatsOptionsContext = KnownCreateStatsOptionsContext &
2518
2550
  Record<string, any>;
2551
+
2552
+ /**
2553
+ * Options for css handling.
2554
+ */
2555
+ declare interface CssExperimentOptions {
2556
+ /**
2557
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
2558
+ */
2559
+ exportsOnly?: boolean;
2560
+ }
2519
2561
  type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
2520
2562
  declare class DefinePlugin {
2521
2563
  /**
@@ -2582,6 +2624,12 @@ declare class Dependency {
2582
2624
  readonly type: string;
2583
2625
  readonly category: string;
2584
2626
  loc: DependencyLocation;
2627
+ setLoc(
2628
+ startLine?: any,
2629
+ startColumn?: any,
2630
+ endLine?: any,
2631
+ endColumn?: any
2632
+ ): void;
2585
2633
  getResourceIdentifier(): null | string;
2586
2634
  couldAffectReferencingModule(): boolean | typeof TRANSITIVE;
2587
2635
 
@@ -2697,6 +2745,11 @@ declare interface DependencyTemplateContext {
2697
2745
  * when in a concatenated module, information about other concatenated modules
2698
2746
  */
2699
2747
  concatenationScope?: ConcatenationScope;
2748
+
2749
+ /**
2750
+ * the code generation results
2751
+ */
2752
+ codeGenerationResults: CodeGenerationResults;
2700
2753
  }
2701
2754
  declare abstract class DependencyTemplates {
2702
2755
  get(dependency: DependencyConstructor): DependencyTemplate;
@@ -2718,8 +2771,58 @@ declare class DeterministicChunkIdsPlugin {
2718
2771
  apply(compiler: Compiler): void;
2719
2772
  }
2720
2773
  declare class DeterministicModuleIdsPlugin {
2721
- constructor(options?: any);
2722
- options: any;
2774
+ constructor(options?: {
2775
+ /**
2776
+ * context relative to which module identifiers are computed
2777
+ */
2778
+ context?: string;
2779
+ /**
2780
+ * selector function for modules
2781
+ */
2782
+ test?: (arg0: Module) => boolean;
2783
+ /**
2784
+ * maximum id length in digits (used as starting point)
2785
+ */
2786
+ maxLength?: number;
2787
+ /**
2788
+ * hash salt for ids
2789
+ */
2790
+ salt?: number;
2791
+ /**
2792
+ * do not increase the maxLength to find an optimal id space size
2793
+ */
2794
+ fixedLength?: boolean;
2795
+ /**
2796
+ * throw an error when id conflicts occur (instead of rehashing)
2797
+ */
2798
+ failOnConflict?: boolean;
2799
+ });
2800
+ options: {
2801
+ /**
2802
+ * context relative to which module identifiers are computed
2803
+ */
2804
+ context?: string;
2805
+ /**
2806
+ * selector function for modules
2807
+ */
2808
+ test?: (arg0: Module) => boolean;
2809
+ /**
2810
+ * maximum id length in digits (used as starting point)
2811
+ */
2812
+ maxLength?: number;
2813
+ /**
2814
+ * hash salt for ids
2815
+ */
2816
+ salt?: number;
2817
+ /**
2818
+ * do not increase the maxLength to find an optimal id space size
2819
+ */
2820
+ fixedLength?: boolean;
2821
+ /**
2822
+ * throw an error when id conflicts occur (instead of rehashing)
2823
+ */
2824
+ failOnConflict?: boolean;
2825
+ };
2723
2826
 
2724
2827
  /**
2725
2828
  * Apply the plugin
@@ -3246,6 +3349,16 @@ declare interface Environment {
3246
3349
  * The environment supports EcmaScript Module syntax to import EcmaScript modules (import ... from '...').
3247
3350
  */
3248
3351
  module?: boolean;
3352
+
3353
+ /**
3354
+ * The environment supports optional chaining ('obj?.a' or 'obj?.()').
3355
+ */
3356
+ optionalChaining?: boolean;
3357
+
3358
+ /**
3359
+ * The environment supports template literals.
3360
+ */
3361
+ templateLiteral?: boolean;
3249
3362
  }
3250
3363
  declare class EnvironmentPlugin {
3251
3364
  constructor(...keys: any[]);
@@ -3363,6 +3476,11 @@ declare interface ExperimentsExtra {
3363
3476
  */
3364
3477
  buildHttp?: HttpUriOptions | (string | RegExp | ((uri: string) => boolean))[];
3365
3478
 
3479
+ /**
3480
+ * Enable css support.
3481
+ */
3482
+ css?: boolean | CssExperimentOptions;
3483
+
3366
3484
  /**
3367
3485
  * Compile entrypoints and import()s only when they are accessed.
3368
3486
  */
@@ -3379,6 +3497,11 @@ declare interface ExperimentsNormalizedExtra {
3379
3497
  */
3380
3498
  buildHttp?: HttpUriOptions;
3381
3499
 
3500
+ /**
3501
+ * Enable css support.
3502
+ */
3503
+ css?: CssExperimentOptions;
3504
+
3382
3505
  /**
3383
3506
  * Compile entrypoints and import()s only when they are accessed.
3384
3507
  */
@@ -3843,6 +3966,7 @@ type ExternalsType =
3843
3966
  | "commonjs"
3844
3967
  | "commonjs2"
3845
3968
  | "commonjs-module"
3969
+ | "commonjs-static"
3846
3970
  | "amd"
3847
3971
  | "amd-require"
3848
3972
  | "umd"
@@ -4082,40 +4206,43 @@ declare abstract class FileSystemInfo {
4082
4206
  getFileTimestamp(
4083
4207
  path: string,
4084
4208
  callback: (
4085
- arg0?: WebpackError,
4209
+ arg0?: null | WebpackError,
4086
4210
  arg1?: null | FileSystemInfoEntry | "ignore"
4087
4211
  ) => void
4088
4212
  ): void;
4089
4213
  getContextTimestamp(
4090
4214
  path: string,
4091
4215
  callback: (
4092
- arg0?: WebpackError,
4216
+ arg0?: null | WebpackError,
4093
4217
  arg1?: null | "ignore" | ResolvedContextFileSystemInfoEntry
4094
4218
  ) => void
4095
4219
  ): void;
4096
4220
  getFileHash(
4097
4221
  path: string,
4098
- callback: (arg0?: WebpackError, arg1?: string) => void
4222
+ callback: (arg0?: null | WebpackError, arg1?: string) => void
4099
4223
  ): void;
4100
4224
  getContextHash(
4101
4225
  path: string,
4102
- callback: (arg0?: WebpackError, arg1?: string) => void
4226
+ callback: (arg0?: null | WebpackError, arg1?: string) => void
4103
4227
  ): void;
4104
4228
  getContextTsh(
4105
4229
  path: string,
4106
4230
  callback: (
4107
- arg0?: WebpackError,
4231
+ arg0?: null | WebpackError,
4108
4232
  arg1?: ResolvedContextTimestampAndHash
4109
4233
  ) => void
4110
4234
  ): void;
4111
4235
  resolveBuildDependencies(
4112
4236
  context: string,
4113
4237
  deps: Iterable<string>,
4114
- callback: (arg0?: Error, arg1?: ResolveBuildDependenciesResult) => void
4238
+ callback: (
4239
+ arg0?: null | Error,
4240
+ arg1?: ResolveBuildDependenciesResult
4241
+ ) => void
4115
4242
  ): void;
4116
4243
  checkResolveResultsValid(
4117
4244
  resolveResults: Map<string, string | false>,
4118
- callback: (arg0?: Error, arg1?: boolean) => void
4245
+ callback: (arg0?: null | Error, arg1?: boolean) => void
4119
4246
  ): void;
4120
4247
  createSnapshot(
4121
4248
  startTime: number,
@@ -4132,12 +4259,12 @@ declare abstract class FileSystemInfo {
4132
4259
  */
4133
4260
  timestamp?: boolean;
4134
4261
  },
4135
- callback: (arg0?: WebpackError, arg1?: Snapshot) => void
4262
+ callback: (arg0?: null | WebpackError, arg1?: null | Snapshot) => void
4136
4263
  ): void;
4137
4264
  mergeSnapshots(snapshot1: Snapshot, snapshot2: Snapshot): Snapshot;
4138
4265
  checkSnapshotValid(
4139
4266
  snapshot: Snapshot,
4140
- callback: (arg0?: WebpackError, arg1?: boolean) => void
4267
+ callback: (arg0?: null | WebpackError, arg1?: boolean) => void
4141
4268
  ): void;
4142
4269
  getDeprecatedFileTimestamps(): Map<any, any>;
4143
4270
  getDeprecatedContextTimestamps(): Map<any, any>;
@@ -4187,6 +4314,11 @@ declare interface GenerateContext {
4187
4314
  */
4188
4315
  concatenationScope?: ConcatenationScope;
4189
4316
 
4317
+ /**
4318
+ * code generation results of other modules (need to have a codeGenerationDependency to use that)
4319
+ */
4320
+ codeGenerationResults?: CodeGenerationResults;
4321
+
4190
4322
  /**
4191
4323
  * which kind of code should be generated
4192
4324
  */
@@ -4547,7 +4679,7 @@ declare interface InfrastructureLogging {
4547
4679
  /**
4548
4680
  * Log level.
4549
4681
  */
4550
- level?: "none" | "verbose" | "error" | "warn" | "info" | "log";
4682
+ level?: "none" | "error" | "warn" | "info" | "log" | "verbose";
4551
4683
 
4552
4684
  /**
4553
4685
  * Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.
@@ -4693,7 +4825,7 @@ declare class JavascriptModulesPlugin {
4693
4825
  static chunkHasJs: (chunk: Chunk, chunkGraph: ChunkGraph) => boolean;
4694
4826
  }
4695
4827
  declare class JavascriptParser extends Parser {
4696
- constructor(sourceType?: "module" | "script" | "auto");
4828
+ constructor(sourceType?: "module" | "auto" | "script");
4697
4829
  hooks: Readonly<{
4698
4830
  evaluateTypeof: HookMap<
4699
4831
  SyncBailHook<
@@ -4963,7 +5095,7 @@ declare class JavascriptParser extends Parser {
4963
5095
  program: SyncBailHook<[Program, Comment[]], boolean | void>;
4964
5096
  finish: SyncBailHook<[Program, Comment[]], boolean | void>;
4965
5097
  }>;
4966
- sourceType: "module" | "script" | "auto";
5098
+ sourceType: "module" | "auto" | "script";
4967
5099
  scope: ScopeInfo;
4968
5100
  state: ParserState;
4969
5101
  comments: any;
@@ -5303,7 +5435,7 @@ declare interface JavascriptParserOptions {
5303
5435
  /**
5304
5436
  * Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
5305
5437
  */
5306
- exportsPresence?: false | "error" | "warn" | "auto";
5438
+ exportsPresence?: false | "auto" | "error" | "warn";
5307
5439
 
5308
5440
  /**
5309
5441
  * Enable warnings for full dynamic dependencies.
@@ -5338,7 +5470,12 @@ declare interface JavascriptParserOptions {
5338
5470
  /**
5339
5471
  * Specifies the behavior of invalid export names in "import ... from ...".
5340
5472
  */
5341
- importExportsPresence?: false | "error" | "warn" | "auto";
5473
+ importExportsPresence?: false | "auto" | "error" | "warn";
5474
+
5475
+ /**
5476
+ * Enable/disable evaluating import.meta.
5477
+ */
5478
+ importMeta?: boolean;
5342
5479
 
5343
5480
  /**
5344
5481
  * Include polyfills or mocks for various node stuff.
@@ -5348,7 +5485,7 @@ declare interface JavascriptParserOptions {
5348
5485
  /**
5349
5486
  * Specifies the behavior of invalid export names in "export ... from ...". This might be useful to disable during the migration from "export ... from ..." to "export type ... from ..." when reexporting types in TypeScript.
5350
5487
  */
5351
- reexportExportsPresence?: false | "error" | "warn" | "auto";
5488
+ reexportExportsPresence?: false | "auto" | "error" | "warn";
5352
5489
 
5353
5490
  /**
5354
5491
  * Enable/disable parsing of require.context syntax.
@@ -5585,7 +5722,7 @@ declare interface KnownNormalizedStatsOptions {
5585
5722
  modulesSpace: number;
5586
5723
  chunkModulesSpace: number;
5587
5724
  nestedModulesSpace: number;
5588
- logging: false | "none" | "verbose" | "error" | "warn" | "info" | "log";
5725
+ logging: false | "none" | "error" | "warn" | "info" | "log" | "verbose";
5589
5726
  loggingDebug: ((value: string) => boolean)[];
5590
5727
  loggingTrace: boolean;
5591
5728
  }
@@ -5995,7 +6132,7 @@ declare interface LibraryOptions {
5995
6132
  name?: string | string[] | LibraryCustomUmdObject;
5996
6133
 
5997
6134
  /**
5998
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
6135
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
5999
6136
  */
6000
6137
  type: string;
6001
6138
 
@@ -6177,7 +6314,7 @@ declare interface LoaderPluginLoaderContext {
6177
6314
  importModule(
6178
6315
  request: string,
6179
6316
  options: ImportModuleOptions,
6180
- callback: (err?: Error, exports?: any) => any
6317
+ callback: (err?: null | Error, exports?: any) => any
6181
6318
  ): void;
6182
6319
  importModule(request: string, options?: ImportModuleOptions): Promise<any>;
6183
6320
  }
@@ -6482,6 +6619,7 @@ declare class Module extends DependenciesBlock {
6482
6619
  buildMeta: BuildMeta;
6483
6620
  buildInfo: Record<string, any>;
6484
6621
  presentationalDependencies?: Dependency[];
6622
+ codeGenerationDependencies?: Dependency[];
6485
6623
  id: string | number;
6486
6624
  readonly hash: string;
6487
6625
  readonly renderedHash: string;
@@ -6511,6 +6649,7 @@ declare class Module extends DependenciesBlock {
6511
6649
  strict: boolean
6512
6650
  ): "namespace" | "default-only" | "default-with-named" | "dynamic";
6513
6651
  addPresentationalDependency(presentationalDependency: Dependency): void;
6652
+ addCodeGenerationDependency(codeGenerationDependency: Dependency): void;
6514
6653
  addWarning(warning: WebpackError): void;
6515
6654
  getWarnings(): undefined | Iterable<WebpackError>;
6516
6655
  getNumberOfWarnings(): number;
@@ -6541,7 +6680,7 @@ declare class Module extends DependenciesBlock {
6541
6680
  hasReasons(moduleGraph: ModuleGraph, runtime: RuntimeSpec): boolean;
6542
6681
  needBuild(
6543
6682
  context: NeedBuildContext,
6544
- callback: (arg0?: WebpackError, arg1?: boolean) => void
6683
+ callback: (arg0?: null | WebpackError, arg1?: boolean) => void
6545
6684
  ): void;
6546
6685
  needRebuild(
6547
6686
  fileTimestamps: Map<string, null | number>,
@@ -6698,6 +6837,7 @@ declare interface ModuleFederationPluginOptions {
6698
6837
  | "commonjs"
6699
6838
  | "commonjs2"
6700
6839
  | "commonjs-module"
6840
+ | "commonjs-static"
6701
6841
  | "amd"
6702
6842
  | "amd-require"
6703
6843
  | "umd"
@@ -7410,7 +7550,7 @@ declare class NormalModule extends Module {
7410
7550
  resourceResolveData?: Record<string, any>;
7411
7551
  matchResource?: string;
7412
7552
  loaders: LoaderItem[];
7413
- error?: WebpackError;
7553
+ error?: null | WebpackError;
7414
7554
  restoreFromUnsafeCache(
7415
7555
  unsafeCacheData?: any,
7416
7556
  normalModuleFactory?: any
@@ -7543,7 +7683,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
7543
7683
  rootContext: string;
7544
7684
  fs: InputFileSystem;
7545
7685
  sourceMap?: boolean;
7546
- mode: "development" | "production" | "none";
7686
+ mode: "none" | "development" | "production";
7547
7687
  webpack?: boolean;
7548
7688
  _module?: NormalModule;
7549
7689
  _compilation?: Compilation;
@@ -8129,6 +8269,20 @@ declare interface Output {
8129
8269
  */
8130
8270
  crossOriginLoading?: false | "anonymous" | "use-credentials";
8131
8271
 
8272
+ /**
8273
+ * 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.
8274
+ */
8275
+ cssChunkFilename?:
8276
+ | string
8277
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8278
+
8279
+ /**
8280
+ * 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.
8281
+ */
8282
+ cssFilename?:
8283
+ | string
8284
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8285
+
8132
8286
  /**
8133
8287
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
8134
8288
  */
@@ -8235,7 +8389,7 @@ declare interface Output {
8235
8389
  libraryExport?: string | string[];
8236
8390
 
8237
8391
  /**
8238
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
8392
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
8239
8393
  */
8240
8394
  libraryTarget?: string;
8241
8395
 
@@ -8424,6 +8578,20 @@ declare interface OutputNormalized {
8424
8578
  */
8425
8579
  crossOriginLoading?: false | "anonymous" | "use-credentials";
8426
8580
 
8581
+ /**
8582
+ * 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.
8583
+ */
8584
+ cssChunkFilename?:
8585
+ | string
8586
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8587
+
8588
+ /**
8589
+ * 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.
8590
+ */
8591
+ cssFilename?:
8592
+ | string
8593
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8594
+
8427
8595
  /**
8428
8596
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
8429
8597
  */
@@ -9400,7 +9568,7 @@ declare interface ResolveOptionsWebpackOptions {
9400
9568
  /**
9401
9569
  * Plugins for the resolver.
9402
9570
  */
9403
- plugins?: ("..." | ResolvePluginInstance)[];
9571
+ plugins?: (ResolvePluginInstance | "...")[];
9404
9572
 
9405
9573
  /**
9406
9574
  * Prefer to resolve server-relative URLs (starting with '/') as absolute paths before falling back to resolve in 'resolve.roots'.
@@ -10012,18 +10180,21 @@ declare abstract class RuntimeTemplate {
10012
10180
  compilation: Compilation;
10013
10181
  outputOptions: OutputNormalized;
10014
10182
  requestShortener: RequestShortener;
10183
+ globalObject: string;
10015
10184
  isIIFE(): undefined | boolean;
10016
10185
  isModule(): undefined | boolean;
10017
10186
  supportsConst(): undefined | boolean;
10018
10187
  supportsArrowFunction(): undefined | boolean;
10188
+ supportsOptionalChaining(): undefined | boolean;
10019
10189
  supportsForOf(): undefined | boolean;
10020
10190
  supportsDestructuring(): undefined | boolean;
10021
10191
  supportsBigIntLiteral(): undefined | boolean;
10022
10192
  supportsDynamicImport(): undefined | boolean;
10023
10193
  supportsEcmaScriptModuleSyntax(): undefined | boolean;
10024
- supportTemplateLiteral(): boolean;
10194
+ supportTemplateLiteral(): undefined | boolean;
10025
10195
  returningFunction(returnValue?: any, args?: string): string;
10026
10196
  basicFunction(args?: any, body?: any): string;
10197
+ concatenation(...args: (string | { expr: string })[]): string;
10027
10198
  expressionFunction(expression?: any, args?: string): string;
10028
10199
  emptyFunction(): "x => {}" | "function() {}";
10029
10200
  destructureArray(items?: any, value?: any): string;
@@ -10400,6 +10571,24 @@ declare abstract class RuntimeTemplate {
10400
10571
  */
10401
10572
  runtimeRequirements: Set<string>;
10402
10573
  }): string;
10574
+ assetUrl(__0: {
10575
+ /**
10576
+ * the module
10577
+ */
10578
+ module: Module;
10579
+ /**
10580
+ * the public path
10581
+ */
10582
+ publicPath: string;
10583
+ /**
10584
+ * runtime
10585
+ */
10586
+ runtime?: RuntimeSpec;
10587
+ /**
10588
+ * the code generation results
10589
+ */
10590
+ codeGenerationResults: CodeGenerationResults;
10591
+ }): string;
10403
10592
  }
10404
10593
  declare abstract class RuntimeValue {
10405
10594
  fn: (arg0: {
@@ -11239,7 +11428,7 @@ declare interface StatsOptions {
11239
11428
  /**
11240
11429
  * Add logging output.
11241
11430
  */
11242
- logging?: boolean | "none" | "verbose" | "error" | "warn" | "info" | "log";
11431
+ logging?: boolean | "none" | "error" | "warn" | "info" | "log" | "verbose";
11243
11432
 
11244
11433
  /**
11245
11434
  * Include debug logging of specified loggers (i. e. for plugins or loaders). Filters can be Strings, RegExps or Functions.
@@ -11408,15 +11597,40 @@ type StatsPrinterContext = KnownStatsPrinterContext & Record<string, any>;
11408
11597
  type StatsProfile = KnownStatsProfile & Record<string, any>;
11409
11598
  type StatsValue =
11410
11599
  | boolean
11600
+ | StatsOptions
11411
11601
  | "none"
11602
+ | "verbose"
11412
11603
  | "summary"
11413
11604
  | "errors-only"
11414
11605
  | "errors-warnings"
11415
11606
  | "minimal"
11416
11607
  | "normal"
11417
- | "detailed"
11418
- | "verbose"
11419
- | StatsOptions;
11608
+ | "detailed";
11609
+ declare class SyncModuleIdsPlugin {
11610
+ constructor(__0: {
11611
+ /**
11612
+ * path to file
11613
+ */
11614
+ path: string;
11615
+ /**
11616
+ * context for module names
11617
+ */
11618
+ context?: string;
11619
+ /**
11620
+ * selector for modules
11621
+ */
11622
+ test: (arg0: Module) => boolean;
11623
+ /**
11624
+ * operation mode (defaults to merge)
11625
+ */
11626
+ mode?: "read" | "create" | "merge" | "update";
11627
+ });
11628
+
11629
+ /**
11630
+ * Apply the plugin
11631
+ */
11632
+ apply(compiler: Compiler): void;
11633
+ }
11420
11634
  declare interface SyntheticDependencyLocation {
11421
11635
  name: string;
11422
11636
  index?: number;
@@ -11994,6 +12208,7 @@ declare interface WebpackOptionsNormalized {
11994
12208
  | "commonjs"
11995
12209
  | "commonjs2"
11996
12210
  | "commonjs-module"
12211
+ | "commonjs-static"
11997
12212
  | "amd"
11998
12213
  | "amd-require"
11999
12214
  | "umd"
@@ -12026,7 +12241,7 @@ declare interface WebpackOptionsNormalized {
12026
12241
  /**
12027
12242
  * Enable production optimizations or development hints.
12028
12243
  */
12029
- mode?: "development" | "production" | "none";
12244
+ mode?: "none" | "development" | "production";
12030
12245
 
12031
12246
  /**
12032
12247
  * Options affecting the normal modules (`NormalModuleFactory`).
@@ -12285,11 +12500,16 @@ declare namespace exports {
12285
12500
  export let uncaughtErrorHandler: string;
12286
12501
  export let scriptNonce: string;
12287
12502
  export let loadScript: string;
12503
+ export let createScript: string;
12288
12504
  export let createScriptUrl: string;
12505
+ export let getTrustedTypesPolicy: string;
12289
12506
  export let chunkName: string;
12290
12507
  export let runtimeId: string;
12291
12508
  export let getChunkScriptFilename: string;
12509
+ export let getChunkCssFilename: string;
12510
+ export let hasCssModules: string;
12292
12511
  export let getChunkUpdateScriptFilename: string;
12512
+ export let getChunkUpdateCssFilename: string;
12293
12513
  export let startup: string;
12294
12514
  export let startupNoDefault: string;
12295
12515
  export let startupOnlyAfter: string;
@@ -12625,6 +12845,9 @@ declare namespace exports {
12625
12845
  export namespace schemes {
12626
12846
  export { HttpUriPlugin };
12627
12847
  }
12848
+ export namespace ids {
12849
+ export { SyncModuleIdsPlugin };
12850
+ }
12628
12851
  }
12629
12852
  export type WebpackPluginFunction = (
12630
12853
  this: Compiler,
@@ -12698,6 +12921,7 @@ declare namespace exports {
12698
12921
  RuleSetRule,
12699
12922
  RuleSetUse,
12700
12923
  RuleSetUseItem,
12924
+ StatsOptions,
12701
12925
  Configuration,
12702
12926
  WebpackOptionsNormalized,
12703
12927
  WebpackPluginInstance,
@@ -12705,6 +12929,8 @@ declare namespace exports {
12705
12929
  AssetInfo,
12706
12930
  MultiStats,
12707
12931
  ParserState,
12932
+ ResolvePluginInstance,
12933
+ Resolver,
12708
12934
  Watching,
12709
12935
  StatsAsset,
12710
12936
  StatsChunk,