-
Notifications
You must be signed in to change notification settings - Fork 6
More refactoring of the weak-node-api generator
#330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the weak-node-api package by renaming WeakNodeApiHost to NodeApiHost and reorganizing code generation. The changes improve code organization by separating the NodeApiHost struct generation into its own file and enhancing generated file documentation with structured comments.
Key changes:
- Renamed
WeakNodeApiHosttoNodeApiHostthroughout the codebase - Extracted
NodeApiHoststruct generation to a dedicated generator file - Added JSDoc-style file headers to all generated files
- Consolidated npm scripts with consistent naming conventions (e.g.,
prebuild:*prefix)
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/weak-node-api/tests/test_inject.cpp | Updated test references from WeakNodeApiHost to NodeApiHost |
| packages/weak-node-api/scripts/generators/weak-node-api.ts | Removed NodeApiHost struct generation, now imports from separate file |
| packages/weak-node-api/scripts/generators/NodeApiHost.ts | New file containing extracted NodeApiHost struct generation logic |
| packages/weak-node-api/scripts/generate.ts | Added file header generation with JSDoc comments for all output files |
| packages/weak-node-api/package.json | Renamed scripts to use consistent prebuild:* and generate naming |
| packages/weak-node-api/CMakeLists.txt | Added NodeApiHost.hpp to the list of public headers |
| packages/weak-node-api/.gitignore | Simplified to ignore entire /generated/ directory |
| packages/host/scripts/generate-injector.mts | Updated struct name from WeakNodeApiHost to NodeApiHost |
| packages/host/package.json | Renamed script to injector:generate for consistency |
| package.json | Removed unused prerelease script |
| .github/workflows/check.yml | Updated workflow to use renamed npm scripts |
| .changeset/slimy-parts-admire.md | Changeset documenting the rename |
weak-node-api generator
cf5e056 to
bd952a6
Compare
|
Putting this back in draft, since the the new name is crashing with symbols in the host package 🙃 |
bd952a6 to
4ab6985
Compare
4ab6985 to
0e545a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
| * Generates source code for a version script for the given Node API version. | ||
| */ | ||
| export function generateHeader(functions: FunctionDecl[]) { | ||
| export function generateHeader() { |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generateHeader function signature has been changed to accept no parameters, but it's still being called with a functions parameter in generate.ts (line 73). This will cause the functions parameter to be ignored, though the code may still work. Update the call site to pass no arguments, or restore the parameter if it's needed for future use.
| "test:gradle": "ENABLE_GRADLE_TESTS=true node --run test", | ||
| "bootstrap": "node --run generate-weak-node-api-injector", | ||
| "prerelease": "node --run generate-weak-node-api-injector" | ||
| "bootstrap": "node --run injector:generate" |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prerelease script has been removed from this package's scripts, but it's still referenced (and removed) in the root package.json. Ensure that the build/release pipeline doesn't depend on this script, as workspace packages may have had individual prerelease tasks that are no longer executed.
More refactoring (following up on #327 and #328), preparing for #329.