( getValidator: unknown, data: unknown, where: string )
| 102 | } |
| 103 | |
| 104 | const validated = ( |
| 105 | getValidator: unknown, |
| 106 | data: unknown, |
| 107 | where: string |
| 108 | ): PrecompilePluginOptions => { |
| 109 | // e.g. { "members": {...} }, an option written beside "precompile" |
| 110 | for (const key in data as object) { |
| 111 | const option = { [key]: (data as Record<string, unknown>)[key] } |
| 112 | if ( |
| 113 | !("issues" in validators.PrecompileOptions()(option, undefined, null)) |
| 114 | ) { |
| 115 | throw new Error( |
| 116 | `${where}${key} must be set in precompile, as in ${JSON.stringify({ precompile: option })}` |
| 117 | ) |
| 118 | } |
| 119 | } |
| 120 | validate(getValidator as never, data, where) |
| 121 | return (data as { precompile?: PrecompilePluginOptions }).precompile ?? {} |
| 122 | } |
| 123 | |
| 124 | // what the call sets over what ark.json does, before any preset |
| 125 | export const withSettingsFile = <opts extends PrecompilePluginOptions>( |
no test coverage detected