@@ -14,6 +14,7 @@ export async function precompile(
1414 includes : string [ ] ,
1515 excludes : string [ ] ,
1616 testcases : string [ ] | undefined ,
17+ flags : string ,
1718 transformFunction = join ( projectRoot , "transform" , "listFunctions.mjs" )
1819) : Promise < UnittestPackage > {
1920 // if specify testcases, use testcases for unittest
@@ -23,7 +24,7 @@ export async function precompile(
2324 const sourceCodePaths = getRelatedFiles ( includes , excludes , ( path : string ) => ! path . endsWith ( ".test.ts" ) ) ;
2425 const sourceCodeTransforms : Promise < void > [ ] = [ ] ;
2526 for ( const sourceCodePath of sourceCodePaths . values ( ) ) {
26- sourceCodeTransforms . push ( transform ( sourceCodePath , transformFunction ) ) ;
27+ sourceCodeTransforms . push ( transform ( sourceCodePath , transformFunction , flags ) ) ;
2728 }
2829 await Promise . all ( sourceCodeTransforms ) ;
2930
@@ -55,15 +56,13 @@ export function getRelatedFiles(includes: string[], excludes: string[], filter:
5556 return result ;
5657}
5758
58- async function transform ( sourceCodePath : string , transformFunction : string ) {
59- const { error, stderr } = await main ( [
60- sourceCodePath ,
61- "--noEmit" ,
62- "--disableWarning" ,
63- "--transform" ,
64- transformFunction ,
65- "-O0" ,
66- ] ) ;
59+ async function transform ( sourceCodePath : string , transformFunction : string , flags : string ) {
60+ let ascArgv = [ sourceCodePath , "--noEmit" , "--disableWarning" , "--transform" , transformFunction , "-O0" ] ;
61+ if ( flags ) {
62+ const argv = flags . split ( " " ) ;
63+ ascArgv = ascArgv . concat ( argv ) ;
64+ }
65+ const { error, stderr } = await main ( ascArgv ) ;
6766 if ( error ) {
6867 // eslint-disable-next-line @typescript-eslint/no-base-to-string
6968 console . error ( stderr . toString ( ) ) ;
0 commit comments