@@ -22,7 +22,6 @@ pub mod rope;
2222pub mod source_context;
2323pub mod util;
2424pub ( crate ) mod virtual_fs;
25- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
2625mod watcher;
2726use std:: {
2827 borrow:: Cow ,
@@ -66,7 +65,6 @@ use turbo_tasks::{
6665use turbo_tasks_hash:: { DeterministicHash , DeterministicHasher , hash_xxh3_hash64} ;
6766use util:: { extract_disk_access, join_path, normalize_path, sys_to_unix, unix_to_sys} ;
6867pub use virtual_fs:: VirtualFileSystem ;
69- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
7068use watcher:: DiskWatcher ;
7169
7270use self :: { invalidation:: Write , json:: UnparsableJson , mutex_map:: MutexMap } ;
@@ -245,7 +243,6 @@ struct DiskFileSystemInner {
245243 semaphore : tokio:: sync:: Semaphore ,
246244
247245 #[ turbo_tasks( debug_ignore, trace_ignore) ]
248- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
249246 watcher : DiskWatcher ,
250247}
251248
@@ -387,7 +384,6 @@ impl DiskFileSystemInner {
387384 }
388385
389386 #[ tracing:: instrument( level = "info" , name = "start filesystem watching" , skip_all, fields( path = %self . root) ) ]
390- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
391387 async fn start_watching_internal (
392388 self : & Arc < Self > ,
393389 report_invalidation_reason : bool ,
@@ -396,6 +392,7 @@ impl DiskFileSystemInner {
396392 let root_path = self . root_path ( ) . to_path_buf ( ) ;
397393
398394 // create the directory for the filesystem on disk, if it doesn't exist
395+ #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
399396 retry_blocking ( root_path. clone ( ) , move |path| {
400397 let _tracing =
401398 tracing:: info_span!( "create root directory" , name = display( path. display( ) ) )
@@ -406,9 +403,20 @@ impl DiskFileSystemInner {
406403 . concurrency_limited ( & self . semaphore )
407404 . await ?;
408405
406+ #[ cfg( all( target_family = "wasm" , target_os = "unknown" ) ) ]
407+ wasm_fs_offload:: CLIENT
408+ . create_dir_all ( root_path. clone ( ) )
409+ . await ?;
410+
411+ #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
409412 self . watcher
410413 . start_watching ( self . clone ( ) , report_invalidation_reason, poll_interval) ?;
411414
415+ #[ cfg( all( target_family = "wasm" , target_os = "unknown" ) ) ]
416+ self . watcher
417+ . start_watching ( self . clone ( ) , report_invalidation_reason, poll_interval)
418+ . await ?;
419+
412420 Ok ( ( ) )
413421 }
414422
@@ -469,14 +477,12 @@ impl DiskFileSystem {
469477 self . inner . invalidate_with_reason ( reason) ;
470478 }
471479
472- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
473480 pub async fn start_watching ( & self , poll_interval : Option < Duration > ) -> Result < ( ) > {
474481 self . inner
475482 . start_watching_internal ( false , poll_interval)
476483 . await
477484 }
478485
479- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
480486 pub async fn start_watching_with_invalidation_reason (
481487 & self ,
482488 poll_interval : Option < Duration > ,
@@ -550,7 +556,6 @@ impl DiskFileSystem {
550556 invalidator_map : InvalidatorMap :: new ( ) ,
551557 dir_invalidator_map : InvalidatorMap :: new ( ) ,
552558 semaphore : create_semaphore ( ) ,
553- #[ cfg( not( all( target_family = "wasm" , target_os = "unknown" ) ) ) ]
554559 watcher : DiskWatcher :: new (
555560 ignored_subpaths. into_iter ( ) . map ( PathBuf :: from) . collect ( ) ,
556561 ) ,
0 commit comments