import { FileSystemHost , RealFileSystemHost , TransactionalFileSystem } from "../fileSystem" ; import { CompilerOptions , ts } from "../typescript" ; import { TsConfigResolver } from "./TsConfigResolver" ; export interface CompilerOptionsFromTsConfigOptions { encoding ? : string ; fileSystem ? : FileSystemHost ; } export interface CompilerOptionsFromTsConfigResult { options : CompilerOptions ; errors : ts . Diagnostic [ ] ; } param filePath param options export function getCompilerOptionsFromTsConfig ( filePath , options = { } ) { const fileSystemWrapper = new TransactionalFileSystem ( options . fileSystem || new RealFileSystemHost ( ) ) ; const tsConfigResolver = new TsConfigResolver ( fileSystemWrapper , fileSystemWrapper . getStandardizedAbsolutePath ( filePath ) , options . encoding || "utf-8" ) ; return { options : tsConfigResolver . getCompilerOptions ( ) , errors : tsConfigResolver . getErrors ( ) , } ; }