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

get node:fs tests passing part 1 #16270

Merged
merged 60 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
899b298
begin node:fs
paperclover Jan 8, 2025
9fec87b
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
paperclover Jan 8, 2025
171ac77
more
paperclover Jan 9, 2025
4021731
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
paperclover Jan 9, 2025
dc68cee
yea
paperclover Jan 9, 2025
e4c17cc
a
paperclover Jan 9, 2025
cea5a34
a
paperclover Jan 9, 2025
55ae697
fix compile error
paperclover Jan 9, 2025
9e345f2
error printing change
paperclover Jan 9, 2025
c7bdcc6
wala
paperclover Jan 9, 2025
c26602a
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
paperclover Jan 9, 2025
2c56d07
a
paperclover Jan 9, 2025
928e9e4
yeaa
paperclover Jan 10, 2025
eadc1b4
more pass
paperclover Jan 10, 2025
6e273f8
wala
paperclover Jan 10, 2025
678dfeb
lowercasification
paperclover Jan 10, 2025
35b3d23
fix compile error
paperclover Jan 10, 2025
545485a
fff
paperclover Jan 10, 2025
17c80ad
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
paperclover Jan 10, 2025
bd32776
system error changes
paperclover Jan 11, 2025
1970450
a
paperclover Jan 11, 2025
cc1b3c3
a
paperclover Jan 11, 2025
8842fea
fchown pass
dylan-conway Jan 11, 2025
b15841f
copyfile
dylan-conway Jan 11, 2025
39226f9
jbnggcgh
dylan-conway Jan 11, 2025
baf2112
alpine linux fix?
paperclover Jan 11, 2025
e62fdc6
a
paperclover Jan 11, 2025
ec71eb0
fs promises file handle
paperclover Jan 11, 2025
7c084e6
fixy
paperclover Jan 14, 2025
a11776f
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
paperclover Jan 14, 2025
08a6b65
these all pass on mac btw
paperclover Jan 14, 2025
62d5f33
a
paperclover Jan 14, 2025
2333075
fixy
paperclover Jan 14, 2025
7dc9649
fix windows build
dylan-conway Jan 14, 2025
03548f9
walawalawalawala
dylan-conway Jan 14, 2025
68c072b
Add --no-clear-screen to docs (#16364)
sroussey Jan 13, 2025
a72527a
Faster debug builds (#16354)
Jarred-Sumner Jan 13, 2025
78d2350
docs: use tag `$BUN_LATEST_VERSION` for version instead of manual (#1…
RiskyMH Jan 13, 2025
2f7d7ad
Docs: Correctly specify the sign of BigUint64Array (#16358)
yooneskh Jan 13, 2025
7d9693b
fix(cli/install): `--silent` disables summary (#16321)
DonIsaac Jan 13, 2025
8bc844e
feat(cli/bunx): support `--no-install` flag (#16315)
DonIsaac Jan 13, 2025
ae3ae7c
allow importing `bun.lock` (+ types for it) (#16244)
RiskyMH Jan 13, 2025
cab88fa
More HTMLRewriter docs
Jarred-Sumner Jan 13, 2025
e2573c6
Update html-rewriter.md
Jarred-Sumner Jan 13, 2025
2e36f91
Update html-rewriter.md
Jarred-Sumner Jan 13, 2025
5b0f86d
Revert "Skip javascriptcore's first parse step for ES Modules" (#16370)
Jarred-Sumner Jan 13, 2025
d02a75a
Update html-rewriter.md
Jarred-Sumner Jan 13, 2025
44e22f7
Update SetupWebKit.cmake
Jarred-Sumner Jan 13, 2025
616d841
Fix use of .call in builtin
Jarred-Sumner Jan 13, 2025
f971a27
Unify syntax highlighting and ouput for `--help` (#16360)
fel1x-developer Jan 14, 2025
1fcf8bd
alalala
paperclover Jan 14, 2025
7c0bf07
a
paperclover Jan 14, 2025
2de935c
Merge remote-tracking branch 'origin/main' into chloe/node-fs-1
dylan-conway Jan 14, 2025
c657dc7
fix stat on post y2k38 dates on windows
dylan-conway Jan 14, 2025
1942c75
Merge branch 'chloe/node-fs-1' of https://github.com/oven-sh/bun into…
dylan-conway Jan 14, 2025
790d485
binding uv fix
paperclover Jan 14, 2025
6a8f6ea
remove
Jan 15, 2025
9194253
remove some tests
paperclover Jan 15, 2025
71e7353
wala
Jan 15, 2025
91048cc
a
paperclover Jan 15, 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: 2 additions & 2 deletions cmake/tools/SetupLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ if(APPLE)
endif()
endif()

list(APPEND LLVM_PATHS ${HOMEBREW_PREFIX}/opt/llvm/bin)

if(USE_LLVM_VERSION)
list(APPEND LLVM_PATHS ${HOMEBREW_PREFIX}/opt/llvm@${LLVM_VERSION_MAJOR}/bin)
endif()

list(APPEND LLVM_PATHS ${HOMEBREW_PREFIX}/opt/llvm/bin)
endif()

if(UNIX)
Expand Down
22 changes: 0 additions & 22 deletions jsconfig.json

This file was deleted.

3 changes: 0 additions & 3 deletions src/bake/production.zig
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,6 @@ export fn BakeProdLoad(pt: *PerThread, key: bun.String) bun.String {
if (pt.module_map.get(utf8.slice())) |value| {
return pt.bundled_outputs[value.get()].value.toBunString();
}
for (pt.module_map.keys()) |keys| {
std.debug.print("key that does exist: {s}\n", .{keys});
}
return bun.String.dead;
}

Expand Down
150 changes: 76 additions & 74 deletions src/bun.js/ConsoleObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3262,86 +3262,88 @@ pub const Formatter = struct {
else
bun.asByteSlice(@tagName(arrayBuffer.typed_array_type)),
);
if (slice.len == 0) {
writer.print("({d}) []", .{arrayBuffer.len});
return;
}
writer.print("({d}) [ ", .{arrayBuffer.len});

if (slice.len > 0) {
switch (jsType) {
.Int8Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i8,
@as([]align(std.meta.alignment([]i8)) i8, @alignCast(std.mem.bytesAsSlice(i8, slice))),
enable_ansi_colors,
),
.Int16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i16,
@as([]align(std.meta.alignment([]i16)) i16, @alignCast(std.mem.bytesAsSlice(i16, slice))),
enable_ansi_colors,
),
.Uint16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u16,
@as([]align(std.meta.alignment([]u16)) u16, @alignCast(std.mem.bytesAsSlice(u16, slice))),
enable_ansi_colors,
),
.Int32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i32,
@as([]align(std.meta.alignment([]i32)) i32, @alignCast(std.mem.bytesAsSlice(i32, slice))),
enable_ansi_colors,
),
.Uint32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u32,
@as([]align(std.meta.alignment([]u32)) u32, @alignCast(std.mem.bytesAsSlice(u32, slice))),
enable_ansi_colors,
),
.Float16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f16,
@as([]align(std.meta.alignment([]f16)) f16, @alignCast(std.mem.bytesAsSlice(f16, slice))),
enable_ansi_colors,
),
.Float32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f32,
@as([]align(std.meta.alignment([]f32)) f32, @alignCast(std.mem.bytesAsSlice(f32, slice))),
enable_ansi_colors,
),
.Float64Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f64,
@as([]align(std.meta.alignment([]f64)) f64, @alignCast(std.mem.bytesAsSlice(f64, slice))),
enable_ansi_colors,
),
.BigInt64Array => this.writeTypedArray(
switch (jsType) {
.Int8Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i8,
@alignCast(std.mem.bytesAsSlice(i8, slice)),
enable_ansi_colors,
),
.Int16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i16,
@alignCast(std.mem.bytesAsSlice(i16, slice)),
enable_ansi_colors,
),
.Uint16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u16,
@alignCast(std.mem.bytesAsSlice(u16, slice)),
enable_ansi_colors,
),
.Int32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i32,
@alignCast(std.mem.bytesAsSlice(i32, slice)),
enable_ansi_colors,
),
.Uint32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
u32,
@alignCast(std.mem.bytesAsSlice(u32, slice)),
enable_ansi_colors,
),
.Float16Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f16,
@alignCast(std.mem.bytesAsSlice(f16, slice)),
enable_ansi_colors,
),
.Float32Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f32,
@alignCast(std.mem.bytesAsSlice(f32, slice)),
enable_ansi_colors,
),
.Float64Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
f64,
@alignCast(std.mem.bytesAsSlice(f64, slice)),
enable_ansi_colors,
),
.BigInt64Array => this.writeTypedArray(
*@TypeOf(writer),
&writer,
i64,
@alignCast(std.mem.bytesAsSlice(i64, slice)),
enable_ansi_colors,
),
.BigUint64Array => {
this.writeTypedArray(
*@TypeOf(writer),
&writer,
i64,
@as([]align(std.meta.alignment([]i64)) i64, @alignCast(std.mem.bytesAsSlice(i64, slice))),
u64,
@as([]align(std.meta.alignment([]u64)) u64, @alignCast(std.mem.bytesAsSlice(u64, slice))),
enable_ansi_colors,
),
.BigUint64Array => {
this.writeTypedArray(
*@TypeOf(writer),
&writer,
u64,
@as([]align(std.meta.alignment([]u64)) u64, @alignCast(std.mem.bytesAsSlice(u64, slice))),
enable_ansi_colors,
);
},
);
},

// Uint8Array, Uint8ClampedArray, DataView, ArrayBuffer
else => this.writeTypedArray(*@TypeOf(writer), &writer, u8, slice, enable_ansi_colors),
}
// Uint8Array, Uint8ClampedArray, DataView, ArrayBuffer
else => this.writeTypedArray(*@TypeOf(writer), &writer, u8, slice, enable_ansi_colors),
}

writer.writeAll(" ]");
Expand Down
14 changes: 4 additions & 10 deletions src/bun.js/api/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2709,18 +2709,14 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
file.pathlike.fd
else switch (bun.sys.open(file.pathlike.path.sliceZ(&file_buf), bun.O.RDONLY | bun.O.NONBLOCK | bun.O.CLOEXEC, 0)) {
.result => |_fd| _fd,
.err => |err| return this.runErrorHandler(err.withPath(file.pathlike.path.slice()).toSystemError().toErrorInstance(
globalThis,
)),
.err => |err| return this.runErrorHandler(err.withPath(file.pathlike.path.slice()).toJSC(globalThis)),
};

// stat only blocks if the target is a file descriptor
const stat: bun.Stat = switch (bun.sys.fstat(fd)) {
.result => |result| result,
.err => |err| {
this.runErrorHandler(err.withPathLike(file.pathlike).toSystemError().toErrorInstance(
globalThis,
));
this.runErrorHandler(err.withPathLike(file.pathlike).toJSC(globalThis));
if (auto_close) {
_ = bun.sys.close(fd);
}
Expand Down Expand Up @@ -2757,11 +2753,9 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
.errno = @as(bun.sys.Error.Int, @intCast(@intFromEnum(std.posix.E.INVAL))),
.syscall = .sendfile,
};
var sys = err.withPathLike(file.pathlike).toSystemError();
var sys = err.withPathLike(file.pathlike).toShellSystemError();
sys.message = bun.String.static("File must be regular or FIFO");
this.runErrorHandler(sys.toErrorInstance(
globalThis,
));
this.runErrorHandler(sys.toErrorInstance(globalThis));
return;
}
}
Expand Down
30 changes: 0 additions & 30 deletions src/bun.js/bindings/JSPropertyIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,36 +94,6 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje
return JSPropertyIterator::create(vm, array.releaseData());
}

// The only non-own property that we sometimes want to get is the code property.
extern "C" EncodedJSValue Bun__JSPropertyIterator__getCodeProperty(JSPropertyIterator* iter, JSC::JSGlobalObject* globalObject, JSC::JSObject* object)
{
if (UNLIKELY(!iter)) {
return {};
}

auto& vm = iter->vm;
auto scope = DECLARE_THROW_SCOPE(vm);
RETURN_IF_EXCEPTION(scope, {});
if (UNLIKELY(object->type() == JSC::ProxyObjectType)) {
return {};
}

auto& builtinNames = WebCore::builtinNames(vm);

PropertySlot slot(object, PropertySlot::InternalMethodType::VMInquiry, vm.ptr());
if (!object->getNonIndexPropertySlot(globalObject, builtinNames.codePublicName(), slot)) {
return {};
}

if (slot.isAccessor() || slot.isCustom()) {
return {};
}

RETURN_IF_EXCEPTION(scope, {});

return JSValue::encode(slot.getPureResult());
}

extern "C" size_t Bun__JSPropertyIterator__getLongestPropertyName(JSPropertyIterator* iter, JSC::JSGlobalObject* globalObject, JSC::JSObject* object)
{
size_t longest = 0;
Expand Down
25 changes: 0 additions & 25 deletions src/bun.js/bindings/JSPropertyIterator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extern "C" fn Bun__JSPropertyIterator__getNameAndValueNonObservable(iter: ?*anyo
extern "C" fn Bun__JSPropertyIterator__getName(iter: ?*anyopaque, propertyName: *bun.String, i: usize) void;
extern "C" fn Bun__JSPropertyIterator__deinit(iter: ?*anyopaque) void;
extern "C" fn Bun__JSPropertyIterator__getLongestPropertyName(iter: ?*anyopaque, globalObject: *JSC.JSGlobalObject, object: *anyopaque) usize;
extern "C" fn Bun__JSPropertyIterator__getCodeProperty(iter: ?*anyopaque, globalObject: *JSC.JSGlobalObject, object: *anyopaque) JSC.JSValue;
pub const JSPropertyIteratorOptions = struct {
skip_empty_name: bool,
include_value: bool,
Expand All @@ -27,7 +26,6 @@ pub fn JSPropertyIterator(comptime options: JSPropertyIteratorOptions) type {
globalObject: *JSC.JSGlobalObject,
object: *JSC.JSCell = undefined,
value: JSC.JSValue = .zero,
tried_code_property: bool = false,

pub fn getLongestPropertyName(this: *@This()) usize {
if (this.impl == null) return 0;
Expand Down Expand Up @@ -60,7 +58,6 @@ pub fn JSPropertyIterator(comptime options: JSPropertyIteratorOptions) type {
pub fn reset(this: *@This()) void {
this.iter_i = 0;
this.i = 0;
this.tried_code_property = false;
}

/// The bun.String returned has not incremented it's reference count.
Expand Down Expand Up @@ -107,27 +104,5 @@ pub fn JSPropertyIterator(comptime options: JSPropertyIteratorOptions) type {

unreachable;
}

/// "code" is not always an own property, and we want to get it without risking exceptions.
pub fn getCodeProperty(this: *@This()) ?bun.String {
if (comptime !options.include_value) {
@compileError("TODO");
}

if (this.tried_code_property) {
return null;
}

this.tried_code_property = true;

const current = Bun__JSPropertyIterator__getCodeProperty(this.impl, this.globalObject, this.object);
if (current == .zero) {
return null;
}
current.ensureStillAlive();
this.value = current;

return bun.String.static("code");
}
};
}
Loading
Loading