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/next-core): Use ResolvedVc in PackagesGlobs #74712

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
15 changes: 7 additions & 8 deletions crates/next-core/src/next_server/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use serde::{Deserialize, Serialize};
use turbo_rcstr::RcStr;
use turbo_tasks::{trace::TraceRawVcs, ResolvedVc, Value, Vc};
use turbo_tasks::{trace::TraceRawVcs, NonLocalValue, ResolvedVc, Value, Vc};
use turbo_tasks_fs::{self, glob::Glob, FileJsonContent, FileSystemPath};
use turbopack_core::{
issue::{Issue, IssueExt, IssueSeverity, IssueStage, OptionStyledString, StyledString},
Expand Down Expand Up @@ -428,14 +428,13 @@ impl AfterResolvePlugin for ExternalCjsModulesResolvePlugin {
}
}

#[derive(Serialize, Deserialize, TraceRawVcs, PartialEq, Eq, Debug)]
#[derive(Serialize, Deserialize, TraceRawVcs, PartialEq, Eq, Debug, NonLocalValue)]
pub struct PackagesGlobs {
path_glob: Vc<Glob>,
request_glob: Vc<Glob>,
path_glob: ResolvedVc<Glob>,
request_glob: ResolvedVc<Glob>,
}

// TODO move that to turbo
#[turbo_tasks::value(transparent, local)]
#[turbo_tasks::value(transparent)]
pub struct OptionPackagesGlobs(Option<PackagesGlobs>);

#[turbo_tasks::function]
Expand All @@ -448,8 +447,8 @@ async fn packages_glob(packages: Vc<Vec<RcStr>>) -> Result<Vc<OptionPackagesGlob
let request_glob =
Glob::new(format!("{{{},{}/**}}", packages.join(","), packages.join("/**,")).into());
Ok(Vc::cell(Some(PackagesGlobs {
path_glob: path_glob.resolve().await?,
request_glob: request_glob.resolve().await?,
path_glob: path_glob.to_resolved().await?,
request_glob: request_glob.to_resolved().await?,
})))
}

Expand Down
Loading