Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
cb88f6c
refactor(react_compiler): vendor React Compiler core into oxc_react_c…
Boshen Jun 18, 2026
c411285
refactor(react_compiler): remove serde and JSON from oxc_react_compiler
Boshen Jun 18, 2026
1855356
perf(react_compiler): gate debug IR printers behind a `debug` feature
Boshen Jun 19, 2026
7407807
chore(react_compiler): exclude vendored modules from typos
Boshen Jun 19, 2026
2d1d848
refactor(react_compiler): lower front-end skeleton from oxc AST (WIP,…
Boshen Jun 19, 2026
365cf53
refactor(react_compiler): compile + run the oxc front-end skeleton (S…
Boshen Jun 19, 2026
475761a
refactor(react_compiler): port scalar expression arms to oxc (Stage 1…
Boshen Jun 19, 2026
a3b83fa
refactor(react_compiler): port member/call expressions + simple state…
Boshen Jun 19, 2026
1e174d9
refactor(react_compiler): port variable declarations to oxc (arm-fill)
Boshen Jun 19, 2026
256a999
refactor(react_compiler): port scalar expression arms (conditional/se…
Boshen Jun 19, 2026
687b8c5
fix(react_compiler): correct scalar port (arm-fill)
Boshen Jun 19, 2026
82255ca
refactor(react_compiler): port object/array expressions to oxc
Boshen Jun 19, 2026
49044e3
fix(react_compiler): correct object-array port (arm-fill)
Boshen Jun 19, 2026
cf5b78d
refactor(react_compiler): port JSX expressions to oxc
Boshen Jun 19, 2026
23efcae
refactor(react_compiler): port optional chaining (ChainExpression) to…
Boshen Jun 19, 2026
f1989f0
refactor(react_compiler): port function/arrow expressions to oxc
Boshen Jun 19, 2026
f399992
fix(react_compiler): correct function port (arm-fill)
Boshen Jun 19, 2026
48d586c
refactor(react_compiler): port assignment expression + destructuring …
Boshen Jun 19, 2026
1a72d3b
fix(react_compiler): correct assignment port (arm-fill)
Boshen Jun 19, 2026
8bfbc5b
refactor(react_compiler): port remaining statement arms to oxc
Boshen Jun 19, 2026
696d1ca
fix(react_compiler): correct statements port (arm-fill)
Boshen Jun 19, 2026
353e4e2
refactor(react_compiler): port identifier_loc_index to oxc (real walk)
Boshen Jun 20, 2026
a272f96
fix(react_compiler): correct loc-index port
Boshen Jun 20, 2026
e594f60
refactor(react_compiler): port find_context_identifiers to oxc (real …
Boshen Jun 20, 2026
f268ae8
fix(react_compiler): correct find-context port
Boshen Jun 20, 2026
df20c8c
refactor(react_compiler): drop UnsupportedNode + OriginalNode (not in…
Boshen Jun 20, 2026
3c087e4
fix(react_compiler): lower destructuring/default/rest function params…
Boshen Jun 20, 2026
0951c0b
fix(react_compiler): unwrap ParenthesizedExpression in lower_expressi…
Boshen Jun 20, 2026
b98e9b9
fix(react_compiler): lower object-literal shorthand methods instead o…
Boshen Jun 20, 2026
63d7fba
fix(react_compiler): manage fbt_depth and detect duplicate fbt sub-ta…
Boshen Jun 20, 2026
5e5c629
fix(react_compiler): thread source text so HIR SourceLocation line/co…
Boshen Jun 20, 2026
c56dacd
refactor(react_compiler): Stage 2 scaffold — back-end produces oxc AS…
Boshen Jun 20, 2026
d975a9f
refactor(react_compiler): port codegen orchestration to oxc (function…
Boshen Jun 20, 2026
4efd6ab
refactor(react_compiler): port codegen instruction-value emission to oxc
Boshen Jun 20, 2026
4dfaca8
refactor(react_compiler): port codegen jsx/object/function-expr/lvalu…
Boshen Jun 20, 2026
eec92a4
refactor(react_compiler): splice compiled oxc functions into the prog…
Boshen Jun 20, 2026
7b6b377
refactor(react_compiler): delete convert_ast_reverse + dead Babel cod…
Boshen Jun 20, 2026
cce74a6
fix(react_compiler): emit outlined functions in codegen splice
Boshen Jun 20, 2026
6301dc6
fix(react_compiler): reconstruct optional chains without spurious parens
Boshen Jun 20, 2026
9dc1bbe
fix(react_compiler): preserve TS as-expressions / type casts in codegen
Boshen Jun 20, 2026
9e39537
fix(react_compiler): fix remaining Stage-2 codegen fidelity diffs
Boshen Jun 20, 2026
5a03a28
refactor(react_compiler): relocate scope + RawNode types out of react…
Boshen Jun 20, 2026
d99d5c8
refactor(react_compiler): port function discovery to walk the oxc Pro…
Boshen Jun 20, 2026
aaa35d7
refactor(react_compiler): delete react_compiler_ast + convert_ast (Ba…
Boshen Jun 20, 2026
b02d661
refactor(react_compiler): finalize de-Babel: cleanup + just ready
Boshen Jun 20, 2026
0e0a38b
refactor(react_compiler): drop dead is_react_api and stale dead_code …
Boshen Jun 20, 2026
d0dbdee
feat(napi/transform): expose reactCompilerSync
Boshen Jun 20, 2026
4cd1f41
test(react_compiler): add babel-vs-oxc real-world comparison harness
Boshen Jun 20, 2026
3dd4d19
test(react_compiler): compare against the ported fork (BPRC), not jus…
Boshen Jun 20, 2026
135084e
test(react_compiler): document upstream react/react main comparison (…
Boshen Jun 20, 2026
e9b4a7f
fix(react_compiler): lower RegExpLiteral instead of bailing to undefined
Boshen Jun 20, 2026
442628e
fix(react_compiler): port destructuring reassignment targets in codegen
Boshen Jun 20, 2026
17a8a9e
fix(react_compiler): lower delete of member expressions
Boshen Jun 20, 2026
165d4fd
fix(react_compiler): use full span for Import-expression Todo diagnostic
Boshen Jun 20, 2026
c2f6f1a
fix(react_compiler): clear pife on passed-through functions in splice
Boshen Jun 20, 2026
7b882f9
fix(react_compiler): emit placeholder temp for inline class declarations
Boshen Jun 20, 2026
1133712
fix(react_compiler): normalize JSX text entities in passed-through JSX
Boshen Jun 20, 2026
60ee7ad
fix(react_compiler): skip declarator-annotation type refs in scope
Boshen Jun 21, 2026
44332de
fix(react_compiler): skip call/new type-argument type refs in scope
Boshen Jun 21, 2026
f08fd8e
fix(react_compiler): skip JSX type-argument type refs in scope
Boshen Jun 21, 2026
5a3cc21
fix(react_compiler): lower UpdateExpression on TS-cast member targets
Boshen Jun 21, 2026
c8006d6
style(react_compiler): apply rustfmt and oxfmt
Boshen Jun 21, 2026
424b660
chore(react_compiler): rename compare-tool vars to satisfy typos
Boshen Jun 21, 2026
50dc928
fix(react_compiler): read compound-assignment LHS through a load temp…
Boshen Jun 21, 2026
896ba47
fix(react_compiler): insert outlined functions into the original's co…
Boshen Jun 21, 2026
9af9f84
fix(react_compiler): parenthesize non-null assertion over optional chain
Boshen Jun 21, 2026
5c09c5e
fix(react_compiler): name optional-call chains in reorder diagnostic
Boshen Jun 21, 2026
079574d
fix(react_compiler): apply binding renames to re-parsed TS types
Boshen Jun 21, 2026
286ec54
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 21, 2026
63caa46
chore(react_compiler): exclude the compare tool from oxlint
Boshen Jun 21, 2026
e5650b7
perf(react_compiler): hold oxc TSType in HIR to avoid re-parsing type…
Boshen Jun 21, 2026
73d2627
fix(react_compiler): re-emit inline TS `enum` declarations in compile…
Boshen Jun 22, 2026
936dfcf
style(react_compiler): rustfmt line-wrapping left by the lifetime ref…
Boshen Jun 22, 2026
fa00161
perf(react_compiler): skip whole-source clone for files that bail
Boshen Jun 22, 2026
a485808
perf(react_compiler): splice in place via &mut Program instead of clo…
Boshen Jun 22, 2026
6fe5461
style(react_compiler): use bool::then_some in transform_source (clippy)
Boshen Jun 22, 2026
8b30951
perf(react_compiler): precompute scope children to drop O(scopes²) de…
Boshen Jun 22, 2026
3044a31
perf(react_compiler): skip all-scopes scan in TS this-parameter valid…
Boshen Jun 22, 2026
c18d084
perf(react_compiler): precompute declaration-site reference ids once
Boshen Jun 22, 2026
8e2a9ea
perf(react_compiler): fuse the three splice passthrough fixups into o…
Boshen Jun 23, 2026
5533278
perf(react_compiler): fold useMemoCache rename into the passthrough-f…
Boshen Jun 23, 2026
3276bf5
perf(react_compiler): build the source line-offset index once, not pe…
Boshen Jun 23, 2026
022a912
perf(react_compiler): share the reference-node-id set across functions
Boshen Jun 23, 2026
94fb769
perf(react_compiler): run the lint path without cloning the program
Boshen Jun 23, 2026
87983c7
perf(react_compiler): route static string construction in the globals…
Boshen Jun 23, 2026
3490587
refactor(react_compiler): drop the dead hmac-sha256 dependency
Boshen Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ extend-exclude = [
"crates/oxc_linter/src/rules/jsx_a11y/img_redundant_alt.rs",
"crates/oxc_linter/src/rules/react/no_unknown_property.rs",
"crates/oxc_parser/src/lexer/byte_handlers.rs",
# Vendored React Compiler core (kept close to upstream; legit short identifiers
# like `pn`/`oce`/`ome`/`froms` trip typos). The hand-written conversion code
# (`convert_*`, `lib`, ...) is not matched by this glob and stays checked.
"crates/oxc_react_compiler/src/react_compiler*",
"crates/oxc_syntax/src/xml_entities.rs",
"patches/**",
"pnpm-lock.yaml",
Expand Down
193 changes: 1 addition & 192 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "3"
members = ["apps/*", "crates/*", "napi/*", "tasks/*"]
exclude = ["apps/shared", "tasks/lint_rules", "tasks/e2e"]
exclude = ["apps/shared", "tasks/lint_rules", "tasks/e2e", "tasks/react_compiler_compare"]

[workspace.package]
authors = ["Boshen <boshenc@gmail.com>", "Oxc contributors"]
Expand Down
13 changes: 13 additions & 0 deletions crates/oxc_linter/src/context/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ pub struct ContextHost<'a> {
pub(super) config: Arc<LintConfig>,
/// Front-end frameworks that might be in use in the target file.
pub(super) frameworks: FrameworkFlags,
/// The arena that owns the parsed AST for this file. Rules that need to
/// allocate scratch AST nodes (e.g. the React Compiler lint rule, which runs
/// the compiler read-only) can reuse it instead of deep-cloning the program
/// into a private arena.
allocator: &'a oxc_allocator::Allocator,
}

impl std::fmt::Debug for ContextHost<'_> {
Expand All @@ -183,6 +188,7 @@ impl<'a> ContextHost<'a> {
sub_hosts: Vec<ContextSubHost<'a>>,
options: LintOptions,
config: Arc<LintConfig>,
allocator: &'a oxc_allocator::Allocator,
) -> Self {
const DIAGNOSTICS_INITIAL_CAPACITY: usize = 512;

Expand All @@ -203,6 +209,7 @@ impl<'a> ContextHost<'a> {
file_extension,
config,
frameworks: options.framework_hints,
allocator,
}
.sniff_for_frameworks()
}
Expand All @@ -228,6 +235,12 @@ impl<'a> ContextHost<'a> {
&self.current_sub_host().semantic
}

/// The arena that owns this file's parsed AST.
#[inline]
pub fn allocator(&self) -> &'a oxc_allocator::Allocator {
self.allocator
}

/// Mutable reference to the [`Semantic`] analysis of current script block.
#[inline]
pub fn semantic_mut(&mut self) -> &mut Semantic<'a> {
Expand Down
8 changes: 8 additions & 0 deletions crates/oxc_linter/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ impl<'a> LintContext<'a> {
self.parent.module_record()
}

/// The arena that owns this file's parsed AST. Rules that need scratch AST
/// allocations (e.g. the React Compiler rule) can reuse it instead of cloning
/// the program into a private arena.
#[inline]
pub fn allocator(&self) -> &'a oxc_allocator::Allocator {
self.parent.allocator()
}

/// Get the control flow graph for the current program.
#[inline]
pub fn cfg(&self) -> &ControlFlowGraph {
Expand Down
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ impl Linter {
let ResolvedLinterState { rules, config, external_rules } = self.config.resolve(path);
let mut timing_recorder = TIMINGS.then(|| RuleTimingRecorder::with_capacity(rules.len()));

let mut ctx_host = Rc::new(ContextHost::new(path, context_sub_hosts, self.options, config));
let mut ctx_host =
Rc::new(ContextHost::new(path, context_sub_hosts, self.options, config, allocator));

#[cfg(debug_assertions)]
let mut current_diagnostic_index = 0;
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/react/react_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Rule for ReactCompiler {
let program = ctx.nodes().program();
let options = react_compiler_options(ctx.file_path().to_str().map(ToString::to_string));

let result = oxc_react_compiler::lint(program, options);
let result = oxc_react_compiler::lint(program, ctx.allocator(), options);

let diagnostics = result.diagnostics.into_vec();
let diagnostics = if self.report_all_bailouts {
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_linter/src/utils/jest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ mod test {
)],
LintOptions::default(),
Arc::default(),
&allocator,
))
.spawn_for_test()
};
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_linter/src/utils/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ mod test {
)],
LintOptions::default(),
Arc::default(),
&allocator,
))
.spawn_for_test();

Expand Down
Loading
Loading