refactor: allow deno_permissions to compile to wasm32-unknown-unknown (#29487)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build wasm32 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

This commit is contained in:
David Sherret 2025-05-28 14:27:42 -04:00 committed by GitHub
parent 437afebf5c
commit cb23193f74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 411 additions and 106 deletions

View file

@ -582,7 +582,7 @@ impl sys_traits::BaseFsReadDir for DenoRtSys {
&self,
path: &Path,
) -> std::io::Result<
Box<dyn Iterator<Item = std::io::Result<Self::ReadDirEntry>> + '_>,
Box<dyn Iterator<Item = std::io::Result<Self::ReadDirEntry>>>,
> {
if self.0.is_path_within(path) {
let entries = self.0.read_dir_with_metadata(path)?;
@ -905,12 +905,21 @@ impl sys_traits::ThreadSleep for DenoRtSys {
}
impl sys_traits::EnvCurrentDir for DenoRtSys {
#[inline]
fn env_current_dir(&self) -> std::io::Result<PathBuf> {
#[allow(clippy::disallowed_types)] // ok because we're implementing the fs
sys_traits::impls::RealSys.env_current_dir()
}
}
impl sys_traits::EnvHomeDir for DenoRtSys {
#[inline]
fn env_home_dir(&self) -> Option<PathBuf> {
#[allow(clippy::disallowed_types)] // ok because we're implementing the fs
sys_traits::impls::RealSys.env_home_dir()
}
}
impl sys_traits::BaseEnvVar for DenoRtSys {
fn base_env_var_os(
&self,
@ -1381,16 +1390,23 @@ impl FileBackedVfs {
)
}
pub fn read_dir_with_metadata<'a>(
&'a self,
pub fn read_dir_with_metadata(
&self,
path: &Path,
) -> std::io::Result<impl Iterator<Item = FileBackedVfsDirEntry> + 'a> {
) -> std::io::Result<impl Iterator<Item = FileBackedVfsDirEntry>> {
let dir = self.dir_entry(path)?;
let path = path.to_path_buf();
Ok(dir.entries.iter().map(move |entry| FileBackedVfsDirEntry {
parent_path: path.to_path_buf(),
metadata: FileBackedVfsMetadata::from_vfs_entry_ref(entry.as_ref()),
}))
Ok(
dir
.entries
.iter()
.map(move |entry| FileBackedVfsDirEntry {
parent_path: path.to_path_buf(),
metadata: FileBackedVfsMetadata::from_vfs_entry_ref(entry.as_ref()),
})
.collect::<Vec<_>>()
.into_iter(),
)
}
pub fn read_link(&self, path: &Path) -> std::io::Result<PathBuf> {