MCPcopy
hub / github.com/webpack/webpack / _getCacheKey

Method _getCacheKey

lib/schemes/HttpUriPlugin.js:565–579  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

563 * @returns {string} the key
564 */
565 const _getCacheKey = (url) => {
566 const parsedUrl = new URL(url);
567 const folder = toSafePath(parsedUrl.origin);
568 const name = toSafePath(parsedUrl.pathname);
569 const query = toSafePath(parsedUrl.search);
570 let ext = extname(name);
571 if (ext.length > 20) ext = "";
572 const basename = ext ? name.slice(0, -ext.length) : name;
573 const hash = createHash(hashFunction);
574 hash.update(url);
575 const digest = hash.digest(hashDigest).slice(0, hashDigestLength);
576 return `${folder.slice(-50)}/${`${basename}${
577 query ? `_${query}` : ""
578 }`.slice(0, 150)}_${digest}${ext}`;
579 };
580
581 const getLockfile = cachedWithoutKey(
582 /**

Callers

nothing calls this directly

Calls 6

toSafePathFunction · 0.85
extnameFunction · 0.85
createHashFunction · 0.85
sliceMethod · 0.80
updateMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected