Unverified Commit e72a76e4 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: avoid depending on the Project (#78730)

### What?

avoid depending on the Project value directly, since it will change on
every build.
parent ad399701
......@@ -44,7 +44,6 @@ use crate::{
#[turbo_tasks::value]
pub struct MiddlewareEndpoint {
project: ResolvedVc<Project>,
build_id: RcStr,
asset_context: ResolvedVc<Box<dyn AssetContext>>,
source: ResolvedVc<Box<dyn Source>>,
app_dir: Option<ResolvedVc<FileSystemPath>>,
......@@ -56,7 +55,6 @@ impl MiddlewareEndpoint {
#[turbo_tasks::function]
pub fn new(
project: ResolvedVc<Project>,
build_id: RcStr,
asset_context: ResolvedVc<Box<dyn AssetContext>>,
source: ResolvedVc<Box<dyn Source>>,
app_dir: Option<ResolvedVc<FileSystemPath>>,
......@@ -64,7 +62,6 @@ impl MiddlewareEndpoint {
) -> Vc<Self> {
Self {
project,
build_id,
asset_context,
source,
app_dir,
......
......@@ -738,6 +738,11 @@ impl Project {
*self.mode
}
#[turbo_tasks::function]
pub(super) async fn is_watch_enabled(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(self.watch.enable))
}
#[turbo_tasks::function]
pub(super) async fn per_page_module_graph(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(*self.mode.await? == NextMode::Development))
......@@ -944,7 +949,7 @@ impl Project {
// At this point all modules have been computed and we can get rid of the node.js
// process pools
if self.await?.watch.enable {
if *self.is_watch_enabled().await? {
turbopack_node::evaluate::scale_down();
} else {
turbopack_node::evaluate::scale_zero();
......@@ -1412,7 +1417,6 @@ impl Project {
Ok(Vc::upcast(MiddlewareEndpoint::new(
self,
self.await?.build_id.clone(),
middleware_asset_context,
source,
app_dir.as_deref().copied(),
......
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