Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fs): support for copyFile methods #1066

Merged
merged 1 commit into from
Jul 6, 2024
Merged

feat(fs): support for copyFile methods #1066

merged 1 commit into from
Jul 6, 2024

Conversation

sgammon
Copy link
Member

@sgammon sgammon commented Jul 4, 2024

Draft Powered by Pull Request Badge

Summary

Adds initial support for copyFile methods in node:fs and node:fs/promises.

@sgammon sgammon added enhancement New feature or request 🚧 WIP Works-in-progress. Blocks merge lang:javascript Issues relating to JavaScript api:node Node API and stdlib labels Jul 4, 2024
@sgammon sgammon added this to the Release R7: Beta 1 milestone Jul 4, 2024
@sgammon sgammon self-assigned this Jul 4, 2024
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 48.32215% with 154 lines in your changes missing coverage. Please review.

Project coverage is 55.15%. Comparing base (5174091) to head (6f1868a).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1066      +/-   ##
==========================================
+ Coverage   54.88%   55.15%   +0.27%     
==========================================
  Files         327      329       +2     
  Lines       10469    10613     +144     
  Branches     1736     1775      +39     
==========================================
+ Hits         5746     5854     +108     
- Misses       4141     4158      +17     
- Partials      582      601      +19     
Flag Coverage Δ
gradle 55.15% <48.32%> (+0.27%) ⬆️
jvm 55.15% <48.32%> (+0.27%) ⬆️
lib 55.15% <48.32%> (+0.27%) ⬆️
plugin 55.15% <48.32%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...lin/elide/runtime/gvm/internals/node/NodeStdlib.kt 97.14% <ø> (-0.16%) ⬇️
...src/main/kotlin/elide/runtime/gvm/js/JavaScript.kt 0.00% <ø> (ø)
...src/main/kotlin/elide/runtime/gvm/GuestExecutor.kt 0.00% <0.00%> (ø)
.../elide/runtime/intrinsics/js/node/FilesystemAPI.kt 85.71% <66.66%> (+7.93%) ⬆️
...runtime/intrinsics/js/node/FilesystemPromiseAPI.kt 25.00% <50.00%> (+25.00%) ⬆️
...in/kotlin/elide/runtime/intrinsics/js/JsPromise.kt 36.36% <16.66%> (-0.48%) ⬇️
...rc/main/kotlin/elide/runtime/gvm/GuestExecution.kt 46.66% <46.66%> (ø)
...ntime/gvm/internals/intrinsics/js/JsPromiseImpl.kt 49.25% <26.31%> (+6.94%) ⬆️
...ide/runtime/gvm/internals/intrinsics/js/JsError.kt 30.43% <11.76%> (-5.93%) ⬇️
...in/kotlin/elide/runtime/intrinsics/js/err/Error.kt 9.67% <11.53%> (-6.99%) ⬇️
... and 1 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5174091...6f1868a. Read the comment docs.

Comment on lines -306 to -307
checkFileForRead(path)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should eliminate a few syscalls which are HOL blocking and shouldn't be here anyway; if a file is not readable or does not exist, we should surface an exception and fail.

Copy link
Member

@darvld darvld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, a couple more tests and it should be good

@sgammon sgammon marked this pull request as ready for review July 5, 2024 20:39
@sgammon sgammon force-pushed the feat/fs-copy-file branch 2 times, most recently from 329b2f9 to 9e6ed10 Compare July 6, 2024 00:51
@sgammon sgammon force-pushed the feat/fs-copy-file branch 2 times, most recently from e4410bb to 0e96019 Compare July 6, 2024 06:15
- feat: implement `copyFile` methods in `fs` and `fs/promises`
- feat: initial `GuestExecutor` support
- feat: guest executor infra
- test: add tests for `copyFile` methods
- fix: reduce requisite syscalls for file reads
- fix: encoding parameter should default to utf8 for `readFile`
- fix: bugfixes for behavior in callback behavior for `fs`
- fix: support for UTF-32 in `fs` module
- fix: js error handling in `fs` module
- fix: dependency base for gvm tests with executor
- chore: update `runtime` module with new facade exports
- chore: unwire direct executor from `fs`
- chore: update `graalvm` module pin
- chore: wire in guest executors

Signed-off-by: Sam Gammon <[email protected]>
@sgammon sgammon merged commit a8dddbd into main Jul 6, 2024
21 checks passed
@sgammon sgammon deleted the feat/fs-copy-file branch July 6, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:node Node API and stdlib enhancement New feature or request lang:javascript Issues relating to JavaScript 🚧 WIP Works-in-progress. Blocks merge
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants