mirror of
https://github.com/denoland/deno.git
synced 2025-09-24 19:32:30 +00:00
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
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:
parent
437afebf5c
commit
cb23193f74
17 changed files with 411 additions and 106 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue