(fileName: string, explicit?: string)
| 122 | } |
| 123 | |
| 124 | export function resolveOutputFormat(fileName: string, explicit?: string): OutputFormat { |
| 125 | if (explicit && explicit in FORMAT_TO_CONTENT_TYPE) return explicit as OutputFormat |
| 126 | const ext = fileName.slice(fileName.lastIndexOf('.')).toLowerCase() |
| 127 | return EXT_TO_FORMAT[ext] ?? 'json' |
| 128 | } |
| 129 | |
| 130 | export function serializeOutputForFile(output: unknown, format: OutputFormat): string { |
| 131 | const unwrapped = unwrapFunctionExecuteOutput(output) |
no outgoing calls
no test coverage detected