webpack 5.99.6 → 5.99.7

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 (107) hide show
  1. package/lib/AutomaticPrefetchPlugin.js +21 -22
  2. package/lib/BannerPlugin.js +31 -35
  3. package/lib/CleanPlugin.js +5 -3
  4. package/lib/Compilation.js +9 -8
  5. package/lib/Compiler.js +2 -1
  6. package/lib/ContextExclusionPlugin.js +4 -2
  7. package/lib/ContextReplacementPlugin.js +5 -3
  8. package/lib/DelegatedPlugin.js +4 -2
  9. package/lib/DllEntryPlugin.js +4 -2
  10. package/lib/DllPlugin.js +5 -3
  11. package/lib/DllReferencePlugin.js +56 -60
  12. package/lib/DynamicEntryPlugin.js +4 -2
  13. package/lib/EntryOptionPlugin.js +3 -1
  14. package/lib/EntryPlugin.js +4 -2
  15. package/lib/EnvironmentPlugin.js +4 -2
  16. package/lib/EvalDevToolModulePlugin.js +9 -7
  17. package/lib/EvalSourceMapDevToolPlugin.js +137 -138
  18. package/lib/ExternalsPlugin.js +3 -1
  19. package/lib/FlagDependencyExportsPlugin.js +2 -1
  20. package/lib/IgnorePlugin.js +6 -4
  21. package/lib/IgnoreWarningsPlugin.js +4 -2
  22. package/lib/LibManifestPlugin.js +3 -4
  23. package/lib/LoaderOptionsPlugin.js +4 -2
  24. package/lib/LoaderTargetPlugin.js +4 -2
  25. package/lib/Module.js +19 -12
  26. package/lib/ModuleInfoHeaderPlugin.js +11 -12
  27. package/lib/MultiCompiler.js +5 -3
  28. package/lib/NoEmitOnErrorsPlugin.js +5 -3
  29. package/lib/NormalModule.js +5 -1
  30. package/lib/NormalModuleReplacementPlugin.js +33 -36
  31. package/lib/PlatformPlugin.js +3 -1
  32. package/lib/PrefetchPlugin.js +4 -2
  33. package/lib/ProgressPlugin.js +23 -26
  34. package/lib/RecordIdsPlugin.js +72 -102
  35. package/lib/RuntimePlugin.js +34 -32
  36. package/lib/SourceMapDevToolPlugin.js +7 -5
  37. package/lib/WarnCaseSensitiveModulesPlugin.js +36 -37
  38. package/lib/WarnNoModeSetPlugin.js +3 -1
  39. package/lib/WatchIgnorePlugin.js +3 -1
  40. package/lib/WebpackError.js +11 -3
  41. package/lib/WebpackOptionsApply.js +5 -3
  42. package/lib/async-modules/InferAsyncModulesPlugin.js +25 -26
  43. package/lib/cache/IdleFileCachePlugin.js +11 -12
  44. package/lib/cache/MemoryWithGcCachePlugin.js +7 -5
  45. package/lib/cache/ResolverCachePlugin.js +8 -6
  46. package/lib/cli.js +5 -1
  47. package/lib/config/normalization.js +9 -3
  48. package/lib/container/ContainerReferencePlugin.js +24 -26
  49. package/lib/container/ModuleFederationPlugin.js +2 -1
  50. package/lib/css/CssGenerator.js +1 -1
  51. package/lib/css/CssModulesPlugin.js +6 -4
  52. package/lib/dependencies/HarmonyDetectionParserPlugin.js +9 -15
  53. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -15
  54. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -2
  55. package/lib/dependencies/LoaderPlugin.js +5 -3
  56. package/lib/dependencies/RequireContextDependencyParserPlugin.js +46 -46
  57. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +94 -100
  58. package/lib/esm/ModuleChunkLoadingPlugin.js +72 -73
  59. package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
  60. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +0 -1
  61. package/lib/hmr/LazyCompilationPlugin.js +17 -18
  62. package/lib/ids/ChunkModuleIdRangePlugin.js +6 -6
  63. package/lib/ids/DeterministicModuleIdsPlugin.js +47 -48
  64. package/lib/ids/HashedModuleIdsPlugin.js +4 -2
  65. package/lib/ids/NamedChunkIdsPlugin.js +4 -2
  66. package/lib/ids/NamedModuleIdsPlugin.js +4 -2
  67. package/lib/ids/NaturalChunkIdsPlugin.js +4 -2
  68. package/lib/ids/NaturalModuleIdsPlugin.js +4 -2
  69. package/lib/ids/OccurrenceChunkIdsPlugin.js +4 -2
  70. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -2
  71. package/lib/javascript/JavascriptParser.js +634 -656
  72. package/lib/library/ModuleLibraryPlugin.js +60 -42
  73. package/lib/node/CommonJsChunkLoadingPlugin.js +69 -73
  74. package/lib/node/NodeEnvironmentPlugin.js +3 -1
  75. package/lib/optimize/AggressiveSplittingPlugin.js +224 -232
  76. package/lib/optimize/ConcatenatedModule.js +12 -15
  77. package/lib/optimize/FlagIncludedChunksPlugin.js +92 -97
  78. package/lib/optimize/LimitChunkCountPlugin.js +4 -2
  79. package/lib/optimize/MangleExportsPlugin.js +15 -16
  80. package/lib/optimize/MinChunkSizePlugin.js +4 -2
  81. package/lib/optimize/ModuleConcatenationPlugin.js +4 -2
  82. package/lib/optimize/RealContentHashPlugin.js +4 -2
  83. package/lib/optimize/RemoveEmptyChunksPlugin.js +5 -3
  84. package/lib/optimize/RemoveParentModulesPlugin.js +4 -2
  85. package/lib/optimize/RuntimeChunkPlugin.js +17 -18
  86. package/lib/optimize/SplitChunksPlugin.js +7 -5
  87. package/lib/performance/SizeLimitsPlugin.js +3 -1
  88. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +61 -62
  89. package/lib/runtime/StartupChunkDependenciesPlugin.js +39 -42
  90. package/lib/schemes/DataUriPlugin.js +5 -3
  91. package/lib/schemes/FileUriPlugin.js +5 -3
  92. package/lib/schemes/HttpUriPlugin.js +32 -39
  93. package/lib/serialization/AggregateErrorSerializer.js +42 -0
  94. package/lib/serialization/ErrorObjectSerializer.js +7 -2
  95. package/lib/serialization/ObjectMiddleware.js +13 -0
  96. package/lib/sharing/ProvideSharedPlugin.js +6 -4
  97. package/lib/stats/DefaultStatsFactoryPlugin.js +89 -33
  98. package/lib/stats/DefaultStatsPresetPlugin.js +25 -20
  99. package/lib/stats/DefaultStatsPrinterPlugin.js +306 -341
  100. package/lib/util/concatenate.js +4 -2
  101. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +55 -57
  102. package/lib/web/JsonpChunkLoadingPlugin.js +73 -74
  103. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +77 -78
  104. package/package.json +4 -3
  105. package/schemas/WebpackOptions.check.js +1 -1
  106. package/schemas/WebpackOptions.json +24 -2
  107. package/types.d.ts +148 -55
@@ -1733,7 +1733,7 @@
1733
1733
  {
1734
1734
  "description": "A custom function to select warnings based on the raw warning instance.",
1735
1735
  "instanceof": "Function",
1736
- "tsType": "((warning: import('../lib/WebpackError'), compilation: import('../lib/Compilation')) => boolean)"
1736
+ "tsType": "((warning: Error, compilation: import('../lib/Compilation')) => boolean)"
1737
1737
  }
1738
1738
  ]
1739
1739
  }
@@ -1744,7 +1744,7 @@
1744
1744
  "items": {
1745
1745
  "description": "A function to select warnings based on the raw warning instance.",
1746
1746
  "instanceof": "Function",
1747
- "tsType": "((warning: import('../lib/WebpackError'), compilation: import('../lib/Compilation')) => boolean)"
1747
+ "tsType": "((warning: Error, compilation: import('../lib/Compilation')) => boolean)"
1748
1748
  }
1749
1749
  },
1750
1750
  "Iife": {
@@ -5048,6 +5048,17 @@
5048
5048
  "description": "Add --env information.",
5049
5049
  "type": "boolean"
5050
5050
  },
5051
+ "errorCause": {
5052
+ "description": "Add cause to errors.",
5053
+ "anyOf": [
5054
+ {
5055
+ "enum": ["auto"]
5056
+ },
5057
+ {
5058
+ "type": "boolean"
5059
+ }
5060
+ ]
5061
+ },
5051
5062
  "errorDetails": {
5052
5063
  "description": "Add details to errors (like resolving log).",
5053
5064
  "anyOf": [
@@ -5059,6 +5070,17 @@
5059
5070
  }
5060
5071
  ]
5061
5072
  },
5073
+ "errorErrors": {
5074
+ "description": "Add nested errors to errors (like in AggregateError).",
5075
+ "anyOf": [
5076
+ {
5077
+ "enum": ["auto"]
5078
+ },
5079
+ {
5080
+ "type": "boolean"
5081
+ }
5082
+ ]
5083
+ },
5062
5084
  "errorStack": {
5063
5085
  "description": "Add internal stack trace to errors.",
5064
5086
  "type": "boolean"
package/types.d.ts CHANGED
@@ -92,10 +92,7 @@ import { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
92
92
  import { ListenOptions, Server } from "net";
93
93
  import { validate as validateFunction } from "schema-utils";
94
94
  import { default as ValidationError } from "schema-utils/declarations/ValidationError";
95
- import {
96
- Extend,
97
- ValidationErrorConfiguration
98
- } from "schema-utils/declarations/validate";
95
+ import { ValidationErrorConfiguration } from "schema-utils/declarations/validate";
99
96
  import {
100
97
  AsArray,
101
98
  AsyncParallelHook,
@@ -1962,8 +1959,8 @@ declare class Compilation {
1962
1959
  needAdditionalPass: SyncBailHook<[], boolean | void>;
1963
1960
  childCompiler: SyncHook<[Compiler, string, number]>;
1964
1961
  log: SyncBailHook<[string, LogEntry], boolean | void>;
1965
- processWarnings: SyncWaterfallHook<[WebpackError[]]>;
1966
- processErrors: SyncWaterfallHook<[WebpackError[]]>;
1962
+ processWarnings: SyncWaterfallHook<[Error[]]>;
1963
+ processErrors: SyncWaterfallHook<[Error[]]>;
1967
1964
  statsPreset: HookMap<
1968
1965
  SyncHook<[Partial<NormalizedStatsOptions>, CreateStatsOptionsContext]>
1969
1966
  >;
@@ -2030,8 +2027,8 @@ declare class Compilation {
2030
2027
  additionalChunkAssets: string[];
2031
2028
  assets: CompilationAssets;
2032
2029
  assetsInfo: Map<string, AssetInfo>;
2033
- errors: WebpackError[];
2034
- warnings: WebpackError[];
2030
+ errors: Error[];
2031
+ warnings: Error[];
2035
2032
  children: Compilation[];
2036
2033
  logging: Map<string, LogEntry[]>;
2037
2034
  dependencyFactories: Map<DepConstructor, ModuleFactory>;
@@ -2230,8 +2227,8 @@ declare class Compilation {
2230
2227
  filename: TemplatePath,
2231
2228
  data: PathData
2232
2229
  ): InterpolatedPathAndAssetInfo;
2233
- getWarnings(): WebpackError[];
2234
- getErrors(): WebpackError[];
2230
+ getWarnings(): Error[];
2231
+ getErrors(): Error[];
2235
2232
 
2236
2233
  /**
2237
2234
  * This function allows you to run another instance of webpack inside of webpack however as
@@ -2705,7 +2702,7 @@ declare interface Configuration {
2705
2702
  */
2706
2703
  module?: RegExp;
2707
2704
  }
2708
- | ((warning: WebpackError, compilation: Compilation) => boolean)
2705
+ | ((warning: Error, compilation: Compilation) => boolean)
2709
2706
  )[];
2710
2707
 
2711
2708
  /**
@@ -3175,6 +3172,17 @@ declare interface CssAutoParserOptions {
3175
3172
  */
3176
3173
  url?: boolean;
3177
3174
  }
3175
+ declare interface CssData {
3176
+ /**
3177
+ * whether export __esModule
3178
+ */
3179
+ esModule: boolean;
3180
+
3181
+ /**
3182
+ * the css exports
3183
+ */
3184
+ exports: Map<string, string>;
3185
+ }
3178
3186
 
3179
3187
  /**
3180
3188
  * Generator options for css modules.
@@ -7714,19 +7722,97 @@ declare interface KnownAssetInfo {
7714
7722
  declare interface KnownBuildInfo {
7715
7723
  cacheable?: boolean;
7716
7724
  parsed?: boolean;
7725
+ strict?: boolean;
7726
+
7727
+ /**
7728
+ * using in AMD
7729
+ */
7717
7730
  moduleArgument?: string;
7731
+
7732
+ /**
7733
+ * using in AMD
7734
+ */
7718
7735
  exportsArgument?: string;
7719
- strict?: boolean;
7736
+
7737
+ /**
7738
+ * using in CommonJs
7739
+ */
7720
7740
  moduleConcatenationBailout?: string;
7741
+
7742
+ /**
7743
+ * using in APIPlugin
7744
+ */
7745
+ needCreateRequire?: boolean;
7746
+
7747
+ /**
7748
+ * using in HttpUriPlugin
7749
+ */
7750
+ resourceIntegrity?: string;
7751
+
7752
+ /**
7753
+ * using in NormalModule
7754
+ */
7721
7755
  fileDependencies?: LazySet<string>;
7756
+
7757
+ /**
7758
+ * using in NormalModule
7759
+ */
7722
7760
  contextDependencies?: LazySet<string>;
7761
+
7762
+ /**
7763
+ * using in NormalModule
7764
+ */
7723
7765
  missingDependencies?: LazySet<string>;
7766
+
7767
+ /**
7768
+ * using in NormalModule
7769
+ */
7724
7770
  buildDependencies?: LazySet<string>;
7771
+
7772
+ /**
7773
+ * using in NormalModule
7774
+ */
7725
7775
  valueDependencies?: Map<string, string | Set<string>>;
7726
- hash?: any;
7776
+
7777
+ /**
7778
+ * using in NormalModule
7779
+ */
7727
7780
  assets?: Record<string, Source>;
7728
- assetsInfo?: Map<string, undefined | AssetInfo>;
7781
+
7782
+ /**
7783
+ * using in NormalModule
7784
+ */
7785
+ hash?: string;
7786
+
7787
+ /**
7788
+ * using in ContextModule
7789
+ */
7729
7790
  snapshot?: null | Snapshot;
7791
+
7792
+ /**
7793
+ * for assets modules
7794
+ */
7795
+ fullContentHash?: string;
7796
+
7797
+ /**
7798
+ * for assets modules
7799
+ */
7800
+ filename?: string;
7801
+
7802
+ /**
7803
+ * for assets modules
7804
+ */
7805
+ assetsInfo?: Map<string, undefined | AssetInfo>;
7806
+
7807
+ /**
7808
+ * for assets modules
7809
+ */
7810
+ dataUrl?: boolean;
7811
+
7812
+ /**
7813
+ * for css modules
7814
+ */
7815
+ cssData?: CssData;
7730
7816
  }
7731
7817
  declare interface KnownBuildMeta {
7732
7818
  exportsType?: "namespace" | "dynamic" | "default" | "flagged";
@@ -7903,6 +7989,8 @@ declare interface KnownStatsError {
7903
7989
  moduleTrace?: StatsModuleTraceItem[];
7904
7990
  details?: string;
7905
7991
  stack?: string;
7992
+ cause?: KnownStatsError;
7993
+ errors?: KnownStatsError[];
7906
7994
  compilerPath?: string;
7907
7995
  }
7908
7996
  declare interface KnownStatsFactoryContext {
@@ -15096,11 +15184,21 @@ declare interface StatsOptions {
15096
15184
  */
15097
15185
  env?: boolean;
15098
15186
 
15187
+ /**
15188
+ * Add cause to errors.
15189
+ */
15190
+ errorCause?: boolean | "auto";
15191
+
15099
15192
  /**
15100
15193
  * Add details to errors (like resolving log).
15101
15194
  */
15102
15195
  errorDetails?: boolean | "auto";
15103
15196
 
15197
+ /**
15198
+ * Add nested errors to errors (like in AggregateError).
15199
+ */
15200
+ errorErrors?: boolean | "auto";
15201
+
15104
15202
  /**
15105
15203
  * Add internal stack trace to errors.
15106
15204
  */
@@ -15778,7 +15876,7 @@ declare class WebpackError extends Error {
15778
15876
  /**
15779
15877
  * Creates an instance of WebpackError.
15780
15878
  */
15781
- constructor(message?: string);
15879
+ constructor(message?: string, options?: { cause?: unknown });
15782
15880
  [index: number]: () => string;
15783
15881
  details?: string;
15784
15882
  module?: null | Module;
@@ -15788,6 +15886,7 @@ declare class WebpackError extends Error {
15788
15886
  file?: string;
15789
15887
  serialize(__0: ObjectSerializerContext): void;
15790
15888
  deserialize(__0: ObjectDeserializerContext): void;
15889
+ cause: any;
15791
15890
 
15792
15891
  /**
15793
15892
  * Create .stack property on a target object
@@ -15925,10 +16024,7 @@ declare interface WebpackOptionsNormalized {
15925
16024
  /**
15926
16025
  * Ignore specific warnings.
15927
16026
  */
15928
- ignoreWarnings?: ((
15929
- warning: WebpackError,
15930
- compilation: Compilation
15931
- ) => boolean)[];
16027
+ ignoreWarnings?: ((warning: Error, compilation: Compilation) => boolean)[];
15932
16028
 
15933
16029
  /**
15934
16030
  * Options for infrastructure level logging.
@@ -16238,42 +16334,39 @@ declare namespace exports {
16238
16334
  export namespace cli {
16239
16335
  export let getArguments: (
16240
16336
  schema?:
16241
- | (JSONSchema4 &
16242
- Extend & {
16243
- absolutePath: boolean;
16244
- instanceof: string;
16245
- cli: {
16246
- helper?: boolean;
16247
- exclude?: boolean;
16248
- description?: string;
16249
- negatedDescription?: string;
16250
- resetDescription?: string;
16251
- };
16252
- })
16253
- | (JSONSchema6 &
16254
- Extend & {
16255
- absolutePath: boolean;
16256
- instanceof: string;
16257
- cli: {
16258
- helper?: boolean;
16259
- exclude?: boolean;
16260
- description?: string;
16261
- negatedDescription?: string;
16262
- resetDescription?: string;
16263
- };
16264
- })
16265
- | (JSONSchema7 &
16266
- Extend & {
16267
- absolutePath: boolean;
16268
- instanceof: string;
16269
- cli: {
16270
- helper?: boolean;
16271
- exclude?: boolean;
16272
- description?: string;
16273
- negatedDescription?: string;
16274
- resetDescription?: string;
16275
- };
16276
- })
16337
+ | (JSONSchema4 & {
16338
+ absolutePath: boolean;
16339
+ instanceof: string;
16340
+ cli: {
16341
+ helper?: boolean;
16342
+ exclude?: boolean;
16343
+ description?: string;
16344
+ negatedDescription?: string;
16345
+ resetDescription?: string;
16346
+ };
16347
+ })
16348
+ | (JSONSchema6 & {
16349
+ absolutePath: boolean;
16350
+ instanceof: string;
16351
+ cli: {
16352
+ helper?: boolean;
16353
+ exclude?: boolean;
16354
+ description?: string;
16355
+ negatedDescription?: string;
16356
+ resetDescription?: string;
16357
+ };
16358
+ })
16359
+ | (JSONSchema7 & {
16360
+ absolutePath: boolean;
16361
+ instanceof: string;
16362
+ cli: {
16363
+ helper?: boolean;
16364
+ exclude?: boolean;
16365
+ description?: string;
16366
+ negatedDescription?: string;
16367
+ resetDescription?: string;
16368
+ };
16369
+ })
16277
16370
  ) => Flags;
16278
16371
  export let processArguments: (
16279
16372
  args: Flags,