From 7eab65df99bd6d447474c4e1a5009948ccf2bbd0 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 4 Mar 2025 19:14:33 -0800 Subject: [PATCH 1/5] cmd: tidy spacing in `bun init` (#17659) --- src/cli/init_command.zig | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/cli/init_command.zig b/src/cli/init_command.zig index a5bb0b0d89..a13abfffff 100644 --- a/src/cli/init_command.zig +++ b/src/cli/init_command.zig @@ -827,14 +827,12 @@ pub const InitCommand = struct { } if (fields.entry_point.len > 0 and !did_load_package_json) { - Output.pretty("\nTo get started, run:\n\n\t", .{}); - if (strings.containsAny( - " \"'", - fields.entry_point, - )) { - Output.prettyln("bun run {any}", .{bun.fmt.formatJSONStringLatin1(fields.entry_point)}); + Output.pretty("\nTo get started, run:\n\n ", .{}); + + if (strings.containsAny(" \"'", fields.entry_point)) { + Output.pretty("bun run {any}\n\n", .{bun.fmt.formatJSONStringLatin1(fields.entry_point)}); } else { - Output.prettyln("bun run {s}", .{fields.entry_point}); + Output.pretty("bun run {s}\n\n", .{fields.entry_point}); } } @@ -1106,15 +1104,15 @@ const Template = enum { \\ \\Development - full-stack dev server with hot reload \\ - \\ bun dev + \\ bun dev \\ \\Static Site - build optimized assets to disk (no backend) \\ - \\ bun run build + \\ bun run build \\ \\Production - serve a full-stack production build \\ - \\ bun start + \\ bun start \\ \\Happy bunning! 🐇 \\ From bae0921ef7208094044ab32ed92255b47f20ec70 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 4 Mar 2025 20:00:59 -0800 Subject: [PATCH 2/5] ci: this can take longer when CI is backed up --- .buildkite/ci.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/ci.mjs b/.buildkite/ci.mjs index 14a7efad0d..b3b2f4ca4c 100755 --- a/.buildkite/ci.mjs +++ b/.buildkite/ci.mjs @@ -471,7 +471,7 @@ function getBuildZigStep(platform, options) { cancel_on_build_failing: isMergeQueue(), env: getBuildEnv(platform, options), command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`, - timeout_in_minutes: 25, + timeout_in_minutes: 35, }; } From 6ec2b98336c68c99453d14fa6d1d13ee492496b6 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 4 Mar 2025 20:57:26 -0800 Subject: [PATCH 3/5] Add BUN_DISABLE_STOP_IF_NECESSARY_TIMER env var --- src/bun.js/bindings/ZigGlobalObject.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 257a876d39..4a74d169b6 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -892,7 +892,25 @@ extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, vm.heap.acquireAccess(); JSC::JSLockHolder locker(vm); - vm.heap.disableStopIfNecessaryTimer(); + { + const char* disable_stop_if_necessary_timer = getenv("BUN_DISABLE_STOP_IF_NECESSARY_TIMER"); + // Keep stopIfNecessaryTimer enabled by default when either: + // - `--smol` is passed + // - The machine has less than 4GB of RAM + bool shouldDisableStopIfNecessaryTimer = !miniMode || WTF::ramSize() < (1024ull * 1024ull * 1024ull * 4ull); + if (disable_stop_if_necessary_timer) { + const char value = disable_stop_if_necessary_timer[0]; + if (value == '0') { + shouldDisableStopIfNecessaryTimer = false; + } else if (value == '1') { + shouldDisableStopIfNecessaryTimer = true; + } + } + + if (shouldDisableStopIfNecessaryTimer) { + vm.heap.disableStopIfNecessaryTimer(); + } + } // Every JS VM's RunLoop should use Bun's RunLoop implementation ASSERT(vmPtr->runLoop().kind() == WTF::RunLoop::Kind::Bun); From 5053d0eaafe5523566538167f5c0a01b8cbb5d9b Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 4 Mar 2025 22:56:10 -0800 Subject: [PATCH 4/5] Flip shouldDisableStopIfNecessaryTimer --- src/bun.js/bindings/ZigGlobalObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 4a74d169b6..5d8259c49e 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -897,7 +897,7 @@ extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, // Keep stopIfNecessaryTimer enabled by default when either: // - `--smol` is passed // - The machine has less than 4GB of RAM - bool shouldDisableStopIfNecessaryTimer = !miniMode || WTF::ramSize() < (1024ull * 1024ull * 1024ull * 4ull); + bool shouldDisableStopIfNecessaryTimer = !miniMode || WTF::ramSize() > (1024ull * 1024ull * 1024ull * 4ull); if (disable_stop_if_necessary_timer) { const char value = disable_stop_if_necessary_timer[0]; if (value == '0') { From 8a177f6c85bc4dfc9bcd9a1daeba3a916dba8180 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 4 Mar 2025 22:57:02 -0800 Subject: [PATCH 5/5] Adjust flipping logic --- src/bun.js/bindings/ZigGlobalObject.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 5d8259c49e..75514a4e25 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -897,7 +897,11 @@ extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, // Keep stopIfNecessaryTimer enabled by default when either: // - `--smol` is passed // - The machine has less than 4GB of RAM - bool shouldDisableStopIfNecessaryTimer = !miniMode || WTF::ramSize() > (1024ull * 1024ull * 1024ull * 4ull); + bool shouldDisableStopIfNecessaryTimer = !miniMode; + if (WTF::ramSize() < 1024ull * 1024ull * 1024ull * 4ull) { + shouldDisableStopIfNecessaryTimer = false; + } + if (disable_stop_if_necessary_timer) { const char value = disable_stop_if_necessary_timer[0]; if (value == '0') {