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

Remove ServerDirectiveTransformer #56496

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use turbopack_binding::{
},
dev::{react_refresh::assert_can_resolve_react_refresh, DevChunkingContext},
ecmascript::chunk::EcmascriptChunkingContext,
ecmascript_plugin::transform::directives::server::ServerDirectiveTransformer,
node::execution_context::ExecutionContext,
turbopack::{
condition::ContextCondition,
Expand Down Expand Up @@ -232,11 +231,6 @@ pub async fn get_client_module_options_context(
*get_emotion_transform_plugin(next_config).await?,
*get_styled_components_transform_plugin(next_config).await?,
*get_styled_jsx_transform_plugin().await?,
Some(Vc::cell(Box::new(ServerDirectiveTransformer::new(
// ServerDirective is not implemented yet and always reports an issue.
// We don't have to pass a valid transition name yet, but the API is prepared.
&Vc::cell("TODO".to_string()),
)) as _)),
]
.into_iter()
.flatten()
Expand Down
14 changes: 14 additions & 0 deletions packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,20 @@ pub async fn get_next_server_import_map(
"next/dist/build/webpack/loaders/next-flight-loader/action-proxy",
),
);
import_map.insert_exact_alias(
"private-next-rsc-action-client-wrapper",
request_to_import_mapping(
project_path,
"next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path for that file is a bit weird. Maybe we should move that out of the next-flight-loader

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we should do that at some point 👍

),
);
import_map.insert_exact_alias(
"private-next-rsc-action-validate",
request_to_import_mapping(
project_path,
"next/dist/build/webpack/loaders/next-flight-loader/action-validate",
),
);
import_map.insert_exact_alias(
"next/head",
request_to_import_mapping(project_path, "next/dist/client/components/noop-head"),
Expand Down
23 changes: 6 additions & 17 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use turbopack_binding::{
resolve::{parse::Request, pattern::Pattern},
},
ecmascript::TransformPlugin,
ecmascript_plugin::transform::directives::{
client::ClientDirectiveTransformer, server::ServerDirectiveTransformer,
},
ecmascript_plugin::transform::directives::client::ClientDirectiveTransformer,
node::execution_context::ExecutionContext,
turbopack::{
condition::ContextCondition,
Expand Down Expand Up @@ -276,12 +274,6 @@ pub async fn get_server_module_options_context(
let styled_components_transform_plugin =
*get_styled_components_transform_plugin(next_config).await?;
let styled_jsx_transform_plugin = *get_styled_jsx_transform_plugin().await?;
let server_directive_transform_plugin =
Some(Vc::cell(Box::new(ServerDirectiveTransformer::new(
// ServerDirective is not implemented yet and always reports an issue.
// We don't have to pass a valid transition name yet, but the API is prepared.
&Vc::cell("TODO".to_string()),
)) as _));

// ModuleOptionsContext related options
let tsconfig = get_typescript_transform_options(project_path);
Expand Down Expand Up @@ -374,7 +366,6 @@ pub async fn get_server_module_options_context(
let mut base_source_transforms: Vec<Vc<TransformPlugin>> = vec![
styled_components_transform_plugin,
styled_jsx_transform_plugin,
server_directive_transform_plugin,
]
.into_iter()
.flatten()
Expand Down Expand Up @@ -433,13 +424,11 @@ pub async fn get_server_module_options_context(
ecmascript_client_reference_transition_name,
..
} => {
let mut base_source_transforms: Vec<Vc<TransformPlugin>> = vec![
styled_components_transform_plugin,
server_directive_transform_plugin,
]
.into_iter()
.flatten()
.collect();
let mut base_source_transforms: Vec<Vc<TransformPlugin>> =
vec![styled_components_transform_plugin]
.into_iter()
.flatten()
.collect();

if let Some(ecmascript_client_reference_transition_name) =
ecmascript_client_reference_transition_name
Expand Down