@@ -14,6 +14,7 @@ export async function precompile(
14
14
includes : string [ ] ,
15
15
excludes : string [ ] ,
16
16
testcases : string [ ] | undefined ,
17
+ flags : string ,
17
18
transformFunction = join ( projectRoot , "transform" , "listFunctions.mjs" )
18
19
) : Promise < UnittestPackage > {
19
20
// if specify testcases, use testcases for unittest
@@ -23,7 +24,7 @@ export async function precompile(
23
24
const sourceCodePaths = getRelatedFiles ( includes , excludes , ( path : string ) => ! path . endsWith ( ".test.ts" ) ) ;
24
25
const sourceCodeTransforms : Promise < void > [ ] = [ ] ;
25
26
for ( const sourceCodePath of sourceCodePaths . values ( ) ) {
26
- sourceCodeTransforms . push ( transform ( sourceCodePath , transformFunction ) ) ;
27
+ sourceCodeTransforms . push ( transform ( sourceCodePath , transformFunction , flags ) ) ;
27
28
}
28
29
await Promise . all ( sourceCodeTransforms ) ;
29
30
@@ -55,15 +56,20 @@ export function getRelatedFiles(includes: string[], excludes: string[], filter:
55
56
return result ;
56
57
}
57
58
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 = [
61
+ sourceCodePath ,
62
+ "--noEmit" ,
63
+ "--disableWarning" ,
64
+ "--transform" ,
65
+ transformFunction ,
66
+ "-O0" ,
67
+ ]
68
+ if ( flags ) {
69
+ const argv = flags . split ( " " ) ;
70
+ ascArgv = ascArgv . concat ( argv ) ;
71
+ }
72
+ const { error, stderr } = await main ( ascArgv ) ;
67
73
if ( error ) {
68
74
// eslint-disable-next-line @typescript-eslint/no-base-to-string
69
75
console . error ( stderr . toString ( ) ) ;
0 commit comments