Skip to content

Commit

Permalink
refactor(next-core): Remove local annotations from structs in next-co…
Browse files Browse the repository at this point in the history
…re/src/app_structure.rs (#74200)

These only need trivial modifications to implement `NonLocalValue`.
  • Loading branch information
bgw authored Jan 3, 2025
1 parent 978cf1e commit 3a73012
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ enum AppPageEndpointType {
Rsc,
}

#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs)]
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
enum AppEndpointType {
Page {
ty: AppPageEndpointType,
Expand All @@ -815,7 +815,7 @@ enum AppEndpointType {
},
}

#[turbo_tasks::value(local)]
#[turbo_tasks::value]
struct AppEndpoint {
ty: AppEndpointType,
app_project: ResolvedVc<AppProject>,
Expand Down
38 changes: 19 additions & 19 deletions crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl Metadata {
}

/// Metadata files that can be placed in the root of the app directory.
#[turbo_tasks::value(local)]
#[turbo_tasks::value]
#[derive(Default, Clone, Debug)]
pub struct GlobalMetadata {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -214,15 +214,15 @@ impl GlobalMetadata {
}
}

#[turbo_tasks::value(local)]
#[turbo_tasks::value]
#[derive(Debug)]
pub struct DirectoryTree {
/// key is e.g. "dashboard", "(dashboard)", "@slot"
pub subdirectories: BTreeMap<RcStr, ResolvedVc<DirectoryTree>>,
pub modules: AppDirModules,
}

#[turbo_tasks::value(local)]
#[turbo_tasks::value]
#[derive(Clone, Debug)]
struct PlainDirectoryTree {
/// key is e.g. "dashboard", "(dashboard)", "@slot"
Expand Down Expand Up @@ -416,7 +416,7 @@ async fn get_directory_tree_internal(
.cell())
}

#[turbo_tasks::value(local)]
#[turbo_tasks::value]
#[derive(Debug, Clone)]
pub struct AppPageLoaderTree {
pub page: AppPage,
Expand Down Expand Up @@ -512,6 +512,7 @@ impl ValueDefault for FileSystemPathVec {
ValueDebugFormat,
Debug,
TaskInput,
NonLocalValue,
)]
pub enum Entrypoint {
AppPage {
Expand Down Expand Up @@ -539,7 +540,7 @@ impl Entrypoint {
}
}

#[turbo_tasks::value(transparent, local)]
#[turbo_tasks::value(transparent)]
pub struct Entrypoints(FxIndexMap<AppPath, Entrypoint>);

fn is_parallel_route(name: &str) -> bool {
Expand All @@ -555,7 +556,7 @@ fn match_parallel_route(name: &str) -> Option<&str> {
}

fn conflict_issue(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
e: &'_ OccupiedEntry<'_, AppPath, Entrypoint>,
a: &str,
b: &str,
Expand Down Expand Up @@ -586,7 +587,7 @@ fn conflict_issue(
}

fn add_app_page(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
result: &mut FxIndexMap<AppPath, Entrypoint>,
page: AppPage,
loader_tree: ResolvedVc<AppPageLoaderTree>,
Expand Down Expand Up @@ -645,7 +646,7 @@ fn add_app_page(
}

fn add_app_route(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
result: &mut FxIndexMap<AppPath, Entrypoint>,
page: AppPage,
path: ResolvedVc<FileSystemPath>,
Expand Down Expand Up @@ -688,7 +689,7 @@ fn add_app_route(
}

fn add_app_metadata_route(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
result: &mut FxIndexMap<AppPath, Entrypoint>,
page: AppPage,
metadata: MetadataItem,
Expand Down Expand Up @@ -1121,7 +1122,7 @@ async fn default_route_tree(

#[turbo_tasks::function]
async fn directory_tree_to_entrypoints_internal(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
global_metadata: Vc<GlobalMetadata>,
directory_name: RcStr,
directory_tree: Vc<DirectoryTree>,
Expand All @@ -1142,7 +1143,7 @@ async fn directory_tree_to_entrypoints_internal(
}

async fn directory_tree_to_entrypoints_internal_untraced(
app_dir: Vc<FileSystemPath>,
app_dir: ResolvedVc<FileSystemPath>,
global_metadata: Vc<GlobalMetadata>,
directory_name: RcStr,
directory_tree: Vc<DirectoryTree>,
Expand Down Expand Up @@ -1171,7 +1172,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
let app_path = AppPath::from(app_page.clone());

let loader_tree = *directory_tree_to_loader_tree(
app_dir,
*app_dir,
global_metadata,
directory_name.clone(),
directory_tree_vc,
Expand Down Expand Up @@ -1261,7 +1262,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
modules: AppDirModules {
page: match modules.not_found {
Some(v) => Some(v),
None => Some(get_next_package(app_dir)
None => Some(get_next_package(*app_dir)
.join("dist/client/components/not-found-error.js".into())
.to_resolved()
.await?),
Expand Down Expand Up @@ -1305,7 +1306,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
}

let map = directory_tree_to_entrypoints_internal(
app_dir,
*app_dir,
global_metadata,
subdir_name.clone(),
*subdirectory,
Expand All @@ -1332,7 +1333,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
let app_path = AppPath::from(page.clone());

let loader_tree = directory_tree_to_loader_tree(
app_dir,
*app_dir,
global_metadata,
directory_name.clone(),
directory_tree_vc,
Expand Down Expand Up @@ -1427,11 +1428,10 @@ pub async fn get_global_metadata(
Ok(metadata.cell())
}

#[turbo_tasks::value(shared, local)]
#[turbo_tasks::value(shared)]
struct DirectoryTreeIssue {
pub severity: ResolvedVc<IssueSeverity>,
// no-resolved-vc(kdy1): I'll resolve this later because it's a complex case.
pub app_dir: Vc<FileSystemPath>,
pub app_dir: ResolvedVc<FileSystemPath>,
pub message: ResolvedVc<StyledString>,
}

Expand All @@ -1454,7 +1454,7 @@ impl Issue for DirectoryTreeIssue {

#[turbo_tasks::function]
fn file_path(&self) -> Vc<FileSystemPath> {
self.app_dir
*self.app_dir
}

#[turbo_tasks::function]
Expand Down

0 comments on commit 3a73012

Please sign in to comment.