Repository navigation
feat(transformer): expose whether env options lower any JavaScript syntax - #30251
Merged
Merged
Conversation
Contributor
Merging this PR will not alter performanceWarning oxc-project has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed.
Comparing Footnotes
|
Dunqing
force-pushed
the
transformer-needs-js-transform
branch
from
November 25, 2026 14:55
056f9f9 to
cbefbea
Compare
Dunqing
force-pushed
the
decorators-lowering
branch
2 times, most recently
from
November 25, 2026 16:37
b6aeade to
1f5fcf7
Compare
Dunqing
force-pushed
the
transformer-needs-js-transform
branch
from
November 25, 2026 16:37
cbefbea to
18e8bed
Compare
Dunqing
force-pushed
the
decorators-lowering
branch
from
November 25, 2026 17:04
1f5fcf7 to
da26dfd
Compare
Dunqing
force-pushed
the
transformer-needs-js-transform
branch
2 times, most recently
from
November 25, 2026 17:23
9cad94a to
e66ccf8
Compare
Dunqing
force-pushed
the
decorators-lowering
branch
from
November 25, 2026 17:23
da26dfd to
2e5018e
Compare
…ntax Add `EnvOptions::lowers_syntax` so callers such as Rolldown can skip the transformer for plain JavaScript without keeping their own copy of the target feature list. It destructures every env flag, so a new flag fails to compile until it is counted. It does not cover transforms that do not depend on the target: decorators, TypeScript, JSX options, plugins and the module format.
Dunqing
force-pushed
the
decorators-lowering
branch
from
November 25, 2026 17:32
2e5018e to
90f41a1
Compare
Dunqing
requested review from
camc314,
leaysgur and
overlookmotel
as code owners
November 25, 2026 17:32
Dunqing
force-pushed
the
transformer-needs-js-transform
branch
from
November 25, 2026 17:32
e66ccf8 to
5bb4f53
Compare
camc314
approved these changes
Nov 25, 2026
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.
Rolldown skips the transformer for plain JavaScript when the target lowers nothing. To decide that, it keeps a hand-copied list of the
ESFeatures thatEnvOptions::from(EngineTargets)turns into transform flags, with a canary test. A missing entry once letusingdeclarations through at es2024.This adds
EnvOptions::lowers_syntax()so callers can ask Oxc instead: whether the env options lower, or reject, any JavaScript syntax. It destructures every flag, so a new flag doesn't compile until it's counted. It depends only on the options, so callers can cache it.When it is
false, the transformer leaves a JavaScript program's syntax unchanged, apart from transforms that don't depend on the target: decorators (decorator.legacy), TypeScript, JSX options (display_nameis on by default and namesReact.createClasscalls in any source type), plugins (styled-components, the</scripttagged-template transform) andEnvOptions::module. Whether a program needs decorator lowering comes with the standard decorators stack: #28882 addsDecoratorOptions::transforms_decoratorsnext to this.The new integration test checks the method against the transformer itself: for every ES target and a program for each lowered feature, a program the method says to skip must come out of the transformer unchanged. Transformer tests, clippy and transform conformance pass with no snapshot changes.
AI disclosure: written with Claude Code (Claude Opus 5.5, model ID claude-opus-5-5); reasoning effort level not exposed to the session.