MCPcopy
hub / github.com/webpack/webpack / updateHash

Method updateHash

lib/NormalModule.js:2256–2277  ·  view source on GitHub ↗

* Updates the hash with the data contributed by this instance. * @param {Hash} hash the hash used to track dependencies * @param {UpdateHashContext} context context * @returns {void}

(hash, context)

Source from the content-addressed store, hash-verified

2254 * @returns {void}
2255 */
2256 updateHash(hash, context) {
2257 const buildInfo = /** @type {NormalModuleBuildInfo} */ (this.buildInfo);
2258 hash.update(
2259 /** @type {string} */
2260 (buildInfo.hash)
2261 );
2262 // Clear cached source types and re-compute so that changes in incoming
2263 // connections (e.g. asset module newly referenced from JS via lazy
2264 // compilation) are reflected in the hash and trigger code generation
2265 // cache invalidation.
2266 // https://github.com/webpack/webpack/issues/20800
2267 this._sourceTypes = undefined;
2268 for (const type of this.getSourceTypes()) {
2269 hash.update(type);
2270 }
2271 /** @type {Generator} */
2272 (this.generator).updateHash(hash, {
2273 module: this,
2274 ...context
2275 });
2276 super.updateHash(hash, context);
2277 }
2278
2279 /**
2280 * Serializes this instance into the provided serializer context.

Callers 1

_initBuildHashMethod · 0.45

Calls 2

getSourceTypesMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected