Skip to content

Commit f05246e

Browse files
committed
use buildInfo instead of hash for cacheUnaffected
1 parent 4c68833 commit f05246e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/Compilation.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
21812181
let statChanged = 0;
21822182
let statUnchanged = 0;
21832183
let statReferencesChanged = 0;
2184-
let statWithoutHash = 0;
2184+
let statWithoutBuild = 0;
21852185

21862186
const computeReferences = module => {
21872187
/** @type {WeakMap<Dependency, Module>} */
@@ -2216,14 +2216,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
22162216
const modulesWithoutCache = new Set(modules);
22172217
for (const [module, cachedMemCache] of moduleMemCacheCache) {
22182218
if (modulesWithoutCache.has(module)) {
2219-
const hash = module.buildInfo && module.buildInfo.hash;
2220-
if (typeof hash === "string") {
2221-
if (cachedMemCache.hash !== hash) {
2219+
const buildInfo = module.buildInfo;
2220+
if (buildInfo) {
2221+
if (cachedMemCache.buildInfo !== buildInfo) {
22222222
// use a new one
22232223
const memCache = new WeakTupleMap();
22242224
moduleMemCaches.set(module, memCache);
22252225
affectedModules.add(module);
2226-
cachedMemCache.hash = hash;
2226+
cachedMemCache.buildInfo = buildInfo;
22272227
cachedMemCache.references = computeReferences(module);
22282228
cachedMemCache.memCache = memCache;
22292229
statChanged++;
@@ -2243,7 +2243,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
22432243
} else {
22442244
infectedModules.add(module);
22452245
moduleMemCacheCache.delete(module);
2246-
statWithoutHash++;
2246+
statWithoutBuild++;
22472247
}
22482248
modulesWithoutCache.delete(module);
22492249
} else {
@@ -2252,12 +2252,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
22522252
}
22532253

22542254
for (const module of modulesWithoutCache) {
2255-
const hash = module.buildInfo && module.buildInfo.hash;
2256-
if (typeof hash === "string") {
2255+
const buildInfo = module.buildInfo && module.buildInfo.buildInfo;
2256+
if (buildInfo) {
22572257
// create a new entry
22582258
const memCache = new WeakTupleMap();
22592259
moduleMemCacheCache.set(module, {
2260-
hash: hash,
2260+
buildInfo,
22612261
references: computeReferences(module),
22622262
memCache
22632263
});
@@ -2266,7 +2266,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
22662266
statNew++;
22672267
} else {
22682268
infectedModules.add(module);
2269-
statWithoutHash++;
2269+
statWithoutBuild++;
22702270
}
22712271
}
22722272

@@ -2330,7 +2330,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
23302330
infectedModules.size
23312331
} infected of ${
23322332
this.modules.size
2333-
}) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutHash} without hash)`
2333+
}) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)`
23342334
);
23352335
}
23362336

lib/Compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class Compiler {
249249

250250
this.cache = new Cache();
251251

252-
/** @type {Map<Module, { hash: string, references: WeakMap<Dependency, Module>, memCache: WeakTupleMap }> | undefined} */
252+
/** @type {Map<Module, { buildInfo: object, references: WeakMap<Dependency, Module>, memCache: WeakTupleMap }> | undefined} */
253253
this.moduleMemCaches = undefined;
254254

255255
this.compilerPath = "";

types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ declare class Compiler {
19111911
moduleMemCaches?: Map<
19121912
Module,
19131913
{
1914-
hash: string;
1914+
buildInfo: object;
19151915
references: WeakMap<Dependency, Module>;
19161916
memCache: WeakTupleMap<any, any>;
19171917
}

0 commit comments

Comments
 (0)