webpack 5.94.0 → 5.96.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.
- package/README.md +1 -1
- package/lib/AsyncDependenciesBlock.js +1 -1
- package/lib/BannerPlugin.js +2 -1
- package/lib/Chunk.js +30 -0
- package/lib/ChunkGraph.js +11 -6
- package/lib/ChunkGroup.js +2 -2
- package/lib/CleanPlugin.js +4 -5
- package/lib/CodeGenerationResults.js +6 -5
- package/lib/Compilation.js +71 -48
- package/lib/Compiler.js +7 -5
- package/lib/ConcatenationScope.js +7 -20
- package/lib/ContextModule.js +7 -8
- package/lib/CssModule.js +25 -21
- package/lib/DefinePlugin.js +14 -8
- package/lib/DelegatedModule.js +3 -3
- package/lib/DllModule.js +4 -4
- package/lib/DynamicEntryPlugin.js +29 -22
- package/lib/EnvironmentPlugin.js +3 -2
- package/lib/EvalDevToolModulePlugin.js +5 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -2
- package/lib/ExternalModule.js +118 -99
- package/lib/ExternalModuleFactoryPlugin.js +33 -9
- package/lib/FileSystemInfo.js +12 -8
- package/lib/Generator.js +5 -4
- package/lib/HotModuleReplacementPlugin.js +8 -6
- package/lib/IgnorePlugin.js +19 -1
- package/lib/LoaderOptionsPlugin.js +3 -1
- package/lib/Module.js +9 -8
- package/lib/ModuleSourceTypesConstants.js +100 -0
- package/lib/NormalModule.js +27 -13
- package/lib/NormalModuleFactory.js +38 -22
- package/lib/OptionsApply.js +12 -1
- package/lib/ProgressPlugin.js +50 -10
- package/lib/RawModule.js +3 -4
- package/lib/RuntimeModule.js +3 -4
- package/lib/RuntimePlugin.js +11 -4
- package/lib/RuntimeTemplate.js +13 -42
- package/lib/SourceMapDevToolPlugin.js +10 -7
- package/lib/TemplatedPathPlugin.js +9 -3
- package/lib/Watching.js +2 -2
- package/lib/WebpackOptionsApply.js +42 -21
- package/lib/asset/AssetGenerator.js +347 -194
- package/lib/asset/AssetModulesPlugin.js +2 -1
- package/lib/asset/AssetSourceGenerator.js +82 -27
- package/lib/asset/RawDataUrlModule.js +5 -4
- package/lib/buildChunkGraph.js +79 -62
- package/lib/cache/PackFileCacheStrategy.js +69 -31
- package/lib/cache/ResolverCachePlugin.js +248 -173
- package/lib/config/defaults.js +135 -126
- package/lib/container/ContainerEntryModule.js +3 -4
- package/lib/container/ContainerPlugin.js +8 -0
- package/lib/container/FallbackModule.js +2 -2
- package/lib/container/HoistContainerReferencesPlugin.js +250 -0
- package/lib/container/ModuleFederationPlugin.js +38 -1
- package/lib/container/RemoteModule.js +4 -2
- package/lib/container/RemoteRuntimeModule.js +4 -2
- package/lib/css/CssExportsGenerator.js +16 -12
- package/lib/css/CssGenerator.js +22 -16
- package/lib/css/CssLoadingRuntimeModule.js +7 -6
- package/lib/css/CssModulesPlugin.js +122 -77
- package/lib/css/CssParser.js +655 -526
- package/lib/css/walkCssTokens.js +1168 -338
- package/lib/debug/ProfilingPlugin.js +5 -0
- package/lib/dependencies/CommonJsExportsParserPlugin.js +5 -2
- package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -6
- package/lib/dependencies/ContextDependency.js +6 -1
- package/lib/dependencies/ContextElementDependency.js +33 -6
- package/lib/dependencies/CssExportDependency.js +3 -3
- package/lib/dependencies/CssLocalIdentifierDependency.js +26 -17
- package/lib/dependencies/CssUrlDependency.js +33 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +39 -14
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +15 -82
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +5 -2
- package/lib/dependencies/ImportParserPlugin.js +9 -7
- package/lib/dependencies/LoaderPlugin.js +19 -0
- package/lib/dependencies/SystemPlugin.js +2 -1
- package/lib/dependencies/URLPlugin.js +7 -1
- package/lib/dependencies/WorkerPlugin.js +1 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +4 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/LazyCompilationPlugin.js +16 -4
- package/lib/hmr/lazyCompilationBackend.js +1 -7
- package/lib/index.js +35 -6
- package/lib/javascript/EnableChunkLoadingPlugin.js +2 -2
- package/lib/javascript/JavascriptGenerator.js +8 -8
- package/lib/javascript/JavascriptModulesPlugin.js +166 -88
- package/lib/javascript/JavascriptParser.js +338 -117
- package/lib/json/JsonGenerator.js +5 -5
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ExportPropertyLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +16 -8
- package/lib/logging/Logger.js +11 -11
- package/lib/logging/createConsoleLogger.js +14 -14
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/NodeWatchFileSystem.js +3 -1
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +20 -18
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -2
- package/lib/node/nodeConsole.js +11 -8
- package/lib/optimize/AggressiveSplittingPlugin.js +21 -7
- package/lib/optimize/ConcatenatedModule.js +44 -148
- package/lib/optimize/FlagIncludedChunksPlugin.js +6 -0
- package/lib/optimize/InnerGraphPlugin.js +57 -16
- package/lib/optimize/LimitChunkCountPlugin.js +2 -4
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +4 -2
- package/lib/optimize/RealContentHashPlugin.js +1 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +6 -3
- package/lib/rules/RuleSetCompiler.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +2 -2
- package/lib/schemes/DataUriPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +32 -19
- package/lib/serialization/ObjectMiddleware.js +23 -9
- package/lib/serialization/SerializerMiddleware.js +3 -2
- package/lib/serialization/types.js +2 -2
- package/lib/sharing/ConsumeSharedModule.js +2 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +3 -1
- package/lib/sharing/ProvideSharedModule.js +2 -3
- package/lib/stats/DefaultStatsFactoryPlugin.js +22 -20
- package/lib/stats/StatsFactory.js +12 -12
- package/lib/stats/StatsPrinter.js +7 -7
- package/lib/util/AsyncQueue.js +17 -1
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazySet.js +12 -0
- package/lib/util/SetHelpers.js +1 -1
- package/lib/util/cleverMerge.js +48 -24
- package/lib/util/concatenate.js +227 -0
- package/lib/util/create-schema-validation.js +22 -9
- package/lib/util/deprecation.js +86 -28
- package/lib/util/fs.js +10 -10
- package/lib/util/hash/wasm-hash.js +12 -1
- package/lib/util/magicComment.js +21 -0
- package/lib/util/makeSerializable.js +24 -1
- package/lib/util/memoize.js +2 -1
- package/lib/util/runtime.js +10 -1
- package/lib/util/semver.js +130 -23
- package/lib/wasm/EnableWasmLoadingPlugin.js +2 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +5 -5
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -5
- package/lib/wasm-sync/WebAssemblyGenerator.js +8 -9
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -5
- package/lib/web/FetchCompileAsyncWasmPlugin.js +1 -2
- package/lib/web/FetchCompileWasmPlugin.js +1 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +6 -6
- package/package.json +19 -20
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +12 -2
- package/types.d.ts +817 -269
- package/lib/util/mergeScope.js +0 -76
package/README.md
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
<a href="https://twitter.com/Webpack">
|
40
40
|
<img src="https://img.shields.io/twitter/follow/Webpack?style=social">
|
41
41
|
</a>
|
42
|
-
<a href="https://discord.gg/
|
42
|
+
<a href="https://discord.gg/5sxFZPdx2k">
|
43
43
|
<img src="https://img.shields.io/discord/1180618526436888586?label=discord&logo=discord&logoColor=white&style=flat">
|
44
44
|
</a>
|
45
45
|
<h1>webpack</h1>
|
package/lib/BannerPlugin.js
CHANGED
@@ -19,7 +19,8 @@ const createSchemaValidation = require("./util/create-schema-validation");
|
|
19
19
|
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
|
20
20
|
|
21
21
|
const validate = createSchemaValidation(
|
22
|
-
|
22
|
+
/** @type {(function(typeof import("../schemas/plugins/BannerPlugin.json")): boolean)} */
|
23
|
+
(require("../schemas/plugins/BannerPlugin.check.js")),
|
23
24
|
() => require("../schemas/plugins/BannerPlugin.json"),
|
24
25
|
{
|
25
26
|
name: "Banner Plugin",
|
package/lib/Chunk.js
CHANGED
@@ -839,6 +839,36 @@ class Chunk {
|
|
839
839
|
|
840
840
|
return chunkMaps;
|
841
841
|
}
|
842
|
+
|
843
|
+
/**
|
844
|
+
* @param {ChunkGraph} chunkGraph the chunk graph
|
845
|
+
* @param {string} type option name
|
846
|
+
* @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included)
|
847
|
+
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
|
848
|
+
* @returns {boolean} true when the child is of type order, otherwise false
|
849
|
+
*/
|
850
|
+
hasChildByOrder(chunkGraph, type, includeDirectChildren, filterFn) {
|
851
|
+
if (includeDirectChildren) {
|
852
|
+
/** @type {Set<Chunk>} */
|
853
|
+
const chunks = new Set();
|
854
|
+
for (const chunkGroup of this.groupsIterable) {
|
855
|
+
for (const chunk of chunkGroup.chunks) {
|
856
|
+
chunks.add(chunk);
|
857
|
+
}
|
858
|
+
}
|
859
|
+
for (const chunk of chunks) {
|
860
|
+
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
|
861
|
+
if (data[type] !== undefined) return true;
|
862
|
+
}
|
863
|
+
}
|
864
|
+
|
865
|
+
for (const chunk of this.getAllAsyncChunks()) {
|
866
|
+
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
|
867
|
+
if (data[type] !== undefined) return true;
|
868
|
+
}
|
869
|
+
|
870
|
+
return false;
|
871
|
+
}
|
842
872
|
}
|
843
873
|
|
844
874
|
module.exports = Chunk;
|
package/lib/ChunkGraph.js
CHANGED
@@ -32,7 +32,9 @@ const {
|
|
32
32
|
/** @typedef {import("./Chunk")} Chunk */
|
33
33
|
/** @typedef {import("./Chunk").ChunkId} ChunkId */
|
34
34
|
/** @typedef {import("./ChunkGroup")} ChunkGroup */
|
35
|
+
/** @typedef {import("./Generator").SourceTypes} SourceTypes */
|
35
36
|
/** @typedef {import("./Module")} Module */
|
37
|
+
/** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
36
38
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
37
39
|
/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
|
38
40
|
/** @typedef {import("./RuntimeModule")} RuntimeModule */
|
@@ -119,7 +121,10 @@ const modulesBySourceType = sourceTypesByModule => set => {
|
|
119
121
|
};
|
120
122
|
const defaultModulesBySourceType = modulesBySourceType(undefined);
|
121
123
|
|
122
|
-
/**
|
124
|
+
/**
|
125
|
+
* @template T
|
126
|
+
* @type {WeakMap<Function, any>}
|
127
|
+
*/
|
123
128
|
const createOrderedArrayFunctionMap = new WeakMap();
|
124
129
|
|
125
130
|
/**
|
@@ -624,7 +629,7 @@ class ChunkGraph {
|
|
624
629
|
/**
|
625
630
|
* @param {Chunk} chunk chunk
|
626
631
|
* @param {Module} module chunk module
|
627
|
-
* @returns {
|
632
|
+
* @returns {SourceTypes} source types
|
628
633
|
*/
|
629
634
|
getChunkModuleSourceTypes(chunk, module) {
|
630
635
|
const cgc = this._getChunkGraphChunk(chunk);
|
@@ -636,7 +641,7 @@ class ChunkGraph {
|
|
636
641
|
|
637
642
|
/**
|
638
643
|
* @param {Module} module module
|
639
|
-
* @returns {
|
644
|
+
* @returns {SourceTypes} source types
|
640
645
|
*/
|
641
646
|
getModuleSourceTypes(module) {
|
642
647
|
return (
|
@@ -1526,7 +1531,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
|
1526
1531
|
/**
|
1527
1532
|
* @param {Module} module the module
|
1528
1533
|
* @param {RuntimeSpec} runtime the runtime
|
1529
|
-
* @returns {
|
1534
|
+
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
|
1530
1535
|
*/
|
1531
1536
|
getModuleRuntimeRequirements(module, runtime) {
|
1532
1537
|
const cgm = this._getChunkGraphModule(module);
|
@@ -1537,7 +1542,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
|
1537
1542
|
|
1538
1543
|
/**
|
1539
1544
|
* @param {Chunk} chunk the chunk
|
1540
|
-
* @returns {
|
1545
|
+
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
|
1541
1546
|
*/
|
1542
1547
|
getChunkRuntimeRequirements(chunk) {
|
1543
1548
|
const cgc = this._getChunkGraphChunk(chunk);
|
@@ -1734,7 +1739,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
|
1734
1739
|
|
1735
1740
|
/**
|
1736
1741
|
* @param {Chunk} chunk the chunk
|
1737
|
-
* @returns {
|
1742
|
+
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
|
1738
1743
|
*/
|
1739
1744
|
getTreeRuntimeRequirements(chunk) {
|
1740
1745
|
const cgc = this._getChunkGraphChunk(chunk);
|
package/lib/ChunkGroup.js
CHANGED
@@ -31,7 +31,7 @@ const {
|
|
31
31
|
* @property {("low" | "high" | "auto")=} fetchPriority
|
32
32
|
*/
|
33
33
|
|
34
|
-
/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */
|
34
|
+
/** @typedef {RawChunkGroupOptions & { name?: string | null }} ChunkGroupOptions */
|
35
35
|
|
36
36
|
let debugId = 5000;
|
37
37
|
|
@@ -137,7 +137,7 @@ class ChunkGroup {
|
|
137
137
|
|
138
138
|
/**
|
139
139
|
* returns the name of current ChunkGroup
|
140
|
-
* @returns {string | undefined} returns the ChunkGroup name
|
140
|
+
* @returns {string | null | undefined} returns the ChunkGroup name
|
141
141
|
*/
|
142
142
|
get name() {
|
143
143
|
return this.options.name;
|
package/lib/CleanPlugin.js
CHANGED
@@ -25,13 +25,13 @@ const processAsyncTree = require("./util/processAsyncTree");
|
|
25
25
|
|
26
26
|
/**
|
27
27
|
* @typedef {object} CleanPluginCompilationHooks
|
28
|
-
* @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config
|
28
|
+
* @property {SyncBailHook<[string], boolean | void>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config
|
29
29
|
*/
|
30
30
|
|
31
31
|
/**
|
32
32
|
* @callback KeepFn
|
33
33
|
* @param {string} path path
|
34
|
-
* @returns {boolean} true, if the path should be kept
|
34
|
+
* @returns {boolean | void} true, if the path should be kept
|
35
35
|
*/
|
36
36
|
|
37
37
|
const validate = createSchemaValidation(
|
@@ -149,7 +149,7 @@ const doStat = (fs, filename, callback) => {
|
|
149
149
|
* @param {boolean} dry only log instead of fs modification
|
150
150
|
* @param {Logger} logger logger
|
151
151
|
* @param {Set<string>} diff filenames of the assets that shouldn't be there
|
152
|
-
* @param {function(string): boolean} isKept check if the entry is ignored
|
152
|
+
* @param {function(string): boolean | void} isKept check if the entry is ignored
|
153
153
|
* @param {function(Error=, Assets=): void} callback callback
|
154
154
|
* @returns {void}
|
155
155
|
*/
|
@@ -310,7 +310,6 @@ class CleanPlugin {
|
|
310
310
|
let hooks = compilationHooksMap.get(compilation);
|
311
311
|
if (hooks === undefined) {
|
312
312
|
hooks = {
|
313
|
-
/** @type {SyncBailHook<[string], boolean>} */
|
314
313
|
keep: new SyncBailHook(["ignore"])
|
315
314
|
};
|
316
315
|
compilationHooksMap.set(compilation, hooks);
|
@@ -393,7 +392,7 @@ class CleanPlugin {
|
|
393
392
|
|
394
393
|
/**
|
395
394
|
* @param {string} path path
|
396
|
-
* @returns {boolean} true, if needs to be kept
|
395
|
+
* @returns {boolean | void} true, if needs to be kept
|
397
396
|
*/
|
398
397
|
const isKept = path => {
|
399
398
|
const result = hooks.keep.call(path);
|
@@ -13,6 +13,7 @@ const { runtimeToString, RuntimeSpecMap } = require("./util/runtime");
|
|
13
13
|
/** @typedef {import("webpack-sources").Source} Source */
|
14
14
|
/** @typedef {import("./Module")} Module */
|
15
15
|
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
16
|
+
/** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
16
17
|
/** @typedef {typeof import("./util/Hash")} Hash */
|
17
18
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
18
19
|
|
@@ -42,9 +43,7 @@ class CodeGenerationResults {
|
|
42
43
|
);
|
43
44
|
}
|
44
45
|
if (runtime === undefined) {
|
45
|
-
if (
|
46
|
-
/** @type {RuntimeSpecMap<CodeGenerationResult>} */ (entry).size > 1
|
47
|
-
) {
|
46
|
+
if (entry.size > 1) {
|
48
47
|
const results = new Set(entry.values());
|
49
48
|
if (results.size !== 1) {
|
50
49
|
throw new Error(
|
@@ -99,13 +98,15 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
|
99
98
|
* @returns {Source} a source
|
100
99
|
*/
|
101
100
|
getSource(module, runtime, sourceType) {
|
102
|
-
return
|
101
|
+
return /** @type {Source} */ (
|
102
|
+
this.get(module, runtime).sources.get(sourceType)
|
103
|
+
);
|
103
104
|
}
|
104
105
|
|
105
106
|
/**
|
106
107
|
* @param {Module} module the module
|
107
108
|
* @param {RuntimeSpec} runtime runtime(s)
|
108
|
-
* @returns {
|
109
|
+
* @returns {ReadOnlyRuntimeRequirements | null} runtime requirements
|
109
110
|
*/
|
110
111
|
getRuntimeRequirements(module, runtime) {
|
111
112
|
return this.get(module, runtime).runtimeRequirements;
|
package/lib/Compilation.js
CHANGED
@@ -98,15 +98,18 @@ const { isSourceEqual } = require("./util/source");
|
|
98
98
|
/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
|
99
99
|
/** @typedef {import("./Compiler")} Compiler */
|
100
100
|
/** @typedef {import("./Compiler").CompilationParams} CompilationParams */
|
101
|
+
/** @typedef {import("./Compiler").ModuleMemCachesItem} ModuleMemCachesItem */
|
101
102
|
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
|
102
103
|
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
103
104
|
/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */
|
104
105
|
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
|
105
106
|
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
|
106
107
|
/** @typedef {import("./Module").BuildInfo} BuildInfo */
|
108
|
+
/** @typedef {import("./Module").ValueCacheVersions} ValueCacheVersions */
|
107
109
|
/** @typedef {import("./NormalModule").NormalModuleCompilationHooks} NormalModuleCompilationHooks */
|
108
110
|
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
109
111
|
/** @typedef {import("./ModuleFactory")} ModuleFactory */
|
112
|
+
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
|
110
113
|
/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */
|
111
114
|
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */
|
112
115
|
/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
|
@@ -119,6 +122,7 @@ const { isSourceEqual } = require("./util/source");
|
|
119
122
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
|
120
123
|
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
|
121
124
|
/** @typedef {import("./util/Hash")} Hash */
|
125
|
+
/** @typedef {import("./util/createHash").Algorithm} Algorithm */
|
122
126
|
/**
|
123
127
|
* @template T
|
124
128
|
* @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
|
@@ -167,6 +171,7 @@ const { isSourceEqual } = require("./util/source");
|
|
167
171
|
*/
|
168
172
|
|
169
173
|
/** @typedef {new (...args: any[]) => Dependency} DepConstructor */
|
174
|
+
|
170
175
|
/** @typedef {Record<string, Source>} CompilationAssets */
|
171
176
|
|
172
177
|
/**
|
@@ -223,9 +228,12 @@ const { isSourceEqual } = require("./util/source");
|
|
223
228
|
*/
|
224
229
|
|
225
230
|
/**
|
231
|
+
* @typedef {{ id: string, exports: any, loaded: boolean }} ModuleObject
|
232
|
+
*
|
233
|
+
* /**
|
226
234
|
* @typedef {object} ExecuteModuleArgument
|
227
235
|
* @property {Module} module
|
228
|
-
* @property {
|
236
|
+
* @property {ModuleObject=} moduleObject
|
229
237
|
* @property {any} preparedInfo
|
230
238
|
* @property {CodeGenerationResult} codeGenerationResult
|
231
239
|
*/
|
@@ -362,8 +370,6 @@ const { isSourceEqual } = require("./util/source");
|
|
362
370
|
|
363
371
|
/** @typedef {Set<Module>} NotCodeGeneratedModules */
|
364
372
|
|
365
|
-
/** @typedef {string | Set<string> | undefined} ValueCacheVersion */
|
366
|
-
|
367
373
|
/** @type {AssetInfo} */
|
368
374
|
const EMPTY_ASSET_INFO = Object.freeze({});
|
369
375
|
|
@@ -697,7 +703,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
697
703
|
optimizeChunkModules: new AsyncSeriesBailHook(["chunks", "modules"]),
|
698
704
|
/** @type {SyncHook<[Iterable<Chunk>, Iterable<Module>]>} */
|
699
705
|
afterOptimizeChunkModules: new SyncHook(["chunks", "modules"]),
|
700
|
-
/** @type {SyncBailHook<[], boolean |
|
706
|
+
/** @type {SyncBailHook<[], boolean | void>} */
|
701
707
|
shouldRecord: new SyncBailHook([]),
|
702
708
|
|
703
709
|
/** @type {SyncHook<[Chunk, Set<string>, RuntimeRequirementsContext]>} */
|
@@ -792,7 +798,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
792
798
|
|
793
799
|
/** @type {SyncHook<[]>} */
|
794
800
|
beforeModuleAssets: new SyncHook([]),
|
795
|
-
/** @type {SyncBailHook<[], boolean>} */
|
801
|
+
/** @type {SyncBailHook<[], boolean | void>} */
|
796
802
|
shouldGenerateChunkAssets: new SyncBailHook([]),
|
797
803
|
/** @type {SyncHook<[]>} */
|
798
804
|
beforeChunkAssets: new SyncHook([]),
|
@@ -840,7 +846,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
840
846
|
/** @type {AsyncSeriesHook<[CompilationAssets]>} */
|
841
847
|
processAdditionalAssets: new AsyncSeriesHook(["assets"]),
|
842
848
|
|
843
|
-
/** @type {SyncBailHook<[], boolean |
|
849
|
+
/** @type {SyncBailHook<[], boolean | void>} */
|
844
850
|
needAdditionalSeal: new SyncBailHook([]),
|
845
851
|
/** @type {AsyncSeriesHook<[]>} */
|
846
852
|
afterSeal: new AsyncSeriesHook([]),
|
@@ -861,7 +867,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
861
867
|
/** @type {SyncWaterfallHook<[string, object, AssetInfo | undefined]>} */
|
862
868
|
assetPath: new SyncWaterfallHook(["path", "options", "assetInfo"]),
|
863
869
|
|
864
|
-
/** @type {SyncBailHook<[], boolean>} */
|
870
|
+
/** @type {SyncBailHook<[], boolean | void>} */
|
865
871
|
needAdditionalPass: new SyncBailHook([]),
|
866
872
|
|
867
873
|
/** @type {SyncHook<[Compiler, string, number]>} */
|
@@ -871,7 +877,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
871
877
|
"compilerIndex"
|
872
878
|
]),
|
873
879
|
|
874
|
-
/** @type {SyncBailHook<[string, LogEntry],
|
880
|
+
/** @type {SyncBailHook<[string, LogEntry], boolean | void>} */
|
875
881
|
log: new SyncBailHook(["origin", "logEntry"]),
|
876
882
|
|
877
883
|
/** @type {SyncWaterfallHook<[WebpackError[]]>} */
|
@@ -921,7 +927,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
921
927
|
true
|
922
928
|
);
|
923
929
|
}
|
924
|
-
/** @type {
|
930
|
+
/** @type {ValueCacheVersions} */
|
925
931
|
this.valueCacheVersions = new Map();
|
926
932
|
this.requestShortener = compiler.requestShortener;
|
927
933
|
this.compilerPath = compiler.compilerPath;
|
@@ -1074,11 +1080,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1074
1080
|
this.codeGeneratedModules = new WeakSet();
|
1075
1081
|
/** @type {WeakSet<Module>} */
|
1076
1082
|
this.buildTimeExecutedModules = new WeakSet();
|
1077
|
-
/**
|
1078
|
-
* @private
|
1079
|
-
* @type {Map<Module, Callback[]>}
|
1080
|
-
*/
|
1081
|
-
this._rebuildingModules = new Map();
|
1082
1083
|
/** @type {Set<string>} */
|
1083
1084
|
this.emittedAssets = new Set();
|
1084
1085
|
/** @type {Set<string>} */
|
@@ -1241,7 +1242,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1241
1242
|
typeof console.profile === "function"
|
1242
1243
|
) {
|
1243
1244
|
console.profile(
|
1244
|
-
`[${name}] ${
|
1245
|
+
`[${name}] ${
|
1246
|
+
/** @type {NonNullable<LogEntry["args"]>} */
|
1247
|
+
(logEntry.args)[0]
|
1248
|
+
}`
|
1245
1249
|
);
|
1246
1250
|
}
|
1247
1251
|
}
|
@@ -1501,7 +1505,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1501
1505
|
let factoryCacheKey;
|
1502
1506
|
/** @type {ModuleFactory} */
|
1503
1507
|
let factoryCacheKey2;
|
1504
|
-
/** @
|
1508
|
+
/** @typedef {Map<string, Dependency[]>} FactoryCacheValue */
|
1509
|
+
/** @type {FactoryCacheValue | undefined} */
|
1505
1510
|
let factoryCacheValue;
|
1506
1511
|
/** @type {string} */
|
1507
1512
|
let listCacheKey1;
|
@@ -1705,7 +1710,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1705
1710
|
if (factoryCacheKey2 !== undefined) {
|
1706
1711
|
// Archive last cache entry
|
1707
1712
|
if (dependencies === undefined) dependencies = new Map();
|
1708
|
-
dependencies.set(
|
1713
|
+
dependencies.set(
|
1714
|
+
factoryCacheKey2,
|
1715
|
+
/** @type {FactoryCacheValue} */ (factoryCacheValue)
|
1716
|
+
);
|
1709
1717
|
factoryCacheValue = dependencies.get(factory);
|
1710
1718
|
if (factoryCacheValue === undefined) {
|
1711
1719
|
factoryCacheValue = new Map();
|
@@ -1724,9 +1732,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1724
1732
|
category === esmDependencyCategory
|
1725
1733
|
? resourceIdent
|
1726
1734
|
: `${category}${resourceIdent}`;
|
1727
|
-
let list = factoryCacheValue.get(
|
1735
|
+
let list = /** @type {FactoryCacheValue} */ (factoryCacheValue).get(
|
1736
|
+
cacheKey
|
1737
|
+
);
|
1728
1738
|
if (list === undefined) {
|
1729
|
-
|
1739
|
+
/** @type {FactoryCacheValue} */
|
1740
|
+
(factoryCacheValue).set(cacheKey, (list = []));
|
1730
1741
|
sortedDependencies.push({
|
1731
1742
|
factory: factoryCacheKey2,
|
1732
1743
|
dependencies: list,
|
@@ -1756,7 +1767,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1756
1767
|
}
|
1757
1768
|
} while (queue.length !== 0);
|
1758
1769
|
} catch (err) {
|
1759
|
-
return callback(err);
|
1770
|
+
return callback(/** @type {WebpackError} */ (err));
|
1760
1771
|
}
|
1761
1772
|
|
1762
1773
|
if (--inProgressSorting === 0) onDependenciesSorted();
|
@@ -1852,7 +1863,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1852
1863
|
(err, factoryResult) => {
|
1853
1864
|
const applyFactoryResultDependencies = () => {
|
1854
1865
|
const { fileDependencies, contextDependencies, missingDependencies } =
|
1855
|
-
factoryResult;
|
1866
|
+
/** @type {ModuleFactoryResult} */ (factoryResult);
|
1856
1867
|
if (fileDependencies) {
|
1857
1868
|
this.fileDependencies.addAll(fileDependencies);
|
1858
1869
|
}
|
@@ -1873,7 +1884,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1873
1884
|
return callback(err);
|
1874
1885
|
}
|
1875
1886
|
|
1876
|
-
const newModule =
|
1887
|
+
const newModule =
|
1888
|
+
/** @type {ModuleFactoryResult} */
|
1889
|
+
(factoryResult).module;
|
1877
1890
|
|
1878
1891
|
if (!newModule) {
|
1879
1892
|
applyFactoryResultDependencies();
|
@@ -1901,7 +1914,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1901
1914
|
|
1902
1915
|
if (
|
1903
1916
|
this._unsafeCache &&
|
1904
|
-
|
1917
|
+
/** @type {ModuleFactoryResult} */
|
1918
|
+
(factoryResult).cacheable !== false &&
|
1905
1919
|
module.restoreFromUnsafeCache &&
|
1906
1920
|
this._unsafeCachePredicate(module)
|
1907
1921
|
) {
|
@@ -2109,7 +2123,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2109
2123
|
const notFoundError = new ModuleNotFoundError(
|
2110
2124
|
originModule,
|
2111
2125
|
err,
|
2112
|
-
|
2126
|
+
/** @type {DependencyLocation} */
|
2127
|
+
(dependencies.map(d => d.loc).find(Boolean))
|
2113
2128
|
);
|
2114
2129
|
return callback(notFoundError, factoryResult ? result : undefined);
|
2115
2130
|
}
|
@@ -2287,11 +2302,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2287
2302
|
this.hooks.failedEntry.call(entry, options, err);
|
2288
2303
|
return callback(err);
|
2289
2304
|
}
|
2290
|
-
this.hooks.succeedEntry.call(
|
2291
|
-
entry,
|
2292
|
-
options,
|
2293
|
-
/** @type {Module} */ (module)
|
2294
|
-
);
|
2305
|
+
this.hooks.succeedEntry.call(entry, options, module);
|
2295
2306
|
return callback(null, module);
|
2296
2307
|
}
|
2297
2308
|
);
|
@@ -2512,7 +2523,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2512
2523
|
affectedModules.add(referencingModule);
|
2513
2524
|
}
|
2514
2525
|
const memCache = new WeakTupleMap();
|
2515
|
-
const cache =
|
2526
|
+
const cache =
|
2527
|
+
/** @type {ModuleMemCachesItem} */
|
2528
|
+
(moduleMemCacheCache.get(referencingModule));
|
2516
2529
|
cache.memCache = memCache;
|
2517
2530
|
moduleMemCaches.set(referencingModule, memCache);
|
2518
2531
|
}
|
@@ -2541,10 +2554,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2541
2554
|
let statNew = 0;
|
2542
2555
|
/**
|
2543
2556
|
* @param {Module} module module
|
2544
|
-
* @returns {{ id:
|
2557
|
+
* @returns {{ id: ModuleId, modules?: Map<Module, string | number | undefined>, blocks?: (string | number | null)[] }} references
|
2545
2558
|
*/
|
2546
2559
|
const computeReferences = module => {
|
2547
|
-
const id = chunkGraph.getModuleId(module);
|
2560
|
+
const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
|
2548
2561
|
/** @type {Map<Module, string | number | undefined> | undefined} */
|
2549
2562
|
let modules;
|
2550
2563
|
/** @type {(string | number | null)[] | undefined} */
|
@@ -2554,7 +2567,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
2554
2567
|
for (const m of outgoing.keys()) {
|
2555
2568
|
if (!m) continue;
|
2556
2569
|
if (modules === undefined) modules = new Map();
|
2557
|
-
modules.set(m, chunkGraph.getModuleId(m));
|
2570
|
+
modules.set(m, /** @type {ModuleId} */ (chunkGraph.getModuleId(m)));
|
2558
2571
|
}
|
2559
2572
|
}
|
2560
2573
|
if (module.blocks.length > 0) {
|
@@ -3743,7 +3756,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
3743
3756
|
if (name) {
|
3744
3757
|
const chunkGroup = this.namedChunkGroups.get(name);
|
3745
3758
|
if (chunkGroup !== undefined) {
|
3746
|
-
chunkGroup.addOptions(groupOptions);
|
3747
3759
|
if (module) {
|
3748
3760
|
chunkGroup.addOrigin(
|
3749
3761
|
module,
|
@@ -4014,10 +4026,13 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4014
4026
|
|
4015
4027
|
assignRuntimeIds() {
|
4016
4028
|
const { chunkGraph } = this;
|
4029
|
+
/**
|
4030
|
+
* @param {Entrypoint} ep an entrypoint
|
4031
|
+
*/
|
4017
4032
|
const processEntrypoint = ep => {
|
4018
|
-
const runtime = ep.options.runtime || ep.name;
|
4019
|
-
const chunk = ep.getRuntimeChunk();
|
4020
|
-
chunkGraph.setRuntimeId(runtime, chunk.id);
|
4033
|
+
const runtime = /** @type {string} */ (ep.options.runtime || ep.name);
|
4034
|
+
const chunk = /** @type {Chunk} */ (ep.getRuntimeChunk());
|
4035
|
+
chunkGraph.setRuntimeId(runtime, /** @type {ChunkId} */ (chunk.id));
|
4021
4036
|
};
|
4022
4037
|
for (const ep of this.entrypoints.values()) {
|
4023
4038
|
processEntrypoint(ep);
|
@@ -4139,7 +4154,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4139
4154
|
) {
|
4140
4155
|
let moduleHashDigest;
|
4141
4156
|
try {
|
4142
|
-
const moduleHash = createHash(hashFunction);
|
4157
|
+
const moduleHash = createHash(/** @type {Algorithm} */ (hashFunction));
|
4143
4158
|
module.updateHash(moduleHash, {
|
4144
4159
|
chunkGraph,
|
4145
4160
|
runtime,
|
@@ -4167,7 +4182,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4167
4182
|
const hashFunction = outputOptions.hashFunction;
|
4168
4183
|
const hashDigest = outputOptions.hashDigest;
|
4169
4184
|
const hashDigestLength = outputOptions.hashDigestLength;
|
4170
|
-
const hash = createHash(hashFunction);
|
4185
|
+
const hash = createHash(/** @type {Algorithm} */ (hashFunction));
|
4171
4186
|
if (outputOptions.hashSalt) {
|
4172
4187
|
hash.update(outputOptions.hashSalt);
|
4173
4188
|
}
|
@@ -4175,7 +4190,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4175
4190
|
if (this.children.length > 0) {
|
4176
4191
|
this.logger.time("hashing: hash child compilations");
|
4177
4192
|
for (const child of this.children) {
|
4178
|
-
hash.update(child.hash);
|
4193
|
+
hash.update(/** @type {string} */ (child.hash));
|
4179
4194
|
}
|
4180
4195
|
this.logger.timeEnd("hashing: hash child compilations");
|
4181
4196
|
}
|
@@ -4236,7 +4251,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|
4236
4251
|
e => e.chunks[e.chunks.length - 1]
|
4237
4252
|
)
|
4238
4253
|
)) {
|
4239
|
-
const otherInfo =
|
4254
|
+
const otherInfo =
|
4255
|
+
/** @type {RuntimeChunkInfo} */
|
4256
|
+
(runtimeChunksMap.get(other));
|
4240
4257
|
otherInfo.referencedBy.push(info);
|
4241
4258
|
info.remaining++;
|
4242
4259
|
remaining++;
|
@@ -4348,7 +4365,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4348
4365
|
this.logger.timeAggregate("hashing: hash runtime modules");
|
4349
4366
|
try {
|
4350
4367
|
this.logger.time("hashing: hash chunks");
|
4351
|
-
const chunkHash = createHash(hashFunction);
|
4368
|
+
const chunkHash = createHash(/** @type {Algorithm} */ (hashFunction));
|
4352
4369
|
if (outputOptions.hashSalt) {
|
4353
4370
|
chunkHash.update(outputOptions.hashSalt);
|
4354
4371
|
}
|
@@ -4401,7 +4418,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4401
4418
|
for (const module of /** @type {Iterable<RuntimeModule>} */ (
|
4402
4419
|
chunkGraph.getChunkFullHashModulesIterable(chunk)
|
4403
4420
|
)) {
|
4404
|
-
const moduleHash = createHash(hashFunction);
|
4421
|
+
const moduleHash = createHash(/** @type {Algorithm} */ (hashFunction));
|
4405
4422
|
module.updateHash(moduleHash, {
|
4406
4423
|
chunkGraph,
|
4407
4424
|
runtime: chunk.runtime,
|
@@ -4419,7 +4436,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4419
4436
|
);
|
4420
4437
|
codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest;
|
4421
4438
|
}
|
4422
|
-
const chunkHash = createHash(hashFunction);
|
4439
|
+
const chunkHash = createHash(/** @type {Algorithm} */ (hashFunction));
|
4423
4440
|
chunkHash.update(chunk.hash);
|
4424
4441
|
chunkHash.update(this.hash);
|
4425
4442
|
const chunkHashDigest =
|
@@ -4464,6 +4481,12 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4464
4481
|
this._setAssetInfo(file, assetInfo, undefined);
|
4465
4482
|
}
|
4466
4483
|
|
4484
|
+
/**
|
4485
|
+
* @private
|
4486
|
+
* @param {string} file file name
|
4487
|
+
* @param {AssetInfo} newInfo new asset information
|
4488
|
+
* @param {AssetInfo=} oldInfo old asset information
|
4489
|
+
*/
|
4467
4490
|
_setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) {
|
4468
4491
|
if (newInfo === undefined) {
|
4469
4492
|
this.assetsInfo.delete(file);
|
@@ -4751,8 +4774,8 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4751
4774
|
try {
|
4752
4775
|
manifest = this.getRenderManifest({
|
4753
4776
|
chunk,
|
4754
|
-
hash: this.hash,
|
4755
|
-
fullHash: this.fullHash,
|
4777
|
+
hash: /** @type {string} */ (this.hash),
|
4778
|
+
fullHash: /** @type {string} */ (this.fullHash),
|
4756
4779
|
outputOptions,
|
4757
4780
|
codeGenerationResults: this.codeGenerationResults,
|
4758
4781
|
moduleTemplates: this.moduleTemplates,
|
@@ -4966,7 +4989,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
4966
4989
|
* a child with different settings and configurations (if desired) applied. It copies all hooks, plugins
|
4967
4990
|
* from parent (or top level compiler) and creates a child Compilation
|
4968
4991
|
* @param {string} name name of the child compiler
|
4969
|
-
* @param {OutputOptions
|
4992
|
+
* @param {Partial<OutputOptions>=} outputOptions // Need to convert config schema to types for this
|
4970
4993
|
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>=} plugins webpack plugins that will be applied
|
4971
4994
|
* @returns {Compiler} creates a child Compiler instance
|
4972
4995
|
*/
|
@@ -5374,7 +5397,7 @@ This prevents using hashes of each other and should be avoided.`);
|
|
5374
5397
|
|
5375
5398
|
/**
|
5376
5399
|
* @typedef {object} FactorizeModuleOptions
|
5377
|
-
* @property {ModuleProfile} currentProfile
|
5400
|
+
* @property {ModuleProfile=} currentProfile
|
5378
5401
|
* @property {ModuleFactory} factory
|
5379
5402
|
* @property {Dependency[]} dependencies
|
5380
5403
|
* @property {boolean=} factoryResult return full ModuleFactoryResult instead of only module
|
package/lib/Compiler.js
CHANGED
@@ -98,6 +98,8 @@ const { isSourceEqual } = require("./util/source");
|
|
98
98
|
/** @typedef {{ sizeOnlySource: SizeOnlySource | undefined, writtenTo: Map<string, number> }} CacheEntry */
|
99
99
|
/** @typedef {{ path: string, source: Source, size: number | undefined, waiting: ({ cacheEntry: any, file: string }[] | undefined) }} SimilarEntry */
|
100
100
|
|
101
|
+
/** @typedef {{ buildInfo: BuildInfo, references: References | undefined, memCache: WeakTupleMap<any, any> }} ModuleMemCachesItem */
|
102
|
+
|
101
103
|
/**
|
102
104
|
* @param {string[]} array an array
|
103
105
|
* @returns {boolean} true, if the array is sorted
|
@@ -146,7 +148,7 @@ class Compiler {
|
|
146
148
|
/** @type {SyncHook<[]>} */
|
147
149
|
initialize: new SyncHook([]),
|
148
150
|
|
149
|
-
/** @type {SyncBailHook<[Compilation], boolean |
|
151
|
+
/** @type {SyncBailHook<[Compilation], boolean | void>} */
|
150
152
|
shouldEmit: new SyncBailHook(["compilation"]),
|
151
153
|
/** @type {AsyncSeriesHook<[Stats]>} */
|
152
154
|
done: new AsyncSeriesHook(["stats"]),
|
@@ -201,7 +203,7 @@ class Compiler {
|
|
201
203
|
/** @type {AsyncSeriesHook<[]>} */
|
202
204
|
shutdown: new AsyncSeriesHook([]),
|
203
205
|
|
204
|
-
/** @type {SyncBailHook<[string, string, any[] | undefined], true>} */
|
206
|
+
/** @type {SyncBailHook<[string, string, any[] | undefined], true | void>} */
|
205
207
|
infrastructureLog: new SyncBailHook(["origin", "type", "args"]),
|
206
208
|
|
207
209
|
// TODO the following hooks are weirdly located here
|
@@ -214,7 +216,7 @@ class Compiler {
|
|
214
216
|
afterPlugins: new SyncHook(["compiler"]),
|
215
217
|
/** @type {SyncHook<[Compiler]>} */
|
216
218
|
afterResolvers: new SyncHook(["compiler"]),
|
217
|
-
/** @type {SyncBailHook<[string, Entry], boolean>} */
|
219
|
+
/** @type {SyncBailHook<[string, Entry], boolean | void>} */
|
218
220
|
entryOption: new SyncBailHook(["context", "entry"])
|
219
221
|
});
|
220
222
|
|
@@ -288,7 +290,7 @@ class Compiler {
|
|
288
290
|
|
289
291
|
this.cache = new Cache();
|
290
292
|
|
291
|
-
/** @type {Map<Module,
|
293
|
+
/** @type {Map<Module, ModuleMemCachesItem> | undefined} */
|
292
294
|
this.moduleMemCaches = undefined;
|
293
295
|
|
294
296
|
this.compilerPath = "";
|
@@ -1161,7 +1163,7 @@ ${other}`);
|
|
1161
1163
|
* @param {Compilation} compilation the compilation
|
1162
1164
|
* @param {string} compilerName the compiler's name
|
1163
1165
|
* @param {number} compilerIndex the compiler's index
|
1164
|
-
* @param {OutputOptions
|
1166
|
+
* @param {Partial<OutputOptions>=} outputOptions the output options
|
1165
1167
|
* @param {WebpackPluginInstance[]=} plugins the plugins to apply
|
1166
1168
|
* @returns {Compiler} a child compiler
|
1167
1169
|
*/
|