MCPcopy
hub / github.com/webpack/webpack / provide

Method provide

lib/CacheFacade.js:349–361  ·  view source on GitHub ↗

* Processes the provided identifier. * @template T * @param {string} identifier the cache identifier * @param {Etag | null} etag the etag * @param {(callback: CallbackNormalErrorCache<T>) => void} computer function to compute the value if not cached * @param {CallbackNormalErrorCache<T>} c

(identifier, etag, computer, callback)

Source from the content-addressed store, hash-verified

347 * @returns {void}
348 */
349 provide(identifier, etag, computer, callback) {
350 this.get(identifier, etag, (err, cacheEntry) => {
351 if (err) return callback(err);
352 if (cacheEntry !== undefined) return cacheEntry;
353 computer((err, result) => {
354 if (err) return callback(err);
355 this.store(identifier, etag, result, (err) => {
356 if (err) return callback(err);
357 callback(null, result);
358 });
359 });
360 });
361 }
362
363 /**
364 * Returns promise with the data.

Callers 4

getBlockModulesFunction · 0.45

Calls 3

getMethod · 0.95
storeMethod · 0.95
callbackFunction · 0.50

Tested by

no test coverage detected