File tree Expand file tree Collapse file tree 5 files changed +14
-12
lines changed
Expand file tree Collapse file tree 5 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ const path = require("path");
33const tstl = require ( "./src" ) ;
44
55const configFileName = path . resolve ( __dirname , "src/lualib/tsconfig.json" ) ;
6- const { diagnostics } = tstl . transpileProject ( configFileName ) ;
6+ const { diagnostics } = tstl . transpileLuaLibProject ( configFileName ) ;
77diagnostics . forEach ( tstl . createDiagnosticReporter ( true ) ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export function getHelpString(): string {
1919
2020 result += "Options:\n" ;
2121 for ( const option of optionDeclarations ) {
22- if ( option . internal ) continue ;
2322 const aliasStrings = ( option . aliases ?? [ ] ) . map ( a => "-" + a ) ;
2423 const optionString = [ ...aliasStrings , "--" + option . name ] . join ( "|" ) ;
2524
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ interface CommandLineOptionBase {
1010 name : string ;
1111 aliases ?: string [ ] ;
1212 description : string ;
13- internal ?: boolean ;
1413}
1514
1615interface CommandLineOptionOfEnum extends CommandLineOptionBase {
@@ -84,12 +83,6 @@ export const optionDeclarations: CommandLineOption[] = [
8483 description : "An array of paths that tstl should not resolve and keep as-is." ,
8584 type : "array" ,
8685 } ,
87- {
88- name : "luaLibCompilation" ,
89- description : "Internal. Specifies if this project is lualib source." ,
90- type : "boolean" ,
91- internal : true ,
92- } ,
9386] ;
9487
9588export function updateParsedConfigFile ( parsedConfigFile : ts . ParsedCommandLine ) : ParsedCommandLine {
@@ -110,7 +103,7 @@ export function updateParsedConfigFile(parsedConfigFile: ts.ParsedCommandLine):
110103
111104 for ( const [ name , rawValue ] of Object . entries ( parsedConfigFile . raw . tstl ) ) {
112105 const option = optionDeclarations . find ( option => option . name === name ) ;
113- if ( ! option && option !== "lualibCompilation" ) {
106+ if ( ! option ) {
114107 parsedConfigFile . errors . push ( cliDiagnostics . unknownCompilerOption ( name ) ) ;
115108 continue ;
116109 }
Original file line number Diff line number Diff line change 1010 },
1111 "tstl" : {
1212 "luaLibImport" : " none" ,
13- "noHeader" : true ,
14- "luaLibCompilation" : true
13+ "noHeader" : true
1514 }
1615}
Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ export function transpileProject(
4040 return transpileFiles ( parseResult . fileNames , parseResult . options , writeFile ) ;
4141}
4242
43+ /** @internal */
44+ export function transpileLuaLibProject ( configFileName : string ) : EmitResult {
45+ const parseResult = parseConfigFileWithSystem ( configFileName ) ;
46+ if ( parseResult . errors . length > 0 ) {
47+ return { diagnostics : parseResult . errors , emitSkipped : true } ;
48+ }
49+ parseResult . options . luaLibCompilation = true ;
50+
51+ return transpileFiles ( parseResult . fileNames , parseResult . options ) ;
52+ }
53+
4354const libCache : { [ key : string ] : ts . SourceFile } = { } ;
4455
4556/** @internal */
You can’t perform that action at this time.
0 commit comments