( format: string | Formatter<unknown> | undefined )
| 174 | } |
| 175 | |
| 176 | async function resolveCustomFormatter( |
| 177 | format: string | Formatter<unknown> | undefined |
| 178 | ): Promise<Formatter<unknown>> { |
| 179 | if (!format) { |
| 180 | throw new Error('A custom formatter is required') |
| 181 | } |
| 182 | if (typeof format !== 'string') { |
| 183 | return format |
| 184 | } |
| 185 | try { |
| 186 | return dynamicImport(pathToFileURL(resolve(process.cwd(), format)).href) |
| 187 | } catch (e) { |
| 188 | console.error(`Cannot resolve formatter ${format}`) |
| 189 | throw e |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Compile extracted translation files with the native formatjs CLI binding and |
no test coverage detected