File tree 3 files changed +46
-2
lines changed
3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change 26
26
VERSION=${COMMIT_MESSAGE##* }
27
27
echo $COMMIT_MESSAGE
28
28
npm run --silent write-symbols
29
+ npm run --silent write-win32-def
29
30
CHANGED_FILES=$(git diff --name-only)
30
31
BRANCH_NAME="update-headers/${VERSION}"
31
32
if [ -z "$CHANGED_FILES" ]; then
Original file line number Diff line number Diff line change 47
47
},
48
48
"scripts" : {
49
49
"update-headers" : " node --no-warnings scripts/update-headers.js" ,
50
- "write-symbols" : " node --no-warnings scripts/write-symbols.js"
50
+ "write-symbols" : " node --no-warnings scripts/write-symbols.js" ,
51
+ "write-win32-def" : " node --no-warnings scripts/write-win32-def.js"
51
52
},
52
53
"version" : " 0.0.4" ,
53
54
"support" : true
54
55
}
55
-
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const { resolve : resolvePath } = require ( 'path' ) ;
4
+ const { writeFile } = require ( 'fs/promises' ) ;
5
+ const { symbols } = require ( '..' ) ;
6
+
7
+ function getNodeApiDef ( ) {
8
+ const symbolsSet = new Set ( ) ;
9
+ for ( const ver of Object . values ( symbols ) ) {
10
+ for ( const sym of ver . node_api_symbols ) {
11
+ symbolsSet . add ( sym ) ;
12
+ }
13
+ for ( const sym of ver . js_native_api_symbols ) {
14
+ symbolsSet . add ( sym ) ;
15
+ }
16
+ }
17
+ return 'NAME NODE.EXE\nEXPORTS\n' + Array . from ( symbolsSet ) . join ( '\n' ) ;
18
+ }
19
+
20
+ function getJsNativeApiDef ( ) {
21
+ const symbolsSet = new Set ( ) ;
22
+ for ( const ver of Object . values ( symbols ) ) {
23
+ for ( const sym of ver . js_native_api_symbols ) {
24
+ symbolsSet . add ( sym ) ;
25
+ }
26
+ }
27
+ return 'NAME NODE.EXE\nEXPORTS\n' + Array . from ( symbolsSet ) . join ( '\n' ) ;
28
+ }
29
+
30
+ async function main ( ) {
31
+ const nodeApiDefPath = resolvePath ( __dirname , '../node_api.def' ) ;
32
+ console . log ( `Writing Windows .def file to ${ nodeApiDefPath } ` ) ;
33
+ await writeFile ( nodeApiDefPath , getNodeApiDef ( ) ) ;
34
+
35
+ const jsNativeApiDefPath = resolvePath ( __dirname , '../js_native_api.def' ) ;
36
+ console . log ( `Writing Windows .def file to ${ jsNativeApiDefPath } ` ) ;
37
+ await writeFile ( jsNativeApiDefPath , getJsNativeApiDef ( ) ) ;
38
+ }
39
+
40
+ main ( ) . catch ( e => {
41
+ console . error ( e ) ;
42
+ process . exitCode = 1 ;
43
+ } ) ;
You can’t perform that action at this time.
0 commit comments