-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Conversation
packages/next-swc/crates/next-core/src/next_shared/transforms/relay.rs
Outdated
Show resolved
Hide resolved
65d44cc
to
9616338
Compare
.relay | ||
.as_ref() | ||
.map(|config| { | ||
// [TODO]: There are config mismatches between RelayConfig to swc_relay::Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an linear issue and reference that here
program: &mut Program, | ||
ctx: &TransformContext<'_>, | ||
) -> Option<Program> { | ||
let module_program = unwrap_module_program(program); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these should do it:
let module_program = unwrap_module_program(program); | |
let module_program = std::mem::take(program); |
let module_program = unwrap_module_program(program); | |
let module_program = std::mem::replace(program, Program::dummy()); |
let module_program = unwrap_module_program(program); | |
let module_program = std::mem::replace(program, Program::Module(Module::dummy())); |
Some(module_program.fold_with(&mut next_dynamic( | ||
self.is_development, | ||
self.is_server, | ||
self.is_server_components, | ||
NextDynamicMode::Turbo, | ||
FileName::Real(ctx.file_path_str.into()), | ||
self.pages_dir.clone(), | ||
))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When transform has been change to not return Option
Some(module_program.fold_with(&mut next_dynamic( | |
self.is_development, | |
self.is_server, | |
self.is_server_components, | |
NextDynamicMode::Turbo, | |
FileName::Real(ctx.file_path_str.into()), | |
self.pages_dir.clone(), | |
))) | |
*program = module_program.fold_with(&mut next_dynamic( | |
self.is_development, | |
self.is_server, | |
self.is_server_components, | |
NextDynamicMode::Turbo, | |
FileName::Real(ctx.file_path_str.into()), | |
self.pages_dir.clone(), | |
)) |
needs rebase |
9616338
to
257f912
Compare
257f912
to
333f0ce
Compare
0f8ff7e
to
82d437a
Compare
82d437a
to
d43266b
Compare
Failing test suitesCommit: 27f6f93
Expand output● Middleware custom matchers basePath › should match query path
Read more about building and testing Next.js in contributing.md. |
What
Part 1 for WEB-848.
This PR implements initial path to enable relay compiler option in Turbopack. PR is based on approach WEB-955, that passing custom plugin transform itself instead of trying to pass down configuration into turbopack. In result, this PR requires counterpart turbopack PR at vercel/turborepo#4721.
PR also refactors next-shared's transform bit, as we have grown number of custom transforms.
Unfortunately there are some runtime errors with this transforms, so it is not possible to use relay actually yet. WEB-956 tracks this. (swc-project/plugins#179)