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

refactor(turbopack): Use ResolvedVc<T> for struct fields in next-api, part 1 #73366

Merged
merged 4 commits into from
Nov 30, 2024
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
24 changes: 12 additions & 12 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ impl ProjectDefineEnv {

#[turbo_tasks::value(shared)]
struct ConflictIssue {
path: Vc<FileSystemPath>,
title: Vc<StyledString>,
description: Vc<StyledString>,
severity: Vc<IssueSeverity>,
path: ResolvedVc<FileSystemPath>,
title: ResolvedVc<StyledString>,
description: ResolvedVc<StyledString>,
severity: ResolvedVc<IssueSeverity>,
}

#[turbo_tasks::value_impl]
Expand All @@ -508,22 +508,22 @@ impl Issue for ConflictIssue {

#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
self.severity
*self.severity
}

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

#[turbo_tasks::function]
fn title(&self) -> Vc<StyledString> {
self.title
*self.title
}

#[turbo_tasks::function]
fn description(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(self.description))
Vc::cell(Some(*self.description))
}
}

Expand Down Expand Up @@ -879,20 +879,20 @@ impl Project {
match routes.entry(pathname.clone()) {
Entry::Occupied(mut entry) => {
ConflictIssue {
path: self.project_path(),
path: self.project_path().to_resolved().await?,
title: StyledString::Text(
format!("App Router and Pages Router both match path: {}", pathname)
.into(),
)
.cell(),
.resolved_cell(),
description: StyledString::Text(
"Next.js does not support having both App Router and Pages Router \
routes matching the same path. Please remove one of the conflicting \
routes."
.into(),
)
.cell(),
severity: IssueSeverity::Error.cell(),
.resolved_cell(),
severity: IssueSeverity::Error.resolved_cell(),
}
.cell()
.emit();
Expand Down
6 changes: 3 additions & 3 deletions crates/next-api/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ async fn parse_actions(module: Vc<Box<dyn Module>>) -> Result<Vc<OptionActionMap

let mut actions = FxIndexMap::from_iter(actions.into_iter());
actions.sort_keys();
Ok(Vc::cell(Some(Vc::cell(actions))))
Ok(Vc::cell(Some(ResolvedVc::cell(actions))))
}

fn all_export_names(program: &Program) -> Vec<Atom> {
Expand Down Expand Up @@ -485,7 +485,7 @@ fn is_turbopack_internal_var(with: &Option<Box<ObjectLit>>) -> bool {
/// collecting into a flat-mapped [FxIndexMap].
async fn parse_actions_filter_map(
(layer, module, name): FindActionsNode,
) -> Result<Option<(FindActionsNode, Vc<ActionMap>)>> {
) -> Result<Option<(FindActionsNode, ResolvedVc<ActionMap>)>> {
parse_actions(*module).await.map(|option_action_map| {
option_action_map
.clone_value()
Expand Down Expand Up @@ -514,7 +514,7 @@ struct ActionMap(FxIndexMap<String, String>);

/// An Option wrapper around [ActionMap].
#[turbo_tasks::value(transparent)]
struct OptionActionMap(Option<Vc<ActionMap>>);
struct OptionActionMap(Option<ResolvedVc<ActionMap>>);

#[turbo_tasks::value_impl]
impl OptionActionMap {
Expand Down
Loading