Avatar for the oxc-project user
oxc-project
oxc
BlogDocsChangelog

Performance History

Latest Results

feat(parser): support `turbopack` magic comments
kane50613:main
14 minutes ago
Merge branch 'main' into fix/minifier-rewrite-arguments-copy-loop
fazba:fix/minifier-rewrite-arguments-copy-loop
2 hours ago
fix(transformer/typescript): preserve execution order for accessor with `useDefineForClassFields: false` (#21369) ## Summary When `useDefineForClassFields: false` (`setPublicClassFields` assumption), the TypeScript transform moves public/TS-private field initializers into the constructor. However, private field initializers (including `accessor` backing fields from the legacy decorator transform) were left as class field declarations, causing them to execute **before** the constructor body. This broke execution order when the initializer depended on other fields that were already moved to the constructor. **Input:** ```ts class Hello { private input = { foo }; accessor util = this.input.foo(); } ``` **Before (broken):** `this.input.foo()` runs before `this.input = { foo }` ```js class Hello { constructor() { this.input = { foo }; } #_util_accessor_storage = this.input.foo(); // ← runs BEFORE constructor } ``` **After (fixed):** all instance initializers in the constructor, in source order ```js class Hello { constructor() { this.input = { foo }; this.#_util_accessor_storage = this.input.foo(); } #_util_accessor_storage; } ``` ### Approach Matches TypeScript's [`WillHoistInitializersToConstructor`](https://github.com/microsoft/TypeScript/blob/7b8cb3bdf82f400642b73173f941335775d6f730/src/compiler/transformers/classFields.ts#L339) logic in [`shouldTransformAutoAccessorsInCurrentClass`](https://github.com/microsoft/TypeScript/blob/7b8cb3bdf82f400642b73173f941335775d6f730/src/compiler/transformers/classFields.ts#L1069-L1073): - Pre-scan the class body to check if any non-private instance field has an initializer that will be hoisted - When hoisting occurs, include **all** instance fields (including `#` private) in the hoisting to preserve execution order - When no public fields are being hoisted, private fields stay as class field declarations No changes needed to the decorator/legacy transform β€” the fix is entirely in `transform_class_fields`. Fixes #21365 ## Test plan - [x] Added test fixture: `accessor-use-define-for-class-fields` (with hoisted + non-hoisted cases) - [x] Updated `use-define-for-class-fields-without-class-properties` expected output to match TypeScript behavior - [x] `cargo test -p oxc_transformer` β€” all pass - [x] `cargo run -p oxc_transform_conformance` β€” no regressions, previously failing test now passes πŸ€– Generated with [Claude Code](https://claude.ai/code)
main
3 hours ago
fix(formatter): preserve parens around `intrinsic` in type alias annotation (#21410) ## Summary Fixes #20205 β€” `type t = (intrinsic);` was losing its parentheses during formatting, changing the AST on re-parse or producing unparseable TypeScript. ## Why this happens The parser treats a leading `intrinsic` identifier in a type alias annotation as `TSIntrinsicKeyword`: - `type t = intrinsic;` β†’ `TSIntrinsicKeyword` - `type t = (intrinsic);` β†’ `TSParenthesizedType(TSTypeReference(IdentifierReference))` `oxc_formatter` runs the parser with `preserve_parens: false`, which drops the `TSParenthesizedType` wrapper. Without re-emitting the parens: | Input | Naive output | Re-parses as | |-------|-------------|--------------| | `type t = (intrinsic);` | `type t = intrinsic;` | `TSIntrinsicKeyword` (different AST) | | `type t = (intrinsic) \| string;` | `type t = intrinsic \| string;` | **Syntax error** β€” oxc and TypeScript both reject it | | `type t = (intrinsic) & string;` | `type t = intrinsic & string;` | **Syntax error** | Prettier has the same bug and emits the broken outputs; we intentionally diverge to produce correct, round-trippable TypeScript. ## Fix In `FormatWrite<TSTypeReference>::write`, detect when the reference is a bare `intrinsic` identifier AND is the leftmost descendant of a `TSTypeAliasDeclaration` (directly, or through leftmost members of union/intersection types). When so, wrap the output in parens. Any other `intrinsic` position (right arm of union, array element, object property, type arguments, etc.) is unambiguous and is left alone. Fast-pathed on the name check so non-`intrinsic` references pay only a hash-prefixed string compare. ## Test plan - [x] New fixture `crates/oxc_formatter/tests/fixtures/ts/parenthesis/intrinsic.ts` covers direct, leftmost-union, leftmost-intersection, right-arm, tuple, object property, and type-argument positions - [x] Output round-trips through `oxc_parser` - [x] `cargo test -p oxc_formatter` β€” 269/269 passing - [x] `cargo run -p oxc_prettier_conformance` β€” js 746/753, ts 591/601 (no delta)
main
3 hours ago
fix(formatter): Follow up on #21410
04-15-fix_formatter_follow_up_on_21410
3 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
feat(parser): support `turbopack` magic comments#20803
19 days ago
6a0e43f
kane50613:main
CodSpeed Performance Gauge
0%
fix(minifier): avoid illegal `var;` when folding unused arguments copy loop#21421
18 hours ago
3a2cd88
fazba:fix/minifier-rewrite-arguments-copy-loop
CodSpeed Performance Gauge
0%
3 hours ago
8559776
04-15-fix_formatter_follow_up_on_21410
Β© 2026 CodSpeed Technology
Home Terms Privacy Docs