( marketplaceName: string, )
| 70 | * Read a marketplace JSON file from the zip cache. |
| 71 | */ |
| 72 | export async function readMarketplaceJson( |
| 73 | marketplaceName: string, |
| 74 | ): Promise<PluginMarketplace | null> { |
| 75 | const zipCachePath = getPluginZipCachePath() |
| 76 | if (!zipCachePath) { |
| 77 | return null |
| 78 | } |
| 79 | const relPath = getMarketplaceJsonRelativePath(marketplaceName) |
| 80 | const fullPath = join(zipCachePath, relPath) |
| 81 | try { |
| 82 | const content = await readFile(fullPath, 'utf-8') |
| 83 | const parsed = jsonParse(content) |
| 84 | const result = PluginMarketplaceSchema().safeParse(parsed) |
| 85 | if (result.success) { |
| 86 | return result.data |
| 87 | } |
| 88 | logForDebugging( |
| 89 | `Invalid marketplace JSON for ${marketplaceName}: ${result.error}`, |
| 90 | ) |
| 91 | return null |
| 92 | } catch { |
| 93 | return null |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Save a marketplace JSON to the zip cache from its install location. |
nothing calls this directly
no test coverage detected