(folder: string, label: string, toolConfig: unknown)
| 185 | } |
| 186 | |
| 187 | function validateLanguageToolConfig(folder: string, label: string, toolConfig: unknown): void { |
| 188 | if (!toolConfig || typeof toolConfig !== "object" || Array.isArray(toolConfig)) { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | const tool = toolConfig as { |
| 193 | name?: unknown; |
| 194 | runtime?: unknown; |
| 195 | downloadUrl?: unknown; |
| 196 | }; |
| 197 | const name = typeof tool.name === "string" ? tool.name : undefined; |
| 198 | const runtime = typeof tool.runtime === "string" ? tool.runtime : undefined; |
| 199 | |
| 200 | if (!name) { |
| 201 | error(folder, `${label} tool missing 'name'`); |
| 202 | return; |
| 203 | } |
| 204 | |
| 205 | if (!runtime) { |
| 206 | error(folder, `${label} tool '${name}' missing 'runtime'`); |
| 207 | return; |
| 208 | } |
| 209 | |
| 210 | if (!validToolRuntimes.has(runtime)) { |
| 211 | error(folder, `${label} tool '${name}' has invalid runtime '${runtime}'`); |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | if (runtime === "system" && tool.downloadUrl !== undefined) { |
| 216 | error(folder, `${label} system tool '${name}' must not declare 'downloadUrl'`); |
| 217 | } |
| 218 | |
| 219 | if ( |
| 220 | runtime === "binary" && |
| 221 | typeof tool.downloadUrl !== "string" && |
| 222 | !knownBinaryInstallStrategyTools.has(name) && |
| 223 | !knownRuntimeRewriteTools.has(name) |
| 224 | ) { |
| 225 | error( |
| 226 | folder, |
| 227 | `${label} binary tool '${name}' needs 'downloadUrl', a known install strategy, or runtime 'system'`, |
| 228 | ); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | function validateLanguageToolConfigs(folder: string, manifest: Record<string, unknown>): void { |
| 233 | const capabilities = |
no test coverage detected