summaryrefslogtreecommitdiff
path: root/ext/fs/interface.rs
AgeCommit message (Collapse)Author
2024-09-28refactor: move NpmCacheDir to deno_cache_dir (#25916)David Sherret
Part of the ongoing work to move more of Deno's resolution out of the CLI crate (for use in Wasm and other things) Includes: * https://github.com/denoland/deno_cache_dir/pull/60
2024-07-23refactor: update to use deno_package_json (#24688)David Sherret
This is in preparation for extracting out node resolution code from ext/node (which is something I'm going to do gradually over time). Uses https://github.com/denoland/deno_package_json
2024-07-17perf(ext/node): optimize fs.exists[Sync] (#24613)Divy Srivastava
Use `access` on *nix and `GetFileAttributesW` on Windows. [Benchmark](https://paste.divy.work/p/-gq8Ark.js): ``` $ deno run -A bench.mjs # main (568dd) existsSync: 8980.636629ms $ target/release/deno run -A bench.mjs # this PR existsSync: 6448.7604519999995ms $ bun bench.mjs existsSync: 6562.88671ms $ node bench.mjs existsSync: 7740.064653ms ``` Ref https://github.com/denoland/deno/pull/24434#discussion_r1679777912
2024-07-09refactor: use concrete error types for node resolution (#24470)David Sherret
This will help clean up some of the code in the CLI because we'll be able to tell how the resolution failed (not part of this PR).
2024-07-05refactor: move `FileCollector` to deno_config (#24433)David Sherret
2024-07-05fix(node): Implement `fs.lchown` (and `process.getegid`) (#24418)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/21260. Part of https://github.com/denoland/deno/issues/18218. Implements `node:fs.lchown`, and enables the node_compat test for it. The test uses `process.getegid`, which we didn't have implemented, so I went ahead and implemented that as well to get the test working.
2024-07-04fix: revert accidentally added `parentPath` on `DirEntry` (#24438)David Sherret
Reverts the accidentally added `.parentPath` on dir entries in https://github.com/denoland/deno/pull/24257/files This should not have been added to the public api and is not documented.
2024-07-02fix(ext/node): Add `fs.lutimes` / `fs.lutimesSync` (#23172)Nathan Whitaker
Part of #18218 - Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do this I added methods to the `FileSystem` trait + ops to expose the functionality to JS. - Exports `fs._toUnixTimestamp`. Node exposes an internal util `toUnixTimestamp` from the fs module to be used by unit tests (so we need it for the unit test to pass unmodified). It's weird because it's only supposed to be used internally but it's still publicly accessible - Matches up error handling and timestamp handling for fs.futimes and fs.utimes with node - Enables the node_compat utimes test - this exercises futimes, lutimes, and utimes.
2024-06-26refactor: move PackageJson to deno_config (#24348)David Sherret
2024-06-19fix(ext/node): Add Dirent.path and Dirent.parentPath (#24257)Divy Srivastava
2024-06-08fix(ext/node): lossy UTF-8 read node_modules files (#24140)Luca Casonato
Previously various reads of files in `node_modules` would error on invalid UTF-8. These were cases involving: - reading package.json from Rust - reading package.json from JS - reading CommonJS files from JS - reading CommonJS files from Rust (for ESM translation) - reading ESM files from Rust
2024-04-19feat(runtime): Allow embedders to perform additional access checks on file ↵Matt Mastracci
open (#23208) Embedders may have special requirements around file opening, so we add a new `check_open` permission check that is called as part of the file open process.
2024-03-09fix(ext/node): support junction symlinks on Windows (#22762)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20609 Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-01-05fix(ext/node): add fs.cp, fs.cpSync, promises.cp (#21745)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20803 Fixes https://github.com/denoland/deno/issues/21723 Performance: copying a 48GiB rust `target` folder (recursive) | Platform | `deno` | `node v21.5` | Improvement | | -------- | ------- | ------- | ------- | | macOS (APFS) | 3.1secs | 127.99 secs | **42x** | | Windows | 18.3secs | 67.2secs | **3.8x** | Copying files with varying sizes: ![image](https://github.com/denoland/deno/assets/34997667/58932652-6f7a-47f5-8504-896dc9ab4ddc)
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-08-08chore: rename some helpers on the Fs trait (#20097)Luca Casonato
Rename some of the helper methods on the Fs trait to be suffixed with `_sync` / `_async`, in preparation of the introduction of more async methods for some helpers. Also adds a `read_text_file_async` helper to complement the renamed `read_text_file_sync` helper.
2023-06-26chore: fix typos (#19572)Martin Fischer
2023-05-10feat(compile): unstable npm and node specifier support (#19005)David Sherret
This is the initial support for npm and node specifiers in `deno compile`. The npm packages are included in the binary and read from it via a virtual file system. This also supports the `--node-modules-dir` flag, dependencies specified in a package.json, and npm binary commands (ex. `deno compile --unstable npm:cowsay`) Closes #16632
2023-05-08refactor(ext/fs): `deno_fs::FileSystem` - conditional `Send + Sync` (#18993)David Sherret
This allows for having a conditional `Send + Sync` on the file system trait for Deploy.
2023-05-05refactor(ext/node): combine `deno_node::Fs` with `deno_fs::FileSystem` (#18991)David Sherret
2023-05-04refactor(ext/fs): boxed deno_fs::FileSystem (#18945)David Sherret
1. Boxed `File` and `FileSystem` to allow more easily passing this through the CLI code (as shown within this pr). 2. `StdFileResource` is now `FileResource`. `FileResource` now contains an `Rc<dyn File>`.
2023-04-17chore(ext/fs): decouple fs trait from deno_core (#18732)Luca Casonato
This commit removes the dependencies on `deno_core` for the Fs trait. This allows to move the trait into a different crate that does not depend on core in the limit. This adds a new `bounds` field to `deno_core::extension!` that expands to `where` clauses on the generated code. This allows to add bounds to the extension parameters, such as `Fs::File: Resource`.
2023-04-12refactor(ext/fs): abstract FS via FileSystem trait (#18599)Luca Casonato
This commit abstracts out the specifics of the underlying system calls FS operations behind a new `FileSystem` and `File` trait in the `ext/fs` extension. This allows other embedders to re-use ext/fs, but substituting in a different FS backend. This is likely not the final form of these traits. Eventually they will be entirely `deno_core::Resource` agnostic, and will live in a seperate crate. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>