File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export interface TypeScriptToLuaOptions {
4747 lua51AllowTryCatchInAsyncAwait ?: boolean ;
4848 measurePerformance ?: boolean ;
4949 luaLibName ?: string ;
50+ luaLibEmit ?: boolean ;
5051}
5152
5253export type CompilerOptions = OmitIndexSignature < ts . CompilerOptions > &
Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ export const optionDeclarations: CommandLineOption[] = [
5656 description : "The name of the file to store Lua library features in." ,
5757 type : "string" ,
5858 } ,
59+ {
60+ name : "luaLibEmit" ,
61+ description : "Whether the Lua library file is emitted with the code. Only effective when luaLibImport is require." ,
62+ type : "boolean" ,
63+ } ,
5964 {
6065 name : "luaTarget" ,
6166 aliases : [ "lt" ] ,
Original file line number Diff line number Diff line change @@ -132,9 +132,11 @@ export class Transpiler {
132132 console . log ( "Including lualib bundle" ) ;
133133 }
134134 // Add lualib bundle to source dir 'virtually', will be moved to correct output dir in emitPlan
135- const fileName = normalizeSlashes ( path . resolve ( getSourceDir ( program ) , ( options . luaLibName ?? "lualib_bundle" ) + ".lua" ) ) ;
136- const code = this . getLuaLibBundleContent ( options , resolutionResult . resolvedFiles ) ;
137- resolutionResult . resolvedFiles . unshift ( { fileName, code } ) ;
135+ if ( options . luaLibEmit !== false ) {
136+ const fileName = normalizeSlashes ( path . resolve ( getSourceDir ( program ) , ( options . luaLibName ?? "lualib_bundle" ) + ".lua" ) ) ;
137+ const code = this . getLuaLibBundleContent ( options , resolutionResult . resolvedFiles ) ;
138+ resolutionResult . resolvedFiles . unshift ( { fileName, code } ) ;
139+ }
138140 }
139141
140142 let emitPlan : EmitFile [ ] ;
Original file line number Diff line number Diff line change 5151 "type" : " string" ,
5252 "default" : " lualib_bundle"
5353 },
54+ "luaLibEmit" : {
55+ "description" : " Whether the Lua library file is emitted with the code. Only effective when luaLibImport is require." ,
56+ "type" : " boolean" ,
57+ "default" : true
58+ },
5459 "luaTarget" : {
5560 "description" : " Specifies the Lua version you want to generate code for." ,
5661 "type" : " string" ,
You can’t perform that action at this time.
0 commit comments