feat(napi/transform): add async transform function#13881
feat(napi/transform): add async transform function#13881graphite-app[bot] merged 1 commit intomainfrom
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds an asynchronous transform function to the NAPI transform package, providing a Promise-based API alongside the existing synchronous transform function for better integration with async workflows.
- Added
transformAsyncfunction that returns a Promise using NAPI's AsyncTask - Implemented
TransformTaskstruct following the same pattern as the parser package - Added comprehensive tests to verify async behavior matches sync version
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
napi/transform/src/transformer.rs |
Core implementation of async transform with TransformTask struct |
napi/transform/test/transform.test.ts |
Test suite for async transform functionality |
napi/transform/index.js |
Export binding for transformAsync function |
napi/transform/transform.wasi.cjs |
WASI CommonJS export for transformAsync |
napi/transform/transform.wasi-browser.js |
WASI browser export for transformAsync |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
## Summary This PR adds an async transform function to the NAPI transform package, following the same pattern used in the parser package for consistency. Closes #10900 ## Changes - Added `transformAsync` function that returns a Promise - Implemented `TransformTask` struct with `napi::Task` trait - Reuses existing transform logic from the synchronous version - Added comprehensive tests to verify async behavior ## Test Plan Added tests in `test/transform.test.ts` that verify: - Async function works correctly - Produces identical results to sync version - Properly handles errors All existing tests continue to pass. 🤖 Generated with [Claude Code](https://claude.ai/code)
e18b78c to
70c402b
Compare
Summary
This PR adds an async transform function to the NAPI transform package, following the same pattern used in the parser package for consistency.
Closes #10900
Changes
transformAsyncfunction that returns a PromiseTransformTaskstruct withnapi::TasktraitTest Plan
Added tests in
test/transform.test.tsthat verify:All existing tests continue to pass.
🤖 Generated with Claude Code