diff --git a/packages/next-swc/crates/next-build/src/next_pages/page_chunks.rs b/packages/next-swc/crates/next-build/src/next_pages/page_chunks.rs index 44ac379a8d49c..284e5fe455190 100644 --- a/packages/next-swc/crates/next-build/src/next_pages/page_chunks.rs +++ b/packages/next-swc/crates/next-build/src/next_pages/page_chunks.rs @@ -122,7 +122,7 @@ pub async fn get_page_chunks( ) .into(); - let node_compile_time_info = get_server_compile_time_info(node_ty, mode, env, node_addr); + let node_compile_time_info = get_server_compile_time_info(mode, env, node_addr); let node_resolve_options_context = get_server_resolve_options_context( project_root, node_ty, diff --git a/packages/next-swc/crates/next-core/src/app_source.rs b/packages/next-swc/crates/next-core/src/app_source.rs index 5d8f6807322f0..aeeb17972d344 100644 --- a/packages/next-swc/crates/next-core/src/app_source.rs +++ b/packages/next-swc/crates/next-core/src/app_source.rs @@ -17,7 +17,7 @@ use turbopack_binding::{ chunk::{EvaluatableAssetVc, EvaluatableAssetsVc}, compile_time_info::CompileTimeInfoVc, context::{AssetContext, AssetContextVc}, - environment::{EnvironmentIntention, ServerAddrVc}, + environment::ServerAddrVc, issue::{Issue, IssueSeverity, IssueSeverityVc, IssueVc}, reference_type::{ EcmaScriptModulesReferenceSubType, EntryReferenceSubType, InnerAssetsVc, @@ -195,7 +195,7 @@ fn next_ssr_client_module_transition( next_config, execution_context, ), - ssr_environment: get_server_compile_time_info(ty, mode, process_env, server_addr), + ssr_environment: get_server_compile_time_info(mode, process_env, server_addr), } .cell() .into() @@ -213,7 +213,7 @@ fn next_server_component_transition( ) -> TransitionVc { let ty = Value::new(ServerContextType::AppRSC { app_dir }); let mode = NextMode::Development; - let rsc_compile_time_info = get_server_compile_time_info(ty, mode, process_env, server_addr); + let rsc_compile_time_info = get_server_compile_time_info(mode, process_env, server_addr); let rsc_resolve_options_context = get_server_resolve_options_context(project_path, ty, mode, next_config, execution_context); let rsc_module_options_context = @@ -240,11 +240,7 @@ fn next_edge_server_component_transition( ) -> TransitionVc { let ty = Value::new(ServerContextType::AppRSC { app_dir }); let mode = NextMode::Development; - let rsc_compile_time_info = get_edge_compile_time_info( - project_path, - server_addr, - Value::new(EnvironmentIntention::ServerRendering), - ); + let rsc_compile_time_info = get_edge_compile_time_info(project_path, server_addr); let rsc_resolve_options_context = get_edge_resolve_options_context(project_path, ty, next_config, execution_context); let rsc_module_options_context = @@ -272,11 +268,7 @@ fn next_edge_route_transition( ) -> TransitionVc { let server_ty = Value::new(ServerContextType::AppRoute { app_dir }); - let edge_compile_time_info = get_edge_compile_time_info( - project_path, - server_addr, - Value::new(EnvironmentIntention::Api), - ); + let edge_compile_time_info = get_edge_compile_time_info(project_path, server_addr); let edge_chunking_context = DevChunkingContextVc::builder( project_path, @@ -316,11 +308,7 @@ fn next_edge_page_transition( ) -> TransitionVc { let server_ty = Value::new(ServerContextType::AppRoute { app_dir }); - let edge_compile_time_info = get_edge_compile_time_info( - project_path, - server_addr, - Value::new(EnvironmentIntention::ServerRendering), - ); + let edge_compile_time_info = get_edge_compile_time_info(project_path, server_addr); let edge_chunking_context = DevChunkingContextVc::builder( project_path, @@ -457,7 +445,7 @@ fn app_context( let ssr_ty = Value::new(ServerContextType::AppSSR { app_dir }); ModuleAssetContextVc::new( TransitionsByNameVc::cell(transitions), - get_server_compile_time_info(ssr_ty, mode, env, server_addr), + get_server_compile_time_info(mode, env, server_addr), get_server_module_options_context( project_path, execution_context, diff --git a/packages/next-swc/crates/next-core/src/next_client/context.rs b/packages/next-swc/crates/next-core/src/next_client/context.rs index 8d845969f3661..6dce2e83f2de1 100644 --- a/packages/next-swc/crates/next-core/src/next_client/context.rs +++ b/packages/next-swc/crates/next-core/src/next_client/context.rs @@ -15,9 +15,7 @@ use turbopack_binding::{ FreeVarReference, FreeVarReferencesVc, }, context::AssetContextVc, - environment::{ - BrowserEnvironment, EnvironmentIntention, EnvironmentVc, ExecutionEnvironment, - }, + environment::{BrowserEnvironment, EnvironmentVc, ExecutionEnvironment}, free_var_references, resolve::{parse::RequestVc, pattern::Pattern}, }, @@ -107,8 +105,8 @@ async fn next_client_free_vars(mode: NextMode) -> Result { #[turbo_tasks::function] pub fn get_client_compile_time_info(mode: NextMode, browserslist_query: &str) -> CompileTimeInfoVc { - CompileTimeInfo::builder(EnvironmentVc::new( - Value::new(ExecutionEnvironment::Browser( + CompileTimeInfo::builder(EnvironmentVc::new(Value::new( + ExecutionEnvironment::Browser( BrowserEnvironment { dom: true, web_worker: false, @@ -116,9 +114,8 @@ pub fn get_client_compile_time_info(mode: NextMode, browserslist_query: &str) -> browserslist_query: browserslist_query.to_owned(), } .into(), - )), - Value::new(EnvironmentIntention::Client), - )) + ), + ))) .defines(next_client_defines(mode)) .free_var_references(next_client_free_vars(mode)) .cell() diff --git a/packages/next-swc/crates/next-core/src/next_edge/context.rs b/packages/next-swc/crates/next-core/src/next_edge/context.rs index 1557ac231c8eb..01ca566179918 100644 --- a/packages/next-swc/crates/next-core/src/next_edge/context.rs +++ b/packages/next-swc/crates/next-core/src/next_edge/context.rs @@ -10,8 +10,7 @@ use turbopack_binding::{ FreeVarReference, FreeVarReferencesVc, }, environment::{ - EdgeWorkerEnvironment, EnvironmentIntention, EnvironmentVc, ExecutionEnvironment, - ServerAddrVc, + EdgeWorkerEnvironment, EnvironmentVc, ExecutionEnvironment, ServerAddrVc, }, free_var_references, }, @@ -64,14 +63,10 @@ fn next_edge_free_vars(project_path: FileSystemPathVc) -> FreeVarReferencesVc { pub fn get_edge_compile_time_info( project_path: FileSystemPathVc, server_addr: ServerAddrVc, - intention: Value, ) -> CompileTimeInfoVc { - CompileTimeInfo::builder(EnvironmentVc::new( - Value::new(ExecutionEnvironment::EdgeWorker( - EdgeWorkerEnvironment { server_addr }.into(), - )), - intention, - )) + CompileTimeInfo::builder(EnvironmentVc::new(Value::new( + ExecutionEnvironment::EdgeWorker(EdgeWorkerEnvironment { server_addr }.into()), + ))) .defines(next_edge_defines()) .free_var_references(next_edge_free_vars(project_path)) .cell() diff --git a/packages/next-swc/crates/next-core/src/next_server/context.rs b/packages/next-swc/crates/next-core/src/next_server/context.rs index beedcb31a7fee..93ac6ae40bc55 100644 --- a/packages/next-swc/crates/next-core/src/next_server/context.rs +++ b/packages/next-swc/crates/next-core/src/next_server/context.rs @@ -10,10 +10,7 @@ use turbopack_binding::{ CompileTimeDefines, CompileTimeDefinesVc, CompileTimeInfo, CompileTimeInfoVc, FreeVarReferencesVc, }, - environment::{ - EnvironmentIntention, EnvironmentVc, ExecutionEnvironment, NodeJsEnvironmentVc, - ServerAddrVc, - }, + environment::{EnvironmentVc, ExecutionEnvironment, NodeJsEnvironmentVc, ServerAddrVc}, free_var_references, }, ecmascript::TransformPluginVc, @@ -245,25 +242,13 @@ async fn next_server_free_vars(mode: NextMode) -> Result { #[turbo_tasks::function] pub fn get_server_compile_time_info( - ty: Value, mode: NextMode, process_env: ProcessEnvVc, server_addr: ServerAddrVc, ) -> CompileTimeInfoVc { - CompileTimeInfo::builder(EnvironmentVc::new( - Value::new(ExecutionEnvironment::NodeJsLambda( - NodeJsEnvironmentVc::current(process_env, server_addr), - )), - match ty.into_value() { - ServerContextType::Pages { .. } | ServerContextType::PagesData { .. } => { - Value::new(EnvironmentIntention::ServerRendering) - } - ServerContextType::AppSSR { .. } => Value::new(EnvironmentIntention::Prerendering), - ServerContextType::AppRSC { .. } => Value::new(EnvironmentIntention::ServerRendering), - ServerContextType::AppRoute { .. } => Value::new(EnvironmentIntention::Api), - ServerContextType::Middleware => Value::new(EnvironmentIntention::Middleware), - }, - )) + CompileTimeInfo::builder(EnvironmentVc::new(Value::new( + ExecutionEnvironment::NodeJsLambda(NodeJsEnvironmentVc::current(process_env, server_addr)), + ))) .defines(next_server_defines(mode)) .free_var_references(next_server_free_vars(mode)) .cell() diff --git a/packages/next-swc/crates/next-core/src/page_source.rs b/packages/next-swc/crates/next-core/src/page_source.rs index 95329e2400e7b..a7900a5da1987 100644 --- a/packages/next-swc/crates/next-core/src/page_source.rs +++ b/packages/next-swc/crates/next-core/src/page_source.rs @@ -16,7 +16,7 @@ use turbopack_binding::{ asset::{AssetVc, AssetsVc}, chunk::{ChunkingContextVc, EvaluatableAssetVc, EvaluatableAssetsVc}, context::{AssetContext, AssetContextVc}, - environment::{EnvironmentIntention, ServerAddrVc}, + environment::ServerAddrVc, reference_type::{EntryReferenceSubType, InnerAssetsVc, ReferenceType}, source_asset::SourceAssetVc, }, @@ -152,11 +152,7 @@ pub async fn create_page_source( .cell() .into(); - let edge_compile_time_info = get_edge_compile_time_info( - project_root, - server_addr, - Value::new(EnvironmentIntention::Api), - ); + let edge_compile_time_info = get_edge_compile_time_info(project_root, server_addr); let edge_chunking_context = DevChunkingContextVc::builder( project_root, @@ -186,7 +182,7 @@ pub async fn create_page_source( .cell() .into(); - let server_compile_time_info = get_server_compile_time_info(server_ty, mode, env, server_addr); + let server_compile_time_info = get_server_compile_time_info(mode, env, server_addr); let server_resolve_options_context = get_server_resolve_options_context( project_root, server_ty, diff --git a/packages/next-swc/crates/next-core/src/router.rs b/packages/next-swc/crates/next-core/src/router.rs index fc56edbb36395..bdeb8c58770f9 100644 --- a/packages/next-swc/crates/next-core/src/router.rs +++ b/packages/next-swc/crates/next-core/src/router.rs @@ -20,7 +20,7 @@ use turbopack_binding::{ changed::any_content_changed, chunk::ChunkingContext, context::{AssetContext, AssetContextVc}, - environment::{EnvironmentIntention::Middleware, ServerAddrVc, ServerInfo}, + environment::{ServerAddrVc, ServerInfo}, ident::AssetIdentVc, issue::IssueVc, reference_type::{EcmaScriptModulesReferenceSubType, InnerAssetsVc, ReferenceType}, @@ -240,8 +240,7 @@ fn edge_transition_map( next_config: NextConfigVc, execution_context: ExecutionContextVc, ) -> TransitionsByNameVc { - let edge_compile_time_info = - get_edge_compile_time_info(project_path, server_addr, Value::new(Middleware)); + let edge_compile_time_info = get_edge_compile_time_info(project_path, server_addr); let edge_chunking_context = DevChunkingContextVc::builder( project_path, diff --git a/packages/next-swc/crates/next-core/src/web_entry_source.rs b/packages/next-swc/crates/next-core/src/web_entry_source.rs index 16307596c2a82..19d87a4f28763 100644 --- a/packages/next-swc/crates/next-core/src/web_entry_source.rs +++ b/packages/next-swc/crates/next-core/src/web_entry_source.rs @@ -12,9 +12,7 @@ use turbopack_binding::{ CompileTimeDefines, CompileTimeDefinesVc, CompileTimeInfo, CompileTimeInfoVc, FreeVarReferencesVc, }, - environment::{ - BrowserEnvironment, EnvironmentIntention, EnvironmentVc, ExecutionEnvironment, - }, + environment::{BrowserEnvironment, EnvironmentVc, ExecutionEnvironment}, free_var_references, reference_type::{EntryReferenceSubType, ReferenceType}, resolve::{origin::PlainResolveOriginVc, parse::RequestVc}, @@ -62,8 +60,8 @@ async fn web_free_vars() -> Result { #[turbo_tasks::function] pub fn get_compile_time_info(browserslist_query: &str) -> CompileTimeInfoVc { - CompileTimeInfo::builder(EnvironmentVc::new( - Value::new(ExecutionEnvironment::Browser( + CompileTimeInfo::builder(EnvironmentVc::new(Value::new( + ExecutionEnvironment::Browser( BrowserEnvironment { dom: true, web_worker: false, @@ -71,9 +69,8 @@ pub fn get_compile_time_info(browserslist_query: &str) -> CompileTimeInfoVc { browserslist_query: browserslist_query.to_owned(), } .into(), - )), - Value::new(EnvironmentIntention::Client), - )) + ), + ))) .defines(web_defines()) .free_var_references(web_free_vars()) .cell()