( name: string, )
| 2079 | * Use this for startup paths that should never block on network. |
| 2080 | */ |
| 2081 | export async function getMarketplaceCacheOnly( |
| 2082 | name: string, |
| 2083 | ): Promise<PluginMarketplace | null> { |
| 2084 | const fs = getFsImplementation() |
| 2085 | const configFile = getKnownMarketplacesFile() |
| 2086 | |
| 2087 | try { |
| 2088 | const content = await fs.readFile(configFile, { encoding: 'utf-8' }) |
| 2089 | const config = jsonParse(content) as KnownMarketplacesConfig |
| 2090 | const entry = config[name] |
| 2091 | |
| 2092 | if (!entry) { |
| 2093 | return null |
| 2094 | } |
| 2095 | |
| 2096 | return await readCachedMarketplace(entry.installLocation) |
| 2097 | } catch (error) { |
| 2098 | if (isENOENT(error)) { |
| 2099 | return null |
| 2100 | } |
| 2101 | logForDebugging( |
| 2102 | `Failed to read cached marketplace ${name}: ${errorMessage(error)}`, |
| 2103 | { level: 'warn' }, |
| 2104 | ) |
| 2105 | return null |
| 2106 | } |
| 2107 | } |
| 2108 | |
| 2109 | /** |
| 2110 | * Get a specific marketplace by name |
no test coverage detected