MCPcopy
hub / github.com/webpack/webpack / storeResult

Method storeResult

lib/schemes/HttpUriPlugin.js:683–702  ·  view source on GitHub ↗
(lockfile, url, result, callback)

Source from the content-addressed store, hash-verified

681 * @returns {void}
682 */
683 const storeResult = (lockfile, url, result, callback) => {
684 if (result.storeLock) {
685 storeLockEntry(lockfile, url, result.entry);
686 if (!cacheLocation || !result.content) {
687 return callback(null, result);
688 }
689 const key = getCacheKey(result.entry.resolved);
690 const filePath = join(intermediateFs, cacheLocation, key);
691 mkdirp(intermediateFs, dirname(intermediateFs, filePath), (err) => {
692 if (err) return callback(err);
693 intermediateFs.writeFile(filePath, result.content, (err) => {
694 if (err) return callback(err);
695 callback(null, result);
696 });
697 });
698 } else {
699 storeLockEntry(lockfile, url, "no-cache");
700 callback(null, result);
701 }
702 };
703
704 for (const { scheme, fetch } of schemes) {
705 /**

Callers

nothing calls this directly

Calls 5

joinFunction · 0.85
mkdirpFunction · 0.85
dirnameFunction · 0.85
callbackFunction · 0.50
writeFileMethod · 0.45

Tested by

no test coverage detected