11import * as fs from "fs" ;
22import * as path from "path" ;
33import * as ts from "typescript" ;
4- import { parseConfigFileContent } from "./CommandLineParser" ;
4+ import { parseConfigFileWithSystem } from "./CommandLineParser" ;
55import { CompilerOptions } from "./CompilerOptions" ;
66import { getTranspileOutput , TranspilationResult , TranspiledFile } from "./Transpile" ;
77
8- export { parseConfigFileContent } from "./CommandLineParser" ;
8+ export { parseCommandLine , ParsedCommandLine , updateParsedConfigFile } from "./CommandLineParser" ;
99export { CompilerOptions , LuaLibImportKind , LuaTarget } from "./CompilerOptions" ;
1010export * from "./Emit" ;
1111export * from "./LuaAST" ;
@@ -30,17 +30,12 @@ export function transpileFiles(
3030}
3131
3232export function transpileProject ( fileName : string , options ?: CompilerOptions ) : TranspilationResult {
33- const parseResult = parseConfigFileContent (
34- fs . readFileSync ( fileName , "utf8" ) ,
35- fileName ,
36- options
37- ) ;
38- if ( parseResult . isValid === false ) {
39- // TODO: Return diagnostics
40- throw new Error ( parseResult . errorMessage ) ;
33+ const parseResult = parseConfigFileWithSystem ( fileName , options ) ;
34+ if ( parseResult . errors . length > 0 ) {
35+ return { diagnostics : parseResult . errors , transpiledFiles : new Map ( ) } ;
4136 }
4237
43- return transpileFiles ( parseResult . result . fileNames , parseResult . result . options ) ;
38+ return transpileFiles ( parseResult . fileNames , parseResult . options ) ;
4439}
4540
4641const libCache : { [ key : string ] : ts . SourceFile } = { } ;
0 commit comments