Commit Graph

167 Commits

Author SHA1 Message Date
Boshen c205b0df51 fix(ast): remove ThisExpression from TSModuleReference (#18489)
## Summary

- Removes `ThisExpression` variant from `TSModuleReference` since `import x = this` is invalid TypeScript (error TS1359)
- Adds parser error when `this` is used in import equals declaration
- Updates codegen, transformer, and linter rules to handle the new enum structure

Closes #16841

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-24 15:25:10 +00:00
Boshen 9b3165f524 docs(napi/parser): clarify when to use parseAsync vs parseSync (#18486)
## Summary

- Add detailed JSDoc documentation to `parse` and `parseSync` functions explaining their performance characteristics
- Clarify that `parseSync` is generally preferable since AST deserialization happens on the main thread anyway
- Recommend using worker threads with `parseSync` for parallelizing multiple files

Closes #15361

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-24 14:54:52 +00:00
overlookmotel 09a4057f14 refactor(linter/plugins, napi/parser): remove pattern of destructuring globals at top level (#18455)
Pure refactor.

Remove a few remaining instances of the pattern where we destructure global objects at top level e.g. `const { isArray } = Array;`.

In Oxlint, TSDown plugin already performs this optimization. In `napi/parser`, we intend to build the package with TSDown, and we'll apply the same optimization in build process then too.
2026-01-23 14:28:18 +00:00
overlookmotel 8db0e78ae6 feat(linter/plugins): handle BOMs (#18376)
Closes #12526.

Handle BOM on start of files in the same way that ESLint does - do not include it in the source text on JS side, but `context.sourceCode.hasBOM` evaluates to `true`.

Method:

* Alter `program.source_text` to trim off the BOM before passing AST to JS side.
* Add a `has_bom` flag to `RawTransferMetadata`.
* Add ability to add an offset in the conversion from UTF-8 to UTF-16 spans.

The result is that the file as it's seen on JS side is as if the BOM didn't exist (except for the `hasBOM` flag). Spans are converted accordingly in JS-side AST, and converted back when passing diagnostics back to Rust.
2026-01-22 02:16:54 +00:00
overlookmotel 6ac09e2a9d feat(linter/plugins): support source text not being at start of buffer (#18375)
Previous raw transfer required that the source text start exactly at the start of the buffer. In linter, relax this restriction and handle when source text is stored elsewhere in the buffer.

This is necessary for stripping BOM from source (#18376), as then the source text used on JS side starts 3 bytes after the start of the buffer.
2026-01-22 02:16:53 +00:00
Boshen 7174336d10 refactor(parser): shorten raw transfer deserializer code for non-range variants (#18137)
## Summary

- Use inline assignment pattern (`let x; { x: x = value }`) for `start` and `end` fields instead of declaring them in the preamble
- This allows minifiers to eliminate unused variables when RANGE is false
- Restores original file size for deserializers that don't use range fields

**Before (js.js with RANGE=false):**
```javascript
function deserializeIdentifierName(pos) {
  let start = deserializeU32(pos),
    end = deserializeU32(pos + 4);
  return { type: "Identifier", name: deserializeStr(pos + 8), start, end };
}
```

**After (js.js with RANGE=false):**
```javascript
function deserializeIdentifierName(pos) {
  return { type: "Identifier", name: deserializeStr(pos + 8), start: deserializeU32(pos), end: deserializeU32(pos + 4) };
}
```

Closes #14332

## Test plan

- [x] `just ast` regenerates deserializers correctly
- [x] `pnpm test --filter='@oxc-project/napi-parser'` passes (109 tests)
- [x] `cargo clippy -p oxc_ast_tools` passes

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-21 02:55:05 +00:00
Boshen 89de3a146b release(crates): oxc v0.110.0 (#18240)
### 🐛 Bug Fixes

- f1e2dc0 semantic: No error in `check_function_redeclaration` for
CommonJS files (#18231) (overlookmotel)
- 645c3f0 transformer: Use `require` not `import` in CommonJS files
(#18226) (overlookmotel)
- ee9f6a4 mangler: Use `retain` instead of `truncate` to remove empty
frequency slots (#18225) (Dunqing)

### ⚡ Performance

- 52073d9 semantic: Use cheaper test for source type (#18235)
(overlookmotel)

Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
2026-01-19 13:42:45 +00:00
Boshen 7282e9c564 release(crates): oxc v0.109.0 (#18222) 2026-01-19 18:42:47 +08:00
overlookmotel 6e8fa809f5 feat(napi/parser, napi/transform): accept sourceType: "commonjs" (#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`.
2026-01-19 04:39:04 +00:00
Boshen 4f45a2845a refactor(ast)!: replace TSMappedType.type_parameter with dedicated key and constraint fields (#18185)
## Summary

- Replace `type_parameter: Box<'a, TSTypeParameter<'a>>` with two dedicated fields:
  - `key: BindingIdentifier<'a>` - the parameter name (e.g., `P` in `[P in keyof T]`)
  - `constraint: TSType<'a>` - the constraint type (e.g., `keyof T`)
- Improves type safety by preventing invalid AST states - `TSTypeParameter` contains `const`, `in`, `out`, and `default` fields that are syntactically invalid in mapped types
- Matches TSESTree structure more closely

Closes #15101

## Test plan

- [x] All parser, codegen, semantic, and linter tests pass
- [x] Conformance tests show no regressions
- [x] Semantic snapshots updated to reflect the new structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-18 14:49:37 +00:00
Boshen 08dad63678 feat(span): add sourceType: 'commonjs' support (#18089)
## Summary

- Add `ModuleKind::CommonJS` variant to support CommonJS module type in the parser
- Enable top-level `return` statements (CommonJS files are wrapped in a function)
- Enable top-level `new.target` (allowed in CommonJS function wrapper)
- Add proper errors for `import`/`export` statements in CommonJS
- Add proper errors for `import.meta` in CommonJS

The CommonJS source type can be set via:
- `SourceType::with_commonjs(true)` method
- Babel's `sourceType: "commonjs"` option

Closes #16200

## Test plan

- [x] Added test cases in `tasks/coverage/misc/pass/` for valid CommonJS features
- [x] Added test cases in `tasks/coverage/misc/fail/` for invalid CommonJS usage
- [x] Enabled Babel conformance tests for `sourceType: "commonjs"`
- [x] All existing tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-16 16:08:27 +00:00
Boshen 9135b0b2f3 feat(ast)!: move scope from TSEnumDeclaration to TSEnumBody (#18058)
## Summary

- Move `scope_id: Cell<Option<ScopeId>>` from `TSEnumDeclaration` to `TSEnumBody`
- Since `TSEnumBody` was introduced as a dedicated type in PR #10284, the scope logically belongs on the body rather than on the parent declaration node

Closes #10331

## Test plan

- [x] Unit tests pass (`just test`)
- [x] Conformance tests pass (`just conformance`)
- [x] Updated semantic test snapshots reflect scope now on `TSEnumBody`

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-16 13:30:08 +00:00
Peter Wagenet 7a0ca9999b fix(linter/plugins): use correct ScriptKind for tokens (#17185)
When parsing tokens for JS plugins, the TypeScript parser was always using `ScriptKind.TSX`, regardless of file extension. This caused TypeScript to incorrectly parse generic arrow functions like `<T>() => {}` in `.ts` files, creating bogus `JsxText` tokens that overlap with comments.

This PR adds an `is_jsx` flag to `RawTransferMetadata`. Rust side sets the flag depending on source type, and JS side uses that information to pass the correct `ScriptKind` for the file to TypeScript parser.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2026-01-15 19:06:08 +00:00
Boshen 140cb1f405 release(crates): oxc v0.108.0 (#17920)
### 🚀 Features

- 10426af codegen: Print soft space between inline block comments on the
same line (#17799) (camc314)
- 2261e6e semantic: Improve error message to add `#` for private
identifiers (#17779) (Dunqing)

### 🐛 Bug Fixes

- 7422b7e parser/trivia: Correctly mark whether a block comment is on a
newline (#17754) (camc314)
- c32e8d5 codegen: Wrap `TSAsExpression` in parens when used with
in/instanceof operators (#17752) (camc314)
- 5755b2d semantic: Report duplicate private identifier for static and
instance elements (#17591) (camc314)
- 0600df3 isolated_declarations: Only print jsdoc comments (#17748)
(camc314)
- ef7e014 parser: Preserve `@__NO_SIDE_EFFECTS__` annotation with
parenthesized expressions (#17711) (camc314)
- 59a6228 parser: Detect TS1363 error for type-only imports with mixed
default and named/namespace bindings (#17712) (Copilot)

### ⚡ Performance

- 864f1fa semantic: Mark duplicate class element error reporting as cold
(#17746) (camc314)
- 3a452b8 semantic: Use smallvec for storing reference IDs (#17731)
(camchenry)
- d5979dc minifier: Do not allocate when checking to convert `const` to
`let` (#17730) (camchenry)
- 3f4429c parser: Do not re-allocate TS interface heritage (#17692)
(camchenry)

### 📚 Documentation

- 120a27c minifier: Add prettier-ignore for js-in-md part (#17687)
(leaysgur)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2026-01-12 17:51:21 +08:00
Boshen 811b2a753c release(crates): oxc v0.107.0 (#17661)
### 🚀 Features

- 659c23e linter: Init note field boilerplate  (#17589) (Shrey Sudhir)
- 6870b64 parser: Add TS1363 error code (#17609) (Sysix)
- 23680a3 mangler: Skip mangling only in scopes affected by direct eval (#17612) (camc314)
- a7e1643 parser: Add TS2528 error code to duplicate_default_export diagnostic (#17558) (camc314)

### 🐛 Bug Fixes

- 1044116 ecmascript: Mark `new Symbol` as non side-effect free (#17568) (camc314)
- ab5e4ca isolated-declarations: Strip default values from rest parameter binding patterns (#17602) (camc314)
- 68b2e54 minifier: Prevent incorrect ??= transformation when member base is mutated (#17472) (copilot-swe-agent)

### ⚡ Performance

- 6067143 semantic: Remove hash when checking identifier (#17564) (camchenry)
- a28ab3d semantic: Avoid bounds check when checking string literal (#17545) (camc314)
- 04809d1 semantic: Use SIMD for finding backslashes in `check_string_literal` (#17534) (camchenry)
- 49ad2f0 semantic: Mark all diagnostic functions as `#[cold]` (#17487) (camc314)
- ea82b50 transformer: Mark all diagnostic functions as `#[cold]` (#17486) (camc314)
- d968e51 semantic: Mark `checker::check` as `inline(always)` (#17459) (camc314)
2026-01-05 13:45:22 +00:00
renovate 3741b8171c chore(deps): update napi (#17481)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | Type | Update |
|---|---|---|---|---|---|---|---|
| [@napi-rs/cli](https://napi.rs/) ([source](https://redirect.github.com/napi-rs/napi-rs)) | [`3.5.0` → `3.5.1`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.5.0/3.5.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@napi-rs%2fcli/3.5.1?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@napi-rs%2fcli/3.5.1?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@napi-rs%2fcli/3.5.0/3.5.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@napi-rs%2fcli/3.5.0/3.5.1?slim=true) | pnpm.catalog.default | patch |
| [napi](https://redirect.github.com/napi-rs/napi-rs) | `3.7.1` → `3.8.1` | ![age](https://developer.mend.io/api/mc/badges/age/crate/napi/3.8.1?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/crate/napi/3.8.1?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/crate/napi/3.7.1/3.8.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/crate/napi/3.7.1/3.8.1?slim=true) | workspace.dependencies | minor |
| [napi-derive](https://redirect.github.com/napi-rs/napi-rs) | `3.4.1` → `3.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/crate/napi-derive/3.5.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/crate/napi-derive/3.5.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/crate/napi-derive/3.4.1/3.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/crate/napi-derive/3.4.1/3.5.0?slim=true) | workspace.dependencies | minor |

---

### Release Notes

<details>
<summary>napi-rs/napi-rs (@&#8203;napi-rs/cli)</summary>

### [`v3.5.1`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.5.0...@napi-rs/cli@3.5.1)

[Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.5.0...@napi-rs/cli@3.5.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNjYuMTQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->
2025-12-31 12:52:40 +00:00
Boshen 9ec93401a3 release(crates): oxc v0.106.0 (#17447) 2025-12-29 17:16:30 +08:00
camc314 3984750c69 refactor(all)!: remove binding pattern wierdness (#15925)
fixes #11489

Note, in quite a few places i changed the span we report on to look something like this, the only reason for this is to reduce the diff in some of the snapshots
```
decl.type_annotation.as_ref().map_or_else(
                        || decl.id.span(),
                        |type_annotation| decl.id.span().merge(type_annotation.span()),
                    ),
```
2025-12-22 10:04:20 +00:00
Boshen 06370495a0 release(crates): oxc v0.105.0 (#17259) 2025-12-22 17:32:08 +08:00
overlookmotel 5aefb84daa perf(linter/plugins): reduce size of walker code (#17176)
By hoisting `let enter;` up out of the the `if` block, minifier is able to convert the `if` statement into a `&&` expression, resulting in tighter minified output.

This optimization is only visible in the bundled output, as that's where we do more aggressive minification.
2025-12-20 13:59:13 +00:00
overlookmotel 19566641dc refactor(linter/plugins, parser/napi): add JSDoc comments to generated code (#17175)
Just add JSDoc comments to some generated code.
2025-12-20 13:59:13 +00:00
overlookmotel 24a8d9e17e refactor(linter/plugins, parser/napi): generate type IDs maps as variants (#17174)
Pure refactor. Generate the JS files containing `NODE_TYPE_IDS_MAP` as variants of a single source code file, instead of constructing to two different versions for parser and linter manually.

This makes changes in further PRs to come easier to implement.
2025-12-20 13:59:13 +00:00
Boshen c90ab786d0 release(crates): oxc v0.104.0 (#17096)
### 🚀 Features

- d209c21 allocator: Add cap to FixedSizeAllocatorPool and block when
exhausted (#17023) (Cameron)
- fb2af91 allocator: Add bitset utils (#17042) (zhaoting zhou)
- c16082c tasks/compat_data: Integrate `node-compat-table` (#16831)
(Boshen)
- 5586823 span: Extract TS declaration file check to its own function
(#17037) (camchenry)
- 3d2b492 minifier: Fold iife arrow functions in call expressions
(#16477) (Armano)
- 67e9f9e codegen: Keep comments on the export specifiers (#16943)
(夕舞八弦)
- cb515fa parser: Improve error message for `yield` as identifier usage
(#16950) (sapphi-red)
- dcc856b parser: Add help for `new_dynamic_import` error (#16949)
(sapphi-red)
- c3c79f8 parser: Improve import attribute value error message (#16948)
(sapphi-red)
- 291b57b ast_tools: Generate TS declaration files for deserializer and
walk files (#16912) (camc314)
- 74eae13 minifier: Remove unused import specifiers (#16797) (camc314)

### 🐛 Bug Fixes

- fb9e193 linter: OOM problems with custom plugins (#17082)
(overlookmotel)
- e59132b parser/napi: Fix lazy deser (#17069) (overlookmotel)
- a92faf0 ast_tools: Support `u128` in `assert_layouts` generator
(#17050) (overlookmotel)
- 47b4c2f minifier/docs: Correct hyperlink path in OPTIMIZATIONS.md
(#16986) (GRK)
- 3002649 transformer/typescript: Remove unused import equals
declaration (#16776) (Dunqing)
- 5a2af88 regular_expression: Correct named capture group reference
error (#16952) (sapphi-red)

### ⚡ Performance

- b657bb6 allocator: Reduce time `Mutex` lock is held in
`FixedSizeAllocatorPool::get` (#17079) (overlookmotel)
- 1f3b19b ast: `#[ast]` macro use `#[repr(transparent)]` for
single-field structs (#17052) (overlookmotel)
- 225f229 parser: Use SmallVec for duplicate default export detection
(#16801) (camc314)

### 📚 Documentation

- a9c419f traverse: Update safety comments (#16944) (overlookmotel)

Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
2025-12-19 02:14:06 +00:00
overlookmotel e59132b6c0 fix(parser/napi): fix lazy deser (#17069)
Lazy deserialization in `oxc-parser` was broken by #16957. Fix it.
2025-12-18 15:48:00 +00:00
overlookmotel a92faf08e8 fix(ast_tools): support u128 in assert_layouts generator (#17050)
Previously `u128` was not supported in `assert_layouts` generator, because Rust changed the alignment of `u128` from 8 to 16 - and therefore the alignment depended on Rust version.

That change happened some time ago now, and all Rust versions above our MSRV have `u128` with alignment of 16. So we can now support `u128` (and also `i128`, `NonZeroU128`, `NonZeroI128`).

Also support `u128` in `raw_transfer` and `raw_transfer_lazy` generators.

This will help with making lexer tokens serializable (#17025), since `Token` contains a `u128`.
2025-12-18 11:58:03 +00:00
camc314 5d211a8c69 refactor(napi/parser): move generated JS into src-js (#16957)
moves the generated code into src-js to keep the same pattern as oxlint
2025-12-17 11:43:42 +00:00
Boshen 6fca2f7f60 chore(infra): use oxfmt for all files, remove dprint (#16599)
Toml formatting is missing but there's only a few toml files, can wait
for oxfmt plugins.

- [x] Something is slow, can't figure out why, need #16607
2025-12-15 12:06:24 +00:00
Boshen e6ad960231 release(crates): oxc v0.103.0 (#16887) 2025-12-15 18:17:19 +08:00
camc314 2acd66ed42 style(all): enable eslint/curly lint rule (#16753)
built on https://github.com/oxc-project/oxc/pull/16749, we can use the linter to be consistent here
2025-12-11 14:49:48 +00:00
Boshen 745873e4cd release(crates): oxc v0.102.0 (#16595)
### 💥 BREAKING CHANGES

- 083fea9 napi/parser: [**BREAKING**] Represent empty optional fields on
JS side as `null` (#16411) (overlookmotel)

### 🚀 Features

- 7a2afee parser: Add TS1174 error for classes extending multiple base
classes (#15993) (sapphi-red)
- da87812 semantic: Add TS2309 error for export assignment with other
exports (#15992) (sapphi-red)
- d6d2bcd minifier: Remove unused function calls that are marked by
`manual_pure_functions` (#16534) (sapphi-red)
- c90f053 minifier: Support `.` separated values for
`compress.treeshake.manualPureFunctions` (#16529) (sapphi-red)
- a607cc4 codegen: Preserve comments between CatchClause's param and
body (#16167) (copilot-swe-agent)
- 8c10694 semantic: Expose get_comment_at method (#16439) (camc314)
- 3981e7a ast: Add get_comment_at to lookup a comment by span (#16438)
(camc314)

### 🐛 Bug Fixes

- 699406a napi/parser: Move `ExportEntry::module_request` field to first
(#16412) (overlookmotel)
- 12bd794 napi/parser: Move `ExportEntry::module_request` field to last
(#16403) (overlookmotel)

### ⚡ Performance

- 790beeb napi/parser: Do not remove extraneous options on JS side
(#16447) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-12-08 11:47:22 +00:00
overlookmotel 3459f8a548 ci(lint): enable prefer-destructuring lint rule (#16449)
Enable `prefer-destructuring` rule in our linting setup.

Not related to JS plugins, I just like this rule, and it's useful not to make nitty comments on PRs, when linter can do it for me...
2025-12-03 22:10:54 +00:00
overlookmotel 790beebd17 perf(napi/parser): do not remove extraneous options on JS side (#16447)
Similar to #16442.

There's no need to remove the `experimental*` properties from `options` object on JS side. They'll be ignored by NAPI-RS on Rust side anyway, so creating a new object on JS side is pointless overhead.
2025-12-03 14:47:24 +00:00
overlookmotel 699406af5e fix(napi/parser): move ExportEntry::module_request field to first (#16412)
Revert the change made in #16403. It's no longer necessary after #16411, because NAPI-RS no longer re-orders the fields.
2025-12-02 23:30:56 +00:00
overlookmotel 083fea9fa6 feat(napi/parser)!: represent empty optional fields on JS side as null (#16411)
Follow-on after #16383 and #16403.

While working on those I discovered an option NAPI-RS has to represent `Option::None` as `null`, instead of omitting the field entirely.

Use that option on the structs used for transferring errors and module record over to JS.

I think this is likely more performant because:

1. NAPI-RS can create all properties of the objects using only the faster `node_api_create_object_with_properties` API.
2. It produces consistent object shapes, so JS engine can better optimize code using these objects.

It also brings the shape of the data perfectly into line between standard transfer and raw transfer, and is consistent with how empty fields in the AST are represented as `null`.

I would have used this option before if I'd known it existed.

### Breaking change

I've marked this as a breaking change because code consuming these objects would now need to check for empty fields with `value === null` instead of `value === undefined`.

However in practice, most people probably use `!value` or `value ?? ...`, so it's unlikely to affect many users. This only affects module record and errors anyway, not the AST itself, as we transfer that as JSON, not via NAPI.
2025-12-02 23:30:56 +00:00
overlookmotel 12bd7940bf fix(napi/parser): move ExportEntry::module_request field to last (#16403)
NAPI-RS 3.6.0 makes a change to the ordering of objects. It now puts optional fields last.

This made tests in `napi/parser` for module record fail when we tried to update (#16383) because the `module_request` field of `ExportEntry` moves to last which breaks the snapshots.

The change in NAPI-RS is unlikely to be reverted, because it's a sizeable perf optimization: https://github.com/napi-rs/napi-rs/pull/2990

To work around this problem:

1. Move the field in the `ExportEntry` intermediate struct in `napi/parser` to last, so NAPI's output matches what you'd expect from the struct definition.
2. Alter the `#[estree]` attr on `ExportEntry` struct in `oxc_syntax` crate to match.

Note: The `ExportEntry` struct in `napi/parser` is just an intermediate structure used for serialization. So I think it's fine to fiddle with its field order. The actual `ExportEntry` struct used in the module record is in `oxc_syntax` crate, and it remains unaltered.
2025-12-02 17:42:53 +00:00
Boshen 701ab87e3e release(crates): oxc v0.101.0 (#16381) 2025-12-02 17:19:30 +08:00
Boshen 08727586bc release(crates): oxc v0.100.0 (#16331)
### 💥 BREAKING CHANGES

- 74cf572 ast: [**BREAKING**] Make `source` field of `TSImportType` a
`StringLiteral` (#16114) (copilot-swe-agent)
- 43156ae ast: [**BREAKING**] Rename `TSImportType` `argument` field to
`source` (#16110) (overlookmotel)
- 934d873 napi: [**BREAKING**] Drop `armv7-unknown-linux-musleabihf`
support (#16105) (Boshen)

### 🚀 Features

- 669afe0 ast: Add `Expression::is_jsx` method (#16154) (Dunqing)
- 17a8caa parser: Add diagnostic for JSX identifiers with hyphens
(#16133) (camchenry)
- 0549ae5 parser: Add diagnostic for expected ident after optional chain
(#16132) (camchenry)
- db839ae parser: Improve diagnostic for unexpected optional
declarations (#16131) (camchenry)
- bab4bc8 napi/parser: Add type annotations to parse-raw-worker test
(#15998) (camc314)

### 🐛 Bug Fixes

- 35ed36c traverse: Fix panic when truncating non-ASCII variable names
(#16265) (peter)
- 9149a26 linter/plugins, napi/parser: Deep freeze visitor keys (#16293)
(overlookmotel)
- 6b54dab minifier: Incorrect non-null object condition simplification
with `&&` and `||` (#16161) (sapphi-red)
- 9cc20a1 minifier: Avoid merging side effectful expressions to next
assignment statement if the side effect may change the left hand side
reference (#16165) (sapphi-red)
- 91eb3f2 ast/estree: Convert `TSImportType` `argument` field to
`Literal` (#16109) (overlookmotel)
- 1199cee parser: Reject invalid modifiers on parameter properties with
binding patterns (#16083) (camc314)
- f376325 traverse: Remove `console.log` from build script (#16049)
(overlookmotel)

### ⚡ Performance

- 82d784f lexer: Reduce bounds checks in `Lexer::get_string` (#16317)
(overlookmotel)
- cc2f352 span: Add `#[inline]` to `Atom` methods (#16311)
(overlookmotel)
- ffca070 span: Add `#[repr(transparent)]` to `Atom` (#16310)
(overlookmotel)
- 02bdf90 linter/plugins, napi/parser: Reuse arrays in visitor keys
(#16294) (overlookmotel)

### 📚 Documentation

- 891e0b4 parser: Add note about falling back to parse TSType in
TSImportType (#16119) (camc314)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-12-01 15:01:33 +00:00
renovate e44b288902 chore(deps): update dependency oxlint-tsgolint to v0.8.3 (#16187)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [oxlint-tsgolint](https://redirect.github.com/oxc-project/tsgolint) | [`0.8.2` -> `0.8.3`](https://renovatebot.com/diffs/npm/oxlint-tsgolint/0.8.2/0.8.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint-tsgolint/0.8.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint-tsgolint/0.8.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint-tsgolint/0.8.2/0.8.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint-tsgolint/0.8.2/0.8.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>oxc-project/tsgolint (oxlint-tsgolint)</summary>

### [`v0.8.3`](https://redirect.github.com/oxc-project/tsgolint/releases/tag/v0.8.3)

[Compare Source](https://redirect.github.com/oxc-project/tsgolint/compare/v0.8.2...v0.8.3)

##### What's Changed

- chore(deps): update typescript-go digest to [`e34615c`](https://redirect.github.com/oxc-project/tsgolint/commit/e34615c) by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;465](https://redirect.github.com/oxc-project/tsgolint/pull/465)
- chore(deps): update typescript-go digest to [`bd7c18d`](https://redirect.github.com/oxc-project/tsgolint/commit/bd7c18d) by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;466](https://redirect.github.com/oxc-project/tsgolint/pull/466)
- chore(deps): update typescript-go digest to [`417387a`](https://redirect.github.com/oxc-project/tsgolint/commit/417387a) by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;467](https://redirect.github.com/oxc-project/tsgolint/pull/467)
- chore(deps): update dependency vitest>vite to v7.2.8 by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;469](https://redirect.github.com/oxc-project/tsgolint/pull/469)
- chore(deps): update typescript-go digest to [`d1be94b`](https://redirect.github.com/oxc-project/tsgolint/commit/d1be94b) by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;470](https://redirect.github.com/oxc-project/tsgolint/pull/470)
- chore(deps): update crate-ci/typos action to v1.40.0 by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [#&#8203;471](https://redirect.github.com/oxc-project/tsgolint/pull/471)

**Full Changelog**: <https://github.com/oxc-project/tsgolint/compare/v0.8.2...v0.8.3>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xOS45IiwidXBkYXRlZEluVmVyIjoiNDIuMTkuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2025-11-27 08:31:05 +00:00
Boshen 523a30a016 style(all): apply oxfmt default options (#16091)
Embrace the defaults!

---------

Co-authored-by: Yuji Sugiura <y.sugiura.0316@gmail.com>
2025-11-25 15:56:24 +09:00
overlookmotel d2c97404c1 refactor(napi): prefer oxlint-disable over eslint-disable (#16054)
Nit. Use `// oxlint-disable` comments in our own code, instead of `// eslint-disable`.
2025-11-24 12:12:12 +00:00
Boshen 7252123e5e release(crates): oxc v0.99.0 (#16037)
### 💥 BREAKING CHANGES

- cbb27fd ast: [**BREAKING**] Add `TSGlobalDeclaration` type (#15712)
(overlookmotel)

### 🚀 Features

- 0c1f82b linter/plugins: Add `tokens` property to `Program` (#16020)
(overlookmotel)
- 6cff132 span: Add `Span::merge_within` method (#15869) (sapphi-red)
- 102365d allocator/vec: Add `Vec::into_bump_slice` method (#15770)
(Dunqing)

### 🐛 Bug Fixes

- e2ca770 codegen: Add support for printing type arguments in new
expressions (#15963) (Ives van Hoorne)
- 2bd3cb6 apps, editors, napi: Fix `oxlint-disable` comments (#16014)
(overlookmotel)
- 622cb5e parser: Preserve legal comments with @preserve/@license when
preceded by other annotations (#15929) (copilot-swe-agent)
- 7c46a9e transformer/tagged-template-transform: Handle `\n` escape
sequences (#15830) (Dunqing)
- f386efc minifier: Avoid generating invalid spans (#15778) (sapphi-red)
- d4ff004 parser: Forbid invalid modifiers on `module` and `global`
(#15723) (overlookmotel)
- 2191ae9 semantic: Allow reserved keywords in typescript ambient
contexts (#15495) (sapphi-red)
- 7d1ebad isolated-declarations: Incorrect nested namespace output in
isolated declarations (#15800) (copilot-swe-agent)

### ⚡ Performance

- b4b0ed8 transformer/typescript: Reverse order of checks (#15722)
(overlookmotel)

### 📚 Documentation

- c81a331 data_structures: Doc comments on fields of `Stack` (#15793)
(overlookmotel)
- cfae31d allocator: Use `allocator` as var name in examples (#15781)
(overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2025-11-24 10:06:24 +00:00
Boshen c588bc59ac release(crates): oxc v0.98.0 (#15771)
### 💥 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)
2025-11-17 12:38:34 +00:00
Boshen ea51b0b5c8 feat(napi)!: standardize function naming with sync suffixes (#15661)
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)
2025-11-13 12:28:23 +00:00
Boshen 98585f01a1 release(crates): oxc v0.97.0 (#15582) 2025-11-11 17:18:13 +08:00
Boshen 14fe64a935 release(crates): v0.96.0 (#15115) 2025-10-30 15:43:06 +08:00
leaysgur a8e5181ab7 chore(infra): dogfooding oxfmt (#14979)
Fixes #14803

- Added `oxfmt` and `oxfmtrc.jsonc`
- Remove `dprint` plugin and useless ignore paths
- Apply `dprint` again
- Apply `oxfmt`
2025-10-28 01:16:46 +00:00
Brooooooklyn f472631b73 chore(napi): update cli and js bindings (#14917)
Ref: https://github.com/oxc-project/oxc/issues/14732#issuecomment-3431289160
2025-10-23 09:47:23 +00:00
Boshen 454ee94ff3 release(crates): v0.95.0 (#14619) 2025-10-15 15:06:05 +08:00
camc314 1cc7ee92b0 chore(parser): enable oxlint (#14571) 2025-10-14 13:25:29 +00:00
overlookmotel 52f35c6dcd refactor(napi/parser, linter/plugins): rename types.js to type_ids.js (#14384)
Pure refactor. Just rename generated `types.js` files to `type_ids.js`. This name better describes what the files contain, and it avoids naming clash with `types.d.ts` in `apps/oxlint/src-js/generated`.
2025-10-06 18:55:15 +00:00