webpack 5.58.2 → 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/Compilation.js +11 -14
- package/lib/Compiler.js +2 -2
- package/lib/DefinePlugin.js +1 -1
- package/lib/FileSystemInfo.js +50 -7
- package/lib/NormalModule.js +31 -11
- package/lib/RuntimeTemplate.js +1 -1
- package/lib/WebpackOptionsApply.js +0 -2
- 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/optimize/ConcatenatedModule.js +1 -1
- package/lib/optimize/SplitChunksPlugin.js +49 -1
- package/lib/schemes/HttpUriPlugin.js +107 -31
- 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 +104 -83
package/types.d.ts
CHANGED
@@ -631,6 +631,7 @@ declare interface CacheGroupSource {
|
|
631
631
|
chunksFilter?: (chunk: Chunk) => boolean;
|
632
632
|
enforce?: boolean;
|
633
633
|
minSize: SplitChunksSizes;
|
634
|
+
minSizeReduction: SplitChunksSizes;
|
634
635
|
minRemainingSize: SplitChunksSizes;
|
635
636
|
enforceSizeThreshold: SplitChunksSizes;
|
636
637
|
maxAsyncSize: SplitChunksSizes;
|
@@ -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">;
|
@@ -3289,11 +3290,12 @@ declare interface ExecuteModuleResult {
|
|
3289
3290
|
missingDependencies: LazySet<string>;
|
3290
3291
|
buildDependencies: LazySet<string>;
|
3291
3292
|
}
|
3293
|
+
type Experiments = ExperimentsCommon & ExperimentsExtra;
|
3292
3294
|
|
3293
3295
|
/**
|
3294
3296
|
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
3295
3297
|
*/
|
3296
|
-
declare interface
|
3298
|
+
declare interface ExperimentsCommon {
|
3297
3299
|
/**
|
3298
3300
|
* Allow module type 'asset' to generate assets.
|
3299
3301
|
*/
|
@@ -3304,11 +3306,6 @@ declare interface Experiments {
|
|
3304
3306
|
*/
|
3305
3307
|
asyncWebAssembly?: boolean;
|
3306
3308
|
|
3307
|
-
/**
|
3308
|
-
* Build http(s): urls using a lockfile and resource content cache.
|
3309
|
-
*/
|
3310
|
-
buildHttp?: boolean | HttpUriOptions;
|
3311
|
-
|
3312
3309
|
/**
|
3313
3310
|
* Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.
|
3314
3311
|
*/
|
@@ -3324,40 +3321,6 @@ declare interface Experiments {
|
|
3324
3321
|
*/
|
3325
3322
|
layers?: boolean;
|
3326
3323
|
|
3327
|
-
/**
|
3328
|
-
* Compile entrypoints and import()s only when they are accessed.
|
3329
|
-
*/
|
3330
|
-
lazyCompilation?:
|
3331
|
-
| boolean
|
3332
|
-
| {
|
3333
|
-
/**
|
3334
|
-
* A custom backend.
|
3335
|
-
*/
|
3336
|
-
backend?:
|
3337
|
-
| ((
|
3338
|
-
compiler: Compiler,
|
3339
|
-
client: string,
|
3340
|
-
callback: (err?: Error, api?: any) => void
|
3341
|
-
) => void)
|
3342
|
-
| ((compiler: Compiler, client: string) => Promise<any>);
|
3343
|
-
/**
|
3344
|
-
* A custom client.
|
3345
|
-
*/
|
3346
|
-
client?: string;
|
3347
|
-
/**
|
3348
|
-
* Enable/disable lazy compilation for entries.
|
3349
|
-
*/
|
3350
|
-
entries?: boolean;
|
3351
|
-
/**
|
3352
|
-
* Enable/disable lazy compilation for import() modules.
|
3353
|
-
*/
|
3354
|
-
imports?: boolean;
|
3355
|
-
/**
|
3356
|
-
* Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name.
|
3357
|
-
*/
|
3358
|
-
test?: string | RegExp | ((module: Module) => boolean);
|
3359
|
-
};
|
3360
|
-
|
3361
3324
|
/**
|
3362
3325
|
* Allow output javascript files as module source type.
|
3363
3326
|
*/
|
@@ -3373,6 +3336,37 @@ declare interface Experiments {
|
|
3373
3336
|
*/
|
3374
3337
|
topLevelAwait?: boolean;
|
3375
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
|
+
}
|
3376
3370
|
declare abstract class ExportInfo {
|
3377
3371
|
name: string;
|
3378
3372
|
|
@@ -3933,12 +3927,12 @@ declare interface FileCacheOptions {
|
|
3933
3927
|
/**
|
3934
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.
|
3935
3929
|
*/
|
3936
|
-
immutablePaths?: string[];
|
3930
|
+
immutablePaths?: (string | RegExp)[];
|
3937
3931
|
|
3938
3932
|
/**
|
3939
3933
|
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
|
3940
3934
|
*/
|
3941
|
-
managedPaths?: string[];
|
3935
|
+
managedPaths?: (string | RegExp)[];
|
3942
3936
|
|
3943
3937
|
/**
|
3944
3938
|
* Time for which unused cache entries stay in the filesystem cache at minimum (in milliseconds).
|
@@ -4051,10 +4045,12 @@ declare abstract class FileSystemInfo {
|
|
4051
4045
|
contextTshQueue: AsyncQueue<string, string, null | ContextTimestampAndHash>;
|
4052
4046
|
managedItemQueue: AsyncQueue<string, string, null | string>;
|
4053
4047
|
managedItemDirectoryQueue: AsyncQueue<string, string, Set<string>>;
|
4054
|
-
managedPaths: string[];
|
4048
|
+
managedPaths: (string | RegExp)[];
|
4055
4049
|
managedPathsWithSlash: string[];
|
4056
|
-
|
4050
|
+
managedPathsRegExps: RegExp[];
|
4051
|
+
immutablePaths: (string | RegExp)[];
|
4057
4052
|
immutablePathsWithSlash: string[];
|
4053
|
+
immutablePathsRegExps: RegExp[];
|
4058
4054
|
logStatistics(): void;
|
4059
4055
|
clear(): void;
|
4060
4056
|
addFileTimestamps(
|
@@ -4380,6 +4376,11 @@ declare class HotUpdateChunk extends Chunk {
|
|
4380
4376
|
* Options for building http resources.
|
4381
4377
|
*/
|
4382
4378
|
declare interface HttpUriOptions {
|
4379
|
+
/**
|
4380
|
+
* List of allowed URIs (resp. the beginning of them).
|
4381
|
+
*/
|
4382
|
+
allowedUris: (string | RegExp | ((uri: string) => boolean))[];
|
4383
|
+
|
4383
4384
|
/**
|
4384
4385
|
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4385
4386
|
*/
|
@@ -4401,27 +4402,7 @@ declare interface HttpUriOptions {
|
|
4401
4402
|
upgrade?: boolean;
|
4402
4403
|
}
|
4403
4404
|
declare class HttpUriPlugin {
|
4404
|
-
constructor(options
|
4405
|
-
/**
|
4406
|
-
* Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
|
4407
|
-
*/
|
4408
|
-
cacheLocation?: string | false;
|
4409
|
-
/**
|
4410
|
-
* When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
|
4411
|
-
*/
|
4412
|
-
frozen?: boolean;
|
4413
|
-
/**
|
4414
|
-
* Location of the lockfile.
|
4415
|
-
*/
|
4416
|
-
lockfileLocation?: string;
|
4417
|
-
/**
|
4418
|
-
* When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
|
4419
|
-
*/
|
4420
|
-
upgrade?: boolean;
|
4421
|
-
hashFunction?: string | typeof Hash;
|
4422
|
-
hashDigest?: string;
|
4423
|
-
hashDigestLength?: number;
|
4424
|
-
});
|
4405
|
+
constructor(options: HttpUriOptions);
|
4425
4406
|
|
4426
4407
|
/**
|
4427
4408
|
* Apply the plugin
|
@@ -5812,6 +5793,42 @@ declare interface KnownStatsProfile {
|
|
5812
5793
|
factory: number;
|
5813
5794
|
dependencies: number;
|
5814
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
|
+
}
|
5815
5832
|
declare class LazySet<T> {
|
5816
5833
|
constructor(iterable?: Iterable<T>);
|
5817
5834
|
readonly size: number;
|
@@ -7352,12 +7369,6 @@ declare class NormalModule extends Module {
|
|
7352
7369
|
sourceMap?: any,
|
7353
7370
|
associatedObjectForCache?: Object
|
7354
7371
|
): Source;
|
7355
|
-
createLoaderContext(
|
7356
|
-
resolver: ResolverWithOptions,
|
7357
|
-
options: WebpackOptionsNormalized,
|
7358
|
-
compilation: Compilation,
|
7359
|
-
fs: InputFileSystem
|
7360
|
-
): NormalModuleLoaderContext<any>;
|
7361
7372
|
getCurrentLoader(loaderContext?: any, index?: any): null | LoaderItem;
|
7362
7373
|
createSource(
|
7363
7374
|
context: string,
|
@@ -7365,13 +7376,6 @@ declare class NormalModule extends Module {
|
|
7365
7376
|
sourceMap?: any,
|
7366
7377
|
associatedObjectForCache?: Object
|
7367
7378
|
): Source;
|
7368
|
-
doBuild(
|
7369
|
-
options: WebpackOptionsNormalized,
|
7370
|
-
compilation: Compilation,
|
7371
|
-
resolver: ResolverWithOptions,
|
7372
|
-
fs: InputFileSystem,
|
7373
|
-
callback: (arg0?: WebpackError) => void
|
7374
|
-
): void;
|
7375
7379
|
markModuleAsErrored(error: WebpackError): void;
|
7376
7380
|
applyNoParseRule(rule?: any, content?: any): any;
|
7377
7381
|
shouldPreventParsing(noParseRule?: any, request?: any): any;
|
@@ -7383,6 +7387,8 @@ declare class NormalModule extends Module {
|
|
7383
7387
|
declare interface NormalModuleCompilationHooks {
|
7384
7388
|
loader: SyncHook<[object, NormalModule]>;
|
7385
7389
|
beforeLoaders: SyncHook<[LoaderItem[], NormalModule, object]>;
|
7390
|
+
beforeParse: SyncHook<[NormalModule]>;
|
7391
|
+
beforeSnapshot: SyncHook<[NormalModule]>;
|
7386
7392
|
readResourceForScheme: HookMap<
|
7387
7393
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
7388
7394
|
>;
|
@@ -7817,6 +7823,11 @@ declare interface OptimizationSplitChunksCacheGroup {
|
|
7817
7823
|
*/
|
7818
7824
|
minSize?: number | { [index: string]: number };
|
7819
7825
|
|
7826
|
+
/**
|
7827
|
+
* Minimum size reduction due to the created chunk.
|
7828
|
+
*/
|
7829
|
+
minSizeReduction?: number | { [index: string]: number };
|
7830
|
+
|
7820
7831
|
/**
|
7821
7832
|
* Give chunks for this cache group a name (chunks with equal name are merged).
|
7822
7833
|
*/
|
@@ -7908,6 +7919,10 @@ declare interface OptimizationSplitChunksOptions {
|
|
7908
7919
|
* Minimal size for the created chunk.
|
7909
7920
|
*/
|
7910
7921
|
minSize?: number | { [index: string]: number };
|
7922
|
+
/**
|
7923
|
+
* Minimum size reduction due to the created chunk.
|
7924
|
+
*/
|
7925
|
+
minSizeReduction?: number | { [index: string]: number };
|
7911
7926
|
};
|
7912
7927
|
|
7913
7928
|
/**
|
@@ -7960,6 +7975,11 @@ declare interface OptimizationSplitChunksOptions {
|
|
7960
7975
|
*/
|
7961
7976
|
minSize?: number | { [index: string]: number };
|
7962
7977
|
|
7978
|
+
/**
|
7979
|
+
* Minimum size reduction due to the created chunk.
|
7980
|
+
*/
|
7981
|
+
minSizeReduction?: number | { [index: string]: number };
|
7982
|
+
|
7963
7983
|
/**
|
7964
7984
|
* Give chunks created a name (chunks with equal name are merged).
|
7965
7985
|
*/
|
@@ -10516,12 +10536,12 @@ declare interface SnapshotOptions {
|
|
10516
10536
|
/**
|
10517
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.
|
10518
10538
|
*/
|
10519
|
-
immutablePaths?: string[];
|
10539
|
+
immutablePaths?: (string | RegExp)[];
|
10520
10540
|
|
10521
10541
|
/**
|
10522
10542
|
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
|
10523
10543
|
*/
|
10524
|
-
managedPaths?: string[];
|
10544
|
+
managedPaths?: (string | RegExp)[];
|
10525
10545
|
|
10526
10546
|
/**
|
10527
10547
|
* Options for snapshotting dependencies of modules to determine if they need to be built again.
|
@@ -10721,6 +10741,7 @@ declare interface SplitChunksOptions {
|
|
10721
10741
|
chunksFilter: (chunk: Chunk) => boolean;
|
10722
10742
|
defaultSizeTypes: string[];
|
10723
10743
|
minSize: SplitChunksSizes;
|
10744
|
+
minSizeReduction: SplitChunksSizes;
|
10724
10745
|
minRemainingSize: SplitChunksSizes;
|
10725
10746
|
enforceSizeThreshold: SplitChunksSizes;
|
10726
10747
|
maxInitialSize: SplitChunksSizes;
|
@@ -11846,7 +11867,7 @@ declare interface WebpackOptionsNormalized {
|
|
11846
11867
|
/**
|
11847
11868
|
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
11848
11869
|
*/
|
11849
|
-
experiments:
|
11870
|
+
experiments: ExperimentsNormalized;
|
11850
11871
|
|
11851
11872
|
/**
|
11852
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`.
|