test the wasm side (#6726)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-05-06 20:04:34 -07:00
committed by GitHub
parent 17c326e654
commit e373d285fe
30 changed files with 594 additions and 330 deletions

View File

@ -2,6 +2,7 @@
use anyhow::Result;
use crate::execution::typed_path::TypedPath;
use crate::SourceRange;
#[cfg(not(target_arch = "wasm32"))]
@ -20,30 +21,22 @@ pub use wasm::FileManager;
#[async_trait::async_trait]
pub trait FileSystem: Clone {
/// Read a file from the local file system.
async fn read<P: AsRef<std::path::Path> + std::marker::Send + std::marker::Sync>(
&self,
path: P,
source_range: SourceRange,
) -> Result<Vec<u8>, crate::errors::KclError>;
async fn read(&self, path: &TypedPath, source_range: SourceRange) -> Result<Vec<u8>, crate::errors::KclError>;
/// Read a file from the local file system.
async fn read_to_string<P: AsRef<std::path::Path> + std::marker::Send + std::marker::Sync>(
async fn read_to_string(
&self,
path: P,
path: &TypedPath,
source_range: SourceRange,
) -> Result<String, crate::errors::KclError>;
/// Check if a file exists on the local file system.
async fn exists<P: AsRef<std::path::Path> + std::marker::Send + std::marker::Sync>(
&self,
path: P,
source_range: SourceRange,
) -> Result<bool, crate::errors::KclError>;
async fn exists(&self, path: &TypedPath, source_range: SourceRange) -> Result<bool, crate::errors::KclError>;
/// Get all the files in a directory recursively.
async fn get_all_files<P: AsRef<std::path::Path> + std::marker::Send + std::marker::Sync>(
async fn get_all_files(
&self,
path: P,
path: &TypedPath,
source_range: SourceRange,
) -> Result<Vec<std::path::PathBuf>, crate::errors::KclError>;
) -> Result<Vec<TypedPath>, crate::errors::KclError>;
}