webpack 5.5.1 → 5.9.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/bin/webpack.js +10 -3
- package/lib/Compilation.js +132 -17
- package/lib/Compiler.js +2 -2
- package/lib/ExportsInfo.js +1 -1
- package/lib/FlagDependencyUsagePlugin.js +4 -2
- package/lib/HotModuleReplacementPlugin.js +170 -36
- package/lib/NormalModule.js +13 -1
- package/lib/RuntimeTemplate.js +0 -3
- package/lib/SourceMapDevToolPlugin.js +2 -1
- package/lib/Template.js +0 -1
- package/lib/TemplatedPathPlugin.js +8 -0
- package/lib/Watching.js +0 -1
- package/lib/cache/ResolverCachePlugin.js +0 -1
- package/lib/config/defaults.js +1 -1
- package/lib/dependencies/AMDDefineDependency.js +3 -1
- package/lib/dependencies/AMDRequireArrayDependency.js +3 -1
- package/lib/dependencies/AMDRequireDependency.js +3 -1
- package/lib/dependencies/CachedConstDependency.js +3 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +3 -2
- package/lib/dependencies/CommonJsExportsDependency.js +3 -1
- package/lib/dependencies/CommonJsFullRequireDependency.js +3 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +3 -1
- package/lib/dependencies/ConstDependency.js +3 -1
- package/lib/dependencies/ExportsInfoDependency.js +3 -1
- package/lib/dependencies/HarmonyAcceptDependency.js +3 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +3 -1
- package/lib/dependencies/HarmonyCompatibilityDependency.js +3 -1
- package/lib/dependencies/HarmonyExportExpressionDependency.js +3 -1
- package/lib/dependencies/HarmonyExportHeaderDependency.js +3 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +11 -2
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +3 -1
- package/lib/dependencies/HarmonyImportDependency.js +50 -46
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +3 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +11 -1
- package/lib/dependencies/ImportDependency.js +3 -2
- package/lib/dependencies/ImportEagerDependency.js +3 -1
- package/lib/dependencies/ImportWeakDependency.js +3 -1
- package/lib/dependencies/LocalModuleDependency.js +3 -1
- package/lib/dependencies/ModuleDecoratorDependency.js +3 -2
- package/lib/dependencies/NullDependency.js +3 -2
- package/lib/dependencies/PureExpressionDependency.js +3 -1
- package/lib/dependencies/RequireEnsureDependency.js +3 -1
- package/lib/dependencies/RequireHeaderDependency.js +3 -1
- package/lib/dependencies/RequireIncludeDependency.js +3 -2
- package/lib/dependencies/RequireResolveHeaderDependency.js +3 -1
- package/lib/dependencies/RuntimeRequirementsDependency.js +3 -1
- package/lib/dependencies/URLDependency.js +3 -1
- package/lib/dependencies/UnsupportedDependency.js +3 -1
- package/lib/dependencies/WorkerDependency.js +3 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
- package/lib/index.js +3 -0
- package/lib/javascript/JavascriptParser.js +29 -11
- package/lib/optimize/RealContentHashPlugin.js +127 -32
- package/lib/optimize/SideEffectsFlagPlugin.js +224 -204
- package/lib/optimize/SplitChunksPlugin.js +0 -1
- package/lib/runtime/GetMainFilenameRuntimeModule.js +4 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +0 -1
- package/lib/serialization/FileMiddleware.js +4 -2
- package/lib/util/runtime.js +4 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +0 -1
- package/lib/webpack.js +0 -2
- package/package.json +14 -14
- package/types.d.ts +179 -149
package/types.d.ts
CHANGED
@@ -271,7 +271,7 @@ declare interface AssetInfo {
|
|
271
271
|
}
|
272
272
|
type AssetModuleFilename =
|
273
273
|
| string
|
274
|
-
| ((pathData: PathData, assetInfo
|
274
|
+
| ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
275
275
|
declare abstract class AsyncDependenciesBlock extends DependenciesBlock {
|
276
276
|
groupOptions: {
|
277
277
|
preloadOrder?: number;
|
@@ -296,10 +296,10 @@ declare abstract class AsyncDependenciesBlock extends DependenciesBlock {
|
|
296
296
|
declare abstract class AsyncQueue<T, K, R> {
|
297
297
|
hooks: {
|
298
298
|
beforeAdd: AsyncSeriesHook<[T]>;
|
299
|
-
added: SyncHook<[T]
|
299
|
+
added: SyncHook<[T]>;
|
300
300
|
beforeStart: AsyncSeriesHook<[T]>;
|
301
|
-
started: SyncHook<[T]
|
302
|
-
result: SyncHook<[T, Error, R]
|
301
|
+
started: SyncHook<[T]>;
|
302
|
+
result: SyncHook<[T, Error, R]>;
|
303
303
|
};
|
304
304
|
add(item: T, callback: CallbackFunction<R>): void;
|
305
305
|
invalidate(item: T): void;
|
@@ -507,7 +507,7 @@ declare class Cache {
|
|
507
507
|
>;
|
508
508
|
store: AsyncParallelHook<[string, Etag, any]>;
|
509
509
|
storeBuildDependencies: AsyncParallelHook<[Iterable<string>]>;
|
510
|
-
beginIdle: SyncHook<[]
|
510
|
+
beginIdle: SyncHook<[]>;
|
511
511
|
endIdle: AsyncParallelHook<[]>;
|
512
512
|
shutdown: AsyncParallelHook<[]>;
|
513
513
|
};
|
@@ -684,7 +684,7 @@ declare class Chunk {
|
|
684
684
|
}
|
685
685
|
type ChunkFilename =
|
686
686
|
| string
|
687
|
-
| ((pathData: PathData, assetInfo
|
687
|
+
| ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
688
688
|
declare class ChunkGraph {
|
689
689
|
constructor(moduleGraph: ModuleGraph);
|
690
690
|
moduleGraph: ModuleGraph;
|
@@ -1096,11 +1096,11 @@ declare class Compilation {
|
|
1096
1096
|
*/
|
1097
1097
|
constructor(compiler: Compiler);
|
1098
1098
|
hooks: Readonly<{
|
1099
|
-
buildModule: SyncHook<[Module]
|
1100
|
-
rebuildModule: SyncHook<[Module]
|
1101
|
-
failedModule: SyncHook<[Module, WebpackError]
|
1102
|
-
succeedModule: SyncHook<[Module]
|
1103
|
-
stillValidModule: SyncHook<[Module]
|
1099
|
+
buildModule: SyncHook<[Module]>;
|
1100
|
+
rebuildModule: SyncHook<[Module]>;
|
1101
|
+
failedModule: SyncHook<[Module, WebpackError]>;
|
1102
|
+
succeedModule: SyncHook<[Module]>;
|
1103
|
+
stillValidModule: SyncHook<[Module]>;
|
1104
1104
|
addEntry: SyncHook<
|
1105
1105
|
[
|
1106
1106
|
Dependency,
|
@@ -1113,8 +1113,7 @@ declare class Compilation {
|
|
1113
1113
|
| "runtime"
|
1114
1114
|
| "wasmLoading"
|
1115
1115
|
>
|
1116
|
-
]
|
1117
|
-
void
|
1116
|
+
]
|
1118
1117
|
>;
|
1119
1118
|
failedEntry: SyncHook<
|
1120
1119
|
[
|
@@ -1129,8 +1128,7 @@ declare class Compilation {
|
|
1129
1128
|
| "wasmLoading"
|
1130
1129
|
>,
|
1131
1130
|
Error
|
1132
|
-
]
|
1133
|
-
void
|
1131
|
+
]
|
1134
1132
|
>;
|
1135
1133
|
succeedEntry: SyncHook<
|
1136
1134
|
[
|
@@ -1145,8 +1143,7 @@ declare class Compilation {
|
|
1145
1143
|
| "wasmLoading"
|
1146
1144
|
>,
|
1147
1145
|
Module
|
1148
|
-
]
|
1149
|
-
void
|
1146
|
+
]
|
1150
1147
|
>;
|
1151
1148
|
dependencyReferencedExports: SyncWaterfallHook<
|
1152
1149
|
[
|
@@ -1157,64 +1154,61 @@ declare class Compilation {
|
|
1157
1154
|
>;
|
1158
1155
|
finishModules: AsyncSeriesHook<[Iterable<Module>]>;
|
1159
1156
|
finishRebuildingModule: AsyncSeriesHook<[Module]>;
|
1160
|
-
unseal: SyncHook<[]
|
1161
|
-
seal: SyncHook<[]
|
1162
|
-
beforeChunks: SyncHook<[]
|
1163
|
-
afterChunks: SyncHook<[Iterable<Chunk>]
|
1157
|
+
unseal: SyncHook<[]>;
|
1158
|
+
seal: SyncHook<[]>;
|
1159
|
+
beforeChunks: SyncHook<[]>;
|
1160
|
+
afterChunks: SyncHook<[Iterable<Chunk>]>;
|
1164
1161
|
optimizeDependencies: SyncBailHook<[Iterable<Module>], any>;
|
1165
|
-
afterOptimizeDependencies: SyncHook<[Iterable<Module>]
|
1166
|
-
optimize: SyncHook<[]
|
1162
|
+
afterOptimizeDependencies: SyncHook<[Iterable<Module>]>;
|
1163
|
+
optimize: SyncHook<[]>;
|
1167
1164
|
optimizeModules: SyncBailHook<[Iterable<Module>], any>;
|
1168
|
-
afterOptimizeModules: SyncHook<[Iterable<Module>]
|
1165
|
+
afterOptimizeModules: SyncHook<[Iterable<Module>]>;
|
1169
1166
|
optimizeChunks: SyncBailHook<[Iterable<Chunk>, ChunkGroup[]], any>;
|
1170
|
-
afterOptimizeChunks: SyncHook<[Iterable<Chunk>, ChunkGroup[]]
|
1167
|
+
afterOptimizeChunks: SyncHook<[Iterable<Chunk>, ChunkGroup[]]>;
|
1171
1168
|
optimizeTree: AsyncSeriesHook<[Iterable<Chunk>, Iterable<Module>]>;
|
1172
|
-
afterOptimizeTree: SyncHook<[Iterable<Chunk>, Iterable<Module>]
|
1169
|
+
afterOptimizeTree: SyncHook<[Iterable<Chunk>, Iterable<Module>]>;
|
1173
1170
|
optimizeChunkModules: AsyncSeriesBailHook<
|
1174
1171
|
[Iterable<Chunk>, Iterable<Module>],
|
1175
1172
|
any
|
1176
1173
|
>;
|
1177
|
-
afterOptimizeChunkModules: SyncHook<
|
1178
|
-
[Iterable<Chunk>, Iterable<Module>],
|
1179
|
-
void
|
1180
|
-
>;
|
1174
|
+
afterOptimizeChunkModules: SyncHook<[Iterable<Chunk>, Iterable<Module>]>;
|
1181
1175
|
shouldRecord: SyncBailHook<[], boolean>;
|
1182
|
-
additionalChunkRuntimeRequirements: SyncHook<[Chunk, Set<string>]
|
1176
|
+
additionalChunkRuntimeRequirements: SyncHook<[Chunk, Set<string>]>;
|
1183
1177
|
runtimeRequirementInChunk: HookMap<SyncBailHook<[Chunk, Set<string>], any>>;
|
1184
|
-
additionalModuleRuntimeRequirements: SyncHook<[Module, Set<string>]
|
1178
|
+
additionalModuleRuntimeRequirements: SyncHook<[Module, Set<string>]>;
|
1185
1179
|
runtimeRequirementInModule: HookMap<
|
1186
1180
|
SyncBailHook<[Module, Set<string>], any>
|
1187
1181
|
>;
|
1188
|
-
additionalTreeRuntimeRequirements: SyncHook<[Chunk, Set<string>]
|
1182
|
+
additionalTreeRuntimeRequirements: SyncHook<[Chunk, Set<string>]>;
|
1189
1183
|
runtimeRequirementInTree: HookMap<SyncBailHook<[Chunk, Set<string>], any>>;
|
1190
|
-
runtimeModule: SyncHook<[RuntimeModule, Chunk]
|
1191
|
-
reviveModules: SyncHook<[Iterable<Module>, any]
|
1192
|
-
beforeModuleIds: SyncHook<[Iterable<Module>]
|
1193
|
-
moduleIds: SyncHook<[Iterable<Module>]
|
1194
|
-
optimizeModuleIds: SyncHook<[Iterable<Module>]
|
1195
|
-
afterOptimizeModuleIds: SyncHook<[Iterable<Module>]
|
1196
|
-
reviveChunks: SyncHook<[Iterable<Chunk>, any]
|
1197
|
-
beforeChunkIds: SyncHook<[Iterable<Chunk>]
|
1198
|
-
chunkIds: SyncHook<[Iterable<Chunk>]
|
1199
|
-
optimizeChunkIds: SyncHook<[Iterable<Chunk>]
|
1200
|
-
afterOptimizeChunkIds: SyncHook<[Iterable<Chunk>]
|
1201
|
-
recordModules: SyncHook<[Iterable<Module>, any]
|
1202
|
-
recordChunks: SyncHook<[Iterable<Chunk>, any]
|
1203
|
-
optimizeCodeGeneration: SyncHook<[Iterable<Module>]
|
1204
|
-
beforeModuleHash: SyncHook<[]
|
1205
|
-
afterModuleHash: SyncHook<[]
|
1206
|
-
beforeCodeGeneration: SyncHook<[]
|
1207
|
-
afterCodeGeneration: SyncHook<[]
|
1208
|
-
beforeRuntimeRequirements: SyncHook<[]
|
1209
|
-
afterRuntimeRequirements: SyncHook<[]
|
1210
|
-
beforeHash: SyncHook<[]
|
1211
|
-
contentHash: SyncHook<[Chunk]
|
1212
|
-
afterHash: SyncHook<[]
|
1213
|
-
recordHash: SyncHook<[any]
|
1214
|
-
record: SyncHook<[Compilation, any]
|
1215
|
-
beforeModuleAssets: SyncHook<[]
|
1184
|
+
runtimeModule: SyncHook<[RuntimeModule, Chunk]>;
|
1185
|
+
reviveModules: SyncHook<[Iterable<Module>, any]>;
|
1186
|
+
beforeModuleIds: SyncHook<[Iterable<Module>]>;
|
1187
|
+
moduleIds: SyncHook<[Iterable<Module>]>;
|
1188
|
+
optimizeModuleIds: SyncHook<[Iterable<Module>]>;
|
1189
|
+
afterOptimizeModuleIds: SyncHook<[Iterable<Module>]>;
|
1190
|
+
reviveChunks: SyncHook<[Iterable<Chunk>, any]>;
|
1191
|
+
beforeChunkIds: SyncHook<[Iterable<Chunk>]>;
|
1192
|
+
chunkIds: SyncHook<[Iterable<Chunk>]>;
|
1193
|
+
optimizeChunkIds: SyncHook<[Iterable<Chunk>]>;
|
1194
|
+
afterOptimizeChunkIds: SyncHook<[Iterable<Chunk>]>;
|
1195
|
+
recordModules: SyncHook<[Iterable<Module>, any]>;
|
1196
|
+
recordChunks: SyncHook<[Iterable<Chunk>, any]>;
|
1197
|
+
optimizeCodeGeneration: SyncHook<[Iterable<Module>]>;
|
1198
|
+
beforeModuleHash: SyncHook<[]>;
|
1199
|
+
afterModuleHash: SyncHook<[]>;
|
1200
|
+
beforeCodeGeneration: SyncHook<[]>;
|
1201
|
+
afterCodeGeneration: SyncHook<[]>;
|
1202
|
+
beforeRuntimeRequirements: SyncHook<[]>;
|
1203
|
+
afterRuntimeRequirements: SyncHook<[]>;
|
1204
|
+
beforeHash: SyncHook<[]>;
|
1205
|
+
contentHash: SyncHook<[Chunk]>;
|
1206
|
+
afterHash: SyncHook<[]>;
|
1207
|
+
recordHash: SyncHook<[any]>;
|
1208
|
+
record: SyncHook<[Compilation, any]>;
|
1209
|
+
beforeModuleAssets: SyncHook<[]>;
|
1216
1210
|
shouldGenerateChunkAssets: SyncBailHook<[], boolean>;
|
1217
|
-
beforeChunkAssets: SyncHook<[]
|
1211
|
+
beforeChunkAssets: SyncHook<[]>;
|
1218
1212
|
additionalChunkAssets: Pick<
|
1219
1213
|
AsyncSeriesHook<[Set<Chunk>]>,
|
1220
1214
|
"tap" | "tapAsync" | "tapPromise" | "name"
|
@@ -1235,10 +1229,17 @@ declare class Compilation {
|
|
1235
1229
|
"tap" | "tapAsync" | "tapPromise" | "name"
|
1236
1230
|
> &
|
1237
1231
|
FakeHookMarker;
|
1238
|
-
optimizeAssets: AsyncSeriesHook<
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1232
|
+
optimizeAssets: AsyncSeriesHook<
|
1233
|
+
[Record<string, Source>],
|
1234
|
+
{ additionalAssets?: true | Function }
|
1235
|
+
>;
|
1236
|
+
afterOptimizeAssets: SyncHook<[Record<string, Source>]>;
|
1237
|
+
processAssets: AsyncSeriesHook<
|
1238
|
+
[Record<string, Source>],
|
1239
|
+
{ additionalAssets?: true | Function }
|
1240
|
+
>;
|
1241
|
+
afterProcessAssets: SyncHook<[Record<string, Source>]>;
|
1242
|
+
processAdditionalAssets: AsyncSeriesHook<[Record<string, Source>]>;
|
1242
1243
|
needAdditionalSeal: SyncBailHook<[], boolean>;
|
1243
1244
|
afterSeal: AsyncSeriesHook<[]>;
|
1244
1245
|
renderManifest: SyncWaterfallHook<
|
@@ -1247,21 +1248,21 @@ declare class Compilation {
|
|
1247
1248
|
RenderManifestOptions
|
1248
1249
|
]
|
1249
1250
|
>;
|
1250
|
-
fullHash: SyncHook<[Hash]
|
1251
|
-
chunkHash: SyncHook<[Chunk, Hash, ChunkHashContext]
|
1252
|
-
moduleAsset: SyncHook<[Module, string]
|
1253
|
-
chunkAsset: SyncHook<[Chunk, string]
|
1251
|
+
fullHash: SyncHook<[Hash]>;
|
1252
|
+
chunkHash: SyncHook<[Chunk, Hash, ChunkHashContext]>;
|
1253
|
+
moduleAsset: SyncHook<[Module, string]>;
|
1254
|
+
chunkAsset: SyncHook<[Chunk, string]>;
|
1254
1255
|
assetPath: SyncWaterfallHook<[string, any, AssetInfo]>;
|
1255
1256
|
needAdditionalPass: SyncBailHook<[], boolean>;
|
1256
|
-
childCompiler: SyncHook<[Compiler, string, number]
|
1257
|
+
childCompiler: SyncHook<[Compiler, string, number]>;
|
1257
1258
|
log: SyncBailHook<[string, LogEntry], true>;
|
1258
1259
|
processWarnings: SyncWaterfallHook<[WebpackError[]]>;
|
1259
1260
|
processErrors: SyncWaterfallHook<[WebpackError[]]>;
|
1260
|
-
statsPreset: HookMap<SyncHook<[any, any]
|
1261
|
-
statsNormalize: SyncHook<[any, any]
|
1262
|
-
statsFactory: SyncHook<[StatsFactory, any]
|
1263
|
-
statsPrinter: SyncHook<[StatsPrinter, any]
|
1264
|
-
readonly normalModuleLoader: SyncHook<[any, NormalModule]
|
1261
|
+
statsPreset: HookMap<SyncHook<[any, any]>>;
|
1262
|
+
statsNormalize: SyncHook<[any, any]>;
|
1263
|
+
statsFactory: SyncHook<[StatsFactory, any]>;
|
1264
|
+
statsPrinter: SyncHook<[StatsPrinter, any]>;
|
1265
|
+
readonly normalModuleLoader: SyncHook<[any, NormalModule]>;
|
1265
1266
|
}>;
|
1266
1267
|
name: string;
|
1267
1268
|
startTime: any;
|
@@ -1507,7 +1508,10 @@ declare class Compilation {
|
|
1507
1508
|
createChildCompiler(
|
1508
1509
|
name: string,
|
1509
1510
|
outputOptions: OutputNormalized,
|
1510
|
-
plugins:
|
1511
|
+
plugins: (
|
1512
|
+
| ((this: Compiler, compiler: Compiler) => void)
|
1513
|
+
| WebpackPluginInstance
|
1514
|
+
)[]
|
1511
1515
|
): Compiler;
|
1512
1516
|
checkConstraints(): void;
|
1513
1517
|
|
@@ -1539,6 +1543,8 @@ declare class Compilation {
|
|
1539
1543
|
|
1540
1544
|
/**
|
1541
1545
|
* Optimize the count of existing assets, e. g. by merging them.
|
1546
|
+
* Only assets of the same type should be merged.
|
1547
|
+
* For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE.
|
1542
1548
|
*/
|
1543
1549
|
static PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT: number;
|
1544
1550
|
|
@@ -1553,16 +1559,22 @@ declare class Compilation {
|
|
1553
1559
|
static PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE: number;
|
1554
1560
|
|
1555
1561
|
/**
|
1556
|
-
*
|
1557
|
-
* When creating new assets from this they should be fully optimized.
|
1558
|
-
* e. g. creating an assets manifest of Service Workers.
|
1562
|
+
* Add development tooling to assets, e. g. by extracting a SourceMap.
|
1559
1563
|
*/
|
1560
|
-
static
|
1564
|
+
static PROCESS_ASSETS_STAGE_DEV_TOOLING: number;
|
1561
1565
|
|
1562
1566
|
/**
|
1563
|
-
*
|
1567
|
+
* Optimize the count of existing assets, e. g. by inlining assets of into other assets.
|
1568
|
+
* Only assets of different types should be inlined.
|
1569
|
+
* For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT.
|
1564
1570
|
*/
|
1565
|
-
static
|
1571
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE: number;
|
1572
|
+
|
1573
|
+
/**
|
1574
|
+
* Summarize the list of existing assets
|
1575
|
+
* e. g. creating an assets manifest of Service Workers.
|
1576
|
+
*/
|
1577
|
+
static PROCESS_ASSETS_STAGE_SUMMARIZE: number;
|
1566
1578
|
|
1567
1579
|
/**
|
1568
1580
|
* Optimize the hashes of the assets, e. g. by generating real hashes of the asset content.
|
@@ -1597,9 +1609,12 @@ declare interface CompilationHooksJavascriptModulesPlugin {
|
|
1597
1609
|
renderMain: SyncWaterfallHook<[Source, RenderContextObject]>;
|
1598
1610
|
render: SyncWaterfallHook<[Source, RenderContextObject]>;
|
1599
1611
|
renderRequire: SyncWaterfallHook<[string, RenderBootstrapContext]>;
|
1600
|
-
chunkHash: SyncHook<[Chunk, Hash, ChunkHashContext]
|
1612
|
+
chunkHash: SyncHook<[Chunk, Hash, ChunkHashContext]>;
|
1601
1613
|
useSourceMap: SyncBailHook<[Chunk, RenderContextObject], boolean>;
|
1602
1614
|
}
|
1615
|
+
declare interface CompilationHooksRealContentHashPlugin {
|
1616
|
+
updateHash: SyncBailHook<[Buffer[], string], string>;
|
1617
|
+
}
|
1603
1618
|
declare interface CompilationParams {
|
1604
1619
|
normalModuleFactory: NormalModuleFactory;
|
1605
1620
|
contextModuleFactory: ContextModuleFactory;
|
@@ -1607,34 +1622,34 @@ declare interface CompilationParams {
|
|
1607
1622
|
declare class Compiler {
|
1608
1623
|
constructor(context: string);
|
1609
1624
|
hooks: Readonly<{
|
1610
|
-
initialize: SyncHook<[]
|
1625
|
+
initialize: SyncHook<[]>;
|
1611
1626
|
shouldEmit: SyncBailHook<[Compilation], boolean>;
|
1612
1627
|
done: AsyncSeriesHook<[Stats]>;
|
1613
|
-
afterDone: SyncHook<[Stats]
|
1628
|
+
afterDone: SyncHook<[Stats]>;
|
1614
1629
|
additionalPass: AsyncSeriesHook<[]>;
|
1615
1630
|
beforeRun: AsyncSeriesHook<[Compiler]>;
|
1616
1631
|
run: AsyncSeriesHook<[Compiler]>;
|
1617
1632
|
emit: AsyncSeriesHook<[Compilation]>;
|
1618
1633
|
assetEmitted: AsyncSeriesHook<[string, AssetEmittedInfo]>;
|
1619
1634
|
afterEmit: AsyncSeriesHook<[Compilation]>;
|
1620
|
-
thisCompilation: SyncHook<[Compilation, CompilationParams]
|
1621
|
-
compilation: SyncHook<[Compilation, CompilationParams]
|
1622
|
-
normalModuleFactory: SyncHook<[NormalModuleFactory]
|
1623
|
-
contextModuleFactory: SyncHook<[ContextModuleFactory]
|
1635
|
+
thisCompilation: SyncHook<[Compilation, CompilationParams]>;
|
1636
|
+
compilation: SyncHook<[Compilation, CompilationParams]>;
|
1637
|
+
normalModuleFactory: SyncHook<[NormalModuleFactory]>;
|
1638
|
+
contextModuleFactory: SyncHook<[ContextModuleFactory]>;
|
1624
1639
|
beforeCompile: AsyncSeriesHook<[CompilationParams]>;
|
1625
|
-
compile: SyncHook<[CompilationParams]
|
1640
|
+
compile: SyncHook<[CompilationParams]>;
|
1626
1641
|
make: AsyncParallelHook<[Compilation]>;
|
1627
1642
|
finishMake: AsyncParallelHook<[Compilation]>;
|
1628
1643
|
afterCompile: AsyncSeriesHook<[Compilation]>;
|
1629
1644
|
watchRun: AsyncSeriesHook<[Compiler]>;
|
1630
|
-
failed: SyncHook<[Error]
|
1631
|
-
invalid: SyncHook<[string, number]
|
1632
|
-
watchClose: SyncHook<[]
|
1645
|
+
failed: SyncHook<[Error]>;
|
1646
|
+
invalid: SyncHook<[string, number]>;
|
1647
|
+
watchClose: SyncHook<[]>;
|
1633
1648
|
infrastructureLog: SyncBailHook<[string, string, any[]], true>;
|
1634
|
-
environment: SyncHook<[]
|
1635
|
-
afterEnvironment: SyncHook<[]
|
1636
|
-
afterPlugins: SyncHook<[Compiler]
|
1637
|
-
afterResolvers: SyncHook<[Compiler]
|
1649
|
+
environment: SyncHook<[]>;
|
1650
|
+
afterEnvironment: SyncHook<[]>;
|
1651
|
+
afterPlugins: SyncHook<[Compiler]>;
|
1652
|
+
afterResolvers: SyncHook<[Compiler]>;
|
1638
1653
|
entryOption: SyncBailHook<[string, EntryNormalized], boolean>;
|
1639
1654
|
}>;
|
1640
1655
|
webpack: typeof exports;
|
@@ -2194,8 +2209,20 @@ declare class DefinePlugin {
|
|
2194
2209
|
/**
|
2195
2210
|
* Create a new define plugin
|
2196
2211
|
*/
|
2197
|
-
constructor(
|
2198
|
-
|
2212
|
+
constructor(
|
2213
|
+
definitions: Record<
|
2214
|
+
string,
|
2215
|
+
RecursiveArrayOrRecord<
|
2216
|
+
string | number | bigint | boolean | Function | RegExp | RuntimeValue
|
2217
|
+
>
|
2218
|
+
>
|
2219
|
+
);
|
2220
|
+
definitions: Record<
|
2221
|
+
string,
|
2222
|
+
RecursiveArrayOrRecord<
|
2223
|
+
string | number | bigint | boolean | Function | RegExp | RuntimeValue
|
2224
|
+
>
|
2225
|
+
>;
|
2199
2226
|
|
2200
2227
|
/**
|
2201
2228
|
* Apply the plugin
|
@@ -3213,7 +3240,7 @@ type ExternalItem =
|
|
3213
3240
|
| { [index: string]: string | boolean | string[] | { [index: string]: any } }
|
3214
3241
|
| ((
|
3215
3242
|
data: { context: string; request: string },
|
3216
|
-
callback: (err
|
3243
|
+
callback: (err?: Error, result?: string) => void
|
3217
3244
|
) => void);
|
3218
3245
|
declare class ExternalModule extends Module {
|
3219
3246
|
constructor(request?: any, type?: any, userRequest?: any);
|
@@ -3237,7 +3264,7 @@ type Externals =
|
|
3237
3264
|
| { [index: string]: string | boolean | string[] | { [index: string]: any } }
|
3238
3265
|
| ((
|
3239
3266
|
data: { context: string; request: string },
|
3240
|
-
callback: (err
|
3267
|
+
callback: (err?: Error, result?: string) => void
|
3241
3268
|
) => void);
|
3242
3269
|
declare class ExternalsPlugin {
|
3243
3270
|
constructor(type: string, externals: Externals);
|
@@ -3444,7 +3471,7 @@ declare interface FileSystem {
|
|
3444
3471
|
};
|
3445
3472
|
}
|
3446
3473
|
declare interface FileSystemCallback<T> {
|
3447
|
-
(err
|
3474
|
+
(err?: PossibleFileSystemError & Error, result?: T): any;
|
3448
3475
|
}
|
3449
3476
|
declare interface FileSystemDirent {
|
3450
3477
|
name: string | Buffer;
|
@@ -3526,7 +3553,9 @@ declare interface FileSystemStats {
|
|
3526
3553
|
isDirectory: () => boolean;
|
3527
3554
|
isFile: () => boolean;
|
3528
3555
|
}
|
3529
|
-
type Filename =
|
3556
|
+
type Filename =
|
3557
|
+
| string
|
3558
|
+
| ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
3530
3559
|
type FilterItemTypes = string | RegExp | ((value: string) => boolean);
|
3531
3560
|
type FilterTypes =
|
3532
3561
|
| string
|
@@ -3659,7 +3688,7 @@ declare interface HashedModuleIdsPluginOptions {
|
|
3659
3688
|
/**
|
3660
3689
|
* The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
|
3661
3690
|
*/
|
3662
|
-
hashDigest?: "
|
3691
|
+
hashDigest?: "base64" | "latin1" | "hex";
|
3663
3692
|
|
3664
3693
|
/**
|
3665
3694
|
* The prefix length of the hash digest to use, defaults to 4.
|
@@ -4162,6 +4191,13 @@ declare class JavascriptParser extends Parser {
|
|
4162
4191
|
preWalkStatement(statement?: any): void;
|
4163
4192
|
blockPreWalkStatement(statement?: any): void;
|
4164
4193
|
walkStatement(statement?: any): void;
|
4194
|
+
|
4195
|
+
/**
|
4196
|
+
* Walks a statements that is nested within a parent statement
|
4197
|
+
* and can potentially be a non-block statement.
|
4198
|
+
* This enforces the nested statement to never be in ASI position.
|
4199
|
+
*/
|
4200
|
+
walkNestedStatement(statement: Statement): void;
|
4165
4201
|
preWalkBlockStatement(statement?: any): void;
|
4166
4202
|
walkBlockStatement(statement?: any): void;
|
4167
4203
|
walkExpressionStatement(statement?: any): void;
|
@@ -5307,10 +5343,10 @@ declare abstract class ModuleTemplate {
|
|
5307
5343
|
declare class MultiCompiler {
|
5308
5344
|
constructor(compilers: Compiler[] | Record<string, Compiler>);
|
5309
5345
|
hooks: Readonly<{
|
5310
|
-
done: SyncHook<[MultiStats]
|
5311
|
-
invalid: MultiHook<SyncHook<[string, number]
|
5346
|
+
done: SyncHook<[MultiStats]>;
|
5347
|
+
invalid: MultiHook<SyncHook<[string, number]>>;
|
5312
5348
|
run: MultiHook<AsyncSeriesHook<[Compiler]>>;
|
5313
|
-
watchClose: SyncHook<[]
|
5349
|
+
watchClose: SyncHook<[]>;
|
5314
5350
|
watchRun: MultiHook<AsyncSeriesHook<[Compiler]>>;
|
5315
5351
|
infrastructureLog: MultiHook<SyncBailHook<[string, string, any[]], true>>;
|
5316
5352
|
}>;
|
@@ -5619,8 +5655,8 @@ declare class NormalModule extends Module {
|
|
5619
5655
|
static deserialize(context?: any): NormalModule;
|
5620
5656
|
}
|
5621
5657
|
declare interface NormalModuleCompilationHooks {
|
5622
|
-
loader: SyncHook<[any, NormalModule]
|
5623
|
-
beforeLoaders: SyncHook<[LoaderItem[], NormalModule, any]
|
5658
|
+
loader: SyncHook<[any, NormalModule]>;
|
5659
|
+
beforeLoaders: SyncHook<[LoaderItem[], NormalModule, any]>;
|
5624
5660
|
readResourceForScheme: HookMap<
|
5625
5661
|
AsyncSeriesBailHook<[string, NormalModule], string | Buffer>
|
5626
5662
|
>;
|
@@ -5647,11 +5683,11 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
|
|
5647
5683
|
beforeResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
5648
5684
|
afterResolve: AsyncSeriesBailHook<[ResolveData], any>;
|
5649
5685
|
createModule: AsyncSeriesBailHook<[any, ResolveData], any>;
|
5650
|
-
module: SyncWaterfallHook<[Module, any, ResolveData]>;
|
5686
|
+
module: SyncWaterfallHook<[Module, any, ResolveData], any>;
|
5651
5687
|
createParser: HookMap<SyncBailHook<any, any>>;
|
5652
|
-
parser: HookMap<SyncHook<any
|
5688
|
+
parser: HookMap<SyncHook<any>>;
|
5653
5689
|
createGenerator: HookMap<SyncBailHook<any, any>>;
|
5654
|
-
generator: HookMap<SyncHook<any
|
5690
|
+
generator: HookMap<SyncHook<any>>;
|
5655
5691
|
}>;
|
5656
5692
|
resolverFactory: ResolverFactory;
|
5657
5693
|
ruleSet: RuleSet;
|
@@ -5907,7 +5943,7 @@ declare interface OptimizationSplitChunksCacheGroup {
|
|
5907
5943
|
/**
|
5908
5944
|
* Sets the template for the filename for created chunks.
|
5909
5945
|
*/
|
5910
|
-
filename?: string | ((pathData: PathData, assetInfo
|
5946
|
+
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
5911
5947
|
|
5912
5948
|
/**
|
5913
5949
|
* Sets the hint for chunk id.
|
@@ -6050,7 +6086,7 @@ declare interface OptimizationSplitChunksOptions {
|
|
6050
6086
|
/**
|
6051
6087
|
* Sets the template for the filename for created chunks.
|
6052
6088
|
*/
|
6053
|
-
filename?: string | ((pathData: PathData, assetInfo
|
6089
|
+
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
6054
6090
|
|
6055
6091
|
/**
|
6056
6092
|
* Prevents exposing path info when creating names for parts splitted by maxSize.
|
@@ -6648,9 +6684,6 @@ declare interface PerformanceOptions {
|
|
6648
6684
|
*/
|
6649
6685
|
maxEntrypointSize?: number;
|
6650
6686
|
}
|
6651
|
-
declare interface Plugin {
|
6652
|
-
apply: () => void;
|
6653
|
-
}
|
6654
6687
|
declare interface PnpApiImpl {
|
6655
6688
|
resolveToUnqualified: (arg0: string, arg1: string, arg2?: any) => string;
|
6656
6689
|
}
|
@@ -6855,13 +6888,13 @@ declare interface ProvidesObject {
|
|
6855
6888
|
}
|
6856
6889
|
type PublicPath =
|
6857
6890
|
| string
|
6858
|
-
| ((pathData: PathData, assetInfo
|
6891
|
+
| ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
6859
6892
|
declare interface RawChunkGroupOptions {
|
6860
6893
|
preloadOrder?: number;
|
6861
6894
|
prefetchOrder?: number;
|
6862
6895
|
}
|
6863
6896
|
declare class RawSource extends Source {
|
6864
|
-
constructor(source: string | Buffer, convertToString
|
6897
|
+
constructor(source: string | Buffer, convertToString?: boolean);
|
6865
6898
|
isBuffer(): boolean;
|
6866
6899
|
}
|
6867
6900
|
declare class ReadFileCompileWasmPlugin {
|
@@ -6873,21 +6906,26 @@ declare class ReadFileCompileWasmPlugin {
|
|
6873
6906
|
*/
|
6874
6907
|
apply(compiler: Compiler): void;
|
6875
6908
|
}
|
6909
|
+
declare class RealContentHashPlugin {
|
6910
|
+
constructor(__0: { hashFunction: any; hashDigest: any });
|
6911
|
+
|
6912
|
+
/**
|
6913
|
+
* Apply the plugin
|
6914
|
+
*/
|
6915
|
+
apply(compiler: Compiler): void;
|
6916
|
+
static getCompilationHooks(
|
6917
|
+
compilation: Compilation
|
6918
|
+
): CompilationHooksRealContentHashPlugin;
|
6919
|
+
}
|
6876
6920
|
declare interface RealDependencyLocation {
|
6877
6921
|
start: SourcePosition;
|
6878
6922
|
end?: SourcePosition;
|
6879
6923
|
index?: number;
|
6880
6924
|
}
|
6881
|
-
type RecursiveArrayOrRecord =
|
6882
|
-
| string
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
| boolean
|
6886
|
-
| Function
|
6887
|
-
| RegExp
|
6888
|
-
| RuntimeValue
|
6889
|
-
| { [index: string]: RecursiveArrayOrRecord }
|
6890
|
-
| RecursiveArrayOrRecord[];
|
6925
|
+
type RecursiveArrayOrRecord<T> =
|
6926
|
+
| { [index: string]: RecursiveArrayOrRecord<T> }
|
6927
|
+
| RecursiveArrayOrRecord<T>[]
|
6928
|
+
| T;
|
6891
6929
|
declare interface ReferencedExport {
|
6892
6930
|
/**
|
6893
6931
|
* name of the referenced export
|
@@ -7038,9 +7076,9 @@ declare interface RenderManifestOptions {
|
|
7038
7076
|
chunkGraph: ChunkGraph;
|
7039
7077
|
}
|
7040
7078
|
declare class ReplaceSource extends Source {
|
7041
|
-
constructor(source: Source, name
|
7042
|
-
replace(start: number, end: number, newValue: string, name
|
7043
|
-
insert(pos: number, newValue: string, name
|
7079
|
+
constructor(source: Source, name?: string);
|
7080
|
+
replace(start: number, end: number, newValue: string, name?: string): void;
|
7081
|
+
insert(pos: number, newValue: string, name?: string): void;
|
7044
7082
|
getName(): string;
|
7045
7083
|
original(): string;
|
7046
7084
|
getReplacements(): {
|
@@ -7369,10 +7407,9 @@ declare abstract class Resolver {
|
|
7369
7407
|
[
|
7370
7408
|
AsyncSeriesBailHook<[ResolveRequest, ResolveContext], ResolveRequest>,
|
7371
7409
|
ResolveRequest
|
7372
|
-
]
|
7373
|
-
void
|
7410
|
+
]
|
7374
7411
|
>;
|
7375
|
-
noResolve: SyncHook<[ResolveRequest, Error]
|
7412
|
+
noResolve: SyncHook<[ResolveRequest, Error]>;
|
7376
7413
|
resolve: AsyncSeriesBailHook<
|
7377
7414
|
[ResolveRequest, ResolveContext],
|
7378
7415
|
ResolveRequest
|
@@ -7395,7 +7432,7 @@ declare abstract class Resolver {
|
|
7395
7432
|
path: string,
|
7396
7433
|
request: string,
|
7397
7434
|
resolveContext: ResolveContext,
|
7398
|
-
callback: (arg0: Error, arg1
|
7435
|
+
callback: (arg0: Error, arg1?: DevTool, arg2?: ResolveRequest) => void
|
7399
7436
|
): void;
|
7400
7437
|
doResolve(
|
7401
7438
|
hook?: any,
|
@@ -7644,8 +7681,7 @@ declare abstract class ResolverFactory {
|
|
7644
7681
|
dependencyType?: string;
|
7645
7682
|
resolveToContext?: boolean;
|
7646
7683
|
}
|
7647
|
-
]
|
7648
|
-
void
|
7684
|
+
]
|
7649
7685
|
>
|
7650
7686
|
>;
|
7651
7687
|
}>;
|
@@ -8024,6 +8060,7 @@ declare abstract class RuntimeSpecMap<T> {
|
|
8024
8060
|
}
|
8025
8061
|
declare abstract class RuntimeSpecSet {
|
8026
8062
|
add(runtime?: any): void;
|
8063
|
+
has(runtime?: any): boolean;
|
8027
8064
|
[Symbol.iterator](): IterableIterator<string | SortableSet<string>>;
|
8028
8065
|
readonly size: number;
|
8029
8066
|
}
|
@@ -8292,14 +8329,6 @@ declare abstract class RuntimeTemplate {
|
|
8292
8329
|
* true, if this is a weak dependency
|
8293
8330
|
*/
|
8294
8331
|
weak?: boolean;
|
8295
|
-
/**
|
8296
|
-
* runtime for which this code will be generated
|
8297
|
-
*/
|
8298
|
-
runtime?: string | SortableSet<string>;
|
8299
|
-
/**
|
8300
|
-
* only execute the statement in some runtimes
|
8301
|
-
*/
|
8302
|
-
runtimeCondition?: string | boolean | SortableSet<string>;
|
8303
8332
|
/**
|
8304
8333
|
* if set, will be filled with runtime requirements
|
8305
8334
|
*/
|
@@ -8688,8 +8717,8 @@ declare abstract class SortableSet<T> extends Set<T> {
|
|
8688
8717
|
declare class Source {
|
8689
8718
|
constructor();
|
8690
8719
|
size(): number;
|
8691
|
-
map(options
|
8692
|
-
sourceAndMap(options
|
8720
|
+
map(options?: MapOptions): Object;
|
8721
|
+
sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object };
|
8693
8722
|
updateHash(hash: Hash): void;
|
8694
8723
|
source(): string | Buffer;
|
8695
8724
|
buffer(): Buffer;
|
@@ -8792,8 +8821,8 @@ declare class SourceMapSource extends Source {
|
|
8792
8821
|
source: string | Buffer,
|
8793
8822
|
name: string,
|
8794
8823
|
sourceMap: string | Object | Buffer,
|
8795
|
-
originalSource
|
8796
|
-
innerSourceMap
|
8824
|
+
originalSource?: string | Buffer,
|
8825
|
+
innerSourceMap?: string | Object | Buffer
|
8797
8826
|
);
|
8798
8827
|
getArgsAsBuffers(): [Buffer, string, Buffer, Buffer, Buffer];
|
8799
8828
|
}
|
@@ -10221,6 +10250,7 @@ declare namespace exports {
|
|
10221
10250
|
LimitChunkCountPlugin,
|
10222
10251
|
MinChunkSizePlugin,
|
10223
10252
|
ModuleConcatenationPlugin,
|
10253
|
+
RealContentHashPlugin,
|
10224
10254
|
RuntimeChunkPlugin,
|
10225
10255
|
SideEffectsFlagPlugin,
|
10226
10256
|
SplitChunksPlugin
|