MCPcopy
hub / github.com/webpack/webpack / processContextHashSnapshot

Method processContextHashSnapshot

lib/FileSystemInfo.js:3457–3490  ·  view source on GitHub ↗
(path, hash)

Source from the content-addressed store, hash-verified

3455 * @param {string | null} hash hash
3456 */
3457 const processContextHashSnapshot = (path, hash) => {
3458 const cache = this._contextHashes.get(path);
3459 /** @type {undefined | null | string} */
3460 let resolved;
3461 if (
3462 cache !== undefined &&
3463 (resolved = getResolvedHash(cache)) !== undefined
3464 ) {
3465 if (!checkHash(path, resolved, hash)) {
3466 invalid();
3467 }
3468 } else {
3469 jobs++;
3470 /**
3471 * Processes the provided err.
3472 * @param {(WebpackError | null)=} err err
3473 * @param {string=} entry entry
3474 * @returns {void}
3475 */
3476 const callback = (err, entry) => {
3477 if (err) return invalidWithError(path, err);
3478 if (!checkHash(path, /** @type {string} */ (entry), hash)) {
3479 invalid();
3480 } else {
3481 jobDone();
3482 }
3483 };
3484 if (cache !== undefined) {
3485 this._resolveContextHash(cache, callback);
3486 } else {
3487 this.getContextHash(path, callback);
3488 }
3489 }
3490 };
3491 if (snapshot.hasContextHashes()) {
3492 const contextHashes =
3493 /** @type {ContextHashes} */

Callers

nothing calls this directly

Calls 4

_resolveContextHashMethod · 0.95
getContextHashMethod · 0.95
getResolvedHashFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected