webpack 5.31.2 → 5.33.2
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/CaseSensitiveModulesWarning.js +3 -3
- package/lib/Compilation.js +488 -48
- package/lib/DefinePlugin.js +21 -5
- package/lib/EntryOptionPlugin.js +1 -0
- package/lib/FlagDependencyExportsPlugin.js +22 -0
- package/lib/Module.js +1 -1
- package/lib/ModuleGraph.js +24 -0
- package/lib/NormalModule.js +14 -3
- package/lib/NormalModuleFactory.js +15 -1
- package/lib/RuntimeModule.js +5 -1
- package/lib/RuntimePlugin.js +7 -2
- package/lib/WarnCaseSensitiveModulesPlugin.js +15 -9
- package/lib/WebpackOptionsApply.js +3 -1
- package/lib/asset/AssetModulesPlugin.js +13 -0
- package/lib/config/defaults.js +1 -3
- package/lib/config/normalization.js +1 -0
- package/lib/container/RemoteRuntimeModule.js +2 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +7 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +191 -39
- package/lib/dependencies/LoaderImportDependency.js +28 -0
- package/lib/dependencies/LoaderPlugin.js +134 -2
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -2
- package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -2
- package/lib/javascript/JavascriptModulesPlugin.js +67 -2
- package/lib/library/AbstractLibraryPlugin.js +26 -8
- package/lib/node/CommonJsChunkLoadingPlugin.js +3 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +3 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +3 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -2
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +2 -4
- package/lib/runtime/CompatRuntimeModule.js +1 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +3 -2
- package/lib/runtime/PublicPathRuntimeModule.js +5 -5
- package/lib/runtime/RuntimeIdRuntimeModule.js +1 -2
- package/lib/runtime/StartupChunkDependenciesPlugin.js +5 -3
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +2 -2
- package/lib/serialization/ObjectMiddleware.js +13 -4
- package/lib/sharing/ConsumeSharedRuntimeModule.js +2 -5
- package/lib/sharing/ShareRuntimeModule.js +2 -2
- package/lib/stats/DefaultStatsFactoryPlugin.js +5 -0
- package/lib/stats/DefaultStatsPrinterPlugin.js +2 -0
- package/lib/util/AsyncQueue.js +45 -10
- package/lib/util/WeakTupleMap.js +168 -0
- package/lib/util/processAsyncTree.js +3 -2
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +3 -1
- package/lib/web/FetchCompileWasmPlugin.js +3 -1
- package/lib/web/JsonpChunkLoadingPlugin.js +3 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -2
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +3 -3
- package/schemas/WebpackOptions.json +10 -0
- package/types.d.ts +131 -14
@@ -0,0 +1,168 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const isWeakKey = thing => typeof thing === "object" && thing !== null;
|
9
|
+
|
10
|
+
class WeakTupleNode {
|
11
|
+
constructor() {
|
12
|
+
this.f = 0;
|
13
|
+
/** @type {any} */
|
14
|
+
this.v = undefined;
|
15
|
+
/** @type {Map<object, WeakTupleNode> | undefined} */
|
16
|
+
this.m = undefined;
|
17
|
+
/** @type {WeakMap<object, WeakTupleNode> | undefined} */
|
18
|
+
this.w = undefined;
|
19
|
+
}
|
20
|
+
|
21
|
+
getValue() {
|
22
|
+
return this.v;
|
23
|
+
}
|
24
|
+
|
25
|
+
hasValue() {
|
26
|
+
return (this.f & 1) === 1;
|
27
|
+
}
|
28
|
+
|
29
|
+
setValue(v) {
|
30
|
+
this.f |= 1;
|
31
|
+
this.v = v;
|
32
|
+
}
|
33
|
+
|
34
|
+
deleteValue() {
|
35
|
+
this.f &= 6;
|
36
|
+
this.v = undefined;
|
37
|
+
}
|
38
|
+
|
39
|
+
peek(thing) {
|
40
|
+
if (isWeakKey(thing)) {
|
41
|
+
if ((this.f & 4) !== 4) return undefined;
|
42
|
+
return this.w.get(thing);
|
43
|
+
} else {
|
44
|
+
if ((this.f & 2) !== 2) return undefined;
|
45
|
+
return this.m.get(thing);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
get(thing) {
|
50
|
+
if (isWeakKey(thing)) {
|
51
|
+
if ((this.f & 4) !== 4) {
|
52
|
+
const newMap = new WeakMap();
|
53
|
+
this.f |= 4;
|
54
|
+
const newNode = new WeakTupleNode();
|
55
|
+
(this.w = newMap).set(thing, newNode);
|
56
|
+
return newNode;
|
57
|
+
}
|
58
|
+
const entry = this.w.get(thing);
|
59
|
+
if (entry !== undefined) {
|
60
|
+
return entry;
|
61
|
+
}
|
62
|
+
const newNode = new WeakTupleNode();
|
63
|
+
this.w.set(thing, newNode);
|
64
|
+
return newNode;
|
65
|
+
} else {
|
66
|
+
if ((this.f & 2) !== 2) {
|
67
|
+
const newMap = new Map();
|
68
|
+
this.f |= 2;
|
69
|
+
const newNode = new WeakTupleNode();
|
70
|
+
(this.m = newMap).set(thing, newNode);
|
71
|
+
return newNode;
|
72
|
+
}
|
73
|
+
const entry = this.m.get(thing);
|
74
|
+
if (entry !== undefined) {
|
75
|
+
return entry;
|
76
|
+
}
|
77
|
+
const newNode = new WeakTupleNode();
|
78
|
+
this.m.set(thing, newNode);
|
79
|
+
return newNode;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @template {any[]} T
|
86
|
+
* @template V
|
87
|
+
*/
|
88
|
+
class WeakTupleMap {
|
89
|
+
constructor() {
|
90
|
+
this._node = new WeakTupleNode();
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @param {[...T, V]} args tuple
|
95
|
+
* @returns {void}
|
96
|
+
*/
|
97
|
+
set(...args) {
|
98
|
+
let node = this._node;
|
99
|
+
for (let i = 0; i < args.length - 1; i++) {
|
100
|
+
node = node.get(args[i]);
|
101
|
+
}
|
102
|
+
node.setValue(args[args.length - 1]);
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* @param {T} args tuple
|
107
|
+
* @returns {boolean} true, if the tuple is in the Set
|
108
|
+
*/
|
109
|
+
has(...args) {
|
110
|
+
let node = this._node;
|
111
|
+
for (let i = 0; i < args.length; i++) {
|
112
|
+
node = node.peek(args[i]);
|
113
|
+
if (node === undefined) return false;
|
114
|
+
}
|
115
|
+
return node.hasValue();
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @param {T} args tuple
|
120
|
+
* @returns {V} the value
|
121
|
+
*/
|
122
|
+
get(...args) {
|
123
|
+
let node = this._node;
|
124
|
+
for (let i = 0; i < args.length; i++) {
|
125
|
+
node = node.peek(args[i]);
|
126
|
+
if (node === undefined) return undefined;
|
127
|
+
}
|
128
|
+
return node.getValue();
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* @param {[...T, function(): V]} args tuple
|
133
|
+
* @returns {V} the value
|
134
|
+
*/
|
135
|
+
provide(...args) {
|
136
|
+
let node = this._node;
|
137
|
+
for (let i = 0; i < args.length - 1; i++) {
|
138
|
+
node = node.get(args[i]);
|
139
|
+
}
|
140
|
+
if (node.hasValue()) return node.getValue();
|
141
|
+
const fn = args[args.length - 1];
|
142
|
+
const newValue = fn(...args.slice(0, -1));
|
143
|
+
node.setValue(newValue);
|
144
|
+
return newValue;
|
145
|
+
}
|
146
|
+
|
147
|
+
/**
|
148
|
+
* @param {T} args tuple
|
149
|
+
* @returns {void}
|
150
|
+
*/
|
151
|
+
delete(...args) {
|
152
|
+
let node = this._node;
|
153
|
+
for (let i = 0; i < args.length; i++) {
|
154
|
+
node = node.peek(args[i]);
|
155
|
+
if (node === undefined) return;
|
156
|
+
}
|
157
|
+
node.deleteValue();
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* @returns {void}
|
162
|
+
*/
|
163
|
+
clear() {
|
164
|
+
this._node = new WeakTupleNode();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
module.exports = WeakTupleMap;
|
@@ -7,10 +7,11 @@
|
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @template T
|
10
|
+
* @template {Error} E
|
10
11
|
* @param {Iterable<T>} items initial items
|
11
12
|
* @param {number} concurrency number of items running in parallel
|
12
|
-
* @param {function(T, function(T): void, function(
|
13
|
-
* @param {function(
|
13
|
+
* @param {function(T, function(T): void, function(E=): void): void} processor worker which pushes more items
|
14
|
+
* @param {function(E=): void} callback all items processed
|
14
15
|
* @returns {void}
|
15
16
|
*/
|
16
17
|
const processAsyncTree = (items, concurrency, processor, callback) => {
|
@@ -200,8 +200,8 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
|
|
200
200
|
* @returns {string} runtime code
|
201
201
|
*/
|
202
202
|
generate() {
|
203
|
-
const { compilation, chunk, mangleImports } = this;
|
204
|
-
const {
|
203
|
+
const { chunkGraph, compilation, chunk, mangleImports } = this;
|
204
|
+
const { moduleGraph, outputOptions } = compilation;
|
205
205
|
const fn = RuntimeGlobals.ensureChunkHandlers;
|
206
206
|
const wasmModules = getAllWasmModules(moduleGraph, chunkGraph, chunk);
|
207
207
|
const declarations = [];
|
@@ -24,7 +24,9 @@ class FetchCompileAsyncWasmPlugin {
|
|
24
24
|
const isEnabledForChunk = chunk => {
|
25
25
|
const options = chunk.getEntryOptions();
|
26
26
|
const wasmLoading =
|
27
|
-
|
27
|
+
options && options.wasmLoading !== undefined
|
28
|
+
? options.wasmLoading
|
29
|
+
: globalWasmLoading;
|
28
30
|
return wasmLoading === "fetch";
|
29
31
|
};
|
30
32
|
const generateLoadBinaryCode = path =>
|
@@ -30,7 +30,9 @@ class FetchCompileWasmPlugin {
|
|
30
30
|
const isEnabledForChunk = chunk => {
|
31
31
|
const options = chunk.getEntryOptions();
|
32
32
|
const wasmLoading =
|
33
|
-
|
33
|
+
options && options.wasmLoading !== undefined
|
34
|
+
? options.wasmLoading
|
35
|
+
: globalWasmLoading;
|
34
36
|
return wasmLoading === "fetch";
|
35
37
|
};
|
36
38
|
const generateLoadBinaryCode = path =>
|
@@ -24,7 +24,9 @@ class JsonpChunkLoadingPlugin {
|
|
24
24
|
const isEnabledForChunk = chunk => {
|
25
25
|
const options = chunk.getEntryOptions();
|
26
26
|
const chunkLoading =
|
27
|
-
|
27
|
+
options && options.chunkLoading !== undefined
|
28
|
+
? options.chunkLoading
|
29
|
+
: globalChunkLoading;
|
28
30
|
return chunkLoading === "jsonp";
|
29
31
|
};
|
30
32
|
const onceForChunkSet = new WeakSet();
|
@@ -55,10 +55,9 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
55
55
|
* @returns {string} runtime code
|
56
56
|
*/
|
57
57
|
generate() {
|
58
|
-
const { compilation, chunk } = this;
|
58
|
+
const { chunkGraph, compilation, chunk } = this;
|
59
59
|
const {
|
60
60
|
runtimeTemplate,
|
61
|
-
chunkGraph,
|
62
61
|
outputOptions: {
|
63
62
|
globalObject,
|
64
63
|
chunkLoadingGlobal,
|
@@ -29,7 +29,9 @@ class ImportScriptsChunkLoadingPlugin {
|
|
29
29
|
const isEnabledForChunk = chunk => {
|
30
30
|
const options = chunk.getEntryOptions();
|
31
31
|
const chunkLoading =
|
32
|
-
|
32
|
+
options && options.chunkLoading !== undefined
|
33
|
+
? options.chunkLoading
|
34
|
+
: globalChunkLoading;
|
33
35
|
return chunkLoading === "import-scripts";
|
34
36
|
};
|
35
37
|
const onceForChunkSet = new WeakSet();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.33.2",
|
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",
|
@@ -60,7 +60,7 @@
|
|
60
60
|
"eslint-plugin-prettier": "^3.1.4",
|
61
61
|
"file-loader": "^6.0.0",
|
62
62
|
"fork-ts-checker-webpack-plugin": "^6.0.5",
|
63
|
-
"husky": "^
|
63
|
+
"husky": "^6.0.0",
|
64
64
|
"is-ci": "^3.0.0",
|
65
65
|
"istanbul": "^0.4.5",
|
66
66
|
"jest": "^26.6.3",
|
@@ -92,7 +92,7 @@
|
|
92
92
|
"style-loader": "^2.0.0",
|
93
93
|
"terser": "^5.5.0",
|
94
94
|
"toml": "^3.0.0",
|
95
|
-
"tooling": "webpack/tooling#v1.
|
95
|
+
"tooling": "webpack/tooling#v1.15.0",
|
96
96
|
"ts-loader": "^8.0.2",
|
97
97
|
"typescript": "^4.2.0-beta",
|
98
98
|
"url-loader": "^4.1.0",
|
@@ -470,6 +470,9 @@
|
|
470
470
|
"library": {
|
471
471
|
"$ref": "#/definitions/LibraryOptions"
|
472
472
|
},
|
473
|
+
"publicPath": {
|
474
|
+
"$ref": "#/definitions/PublicPath"
|
475
|
+
},
|
473
476
|
"runtime": {
|
474
477
|
"$ref": "#/definitions/EntryRuntime"
|
475
478
|
},
|
@@ -518,6 +521,9 @@
|
|
518
521
|
"library": {
|
519
522
|
"$ref": "#/definitions/LibraryOptions"
|
520
523
|
},
|
524
|
+
"publicPath": {
|
525
|
+
"$ref": "#/definitions/PublicPath"
|
526
|
+
},
|
521
527
|
"runtime": {
|
522
528
|
"$ref": "#/definitions/EntryRuntime"
|
523
529
|
},
|
@@ -675,6 +681,10 @@
|
|
675
681
|
"description": "Support WebAssembly as asynchronous EcmaScript Module.",
|
676
682
|
"type": "boolean"
|
677
683
|
},
|
684
|
+
"executeModule": {
|
685
|
+
"description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
|
686
|
+
"type": "boolean"
|
687
|
+
},
|
678
688
|
"layers": {
|
679
689
|
"description": "Enable module and chunk layers.",
|
680
690
|
"type": "boolean"
|
package/types.d.ts
CHANGED
@@ -343,8 +343,13 @@ declare abstract class AsyncQueue<T, K, R> {
|
|
343
343
|
started: SyncHook<[T]>;
|
344
344
|
result: SyncHook<[T, Error, R]>;
|
345
345
|
};
|
346
|
-
add(item: T, callback:
|
346
|
+
add(item: T, callback: CallbackAsyncQueue<R>): void;
|
347
347
|
invalidate(item: T): void;
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Waits for an already started item
|
351
|
+
*/
|
352
|
+
waitFor(item: T, callback: CallbackAsyncQueue<R>): void;
|
348
353
|
stop(): void;
|
349
354
|
increaseParallelism(): void;
|
350
355
|
decreaseParallelism(): void;
|
@@ -657,6 +662,9 @@ declare interface CallExpressionInfo {
|
|
657
662
|
name: string;
|
658
663
|
getMembers: () => string[];
|
659
664
|
}
|
665
|
+
declare interface CallbackAsyncQueue<T> {
|
666
|
+
(err?: WebpackError, result?: T): any;
|
667
|
+
}
|
660
668
|
declare interface CallbackCache<T> {
|
661
669
|
(err?: WebpackError, result?: T): void;
|
662
670
|
}
|
@@ -1242,6 +1250,10 @@ declare class Compilation {
|
|
1242
1250
|
dependencyReferencedExports: SyncWaterfallHook<
|
1243
1251
|
[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]
|
1244
1252
|
>;
|
1253
|
+
executeModule: SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>;
|
1254
|
+
prepareModuleExecution: AsyncParallelHook<
|
1255
|
+
[ExecuteModuleArgument, ExecuteModuleContext]
|
1256
|
+
>;
|
1245
1257
|
finishModules: AsyncSeriesHook<[Iterable<Module>]>;
|
1246
1258
|
finishRebuildingModule: AsyncSeriesHook<[Module]>;
|
1247
1259
|
unseal: SyncHook<[]>;
|
@@ -1263,14 +1275,24 @@ declare class Compilation {
|
|
1263
1275
|
>;
|
1264
1276
|
afterOptimizeChunkModules: SyncHook<[Iterable<Chunk>, Iterable<Module>]>;
|
1265
1277
|
shouldRecord: SyncBailHook<[], boolean>;
|
1266
|
-
additionalChunkRuntimeRequirements: SyncHook<
|
1267
|
-
|
1268
|
-
|
1278
|
+
additionalChunkRuntimeRequirements: SyncHook<
|
1279
|
+
[Chunk, Set<string>, RuntimeRequirementsContext]
|
1280
|
+
>;
|
1281
|
+
runtimeRequirementInChunk: HookMap<
|
1282
|
+
SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext], any>
|
1283
|
+
>;
|
1284
|
+
additionalModuleRuntimeRequirements: SyncHook<
|
1285
|
+
[Module, Set<string>, RuntimeRequirementsContext]
|
1286
|
+
>;
|
1269
1287
|
runtimeRequirementInModule: HookMap<
|
1270
|
-
SyncBailHook<[Module, Set<string
|
1288
|
+
SyncBailHook<[Module, Set<string>, RuntimeRequirementsContext], any>
|
1289
|
+
>;
|
1290
|
+
additionalTreeRuntimeRequirements: SyncHook<
|
1291
|
+
[Chunk, Set<string>, RuntimeRequirementsContext]
|
1292
|
+
>;
|
1293
|
+
runtimeRequirementInTree: HookMap<
|
1294
|
+
SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext], any>
|
1271
1295
|
>;
|
1272
|
-
additionalTreeRuntimeRequirements: SyncHook<[Chunk, Set<string>]>;
|
1273
|
-
runtimeRequirementInTree: HookMap<SyncBailHook<[Chunk, Set<string>], any>>;
|
1274
1296
|
runtimeModule: SyncHook<[RuntimeModule, Chunk]>;
|
1275
1297
|
reviveModules: SyncHook<[Iterable<Module>, any]>;
|
1276
1298
|
beforeModuleIds: SyncHook<[Iterable<Module>]>;
|
@@ -1363,7 +1385,7 @@ declare class Compilation {
|
|
1363
1385
|
resolverFactory: ResolverFactory;
|
1364
1386
|
inputFileSystem: InputFileSystem;
|
1365
1387
|
fileSystemInfo: FileSystemInfo;
|
1366
|
-
valueCacheVersions: Map<string, string
|
1388
|
+
valueCacheVersions: Map<string, string | Set<string>>;
|
1367
1389
|
requestShortener: RequestShortener;
|
1368
1390
|
compilerPath: string;
|
1369
1391
|
logger: WebpackLogger;
|
@@ -1376,7 +1398,7 @@ declare class Compilation {
|
|
1376
1398
|
runtimeTemplate: RuntimeTemplate;
|
1377
1399
|
moduleTemplates: { javascript: ModuleTemplate };
|
1378
1400
|
moduleGraph: ModuleGraph;
|
1379
|
-
chunkGraph
|
1401
|
+
chunkGraph: ChunkGraph;
|
1380
1402
|
codeGenerationResults: CodeGenerationResults;
|
1381
1403
|
processDependenciesQueue: AsyncQueue<Module, Module, Module>;
|
1382
1404
|
addModuleQueue: AsyncQueue<Module, string, Module>;
|
@@ -1415,6 +1437,7 @@ declare class Compilation {
|
|
1415
1437
|
needAdditionalPass: boolean;
|
1416
1438
|
builtModules: WeakSet<Module>;
|
1417
1439
|
codeGeneratedModules: WeakSet<Module>;
|
1440
|
+
buildTimeExecutedModules: WeakSet<Module>;
|
1418
1441
|
emittedAssets: Set<string>;
|
1419
1442
|
comparedForEmitAssets: Set<string>;
|
1420
1443
|
fileDependencies: LazySet<string>;
|
@@ -1512,8 +1535,33 @@ declare class Compilation {
|
|
1512
1535
|
blocks: DependenciesBlock[]
|
1513
1536
|
): void;
|
1514
1537
|
codeGeneration(callback?: any): void;
|
1515
|
-
processRuntimeRequirements(
|
1516
|
-
|
1538
|
+
processRuntimeRequirements(__0?: {
|
1539
|
+
/**
|
1540
|
+
* the chunk graph
|
1541
|
+
*/
|
1542
|
+
chunkGraph?: ChunkGraph;
|
1543
|
+
/**
|
1544
|
+
* modules
|
1545
|
+
*/
|
1546
|
+
modules?: Iterable<Module>;
|
1547
|
+
/**
|
1548
|
+
* chunks
|
1549
|
+
*/
|
1550
|
+
chunks?: Iterable<Chunk>;
|
1551
|
+
/**
|
1552
|
+
* codeGenerationResults
|
1553
|
+
*/
|
1554
|
+
codeGenerationResults?: CodeGenerationResults;
|
1555
|
+
/**
|
1556
|
+
* chunkGraphEntries
|
1557
|
+
*/
|
1558
|
+
chunkGraphEntries?: Iterable<Chunk>;
|
1559
|
+
}): void;
|
1560
|
+
addRuntimeModule(
|
1561
|
+
chunk: Chunk,
|
1562
|
+
module: RuntimeModule,
|
1563
|
+
chunkGraph?: ChunkGraph
|
1564
|
+
): void;
|
1517
1565
|
addChunkInGroup(
|
1518
1566
|
groupOptions: string | ChunkGroupOptions,
|
1519
1567
|
module: Module,
|
@@ -1601,6 +1649,11 @@ declare class Compilation {
|
|
1601
1649
|
| WebpackPluginInstance
|
1602
1650
|
)[]
|
1603
1651
|
): Compiler;
|
1652
|
+
executeModule(
|
1653
|
+
module: Module,
|
1654
|
+
options: ExecuteModuleOptions,
|
1655
|
+
callback: (err?: WebpackError, result?: ExecuteModuleResult) => void
|
1656
|
+
): void;
|
1604
1657
|
checkConstraints(): void;
|
1605
1658
|
|
1606
1659
|
/**
|
@@ -2876,6 +2929,11 @@ declare interface EntryDescription {
|
|
2876
2929
|
*/
|
2877
2930
|
library?: LibraryOptions;
|
2878
2931
|
|
2932
|
+
/**
|
2933
|
+
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
|
2934
|
+
*/
|
2935
|
+
publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
2936
|
+
|
2879
2937
|
/**
|
2880
2938
|
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
|
2881
2939
|
*/
|
@@ -2921,6 +2979,11 @@ declare interface EntryDescriptionNormalized {
|
|
2921
2979
|
*/
|
2922
2980
|
library?: LibraryOptions;
|
2923
2981
|
|
2982
|
+
/**
|
2983
|
+
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
|
2984
|
+
*/
|
2985
|
+
publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
2986
|
+
|
2924
2987
|
/**
|
2925
2988
|
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
|
2926
2989
|
*/
|
@@ -3085,6 +3148,30 @@ declare class EvalSourceMapDevToolPlugin {
|
|
3085
3148
|
*/
|
3086
3149
|
apply(compiler: Compiler): void;
|
3087
3150
|
}
|
3151
|
+
declare interface ExecuteModuleArgument {
|
3152
|
+
module: Module;
|
3153
|
+
moduleObject?: { id: string; exports: any; loaded: boolean };
|
3154
|
+
preparedInfo: any;
|
3155
|
+
codeGenerationResult: CodeGenerationResult;
|
3156
|
+
}
|
3157
|
+
declare interface ExecuteModuleContext {
|
3158
|
+
assets: Map<string, { source: Source; info: AssetInfo }>;
|
3159
|
+
chunk: Chunk;
|
3160
|
+
chunkGraph: ChunkGraph;
|
3161
|
+
__webpack_require__?: (arg0: string) => any;
|
3162
|
+
}
|
3163
|
+
declare interface ExecuteModuleOptions {
|
3164
|
+
entryOptions?: EntryOptions;
|
3165
|
+
}
|
3166
|
+
declare interface ExecuteModuleResult {
|
3167
|
+
exports: any;
|
3168
|
+
cacheable: boolean;
|
3169
|
+
assets: Map<string, { source: Source; info: AssetInfo }>;
|
3170
|
+
fileDependencies: LazySet<string>;
|
3171
|
+
contextDependencies: LazySet<string>;
|
3172
|
+
missingDependencies: LazySet<string>;
|
3173
|
+
buildDependencies: LazySet<string>;
|
3174
|
+
}
|
3088
3175
|
|
3089
3176
|
/**
|
3090
3177
|
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
|
@@ -3100,6 +3187,11 @@ declare interface Experiments {
|
|
3100
3187
|
*/
|
3101
3188
|
asyncWebAssembly?: boolean;
|
3102
3189
|
|
3190
|
+
/**
|
3191
|
+
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
3192
|
+
*/
|
3193
|
+
executeModule?: boolean;
|
3194
|
+
|
3103
3195
|
/**
|
3104
3196
|
* Enable module and chunk layers.
|
3105
3197
|
*/
|
@@ -4048,6 +4140,11 @@ declare interface HandleModuleCreationOptions {
|
|
4048
4140
|
* recurse into dependencies of the created module
|
4049
4141
|
*/
|
4050
4142
|
recursive?: boolean;
|
4143
|
+
|
4144
|
+
/**
|
4145
|
+
* connect the resolved module with the origin module
|
4146
|
+
*/
|
4147
|
+
connectOrigin?: boolean;
|
4051
4148
|
}
|
4052
4149
|
declare class Hash {
|
4053
4150
|
constructor();
|
@@ -5348,6 +5445,7 @@ declare interface KnownStatsModule {
|
|
5348
5445
|
cacheable?: boolean;
|
5349
5446
|
built?: boolean;
|
5350
5447
|
codeGenerated?: boolean;
|
5448
|
+
buildTimeExecuted?: boolean;
|
5351
5449
|
cached?: boolean;
|
5352
5450
|
optional?: boolean;
|
5353
5451
|
orphan?: boolean;
|
@@ -5484,6 +5582,7 @@ declare class LibManifestPlugin {
|
|
5484
5582
|
}
|
5485
5583
|
declare interface LibraryContext<T> {
|
5486
5584
|
compilation: Compilation;
|
5585
|
+
chunkGraph: ChunkGraph;
|
5487
5586
|
options: T;
|
5488
5587
|
}
|
5489
5588
|
|
@@ -6154,6 +6253,12 @@ declare class ModuleGraph {
|
|
6154
6253
|
setAsync(module: Module): void;
|
6155
6254
|
getMeta(thing?: any): Object;
|
6156
6255
|
getMetaIfExisting(thing?: any): Object;
|
6256
|
+
freeze(): void;
|
6257
|
+
unfreeze(): void;
|
6258
|
+
cached<T extends any[], V>(
|
6259
|
+
fn: (moduleGraph: ModuleGraph, ...args: T) => V,
|
6260
|
+
...args: T
|
6261
|
+
): V;
|
6157
6262
|
static getModuleGraphForModule(
|
6158
6263
|
module: Module,
|
6159
6264
|
deprecateMessage: string,
|
@@ -6514,7 +6619,7 @@ declare class NaturalModuleIdsPlugin {
|
|
6514
6619
|
}
|
6515
6620
|
declare interface NeedBuildContext {
|
6516
6621
|
fileSystemInfo: FileSystemInfo;
|
6517
|
-
valueCacheVersions: Map<string, string
|
6622
|
+
valueCacheVersions: Map<string, string | Set<string>>;
|
6518
6623
|
}
|
6519
6624
|
declare class NoEmitOnErrorsPlugin {
|
6520
6625
|
constructor();
|
@@ -9268,8 +9373,9 @@ declare class RuntimeModule extends Module {
|
|
9268
9373
|
stage: number;
|
9269
9374
|
compilation: Compilation;
|
9270
9375
|
chunk: Chunk;
|
9376
|
+
chunkGraph: ChunkGraph;
|
9271
9377
|
fullHash: boolean;
|
9272
|
-
attach(compilation: Compilation, chunk: Chunk): void;
|
9378
|
+
attach(compilation: Compilation, chunk: Chunk, chunkGraph?: ChunkGraph): void;
|
9273
9379
|
generate(): string;
|
9274
9380
|
getGeneratedCode(): string;
|
9275
9381
|
shouldIsolate(): boolean;
|
@@ -9294,6 +9400,17 @@ declare class RuntimeModule extends Module {
|
|
9294
9400
|
*/
|
9295
9401
|
static STAGE_TRIGGER: number;
|
9296
9402
|
}
|
9403
|
+
declare interface RuntimeRequirementsContext {
|
9404
|
+
/**
|
9405
|
+
* the chunk graph
|
9406
|
+
*/
|
9407
|
+
chunkGraph: ChunkGraph;
|
9408
|
+
|
9409
|
+
/**
|
9410
|
+
* the code generation results
|
9411
|
+
*/
|
9412
|
+
codeGenerationResults: CodeGenerationResults;
|
9413
|
+
}
|
9297
9414
|
type RuntimeSpec = undefined | string | SortableSet<string>;
|
9298
9415
|
declare abstract class RuntimeSpecMap<T> {
|
9299
9416
|
get(runtime: RuntimeSpec): T;
|
@@ -9714,7 +9831,7 @@ declare abstract class RuntimeValue {
|
|
9714
9831
|
readonly fileDependencies?: true | string[];
|
9715
9832
|
exec(
|
9716
9833
|
parser: JavascriptParser,
|
9717
|
-
valueCacheVersions: Map<string, string
|
9834
|
+
valueCacheVersions: Map<string, string | Set<string>>,
|
9718
9835
|
key: string
|
9719
9836
|
): CodeValuePrimitive;
|
9720
9837
|
getCacheVersion(): undefined | string;
|