File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,27 @@ export async function generateTypeScriptDeclarations({
4444 ) ;
4545 const tempOutputPath = path . join ( tempPath , outputFilename ) ;
4646 // Call into napi.rs to generate TypeScript declarations
47- // RUSTFLAGS: "-C link-arg=-undefined -C link-arg=dynamic_lookup",
48- const { task } = await napiCli . build ( {
49- verbose : false ,
50- dts : outputFilename ,
51- outputDir : tempPath ,
52- cwd : createPath ,
53- cargoOptions : [ "--quiet" ] ,
54- } ) ;
55- await task ;
47+ try {
48+ assert . equal (
49+ typeof process . env . RUSTFLAGS ,
50+ "undefined" ,
51+ "Expected RUSTFLAGS to be undefined"
52+ ) ;
53+ // Workaround to instruct the rust compiler to not worry about undefined symbols
54+ // TODO: Figure out why this is actually necessary - it should link against sys::nodeapi
55+ process . env . RUSTFLAGS =
56+ "-C link-arg=-undefined -C link-arg=dynamic_lookup" ;
57+ const { task } = await napiCli . build ( {
58+ verbose : false ,
59+ dts : outputFilename ,
60+ outputDir : tempPath ,
61+ cwd : createPath ,
62+ cargoOptions : [ "--quiet" ] ,
63+ } ) ;
64+ await task ;
65+ } finally {
66+ delete process . env . RUSTFLAGS ;
67+ }
5668 // Override the banner
5769 assert (
5870 fs . existsSync ( tempOutputPath ) ,
You can’t perform that action at this time.
0 commit comments