Skip to content

refactor(oxfmt): Insert options.(parser|filepath) on Rust side#19199

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-10-refactor_oxfmt_insert_options.parser_filepath_in_rust
Feb 10, 2026
Merged

refactor(oxfmt): Insert options.(parser|filepath) on Rust side#19199
graphite-app[bot] merged 1 commit intomainfrom
02-10-refactor_oxfmt_insert_options.parser_filepath_in_rust

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Feb 10, 2026

  • Reduce work load on JS
  • Also simplify wrap_xxx() in Rust

@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Feb 10, 2026
Copy link
Member Author

leaysgur commented Feb 10, 2026


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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@leaysgur leaysgur changed the title refactor(oxfmt): Insert options.parser,filepath in Rust refactor(oxfmt): Insert options.(parser|filepath) in Rust Feb 10, 2026
@leaysgur leaysgur force-pushed the 02-10-refactor_oxfmt_insert_options.parser_filepath_in_rust branch from 3ca5682 to 757b365 Compare February 10, 2026 04:33
@leaysgur leaysgur marked this pull request as ready for review February 10, 2026 06:06
Copilot AI review requested due to automatic review settings February 10, 2026 06:06
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 refactors oxfmt’s Rust↔JS boundary for external formatting so that Rust injects parser/filepath into the Prettier options object, reducing JS-side work and simplifying the Rust wrapper callbacks.

Changes:

  • Simplify NAPI callback signatures for embedded/file formatting from (options, parserName, ...) to (options, code).
  • Move parser/filepath option injection into Rust (for both embedded formatting and non-JS/TS file formatting).
  • Add/relocate tracing spans around external formatter operations.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/oxfmt/src/main_napi.rs Updates NAPI TypeScript callback types to the new (options, code) signatures.
apps/oxfmt/src/core/format.rs Injects parser and filepath into external_options before invoking the external formatter for non-JS/TS files.
apps/oxfmt/src/core/external_formatter.rs Refactors callback type signatures to take owned Value options and injects parser for embedded formatting in Rust.
apps/oxfmt/src-js/libs/apis.ts Removes JS-side mutation of options.parser/options.filepath; assumes Rust provides them.
apps/oxfmt/src-js/index.ts Updates the Node API wrapper to pass the new callback shapes into the NAPI binding.
apps/oxfmt/src-js/cli/worker-proxy.ts Updates worker-proxy RPC functions to match the new callback signatures/params.
apps/oxfmt/src-js/bindings.d.ts Updates generated typings for format and runCli callback signatures.

@leaysgur leaysgur changed the title refactor(oxfmt): Insert options.(parser|filepath) in Rust refactor(oxfmt): Insert options.(parser|filepath) on Rust side Feb 10, 2026
@leaysgur leaysgur requested a review from Dunqing February 10, 2026 06:20
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Feb 10, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 10, 2026

Merge activity

)

- Reduce work load on JS
- Also simplify `wrap_xxx()` in Rust
@graphite-app graphite-app bot force-pushed the 02-10-refactor_oxfmt_insert_options.parser_filepath_in_rust branch from 757b365 to d1e3537 Compare February 10, 2026 07:12
@graphite-app graphite-app bot merged commit d1e3537 into main Feb 10, 2026
19 checks passed
@graphite-app graphite-app bot deleted the 02-10-refactor_oxfmt_insert_options.parser_filepath_in_rust branch February 10, 2026 07:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants