Function
resolveBuiltinFormatter
(
format?: string | Formatter<unknown>
)
Source from the content-addressed store, hash-verified
| 21 | } |
| 22 | |
| 23 | export async function resolveBuiltinFormatter( |
| 24 | format?: string | Formatter<unknown> |
| 25 | ): Promise<any> { |
| 26 | if (!format) { |
| 27 | return defaultFormatter |
| 28 | } |
| 29 | if (typeof format !== 'string') { |
| 30 | return format |
| 31 | } |
| 32 | switch (format) { |
| 33 | case 'transifex': |
| 34 | return transifex |
| 35 | case 'smartling': |
| 36 | return smartling |
| 37 | case 'simple': |
| 38 | return simple |
| 39 | case 'lokalise': |
| 40 | return lokalise |
| 41 | case 'crowdin': |
| 42 | return crowdin |
| 43 | } |
| 44 | try { |
| 45 | // eslint-disable-next-line import/dynamic-import-chunkname |
| 46 | return import(pathToFileURL(resolve(process.cwd(), format)).href) |
| 47 | } catch (e) { |
| 48 | console.error(`Cannot resolve formatter ${format}`) |
| 49 | throw e |
| 50 | } |
| 51 | } |
Tested by
no test coverage detected