( cwd: string, pathValue: string )
| 119 | * Resolves and caches the full CLI resolution, including miss diagnostics. |
| 120 | */ |
| 121 | export function resolveCachedCliInvocation( |
| 122 | cwd: string, |
| 123 | pathValue: string |
| 124 | ): Promise< |
| 125 | | ResolvedVercelCliInvocation |
| 126 | | { |
| 127 | found: false; |
| 128 | diagnostics: ResolutionDiagnostics; |
| 129 | } |
| 130 | > { |
| 131 | const cacheKey = getCliInvocationCacheKey(cwd, pathValue); |
| 132 | |
| 133 | if (cliInvocationCache.has(cacheKey)) { |
| 134 | return cliInvocationCache.get(cacheKey)!; |
| 135 | } |
| 136 | |
| 137 | const resolution = resolveCliInvocation(cwd, pathValue).catch(error => { |
| 138 | cliInvocationCache.delete(cacheKey); |
| 139 | throw error; |
| 140 | }); |
| 141 | |
| 142 | cliInvocationCache.set(cacheKey, resolution); |
| 143 | return resolution; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Removes internal resolution diagnostics from a successful CLI lookup result. |
no test coverage detected