MCPcopy
hub / github.com/vercel/hyper / resolveOfflineCacheFolder

Function resolveOfflineCacheFolder

bin/yarn-standalone.js:105708–105726  ·  view source on GitHub ↗
(fsPath)

Source from the content-addressed store, hash-verified

105706 };
105707
105708 const resolveOfflineCacheFolder = function resolveOfflineCacheFolder(fsPath) {
105709 if (!offlineCacheFolder) {
105710 return fsPath;
105711 }
105712
105713 const cacheRelativePath = getCachePath(fsPath);
105714
105715 // if fsPath is not inside the cache, we shouldn't replace it (workspace)
105716 if (!cacheRelativePath) {
105717 return fsPath;
105718 }
105719
105720 const components = cacheRelativePath.split(/\//g);
105721 const cacheEntry = components[0],
105722 internalPath = components.slice(1);
105723
105724
105725 return path.resolve(offlineCacheFolder, `${cacheEntry}${OFFLINE_CACHE_EXTENSION}`, internalPath.join('/'));
105726 };
105727
105728 const normalizePath = function normalizePath(fsPath) {
105729 return process.platform === 'win32' ? fsPath.replace(backwardSlashRegExp, '/') : fsPath;

Callers 2

normalizeDirectoryPathFunction · 0.85
yarn-standalone.jsFile · 0.85

Calls 2

getCachePathFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected