Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 19 additions & 4 deletions crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use next_core::{
all_assets_from_entries,
app_segment_config::NextSegmentConfig,
app_structure::{
AppPageLoaderTree, Entrypoint as AppEntrypoint, Entrypoints as AppEntrypoints,
FileSystemPathVec, MetadataItem, get_entrypoints,
AppPageLoaderTree, CollectedRootParams, Entrypoint as AppEntrypoint,
Entrypoints as AppEntrypoints, FileSystemPathVec, MetadataItem, collect_root_params,
get_entrypoints,
},
get_edge_resolve_options_context, get_next_package,
next_app::{
Expand Down Expand Up @@ -203,6 +204,11 @@ impl AppProject {
)
}

#[turbo_tasks::function]
async fn collected_root_params(self: Vc<Self>) -> Result<Vc<CollectedRootParams>> {
Ok(collect_root_params(self.app_entrypoints()))
}

#[turbo_tasks::function]
async fn client_module_options_context(self: Vc<Self>) -> Result<Vc<ModuleOptionsContext>> {
Ok(get_client_module_options_context(
Expand Down Expand Up @@ -297,6 +303,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
Some(self.collected_root_params()),
))
}

Expand All @@ -308,6 +315,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
Some(self.collected_root_params()),
))
}

Expand All @@ -319,6 +327,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
Some(self.collected_root_params()),
))
}

Expand All @@ -332,6 +341,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
Some(self.collected_root_params()),
))
}

Expand Down Expand Up @@ -629,6 +639,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
None, // root params are not available in client modules
))
}

Expand All @@ -640,6 +651,7 @@ impl AppProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
None, // root params are not available in client modules
))
}

Expand Down Expand Up @@ -978,7 +990,9 @@ pub fn app_entry_point_to_route(
entrypoint: AppEntrypoint,
) -> Vc<Route> {
match entrypoint {
AppEntrypoint::AppPage { pages, loader_tree } => Route::AppPage(
AppEntrypoint::AppPage {
pages, loader_tree, ..
} => Route::AppPage(
pages
.into_iter()
.map(|page| AppPageRoute {
Expand Down Expand Up @@ -1012,6 +1026,7 @@ pub fn app_entry_point_to_route(
page,
path,
root_layouts,
..
} => Route::AppRoute {
original_name: page.to_string().into(),
endpoint: ResolvedVc::upcast(
Expand All @@ -1023,7 +1038,7 @@ pub fn app_entry_point_to_route(
.resolved_cell(),
),
},
AppEntrypoint::AppMetadata { page, metadata } => Route::AppRoute {
AppEntrypoint::AppMetadata { page, metadata, .. } => Route::AppRoute {
original_name: page.to_string().into(),
endpoint: ResolvedVc::upcast(
AppEndpoint {
Expand Down
2 changes: 2 additions & 0 deletions crates/next-api/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ impl PagesProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
None, // root params are not available in pages dir
))
}

Expand All @@ -564,6 +565,7 @@ impl PagesProject {
self.project().next_mode(),
self.project().next_config(),
self.project().execution_context(),
None, // root params are not available in pages dir
))
}

Expand Down
4 changes: 4 additions & 0 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
/// E.g. `/home/user/projects/my-repo`.
pub root_path: RcStr,

/// A path which contains the app/pages directories, relative to [`Project::root_path`], always

Check warning on line 157 in crates/next-api/src/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_path` links to private item `Project::root_path`
/// Unix path. E.g. `apps/my-app`
pub project_path: RcStr,

Expand Down Expand Up @@ -1339,6 +1339,7 @@
self.next_mode(),
self.next_config(),
self.execution_context(),
None, // root params can't be used in middleware
),
Layer::new_with_user_friendly_name(
rcstr!("middleware-edge"),
Expand Down Expand Up @@ -1399,6 +1400,7 @@
self.next_mode(),
self.next_config(),
self.execution_context(),
None, // root params can't be used in middleware
),
Layer::new_with_user_friendly_name(rcstr!("middleware"), rcstr!("Middleware")),
)))
Expand Down Expand Up @@ -1516,6 +1518,7 @@
self.next_mode(),
self.next_config(),
self.execution_context(),
None, // root params can't be used in instrumentation
),
Layer::new_with_user_friendly_name(
rcstr!("instrumentation"),
Expand Down Expand Up @@ -1577,6 +1580,7 @@
self.next_mode(),
self.next_config(),
self.execution_context(),
None, // root params can't be used in instrumentation
),
Layer::new_with_user_friendly_name(
rcstr!("instrumentation-edge"),
Expand Down
Loading
Loading