MCPcopy
hub / github.com/webpack/webpack / processCapturedDirectories

Method processCapturedDirectories

lib/FileSystemInfo.js:2713–2871  ·  view source on GitHub ↗
(capturedDirectories)

Source from the content-addressed store, hash-verified

2711 * @param {ManagedContexts} capturedDirectories captured directories
2712 */
2713 const processCapturedDirectories = (capturedDirectories) => {
2714 if (capturedDirectories.size === 0) {
2715 return;
2716 }
2717 switch (mode) {
2718 case 3:
2719 this._contextTshsOptimization.optimize(snapshot, capturedDirectories);
2720 for (const path of capturedDirectories) {
2721 const cache = this._contextTshs.get(path);
2722 /** @type {ResolvedContextTimestampAndHash | null | undefined} */
2723 let resolved;
2724 if (
2725 cache !== undefined &&
2726 (resolved = getResolvedTimestamp(cache)) !== undefined
2727 ) {
2728 contextTshs.set(path, resolved);
2729 } else {
2730 jobs++;
2731 /**
2732 * Processes the provided err.
2733 * @param {(WebpackError | null)=} err error
2734 * @param {(ResolvedContextTimestampAndHash | null)=} entry entry
2735 * @returns {void}
2736 */
2737 const callback = (err, entry) => {
2738 if (err) {
2739 if (this.logger) {
2740 this.logger.debug(
2741 `Error snapshotting context timestamp hash combination of ${path}: ${err.stack}`
2742 );
2743 }
2744 jobError();
2745 } else {
2746 contextTshs.set(
2747 path,
2748 /** @type {ResolvedContextTimestampAndHash | null} */
2749 (entry)
2750 );
2751 jobDone();
2752 }
2753 };
2754 if (cache !== undefined) {
2755 this._resolveContextTsh(cache, callback);
2756 } else {
2757 this.getContextTsh(path, callback);
2758 }
2759 }
2760 }
2761 break;
2762 case 2:
2763 this._contextHashesOptimization.optimize(
2764 snapshot,
2765 capturedDirectories
2766 );
2767 for (const path of capturedDirectories) {
2768 const cache = this._contextHashes.get(path);
2769 /** @type {undefined | null | string} */
2770 let resolved;

Callers

nothing calls this directly

Calls 12

_resolveContextTshMethod · 0.95
getContextTshMethod · 0.95
_resolveContextHashMethod · 0.95
getContextHashMethod · 0.95
getResolvedTimestampFunction · 0.85
getResolvedHashFunction · 0.85
isExistenceOnlyFunction · 0.85
optimizeMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected