@@ -2,11 +2,10 @@ import * as fs from "fs";
22import * as path from "path" ;
33import * as ts from "typescript" ;
44
5- import { parseCommandLine } from "./CommandLineParser" ;
6- import { CompilerOptions , LuaLibImportKind , LuaTarget } from "./CompilerOptions" ;
7- import { createTransformer } from "./TransformerFactory" ;
8- import { LuaTranspiler } from "./LuaTranspiler" ;
9-
5+ import { parseCommandLine } from "./CommandLineParser" ;
6+ import { CompilerOptions , LuaLibImportKind , LuaTarget } from "./CompilerOptions" ;
7+ import { LuaTranspiler } from "./LuaTranspiler" ;
8+ import { createTransformer } from "./TransformerFactory" ;
109
1110export function compile ( argv : string [ ] ) : void {
1211 const commandLine = parseCommandLine ( argv ) ;
@@ -24,19 +23,9 @@ export function watchWithOptions(fileNames: string[], options: CompilerOptions):
2423 let config = false ;
2524 if ( options . project ) {
2625 config = true ;
27- host = ts . createWatchCompilerHost (
28- options . project ,
29- options ,
30- ts . sys ,
31- ts . createSemanticDiagnosticsBuilderProgram
32- ) ;
26+ host = ts . createWatchCompilerHost ( options . project , options , ts . sys , ts . createSemanticDiagnosticsBuilderProgram ) ;
3327 } else {
34- host = ts . createWatchCompilerHost (
35- fileNames ,
36- options ,
37- ts . sys ,
38- ts . createSemanticDiagnosticsBuilderProgram
39- ) ;
28+ host = ts . createWatchCompilerHost ( fileNames , options , ts . sys , ts . createSemanticDiagnosticsBuilderProgram ) ;
4029 }
4130
4231 host . afterProgramCreate = program => {
@@ -55,19 +44,13 @@ export function watchWithOptions(fileNames: string[], options: CompilerOptions):
5544 errorDiagnostic . messageText = "Found Errors. Watching for file changes." ;
5645 errorDiagnostic . code = 6193 ;
5746 }
58- host . onWatchStatusChange (
59- errorDiagnostic ,
60- host . getNewLine ( ) ,
61- program . getCompilerOptions ( )
62- ) ;
47+ host . onWatchStatusChange ( errorDiagnostic , host . getNewLine ( ) , program . getCompilerOptions ( ) ) ;
6348 } ;
6449
6550 if ( config ) {
66- ts . createWatchProgram (
67- host as ts . WatchCompilerHostOfConfigFile < ts . SemanticDiagnosticsBuilderProgram > ) ;
51+ ts . createWatchProgram ( host as ts . WatchCompilerHostOfConfigFile < ts . SemanticDiagnosticsBuilderProgram > ) ;
6852 } else {
69- ts . createWatchProgram (
70- host as ts . WatchCompilerHostOfFilesAndCompilerOptions < ts . SemanticDiagnosticsBuilderProgram > ) ;
53+ ts . createWatchProgram ( host as ts . WatchCompilerHostOfFilesAndCompilerOptions < ts . SemanticDiagnosticsBuilderProgram > ) ;
7154 }
7255}
7356
@@ -81,11 +64,10 @@ export function compileFilesWithOptions(fileNames: string[], options: CompilerOp
8164
8265const libSource = fs . readFileSync ( path . join ( path . dirname ( require . resolve ( "typescript" ) ) , "lib.es6.d.ts" ) ) . toString ( ) ;
8366
84- export function transpileString ( str : string ,
85- options : CompilerOptions = {
86- luaLibImport : LuaLibImportKind . Require ,
87- luaTarget : LuaTarget . Lua53 ,
88- } ) : string {
67+ export function transpileString ( str : string , options : CompilerOptions = {
68+ luaLibImport : LuaLibImportKind . Require ,
69+ luaTarget : LuaTarget . Lua53 ,
70+ } ) : string {
8971 const compilerHost = {
9072 directoryExists : ( ) => true ,
9173 fileExists : ( fileName ) : boolean => true ,
0 commit comments