refactor(napi/parser): move generated JS into src-js#16957
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the NAPI parser code generation paths to move generated JavaScript files into the src-js directory, aligning with the pattern used in oxlint. The changes update both the code generators (in tasks/ast_tools) and the import paths in the runtime code.
- Updates code generation output paths from
generated/tosrc-js/generated/ - Adjusts import paths in runtime code to reflect the new directory structure
- Maintains consistency with existing project patterns
Reviewed changes
Copilot reviewed 10 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tasks/ast_tools/src/generators/raw_transfer_lazy.rs | Updates output paths for lazy transfer generators and import paths within generated code |
| tasks/ast_tools/src/generators/raw_transfer.rs | Updates output paths for constants and deserializer files |
| tasks/ast_tools/src/generators/estree_visit.rs | Updates output paths for visitor-related generated files |
| napi/parser/src-js/visit/visitor.js | Adjusts import path for type_ids to remove extra directory traversal |
| napi/parser/src-js/visit/index.js | Adjusts import path for walk.js to remove extra directory traversal |
| napi/parser/src-js/raw-transfer/visitor.js | Adjusts import path for type_ids to remove extra directory traversal |
| napi/parser/src-js/raw-transfer/lazy.js | Adjusts import paths for constants, constructors, and walk to remove extra directory traversal |
| napi/parser/src-js/raw-transfer/eager.js | Adjusts require path for deserializers to remove extra directory traversal |
| napi/parser/src-js/raw-transfer/common.js | Adjusts import path for constants to remove extra directory traversal |
| napi/parser/src-js/index.js | Adjusts export path for visitorKeys to remove directory traversal |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src-jssrc-js
There was a problem hiding this comment.
I think need to update the files list in package.json too.
Note: We don't include all the files in generated folder in the NPM package. Some of the generated deserializers are only for testing, and not actually referenced in the package. So we shouldn't just include the whole src-js directory.
959b50c to
8c8b4ea
Compare
|
Yep you're right 🫣 - fixed |
overlookmotel
left a comment
There was a problem hiding this comment.
Looks good. But let's test the NPM package after next release.
We should really run tests on the built package. Right now it's too easy for tests to all pass, but for the published package to be broken. (I guess if we bundled it, that would mostly solve the problem)
Merge activity
|
08b2295 to
5d211a8
Compare
Lazy deserialization in `oxc-parser` was broken by #16957. Fix it.
…6957) moves the generated code into src-js to keep the same pattern as oxlint

moves the generated code into src-js to keep the same pattern as oxlint