diff --git a/patches/0001-return-typed-ast-no-json.patch b/patches/0001-return-typed-ast-no-json.patch deleted file mode 100644 index 70a4229..0000000 --- a/patches/0001-return-typed-ast-no-json.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff --git a/react-compiler/crates/react_compiler/src/entrypoint/compile_result.rs b/react-compiler/crates/react_compiler/src/entrypoint/compile_result.rs -index 24971f2..7ae4199 100644 ---- a/react-compiler/crates/react_compiler/src/entrypoint/compile_result.rs -+++ b/react-compiler/crates/react_compiler/src/entrypoint/compile_result.rs -@@ -80,11 +80,13 @@ pub struct BindingRenameInfo { - #[serde(tag = "kind", rename_all = "lowercase")] - pub enum CompileResult { - /// Compilation succeeded (or no functions needed compilation). -- /// `ast` is None if no changes were made to the program. -- /// The AST is stored as a pre-serialized JSON string (RawValue) to avoid -- /// double-serialization: File→Value→String becomes File→String directly. -+ /// `ast` is None if no changes were made to the program. The compiled Babel -+ /// AST is returned by value so in-process Rust consumers (the oxc/swc -+ /// front-ends) use it directly instead of round-tripping through JSON. -+ /// `CompileResult` still derives `Serialize`, so a JS consumer can serialize -+ /// the whole result as before. - Success { -- ast: Option>, -+ ast: Option, - events: Vec, - /// Unified ordered log interleaving events and debug entries. - /// Items appear in the order they were emitted during compilation. -diff --git a/react-compiler/crates/react_compiler/src/entrypoint/program.rs b/react-compiler/crates/react_compiler/src/entrypoint/program.rs -index a0f7966..ffebee4 100644 ---- a/react-compiler/crates/react_compiler/src/entrypoint/program.rs -+++ b/react-compiler/crates/react_compiler/src/entrypoint/program.rs -@@ -3983,27 +3983,12 @@ pub fn compile_program(mut file: File, scope: ScopeInfo, options: PluginOptions) - // Now we can mutate file.program - apply_compiled_functions(&replacements, &mut file.program, &mut context); - -- // Serialize the modified File AST directly to a JSON string and wrap as RawValue. -- // This avoids double-serialization (File→Value→String) by going File→String directly. -- // The RawValue is embedded verbatim when the CompileResult is serialized. -- let ast = match serde_json::to_string(&file) { -- Ok(s) => match serde_json::value::RawValue::from_string(s) { -- Ok(raw) => Some(raw), -- Err(e) => { -- eprintln!("RUST COMPILER: Failed to create RawValue: {}", e); -- None -- } -- }, -- Err(e) => { -- eprintln!("RUST COMPILER: Failed to serialize AST: {}", e); -- None -- } -- }; -- - let timing_entries = context.timing.into_entries(); - -+ // Return the compiled Babel AST by value — no JSON round-trip for in-process -+ // Rust consumers (the oxc/swc front-ends deserialized it back immediately). - CompileResult::Success { -- ast, -+ ast: Some(file), - events: context.events, - ordered_log: context.ordered_log, - renames: convert_renames(&context.renames), -diff --git a/react-compiler/crates/react_compiler_oxc/src/lib.rs b/react-compiler/crates/react_compiler_oxc/src/lib.rs -index 3437a12..b47ef40 100644 ---- a/react-compiler/crates/react_compiler_oxc/src/lib.rs -+++ b/react-compiler/crates/react_compiler_oxc/src/lib.rs -@@ -77,13 +77,9 @@ pub fn transform( - // This maps source positions to new identifier names for uncompiled code. - let rename_plan = build_rename_plan(&scope_info, &renames); - -- let compiled_file = program_ast.and_then(|raw_json| { -- // First parse to serde_json::Value which deduplicates "type" fields -- // (the compiler output can produce duplicate "type" keys due to -- // BaseNode.node_type + #[serde(tag = "type")] enum tagging) -- let value: serde_json::Value = serde_json::from_str(raw_json.get()).ok()?; -- serde_json::from_value(value).ok() -- }); -+ // `compile_program` returns the Babel AST by value — use it directly, no -+ // JSON round-trip. -+ let compiled_file = program_ast; - - TransformResult { - file: compiled_file, -diff --git a/react-compiler/crates/react_compiler_swc/src/lib.rs b/react-compiler/crates/react_compiler_swc/src/lib.rs -index cbd5bcc..2698dc2 100644 ---- a/react-compiler/crates/react_compiler_swc/src/lib.rs -+++ b/react-compiler/crates/react_compiler_swc/src/lib.rs -@@ -102,15 +102,10 @@ pub fn transform( - } => (None, events, Vec::new()), - }; - -- let conversion_result = program_json.and_then(|raw_json| { -- // First parse to serde_json::Value which deduplicates "type" fields -- // (the compiler output can produce duplicate "type" keys due to -- // BaseNode.node_type + #[serde(tag = "type")] enum tagging) -- let value: serde_json::Value = serde_json::from_str(raw_json.get()).ok()?; -- let file: react_compiler_ast::File = serde_json::from_value(value).ok()?; -- let result = convert_program_to_swc_with_source(&file, Some(source_text)); -- Some(result) -- }); -+ // `compile_program` returns the Babel AST by value — convert it directly, -+ // no JSON round-trip. -+ let conversion_result = -+ program_json.map(|file| convert_program_to_swc_with_source(&file, Some(source_text))); - - let (mut swc_module, mut comments) = match conversion_result { - Some(result) => (Some(result.module), Some(result.comments)), diff --git a/patches/0002-update-swc-crate-versions.patch b/patches/0001-update-swc-crate-versions.patch similarity index 100% rename from patches/0002-update-swc-crate-versions.patch rename to patches/0001-update-swc-crate-versions.patch