Files
Boshen 1645d93cfb fix(react_compiler): preserve source spans (#25462)
React Compiler rebuilt source-derived AST nodes with empty spans, so compiled function bodies had no useful source mappings. Preserve retained HIR and reactive spans during codegen while keeping synthetic memoization scaffolding unmapped.

AI-assisted: implementation used Codex; the author remains responsible for review.
2026-08-11 02:10:30 +00:00

73 lines
2.8 KiB
TOML

# oxc_react_compiler
#
# Native oxc integration for the Rust port of the React Compiler:
# https://github.com/react/react/tree/main/compiler
#
# This crate owns the oxc <-> react_compiler_ast conversion layer, plus the React
# Compiler *core* itself, vendored in-tree under `src/react_compiler*` (one module
# per upstream crate, from the MIT fork at oxc-project/forked-react-compiler). The
# core is frontend-agnostic (small utility crates only, never oxc); the AST/scope
# conversion on our side is written against the live workspace oxc AST.
[package]
name = "oxc_react_compiler"
version = "0.143.0"
publish = false
authors.workspace = true
categories.workspace = true
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description = "oxc integration for the Rust port of React Compiler"
include = ["src/**/*", "examples/**/*", "LICENSE", "README.md", "CHANGELOG.md"]
[lib]
doctest = false
[dependencies]
oxc_allocator = { workspace = true }
oxc_ast = { workspace = true }
oxc_ast_visit = { workspace = true }
oxc_diagnostics = { workspace = true }
oxc_ecmascript = { workspace = true }
oxc_index = { workspace = true }
oxc_semantic = { workspace = true }
oxc_span = { workspace = true }
oxc_str = { workspace = true }
oxc_syntax = { workspace = true, features = ["to_js_string"] }
# External crates the vendored React Compiler modules (`src/react_compiler*`) depend
# on. The compiler core is frontend-agnostic — small utility crates only, no oxc.
indexmap = { workspace = true }
rustc-hash = { workspace = true }
cow-utils = { workspace = true }
smallvec = { workspace = true }
[dev-dependencies]
# The example and integration tests parse source and print the compiled program; the
# library itself takes an already-parsed `Program` and never parses or codegens.
oxc_codegen = { workspace = true, features = ["sourcemap"] }
oxc_parser = { workspace = true }
# Snapshot testing of the compiler over the upstream fixture corpus (tests/snapshot.rs).
insta = { workspace = true, features = ["glob"] }
convert_case = { workspace = true }
# The `src/` conversion modules are vendored close to upstream `react_compiler_oxc`
# (kept near byte-for-byte to ease re-syncing). Defining `[lints.clippy]` means this
# crate does not inherit `[lints] workspace = true`, which keeps the in-house
# restriction lints (`todo!`/`unimplemented!`/...) off the vendored code while clippy's
# default correctness and perf checks still apply.
[lints.clippy]
result_large_err = "allow" # `Result<T, OxcDiagnostic>` everywhere; same trade-off as the workspace allow
# The vendored modules' doc comments reference types like `Vec<PatternLike>`
# without backticks; relax rustdoc for them rather than editing upstream code.
[lints.rustdoc]
broken_intra_doc_links = "allow"
invalid_html_tags = "allow"
bare_urls = "allow"