(
inputFiles: string[],
opts: Opts = {}
)
| 83 | * @returns serialized result in string format |
| 84 | */ |
| 85 | export async function compile( |
| 86 | inputFiles: string[], |
| 87 | opts: Opts = {} |
| 88 | ): Promise<string> { |
| 89 | debug('Compiling files:', inputFiles) |
| 90 | const { |
| 91 | ast, |
| 92 | format, |
| 93 | pseudoLocale, |
| 94 | skipErrors, |
| 95 | ignoreTag, |
| 96 | signal, |
| 97 | followLinks, |
| 98 | } = opts |
| 99 | signal?.throwIfAborted() |
| 100 | |
| 101 | if (format && !isBuiltinFormatter(format)) { |
| 102 | return compileWithCustomFormatter(inputFiles, opts) |
| 103 | } |
| 104 | |
| 105 | return compileWithNative(inputFiles, { |
| 106 | ast, |
| 107 | format: typeof format === 'string' ? format : undefined, |
| 108 | followLinks, |
| 109 | ignoreTag, |
| 110 | pseudoLocale, |
| 111 | skipErrors, |
| 112 | }) |
| 113 | } |
| 114 | |
| 115 | function isBuiltinFormatter( |
| 116 | format: string | Formatter<unknown> |
no test coverage detected