MCPcopy
hub / github.com/webpack/webpack / finishWith

Method finishWith

lib/schemes/HttpUriPlugin.js:840–883  ·  view source on GitHub ↗
(partialResult)

Source from the content-addressed store, hash-verified

838 * @returns {void}
839 */
840 const finishWith = (partialResult) => {
841 if ("location" in partialResult) {
842 logger.debug(
843 `GET ${url} [${res.statusCode}] -> ${partialResult.location}`
844 );
845 } else {
846 logger.debug(
847 `GET ${url} [${res.statusCode}] ${Math.ceil(
848 partialResult.content.length / 1024
849 )} kB${!storeLock ? " no-cache" : ""}`
850 );
851 }
852 const result = {
853 ...partialResult,
854 fresh: true,
855 storeLock,
856 storeCache,
857 validUntil,
858 etag
859 };
860 if (!storeCache) {
861 logger.log(
862 `${url} can't be stored in cache, due to Cache-Control header: ${cacheControl}`
863 );
864 return callback(null, result);
865 }
866 cache.store(
867 url,
868 null,
869 {
870 ...result,
871 fresh: false
872 },
873 (err) => {
874 if (err) {
875 logger.warn(
876 `${url} can't be stored in cache: ${err.message}`
877 );
878 logger.debug(err.stack);
879 }
880 callback(null, result);
881 }
882 );
883 };
884 if (res.statusCode === 304) {
885 const result = /** @type {FetchResult} */ (cachedResult);
886 if (

Callers

nothing calls this directly

Calls 5

debugMethod · 0.80
logMethod · 0.80
warnMethod · 0.80
callbackFunction · 0.50
storeMethod · 0.45

Tested by

no test coverage detected