Skip to content

Comments

feat(napi/transform): add async transform function#13881

Merged
graphite-app[bot] merged 1 commit intomainfrom
feat/napi-transform-async
Sep 18, 2025
Merged

feat(napi/transform): add async transform function#13881
graphite-app[bot] merged 1 commit intomainfrom
feat/napi-transform-async

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Sep 18, 2025

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

Copilot AI review requested due to automatic review settings September 18, 2025 12:39
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 18, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request labels Sep 18, 2025
Copy link
Contributor

Copilot AI left a 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 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 transformAsync function that returns a Promise using NAPI's AsyncTask
  • Implemented TransformTask struct 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.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Sep 18, 2025
Copy link
Member Author

Boshen commented Sep 18, 2025

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)
@graphite-app graphite-app bot force-pushed the feat/napi-transform-async branch from e18b78c to 70c402b Compare September 18, 2025 12:44
@graphite-app graphite-app bot merged commit 70c402b into main Sep 18, 2025
17 checks passed
@graphite-app graphite-app bot deleted the feat/napi-transform-async branch September 18, 2025 12:50
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(napi): add async transform function

1 participant