Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Nov 13, 2025

closes #15576

Summary

Standardizes function naming across all NAPI packages (parser, transform, minify) with a consistent pattern:

  • Async functions: verb (no suffix)
  • Sync functions: verbSync (with Sync suffix)

Changes

Breaking Changes

napi/parser:

  • parseAsyncparse (async)
  • parseSync remains unchanged (sync)

napi/transform:

  • transformAsynctransform (async)
  • transformtransformSync (sync)
  • isolatedDeclarationisolatedDeclarationSync (sync)
  • Added new isolatedDeclaration function (async)
  • moduleRunnerTransformmoduleRunnerTransformSync (sync)
  • Added new moduleRunnerTransform function (async)

napi/minify:

  • minifyminifySync (sync)
  • Added new minify function (async)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings November 13, 2025 06:54
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 13, 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-parser Area - Parser A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request labels Nov 13, 2025
@Boshen Boshen requested a review from sapphi-red November 13, 2025 06:55
@Boshen Boshen self-assigned this Nov 13, 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 standardizes the naming convention for synchronous and asynchronous functions across all NAPI packages (parser, transform, minify), establishing a consistent pattern where async functions use the base verb name and sync functions use a Sync suffix.

Key Changes

  • Renamed async functions: parseAsyncparse, transformAsynctransform, and introduced new async minify, isolatedDeclaration, and moduleRunnerTransform functions
  • Renamed sync functions: transformtransformSync, minifyminifySync, isolatedDeclarationisolatedDeclarationSync, moduleRunnerTransformmoduleRunnerTransformSync
  • Enhanced documentation: Added comprehensive API documentation to all README files with clear function signatures and usage guidance

Reviewed Changes

Copilot reviewed 29 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
napi/transform/src/transformer.rs Refactored to extract shared logic into transform_impl and module_runner_transform_impl; renamed functions to follow new convention
napi/transform/src/isolated_declaration.rs Refactored to extract shared logic into isolated_declaration_impl; added async variant
napi/transform/test/*.ts Updated all test files to use new function names; simplified async tests to verify equivalence with sync
napi/transform/*.js Updated all exports to include both sync and async function variants
napi/parser/src/lib.rs Renamed parse_async to parse; refactored to use parse_impl
napi/parser/src/raw_transfer.rs Renamed parse_async_raw to parse_raw
napi/parser/src-js/*.js Updated parser exports and raw transfer implementations to use new naming
napi/parser/test/*.ts Updated all parser tests to use parse instead of parseAsync
napi/minify/src/lib.rs Refactored to extract shared logic into minify_impl; added async variant
napi/minify/test/*.ts Updated all minify tests to use new function names
napi/minify/*.js Updated all exports to include both sync and async function variants
napi/*/README.md Added comprehensive API documentation with function signatures and usage guidance
napi/*/index.d.ts Updated TypeScript definitions to reflect new function names and return types
napi/playground/index.d.ts Added new properties to OxcSortImportsOptions (unrelated to main PR purpose)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Boshen Boshen force-pushed the feat/napi-consistent-naming branch 3 times, most recently from cd459e7 to d86e3de Compare November 13, 2025 07:24
@Boshen Boshen force-pushed the feat/napi-consistent-naming branch 2 times, most recently from 9f3c8eb to 8eac59c Compare November 13, 2025 08:42
@Boshen Boshen force-pushed the feat/napi-consistent-naming branch 3 times, most recently from 4b812c7 to c0a268e Compare November 13, 2025 12:10
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 13, 2025
Copy link
Member Author

Boshen commented Nov 13, 2025

Merge activity

@Boshen Boshen changed the title feat(napi)!: standardize function naming with async/sync suffixes feat(napi)!: standardize function naming with sync suffixes Nov 13, 2025
closes #15576

## Summary

Standardizes function naming across all NAPI packages (parser, transform, minify) with a consistent pattern:
- Async functions: `verb` (no suffix)
- Sync functions: `verbSync` (with Sync suffix)

## Changes

### Breaking Changes

**napi/parser:**
- `parseAsync` → `parse` (async)
- `parseSync` remains unchanged (sync)

**napi/transform:**
- `transformAsync` → `transform` (async)
- `transform` → `transformSync` (sync)
- `isolatedDeclaration` → `isolatedDeclarationSync` (sync)
- Added new `isolatedDeclaration` function (async)
- `moduleRunnerTransform` → `moduleRunnerTransformSync` (sync)
- Added new `moduleRunnerTransform` function (async)

**napi/minify:**
- `minify` → `minifySync` (sync)
- Added new `minify` function (async)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot force-pushed the feat/napi-consistent-naming branch from c0a268e to ea51b0b Compare November 13, 2025 12:28
@graphite-app graphite-app bot merged commit ea51b0b into main Nov 13, 2025
18 checks passed
@graphite-app graphite-app bot deleted the feat/napi-consistent-naming branch November 13, 2025 12:33
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 13, 2025
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 15, 2025
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 15, 2025
graphite-app bot pushed a commit that referenced this pull request Nov 17, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync suffixes (#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses (#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (#15727) (sapphi-red)
- b7404bc parser: Improve error message for missing function body (#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not enabled (#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict` directives for DCE (#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (#15700) (overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses (#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when binding `TSModuleDeclaration`s (#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (#15746) (sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment` check (#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using `get_binding_identifiers` (#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (#15717) (overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in `TSModuleDeclarationBody::as_module_block_mut` (#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of `TSModuleDeclaration::has_use_strict_directive` (#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (#15697) (overlookmotel)
overlookmotel pushed a commit that referenced this pull request Nov 17, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync
suffixes (#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses
(#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (#15727)
(sapphi-red)
- b7404bc parser: Improve error message for missing function body
(#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not
enabled (#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict`
directives for DCE (#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (#15700)
(overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses
(#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when
binding `TSModuleDeclaration`s (#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (#15746)
(sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment`
check (#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using
`get_binding_identifiers` (#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (#15717)
(overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in
`TSModuleDeclarationBody::as_module_block_mut` (#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of
`TSModuleDeclaration::has_use_strict_directive` (#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (#15697)
(overlookmotel)
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 17, 2025
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 17, 2025
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 17, 2025
camc314 added a commit to camc314/rolldown that referenced this pull request Nov 17, 2025
Boshen pushed a commit to camc314/rolldown that referenced this pull request Nov 17, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync
suffixes (oxc-project#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses
(oxc-project#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (oxc-project#15727)
(sapphi-red)
- b7404bc parser: Improve error message for missing function body
(oxc-project#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not
enabled (oxc-project#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict`
directives for DCE (oxc-project#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (oxc-project#15700)
(overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses
(oxc-project#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when
binding `TSModuleDeclaration`s (oxc-project#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (oxc-project#15746)
(sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment`
check (oxc-project#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (oxc-project#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using
`get_binding_identifiers` (oxc-project#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (oxc-project#15717)
(overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in
`TSModuleDeclarationBody::as_module_block_mut` (oxc-project#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of
`TSModuleDeclaration::has_use_strict_directive` (oxc-project#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (oxc-project#15697)
(overlookmotel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier A-parser Area - Parser 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.

napi: align API signature

3 participants