webpack 5.90.3 → 5.91.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/README.md +5 -5
- package/bin/webpack.js +5 -1
- package/lib/APIPlugin.js +8 -4
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +7 -1
- package/lib/CacheFacade.js +3 -3
- package/lib/ChunkGraph.js +32 -18
- package/lib/ChunkGroup.js +14 -14
- package/lib/CleanPlugin.js +7 -5
- package/lib/Compilation.js +262 -93
- package/lib/Compiler.js +199 -83
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +2 -0
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/DefinePlugin.js +4 -2
- package/lib/Dependency.js +4 -2
- package/lib/DependencyTemplate.js +7 -2
- package/lib/DllModule.js +1 -0
- package/lib/DllReferencePlugin.js +6 -2
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfo.js +1 -4
- package/lib/ExternalModule.js +118 -24
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +1 -1
- package/lib/Generator.js +2 -1
- package/lib/HookWebpackError.js +2 -2
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +15 -7
- package/lib/Module.js +30 -2
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleGraph.js +56 -27
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +26 -8
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +3 -1
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +2 -1
- package/lib/ResolverFactory.js +3 -1
- package/lib/RuntimeModule.js +4 -4
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +102 -34
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +10 -3
- package/lib/TemplatedPathPlugin.js +32 -6
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/RawDataUrlModule.js +3 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +117 -64
- package/lib/cache/IdleFileCachePlugin.js +8 -3
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +49 -16
- package/lib/cache/ResolverCachePlugin.js +14 -6
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/defaults.js +24 -1
- package/lib/config/normalization.js +3 -1
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +3 -1
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +34 -17
- package/lib/css/CssGenerator.js +20 -2
- package/lib/css/CssLoadingRuntimeModule.js +212 -96
- package/lib/css/CssModulesPlugin.js +47 -13
- package/lib/debug/ProfilingPlugin.js +27 -2
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +9 -5
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +33 -18
- package/lib/dependencies/CommonJsExportsDependency.js +13 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -15
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -2
- package/lib/dependencies/ContextDependencyHelpers.js +49 -29
- package/lib/dependencies/ContextElementDependency.js +8 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +63 -8
- package/lib/dependencies/CssUrlDependency.js +5 -3
- package/lib/dependencies/ExportsInfoDependency.js +4 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +5 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +43 -23
- package/lib/dependencies/HarmonyExportHeaderDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +73 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +10 -2
- package/lib/dependencies/HarmonyImportDependency.js +28 -12
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +44 -16
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +6 -5
- package/lib/dependencies/ImportDependency.js +9 -2
- package/lib/dependencies/ImportEagerDependency.js +4 -2
- package/lib/dependencies/ImportMetaContextDependency.js +7 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +25 -14
- package/lib/dependencies/ImportParserPlugin.js +12 -4
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +4 -1
- package/lib/dependencies/RequireContextPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +26 -14
- package/lib/dependencies/RequireEnsureDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +7 -4
- package/lib/dependencies/WorkerPlugin.js +2 -1
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +2 -1
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/JavascriptParser.js +169 -57
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +11 -7
- package/lib/node/NodeEnvironmentPlugin.js +13 -7
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +138 -54
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +7 -2
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/ModuleConcatenationPlugin.js +12 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +46 -15
- package/lib/optimize/SplitChunksPlugin.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +11 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/serialization/FileMiddleware.js +1 -0
- package/lib/serialization/ObjectMiddleware.js +2 -0
- package/lib/serialization/Serializer.js +19 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedPlugin.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +2 -2
- package/lib/sharing/utils.js +13 -6
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/cleverMerge.js +24 -11
- package/lib/util/comparators.js +34 -14
- package/lib/util/conventions.js +129 -0
- package/lib/util/fs.js +379 -65
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/runtime.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +15 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +27 -6
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
- package/lib/webpack.js +7 -3
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +25 -26
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +69 -8
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +5 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +1668 -613
package/lib/logging/Logger.js
CHANGED
@@ -95,19 +95,32 @@ class WebpackLogger {
|
|
95
95
|
this[LOG_SYMBOL](LogType.groupEnd, args);
|
96
96
|
}
|
97
97
|
|
98
|
+
/**
|
99
|
+
* @param {string=} label label
|
100
|
+
*/
|
98
101
|
profile(label) {
|
99
102
|
this[LOG_SYMBOL](LogType.profile, [label]);
|
100
103
|
}
|
101
104
|
|
105
|
+
/**
|
106
|
+
* @param {string=} label label
|
107
|
+
*/
|
102
108
|
profileEnd(label) {
|
103
109
|
this[LOG_SYMBOL](LogType.profileEnd, [label]);
|
104
110
|
}
|
105
111
|
|
112
|
+
/**
|
113
|
+
* @param {string} label label
|
114
|
+
*/
|
106
115
|
time(label) {
|
116
|
+
/** @type {Map<string | undefined, [number, number]>} */
|
107
117
|
this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map();
|
108
118
|
this[TIMERS_SYMBOL].set(label, process.hrtime());
|
109
119
|
}
|
110
120
|
|
121
|
+
/**
|
122
|
+
* @param {string=} label label
|
123
|
+
*/
|
111
124
|
timeLog(label) {
|
112
125
|
const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
|
113
126
|
if (!prev) {
|
@@ -117,16 +130,23 @@ class WebpackLogger {
|
|
117
130
|
this[LOG_SYMBOL](LogType.time, [label, ...time]);
|
118
131
|
}
|
119
132
|
|
133
|
+
/**
|
134
|
+
* @param {string=} label label
|
135
|
+
*/
|
120
136
|
timeEnd(label) {
|
121
137
|
const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
|
122
138
|
if (!prev) {
|
123
139
|
throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
|
124
140
|
}
|
125
141
|
const time = process.hrtime(prev);
|
126
|
-
|
142
|
+
/** @type {Map<string | undefined, [number, number]>} */
|
143
|
+
(this[TIMERS_SYMBOL]).delete(label);
|
127
144
|
this[LOG_SYMBOL](LogType.time, [label, ...time]);
|
128
145
|
}
|
129
146
|
|
147
|
+
/**
|
148
|
+
* @param {string=} label label
|
149
|
+
*/
|
130
150
|
timeAggregate(label) {
|
131
151
|
const prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
|
132
152
|
if (!prev) {
|
@@ -135,7 +155,9 @@ class WebpackLogger {
|
|
135
155
|
);
|
136
156
|
}
|
137
157
|
const time = process.hrtime(prev);
|
138
|
-
|
158
|
+
/** @type {Map<string | undefined, [number, number]>} */
|
159
|
+
(this[TIMERS_SYMBOL]).delete(label);
|
160
|
+
/** @type {Map<string | undefined, [number, number]>} */
|
139
161
|
this[TIMERS_AGGREGATES_SYMBOL] =
|
140
162
|
this[TIMERS_AGGREGATES_SYMBOL] || new Map();
|
141
163
|
const current = this[TIMERS_AGGREGATES_SYMBOL].get(label);
|
@@ -151,6 +173,9 @@ class WebpackLogger {
|
|
151
173
|
this[TIMERS_AGGREGATES_SYMBOL].set(label, time);
|
152
174
|
}
|
153
175
|
|
176
|
+
/**
|
177
|
+
* @param {string=} label label
|
178
|
+
*/
|
154
179
|
timeAggregateEnd(label) {
|
155
180
|
if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return;
|
156
181
|
const time = this[TIMERS_AGGREGATES_SYMBOL].get(label);
|
@@ -12,6 +12,7 @@ const { LogType } = require("./Logger");
|
|
12
12
|
/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */
|
13
13
|
|
14
14
|
/** @typedef {function(string): boolean} FilterFunction */
|
15
|
+
/** @typedef {function(string, LogTypeEnum, any[]): void} LoggingFunction */
|
15
16
|
|
16
17
|
/**
|
17
18
|
* @typedef {Object} LoggerConsole
|
@@ -40,7 +41,7 @@ const { LogType } = require("./Logger");
|
|
40
41
|
|
41
42
|
/**
|
42
43
|
* @param {FilterItemTypes} item an input item
|
43
|
-
* @returns {FilterFunction} filter function
|
44
|
+
* @returns {FilterFunction | undefined} filter function
|
44
45
|
*/
|
45
46
|
const filterToFunction = item => {
|
46
47
|
if (typeof item === "string") {
|
@@ -76,15 +77,18 @@ const LogLevel = {
|
|
76
77
|
|
77
78
|
/**
|
78
79
|
* @param {LoggerOptions} options options object
|
79
|
-
* @returns {
|
80
|
+
* @returns {LoggingFunction} logging function
|
80
81
|
*/
|
81
82
|
module.exports = ({ level = "info", debug = false, console }) => {
|
82
83
|
const debugFilters =
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
/** @type {FilterFunction[]} */
|
85
|
+
(
|
86
|
+
typeof debug === "boolean"
|
87
|
+
? [() => debug]
|
88
|
+
: /** @type {FilterItemTypes[]} */ ([])
|
89
|
+
.concat(debug)
|
90
|
+
.map(filterToFunction)
|
91
|
+
);
|
88
92
|
/** @type {number} */
|
89
93
|
const loglevel = LogLevel[`${level}`] || 0;
|
90
94
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
-
const CachedInputFileSystem = require("enhanced-resolve
|
8
|
+
const CachedInputFileSystem = require("enhanced-resolve").CachedInputFileSystem;
|
9
9
|
const fs = require("graceful-fs");
|
10
10
|
const createConsoleLogger = require("../logging/createConsoleLogger");
|
11
11
|
const NodeWatchFileSystem = require("./NodeWatchFileSystem");
|
@@ -13,6 +13,7 @@ const nodeConsole = require("./nodeConsole");
|
|
13
13
|
|
14
14
|
/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */
|
15
15
|
/** @typedef {import("../Compiler")} Compiler */
|
16
|
+
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
16
17
|
|
17
18
|
class NodeEnvironmentPlugin {
|
18
19
|
/**
|
@@ -38,18 +39,23 @@ class NodeEnvironmentPlugin {
|
|
38
39
|
nodeConsole({
|
39
40
|
colors: infrastructureLogging.colors,
|
40
41
|
appendOnly: infrastructureLogging.appendOnly,
|
41
|
-
stream:
|
42
|
+
stream:
|
43
|
+
/** @type {NodeJS.WritableStream} */
|
44
|
+
(infrastructureLogging.stream)
|
42
45
|
})
|
43
46
|
});
|
44
47
|
compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000);
|
45
|
-
const inputFileSystem =
|
48
|
+
const inputFileSystem =
|
49
|
+
/** @type {InputFileSystem} */
|
50
|
+
(compiler.inputFileSystem);
|
46
51
|
compiler.outputFileSystem = fs;
|
47
52
|
compiler.intermediateFileSystem = fs;
|
48
|
-
compiler.watchFileSystem = new NodeWatchFileSystem(
|
49
|
-
compiler.inputFileSystem
|
50
|
-
);
|
53
|
+
compiler.watchFileSystem = new NodeWatchFileSystem(inputFileSystem);
|
51
54
|
compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
|
52
|
-
if (
|
55
|
+
if (
|
56
|
+
compiler.inputFileSystem === inputFileSystem &&
|
57
|
+
inputFileSystem.purge
|
58
|
+
) {
|
53
59
|
compiler.fsStartTime = Date.now();
|
54
60
|
inputFileSystem.purge();
|
55
61
|
}
|
@@ -10,11 +10,15 @@ const Watchpack = require("watchpack");
|
|
10
10
|
|
11
11
|
/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */
|
12
12
|
/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */
|
13
|
+
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
13
14
|
/** @typedef {import("../util/fs").WatchFileSystem} WatchFileSystem */
|
14
15
|
/** @typedef {import("../util/fs").WatchMethod} WatchMethod */
|
15
16
|
/** @typedef {import("../util/fs").Watcher} Watcher */
|
16
17
|
|
17
18
|
class NodeWatchFileSystem {
|
19
|
+
/**
|
20
|
+
* @param {InputFileSystem} inputFileSystem input filesystem
|
21
|
+
*/
|
18
22
|
constructor(inputFileSystem) {
|
19
23
|
this.inputFileSystem = inputFileSystem;
|
20
24
|
this.watcherOptions = {
|
@@ -26,10 +30,10 @@ class NodeWatchFileSystem {
|
|
26
30
|
/**
|
27
31
|
* @param {Iterable<string>} files watched files
|
28
32
|
* @param {Iterable<string>} directories watched directories
|
29
|
-
* @param {Iterable<string>} missing watched
|
33
|
+
* @param {Iterable<string>} missing watched existence entries
|
30
34
|
* @param {number} startTime timestamp of start time
|
31
35
|
* @param {WatchOptions} options options object
|
32
|
-
* @param {function(
|
36
|
+
* @param {function(Error | null, Map<string, FileSystemInfoEntry>, Map<string, FileSystemInfoEntry>, Set<string>, Set<string>): void} callback aggregated callback
|
33
37
|
* @param {function(string, number): void} callbackUndelayed callback when the first change was detected
|
34
38
|
* @returns {Watcher} a watcher
|
35
39
|
*/
|
@@ -81,28 +85,35 @@ class NodeWatchFileSystem {
|
|
81
85
|
}
|
82
86
|
return { fileTimeInfoEntries, contextTimeInfoEntries };
|
83
87
|
};
|
84
|
-
this.watcher.once(
|
85
|
-
|
86
|
-
|
88
|
+
this.watcher.once(
|
89
|
+
"aggregated",
|
90
|
+
/**
|
91
|
+
* @param {Set<string>} changes changes
|
92
|
+
* @param {Set<string>} removals removals
|
93
|
+
*/
|
94
|
+
(changes, removals) => {
|
95
|
+
// pause emitting events (avoids clearing aggregated changes and removals on timeout)
|
96
|
+
this.watcher.pause();
|
87
97
|
|
88
|
-
if (this.inputFileSystem && this.inputFileSystem.purge) {
|
89
98
|
const fs = this.inputFileSystem;
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
99
|
+
if (fs && fs.purge) {
|
100
|
+
for (const item of changes) {
|
101
|
+
fs.purge(item);
|
102
|
+
}
|
103
|
+
for (const item of removals) {
|
104
|
+
fs.purge(item);
|
105
|
+
}
|
95
106
|
}
|
107
|
+
const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
|
108
|
+
callback(
|
109
|
+
null,
|
110
|
+
fileTimeInfoEntries,
|
111
|
+
contextTimeInfoEntries,
|
112
|
+
changes,
|
113
|
+
removals
|
114
|
+
);
|
96
115
|
}
|
97
|
-
|
98
|
-
callback(
|
99
|
-
null,
|
100
|
-
fileTimeInfoEntries,
|
101
|
-
contextTimeInfoEntries,
|
102
|
-
changes,
|
103
|
-
removals
|
104
|
-
);
|
105
|
-
});
|
116
|
+
);
|
106
117
|
|
107
118
|
this.watcher.watch({ files, directories, missing, startTime });
|
108
119
|
|
@@ -124,8 +135,8 @@ class NodeWatchFileSystem {
|
|
124
135
|
getAggregatedRemovals: util.deprecate(
|
125
136
|
() => {
|
126
137
|
const items = this.watcher && this.watcher.aggregatedRemovals;
|
127
|
-
|
128
|
-
|
138
|
+
const fs = this.inputFileSystem;
|
139
|
+
if (items && fs && fs.purge) {
|
129
140
|
for (const item of items) {
|
130
141
|
fs.purge(item);
|
131
142
|
}
|
@@ -138,8 +149,8 @@ class NodeWatchFileSystem {
|
|
138
149
|
getAggregatedChanges: util.deprecate(
|
139
150
|
() => {
|
140
151
|
const items = this.watcher && this.watcher.aggregatedChanges;
|
141
|
-
|
142
|
-
|
152
|
+
const fs = this.inputFileSystem;
|
153
|
+
if (items && fs && fs.purge) {
|
143
154
|
for (const item of items) {
|
144
155
|
fs.purge(item);
|
145
156
|
}
|
@@ -166,8 +177,8 @@ class NodeWatchFileSystem {
|
|
166
177
|
getInfo: () => {
|
167
178
|
const removals = this.watcher && this.watcher.aggregatedRemovals;
|
168
179
|
const changes = this.watcher && this.watcher.aggregatedChanges;
|
169
|
-
|
170
|
-
|
180
|
+
const fs = this.inputFileSystem;
|
181
|
+
if (fs && fs.purge) {
|
171
182
|
if (removals) {
|
172
183
|
for (const item of removals) {
|
173
184
|
fs.purge(item);
|
@@ -18,10 +18,11 @@ const { getUndoPath } = require("../util/identifier");
|
|
18
18
|
/** @typedef {import("../Chunk")} Chunk */
|
19
19
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
20
20
|
/** @typedef {import("../Compilation")} Compilation */
|
21
|
+
/** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
21
22
|
|
22
23
|
class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
23
24
|
/**
|
24
|
-
* @param {
|
25
|
+
* @param {ReadOnlyRuntimeRequirements} runtimeRequirements runtime requirements
|
25
26
|
*/
|
26
27
|
constructor(runtimeRequirements) {
|
27
28
|
super("readFile chunk loading", RuntimeModule.STAGE_ATTACH);
|
@@ -18,10 +18,11 @@ const { getUndoPath } = require("../util/identifier");
|
|
18
18
|
/** @typedef {import("../Chunk")} Chunk */
|
19
19
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
20
20
|
/** @typedef {import("../Compilation")} Compilation */
|
21
|
+
/** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
21
22
|
|
22
23
|
class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
23
24
|
/**
|
24
|
-
* @param {
|
25
|
+
* @param {ReadOnlyRuntimeRequirements} runtimeRequirements runtime requirements
|
25
26
|
*/
|
26
27
|
constructor(runtimeRequirements) {
|
27
28
|
super("require chunk loading", RuntimeModule.STAGE_ATTACH);
|
package/lib/node/nodeConsole.js
CHANGED
@@ -8,12 +8,29 @@
|
|
8
8
|
const util = require("util");
|
9
9
|
const truncateArgs = require("../logging/truncateArgs");
|
10
10
|
|
11
|
+
/** @typedef {import("../logging/createConsoleLogger").LoggerConsole} LoggerConsole */
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @param {Object} options options
|
15
|
+
* @param {boolean=} options.colors colors
|
16
|
+
* @param {boolean=} options.appendOnly append only
|
17
|
+
* @param {NodeJS.WritableStream} options.stream stream
|
18
|
+
* @returns {LoggerConsole} logger function
|
19
|
+
*/
|
11
20
|
module.exports = ({ colors, appendOnly, stream }) => {
|
21
|
+
/** @type {string[] | undefined} */
|
12
22
|
let currentStatusMessage = undefined;
|
13
23
|
let hasStatusMessage = false;
|
14
24
|
let currentIndent = "";
|
15
25
|
let currentCollapsed = 0;
|
16
26
|
|
27
|
+
/**
|
28
|
+
* @param {string} str string
|
29
|
+
* @param {string} prefix prefix
|
30
|
+
* @param {string} colorPrefix color prefix
|
31
|
+
* @param {string} colorSuffix color suffix
|
32
|
+
* @returns {string} indented string
|
33
|
+
*/
|
17
34
|
const indent = (str, prefix, colorPrefix, colorSuffix) => {
|
18
35
|
if (str === "") return str;
|
19
36
|
prefix = currentIndent + prefix;
|
@@ -38,7 +55,7 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|
38
55
|
|
39
56
|
const writeStatusMessage = () => {
|
40
57
|
if (!currentStatusMessage) return;
|
41
|
-
const l = stream.columns || 40;
|
58
|
+
const l = /** @type {TODO} */ (stream).columns || 40;
|
42
59
|
const args = truncateArgs(currentStatusMessage, l - 1);
|
43
60
|
const str = args.join(" ");
|
44
61
|
const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
|
@@ -46,6 +63,12 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|
46
63
|
hasStatusMessage = true;
|
47
64
|
};
|
48
65
|
|
66
|
+
/**
|
67
|
+
* @param {string} prefix prefix
|
68
|
+
* @param {string} colorPrefix color prefix
|
69
|
+
* @param {string} colorSuffix color suffix
|
70
|
+
* @returns {(function(...any[]): void)} function to write with colors
|
71
|
+
*/
|
49
72
|
const writeColored = (prefix, colorPrefix, colorSuffix) => {
|
50
73
|
return (...args) => {
|
51
74
|
if (currentCollapsed > 0) return;
|
@@ -100,6 +100,7 @@ class AggressiveSplittingPlugin {
|
|
100
100
|
let newSplits;
|
101
101
|
/** @type {Set<Chunk>} */
|
102
102
|
let fromAggressiveSplittingSet;
|
103
|
+
/** @type {Map<Chunk, TODO>} */
|
103
104
|
let chunkSplitDataMap;
|
104
105
|
compilation.hooks.optimize.tap("AggressiveSplittingPlugin", () => {
|
105
106
|
newSplits = [];
|