diff --git a/crates/napi/src/next_api/utils.rs b/crates/napi/src/next_api/utils.rs index 85ee3bebc2cab..0e6d1330c2359 100644 --- a/crates/napi/src/next_api/utils.rs +++ b/crates/napi/src/next_api/utils.rs @@ -1,5 +1,5 @@ use std::{ - collections::HashMap, env, future::Future, ops::Deref, path::PathBuf, sync::Arc, time::Duration, + collections::HashMap, future::Future, ops::Deref, path::PathBuf, sync::Arc, time::Duration, }; use anyhow::{anyhow, Context, Result}; @@ -12,7 +12,9 @@ use serde::Serialize; use turbo_tasks::{ trace::TraceRawVcs, ReadRef, TaskId, TryJoinIterExt, TurboTasks, UpdateInfo, Vc, }; -use turbo_tasks_backend::{default_backing_storage, DefaultBackingStorage}; +use turbo_tasks_backend::{ + default_backing_storage, noop_backing_storage, DefaultBackingStorage, NoopBackingStorage, +}; use turbo_tasks_fs::FileContent; use turbopack_core::{ diagnostics::{Diagnostic, DiagnosticContextExt, PlainDiagnostic}, @@ -25,7 +27,7 @@ use crate::util::log_internal_error_and_inform; #[derive(Clone)] pub enum NextTurboTasks { - Memory(Arc>), + Memory(Arc>>), PersistentCaching( Arc>>, ), @@ -108,7 +110,7 @@ impl NextTurboTasks { pub fn memory_backend(&self) -> Option<&turbo_tasks_memory::MemoryBackend> { match self { - NextTurboTasks::Memory(turbo_tasks) => Some(turbo_tasks.backend()), + NextTurboTasks::Memory(_) => None, NextTurboTasks::PersistentCaching(_) => None, } } @@ -124,7 +126,7 @@ impl NextTurboTasks { pub fn create_turbo_tasks( output_path: PathBuf, persistent_caching: bool, - memory_limit: usize, + _memory_limit: usize, ) -> Result { Ok(if persistent_caching { NextTurboTasks::PersistentCaching(TurboTasks::new( @@ -134,11 +136,15 @@ pub fn create_turbo_tasks( ), )) } else { - let mut backend = turbo_tasks_memory::MemoryBackend::new(memory_limit); - if env::var_os("NEXT_TURBOPACK_PRINT_TASK_INVALIDATION").is_some() { - backend.print_task_invalidation(true); - } - NextTurboTasks::Memory(TurboTasks::new(backend)) + NextTurboTasks::Memory(TurboTasks::new( + turbo_tasks_backend::TurboTasksBackend::new( + turbo_tasks_backend::BackendOptions { + storage_mode: None, + ..Default::default() + }, + noop_backing_storage(), + ), + )) }) } diff --git a/turbopack/crates/turbo-tasks-backend/src/lib.rs b/turbopack/crates/turbo-tasks-backend/src/lib.rs index b89d72769981d..3419090597763 100644 --- a/turbopack/crates/turbo-tasks-backend/src/lib.rs +++ b/turbopack/crates/turbo-tasks-backend/src/lib.rs @@ -36,8 +36,8 @@ pub fn lmdb_backing_storage(path: &Path) -> Result { pub type NoopBackingStorage = KeyValueDatabaseBackingStorage; -pub fn noop_backing_storage(_path: &Path) -> Result { - Ok(KeyValueDatabaseBackingStorage::new(NoopKvDb)) +pub fn noop_backing_storage() -> NoopBackingStorage { + KeyValueDatabaseBackingStorage::new(NoopKvDb) } pub type DefaultBackingStorage = LmdbBackingStorage;