MCPcopy
hub / github.com/webpack/webpack / getContextHash

Method getContextHash

lib/FileSystemInfo.js:1735–1753  ·  view source on GitHub ↗

* Returns context hash. * @param {string} path context path * @param {(err?: WebpackError | null, contextHash?: string) => void} callback callback function * @returns {void}

(path, callback)

Source from the content-addressed store, hash-verified

1733 * @returns {void}
1734 */
1735 getContextHash(path, callback) {
1736 const cache = this._contextHashes.get(path);
1737 if (cache !== undefined) {
1738 const resolved = getResolvedHash(cache);
1739 if (resolved !== undefined) {
1740 return callback(null, /** @type {string} */ (resolved));
1741 }
1742 return this._resolveContextHash(cache, callback);
1743 }
1744 this.contextHashQueue.add(path, (err, _entry) => {
1745 if (err) return callback(err);
1746 const entry = /** @type {ContextHash} */ (_entry);
1747 const resolved = getResolvedHash(entry);
1748 if (resolved !== undefined) {
1749 return callback(null, /** @type {string} */ (resolved));
1750 }
1751 this._resolveContextHash(entry, callback);
1752 });
1753 }
1754
1755 /**
1756 * Get unresolved context hash.

Calls 5

_resolveContextHashMethod · 0.95
getResolvedHashFunction · 0.85
callbackFunction · 0.50
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected