Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(next-core): relay transform plugin #48899

Merged
merged 11 commits into from
May 9, 2023
71 changes: 37 additions & 34 deletions Cargo.lock

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

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ next-transform-strip-page-exports = { path = "packages/next-swc/crates/next-tran
# SWC crates
# Keep consistent with preset_env_base through swc_core
swc_core = { version = "0.75.41" }
swc_relay = { version = "0.2.7" }
testing = { version = "0.33.6" }
testing = { version = "0.33.4" }

# Turbo crates
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230504.3" }
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230508.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230504.3" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230508.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230504.3" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230508.2" }

# General Deps

Expand Down
1 change: 0 additions & 1 deletion packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ turbo-binding = { workspace = true, features = [
"__swc_transform_modularize_imports",
"__swc_transform_relay",
] }
swc_relay = { workspace = true }

[dev-dependencies]
turbo-binding = { workspace = true, features = [
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct TransformOptions {

#[serde(default)]
#[cfg(not(target_arch = "wasm32"))]
pub relay: Option<swc_relay::Config>,
pub relay: Option<turbo_binding::swc::custom_transform::relay::Config>,

#[allow(unused)]
#[serde(default)]
Expand Down Expand Up @@ -142,7 +142,7 @@ where
#[cfg(not(target_arch = "wasm32"))]
let relay_plugin = {
if let Some(config) = &opts.relay {
Either::Left(swc_relay::relay(
Either::Left(turbo_binding::swc::custom_transform::relay::relay(
config,
file.name.clone(),
current_dir().unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use next_swc::{
shake_exports::{shake_exports, Config as ShakeExportsConfig},
};
use next_transform_font::{next_font_loaders, Config as FontLoaderConfig};
use swc_relay::{relay, RelayLanguageConfig};
use turbo_binding::swc::{
core::{
common::{chain, comments::SingleThreadedComments, FileName, Mark},
Expand All @@ -25,6 +24,7 @@ use turbo_binding::swc::{
},
},
},
custom_transform::relay::{relay, RelayLanguageConfig},
testing::fixture,
};

Expand Down Expand Up @@ -151,7 +151,7 @@ fn page_config_fixture(input: PathBuf) {
#[fixture("tests/fixture/relay/**/input.ts*")]
fn relay_no_artifact_dir_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
let config = swc_relay::Config {
let config = turbo_binding::swc::custom_transform::relay::Config {
language: RelayLanguageConfig::TypeScript,
artifact_directory: Some(PathBuf::from("__generated__")),
..Default::default()
Expand Down