webpack 5.50.0 → 5.52.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 (43) hide show
  1. package/README.md +4 -16
  2. package/lib/ChunkGraph.js +75 -1
  3. package/lib/Compilation.js +10 -1
  4. package/lib/Compiler.js +7 -0
  5. package/lib/EvalSourceMapDevToolPlugin.js +2 -2
  6. package/lib/ExternalModule.js +25 -16
  7. package/lib/FileSystemInfo.js +660 -191
  8. package/lib/HotModuleReplacementPlugin.js +14 -0
  9. package/lib/InitFragment.js +23 -0
  10. package/lib/NormalModule.js +10 -2
  11. package/lib/NormalModuleFactory.js +7 -4
  12. package/lib/RuntimeGlobals.js +5 -0
  13. package/lib/RuntimeModule.js +2 -1
  14. package/lib/SourceMapDevToolPlugin.js +2 -2
  15. package/lib/Watching.js +8 -10
  16. package/lib/WebpackOptionsApply.js +1 -3
  17. package/lib/config/defaults.js +0 -1
  18. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +6 -2
  19. package/lib/dependencies/LoaderPlugin.js +94 -98
  20. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +10 -1
  21. package/lib/library/ModuleLibraryPlugin.js +4 -0
  22. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +7 -1
  23. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -2
  24. package/lib/node/ReadFileCompileWasmPlugin.js +2 -1
  25. package/lib/node/RequireChunkLoadingRuntimeModule.js +7 -1
  26. package/lib/optimize/ConcatenatedModule.js +3 -3
  27. package/lib/optimize/MangleExportsPlugin.js +21 -4
  28. package/lib/optimize/SplitChunksPlugin.js +1 -1
  29. package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -0
  30. package/lib/util/fs.js +40 -0
  31. package/lib/util/identifier.js +26 -8
  32. package/lib/util/internalSerializables.js +1 -0
  33. package/lib/util/propertyAccess.js +54 -1
  34. package/lib/wasm-async/{AsyncWasmChunkLoadingRuntimeModule.js → AsyncWasmLoadingRuntimeModule.js} +3 -3
  35. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +18 -2
  36. package/lib/web/FetchCompileAsyncWasmPlugin.js +2 -2
  37. package/lib/web/FetchCompileWasmPlugin.js +2 -1
  38. package/lib/web/JsonpChunkLoadingRuntimeModule.js +21 -8
  39. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +7 -1
  40. package/package.json +3 -2
  41. package/schemas/WebpackOptions.check.js +1 -1
  42. package/schemas/WebpackOptions.json +0 -4
  43. package/types.d.ts +62 -12
@@ -699,10 +699,6 @@
699
699
  }
700
700
  ]
701
701
  },
702
- "executeModule": {
703
- "description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
704
- "type": "boolean"
705
- },
706
702
  "layers": {
707
703
  "description": "Enable module and chunk layers.",
708
704
  "type": "boolean"
package/types.d.ts CHANGED
@@ -767,6 +767,10 @@ declare class ChunkGraph {
767
767
  attachModules(chunk: Chunk, modules: Iterable<Module>): void;
768
768
  attachRuntimeModules(chunk: Chunk, modules: Iterable<RuntimeModule>): void;
769
769
  attachFullHashModules(chunk: Chunk, modules: Iterable<RuntimeModule>): void;
770
+ attachDependentHashModules(
771
+ chunk: Chunk,
772
+ modules: Iterable<RuntimeModule>
773
+ ): void;
770
774
  replaceModule(oldModule: Module, newModule: Module): void;
771
775
  isModuleInChunk(module: Module, chunk: Chunk): boolean;
772
776
  isModuleInChunkGroup(module: Module, chunkGroup: ChunkGroup): boolean;
@@ -780,6 +784,7 @@ declare class ChunkGraph {
780
784
  getNumberOfModuleChunks(module: Module): number;
781
785
  getModuleRuntimes(module: Module): RuntimeSpecSet;
782
786
  getNumberOfChunkModules(chunk: Chunk): number;
787
+ getNumberOfChunkFullHashModules(chunk: Chunk): number;
783
788
  getChunkModulesIterable(chunk: Chunk): Iterable<Module>;
784
789
  getChunkModulesIterableBySourceType(
785
790
  chunk: Chunk,
@@ -831,6 +836,7 @@ declare class ChunkGraph {
831
836
  ): number;
832
837
  canChunksBeIntegrated(chunkA: Chunk, chunkB: Chunk): boolean;
833
838
  integrateChunks(chunkA: Chunk, chunkB: Chunk): void;
839
+ upgradeDependentToFullHashModules(chunk: Chunk): void;
834
840
  isEntryModuleInChunk(module: Module, chunk: Chunk): boolean;
835
841
  connectChunkAndEntryModule(
836
842
  chunk: Chunk,
@@ -839,6 +845,7 @@ declare class ChunkGraph {
839
845
  ): void;
840
846
  connectChunkAndRuntimeModule(chunk: Chunk, module: RuntimeModule): void;
841
847
  addFullHashModuleToChunk(chunk: Chunk, module: RuntimeModule): void;
848
+ addDependentHashModuleToChunk(chunk: Chunk, module: RuntimeModule): void;
842
849
  disconnectChunkAndEntryModule(chunk: Chunk, module: Module): void;
843
850
  disconnectChunkAndRuntimeModule(chunk: Chunk, module: RuntimeModule): void;
844
851
  disconnectEntryModule(module: Module): void;
@@ -856,6 +863,9 @@ declare class ChunkGraph {
856
863
  getChunkFullHashModulesSet(
857
864
  chunk: Chunk
858
865
  ): undefined | ReadonlySet<RuntimeModule>;
866
+ getChunkDependentHashModulesIterable(
867
+ chunk: Chunk
868
+ ): undefined | Iterable<RuntimeModule>;
859
869
  getChunkEntryModulesWithChunkGroupIterable(
860
870
  chunk: Chunk
861
871
  ): Iterable<[Module, undefined | Entrypoint]>;
@@ -2388,6 +2398,17 @@ declare class ContextExclusionPlugin {
2388
2398
  */
2389
2399
  apply(compiler: Compiler): void;
2390
2400
  }
2401
+ declare interface ContextFileSystemInfoEntry {
2402
+ safeTime: number;
2403
+ timestampHash?: string;
2404
+ resolved?: ResolvedContextFileSystemInfoEntry;
2405
+ symlinks?: Set<string>;
2406
+ }
2407
+ declare interface ContextHash {
2408
+ hash: string;
2409
+ resolved?: string;
2410
+ symlinks?: Set<string>;
2411
+ }
2391
2412
  type ContextMode =
2392
2413
  | "sync"
2393
2414
  | "eager"
@@ -2455,6 +2476,13 @@ declare class ContextReplacementPlugin {
2455
2476
  newContentRegExp: any;
2456
2477
  apply(compiler?: any): void;
2457
2478
  }
2479
+ declare interface ContextTimestampAndHash {
2480
+ safeTime: number;
2481
+ timestampHash?: string;
2482
+ hash: string;
2483
+ resolved?: ResolvedContextTimestampAndHash;
2484
+ symlinks?: Set<string>;
2485
+ }
2458
2486
  type CreateStatsOptionsContext = KnownCreateStatsOptionsContext &
2459
2487
  Record<string, any>;
2460
2488
  type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
@@ -3254,11 +3282,6 @@ declare interface Experiments {
3254
3282
  */
3255
3283
  buildHttp?: boolean | HttpUriOptions;
3256
3284
 
3257
- /**
3258
- * Enable build-time execution of modules from the module graph for plugins and loaders.
3259
- */
3260
- executeModule?: boolean;
3261
-
3262
3285
  /**
3263
3286
  * Enable module and chunk layers.
3264
3287
  */
@@ -3968,8 +3991,13 @@ declare abstract class FileSystemInfo {
3968
3991
  logger?: WebpackLogger;
3969
3992
  fileTimestampQueue: AsyncQueue<string, string, null | FileSystemInfoEntry>;
3970
3993
  fileHashQueue: AsyncQueue<string, string, null | string>;
3971
- contextTimestampQueue: AsyncQueue<string, string, null | FileSystemInfoEntry>;
3972
- contextHashQueue: AsyncQueue<string, string, null | string>;
3994
+ contextTimestampQueue: AsyncQueue<
3995
+ string,
3996
+ string,
3997
+ null | ContextFileSystemInfoEntry
3998
+ >;
3999
+ contextHashQueue: AsyncQueue<string, string, null | ContextHash>;
4000
+ contextTshQueue: AsyncQueue<string, string, null | ContextTimestampAndHash>;
3973
4001
  managedItemQueue: AsyncQueue<string, string, null | string>;
3974
4002
  managedItemDirectoryQueue: AsyncQueue<string, string, Set<string>>;
3975
4003
  managedPaths: string[];
@@ -3997,7 +4025,7 @@ declare abstract class FileSystemInfo {
3997
4025
  path: string,
3998
4026
  callback: (
3999
4027
  arg0?: WebpackError,
4000
- arg1?: null | FileSystemInfoEntry | "ignore"
4028
+ arg1?: null | "ignore" | ResolvedContextFileSystemInfoEntry
4001
4029
  ) => void
4002
4030
  ): void;
4003
4031
  getFileHash(
@@ -4008,6 +4036,13 @@ declare abstract class FileSystemInfo {
4008
4036
  path: string,
4009
4037
  callback: (arg0?: WebpackError, arg1?: string) => void
4010
4038
  ): void;
4039
+ getContextTsh(
4040
+ path: string,
4041
+ callback: (
4042
+ arg0?: WebpackError,
4043
+ arg1?: ResolvedContextTimestampAndHash
4044
+ ) => void
4045
+ ): void;
4011
4046
  resolveBuildDependencies(
4012
4047
  context: string,
4013
4048
  deps: Iterable<string>,
@@ -4045,7 +4080,6 @@ declare abstract class FileSystemInfo {
4045
4080
  declare interface FileSystemInfoEntry {
4046
4081
  safeTime: number;
4047
4082
  timestamp?: number;
4048
- timestampHash?: string;
4049
4083
  }
4050
4084
  declare interface FileSystemStats {
4051
4085
  isDirectory: () => boolean;
@@ -4478,6 +4512,8 @@ declare abstract class InitFragment<Context> {
4478
4512
  endContent?: string | Source;
4479
4513
  getContent(context: Context): string | Source;
4480
4514
  getEndContent(context: Context): undefined | string | Source;
4515
+ serialize(context?: any): void;
4516
+ deserialize(context?: any): void;
4481
4517
  merge: any;
4482
4518
  }
4483
4519
  declare interface InputFileSystem {
@@ -4504,6 +4540,10 @@ declare interface InputFileSystem {
4504
4540
  arg0: string,
4505
4541
  arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
4506
4542
  ) => void;
4543
+ lstat?: (
4544
+ arg0: string,
4545
+ arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void
4546
+ ) => void;
4507
4547
  realpath?: (
4508
4548
  arg0: string,
4509
4549
  arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void
@@ -9255,6 +9295,15 @@ declare interface ResolvePluginInstance {
9255
9295
  apply: (resolver: Resolver) => void;
9256
9296
  }
9257
9297
  type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
9298
+ declare interface ResolvedContextFileSystemInfoEntry {
9299
+ safeTime: number;
9300
+ timestampHash?: string;
9301
+ }
9302
+ declare interface ResolvedContextTimestampAndHash {
9303
+ safeTime: number;
9304
+ timestampHash?: string;
9305
+ hash: string;
9306
+ }
9258
9307
  declare abstract class Resolver {
9259
9308
  fileSystem: FileSystem;
9260
9309
  options: ResolveOptionsTypes;
@@ -9737,6 +9786,7 @@ declare class RuntimeModule extends Module {
9737
9786
  chunk: Chunk;
9738
9787
  chunkGraph: ChunkGraph;
9739
9788
  fullHash: boolean;
9789
+ dependentHash: boolean;
9740
9790
  attach(compilation: Compilation, chunk: Chunk, chunkGraph?: ChunkGraph): void;
9741
9791
  generate(): string;
9742
9792
  getGeneratedCode(): string;
@@ -10326,9 +10376,9 @@ declare abstract class Snapshot {
10326
10376
  fileTimestamps?: Map<string, FileSystemInfoEntry>;
10327
10377
  fileHashes?: Map<string, string>;
10328
10378
  fileTshs?: Map<string, string | TimestampAndHash>;
10329
- contextTimestamps?: Map<string, FileSystemInfoEntry>;
10379
+ contextTimestamps?: Map<string, ResolvedContextFileSystemInfoEntry>;
10330
10380
  contextHashes?: Map<string, string>;
10331
- contextTshs?: Map<string, string | TimestampAndHash>;
10381
+ contextTshs?: Map<string, ResolvedContextTimestampAndHash>;
10332
10382
  missingExistence?: Map<string, boolean>;
10333
10383
  managedItemInfo?: Map<string, string>;
10334
10384
  managedFiles?: Set<string>;
@@ -11242,7 +11292,6 @@ declare class Template {
11242
11292
  declare interface TimestampAndHash {
11243
11293
  safeTime: number;
11244
11294
  timestamp?: number;
11245
- timestampHash?: string;
11246
11295
  hash: string;
11247
11296
  }
11248
11297
 
@@ -12036,6 +12085,7 @@ declare namespace exports {
12036
12085
  export let hmrDownloadUpdateHandlers: string;
12037
12086
  export let hmrModuleData: string;
12038
12087
  export let hmrInvalidateModuleHandlers: string;
12088
+ export let hmrRuntimeStatePrefix: string;
12039
12089
  export let amdDefine: string;
12040
12090
  export let amdOptions: string;
12041
12091
  export let system: string;