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

Method updateHash

lib/ExternalModule.js:1334–1353  ·  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

1332 * @returns {void}
1333 */
1334 updateHash(hash, context) {
1335 const { chunkGraph } = context;
1336 hash.update(
1337 `${this._resolveExternalType(this.externalType)}${JSON.stringify(
1338 this.request
1339 )}${this.isOptional(chunkGraph.moduleGraph)}`
1340 );
1341 const meta = /** @type {ImportDependencyMeta | undefined} */ (
1342 this.dependencyMeta
1343 );
1344 if (meta) {
1345 if (meta.phase) {
1346 hash.update(`|phase=${ImportPhaseUtils.stringify(meta.phase)}`);
1347 }
1348 if (meta.attributes) {
1349 hash.update(`|attributes=${JSON.stringify(meta.attributes)}`);
1350 }
1351 }
1352 super.updateHash(hash, context);
1353 }
1354
1355 /**
1356 * Serializes this instance into the provided serializer context.

Callers

nothing calls this directly

Calls 3

_resolveExternalTypeMethod · 0.95
isOptionalMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected