webpack 5.57.1 → 5.58.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.
- package/lib/AsyncDependenciesBlock.js +0 -2
- package/lib/ChunkCombination.js +187 -0
- package/lib/ChunkGraph.js +30 -42
- package/lib/Compilation.js +49 -8
- package/lib/DependenciesBlock.js +9 -0
- package/lib/Dependency.js +2 -0
- package/lib/Module.js +4 -0
- package/lib/ModuleGraph.js +11 -17
- package/lib/NormalModule.js +33 -16
- package/lib/buildChunkGraph.js +157 -100
- package/lib/logging/Logger.js +1 -0
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -0
- package/lib/optimize/SplitChunksPlugin.js +135 -235
- package/lib/schemes/FileUriPlugin.js +9 -0
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +6 -1
- package/package.json +1 -1
- package/types.d.ts +20 -2
@@ -5,6 +5,7 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
const WebpackError = require("../WebpackError");
|
8
|
+
const { someInIterable } = require("../util/IterableHelpers");
|
8
9
|
|
9
10
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
10
11
|
/** @typedef {import("../Module")} Module */
|
@@ -42,7 +43,11 @@ const getInitialModuleChains = (
|
|
42
43
|
for (const connection of moduleGraph.getIncomingConnections(head)) {
|
43
44
|
const newHead = connection.originModule;
|
44
45
|
if (newHead) {
|
45
|
-
if (
|
46
|
+
if (
|
47
|
+
!someInIterable(chunkGraph.getModuleChunksIterable(newHead), c =>
|
48
|
+
c.canBeInitial()
|
49
|
+
)
|
50
|
+
)
|
46
51
|
continue;
|
47
52
|
final = false;
|
48
53
|
if (alreadyReferencedModules.has(newHead)) continue;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.58.0",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
6
6
|
"license": "MIT",
|
package/types.d.ts
CHANGED
@@ -335,7 +335,6 @@ declare class AsyncDependenciesBlock extends DependenciesBlock {
|
|
335
335
|
};
|
336
336
|
loc?: SyntheticDependencyLocation | RealDependencyLocation;
|
337
337
|
request?: string;
|
338
|
-
parent: DependenciesBlock;
|
339
338
|
chunkName: string;
|
340
339
|
module: any;
|
341
340
|
}
|
@@ -758,6 +757,17 @@ declare class Chunk {
|
|
758
757
|
filterFn?: (c: Chunk, chunkGraph: ChunkGraph) => boolean
|
759
758
|
): Record<string | number, Record<string, (string | number)[]>>;
|
760
759
|
}
|
760
|
+
declare abstract class ChunkCombination {
|
761
|
+
debugId: number;
|
762
|
+
size: number;
|
763
|
+
readonly chunksIterable: Iterable<Chunk>;
|
764
|
+
with(chunk: Chunk): ChunkCombination;
|
765
|
+
without(chunk: Chunk): ChunkCombination;
|
766
|
+
withAll(other?: any): any;
|
767
|
+
hasSharedChunks(other?: any): boolean;
|
768
|
+
isSubset(other: ChunkCombination): boolean;
|
769
|
+
getChunks(): Chunk[];
|
770
|
+
}
|
761
771
|
declare class ChunkGraph {
|
762
772
|
constructor(moduleGraph: ModuleGraph, hashFunction?: string | typeof Hash);
|
763
773
|
moduleGraph: ModuleGraph;
|
@@ -775,6 +785,7 @@ declare class ChunkGraph {
|
|
775
785
|
isModuleInChunk(module: Module, chunk: Chunk): boolean;
|
776
786
|
isModuleInChunkGroup(module: Module, chunkGroup: ChunkGroup): boolean;
|
777
787
|
isEntryModule(module: Module): boolean;
|
788
|
+
getModuleChunkCombination(module: Module): ChunkCombination;
|
778
789
|
getModuleChunksIterable(module: Module): Iterable<Chunk>;
|
779
790
|
getOrderedModuleChunksIterable(
|
780
791
|
module: Module,
|
@@ -1646,6 +1657,7 @@ declare class Compilation {
|
|
1646
1657
|
*/
|
1647
1658
|
addChunk(name?: string): Chunk;
|
1648
1659
|
assignDepth(module: Module): void;
|
1660
|
+
assignDepths(modules: Set<Module>): void;
|
1649
1661
|
getDependencyReferencedExports(
|
1650
1662
|
dependency: Dependency,
|
1651
1663
|
runtime: RuntimeSpec
|
@@ -2544,6 +2556,8 @@ declare interface DepConstructor {
|
|
2544
2556
|
declare abstract class DependenciesBlock {
|
2545
2557
|
dependencies: Dependency[];
|
2546
2558
|
blocks: AsyncDependenciesBlock[];
|
2559
|
+
parent: DependenciesBlock;
|
2560
|
+
getRootBlock(): DependenciesBlock;
|
2547
2561
|
|
2548
2562
|
/**
|
2549
2563
|
* Adds a DependencyBlock to DependencyBlock relationship.
|
@@ -6500,6 +6514,7 @@ declare class Module extends DependenciesBlock {
|
|
6500
6514
|
getSideEffectsConnectionState(moduleGraph: ModuleGraph): ConnectionState;
|
6501
6515
|
codeGeneration(context: CodeGenerationContext): CodeGenerationResult;
|
6502
6516
|
chunkCondition(chunk: Chunk, compilation: Compilation): boolean;
|
6517
|
+
hasChunkCondition(): boolean;
|
6503
6518
|
|
6504
6519
|
/**
|
6505
6520
|
* Assuming this module is in the cache. Update the (cached) module with
|
@@ -6669,10 +6684,12 @@ declare class ModuleGraph {
|
|
6669
6684
|
setParents(
|
6670
6685
|
dependency: Dependency,
|
6671
6686
|
block: DependenciesBlock,
|
6672
|
-
module: Module
|
6687
|
+
module: Module,
|
6688
|
+
indexInBlock?: number
|
6673
6689
|
): void;
|
6674
6690
|
getParentModule(dependency: Dependency): Module;
|
6675
6691
|
getParentBlock(dependency: Dependency): DependenciesBlock;
|
6692
|
+
getParentBlockIndex(dependency: Dependency): number;
|
6676
6693
|
setResolvedModule(
|
6677
6694
|
originModule: Module,
|
6678
6695
|
dependency: Dependency,
|
@@ -7381,6 +7398,7 @@ declare interface NormalModuleCompilationHooks {
|
|
7381
7398
|
readResourceForScheme: HookMap<
|
7382
7399
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7383
7400
|
>;
|
7401
|
+
readResource: HookMap<AsyncSeriesBailHook<[object], string | Buffer>>;
|
7384
7402
|
needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
|
7385
7403
|
}
|
7386
7404
|
declare abstract class NormalModuleFactory extends ModuleFactory {
|