Unverified Commit 8ab6c4ca authored by Leah's avatar Leah Committed by GitHub

Exclude app from `_devPagesManifest.js` in turbopack (#48633)

### What?
Seems I accidentally included the app root when I initially added it,
but apps never have a page loader, so they should be excluded

I also cleaned up the manifest a bit, and it now perfectly matches the
one in next.js


Fixes WEB-926
parent 3a83c6b3
......@@ -5,7 +5,10 @@ use serde::Serialize;
use turbo_binding::{
turbo::{tasks::TryJoinIterExt, tasks_fs::File},
turbopack::{
core::asset::AssetContentVc,
core::{
asset::AssetContentVc,
introspect::{Introspectable, IntrospectableVc},
},
dev_server::source::{
ContentSource, ContentSourceContentVc, ContentSourceData, ContentSourceResultVc,
ContentSourceVc,
......@@ -77,10 +80,17 @@ impl DevManifestContentSourceVc {
let mut routes = routes
.into_iter()
.flatten()
.map(|s| s.to_string())
.map(|s| {
if !s.starts_with('/') {
format!("/{}", s)
} else {
s.to_string()
}
})
.collect::<Vec<_>>();
routes.sort_by_cached_key(|s| s.split('/').map(PageSortKey::from).collect::<Vec<_>>());
routes.dedup();
Ok(StringsVc::cell(routes))
}
......@@ -185,6 +195,22 @@ impl ContentSource for DevManifestContentSource {
}
}
#[turbo_tasks::value_impl]
impl Introspectable for DevManifestContentSource {
#[turbo_tasks::function]
fn ty(&self) -> StringVc {
StringVc::cell("dev manifest source".to_string())
}
#[turbo_tasks::function]
fn details(&self) -> StringVc {
StringVc::cell(
"provides _devPagesManifest.json, _buildManifest.js and _devMiddlewareManifest.json."
.to_string(),
)
}
}
/// PageSortKey is necessary because the next.js client code looks for matches
/// in the order the pages are sent in the manifest,if they're sorted
/// alphabetically this means \[slug] and \[\[catchall]] routes are prioritized
......
......@@ -369,7 +369,7 @@ async fn source(
let static_source =
StaticAssetsContentSourceVc::new(String::new(), project_path.join("public")).into();
let manifest_source = DevManifestContentSource {
page_roots: vec![app_source, page_source],
page_roots: vec![page_source],
next_config,
}
.cell()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment