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

node fs compat pr #2 #16422

Merged
merged 136 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
9244d82
nodefs compat pr 2
paperclover Jan 15, 2025
315e0db
fix compilation
paperclover Jan 16, 2025
5f33c87
fix
paperclover Jan 16, 2025
99ed7b2
we are now long paths
paperclover Jan 16, 2025
bfed4c0
g -> G
paperclover Jan 16, 2025
097e290
lalalalala
paperclover Jan 16, 2025
89b7698
no trail slash window path
paperclover Jan 16, 2025
43acf18
more
paperclover Jan 16, 2025
f90412c
a
paperclover Jan 16, 2025
f2f90b0
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 16, 2025
763bd2c
a
paperclover Jan 16, 2025
e6b9371
Merge branch 'chloe/node-fs-2' of github.com:oven-sh/bun into chloe/n…
paperclover Jan 16, 2025
3b2ed11
walawala
paperclover Jan 17, 2025
265ea6b
thank you
paperclover Jan 17, 2025
a0ccb6e
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
paperclover Jan 17, 2025
98c43b8
Merge branch 'chloe/node-fs-2' of github.com:oven-sh/bun into chloe/n…
paperclover Jan 17, 2025
9c9d6e7
more things
paperclover Jan 17, 2025
8311564
a
paperclover Jan 17, 2025
6670fa7
Merge branch 'chloe/node-fs-2' of github.com:oven-sh/bun into chloe/n…
paperclover Jan 17, 2025
12d1b2e
a
paperclover Jan 17, 2025
d56e158
a
paperclover Jan 17, 2025
cd9a240
a
paperclover Jan 17, 2025
7e3eae6
another one
paperclover Jan 17, 2025
60f1177
Merge branch 'chloe/node-fs-2' of github.com:oven-sh/bun into chloe/n…
paperclover Jan 17, 2025
7a58479
add test-fs-write-file-sync.js
dylan-conway Jan 18, 2025
14ef956
test-fs-symlink.js
paperclover Jan 18, 2025
db9cf38
Merge branch 'main' into chloe/node-fs-2
dylan-conway Jan 18, 2025
11bd3d2
add test-fs-rename-type-check.js
dylan-conway Jan 18, 2025
7e2a4f2
oops
dylan-conway Jan 18, 2025
730a70f
more tests pass
paperclover Jan 18, 2025
c50f7e8
test-fs-stat-sync-overflow.js
dylan-conway Jan 18, 2025
cf000bd
add test-fs-truncate.js
dylan-conway Jan 18, 2025
6d60527
add test-fs-utimes.js
dylan-conway Jan 18, 2025
a6f313b
syscall is expected to be watch
dylan-conway Jan 18, 2025
ed8aa26
Update node:crypto compatibility
nektro Jan 18, 2025
68b0ac0
node:fs mkdir: disable linux statx path (#16478)
paperclover Jan 18, 2025
e7a9124
fix windows build
dylan-conway Jan 18, 2025
c50b882
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
dylan-conway Jan 18, 2025
a578e36
oops
dylan-conway Jan 18, 2025
501887a
error
dylan-conway Jan 18, 2025
6e8a099
more oops
dylan-conway Jan 18, 2025
3adeee8
fix another
dylan-conway Jan 18, 2025
0e41361
abort signal
paperclover Jan 18, 2025
64d685e
read file
paperclover Jan 18, 2025
34907dc
write file aborting
paperclover Jan 18, 2025
ab5dded
dont eat
dylan-conway Jan 18, 2025
2ff5e5b
fix
dylan-conway Jan 18, 2025
1c903c4
write tests that pass
paperclover Jan 18, 2025
7559952
a
paperclover Jan 18, 2025
4f996b5
a
paperclover Jan 18, 2025
590fb4d
iam sorrryy,, i pushed code that didnt compile,,
paperclover Jan 18, 2025
114f359
test-fs-stat-sync-overflow.js
paperclover Jan 18, 2025
5e729a4
fix test-fs-realpath-buffer-encoding.js
dylan-conway Jan 18, 2025
31f499f
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 18, 2025
559111c
a
paperclover Jan 18, 2025
2f99f7e
a
paperclover Jan 18, 2025
aa06aae
install: debugging features
paperclover Jan 18, 2025
90f483b
realpath
paperclover Jan 18, 2025
5d3cbfe
`bun run zig-format`
dylan-conway Jan 19, 2025
0c2e1f3
node test: run bun:test tests with bun test
paperclover Jan 19, 2025
cd36aa6
some improvement
paperclover Jan 19, 2025
87cb49c
`bun run zig-format`
dylan-conway Jan 19, 2025
15aec59
a
paperclover Jan 19, 2025
e5a208a
corner cut
paperclover Jan 19, 2025
973b1c4
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 19, 2025
1702342
badf
paperclover Jan 19, 2025
9294576
streams :)
paperclover Jan 19, 2025
a28d06a
give up on these for 1.2, we'll get it after
paperclover Jan 19, 2025
969337c
wala
paperclover Jan 19, 2025
237a568
docs
paperclover Jan 19, 2025
809ff5e
test stdio closed
paperclover Jan 19, 2025
20860d6
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 19, 2025
6063016
i
paperclover Jan 20, 2025
5f01e09
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 20, 2025
92c0b65
dev
paperclover Jan 20, 2025
d0f0302
hi
paperclover Jan 20, 2025
bca94b7
maybe fix
dylan-conway Jan 20, 2025
1d41c46
Revert "maybe fix"
dylan-conway Jan 20, 2025
6eca3ee
fix some errors
dylan-conway Jan 20, 2025
ed92896
test
dylan-conway Jan 20, 2025
be4ad46
native readable rewrite
paperclover Jan 20, 2025
a54e07b
a
paperclover Jan 20, 2025
85e43ad
Revert "test"
dylan-conway Jan 20, 2025
1f2a7a3
resolve auto platform
dylan-conway Jan 20, 2025
1a67dc2
wah
paperclover Jan 20, 2025
1efb06a
more resolve platform
dylan-conway Jan 20, 2025
f6714af
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
paperclover Jan 20, 2025
ff5dd50
stuff
paperclover Jan 20, 2025
a2e583f
fix
paperclover Jan 20, 2025
16b10f9
a
paperclover Jan 20, 2025
0e0670a
make sure dependency slashes are normalized
dylan-conway Jan 20, 2025
2b2cbe1
windows only
dylan-conway Jan 20, 2025
c0f1b78
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 20, 2025
854c117
a
paperclover Jan 20, 2025
0fe634b
fix install test
dylan-conway Jan 21, 2025
d1c408a
waaaa
paperclover Jan 21, 2025
a71e3da
a
paperclover Jan 21, 2025
b41523f
wala
paperclover Jan 21, 2025
d82615f
a
paperclover Jan 21, 2025
d56dce5
some more fast path opt outs :(
paperclover Jan 21, 2025
5020c50
prom
paperclover Jan 21, 2025
baf003e
fix some windowing
paperclover Jan 21, 2025
4363fd1
readd
paperclover Jan 21, 2025
a66c2d5
scope out
paperclover Jan 21, 2025
d0b9342
fix exists with empty string
dylan-conway Jan 21, 2025
fbaeadd
fix fs.test.ts
dylan-conway Jan 21, 2025
f6e0bc5
fix 4123
paperclover Jan 21, 2025
b794dac
wawawwaawwawawawa
paperclover Jan 21, 2025
3b2157f
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
paperclover Jan 21, 2025
c82bbab
aa
paperclover Jan 21, 2025
99dde4f
a
paperclover Jan 21, 2025
2a5b043
a
paperclover Jan 21, 2025
895e2af
asdfg;'
paperclover Jan 21, 2025
bb31a98
Merge remote-tracking branch 'origin/main' into chloe/node-fs-2
paperclover Jan 21, 2025
87815e1
bugs 1 and 2
paperclover Jan 21, 2025
bf5182d
a
paperclover Jan 21, 2025
82eeffb
fix test-fs-error-messages.js
dylan-conway Jan 21, 2025
8fda68b
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
dylan-conway Jan 21, 2025
831e674
-
dylan-conway Jan 21, 2025
a34529d
a
paperclover Jan 21, 2025
c989b75
Update src/bun.js/api/BunObject.zig
dylan-conway Jan 21, 2025
269ce0d
Merge branch 'main' into chloe/node-fs-2
dylan-conway Jan 21, 2025
f3ddbdd
fix
dylan-conway Jan 21, 2025
8792e03
fix process-binding.test.ts
dylan-conway Jan 21, 2025
2294106
a
paperclover Jan 21, 2025
4cef460
delete test-fs-read-stream-pos.js
dylan-conway Jan 21, 2025
f6432f9
waaa
paperclover Jan 21, 2025
dab4fb3
Merge branch 'chloe/node-fs-2' of https://github.com/oven-sh/bun into…
dylan-conway Jan 21, 2025
ea93b08
fix
dylan-conway Jan 21, 2025
750795b
Revert "fix"
dylan-conway Jan 21, 2025
a9f3e0a
Revert "fix test-fs-error-messages.js"
dylan-conway Jan 21, 2025
640d862
revert test change
dylan-conway Jan 21, 2025
9bcc3d3
fix regression test
dylan-conway Jan 21, 2025
6846aac
Merge branch 'main' into chloe/node-fs-2
paperclover Jan 21, 2025
dc16f00
inotify events are align 1!!
dylan-conway Jan 21, 2025
1bcc6bc
just 1 more test
dylan-conway Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions docs/runtime/nodejs-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ This page is updated regularly to reflect compatibility status of the latest ver

🟢 Fully implemented. `EventEmitterAsyncResource` uses `AsyncResource` underneath. 100% of Node.js's test suite for EventEmitter passes.

### [`node:fs`](https://nodejs.org/api/fs.html)

🟢 Fully implemented. 92% of Node.js's test suite passes.

### [`node:http`](https://nodejs.org/api/http.html)

🟢 Fully implemented. Outgoing client request body is currently buffered instead of streamed.
Expand Down Expand Up @@ -88,7 +92,7 @@ This page is updated regularly to reflect compatibility status of the latest ver

### [`node:async_hooks`](https://nodejs.org/api/async_hooks.html)

🟡 `AsyncLocalStorage`, and `AsyncResource` are implemented. `AsyncResource` is missing `bind`. v8 hooks are stubbed.
🟡 `AsyncLocalStorage`, and `AsyncResource` are implemented. v8 promise hooks are not called, and its usage is [strongly discouraged](https://nodejs.org/docs/latest/api/async_hooks.html#async-hooks).

### [`node:child_process`](https://nodejs.org/api/child_process.html)

Expand All @@ -108,10 +112,6 @@ Some methods are not optimized yet.

🟡 Missing `Domain` `active`

### [`node:fs`](https://nodejs.org/api/fs.html)

🟡 Missing `statfs` `statfsSync`, `opendirSync`. `Dir` is partially implemented.

### [`node:http2`](https://nodejs.org/api/http2.html)

🟡 Client & server are implemented (95.25% of gRPC's test suite passes). Missing `options.allowHTTP1`, `options.enableConnectProtocol`, ALTSVC extension, and `http2stream.pushStream`.
Expand Down
2 changes: 2 additions & 0 deletions jj.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require("fs").writeFileSync("awa2", "meowy", { flag: "a" });
require("fs").writeFileSync("awa2", "meowy", { flag: "a" });
3 changes: 2 additions & 1 deletion scripts/runner.node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ async function runTests() {
const absoluteTestPath = join(testsPath, testPath);
const title = relative(cwd, absoluteTestPath).replaceAll(sep, "/");
if (isNodeParallelTest(testPath)) {
const subcommand = title.includes("needs-test") ? "test" : "run";
const runWithBunTest = title.includes("needs-test") || readFileSync(absoluteTestPath, "utf-8").includes('bun:test');
const subcommand = runWithBunTest ? "test" : "run";
await runTest(title, async () => {
const { ok, error, stdout } = await spawnBun(execPath, {
cwd: cwd,
Expand Down
24 changes: 11 additions & 13 deletions src/StandaloneModuleGraph.zig
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,11 @@ pub const StandaloneModuleGraph = struct {
const file = bun.sys.openFileAtWindows(
bun.invalid_fd,
out,
// access_mask
w.SYNCHRONIZE | w.GENERIC_WRITE | w.GENERIC_READ | w.DELETE,
// create disposition
w.FILE_OPEN,
// create options
w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_REPARSE_POINT,
.{
.access_mask = w.SYNCHRONIZE | w.GENERIC_WRITE | w.GENERIC_READ | w.DELETE,
.disposition = w.FILE_OPEN,
.options = w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_REPARSE_POINT,
},
).unwrap() catch |e| {
Output.prettyErrorln("<r><red>error<r><d>:<r> failed to open temporary file to copy bun into\n{}", .{e});
Global.exit(1);
Expand Down Expand Up @@ -953,7 +952,7 @@ pub const StandaloneModuleGraph = struct {
const image_path = image_path_unicode_string.Buffer.?[0 .. image_path_unicode_string.Length / 2];

var nt_path_buf: bun.WPathBuffer = undefined;
const nt_path = bun.strings.addNTPathPrefix(&nt_path_buf, image_path);
const nt_path = bun.strings.addNTPathPrefixIfNeeded(&nt_path_buf, image_path);

const basename_start = std.mem.lastIndexOfScalar(u16, nt_path, '\\') orelse
return error.FileNotFound;
Expand All @@ -965,12 +964,11 @@ pub const StandaloneModuleGraph = struct {
return bun.sys.openFileAtWindows(
bun.FileDescriptor.cwd(),
nt_path,
// access_mask
w.SYNCHRONIZE | w.GENERIC_READ,
// create disposition
w.FILE_OPEN,
// create options
w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_REPARSE_POINT,
.{
.access_mask = w.SYNCHRONIZE | w.GENERIC_READ,
.disposition = w.FILE_OPEN,
.options = w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_REPARSE_POINT,
},
).unwrap() catch {
return error.FileNotFound;
};
Expand Down
Loading
Loading