File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
packages/weak-node-api/scripts Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,32 @@ type GenerateFileOptions = {
1717 functions : FunctionDecl [ ] ;
1818 fileName : string ;
1919 generator : ( functions : FunctionDecl [ ] ) => string ;
20+ headingComment ?: string ;
2021} ;
2122
2223async function generateFile ( {
2324 functions,
2425 fileName,
2526 generator,
27+ headingComment = "" ,
2628} : GenerateFileOptions ) {
2729 const generated = generator ( functions ) ;
28- const output = `// This file is generated - don't edit it directly\n\n${ generated } ` ;
30+ const output = `
31+ /**
32+ * @file ${ fileName }
33+ * ${ headingComment
34+ . trim ( )
35+ . split ( "\n" )
36+ . map ( ( l ) => l . trim ( ) )
37+ . join ( "\n* " ) }
38+ *
39+ * @note This file is generated - don't edit it directly
40+ */
41+
42+ ${ generated }
43+ ` ;
2944 const outputPath = path . join ( OUTPUT_PATH , fileName ) ;
30- await fs . promises . writeFile ( outputPath , output , "utf-8" ) ;
45+ await fs . promises . writeFile ( outputPath , output . trim ( ) , "utf-8" ) ;
3146 const { status, stderr = "No error output" } = cp . spawnSync (
3247 "clang-format" ,
3348 [ "-i" , outputPath ] ,
@@ -56,6 +71,11 @@ async function run() {
5671 functions,
5772 fileName : "weak_node_api.hpp" ,
5873 generator : weakNodeApiGenerator . generateHeader ,
74+ headingComment : `
75+ @brief Weak Node-API host injection interface.
76+
77+ This header provides the struct and injection function for deferring Node-API function calls from addons into a Node-API host.
78+ ` ,
5979 } ) ;
6080 await generateFile ( {
6181 functions,
You can’t perform that action at this time.
0 commit comments