webpack 5.68.0 → 5.69.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/ChunkGraph.js +1 -2
- package/lib/Compilation.js +2 -0
- package/lib/ContextModule.js +79 -24
- package/lib/ContextModuleFactory.js +60 -21
- package/lib/ExportsInfo.js +4 -4
- package/lib/NormalModuleFactory.js +25 -27
- package/lib/ProgressPlugin.js +1 -1
- package/lib/TemplatedPathPlugin.js +48 -23
- package/lib/asset/AssetGenerator.js +3 -2
- package/lib/buildChunkGraph.js +1 -1
- package/lib/cache/ResolverCachePlugin.js +80 -28
- package/lib/config/defaults.js +7 -2
- package/lib/css/CssLoadingRuntimeModule.js +63 -70
- package/lib/css/CssModulesPlugin.js +2 -1
- package/lib/debug/ProfilingPlugin.js +3 -4
- package/lib/dependencies/ContextElementDependency.js +8 -2
- package/lib/dependencies/ExportsInfoDependency.js +6 -0
- package/lib/index.js +5 -0
- package/lib/javascript/JavascriptModulesPlugin.js +27 -2
- package/lib/javascript/StartupHelpers.js +3 -2
- package/lib/library/AssignLibraryPlugin.js +8 -2
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +10 -4
- package/lib/schemes/HttpUriPlugin.js +24 -3
- package/lib/serialization/FileMiddleware.js +44 -9
- package/lib/util/compileBooleanMatcher.js +1 -1
- package/lib/util/deterministicGrouping.js +1 -1
- package/lib/util/identifier.js +65 -44
- package/lib/util/nonNumericOnlyHash.js +22 -0
- package/lib/util/semver.js +17 -10
- package/package.json +13 -13
- package/types.d.ts +46 -20
package/types.d.ts
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
* Run `yarn special-lint-fix` to update
|
5
5
|
*/
|
6
6
|
|
7
|
+
import { Buffer } from "buffer";
|
7
8
|
import {
|
8
9
|
ArrayExpression,
|
9
10
|
ArrayPattern,
|
@@ -63,6 +64,7 @@ import {
|
|
63
64
|
SimpleCallExpression,
|
64
65
|
SimpleLiteral,
|
65
66
|
SpreadElement,
|
67
|
+
StaticBlock,
|
66
68
|
Super,
|
67
69
|
SwitchCase,
|
68
70
|
SwitchStatement,
|
@@ -662,7 +664,7 @@ declare interface CacheGroupsContext {
|
|
662
664
|
moduleGraph: ModuleGraph;
|
663
665
|
chunkGraph: ChunkGraph;
|
664
666
|
}
|
665
|
-
type CacheOptionsNormalized = false |
|
667
|
+
type CacheOptionsNormalized = false | FileCacheOptions | MemoryCacheOptions;
|
666
668
|
declare class CachedSource extends Source {
|
667
669
|
constructor(source: Source);
|
668
670
|
constructor(source: Source | (() => Source), cachedData?: any);
|
@@ -1047,6 +1049,11 @@ declare abstract class ChunkGroup {
|
|
1047
1049
|
}
|
1048
1050
|
type ChunkGroupOptions = RawChunkGroupOptions & { name?: string };
|
1049
1051
|
declare interface ChunkHashContext {
|
1052
|
+
/**
|
1053
|
+
* results of code generation
|
1054
|
+
*/
|
1055
|
+
codeGenerationResults: CodeGenerationResults;
|
1056
|
+
|
1050
1057
|
/**
|
1051
1058
|
* the runtime template
|
1052
1059
|
*/
|
@@ -2056,7 +2063,7 @@ declare interface Configuration {
|
|
2056
2063
|
/**
|
2057
2064
|
* Cache generated modules and chunks to improve performance for multiple incremental builds.
|
2058
2065
|
*/
|
2059
|
-
cache?: boolean |
|
2066
|
+
cache?: boolean | FileCacheOptions | MemoryCacheOptions;
|
2060
2067
|
|
2061
2068
|
/**
|
2062
2069
|
* The base directory (absolute path!) for resolving the `entry` option. If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
|
@@ -2113,6 +2120,7 @@ declare interface Configuration {
|
|
2113
2120
|
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
|
2114
2121
|
*/
|
2115
2122
|
externalsType?:
|
2123
|
+
| "import"
|
2116
2124
|
| "var"
|
2117
2125
|
| "module"
|
2118
2126
|
| "assign"
|
@@ -2131,7 +2139,6 @@ declare interface Configuration {
|
|
2131
2139
|
| "jsonp"
|
2132
2140
|
| "system"
|
2133
2141
|
| "promise"
|
2134
|
-
| "import"
|
2135
2142
|
| "script"
|
2136
2143
|
| "node-commonjs";
|
2137
2144
|
|
@@ -2470,9 +2477,9 @@ declare interface ContextHash {
|
|
2470
2477
|
symlinks?: Set<string>;
|
2471
2478
|
}
|
2472
2479
|
type ContextMode =
|
2480
|
+
| "weak"
|
2473
2481
|
| "sync"
|
2474
2482
|
| "eager"
|
2475
|
-
| "weak"
|
2476
2483
|
| "async-weak"
|
2477
2484
|
| "lazy"
|
2478
2485
|
| "lazy-once";
|
@@ -2519,7 +2526,7 @@ declare interface ContextModuleOptions {
|
|
2519
2526
|
* exports referenced from modules (won't be mangled)
|
2520
2527
|
*/
|
2521
2528
|
referencedExports?: string[][];
|
2522
|
-
resource: string;
|
2529
|
+
resource: string | string[];
|
2523
2530
|
resourceQuery?: string;
|
2524
2531
|
resourceFragment?: string;
|
2525
2532
|
resolveOptions: any;
|
@@ -3956,6 +3963,7 @@ declare interface ExternalsPresets {
|
|
3956
3963
|
webAsync?: boolean;
|
3957
3964
|
}
|
3958
3965
|
type ExternalsType =
|
3966
|
+
| "import"
|
3959
3967
|
| "var"
|
3960
3968
|
| "module"
|
3961
3969
|
| "assign"
|
@@ -3974,7 +3982,6 @@ type ExternalsType =
|
|
3974
3982
|
| "jsonp"
|
3975
3983
|
| "system"
|
3976
3984
|
| "promise"
|
3977
|
-
| "import"
|
3978
3985
|
| "script"
|
3979
3986
|
| "node-commonjs";
|
3980
3987
|
declare interface FactorizeModuleOptions {
|
@@ -4462,12 +4469,12 @@ declare class Hash {
|
|
4462
4469
|
constructor();
|
4463
4470
|
|
4464
4471
|
/**
|
4465
|
-
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
4472
|
+
* Update hash {@link https ://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
4466
4473
|
*/
|
4467
4474
|
update(data: string | Buffer, inputEncoding?: string): Hash;
|
4468
4475
|
|
4469
4476
|
/**
|
4470
|
-
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
4477
|
+
* Calculates the digest {@link https ://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
4471
4478
|
*/
|
4472
4479
|
digest(encoding?: string): string | Buffer;
|
4473
4480
|
}
|
@@ -4488,7 +4495,7 @@ declare interface HashedModuleIdsPluginOptions {
|
|
4488
4495
|
/**
|
4489
4496
|
* The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
|
4490
4497
|
*/
|
4491
|
-
hashDigest?: "
|
4498
|
+
hashDigest?: "latin1" | "hex" | "base64";
|
4492
4499
|
|
4493
4500
|
/**
|
4494
4501
|
* The prefix length of the hash digest to use, defaults to 4.
|
@@ -4902,6 +4909,7 @@ declare class JavascriptParser extends Parser {
|
|
4902
4909
|
| ClassDeclaration
|
4903
4910
|
| ExpressionStatement
|
4904
4911
|
| BlockStatement
|
4912
|
+
| StaticBlock
|
4905
4913
|
| EmptyStatement
|
4906
4914
|
| DebuggerStatement
|
4907
4915
|
| WithStatement
|
@@ -4932,6 +4940,7 @@ declare class JavascriptParser extends Parser {
|
|
4932
4940
|
| ClassDeclaration
|
4933
4941
|
| ExpressionStatement
|
4934
4942
|
| BlockStatement
|
4943
|
+
| StaticBlock
|
4935
4944
|
| EmptyStatement
|
4936
4945
|
| DebuggerStatement
|
4937
4946
|
| WithStatement
|
@@ -4962,6 +4971,7 @@ declare class JavascriptParser extends Parser {
|
|
4962
4971
|
| ClassDeclaration
|
4963
4972
|
| ExpressionStatement
|
4964
4973
|
| BlockStatement
|
4974
|
+
| StaticBlock
|
4965
4975
|
| EmptyStatement
|
4966
4976
|
| DebuggerStatement
|
4967
4977
|
| WithStatement
|
@@ -5133,6 +5143,7 @@ declare class JavascriptParser extends Parser {
|
|
5133
5143
|
| ClassDeclaration
|
5134
5144
|
| ExpressionStatement
|
5135
5145
|
| BlockStatement
|
5146
|
+
| StaticBlock
|
5136
5147
|
| EmptyStatement
|
5137
5148
|
| DebuggerStatement
|
5138
5149
|
| WithStatement
|
@@ -5355,7 +5366,7 @@ declare class JavascriptParser extends Parser {
|
|
5355
5366
|
setVariable(name: string, variableInfo: ExportedVariableInfo): void;
|
5356
5367
|
parseCommentOptions(
|
5357
5368
|
range?: any
|
5358
|
-
): { options: null; errors: null } | { options: object; errors:
|
5369
|
+
): { options: null; errors: null } | { options: object; errors: unknown[] };
|
5359
5370
|
extractMemberExpressionChain(expression: MemberExpression): {
|
5360
5371
|
members: string[];
|
5361
5372
|
object:
|
@@ -6034,9 +6045,8 @@ declare class LazySet<T> {
|
|
6034
6045
|
has(item: T): boolean;
|
6035
6046
|
keys(): IterableIterator<T>;
|
6036
6047
|
values(): IterableIterator<T>;
|
6037
|
-
[Symbol.iterator](): IterableIterator<T>;
|
6038
|
-
readonly [Symbol.toStringTag]: string;
|
6039
6048
|
serialize(__0: { write: any }): void;
|
6049
|
+
[Symbol.iterator](): IterableIterator<T>;
|
6040
6050
|
static deserialize(__0: { read: any }): LazySet<any>;
|
6041
6051
|
}
|
6042
6052
|
declare interface LibIdentOptions {
|
@@ -6827,6 +6837,7 @@ declare interface ModuleFederationPluginOptions {
|
|
6827
6837
|
* The external type of the remote containers.
|
6828
6838
|
*/
|
6829
6839
|
remoteType?:
|
6840
|
+
| "import"
|
6830
6841
|
| "var"
|
6831
6842
|
| "module"
|
6832
6843
|
| "assign"
|
@@ -6845,7 +6856,6 @@ declare interface ModuleFederationPluginOptions {
|
|
6845
6856
|
| "jsonp"
|
6846
6857
|
| "system"
|
6847
6858
|
| "promise"
|
6848
|
-
| "import"
|
6849
6859
|
| "script"
|
6850
6860
|
| "node-commonjs";
|
6851
6861
|
|
@@ -7390,6 +7400,7 @@ type NodeEstreeIndex =
|
|
7390
7400
|
| PrivateIdentifier
|
7391
7401
|
| ExpressionStatement
|
7392
7402
|
| BlockStatement
|
7403
|
+
| StaticBlock
|
7393
7404
|
| EmptyStatement
|
7394
7405
|
| DebuggerStatement
|
7395
7406
|
| WithStatement
|
@@ -7709,8 +7720,8 @@ type NormalizedStatsOptions = KnownNormalizedStatsOptions &
|
|
7709
7720
|
Omit<
|
7710
7721
|
StatsOptions,
|
7711
7722
|
| "context"
|
7712
|
-
| "requestShortener"
|
7713
7723
|
| "chunkGroups"
|
7724
|
+
| "requestShortener"
|
7714
7725
|
| "chunksSort"
|
7715
7726
|
| "modulesSort"
|
7716
7727
|
| "chunkModulesSort"
|
@@ -8987,7 +8998,7 @@ declare class ProgressPlugin {
|
|
8987
8998
|
showModules?: boolean;
|
8988
8999
|
showDependencies?: boolean;
|
8989
9000
|
showActiveModules?: boolean;
|
8990
|
-
percentBy?: null | "
|
9001
|
+
percentBy?: null | "modules" | "dependencies" | "entries";
|
8991
9002
|
apply(compiler: Compiler | MultiCompiler): void;
|
8992
9003
|
static getReporter(
|
8993
9004
|
compiler: Compiler
|
@@ -9048,7 +9059,7 @@ declare interface ProgressPluginOptions {
|
|
9048
9059
|
/**
|
9049
9060
|
* Collect percent algorithm. By default it calculates by a median from modules, entries and dependencies percent.
|
9050
9061
|
*/
|
9051
|
-
percentBy?: null | "
|
9062
|
+
percentBy?: null | "modules" | "dependencies" | "entries";
|
9052
9063
|
|
9053
9064
|
/**
|
9054
9065
|
* Collect profile data for progress steps. Default: false.
|
@@ -9215,6 +9226,11 @@ declare interface RenderBootstrapContext {
|
|
9215
9226
|
*/
|
9216
9227
|
chunk: Chunk;
|
9217
9228
|
|
9229
|
+
/**
|
9230
|
+
* results of code generation
|
9231
|
+
*/
|
9232
|
+
codeGenerationResults: CodeGenerationResults;
|
9233
|
+
|
9218
9234
|
/**
|
9219
9235
|
* the runtime template
|
9220
9236
|
*/
|
@@ -9389,6 +9405,11 @@ declare interface ResolveContext {
|
|
9389
9405
|
* log function
|
9390
9406
|
*/
|
9391
9407
|
log?: (arg0: string) => void;
|
9408
|
+
|
9409
|
+
/**
|
9410
|
+
* yield result, if provided plugins can return several results
|
9411
|
+
*/
|
9412
|
+
yield?: (arg0: ResolveRequest) => void;
|
9392
9413
|
}
|
9393
9414
|
declare interface ResolveData {
|
9394
9415
|
contextInfo: ModuleFactoryCreateDataContextInfo;
|
@@ -10173,8 +10194,8 @@ declare class RuntimeSpecSet {
|
|
10173
10194
|
constructor(iterable?: any);
|
10174
10195
|
add(runtime?: any): void;
|
10175
10196
|
has(runtime?: any): boolean;
|
10176
|
-
[Symbol.iterator](): IterableIterator<RuntimeSpec>;
|
10177
10197
|
readonly size: number;
|
10198
|
+
[Symbol.iterator](): IterableIterator<RuntimeSpec>;
|
10178
10199
|
}
|
10179
10200
|
declare abstract class RuntimeTemplate {
|
10180
10201
|
compilation: Compilation;
|
@@ -10871,7 +10892,6 @@ declare abstract class SortableSet<T> extends Set<T> {
|
|
10871
10892
|
* Iterates over values in the set.
|
10872
10893
|
*/
|
10873
10894
|
[Symbol.iterator](): IterableIterator<T>;
|
10874
|
-
readonly [Symbol.toStringTag]: string;
|
10875
10895
|
}
|
10876
10896
|
declare class Source {
|
10877
10897
|
constructor();
|
@@ -11061,6 +11081,7 @@ type Statement =
|
|
11061
11081
|
| ClassDeclaration
|
11062
11082
|
| ExpressionStatement
|
11063
11083
|
| BlockStatement
|
11084
|
+
| StaticBlock
|
11064
11085
|
| EmptyStatement
|
11065
11086
|
| DebuggerStatement
|
11066
11087
|
| WithStatement
|
@@ -11835,7 +11856,7 @@ declare interface UserResolveOptions {
|
|
11835
11856
|
restrictions?: (string | RegExp)[];
|
11836
11857
|
|
11837
11858
|
/**
|
11838
|
-
* Use only the sync
|
11859
|
+
* Use only the sync constraints of the file system calls
|
11839
11860
|
*/
|
11840
11861
|
useSyncFileSystemCalls?: boolean;
|
11841
11862
|
|
@@ -12198,6 +12219,7 @@ declare interface WebpackOptionsNormalized {
|
|
12198
12219
|
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
|
12199
12220
|
*/
|
12200
12221
|
externalsType?:
|
12222
|
+
| "import"
|
12201
12223
|
| "var"
|
12202
12224
|
| "module"
|
12203
12225
|
| "assign"
|
@@ -12216,7 +12238,6 @@ declare interface WebpackOptionsNormalized {
|
|
12216
12238
|
| "jsonp"
|
12217
12239
|
| "system"
|
12218
12240
|
| "promise"
|
12219
|
-
| "import"
|
12220
12241
|
| "script"
|
12221
12242
|
| "node-commonjs";
|
12222
12243
|
|
@@ -12913,6 +12934,7 @@ declare namespace exports {
|
|
12913
12934
|
Entry,
|
12914
12935
|
EntryNormalized,
|
12915
12936
|
EntryObject,
|
12937
|
+
FileCacheOptions,
|
12916
12938
|
LibraryOptions,
|
12917
12939
|
ModuleOptions,
|
12918
12940
|
ResolveOptionsWebpackOptions as ResolveOptions,
|
@@ -12927,11 +12949,15 @@ declare namespace exports {
|
|
12927
12949
|
WebpackPluginInstance,
|
12928
12950
|
Asset,
|
12929
12951
|
AssetInfo,
|
12952
|
+
EntryOptions,
|
12953
|
+
AssetEmittedInfo,
|
12930
12954
|
MultiStats,
|
12931
12955
|
ParserState,
|
12932
12956
|
ResolvePluginInstance,
|
12933
12957
|
Resolver,
|
12934
12958
|
Watching,
|
12959
|
+
Argument,
|
12960
|
+
Problem,
|
12935
12961
|
StatsAsset,
|
12936
12962
|
StatsChunk,
|
12937
12963
|
StatsChunkGroup,
|