@@ -8,8 +8,7 @@ import { assert, cast, isNonNull, normalizeSlashes, trimExtension } from "../uti
88import { Chunk , modulesToBundleChunks , modulesToChunks } from "./chunk" ;
99import { createResolutionErrorDiagnostic } from "./diagnostics" ;
1010import { buildModule , Module } from "./module" ;
11- import { Transpiler } from "./transpiler" ;
12- import { EmitHost } from "./utils" ;
11+ import { Transpiler , TranspilerHost } from "./transpiler" ;
1312
1413export class Transpilation {
1514 public readonly diagnostics : ts . Diagnostic [ ] = [ ] ;
@@ -18,27 +17,27 @@ export class Transpilation {
1817 public options = this . program . getCompilerOptions ( ) as CompilerOptions ;
1918 public rootDir : string ;
2019 public outDir : string ;
21- public emitHost : EmitHost ;
20+ public host : TranspilerHost ;
2221
2322 private readonly implicitScriptExtensions = [ ".ts" , ".tsx" , ".js" , ".jsx" ] as const ;
2423 protected resolver : Resolver ;
2524
2625 constructor ( public transpiler : Transpiler , public program : ts . Program ) {
27- this . emitHost = transpiler . emitHost ;
26+ this . host = transpiler . host ;
2827
2928 const { rootDir } = program . getCompilerOptions ( ) ;
3029 this . rootDir =
3130 // getCommonSourceDirectory ignores provided rootDir when TS6059 is emitted
3231 rootDir == null
3332 ? program . getCommonSourceDirectory ( )
34- : ts . getNormalizedAbsolutePath ( rootDir , this . emitHost . getCurrentDirectory ( ) ) ;
33+ : ts . getNormalizedAbsolutePath ( rootDir , this . host . getCurrentDirectory ( ) ) ;
3534
3635 this . outDir = this . options . outDir ?? this . rootDir ;
3736
3837 this . resolver = ResolverFactory . createResolver ( {
3938 extensions : [ ".lua" , ...this . implicitScriptExtensions ] ,
4039 conditionNames : [ "lua" , `lua:${ this . options . luaTarget ?? LuaTarget . Universal } ` ] ,
41- fileSystem : this . emitHost . resolutionFileSystem ?? fs ,
40+ fileSystem : this . host . resolutionFileSystem ?? fs ,
4241 useSyncFileSystemCalls : true ,
4342 } ) ;
4443 }
@@ -50,7 +49,7 @@ export class Transpilation {
5049 const lualibRequired = this . modules . some ( m => m . code . toString ( ) . includes ( 'require("lualib_bundle")' ) ) ;
5150 if ( lualibRequired ) {
5251 const fileName = normalizeSlashes ( path . resolve ( this . rootDir , "lualib_bundle.lua" ) ) ;
53- this . modules . unshift ( { request : fileName , code : getLuaLibBundle ( this . emitHost ) , isBuilt : true } ) ;
52+ this . modules . unshift ( { request : fileName , code : getLuaLibBundle ( this . host ) , isBuilt : true } ) ;
5453 }
5554
5655 return this . mapModulesToChunks ( this . modules ) ;
@@ -86,7 +85,7 @@ export class Transpilation {
8685 // TODO: Load source map files
8786 module = {
8887 request : resolvedPath ,
89- code : cast ( this . emitHost . readFile ( resolvedPath ) , isNonNull ) ,
88+ code : cast ( this . host . readFile ( resolvedPath ) , isNonNull ) ,
9089 isBuilt : false ,
9190 } ;
9291
0 commit comments