Skip to content

Commit

Permalink
refactor(turbopack/next-core): Use ResolvedVc in PackagesGlobs
Browse files Browse the repository at this point in the history
  • Loading branch information
bgw committed Jan 11, 2025
1 parent 64375e9 commit 535dcd4
Showing 1 changed file with 7 additions and 8 deletions.
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

0 comments on commit 535dcd4

Please sign in to comment.