Skip to content

feat(napi/parser, napi/transform): accept sourceType: "commonjs"#18197

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_
Jan 19, 2026
Merged

feat(napi/parser, napi/transform): accept sourceType: "commonjs"#18197
graphite-app[bot] merged 1 commit intomainfrom
om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 18, 2026

#18089 added support in parser for commonjs source type.

Extend this support to the NAPI packages - accept sourceType: 'commonjs' in options for oxc-parser and oxc-transform.

@github-actions github-actions bot added A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-transformer Area - Transformer / Transpiler A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request labels Jan 18, 2026
Copy link
Member Author

overlookmotel commented Jan 18, 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.

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 extends support for the commonjs source type to NAPI packages (oxc-parser and oxc-transform), building on the parser support added in #18089. The change allows users to explicitly specify sourceType: 'commonjs' when parsing or transforming code.

Changes:

  • Updated TypeScript type definitions across parser, transform, and oxlint packages to include 'commonjs' as a valid sourceType option
  • Added implementation support in the shared get_source_type function to handle the 'commonjs' case
  • Added comprehensive test coverage for the new commonjs source type in the parser package

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
napi/transform/src/transformer.rs Updated TypeScript type annotation to include 'commonjs' option
napi/transform/index.d.ts Updated TypeScript interface to include 'commonjs' in sourceType union
napi/parser/test/parse.test.ts Added comprehensive tests for sourceType: 'commonjs' across all language types
napi/parser/src/types.rs Updated TypeScript type annotation to include 'commonjs' option
napi/parser/src-js/index.d.ts Updated TypeScript interface to include 'commonjs' in sourceType union
crates/oxc_napi/src/lib.rs Added commonjs case handling in get_source_type function and minor documentation improvement
apps/oxlint/src/js_plugins/parse.rs Updated TypeScript type annotation to include 'commonjs' option
apps/oxlint/src-js/bindings.d.ts Updated TypeScript interface to include 'commonjs' in sourceType union

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

@overlookmotel overlookmotel requested review from Boshen and Dunqing and removed request for Boshen January 18, 2026 23:02
@graphite-app graphite-app bot changed the base branch from om/01-18-test_linter_plugins_fix_tests_for_ruletester_ignorenonfatalerrors_option to graphite-base/18197 January 18, 2026 23:09
@graphite-app graphite-app bot force-pushed the graphite-base/18197 branch from 4d0e4d0 to ff4edd2 Compare January 18, 2026 23:16
@graphite-app graphite-app bot force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch from ef08b7c to 80fc51f Compare January 18, 2026 23:16
@graphite-app graphite-app bot changed the base branch from graphite-base/18197 to main January 18, 2026 23:16
@graphite-app graphite-app bot force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch from 80fc51f to 9a5146e Compare January 18, 2026 23:17
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 19, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 19, 2026

Merge activity

…18197)

#18089 added support in parser for `commonjs` source type.

Extend this support to the NAPI packages - accept `sourceType: 'commonjs'` in options for `oxc-parser` and `oxc-transform`.
@graphite-app graphite-app bot force-pushed the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch from 9a5146e to 6e8fa80 Compare January 19, 2026 04:39
@graphite-app graphite-app bot merged commit 6e8fa80 into main Jan 19, 2026
21 checks passed
@graphite-app graphite-app bot deleted the om/01-18-feat_napi_parser_napi_transform_accept_sourcetype_commonjs_ branch January 19, 2026 04:45
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 19, 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-linter Area - Linter A-linter-plugins Area - Linter JS plugins 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.

3 participants

Comments