webpack 5.57.1 → 5.59.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/ChunkGraph.js +0 -26
- package/lib/Compilation.js +222 -115
- package/lib/Compiler.js +2 -2
- package/lib/DefinePlugin.js +1 -1
- package/lib/DependenciesBlock.js +9 -0
- package/lib/Dependency.js +2 -0
- package/lib/FileSystemInfo.js +112 -30
- package/lib/Module.js +4 -0
- package/lib/ModuleGraph.js +11 -17
- package/lib/NormalModule.js +64 -27
- package/lib/NormalModuleFactory.js +57 -55
- package/lib/RuntimeTemplate.js +1 -1
- package/lib/WebpackOptionsApply.js +0 -2
- package/lib/buildChunkGraph.js +157 -100
- package/lib/cache/AddManagedPathsPlugin.js +2 -2
- package/lib/cache/PackFileCacheStrategy.js +2 -2
- package/lib/config/defaults.js +65 -43
- package/lib/config/normalization.js +6 -1
- package/lib/logging/Logger.js +1 -0
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +1 -1
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -0
- package/lib/optimize/SplitChunksPlugin.js +57 -4
- package/lib/schemes/FileUriPlugin.js +9 -0
- package/lib/schemes/HttpUriPlugin.js +107 -31
- package/lib/serialization/Serializer.js +2 -4
- package/lib/util/fs.js +2 -0
- package/lib/util/propertyAccess.js +2 -2
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +258 -55
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
- package/schemas/plugins/schemes/HttpUriPlugin.json +28 -0
- package/types.d.ts +118 -91
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
|
}
|
@@ -632,6 +631,7 @@ declare interface CacheGroupSource {
|
|
632
631
|
chunksFilter?: (chunk: Chunk) => boolean;
|
633
632
|
enforce?: boolean;
|
634
633
|
minSize: SplitChunksSizes;
|
634
|
+
minSizeReduction: SplitChunksSizes;
|
635
635
|
minRemainingSize: SplitChunksSizes;
|
636
636
|
enforceSizeThreshold: SplitChunksSizes;
|
637
637
|
maxAsyncSize: SplitChunksSizes;
|
@@ -1646,6 +1646,7 @@ declare class Compilation {
|
|
1646
1646
|
*/
|
1647
1647
|
addChunk(name?: string): Chunk;
|
1648
1648
|
assignDepth(module: Module): void;
|
1649
|
+
assignDepths(modules: Set<Module>): void;
|
1649
1650
|
getDependencyReferencedExports(
|
1650
1651
|
dependency: Dependency,
|
1651
1652
|
runtime: RuntimeSpec
|
@@ -1895,8 +1896,8 @@ declare class Compiler {
|
|
1895
1896
|
recordsInputPath: null | string;
|
1896
1897
|
recordsOutputPath: null | string;
|
1897
1898
|
records: object;
|
1898
|
-
managedPaths: Set<string>;
|
1899
|
-
immutablePaths: Set<string>;
|
1899
|
+
managedPaths: Set<string | RegExp>;
|
1900
|
+
immutablePaths: Set<string | RegExp>;
|
1900
1901
|
modifiedFiles: ReadonlySet<string>;
|
1901
1902
|
removedFiles: ReadonlySet<string>;
|
1902
1903
|
fileTimestamps: ReadonlyMap<string, null | FileSystemInfoEntry | "ignore">;
|
@@ -2544,6 +2545,8 @@ declare interface DepConstructor {
|
|
2544
2545
|
declare abstract class DependenciesBlock {
|
2545
2546
|
dependencies: Dependency[];
|
2546
2547
|
blocks: AsyncDependenciesBlock[];
|
2548
|
+
parent: DependenciesBlock;
|
2549
|
+
getRootBlock(): DependenciesBlock;
|
2547
2550
|
|
2548
2551
|
/**
|
2549
2552
|
* Adds a DependencyBlock to DependencyBlock relationship.
|
@@ -3287,11 +3290,12 @@ declare interface ExecuteModuleResult {
|
|
3287
3290
|
missingDependencies: LazySet<string>;
|
3288
3291
|
buildDependencies: LazySet<string>;
|
3289
3292
|
}
|
3293
|
+
type Experiments = ExperimentsCommon & ExperimentsExtra;
|
3290
3294
|
|
3291
3295
|
/**
|
3292
3296
|
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
3293
3297
|
*/
|
3294
|
-
declare interface
|
3298
|
+
declare interface ExperimentsCommon {
|
3295
3299
|
/**
|
3296
3300
|
* Allow module type 'asset' to generate assets.
|
3297
3301
|
*/
|
@@ -3302,11 +3306,6 @@ declare interface Experiments {
|
|
3302
3306
|
*/
|
3303
3307
|
asyncWebAssembly?: boolean;
|
3304
3308
|
|
3305
|
-
/**
|
3306
|
-
* Build http(s): urls using a lockfile and resource content cache.
|
3307
|
-
*/
|
3308
|
-
buildHttp?: boolean | HttpUriOptions;
|
3309
|
-
|
3310
3309
|
/**
|
3311
3310
|
* Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.
|
3312
3311
|
*/
|
@@ -3322,40 +3321,6 @@ declare interface Experiments {
|
|
3322
3321
|
*/
|
3323
3322
|
layers?: boolean;
|
3324
3323
|
|
3325
|
-
/**
|
3326
|
-
* Compile entrypoints and import()s only when they are accessed.
|
3327
|
-
*/
|
3328
|
-
lazyCompilation?:
|
3329
|
-
| boolean
|
3330
|
-
| {
|
3331
|
-
/**
|
3332
|
-
* A custom backend.
|
3333
|
-
*/
|
3334
|
-
backend?:
|
3335
|
-
| ((
|
3336
|
-
compiler: Compiler,
|
3337
|
-
client: string,
|
3338
|
-
callback: (err?: Error, api?: any) => void
|
3339
|
-
) => void)
|
3340
|
-
| ((compiler: Compiler, client: string) => Promise<any>);
|
3341
|
-
/**
|
3342
|
-
* A custom client.
|
3343
|
-
*/
|
3344
|
-
client?: string;
|
3345
|
-
/**
|
3346
|
-
* Enable/disable lazy compilation for entries.
|
3347
|
-
*/
|
3348
|
-
entries?: boolean;
|
3349
|
-
/**
|
3350
|
-
* Enable/disable lazy compilation for import() modules.
|
3351
|
-
*/
|
3352
|
-
imports?: boolean;
|
3353
|
-
/**
|
3354
|
-
* Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name.
|
3355
|
-
*/
|
3356
|
-
test?: string | RegExp | ((module: Module) => boolean);
|
3357
|
-
};
|
3358
|
-
|
3359
3324
|
/**
|
3360
3325
|
* Allow output javascript files as module source type.
|
3361
3326
|
*/
|
@@ -3371,6 +3336,37 @@ declare interface Experiments {
|
|
3371
3336
|
*/
|
3372
3337
|
topLevelAwait?: boolean;
|
3373
3338
|
}
|
3339
|
+
|
3340
|
+
/**
|
3341
|
+
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
3342
|
+
*/
|
3343
|
+
declare interface ExperimentsExtra {
|
3344
|
+
/**
|
3345
|
+
* Build http(s): urls using a lockfile and resource content cache.
|
3346
|
+
*/
|
3347
|
+
buildHttp?: HttpUriOptions | (string | RegExp | ((uri: string) => boolean))[];
|
3348
|
+
|
3349
|
+
/**
|
3350
|
+
* Compile entrypoints and import()s only when they are accessed.
|
3351
|
+
*/
|
3352
|
+
lazyCompilation?: boolean | LazyCompilationOptions;
|
3353
|
+
}
|
3354
|
+
type ExperimentsNormalized = ExperimentsCommon & ExperimentsNormalizedExtra;
|
3355
|
+
|
3356
|
+
/**
|
3357
|
+
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
3358
|
+
*/
|
3359
|
+
declare interface ExperimentsNormalizedExtra {
|
3360
|
+
/**
|
3361
|
+
* Build http(s): urls using a lockfile and resource content cache.
|
3362
|
+
*/
|
3363
|
+
buildHttp?: HttpUriOptions;
|
3364
|
+
|
3365
|
+
/**
|
3366
|
+
* Compile entrypoints and import()s only when they are accessed.
|
3367
|
+
*/
|
3368
|
+
lazyCompilation?: LazyCompilationOptions;
|
3369
|
+
}
|
3374
3370
|
declare abstract class ExportInfo {
|
3375
3371
|
name: string;
|
3376
3372
|
|
@@ -3931,12 +3927,12 @@ declare interface FileCacheOptions {
|
|
3931
3927
|
/**
|
3932
3928
|
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
|
3933
3929
|
*/
|
3934
|
-
immutablePaths?: string[];
|
3930
|
+
immutablePaths?: (string | RegExp)[];
|
3935
3931
|
|
3936
3932
|
/**
|
3937
3933
|
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
|
3938
3934
|
*/
|
3939
|
-
managedPaths?: string[];
|
3935
|
+
managedPaths?: (string | RegExp)[];
|
3940
3936
|
|
3941
3937
|
/**
|
3942
3938
|
* Time for which unused cache entries stay in the filesystem cache at minimum (in milliseconds).
|
@@ -4049,10 +4045,12 @@ declare abstract class FileSystemInfo {
|
|
4049
4045
|
contextTshQueue: AsyncQueue<string, string, null | ContextTimestampAndHash>;
|
4050
4046
|
managedItemQueue: AsyncQueue<string, string, null | string>;
|
4051
4047
|
managedItemDirectoryQueue: AsyncQueue<string, string, Set<string>>;
|
4052
|
-
managedPaths: string[];
|
4048
|
+
managedPaths: (string | RegExp)[];
|
4053
4049
|
managedPathsWithSlash: string[];
|
4054
|
-
|
4050
|
+
managedPathsRegExps: RegExp[];
|
4051
|
+
immutablePaths: (string | RegExp)[];
|
4055
4052
|
immutablePathsWithSlash: string[];
|
4053
|
+
immutablePathsRegExps: RegExp[];
|
4056
4054
|
logStatistics(): void;
|
4057
4055
|
clear(): void;
|
4058
4056
|
addFileTimestamps(
|
@@ -4378,6 +4376,11 @@ declare class HotUpdateChunk extends Chunk {
|
|
4378
4376
|
* Options for building http resources.
|
4379
4377
|
*/
|
4380
4378
|
declare interface HttpUriOptions {
|
4379
|
+
/**
|
4380
|
+
* List of allowed URIs (resp. the beginning of them).
|
4381
|
+
*/
|
4382
|
+
allowedUris: (string | RegExp | ((uri: string) => boolean))[];
|
4383
|
+
|
4381
4384
|
/**
|
4382
4385
|
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4383
4386
|
*/
|
@@ -4399,27 +4402,7 @@ declare interface HttpUriOptions {
|
|
4399
4402
|
upgrade?: boolean;
|
4400
4403
|
}
|
4401
4404
|
declare class HttpUriPlugin {
|
4402
|
-
constructor(options
|
4403
|
-
/**
|
4404
|
-
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4405
|
-
*/
|
4406
|
-
cacheLocation?: string | false;
|
4407
|
-
/**
|
4408
|
-
* When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
|
4409
|
-
*/
|
4410
|
-
frozen?: boolean;
|
4411
|
-
/**
|
4412
|
-
* Location of the lockfile.
|
4413
|
-
*/
|
4414
|
-
lockfileLocation?: string;
|
4415
|
-
/**
|
4416
|
-
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4417
|
-
*/
|
4418
|
-
upgrade?: boolean;
|
4419
|
-
hashFunction?: string | typeof Hash;
|
4420
|
-
hashDigest?: string;
|
4421
|
-
hashDigestLength?: number;
|
4422
|
-
});
|
4405
|
+
constructor(options: HttpUriOptions);
|
4423
4406
|
|
4424
4407
|
/**
|
4425
4408
|
* Apply the plugin
|
@@ -5810,6 +5793,42 @@ declare interface KnownStatsProfile {
|
|
5810
5793
|
factory: number;
|
5811
5794
|
dependencies: number;
|
5812
5795
|
}
|
5796
|
+
|
5797
|
+
/**
|
5798
|
+
* Options for compiling entrypoints and import()s only when they are accessed.
|
5799
|
+
*/
|
5800
|
+
declare interface LazyCompilationOptions {
|
5801
|
+
/**
|
5802
|
+
* A custom backend.
|
5803
|
+
*/
|
5804
|
+
backend?:
|
5805
|
+
| ((
|
5806
|
+
compiler: Compiler,
|
5807
|
+
client: string,
|
5808
|
+
callback: (err?: Error, api?: any) => void
|
5809
|
+
) => void)
|
5810
|
+
| ((compiler: Compiler, client: string) => Promise<any>);
|
5811
|
+
|
5812
|
+
/**
|
5813
|
+
* A custom client.
|
5814
|
+
*/
|
5815
|
+
client?: string;
|
5816
|
+
|
5817
|
+
/**
|
5818
|
+
* Enable/disable lazy compilation for entries.
|
5819
|
+
*/
|
5820
|
+
entries?: boolean;
|
5821
|
+
|
5822
|
+
/**
|
5823
|
+
* Enable/disable lazy compilation for import() modules.
|
5824
|
+
*/
|
5825
|
+
imports?: boolean;
|
5826
|
+
|
5827
|
+
/**
|
5828
|
+
* Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name.
|
5829
|
+
*/
|
5830
|
+
test?: string | RegExp | ((module: Module) => boolean);
|
5831
|
+
}
|
5813
5832
|
declare class LazySet<T> {
|
5814
5833
|
constructor(iterable?: Iterable<T>);
|
5815
5834
|
readonly size: number;
|
@@ -6500,6 +6519,7 @@ declare class Module extends DependenciesBlock {
|
|
6500
6519
|
getSideEffectsConnectionState(moduleGraph: ModuleGraph): ConnectionState;
|
6501
6520
|
codeGeneration(context: CodeGenerationContext): CodeGenerationResult;
|
6502
6521
|
chunkCondition(chunk: Chunk, compilation: Compilation): boolean;
|
6522
|
+
hasChunkCondition(): boolean;
|
6503
6523
|
|
6504
6524
|
/**
|
6505
6525
|
* Assuming this module is in the cache. Update the (cached) module with
|
@@ -6669,10 +6689,12 @@ declare class ModuleGraph {
|
|
6669
6689
|
setParents(
|
6670
6690
|
dependency: Dependency,
|
6671
6691
|
block: DependenciesBlock,
|
6672
|
-
module: Module
|
6692
|
+
module: Module,
|
6693
|
+
indexInBlock?: number
|
6673
6694
|
): void;
|
6674
6695
|
getParentModule(dependency: Dependency): Module;
|
6675
6696
|
getParentBlock(dependency: Dependency): DependenciesBlock;
|
6697
|
+
getParentBlockIndex(dependency: Dependency): number;
|
6676
6698
|
setResolvedModule(
|
6677
6699
|
originModule: Module,
|
6678
6700
|
dependency: Dependency,
|
@@ -7347,12 +7369,6 @@ declare class NormalModule extends Module {
|
|
7347
7369
|
sourceMap?: any,
|
7348
7370
|
associatedObjectForCache?: Object
|
7349
7371
|
): Source;
|
7350
|
-
createLoaderContext(
|
7351
|
-
resolver: ResolverWithOptions,
|
7352
|
-
options: WebpackOptionsNormalized,
|
7353
|
-
compilation: Compilation,
|
7354
|
-
fs: InputFileSystem
|
7355
|
-
): NormalModuleLoaderContext<any>;
|
7356
7372
|
getCurrentLoader(loaderContext?: any, index?: any): null | LoaderItem;
|
7357
7373
|
createSource(
|
7358
7374
|
context: string,
|
@@ -7360,13 +7376,6 @@ declare class NormalModule extends Module {
|
|
7360
7376
|
sourceMap?: any,
|
7361
7377
|
associatedObjectForCache?: Object
|
7362
7378
|
): Source;
|
7363
|
-
doBuild(
|
7364
|
-
options: WebpackOptionsNormalized,
|
7365
|
-
compilation: Compilation,
|
7366
|
-
resolver: ResolverWithOptions,
|
7367
|
-
fs: InputFileSystem,
|
7368
|
-
callback: (arg0?: WebpackError) => void
|
7369
|
-
): void;
|
7370
7379
|
markModuleAsErrored(error: WebpackError): void;
|
7371
7380
|
applyNoParseRule(rule?: any, content?: any): any;
|
7372
7381
|
shouldPreventParsing(noParseRule?: any, request?: any): any;
|
@@ -7378,9 +7387,12 @@ declare class NormalModule extends Module {
|
|
7378
7387
|
declare interface NormalModuleCompilationHooks {
|
7379
7388
|
loader: SyncHook<[object, NormalModule]>;
|
7380
7389
|
beforeLoaders: SyncHook<[LoaderItem[], NormalModule, object]>;
|
7390
|
+
beforeParse: SyncHook<[NormalModule]>;
|
7391
|
+
beforeSnapshot: SyncHook<[NormalModule]>;
|
7381
7392
|
readResourceForScheme: HookMap<
|
7382
7393
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7383
7394
|
>;
|
7395
|
+
readResource: HookMap<AsyncSeriesBailHook<[object], string | Buffer>>;
|
7384
7396
|
needBuild: AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>;
|
7385
7397
|
}
|
7386
7398
|
declare abstract class NormalModuleFactory extends ModuleFactory {
|
@@ -7811,6 +7823,11 @@ declare interface OptimizationSplitChunksCacheGroup {
|
|
7811
7823
|
*/
|
7812
7824
|
minSize?: number | { [index: string]: number };
|
7813
7825
|
|
7826
|
+
/**
|
7827
|
+
* Minimum size reduction due to the created chunk.
|
7828
|
+
*/
|
7829
|
+
minSizeReduction?: number | { [index: string]: number };
|
7830
|
+
|
7814
7831
|
/**
|
7815
7832
|
* Give chunks for this cache group a name (chunks with equal name are merged).
|
7816
7833
|
*/
|
@@ -7902,6 +7919,10 @@ declare interface OptimizationSplitChunksOptions {
|
|
7902
7919
|
* Minimal size for the created chunk.
|
7903
7920
|
*/
|
7904
7921
|
minSize?: number | { [index: string]: number };
|
7922
|
+
/**
|
7923
|
+
* Minimum size reduction due to the created chunk.
|
7924
|
+
*/
|
7925
|
+
minSizeReduction?: number | { [index: string]: number };
|
7905
7926
|
};
|
7906
7927
|
|
7907
7928
|
/**
|
@@ -7954,6 +7975,11 @@ declare interface OptimizationSplitChunksOptions {
|
|
7954
7975
|
*/
|
7955
7976
|
minSize?: number | { [index: string]: number };
|
7956
7977
|
|
7978
|
+
/**
|
7979
|
+
* Minimum size reduction due to the created chunk.
|
7980
|
+
*/
|
7981
|
+
minSizeReduction?: number | { [index: string]: number };
|
7982
|
+
|
7957
7983
|
/**
|
7958
7984
|
* Give chunks created a name (chunks with equal name are merged).
|
7959
7985
|
*/
|
@@ -10442,12 +10468,12 @@ declare class SizeOnlySource extends Source {
|
|
10442
10468
|
}
|
10443
10469
|
declare abstract class Snapshot {
|
10444
10470
|
startTime?: number;
|
10445
|
-
fileTimestamps?: Map<string, FileSystemInfoEntry>;
|
10446
|
-
fileHashes?: Map<string, string>;
|
10447
|
-
fileTshs?: Map<string, string | TimestampAndHash>;
|
10448
|
-
contextTimestamps?: Map<string, ResolvedContextFileSystemInfoEntry>;
|
10449
|
-
contextHashes?: Map<string, string>;
|
10450
|
-
contextTshs?: Map<string, ResolvedContextTimestampAndHash>;
|
10471
|
+
fileTimestamps?: Map<string, null | FileSystemInfoEntry>;
|
10472
|
+
fileHashes?: Map<string, null | string>;
|
10473
|
+
fileTshs?: Map<string, null | string | TimestampAndHash>;
|
10474
|
+
contextTimestamps?: Map<string, null | ResolvedContextFileSystemInfoEntry>;
|
10475
|
+
contextHashes?: Map<string, null | string>;
|
10476
|
+
contextTshs?: Map<string, null | ResolvedContextTimestampAndHash>;
|
10451
10477
|
missingExistence?: Map<string, boolean>;
|
10452
10478
|
managedItemInfo?: Map<string, string>;
|
10453
10479
|
managedFiles?: Set<string>;
|
@@ -10510,12 +10536,12 @@ declare interface SnapshotOptions {
|
|
10510
10536
|
/**
|
10511
10537
|
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
|
10512
10538
|
*/
|
10513
|
-
immutablePaths?: string[];
|
10539
|
+
immutablePaths?: (string | RegExp)[];
|
10514
10540
|
|
10515
10541
|
/**
|
10516
10542
|
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
|
10517
10543
|
*/
|
10518
|
-
managedPaths?: string[];
|
10544
|
+
managedPaths?: (string | RegExp)[];
|
10519
10545
|
|
10520
10546
|
/**
|
10521
10547
|
* Options for snapshotting dependencies of modules to determine if they need to be built again.
|
@@ -10715,6 +10741,7 @@ declare interface SplitChunksOptions {
|
|
10715
10741
|
chunksFilter: (chunk: Chunk) => boolean;
|
10716
10742
|
defaultSizeTypes: string[];
|
10717
10743
|
minSize: SplitChunksSizes;
|
10744
|
+
minSizeReduction: SplitChunksSizes;
|
10718
10745
|
minRemainingSize: SplitChunksSizes;
|
10719
10746
|
enforceSizeThreshold: SplitChunksSizes;
|
10720
10747
|
maxInitialSize: SplitChunksSizes;
|
@@ -11840,7 +11867,7 @@ declare interface WebpackOptionsNormalized {
|
|
11840
11867
|
/**
|
11841
11868
|
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
11842
11869
|
*/
|
11843
|
-
experiments:
|
11870
|
+
experiments: ExperimentsNormalized;
|
11844
11871
|
|
11845
11872
|
/**
|
11846
11873
|
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
|