Repository navigation
fix(transformer): keep classes whose decorators are preserved - #29748
Merged
Merged
Conversation
Dunqing
force-pushed
the
class-lowering-decision
branch
from
November 17, 2026 10:57
dfb25bf to
980cc67
Compare
This was referenced Nov 17, 2026
Member
Author
This was referenced Nov 17, 2026
Contributor
Merging this PR will improve performance by 5.16%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Dunqing
force-pushed
the
class-lowering-decision
branch
from
November 18, 2026 08:44
980cc67 to
d79897f
Compare
Dunqing
marked this pull request as ready for review
November 18, 2026 13:17
Dunqing
force-pushed
the
class-lowering-decision
branch
2 times, most recently
from
November 19, 2026 02:48
6852d1e to
ae01601
Compare
Member
Author
Merge activity
|
Oxc's downstream tests hit invalid JavaScript when compiling Puppeteer's private auto-accessor ([report](#8628 (comment))). Class-field lowering leaves the auto-accessor in the class but extracts the private method that reads it and emits a helper call with a missing argument. With legacy decorators disabled, the same lowering can erase a decorated field and its decorator. Choose whether to preserve or lower each class before TypeScript strips its type-only elements. Classes with preserved decorators or runtime auto-accessors keep their class elements and private bindings for a downstream transform. Plain classes and unrelated syntax still receive target-selected transforms. Private references follow their declaring class, even when nested classes use a different lowering mode. For TypeScript parameter properties in assignment mode, the constructor assignment remains, without a synthetic field that would shadow an inherited setter. ### Example Input ([playground for this example](https://playground.oxc.rs/?t=codegen&options=%7B%22run%22%3A%7B%22transform%22%3Atrue%7D%2C%22parser%22%3A%7B%22extension%22%3A%22js%22%7D%2C%22transformer%22%3A%7B%22target%22%3A%22chrome49%22%2C%22useDefineForClassFields%22%3Atrue%2C%22experimentalDecorators%22%3Afalse%7D%7D&code=let+x%3B%0Aclass+C+%7B+accessor+%23prop+%3D+123%3B+%23method%28%29+%7B+this.%23prop%3B+%7D+%7D%0A)): ```js let x; class C { accessor #prop = 123; #method() { this.#prop; } } ``` Before output: ```js let x; var _C_brand = /* @__PURE__ */ new WeakSet(); class C { constructor() { babelHelpers.classPrivateMethodInitSpec(this, _C_brand); } accessor #prop = 123; } function _method() { babelHelpers.classPrivateFieldGet2(, this); } ``` After output: ```js let x; class C { accessor #prop = 123; #method() { this.#prop; } } ``` The accessor and its private method stay together, so no private-field helper is emitted. The playground uses released Oxc, not the PR branch. ### Decorated TypeScript field Input: ```ts class Example { @decorate value: number = 1; } ``` Before output: ```js class Example { constructor() { babelHelpers.defineProperty(this, "value", 1); } } ``` After output: ```js class Example { @decorate value = 1; } ``` The type annotation is removed, but the field and its decorator survive. Both examples were captured with `cargo run -p oxc_transformer --example transformer -- <input> --target chrome49` on parent `a2eed1b99f` and this branch `d79897face`, with legacy decorators disabled and define semantics for class fields. Rust formatting, transformer lint, all 42 Rust transformer tests, and all 62 Node binding tests passed. Allocation snapshots regenerated without changes. Transform output conformance reports 754/1182 Babel cases and 337/462 Oxc cases with no new failures. Full execution conformance was not rerun for this revision. Part of #9170. This is the prerequisite below #27784. Prepared with AI assistance (model ID: `mythos-magpie-4133180673`; reasoning effort unavailable).
graphite-app
Bot
force-pushed
the
class-lowering-decision
branch
from
November 19, 2026 02:51
ae01601 to
a7ea78b
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
…#27784) ## What Adds the standard-decorators test infrastructure before the lowering implementation lands, so later layers show their effects in the conformance reports. Part of #9170. Depends on #29748. ## What it enables - **Babel standard-decorator fixtures** in exec mode; expected transform errors stay eligible for conformance. Ordinary upstream `2023-*` output comparisons are skipped (Oxc's lowering uses a different helper protocol); local Oxc output comparisons remain enabled. Harness regressions cover those boundaries, including exec file extensions and expected errors. - **Test262 runtime decorator cases** on transformed code. The runner bypasses native V8 decorator-syntax exclusions for that route only; unrelated engine and harness exclusions are retained. Default scripts run in sloppy and strict modes, with strictness applied before parsing and transformation. - **`undecorated-static-private` no longer skipped**: the class-lowering fix below this PR preserves classes with auto-accessors instead of panicking on them. ## How the exec fixtures run - Fixtures without an explicit `sourceType` (and not `.mjs`) transform as scripts and execute in sloppy mode through `vm.Script`, with `this` bound to the global object — matching how Babel's own runner executes them. Runtime helpers are imported by the generated test module, so they resolve to this checkout and are handed to the script through its `require`. Previously these fixtures ran as strict ESM, so fixtures assigning to undeclared variables failed for reasons unrelated to the transform. Oxc's own exec fixtures keep the existing module and callback wrappers. - Exported exec fixtures and their assertions stay at module scope. A Vitest resolver loads this checkout's runtime helpers before Vite can substitute its bundled runtime. Module evaluation failures are reported as fixture failures. ## Vendored esbuild decorator suite `upstream/decorator-tests.ts` is an unmodified copy of esbuild's MIT-licensed `scripts/decorator-tests.ts`, with the complete copyright and license notice retained beside the source. At execution time the runner expands all 147 named callbacks by their AST spans, preserving the upstream metadata setup and assertion helpers, and generates individual fixtures in the existing gitignored directory. Each callback runs in both transform configurations — 294 executions with stable per-case names, filtering, and one failed case not preventing the others. Every callback is awaited; a failure recorded by the upstream assertion counter fails the Vitest module. Case count, async cases, unsupported property shapes, and filename collisions are guarded. Locally authored decorator behavior fixtures live in the implementation layers. ## Verification at this layer Seven harness tests, harness lint, full transform conformance with execution, and Test262 runtime regeneration all pass. Runtime coverage includes 24 newly eligible decorator/accessor cases. Default lowering is introduced later, so preserved-syntax execution failures remain expected here. Regenerated reports: Babel output 754/1190, Babel execution 342/592, Oxc output 335/461, Oxc execution 68/364. These include expected failures; command exit status does not imply every suite case passes. Implemented with AI assistance (model ID: `mythos-magpie-4133180673`).
Dunqing
pushed a commit
that referenced
this pull request
Nov 20, 2026
Classes preserved for a downstream decorator transform (with runtime decorators or auto-accessors) skipped `transform_class_fields`, so under `useDefineForClassFields: false` their undecorated fields kept define semantics. TypeScript now converts those fields again. Decorated fields stay in the class, and instance fields before the last kept instance initializer stay too, so initializers keep their order. Fixes a regression from #29748. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ogydbcf46ZrwM8jrDg2nT
Dunqing
pushed a commit
that referenced
this pull request
Nov 20, 2026
Classes preserved for a downstream decorator transform (with runtime decorators or auto-accessors) skipped `transform_class_fields`, so under `useDefineForClassFields: false` their undecorated fields kept define semantics. TypeScript now converts those fields again. Decorated fields stay in the class, and instance fields before the last kept instance initializer stay too, so initializers keep their order. Fixes a regression from #29748. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ogydbcf46ZrwM8jrDg2nT
Dunqing
pushed a commit
that referenced
this pull request
Nov 20, 2026
Classes preserved for a downstream decorator transform (with runtime decorators or auto-accessors) skipped `transform_class_fields`, so under `useDefineForClassFields: false` their undecorated fields kept define semantics. TypeScript now converts those fields again. Decorated fields stay in the class, and instance fields before the last kept instance initializer stay too, so initializers keep their order. Fixes a regression from #29748. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ogydbcf46ZrwM8jrDg2nT
Dunqing
pushed a commit
that referenced
this pull request
Nov 20, 2026
Classes preserved for a downstream decorator transform (with runtime decorators or auto-accessors) skipped `transform_class_fields`, so under `useDefineForClassFields: false` their undecorated fields kept define semantics. TypeScript now converts those fields again. Decorated fields stay in the class, and instance fields before the last kept instance initializer stay too, so initializers keep their order. Fixes a regression from #29748. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ogydbcf46ZrwM8jrDg2nT
Dunqing
added a commit
that referenced
this pull request
Nov 21, 2026
…ses (#29930) Since #29748, classes that keep decorators or `accessor` for a downstream transform skip TypeScript's `useDefineForClassFields: false` conversion entirely. Their other fields stay define-semantics fields instead of becoming assignments. Found while testing rolldown. ### Example Input ([playground for this example](https://playground.oxc.rs/?t=codegen&options=%7B%22run%22%3A%7B%22transform%22%3Atrue%7D%2C%22parser%22%3A%7B%22extension%22%3A%22ts%22%7D%2C%22transformer%22%3A%7B%22useDefineForClassFields%22%3Afalse%2C%22experimentalDecorators%22%3Afalse%7D%7D&code=class+X+%7B%0A++static+accessor+a+%3D+b%3B%0A++static+c+%3D+d%3B%0A%7D%0A)): ```ts class X { static accessor a = b; static c = d; } ``` Before output: ```js class X { static accessor a = b; static c = d; } ``` After output: ```js class X { static accessor a = b; static { this.c = d; } } ``` `c` is assigned again, as before #29748 and as in `tsc` 5.9.3. The outputs come from `cargo run -p oxc_transformer --example transformer` with `setPublicClassFields: true` and `transform-typescript`, on parent `c265eda3` and on this branch. The playground runs released Oxc. Node can't run `accessor` or decorators, so there is no runtime example or `exec.js`. ### What stays a field Preserved classes now go through the same conversion as other classes, except for: - **Decorated fields**, which the downstream decorator transform needs. - **Instance fields written before a decorated field or an initialized `accessor`.** Their assignments would run in the constructor, after that later initializer: ```ts class C { c = d; accessor a = this.c; // `c` stays a field, so `a` still sees it } ``` `tsc` lowers the accessor here instead, but oxc keeps `accessor` as is (#27741). Static fields become static blocks in place, so they are always converted. The two `use-define-for-class-fields` fixtures that #29748 changed are back to static blocks. ### One ownership decision per class The regression came from one flag answering two questions. `ClassLoweringMode::Preserve` meant both "no transform lowers this class" and "TypeScript doesn't touch its fields". The TypeScript transform then combined the mode, `ClassTransform::owns_all_class_fields()` and `setPublicClassFields` in three places that had to agree. `ClassLowering` now answers the questions that transforms ask directly: - `lowers_fields()`: class-properties lowers the fields. Otherwise TypeScript gives them its own semantics. - `keeps_field()`: the decorated fields and auto-accessors that a preserved class keeps as written. - `first_movable_instance_field()`: instance fields before this index stay, so initializers keep their order. TypeScript, class-properties and legacy decorators all use these. `ClassTransform::owns_all_class_fields()` is gone, `ClassLoweringMode` is private to `class_lowering.rs`, and native and preserved classes share one path in the TypeScript transform. This also fixes parameter property fields with `removeClassFieldsWithoutInitializer`. They were added on class entry, then removed on class exit: ```ts class A { x: number; constructor(public p: number) {} } ``` Before output: ```js class A { constructor(p) { this.p = p; } } ``` After output: ```js class A { p; constructor(p) { this.p = p; } } ``` The `p;` matches `tsc` with `useDefineForClassFields: true`. Fields are now added on exit, after removal. The new `parameter-property-fields-remove-uninitialized` fixture covers this, including a removed field with the same name and nested classes. With legacy decorators and class-properties, `removeClassFieldsWithoutInitializer` now also erases undecorated fields without initializers, as it already did in every other mode. Before, `x: number` became `defineProperty(this, "x", void 0)`. The new `legacy-decorators/oxc/class-properties-remove-class-fields-without-initializer` fixture covers this. ### Related issues - #21365: the ordering bug above, for accessors lowered by legacy decorators. Its fixture still passes, and this PR applies the same ordering to preserved accessors. - #27741: `accessor` is never lowered on its own. Once it can be, the fields that stay above can be converted as well. I noted this on the issue. - #29904, fixed by #29911: non-identifier keys left `null;` behind. Preserved classes now use the same conversion, and with #29911 they keep their original keys too (`"x";`, `[_y = y];`). Fixes a regression from #29748. Part of #9170. Prepared with AI assistance: Claude Opus 5.5 (`claude-opus-5-5`); reasoning effort level unavailable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018ogydbcf46ZrwM8jrDg2nT --------- Co-authored-by: Claude <noreply@anthropic.com>
camc314
added a commit
to camc314/rolldown
that referenced
this pull request
Nov 23, 2026
Oxc keeps class elements together when decorators or auto-accessors are preserved for a downstream transform. Regenerate the three auto-accessor snapshots for ES2021, ES2022 and ESNext, and the standard-decorator fixture with legacy decorators disabled. Static fields stay in the class and decorated fields retain their decorators. The immediate parent passes all four original snapshots. Executing both sets of outputs after TypeScript lowering confirms the same auto-accessor values and initializer order. The standard-decorator output runs the decorators on the four retained public fields. First-bad-Oxc-Commit: a7ea78b405740bd69c3a472ddffccb9b35feb7c5 Oxc-Revision: a7ea78b405740bd69c3a472ddffccb9b35feb7c5
camc314
added a commit
that referenced
this pull request
Nov 23, 2026
### 💥 BREAKING CHANGES - f573c93 syntax: [**BREAKING**] Remove `NumberBase` and `BigintBase` types (#29920) (overlookmotel) - b90b3aa ast: [**BREAKING**] Remove `base` field from `NumericLiteral` and `BigIntLiteral` (#29919) (overlookmotel) - 8c2abc4 diagnostics: [**BREAKING**] Implement `SourceCode` for `&T` (#29852) (overlookmotel) - 2bc8e89 diagnostics: [**BREAKING**] `NamedSource` support `&str` as name (#29851) (overlookmotel) ### 🚀 Features - 2384875 minifier: Remove redundant `| 0` under bitwise operators (#29991) (Cameron) - abf889f minifier: Flatten nested string concatenations (#30015) (Cameron) - 5f51bd3 minifier: Fold division with short numeric results (#29994) (Cameron) - 1102f24 minifier: Flatten nested untagged template literals (#29993) (Cameron) - 12897a0 minifier: Fold switch with one case and default into if-else (#29990) (Cameron) - f9e90de minifier: Fold numeric identities like `x - 0` and `x * 1` (#29926) (Dunqing) - c265eda minifier,ecmascript: Fold additive zero and safe offsets on int32/uint32 expressions (#29865) (Andre_Ramirez) - 37ec2e2 compat: Add standard decorators compatibility data (#29448) (Dunqing) - 22e4d0b runtime: Add standard decorator helpers (#29447) (Dunqing) - a67ac1f data_structures: Add brand types (#29756) (overlookmotel) ### 🐛 Bug Fixes - 38cd470 transformer: Share auto-accessor lowering and fix its private storage names (#29449) (Dunqing) - 6838760 packages/codegen: Parenthesize for-of targets that start with `let` (#30071) (Cameron) - 13dd5ac packages/codegen: Parenthesize comma expressions in enum initializers (#30070) (Cameron) - c4e4fcc packages/codegen: Parenthesize private `in` checks in for initializers (#30073) (Cameron) - 32882ef packages/codegen: Parenthesize comma expressions in export assignments (#30072) (Cameron) - 7d8998d packages/codegen: Parenthesize comma expressions in JSX containers (#30074) (Cameron) - c98b8b1 packages/codegen: Parenthesize TypeScript instantiation operands (#30068) (Cameron) - d615de4 codegen: Parenthesize TypeScript instantiation expressions used as operands (#30065) (Cameron) - 90b5af9 codegen: Keep `()` on minified `new` expressions with type arguments (#30062) (Cameron) - 4b1efd3 transformer/legacy-decorator: Move class self-references to alias symbol (#30056) (Dunqing) - adf284e mangler: Use debug names for private members (#30061) (Cameron) - bbe2fba transformer/legacy-decorator: Avoid class name shadowing in static setters (#30058) (Dunqing) - 7fa5d50 codegen: Keep comments from ending a line after code (#29814) (Yuji Sugiura) - 41dbc08 mangler: Keep names set by redeclarations with keepNames (#30055) (Dunqing) - 8921865 transformer/legacy-decorator: Keep static private brand checks on the original class (#30054) (Dunqing) - abb3593 transformer/legacy-decorator: Share anonymous default class bindings (#29753) (Dunqing) - bbc6772 lexer: Read << as a shift where TypeScript opens no type arguments (#30051) (Shanon Jackson) - 52b5506 transformer/class-properties: Preserve names of anonymous classes (#29931) (Dunqing) - 8488767 codegen: Parenthesize private `in` tests in `for` initializers (#30037) (Cameron) - 395913e parser: Parse `<=` after `as` and `satisfies` (#30028) (Cameron) - 9570bc8 parser: Require `class` keyword for decorated class export (#30027) (Cameron) - e9e80b1 codegen: Parenthesize for-of heads that print a leading `let` or `async` (#30025) (Cameron) - a54befb codegen: Avoid double parentheses around `as`/`satisfies` for-of heads (#30024) (Cameron) - 157673a codegen: Parenthesize comma expressions in export assignments (#30022) (Cameron) - bedf3f5 codegen: Parenthesize comma expressions in enum initializers (#30021) (Cameron) - 11bafb6 codegen: Parenthesize comma expressions in JSX containers (#30020) (Cameron) - 967a97c codegen: Print a computed key for renamed `__proto__` shorthand (#30019) (Cameron) - 64b7176 minifier: Preserve throwing `String.fromCodePoint` calls (#30014) (Cameron) - f17a216 ecmascript: Evaluate unary expressions in `ToNumber` (#30009) (Cameron) - 181dd40 ecmascript: Canonicalize RegExp flags in string conversion (#30008) (Cameron) - cf35a2e ecmascript: Respect shadowed `NaN` in strict equality (#30005) (Cameron) - 2d9246e minifier: Don't inline block-level vars visible to an outer direct eval (#29992) (Cameron) - 08023ad transformer: Keep TypeScript assign semantics for preserved classes (#29930) (Dunqing) - 32798b3 minifier: Don't treat reassigned `@__NO_SIDE_EFFECTS__` functions as pure (#29974) (oxc-captain[bot]) - 0167451 parser: Treat `import x = require()` as module syntax (#29908) (camc314) - e27f727 semantic: Align JSDoc nullable type suggestions with TypeScript (#29947) (camc314) - 831fbca transformer: Don't fold computed key assignments into non-computed method keys (#29912) (Dunqing) - 6db561f transformer: Keep correct keys on leftover fields with setPublicClassFields (#29911) (Dunqing) - e4e2ac4 parser,semantic: Reject invalid types in type arguments (#29945) (camc314) - bdbed9e transformer/async-to-generator: Avoid invalid and shadowing inferred function names (#29815) (YT) - a0f67fa parser: Parse TSX `<T extends U` as start of generic arrow function (#29910) (overlookmotel) - 8c84c5f parser: Never parse `<` as start of generic arrow function in JSX files (#29909) (overlookmotel) - f5022f2 lexer: Read yield and await by enclosing function in modules (#29890) (Shanon Jackson) - 168daf3 lexer: Keep async and generator scope across class members and generic async arrows (#29889) (Shanon Jackson) - 777d2d1 parser: Report import/export in unambiguous code resolved to script (#29902) (camc314) - e385fe8 parser: Don't treat `await` in function parameters and class fields as top-level await (#29901) (camc314) - 5442f8a parser: Report misplaced import/export before checking parse goal (#29898) (camc314) - c589002 minifier: Drop redeclarations of removed declarations (#29415) (Dunqing) - 24a1aaf parser: Discard comments from rewound speculative parses (#29847) (camc314) - 1aadbe7 isolated-declarations: Preserve const literal initializers through parentheses (#29041) (camc314) - a7ea78b transformer: Keep classes whose decorators are preserved (#29748) (Dunqing) - 5ece804 transformer/async-to-generator: Remove leading digits from inferred function names (#29816) (YT) - 15bdce3 parser: `parse_expression` produce correct error for overlong source (#29761) (overlookmotel) - b6ff506 react-compiler: Do not treat the receiver of a JSX ref property load as a ref (#29754) (Boshen) - 2f6a11f semantic: Keep catch parameters in the catch clause scope (#29635) (Dunqing) - 60718a1 minifier: Keep unused classes with a static computed `prototype` key (#27966) (baltasarblanco) - d59aa8e transformer/legacy-decorator: Apply static member decorators last (#27744) (Yunus Ozen) - 97307e3 transformer/legacy-decorator: Emit `String`/`Number` metadata for enums declared after the class (#29724) (Max Schwenk) - 3586c66 transformer: Preserve object rest assignment evaluation (#29645) (Boshen) - 4fb4887 allocator: Require Sync allocator for Drain Send (#26152) (Cameron) - f860f1b semantic: Resolve a private name to the enclosing class that declares it (#29714) (Nadir Ali) - 7b2b207 parser: Parse contextual keywords after relational expressions (#25097) (camc314) - b7e2beb minifier: Preserve indirect calls when inlining eval aliases (#29725) (Yunfei He) - 279185a react-compiler: Ignore ESLint suppressions when hooks and memo validations are enabled (#29655) (Boshen) - d69ba66 napi/parser: Walk skipped ESTree fields in lazy visitor (#29381) (Ryan Tsao) - f22757c transformer/class-properties: Preserve receivers in TS-wrapped private calls (#29684) (camc314) - 0e1ef65 transformer/exponentiation-operator: Scope default parameter temporaries (#29685) (camc314) ### ⚡ Performance - 209f078 mangler: Include digits in trailing character frequency order (#29437) (camc314) - 5e7abd1 parser: Remove unnecessary conversion when parsing BigInts (#29913) (overlookmotel) - 5ac3942 parser: Mark missing-digit lexer errors cold (#29806) (Boshen) - 892f086 various: Avoid copying source text in `OxcDiagnostic::render_with_source_code` callers (#29850) (overlookmotel) - 27777a9 diagnostics: Loosen lifetime bound on `OxcDiagnostic::with_source_code` (#29849) (overlookmotel) - a2eed1b parser: Read each comment once (#29794) (Boshen) - ec4090d semantic: Size the `Scoping` arena from symbol, reference and scope counts (#29809) (Boshen) - 7c39be0 minifier: Avoid rebuilding variable declarations when keeping all declarators (#29767) (camc314) - 0537b09 parser: Take the name of a JSX identifier from its token (#29746) (Boshen) - 1c2cd7c parser: Take the value of a string literal without escapes from its source text (#29745) (Boshen) - 1d84d3f parser: Take the value of JSX text from its source text (#29744) (Boshen) - 41e3075 parser: Check for the `<` of type arguments without a call (#29743) (Boshen) - 6e783b1 parser: Keep the token read after `import` (#29742) (Boshen) - eb9c7a4 parser: Parse `(<div />)` as a parenthesized expression directly (#29741) (Boshen) - 7acf20a parser: Parse JSX at the start of an expression without speculation (#29740) (Boshen) - aea847b estree: Merge compact `serialize_field` writes (#28399) (codspeed[bot]) - 414532b parser: Cache failed type argument speculation (#29518) (Boshen) - d91c961 parser: Take comments from the lexer without copying inline storage (#29623) (Boshen) - dda1781 parser: Finish plain strings and integers in their token handler (#29622) (Boshen) - 6f5d371 parser: Choose how to scan a block comment from its first bytes (#29621) (Boshen) - d80d731 parser: Do less work to record each comment (#29620) (Boshen) - ce2b7aa parser: Lex the token after a line break in its token handler (#29619) (Boshen) - 7833ea0 parser: Finish identifier and keyword tokens in their token handler (#29618) (Boshen) - bb08acb parser: Dispatch tokens through handlers which finish the token (#29617) (Boshen) - a1ed5af parser: Parse `(…)` once with a cover grammar for arrow functions (#29603) (Boshen) ### 📚 Documentation - 158fcf5 minifier: Fix duplicated word in comment (#30059) (Dunqing) - 3ff249b skills: Share PR title guidance with triagebot (#29980) (Cameron) - 983ebc7 ast: Clarify which keys `PropertyKey::static_name` supports (#29905) (camc314) - 1da6ea8 skills: Merge PR guidance into pr-guide skill (#29866) (Dunqing) - 9740083 minifier: Clarify when variable declarations are merged (#29768) (camc314) --------- Co-authored-by: Cameron <cameron.clark@hey.com>
camc314
added a commit
to camc314/rolldown
that referenced
this pull request
Nov 23, 2026
Oxc keeps class elements together when decorators or auto-accessors are preserved for a downstream transform. Regenerate the three auto-accessor snapshots for ES2021, ES2022 and ESNext, and the standard-decorator fixture with legacy decorators disabled. Static fields stay in the class and decorated fields retain their decorators. The immediate parent passes all four original snapshots. Executing both sets of outputs after TypeScript lowering confirms the same auto-accessor values and initializer order. The standard-decorator output runs the decorators on the four retained public fields. First-bad-Oxc-Commit: a7ea78b405740bd69c3a472ddffccb9b35feb7c5 Oxc-Revision: a7ea78b405740bd69c3a472ddffccb9b35feb7c5
hyfdev
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Nov 23, 2026
## Summary - Upgrade Oxc Rust dependencies to 0.160.0. - Upgrade @oxc-project/runtime, @oxc-project/types, oxc-parser, and oxc-transform to 0.160.0. - Update the Rust `url` dependency to 2.5.9 for the security check. [RUSTSEC-2026-0592](https://rustsec.org/advisories/RUSTSEC-2026-0592.html) ## Root causes ### oxc-project/oxc#29748 Oxc keeps class elements together when standard decorators or auto-accessors are preserved. The snapshots show decorated fields retaining their decorators and static field initialization staying inside the class. ### oxc-project/oxc#29415 Oxc clears stale redeclaration records when it drops declarations. The minified `catch_var_self_import` snapshot now omits three unused catch parameters and retains the bindings still used by the fixture. ### oxc-project/oxc#29919 Oxc removes the numeric and BigInt literal base fields. Rolldown updates the affected AST constructors while preserving literal values, raw text, and spans. ### oxc-project/oxc#29907 Oxc encodes whether a property key is computed in the `PropertyKey` variant. Rolldown updates key construction and inspection, preserves quoted and computed options in Vite import glob, and uses computed keys for own `__proto__` properties in JSON and namespace objects. The minified JSON snapshot now prints the computed strings with backticks. ### oxc-project/oxc#29930 Oxc restores TypeScript assignment semantics for public static fields in classes with preserved accessors. The auto-accessor fixtures emit in-place static blocks so assignments call inherited setters and preserve initializer order. ### oxc-project/oxc#29994 Oxc folds `3 / 6` to `.5` in the JavaScript constant and TypeScript enum entries of the cross-module constant-folding snapshot. Both outputs evaluate to the same values. ### oxc-project/oxc#29753 Oxc shares the class binding between static field lowering and legacy decoration for anonymous default exports. Two classes gain explicit names in the snapshot, and a decorator can read initialized static fields when targeting ES2015. ### oxc-project/oxc#29447 Oxc adds six standard decorator helpers to its runtime package. Regenerate the embedded ESM and CommonJS modules so Rolldown’s runtime plugin can load the helpers in standalone bundles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Class-field lowering produced invalid JavaScript for Puppeteer's private auto-accessor, which Oxc's downstream tests hit (report). It left the auto-accessor in the class but extracted the private method that reads it, and emitted a helper call with a missing argument. With legacy decorators disabled, the same lowering could also erase a decorated field and its decorator.
Example
Input (playground for this example):
Before output:
After output:
The accessor and its private method stay together, so no private-field helper is emitted.
Decorated TypeScript field
Input:
Before output:
After output:
The type annotation is removed, but the field and its decorator survive.
Both examples were captured with
cargo run -p oxc_transformer --example transformer -- <input> --target chrome49on parenta2eed1b99fand this branchd79897face, with legacy decorators disabled and define semantics for class fields.Fix
Each class is now marked to be preserved or lowered before TypeScript strips its type-only elements. Classes with preserved decorators or runtime auto-accessors keep their class elements and private bindings for a downstream transform; plain classes and unrelated syntax still get the target-selected transforms. Private references follow their declaring class, even when nested classes use a different mode. For TypeScript parameter properties in assignment mode, the constructor assignment remains, without a synthetic field that would shadow an inherited setter.
Transformer and Node binding tests pass, allocation snapshots are unchanged, and transform output conformance (754/1182 Babel, 337/462 Oxc) has no new failures. Full execution conformance was not rerun for this revision.
Part of #9170. This is the prerequisite below #27784.
AI disclosure: prepared with AI assistance (model ID:
mythos-magpie-4133180673; reasoning effort unavailable).