diff --git a/.gitignore b/.gitignore index e1d42a3..a3d4dda 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ # Build artifacts /target/ +/codemod/target/ /react-compiler/target/ /node_modules/ diff --git a/codemod/src/main.rs b/codemod/src/main.rs index 90bf5dc..14779b3 100644 --- a/codemod/src/main.rs +++ b/codemod/src/main.rs @@ -11,7 +11,8 @@ //! - inherits version/edition/license/description/repository from `[workspace.package]` //! - internal deps become `{ workspace = true }` //! - any `regex` dep is swapped to a `regex-lite` package rename (import name kept) -//! - `publish` = true for `react_compiler` and its (transitive) deps; false for the rest +//! - `publish` = true for the publish roots (`react_compiler`, `react_compiler_swc`) and +//! their (transitive) deps; false for the rest //! Root `[workspace.dependencies]` maps each import name to its published package: //! `react_compiler_X = { package = "nextjs_react_compiler_X", version, path }` //! @@ -30,6 +31,10 @@ const EDITION: &str = "2024"; const LICENSE: &str = "MIT"; const DESCRIPTION: &str = "Rust port of the React Compiler, vendored from facebook/react."; const REPOSITORY: &str = "https://github.com/vercel/forked-react-compiler"; +/// Crates whose `publish` flag is set to `true` (along with their transitive +/// internal deps). Everything else gets `publish = false`. Import names (not +/// published `nextjs_*` names). +const PUBLISH_ROOTS: &[&str] = &["react_compiler", "react_compiler_swc"]; /// React's MIT LICENSE, kept as a local copy (`./LICENSE`) and linked into the /// tool so syncing needs no network for it. const LICENSE_TEXT: &str = include_str!("../../LICENSE"); @@ -176,8 +181,8 @@ fn edit_root_manifest(root: &Path, members: &[Member], version: &str) { fs::write(&path, doc.to_string()).expect("write workspace Cargo.toml"); } -/// Crates reachable from `react_compiler` over internal `[dependencies]` / -/// `[build-dependencies]` — the set to publish — including `react_compiler` itself. +/// Crates to publish: the publish roots (`react_compiler`, `react_compiler_swc`) plus +/// everything reachable from them over internal `[dependencies]` / `[build-dependencies]`. fn publish_closure(members: &[Member], internal: &BTreeSet<&str>) -> BTreeSet { let mut adjacency: HashMap> = HashMap::new(); for member in members { @@ -196,7 +201,7 @@ fn publish_closure(members: &[Member], internal: &BTreeSet<&str>) -> BTreeSet = PUBLISH_ROOTS.iter().map(|s| s.to_string()).collect(); while let Some(name) = queue.pop_front() { if !closure.insert(name.clone()) { continue; diff --git a/react-compiler/crates/react_compiler_swc/Cargo.toml b/react-compiler/crates/react_compiler_swc/Cargo.toml index 3121807..e104c18 100644 --- a/react-compiler/crates/react_compiler_swc/Cargo.toml +++ b/react-compiler/crates/react_compiler_swc/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true license.workspace = true description.workspace = true repository.workspace = true -publish = false +publish = true [dependencies] react_compiler_ast = { workspace = true }