MCPcopy
hub / github.com/webpack/webpack / getHash

Method getHash

lib/CodeGenerationResults.js:152–164  ·  lib/CodeGenerationResults.js::CodeGenerationResults.getHash

* Returns a stable hash for the generated sources and runtime requirements, * computing and caching it on first access. * @param {Module} module the module * @param {RuntimeSpec} runtime runtime(s) * @returns {string} hash of the code generation

(module, runtime)

Source from the content-addressed store, hash-verified

150 * @returns {string} hash of the code generation
151 */
152 getHash(module, runtime) {
153 const info = this.get(module, runtime);
154 if (info.hash !== undefined) return info.hash;
155 const hash = createHash(this._hashFunction);
156 for (const [type, source] of info.sources) {
157 hash.update(type);
158 source.updateHash(hash);
159 }
160 if (info.runtimeRequirements) {
161 for (const rr of info.runtimeRequirements) hash.update(rr);
162 }
163 return (info.hash = hash.digest(class="st">"hex"));
164 }
165
166 /**
167 * Stores a code generation result for a module/runtime pair, creating the

Callers

nothing calls this directly

Calls 5

getMethod · 0.95
createHashFunction · 0.85
updateMethod · 0.45
updateHashMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected