Skip to content
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
39 changes: 23 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ syn = "2.0.100"
tempfile = "3.20.0"
thread_local = "1.1.8"
thiserror = "1.0.48"
tokio = "1.43.0"
tokio-util = { version = "0.7.13", features = ["io", "rt"] }
tokio = "1.47.1"
tokio-util = { version = "0.7.16", features = ["io", "rt"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
triomphe = { git = "https://github.com/sokra/triomphe", branch = "sokra/unstable" }
Expand All @@ -441,10 +441,11 @@ urlencoding = "2.1.2"
vergen = { version = "9.0.6", features = ["cargo"] }
vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
webbrowser = "0.8.7"
wasmtimer = "0.4.2"

[patch.crates-io]
hyper = { git = "https://github.com/bgw/hyper-rs.git", branch = "v1.6.0-with-macos-intel-miscompilation-workaround" }
mdxjs = { git = "https://github.com/mischnic/mdxjs-rs.git", branch = "swc-core-32" }
lightningcss = { git = "https://github.com/parcel-bundler/lightningcss.git", branch = "mischnic/bump-browserslist" }
parcel_selectors = { git = "https://github.com/parcel-bundler/lightningcss.git", branch = "mischnic/bump-browserslist" }
tokio = { git = "https://github.com/utooland/tokio.git", package = "tokio" }
tokio-util = { git = "https://github.com/utooland/tokio.git", package = "tokio-util" }
5 changes: 1 addition & 4 deletions turbopack/crates/turbo-tasks-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,16 @@ tracing = { workspace = true }
thread_local = { workspace = true }
turbo-rcstr = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-testing = { workspace = true }

[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
turbo-persistence = { workspace = true }

[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
wasmtimer = { workspace = true }

[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
regex = { workspace = true }
tempfile = { workspace = true }
rstest = { workspace = true }
turbo-tasks-testing = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
Expand Down
3 changes: 0 additions & 3 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use indexmap::IndexSet;
use parking_lot::{Condvar, Mutex};
use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
use smallvec::{SmallVec, smallvec};
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use tokio::time::{Instant, sleep_until};
use tracing::field::Empty;
use turbo_tasks::{
Expand All @@ -42,8 +41,6 @@ use turbo_tasks::{
turbo_tasks,
util::IdFactoryWithReuse,
};
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
use wasmtimer::{std::Instant, tokio::sleep_until};

pub use self::{operation::AnyOperation, storage::TaskDataCategory};
#[cfg(feature = "trace_task_dirty")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use std::time::Instant;
use std::{
cmp::{Ordering, max},
collections::{VecDeque, hash_map::Entry as HashMapEntry},
Expand All @@ -17,14 +15,13 @@ use ringmap::RingSet;
use rustc_hash::{FxBuildHasher, FxHashMap};
use serde::{Deserialize, Serialize, Serializer, ser::SerializeSeq};
use smallvec::{SmallVec, smallvec};
use tokio::time::Instant;
#[cfg(any(
feature = "trace_aggregation_update",
feature = "trace_find_and_schedule"
))]
use tracing::{span::Span, trace_span};
use turbo_tasks::{FxIndexMap, SessionId, TaskExecutionReason, TaskId};
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
use wasmtimer::std::Instant;

#[cfg(feature = "trace_task_dirty")]
use crate::backend::operation::invalidate::TaskDirtyCause;
Expand Down
6 changes: 4 additions & 2 deletions turbopack/crates/turbo-tasks-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ include_dir = { version = "0.7.2", features = ["nightly"] }
indexmap = { workspace = true }
jsonc-parser = { version = "0.21.0", features = ["serde"] }
mime = { workspace = true }
notify = { workspace = true }
parking_lot = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
Expand All @@ -52,8 +51,11 @@ turbo-tasks = { workspace = true }
turbo-tasks-hash = { workspace = true }
urlencoding = { workspace = true }

[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
notify = { workspace = true }

[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
tokio-fs-ext = "0.3.9"
tokio-fs-ext = "0.3.10"

[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
Expand Down
1 change: 1 addition & 0 deletions turbopack/crates/turbo-tasks-fs/src/embed/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub async fn directory_from_relative_path(
path: RcStr,
) -> Result<Vc<Box<dyn FileSystem>>> {
let disk_fs = DiskFileSystem::new(name, path, vec![]);
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
disk_fs.await?.start_watching(None).await?;

Ok(Vc::upcast(disk_fs))
Expand Down
1 change: 1 addition & 0 deletions turbopack/crates/turbo-tasks-fs/src/embed/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub async fn content_from_relative_path(
root_path.to_string_lossy().into(),
vec![],
);
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
disk_fs.await?.start_watching(None).await?;

let fs_path = disk_fs.root().await?.join(path)?;
Expand Down
13 changes: 12 additions & 1 deletion turbopack/crates/turbo-tasks-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub mod rope;
pub mod source_context;
pub mod util;
pub(crate) mod virtual_fs;
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
mod watcher;
use std::{
borrow::Cow,
Expand Down Expand Up @@ -62,6 +63,7 @@ use turbo_tasks::{
use turbo_tasks_hash::{DeterministicHash, DeterministicHasher, hash_xxh3_hash64};
use util::{extract_disk_access, join_path, normalize_path, sys_to_unix, unix_to_sys};
pub use virtual_fs::VirtualFileSystem;
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use watcher::DiskWatcher;

use self::{invalidation::Write, json::UnparsableJson, mutex_map::MutexMap};
Expand Down Expand Up @@ -240,6 +242,7 @@ struct DiskFileSystemInner {
semaphore: tokio::sync::Semaphore,

#[turbo_tasks(debug_ignore, trace_ignore)]
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
watcher: DiskWatcher,
}

Expand All @@ -255,7 +258,8 @@ impl DiskFileSystemInner {
let invalidator = turbo_tasks::get_invalidator();
self.invalidator_map
.insert(path_to_key(path), invalidator, None);
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
#[cfg(not(any(target_os = "macos", target_os = "windows",)))]
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
if let Some(dir) = path.parent() {
self.watcher.ensure_watching(dir, self.root_path())?;
}
Expand Down Expand Up @@ -285,6 +289,7 @@ impl DiskFileSystemInner {
invalidators.insert(invalidator, Some(write_content));
drop(invalidator_map);
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
if let Some(dir) = path.parent() {
self.watcher.ensure_watching(dir, self.root_path())?;
}
Expand All @@ -298,6 +303,7 @@ impl DiskFileSystemInner {
self.dir_invalidator_map
.insert(path_to_key(path), invalidator, None);
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
self.watcher.ensure_watching(path, self.root_path())?;
Ok(())
}
Expand Down Expand Up @@ -378,6 +384,7 @@ impl DiskFileSystemInner {
}

#[tracing::instrument(level = "info", name = "start filesystem watching", skip_all, fields(path = %self.root))]
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
async fn start_watching_internal(
self: &Arc<Self>,
report_invalidation_reason: bool,
Expand Down Expand Up @@ -451,12 +458,14 @@ impl DiskFileSystem {
self.inner.invalidate_with_reason(reason);
}

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
pub async fn start_watching(&self, poll_interval: Option<Duration>) -> Result<()> {
self.inner
.start_watching_internal(false, poll_interval)
.await
}

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
pub async fn start_watching_with_invalidation_reason(
&self,
poll_interval: Option<Duration>,
Expand All @@ -466,6 +475,7 @@ impl DiskFileSystem {
.await
}

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
pub fn stop_watching(&self) {
self.inner.watcher.stop_watching();
}
Expand Down Expand Up @@ -529,6 +539,7 @@ impl DiskFileSystem {
invalidator_map: InvalidatorMap::new(),
dir_invalidator_map: InvalidatorMap::new(),
semaphore: create_semaphore(),
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
watcher: DiskWatcher::new(
ignored_subpaths.into_iter().map(PathBuf::from).collect(),
),
Expand Down
2 changes: 0 additions & 2 deletions turbopack/crates/turbo-tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ turbo-tasks-macros = { workspace = true }
turbo-tasks-malloc = { workspace = true }
unsize = { workspace = true }

[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
wasmtimer = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
5 changes: 1 addition & 4 deletions turbopack/crates/turbo-tasks/src/capture_future.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use std::time::Instant;
use std::{
borrow::Cow,
cell::RefCell,
Expand All @@ -14,9 +12,8 @@ use std::{
use anyhow::Result;
use pin_project_lite::pin_project;
use serde::{Deserialize, Serialize};
use tokio::time::Instant;
use turbo_tasks_malloc::{AllocationInfo, TurboMalloc};
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
use wasmtimer::std::Instant;

use crate::{backend::TurboTasksExecutionErrorMessage, panic_hooks::LAST_ERROR_LOCATION};

Expand Down
6 changes: 1 addition & 5 deletions turbopack/crates/turbo-tasks/src/duration_span.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use std::time::Instant;

#[cfg(all(target_family = "wasm", target_os = "unknown"))]
use wasmtimer::std::Instant;
use tokio::time::Instant;

/// Guard that emits a tracing event when dropped with the duration of the
/// lifetime of the guard.
Expand Down
6 changes: 4 additions & 2 deletions turbopack/crates/turbo-tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ pub use invalidation::{
pub use join_iter_ext::{JoinIterExt, TryFlatJoinIterExt, TryJoinIterExt};
pub use key_value_pair::KeyValuePair;
pub use magic_any::MagicAny;
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
pub use manager::spawn_thread;
pub use manager::{
CurrentCellRef, ReadConsistency, TaskPersistence, TurboTasks, TurboTasksApi,
TurboTasksBackendApi, TurboTasksBackendApiExt, TurboTasksCallApi, Unused, UpdateInfo,
dynamic_call, emit, mark_finished, mark_root, mark_session_dependent, mark_stateful,
prevent_gc, run_once, run_once_with_reason, spawn_blocking, spawn_thread, trait_call,
turbo_tasks, turbo_tasks_scope,
prevent_gc, run_once, run_once_with_reason, spawn_blocking, trait_call, turbo_tasks,
turbo_tasks_scope,
};
pub use output::OutputContent;
pub use raw_vc::{CellId, RawVc, ReadRawVcFuture, ResolveTypeError};
Expand Down
Loading
Loading