webpack 5.23.0 → 5.24.3
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/ChunkGraph.js +13 -5
- package/lib/Compilation.js +14 -7
- package/lib/Dependency.js +2 -0
- package/lib/ExportsInfo.js +23 -7
- package/lib/FlagDependencyExportsPlugin.js +16 -5
- package/lib/Module.js +5 -3
- package/lib/ModuleGraph.js +42 -6
- package/lib/ModuleGraphConnection.js +2 -2
- package/lib/MultiCompiler.js +29 -12
- package/lib/Watching.js +13 -18
- package/lib/WebpackOptionsApply.js +1 -1
- package/lib/async-modules/InferAsyncModulesPlugin.js +10 -6
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +60 -20
- package/lib/ids/OccurrenceModuleIdsPlugin.js +28 -17
- package/lib/index.js +1 -0
- package/lib/javascript/JavascriptModulesPlugin.js +5 -5
- package/lib/node/NodeWatchFileSystem.js +6 -0
- package/lib/optimize/ConcatenatedModule.js +14 -9
- package/lib/optimize/ModuleConcatenationPlugin.js +559 -516
- package/lib/optimize/RealContentHashPlugin.js +22 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +17 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +140 -131
- package/lib/util/SetHelpers.js +15 -0
- package/lib/util/fs.js +2 -0
- package/lib/util/semver.js +4 -4
- package/package.json +4 -8
- package/schemas/WebpackOptions.json +139 -4
- package/types.d.ts +118 -21
@@ -37,12 +37,12 @@ const createModulesListMessage = (modules, moduleGraph) => {
|
|
37
37
|
.map(m => {
|
38
38
|
let message = `* ${m.identifier()}`;
|
39
39
|
const validReasons = Array.from(
|
40
|
-
moduleGraph.
|
41
|
-
).filter(
|
40
|
+
moduleGraph.getIncomingConnectionsByOriginModule(m).keys()
|
41
|
+
).filter(x => x);
|
42
42
|
|
43
43
|
if (validReasons.length > 0) {
|
44
44
|
message += `\n Used by ${validReasons.length} module(s), i. e.`;
|
45
|
-
message += `\n ${validReasons[0].
|
45
|
+
message += `\n ${validReasons[0].identifier()}`;
|
46
46
|
}
|
47
47
|
return message;
|
48
48
|
})
|
package/lib/ChunkGraph.js
CHANGED
@@ -69,6 +69,18 @@ const getArray = set => {
|
|
69
69
|
return Array.from(set);
|
70
70
|
};
|
71
71
|
|
72
|
+
/**
|
73
|
+
* @param {SortableSet<Chunk>} chunks the chunks
|
74
|
+
* @returns {RuntimeSpecSet} runtimes
|
75
|
+
*/
|
76
|
+
const getModuleRuntimes = chunks => {
|
77
|
+
const runtimes = new RuntimeSpecSet();
|
78
|
+
for (const chunk of chunks) {
|
79
|
+
runtimes.add(chunk.runtime);
|
80
|
+
}
|
81
|
+
return runtimes;
|
82
|
+
};
|
83
|
+
|
72
84
|
/**
|
73
85
|
* @param {SortableSet<Module>} set the set
|
74
86
|
* @returns {Map<string, SortableSet<Module>>} modules by source type
|
@@ -510,11 +522,7 @@ class ChunkGraph {
|
|
510
522
|
*/
|
511
523
|
getModuleRuntimes(module) {
|
512
524
|
const cgm = this._getChunkGraphModule(module);
|
513
|
-
|
514
|
-
for (const chunk of cgm.chunks) {
|
515
|
-
runtimes.add(chunk.runtime);
|
516
|
-
}
|
517
|
-
return runtimes;
|
525
|
+
return cgm.chunks.getFromUnorderedCache(getModuleRuntimes);
|
518
526
|
}
|
519
527
|
|
520
528
|
/**
|
package/lib/Compilation.js
CHANGED
@@ -99,6 +99,9 @@ const { isSourceEqual } = require("./util/source");
|
|
99
99
|
/** @typedef {import("./RuntimeModule")} RuntimeModule */
|
100
100
|
/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */
|
101
101
|
/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */
|
102
|
+
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
103
|
+
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
|
104
|
+
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
|
102
105
|
/** @typedef {import("./util/Hash")} Hash */
|
103
106
|
/** @template T @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T> */
|
104
107
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
@@ -235,9 +238,9 @@ const { isSourceEqual } = require("./util/source");
|
|
235
238
|
* @property {boolean} groupAssetsByPath
|
236
239
|
* @property {boolean} groupAssetsByExtension
|
237
240
|
* @property {number} assetsSpace
|
238
|
-
* @property {
|
239
|
-
* @property {
|
240
|
-
* @property {
|
241
|
+
* @property {((value: string, asset: StatsAsset) => boolean)[]} excludeAssets
|
242
|
+
* @property {((name: string, module: StatsModule, type: "module" | "chunk" | "root-of-chunk" | "nested") => boolean)[]} excludeModules
|
243
|
+
* @property {((warning: StatsError, textValue: string) => boolean)[]} warningsFilter
|
241
244
|
* @property {boolean} cachedModules
|
242
245
|
* @property {boolean} orphanModules
|
243
246
|
* @property {boolean} dependentModules
|
@@ -257,12 +260,12 @@ const { isSourceEqual } = require("./util/source");
|
|
257
260
|
* @property {number} chunkModulesSpace
|
258
261
|
* @property {number} nestedModulesSpace
|
259
262
|
* @property {false|"none"|"error"|"warn"|"info"|"log"|"verbose"} logging
|
260
|
-
* @property {
|
263
|
+
* @property {((value: string) => boolean)[]} loggingDebug
|
261
264
|
* @property {boolean} loggingTrace
|
262
265
|
* @property {any} _env
|
263
266
|
*/
|
264
267
|
|
265
|
-
/** @typedef {KnownNormalizedStatsOptions & StatsOptions & Record<string, any>} NormalizedStatsOptions */
|
268
|
+
/** @typedef {KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>} NormalizedStatsOptions */
|
266
269
|
|
267
270
|
/**
|
268
271
|
* @typedef {Object} KnownCreateStatsOptionsContext
|
@@ -488,7 +491,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
488
491
|
);
|
489
492
|
}
|
490
493
|
},
|
491
|
-
`${name} is deprecated (use Compilation.
|
494
|
+
`${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`,
|
492
495
|
code
|
493
496
|
);
|
494
497
|
};
|
@@ -1485,7 +1488,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
1485
1488
|
|
1486
1489
|
for (let i = 0; i < dependencies.length; i++) {
|
1487
1490
|
const dependency = dependencies[i];
|
1488
|
-
moduleGraph.setResolvedModule(
|
1491
|
+
moduleGraph.setResolvedModule(
|
1492
|
+
recursive ? originModule : null,
|
1493
|
+
dependency,
|
1494
|
+
module
|
1495
|
+
);
|
1489
1496
|
}
|
1490
1497
|
|
1491
1498
|
moduleGraph.setIssuerIfUnset(
|
package/lib/Dependency.js
CHANGED
@@ -53,12 +53,14 @@
|
|
53
53
|
* @property {(string | ExportSpec)[]=} exports nested exports
|
54
54
|
* @property {ModuleGraphConnection=} from when reexported: from which module
|
55
55
|
* @property {string[] | null=} export when reexported: from which export
|
56
|
+
* @property {boolean=} hidden export is not visible, because another export blends over it
|
56
57
|
*/
|
57
58
|
|
58
59
|
/**
|
59
60
|
* @typedef {Object} ExportsSpec
|
60
61
|
* @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports
|
61
62
|
* @property {Set<string>=} excludeExports when exports = true, list of unaffected exports
|
63
|
+
* @property {Set<string>=} hideExports list of maybe prior exposed, but now hidden exports
|
62
64
|
* @property {ModuleGraphConnection=} from when reexported: from which module
|
63
65
|
* @property {boolean=} canMangle can the export be renamed (defaults to true)
|
64
66
|
* @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts
|
package/lib/ExportsInfo.js
CHANGED
@@ -1017,6 +1017,15 @@ class ExportInfo {
|
|
1017
1017
|
return false;
|
1018
1018
|
}
|
1019
1019
|
|
1020
|
+
/**
|
1021
|
+
* @param {any} key the key
|
1022
|
+
* @returns {boolean} true, if something has changed
|
1023
|
+
*/
|
1024
|
+
unsetTarget(key) {
|
1025
|
+
if (!this._target) return false;
|
1026
|
+
return this._target.delete(key);
|
1027
|
+
}
|
1028
|
+
|
1020
1029
|
/**
|
1021
1030
|
* @param {any} key the key
|
1022
1031
|
* @param {ModuleGraphConnection=} connection the target module if a single one
|
@@ -1223,7 +1232,7 @@ class ExportInfo {
|
|
1223
1232
|
|
1224
1233
|
/**
|
1225
1234
|
* @param {ModuleGraph} moduleGraph the module graph
|
1226
|
-
* @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target
|
1235
|
+
* @param {function({ module: Module, connection: ModuleGraphConnection, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target
|
1227
1236
|
* @param {Set<ExportInfo> | undefined} alreadyVisited set of already visited export info to avoid circular references
|
1228
1237
|
* @returns {{ module: Module, connection: ModuleGraphConnection, export: string[] | undefined } | CIRCULAR | undefined} the target
|
1229
1238
|
*/
|
@@ -1291,9 +1300,6 @@ class ExportInfo {
|
|
1291
1300
|
const target = resolveTarget(values.next().value, newAlreadyVisited);
|
1292
1301
|
if (target === CIRCULAR) return CIRCULAR;
|
1293
1302
|
if (target === null) return undefined;
|
1294
|
-
if (this._target.size === 1) {
|
1295
|
-
return target;
|
1296
|
-
}
|
1297
1303
|
let result = values.next();
|
1298
1304
|
while (!result.done) {
|
1299
1305
|
const t = resolveTarget(result.value, newAlreadyVisited);
|
@@ -1311,15 +1317,25 @@ class ExportInfo {
|
|
1311
1317
|
* Move the target forward as long resolveTargetFilter is fulfilled
|
1312
1318
|
* @param {ModuleGraph} moduleGraph the module graph
|
1313
1319
|
* @param {function({ module: Module, export: string[] | undefined }): boolean} resolveTargetFilter filter function to further resolve target
|
1314
|
-
* @
|
1320
|
+
* @param {function({ module: Module, export: string[] | undefined }): ModuleGraphConnection=} updateOriginalConnection updates the original connection instead of using the target connection
|
1321
|
+
* @returns {{ module: Module, export: string[] | undefined } | undefined} the resolved target when moved
|
1315
1322
|
*/
|
1316
|
-
moveTarget(moduleGraph, resolveTargetFilter) {
|
1323
|
+
moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) {
|
1317
1324
|
const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined);
|
1318
1325
|
if (target === CIRCULAR) return undefined;
|
1319
1326
|
if (!target) return undefined;
|
1327
|
+
const originalTarget = this._target.values().next().value;
|
1328
|
+
if (
|
1329
|
+
originalTarget.connection === target.connection &&
|
1330
|
+
originalTarget.export === target.export
|
1331
|
+
) {
|
1332
|
+
return undefined;
|
1333
|
+
}
|
1320
1334
|
this._target.clear();
|
1321
1335
|
this._target.set(undefined, {
|
1322
|
-
connection:
|
1336
|
+
connection: updateOriginalConnection
|
1337
|
+
? updateOriginalConnection(target)
|
1338
|
+
: target.connection,
|
1323
1339
|
export: target.export
|
1324
1340
|
});
|
1325
1341
|
return target;
|
@@ -122,6 +122,12 @@ class FlagDependencyExportsPlugin {
|
|
122
122
|
const globalTerminalBinding =
|
123
123
|
exportDesc.terminalBinding || false;
|
124
124
|
const exportDeps = exportDesc.dependencies;
|
125
|
+
if (exportDesc.hideExports) {
|
126
|
+
for (const name of exportDesc.hideExports) {
|
127
|
+
const exportInfo = exportsInfo.getExportInfo(name);
|
128
|
+
exportInfo.unsetTarget(dep);
|
129
|
+
}
|
130
|
+
}
|
125
131
|
if (exports === true) {
|
126
132
|
// unknown exports
|
127
133
|
if (
|
@@ -148,6 +154,7 @@ class FlagDependencyExportsPlugin {
|
|
148
154
|
let exports = undefined;
|
149
155
|
let from = globalFrom;
|
150
156
|
let fromExport = undefined;
|
157
|
+
let hidden = false;
|
151
158
|
if (typeof exportNameOrSpec === "string") {
|
152
159
|
name = exportNameOrSpec;
|
153
160
|
} else {
|
@@ -162,6 +169,8 @@ class FlagDependencyExportsPlugin {
|
|
162
169
|
from = exportNameOrSpec.from;
|
163
170
|
if (exportNameOrSpec.terminalBinding !== undefined)
|
164
171
|
terminalBinding = exportNameOrSpec.terminalBinding;
|
172
|
+
if (exportNameOrSpec.hidden !== undefined)
|
173
|
+
hidden = exportNameOrSpec.hidden;
|
165
174
|
}
|
166
175
|
const exportInfo = exportsInfo.getExportInfo(name);
|
167
176
|
|
@@ -190,11 +199,13 @@ class FlagDependencyExportsPlugin {
|
|
190
199
|
|
191
200
|
if (
|
192
201
|
from &&
|
193
|
-
|
194
|
-
dep
|
195
|
-
|
196
|
-
|
197
|
-
|
202
|
+
(hidden
|
203
|
+
? exportInfo.unsetTarget(dep)
|
204
|
+
: exportInfo.setTarget(
|
205
|
+
dep,
|
206
|
+
from,
|
207
|
+
fromExport === undefined ? [name] : fromExport
|
208
|
+
))
|
198
209
|
) {
|
199
210
|
changed = true;
|
200
211
|
}
|
package/lib/Module.js
CHANGED
@@ -631,9 +631,11 @@ class Module extends DependenciesBlock {
|
|
631
631
|
*/
|
632
632
|
hasReasonForChunk(chunk, moduleGraph, chunkGraph) {
|
633
633
|
// check for each reason if we need the chunk
|
634
|
-
for (const
|
635
|
-
|
636
|
-
|
634
|
+
for (const [
|
635
|
+
fromModule,
|
636
|
+
connections
|
637
|
+
] of moduleGraph.getIncomingConnectionsByOriginModule(this)) {
|
638
|
+
if (!connections.some(c => c.isTargetActive(chunk.runtime))) continue;
|
637
639
|
for (const originChunk of chunkGraph.getModuleChunksIterable(
|
638
640
|
fromModule
|
639
641
|
)) {
|
package/lib/ModuleGraph.js
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
const util = require("util");
|
9
9
|
const ExportsInfo = require("./ExportsInfo");
|
10
10
|
const ModuleGraphConnection = require("./ModuleGraphConnection");
|
11
|
+
const SortableSet = require("./util/SortableSet");
|
11
12
|
|
12
13
|
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
|
13
14
|
/** @typedef {import("./Dependency")} Dependency */
|
@@ -15,7 +16,6 @@ const ModuleGraphConnection = require("./ModuleGraphConnection");
|
|
15
16
|
/** @typedef {import("./Module")} Module */
|
16
17
|
/** @typedef {import("./ModuleProfile")} ModuleProfile */
|
17
18
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
18
|
-
/** @template T @typedef {import("./util/SortableSet")<T>} SortableSet<t> */
|
19
19
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
20
20
|
|
21
21
|
/**
|
@@ -26,10 +26,40 @@ const ModuleGraphConnection = require("./ModuleGraphConnection");
|
|
26
26
|
|
27
27
|
const EMPTY_ARRAY = [];
|
28
28
|
|
29
|
+
/**
|
30
|
+
* @param {SortableSet<ModuleGraphConnection>} set input
|
31
|
+
* @returns {readonly Map<Module, readonly ModuleGraphConnection[]>} mapped by origin module
|
32
|
+
*/
|
33
|
+
const getConnectionsByOriginModule = set => {
|
34
|
+
const map = new Map();
|
35
|
+
/** @type {Module | 0} */
|
36
|
+
let lastModule = 0;
|
37
|
+
/** @type {ModuleGraphConnection[]} */
|
38
|
+
let lastList = undefined;
|
39
|
+
for (const connection of set) {
|
40
|
+
const { originModule } = connection;
|
41
|
+
if (lastModule === originModule) {
|
42
|
+
lastList.push(connection);
|
43
|
+
} else {
|
44
|
+
lastModule = originModule;
|
45
|
+
const list = map.get(originModule);
|
46
|
+
if (list !== undefined) {
|
47
|
+
lastList = list;
|
48
|
+
list.push(connection);
|
49
|
+
} else {
|
50
|
+
const list = [connection];
|
51
|
+
lastList = list;
|
52
|
+
map.set(originModule, list);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return map;
|
57
|
+
};
|
58
|
+
|
29
59
|
class ModuleGraphModule {
|
30
60
|
constructor() {
|
31
|
-
/** @type {
|
32
|
-
this.incomingConnections = new
|
61
|
+
/** @type {SortableSet<ModuleGraphConnection>} */
|
62
|
+
this.incomingConnections = new SortableSet();
|
33
63
|
/** @type {Set<ModuleGraphConnection> | undefined} */
|
34
64
|
this.outgoingConnections = undefined;
|
35
65
|
/** @type {Module | null} */
|
@@ -319,9 +349,6 @@ class ModuleGraph {
|
|
319
349
|
newConnections.add(newConnection);
|
320
350
|
if (newConnection.module !== undefined) {
|
321
351
|
const otherMgm = this._getModuleGraphModule(newConnection.module);
|
322
|
-
if (otherMgm.incomingConnections === undefined) {
|
323
|
-
otherMgm.incomingConnections = new Set();
|
324
|
-
}
|
325
352
|
otherMgm.incomingConnections.add(newConnection);
|
326
353
|
}
|
327
354
|
}
|
@@ -402,6 +429,15 @@ class ModuleGraph {
|
|
402
429
|
return connections === undefined ? EMPTY_ARRAY : connections;
|
403
430
|
}
|
404
431
|
|
432
|
+
/**
|
433
|
+
* @param {Module} module the module
|
434
|
+
* @returns {readonly Map<Module, readonly ModuleGraphConnection[]>} reasons why a module is included, in a map by source module
|
435
|
+
*/
|
436
|
+
getIncomingConnectionsByOriginModule(module) {
|
437
|
+
const connections = this._getModuleGraphModule(module).incomingConnections;
|
438
|
+
return connections.getFromUnorderedCache(getConnectionsByOriginModule);
|
439
|
+
}
|
440
|
+
|
405
441
|
/**
|
406
442
|
* @param {Module} module the module
|
407
443
|
* @returns {ModuleProfile | null} the module profile
|
@@ -51,8 +51,8 @@ const intersectConnectionStates = (a, b) => {
|
|
51
51
|
|
52
52
|
class ModuleGraphConnection {
|
53
53
|
/**
|
54
|
-
* @param {Module|
|
55
|
-
* @param {Dependency|
|
54
|
+
* @param {Module|null} originModule the referencing module
|
55
|
+
* @param {Dependency|null} dependency the referencing dependency
|
56
56
|
* @param {Module} module the referenced module
|
57
57
|
* @param {string=} explanation some extra detail
|
58
58
|
* @param {boolean=} weak the reference is weak
|
package/lib/MultiCompiler.js
CHANGED
@@ -350,6 +350,12 @@ module.exports = class MultiCompiler {
|
|
350
350
|
let errored = false;
|
351
351
|
let running = 0;
|
352
352
|
const parallelism = this._options.parallelism;
|
353
|
+
/**
|
354
|
+
* @param {Node} node node
|
355
|
+
* @param {Error=} err error
|
356
|
+
* @param {Stats=} stats result
|
357
|
+
* @returns {void}
|
358
|
+
*/
|
353
359
|
const nodeDone = (node, err, stats) => {
|
354
360
|
if (errored) return;
|
355
361
|
if (err) {
|
@@ -367,27 +373,35 @@ module.exports = class MultiCompiler {
|
|
367
373
|
);
|
368
374
|
}
|
369
375
|
node.result = stats;
|
376
|
+
running--;
|
370
377
|
if (node.state === "running") {
|
371
|
-
running--;
|
372
378
|
node.state = "done";
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
+
}
|
380
|
+
for (const child of node.children) {
|
381
|
+
if (child.state !== "blocked") continue;
|
382
|
+
if (child.parents.every(p => p.state === "done")) {
|
383
|
+
child.state = "queued";
|
384
|
+
queue.enqueue(child);
|
379
385
|
}
|
380
|
-
process.nextTick(processQueue);
|
381
386
|
}
|
387
|
+
process.nextTick(processQueue);
|
382
388
|
};
|
389
|
+
/**
|
390
|
+
* @param {Node} node node
|
391
|
+
* @returns {void}
|
392
|
+
*/
|
383
393
|
const nodeInvalid = node => {
|
384
|
-
if (node.state === "done") {
|
394
|
+
if (node.state === "done" || node.state === "running") {
|
385
395
|
node.state = "blocked";
|
386
|
-
|
387
|
-
|
388
|
-
|
396
|
+
}
|
397
|
+
for (const child of node.children) {
|
398
|
+
nodeInvalid(child);
|
389
399
|
}
|
390
400
|
};
|
401
|
+
/**
|
402
|
+
* @param {Node} node node
|
403
|
+
* @returns {void}
|
404
|
+
*/
|
391
405
|
const nodeChange = node => {
|
392
406
|
nodeInvalid(node);
|
393
407
|
if (
|
@@ -415,6 +429,7 @@ module.exports = class MultiCompiler {
|
|
415
429
|
const processQueue = () => {
|
416
430
|
while (running < parallelism && queue.length > 0 && !errored) {
|
417
431
|
const node = queue.dequeue();
|
432
|
+
if (node.state !== "queued") continue;
|
418
433
|
running++;
|
419
434
|
node.state = "running";
|
420
435
|
run(node.compiler, nodeDone.bind(null, node));
|
@@ -446,6 +461,7 @@ module.exports = class MultiCompiler {
|
|
446
461
|
if (this.running) {
|
447
462
|
return handler(new ConcurrentCompilationError());
|
448
463
|
}
|
464
|
+
this.running = true;
|
449
465
|
|
450
466
|
if (this.validateDependencies(handler)) {
|
451
467
|
const watchings = this._runGraph(
|
@@ -480,6 +496,7 @@ module.exports = class MultiCompiler {
|
|
480
496
|
if (this.running) {
|
481
497
|
return callback(new ConcurrentCompilationError());
|
482
498
|
}
|
499
|
+
this.running = true;
|
483
500
|
|
484
501
|
if (this.validateDependencies(callback)) {
|
485
502
|
this._runGraph(
|
package/lib/Watching.js
CHANGED
@@ -54,7 +54,6 @@ class Watching {
|
|
54
54
|
this.running = false;
|
55
55
|
this._initial = true;
|
56
56
|
this._needRecords = true;
|
57
|
-
this._needWatcherInfo = false;
|
58
57
|
this.watcher = undefined;
|
59
58
|
this.pausedWatcher = undefined;
|
60
59
|
this._done = this._done.bind(this);
|
@@ -84,21 +83,6 @@ class Watching {
|
|
84
83
|
});
|
85
84
|
}
|
86
85
|
this.invalid = false;
|
87
|
-
if (this._needWatcherInfo) {
|
88
|
-
this._needWatcherInfo = false;
|
89
|
-
const watcher = this.pausedWatcher;
|
90
|
-
if (watcher) {
|
91
|
-
this.compiler.modifiedFiles = watcher.aggregatedChanges;
|
92
|
-
this.compiler.removedFiles = watcher.aggregatedRemovals;
|
93
|
-
this.compiler.fileTimestamps = watcher.getFileTimeInfoEntries();
|
94
|
-
this.compiler.contextTimestamps = watcher.getContextTimeInfoEntries();
|
95
|
-
} else {
|
96
|
-
this.compiler.modifiedFiles = undefined;
|
97
|
-
this.compiler.removedFiles = undefined;
|
98
|
-
this.compiler.fileTimestamps = undefined;
|
99
|
-
this.compiler.contextTimestamps = undefined;
|
100
|
-
}
|
101
|
-
}
|
102
86
|
this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
|
103
87
|
if (err) return this._done(err);
|
104
88
|
const onCompiled = (err, compilation) => {
|
@@ -277,6 +261,11 @@ class Watching {
|
|
277
261
|
this.compiler.contextTimestamps = contextTimeInfoEntries;
|
278
262
|
this.compiler.removedFiles = removedFiles;
|
279
263
|
this.compiler.modifiedFiles = changedFiles;
|
264
|
+
if (this.watcher) {
|
265
|
+
this.pausedWatcher = this.watcher;
|
266
|
+
this.watcher.pause();
|
267
|
+
this.watcher = null;
|
268
|
+
}
|
280
269
|
this._invalidate();
|
281
270
|
this._onChange();
|
282
271
|
},
|
@@ -297,7 +286,6 @@ class Watching {
|
|
297
286
|
}
|
298
287
|
if (!this._initial) {
|
299
288
|
this.compiler.hooks.invalid.call(null, Date.now());
|
300
|
-
this._needWatcherInfo = true;
|
301
289
|
}
|
302
290
|
this._invalidate();
|
303
291
|
}
|
@@ -309,6 +297,14 @@ class Watching {
|
|
309
297
|
return;
|
310
298
|
}
|
311
299
|
if (this.watcher) {
|
300
|
+
this.compiler.modifiedFiles =
|
301
|
+
this.watcher.getAggregatedChanges &&
|
302
|
+
this.watcher.getAggregatedChanges();
|
303
|
+
this.compiler.removedFiles =
|
304
|
+
this.watcher.getAggregatedRemovals &&
|
305
|
+
this.watcher.getAggregatedRemovals();
|
306
|
+
this.compiler.fileTimestamps = this.watcher.getFileTimeInfoEntries();
|
307
|
+
this.compiler.contextTimestamps = this.watcher.getContextTimeInfoEntries();
|
312
308
|
this.pausedWatcher = this.watcher;
|
313
309
|
this.watcher.pause();
|
314
310
|
this.watcher = null;
|
@@ -328,7 +324,6 @@ class Watching {
|
|
328
324
|
resume() {
|
329
325
|
if (this.suspended) {
|
330
326
|
this.suspended = false;
|
331
|
-
this._needWatcherInfo = true;
|
332
327
|
this._invalidate();
|
333
328
|
}
|
334
329
|
}
|
@@ -271,7 +271,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|
271
271
|
),
|
272
272
|
entries: !lazyOptions || lazyOptions.entries !== false,
|
273
273
|
imports: !lazyOptions || lazyOptions.imports !== false,
|
274
|
-
test: lazyOptions && lazyOptions.test
|
274
|
+
test: (lazyOptions && lazyOptions.test) || undefined
|
275
275
|
}).apply(compiler);
|
276
276
|
}
|
277
277
|
|
@@ -31,14 +31,18 @@ class InferAsyncModulesPlugin {
|
|
31
31
|
}
|
32
32
|
for (const module of queue) {
|
33
33
|
moduleGraph.setAsync(module);
|
34
|
-
const
|
35
|
-
|
36
|
-
|
34
|
+
for (const [
|
35
|
+
originModule,
|
36
|
+
connections
|
37
|
+
] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
|
37
38
|
if (
|
38
|
-
|
39
|
-
|
39
|
+
connections.some(
|
40
|
+
c =>
|
41
|
+
c.dependency instanceof HarmonyImportDependency &&
|
42
|
+
c.isTargetActive(undefined)
|
43
|
+
)
|
40
44
|
) {
|
41
|
-
queue.add(
|
45
|
+
queue.add(originModule);
|
42
46
|
}
|
43
47
|
}
|
44
48
|
}
|