import { transpileModule } from 'typescript';
import { diagnosticsToString } from './diagnosticToString';
export function transpileFile(contents, options, basePath, moduleName) {
    const { outputText, diagnostics, sourceMapText = '' } = transpileModule(contents, {
        compilerOptions: Object.assign({}, options, { sourceMap: true }),
        moduleName,
    });
    if (diagnostics && diagnostics.length > 0) {
        throw new Error(diagnosticsToString(diagnostics, basePath));
    }
    return {
        content: outputText,
        sourceMap: sourceMapText,
    };
}
//# sourceMappingURL=transpileFile.js.map