File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
import fs from "fs/promises" ;
2
+ import fsSync from "fs" ;
2
3
import { dirname , join } from "path" ;
3
4
import { createRequire } from "module" ;
4
5
@@ -43,18 +44,32 @@ async function compileAllAsc() {
43
44
Object . assign ( config , m ) ;
44
45
} catch ( e ) { }
45
46
console . log ( `Compiling ${ ascFile } ...` ) ;
47
+
48
+ const wasmFile = ascFile . replace ( / \. t s $ / , ".wasm" ) ;
49
+ if ( fsSync . existsSync ( wasmFile ) ) {
50
+ await fs . unlink ( wasmFile ) ;
51
+ }
52
+
46
53
const params = [
47
54
"--runtime" ,
48
55
"stub" ,
49
56
"--exportRuntime" ,
50
57
"--transform" ,
51
58
transformFile ,
52
- "--binaryFile " ,
59
+ "--outFile " ,
53
60
ascFile . replace ( / \. t s $ / , ".wasm" ) ,
54
61
ascFile
55
62
] ;
56
63
config . mangleCompilerParams ( params ) ;
57
- await asc . main ( params ) ;
64
+ const result = await asc . main ( params , {
65
+ stderr : process . stderr ,
66
+ stdout : process . stdout
67
+ } ) ;
68
+
69
+ if ( result . error !== null ) {
70
+ console . error ( `Failed to compile ${ ascFile } ` ) ;
71
+ process . exit ( 1 ) ;
72
+ }
58
73
}
59
74
}
60
75
You can’t perform that action at this time.
0 commit comments