Compare commits

...

2140 Commits

Author SHA1 Message Date
Meghan Denny
4955eb0b2a lower this because windows leaks bad and exhibits the crash quickly 2024-07-31 23:51:11 -07:00
Meghan Denny
b9fc52bf76 move to .test.js file and make one test 2024-07-31 23:39:56 -07:00
Meghan Denny
e331fea16a fix again and add reproduction test 2024-07-31 22:31:32 -07:00
Meghan Denny
a116bf9e7b vscode: dont auto include this 2024-07-31 22:29:19 -07:00
Meghan Denny
714324e891 use bun.New 2024-07-31 18:50:37 -07:00
Meghan Denny
000ea07cbe fix posix crash 2024-07-31 18:15:19 -07:00
Meghan Denny
5e5ecd14f2 fix posix build error 2024-07-31 18:15:12 -07:00
Meghan Denny
8219f155b6 remove flags.finalized 2024-07-31 18:15:03 -07:00
Meghan Denny
d6757df1a6 remove flags.has_stdin_destructor_called 2024-07-31 18:14:45 -07:00
Meghan Denny
66d71fde0e Subprocess: fix crash when it frees itself before stdin does 2024-07-31 16:23:57 -07:00
Ciro Spaciari
bec04c7341 change Body.Value.Error to not always allocate JSValues (#12955)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-31 02:26:14 -07:00
Jarred Sumner
a44b7e41d2 Pass --force to git submodule update in CI 2024-07-30 23:03:35 -07:00
Jarred Sumner
de5e56336c Use example.com as the test domain in a test 2024-07-30 22:44:47 -07:00
Ciro Spaciari
1c648063fa fix(tls/socket/fetch) shutdown fix + ref counted context (#12925)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-30 22:41:54 -07:00
Jarred Sumner
1c3354bc95 Deflake setInterval test 2024-07-30 22:33:04 -07:00
dave caruso
d5d4f53e82 fix(bundler): put unwrapped cjs imports at top level for minifyrenamer (#12951) 2024-07-30 21:30:09 -07:00
Pipythonmc
7ab4dc738f doc: fix incorrect documentation relating to the --define flag (#12952) 2024-07-30 19:17:32 -07:00
dave caruso
ebc7045ca4 fix crash handler test failures (#12932) 2024-07-30 16:52:59 -07:00
Ashcon Partovi
848ad19d9e Attempt to fix flaky Windows builds 2024-07-30 10:55:13 -07:00
Ashcon Partovi
1da3436266 Attempt to fix flaky build-deps on Windows 2024-07-30 10:48:24 -07:00
Ashcon Partovi
49e496399a Attempt to fix missing GitHub assets on release 2024-07-30 10:44:44 -07:00
Ashcon Partovi
9b8340a5b3 Attempt to fix 'spawn error' on Windows tests 2024-07-29 19:16:29 -07:00
Meghan Denny
8efcc61a7b windows: cleanup logging of NODE_CHANNEL_FD (#12930) 2024-07-29 19:16:02 -07:00
Meghan Denny
4d6480050c NodeError: add more and use them in child_process and dgram (#12929) 2024-07-29 19:15:23 -07:00
Meghan Denny
fc2c134bc6 test: rewrite "should call close" to use promise instead of done (#12931) 2024-07-29 19:05:44 -07:00
m1212e
4c4db1da37 docs: Add hint for memory timeline in debugger (#12923) 2024-07-29 19:05:13 -07:00
dave caruso
77e14c8482 fix template addition folding 12904 (#12928) 2024-07-29 19:04:59 -07:00
Ashcon Partovi
fba5d65003 Make the release script faster 2024-07-29 17:38:06 -07:00
Jarred Sumner
c181cf45a7 Fixes #12910 (#12911) 2024-07-29 17:19:47 -07:00
Ashcon Partovi
5aeb4d9f79 Fix missing assert in release script 2024-07-29 16:57:22 -07:00
Dariush Alipour
1d9a8b4134 fix: child_process test with specified shell for windows (#12926) 2024-07-29 16:36:46 -07:00
Ashcon Partovi
30881444df Fix flaky C++ build with missing submodules 2024-07-29 16:34:01 -07:00
Ashcon Partovi
a2b4e3d4c2 Fix syntax in env.ps1 2024-07-29 16:25:50 -07:00
Ashcon Partovi
e5662caa33 Fix release script, again 2024-07-29 16:21:55 -07:00
Ashcon Partovi
1f1ea7bf24 Fix release script 2024-07-29 15:29:46 -07:00
Ashcon Partovi
175746e569 Only upload canary artifacts when the build is canary 2024-07-29 14:54:29 -07:00
Ashcon Partovi
005dd776b6 Allow creating release builds with 'RELEASE=1' 2024-07-29 14:50:26 -07:00
Ashcon Partovi
81dec2657f Enable buildkite (#12653) 2024-07-29 14:39:50 -07:00
Jarred Sumner
dbd320ccfa Remove some dynamic memory allocations in uWebSockets (#12897) 2024-07-29 15:10:55 -03:00
Jarred Sumner
8f8d3968a3 Enable concurrent transpiler on Windows (#12915) 2024-07-29 06:25:38 -07:00
Jarred Sumner
0bbdd880e6 Fix various Windows build issues 2024-07-29 04:31:39 -07:00
Jarred Sumner
51257d5668 Add BUN_FEATURE_FLAG_DISABLE_ASYNC_TRANSPILER feature flag 2024-07-29 01:37:59 -07:00
Jarred Sumner
a2ae28d158 Add named allocator 2024-07-28 21:27:08 -07:00
Jarred Sumner
f04991f6bb Fix debug build issue 2024-07-28 19:38:03 -07:00
Andrew Johnston
80e651aca3 fix(build): use specific version of lld for link on unix (#12907) 2024-07-28 18:38:01 -07:00
Jarred Sumner
a5ba02804f Use typed allocators in more places (#12899) 2024-07-28 18:37:35 -07:00
Jarred Sumner
4199fd4515 Fix memory leak in RuntimeTranspilerStore (#12900) 2024-07-28 08:30:32 -07:00
Dylan Conway
848327d333 textencoder: remove DOMJIT (#12868) 2024-07-28 07:46:53 -07:00
Jarred Sumner
bfb72f84c4 In debug builds on macOS, add malloc_zone_check when GC runs 2024-07-28 05:13:50 -07:00
Jarred Sumner
e4022ec3c7 Bump versions of things 2024-07-27 02:02:48 -07:00
Jarred Sumner
a7f34c15fc Slightly better error.stack (#12861) 2024-07-27 01:02:46 -07:00
Meghan Denny
a0ebb051b0 implement node:util.getSystemErrorName() (#12837) 2024-07-27 00:20:50 -07:00
dave caruso
70ca2b76c3 fix: check if we are crashing before exiting gracefully (#12865) 2024-07-26 20:00:02 -07:00
Jarred Sumner
e5ac4f94fa Handle errors in node:http better (#12641)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-26 19:53:36 -07:00
dave caruso
d547d8a30e fix a bundler crash (#12864)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-07-26 19:39:37 -07:00
Meghan Denny
32d9bb3ced ci: format: switch to mlugg/setup-zig (#12863) 2024-07-26 18:47:02 -07:00
dave caruso
75df73ef90 fix: make raiseIgnoringPanicHandler ignore the panic handler (#12578)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-26 18:36:53 -07:00
Dylan Conway
13907c4c29 fix(build): assertion failure when cross-compiling on windows (#12862)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-07-26 17:29:01 -07:00
Jarred Sumner
87169b6bb3 Configure libcpp assert to avoid macOS 13.0 issue (#12860) 2024-07-26 16:03:16 -07:00
Jarred Sumner
244100c32f When crash reporter is disabled also disable resetSegfaultHanlder 2024-07-26 14:50:56 -07:00
Jarred Sumner
8a78b2241d Rename JSC.Node.StringOrBuffer -> StringOrBuffer 2024-07-26 14:50:30 -07:00
dave caruso
bf8b6922bb Fix memory leak when printing any error's source code. (#12831)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-26 14:14:16 -07:00
Dylan Conway
7aa05ec542 bump webkit (#12858)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-07-26 14:13:58 -07:00
Meghan Denny
f95ae9baee launch.json: remove BUN_DEBUG_ALL=1 from 'bun run' (#12845) 2024-07-26 04:14:45 -07:00
Meghan Denny
f7cb2da542 use .undefined literal instead of jsUndefined() call (#12834) 2024-07-26 04:03:55 -07:00
Meghan Denny
d966129992 bindings: better use of jsc api in Path_functionToNamespacedPath (#12836) 2024-07-26 04:02:31 -07:00
Meghan Denny
6cb5cd2a87 node:v8: expose DefaultDeserializer and DefaultSerializer exports (#12838) 2024-07-26 03:58:47 -07:00
Meghan Denny
080a2806af uws: tidy use of ssl intFromBool (#12839) 2024-07-26 03:58:01 -07:00
Meghan Denny
92c83fcd9e ipc: make IPCInstance.context void on windows instead of u0 (#12840) 2024-07-26 03:56:13 -07:00
Meghan Denny
277ed9d138 bindings: fix zig extern def of Bun__JSValue__deserialize (#12844) 2024-07-26 03:48:30 -07:00
Meghan Denny
879cb23163 cpp: missing uses of propertyNames (#12835) 2024-07-26 03:47:41 -07:00
Jarred Sumner
d321ee97c5 Move napi_new_instance to c++ (#12658)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-25 18:51:01 -07:00
Jarred Sumner
3bfeb83e7e Fix [Symbol.dispose] on Bun.listen() & Bun.connect() + add types (#12739)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-25 18:49:35 -07:00
Meghan Denny
5a18b7d2fc fixes relationship between process.kill and process._kill (#12792)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-25 18:46:30 -07:00
Gert Goet
e75ef69fb4 Fix spacing of patch-command help (#12769) 2024-07-25 18:44:52 -07:00
Dylan Conway
78021e34ae fix(bun:test): make sure test.each doesn't return .zero (#12828) 2024-07-25 18:24:16 -07:00
Dylan Conway
d7187592c0 fix(brotli): protect and unprotect buffer values (#12829) 2024-07-25 18:24:01 -07:00
Jarred Sumner
5f1b569c52 Fix crash when creating a new Worker with a numeric environment varia… (#12810) 2024-07-25 18:10:57 -07:00
dave caruso
e54fe5995b fix(bundler): dont tree-shake imported enum if inlined and used (#12826) 2024-07-25 17:29:20 -07:00
Jarred Sumner
a2f68989a0 Retry on 5xx errors from npm registry (#12825) 2024-07-25 17:28:59 -07:00
Jarred Sumner
4a1e01d076 Use bun.New more (#12811)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-25 15:35:02 -07:00
Jarred Sumner
dd8b0a5889 Clean up socket_async_http_abort_tracker after a lot of requests (#12816) 2024-07-25 15:34:48 -07:00
Jarred Sumner
8cadf66143 Add malloc zones to heapStats() on macOS in debug builds (#12815) 2024-07-25 15:33:43 -07:00
Jarred Sumner
77cd03dad1 Workaround for BUN-2WQ (#12806) 2024-07-25 15:33:17 -07:00
Meghan Denny
82b42ed851 node: more process.exitCode fixes (#12809) 2024-07-25 15:18:41 -07:00
Dylan Conway
2de82c0b3b fix regression test 2024-07-25 14:07:57 -07:00
Jarred Sumner
30df04cd35 Add a couple feature flags 2024-07-25 05:52:50 -07:00
Jarred Sumner
585c8299d8 Clean up some stack trace printing logic (#12791) 2024-07-25 04:04:02 -07:00
Dylan Conway
375d8da8e6 fix(brotli): protect buffer jsvalues (#12800)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-25 04:01:53 -07:00
Jarred Sumner
0bd8db7162 Slightly reduce pointer lookups in hot code path (#12802) 2024-07-24 23:07:51 -07:00
Meghan Denny
d97260869d replace JSValue .callWithThis with always explicit .call (#12789) 2024-07-24 23:07:28 -07:00
Jarred Sumner
fdb58dc861 Fixes #9555 (#12801) 2024-07-24 23:07:04 -07:00
Meghan Denny
5f118704ec web-apis.md: make this list diff better; does not change presentation (#12795) 2024-07-24 22:27:32 -07:00
dave caruso
610c7f5e47 fix memory lifetime of define expressions (#12784) 2024-07-24 22:27:14 -07:00
Meghan Denny
1e0b20f514 node: fix observable value of process.exitCode (#12799) 2024-07-24 22:26:07 -07:00
Meghan Denny
f6c89f4c25 JSValue.toFmt doesn't need a globalThis param because ConsoleObject.Formatter already has one (#12790) 2024-07-24 22:03:51 -07:00
Meghan Denny
907cd8d45d fix crash in populateStackTrace() (#12793) 2024-07-24 21:08:25 -07:00
Dylan Conway
ac4523e903 fix(napi): unref threadsafe functions on finalize (#12788) 2024-07-24 18:57:01 -07:00
Jarred Sumner
24574dddb2 Ensure LLVM 18 with Homebrew on macOS 2024-07-24 15:56:05 -07:00
Dylan Conway
2da57f6d7b napi_threadsafe_function async tracker (#12780) 2024-07-24 15:27:51 -07:00
dave caruso
e2c3749965 fix(bundler): become smarter with __esm wrappers (#12729) 2024-07-24 02:00:20 -07:00
Jarred Sumner
57c6a7db35 libdeflate (#12741) 2024-07-24 01:30:31 -07:00
ippsav
c37891471a Fix alignment calculation in Zone.create function (#12748) 2024-07-24 01:30:11 -07:00
Jarred Sumner
8ba0791dc8 Use one JSC::SourceProvider instead of 322 (#12761) 2024-07-24 01:26:09 -07:00
dave caruso
f9371e59f2 fix(bundler): fix part liveness calculation (#12758) 2024-07-23 23:49:01 -07:00
Jarred Sumner
79ddf0e47a Fix assertion failure in bun build when entry point is a file loader (#12683)
Co-authored-by: dave caruso <me@paperdave.net>
2024-07-23 22:02:51 -07:00
David Stevens
177f3a8622 Fixes #12182 - update default port when server is created (#12201) 2024-07-23 11:07:38 -07:00
Ciro Spaciari
5a5f3d6b30 fix(http) timeout (#12728)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-23 01:13:43 -07:00
Ivan Baksheev
4e5d759c37 fix(bundler): ignore external rules for entrypoint (#12736) 2024-07-23 00:33:18 -07:00
Jarred Sumner
1a702dfdc7 Add canary to cache key 2024-07-22 22:16:27 -07:00
Jarred Sumner
3ef84816a6 Update WebKit 2024-07-22 20:47:53 -07:00
Jarred Sumner
6e9b592c56 try using LLVM 18 on macOS (#12727)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-22 20:44:29 -07:00
Jarred Sumner
a6b5543bd8 Don't set fuse-ld=lld in boringssl script 2024-07-22 15:41:41 -07:00
Jarred Sumner
a4759eb147 Bump minimum macOS build to 13.0 2024-07-22 14:50:23 -07:00
Dariush Alipour
732ed2b7df Fix: test coverage node_modules exclusion in Windows (#12691) 2024-07-22 13:25:42 -07:00
Jarred Sumner
63fab9a82b Update fetch.md 2024-07-22 04:06:00 -07:00
Jarred Sumner
ff17b427c8 Update fetch.md 2024-07-22 04:02:48 -07:00
Jarred Sumner
ca44df7c88 Update fetch.md 2024-07-22 03:57:29 -07:00
huseeiin
9daa7ea555 Update bun.d.ts (#12719) 2024-07-22 03:55:14 -07:00
Jarred Sumner
2f0020f00f Update fetch.md 2024-07-22 03:52:33 -07:00
Jarred Sumner
599d27d93e Update fetch.md 2024-07-22 03:50:22 -07:00
Jarred Sumner
696f209ec1 Update fetch.md 2024-07-22 03:49:32 -07:00
Jarred Sumner
1a6ead667b Introduce bun --fetch-preconnect <url> ./my-script.ts (#12698) 2024-07-22 03:41:59 -07:00
Jarred Sumner
bbf2f5d716 Experiment: disable C++ static destructors (#12652)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-21 21:32:52 -07:00
ippsav
9574044083 Fix expect.toThrow(expect.any()) matcher to correctly handle ExpectAny objects (#12670) 2024-07-21 20:35:18 -07:00
Jarred Sumner
822b725bec Fix BUN-2M9, take two 2024-07-21 08:49:00 -07:00
Jarred Sumner
dc775f75f0 Fix BUN-2M9 2024-07-21 07:40:57 -07:00
Jarred Sumner
738947bdec Deflake node-tls-connect test 2024-07-20 02:36:08 -07:00
Jarred Sumner
b7efeafc03 Deflake node-tls-connect test 2024-07-19 23:42:23 -07:00
Jarred Sumner
f5d1a17a5c Fix crash in bun exec cd (#12676)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-19 22:57:52 -07:00
Jarred Sumner
03024e6b4e Fix truncating in BigIntStats (#12643)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-19 20:00:32 -07:00
Jarred Sumner
1d61676c7b Check for file or directory 2024-07-18 13:56:21 -07:00
Jarred Sumner
23fb63f45c Fixes #12360 (#12364) 2024-07-18 09:10:15 -07:00
Jarred Sumner
0be71edf3f Upload .dSYM file 2024-07-18 03:19:48 -07:00
Jarred Sumner
6b50deb7b7 Move dev dependencies to "devDependencies"
Spammy vulnerability scanning software can't tell we aren't using these in the "bun" npm package.
2024-07-18 01:13:36 -07:00
Jarred Sumner
6ad3e6a5e3 Fixes #2532 (#12633)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-17 20:53:12 -07:00
HibanaSama
b1dce1e241 build(windows): fix esbuild errors when bundling node-fallbacks (#12628) 2024-07-17 19:40:25 -07:00
Jarred Sumner
cc42052039 node-fetch polyfill shouldn't break when web globals are overriden (#12634) 2024-07-17 18:57:03 -07:00
Jarred Sumner
ecf5aea071 Ensure undici primordials are pristine (#12635) 2024-07-17 18:56:22 -07:00
Jarred Sumner
79d21a0d02 Bump internal bun versions 2024-07-17 17:21:14 -07:00
dave caruso
43949151b1 fix(bundler): importing modules with trailing slash no longer uses a builtin (#12632) 2024-07-17 17:17:00 -07:00
Ciro Spaciari
16aad326e4 fix(setSystemTime) fix number parameter behavior (#12630)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-17 17:09:24 -07:00
Jarred Sumner
1a6f2d38da Github actions 2024-07-17 03:31:12 -07:00
Jarred Sumner
c6149d36b3 Bump 2024-07-17 02:40:42 -07:00
Jarred Sumner
34e493f945 Experiment: disable -fPIC and relro (#12582)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-17 02:33:46 -07:00
dave caruso
866b301626 bundler: make import() calls visit the options object (#12617) 2024-07-16 23:21:34 -07:00
dave caruso
cabc0fa0e6 fix typescript namespace merging with functions and classes (#12610) 2024-07-16 19:39:27 -07:00
HibanaSama
d703354fcd docs: close details block (#12533) 2024-07-16 17:50:47 -07:00
Ciro Spaciari
37036f2eb0 fix(serve) fix abrupt close when downloading data (#12581)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-07-16 16:39:37 -07:00
190n
ff0dc62314 Accept undefined as explicit second argument for path.*.basename (#12609) 2024-07-16 16:37:21 -07:00
Ciro Spaciari
f05f13780e fix(CryptoHasher) check of .empty/null/undefined in update (#12607)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-07-16 16:33:35 -07:00
190n
4d74855fd7 Prevent unref from hanging on uninitialized dgram socket (#12585)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-16 16:31:07 -07:00
Jarred Sumner
5088a360b5 Avoid stale reference to Body.Value when erroring (#12579) 2024-07-16 12:33:19 -07:00
dave caruso
891b1907ae feat(bundler): implement non-isolated hashes (#12576) 2024-07-15 20:34:15 -07:00
dave caruso
ae988642fb fix .use_count integer underflow (#12584) 2024-07-15 18:36:42 -07:00
190n
75e442c170 Change .mjs to .mts during TypeScript module resolution (fixes #12471) (#12580) 2024-07-15 18:12:18 -07:00
Jarred Sumner
8808af1c99 Replace some Identifier::fromString usages with vm->propertyNames (#12575) 2024-07-15 16:15:56 -07:00
Jarred Sumner
b9d2a03ffc Make creating a BufferList (used in node:stream) slightly faster (#12577) 2024-07-15 16:15:10 -07:00
Jarred Sumner
157b56cca5 Update launch.json 2024-07-15 15:12:57 -07:00
Eric L. Goldstein
caaeae123a Add documentation for mock.restore() (#12553) 2024-07-14 21:20:33 -07:00
Ivan Baksheev
20235a0d22 Add packages option to remove all dependencies from bundle (#12562) 2024-07-14 15:20:27 -07:00
Dylan Conway
ae19489250 bump 2024-07-12 19:45:10 -07:00
Dylan Conway
242c48f302 bump 2024-07-12 19:42:18 -07:00
dave caruso
110849355c make the windows binary smaller (#12523)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-12 00:20:28 -07:00
Jarred Sumner
36fd3115f1 Try icf=safe (#12524) 2024-07-11 22:37:04 -07:00
Jarred Sumner
7d9b876968 Use armv8a+crc 2024-07-11 20:59:37 -07:00
Jarred Sumner
40f0da1254 Use armv8-a 2024-07-11 20:30:21 -07:00
Jarred Sumner
aea3964abd Set -march instead of -mcpu 2024-07-11 20:14:43 -07:00
Jarred Sumner
780bff781d Set the cpu model in the right place 2024-07-11 19:00:06 -07:00
Jarred Sumner
c6a2ab5165 Revert "Don't set mtune"
This reverts commit ef1c660708.
2024-07-11 18:58:24 -07:00
Jarred Sumner
ef1c660708 Don't set mtune 2024-07-11 18:40:52 -07:00
Ciro Spaciari
11f8d3cb24 fix(server) fix abrupt stop (#12472)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-07-11 18:22:23 -07:00
dave caruso
3ac9c3cc1c make bun static link the c redistributable (#12521)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-07-11 17:35:35 -07:00
Jarred Sumner
aa0f54cb93 Fixes #12076 (#12504) 2024-07-11 16:59:14 -07:00
huseeiin
8a3f882ef7 Update README.md (#12512) 2024-07-11 07:24:13 -07:00
Jarred Sumner
b7dd57ac32 Fix zig build error on Windows 2024-07-11 00:08:05 -07:00
Jarred Sumner
cf1c7772f3 See if .dSYM will upload (#12502) 2024-07-10 23:53:17 -07:00
Jarred Sumner
329d5e2af5 Disable this debug log 2024-07-10 23:25:55 -07:00
Jarred Sumner
0098678a1d Upload .dSYM file in CI 2024-07-10 23:04:06 -07:00
Jarred Sumner
bf4c2caa11 Bump 2024-07-10 22:48:28 -07:00
Jarred Sumner
226f42e04a Rewrite js_ast.NewBaseStore (#12388)
Co-authored-by: dave caruso <me@paperdave.net>
2024-07-10 21:57:40 -07:00
Ciro Spaciari
96d19fcfe2 fix(fetch.tls.test) make test more reliable (#12499) 2024-07-10 21:52:34 -07:00
Dylan Conway
58483426cd fix(install): call GetFinalPathNameByHandle on cwd for postinstall scripts (#12497) 2024-07-10 21:09:14 -07:00
Dylan Conway
25f7ef7338 Revert "Nest test results under describe scopes (#12189)"
This reverts commit 6a43f7f52d.
2024-07-10 21:05:47 -07:00
Jarred Sumner
412806bb22 Make expect().toThrow faster (#12494) 2024-07-10 20:46:29 -07:00
Ciro Spaciari
4c87406391 fix(ssl) fix ssl shutdown (#12492)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-10 20:29:54 -07:00
Dylan Conway
5f7b96b58f fix(install): optional peer dependency bugfix (#12485)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-07-10 20:04:32 -07:00
Jarred Sumner
f1151a84ad On Windows, fix fs.writeFile(1, fs.writeFile(2, fs.writeFile(\\nul (#12410)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-07-10 19:49:36 -07:00
Zack Radisic
cdc68a2237 .npmrc follow up (#12390)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-10 19:35:21 -07:00
Jarred Sumner
e866793eb3 Fix Windows assertion failures 2024-07-10 18:08:04 -07:00
Dylan Conway
cf9c418bcb revert 2024-07-10 17:22:16 -07:00
Jarred Sumner
138ef1328e webcrypto tests are slow 2024-07-10 17:18:39 -07:00
Dylan Conway
e5e6d7ca43 comma 2024-07-10 17:03:19 -07:00
Jarred Sumner
cb81fc5445 Make ${encoding}Slice & ${encoding}Write work on Uint8Array (#12491) 2024-07-10 16:58:01 -07:00
Dylan Conway
d8caf7f9fa install all at once 2024-07-10 16:48:40 -07:00
Dylan Conway
6f8ceb0ea9 windows: bump llvm to 18.1.8 (#12490) 2024-07-10 16:45:54 -07:00
dave caruso
02b589b2ce fix a crash in remapping stacks (#12477)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-10 16:39:05 -07:00
Jarred Sumner
55d59ebf1f Try disabling the vs2022 build tools workaround 2024-07-10 02:01:29 -07:00
Jarred Sumner
e1bc6c55d5 Speculative fix for crash in visitChildren in BufferList (#12427) 2024-07-10 01:44:52 -07:00
Dylan Conway
e42dede529 upgrade webkit (#12474)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-07-10 01:38:26 -07:00
arnab
73ef93ffa3 Fix spelling - following (#12479) 2024-07-09 23:35:06 -07:00
Derrick Farris
475f71a2a1 fix(jest): beforeEach, afterEach not called for test.todo (#12406) 2024-07-09 23:15:27 -07:00
Ciro Spaciari
af6035ce36 fix(server) wait for readFile on abort/process exit cases (#12441)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-09 22:38:32 -07:00
Jarred Sumner
bfa395d1d5 Warn when installing a global binary and global bin is not in path (#12454) 2024-07-09 22:32:56 -07:00
Jarred Sumner
76bb5b8619 Set __DARWIN_NON_CANCELABLE (#12354)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-09 17:48:31 -07:00
Imgodmaoyouknow
6354e608a7 chore(docs): fix wrongly written at binary-data.md (#12451) 2024-07-09 17:39:01 -07:00
Le Michel
28d9527189 Update cache.md (#12231) 2024-07-09 17:26:18 -07:00
Victor Homyakov
fbcd843c58 Make JSX in react-hello-world.node.jsx the same as others (#12259) 2024-07-09 17:25:54 -07:00
lmmfranco
6b0c2383d5 Adding proper bash quote escaping on install.sh (#5002)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-09 17:10:43 -07:00
silverwind
f1a748fcab Add -u alias to bun test (#10097)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-09 16:53:35 -07:00
Vladimir Pouzanov
87296405a7 Remove the case-insensitive bit from the docs. (#4858) 2024-07-09 16:47:48 -07:00
张新伟
4dfbabd590 chore(docs): add notes for ubuntu developers (#12296)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-09 16:31:26 -07:00
Jarred Sumner
ea1135a464 [bundows] Skip unnecessary GetFinalPathNameByHandle (#10338)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-09 16:21:13 -07:00
Dmitrii
f1755df6f0 docs: update drizzle-kit cli command in drizzle.md (#11666) 2024-07-09 16:18:42 -07:00
Bjön Limell
b01f67857f Added missing commands to bun.bash (#7181) 2024-07-09 16:15:34 -07:00
Nikola Ristić
9fe7ea340d Add a note about bun add --exact alias to docs (#6968) 2024-07-09 16:09:24 -07:00
Ivan Baksheev
68ba6b9e79 docs: sync Database.run docs with types (#9993) 2024-07-09 15:47:15 -07:00
patricio
a703d2d019 fix(docs): correct value for BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD (#9647) 2024-07-09 15:37:45 -07:00
dave caruso
5137213f86 heavy revision on heap_breakdown's safety (#12445) 2024-07-09 14:29:00 -07:00
Danny Lin
c98da7daf7 docs: Simplify Homebrew install command (#4595) 2024-07-09 13:32:30 -07:00
Jarred Sumner
25252c9b46 Use memmove in path handling code (#12413)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-09 11:22:54 -07:00
Imgodmaoyouknow
21ff566d69 chore(docs): fix wrongly written at binary-data.md (#12452) 2024-07-09 01:44:47 -07:00
Dylan Conway
a36a01e235 fix(--watch): ref or create new module specifier strings (#12442) 2024-07-08 19:55:21 -07:00
Jarred Sumner
9ae870546b On Windows, support Bun.stdin, Bun.stdout, Bun.stderr in Bun.write when the other argument is a file (#12411)
Co-authored-by: dave caruso <me@paperdave.net>
2024-07-08 18:03:48 -07:00
Jarred Sumner
a4b0817cd3 Print list of CPU features in crash reports (#12350)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-08 15:08:07 -07:00
Jarred Sumner
c2a5451e93 Fix argument validation with callbacks in node:fs (#12412) 2024-07-07 20:18:07 -07:00
Jarred Sumner
150ae032e8 Flip conditional 2024-07-07 09:47:30 -07:00
Jarred Sumner
37ee951448 Add unusable postgres client behind a canary-or-debug-only feature flag (#11920)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-07 09:43:48 -07:00
Jarred Sumner
b8c70ba6cf Deflake node-tls-connect test 2024-07-07 09:28:53 -07:00
Jarred Sumner
cbcf9506d9 Update CONTRIBUTING.md 2024-07-06 20:36:09 -07:00
Jarred Sumner
92bd629e60 Support promises in profile method in bun:jsc (#12165) 2024-07-06 20:24:21 -07:00
Jarred Sumner
e7031b07ae Fix memory leak in withFileTypes: true in fs.readdir (#12393) 2024-07-06 20:22:55 -07:00
Jarred Sumner
41a5ebe09f Fix memory leak in new Request(request) (#12387) 2024-07-05 22:11:09 -07:00
Jarred Sumner
cd97c21038 Handle OOM in btoa (#12353)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-05 22:02:07 -07:00
dave caruso
57d22908d1 fix(transpiler): Fix non-inlined nested namespaces (#12386) 2024-07-05 21:59:23 -07:00
dave caruso
749c51d71a simpler version of simplifyUnusedExpr rewrite (#12384) 2024-07-05 20:20:45 -07:00
Noah Friedman
80bbad6568 setup-bun action bumped to v2 in docs (#12315) 2024-07-05 18:54:53 -07:00
Jarred Sumner
da1b3d2007 Check that ccache points to a regular file instead of a non-empty string (#12382) 2024-07-05 18:33:00 -07:00
Andrew Johnston
050a4b5c71 fix(formdata): handle file names correctly when setting on formdata (#12379)
Co-authored-by: Andrew Johnston <andrew@bun.sh>
2024-07-05 18:29:12 -07:00
Jarred Sumner
6f52b649da Make debug log more useful 2024-07-05 17:28:48 -07:00
Zach Olivare
bbc621adff docs(argv): Correct cli file name (#12373) 2024-07-05 16:05:12 -07:00
Jarred Sumner
71c223e111 Handle EINTR in usockets (#12357)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-05 15:40:10 -07:00
Jarred Sumner
ee25618197 Use bun.ComptimeStringMap instead of std.StaticStringMap (#12351)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-04 23:05:51 -07:00
Vadzim
4f3ef07455 Fix crash on aborted timer (#12348) 2024-07-04 16:20:59 -07:00
Jarred Sumner
fad58168d2 Configure LTO on Windows (#12290) 2024-07-04 16:20:18 -07:00
Dylan Conway
4fefb8507c respect package.json indentation in bun install (#12328) 2024-07-03 23:10:34 -07:00
Jarred Sumner
39d5c8a8a5 Remove proto installation method from docs
We cannot recommend people install Bun using an installation method that makes Bun take 1 second to print the version number

https://github.com/oven-sh/bun/issues/12294
2024-07-03 20:55:18 -07:00
Jake Boone
6a43f7f52d Nest test results under describe scopes (#12189)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-07-03 20:46:55 -07:00
Jarred Sumner
c486a049a8 Implement buffer.resolveObjectURL (#12324) 2024-07-03 19:17:20 -07:00
Jarred Sumner
5a0b935231 Bump libarchive (#12314)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-03 11:56:17 -07:00
dave caruso
688ddbda74 feat(bundler): implement enum inlining / more constant folding (#12144)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-03 04:23:17 -07:00
Dylan Conway
b9fba61153 fix(install): patching in root package with workspaces (#12313)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-07-03 03:52:15 -07:00
Jarred Sumner
dfca8147df Bump WebKit submodule (#12310)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-03 03:08:11 -07:00
Umar Faruq Chowdhury
b85c30cd89 Remove unused details section (#12311) 2024-07-03 02:14:56 -07:00
Jarred Sumner
f83e42de20 GitHub actions 2024-07-03 01:46:46 -07:00
Jarred Sumner
927dde7b34 GitHub actions 2024-07-03 01:22:49 -07:00
Jarred Sumner
c85576b15d GitHub actions 2024-07-03 01:21:16 -07:00
Jarred Sumner
db60af1a44 GitHub actions 2024-07-03 01:14:52 -07:00
Jarred Sumner
292035efcb GitHub actions 2024-07-03 01:10:37 -07:00
Jarred Sumner
823d790b1c GitHub actions 2024-07-03 01:07:40 -07:00
Jarred Sumner
5573b2e899 Add comment when updating a submodule 2024-07-03 01:05:49 -07:00
Jarred Sumner
2f0789af7c Always set enable_logs in development 2024-07-01 23:38:03 -07:00
Jarred Sumner
f8e640c018 Remove callconv from a couple functions 2024-07-01 23:35:28 -07:00
Jarred Sumner
b0018465cc WebKit upgrade (#12246)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-07-01 23:27:59 -07:00
Justin Ho
dd057613b9 Update Buffer implementation status in nodejs-apis.md (#12274) 2024-07-01 22:08:09 -07:00
Zack Radisic
bf14a09a23 install: fix issues with patching hoisted dependencies in workspaces (#12141)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-07-01 17:44:18 -07:00
Filip Skokan
81711faebe fix: add Symbol.toStringTag to KeyObject instances (#12278) 2024-07-01 15:13:34 -07:00
Eric L. Goldstein
86fd13643b base64 decode the request body instead of encoding it a second time (#12219) 2024-07-01 11:59:33 -07:00
Zack Radisic
861be5560e Support reading from .npmrc (#11979)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-29 18:11:23 -07:00
Jarred Sumner
7f3e6f23f6 Refactor ZigString -> toJS (#12242) 2024-06-29 00:21:42 -07:00
Jarred Sumner
5f34387bea Fix crash in dns.lookup, ensure getaddrinfo() only returns IPv4-only or IPv6-only results when it should, normalize node:dns errors (#12223) 2024-06-28 18:45:10 -07:00
Zack Radisic
e22383dff9 fix bad test/snapshot in glob/scan.test.ts (#12239)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-28 18:39:53 -07:00
Dylan Conway
c1a5b4acc5 fix napi.test.ts (#12241)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-28 18:38:37 -07:00
Jarred Sumner
61b343cf7d GitHub actions 2024-06-28 18:01:29 -07:00
Jarred Sumner
ec3487867c Update build-windows.yml 2024-06-28 17:42:02 -07:00
Jarred Sumner
3c52344b53 Hardcode this 2024-06-28 17:40:23 -07:00
Jarred Sumner
f37d89afb1 Revert BuildKite for now 2024-06-28 17:38:27 -07:00
Jarred Sumner
a0b5006b78 Re-enable GitHub actions CI (#12240) 2024-06-28 17:31:38 -07:00
Jarred Sumner
1a10f2b46e Bump 2024-06-28 17:23:15 -07:00
Dylan Conway
acc0fe6db4 comment 2024-06-28 17:02:36 -07:00
Dylan Conway
6e89419250 fix(install): bugfix for tarball "overrides" (#12234) 2024-06-28 16:54:35 -07:00
Dylan Conway
d5aa7265df fix(install): bun pm trust with updated dependencies (#12215)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-28 16:51:06 -07:00
Ashcon Partovi
fe27a181d3 Increase macOS test parallelism to 3 [skip ci] 2024-06-28 11:05:43 -07:00
Ashcon Partovi
145b9e7d09 Skip no-lto builds on main branch [skip ci] 2024-06-28 10:24:41 -07:00
Ashcon Partovi
fab33be408 Fix release script 2024-06-28 09:56:55 -07:00
Dylan Conway
da27f22622 fix(install): install binaries for packages installed multiple times (#11886)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-06-28 03:24:39 -07:00
Kelvin Luck
20d33e480b Mark semver.order as this:void (#12224) 2024-06-28 02:59:14 -07:00
Ashcon Partovi
066e2f2589 Skip tests on main [no ci] 2024-06-27 16:33:17 -07:00
Per Karlsson
9697a2b058 docs: Update docker.md (#12197) 2024-06-27 16:24:56 -07:00
Isaiah Banks
b37f94d396 Fix typo in pm_trusted_command.zig (#12162) 2024-06-27 16:12:00 -07:00
Jake Boone
eff2ea6271 Fix "lines" and "functions" in coverage threshold guide (#12217) 2024-06-27 16:00:13 -07:00
Ashcon Partovi
d105b048b1 Use Buildkite for CI (#11477) 2024-06-27 14:56:07 -07:00
Ashcon Partovi
d356e27a4d Remove debug workflow
No longer needed
2024-06-26 23:54:51 -07:00
Ashcon Partovi
96e84b276b Add a debug workflow
Github actions only triggers the `status` event if the workflow is in the main branch. This can be removed later.
2024-06-26 18:38:56 -07:00
Jarred Sumner
60ef13e079 Fix assertion failure in Bun.escapeHTML with latin1 input (#12185) 2024-06-26 18:25:02 -07:00
Jarred Sumner
10ce5ddd24 Fixes #12188 2024-06-26 18:07:19 -07:00
Erik Dunteman
cab78045b7 Make console.log(someFunction) print AsyncFunction when appropriate (#12136)
Co-authored-by: Erik Dunteman <erik@MacBook-Pro.attlocal.net>
Co-authored-by: Erik Dunteman <erik@Eriks-MBP.attlocal.net>
2024-06-25 13:00:24 -07:00
Jarred Sumner
d5e3ea0ab7 Make node:v8 getHeapStatistics more plausible (#12139) 2024-06-25 00:17:51 -07:00
Dylan Conway
9f2533e24c update test 2024-06-24 22:45:36 -07:00
Jarred Sumner
bb66bba1bf Make PackageManifest.Serializer.readArray more careful (#12106) 2024-06-24 19:22:10 -07:00
Jarred Sumner
ccd92a98e5 Copy a42b74ae8139738a14148f94543c659ec2d5b92b from libxev (#12128) 2024-06-24 19:21:40 -07:00
Jarred Sumner
d191ec5933 Add OS version to crash report message (#12098) 2024-06-24 19:17:48 -07:00
Jarred Sumner
5f72f207de Make Lockfile.Buffers.readArray more careful (#12105) 2024-06-24 19:17:01 -07:00
Jarred Sumner
40858b4f25 Make reported node.js version a build option (#12104) 2024-06-24 15:34:28 -07:00
Jarred Sumner
de3ad9840b 5% faster fs.readdirSync for small directories on macOS (#12101) 2024-06-24 10:11:58 -03:00
Jarred Sumner
82c89bd8fc Fixes #12040 (#12072) 2024-06-23 17:38:35 -07:00
nmarks
314666d8ae Remove empty if statement in CMakeLists.txt (#12073) 2024-06-23 00:58:43 -07:00
Jarred Sumner
65df049fb4 Fixes #12070 (#12071) 2024-06-22 21:46:55 -07:00
Jarred Sumner
dfad48a6de Bump 2024-06-22 19:58:37 -07:00
Jarred Sumner
bf7b327f68 Fixes #12039 (#12066) 2024-06-22 17:40:45 -07:00
Jarred Sumner
a9e800ad5f Commit missing snapshot file 2024-06-22 15:31:29 -07:00
Jarred Sumner
1a8ec98fd0 Rename code coverage reporter for console -> text (#12054) 2024-06-22 14:46:40 -07:00
Ale Muñoz
484ce2ce60 Remove extraneous Bun.ArrayBufferSink mention. (#12065) 2024-06-22 14:46:22 -07:00
TATSUNO “Taz” Yasuhiro
4830e2d817 Implement initial LCOV reporter (no function names support) (#11883)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-22 02:03:19 -07:00
Jarred Sumner
ff2080da1e Fixes #12045 (#12051) 2024-06-21 22:45:28 -07:00
forcefieldsovereign
191a06207f Fix TS experimental decorator crash (#11902) 2024-06-21 21:58:08 -07:00
Dylan Conway
ff15281b49 fix(install): fix potential flakiness with git dependencies (#12030)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-06-21 21:34:23 -07:00
Zack Radisic
d563b6485a Use slow move-based fallback for renameatConcurrently (#12048)
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-21 20:41:22 -07:00
Dylan Conway
3b199cde59 remove glibc memfd_create from required symbols (#12050)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-06-21 19:02:27 -07:00
dave caruso
131d8f5c80 fix mock function crash (#12023)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-06-21 18:48:14 -07:00
Dylan Conway
3b6f1bb20e fix #4925 (#12049) 2024-06-21 18:45:05 -07:00
Kamaljot Singh
19bed6e05a [FIX]: Made the LICENCE a markdown file to be previewable and minor fixes in markdown syntax (#12025)
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-21 15:14:22 -07:00
Zack Radisic
00f9410d92 Fix bun patch with workspaces and scoped packages (#12022)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-06-21 14:16:14 -07:00
surprisedpika
36fbad3709 Fix minor spelling mistake in bun:test toThrowError() (#12043) 2024-06-21 12:23:47 -07:00
Eckhardt (Kaizen) Dreyer
087b83c56d fix(install): use ssh keys for private git repos (#11917)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-06-21 01:31:12 -07:00
Jarred Sumner
8c548d2593 Deflake weboscket.test.js 2024-06-20 18:34:41 -07:00
Jarred Sumner
2338f16b36 Fixes #12012 (#12020) 2024-06-20 18:10:40 -07:00
Jarred Sumner
eaa7858df4 Bump 2024-06-20 17:55:05 -07:00
dave caruso
21b5bdf8b5 fix: execArgv sometimes could include user args (#11987) 2024-06-20 16:14:54 -07:00
Jarred Sumner
864cbc1555 Fixes #301 (#11988)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-20 16:14:26 -07:00
Jarred Sumner
c082ec5c9d Fixes #1288 (#11991) 2024-06-20 16:14:14 -07:00
dave caruso
3908ac073b fix(transpiler): mark non-ascii TS enum keys as UTF-16 (#11994)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-06-20 16:14:03 -07:00
dave caruso
b76376f8a6 chore: upgrade zig to 0.13.0 (#9965)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Kenta Iwasaki <63115601+lithdew@users.noreply.github.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Dale Seo <5466341+DaleSeo@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-06-20 13:48:39 -07:00
dave caruso
e58cf69f94 feat(bundler): Add --sourcemap=linked for //# sourceMappingURL comments (#11983)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-20 13:46:49 -07:00
Dylan Conway
dd22c71612 fix(shell): handle cwd paths with non ascii characters (#11990)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-19 23:53:50 -07:00
Jarred Sumner
a0032d1b5c Replace libbase64 with simdutf (#11982) 2024-06-19 23:02:56 -07:00
dave caruso
ba6e421e3b log the error when file watcher fails to start (#11986) 2024-06-19 22:37:45 -07:00
Dylan Conway
b23ba1fe18 fix(install): allow unresolvable optionalDependencies (#11977) 2024-06-19 15:23:51 -07:00
Jarred Sumner
3ff29955a1 Use stderr instead of stdout in bun patch errors (#11966) 2024-06-19 00:52:42 -07:00
Jarred Sumner
6df1bd5ed8 Oops 2024-06-19 00:51:13 -07:00
github-actions[bot]
43a5530f76 Bump to 1.1.14 (#11965)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-19 00:34:53 -07:00
Jarred Sumner
33ca0921f2 Update patch.md 2024-06-18 22:13:21 -07:00
Jarred Sumner
995bd374d8 Update patch.md 2024-06-18 21:33:31 -07:00
Jarred Sumner
45f9ec70dd Update patch.md 2024-06-18 21:33:13 -07:00
Jarred Sumner
a994bda80a Update patch.md 2024-06-18 21:31:06 -07:00
Jarred Sumner
3003dcb58f Update patch docs 2024-06-18 21:30:53 -07:00
Zack Radisic
7c27f3f9b4 Patch (#11858)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
2024-06-18 16:34:10 -07:00
Jarred Sumner
604cbd0228 Add test for line and column property on Error instance (#11940) 2024-06-18 14:42:58 -07:00
huseeiin
85baa0f3c0 typo (#11957) 2024-06-18 13:39:20 -07:00
Ciro Spaciari
3a5077c622 fix(napi) napi_call_threadsafe_function should work with null data and napi_create_threadsafe_function should keep the process alive by default (#11952) 2024-06-18 13:38:04 -07:00
Jarred Sumner
3a17a2cb43 Update debugger.md 2024-06-17 23:41:32 -07:00
Jarred Sumner
52f2c22e3b Update debugger.md 2024-06-17 23:40:46 -07:00
Jarred Sumner
623b73171c Update debugger.md 2024-06-17 23:34:40 -07:00
Jarred Sumner
bf45791ae6 Update debugger.md 2024-06-17 23:31:21 -07:00
Jarred Sumner
7b9fe84cbd Update debugger.md 2024-06-17 23:30:34 -07:00
Jarred Sumner
0189dbb1b5 Update debugger.md 2024-06-17 23:29:02 -07:00
Jarred Sumner
3493dc634e Update debugger.md 2024-06-17 23:28:27 -07:00
Jarred Sumner
709b485294 Update debugger.md 2024-06-17 23:26:52 -07:00
Jarred Sumner
43733069bb Add more docs on debugging 2024-06-17 23:17:04 -07:00
Zayd Krunz
9621721e3d Change "what's new" link to bun blog instead of release page (#11909)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-17 21:28:58 -07:00
Jarred Sumner
b07e15ac29 Add needs repro label comment 2024-06-17 20:23:36 -07:00
Zack Radisic
a09e633b6f shell: Fix memory leak, lazily create ShellInterpreter object (#11830)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-17 20:08:00 -07:00
Jarred Sumner
c12baa3485 GitHub actions 2024-06-17 20:03:40 -07:00
Jarred Sumner
24182a4de0 Bump version on release 2024-06-17 20:03:40 -07:00
github-actions[bot]
30ae61fb03 Bump to 1.1.13 (#11935)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-17 19:58:29 -07:00
Jarred Sumner
478e2558e4 GitHub actions 2024-06-17 19:54:47 -07:00
Jarred Sumner
9dc36adf83 GitHub actions 2024-06-17 19:53:30 -07:00
Jarred Sumner
748209f79b GitHub actions 2024-06-17 19:51:03 -07:00
Dylan Conway
8b4ec84fb1 fix(install): use correct lockfile when printing install summary (#11930) 2024-06-17 19:30:16 -07:00
Jarred Sumner
f5b0951191 Github actions 2024-06-17 18:14:13 -07:00
Jarred Sumner
fc0335b987 Github actions 2024-06-17 18:10:44 -07:00
Jarred Sumner
4ea31d474f Github actions 2024-06-17 18:07:55 -07:00
Jarred Sumner
46610c7254 Update labeled.yml 2024-06-17 17:56:27 -07:00
Jarred Sumner
31cffe4ec0 Github actions 2024-06-17 17:54:37 -07:00
Jarred Sumner
bafaa9e80e Use commas instead of newlines as the delimiter 2024-06-17 17:46:54 -07:00
Jarred Sumner
a4aa146a2a Comment if crash report is on outdated version of Bun 2024-06-17 17:35:01 -07:00
dave caruso
ae656e8a4c fix(windows): dont call SetConsoleMode on stdin (#11927) 2024-06-17 15:11:01 -07:00
Ciro Spaciari
422c17d76c fix(http) mark completed true (#11926) 2024-06-17 15:09:20 -07:00
Jarred Sumner
8eabade199 Update sqlite.md 2024-06-17 13:55:09 -07:00
Jarred Sumner
72d925152c Update sqlite.md 2024-06-17 06:59:44 -07:00
Jarred Sumner
537c62396d Update sqlite.md 2024-06-17 06:52:51 -07:00
Jarred Sumner
77192072c8 [bun:sqlite] Support unprefixed bindings, safe integers / BigInt, as(Class) (#11887) 2024-06-16 23:44:07 -07:00
Dylan Conway
fa952b163c fix(install): tarball extracting bugfix (#11864)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-15 00:22:16 -07:00
Dylan Conway
eedb3e530c fix(install): handle transitive folder dependencies (#10445)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-15 00:08:40 -07:00
Jarred Sumner
fcfc68a43e Update labeled.yml 2024-06-14 15:06:26 -07:00
Jarred Sumner
1224540c89 Update labeled.yml 2024-06-14 15:02:26 -07:00
Jarred Sumner
5ef5dbe764 Update labeled.yml 2024-06-14 15:00:55 -07:00
Jarred Sumner
ac8d1726b6 Update labeled.yml 2024-06-14 14:57:59 -07:00
Jarred Sumner
18ec3a2190 Update labeled.yml 2024-06-14 14:54:33 -07:00
Jarred Sumner
bcc2289ddb Add platform label 2024-06-14 14:52:20 -07:00
Ciro Spaciari
48cefe14bd fix(WebSocket) don't touch casing on custom headers and don't use lowercased versions of well know headers (#11855) 2024-06-14 11:36:33 -07:00
Jarred Sumner
1454e9a0a6 Don't wait for both connections to fail before starting the next one (#11859) 2024-06-14 11:36:18 -07:00
Jarred Sumner
22be784714 Print like curl (#11865) 2024-06-14 01:57:20 -07:00
Jarred Sumner
ae5b1280e1 Fixes #11866 (#11867) 2024-06-14 01:50:36 -07:00
Dylan Conway
e9d1e7ac5e fix(install): return non-zero exit code when tarballs fail to download (#11828) 2024-06-14 01:15:53 -07:00
Jarred Sumner
baee597054 Bump! 2024-06-13 18:11:06 -07:00
Dylan Conway
9ad75c6b3a fix(install): possible sentinel mismatch when reading workspaces (#11856) 2024-06-13 16:54:04 -07:00
Ciro Spaciari
2f7cd38d81 fix(SSL) Fix clients write retry (#11849) 2024-06-13 13:00:24 -07:00
Ciro Spaciari
b8ca523bfb fix(Blob/stream) blob from fetch now reliable returns type, blob name can be set (#11815) 2024-06-13 12:55:41 -07:00
Grigory
3568702eca chore(test/bunx): remove duplicate check (#11837) 2024-06-13 04:31:33 -07:00
Jarred Sumner
c44d489ed0 Support NODE_TLS_REJECT_UNAUTHORIZED=0 at runtime and implement BUN_CONFIG_VERBOSE_FETCH (#11833) 2024-06-13 04:30:15 -07:00
Jarred Sumner
6c55ff6008 Fixes #11747 (#11829) 2024-06-12 19:59:53 -07:00
Meghan Denny
ba5dd63eb6 allow node:fs.promises.{read,write,append}File to accept a FileHandle (#11800) 2024-06-12 18:26:15 -07:00
oscar
0a99416764 docs: Fix hyperlink (#11827) 2024-06-12 17:41:19 -07:00
Grigory
49516c8d40 fix(bun_shim_impl): pass env to CreateProcessW (#11817)
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-12 16:50:57 -07:00
Diogo
fab96a74ea Add the 5 new bun:test matchers to writing.md docs (#11803) 2024-06-12 09:08:06 -07:00
Dylan Conway
bd6a605120 fix(install): ensure capacity of preinstall_state before cleaning lockfile (#11792)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-11 14:56:21 -07:00
dave caruso
6e0f58bc05 fix(ci): make it so ci doesnt overwrite the release builds with canary's debug symbols (#11769)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-11 13:35:29 -07:00
Ciro Spaciari
6ff074ae27 followup on PR #11788 organize test imports and assert (#11791)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-06-11 13:31:47 -07:00
Jarred Sumner
dc144f9519 In AbortSignal, use Ref explicitly to ensure its alive (#11790) 2024-06-11 13:31:33 -07:00
Ciro Spaciari
7c8701c96e fix(WebSocket) fix ref count so finalize is called (#11788) 2024-06-11 11:49:12 -07:00
Ciro Spaciari
27d0912f9d fix(AbortSignal.any) fire dependents signals (#11789) 2024-06-11 11:42:48 -07:00
Ludvig Hozman
ee30e8660c feat(https/fetch): Support custom ca/cert/key in fetch (#11322)
Co-authored-by: Liz3 (Yann HN) <accs@liz3.net>
2024-06-11 10:36:32 -03:00
Jarred Sumner
1b8a72e724 Fixes #11703 (#11776) 2024-06-11 03:52:40 -07:00
Nacho Martín
7f8143c5c9 Fix broken link in debugging docs (debugger.md) (#11774) 2024-06-11 02:24:48 -07:00
Dylan Conway
791ba794e8 add BUN_FEATURE_FLAG_LAST_MODIFIED_PRETEND_304 (#11767) 2024-06-10 20:58:02 -07:00
Jarred Sumner
5427646a30 Update .gitignore 2024-06-10 20:52:30 -07:00
Dylan Conway
5e619ee337 fix(install): manifest parsing and peer dependency bugfix (#11763)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-10 20:29:16 -07:00
Dylan Conway
6e6c10bc1f Remove duplicated code for binding for Object.values (#11765)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-10 19:36:27 -07:00
Dylan Conway
5b48bb1d5d Fix cloning File with structuredClone (#11766)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-10 19:35:09 -07:00
Jarred Sumner
b521b06147 Speculative fix for #11742 (#11743) 2024-06-10 19:00:45 -07:00
Jarred Sumner
c451ef5f31 Avoid passing nullptr to memcpy 2024-06-10 18:04:49 -07:00
Jarred Sumner
99b9be7a34 Sentinel-terminate file contents (#11738) 2024-06-09 19:37:57 -07:00
Jarred Sumner
4786c6139e Clean up some expect() matchers (#11721) 2024-06-09 03:42:36 -07:00
Jarred Sumner
72a33e487d Deflake bunx.test on Windows 2024-06-09 00:28:05 -07:00
Jarred Sumner
25a09d8858 Disable bun patch in release builds until #11719 is fixed
cc @zackradisic
2024-06-08 23:08:00 -07:00
Jarred Sumner
731a85f80d Prevent extremely unlikely division by zero 2024-06-08 23:08:00 -07:00
Jarred Sumner
c5010e9a12 Deflake child_process test 2024-06-08 23:08:00 -07:00
Ciro Spaciari
1ba57351b0 fix(Bun.serve) fix mimetype with utf16 (#11695)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-08 22:34:06 -07:00
Jarred Sumner
ccb76c20e9 Fixes #11677 (#11698)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-08 22:05:41 -07:00
Ciro Spaciari
376c02e62c fix(Bun.serve) fix async upgrade using custom protocols (#11707) 2024-06-08 21:21:49 -07:00
Nithin K Joy
80e4e60e57 feat: Implemented some jest-extended methods (#9741)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-06-08 20:59:43 -07:00
Dylan Conway
61cb11dc2f remove sourceMap property 2024-06-08 15:50:33 -07:00
Ciro Spaciari
5df1c2689e fix napi ref/unref (#11690)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-08 14:39:23 -07:00
Ciro Spaciari
60af985863 fix(fs.watchFile) (#11669) 2024-06-07 22:54:10 -07:00
Ciro Spaciari
8ac8e4dc5f fix(fs:watch) fix missing char in filename (#11693)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-06-07 22:46:35 -07:00
Dylan Conway
d92ebf2a99 Fix windows build (#11689) 2024-06-07 22:24:34 -07:00
Meghan Denny
26201671d1 meta: update zig download url (#11692) 2024-06-07 19:13:59 -07:00
Jarred Sumner
1dcd1bba3d Revert "fix(fs:watch) fix missing char in filename" (#11691) 2024-06-07 17:34:20 -07:00
Ciro Spaciari
0bbef7eb94 fix(fs:watch) fix missing char in filename (#11686) 2024-06-07 17:33:59 -07:00
Ciro Spaciari
386bc212b1 update root certs (#11675) 2024-06-07 04:19:19 -07:00
dave caruso
2e44ee019a Fix crash when throwing an exception in setTimeout (#11670) 2024-06-06 22:15:27 -07:00
Dylan Conway
5b09384f01 add memrchr to strings.lastIndexOfChar on linux (#11671) 2024-06-06 22:01:28 -07:00
dave caruso
2cba070756 fix(bundler): Do not emit useless constructor (#11668) 2024-06-06 19:02:06 -07:00
Meghan Denny
c6187e3e3a correct node:crypto.randomInt behavior and accept a callback (#11505)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-06 18:24:26 -07:00
Zack Radisic
c85dd4e3bf feat: bun patch (#11470)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-06 17:48:05 -07:00
Dylan Conway
12f070d1a0 fix #11649 (#11659) 2024-06-06 17:26:39 -07:00
Dylan Conway
10608ea7d8 fix(bun:test): deepEquals undefined properties bugfix (#11661) 2024-06-06 17:01:45 -07:00
Dylan Conway
8d6f19516f root lifecycle scripts inherit stdin (#11647)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-06-06 05:10:43 -07:00
Dylan Conway
f3118d0f22 fix(install): git dependencies without package.json or a name (#11644) 2024-06-06 04:38:47 -07:00
Zack Radisic
7ac8ff6d8a shell: Fix #11554 and #11561 (#11574) 2024-06-06 03:42:52 -07:00
Dylan Conway
456aa1fc00 Worker and websocket close fix (#11635) 2024-06-06 03:25:36 -07:00
Dylan Conway
af95bfc7b1 Write registry hash and length before data in manifest cache (#11632) 2024-06-05 22:14:41 -07:00
Dylan Conway
c614d5b1da fix(install): aliased workspace without version in package.json (#11630) 2024-06-05 22:04:57 -07:00
Jarred Sumner
6fd47d6846 Improve the error message when Bun.serve() is passed a non-Response object (#11562)
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-05 20:35:47 -07:00
Jarred Sumner
6a756bf979 Implement blob: URLs in fetch, import, and Worker (#11537)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-05 18:49:03 -07:00
Jarred Sumner
bab8c0c0b2 fix(windows): handle invalid utf16le in command line arguments (#11612) 2024-06-05 18:48:08 -07:00
Dylan Conway
3e4c0918a4 fix(install): invalidate manifest cache on registry change (#11606) 2024-06-05 18:44:36 -07:00
Jarred Sumner
fe7b04085a Implement expect(value, customMessage?: string) (#11624)
Co-authored-by: dave caruso <me@paperdave.net>
2024-06-05 18:35:56 -07:00
MARCROCK22
e5ff1fdc25 fix: wrong help menu package names (#11611) 2024-06-05 18:31:26 -07:00
Dylan Conway
ac5f2e96c7 fix bun create test should create template from local folder (#11503) 2024-06-05 18:29:46 -07:00
Sushant Mishra
e76d212f18 fix: create_command telling to 'cd' when it should be omitted or cd . (#11567) 2024-06-05 13:30:22 -07:00
Jarred Sumner
c7a08f1ec5 Fixes #7263 (#11585) 2024-06-05 03:15:36 -07:00
dave caruso
bb8c0d97ba Fix runtime stack trace computation (#11581)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-06-05 00:26:03 -07:00
Jarred Sumner
2580d199a4 fix some worker-related stability issues (#11494) 2024-06-04 23:29:21 -07:00
Jarred Sumner
0184097ba0 See if ReferenceError works (#11595) 2024-06-04 17:17:02 -07:00
Jarred Sumner
dc5023e26e Fix possible leak in fetch when checkServerIdentity is used (#11580) 2024-06-04 19:52:26 -03:00
Ashcon Partovi
29234f3ecb Use needs triage labels 2024-06-04 14:29:14 -07:00
Jarred Sumner
10a60b5d91 Update 7-install-crash-report.yml 2024-06-04 00:37:32 -07:00
Jarred Sumner
75209021c8 Update 7-install-crash-report.yml 2024-06-04 00:36:48 -07:00
Jarred Sumner
42d5a4e506 Issue template 2024-06-04 00:36:03 -07:00
Jarred Sumner
57fa0dcee4 Update 6-crash-report.yml 2024-06-04 00:32:31 -07:00
Jarred Sumner
2e263db3da Update 7-install-crash-report.yml 2024-06-04 00:31:23 -07:00
Jarred Sumner
d6fedd1d9d Issue template update 2024-06-04 00:30:42 -07:00
Dylan Conway
347dc264ac fix(install): bun update keeps pinned versions (#11575) 2024-06-03 20:13:25 -07:00
Jarred Sumner
16d08564e1 Fix speculative race in fetch (#11579) 2024-06-03 19:15:31 -07:00
Dylan Conway
f56e6c7d54 fix(install): semver mistaking . as the beginning of pre/build tags (#11577) 2024-06-03 16:50:21 -07:00
Jarred Sumner
8806bf9c4e Update process.versions (#11558)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-06-03 03:02:51 -07:00
Jarred Sumner
656ad7c7ae Fix port exhaustion issue (#11512) 2024-06-03 02:16:58 -07:00
Jarred Sumner
4b3c873ca7 Auto-update the generated versions list on commit 2024-06-03 01:54:37 -07:00
Jarred Sumner
30a9c394e8 Update libarchive (#11533) 2024-06-03 01:07:37 -07:00
Jarred Sumner
ff905ba5f5 Backport parts of d0250818dd (#11555) 2024-06-03 01:07:10 -07:00
Dylan Conway
c2eef9eded fix(install): manifest package name mismatch (#11549) 2024-06-02 22:56:57 -07:00
Ciro Spaciari
1d89c5988e refactor OOM errors (#11540) 2024-06-02 22:56:26 -07:00
Timo Sand
eb31675af9 Fix typo in ENV variable name (#11541) 2024-06-02 21:08:05 -07:00
Dylan Conway
c65a911a57 fix(install): lockfile printing bugfix (#11545) 2024-06-02 18:49:07 -07:00
Dylan Conway
8f5fbd50cd fix(install): bun update with unresolved package (#11547) 2024-06-02 18:16:59 -07:00
Jarred Sumner
a1c3ea0b33 Update pm.md 2024-06-02 04:09:02 -07:00
Jarred Sumner
7fb25acf5f Update zstd (#11534) 2024-06-02 03:10:47 -07:00
Jarred Sumner
9523ea3aea Update mimalloc (#11532) 2024-06-02 01:19:54 -07:00
Jarred Sumner
c717f52459 Update nodejs-apis.md 2024-06-01 19:29:32 -07:00
Jarred Sumner
d38890d30c Update nodejs-apis.md 2024-06-01 19:29:07 -07:00
Jarred Sumner
814b48116a Update nodejs-apis.md 2024-06-01 19:28:53 -07:00
Jarred Sumner
152a7e1bd3 Update nodejs-apis.md 2024-06-01 19:28:07 -07:00
Jarred Sumner
b10887c7cb Update nodejs-apis.md 2024-06-01 19:25:33 -07:00
Jarred Sumner
43f0913c38 Bump 2024-06-01 02:34:36 -07:00
Jarred Sumner
6ca5896e86 Revert "feat: 🎨 Show better bun upgrade progress" (#11515) 2024-06-01 02:34:12 -07:00
dave caruso
784022785d revert the last commit
we were testing if we could disable push-to-main permissions
i should probably just stop committing to main
2024-06-01 01:39:55 -07:00
dave caruso
bc64e6b8e5 hi 2024-06-01 01:39:08 -07:00
dave caruso
9dd22f0d8d fix submodules 2024-06-01 01:35:40 -07:00
dave caruso
00472fbb1c fix release script 2024-06-01 01:29:11 -07:00
Jarred Sumner
4fb6056f85 Update CMakeLists.txt 2024-06-01 00:20:34 -07:00
Jarred Sumner
30b0b49594 Deflake large_asset_regression test 2024-06-01 00:20:34 -07:00
dave caruso
18bba0dc44 revert sourcemap-related logging change (#11510) 2024-05-31 23:26:43 -07:00
dave caruso
0a5fa2dd8c fix sourcemap printing with multiple chunks sharing the same file (#11509) 2024-05-31 23:10:02 -07:00
Ashcon Partovi
3a63f46dc0 Docs for bun update --latest 2024-05-31 18:35:53 -07:00
Ciro Spaciari
e3b7635fa4 fix(Bun.Socket) onDrain will only be called after handshake + docs update (#11499)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-31 18:33:06 -07:00
Dylan Conway
dc051ae810 Revert "fix windows todo"
This reverts commit ec09e6e238.
2024-05-31 17:44:35 -07:00
Dylan Conway
ec09e6e238 fix windows todo 2024-05-31 17:44:13 -07:00
Georgijs
d9f7d053d5 fix peer hoisting (#11473)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-31 17:12:33 -07:00
Jarred Sumner
fd55cdae34 Try deflaking child process test again (#11496) 2024-05-31 04:17:59 -07:00
Jarred Sumner
75b64d9b8e Deflake child_process test (#11495) 2024-05-31 02:21:51 -07:00
dave caruso
c467fd9381 fix high cpu usage when using bun.build (#11455) 2024-05-31 00:05:33 -07:00
refi64
f127dbd127 Restore support for dynamic function names in tracebacks (#11475)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-31 00:04:28 -07:00
Dylan Conway
774d6a1efb fix potential integer overflow (#11491) 2024-05-31 00:03:57 -07:00
Jarred Sumner
a6d0e64196 Attempt to deflake bun-create.test 2024-05-30 23:41:51 -07:00
Jarred Sumner
c3142e1ae0 Hopefully deflake bun create tests 2024-05-30 21:12:06 -07:00
Jarred Sumner
9693fc9183 Deflake child process test (#11488) 2024-05-30 21:05:57 -07:00
Jarred Sumner
61805b5344 Try fast timer then fallback to slow timer (#11486) 2024-05-30 20:16:21 -07:00
Toby Cm
8de0ec598b feat: Show better bun upgrade progress (#11402)
Co-authored-by: dave caruso <me@paperdave.net>
2024-05-30 17:47:48 -07:00
Jarred Sumner
fca20f1a43 Make sure this is set 2024-05-30 17:32:55 -07:00
Jarred Sumner
323011980c Add fuzzer-like test of methods (#11436)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-05-30 15:12:29 -07:00
Parmar Jai Atul
b49853c24f Fix an ambiguous redirect in bun bash-completions (#11468) 2024-05-30 15:11:12 -07:00
Ashcon Partovi
f0bcc631d5 Undo commits meant for another branch 2024-05-30 14:43:44 -07:00
Ashcon Partovi
ce20abef5c Remove extra commit diff 2024-05-30 14:41:10 -07:00
Ashcon Partovi
ecfe2a0f1b Fix supruious sccache errors 2024-05-30 14:41:10 -07:00
Georgijs
6a7c35cb52 Fix crash with multiple Bun.stderr.text() calls (#11472) 2024-05-30 14:18:32 -07:00
Dylan Conway
8461a20d9b update output (#11474) 2024-05-30 14:17:23 -07:00
Ashcon Partovi
ff9ab489b0 sharding tests 2024-05-30 14:16:09 -07:00
Ciro Spaciari
55c5ed3d3e fix(tests) update http2 cert in tests (#11462) 2024-05-30 13:24:27 -07:00
Ciro Spaciari
a8fcb48609 fix(test) handle connect errors on node-tls-context (#11463) 2024-05-30 13:24:08 -07:00
Dylan Conway
4b8f89cb73 Allow bun update to edit package.json (#11340)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-30 02:14:01 -07:00
Jarred Sumner
45d0c1432b rewrite timers for setTimeout, setInterval, setImmediate (#11419)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-30 02:11:12 -07:00
Dylan Conway
922f9191b0 fix(install): re-link workspaces if necessary (#11457) 2024-05-30 01:40:28 -07:00
Meghan Denny
c456622161 node:fs/promises.cp should make path if dest does not exist (#11433) 2024-05-30 01:15:20 -07:00
janos-r
b2c697296e Fix bun.fish completions (#11450) 2024-05-29 16:59:13 -07:00
Meghan Denny
2285735abd node:zlib: allow passing brotli params in encode+decode options (#11429) 2024-05-29 00:51:00 -07:00
Meghan Denny
7f1880cafb Bun.CryptoHasher: fix byteLength and add test (#11431) 2024-05-29 00:13:02 -07:00
dave caruso
1f8c121652 increase test timeout time for sourcemap tests (#11432) 2024-05-29 00:11:54 -07:00
Georgijs
370db08891 Replace Streams.Readable with a JS implementation (#11332)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-28 18:49:59 -07:00
Jarred Sumner
62b4c2141b Bump WebKit 2024-05-28 18:11:31 -07:00
Jarred Sumner
5f55d45d3b [internal] Fix showing source mappings for WebKit code in debugger 2024-05-28 18:09:43 -07:00
Jarred Sumner
4d03105614 Make dns tests use promises instead of done (#11347)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-05-28 17:30:52 -07:00
Meghan Denny
367b69dff5 bindings: fix createTypeError and createRangeError inheritance (#11341) 2024-05-28 16:54:08 -07:00
dave caruso
96f29e8555 fix(bundler): some sourcemap generation bugs (#11344)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Meghan Denny <meghan@bun.sh>
Co-authored-by: nektro <nektro@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Le Michel <95184938+Ptitet@users.noreply.github.com>
Co-authored-by: Дмитрий Заводской <zawodskoj2@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: HUMORCE <humorce@outlook.com>
Co-authored-by: huseeiin <122984423+huseeiin@users.noreply.github.com>
2024-05-28 16:51:35 -07:00
Jarred Sumner
634cc82dd0 Fix guide 2024-05-28 15:49:18 -07:00
Abhijeet Prasad
474d4cf3ce docs: Add Sentry guide (#11276) 2024-05-28 15:14:34 -07:00
Jonny Burger
15603ab596 Lift http.createServer maxRequestBodySize (#11426) 2024-05-28 15:13:46 -07:00
Jarred Sumner
1041655ff6 Implement addAbortListener and getMaxListeners in node:events (#11392) 2024-05-28 15:13:27 -07:00
huseeiin
912bccb624 Update import-html.md (#11417) 2024-05-28 04:16:00 -07:00
Jarred Sumner
3d11e5042e Use calloc when allocating loop on Windows (#11409) 2024-05-27 19:20:54 -07:00
Jarred Sumner
34b02ada14 Move Timer into a separate file (#11408) 2024-05-27 16:40:34 -07:00
Jarred Sumner
ad5340d971 Deflake serve-body-leak.test 2024-05-27 15:37:40 -07:00
Dylan Conway
06231b51bd fix(node:path): toNamespacedPath bugfix (#11406) 2024-05-27 15:36:54 -07:00
Le Michel
856654a065 Added forgotten dot in utils.md (#11362) 2024-05-27 09:08:01 -07:00
Dylan Conway
d43922d3e1 follow up for #11387 (#11393) 2024-05-27 03:57:39 -07:00
Jarred Sumner
98b3aeb9ec Update nodejs-apis.md 2024-05-27 02:28:24 -07:00
HUMORCE
cfedd70110 docs: Correct command line of package upgrading with Scoop (#11391) 2024-05-27 02:18:57 -07:00
Dylan Conway
470e523c52 fix(install): semver tag parsing bugfix (#11387) 2024-05-27 02:17:43 -07:00
Jarred Sumner
e1eb4a4753 Improve unhandled error reporting in bun:test (#11386) 2024-05-27 01:55:33 -07:00
Дмитрий Заводской
ad5574b86f Run deinit() on CallbackJob regardless of result type (#11379)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-26 20:02:32 -07:00
Le Michel
ec8e5d7cd3 Fixed typo in context.md (#11373) 2024-05-26 16:22:38 -07:00
Jarred Sumner
af4e844b62 Deflake test 2024-05-26 04:15:39 -07:00
Jarred Sumner
fdbccef110 Speed up a couple tests (#11369) 2024-05-26 04:09:28 -07:00
Le Michel
4539d168b4 Removed ambiguous quotes in utils.md (#11363) 2024-05-26 02:39:04 -07:00
Jarred Sumner
c50e837f34 Fix kqueue event handling code (#11364) 2024-05-26 02:24:41 -07:00
Jarred Sumner
99b979e5ca Remove std.debug.print
@paperdave you left this
2024-05-25 23:22:29 -07:00
dave caruso
7be0669840 fix(bundler): more windows backslash stuff (#11333)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-25 21:52:59 -07:00
Jarred Sumner
59bbedf251 Update c-ares (#11361) 2024-05-25 21:36:19 -07:00
Meghan Denny
aa3aa888d5 ci: windows: fix dns.getServers test (#11309)
Co-authored-by: nektro <nektro@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-25 01:43:13 -07:00
Jarred Sumner
c689b2b265 Speculative crash fix (#11337) 2024-05-24 18:29:50 -07:00
Jarred Sumner
5102a94430 Fixes #11297 (#11331) 2024-05-24 14:44:14 -07:00
Georgijs
5f7282fea3 Fire listeners that are removed during their event (#11329)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-24 14:07:03 -07:00
Dylan Conway
6c9b3de217 add jest.setTimeout type 2024-05-24 02:15:26 -07:00
Jarred Sumner
d16c136e77 Fix linkat with O_TMPFILE on Ubuntu/non-privileged users 2024-05-24 01:10:28 -07:00
Dylan Conway
df83028546 fix(install): npm lockfile migration bugfix (#11311) 2024-05-24 00:19:56 -07:00
dave caruso
3d99c9af24 fix(bundler): unify code + codeWithSourceMapShifts (#11315) 2024-05-23 23:32:28 -07:00
dave caruso
ec082db67c fix: fix sourcemap generation (rewrites bun.StringJoiner) (#11288) 2024-05-23 23:30:11 -07:00
Jarred Sumner
230c760b42 Fix formatting in guide 2024-05-23 22:25:06 -07:00
Dylan Conway
d3fdb17321 add jest.setTimeout to bun test (#10687)
Co-authored-by: dylan-conway <dylan-conway@users.noreply.github.com>
2024-05-23 20:24:54 -07:00
dave caruso
c3157e2c50 fix(windows spawn): use Job Object to manage subprocesses of subprocesses (#11240)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-23 19:59:39 -07:00
Dylan Conway
d1ac51e442 fix bun-install-windowsshim.test.ts (#11258) 2024-05-23 19:55:53 -07:00
Jarred Sumner
0905e43049 Test gardening (#11285) 2024-05-23 19:54:36 -07:00
Jarred Sumner
0b821c6e25 Save to package manifest cache async, only check disk once (#11304)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-05-23 19:54:18 -07:00
Meghan Denny
f339e51d84 ci: windows: skip bunshell stacktrace test (#11306) 2024-05-23 19:43:44 -07:00
Georgijs
2528caa598 fix out of bounds error for bun install (#11308)
Co-authored-by: Georgijs Vilums <=>
2024-05-23 17:54:12 -07:00
Jarred Sumner
260366f1a6 ~2x faster uncached bun install on Windows (#11293) 2024-05-23 15:02:12 -07:00
Meghan Denny
bdc65d0f87 fix spawn-kill-signal.test.ts (#11290) 2024-05-23 12:53:22 -07:00
Georgijs
6566b8a6d6 limit concurrent connection count for happy eyeballs (#11282)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-23 00:05:03 -07:00
Jarred Sumner
d06498bc96 Deflake serve-body-leak test 2024-05-22 19:22:22 -07:00
dave caruso
aff93ba9df crash_handler: add note if this crash is from canary (#11281)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-22 18:31:06 -07:00
Georgijs
d50acbc0bd Fix refConcurrent and unrefConcurrent (#11280)
Co-authored-by: Georgijs Vilums <=>
2024-05-22 16:57:05 -07:00
Jarred Sumner
12bb5d03a2 Always propagate error in EventEmitter (#11210)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-05-22 16:39:42 -07:00
Grigory
942061a40a docs(building-windows): add info about winget (#11204)
Co-authored-by: dave caruso <me@paperdave.net>
2024-05-22 15:46:16 -07:00
Ciro Spaciari
096cfeebc0 fix(fetch) allow Response to be GC'd before all the request body is received (#10933)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-05-22 15:42:30 -07:00
dave caruso
f3e974102d ci: upload extra data for crash handler 2024-05-22 14:05:42 -07:00
Georgijs
81cebc789a Fix workers on windows taking a long time to exit (#11271) 2024-05-22 14:04:50 -07:00
Eigil Sagafos
ce8474b2a1 Update http2 NotImplementedErrors to report issue 8823 (#11277) 2024-05-22 14:03:43 -07:00
jess-render
cd5a97b383 docs: Add guide for deploying a Bun app to Render (#11248)
Co-authored-by: Jess Lin <jesslin@JesssMBPRender.home>
Co-authored-by: Jess Lin <jesslin@new-host-6.home>
2024-05-22 10:37:27 -07:00
Meghan Denny
9399b70138 ci: make bun-install-registry.test.ts less flaky on windows (#11253) 2024-05-21 23:14:10 -07:00
Meghan Denny
d4b3f16388 ci: skip next-pages/dev-server on windows (#11256) 2024-05-21 23:12:24 -07:00
Dylan Conway
cc0bce62e3 fix(install): adding packages in subdirectories of workspaces (#11254) 2024-05-21 22:46:26 -07:00
Meghan Denny
87cbaae4f0 meta: ci: dont linkify list of failing files (#11257) 2024-05-21 22:07:37 -07:00
Jarred Sumner
6e6cfcd839 Bump + crash reporter uploading 2024-05-21 21:54:53 -07:00
Meghan Denny
e5de03b8eb replace [bun.MAX_PATH_BYTES + 1]u8 with bun.PathBuffer (#11163) 2024-05-21 20:53:34 -07:00
マルコメ
0d76c416ed docs: update jest compatibility (#11247) 2024-05-21 19:25:49 -07:00
Dylan Conway
bb13798d98 fix(install): workspace version added to package.json (#11241) 2024-05-21 17:25:40 -07:00
Meghan Denny
ecb6c810c8 replace [bun.MAX_PATH_BYTES]u8 with bun.PathBuffer (#11162) 2024-05-21 15:55:49 -07:00
Georgijs
6c77d5e882 bypass getaddrinfo for ip addresses (#11238)
Co-authored-by: Georgijs Vilums <=>
2024-05-21 15:51:10 -07:00
dave caruso
e98c235e30 feat: load sourcemaps at runtime when using a bun build --target=bun bundle (#10998)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-21 14:41:53 -07:00
Jarred Sumner
c03b35ecfc Fix node:dns error code issue impacting MongoDB (#11235) 2024-05-21 14:41:00 -07:00
Georgijs
6e55612d36 fix http2 test on windows (#11236)
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-21 14:36:08 -07:00
dave caruso
0457d6a748 fix(win): bugs with files in roots / bugs with resolver and unc shares (#11155)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-21 13:51:47 -07:00
Meghan Denny
1c99cfebeb crypto: fix digestToBytes and add tests (#11234) 2024-05-21 13:51:00 -07:00
Dylan Conway
33aaf3376b use count instead of index for error output 2024-05-21 13:42:20 -07:00
Dylan Conway
fbde05b339 one 2024-05-21 13:38:04 -07:00
Jarred Sumner
bbaeeaeed2 Implement expect().toHaveReturned() && expect().toHaveReturnedTimes(n) (#11231) 2024-05-21 13:11:26 -07:00
Meghan Denny
396dc78522 node:fs: add Dirent.path and .parentPath fields (#11135)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-21 11:24:05 -07:00
Zack Radisic
adde0af7b4 fix which when bin or PATH is rlly long (#11218) 2024-05-21 11:21:29 -07:00
Jarred Sumner
40fcf25e01 Fixes "column must be greater than or equal to 0" error (#11211) 2024-05-21 11:19:18 -07:00
Gaurish Sethia
c66e290801 Alias util.debug to util.debuglog (#11189) 2024-05-21 10:45:14 -07:00
Grigory
b59868ced1 fix(scripts/env): also search for prerelease vs (#11222) 2024-05-21 10:18:48 -07:00
Jake Boone
b2b7ad235e Remove expect.extend from list of missing features in migrate-from-jest.md (#11214) 2024-05-20 22:12:29 -07:00
Georgijs
4df387d59f happy eyeballs (#11206)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-20 22:12:14 -07:00
Jarred Sumner
440c7cde9e Upgrade reported Node.js version to v22.2.0 2024-05-20 21:38:22 -07:00
Jarred Sumner
6d87c965bf Fixes #10170 (#11209) 2024-05-20 21:30:44 -07:00
Jarred Sumner
cabfca4039 Fix adding packages in workspaces (#11177)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-05-20 21:24:37 -07:00
Georgijs
06a9aa80c3 fix data race in us_internal_handle_dns_result (#11201)
Co-authored-by: Georgijs Vilums <=>
2024-05-20 15:06:07 -07:00
Zack Radisic
ff1db36aaa shell: handle operators and delimiters better (#11165)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-20 10:37:52 -07:00
Dylan Conway
a612d22e33 upgrade webkit (#11188) 2024-05-20 10:37:06 -07:00
Peter Ammon
ee13aabded Optimize fish completions (#11185) 2024-05-19 18:31:05 -07:00
Jarred Sumner
09438eb50c Add DNS docs page 2024-05-19 18:10:24 -07:00
Jarred Sumner
b15d47dfe8 Introduce bun.dns.prefetch API (#11176)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Eric L. Goldstein <3359116+mangs@users.noreply.github.com>
2024-05-19 18:08:16 -07:00
Meghan Denny
16e0f6e671 make WindowsFileAttributes a packed struct and add a windows junction test (#11161)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-19 14:28:43 -07:00
Kelvin Luck
dcec6906f6 Prefer import.meta.path in http server guide (#11180) 2024-05-19 13:37:17 -07:00
Jarred Sumner
8fffe01ef3 Fix crash in CodeCoverage 2024-05-19 11:43:25 -07:00
Jarred Sumner
b044387e58 Fix icu version test 2024-05-19 03:15:00 -07:00
Georgijs
814440b1c0 Asynchronous DNS for sockets (#11097)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-05-18 05:11:21 -07:00
dave caruso
d0cacfc2ac fix junction/pnpm on window (#11157)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-17 19:32:44 -07:00
Zack Radisic
38122a99b2 shell: Fix some cd returning the wrong exit code (#11092) 2024-05-17 18:12:57 -07:00
Jarred Sumner
16920a552f Make unhandled exceptions in Bun.serve() within a test() or expect() call fail the test like any other exception (#11141) 2024-05-17 18:11:43 -07:00
dave caruso
4e714ae9dc fix: don't crash when seeing -1 in code cov (#11131)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-17 15:53:19 -07:00
Jarred Sumner
902c258c1b Use simdutf to validate utf8 in websocket server (#11140) 2024-05-17 04:03:37 -07:00
Jarred Sumner
dfb935dc73 Add test for ICU version 2024-05-17 03:41:30 -07:00
Jarred Sumner
593ad71891 [bun-types] Add missing serialization option to Bun.spawn 2024-05-17 02:58:14 -07:00
Jarred Sumner
b220254df4 Fix failing test 2024-05-16 23:48:48 -07:00
Meghan Denny
d35ea63e6d node:http: convert Agent from class to function (#11130)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-16 23:33:34 -07:00
Jarred Sumner
ca4d2fcbba A couple fixes to TypeScript types 2024-05-16 23:26:42 -07:00
Meghan Denny
c7d7bc120a node:crypto: add shake128 and shake256 (#11134) 2024-05-16 23:16:59 -07:00
Jarred Sumner
8c963f3430 macOS arm64 CI jobs are being enqueued for too long 2024-05-16 22:47:48 -07:00
Jarred Sumner
44891ee62d Skip bun build of react-dom/server test when react-dom/server is unsupported 2024-05-16 21:47:58 -07:00
Jarred Sumner
ffeaa77370 Add a debug assertion 2024-05-16 20:35:57 -07:00
Meghan Denny
5caca9cd48 add .bytes() method to various readables (#11104)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-05-16 19:10:50 -07:00
Meghan Denny
ac6eaac403 test: use resource disposal to ensure servers shutdown even if tests fail (#11106) 2024-05-16 17:26:13 -07:00
Jarred Sumner
93abd99202 Downgrade to React 18 2024-05-16 15:53:13 -07:00
Jarred Sumner
013d7c2e9c Fix flaky test
@zackradisic please don't use `^` in tests. It means a package updating in the future can cause the test to fail.
2024-05-16 15:44:28 -07:00
Ishan Anand
ed48b66d42 add guide for drizzle + neon (#11004) 2024-05-16 14:25:58 -07:00
Jarred Sumner
d55ac0fa43 Move docs/project/licensing.md to LICENSE so it's easier for people to find it
Fixes #241
2024-05-16 03:49:08 -07:00
Jarred Sumner
2fb0a5e311 Fix bug with errname not allowing double numbers as ints (#11103) 2024-05-16 02:55:07 -07:00
Jarred Sumner
f7a45b30fd GitHub actions 2024-05-16 02:29:59 -07:00
Jarred Sumner
b725be7288 GitHub actions 2024-05-16 02:12:09 -07:00
Jarred Sumner
8ed8acd4ae GitHub actions 2024-05-16 01:59:50 -07:00
Jarred Sumner
87cc3c9898 GitHub actions 2024-05-16 01:51:30 -07:00
Jarred Sumner
c3d4e2729f Github actions 2024-05-16 01:47:33 -07:00
Jarred Sumner
f00772e98d GitHub actions 2024-05-16 01:35:28 -07:00
Jarred Sumner
db80f22751 GitHub actions 2024-05-16 01:22:15 -07:00
Jarred Sumner
d51e144344 GitHub actions 2024-05-16 00:59:48 -07:00
Jarred Sumner
f58249e361 Fix loading bun-types in development (#11110)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-16 00:46:28 -07:00
Jarred Sumner
6098fc5492 GitHub actions 2024-05-16 00:44:55 -07:00
Jarred Sumner
24e195d848 GitHub actions 2024-05-16 00:29:31 -07:00
Jarred Sumner
0cbc5dff7f Bump Bun version used in format action 2024-05-16 00:20:42 -07:00
Jarred Sumner
2f7e3a9e26 GitHub actions 2024-05-15 22:29:12 -07:00
Jarred Sumner
29f840620c GitHub actions 2024-05-15 21:38:06 -07:00
Jarred Sumner
6e4b8215ed GitHub actions 2024-05-15 21:36:17 -07:00
Jarred Sumner
e5e5f98592 Tweak github actions C++ linter (#11105) 2024-05-15 21:28:43 -07:00
Jarred Sumner
d90058a522 GitHub actions 2024-05-15 20:48:07 -07:00
Jarred Sumner
1b77efdc52 GitHub actions 2024-05-15 20:44:35 -07:00
Jarred Sumner
e88118972c GitHub actions 2024-05-15 20:39:48 -07:00
Jarred Sumner
4f93db2c22 GitHub actions 2024-05-15 20:37:58 -07:00
Jarred Sumner
f4679be7fc Remove unnecessary change 2024-05-15 20:36:22 -07:00
Jarred Sumner
735f5d4b62 Setup clang-tidy (C++ linter) (#7961)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-05-15 20:35:39 -07:00
Jarred Sumner
9c5d339ccb 5x faster toString("base64url") (#11087) 2024-05-15 19:53:25 -03:00
Jarred Sumner
b5dff55ef3 Upgrade SIMDUTF, 8x faster atob (#11085) 2024-05-15 03:42:36 -07:00
Jarred Sumner
5389c7ab40 Bump 2024-05-15 00:59:33 -07:00
Meghan Denny
86bcc49bef node:http: allow setting response.statusCode and statusMessage [v2] (#11082) 2024-05-15 00:27:55 -07:00
Meghan Denny
5c8c112c4e fix corrupted file (#11081) 2024-05-14 22:15:20 -07:00
Meghan Denny
4efe026b5f test: unify how all files create a temp directory (#11057)
Co-authored-by: nektro <nektro@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-14 20:19:35 -07:00
阿豪
19f210b085 fix(test): use a real png image instead of Symbolic Link (#11059) 2024-05-14 18:41:47 -07:00
Jarred Sumner
c4840f8a58 Fix BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD env var (#11078) 2024-05-14 18:22:21 -07:00
Jarred Sumner
d62cd47885 Update CONTRIBUTING.md 2024-05-14 18:18:59 -07:00
Jarred Sumner
53bf855c18 Update CONTRIBUTING.md 2024-05-14 18:17:08 -07:00
Meghan Denny
1e6fa76637 rework node:net.connect arg parsing (#10970) 2024-05-14 17:20:19 -07:00
Dale Seo
301b0fd2e7 Add missing code and reason to WebSocket docs (#10669) 2024-05-14 15:42:33 -07:00
Zack Radisic
60482b6e42 Fix backtick escaping and add more tests (#10980)
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-14 14:23:12 -07:00
Jarred Sumner
8fbdf32d74 Update cluster.md 2024-05-14 02:18:04 -07:00
Jarred Sumner
41569fa369 Update cluster.md 2024-05-14 01:57:43 -07:00
Jarred Sumner
5602b7a352 Update cluster.md 2024-05-14 01:56:55 -07:00
Jarred Sumner
e686c2ed7b Add guide for reusePort 2024-05-14 01:53:52 -07:00
Dylan Conway
f2cfa15e4e fix(install): make sure each has_install_script value is updated (#11051)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-13 21:10:33 -07:00
Dylan Conway
2d5cc719d2 fix coercion to double (#11056) 2024-05-13 20:07:00 -07:00
Jarred Sumner
889ec13b32 Fix sorting order of guides 2024-05-13 17:37:18 -07:00
阿豪
d7ba296a20 fix(install.sh): support windows mingw platform (#11017) 2024-05-13 16:58:13 -07:00
Georgijs
89d68debde emit newListener event before new listener is added (#10993)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-13 16:57:59 -07:00
Jarred Sumner
b079f8d907 fix links 2024-05-13 16:50:54 -07:00
Jarred Sumner
b10a954e99 Link to guides in Readme 2024-05-13 16:48:26 -07:00
Jarred Sumner
17763168c4 Update README nav links + script to update the table of contents 2024-05-13 16:24:16 -07:00
Ashcon Partovi
998c4ca0a7 Change node-http test so it doesn't emit annotation 2024-05-13 14:37:42 -07:00
Ashcon Partovi
c0c6d0fa27 Change issue template to just use "crash" tag 2024-05-13 10:19:40 -07:00
LuisAFK
5d51aa454e docs: bun upgrade --stable flag in installation docs (#11000) 2024-05-13 09:48:36 -07:00
Dylan Conway
88468a2c2c Snapshot lockfiles in some tests (#10994) 2024-05-12 17:27:48 -07:00
dave caruso
dbdc376005 fix(bundler): fix emitting invalid sourcemaps (#10999) 2024-05-11 21:58:22 -07:00
Zack Radisic
68cb85a61d Tilde expansion (#10981) 2024-05-10 15:01:17 -07:00
Jarred Sumner
89d25807fb Do not use always() in github actions
@Electroid this causes the tests to never cancel. GitHub has a concurrent actions limit which we easily reach. This causes CI to wait a long time before starting the job, wasting our time.
2024-05-10 06:11:54 -07:00
Jarred Sumner
aa05278d5d GitHub actions test 2024-05-10 05:53:45 -07:00
Jarred Sumner
1d119b7f87 Avoid loading libm.so.6 as it breaks Vercel (#10978) 2024-05-10 05:42:47 -07:00
Jarred Sumner
1fd021e1c4 Bump Webkit again (#10974) 2024-05-10 02:07:31 -07:00
Jarred Sumner
f52c17781e Add to gitignore incase someone still has it locally 2024-05-10 00:54:06 -07:00
Jarred Sumner
1a3f537b3a Remove unnecessary submodule which should be cloned in the integration test action instead 2024-05-10 00:53:20 -07:00
Jarred Sumner
8c6883d1ba Disable Node.js test suite until we start using it 2024-05-10 00:35:41 -07:00
Jarred Sumner
ce07eca2a2 Support overriding headers property in Request subclass (#10969) 2024-05-10 00:18:48 -07:00
Dylan Conway
1482c9fd65 fix(napi): check result arguments in some functions (#10972) 2024-05-10 00:14:08 -07:00
Jarred Sumner
5eb596a9dc Update json-parse-stringify.mjs 2024-05-09 23:51:53 -07:00
Dylan Conway
589a39d413 upgrade webkit (#10971) 2024-05-09 23:06:10 -07:00
Jarred Sumner
abe4fd9bd5 Add extra options to features.json (#10968) 2024-05-09 22:01:46 -07:00
Dylan Conway
e2aa36f8a6 fix(install): bug with dist-tags and workspaces with versions (#10959)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-09 17:22:25 -07:00
Meghan Denny
8528e9c670 make node:fs.ReadableStream and node:stream.NativeReadable constructor functions (#10943)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-09 17:18:43 -07:00
dave caruso
37006509d9 Update ICU on Linux to 75.1 (#10960) 2024-05-09 17:08:46 -07:00
Jarred Sumner
6d717ac852 Revert "Bump"
This reverts commit 86820edbf9.
2024-05-09 15:29:13 -07:00
Jarred Sumner
86820edbf9 Bump 2024-05-09 05:22:01 -07:00
Dylan Conway
159e8bc2a3 fix(install): workspaces without versions (#10913) 2024-05-09 03:55:15 -07:00
Jarred Sumner
50fd2b049a Update nodejs-apis.md 2024-05-08 23:45:01 -07:00
Jarred Sumner
28b5a90823 Fixes missing argument in signal events (#10940) 2024-05-08 23:32:11 -07:00
Jarred Sumner
75420ba12a Implement process.hasUncaughtExceptionCaptureCallback() (#10937) 2024-05-08 19:51:39 -07:00
dave caruso
13c6f46b20 feat: add canary to crash handler message (#10935) 2024-05-08 18:28:56 -07:00
Meghan Denny
93c0a37ec2 brotli: make sure stream encode on large inputs works as expected (#10936)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-05-08 18:28:06 -07:00
Georgijs
c378febf5b Implement process.on("uncaughtException", ...) (#10902)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-08 17:38:31 -07:00
Zack Radisic
4b581b011c feat: Add cp builtin to shell for Windows (#10174)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
2024-05-08 17:01:00 -07:00
dave caruso
f1fbf54b0a fix(win): do not allow exitcode==1 and signalCode to be set at once (#10907) 2024-05-08 16:00:35 -07:00
dave caruso
f60d87b7df chore: fix the build scripts again (#10912)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-08 14:57:15 -07:00
Zack Radisic
0d0fe75bec Fix more glob pattern problems (#10792)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-08 14:47:09 -07:00
Zack Radisic
656925ec97 Fix workspace packages not being found when they are moved (#10899)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-08 14:46:05 -07:00
dave caruso
3c082012b7 fix %i formatter with missing argument (#10910) 2024-05-07 23:51:10 -07:00
dave caruso
127cb9fd42 fix(crash_handler): add a newline 2024-05-07 23:40:55 -07:00
Meghan Denny
1589a1230d Revert "Align arguments of connect() in node:tls and node:net to Node (#10854)" (#10908) 2024-05-07 20:33:42 -07:00
Jarred Sumner
3cb5b2ff1a Add assertion that count() was called before allocate() in lockfile stringbuilder (#10901) 2024-05-07 19:06:11 -07:00
dave caruso
4c0d69af93 fix(windows): build all dependencies with proper cpu target (#10884)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-07 17:36:19 -07:00
Georgijs
d4db29c164 Fix fd offset handling in ReadStream (#10883)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-07 16:05:48 -07:00
Henrik Storck
6217d78567 fix: Align arguments of connect() in node:tls and node:net to Node (#10870)
Co-authored-by: dave caruso <me@paperdave.net>
2024-05-07 15:03:38 -07:00
rcaselles
c4fa1e38dc Fix confirm is never true in windows (#10802)
Co-authored-by: rcaselles <rcaselles@ganaenergia.com>
2024-05-07 14:51:02 -07:00
Dylan Conway
288b540621 fix(node:os): cpus bugfix (#10879) 2024-05-07 13:08:25 -07:00
Meghan Denny
4970ffc3a4 node:http: add agent getter to ClientRequest (#10878) 2024-05-06 23:05:43 -07:00
Meghan Denny
1da810adc1 node:zlib: Brotli (#10722)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-06 22:00:04 -07:00
Jarred Sumner
0a54bc0510 Speculative fix for napi_set_property crash (#10842) 2024-05-06 20:07:55 -07:00
dave caruso
f9be0bef45 add [Symbol.dispose] in some bun apis (#10818)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-06 19:49:23 -07:00
Dylan Conway
5cbb1ba96a console.table bugfix (#10876) 2024-05-06 19:46:35 -07:00
Artemiy Schukin
16bf341a60 fix: typo in the comment (#10817) 2024-05-06 16:35:55 -07:00
Jarred Sumner
b1b91d59d8 Set frame pointers and sigaltstack (#10847) 2024-05-06 15:08:43 -07:00
Jarred Sumner
5002a10ef0 Remove references to echo in spawn because it doesn't work on Windows and that confuses people 2024-05-05 23:07:03 -07:00
Jarred Sumner
34c5d083c6 Update http.md 2024-05-05 21:54:25 -07:00
Jarred Sumner
bafa32b39a Update http.md 2024-05-05 21:51:36 -07:00
Jarred Sumner
07cd586ad6 Update http.md 2024-05-05 20:59:50 -07:00
Jarred Sumner
1a23d95844 Update http.md 2024-05-05 20:51:06 -07:00
Jarred Sumner
b333992640 Add more to the HTTP doc 2024-05-05 20:48:54 -07:00
Jarred Sumner
5e9be3345b Create git-diff-bun-lockfile.md 2024-05-05 02:38:59 -07:00
Jarred Sumner
b01310c3f6 Update ssr-react.md 2024-05-05 00:53:52 -07:00
Jarred Sumner
9bfeb0a2ae Workaround https://github.com/facebook/react/issues/28941 2024-05-05 00:51:51 -07:00
Jarred Sumner
72bc2585e3 Fix passing stdout/stderr from Bun.spawn -> Bun.serve()'s Response (#10840) 2024-05-04 20:43:57 -07:00
Georgijs
7bfcc2c9e3 support onread in net (#10753)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-04 20:35:28 -07:00
dave caruso
9ba7d420d5 chore: upload release artifacts by hash so bun.report can remap them (#10819) 2024-05-04 20:34:59 -07:00
Dylan Conway
989cb79811 Update comment.yml 2024-05-04 00:54:39 -07:00
e3dio
45842893a4 Update websockets.md (#10808) 2024-05-03 20:23:23 -07:00
dave caruso
0ecc49ab7f fix(bundler): resolve failed assertion when lowering using syntax (#10814) 2024-05-03 20:22:25 -07:00
Ashcon Partovi
541744e583 Improve node:inspector stubs (#10807) 2024-05-03 19:44:30 -07:00
Eric L. Goldstein
d1eb35dd5d Update documentation for the [dir] option when customizing bundler naming (#10804) 2024-05-03 19:14:25 -07:00
Jarred Sumner
31d3d527f4 Update installation.md 2024-05-03 19:07:47 -07:00
Jarred Sumner
01fade7b1f Update installation.md 2024-05-03 19:06:13 -07:00
Jarred Sumner
669b47375f Add JS/TS code field to crash report template 2024-05-03 16:30:05 -07:00
Jared McCannon
d6d1a0bec8 Update solidstart.md (#10810) 2024-05-03 14:14:51 -07:00
Jarred Sumner
b0b7db5c06 Add missing $ 2024-05-03 01:47:38 -07:00
Jarred Sumner
13a7df1337 Update create-release-build.yml 2024-05-03 01:03:35 -07:00
Zack Radisic
461827902d Fix bad stack traces (#10778)
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-05-02 23:01:06 -07:00
dave caruso
bbb906c66f fix(bundler): naming of dynamic import chunks (#10761)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-05-02 21:22:36 -07:00
codershiba
b4ae0ed0ca chore(types): Remove type for parseArgs (#10777) 2024-05-02 20:51:48 -07:00
fzn0x
ba3d5e0217 docs(sqlite): fix a small typo in .run() section (#10784) 2024-05-02 20:40:14 -07:00
Georgijs
ec6110e7e3 allow connecting a socket again after its connection was closed (#10781)
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-02 20:36:58 -07:00
Dylan Conway
94bf404c41 Print bun version on unhandled errors (#10760)
Co-authored-by: dave caruso <me@paperdave.net>
2024-05-02 15:06:14 -07:00
dave caruso
d66a4fc0f4 add jsc to features list (#10759) 2024-05-01 22:49:53 -07:00
Dylan Conway
44e09bb7f4 fix(install): catch more errors for bun add/update/remove (#10758) 2024-05-01 21:42:06 -07:00
windwiny
2a0746d57e Update env.ps1, FIX when VS not installed in default path (#10684) 2024-05-01 21:13:42 -07:00
Jarred Sumner
56f3a80166 Revert "Make CONTRIBUTING.md a symlink to docs/project/contributing.md instead"
This reverts commit ca82b7f86c.
2024-05-01 20:23:55 -07:00
Jarred Sumner
ca82b7f86c Make CONTRIBUTING.md a symlink to docs/project/contributing.md instead
So that CI will pick up changes to it correctly
2024-05-01 20:18:17 -07:00
Jarred Sumner
6fbb32dd97 make contributing.md a symlink 2024-05-01 20:16:26 -07:00
Jarred Sumner
e1fdafd39c Update CONTRIBUTING.md 2024-05-01 20:09:39 -07:00
Jarred Sumner
f85323c72a Update docs.yml 2024-05-01 20:09:27 -07:00
Jarred Sumner
3c93a4c0c7 Update CONTRIBUTING.md 2024-05-01 20:09:11 -07:00
Jarred Sumner
f93a31596b Use CONTRIBUTING.md for visibility 2024-05-01 20:04:13 -07:00
Jonny Burger
c9108d19f9 Re-enable support_jsxs_in_jsx_transform flag (#10734) 2024-05-01 19:59:30 -07:00
Dylan Conway
5d7b3ab579 upgrade webkit (#10757) 2024-05-01 19:51:45 -07:00
Ciro Spaciari
79c7abe595 fix(server) handle ignored body and node:http destroy (#10268) 2024-05-01 16:18:35 -07:00
Ashcon Partovi
23fb8ce07a Rewrite some tests so they don't use GitHub annotations (#10748) 2024-05-01 16:13:20 -07:00
Meghan Denny
e45cd749e5 chore(zig): add a new lint for using bun.FD.cwd() (#10683) 2024-05-01 16:12:09 -07:00
Georgijs
5f4c5052d1 fix windows crosscompile to linux and mac (#10751) 2024-05-01 16:07:36 -07:00
Jarred Sumner
32120fe920 Cherry-pick https://github.com/WebKit/WebKit/pull/27964 (#10727) 2024-05-01 15:28:23 -07:00
Meghan Denny
23e4f609bf Revert "node:fs.readdir: should not fail even if folder contains self-referential symlinks" (#10750) 2024-05-01 14:59:01 -07:00
Meghan Denny
bd632464a0 node:fs.readdir: should not fail even if folder contains self-referential symlinks (#10679) 2024-05-01 13:25:47 -07:00
Eric L. Goldstein
2a401486d9 Remove util.styleText type overrides because @types/node has them now (#10746) 2024-05-01 12:53:08 -07:00
Georgijs
fd45c67e72 fix flaky jwt test (#10745) 2024-05-01 12:00:16 -07:00
Zack Radisic
303f86af41 Glob support for workspace names in bun install (#10462)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
2024-05-01 11:01:55 -07:00
Jarred Sumner
3fc2e45960 Update proxy.md 2024-05-01 03:19:30 -07:00
Jarred Sumner
50ba690cad Update proxy.md 2024-05-01 03:17:06 -07:00
Jarred Sumner
2b193095d3 Update proxy.md 2024-05-01 03:16:27 -07:00
Jarred Sumner
e1a7fe55c3 Add guide for proxy 2024-05-01 03:14:25 -07:00
Jarred Sumner
c156a8db09 Fix build 2024-05-01 03:00:04 -07:00
Jarred Sumner
dc99eb69ca Move some dns code into bun.dns (#10728)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-05-01 02:54:32 -07:00
Dylan Conway
a38b3102b6 override std.mem.indexOfSentinel (#10721) 2024-05-01 01:28:04 -07:00
Dylan Conway
3106b890ac Skip threadlocal destructors at exit on Windows (#10723) 2024-05-01 01:27:12 -07:00
Georgijs
b48c6736e5 (green ci) fix issue in workers and process deinit (#10715)
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-04-30 18:12:03 -07:00
Dylan Conway
a5b5a2a725 fix requestCert and rejectUnauthorized option handling (#10710) 2024-04-30 17:29:03 -07:00
Ashcon Partovi
32bf5eb444 Support bunx --version (#10701) 2024-04-30 11:29:17 -07:00
Jarred Sumner
efd4e15f4c Deflake http2 tests (#10682) 2024-04-30 13:50:30 -03:00
Ashcon Partovi
18261046ee Run more Node.js tests 2024-04-30 08:44:08 -07:00
Jarred Sumner
ee0e69702e Fix run URLs in CI comments 2024-04-30 01:03:39 -07:00
Meghan Denny
74c6bd4197 node:fs.fdatasync: include fd in Error when thrown (#10678) 2024-04-29 22:35:09 -07:00
Meghan Denny
a78db0b8ae test: node:http: don't hardcode this value (#10671) 2024-04-29 19:18:42 -07:00
Jarred Sumner
b42f5227e3 Deflake fs.watchFile tests (#10673) 2024-04-29 19:15:53 -07:00
RanolP
93829420dc fix: seq, dirname, basename should exit with 0 even when they don't have stdout (#10590) 2024-04-29 18:06:43 -07:00
Georgijs
168d50e622 fix cpu model identification on linux aarch64 (#10653) 2024-04-29 18:06:04 -07:00
Zack Radisic
558aad5611 Make Windows command line argument parsing more robust (#10661) 2024-04-29 17:53:46 -07:00
Eric L. Goldstein
185a4bf90e Update Bun.serve() types documentation to match the exact values from bun.d.ts (#10420) 2024-04-29 17:40:37 -07:00
Jarred Sumner
ce4f85c2c5 Fixes #10624 (#10625) 2024-04-29 17:16:48 -07:00
Dylan Conway
cacf97ca0a fix flaky bun-create.test.ts with git templates (#10662) 2024-04-29 16:59:07 -07:00
Dale Seo
72b3045758 no need to open the parentheses (#10666) 2024-04-29 15:46:16 -07:00
David Ernst
0f4449d51b Fix "is" -> "as" typo in comment (#10664) 2024-04-29 15:37:11 -07:00
Jarred Sumner
6f15b90e83 Disable these assertions on Windows 2024-04-29 14:25:36 -07:00
Jarred Sumner
2724bd3649 Bump 2024-04-29 14:16:43 -07:00
Jarred Sumner
bca4d0be48 Speculative fix for alignment crash in directory iterator on Windows (#10628) 2024-04-29 14:07:00 -07:00
Jarred Sumner
3970339483 Use error handling callback in more places, emit 1015 when WSS TLS handshaking fails, micro-optimize ServerWebSocket, fix bug in util.inspect exceptions (#10633) 2024-04-29 13:57:23 -07:00
Georgijs
603588ac8c fix flaky udp test (#10650)
Co-authored-by: Georgijs Vilums <=>
2024-04-29 13:03:12 -07:00
Dylan Conway
fbbc20fe83 fix flaky setTimeout test (#10656) 2024-04-29 12:47:08 -07:00
Jarred Sumner
7af0ed164a Fixes #10584 (#10627) 2024-04-29 10:43:59 -07:00
Keigo Ando
7062e89d2e Support asymmetric matchers with equals in expect.extend (#10602) 2024-04-29 10:37:35 -07:00
Jarred Sumner
2bf3f32fb8 Update nodejs-apis.md 2024-04-28 22:58:40 -07:00
Dylan Conway
697f37e21f fix 10610 (#10618) 2024-04-28 16:55:20 -07:00
Dylan Conway
c7aed7e0a3 fix node-module-module.test.js on windows (#10620) 2024-04-28 16:54:47 -07:00
Jarred Sumner
84d81c3002 Add microbenchmark 2024-04-28 02:31:45 -07:00
Jarred Sumner
e58d67b468 Fixes #10588 & upgrade WebKit (#10596) 2024-04-28 01:10:52 -07:00
Jarred Sumner
dfcbe09035 Update create-release-build.yml 2024-04-27 17:44:20 -07:00
Jarred Sumner
cbb0b3113a Update create-release-build.yml 2024-04-27 16:55:31 -07:00
Yusup Hambali
9ebbe035b9 [docs] Fix scoop command (#10586) 2024-04-27 16:44:40 -07:00
João Lucas de Oliveira Lopes
57b529d181 fix: udp docs navbar (#10579) 2024-04-27 16:44:24 -07:00
Jarred Sumner
cc8cdf6c51 Fix napi_get_date_value (#10575) 2024-04-27 02:59:11 -07:00
Jarred Sumner
4cbd215d55 Fix regression with TOML & JSONC (#10573) 2024-04-27 02:58:44 -07:00
Dylan Conway
3b1311a84f fix 10556 (#10572) 2024-04-27 02:03:03 -07:00
Dylan Conway
2f1a3da21b fix 10567 (#10570)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-27 01:25:28 -07:00
Meghan Denny
adc631c9ef fix node:http events regression and add another test (#10566) 2024-04-27 00:53:51 -07:00
dave caruso
a52dd7853d final steps to getting dd-trace to work (#10568) 2024-04-27 00:07:44 -07:00
Georgijs
e2c36aabff add docs for UDP (#10562)
Co-authored-by: Georgijs Vilums <=>
2024-04-26 21:08:51 -07:00
Meghan Denny
9416ee49b2 windows: patch setTimeout.test.js flakiness (#10564) 2024-04-26 21:08:40 -07:00
Meghan Denny
8280defc30 node:http: preserve this value for onListen callback (#10533) 2024-04-26 18:42:29 -07:00
Jarred Sumner
609ef6a8ad Fix DNS lookup not draining microtasks (#10561) 2024-04-26 18:42:18 -07:00
Jarred Sumner
829ac49612 Add missing NOT_SAME_DEVICE -> EXDEV error translation 2024-04-26 15:38:25 -07:00
Jarred Sumner
555bd1defd Bump! 2024-04-26 15:30:38 -07:00
Ashcon Partovi
589f941aea UDP support (#7271)
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <=>
2024-04-26 15:25:24 -07:00
Kilian Brachtendorf
a6d39e14fc Fixes #10551 Search for LLVM 16 during initial setup (#10552) 2024-04-26 15:15:09 -07:00
Jarred Sumner
4b87e1a909 Fixes #4718 (#10543) 2024-04-26 14:56:22 -07:00
Meghan Denny
181d6a0a83 node:net: stub out [get|set]DefaultAutoSelectFamily[AttemptTimeout] (#10529) 2024-04-26 14:35:34 -07:00
Meghan Denny
b257a30977 node:fs: fix arg parsing of readSync (#10527) 2024-04-25 20:49:17 -07:00
Jarred Sumner
189aa22845 Support comments & trailing commas in require/import package.json (#10531) 2024-04-25 20:48:42 -07:00
Dylan Conway
7f0b810d7a fix checking no_proxy env variable (#10530) 2024-04-25 20:45:10 -07:00
Jarred Sumner
17fc156460 Update create-release-build.yml 2024-04-25 19:45:45 -07:00
dave caruso
7502c9b391 fix: never create more than one stdin tty (#10528) 2024-04-25 19:20:37 -07:00
josephjclark
c7773975f6 docs: Remove duplicated content from guides/install/trusted (#10330) 2024-04-25 18:53:10 -07:00
dave caruso
006575a0f1 watcher: major refactor to use Maybe types for better error reporting (#10492) 2024-04-25 18:44:11 -07:00
Georgijs
9ba1181215 fix child-process-exec test on windows (#10522)
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-25 17:58:12 -07:00
Dylan Conway
588259fff1 fix flaky jsonwebtoken tests (#10524) 2024-04-25 17:57:22 -07:00
Jarred Sumner
c34428d47f Fix Linux spawn issue (#10503)
Co-authored-by: Zack Radisic <zack@theradisic.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-25 16:05:19 -07:00
Georgijs
78aef2d894 fix some child_process tests (#10521) 2024-04-25 16:02:19 -07:00
Jarred Sumner
9eab12f7b8 Support cross-compilation in bun build --compile (#10477) 2024-04-25 15:34:40 -07:00
Dylan Conway
196cc2a4cd fix windows install tests (#10497) 2024-04-25 14:27:18 -07:00
Jarred Sumner
49fa21f6dc Don't error on comments & trailing commas in package.json (#10287)
* Don't error on comments & trailing commas in package.json

* Fix windows tests

* Fixup

* Update lockfile.zig

* Woopsie

* Woopsie

* Fix workspace path stuff on Windows

* Always decode

* Always decode

* Revert some things

* Update lockfile.zig
2024-04-25 03:16:00 -07:00
Dylan Conway
d966fe6afd fix flaky and broken test (#10500)
* add package

* fix test
2024-04-25 01:14:11 -07:00
Meghan Denny
a64554bba6 node:http.request should emit events in the right order (#10447)
* node:http.request should emit events in the right order

* Apply formatting changes

* remove runOnNextTick alias

* make private event a symbol

* clean test

* fix regressions and add more tests

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-25 00:07:54 -07:00
Dylan Conway
a6714904e4 set length before copy (#10498) 2024-04-24 23:39:05 -07:00
dave caruso
e792bbdf5f fix: overriding self.postMessage should not impact worker_threads.parentPort (#10496)
* fix a bug in worker

* remove old
2024-04-24 22:14:37 -07:00
Meghan Denny
685dc02142 windows: fix bun-create ci tests (#10494)
* windows: fix bun-create ci tests

* fix lint

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-24 21:51:05 -07:00
Dylan Conway
ebeae0ff1c Revert "Fix issue #10376 (#10421)"
This reverts commit 7bc8456edf.
2024-04-24 19:33:23 -07:00
Uzini
7bc8456edf Fix issue #10376 (#10421)
* add: prevent script install to be spawned if bun install is invoked

* add: test for infinite install loop

* add: error message

* fix: error message, exit code, test

---------

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-04-24 19:12:13 -07:00
Dylan Conway
fdff887c0a file protocol and abs path (#10493) 2024-04-24 18:55:13 -07:00
Meghan Denny
d789eb34c9 remove unnecessary use of ReflectApply (#10482) 2024-04-24 15:30:15 -07:00
Dylan Conway
b03c6690ba fix 10474 (#10478)
* use utf8string

* update
2024-04-24 15:03:12 -07:00
Meghan Denny
e3689e7e83 node:crypto: add blake2b512, sha512-224, sha3-* (#10383)
* node:crypto: add blake2b512, sha512-224, sha3-*

* update submodule

* flesh out rest of api

* remove new bun.newCatchable

* add SHA512_224 to HashClasses

* remove SHA512_224 js class

* better allocation

* remove memcpy in path where buffer is provided to us

* add back benchmark

* move zig crypto things into specific struct

* Apply formatting changes

* centralize algorithm definitions into one spot

* rsa-256 was deleted

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-23 19:35:27 -07:00
Meghan Denny
2abe6e7c3f node:child_process: allow passing stdin,stdout,stderr to spawn (#10451)
* node:child_process: allow passing stdin,stdout,stderr to spawn

* this doesnt actually need to be limited to 0,1,2

* Apply formatting changes

* fix stream guards

* undo process internals change

* wrap check in function for better clarity

* lazy load node:fs more

---------

Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-04-23 17:03:11 -07:00
Jarred Sumner
0989f1a575 Add comment 2024-04-23 16:42:45 -07:00
Zack Radisic
528a84d29f Fix absolute patterns with glob (#10121)
* Make it work with abs patterns

* add tests

* fixes

* Make all the ported fast-glob tests work for absolute path patterns, fix some stuff

* fix scan test

* remove TestBuilder in scan.test.ts

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-23 15:59:59 -07:00
Jarred Sumner
024c274a3d Support type import attribute with "text", "json", "toml", and "file" (#10456)
* Fixes #3449

Fixes https://github.com/oven-sh/bun/issues/10206
Fixes https://github.com/oven-sh/bun/issues/5710

* Apply formatting changes

* Update loaders.md

* Update text-loader-fixture-import.ts

* Add guide

* Update bundler_loader.test.ts

* Address comment

---------

Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-23 15:35:34 -07:00
Meghan Denny
ff624147ad existsSync should never throw ENAMETOOLONG (#10446)
* existsSync should never throw ENAMETOOLONG

* undo PathLike change and use better guard

* Apply formatting changes

* await promise

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-23 15:33:37 -07:00
Jarred Sumner
c1d7a5ed79 Update define-constant.md 2024-04-23 14:39:15 -07:00
Jarred Sumner
7593790308 Update define-constant.md 2024-04-23 14:37:32 -07:00
Jarred Sumner
3d770c112c Update define-constant.md 2024-04-23 14:36:27 -07:00
Jarred Sumner
d690504943 Update define-constant.md 2024-04-23 14:26:21 -07:00
Jarred Sumner
1a17d7179c Update define-constant.md 2024-04-23 14:23:31 -07:00
Jarred Sumner
309c2e3678 Update define-constant.md 2024-04-23 14:22:44 -07:00
Jarred Sumner
90fc629156 Update define-constant.md 2024-04-23 14:21:27 -07:00
Jarred Sumner
dd774c7f8c Formatting 2024-04-23 14:15:09 -07:00
Jarred Sumner
79a4cfb17d Fix example 2024-04-23 14:05:35 -07:00
Jarred Sumner
dc5044443f Add a guide for using --define 2024-04-23 13:58:55 -07:00
Jarred Sumner
68c13f2af5 Format 2024-04-23 01:31:15 -07:00
dave caruso
e6954c440e ci: make next build test ignore gzipped file sizes (#10443)
* fix next build

* window
2024-04-22 21:07:32 -07:00
Jarred Sumner
a1c771834c Fixes #10322 (#10384)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-04-22 21:06:53 -07:00
Erik Brinkman
9768d30e6d check for nested define value identifiers (#10401)
fixes #10399

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-22 19:37:48 -07:00
Georgijs
9813341cef fix hang when spawning many processes (#10448)
* fix hang when spawning many processes

* update comment
2024-04-22 19:37:01 -07:00
Dylan Conway
0f13deb540 Switch to quick_exit (#10450)
* quick_exit

* remove macos
2024-04-22 19:34:23 -07:00
Meghan Denny
0f8d74e3dc node:*: fix some typescript errors (#10310)
* node:*: fix some typescript errors

* add dom to tsconfig

* fix url regression

* fix diagnostics_channel regression

* use $isJSArray instead of ArrayIsArray

* $isArray wasnt actually a real builtin

* Revert "$isArray wasnt actually a real builtin"

This reverts commit 319926b538.

* Apply formatting changes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-04-22 18:24:07 -07:00
Ashcon Partovi
c3c1750ec7 Run tests from Node.js (#10377) 2024-04-22 15:28:16 -07:00
Dylan Conway
e8fa39f938 update crash handler (#10442)
* format null line

* single slash
2024-04-22 15:00:39 -07:00
Jarred Sumner
0fb10356f8 Update upload.yml 2024-04-22 13:28:07 -07:00
Jarred Sumner
c405a4bd21 Fixes #10304 (#10407) 2024-04-22 13:03:36 -07:00
vico
164b2f610f docs: update clang/llvm version to 17 (#10439) 2024-04-22 10:42:56 -07:00
welfuture
83e4aca269 chore: remove repetitive words (#10393)
Signed-off-by: welfuture <wellfuture@qq.com>
2024-04-22 08:47:57 -07:00
Johan Wigert
6758046f76 Fix typo in docker.md (#10430) 2024-04-22 08:46:51 -07:00
Jarred Sumner
7496299b00 Update CMakeLists.txt 2024-04-22 00:53:14 -07:00
Jarred Sumner
c2ad94aa01 CI actions 2024-04-22 00:51:01 -07:00
Jarred Sumner
a614336157 Tweak actions 2024-04-22 00:19:29 -07:00
Jarred Sumner
7bd305c573 Update upload.yml 2024-04-22 00:02:33 -07:00
Jarred Sumner
cd3b184ba0 Update upload.yml 2024-04-22 00:00:24 -07:00
Jarred Sumner
a010db8eca Update ci.yml 2024-04-21 23:50:54 -07:00
Jarred Sumner
a3dc94f1e1 Update ci.yml 2024-04-21 23:49:10 -07:00
Jarred Sumner
639f554c9c Update upload.yml 2024-04-21 23:47:21 -07:00
Jarred Sumner
536379b8ed Update build-darwin.yml 2024-04-21 23:43:02 -07:00
Jarred Sumner
04a79fa308 Update upload.yml 2024-04-21 23:38:02 -07:00
Jarred Sumner
0bd75cc3c5 Update upload.yml 2024-04-21 23:36:57 -07:00
Jarred Sumner
1f1df6be0c Update create-release-build.yml 2024-04-21 23:20:53 -07:00
Jarred Sumner
6ff77c978e Update create-release-build.yml 2024-04-21 23:20:33 -07:00
Jarred Sumner
7433f5a922 Update create-release-build.yml 2024-04-21 23:11:29 -07:00
Jarred Sumner
9c879064fe Update create-release-build.yml 2024-04-21 22:54:43 -07:00
Jarred Sumner
8168415e5a Create release build action 2024-04-21 22:43:50 -07:00
Jarred Sumner
22a289e272 Update ci.yml 2024-04-21 21:45:38 -07:00
Jarred Sumner
97efa6f505 Update ci.yml 2024-04-21 21:42:21 -07:00
Jarred Sumner
c604c57a32 Upgrade to LLVM 17, fix linux debug build, upgrade JSC, remove some C API usages (#10161)
* Upgrade to LLVM 17, JSC, remove more C API usages

* [autofix.ci] apply automated fixes

* Update scripts/setup.sh

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>

* more

* update

* bump

* Fix unused variable

* Fix merge conflict

* [autofix.ci] apply automated fixes

* Increase limit

* double the limit

* CI

* Update CMakeLists.txt

* Update CMakeLists.txt

* Upgrade

* Upgrade more things

* Bump

* Remove ld64 flag

* typo

* Update Dockerfile

* update

* Update

* Up

* asd

* up

* Upgrade

* Bump!

* Fix crash

* Remove unnecessary cahnge

* Propagate canary flag + bump macOS 13

* Upgrades

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-04-21 19:03:01 -07:00
LuisAFK
ab79940e6a Fix typo in workspaces docs "pacakges" (#10417) 2024-04-21 18:03:17 -07:00
Jarred Sumner
1a4bad80b7 Bump 2024-04-20 21:30:14 -07:00
Jarred Sumner
30f4090571 Fix flaky test 2024-04-20 21:30:05 -07:00
Jarred Sumner
1191bf0c15 Delete dead test code (#10405)
* Delete dead test code

* Apply formatting changes

---------

Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-04-20 21:25:10 -07:00
Jarred Sumner
707fd7f1ea Update mimalloc (#10408)
* Update mimalloc

* Update runner.node.mjs
2024-04-20 20:48:55 -07:00
Georgijs
df1e9290ae filter: return with nonzero code if any script fails (#10374)
* filter: return with nonzero code if any script fails

* propagate exit code

* Update src/cli/filter_run.zig

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-20 17:59:14 -07:00
Jarred Sumner
fc4459991d Fixes #8697 (#10378)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-04-20 17:58:14 -07:00
dave caruso
a062e2d367 fix(bundler): fix --compile with asset files on windows (#10385)
* fix some bundler things

* buh

* buh

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-20 17:13:50 -07:00
Dylan Conway
ad44949621 fix upgrade crash (#10387)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-20 16:14:09 -07:00
Arnaud Thomas D
d0a4fd5e80 docs: fix invalid links to other pages (#10404) 2024-04-20 16:13:31 -07:00
Dylan Conway
e6d8391e00 fix(windows): revert thread naming code (#10394) 2024-04-20 10:56:05 -07:00
dave caruso
5bdc5bebb1 feat: crash reporter followup (#10365)
* think about the future

* waaaaaaaaaaa

* a

* testing

* make it faster

* fire

* macos and linux

* stuff

* a

* a

* CI

* buh

* disable in debug

* Apply formatting changes

* a

* a

* Apply formatting changes

* more review comment resolution

* a

* a

* oh no i started writing macos code from within windows i should stop and switch devices again

* rookie mistake

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-04-19 20:50:37 -07:00
Ciro Spaciari
e0f583df75 feat(SNI) Bun.serve/tls (#10364)
* add SNI support

* add some Bun.serve tests

* more tests

* wip move addServername to

* move addServerName

* clean

* fix types

* cleanup

* make TS happy

* opsie revert back

* version this

* internals

* opsie

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-19 17:11:05 -07:00
Ashcon Partovi
131183f747 Likely fix issue with Windows tests [no ci] 2024-04-19 14:56:25 -07:00
Ashcon Partovi
5ccc042cc4 Fix syntax error from workflow [no ci] 2024-04-19 14:05:41 -07:00
Ashcon Partovi
abaa505374 Set git config when running tests on Windows [no ci] 2024-04-19 13:50:23 -07:00
Jarred Sumner
c5270f8121 Fix typo 2024-04-18 22:57:36 -07:00
Jarred Sumner
c4d69146c8 [doc] Disambiguate the title 2024-04-18 22:46:43 -07:00
Jarred Sumner
2ce83953e5 [docs] Add a few more guides 2024-04-18 22:20:29 -07:00
Jarred Sumner
b6aebb58c2 [doc] Add guide for streaming with async iterators 2024-04-18 22:09:09 -07:00
Jarred Sumner
26428d5e1c [CI] Fixup windows 2024-04-18 20:52:37 -07:00
Jarred Sumner
05ff620d4d [Ci] Always cancel-in-progress 2024-04-18 19:12:51 -07:00
Jarred Sumner
e134ed253f [CI] Use bigger windows runners 2024-04-18 18:55:09 -07:00
Jarred Sumner
f663472d5f [CI] Normalize filepaths relative to cwd in output 2024-04-18 18:52:47 -07:00
Jarred Sumner
6f67c63873 Formatting tweak 2024-04-18 18:44:49 -07:00
Ashcon Partovi
f460d39298 Increase timeout for tests 2024-04-18 17:19:49 -07:00
Dylan Conway
246df1f43e check without .exe (#10362) 2024-04-18 17:03:38 -07:00
Ashcon Partovi
213461adc6 Fix Discord message on test failure 2024-04-18 13:05:23 -07:00
Jarred Sumner
a78668eb4c fix(bundler): fix a crash while computing character frequencies
* Fixes #10344

* Update bundler_compile.test.ts

* Apply formatting changes

* Track comments when bundling

* Fix embedded files and add test

* Make this const

* Update runner.node.mjs

* Prefill process arch/platform in bun build --compile

* nitpick

---------

Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-04-18 12:35:59 -07:00
Ashcon Partovi
452dd68253 Fix comment not upserting 2024-04-18 10:56:54 -07:00
Ashcon Partovi
de7985b5a6 Fix unzip location 2024-04-17 19:02:46 -07:00
Ashcon Partovi
a1f86bf3f3 Add temporary SSH into workflow 2024-04-17 19:00:00 -07:00
Ashcon Partovi
df23f18461 Fix glob that unzips bun 2024-04-17 18:58:10 -07:00
Ashcon Partovi
1d7f80c73c Use always() to maybe fix trigger 2024-04-17 18:54:58 -07:00
Ashcon Partovi
6d6b2e8bc5 Add ability to manually trigger tests 2024-04-17 18:52:10 -07:00
Ashcon Partovi
accfff0271 Attempt to fix download artifact issue 2024-04-17 18:28:28 -07:00
Ashcon Partovi
aa1174df69 Probably fix permissions issues with CI 2024-04-17 17:51:41 -07:00
Jarred Sumner
997f57b97f Fix generate comment in CI 2024-04-17 17:41:59 -07:00
Jarred Sumner
074205d963 Fix generate comment in CI 2024-04-17 17:37:33 -07:00
Ashcon Partovi
cfce166a9b Use different GitHub action to download Bun 2024-04-17 17:13:39 -07:00
Ashcon Partovi
13f0188fec Allow concurrent CI runs on main, but only cancel-in-progress if not-main 2024-04-17 16:29:48 -07:00
Ashcon Partovi
97761cba67 Fix GIT_SHA not being populated in builds 2024-04-17 16:23:50 -07:00
Ashcon Partovi
492211f499 Tweak comment from PRs 2024-04-17 16:08:04 -07:00
Jarred Sumner
192577141b Update 6-crash-report.yml 2024-04-17 15:53:24 -07:00
Jarred Sumner
6e71dca5c2 Tweak crash report template 2024-04-17 15:52:09 -07:00
dave caruso
c99d7ed331 feat: overhaul the crash handler (#10203)
* some work

* linux things

* linux things

* feat: tracestrings on Windows

* bwaa

* more work on the crash handler

* okay

* adgadsgbcxcv

* ya

* dsafds

* a

* wuh

* a

* bru h

* ok

* yay

* window

* alright

* oops

* yeah

* a

* a

* OOM handling

* fix on window
2024-04-17 15:32:25 -07:00
Ashcon Partovi
f764c1233b Fix permissions in workflows, part 2 2024-04-17 15:09:26 -07:00
Ashcon Partovi
20d8261405 Fix permissions in workflows 2024-04-17 15:07:54 -07:00
Ashcon Partovi
a7273802a8 Debug comment workflow 2024-04-17 14:18:25 -07:00
Ashcon Partovi
303bf4d9f1 Fix comment workflow 2024-04-17 11:47:05 -07:00
Ashcon Partovi
d4c31d3c9e Maybe fix test workflow 2024-04-17 11:36:40 -07:00
Ashcon Partovi
d5e6ff4c97 Fix artifact uploads for canary builds 2024-04-17 10:04:57 -07:00
liudonghua
51bb5f3a04 Update platform.ts to fix isWindowsAVX2 implementation. (#10313)
The isWindowsAVX2 function is not working as expected due to the stdout endwith `\r\n`. So the simple `stdout == "True"` will never true.
2024-04-17 00:26:57 -07:00
Ashcon Partovi
fdaa01287a Maybe fix Windows tests 2024-04-16 22:53:42 -07:00
Ashcon Partovi
f8a28ad37e Probably fix comment workflow 2024-04-16 22:12:48 -07:00
Ashcon Partovi
c18c25f390 Testing workflows (#10157)
* Testing workflows

* Testing workflows

* Testing workflows

* Testing workflows

* Testing workflows

* Testing workflows

* Update .github/workflows/run-test.yml

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-16 19:39:06 -07:00
Stefano
3df202f91f Fix(windows) search correct path for esbuild(.exe|.cmd) (#10302) 2024-04-16 15:43:47 -07:00
Meghan Denny
df190815df node: convert remaining js packages to ts (#10289) 2024-04-16 15:42:24 -07:00
Meghan Denny
2ae48f3314 lint: ban comparing against undefined in Zig (#10288) 2024-04-16 14:37:09 -07:00
Jarred Sumner
291a39bd3f Do not run shell tests outside test scope (#10199)
* Do not run tests outside test scope

* Fix tests

* Fix type errors and remove potentially precarious uses of unreachable

* yoops

* Remove all instances of "Ruh roh"

---------

Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
2024-04-16 14:03:02 -07:00
Jarred Sumner
fbe2fe0c3f Bump 2024-04-15 21:32:17 -07:00
Dylan Conway
5a81dc8e33 fix(install): fix dependency install order (#10240)
* packages wait for parent trees before install

* use `directoryExistsAt`

* missing increment

* fix faccessat

* swap destination and target

* update

* force

* only create destination dir before installing package

* fix windows symlink/junction

* increment, false on extracting

* done
2024-04-15 18:29:34 -07:00
Georgijs
24a411f904 Correctly handle duplicate column names in sqlite joins (#10285)
* add tests

* working

* cleanup

* fix compile

* fix naming and comment

* fix lints in test

* apply suggested fixes
2024-04-15 14:02:28 -07:00
Jarred Sumner
3f10d5250a [bun:sqlite] Support sqlite3_file_control, better closing behavior, implement Disposable (#10262)
* [bun:sqlite] Support `sqlite_file_control`, better closing behavior, support `using` statements

* docs+flaky test

* Simplify the implementation
2024-04-15 13:06:30 -07:00
Jarred Sumner
dd6beb66d8 [doc] Simplify this guide slightly 2024-04-15 07:45:07 -07:00
Grigory
233624b6ff fix(which/windows): ignore file extension case (#10102)
* fix(which/windows): ignore file extension case

* feat(which): add test for `endsWithExtension` fun

* Revert "feat(which): add test for `endsWithExtension` fun"

This reverts commit fb3ad51de7.

* add test

---------

Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-04-15 05:03:44 -07:00
Georgijs
fdcc844027 fix path resolution for writeFile in nodefs (#10179)
* fix path resolution for writeFile in nodefs

* add test

* [autofix.ci] apply automated fixes

* use force copy

* fix build

* fix test on windows

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-15 05:02:09 -07:00
Ciro Spaciari
74d91f6b51 feat(SSL_renegociate) (#10256)
* allow client renegotiation and allow server renegotiation with limits matching nodejs behavior

* wip before the refactoring and context separation

* investigate if BoringSSL can send a SSL_renegotiate request or only accept

* format-off

* option to disable server renegotiation

* allow tls options on https

* dead_socket when connectError

* propagate cert error

* test

* move the logic to the right place

* cleanup

* Update test/js/node/tls/renegotiation.test.ts

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-04-15 05:00:41 -07:00
Jarred Sumner
9f81a6268e Fixes #10259 (#10260) 2024-04-14 03:07:18 -07:00
Jarred Sumner
7b5065c1c9 Use internal setup-bun action
We do not want metrics to come from internal usage. CC @Electroid please remember this going forward.
2024-04-13 05:03:37 -07:00
Jarred Sumner
21ad40e86c Allow SSL negotiation for clients (#10239)
@lithdew
2024-04-13 02:43:10 -07:00
Jarred Sumner
c59f49385f Make Command.Context a pointer (#10237) 2024-04-13 01:53:31 -07:00
Jarred Sumner
8d49a3ee37 Better way to check if a directory exists (#10235)
* Better way to check if a directory exists

* Update sys.zig

* Fix windows build

* Add missing file
2024-04-12 22:19:29 -07:00
Ciro Spaciari
f6b9c0c909 fix(socket) fix error in case of failure/returning a error in the open handler (#10154)
* fix socket

* one more test

* always clean callback on deinit

* Update src/bun.js/api/bun/socket.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* make context close private

* keep old logic

* move clean step to SocketContext.close

* add comment

* wait for close on stop

* cleanup

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-12 20:58:45 -07:00
Jarred Sumner
65d8288d81 Revert "fix create with github URL on windows (#10231)" (#10236)
This reverts commit 1820d08d25.
2024-04-12 20:55:51 -07:00
Ciro Spaciari
4627af5893 fix(stream) fix http body-stream sending duplicate data (#10221)
* some fixes

* cleanup

* more complete test

* fix test + use same server

* opsie

* incremental steps
2024-04-12 19:58:13 -07:00
Dylan Conway
176af5cf58 reachable errors (#10190)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-12 19:02:45 -07:00
Georgijs
1820d08d25 fix create with github URL on windows (#10231)
* correctly ignore error on windows to match posix behavior

* replace zig accessat with bun.sys.existsAt

* fix posix build
2024-04-12 17:12:44 -07:00
Georgijs
472bd6c7de Allow fs.close with no callback (#10229)
* allow fs.close to only take one argument

* add test

* fix tests on windows
2024-04-12 17:11:58 -07:00
Georgijs Vilums
d785d30eaf return correct error code on overlong paths 2024-04-12 15:52:06 -07:00
Georgijs
22d6227a3a fix wrong truncation on fs.writeFileSync with fd argument (#10225)
* fix wrong truncate

* close fd in test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-12 13:02:24 -07:00
Meghan Denny
70023bc4ed linter: ergonomics and new rules (#10197)
* linter: allow a trailing field

* linter: dont fail if no matches are found

* lint: only import 'bun' once

* lint: ban std.mem.indexOfAny

* linter: ignore commented out code and ignore benchmarks

* this was testing nothing

* lint: ban std.debug.print

* this wasnt testing anything either
2024-04-11 22:26:23 -07:00
Jarred Sumner
19da72fe34 Truncate failing output in internal test runner 2024-04-11 21:30:07 -07:00
Meghan Denny
7d673dd7d8 node:child_process: fix propagation of windowsHide and windowsVerbatimArguments option (#10193) 2024-04-11 20:24:47 -07:00
Meghan Denny
ca98138936 add 'build:windows' package.json script for easier local dev (#10194) 2024-04-11 20:24:03 -07:00
Jarred Sumner
d00b5b94ea Make receiving data over TCP faster on Windows (#10191) 2024-04-11 20:10:09 -07:00
Georgijs
ff5ef512c7 correctly handle --cwd flag (#10187)
* actually change cwd on posix

* add test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-11 19:22:29 -07:00
Georgijs
545cb546cc feat(cli): --filter flag (#8185)
* Skeleton code for `bun run --workspace`

* Update run_command.zig

* implement directory traversal to find workspace root

* finish --workspace implementation

* clean up changes in run_command.zig

* add workspace tests, update harness to handle nested dirs

* [autofix.ci] apply automated fixes

* basic filtering

* [autofix.ci] apply automated fixes

* working filter without patterns

* update tests, filter mostly working

* simplify package name parsing, commit tests

* support filter even without workspace setup

* move filter arg handling to separate source file

* use bun.sys.chdir, match root package for scripts

* fix exit code handling

* ignore node_modules and directories starting with . in --filter

* progress converting --filter to use iterators

* convert filtering to use iterators

* cleanup

* implement DirEntry access method for glob (currently crashing)

* cleanup and fixes

* run js files in subprocess when filter flag passed

* clean up dead code

* fix fd leak in run_command.zig

* [autofix.ci] apply automated fixes

* fix issues after merge

* use posix-spawn in runBinary, fix resource PATH variable resource leak

* move filter argument to runtime category

* fix test harness

* add js and binary tests to filter-workspace

* [autofix.ci] apply automated fixes

* fix compile after merge

* [autofix.ci] apply automated fixes

* clean up filter-workspace test

* [autofix.ci] apply automated fixes

* fixes to running binaries

* fix actually setting cwd_override

* windows fixes

* address some review comments

* handle malformed JSON

* add various tests

* [autofix.ci] apply automated fixes

* update docs for filter

* [autofix.ci] apply automated fixes

* reset tinycc commit

* filtered run prototype

* make pretty

* implement abort handler (not working)

* make prettier

* prep for windows

* windows path and printing fixes

* implement log-style output (not tui)

* fix issues when logging to file

* revert a bunch of unecessary changes

* cleanup

* implement dependency order execution

* detect  circular dependencies, fix cancel hang

* Fix `$PATH`

* ignore dep order on loop, stream on linux, sort pkgs

* support pre and post scripts

* add more filter tests, print elapsed time

* enable 'bun --filter' without run

* fix harness after merge

* [autofix.ci] apply automated fixes

* print number of scripts we're waiting for

* update docs, fix windows build

* fix tests on windows

* [autofix.ci] apply automated fixes

* fix uninitialized memory

* use terminal synchronized update sequences

* Add skip list

* Preallocate

* Use current bun in tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-11 19:06:50 -07:00
Jarred Sumner
688844b472 refactor: ban std.debug.assert (#10168)
* Ban `std.debug.assert`

* Create .clangd

* Update lint.yml

* Update linter.ts

* update

* lint

* Update linter.ts

* Update linter.ts

* update

* Update linter.ts

* update

* Update linter.ts

* more

* Update install.zig

* words

* Remove UB
2024-04-11 17:52:29 -07:00
Georgijs
0f10d4f1be correctly ignore error on windows to match posix behavior (#10186) 2024-04-11 15:10:52 -07:00
Georgijs
c2ac5d4d18 fix example in bun add help text (#10185) 2024-04-11 15:10:33 -07:00
David Ferguson
edeb75a84a Reference .exists() in File-IO Docs (#9957)
* add mention of .exists()

* show that the exists method returns a promise in the docs

* remove unnecessary white space

* update type ref to show that exists returns a promise
2024-04-11 13:24:49 -07:00
Dale Seo
57208cb02e fix typos (#10131) 2024-04-10 12:32:47 -07:00
Evan Shortiss
5b4b6931c4 docs: add guide for neon serverless postgres driver (#10126) 2024-04-10 05:25:27 -07:00
Jarred Sumner
257f4c1b3e Bump zig std lib 2024-04-10 05:21:05 -07:00
Jarred Sumner
459bcdc5ac Concurrent uninstalls (#10111)
* Concurrent uninstalls

* Try disabling concurrency

* Get `rm` tests to pass on Windows

* Fix more things

* Undisable concurrency

* handle error

* Deflake

* [autofix.ci] apply automated fixes

* Undo

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-10 05:09:14 -07:00
Jarred Sumner
f5c8914c8a Re-sync URL from WebKit + set ERR_MISSING_ARGS (#10129)
* Update URL from WebKit

* Set `ERR_MISSING_ARGS` code on all Error objects from C++

* Fix the `code`

* [autofix.ci] apply automated fixes

* Micro optimize URL

* [autofix.ci] apply automated fixes

* Update url.mjs

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-09 23:21:11 -07:00
Jarred Sumner
1e20f618c9 [bundler] Do not generate sourceContents for non-javascript assets (#10140) 2024-04-09 23:18:09 -07:00
Meghan Denny
cd52f42148 windows: fs/promises: fix when writing to file opened in append mode (#10134)
* windows: fs/promises: fix when writing to file opened in append mode

* add default values since we're using one now

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-09 22:57:10 -07:00
Jarred Sumner
21fc1f7295 Add test for #10132 (#10136)
* Add test for #10132

* Update 010132.test.ts

* Update 010132.test.ts
2024-04-09 22:51:22 -07:00
Meghan Denny
e209ae81dd meta: ensure there's a single 'bun' import per file in zig (#10137)
* meta: ensure there's a single 'bun' import per file in zig

* undo this change in codegen
2024-04-09 22:41:07 -07:00
Meghan Denny
698d0f7c87 fix vscode json handling in prettier (#10133) 2024-04-09 20:42:42 -07:00
Zack Radisic
baf0d7c40f shell: Fix escaped newlines and add more tests (#10122)
* Fix multiline args and add more tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-09 17:25:10 -07:00
Dale Seo
81d021794e stdout and sterr are in err (#10130) 2024-04-09 16:42:23 -07:00
John-David Dalton
769d7a1680 fix: null is not an object at readableStreamCancel (#10091)
* fix: null is not an object at readableStreamCancel

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-09 14:02:23 -07:00
Jarred Sumner
df49a5a8e4 Upgrade AbortSignal & AbortController to latest from WebKit (#10106)
Fixes https://github.com/oven-sh/bun/issues/9977
Closes https://github.com/oven-sh/bun/pull/10086

Thank you @lithdew for investigating and most of the fixes. This adds more of the changes we missed from WebKit into Bun like the ability to follow other signals

Co-authored-by: Kenta Iwasaki <63115601+lithdew@users.noreply.github.com>
2024-04-09 00:49:13 -07:00
Meghan Denny
0dc0919119 vscode: dont hide submodules from file tree (#10104) 2024-04-08 23:54:53 -07:00
Meghan Denny
e30a848c4c vscode/settings: force prettier to use workspace config file 2024-04-08 19:02:40 -07:00
Dylan Conway
c739c4adeb unset ENABLE_VIRTUAL_TERMINAL_INPUT (#10089) 2024-04-08 18:19:52 -07:00
Grigory
00933d597a docs(contributing): add link to guide for windows (#10095)
* docs(contributing): add link to guide for windows

* fix broken link

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-04-08 15:43:40 -07:00
Jarred Sumner
5baa2fbb87 Use a different cache dir in each test file 2024-04-08 07:39:21 -07:00
Jarred Sumner
2615dc742e Partial fix for #10028 (#10030)
* Partial fix for #10028

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-08 07:32:43 -07:00
Jarred Sumner
a4e8534779 Use a separate cache dir for this test 2024-04-08 07:31:05 -07:00
Jarred Sumner
9380e99e2b Fixes #9952 (#10069)
* Fixes #9952

* Update CMakeLists.txt

* Update CMakeLists.txt

* linux

* isolate this test
2024-04-08 07:27:07 -07:00
Yoav Balasiano
9898e0a731 Improve bun shell docs examples (#10052) 2024-04-08 06:48:21 -07:00
Juan Pablo Rinaldi
ad6aadf7b2 Fix coverage documentation (#10059) 2024-04-08 06:47:43 -07:00
Jarred Sumner
ee05bae2be Make bun install 60% faster on Windows, improve reliability, reduce memory usage (#10037)
* [bundows] Make bun install 60% faster

* [autofix.ci] apply automated fixes

* Do not keep node_modules folder open between async tasks. Make sure we call runTasks on every event loop wakeup.

* Update install.zig

* Fix deadlock

* Make that deadlock impossible

* a little less repetitive

* Fix test failure with local tarball

* Get those tests to pass

* Normalize absolutely

* lets see how many times we call GetFinalPathNameByHandle

* Workaround https://github.com/ziglang/zig/issues/19586

https://github.com/ziglang/zig/issues/19586

* Is the dev-server-100 test failure a hash table collision?

* Give it its own cache dir

* We cannot change the git task ids

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-08 06:25:24 -07:00
Jarred Sumner
d615c11a57 Force non-zero exit code whenever bun install has any packages which failed to install (#10041)
* If any failed to install, always exit with non-zero

* [autofix.ci] apply automated fixes

* This test should fail

* Update bun-link.test.ts

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-07 16:12:16 -07:00
Jarred Sumner
3679f69b70 Disable assertion on Windows 2024-04-06 15:19:52 -07:00
Tomer Horowitz
0b0bf353fa docs: Updated Bun.nanoseconds documentation (#9986) 2024-04-06 02:47:47 -07:00
Giorgio Bellisario
c4847f464e fix typo: missing "v" prefix on installed Bun version (#9941) 2024-04-05 19:17:32 -07:00
Jarred Sumner
c8d072c2a9 Fixes #9978 (#9995) 2024-04-05 17:42:34 -07:00
dave caruso
f014f35531 fix(windows): use bun.spawnSync for bun upgrade + different check for bun (#10006)
* small changes

* [autofix.ci] apply automated fixes

* fxifsdahjfkdsahjk

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-05 17:30:32 -07:00
Meghan Denny
fd3cd05647 shell: more builtin commands (#9908)
* remove asString and improve fromString

* make writeNoIO return Maybe

* shell: add builtin command 'yes'

* shell: add builtin command 'seq'

* shell: yes+seq: fix usage string

* shell: add builtin command 'dirname'

* shell: add builtin command 'basename'

* add more tests

* update shell docs with list of commands

* add 'bun exec' launch configurations

* fix AsyncDeinitReader name

* fix 'yes' command IO

* shell: rewrite 'bun' to 'bun-debug' when self is bun-debug

* make the docs not lie about bun being a shell builtin

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-05 16:29:50 -07:00
Jarred Sumner
20085d8ddc Merge conflict fix 2024-04-05 15:41:45 -07:00
Jarred Sumner
5735feac5d Redo file watcher + Fix EBUSY when saving lockfile on Windows (#9972)
* Fix `EBUSY` when saving lockfile on Windows

* Redo file watcher wrapper on Windows

* Update lockfile.zig

* Update win_watcher.zig

* Update src/bun.js/node/node_fs.zig

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>

* Add retry logic

* Comments

* more careful

* smaller

* Fix garbage

* Normalize the paths

* hmmm

* [autofix.ci] apply automated fixes

* try

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-05 15:40:05 -07:00
dave caruso
4ba993be7e fix(install.ps1): change cpu check (#9921) 2024-04-05 15:35:46 -07:00
sitiom
0b2bb1fdc1 docs: add scoop installation method (#9818)
* docs: add scoop installation method

* Update installation.md

* Add upgrade and uninstall instructions

* Update installation.md

* add ps prompt to code blocks

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-04-05 14:55:19 -07:00
Dylan Conway
b29cf75a24 fix(install): allow installing without lockfile with --production (#9923)
* check for not_found lockfile load result

* Fix tests

* update tests

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-05 14:54:57 -07:00
Eric L. Goldstein
05fb044577 Add types for node:util styleText() (#9945) 2024-04-05 13:31:50 -07:00
Jarred Sumner
8825b29529 bump webkit (#9997)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-05 12:09:27 -07:00
Dylan Conway
182b90896f fix(parser): handle empty type parameters and conditional union/intersection bugfix (#9964)
* tests

* allow_empty_type_parameters

* pass options through unions and intersections
2024-04-05 00:45:43 -07:00
Zack Radisic
40e33da4b4 Fixes (#9940) 2024-04-04 19:46:53 -07:00
Jarred Sumner
f393f8a065 bun install launch.json 2024-04-04 19:31:10 -07:00
Jarred Sumner
a09c421f2a ```sh-diff doesn't work 2024-04-04 08:48:51 -07:00
Jarred Sumner
ca1dbb4eb2 Revert "remove ENABLE_VIRTUAL_TERMINAL_INPUT (#9913)" (#9935)
This reverts commit 06ec233ebe.
2024-04-04 07:34:33 -07:00
Jarred Sumner
8a3b6f0439 Fixes #6730 (#9930)
* Fixes #6730

* Fix test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-04 07:26:53 -07:00
Jarred Sumner
e7d8abb263 Don't recommend something that doesn't work on windows 2024-04-04 04:51:53 -07:00
Dylan Conway
013bc79f62 ignore EndOfStream error (#9926) 2024-04-04 04:31:47 -07:00
Jarred Sumner
8326235ecc Ask for fewer permissions when opening directories (#9928)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-04 04:18:15 -07:00
Jarred Sumner
7543bf936a Add missing HasStaticPropertyTable structure flag 2024-04-04 01:36:18 -07:00
Dylan Conway
06ec233ebe remove ENABLE_VIRTUAL_TERMINAL_INPUT (#9913) 2024-04-04 00:30:20 -07:00
dave caruso
0cdad4bebb fix(bun-release): support windows in npm package (#9873)
* fix npm install on windows

* try again

* again

* copy less file

* revert changes

* remove package.json from git

* okay

* now?
2024-04-03 23:16:48 -07:00
Ashcon Partovi
14c23cc429 Define BUN_INSTALL_BIN in Dockerfiles
Fixes #8753
2024-04-04 13:24:53 +09:00
Ashcon Partovi
0dfbdc711a Remove python3 from slim and alpine Dockerfiles to match Node.js 2024-04-04 13:22:41 +09:00
Ashcon Partovi
3cde2365ea Do not format Dockerfiles 2024-04-04 13:22:11 +09:00
dave caruso
3cfb2816ac docs 2024-04-03 21:11:15 -07:00
Jarred Sumner
c8f5c9f29c Fixes #9851 (#9886)
* Fixes #9851

* Fix

* Fix
2024-04-03 21:02:02 -07:00
Jarred Sumner
00f27fbeec Get bunx tests to pass on Windows (#9729)
* Get bunx tests to pass on Windows

* wip

* WIP

* wip

* wip

* ads

* asdf

* makeOpenPath

* almost revert

* fix build

* enoent

* fix bun install git repos

* cleanup

* use custom zig stdlib from submodule

* update dockerfile to copy zig stdlib sources

* fix dockerfile, update gitmodules

* fix dockerfile

* fix build

* fix build

* fix symlinkat

* fix build

* fix build

* Remove usages of unreachable

* Fixup

* Fixup

* wip

* fixup

* Fix one of the bugs

* asd

* Normalize BUN_INSTALL_CACHE_DIR var

* Set iterable to false when we're about to delete

* Update bun.zig

* I still can't repro this outside CI

* i think that fixes it?

* fix posix compile

* factor out directory creation

* update all install methods to use InstallDirState

* move walker creation to init function

* fix error cleanup

* fix posix compile

* all install tests pass locally

* cleanup

* [autofix.ci] apply automated fixes

* Fix posix regressions

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-03 20:53:28 -07:00
Jarred Sumner
76795af695 Fixes https://github.com/oven-sh/bun/issues/9807 (#9875)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-03 20:27:50 -07:00
Zack Radisic
a4b151962a feat: Support subshells in Bun shell (#9905)
* fix #9823

* subshell

* Refactor a bit and add a lot of tests

* delete random code

* make tests pass on windows

* Cleanup

* add sharp test

* Resolve comments

---------

Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-03 20:27:20 -07:00
Ciro Spaciari
1cde9bcdac fix(server) fix body-stream (#9898)
* some fixes

* WIP

* wip wip

* more debug

* closer

* sending a really big payload at once is still broken

* now we need to avoid segfault happening inside onWritable after destroy

* opsie

* cleanup

* more cleanup

* more WIP, closer need to fix cork

* fix cork actually not writing non-optional data

* make onWritable return actually do something

* actually clean the on writable handler

* remove unreachable condition

* we are not looping anymore

* little revert

* fix possible fault

* inform backpressure on chunked encoding

* just queue when tryEnd

* remove unreachable code
2024-04-03 20:25:05 -07:00
Eric L. Goldstein
0bd7265e8f Remove documentation references to environment variable inlining because the bundler does not do so (#9901) 2024-04-03 18:14:20 -07:00
Dylan Conway
c831dd8db8 Upgrade webkit (#9885)
* span

* remove JSStringIsEqualToString

* bump webkit tag

* span literal

* undo

* fix windows build

* Update JSStringDecoder.cpp

* Update JSStringDecoder.cpp

* Update JSStringDecoder.cpp

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-03 17:10:39 -07:00
Jarred Sumner
390441327f Fixes #9778 (#9834)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-03 02:47:31 -07:00
Jarred Sumner
2e0e9f135b Fixes #9878 (#9883)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-03 02:47:13 -07:00
Jarred Sumner
36f1bd3694 Truncate source lines in error messages (#9832)
* Truncate source lines in error messages

* Update .prettierignore

* trim

* fix

* try

* fix

* 1 more time

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-03 02:46:10 -07:00
Ciro Spaciari
289d23b377 fix(uws) uWS uintmax_t > uint64_t (#9866)
* wip check this on Posix, probably better to used fixed types on uWS instead of uintmax_t here

* uintmax_t > u64
2024-04-03 01:57:33 -07:00
Meghan Denny
bb483e8479 shell: implement $0, $1, argv accessors (#9740)
* shell: organize imports

* shell: dont allocate when printing errors

* shell: implement $0, $1, argv accessors

* add more tests

* oops need this commit too

* make these logs listen to silencing logs

* expand switch else statements

* align behavior with bash

* this isnt referenced anywhere

* add missing test file

* add another test

* revert this change

* cache utf8 converted version of positionals

* rebase fixes

---------

Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
2024-04-02 23:07:27 -07:00
Meghan Denny
268f13765c ci: windows: use bun install (#9730)
* ci: windows: use bun install

* run the workflow

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-02 17:57:44 -07:00
Georgijs Vilums
801e475c72 update readme again 2024-04-01 09:37:48 -07:00
Georgijs Vilums
a073c85fdb update readme to include windows install command 2024-04-01 09:35:03 -07:00
dave caruso
8cb9f59753 update installation docs 2024-04-01 09:30:47 -07:00
dave caruso
5903a61410 Bun 1.1 2024-04-01 08:57:05 -07:00
dave caruso
b4941cdb0c not canary 2024-04-01 08:55:21 -07:00
Jarred Sumner
58417217d6 Tweak cleanup code in PipeReader for files (#9746)
* WIP: some fixes and improvements

* cleanup

* WIP: some fixes and improvements

* cleanup

* dont pause

---------

Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2024-04-01 08:53:39 -07:00
Jarred Sumner
2d57f25637 Bump 2024-04-01 08:52:24 -07:00
cirospaciari
83a99bf190 revert 2024-04-01 12:14:47 -03:00
cirospaciari
e2ffa66bf7 dont pause 2024-04-01 12:12:44 -03:00
Meghan Denny
8980dc026d shell: fix crash in 'ls' and other misc improvements (#9772)
* shell: ls: fix crash when passing argument

* shell: pwd: output was missing newline

* shell: exit: output was missing newline

* shell: pwd: make sure output goes to proper stdout/stderr

* add test ensuring all those work

* fix build error

* fix

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-04-01 07:54:42 -07:00
Jarred Sumner
4192728592 fix build (#9773)
Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2024-04-01 07:11:02 -07:00
Meghan Denny
bdfbcb1898 use bun shell for lifecycle scripts on windows [v3] (#9771)
* these comments were redundant

* better windows support here

* slightly better error message

* didnt realize this variable already existed

* fix node-gyp shim script

* move 'windows bin linking shim should work' to its own file

* run all lifecycle scripts on windows with bun shell

* tidy

* clean imports

* this seemed missing

* remove these comments

* fix the shim again

* fix posix release ensureTempNodeGypScript

* revert this change, it was correct before
2024-04-01 06:48:44 -07:00
Dylan Conway
6e07f9477c fix(streams): don't lose bytes on drain (#9768)
* fix

* clear

* update

* test

* fix test

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-04-01 05:23:47 -07:00
dave caruso
2dd2fc6ed0 install script 2024-04-01 04:02:26 -07:00
dave caruso
9e6e8b0234 feat(runtime): align import.meta.resolve with node.js's implementation (#5827)
* works

* works

* a

* fix zig compiler error

* fix things

* [autofix.ci] apply automated fixes

* a

* not done

* finish this

* [autofix.ci] apply automated fixes

* self check

* delete committed generated file (#9717)

* Fix bug with PipeWriter (#9714)

* fix!: do not lookup cwd in which (#9691)

* do not lookup cwd in which

* fix webkit submodule

* fix compilation on linux

* feedback

* default process.env.NODE_ENV to undefined (#9695)

* small changes

* [autofix.ci] apply automated fixes

* fix(windows) fix node-stream tests/ windows file reader/writer (#9718)

* fix canceled onFileRead

* report continue errors and fix closing

* also fix pipe writer

* avoid possible memory leaks

* Propagate errors in open

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* posix failures

* windows fixes

* avoid using c++ labels

* add a resolver

* fix compile test AGAIN

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-04-01 02:21:34 -07:00
Zack Radisic
d53e6d6323 feat: Shell if-else, conditional expressions, running commands in background (#9631)
* rename conditional -> binary

* Parse if clauses

* `if` works

* Conditional expressions

* Support If clause condition and branches multi-statements

* cond expr tests

* more

* Fix parse tests

* `&` commands

* clean up

* Make it compile for windows

* Fix test

* Remove If/Else/Elif/Then/Fi tokens

* Fix parsing ambiguities

* Resolve some comments

* More tests fix bugs

* Fix parsing and add more tests ported from GNU bash

* Fix `&`on left side of `&&` error message

* leak test fix hopefully

* todo some tests because `wait` is not implemented

* Disable background commands for now

* Resolve additional comments

* Fix merge conflicts

* Fix broken tests from merge

* Add `==` and `!=` and fix parsing bug

* wow

* fix 09401 test failing... forgot to update `this.inlined.len`

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-04-01 02:07:52 -07:00
Ashcon Partovi
1edacc6e49 Prepare npm i -g bun for Windows 2024-04-01 18:00:16 +09:00
dave caruso
81badbac4c fix(ipc): add json ipc type + buffer incoming messages until a listener is attached. (#8733)
* fix a few ipc issues

* a

* my own revisions

* remove none as a valid type

* a

* fix windows build

* remove comment

* make it work !!!!!!!!

* a

* formatter nonsense

* blah

* huge update refactor

* awa

* wow

* okay
2024-04-01 01:51:15 -07:00
Zack Radisic
7531bfbfe0 add bun exec (#9762)
* add `bun exec`

* Add tests for writing a lot of data for bun exec

* Resolve some comments

* fix on windows
2024-04-01 00:57:19 -07:00
Georgijs
1a989c9ad2 ref tls socket on upgrade (#9766)
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-03-31 21:32:25 -07:00
Chawye Hsu
ab7825cca5 windows: fix bun pm bin -g path not added complaining (#9763)
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
2024-03-31 17:55:36 -07:00
dave caruso
f02752577b fix: which should use cwd if given a relative filepath (#9761)
* Revert "fix!: do not lookup cwd in which (#9691)"

This reverts commit 4869ebff24.

* fix which implementation to be more accurate

* t

* which tests windows

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-31 16:50:16 -07:00
dave caruso
c177e054f5 feat!: shell will now throw on error by default (#9720)
* make the shell throw by default

* make shell default to throws(true)

* ok

* mv tests

* a

* a

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-31 16:13:59 -07:00
dave caruso
a01b01ae72 chore!: enable 1.1's breaking changes (#9724)
* root scripts in foreground

* ignore if silent

* test for breaking changes

* move back to installPackages

* [autofix.ci] apply automated fixes

* boolean variable, comptime, 1_1_0

* flip the 1.1 flag

* add for the next batch of breakings

* make it buidl

* enable breaking changes tests

* fix version fmt

* silent node-gyp

* comment change

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-03-31 16:12:59 -07:00
dave caruso
456a32344e windows: skip cleaning up old binary (#9696) 2024-03-31 16:12:21 -07:00
Jarred Sumner
6164fac256 Revert "pipe.signal.ptr == subprocess.stdin, not subprocess"
This reverts commit 4bbcc39d2f.
2024-03-30 22:55:28 -07:00
Jarred Sumner
4bbcc39d2f pipe.signal.ptr == subprocess.stdin, not subprocess 2024-03-30 22:10:26 -07:00
Meghan Denny
62c8c97e24 add test.todoIf and fix bun-install-registry.test.ts on windows (#9723)
* bun:test: implement test.todoIf and describe.todoIf

* fix bun-install-registry.test.ts and mark some as todo

* add even more tests

* remove todoIf from this file

* [autofix.ci] apply automated fixes

* fix regression

* this extra expect was incorrect

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-30 21:25:05 -07:00
Jarred Sumner
eb708d34ae Fixes #9748 (#9751)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 21:23:34 -07:00
Jarred Sumner
c3ba60eef5 Fixes #9739 (#9752)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 20:57:40 -07:00
Meghan Denny
7f71f10ad1 import-meta.test.js: isolate the query param test into separate cases for esm and cjs (#9750)
* import-meta.test.js: isolate the query param test into separate cases for esm and cos

* make name more accurate
2024-03-30 20:09:01 -07:00
Jarred Sumner
9939049b85 Fixes #5319 (#9745)
* Fixes #5319

* Make this test better

* another test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 20:08:34 -07:00
Meghan Denny
a5c5b5dc61 console-iterator.test.ts: add a case that only uses latin1 characters (#9749) 2024-03-30 18:16:10 -07:00
Ciro Spaciari
a2835ef098 fix(websockets) fix socket/websockets (#9645)
* repro

* cleanup

* avoid shutdownRead on SSL

* still dont fix

* more

* some ssl

* cleanup

* handle shutdown

* make actually pass the tests

* fix STATUS_STACK_BUFFER_OVERRUN?

* revert some, cleanup fetch.tls.test

* make clear why we need on_handshake when closing

* more

* revert

* cleanup

* cleanup + less Bun.gc

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-30 16:32:19 -07:00
Jarred Sumner
31c4c59740 Make duplicate simultaneous bun install work better (#9738)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 14:06:37 -07:00
Jarred Sumner
0248e3c2b7 Add NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT=1 (#9742)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 14:03:52 -07:00
Jarred Sumner
d869fcee21 Fixes #7896 (#9712)
* Fixes #7896

* Update ws.test.ts

* Delete the old one

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-30 04:27:00 -07:00
dave caruso
55f8ae5aea feat(windows): properly implement setRawMode (#9734)
* setRawMode rewrite for Windows

* work on posix using old approach

* [autofix.ci] apply automated fixes

* no print

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-30 04:06:23 -07:00
Meghan Denny
e414d107e6 ci: windows: show all failing files (#9736)
* ci: windows: show all failing files

* fix workflow variables

* fix workflow v2
2024-03-30 02:00:24 -07:00
Meghan Denny
0103e2df73 windows: pass bunshell.test.ts (#9733) 2024-03-30 01:58:28 -07:00
Jarred Sumner
02ad501f9e Add missing globs 2024-03-29 23:40:13 -07:00
saklani
d433a1ada0 fix: Define missing crypto.constants defined on Node (#9511)
* define crypto.constants

* requested changes

* fix: missing jsNumber wrap

---------

Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-03-29 21:53:52 -07:00
dave caruso
d712254128 internal: remove secret hidden internals and introduce new way to call native code from js (#8166)
* oooooh magic

* stuff

* run format

* ok

* yippee

* run the formatter back

* finish things up

* fix webkit

* more

* [autofix.ci] apply automated fixes

* fix compile

* fix compilation on windows, it seems to not work though :(

* update

* a

* v

* ok

* [autofix.ci] apply automated fixes

* OOPS

* bump bun to reduce ci bugs

* a

* js2native is done!

* improve array binding

* rebase

* some final stuff

* wasi fixes

* os

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-29 21:47:11 -07:00
Meghan Denny
a500c69728 shell: implement 'true' and 'false' builtin commands (#9728) 2024-03-29 21:36:13 -07:00
Dylan Conway
d30b53591f fix(napi): fix finalizer callback (#9732)
* fix finalize callback

* fix test
2024-03-29 21:33:48 -07:00
Meghan Denny
b8389f32ce shell: add 'exit' builtin command (#9705)
* shell: add 'exit' builtin command

* remove loop here

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-29 18:20:44 -07:00
Dylan Conway
7172013a72 fix(windows): use extended max path prefix for hardlinks during install (#9721)
* uncomment code

* use GetFinalPathNameByHandleW

* add packages with large names

* delete

* test large package name
2024-03-29 18:13:39 -07:00
Jarred Sumner
8ff7ee03d2 stdio tweaks (#9726) 2024-03-29 18:11:47 -07:00
dave caruso
5296c26dab fix bunx-bins verdaccio package (#9697)
* fix bunx-bins verdaccio package

* env suck

* [autofix.ci] apply automated fixes

* ugh

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-29 17:55:06 -07:00
Jarred Sumner
da6826e2b7 Unmark known failing 2024-03-29 17:49:29 -07:00
Jarred Sumner
a637b4c880 Unmark known failing 2024-03-29 17:49:03 -07:00
Ciro Spaciari
d9074dfa5d fix(windows) fix node-stream tests/ windows file reader/writer (#9718)
* fix canceled onFileRead

* report continue errors and fix closing

* also fix pipe writer

* avoid possible memory leaks

* Propagate errors in open

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-29 16:58:55 -07:00
dave caruso
ba9834d746 default process.env.NODE_ENV to undefined (#9695) 2024-03-29 16:42:50 -07:00
dave caruso
4869ebff24 fix!: do not lookup cwd in which (#9691)
* do not lookup cwd in which

* fix webkit submodule

* fix compilation on linux

* feedback
2024-03-29 16:42:17 -07:00
Jarred Sumner
a9804a3a11 Fix bug with PipeWriter (#9714) 2024-03-29 16:11:24 -07:00
Meghan Denny
6bedc23992 delete committed generated file (#9717) 2024-03-29 15:53:11 -07:00
dave caruso
093e9c2499 ci: does this fix the windows build (#9715)
* does this fix the windows build

* [autofix.ci] apply automated fixes

* a

* enable tar oop

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-29 15:20:13 -07:00
dave caruso
3047c9005e fix: add a better error message for fetch when it fails with an unknown code (#9663)
* add a better error message for fetch when it fails with an unknown code

* Update src/bun.js/webcore/response.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* [autofix.ci] apply automated fixes

* fix compilation

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-29 14:18:11 -07:00
Jarred Sumner
e80e61c9a3 Allow 0-length ArrayBuffer & Blob in Bun.spawn stdio (#9557)
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-03-29 13:51:45 -07:00
Meghan Denny
e3bf906127 memoize all calls to selfExePath (#9703)
* memoize all calls to selfExePath

* Fix threadsafety issue

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-29 13:29:42 -07:00
Walter
4e7ed173ef fix!: remove worker from default conditions (#9256)
Co-authored-by: Walter Blacke <walter.blacke@vegabyte.studio>
2024-03-29 13:22:42 -07:00
Jarred Sumner
31befad163 Workaround for #9041 (#9580)
* Workaround for #9041

* Fix crash with auto install

* Fixup this test

* Update 09041.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-29 13:17:12 -07:00
Meghan Denny
94b01b2f45 test: pm: don't delete temporary directories (#9649) 2024-03-29 12:29:50 -07:00
PondWader
9ecb691380 Fix URL.canParse.length (#9710)
* Fix URL.canParse.length

* Add URL.canParse.length test

---------

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-03-29 12:21:49 -07:00
Meghan Denny
fb8a299765 shell: windows: make EnvMap case-insensitive (#9704)
* shell: windows: make EnvMap case-insensitive

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-29 12:21:09 -07:00
dave caruso
40f61ebb91 fix: EnvStr.initSlice handles zero length strings more reliably. (#9698)
* fix intcast on ptr value of zero-length strings

* Make this better

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-28 22:17:20 -07:00
Jarred Sumner
4512a04820 Add missing code to TextDecoder "Invalid byte sequence" error (#9700)
* Fix missing `ERR_ENCODING_INVALID_ENCODED_DATA` code in TextDecoder

* Update text-decoder.test.js

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-28 22:06:40 -07:00
Dylan Conway
1ad6a3dfb9 fix(http2): fix crash in http2 tests (#9676)
* add the settings

* dont crash on unsupported settings

* add missing property

* less flaky tests

* comment

* Update test/js/node/http2/node-echo-server.fixture.js

* Update test/js/node/http2/node-http2-memory-leak.js

* Update test/js/node/http2/node-http2-memory-leak.js

---------

Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-28 21:39:40 -07:00
dave caruso
1ae9f998f4 alternate approach to env fix (#9689)
* alternate approach to env fix

* rename variable

* Revert "rename variable"

This reverts commit 2374bcd487.

* a

* we pass on window

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-28 21:30:49 -07:00
dave caruso
d113803777 add server ws.terminate (#9693)
* add server ws.terminate

* [autofix.ci] apply automated fixes

* it has to be blazing fast

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-28 18:17:55 -07:00
Jarred Sumner
aaef6d350a Fix unlikely edgecase in WebSocket client (#9694)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-28 17:45:39 -07:00
dave caruso
0751581e86 bump: Bun v1.0.36 2024-03-28 17:42:06 -07:00
Zack Radisic
c510daac55 Fix shell regressions part 2 (#9684)
* Fix undefined memory on subprocess exit immediately and fix crash when writing a lot of data

* format

* Test for #9458

* Document

* Lazily create iowriters (i think this solves fdleak tests?)

* Fix `big_data` test hanging

* I think this make leak tests more stable

* accidentally had deinit in another thread

* oops

* Fixes

* shell `big_data` test redirect to file

* stuff

* Fix windows /dev/null

* Increase timeout

* Resolve comments and better input test
2024-03-28 17:31:43 -07:00
Jarred Sumner
ec66b07720 Make bun meta more helpful (#9690)
* Make `bun meta` more helpful

* More tweaks

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-28 15:55:47 -07:00
dave caruso
b53147ad97 docs: update contributing page 2024-03-28 13:15:56 -07:00
Jarred Sumner
dea877f19b Revert "Fix some shell regressions (#9630)" (#9670)
This reverts commit aee8eeaf45.
2024-03-27 20:56:54 -07:00
Jarred Sumner
d66ace959d Use &= ~ instead of ^= 2024-03-27 20:27:16 -07:00
Jarred Sumner
db1283e982 Fixes #9669 2024-03-27 20:09:31 -07:00
Jarred Sumner
79ced2767a Let's try calling close_range CLOSE_RANGE_CLOEXEC starting on 4 instead of 0 2024-03-27 19:16:23 -07:00
Ashcon Partovi
081c7fff00 Add missing aliases to expect() types 2024-03-27 18:28:48 -07:00
Dylan Conway
8a12c2992b fix(windows): fix prompts.test.ts (#9650)
* remove comment

* fix prompt test

* more time like leaky case

* remove comments

* fixed

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-27 16:49:33 -07:00
Dylan Conway
306b87e929 fix(test): fix crash in expect.toHaveProperty (#9653)
* make sure string doesnt unref

* use String and assign to variable
2024-03-27 16:48:44 -07:00
Stefan Buhrmester
fcd7b01dba add await to Bun.plugin(...) (#9665) 2024-03-27 16:47:40 -07:00
Eduard
9f20d40678 Fix docs for dynamic linking of libatomic (#9646) 2024-03-27 15:01:41 -07:00
Ciro Spaciari
d030cce8bb fix(windows) socket and timers/performance tests (#9651)
* WIP missing keepalive

* cleanup

* is a Bun.sleep bug?

* no bun sleep

* fix exception

* revert

* fix setTimeout/Bun.sleep

* add Bun.sleep keepalive test

* fixes

* one more bonus fix

* fix early firing of timers

* use localhost and pass the server.hostname

* opsie
2024-03-27 10:31:12 -07:00
Zack Radisic
aee8eeaf45 Fix some shell regressions (#9630)
* Fix undefined memory on subprocess exit immediately and fix crash when writing a lot of data

* format

* Test for #9458

* Document

* Lazily create iowriters (i think this solves fdleak tests?)

* Fix `big_data` test hanging

* I think this make leak tests more stable

* accidentally had deinit in another thread

* oops

* Fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-27 09:33:38 -07:00
Jarred Sumner
a9ad303fe2 Add test for fs.writev & fs.readv (#9632)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-27 09:00:39 -07:00
dave caruso
e808cdb725 windows: fix argument handling in bin shim (#9622)
* awa

* update v5

* a

* [autofix.ci] apply automated fixes

* tarball

* a

* a

* blah

* [autofix.ci] apply automated fixes

* bump

* wah

* [autofix.ci] apply automated fixes

* farther

* a

* [autofix.ci] apply automated fixes

* im confused

* [autofix.ci] apply automated fixes

* Fix typo (#9623)

* Fix crash in Bun.escapeHTML (#9619)

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>

* Fixes #9610

* Implement `fs.openAsBlob` (#9628)

* Implement `fs.openAsBlob`

* Use a function

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>

* Fix `bun install -g` not working on Docker
Closes #8753

* Revert "Fix `bun install -g` not working on Docker"

This reverts commit 20fce1a1be.

* what happens if nonblocking tty (#9608)

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>

* merge

* a

* blah

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: sequencerr <45060278+sequencerr@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-03-26 22:38:01 -07:00
Jarred Sumner
1675349667 what happens if nonblocking tty (#9608)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-26 13:53:58 -07:00
Ashcon Partovi
264b4be44a Revert "Fix bun install -g not working on Docker"
This reverts commit 20fce1a1be.
2024-03-26 10:41:28 -07:00
Ashcon Partovi
20fce1a1be Fix bun install -g not working on Docker
Closes #8753
2024-03-26 10:39:40 -07:00
Jarred Sumner
fa145b2218 Implement fs.openAsBlob (#9628)
* Implement `fs.openAsBlob`

* Use a function

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-25 17:21:11 -07:00
Jarred Sumner
c8cc134edb Fixes #9610 2024-03-25 15:17:45 -07:00
Jarred Sumner
d9b7b45080 Fix crash in Bun.escapeHTML (#9619)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-25 14:37:20 -07:00
sequencerr
43ab5313da Fix typo (#9623) 2024-03-25 14:26:47 -07:00
Dylan Conway
c7289b2cd6 fix(windows): fix a few more tests (#9550)
* fix napi tests

* only windows, update passing tests

* remove closing remainder

* fix child_process-node.test.js

* might fail in ci

* oops

* fix dns tests

* remove comment

* sometimes it is slow

* update test

* maybe fix timeout error

* one more try

* off by one, valid npm package name

* update test

* fix hot tests

* revert

* remove close
2024-03-25 13:34:08 -07:00
Dylan Conway
e39a7851c8 fix(install): package binary map bugfix (#9621) 2024-03-25 12:49:52 -07:00
Jarred Sumner
ccaacdc56c Fix incorrect GETFD and O_NONBLOCK setting (#9607)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-24 20:26:08 -07:00
Jarred Sumner
c57cd5b6cd Update shell.md 2024-03-24 18:44:06 -07:00
Jarred Sumner
c71325b52e Fix regression with console.log in --watch on linux (#9601)
* Fix regression with console.log in --watch on linux

* Unset CLOEXEC

* more

* Enable inheritance on windows

* Don't forget to close the handles...

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-24 18:38:41 -07:00
Jarred Sumner
2765347b65 Enable more C++ warnings (#9602)
* Enable more C++ warnings

* Only enable these ones in release builds

* Update MessagePortChannel.cpp

* Update BunProcess.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-24 17:28:58 -07:00
Jarred Sumner
39d1287f03 Port #9278 (#9596)
* Port #9278

Co-Authored-By: argosphil <argosphil@murena.io>

* Fix incorrect type

Co-Authored-By: argosphil <argosphil@murena.io>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: argosphil <argosphil@murena.io>
2024-03-24 12:21:11 -07:00
Jarred Sumner
d8a09d8517 Remove known-failing-on-windows 2024-03-24 12:13:24 -07:00
Jarred Sumner
e8bb3389ef Tweak how we handle bun's process initialization (#9588)
* Tweak how we handle bun's process initialization

* Update panic_handler.zig

* Update output.zig

* Update __global.zig

* Update __global.zig

* Delete WindowsSpawnWorkaround, fix tests

* Fix bug in Bun.spawn on Linux when O_CLOEXEC is set on stdin stdout or stderr

* More errors

* tweak

* Bounds check

* Update install.zig

* Update dependency.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-03-24 12:09:16 -07:00
David Legrand
73fc225c4c docs: bun shell .sh loader fix (#9592)
`.sh` file loader is working with `.bun.sh` files, not `.sh` files as stated in the documentation
2024-03-24 11:17:00 -07:00
HT
0eb638c899 Update executables.md (#9593)
Bun build with `--compile` flag supports `--external` flag. Tested on bun `1.0.33` and it works
2024-03-24 11:15:19 -07:00
pfg
ee5fd51e88 Fix bundling for bun not using ascii_only (#9571)
* Fix bundling not using ascii_only

* add utf8 test to bundler_compile & make test source ascii

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-23 00:04:36 -07:00
dave caruso
73a55cf075 windows: make more windows tests pass (#9370)
* run-eval.test.ts

* transpiler-cache.test.ts

* node net

* some open things

* a

* a

* yikes

* incredible

* run it back

* a

* this code is what i like to call, incorrect

* ok its all worng

* remove an assertion that is wrong again

* update test things and rebase

* performance test

* mark filesink with mkfifo as todo. see #8166

* hehe

* not done

* awa

* fs test pass

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-22 23:40:45 -07:00
kunoka
32174a2a44 fix: added awaits in Bun.connect calls (#9574) 2024-03-22 20:46:50 -07:00
Xin Chen
71113182c2 fix(init): cannot find console in blank project (#9462)
* Fix cannot find console in default project

* Update src/cli/tsconfig-for-init.json

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-03-22 10:23:06 -07:00
Jarred Sumner
940448d6b6 add regression test 2024-03-22 07:58:27 -07:00
Jarred Sumner
be4b47d49d Fixes #9563 (#9566)
* Remove flag in a test

* Get this test file to run in jest again

* Fixes #9563

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-22 07:50:00 -07:00
Meghan Denny
f90bb7719b windows: test\js\bun\test\test-test.test.ts passes (#9554) 2024-03-22 00:34:53 -07:00
Jarred Sumner
7276ff9935 Make .decode(a, {stream :true}) slightly faster in TextDecoder 2024-03-22 00:30:50 -07:00
Jarred Sumner
2d61c865fc Replace some of std.ChildProcess with bun.spawnSync (#9513)
* Replace some of std.ChildProcess with bun.spawnSync

* Update process.zig

* Fix some build errors

* Fix linux build

* Keep error

* Don't print a mesasge in this case

* Update spawn.test.ts

* Make `bun install` faster on Linux

* Comments + edgecases

* Fix the tests

* Add bun install launch.json

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-03-21 23:50:48 -07:00
Dylan Conway
7e3e7d2ed4 enable autoinstall, fixup tests (#9539) 2024-03-21 21:12:54 -07:00
Jarred Sumner
b24d3ba5be Fix build 2024-03-21 11:05:52 -07:00
Jarred Sumner
c6f22de360 Make the version number bigger 2024-03-21 10:44:18 -07:00
Jarred Sumner
e124f08caf A few fixes related to CommonJS module loading (#9540)
* Ensure we always deref the source code

* Move more work to concurrent transpiler

* Update NodeModuleModule.h

* Update string.zig

* Make `Bun.gc()` more effective

* Update text-loader-fixture-dynamic-import-stress.ts

* Update ZigSourceProvider.cpp

* Fixes #6946

* Update ModuleLoader.cpp

* Update ModuleLoader.cpp

* Fixes #8965

* Fixups

* Update ModuleLoader.cpp

* Update ModuleLoader.cpp

* Load it

* Update module_loader.zig

* Update module_loader.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-21 10:42:57 -07:00
Jarred Sumner
0948727243 Fixes #9521 (#9530)
* Fixes #9521

* Another test

* Update load-file-loader-a-lot.test.ts

* Update module_loader.zig

* comments

* Rename variable

* Update module_loader.zig

* Update exports.zig

* small cleanup

* bundows

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-21 00:06:24 -07:00
Paul Eboselume
650dc552d4 fixed typo (#9535) 2024-03-20 20:04:05 -07:00
Dylan Conway
3e86b38f32 fix(windows): waiter thread tests (#9538)
* use Bun.sleepSync

* argv0
2024-03-20 20:03:17 -07:00
Ashcon Partovi
cc4479096a Update lockfiles 2024-03-20 09:16:01 -07:00
Ashcon Partovi
d14c99510c Change macOS version check to be a warning, instead of error 2024-03-20 09:09:29 -07:00
Paul Eboselume
e1e3e41e0f Fixed a typo (#9529) 2024-03-20 09:00:36 -07:00
Jarred Sumner
d9496c3802 update bench 2024-03-20 07:16:32 -07:00
Dylan Conway
931e04b019 fix(install): hoisting bug with devDependencies (#9519)
* fix with tests

* move to hoisting describe scope

* Update bun-install-registry.test.ts
2024-03-19 21:46:54 -07:00
Dylan Conway
cee6be12cc test for #9472 and bun pm trust waiter thread bugfix (#9498)
* test max concurrent scripts

* stress test, waiter thread bugfix

* different verbose

* escape

* Update src/install/lockfile.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* resource usage test

* fix invalid pointer

* another test

* update test

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-19 21:46:03 -07:00
Jarred Sumner
a54264177b Fix coercion edgecase with i32 and i64 (#9518)
* Fix coercsion edgecase

* Add sleep test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-19 20:49:13 -07:00
Gabriel Nunes
5ed609f96b fix(docs): fix broken links in guides (#9512) 2024-03-19 17:59:19 -07:00
Dylan Conway
f15e7f733d Revert "fix invalid pointer"
This reverts commit 3df320d0ed.
2024-03-19 16:48:34 -07:00
Dylan Conway
3df320d0ed fix invalid pointer 2024-03-19 16:45:27 -07:00
Dylan Conway
bf0e5a82f7 fix(windows): install bugfixes for workspaces, tarballs, and relative paths (#8813)
* more tests

* update migration.zig

* fix up paths

* update tests

* update tests

* test

* test

* update registry tests

* comments

* early exit if stream is invalid

* dont pass invalid_fd to openFileAtWindows

* fix merge

* misc crash fix

* make this use optional pointers instead of 0xaa

* ensure absolute paths are propagated properly

* package.json expects forward slash

* this assert was invalid

* add panic checks

* pass bun-remove

* more panic checks

* test: pass bun-add

* querying these hangs outside bun too

* fix compile error from merge conflict resolution

* use compileError instead of comptime unreachable

* tidy

* bunx: check for the .exe bin extension

* bunx: another route to make cache path if it doesnt exist

* install: another case of FolderResolution.getOrPut expecting absolute path

* fix a bun install crash

* dont print zig stack trace if bun install fails

* test: pass bun-link

* test: bunx: add more expects

* test: bun-install-registry: pass

* test: bun-install: pass

* test: bun-pm: pass

* fix merge main error

* fix posix tests

* fix last failing test in bun-install.test.ts
symlink difference between platforms

* bun-install-registry.test.ts fix

* bun-run.test.ts: remove stray console log

---------

Co-authored-by: Meghan Denny <meghan@bun.sh>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-18 22:34:15 -07:00
Dylan Conway
06f04b584c fix(install): default trusted dependencies on windows (#9500)
* make sure source data is set too

* make default trusted dependencies work

* undo

* test

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-18 19:40:11 -07:00
Jarred Sumner
76ced7c6ed WIP Make process.stdout sync on windows (#9398)
* Make some things sync on windows

* WIP

* WIP

* remove uses to uv_default_loop

* remove a compiler warning on windows

* edfghjk

* Windows build fixes

* Fixup

* bundows

* Add quotes

* Fix --cwd arg on Windows

* comment

* move this up

* Fix some tests

* `mv` tests pass

* spawn.test passes again

* Allow .sh file extension for Windows

* Unmark failing tests

* env test pass

* windows

* Fix some tests

* Update ProcessBindingTTYWrap.cpp

* Update CMakeLists.txt

* Set tmpdir

* Make it 5s on windows

* Fixup

* Fixup

* Update ProcessBindingTTYWrap.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-03-18 19:35:34 -07:00
Meghan Denny
e1593ce2e5 docs: api/ffi improvements (#9496) 2024-03-18 18:25:26 -07:00
Jarred Sumner
9e91e137f1 check is callable in util promisify timers (#9482)
* Update CMakeLists.txt

* Check is callable in util promisify

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-17 21:39:39 -07:00
Cezary Kupaj
4dd61bfd20 Fix crypto module to have proper id values for sign function (#9248)
* Fix crypto module to have proper id values for sign function

* Revert adding id hash to DSA sign functions - DSA algorithm doesnt use it

* Add tests for crypto.createSign() and crypto.verifySign()

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-17 21:13:43 -07:00
nellfs
ca97a757bb Development environment documentation for openSUSE Tumbleweed (#9479)
* Add openSUSE Tumbleweed to the list of supported Linux distributions in CMakeLists.txt

* openSUSE Tumbleweed setup

* Revert "Add openSUSE Tumbleweed to the list of supported Linux distributions in CMakeLists.txt"

This reverts commit 93faed88a1.

---------

Co-authored-by: nellfs <nellfs@localhost.localdomain>
2024-03-17 21:12:09 -07:00
Jarred Sumner
a74d6f5a20 Clean up a little after #9402 (#9454)
* Clean up after #9402

* More

* More cleanup

* Bring back `dead`

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
2024-03-17 21:09:25 -07:00
Zack Radisic
4a6cda8d80 Fixes #9459 (shell mv regression) (#9475)
* Fix `mv`

* Add `mv` tests
2024-03-17 21:08:16 -07:00
Jarred Sumner
5fec71bda4 Fixes #9430 (#9472)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-17 07:19:24 -07:00
Jarred Sumner
3d8c10c116 Fixes #7148 (#9467)
* Fixes #7148

* Fix failing tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-17 06:20:24 -07:00
Jarred Sumner
9e8bdaba93 Fixes #9433 (#9471)
* Fix assertion failure when package-lock.json is out of sync with package.json

* Fixes #9433

* Update bun.lockb

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-17 03:42:10 -07:00
Jarred Sumner
c8ec56ec1b Fix assertion failure when package-lock.json is out of sync with package.json (#9468)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-16 23:31:34 -07:00
Jarred Sumner
28d329893b Ensure some logs only generate in debug 2024-03-16 21:45:12 -07:00
Jarred Sumner
17631ce6a0 Fix subprocess.kill(undefined) (#9466)
* Fix subprocess.kill()

* Update spawn-kill-signal.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-16 19:35:21 -07:00
Jarred Sumner
7c9f076385 Fixes #3202 (#9461)
* Fixes #3202

* Update ws.js

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-16 17:47:49 -07:00
Jarred Sumner
1879c499b1 Add shell hanging tests (#9463)
* Add shell hanging tests

* Fix shell hanging

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
2024-03-16 16:22:14 -07:00
Ciro Spaciari
83863c27b4 fix(windows) fix some test failures (#9417)
* fix ReadFile and fix isEligible for sendfile on windows

* give it a little more time

* actually test tls property

* Update src/bun.js/webcore/blob/ReadFile.zig

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>

* getServers test on windows

* retry

* check comptime first on isEligible

* wip body-stream

* oopsie

* opsie 2

* revert this

* test

---------

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-16 05:47:33 -07:00
Jarred Sumner
785d2251da Fix incorrect include order (#9457)
* Update ImportMetaObject.cpp

* Add header guard

* Enable `-Werror=uninitialized` and `-Werror`

* Update napi.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-16 02:50:38 -07:00
Jarred Sumner
a6633e554c Update bunfig.md 2024-03-15 23:38:28 -07:00
Jarred Sumner
324e4f5fff Update bunfig.md 2024-03-15 23:36:25 -07:00
Filip
c9a70f1686 Fixes shell mv with multiple files (#9341)
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-15 23:01:25 -07:00
Jarred Sumner
e89c8d2eaa Fix not using system shell on posix (#9449)
* Use system shell + add to bunfig

* Update CMakeLists.txt

* Fix tests + flags

* Use execPath

* windows

* Propagate exit code

* Add test for default shell in use

* Update bun-run-bunfig.test.ts

* Update bun-run-bunfig.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-15 23:00:53 -07:00
Meghan Denny
b23eb60277 test: updated prisma schema (#9450)
* test: updated prisma schema

* test: fix prisma non-determinism

* fix postgres too
2024-03-15 22:55:42 -07:00
dave caruso
b1719f3a70 make import.meta behave better when query string is provided (#9399)
* make import.meta actually use a vali url

* a
2024-03-15 22:44:23 -07:00
Zack Radisic
bd3812df50 Shell fixes (#9402)
* wip

* Fix a bunch of stuff

* Fix cat

* Fix shell rm windows

* Fix glob scan test on windows

* Fix rm on windows

* stuff

* make it compile on windows

* [autofix.ci] apply automated fixes

* fix compile

* Wow

* Minor changes

* Ensure handle is closed

* Regular files are not pollable on linux

* dupe the blob son

* fix mem leak stuf

* dont use O_NONBLOCK

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-15 21:41:11 -07:00
Dylan Conway
9512f5240f bun pm trust bugfix (#9426)
* check error

* test missing packages

* Update test/cli/install/registry/bun-install-registry.test.ts

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-15 21:22:12 -07:00
Jarred Sumner
307cac5ecd await FileHandle functions (#9451)
* Await FileHandle functions

* Update fs.promises.ts

* use await using = await

* Make this more robust + fix tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-15 21:05:43 -07:00
Brian Donovan
8c5ac06113 fix: return object from FileHandle#read and FileHandle#readv (#9444)
See the NodeJS docs for `read`: https://nodejs.org/api/fs.html#filehandlereadoptions
2024-03-15 14:56:02 -07:00
Ciro Spaciari
eae0f0318a fix ref counting onReaderDone (#9443) 2024-03-15 13:00:19 -07:00
Jarred Sumner
e256751218 Don't link libicudata? (#9424)
* Don't link libicudata?

* Fixups

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-14 20:46:11 -07:00
Dylan Conway
1e090a78c1 improve --print with promises (#9407)
* `.then` on pending promises

* remove header
2024-03-14 19:26:44 -07:00
Jarred Sumner
8852f2a28d Lost in the merge (#9423) 2024-03-14 19:26:28 -07:00
Jarred Sumner
924647f8b9 Fixes #9404 (#9408)
* Fixes #9404

* Fixup

* Test it on macOS and windows too why not

* fixup

* Fix test

* ignore

* seems to work?

* Update Dockerfile
2024-03-14 18:47:22 -07:00
Ashcon Partovi
c72cf989f4 Fix 'xcrun: error: unable to lookup item' error when building on macOS 2024-03-14 12:23:00 -07:00
Ashcon Partovi
eac2e52783 Remove cp.js 2024-03-14 09:48:49 -07:00
Jarred Sumner
9573c6e2b7 Upgrade HTTPParser.h from uWS v20.6.0 to v20.62.0 (#9355)
* Upgrade HTTPParser.h from uWS v20.6.0 to v20.62.0

* Make MAX_FALLBACK_SIZE larger to allow for large redirect urls

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-13 21:22:15 -07:00
Dylan Conway
3375a158de fix(install): make sure trustedDependencies is updated after removing packages (#9400)
* if lockfile diff, transfer new trusted list over

* oops

* comment

* not only

* remove constCast
2024-03-13 19:17:42 -07:00
Jarred Sumner
570b3e567a Bump 2024-03-13 15:26:38 -07:00
Dylan Conway
cce6cfb2b3 fix integer overflow on subprocess deinit (#9388)
* avoid overflow

* closeWithoutReporting

* PipeWriter too

* remove comment
2024-03-13 14:50:31 -07:00
Jarred Sumner
9bda350406 Add a helpful error message when the xcode SDK is newer than the current platform (#9397)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-13 14:34:31 -07:00
Jarred Sumner
c5cc2a45a6 Speed up this test 2024-03-13 12:34:38 -07:00
Dylan Conway
c64e52c67f if cjs, dont set through esm eval 2024-03-12 22:59:31 -07:00
Jarred Sumner
648fd5d138 Always set the result if its an entry point 2024-03-12 22:51:16 -07:00
Jarred Sumner
7f16164b25 Unwrap promises in bun --print 2024-03-12 21:54:07 -07:00
Dylan Conway
e45ece05d9 improve bun pm trust output (#9371)
* fix recursion

* accurate count of blocked package scripts

* update

* fix merge

* reset pipereaders, set bin linker error correctly

* more pretty

* small changes

* e

* update tests

* this one too

* bun.start_time, iterate package_ids, remove put
2024-03-12 19:50:46 -07:00
Dylan Conway
3765032dec feat: bun --print (#9358)
* --print cli flag

* less code elimination

* handle cjs module eval results

* make node -p work

* better test

* more tests

* if

* delete commented code

* delete commented code

* EvalGlobalObject

* remove one constructor

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-12 18:15:50 -07:00
dave caruso
4b0eb47164 fix hot test on windows 2024-03-12 05:38:59 -07:00
Jarred Sumner
2d0cf1a78b [windows] Fix fetch.unix.test.ts (#9369)
* Fix fetch.unix.test

* Skip mmap
2024-03-11 18:01:57 -07:00
Jarred Sumner
574dec0919 Fix a couple windows test failures (#9361)
* Fix a couple test failures

* Another test

* Return a promise on flush
2024-03-11 16:27:08 -07:00
Brian Donovan
840f1b4006 fix typo in error message (#9350)
It should be "its" (possessive), not "it's" (contraction of "it is").

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-03-11 11:53:58 -04:00
Jarred Sumner
c9fe57fa63 wip use wrapper for managing process (#8456)
* WIP sync close (shows ref count bug in stream)

* fix closing on PipeWriter and PipeReader

* remove old todos

* join

* Some shell changes

at least it compiles

* fix some compile errors

* fix ref/unref server on windows

* actually use the ref count in this places

* make windows compile again

* more tests passing

* Make shell compile again

* Slowly remove some `@panic("TODO SHELL")`

* Eliminate `@panic("TODO SHELL")` for BufferedWriter

* Holy cleansing of `@panic("TODO SHELL")`

at least it compiles now

* Okay now the shell compiles, but segfaults

* Fix compiler errors

* more stable stream and now Content-Range pass

* make windows compile again

* revert stuff until the fix is actually ready

* revert onDone thing

* Fix buffered writer for shell

* Fix buffered writer + shell/subproc.zig and windows build

* Fix for #8982 got lost in the merge

* Actually buffer subproc output

* Fix some stuff shell

* oops

* fix context deinit

* fix renderMissing

* shell: Fix array buffer

* more stable streams (#9053)

fix stream ref counting

* wip

* Remove `@panic("TODO")` on shell event loop tasks and Redirect  open flags got lost in merge

* Support redirects

* fixes

cc @cirospaciari

* Update ReadableStreamInternals.ts

* Fix spurious error

* Update stream.js

* leak

* Fix UAF

cc @cirospaciari

* Fix memory leaks

* HOLY FUCK big refactor

* misc cleanup

* shell: Fix a bunch of tests

* clean up

* gitignore: fix ending newline

* get windows compiling again

* tidy

* hide linker warn with icu

* closeIfPossible

* Better leak test

* Fix forgetting to decrement reference count

* Update stdio.zig

* Fix shell windows build

* Stupid unreachable

* Woops

* basic echo hi works on windows

* Fix flaky test on Windows

* Fix windows regression in Bun.main (#9156)

* Fix windows regression in Bun.main

* Handle invalid handles

* Fix flaky test

* Better launch config

* Fixup

* Make this test less flaky on Windows

* Fixup

* Cygwin

* Support signal codes in subprocess.kill(), resolve file path

* Treat null as ignore

* Ignore carriage returns

* Fixup

* shell: Fix IOWriter bug

* shell: Use custom `open()`/`openat()`

* windows shell subproc works

* zack commit

* I think I understand WindowsStreamingWriter

* fix thing

* why were we doing this in tests

* shell: Fix rm

* shell: Add rm -rf node_modules/ test

* shell: use `.runAsTest()` in some places to make it easier to determine which test failed

* [autofix.ci] apply automated fixes

* woopsie

* Various changes

* Fix

* shell: abstract output task logic

* shell: mkdir builtin

* fixup

* stuff

* shell: Make writing length of 0 in IOWriter immediately resolve

* shell: Implement `touch`

* shell: basic `cat` working

* Make it compile on windows

* shell: Fix IOReader bug

* [autofix.ci] apply automated fixes

* fix windows kill on subprocess/process

* fix dns tests to match behavior on windows (same as nodejs)

* fix windows ci

* again

* move `close_handle` to flags in `PipeWriter` and fix shell hanging

* Fix `ls` not giving non-zero exit code on error

* Handle edgecase in is_atty

* Fix writer.flush() when there's no data

* Fix some tests

* Disable uv_unref on uv_process_t on Windows, for now.

* fix writer.end

* fix stdout.write

* fix child-process on win32

* Make this test less flaky on Windows

* Add assertion

* Make these the same

* Make it pass on windows

* Don't commit

* Log the test name

* Make this test less flaky on windows

* Make this test less flaky on windows

* Print which test is taking awhile in the runner

* fixups

* Fixups

* Add some assertions

* Bring back test concurrency

* shell: bring back redirect stdin

* make it compile again cc @zackradisic

* initialize env map with capacity

* some fixes

* cleanup

* oops

* fix leak, fix done

* fix unconsumedPromises on events

* always run expect

* Update child_process.test.ts

* fix reading special files

* Fix a test

* Deflake this test

* Make these comparisons easier

* Won't really fix it but slightly cleaner

* Update serve.test.ts

* Make the checks for if the body is already used more resilient

* Move this to the harness

* Make this test not hang in development

* Fix this test

* Make the logs better

* zero init some things

* Make this test better

* Fix readSocket

* Parallelize this test

* Handle EPipe and avoid big data

* This was a mistake

* Fix a bunch of things

* Fix memory leak

* Avoid sigpipe + optimize + delete dead code

* Make this take less time

* Make it bigger

* Remove some redundant code

* Update process.zig

* Merge and hopefully don't breka things along teh way

* Silence build warning

* Uncomment on posix

* Skip test on windows

* windows

* Cleanup test

* Update

* Deflake

* always

* less flaky test

* [autofix.ci] apply automated fixes

* logs

* fix uaf on shell IOReader

* stuff to make it work with mini event loop

* fix 2 double free scenarios, support redirections on windows

* shell: Make `1>&2` and `2>&1` work with libuv

* yoops

* Partial fix

* Partial fix

* fix build

* fix build

* ok

* Make a couple shell tests pass

* More logging

* fix

* fix

* Fix build issue

* more tests pass

* Deflake

* Deflake

* Use Output.panic instead of garbled text

* Formatting

* Introduce `bun.sys.File`, use it for `Output.Source.StreamType`, fix nested Output.scoped() calls, use Win32 `ReadFile` API for reading when it's not a libuv file descriptor.

This lets us avoid the subtle usages of `unreachable` in std.os when writing to stdout/stderr.

Previously, we were initializing the libuv loop immediately at launch due to checking for the existence of a bun build --compile'd executable. When the file descriptor is not from libuv, it's just overhead to use libuv

cc @paperdave, please tell me if Iany of that is incorrect or if you think this is a bad idea.

* Fix closing undefined memory file descriptors in spawn

cc @zackradisic

* pause instead of close

* Fix poorly-written test

* We don't need big numbers for this test

* sad workaround

* fixup

* Clearer error handling for this test

* Fix incorrect test

@electroid when ReadableStream isn't closed, hanging is the correct behavior when consuming buffered data. We cannot know if the buffered data is finished if the stream never closes.

* Fix build

* Remove known failing on windows

* Deflake

* Mark no longer failing

* show all the failing tests

* Sort the list of tests

* fix argument handling

* dont show "posix_spawn" as an error code on windows

* make bun-upgrade.test.ts pass on windows

* fix bunx and bun create again sorry

* a

* fix invalidexe because we should not be running javascript files as if they were exes

* Concurrency in test runner + better logging

* Revert "fix invalidexe because we should not be running javascript files as if they were exes"

This reverts commit da47cf8247.

* WIP: Unix fixes (#9322)

* wip

* [autofix.ci] apply automated fixes

* wip 2

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* Update runner.node.mjs

* Update runner.node.mjs

* Document some environment variables

* shell: Make `Response` work with builtins

* Make it compile

* make pwd test pass

* [autofix.ci] apply automated fixes

* Fix printing garbage for source code previews

* Update javascript.zig

* Fix posix test failures

* Fix signal dispatch

cc @paperdave. Signals can be run from any thread. This causes an assertion failure when the receiving thread happens to not be the main thread. Easiest to reproduce on linux when you spawn 100 short-lived processes at once.

* windows

---------

Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
Co-authored-by: Zack Radisic <zackradisic@Zacks-MBP-2.attlocal.net>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Meghan Denny <meghan@bun.sh>
Co-authored-by: Zack Radisic <zack@theradisic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-03-11 08:24:30 -07:00
sequencerr
21ec6669df Fix bun description (#9345) 2024-03-10 10:19:38 -07:00
Jarred Sumner
44959e6826 Make printing errors faster (#9328)
* Make printing errors faster

* Make Next.js tests less flaky

* Update dev-server.test.ts

* Copy over runner from process pr

* bump next version

* Update javascript.zig

* Set port to 0

* p-queue

* no dont use docker buildx

* Prevent runner from hanging

* Update dev-server.test.ts

* Really fix hanging this time

* Fix bounds check for unix domain socket, support abstract namespace sockets

* Various fixes

* [autofix.ci] apply automated fixes

* Update runner.node.mjs

* Update runner.node.mjs

* windows

* Only care about stdout

* increase concureency + clean up test

* Tweak puppeteer

* Update runner.node.mjs

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-09 09:48:46 -08:00
Jarred Sumner
79e77f13ab Revert "Bun.serve: error: pass Request parameter when available (#9310)" (#9332)
This reverts commit b92d98556b.
2024-03-09 08:44:03 -08:00
dave caruso
cd320835d1 chore: just a little bit of cleanup (#9319)
* just a little bit of cleanup

* oops
2024-03-09 07:28:54 -08:00
dave caruso
c3a9a7c147 fix #8868 (#9327) 2024-03-09 07:28:31 -08:00
Meghan Denny
b92d98556b Bun.serve: error: pass Request parameter when available (#9310)
* Bun.serve: error: pass Request parameter when available

* this will be null when not found not undefined

* add an assert here

* reorganize tests

* add another test

* add another test
2024-03-08 19:59:58 -08:00
Jarred Sumner
51ac00e965 Move these below package.json script 2024-03-08 19:26:00 -08:00
Jarred Sumner
402f7079df Add tests for file path redirection + tweak 2024-03-08 19:20:41 -08:00
Meghan Denny
709fbc2565 allow bun run to accept js from stdin (#9311)
* allow bun run to accept js from stdin

* document it

* fix window test

* cli/run: use printForLogLevel

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-03-08 18:43:53 -08:00
Meghan Denny
702cae51f6 test: Bun.stringWidth is enabled by default (#9321) 2024-03-08 17:54:51 -08:00
John-David Dalton
ad6a1b1a71 chore: remove unused zig-datetime dep (#9315) 2024-03-08 10:40:05 -08:00
Dylan Conway
d37fbbd4e0 fix(install): lifecycle script changes (#8943)
* empty trustedDependencies

* tests

* handle edgecases with default trusted dependencies

* could be zero length

* --trusted and skipped scripts

* resolver too

* second run --trusted

* --trust, better formatting

* more tests

* --trusted applies to dep deps, more tests

* progress

* fix build

* fix crash, make it look good, comments

* alphabetize, verbose log

* feature flag

* update lockfile

* update skipped text

* check update requests first

* be more careful with inline strings

* only with scripts

* fix tests, todo tests

* fix another test

* fix merge

* fix fix merge

* check binding.gyp for tarball and git resolutions

* remove dead code

* debug assert

* move newline printing

* use enum for `__has_install_script`

* oops

* clone packages

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-07 19:22:21 -08:00
dave caruso
a927340ce3 fix: bun.serve crash due to ExceptionRef (#9309)
* fix bun.serve crash due to ExceptionRef

* add test
2024-03-07 18:54:15 -08:00
Robert Burke
7fc97fcf9c Fix sqlite benchmark setup when sh isn't bash (#9303)
Prevent deno from making noisy output

Co-authored-by: Robert Burke <robert.burke@ltcm.lol>
2024-03-07 17:32:23 -08:00
Meghan Denny
ea5354fc85 handle invalid URL in Location header for fetch() (#9305) 2024-03-07 17:32:05 -08:00
dave caruso
3b13f7f998 fix: large bunx changes, mostly for better windows support (#9143)
* make bun-debug properly override `bun` in path

* windows path

* fix more issues with bunx

* sync

* stuff

* stuff

* f

* stuff

* further work

* a

* [autofix.ci] apply automated fixes

* okay

* fix building on posix systems

* ok

* make it so bun create cant crash + review

* docuemnt why return false is ok

* .

* cache bust

* merge

* yeah

* yea

* Update src/install/install.zig

* review results

* this will probably fix hardlink issue on windwo

* okay

* how did that work before

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-07 14:20:39 -08:00
Ashcon Partovi
806dec7a35 fix: child_process.spawn({ timeout }) exiting too early (#9280) 2024-03-07 09:36:54 -08:00
Meghan Denny
5a8830fdcc NODE_ENV=test should load .env.test even when .env.production exists (#9291) 2024-03-07 03:36:09 -08:00
dave caruso
e8374ebd82 feat: implement util.styleText (#9287)
* feat: implement util.styleText

* i forgot to test
2024-03-07 03:20:08 -08:00
John-David Dalton
9734f4cf6b Allow for smaller allocations in node:path methods (#8932)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-03-07 10:37:13 +01:00
Dylan Conway
ea6bf1257a fix(install): auto node-gyp script bugfix (#9289)
* preinstall and install

* comment
2024-03-06 23:05:23 -08:00
Meghan Denny
3f12d71fdd install: dont crash in debug mode when a semver has a build tag and multiple hyphens in the pre-release tag (#9288) 2024-03-06 20:38:49 -08:00
Jarred Sumner
27a504a45b Add microbenchmark for reading a file in chunks 2024-03-06 17:42:12 -08:00
Jarred Sumner
dd920dadb8 Shorten title 2024-03-06 15:34:18 -08:00
Jarred Sumner
f6d5325daa Support socketPath in node:http request (#9284)
* Support `socketPath` in node:http request

* fix dashes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-03-06 15:28:35 -08:00
Jarred Sumner
a66926243d Support unix domain sockets in fetch() (#9097)
* Support unix domain sockets in fetch()

* rename to 'socket' to 'unix', add test

* enable keepalive on unix socket fetch

* make ownership of unix_socket_path clear, refactor http.zig a bit

* [autofix.ci] apply automated fixes

* add fetch unix redirect test, fix crash

* [autofix.ci] apply automated fixes

* fix fetch redirect from unix to non-unix

* disable keepalive for unix sockets (for now) so we don't leak them

* Update test/js/web/fetch/fetch.unix.test.ts

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-03-06 14:12:03 -08:00
Kyle Scully
440cee1755 refactor: remove unnecessary spread (#9137) 2024-03-06 09:00:29 -08:00
マルコメ
9b4a74715b docs: update test matchers on jest compatibility (#9272) 2024-03-06 00:11:29 -08:00
Meghan Denny
8fc08752e5 node:http: emit 'socket' event after calling http.request() (#9270)
* node:http: emit 'socket' event after calling http.request()

* add reference links for why this is how it is

* add guards to not waste time

* add a regression test

* use test harness port number
2024-03-05 23:01:32 -08:00
Meghan Denny
bb3295ba84 node:url implement domainToASCII and domainToUnicode (#9257)
* node:url implement domainToASCII and domainToUnicode

* fix arg checks

* remove unneeded use of WTF::Vector

* tidy

* throw a js error if icu fails

* add a ton more tests, fix ascii guard, upconvert latin1

* even more tests

* add a comment for this guard

* use ASSERT_NOT_REACHED() instead of raise(SIGABRT)
2024-03-05 19:46:38 -08:00
Ashcon Partovi
c837903e4e Fix new Request("/") not working with node-fetch (#9246)
* Fix `new Request("/")` not working with `node-fetch`

* Address review

* Address review 2

* Fix bad test
2024-03-05 16:51:52 -08:00
Ryan Dsouza
b55e62b634 Update cache.md (#9260)
Specify `bunfig.toml` to make it easy to check where this option needs to be added.
2024-03-05 16:28:08 -08:00
Cameron Haley
2b8fc7a9a8 Running absolute/relative path shouldn't rely on the existence of package.json script (#9265) 2024-03-05 16:27:57 -08:00
Jarred Sumner
edeeffc74c Fixes #9263 (#9266)
* Fixes #9283

* Update URLSearchParams.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-05 16:27:33 -08:00
Jarred Sumner
12c257a012 Fix out of bounds memcpy in crypto 2024-03-05 13:52:27 -08:00
Yash Singh
bd2176ffb0 fix: format specifier without characters in between (#9209)
* fix: format specifier without spaces in between, resolves #9208

* chore: test in console-log.test.ts
2024-03-04 17:46:19 -08:00
ErikOnBike
4f0a497660 Fix lost constructors in Node.js module classes (#9245) 2024-03-04 16:12:22 -08:00
dave caruso
472a0b482d feat: signal handling on windows (#9129)
* start some signal handling

* ok

* work on this from friday

* ok

* ref stuff

* threadsafety

* fix the buikld

* alright

* ok

* fix posix compilation error

* header fix

* revisions

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Zack Radisic <zack@theradisic.com>
2024-03-04 15:37:08 -08:00
Brook Jeynes [SSW]
fa08ac34c9 Fixes #7767: Updated bun upgrade to return error when used with cmd arguments (#7784)
* Updated `upgrade` to return error when used with cmd arguments
- Updated `upgrade` command to check for command-line arguments and return an error if so providing a suggested `update` command.

* added test

* updated condition to allow

* Upgrade argument check now only checks if all arguments contain `--`
- Added more tests

* Using `cpSync` in the following context results in an "Is a directory" error

* Update message displayed back to user

Co-authored-by: dave caruso <me@paperdave.net>

* moved args check to upgrade_command.zig

* fixed broken tests

* changing string interpolation to join() for paths

* [autofix.ci] apply automated fixes

* Fixed build errors
- Removed call to `std.mem.span`
- Added conditional to only run if there's more than 2 arguments (ignores the exec and `upgrade`)
- Added new test to ensure `upgrade` runs with 0 arguments passed

---------

Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-04 15:30:20 -08:00
Yash Singh
51466ff1a2 fix: sep state for assertions and hasAssertions (#9210) 2024-03-04 12:01:50 -08:00
cyfung1031
b14c7aa0b5 docs: Correct Incorrect Information (#9214)
`URL.createObjectURL` is not yet implemented.
See https://github.com/oven-sh/bun/issues/3925
2024-03-04 08:27:18 -08:00
Jarred Sumner
1424a196ff Support "conditions" in Bun.build (#9234)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 23:52:24 -08:00
Zack Radisic
05a7779880 shell: Improve ShellError stacktrace (#9233)
* Improve stacktrace

* woops
2024-03-03 21:46:42 -08:00
Jarred Sumner
95fc939d0b Fixes #9225 (#9232)
* Fixes #9225

* Pass all arguments along

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 20:50:35 -08:00
Jarred Sumner
6d52b3b62b Fixes #8794 (#9231)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 20:13:22 -08:00
Jarred Sumner
30fdfdb295 Fixes #9222 (#9230)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 19:26:27 -08:00
Jarred Sumner
a43a8a8cea Fixes #9226 (#9229)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 17:32:18 -08:00
argosphil
4257457c6a Allow relative paths in cpAsync again (#9184)
* allow relative paths in cpAsync again

* test for #9024

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-03 16:30:34 -08:00
Cameron Haley
b5cea9a20c Avoid manually destroying stream when IncomingMessage stream is done reading (#9219)
* Avoid manually destroying stream when IncomingMessage stream is done reading

* Add test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-03-03 16:29:13 -08:00
Jarred Sumner
49ccad9367 Finish jest.clearAllMocks() implementation (#9217)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 03:48:13 -08:00
Jarred Sumner
71405ff4dc Fix regression from 648d5ae (#9215)
* Slightly reduce number of system calls on Linux

* Fix regression from 648d5aecf3

648d5aecf3 caused HTTP response bodies sent streamingly with a single chunk to include an extraneous 0\r\n\r\n chunk, leading valid clients to close the connection prematurely.

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-03 00:02:44 -08:00
Jarred Sumner
0017dbec4e Fixes #9180 (#9212)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-02 21:42:57 -08:00
Jarred Sumner
a3a5ed3870 Update shell.md 2024-03-02 01:39:34 -08:00
Jarred Sumner
dd111589b0 Update shell.md 2024-03-02 01:37:42 -08:00
Jarred Sumner
3c62580529 Add a couple guides 2024-03-02 01:24:40 -08:00
Dylan Conway
309b417009 add assertion for generated functions returning JSValue.zero without an exception (#9197)
* assert exception when JSValue.zero is returned

* Update generate-classes.ts
2024-03-01 20:18:40 -08:00
Yash Singh
b2794ad7cf feat: implement expect.assertions and expect.hasAssertions (#9190)
* chore: merge oven-sh/bun

* chore: merge oven-sh/bun

* chore: merge oven-sh/bun

* fix: comptime for compiling

* fix: error reporting

* chore: revert runner.node.mjs

* fix: dont construct err b4

* chore: rm force throw test

* chore: rerun

* chore: reset unrelated changes

* fix: return undefined

* fix: dont return undefined on invalid args

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-01 20:17:44 -08:00
Jarred Sumner
4489cda25b Bump (#9196)
* Bump

* Even more calloc

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-01 20:13:16 -08:00
Igor Wessel
dcf6f244a4 feat: add support --conditions flag (#9106)
* feat(options): add possibility to append a custom esm condition

* feat(cli): parse --conditions flag

* test: add case for custom conditions

* fix(cli): not get short-hand --conditions flag

* test: add case using cjs with custom condition

* fix(options): address possible memory issues for esm conditions

* refactor(cli): remove -c alias for --conditions flag

* test: add cases for multiple --conditions specified

* test(bundler): add support to test --conditions

* chore(cli): fix grammar mistakes in --conditions

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-03-01 18:57:45 -08:00
Meghan Denny
3134ae1ada ci: comment disabled actions/upload-artifact call (#9195) 2024-03-01 18:14:15 -08:00
Meghan Denny
4baad765ec windows: pass test/js/web/timers/setTimeout.test.js (#9176)
* windows: pass test/js/web/timers/setTimeout.test.js

* gotta go fast

* ci: windows: try reverting this line

reproducibly getting:
Error: Unable to download artifact(s): Artifact not found for name: bun-windows-x64-zig

* ci: switch back to namespace for zig build
2024-03-01 17:48:52 -08:00
Ashcon Partovi
714e04eeec Github actions changes (#9189)
* Test out custom oven-sh/setup-bun action

* Add files
2024-03-01 17:48:23 -08:00
Jarred Sumner
64bdf6a138 Zero initialize some things in usockets (#9191)
* Zero initialize some things in usockets

* Update epoll_kqueue.c

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-01 17:47:00 -08:00
Meghan Denny
141c2b52b1 ci: fail step if actions/upload-artifact fails (#9194)
* ci: fail step if actions/upload-artifact fails

* the arm64 workflow doesnt have these and they were failing on x86
2024-03-01 17:46:18 -08:00
Jarred Sumner
fd26c3fb55 Fixes #9153 (#9175)
* Fixes #9153

* Update napi.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-03-01 14:42:20 -08:00
Lucas Garron
7909f0eff4 Fix typo: demonstates → demonstrates (#9179) 2024-03-01 05:44:44 -08:00
Jarred Sumner
1e217ce78f Fix path bug (#9173) 2024-02-29 22:35:52 -08:00
Jarred Sumner
08ef0e8e8e Use namespace on more machines 2024-02-29 22:16:47 -08:00
Ashcon Partovi
536919e783 Use namespace.so for faster CI (#9160)
* Use namespace.so for faster CI

* arm64 runners arent working

* deflake

* more

* Update bun-mac-x64-baseline.yml

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-29 16:14:12 -08:00
Meghan Denny
e45a4019c1 windows: pass test/transpiler/transpiler-stack-overflow.test.ts (#9164)
* windows: pass test/transpiler/transpiler-stack-overflow.test.ts

* remove regression silencing comment

* needed this too

* use proper drive letter detection

* oopsie
2024-02-29 15:21:39 -08:00
Alexander Mykolaichuk
0b5e83db97 fix: linux distro name match (#9075) 2024-02-29 13:17:31 -08:00
Meghan Denny
2fb6733eeb windows: pass test/js/node/process/process.test.js (#9161) 2024-02-28 20:25:05 -08:00
Meghan Denny
bcd604edc7 windows: pass test/js/bun/resolve/resolve.test.ts (#9158) 2024-02-28 19:58:42 -08:00
Cameron Haley
bfdad44460 Fix issue where process.stdin is ended too early (#9155)
* Fix issue wherein process.stdin is ended too early

* [autofix.ci] apply automated fixes

* test: Generate prisma client on 'big' schema

* Update test/js/third_party/prisma/helper.ts

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-28 19:03:08 -08:00
Jarred Sumner
27a0deab5f Make this test less flaky on Windows 2024-02-28 17:03:00 -08:00
Jarred Sumner
c7a0c3c5fd Merge branch 'main' of https://github.com/oven-sh/bun 2024-02-28 16:56:02 -08:00
Jarred Sumner
bba9b39ef8 Fix flaky test on Windows 2024-02-28 16:55:58 -08:00
Jarred Sumner
f34de31edb Fix windows regression in Bun.main (#9156)
* Fix windows regression in Bun.main

* Handle invalid handles

* Fix flaky test

* Better launch config

* Fixup
2024-02-28 16:49:37 -08:00
Jarred Sumner
53378227ca [windows] Fix regression from #9154 2024-02-28 15:16:40 -08:00
dave caruso
360bbb4dea fix(windows): fix directory cache regression "expected to end with a trailing slash" (#9144)
* okaaaaaaaay

* Revert "resolver: fix debug mode crash in test/bundler/bun-build-api.test.ts (#9140)"

This reverts commit 331d079dad.

* correctly fix the cache bust bug

this was introduced a couple of commits ago in my random fixes,
where i put the wrong fix to another directory caching bug.

i still stand by the assertion in place despite it causing many people
issues. it's precense will prevent subtle module resolutions failures.

* add an extra comment

* fix building a release build locally

* add a better test case for 3216

* staging

* fix mac issues

* ok

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-28 14:51:14 -08:00
Jarred Sumner
dc6af25b54 Fix ownKeys issue (#9154) 2024-02-28 14:22:25 -08:00
Meghan Denny
331d079dad resolver: fix debug mode crash in test/bundler/bun-build-api.test.ts (#9140) 2024-02-27 22:22:52 -08:00
dave caruso
c54844b30b windows: random things (#9046)
* random things

* fix reliability of loading napi stuff

* fix posix build

* a
2024-02-27 16:30:34 -08:00
Dylan Conway
c9b5191fc2 fix(bun:test): fix toContainKeys with undefined and null (#9125)
* fix 9118

* update

* RELEASE_AND_RETURN

* cache and coerce

* test for toContainKey throwing in hasOwnProperty

* fix test

* [autofix.ci] apply automated fixes

* fix non-truthy and more test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-27 15:10:26 -08:00
dave caruso
4e2d00d052 windows: changes to install/upgrade/uninstallation process (#9025) 2024-02-27 03:11:43 -08:00
Jarred Sumner
fd6fd78f0f Fixes #9120 (#9128)
* Fixes #9120

* Update buffer.test.js

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-26 19:15:28 -08:00
Jarred Sumner
c4a9bdbb81 Silence not implemented warning (#9126)
* Silce not implemented warning

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-26 18:36:18 -08:00
Jarred Sumner
f1b8df29e8 Replace std.unicode.fmtUtf16le with bun.fmt.utf16 (#9127)
* Replace `std.unicode.fmtUtf16le` with `bun.fmt.utf16`

* Update fmt.zig

* Remove bun.fmt.fmtUTF16

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-26 18:35:18 -08:00
Marvin A. Ruder
675dad2fe8 Use bind mount for glibc APKs in Alpine Dockerfile (#9113)
* Fixes #9112

Signed-off-by: Marvin A. Ruder <signed@mruder.dev>
2024-02-26 14:22:30 -08:00
Jarred Sumner
57eb04f6f4 [internal] Switch back to prettier (#9109)
* Switch back to prettier

* wip

* Update .prettierignore

* Update .prettierignore

* ignores

* Update .prettierignore

* Rest

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-26 11:13:02 -08:00
Jarred Sumner
517aaad549 Update executables.md 2024-02-25 23:59:34 -08:00
Jarred Sumner
6e54787d4a Update executables.md 2024-02-25 23:51:36 -08:00
Jarred Sumner
dbb490f3bd Update executables.md 2024-02-25 23:47:49 -08:00
Jarred Sumner
e2ee5642e0 Update executables.md 2024-02-25 23:45:52 -08:00
Jarred Sumner
92dec0a871 Implement util.types.isKeyObject (#9091)
* Implement util.types.isKeyObject

* just use inherits

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-25 14:30:05 -08:00
Jarred Sumner
72d57464b9 Make Bun.main the resolved filesystem path (#9105)
* Make `Bun.main` the resolved filesystem path, but only Bun.main

* Fix flaky test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-25 13:05:34 -08:00
Cameron Haley
2333c94f8e Fix prisma generate by emitting readable event on EoF (#9101)
* Add test for ensuring the 'readable' event is emitted on end

* Run emitReadable on nextTick instead of as microtask

* perf: Store intermediate variables

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-25 13:01:07 -08:00
Jarred Sumner
a3adb8bd10 Add a couple TODO comments 2024-02-24 19:36:56 -08:00
Jarred Sumner
e9d4ced41e Bump WebKit 2024-02-24 18:46:00 -08:00
Jarred Sumner
fdd42eb67e Fixes #9096 2024-02-24 16:06:34 -08:00
Jarred Sumner
4ba1d4d7c8 Add missing fdatasync (#9092)
* Add missing fdatasync

* don't use /tmp/ since it might not support fdatasync on linux

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-24 15:47:14 -08:00
Dylan Conway
b6f3405fa7 fix(windows): fix uv_loop and uv_pipe_t struct sizes (#9085)
* use CRITICAL_SECTION struct instead of pointer

* WIN32_FIND_DATAW too

* INPUT_RECORD too
2024-02-24 02:49:47 -08:00
Aron Homberg
29466b884e feat: implemented jest.clearAllMocks, fixes #9079 (#9081) 2024-02-24 01:06:29 -08:00
Meghan Denny
968065ca73 Bun.stringWidth ambiguousIsNarrow option defaults to true (#9064)
* Bun.stringWidth ambiguousIsNarrow option defaults to true

* number was backwards too
2024-02-23 20:27:10 -08:00
Meghan Denny
72b700205a vscode: highlight invisible and ambiguous characters (#9066) 2024-02-23 20:26:58 -08:00
Meghan Denny
8ed02f9567 fix debug crash in bun.strings.firstNonASCII16 when input is multiple of ascii_u16_vector_size (#9080) 2024-02-23 20:26:08 -08:00
Meghan Denny
109a8c2c37 fix crash in test/transpiler/transpiler.test.js when macro isn't found (#9068) 2024-02-23 18:14:45 -08:00
Lucas Michot
d0d5475953 Update installation.md (#9069)
Simplify homebrew installation instructions

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-02-23 11:02:33 -08:00
Meghan Denny
d0293edc59 remove hidden zero-width-space characters from our md files (#9067) 2024-02-23 11:01:11 -08:00
Jarred Sumner
094750cc9c Update utils.md 2024-02-22 21:59:00 -08:00
Jarred Sumner
b48e5bbebd Update utils.md 2024-02-22 21:58:02 -08:00
Jarred Sumner
460d64a086 Update utils.md 2024-02-22 21:57:27 -08:00
Jarred Sumner
f75306db0f Update utils.md 2024-02-22 21:52:13 -08:00
Jarred Sumner
5147c0ba73 Fix incorrect assertion 2024-02-22 21:51:44 -08:00
jrz
f6a0edc7de docs: fix for contributing using linux (#9050)
Both debian:bookworm and ubuntu:latest (jammy) do not have curl, wget, lsb_release and software-properties-common installed by default.
2024-02-22 20:58:22 -08:00
Jarred Sumner
a146856d11 Support coercing port number from integer (#9047)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-22 20:11:47 -08:00
Jarred Sumner
7e906c1cae Remove ignore min branch (#9061)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-22 20:04:50 -08:00
Jarred Sumner
2e7d77b3b0 Add bench 2024-02-22 19:18:09 -08:00
Meghan Denny
ed339b367d improve Bun.stringWidth's algorithm (#9022)
* improve Bun.stringWidth's algorithm

* add a bunch more tests from string-width package

* make typescript happy

* undo typescript changes

* use better #define check for debug mode

* properly handle latin1 width tests

* support grapheme clusters

* fix trailing newline

* visibleUTF16WidthFn- add fast path for leading ascii

* add firstNonASCII16IgnoreMin

* fix firstNonASCII16CheckMin

* vectorize visibleUTF16WidthFn

* support emoji variation selector

* expose stringWidth in release mode too

* vectorize visibleLatin1Width

* support ambiguousIsNarrow option

* add typescript definition for stringWidth
2024-02-22 19:16:17 -08:00
Meghan Denny
22c25fad92 bun.js: write to pointer instead of stack in bun.js/webcore/body (#9059) 2024-02-22 19:07:56 -08:00
Jarred Sumner
a18b44d01f Bump version 2024-02-22 12:59:59 -08:00
Jarred Sumner
ee791a839f add microbenchmark 2024-02-22 12:58:35 -08:00
Zack Radisic
2605722891 shell: Allow duplicating output fds (e.g. 2>&1) (#9004)
* Open with proper perms when redirecting file to stdin

* Add test for redirecting file to stdin

* Extract redirect flags -> bun.Mode logic to function

* Remove dead code

* Support duplicating output file descriptors

* Clean up

* fix merge fuck up

* Add comment documenting weird hack to get around ordering of posix spawn actions

* Update docs

* Delete dead code

* Update docs
2024-02-21 18:45:44 -08:00
argosphil
53739f8a53 fix: modify bcrypt to be able to verify passwords directly (#9010)
Fixes #9009.

This would make the "bcrypt" algorithm (actually a variation of it)
easier to use.
2024-02-21 18:34:18 -08:00
dave caruso
44f7ddd2ff fix: ConsoleObject handles proxy better (#9042)
* fix: ConsoleObject handles proxy better

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-21 18:33:54 -08:00
Zack Radisic
048ae7c7b8 shell: Fix latin-1 template literal strings (#9040)
* Fix latin-1

* Move utf8 check above 8bit check
2024-02-21 18:32:42 -08:00
Jarred Sumner
2c6cd24393 Implement expect().toBeOneOf(), fix small memory leaks in expect matchers (#9043)
* Add .toBeOneOf

* Fix memory leaks in .toContain(), .toInclude(), toContainKeys(), toBeTypeOf(), toEqualIgnoringWhitespace

* Handle exception

* Ignore non-bool

* Propagate errors when the message callback throws

* fixups

* Update preload.ts

* Update jest-extended.test.js

* Update expect.zig

* comments

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-21 18:31:14 -08:00
Dylan Conway
9ee39cac8b fix(install): semver prerelease bugfix (#9026)
* make sure prereleases match correctly

* add the file

* few more tests

* make sure pre is in query, not group
2024-02-21 14:47:43 -08:00
Kenta Iwasaki
20275aa040 fix(ws/client): handle short reads on payload frame length (#9027)
* fix(ws/client): handle short reads on payload frame length

In the WebSocket specification, control frames may not be fragmented.
However, the frame parser should handle fragmented control frames
nonetheless. Whether or not the frame parser is given a set of
fragmented bytes to parse is subject to the strategy in which the client
buffers received bytes.

All stages of the frame parser currently supports parsing frames
fragmented across multiple TCP segments except for the payload frame
length parsing stage.

This commit implements buffering the bytes of a frame's payload length
into a client instance so that the websocket client is able to properly
parse payload frame lengths despite there being a short read over
incoming TCP data.

A test is added to
test/js/web/websocket/websocket-client-short-read.test.ts which creates
a make-shift WebSocket server that performs short writes over a single
WebSocket frame. The test passes with this commit.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-21 14:31:57 -08:00
Cameron Haley
bdb70d5bc2 Account for initial_thread_count in napi threadsafe_function logic (#9035) 2024-02-21 14:19:43 -08:00
Jarred Sumner
6184542682 Add BUN_DEBUG flag to control where debug logs go (#9019)
* Add `BUN_DEBUG` flag to control where debug logs go

* Update all the actions

* Configure temp

* use spawn instead of rm

* Use CLOSE_RANGE_CLOEXEC

* Make some tests more reproducible

* Update hot.test.ts

* Detect file descriptor leaks and wait for stdout

* Update runner.node.mjs

* Update preload.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-21 14:13:43 -08:00
Jarred Sumner
a0be3cb2ff Slightly reduce code duplication in expect (#9018)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-20 18:58:33 -08:00
dave caruso
5c6b9ea9b6 change how bunx caches things (#8921)
* some things

* yeah

* ok

* fix compilation error

* fix on windows

* ok

* username
2024-02-20 18:58:12 -08:00
Eemeli Palotie
48e7c0fb8e fix: install vendored node_modules when using hardlinks (#9007)
* fix: install vendored node_modules when using hardlinks

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-19 22:50:24 -08:00
Zack Radisic
2656418e50 Don't immediately delimit command substitution result (#9005) 2024-02-19 21:26:50 -08:00
Zack Radisic
7056384702 Fix file redirect stdin not working (#9000)
* Open with proper perms when redirecting file to stdin

* Add test for redirecting file to stdin

* Extract redirect flags -> bun.Mode logic to function

* Remove dead code

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-19 14:56:32 -08:00
Meghan Denny
5712ba8b3b debug: introduce bun.callmod_inline (#9001) 2024-02-19 14:43:42 -08:00
dave caruso
6f1939621c fix astro (#8999)
* fix astro

* set undefined

* [autofix.ci] apply automated fixes

* Fix astro

* Fix test

* Remove bad assertion

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-19 13:48:08 -08:00
Yannik Schröder
182d052d4b events.on: Add compatibility with readline module (#8885)
* fix: make event.on work with for...await of readline module

* fix: queueing events before next() call and multiple event vals

* test: add tests for events.on and readline for await...of

* style, docs

* [autofix.ci] apply automated fixes

* refactor: use removeListeners instead of check for done

* test: merge test files

* test: remove todo comment

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-19 11:44:09 -08:00
Jarred Sumner
42d15ea853 Fixes #8964 (#8978)
* Fixes #8964

* Fix test.each when used with test.only

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-19 10:36:08 -08:00
Jarred Sumner
7407080628 Bump 2024-02-19 10:28:05 -08:00
Jarred Sumner
7ec9ad5cb7 Add test for #7864 (#8997)
* Add test for #7864

* Add napi-rs/canvas

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-19 10:27:12 -08:00
Meghan Denny
141140ef7c windows: pass more tests (#8938)
* windows: implement bun.isWritable

* windows: pass test/cli/run/as-node.test.ts
C:\Users\dave\AppData\Local\Temp\bun-node-a2ae984c3\node.exe is a hardlink on windows so it will not resolve to C:\bun\build\bun-debug.exe
skip the first param since that is not the behavior this test is supposed to be testing

* windows: pass test/js/node/dns/node-dns.test.js

* windows: pass test/js/node/process/process.test.js

* windows: pass test/js/web/streams/streams.test.js

* windows: pass test/js/workerd/html-rewriter.test.js
Closes #8459

* windows: fix node:util.inspect

* windows: these pass now

* windows: pass test/js/node/stream/node-stream.test.js

* disable http sendfile on windows

* use url.origin here

* more sendfile removal

* windows: pass test/js/web/websocket/websocket.test.js

* test/js/deno/performance/performance.test.ts is flaky, come back to it

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-19 10:23:31 -08:00
Cameron Haley
8c7972fdc8 Don't rely on stored napiRef; Always create a new one in napi_create_reference (#8995) 2024-02-19 09:07:15 -08:00
Jarred Sumner
80e4712662 Skip sqlite math fns test on macOS 2024-02-18 12:08:17 -08:00
3λiȯ+
3221bfeeb7 docs: Fix unclosed code block in the example for WebSocketHandler (#8971) 2024-02-17 18:11:22 -08:00
Dale Seo
89641f2e4a chore: add types for date mocking api of jest (#8387) 2024-02-17 08:05:16 -08:00
Risu
bc74154536 docs: use consistent tsconfig for both in docs and bun init (#8953) 2024-02-17 08:04:03 -08:00
Jarred Sumner
a6acb257c1 Fixes #8940 (#8957)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-17 05:48:36 -08:00
Risu
c34bbb2e3f fix: organize tsconfig (#8654)
* fix: organize tsconfig

* fix: remove unnecessary comments in tsconfig

* docs: revert changes on comments and md text

* docs: fix case
2024-02-16 22:19:31 -08:00
Jarred Sumner
f9b12300d4 Make shell errors slightly better (#8945)
* Make shell errors slightly better

* Update shell.ts

* Fix the failing tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-16 20:43:42 -08:00
Jarred Sumner
abf1239976 feat: Support async generator functions in Response and Request for bodies (#8941) 2024-02-16 20:02:22 -08:00
argosphil
e2c92c69b5 fix: make sure Bun.sleep(Date) doesn't resolve prematurely (#8950)
* fix: make sure Bun.sleep(Date) doesn't return prematurely

Fixes #8834.

This makes Bun.sleep(new Date(x)) fulfill its promise only when
Date.now() >= x.

* resolve test now #8834 is fixed

11 ms is in fact the right limit.

---------

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-02-16 18:32:37 -08:00
Tony Zhang
135de4dff7 fix(sqlite): enable math functions (#8944)
* fix(sqlite): enable math functions

* fix(sqlite): enable math function flag in CMakeLists

* test: add math function tests

---------

Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-02-16 18:24:55 -08:00
Dmitri
fe8ec29f1f Add fs.exists[util.promisify.custom] (#8936)
* Add fs.exists[util.promisify.custom]

fs.exists doesn't follow the error-first-callback convention, so it
needs a custom implementation for util.promisify.

* Simplify

---------

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-02-16 18:24:04 -08:00
Ashcon Partovi
27eed543ef Add .env to .gitignore 2024-02-16 14:13:19 -08:00
John-David Dalton
17e01a284b Add url unit tests with failing tests TODO commented-out (#8933)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-02-16 11:32:08 -08:00
Zack Radisic
2b56451a11 Shell changes/fixes (#8846)
* Fix #8403

* Throw on error by default

* Add the shell promise utilities to `ShellOutput` and `ShellError`

* Fix tests

* [autofix.ci] apply automated fixes

* Fix memleak

* [autofix.ci] apply automated fixes

* Woops

* `Bun.gc(true)` in fd leak test

* fd leak test should check if `fd <= baseline`

* wtf

* oob check

* [autofix.ci] apply automated fixes

* Fix double free

* Fix #8550

* increase mem threshold for linux

* Requested changes and make not throw on by default

* [autofix.ci] apply automated fixes

* more requested changes

* Do destructuring in function definition

* delete

* Change shell output test to enable throwing

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-16 05:01:55 -08:00
Zack Radisic
0e2a3a0197 fix(glob): fix patterns starting with * #8817 (#8847)
* Fix #8817

* [autofix.ci] apply automated fixes

* yoops

* fix broken stuff from merge

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-16 04:12:12 -08:00
Zack Radisic
ebaeafbc89 feat: More robust and faster shell escaping (#8904)
* wip

* Proper escaping algorithm

* Don't use `$` for js obj/string referencs

* [autofix.ci] apply automated fixes

* Changes

* Changes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-16 04:09:34 -08:00
Meghan Denny
2b335d72e7 windows: make websocket-client.test.ts pass (#8935) 2024-02-16 04:07:06 -08:00
guest271314
dcda49a271 Missing toWeb (#8937)
https://github.com/oven-sh/bun/issues/3927
2024-02-15 21:41:46 -08:00
John-David Dalton
d49cb0b98e chore: Add PrivateRecursive type annotations (#8291) 2024-02-15 17:35:08 -08:00
dave caruso
bb31e768de docs: update windows build instructions
this removes the WSL codegen step as it is no longer supported, and some other notes i am aware of now
2024-02-15 16:54:03 -08:00
Jake Gordon
099825e5ac Common HTTP server usage guide (#8732)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-02-15 16:30:59 -08:00
Henrikh Kantuni
fc05cbfedc Fix typo (#8930)
"Buns supports" → "Bun supports"

Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-02-15 16:20:55 -08:00
argosphil
c920919c42 fix: distinguish getters and setters in Bun.inspect() (#8858)
* Bun.inspect: distinguish [Getter], [Setter], [Getter/Setter]

fixes #8853

NOTE: this modifies files which were auto-generated at one point, but
which are now maintained as part of the Bun sources.

* test for #8853

---------

Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-02-15 13:09:13 -08:00
Georgijs
da78103b1c fix typo (#8929) 2024-02-15 13:07:07 -08:00
dave caruso
a2ae984c3e disable some tests that are failing in ci (#8922)
* try to make ci green

* fix a crash in debug mode

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-15 07:09:44 -08:00
Jarred Sumner
151512dcc9 Release weak refs before responding to websocket messages (#8898)
* Release weak refs before responding to websocket messages

* Yes

* Wrap the methods instead of the callers

* oops

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-15 07:09:10 -08:00
Toby Cm
1b945ba2ef fix: Update URL in non-avx warning message (#8435)
`https://github.com/oven-sh/bun/release/bun-v1.0.25/bun-linux-x64-baseline.zip`

->

`https://github.com/oven-sh/bun/releases/download/bun-v1.0.25/bun-linux-x64-baseline.zip`
2024-02-15 03:57:22 -08:00
dave caruso
e8dff7b029 chore: random acts of cleanup to tests (#8915)
* random acts of cleanup to tests

* nerf the watchFile test, is CI slow?

* more things

* [autofix.ci] apply automated fixes

* a

* remove a log

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-14 22:40:50 -08:00
Jarred Sumner
d936f365c8 Fixes #8909 (#8911)
* Fixes #8909

* Add it

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-14 18:57:20 -08:00
Jarred Sumner
48c0d7aadc Fix incorrect type definition in usockets loop (#8912)
* Fix incorrect type definition

* Remove dead code

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-14 18:57:07 -08:00
dave caruso
cf054456ce fix build on all platforms 2024-02-14 18:38:20 -08:00
Jarred Sumner
57b1e545f8 This debug code should not have been committed 2024-02-14 18:36:24 -08:00
Meghan Denny
12f83cf48b make V8StackTraceIterator frame parser more robust (#8814)
* make V8StackTraceIterator frame parser more robust

* remove StringView_count and only call StringView::find as many times as we need
2024-02-14 18:25:30 -08:00
Lei
b0f9e03230 Fix coverage.md (#8864)
See lines 264/271 of bunfig.zig
2024-02-14 18:20:37 -08:00
argosphil
7481a29f4e fix: brotli decompression's multi-packet case (#8881)
* fix: reset buffer pointer (misleadingly named total_in) for brotly

Fixes #8017

* fix: panic if brotli decompressor misbehaves
2024-02-14 18:19:46 -08:00
argosphil
0714b3a06b fix: throw on gunzipSync/inflateSync error (#8901)
* fix: zlib functions should throw an error if appropriate

Fixes #8887.

* Tests for #8887

* fix: drive-by fix to avoid unreachable code being reached on error
2024-02-14 18:01:05 -08:00
Dylan Conway
08c2148000 fix(windows): console-iterator.test.ts fix (#8879)
* fix console iterator tests on windows

* rename and size only when bytes is active

* assert size > 0
2024-02-14 17:59:19 -08:00
James Anderson
00cc2eae67 Fix tsconfig path longest prefix matching (#8892) 2024-02-14 08:23:45 -08:00
Dylan Conway
82a07430ed fix(windows): use allocated memory for \\\\.\\NUL replacement on windows (#8889)
* use allocated memory for /dev/null

* deinit
2024-02-13 22:23:54 -08:00
Georgijs
636a8f1f0a Prevent open but inactive http connections from keeping alive http server (#8829)
* unref uv handle after creating uws socket

* unref sockets between http requests to allow the event loop to exit

* remove stale comment
2024-02-13 22:22:44 -08:00
7f8ddd
05d33c39cd fix: Add charset to text/css mime type (#8825)
* Add charset to text/css mime type

Standard: https://www.iana.org/assignments/media-types/text/css

More info: https://stackoverflow.com/questions/70643383/which-mime-types-contain-charset-utf-8-directive

Fixes the warning in Edge that says to include utf-8 when Bun returns a stylesheet.

* Add test

* Change "content type" to "mime-type"
2024-02-13 20:47:02 -08:00
dave caruso
aba37525a6 windows: fix bundler reliability and nuke WSL-based codegen scripts (#8890)
* bruh

* yeaaahhhhhhhhhhhhhhhhhhhhhhhhhhh

* revisions

* yeah

* fix

* make no codegen do less things
2024-02-13 20:33:24 -08:00
dave caruso
04a6ebaa17 fix: allow opening win32 device files in node:fs and bun.file (#8801)
* support opening device files in node:fs and bun.file

* tidy tests

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-13 18:24:14 -08:00
Augie
7405c5a615 feat: make curl install script run the windows installer (if run through cygwin) (#8875)
This updates the *nix install script to run the Windows Powershell install script if it detects it's on Windows.
2024-02-13 11:35:17 -08:00
Jarred Sumner
d0903f6b71 Cherry-pick 570fe762c8 (#8830)
This cherry-picks 570fe762c8

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-02-13 10:58:27 -08:00
Ciro Spaciari
d0b6218bdf fix(fetch) redirects bodies should be handled (#8874)
* redirects bodies should be handled

* [autofix.ci] apply automated fixes

* Update src/http.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-12 21:14:00 -08:00
Meghan Denny
8afcb39055 windows: more tests are passing (#8873) 2024-02-12 17:52:14 -08:00
Meghan Denny
b2a697f264 scripts/codegen.ps1: update wsl call (#8871) 2024-02-12 16:46:26 -08:00
Zack Radisic
aca936515a Make glob work for windows (#8382)
* Fix some related to paths and string encoding

* Fix relative paths with glob

* Fix scan tests

* Fix glob scan test

* [autofix.ci] apply automated fixes

* Fix leak test

* clean up post merge

* [autofix.ci] apply automated fixes

* clean up glob getcwd

* remove old struct

* fix open on posix

* feat: Add win32 path.toNamespacedPath and align rest of node:path with Node (#8469)

* restore zls file change

* [autofix.ci] apply automated fixes

* switch to using fs.top_level_dir in glob

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-02-12 16:30:58 -08:00
Zack Radisic
6ba146c3e0 Run zig fmt 2024-02-12 17:40:36 -06:00
Georgijs
a80b3569b4 disable quiet logs when BUN_DEBUG_LOG is set to 0 (#8866) 2024-02-12 15:20:38 -08:00
argosphil
8b5cac1ea1 chore: use shell-independent globbing in bun run fmt:zig (#8861)
* fix: use shell-independent globbing in bun run fmt:zig

* Erase experimental creature escaped from @paperdave's lab.

See https://github.com/oven-sh/bun/pull/8861#discussion_r1485747297
2024-02-12 14:51:39 -08:00
John-David Dalton
96e7227087 feat: Add win32 path.toNamespacedPath and align rest of node:path with Node (#8469) 2024-02-12 14:27:26 -08:00
Dale Seo
f88855da4f docs: non-null assertion is needed on document.getElementById (#8540) 2024-02-11 20:10:17 -08:00
Ujjwal gupta
19cb3ab6ff fix: ws.publish() not working (#8855)
* fix: ws.publish() not working

* fixes
2024-02-11 13:56:06 -08:00
argosphil
862d35d832 fix: bun test -t (#8845) 2024-02-11 08:39:27 -08:00
argosphil
a0bcd0f946 Fix expect().toBeGreaterThan() not throwing when ANSI is disabled (#8838) 2024-02-10 14:00:16 -08:00
guest271314
2264bb3d04 Substitute js/ for test/js/ (404) (#8808) 2024-02-10 10:44:22 -08:00
Ciro Spaciari
3e1231deb4 fix(crypto) fix KeyObjectkey handling (#8824)
* ref/deref buffer

* Clean up this code

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-09 21:14:35 -08:00
dave caruso
dfcac563bc fix error message in bun.serve (#8828)
* fix error message in bun.serve

* ok
2024-02-09 17:24:46 -08:00
Ciro Spaciari
90fd322b5c fix timer tests (#8804) 2024-02-09 14:00:47 -08:00
Zack Radisic
f77b217abf Correct shell docs for $.escape() 2024-02-09 11:41:59 -06:00
Risu
7c2be6a877 Fix bun-types/index.d.ts (#8802) 2024-02-09 08:46:42 -08:00
Dylan Conway
a3c3dad351 wrap (#8812) 2024-02-09 03:42:03 -08:00
Travis Cooper
98b438d0a4 Update bunfig.md (#8807) 2024-02-09 01:54:00 -08:00
cirospaciari
58d22b063c Unmark tests that are now passing on Windows 2024-02-08 23:02:32 -03:00
Ciro Spaciari
8cd1db9cda [windows] fix crypto (#8797)
* fix password

* refactor

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-08 18:00:22 -08:00
dave caruso
2d7df726fd fix: get bun build working on window (#8712)
* work on bundler

* a

* YAAAAYYAYAYAYYAYA

* get some more bundler tests working

* Update src/bundler/bundle_v2.zig

* rev

* ok

* i converted the cmakelists into LF

* personal review

* we didnt win

* okey they pass

* revert :(

* a

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-08 17:56:26 -08:00
Ashcon Partovi
1ccf0c2e9c Fix some errors not showing up in GitHub annotations (#8799)
* Remove dead code now that `expect()` can be used outside of tests

* Fix some errors not being rendered to GitHub annotations

* [autofix.ci] apply automated fixes

* Update jest.zig

Try `execCallback`

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-08 17:52:58 -08:00
cirospaciari
db85e04ade Unmark tests that are now passing on Windows 2024-02-08 22:19:31 -03:00
Ciro Spaciari
c2936b205d [windows] fix(fetch) file:///, keepalive and tests on Windows (#8784)
* fix file:/// on windows

* skip fifo test

* fix keepalive

* fixes

* avoid std.os.getcwd on POSIX
2024-02-08 17:11:06 -08:00
dave caruso
8680641c23 make process.test.js pass (#8798) 2024-02-08 16:54:09 -08:00
Ciro Spaciari
e77db8ebac [windows] fix which (#8791)
* fix which

* [autofix.ci] apply automated fixes

* refactor

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-08 15:44:56 -08:00
Steven Roussey
dfbedd6a10 fix: flaky test (#8796)
This often fails in CI (and on my machine) non-deterministically.

The 1ms + the 5000 is likely setting up a race condition in tasks/microtasks. Just changing it to to +10ms instead of +1ms is enough.
2024-02-08 15:17:14 -08:00
Ashcon Partovi
8624a86eba Unmark tests that are now passing on Windows 2024-02-08 13:42:13 -08:00
Georgijs
bfc6091faf correctly unblock all signals (#8792) 2024-02-08 12:09:33 -08:00
Joe
9d0a88ab82 docs: quick note on dependencies for C++ (#8772)
* quick note on dependencies for C++

* note Ubuntu C++ standard lib issue and anchor link to troubleshooting

* clarify ubuntu distros
2024-02-08 11:18:37 -08:00
Jarred Sumner
2f8f77eeb7 Ignore panic in reload (#8778)
* Ignore panic in reload

* Use

* Update c-bindings.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-08 00:29:08 -08:00
Steven Roussey
7b6e0f7164 fix: Increase max depth of expect diffs (#8771)
Fix Issue #6519
2024-02-07 16:07:20 -08:00
Ciro Spaciari
5df59cb02b [windows] fix(fs.watch) (#8746)
* clean fixes

* [autofix.ci] apply automated fixes

* more tests passing

* EPERM instead of AccessDenied

* [autofix.ci] apply automated fixes

* fix test on windows

* cleanup

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-07 15:44:07 -08:00
Jarred Sumner
b61282e290 Fix async module mocking (#8769)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-07 15:40:10 -08:00
Dylan Conway
dd3227c436 fix: crash in release builds (#8773)
* zig

* unreachable

* more comment
2024-02-07 15:38:14 -08:00
Georgijs
a9a4bbcd24 remap 0.0.0.0 to localhost on windows (#8770) 2024-02-07 15:17:24 -08:00
Georgijs
55aa35ee35 Fix watch attempting to reuse ports that are not yet released by the old process (#8764)
* windows watcher start new process only after previous terminated

* simplify env setup in spawnWatcherChild
2024-02-07 15:11:28 -08:00
dave caruso
a99459ffdc fix: symlinked files as entry points do not show Bun.main (#8762) 2024-02-07 13:06:11 -08:00
Jake Gordon
08f957d33b fix glob example to be recursive as stated (#8755) 2024-02-07 12:53:28 -08:00
Georgijs
2bd4fe578e Make HTTP shutdowns more robust, speed up connection to localhost (#8730)
* http use arraylist to handle shutdowns

* on windows use wsaconnectbyname to speed up localhost connections

* use arbitrary port

* close socket on setsockopt error

* use null timeout in wsaconnectbyname

* Update src/http.zig

* fix zig compile

* update hostname on linux

* [autofix.ci] apply automated fixes

* fix getpeername failing after connecting with socket

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-07 12:19:41 -08:00
Georgijs
d672309547 c-ares dns on windows (#8737)
* c_ares dns on windows works

* handle errors

* fix invalid hostnames test
2024-02-07 16:26:53 -03:00
argosphil
e171f04ce6 Fix ref-counting of Bun.file(0) etc. (#8687) (#8741)
* Test for #8687

* Fix reference counting of Bun.file(0) etc. (#8687)

Fixes #8687.
2024-02-06 18:11:25 -08:00
Ciro Spaciari
651d5699a0 [windows] fix(fs.watchFile) (#8735)
* fix fs.watchFile

* oopsie

* fix bigint and persistent

* use repeat to make watchFile tests more reliable

* [autofix.ci] apply automated fixes

* follow the pattern

* add increment

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-06 18:10:28 -08:00
Meghan Denny
d0d4d8bf85 windows: enable more passing tests (#8711)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-06 16:08:49 -08:00
Ciro Spaciari
53814dda00 [windows] fix(http2) (#8734)
* fix win http2

* add includes

* cleanup

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-06 15:37:39 -08:00
Meghan Denny
d3d5c7a1d6 tidy: access env map through getter rather than direct field (#8716) 2024-02-06 11:25:45 -08:00
Jarred Sumner
972a7b7080 skip some tests 2024-02-05 19:51:08 -08:00
Jarred Sumner
e3759bbbfe Update bun-windows.yml 2024-02-05 18:46:18 -08:00
Jarred Sumner
f722236978 [windows] Make child_process.spawn not say "TODO: IPC" when IPC isn't used 2024-02-05 17:39:47 -08:00
dave caruso
e366921e90 fix(windows): make fs.symlink normalize forward slashes to backslashes (#8710)
* fix fs.symlink()

* update comment

* .

* add todo
2024-02-05 16:09:50 -08:00
Georgijs
bd2779b029 Fix --hot with empty file, make --hot faster on windows (#8708)
* reduce watcher timeout in windows, fix hot reload with empty files

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-05 14:40:18 -08:00
Ashcon Partovi
a05ef0aeb1 Remove unintentional commit
This reverts commit 23b292ac21.
2024-02-05 12:50:09 -08:00
Ashcon Partovi
264142e756 Add isWindows and related helpers to test harness 2024-02-05 12:47:52 -08:00
Ashcon Partovi
51def5f5d6 Use biome in bun-types 2024-02-05 12:22:39 -08:00
Ashcon Partovi
23b292ac21 T 2024-02-05 12:22:39 -08:00
dave caruso
48ed1dfb65 less (#8651)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-05 10:06:23 -08:00
Drake Semchyshyn
bd4d0d15db Update plugins.md (#8674)
Updated Custom Plugins section (Svelte) so that the import name, and the name that was used, matches each other.
2024-02-04 01:19:00 -08:00
Jarred Sumner
1f0c1c81e9 Fix test 2024-02-04 00:42:40 -08:00
Jarred Sumner
e93eb6c1ab Add event loop debug assertion for Promise.resolve() and Promise.reject() 2024-02-04 00:03:45 -08:00
Jarred Sumner
1009b07807 Implement server.unref() and server.ref() (#8675)
* Implement server.ref() and server.unref()

* Update dns_resolver.zig

* Update server.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-03 23:57:34 -08:00
Georgijs
1a695f13bf Async file copying on windows (#8649)
* rework and simplify file opening in windows

* fix tests

* symlink tests pass

* update error handling

* remove outdated normalization check

* fix mac build

* apply suggested fixes

* fix path tests

* remove debug print

* fix windows compile
2024-02-03 22:33:35 -08:00
Jarred Sumner
c75e768a6c Assert we drained the microtask queue since the last time we called into JavaScript (#8646)
* Add checks that we drain the microtask queue whenever we call into JavaScript

* Drain microtasks in more places

* Tweak assertions for entering/exiting the event loop

* Drain more

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-03 07:40:15 -08:00
Dylan Conway
7d86f9e590 fix(test): strict equals and deleted properties (#8663)
* deleted properties size

* dont need count if structure id is eql

* more test

* fix slow path

* oops forgot this
2024-02-03 06:35:13 -08:00
Dylan Conway
a8600b0878 upgrade 2024-02-03 06:20:24 -08:00
Dylan Conway
5b228256f9 method and comment 2024-02-03 04:24:20 -08:00
Dylan Conway
ba4daee7e5 fix: statement joining and tmpdir on windows (#8659)
* drive letter

* joinwithcomma bundle

* tmpdir update

* same order as os.tmpdir
2024-02-03 04:17:12 -08:00
Jarred Sumner
2c0c562d1d Fixes #4746 (#8661)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-02-03 03:38:59 -08:00
Jarred Sumner
683a03d8c7 Set a default value for Error.prepareStackTrace to align with Node (#8657)
* Set a default value for `Error.prepareStackTrace` to align with Node

* Ensure we never set negative line/column numbers in error.stack (#8656)

* fix(windows): fix macros (#8653)

* fix macro tests

* path format options

* remove failing comment

* fix buffer toString memcpy length

* Ensure we never set negative line/column numbers in error.stack

---------

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-02-03 02:04:58 -08:00
Dylan Conway
e0c0fe235a fix(windows): fix macros (#8653)
* fix macro tests

* path format options

* remove failing comment

* fix buffer toString memcpy length
2024-02-03 00:35:25 -08:00
Jarred Sumner
d16ac87347 Export compile_commands.json 2024-02-02 23:25:07 -08:00
Dylan Conway
5934b17f00 fix(windows): fix a few more tests (#8644)
* fix regression tests

* fix fs.test.ts bigintstats

* enable transpiler cache lol

* remove failing

* fix filesystem router

* update

* fix run-unicode test

* update comment

* add updated snapshot

* fix remaining node-module-module tests

* fixup

* [autofix.ci] apply automated fixes

* fix tty tests

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-02 18:58:16 -08:00
Ashcon Partovi
eedf008c80 Fix formatting not always working 2024-02-02 14:25:53 -08:00
Meghan Denny
3a6318b67c windows: fix module.paths getter causing a crash (#8633)
* windows: fix module.paths getter causing a crash

* use the buffer that was there before
2024-02-02 01:29:50 -08:00
dave caruso
647b15e4f3 fix(windows): initialize uv allocators earlier (#8631)
* uv loop is thread local

* hi

* stuff so far

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-02 00:18:28 -08:00
ふかねこ
625b172a71 docs: Update binary-data.md (#8635)
Binary notation ("0b") is appropriate instead of hexadecimal notation ("0x").

Sorry for the omission of the correction in this [PR](https://github.com/oven-sh/bun/pull/8619).
2024-02-02 00:16:14 -08:00
Meghan Denny
4959c7d363 remove ZigString.Slice.from .init is the exact same thing (#8632)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-02-01 20:35:47 -08:00
Meghan Denny
8808437a02 meta: remove remaining references to prettierrc.cjs (#8634) 2024-02-01 19:24:17 -08:00
Tiramify (A.K. Daniel)
330a4744de chore: fix compiling fd.zig on linux (#8630) 2024-02-01 17:31:54 -08:00
Ashcon Partovi
3a1229d03d Add mysql2 integration test (#8075) 2024-02-01 15:04:49 -08:00
Ashcon Partovi
63a9a8b015 Improve .vscode extensions, tasks, and configuration (#8511) 2024-02-01 14:55:35 -08:00
dave caruso
f73bde79c7 fix(debug): get the result for fd debug message before we close it (#8626) 2024-02-01 14:26:20 -08:00
Meghan Denny
3a7df3f6c7 windows: add more passing test (#8615) 2024-02-01 13:45:47 -08:00
dave caruso
0037dc2537 chore: update webkit 2024-02-01 13:38:09 -08:00
ふかねこ
c0fe042102 Update binary-data.md (#8619)
Binary notation ("0b") is appropriate instead of hexadecimal notation ("0x").
2024-02-01 12:38:54 -08:00
Andres Guarneros
ce1eba1954 Update quickstart.md (#8622)
Update index.ts code snippet for consistency in quickstart.md.
2024-02-01 12:38:21 -08:00
Dylan Conway
8191fbd970 fix: id instead of path (#8617)
* use id

* another path
2024-02-01 02:19:18 -08:00
Dylan Conway
2af7cdedc2 path should be dirname 2024-02-01 00:34:34 -08:00
Dylan Conway
4f98336f86 fix(windows): fix installing non-ascii paths and make normalizeBuf generic (#8608)
* comptime type normalizeStringBuf

* delete

* revert

* revert revert

* revert

* remove unused

* remove unnecessary assert

* add comment

* remove normalize, need ../

* use Output.err

* update error message

* generic T suffix

* fix windows build

* more fix build

* more fix build

* mkdiratZ

* update test

* [autofix.ci] apply automated fixes

* update snapshot again

* fix merge

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-31 22:44:23 -08:00
dave caruso
91cfd614ca fix(window): some more bin things (#8612)
* allow linking bins that do not exist.

* fix some things
2024-01-31 22:37:03 -08:00
Meghan Denny
42e4cd8408 get more bundler tests passing on windows (#8560)
* get test/bundler/bundler_naming.test.ts passing on windows

* move platformToPosixInPlace to bun.path and use the vector'd version

* only resolve rel_path if it contains '/./', most of the time './' needs to be preserved

* fix another file too

* move kernel32 extern to better location

* [autofix.ci] apply automated fixes

* use bun.path.posixToPlatformInPlace here

* rewrite this whole section to stay in utf16 and handle errors

* remove dead comments

* fix a typo

* undo these relative changes

* preserve path.pretty from getting lost

* use bun's instead of zig's resolve here

* both side of this loop need the inplace normal

* use existing generic dirname function

* make path inplace functions generic

* we might need to modify this so copy on windows

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* don't assume the prefix we get from this

* more robust path traversal

* don't mangle absolute paths

* do this bit in a loop

* this line is a u16

* dont forget to compile before pushing

* this was wrong

* look into this later

* check pointer math first since its faster

* posix syscalls support path traversal, don't do the work for them

* its already inside stable, no need to change

* used the online editor

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-31 22:29:33 -08:00
dave caruso
dbe0a4a978 do more assertions (#8610) 2024-01-31 22:14:03 -08:00
Georgijs
350cc1178a --watch and --hot on windows (#8607)
* draft impl of windows watcher

* synchronous watcher

* working standalone watcher

* in progress changes to watcher

* make watcher non-global

* prepare watcher for windows impl

* add windows watcher scaffold and clean up imports

* fix inotify

* make watch code more generic over platforms

* fix visibility

* watcher starts without error

* printing changes works

* basic windows watching works

* handle process exit from watcher

* cleanup in process cloning

* clean up logging and panic handling

* fix hot reload test on windows

* misc cleanup around watcher

* make watch test actually useful

* [autofix.ci] apply automated fixes

* remove old files

* clean up watchers

* update .gitignore

* rework windows watcher into single watcher instance watching top level project dir

* use non-strict utf16 conversion

* change to contains

* fix mac and linux compile

* add baseline in crash report (#8606)

* allow linking bins that do not exist. (#8605)

* fix linux compile

* fix linux compile (again)

* remove outdated todo

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-01-31 22:06:33 -08:00
Jarred Sumner
dccabd9423 Make test work better on windows 2024-01-31 22:03:52 -08:00
dave caruso
345a061d3b fix(windows): make process.env case-insensitive (#8578)
* yay!!!!!!

* [autofix.ci] apply automated fixes

* ok

* do not use reflect here

* ok

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-31 21:52:50 -08:00
3λiȯ+
690346b30b docs: Fix typo in code example for Transpiler.transformSync (#8553)
* Docs: Fix typo in code example for transformSync

* Remove await since transformSync is synchronous

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-31 21:18:57 -08:00
huseeiin
16b7b94aea Update bun.d.ts (#8595)
Add `string | ArrayBuffer` to compressing/uncompression functions
2024-01-31 21:13:12 -08:00
Meghan Denny
fcf0047763 windows: pass ws.test.ts (#8611) 2024-01-31 21:08:19 -08:00
dave caruso
af1a124831 allow linking bins that do not exist. (#8605) 2024-01-31 19:08:50 -08:00
dave caruso
f5754e3c19 add baseline in crash report (#8606) 2024-01-31 18:13:39 -08:00
Joe
4e09f8ef8f Issue-6526 - clarify web docs for the use of .only() (#8600)
* Update writing.md

clarify the use of `.only()`

* Update test.d.ts

Small clarification in JSDoc
2024-01-31 14:12:26 -08:00
Luke Ingalls
1969204fa5 docs: remove outdated callout (#8584)
seems like this is already patched https://github.com/oven-sh/bun/issues/5394
2024-01-31 00:08:26 -08:00
dave caruso
2d9db9b28f fix napi-rs libraries on windows (#8583)
* yay

* a

* ok

* typo

* un-CRLFify these files
2024-01-30 20:21:52 -08:00
dave caruso
0333c7b0bf Fix "__dirname" on windows (#8579) 2024-01-30 16:17:32 -08:00
Dylan Conway
82829c5925 fix crash 2024-01-30 13:44:00 -08:00
dave caruso
8fdb46cb91 ok 2024-01-30 10:04:06 -08:00
vinnichase
0aba51230c dx: create symlink on every execution (#8568)
Symlink is not created on first setup.
2024-01-30 09:41:18 -08:00
Dylan Conway
ca801a35fe fix(windows): fix win32 errors (#8569)
* translate eexist

* use SystemErrno translation

* update
2024-01-30 06:49:59 -08:00
vinnichase
692fb220a4 Update launch.json to use ${workspaceFolder}/build/bun-debug (#8570) 2024-01-29 22:38:43 -08:00
dave caruso
cf1c849e4a fix(windows): more reliable extracting (#8567)
* finally

* a

* Update src/install/extract_tarball.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* fix compilation

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-29 20:03:02 -08:00
Jarred Sumner
2eede4f435 Fixes #8555 (#8566)
* Fixes #8555

* Make this closer to what npm does

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-29 17:52:08 -08:00
dave caruso
4989ef88b8 docs: mark PerformanceEntry and friends as implemented (#8466)
* docs: mark PerformanceEntry and friends as implemented

* Update docs/runtime/nodejs-apis.md

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-29 15:49:06 -08:00
Jarred Sumner
9fa26e6a09 Close more file descriptors in bun --watch (#8533)
* Close more file descriptors in `bun --watch`

* Reset signals

* Add comment

* Update bun.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-29 15:48:26 -08:00
Jarred Sumner
413aaaff33 [bun:sqlite] Support multiple statements in db.run() (#8541)
* [bun:sqlite] Support multiple statements in db.run()

* Update sqlite.test.js

* Update JSSQLStatement.cpp

* Another test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-29 15:17:51 -08:00
Dylan Conway
c538bf87d1 fix(windows): transpiler cache and other test fixes (#8471)
* umask

* process args

* update reportError.test.ts

* file exists

* transpiler cache

* back to const

* remove failing comments

* [autofix.ci] apply automated fixes

* update comment

* debug assert and remmove branch

* oops

* escape

* path sep

* seekTo

* disable

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-29 15:17:23 -08:00
dave caruso
1e9b44adda internal: report all failing tests to our internal feed (#8563)
* yeah

* oop

* yeahh
2024-01-29 15:17:14 -08:00
dave caruso
3046b0ee39 feat(windows): allow open and Bun.file() with /dev/null (#8499)
* DEV NULL

* oops

* ok
2024-01-29 11:08:09 -08:00
dave caruso
01d41838c5 fix(builtin-bundler): do not replace globals when extending classes (#8557)
* fix(builtin-bundler): do not replace globals when extending classes

* format
2024-01-29 11:07:39 -08:00
dave caruso
bc7e7027e4 windows: some random things (#8521)
* swaggin

* fix(bun_shim_impl): support exe names that are shorter than four characters

* hi

* a
2024-01-29 10:50:24 -08:00
João V. Farias
eaea6dea54 chore(build): adjust arch/manjaro linux auto detect to include artix (#8510) 2024-01-29 09:41:58 -08:00
Jarred Sumner
d0b759f784 Remove references to bun-types 2024-01-29 08:10:14 -08:00
Dale Seo
dbfc62e288 docs: include .jsx (#8542) 2024-01-28 10:00:54 -08:00
Yahya Jirari
34ae040d95 docs: remove unnecessary await in lines() example (#8537) 2024-01-28 06:36:29 -08:00
Ben Limmer
3caa846988 docs: expect.extend is implemented (#8525) 2024-01-27 20:39:46 -08:00
Dylan Conway
5a0ae3c256 not on windows 2024-01-27 07:32:06 -08:00
Dylan Conway
568f87eb8f fix(windows): bun link, unlink, and fix tests in test/cli/install (#8517)
* link and unlink

* valid git dependency cache path

* windows global link

* not git

* update some tests

* update more tests

* update

* update log

* fix snapshots

* more tests

* fix bun pm ls

* make it possible to delete cache dir

* normalize

* fix bun-create tests

* update bun-remove tests

* silent

* bun-run update

* update more tests

* update more

* update

* [autofix.ci] apply automated fixes

* update simdutf for getFdPath

* update test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-27 04:22:04 -08:00
dave caruso
968c21d80a feat(windows): support bun build --compile (#8503)
* alright

* were winning

* WAOOOOOO
2024-01-26 20:56:08 -08:00
dave caruso
6faeef6dc2 Workaround https://github.com/microsoft/terminal/issues/16606 (#8506)
Fixes #8504
2024-01-26 20:55:48 -08:00
Georgijs
08c9511acc [windows] nodefs (#8509)
* 100 passing fs tests

* 111 fs tests passing

* 114 passing fs tests

* 115 passing (TODO: fix path normalization for windows ntCreateFile

* all fs tests passing

* [autofix.ci] apply automated fixes

* make windows path norm smarter, fix tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-26 20:07:33 -08:00
Meghan Denny
1644f341f9 windows: setInterval.test.js is passing now (#8508) 2024-01-26 14:11:03 -08:00
nullun
17fc1e7be1 chore: Remove trailing whitespace (#8502) 2024-01-26 07:25:45 -08:00
Jarred Sumner
7492b3a203 [windows] Remove no longer failing tests from being marked as failing 2024-01-25 21:59:11 -08:00
Jarred Sumner
681baedab2 Track hasInstallScript and libc in NPM registry api (#8495)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-25 20:38:20 -08:00
Jarred Sumner
c7c3ae381b Make this test less flaky on Windows 2024-01-25 20:37:41 -08:00
Jarred Sumner
7543da0bb3 Always normalize the carriage returns in the bundler tests 2024-01-25 20:27:58 -08:00
dave caruso
83ac4f0c33 windows: fix bun plugin (#8485)
* plugins work now

* real

* Update src/js/builtins/BundlerPlugin.ts

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-25 19:34:51 -08:00
Jarred Sumner
3c42dfd42b [internal] Tweak jsonc formatting 2024-01-25 19:19:32 -08:00
Jarred Sumner
e3188c918a use Biome to format Bun's codebase instead of Prettier (#8494)
* Ignore

* Create biome.json

* Ignore

* biome

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-25 19:15:26 -08:00
Jarred Sumner
045672cf67 Force \n instead of \r\n on Windows CI 2024-01-25 19:05:47 -08:00
Dale Seo
345ed18454 fix: mock() should work with no arguments (#8492) 2024-01-25 17:06:36 -08:00
Jarred Sumner
5462ca01fd Typo 2024-01-25 16:33:07 -08:00
Jarred Sumner
4bfd8a8cef Make this test less flaky on Windows 2024-01-25 16:30:25 -08:00
Jarred Sumner
a2a12b5802 Make this test less flaky on Windows 2024-01-25 15:09:32 -08:00
Jarred Sumner
b6c1dc1fa8 Use native AbortController & AbortSignal when abort-controller is loaded (#8489)
* Nationalize `abort-controller`

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-25 15:01:29 -08:00
Jarred Sumner
f4f8bb377a Make this test less flaky on Windows 2024-01-25 14:53:20 -08:00
Jarred Sumner
5c21695db6 Bump + ci autofix (#8490)
* Bump

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-25 13:58:59 -08:00
Adam Dimitry Enzo Ambrosino
2c16b204ff Fix type definition for Array.fromAsync (#8486) 2024-01-25 10:32:47 -07:00
dave caruso
20f7fd5b08 fix(windows): do not use GetTempPath2W (#8477) 2024-01-25 08:13:36 -08:00
dave caruso
c9a7d24538 windows(install): add bun_shim (support bin linking, bin shebangs, etc) (#8265)
* shim v1 TODO

* fix BunXShimData

* wip

* put a little bit of the sa u c e on it

* wow

* wat

* a

* swag

* swag

* allllllllllllright

* Update src/install/bin.zig

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* swag

* swag

* finis

* fix submodules

* ok

* omg it works again

* silly

* ok

* OK

* update laucnh jsn

* swaaaaaaaaaaaaag

* remove debug

---------

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-25 07:38:55 -08:00
Jarred Sumner
108cae5189 Disable dead code elimination when code coverage is enabled (#8473)
This should hopefully make source mappings more accurate

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-25 05:31:44 -08:00
dave caruso
358be9e727 docs: update the windows build documentation and list it on the docs site 2024-01-25 04:15:41 -08:00
Jarred Sumner
2a6388d50b Silence log when ENOTCONN
When using sendfile() to stream, if the user aborted the request it may appear as `ENOTCONN`, which we were logging to the terminal. We really shouldn't be logging anything here, but it's a little unclear what kind of error to emit. It's not a fatal error.
2024-01-25 01:03:29 -08:00
Jarred Sumner
aa901a22c2 Update types.zig 2024-01-24 23:11:58 -08:00
Jarred Sumner
562495b878 [windows] Mark as known failing 2024-01-24 23:11:55 -08:00
Jarred Sumner
875728da83 [windows] Make more things panic 2024-01-24 22:47:40 -08:00
Jarred Sumner
47e7e004b1 Remove @known-failing-on-windows for tests which are no longer failing on windows 2024-01-24 21:03:32 -08:00
Georgijs
80bd3254cc fix argv parsing on windows (#8458)
* fix argv parsing on windows

* directly use zig stdlib

* remove debug comments, fix double deinit

* change bun.argv() to return slices, not null-terminated pointers

* fix test on windows to escape file paths correctly

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-24 20:54:01 -08:00
Jonathan Deiss
0bf8a25d50 Clarifies bun shebang in bunx documentation (#8437)
* Update bunx.md

* better phrasing of shebang
2024-01-24 19:59:56 -08:00
Meghan Denny
effb8f189b windows: fix some websocket tests (#8433)
* windows: fix some websocket tests

* this file should work now, report any errors

* make this change later

* add back running this with node

* add as const to these

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-24 19:40:59 -08:00
Johann
7eeefc1497 chore(password): fix sha256 typo (#8461) 2024-01-24 19:27:29 -08:00
Georgijs
025a5ba140 fix sys.dup on windows and make console-iterator work (#8463)
* fix sys.dup on windows and make console-iterator work

* fix(windows): fix console async iterator to not include the \r

* fix kill on windows again. and report the right errno

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-24 19:25:45 -08:00
Ashcon Partovi
885d705d55 Fix bun-types version being incorrect 2024-01-24 15:21:10 -07:00
dave caruso
3447bc2ed3 fixy 2024-01-24 03:16:23 -08:00
Jarred Sumner
f1f861fd74 [windows] Fix panic in server 2024-01-24 02:20:29 -08:00
dave caruso
58ba802ca6 ci(windows): install the profile build 2024-01-24 02:12:16 -08:00
Zachary Huang
73f3b92dc9 fix(ci): fix MacOS build when OpenSSL is also installed (#7759)
Co-authored-by: dave caruso <me@paperdave.net>
2024-01-24 01:44:04 -08:00
dave caruso
eeb10f3f7d fix(windows): fix node:url pathFromFileURL and fileURLFromPath and file url tests (#8442)
* yay for file urls

* swag

* oops

* merge conf

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-24 01:19:47 -08:00
dave caruso
8544f8ae68 ci(windows): debug info in the binaries + ship a version on github (#8443)
* debug info yaaaaaaaaaaaaaaaaaay

* fix the build
2024-01-24 01:16:17 -08:00
Jarred Sumner
9f5ce53544 Normalize another newline 2024-01-23 23:44:38 -08:00
Jarred Sumner
82b6a42a3c Normalize more paths 2024-01-23 20:48:48 -08:00
Jarred Sumner
0974479655 Normalize slashes 2024-01-23 20:47:37 -08:00
Jarred Sumner
918e1878a5 Normalize newlines 2024-01-23 20:45:37 -08:00
Jarred Sumner
17deafd05f Add TypeScript issue template 2024-01-23 20:39:08 -08:00
Dylan Conway
b7ae984ca1 fix(windows): update some bundler tests (#8440)
* replace invalid path character

* windows paths
2024-01-23 20:23:01 -08:00
Jarred Sumner
e848c3f226 Get Bun.write tests to pass on Windows and bun:sqlite tests to pass (#8393)
* Move ReadFile and WriteFile to separate file

* Use libuv for Bun.write()

* Update windows_event_loop.zig

* build

* Get bun-write tests to pass. Implement Bun.write with two files.

* UPdate

* Update

* Update failing test list

* update

* More

* More

* More

* More

* Mark the rest

* ok

* oops

* Update bun-write.test.js

* Update blob.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Dave Caruso <me@paperdave.net>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
2024-01-23 20:03:56 -08:00
Dylan Conway
cd3de9c788 fix(windows): fix text-decoder.test.js (#8436)
* use with_errors

* remove comment

* use correct index
2024-01-23 19:28:54 -08:00
dave caruso
945ad77bce window: fix runtime.js build process (#8438)
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
2024-01-23 19:27:57 -08:00
Chen Yufei
04a99deb0e copy_file: ioctl_ficlone EACCES, EPERM as not supported. (#8425)
ioctl_ficlone may return EPERM (in LXC container), EACCESS (in Android).
Those error should be taken as ficlone being not supported instead of
error.

Refer to this coreutils bug report https://bugs.gnu.org/62404
2024-01-23 18:24:54 -08:00
Ciro Spaciari
cff5dc0ee8 fix close on spawn and watch (#8426)
* fix close on spawn and watch

* add check closed, and fixes

* fix subprocess close
2024-01-23 18:09:13 -08:00
Dylan Conway
77ccf77e35 Revert "Revert "fix(windows): a bunch of install test fixes"" (#8431)
* keep cache dir path, use correct buffer

* make it work more better

* more working

* more fix

* more update

* more fix

* fix test

* update

* fix

* update pointers

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-23 18:00:18 -08:00
DidaS
864a726249 Improve bun-types (#8195) 2024-01-23 13:51:45 -07:00
Jarred Sumner
1407683f95 Revert "fix(windows): a bunch of install test fixes" (#8408) 2024-01-23 06:38:13 -08:00
dave caruso
1f928e9b6e goddamn (#8405) 2024-01-23 06:37:14 -08:00
Dylan Conway
e0cf77c660 fix(windows): a bunch of install test fixes (#8402)
* keep cache dir path, use correct buffer

* make it work more better

* more working

* more fix

* more update

* more fix

* fix test

* update tests

* comment and fix test

* one more fix

* fix build

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-23 06:36:53 -08:00
dave caruso
07a685bd3d feat(windows): implement the rest of node:os (#8399)
* feat(windows): implement os.networkInterfaces

* we are cooking (os tests almost pass)

* os

* fix version struct

* oops

* [autofix.ci] apply automated fixes

* fix the submodules

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-23 05:06:51 -08:00
dave caruso
80ad8d57f2 windows: fix a path resolution case (#8392)
* fix resolving certain filepaths

* extra

* swag

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-22 21:53:34 -08:00
Jarred Sumner
41b45599c6 Delete some dead code (#8391)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-22 21:06:13 -08:00
Ciro Spaciari
416e896c63 [windows] Implement fs.watch on Windows (#8379)
* implement fs watch

* fix unref

* fixes

* actually use bun.New

* fix destroy, use another buffer for joinPath, remove Win prefix

* oopsie
2024-01-22 20:29:46 -08:00
Dylan Conway
2d1e0dc240 trim correctly (#8388)
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-22 19:57:20 -08:00
Meghan Denny
c52e7c57d2 add another launch config for windows bun test (#8389) 2024-01-22 19:45:39 -08:00
Georgijs
c4a60f9059 fix to enqueue bundler tasks in correct event loop (#8386)
* fix to enqueue bundler tasks in correct event loop

* fix posix build

---------

Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
2024-01-22 19:45:24 -08:00
Dale Seo
15fe30ac41 docs: remove unncessary use of async in bun test examples (#8341) 2024-01-22 17:57:02 -08:00
Dale Seo
a014f1c566 docs: correct imports (#8380) 2024-01-22 17:14:55 -08:00
Jarred Sumner
73b0b35a42 Make the dev-server test more reliable 2024-01-22 17:09:47 -08:00
Georgijs
75524d0ae3 Fix eqlComptimeCheckLenWithKnownType (#8377)
* fix some env tests

* fix and simplify comptime string equality

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-22 16:41:30 -08:00
John-David Dalton
c21dc25a65 Change type for expect().toThrow(unknown) (#8373) 2024-01-22 13:27:25 -07:00
Georgijs Vilums
3bc0f90a7c skip invalid stringWidth test 2024-01-22 12:25:49 -08:00
Jarred Sumner
eaa1cd5553 Add shell-spawn microbenchmark 2024-01-22 03:23:47 -08:00
Jarred Sumner
6019665d4b Fixes #8276 (#8346)
* Fixes #8276

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-21 20:25:00 -08:00
Jarred Sumner
b7b0e28b10 Rename bun.zig to BunObject.zig (#8344)
* Rename `bun.zig` to `BunObject.zig`

* Rename `bun.classes.ts` to `BunObject.classes.ts`

* Update references to `bun.zig`

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-21 19:55:24 -08:00
moznion
c577c64aa7 docs: add description how to parse the CLI ARGV by the built-in parseArg (#8345)
Signed-off-by: moznion <moznion@mail.moznion.net>
2024-01-21 19:54:49 -08:00
Jarred Sumner
1560a866fe Skip stringWidth tests for now 2024-01-21 19:25:57 -08:00
Dale Seo
5b9e1e5708 docs: fix a typo (#8338) 2024-01-21 17:17:55 -08:00
Jarred Sumner
353f724a9c Update bun.d.ts 2024-01-21 06:11:49 -08:00
Jarred Sumner
a8ff7be642 Disable Bun.stringWidth until failing test case passes 2024-01-21 06:10:07 -08:00
Jarred Sumner
af67ee77a0 Bump 2024-01-21 04:48:55 -08:00
Jarred Sumner
b82656d9fc Introduce Bun.stringWidth (#8327)
* Introduce `Bun.stringWidth`

* [autofix.ci] apply automated fixes

* Update utils.md

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-21 04:47:36 -08:00
Jarred Sumner
7b9201a0fc Fixup 2024-01-21 04:23:18 -08:00
Jarred Sumner
627d60c6c7 Fix crash in fs.readFile
We were default-initializing the vm pointer to undefined
2024-01-21 04:19:33 -08:00
Jarred Sumner
c00f0787f0 [types][bun:sqlite] Make SQLiteError a class instead of an interface 2024-01-21 03:57:38 -08:00
Jarred Sumner
3ca0fcb67a [node:vm] Add missing createScript function 2024-01-21 03:57:17 -08:00
Jarred Sumner
43107f48fa Add onLongTimeout callback for WebSocket (#8323)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-21 03:49:28 -08:00
Dylan Conway
b1273e53d8 windows(install): fix linking workspaces and file: dependencies (#8289)
* install workspaces with junctions

* fix #8272

* symlink auto type

* fix file: dependencies

* a better fix

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-20 23:00:29 -08:00
Jarred Sumner
10e57fdc1e windows pipes (#8230)
* spawn sync investigation, pipe closed before uv_read_start is called

* oopsie

* win rusage

* oopsie

* Fix some things

* readable stream now works without FIFO like solution

* blob, ArrayBuffer, Buffer stdin now works

* remove unused

* add UVStreamSink

* update headers.j

* more bindings

* now works yay

* fix rusage on windows

* oops

* fix rare data

* win getUserName

* [autofix.ci] apply automated fixes

* fix build

* oopsie

* fix linux/macos

* exit code fix

* fix kill for win

* disable Bun__crashReportDumpStackTrace on Windows

* remove windows stack dump in report.zig and increase windows test timeout

* condition instead of assertion

* remove IPC again

* fix blob writer when not using TTY

* bump windows tests time again

* bump time again so we see how much we need (this is probably too much)

---------

Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2024-01-20 22:58:01 -08:00
Bjön Limell
fad3db84f0 (docs) Fixed color in node compat (#8299)
`node:module` was green, when it should be yellow.
2024-01-20 22:54:30 -08:00
Dylan Conway
fccab2f0da fix(node:child_process): fix crash with ipc (#8319)
* make sure `onLongTimeout` doesn't happen

* add `onLongTimeout` handler
2024-01-20 22:53:16 -08:00
Dylan Conway
885f9372f4 fix(transpiler): loose equality folding bugfix (#8317)
* fix #8311

* fix `bigint` comparison

* cleanup

* couple tests

* fix `"-0" == 0`

* Update transpiler.test.js

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-20 22:52:53 -08:00
Hanaasagi
509a2c5a69 fix: fix the invalid free pointer in toStringWithBytes. (#8322)
Close: #8264
2024-01-20 22:26:58 -08:00
Meghan Denny
b433beb016 8096 isnt 8kb, 8192 is (#8296)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-19 23:16:11 -08:00
Dylan Conway
c71bad205c Update shell.md 2024-01-19 22:15:23 -08:00
Dylan Conway
d4794bbac8 Update shell.md 2024-01-19 20:05:22 -08:00
Dylan Conway
6fa35839c3 remove .only, update shell.md 2024-01-19 19:59:06 -08:00
Jarred Sumner
35d551c174 Fix passing undefined to $().cwd() and $().env() 2024-01-19 19:55:26 -08:00
Jarred Sumner
4674ee16a1 Simplify $.escape 2024-01-19 19:55:26 -08:00
Jarred Sumner
ce2ef65122 Small docs tweaks for shell 2024-01-19 19:55:26 -08:00
Dylan Conway
0d88dcb0fa Update shell.md 2024-01-19 19:21:26 -08:00
Jarred Sumner
15f727dc2f Update shell.md 2024-01-19 19:05:54 -08:00
Jarred Sumner
dcfec52b11 Update nav.ts 2024-01-19 18:55:29 -08:00
Meghan Denny
7ca4ca8972 copy_file: this TODO is no longer a compiler bug (#8294)
* copy_file: this TODO is no longer a compiler bug

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-19 18:45:59 -08:00
Dylan Conway
76ed8d8086 fix(install): remove invalid bin symlinks (#8293)
* handle invalid bin symlink

* test
2024-01-19 18:37:03 -08:00
Jarred Sumner
1f126cd91a Fix benchmark in node 2024-01-19 18:36:00 -08:00
Jarred Sumner
5e520884cd Add to docs 2024-01-19 18:35:46 -08:00
Max Milton
1c5b318207 feat: Carry over node isIPv4/isIPv6 performance improvements (#8271)
Copy over the `isIPv4`/`isIPv6` performance improvements from
<https://github.com/nodejs/node/pull/49568>.
2024-01-19 17:31:52 -08:00
Zack Radisic
1b1760a9c9 feat: Bun shell (#7748)
* bring in shell impl

* add `$` to global bun scope

* Expose shell parse func on debug mode

* Expose lex tokens and add tests

* refactor parser to have better ast

* assigns and export

* pipeline kinda working

* Decouple Subprocess spawning code from JS stuff

* Subprocess works!

* Conditional execution

* Support JS objects in template expression

* More complete redirection

* Properly drain stdin/stdout/stderr and fix crash from deallocating JSC memory

* Return errors in parser

* Support command substitution

* wip brace expansion stuff

* Rearrange some files

* expansion wip

* Brace expansion working

* wip brace expansion

* refactor brace algorithm

* wip brace expansion on shell

* fix brace expansion

* Working nested brace expansion!

* brace expansion in shell variable assignment only set the last expanded

* stuff

* Small little perf things

* benchmark and test and stuff

* stuff

* fix nested braces but its also kinda broken

* attempt to fix complicated nested braces

* test

* Use fast tokenized algorithm for non nested braces, use parsed algorithm for nested braces

* fix nested braces one and for all

* small stuff

* Not sure if that made a difference

* revert that

* good speed optimization

* rip

* Environment variables, builtin/native shell cmds

* Fix tests

* Support `cd`, `pwd`, add boilerplate for glob expansion

* Support `which`

* Support `rm`

* wip

* wip

* escaping and abstract shell char iterator

* strpool unicode

* Brace expansion support unicode, disallow invalid surrogates in shell script

* shell choose ascii or unicode lexer depending on input

* fix bugs write tests

* kinda start async stuff

* HOLY SHIT big refactor of Subprocess

woops forget to commit this

...and this

* HOLY MOLY it works

* Refactor some stuff, start eval word expansion

* interpret all the nodes

* stuff

* stuff

* stuff

* kind of works but doesnt

* Buffered output works

* no need to heap allocate autosizer

* Fix bug

* Fix some stuff

* unprotect

* move out dummy shell thing

* Bring back assignments

* create expansion state so it can be non blocking for expansions that need IO (glob, cmd subst)

* glob back in action

* Setup builtin non blocking IO commands and implement export

big issue is control flow is really fcked up here need to fix that

* make Cmd state machine use a loop so control flow is a bit more clear

* rename stuff

* move that

* Implement the echo builtin again

* implement cd again but non blocking io

* Fix ls and use proper write function to prevent blockign writes

* Implement which

* holy moly big port std.fs.deleteTree

* fix compile errors

* Okay that works

* rm works thatsnice

* damn

* split it out

* rm async implementation

* fix rm bug for nested

* Work on files as well

* prevent root from being deleted

* rm error handling

* oops

* pwd and fix some script exec bug

* Implement `mv`

* stub out mv to work accross filesystems

* move it around

* woops

* boilerplate for ls and options

* more boilerplate

* stuff

* that got lost in merge

* upgrade shell stuff zig 0.12.0-dev.1828+225fe6ddb

* Implement basic ls

* smol cleanup

* Fix stream, response redirect stdin

* No longer need spawn to be abstract

* Custom promise

* move around some stuff

* shell promise returns shell output

* make tht work for builtins

* refactor IO abstractions to work with JS or mini event loop

* woops

* scaffolding for refactor

* refactor builtins to make event loop refactor easier

* Fix parsing edge case on assignments, fix expansion on cmd assignments

* change subproc to work with any event loop

* Finish refactoring subproc

* move global abstraction out

* big refactor boys

* holy moly: integrate into cli and fix allll the compile errors

* okay works in bun run now

* actually tick the event loop lol

* Fix more stuff

* Support comments

* Fix some tests

* delete that

* Properly report errors when failing to spawn command

* fix a whole bunch of tests

* fix a whole bunch of tests again

* .

* Fix rm

* Fix some exit code bugs, write force rm from deno, fix ls stderr

* fix `rm -d`

* fix `rm -d`

* Fix boolean logic

* error on subshells (e.g. `true && (echo hi && echo lol)`)

* Move out shell state from interpreter struct

* Cmd substitution supports arbitrary script, not just a single cmd

* Some escaping/quotation tests

* Fix stuff add more tests:

- cmd substitution quotations
- escape backticks in single quots

* ALOT of stuff:

- fix proper subshell inheritance of env for cmd subst
- fix: was wrong, assignments don't run in subshell in conditionals
- fix lexing chained vars `$VAR$VAR`
- more tests

* Fix subtle bugs

* Fix crazy redirect to arraybuffer bug

* more crazy echo edgecases

* Proper lexer errors instead of just panicking lol

* yoops

* Proper parsing errors

* Errors for bun run shell script

* Fix redirecting to file

* More test fix bugs yay

* Fix redirect on builtins

* Open redirection fds with O_TRUNC

* Fix lexing invalid variables and add ability to change cwd from JS api

* yoops

* Fix `.cwd()`

* `$PWD` and fix redirection bugs

* `$PWD` and fix redirection bugs

* Get rid of  some `FIXME`s

* throw errors in some places instead of panicking

* Print some errors to stderr

* Get rid of some more panics again

* Handle errors on glob

* pwd test

* `.env()`

* copy-on-write abstraction

* Reference counted env strings + fix some tests

* deinit cwd

* Put commands into a pipeline properly

* deinit Expansion and Assigns properly

* comments

* Comments

* Make it compile

* Update types

* [autofix.ci] apply automated fixes

* Only one WaiterThread

* Fix lifetimes and clean up interface

* Update shell.ts

* Add lazy test

* Remove some dead code

* Update shell.zig

* Fix memory leak

* Fix crash with empty braces

* [autofix.ci] apply automated fixes

* Linux build + bun.sh

* Update subproc.zig

* Update interpreter.zig

* Update interpreter.zig

* Fix some stuff that broke

* Fix Windows compile errors

* Fix some fd leaks

* Fix ls

* Fix a bunch of stuff

* Fix quiet

* Update leak tests fix rm bug

* More reproducible tests

* [autofix.ci] apply automated fixes

* more mem leak tests

* [autofix.ci] apply automated fixes

* Fix merge conflict

* Fix test not actually using temp directory

* Update bunshell.test.ts

* Shell instance

* Capture async context

* Increase test timeouts

* [autofix.ci] apply automated fixes

* Escape

* [autofix.ci] apply automated fixes

* Fix crash

* Add more methods

* [autofix.ci] apply automated fixes

* Fix leak

* Treat file(path) blobs as a file path string

* Create bunshell-file.test.ts

* Support Blob input

* Fix leak + organize imports

* doc

* Update shell.md

* Update shell.md

* Update shell.md

* Update shell.md

* Update CMakeLists.txt

* Fix segfault by cloning error path so it's not freed by arena

* deinit ShellErr

* Delete dead code

* fix really stupid segfault

* don't deinit shell ls task in event loop

* Fix ls bug

* Fix tests

* make truly lazy

* allow more things in the shell substitution and escape whitespace

* Fix newline and exit when finishing shell in `bun run`

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-19 17:30:57 -08:00
Lukas Kastern
751ff68268 feat: Add async support to Bun.serve onError (#8233)
* WIP

* Support not immediately fullfilled promises

* Typo

* Add tests

* Fix test

* Rename test

* Remove file

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-19 16:01:09 -03:00
Jarred Sumner
3c785c88fb Fix issue with perf_hooks in canary (#8279)
* Update perf_hooks.ts

* Update perf_hooks.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-19 05:22:06 -08:00
Dylan Conway
8efa01bd62 fix(bun:test): toContain and toContainEqual string fix (#8270)
* update toContain, toContainEqual, and tests

* fix build, use cursor

* `strings.indexOf` and `jsType` once
2024-01-18 20:13:57 -08:00
Ashcon Partovi
e17709a2d3 Fix bun --inspect with fully-qualified URL (#8267) 2024-01-18 18:32:51 -08:00
Alexandre Seo
c50400e186 Fix bug in string handling in toContain and return undefined in all matchers (#7692)
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
2024-01-18 14:14:16 -08:00
guest271314
ff965af067 Update comment to include "except a built-in" (#8251)
build.module() throws for "buffer"

 9 |   setup(build) {
10 |     build.module(
         ^
error: module() cannot be used to override builtin module "buffer"
2024-01-18 03:29:10 -08:00
Jarred Sumner
48d642e9e0 Add a note about timeouts and max payload size 2024-01-18 03:14:03 -08:00
Jarred Sumner
e197b7c3a0 Fix crash in socket (#8241)
* Fix crash in socket

* Fix Socket timeout issue

* Add test for socket timeout

* Update socket.test.ts

* Fix linux tests

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-18 02:19:58 -08:00
Jarred Sumner
95e466628b Add a note about reading directories 2024-01-17 22:16:34 -08:00
dave caruso
41dda11802 fix: upgrade_command compilation error 2024-01-17 22:08:02 -08:00
dave caruso
8ba332b43a fix(windows): Implement bun.sys.renameat on Windows and fix crash during bun upgrade (#8242)
* fix #7989

* doc

* oops
2024-01-17 22:01:53 -08:00
Michael H
52894121ea bun run: "package.json scripts" at bottom (#8224)
* `bun run`: put "package.json" scripts at bottom & better errors

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-17 18:18:40 -08:00
Jarred Sumner
a5e83189df Stub more of perf_hooks (#8239)
* Stub more of perf_hooks

* Update perf_hooks.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-17 17:41:47 -08:00
dave caruso
405e2d1517 windows: implement os.hostname (#8223)
* windows: implement os.hostname

* oops

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-17 17:33:02 -08:00
Meghan Denny
483b73c4bf absorb bun.fdcast into FileDescriptor and remove (#8240) 2024-01-17 17:32:03 -08:00
Cena Kopahi
cb97baed22 Update docs for @types/bun (#8160)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-01-16 23:26:50 -07:00
Jarred Sumner
01df0e6ef0 Fix prettier 2024-01-16 20:20:30 -08:00
dave caruso
08aa40c570 fix windows CI (use -MD again) (#8220)
* chore: upgrade webkit again

* fix submodules
2024-01-16 19:26:32 -08:00
dave caruso
82fcb38005 fix(windows): support utf16-le files in the bundler and in Bun.file (#8219)
* support utf16-le files

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-16 17:15:16 -08:00
Jarred Sumner
fc80683256 In fs.ReadStream, use $isObject to check options (#8218)
* In fs.ReadStream, use `$isObject` to check if function or object rather than typeof options === "object"

* Update fs.js

* Add test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-16 16:41:24 -08:00
Jarred Sumner
54be1d7705 Fix decimal -> integer conversion bug in process.exit & process.exitCode (#8216)
* Fix process.exit to allow numbers which were previously decimals

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-16 16:19:33 -08:00
Emre Cakiroglu
7eed9d893e fix: handle encoding deconstruction in node:fs (#8212) 2024-01-16 15:56:02 -08:00
Yusup Hambali
e77f9036e0 Fix title in dataview-to-string guide (#8209) 2024-01-16 15:27:38 -08:00
Lukas Kastern
5a6ef045aa fix: Hang when recursively logging via ConsoleObject.messageWithTypeAndLevel (#8213)
* Avoid deadlock in messageWithTypeAndLevel by adding a recursion counter

* Add test for recursive logs

* Do not rely on output of console-recursive.test.js

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-16 15:26:23 -08:00
Aarav Juneja
9350f6bc0b fix: match node's path.parse on dotfiles. (#8142)
* Fix #8090

* Fix bug from modification order.
2024-01-16 14:12:18 -08:00
dave caruso
4ccf6fb284 chore: fix building mimalloc debug with valgrind support (#8199)
* fix valgrind mimalloc

* thens
2024-01-16 00:06:10 -08:00
Jarred Sumner
83f2432da6 Update prettier (#8198)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-15 23:47:13 -08:00
Jarred Sumner
f673a84c75 Update nodejs-apis.md 2024-01-15 23:46:12 -08:00
Jarred Sumner
51680dbfdc Update nodejs-apis.md 2024-01-15 23:45:10 -08:00
Jarred Sumner
1aa36e27cb Update nodejs-apis.md 2024-01-15 23:44:09 -08:00
Jarred Sumner
e6285a1cc8 Update nodejs-apis.md 2024-01-15 23:43:52 -08:00
Meghan Denny
a064ae71ad make node:fs/promises.open return a FileHandle and expose fdatasync (#8141)
* make node:fs/promises.open return a FileHandle and expose fdatasync

* node_fs: add fn spacing

* fix this assert usage too

* move primordial preservation higher

* use expect().toBe() instead of assert

* ensure top level node:fs/promises functions always receive fd's as a number

* add needed fixture

* [autofix.ci] apply automated fixes

* this was the wrong fix for a different thing
will look into it later

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-15 23:20:20 -08:00
dave caruso
f9e78c419f feat: Implement using keyword (explicit resource management) (#8151)
* port 'initial support for using declarations'

1:1 port of this commit:

56a3e01244

* port 'initial support for await using declarations'

1:1 port of this commit:
1634a0b5ad

* fix cmake config for local jsc

* add global defines for symbols

* begin porting lowering implementation

based off of
https://github.com/evanw/esbuild/pull/3192

* [autofix.ci] apply automated fixes

* add some fun webkit scripts

* fix the minification bug

* refactor runtime_js, etc

* rename test file

* finished yapping

* silly silyl

* Update src/bundler.zig

* ok

* a

* Fix crash

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-15 23:14:41 -08:00
Jarred Sumner
0fb864e0ca Bump WebKit 2024-01-15 20:28:05 -08:00
Jarred Sumner
a4da0acb0e Document additions to import.meta 2024-01-15 19:53:49 -08:00
Jarred Sumner
f47def8515 Update run_command.zig 2024-01-15 19:50:05 -08:00
Jarred Sumner
14398ae27e Upgrade to Node.js v21.6.0 2024-01-15 19:50:05 -08:00
Jarred Sumner
64d351b102 Upgrade to SQLite v3.45.0 (#8196)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-15 19:45:14 -08:00
Meghan Denny
6b577a3970 implement events.on (#8190)
* exit event loop if there's unhandled errors

* move FixedQueue to a special package

* require(events) is also EventEmitter

* implement events.on

* move fixed_queue to internal and make it lazy in node:events

* use better Promise intrinsics

* move $shared to internal/shared

* make test not dependent on cwd
2024-01-15 18:54:37 -08:00
Lukas Kastern
a159850cce fix: Bun.serve logging error when fetch returns rejected promise (#8169)
* Handle rejected promise returned from onResponse

* Add test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-15 18:26:08 -08:00
Jarred Sumner
87eedc29d5 Move the standalone executable page 2024-01-15 18:13:28 -08:00
Lukas Kastern
124392ee98 fix: Report error and close event when creating WebSocket fails (#8186)
* Defer websocket error/close when websocket client is null

* Rename test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-15 18:08:34 -08:00
Jarred Sumner
e5421c56b1 feat: Support import db from './my.db' with {type: "sqlite"} (#8178)
* Support SQLite imports

* Docs

* Update executables.md

* Update loaders.md

* Update js_parser.zig

* Update loaders.md

* Update CMakeLists.txt

* Update Module.ts

* JSC got rid of `$trunc`?

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-15 17:56:02 -08:00
Lukas Kastern
407f42718c Only integrate loop us_loop once (#8187) 2024-01-15 17:37:21 -08:00
Jarred Sumner
a36355cefb Some Windows tweaks (#8118)
* Some windows tweaks

* Make this pub

* Update bundle_v2.zig

* Fix woopsie

* Make this error better

* Add assertion for using allocator for HTTP client from another thread.

* Do fewer copies in readdir()

* Fix crash/failing tests

* Update tests

* Fix windows build

* Update loop.c

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-15 17:33:33 -08:00
Ashcon Partovi
2d21567271 Update debugger things (#8180)
* T

* Update Debug Adapter Protocol

* Update JSC and V8 debugger protocols

* Update inspector-frontend

* Fix empty keys not being printed in `console.log`

* Add `bun --inspect` tests and fix edge cases

* bun install --exact
2024-01-15 17:00:29 -08:00
Jarred Sumner
611b296a6a Fixes #8170 2024-01-14 21:01:51 -08:00
Jarred Sumner
317998fdd6 Make toBunString increment the reference count (#8146)
* Make `toBunString` increment the reference count

* Fix WASI

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-14 05:36:31 -08:00
Jarred Sumner
ab40b0e054 Fix file descriptor leak in ipc (#8165)
* Fix file descriptor leak in ipc

* Do not assume sequential file descriptors

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-14 02:57:44 -08:00
Jarred Sumner
2c3dc5176b Upgrade uWebSockets & usockets (#8164)
* Upgrade uWebSockets & usockets

* Update HttpRouter.h

* Defensively prevent sending to blocking sockets

* Add test for receiving large amounts of data

* Large data optimization

* Update loop.c

* Avoid extra system call before entering event loop

* Update internal.h

* 1 less pointer lookup

* Fix error

* Update socket-huge-fixture.js

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-14 02:04:30 -08:00
dave caruso
5fc4538477 windows: support bun:ffi (#8114)
* compile tcc

* initial linking

* ffi and stuff

* swag

* wala

* Update settings.json

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-13 19:14:29 -08:00
Meghan Denny
be0896e204 remove while loops where a for would be more efficient (#8131)
* remove while loops where a for would be more efficient

* this needs to be a stack copy

* this can use the better loop

* this was translated wrong

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-13 19:13:54 -08:00
Jarred Sumner
56f1e5a362 Hide some noisy stack frames (#8148)
* Hide some noisy stack frames

* Update javascript.zig

* Add `asyncModuleEvaluation` to the list

* Sort

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-13 19:11:01 -08:00
Jarred Sumner
702da52312 Fix rawMode regression (#8163)
* Fix rawMode regression

* arg0

* Update ProcessBindingTTYWrap.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-13 19:10:33 -08:00
Jarred Sumner
2a8956a268 Use one isosubspace for all generated constructors (#8162)
* Use one Isosubspace for constructors

* Update generate-classes.ts

* Update generate-classes.ts

* Update generate-classes.ts

* Update generate-classes.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-13 18:50:09 -08:00
Jarred Sumner
86b1aa02b3 Update CMakeLists.txt 2024-01-13 00:57:45 -08:00
Meghan Denny
065eae5a95 tidy: use std.mem.zeroes instead of loop or memset (#8138)
* use std.mem.zeroes instead of loop or memset

* Update src/bun.js/api/bun.zig

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-12 23:56:51 -08:00
Meghan Denny
9fa13aec09 fix signalNumberToNameMap assignment for SIGINFO (#8132) 2024-01-12 23:53:35 -08:00
Jarred Sumner
3e703c4c76 For build scripts, symlink zig.exe to zig on posix (#8147)
* Add `zig.exe` as a symlink of `zig` on posix

* Update scripts/download-zig.sh

Co-authored-by: dave caruso <me@paperdave.net>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-01-12 23:52:07 -08:00
Jarred Sumner
01453be2d1 Move function from a header to a .cpp file 2024-01-12 23:48:14 -08:00
Jarred Sumner
9b32516bcb Implement tty_wrap in process.binding (#8130)
* Implement `tty_wrap` in process.binding

Fixes #4694

* [autofix.ci] apply automated fixes

* Rename some things

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-12 23:31:18 -08:00
Jarred Sumner
7e787d2a5a Move console methods from exports.zig to ConsoleObject.zig (#8145)
* ZigConsoleClient -> ConsoleObject

* Rename more

* Rename more

* ZigConsoleClientFormatter -> ConsoleObject

* More renaming

* Wire up console.profile?

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-12 23:15:36 -08:00
dave caruso
b7a32b87ab fix(bundler): improve external require transpilation on all targets (#8057)
* fix(build): do not emit import.meta.require for browsers/node.js

* update test snapshots

* sweep

* prefer require ref instead of `import.meta.require`

* remove option i did not use

* stuff

* remove rewrite_require_resolve

* ok

* ok

* wooooo

* [autofix.ci] apply automated fixes

* fix bugs

* ok

* [autofix.ci] apply automated fixes

* OOOOOPPPPPPPPPPPPS

* fix Bun.Transpiler regressions

* fix(bundler): make --splitting ensure --outdir

* fix final

* oops

* [autofix.ci] apply automated fixes

* use require.resolve

* revert but ... it no longer crashes there

* ok

* [autofix.ci] apply automated fixes

* fix fetch test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-01-12 22:15:51 -08:00
Meghan Denny
0491ff4186 tidy: remove some redundant bun.toFD calls (#8136)
* remove some redundant bun.toFD calls

* windows fix
2024-01-12 19:46:56 -08:00
Meghan Denny
943c72c8a1 allow StringOrTinyString to hold 31 bytes (#8134) 2024-01-12 19:43:50 -08:00
Meghan Denny
cb6f4b9f4d tidy: remove if(false) dead block (#8129)
* remove if(false) dead block

* remove if (true) {...}

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2024-01-12 18:18:19 -08:00
Meghan Denny
45bd2264e3 more small undefined fixes (#8133) 2024-01-12 18:17:53 -08:00
Meghan Denny
8733748eb6 remove bun.assertDefined, comparing against undefined is UB (#8137) 2024-01-12 18:16:04 -08:00
Kaio Duarte
66fa317390 fix(node:url): handle url with missing host on url.parse (#8126)
* fix(node:url): handle url with missing host on `url.parse`

* lazy load punycode module

* use URL class

* add comment and also extra sanity check tests

* extra test

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-12 18:11:10 -08:00
Dylan Conway
ef0e96a2b2 fix(install): add warning and skip patched packages (#8143)
* add warning and skip patched packages

* also overrides

* comment
2024-01-12 18:03:30 -08:00
Meghan Denny
b0d326dfb9 zig_backend stage1 doesnt exist anymore (#8140) 2024-01-12 17:44:03 -08:00
Meghan Denny
517d5ecde9 remove more big endian handling (#8139) 2024-01-12 17:43:30 -08:00
dave caruso
072f2f15ea ci: run windows tests and also run them concurrently (#7758) 2024-01-12 17:02:20 -08:00
Georgijs
0cd7fa1a63 fix(webkit:performance): correctly track size of measures map (#8128)
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
2024-01-12 14:58:05 -08:00
Ashcon Partovi
2fe0f90d36 Fix loose comparisons and incorrect tag length in semver (#8108) 2024-01-12 15:31:58 -07:00
Jarred Sumner
0783b4bf0e Implement import.meta.{dirname, filename} for Node.js compatibility (#8127)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-12 14:26:50 -08:00
Kaio Duarte
4f96bc416b fix(bun-install): gracefully handle missing package removal (#8091)
* fix(bun-install): gracefully handle missing package removal

* update bun remove test
2024-01-12 14:08:58 -08:00
hugo-syn
f43ecd8aa2 chore: Fix multiple typos (#8121) 2024-01-12 14:07:40 -08:00
Ashcon Partovi
31db26b054 Fix error when null/undefined is passed to stdio in spawn/spawnSync (#8110)
* Fix error when null/undefined is passed to stdio in spawn/spawnSync

* Change conditional
2024-01-12 14:05:55 -08:00
Aayush
f5675284c7 fix(docs): prisma not installed as dev dependency (#8119) 2024-01-12 03:23:47 -08:00
Dylan Conway
98d253d9bb fix(install): incremental support for windows (#7991)
* update for windows

* use correct sizes

* mode

* fchmod and correct error checking

* some progress

* walker_skippable.zig for windows

* no segfault

* comptime only

* normalize

* create files in .bin

* bun.sys.write

* string formatters in bun.fmt, diriterator enum

* isAllASCII comptime

* update more

* some cleanup

* fix 1

* fix 2

* simlink

* cast

* remove normalize

* to zig err

* update fchmod

* fixup

* fix running bin files

* --bun for running binaries

* --bun for scripts

* remove binary linking

* update

* remove todo

* todos

* fix

* simlink

* cast

* more cast
2024-01-11 22:00:47 -08:00
Meghan Denny
9846383b01 all: make bun.FileDescriptor a unique type (#8022)
* all: make bun.FileDescriptor a unique type

# Conflicts:
#	src/bun.js/api/bun/socket.zig
#	src/bun.js/api/bun/spawn.zig
#	src/deps/uws.zig

* need this change too

* convert another bun.FD.asDir call

* more fixes + linux

* fix this size

* accidentally flipped these fd numbers

* more fixes + windows

# Conflicts:
#	src/deps/uws.zig

* dont include type name in serialization

* add another TODO

* resolve review comments

* address more pr comments

* build fixes post-rebase

* another rebase fix

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-11 19:59:48 -08:00
Dylan Conway
fbe4ed206a More bun install hoisting tests (#8112)
* hoisting tests

* more comments on hoistDependency

* fix test
2024-01-11 16:57:24 -08:00
Erik
15263664b6 fix: #7932 (#8038)
* updating package with child peerDependency doesn't keep old version

* [autofix.ci] apply automated fixes

* fixed TODO test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-11 16:38:39 -08:00
Ciro Spaciari
4611b84352 incremental(windows) add TransmitFile and some fixes for fetch, h2 and http (#8089)
* fix win header decoding zig issue

* fix libuv file read lifecycle

* upload working without sendfile (yet)

* undo

* oops uncoment expect

* add TransmitFile aka sendfile on windows

* cleanup

* [autofix.ci] apply automated fixes

---------

Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-11 16:38:13 -08:00
hugo-syn
922ff08a80 chore: Fix multiple typos (#8105) 2024-01-11 16:37:36 -08:00
Jarred Sumner
4c933f733b Fixes #7001 (#7861)
* Fixes #7001

* One more test

* Use `disturbed`

* [autofix.ci] apply automated fixes

* Fix failing test

* Test is no longer todo!

* Make bodyUsed work too

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-11 16:25:26 -08:00
Ciro Spaciari
f1c3e87a06 incremental(windows) setTimeout, setInterval and setImmediate should work (#8101)
* fix compilation and types for FD option using usockets

* comment

* clarify HOST_MAME_MAX on windows

* use libuv for timers on windows

* [autofix.ci] apply automated fixes

* fix linux build

---------

Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-11 15:09:40 -08:00
Jarred Sumner
0bfe3760f6 Remove musl libraries from trusted dependencies because bun doesn't support musl yet 2024-01-10 21:13:20 -08:00
Ashcon Partovi
68bc548dce Fix 'Not a string or buffer' from zlibBufferSync (#8085)
* Fix 'Not a string or buffer' from zlibBufferSync

* Use `Buffer2`
2024-01-10 15:13:53 -08:00
Dylan Conway
7d4cef53a8 construct package paths without getFdPath for lifecycle scripts (#8056)
* use abs paths instead of getFdPath for lifecycle scripts

* fix aliased packages

* oops

* logs

* remove assert
2024-01-09 23:30:41 -08:00
Jarred Sumner
b400b36ca5 Bump! 2024-01-09 15:40:28 -08:00
Hanaasagi
36d4f09d28 fix(socket): fix 0.0.0.0 binding address (#7366)
* fix(socket): fix `0.0.0.0` binding address
Close: #7355

* test

* test

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-09 13:48:56 -08:00
Jarred Sumner
e77e1c1a58 perf: 5% - 10% faster new Headers(object) & new URLSearchParams(object) (#8028)
* 5%-10% faster `new Headers(object)`

* Add another test

* Remove extra parentheses

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-09 13:45:45 -08:00
Aarvin R
6e1ef49ad4 fix #8067 plugin fileapis (#8068)
- use Bun.file() instead of readFileSync
2024-01-09 13:00:31 -08:00
Jarred Sumner
2daade39a9 Don't close the file descriptor since close_range will get it anyway 2024-01-09 03:33:58 -08:00
Jarred Sumner
ae78441b25 Fixes #8010 (#8064)
* Don't use posix_spawn on Linux

* Make it work

* Avoid closing inherited file descriptors

* Hopefully fix test failures

* Reset close-on-exec flag

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-09 03:11:31 -08:00
Kainoa Kanter
fb8b47b2db chore: sort default-trusted-dependencies.txt (#7837)
* chore: sort default-trusted-dependencies.txt

* remove old trusted deps
2024-01-08 20:36:39 -08:00
Markus Ekholm
9a0dadad24 feat: implemented assert.doesNotMatch (#8008)
* implemented assert.doesNotMatch

* fixed assert.match and assert.doesNotMatch tests and ensure it throws when actual is not a string

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-08 17:31:54 -08:00
Archaeopteryx
f27fc77b3b docs: add missing comma in examples (#8018) 2024-01-08 16:21:44 -08:00
Lino Le Van
88fcfa4461 chore: fix typos in js_parser.zig (#7804)
* chore: fix typos in js_parser.zig

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Lino Le Van <linolevan@Linos-MacBook-Air.local>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-08 15:22:30 -08:00
John-David Dalton
9d56ea4880 Add icu4c to macOS install dependencies section (#8050) 2024-01-08 14:48:16 -08:00
karmabadger
b488734c50 docs: Update dev env instructions for Fedora (#8014)
* Update contributing.md

Added documentation for the installation of the perl Math::BigInt module

* Update contributing.md

merged the fedora perl math bigint module with the other dependencies
2024-01-08 14:42:06 -08:00
Jarred Sumner
8f975ec8ec Faster Buffer.concat, fixes #8034 (#8039)
* Faster, safer `Buffer.concat`

* Use wrappers when creating `Buffer` in C++

* Bun.concatArrayBuffers small optimization

* Add comment

* Add tests

* Ignore empty buffers

* Add assertion

* Update buffer-concat.mjs

* Update buffer-concat.mjs

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-08 14:37:18 -08:00
Pramit Sharma
1aee55524a Update hash-a-password.md (#8048)
Fixed a possible typo and improved grammar and conciseness throughout
2024-01-08 12:59:15 -07:00
Jake Gordon
8805e6150a Remove rogue word in doc (#8047) 2024-01-08 12:42:01 -07:00
huseeiin
237b5eded6 Update to-json.md (#8046)
better title
2024-01-08 11:56:30 -07:00
Jarred Sumner
437faa9444 Tweaks to lifecycle script enqueue (#8037)
* Tweaks to lifecycle script enqueue

* Use helper

* Use `bun.openDir`

* Fixup

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-07 21:05:11 -08:00
Jarred Sumner
e65bab75bc Fixes #8010 (#8025)
* Fixes #8010

* Update install.zig

* Copy the metahash when cleaning the lockfile

* Save more, but error less

* Change copy when there are no more dependencies

* Tweak some tests

* Update bun-add.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-07 06:16:31 -08:00
Jarred Sumner
d985e4db65 Use SQLiteError in a test 2024-01-07 03:11:40 -08:00
Jarred Sumner
9a267db105 [bun:sqlite] Ban new SQLiteError() 2024-01-07 01:42:27 -08:00
Jarred Sumner
06c530ba2e Fix crash when exiting bun test (#8026)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-07 00:02:08 -08:00
Jarred Sumner
a1e742734a Fixes #5178 (#8023)
* Fixes #5178

* Update comment

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-06 18:47:13 -08:00
Jarred Sumner
0dc6108bd3 Make PerformanceEntry use 40% less memory (#8016)
* Make PerformanceEntry use 40% less memory

* slightly faster create array of elements

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-06 16:05:03 -08:00
Georgijs
ecdde88670 implement PerformanceObserver and friends (#8011)
* implement PerformanceObserver, PerformanceMeasure, PerformanceMark and friends

* add PerformanceObserver test, clean up other performance tests

* [autofix.ci] apply automated fixes

* Small cleanup

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-05 22:39:29 -08:00
Lucas Coratger
2fd85ef0e6 fix: params in help menu for commands update and install (#7998)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-05 22:27:16 -08:00
guest271314
a774f92757 Fix using two const result=... in same script (#8013)
const result = await ... 
for (const result of result.outputs) {... 

throws

const result = await Bun.build({
                         ^
ReferenceError: Cannot access uninitialized variable.
2024-01-05 22:26:33 -08:00
hborchardt
eb84ebf974 Fix multiple partial consume from BufferList (#8007)
* Add test for multiple partial consume from BufferList

This shows the problem indicated in #7385

* Fix multiple partial consume from BufferList

The JSUint8Array::possiblySharedBuffer() returns the backing array,
not taking into account the byteOffset that indicates the start of
the data in the backing array. This means that when creating an array
with the same backing array, the current byteOffset needs to be added
to the start of the new slice.

This led to consume() returning the same data when repeatedly consuming
small numbers of bytes from the BufferList.
2024-01-05 22:25:01 -08:00
Lucas Coratger
bfe8afd674 feat: add toContainAnyKeys (#7946)
* feat: add toContainAnyKeys

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-05 21:21:12 -08:00
dave caruso
e8179adcbb chore: clarify my comments (#8006) 2024-01-05 21:19:57 -08:00
karmabadger
515ce30a85 docs: Update contributing.md (#8012)
Adding ruby to dependencies installation for macOS and Fedora
2024-01-05 21:17:19 -08:00
Ciarán
97f8c92cf4 feat(build): adjust arch linux auto detect to include manjaro (#7912) 2024-01-05 17:26:10 -08:00
sitiom
d4d6ef9e89 docs: Add Scoop installation reference for Windows (#7882)
* Add Scoop installation for Windows

* Update installation.md

* update powershell/cmd

irm is used because on certain installs of Windows 10 iwr does not work because of something related to Internet Explorer. haha~

---------

Co-authored-by: dave caruso <me@paperdave.net>
2024-01-05 10:26:40 -08:00
Meghan Denny
fa7e4bce27 node:child_process: support defining extra pipes (#7958)
* node:child_process: support defining extra pipes

* unneeded

* lazily load node:fs

* use $isJSArray instead of ArrayIsArray

* remove std.log call

* don't close child fd we don't own

* close child fd's in parent

* add Subprocess.stdio getter that aligns with ChildProcess.stdio fd's

* [autofix.ci] apply automated fixes

* use ArrayList instead of BoundedArray for stdio_pipes

* fix stream primordials

* dont use unreachable for syscalls

* this file was testing Bun.spawn not child_process.spawn

* skip ipc for now

* ensure the socketpair is created non-blocking on non-mac posix

* allow creating a node:net.Socket from an fd via node:net.connect

* node:stream tidy

* node:child_process: use net.Socket for stdio instead of fs streams

* try again

* fix Socket eager loading

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-05 00:38:08 -08:00
Meghan Denny
89ec2fcb35 fix replacing node:module._resolveFilename not passing the parent module (#7993)
* fix replacing node:module._resolveFilename

* add a test
2024-01-05 00:36:07 -08:00
Meghan Denny
39ab26a663 node:readline: move up when decoder is instantiated (#7994) 2024-01-05 00:26:22 -08:00
Ciarán
e103b53c86 docs(test/writing.md): Add documentation for test.each (#7983) 2024-01-04 17:10:08 -08:00
Moris Kramer
ee85bbc0a3 Update simple.md (#7987)
* Update simple.md

* Update docs/guides/http/simple.md

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-04 16:59:01 -08:00
Jarred Sumner
0103dd56ab Update guide 2024-01-04 16:53:22 -08:00
Lucas Coratger
5d6c68122c feat: add toContainKeys (#7945)
* feat: add toContainKeys

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-04 15:16:07 -08:00
Jarred Sumner
47acee5d87 Fix webpack test, fix errors in Worker (#7980)
* Update subprocess.zig

* Fix logging errors in Worker

* Update webpack.test.ts

* Update webpack.test.ts

* 😪

* Fix `self` setter

* Set IsImmutablePrototypeExoticObject and make globalThis.self = work

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-04 02:57:43 -08:00
asomethings
54d762531a fix: properly transform http method to uppercase (#7982)
* fix: http method uppercase transformation using wrong length

* feat: add test case for method uppercase
2024-01-04 02:54:59 -08:00
Jarred Sumner
e5bd7fcb8f Add brotli test (#7976)
* Add brotli test

* Check if we can use brotli

* vendor brotli

* Update .gitattributes

* Brotli is now always available

* Update licensing.md

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-03 21:57:19 -08:00
Meghan Denny
f30689256d tidy: use Arguments.slice() (#7978)
* use Arguments.slice()

* slice should be *const

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-03 16:59:44 -08:00
Meghan Denny
50c1f37230 make the tracy callstack depth configurable (#7979) 2024-01-03 16:33:34 -08:00
Meghan Denny
80ebcbf3d8 no big endian (#7974) 2024-01-03 14:52:50 -08:00
Meghan Denny
6345add18a dont use custom DeclEnum impl (#7975) 2024-01-03 14:52:29 -08:00
Otger Rogla
2946bacbbd feat(worker_threads) support argv and execArgv options (#7962)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-03 14:23:39 -08:00
Otger Rogla
7fa2cf3f61 fix(console.table): fixes for character width breaking the layout (#7966) 2024-01-03 14:22:30 -08:00
Meghan Denny
aa388e6762 vscode: set zig path to local one (#7973) 2024-01-03 14:19:31 -08:00
Jarred Sumner
5a2ad792a0 Try larger runners (#7972)
* Try larger runners

* Update bun-mac-aarch64.yml

* Update bun-mac-aarch64.yml

* Update bun-mac-aarch64.yml

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-03 14:18:39 -08:00
Jarred Sumner
69c85dbe17 Hardcode bun version 2024-01-03 14:10:15 -08:00
Jarred Sumner
71d9199270 Try to make fs.watch tests less flaky (#7909)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-03 13:05:10 -03:00
Jarred Sumner
6b3e1af25d Fix linter warnings in bun:sqlite (#7960)
* [bun:sqlite] Don't call memcpy on a 0 length value or nullptr

* [bun:sqlite] Add missing flags argument

* Make this a reference I guess

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-02 23:27:53 -08:00
Lucas Coratger
9f8ee7c8f7 feat: add toBeEmptyObject (#7772)
* feat: add toBeEmptyObject

* fix: feedbacks

* fix: feedbacks

* fix: feedbacks

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-01-02 17:11:57 -08:00
Meghan Denny
233622d6bb node:child_process: remove require destructure (#7949) 2024-01-02 17:03:50 -08:00
Jarred Sumner
837cbd60d5 Fix crash in WebSocket client when handshaking fails or when the HTTP response is invalid (#7933)
* Fix double-free in websocket client

* Update test

* Fix null pointer dereference

* Fix missing protect() / unprotect() call

* More careful checks

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-01 18:08:08 -08:00
Jarred Sumner
9d6c0649a4 Fix potential uninitialized memory access when loading CommonJS modules 2024-01-01 17:37:07 -08:00
Jarred Sumner
693a00dc5b Make file uploads use less memory on Linux (#7938)
* Add Linux memfd file upload memory optimization

* various build fixes

* cleanup

* Update blob.zig

* Update base.zig

* Add COW test

* Update blob.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-01 00:07:26 -08:00
Lucas Coratger
1f9ce68348 feat: add toContainKey (#7773)
* feat: add toContainKey

* feat: add hasOwnProperty to bindings

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-31 15:29:53 -08:00
Jarred Sumner
492b2d5b76 Implement Brotli support in fetch() (#7839)
* Implement Brotli support in fetch()

* Use @panic

* Update src/http.zig

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>

* Update src/http.zig

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>

* Fix redirect logic

* Allow extremely long redirect URLs

* Update fetch.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2023-12-31 06:19:08 -08:00
Kaio Duarte
8eebfd8e22 fix: add ws properties to BunWebSocketMocked prototype (#7898)
* add ws properties to BunWebSocketMocked prototype

* add tests for Server class

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-31 02:42:58 -08:00
Jarred Sumner
1d684e0d4f Tweak formatting of console.table (#7927)
* Tweak alignment of console.table

* " " empty string instead of "#"

* Fix assertion failure

* Only get the length when necessary

* Avoid stale copies

* Add `asUTF8` helper to `bun.String`

* Cautiously handle recursion

* Further tweaks to output

* output

* Add native implementation of `getStringWidth`

* [autofix.ci] apply automated fixes

* If its not a string then quote it by default

* Add snapshot for headers

* Make it easier to debug when a builtin throws an exception

* This must be hoisted

* Fix bugs in `getStringWidth`

* Update getStringWidth.test.ts

* Eager load it

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-31 02:38:52 -08:00
Jarred Sumner
14c60eca94 Fix crash that can occur due to invalid UTF-8 (#7926)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-30 17:52:52 -08:00
Jarred Sumner
6eab178790 Add OpenSSL v1.1.0 to process.versions.openssl (#7924)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 21:36:41 -08:00
Ciarán
32ca195f60 docs(test/writing.md): update matchers to indicate support for arrayContaining, closeTo, objectContaining (#7800) 2023-12-29 21:35:34 -08:00
Michael H
c381816c57 Clean Trusted Dependencies (#7857)
* clean

* add back node version ones
2023-12-29 20:46:56 -08:00
Jarred Sumner
ae8f2a3afb Windows Build Fixes (#7923)
* Windows Build Fixes

* windows

* Update event_loop.zig

* Update bindings.zig

* Update event_loop.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 20:39:23 -08:00
Ciro Spaciari
25441ede20 fix(bun.serve) avoid double ending chunk (#7897)
* avoid double ending chunk

* re-format

* Ensure we run tests on bun-uws changes

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 20:35:32 -08:00
Jarred Sumner
a0c8ee31a1 Bump version number 2023-12-29 18:38:18 -08:00
Jarred Sumner
135039b137 Better errors for bun:sqlite (#7906)
* Better errors for bun:sqlite

* Add `byteOffset`

* Add `code` property

* Fix error

* Update test

* Add a couple more tests for errors

* Add file with sqlite error codes

* Report extra memory from `sqlite3_stmt`

* Add polyfills for macOS x64

* Use -1 when unavailable

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 18:37:16 -08:00
Jarred Sumner
05f14c8d6a Add setMayBePrototype where it should be added (#7922)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 18:26:33 -08:00
Otger Rogla
15755a0246 feat: implement console.table (#7866)
* feat: implement console.table

* console.table minor changes

* fix console.log for arrays after console.table changes
2023-12-29 18:04:49 -08:00
Jeroen
b6cadf387b docs(bundler): update CLI command in index.md for bun build with publicPath (#7916)
* docs(bundler): update CLI command in index.md for bun build with publicPath

* Update docs/bundler/index.md

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-29 15:26:35 -08:00
Jarred Sumner
b011fd2567 Fixes https://x.com/jeroendotdot/status/1740651288239460384?s=46&t=0Uhw6mmGT650_9M2pXUsCw (#7910)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-29 15:26:06 -08:00
Lucas Coratger
5e72a27a76 feat: add toBeObject (#7770)
* feat: add toBeObject

* fix: feedbacks

* [autofix.ci] apply automated fixes

* feat: add more information on error message

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-29 12:37:02 -08:00
Meghan Denny
9ef7b304d9 misc: use compileError instead of unreachable for comptime-known switches (#7905) 2023-12-29 02:07:17 -08:00
Meghan Denny
38d5a5fe9a tidy: bun.zig: remove switch on literal (#7907) 2023-12-29 02:06:56 -08:00
Jarred Sumner
43b99021f8 Fix flaky timeout test 2023-12-29 01:29:40 -08:00
Jarred Sumner
8a34b8f6f8 Add flags for Valgrind build 2023-12-29 00:25:02 -08:00
Jarred Sumner
70f344101b Revert " feat(server): add server backlog parameter (#7822)" (#7908)
This reverts commit 411094b82d.
2023-12-28 23:44:27 -08:00
Jarred Sumner
a3a6b894c5 [bun:sqlite] Cache the structure and call the destructor (#7904)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-28 21:33:55 -08:00
Meghan Denny
a5bf1216d1 cli: resolve TODO filing upstream issue (#7903) 2023-12-28 20:11:51 -08:00
Jarred Sumner
ae5f1b0168 Fix crash with latin1 supplemental characters in bun:sqlite query (#7902)
* Fix crash with latin1 supplemental characters in bun:sqlite queries

* Make it run from any dir

* Fix comment

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-28 20:00:58 -08:00
Jarred Sumner
20690403da Fixes #7868 (#7884)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-28 17:53:11 -08:00
Jarred Sumner
903a202473 Support Blob in CryptoHasher (#7878)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-28 16:33:18 -08:00
Kaio Duarte
14bc121dc8 Compare error name and message on Bun.deepEquals and assert.deepStrictEqual (#7867)
* check error name and message on Bun.deepEquals

* add tests

* add test with subclass of Error
2023-12-28 16:32:49 -08:00
Oleg Sevruk
eac3bda895 Update bun-create.md (#7889)
Typo. Correct the 8th item in the hidden section “How to create buns”
2023-12-28 16:30:29 -08:00
Aarvin R
0a7bbcb9a6 finish docs for env quotes (#7895)
- added template literal backticks to sentence
- added example of quotes in .env files
2023-12-28 16:17:16 -08:00
Aarvin R
107015fd48 fix example syntax for plugins (#7894)
- updated docs/runtime/plugins.md to use plugin()
- update docs/runtime/plugins.md to use "loaded" instead of "registered" for clarity
2023-12-28 16:14:56 -08:00
Malthe Borch
813afe6c53 Add 'listening' boolean property to 'net:Server' (#7658)
* Add 'listening' boolean property to 'net:Server'

* Convert to getter

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-28 14:20:41 -03:00
Hanaasagi
411094b82d feat(server): add server backlog parameter (#7822)
* feat(server): add server backlog parameter

* add some tests

* Apply suggestions from code review

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>

* fix test

* chore: fix style

---------

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2023-12-28 14:19:20 -03:00
Jarred Sumner
1f90608d66 Fixes #7827 (#7858)
* Fixes #7827

* Add some assertions and errors

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-27 20:22:44 -08:00
Xiliang Chen
2b09347dc6 fix toMatchSnapshot signature (#7880) 2023-12-27 20:16:05 -08:00
Meghan Denny
f02ef8fb35 script/setup.sh: don't hardcode search for pkg-config (#7871) 2023-12-27 18:35:09 -08:00
Meghan Denny
da13884295 inspect: print 'call' property in objects (#7874)
functions have separate code path now
2023-12-27 18:34:52 -08:00
Meghan Denny
8a39c02e7a bun.js bindings: tidy with inline range (#7875) 2023-12-27 18:34:18 -08:00
Meghan Denny
bfc065c5cc bun.js bindings: remove redundant as-bitcast-as (#7876) 2023-12-27 18:33:56 -08:00
Meghan Denny
93c081f351 scripts/setup.sh: don't check for zig since it installs zig later (#7870)
* scripts/setup.sh: don't check for zig since it installs zig later

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-27 16:26:46 -07:00
Ciarán
4a66091491 Fixes #7740: Change "Duplicate dependency" to warn instead of error (#7766)
* fix(#7740): change 'Duplicate dependency' to be warning instead of error

* chore(07740.test.ts): clean up test

* [autofix.ci] apply automated fixes

* fix(src/logger.zig): increment warnings instead of errors in addRangeWarningFmtWithNotes()

* chore(07740.test.ts): simplify package.json to avoid increasing test times

* chore(bun-install.test.ts): update test to expect 'warn' instead of 'error'

* chore(07740.test.ts): fix formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-27 00:53:02 -08:00
johnpyp
d1dcf5ccf7 doc: improve Bun.Glob api docs (#7859)
* doc: improve Bun.Glob api docs

* Update docs/api/glob.md

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-26 22:20:25 -08:00
Ciro Spaciari
f8159f1b36 fix(fetch) Fix fetch redirect (#7847)
* clean socket instance before closing on redirect

* fetch redirect test

* fix flask test

* oops
2023-12-26 17:37:41 -08:00
cirospaciari
1a370eb483 revert 2023-12-26 11:33:30 -03:00
cirospaciari
f12ff9d1e5 clean client ref from socket before close 2023-12-26 11:22:12 -03:00
Jarred Sumner
4d6219eda4 Revert "whitelist nuxt (#7840)"
This reverts commit a3630dde2e.

`nuxt` does not list any scripts in their package.json
2023-12-25 23:39:57 -08:00
Larry Williamson
a3630dde2e whitelist nuxt (#7840) 2023-12-25 23:27:56 -08:00
Ryan
c6ba32b850 Add purescript and spago to default-trusted-dependencies.txt (#7838)
These are two important packages for purescript development, purescript is the language (including a binary file that must be installed), and spago is the purescript package manager (also including a binary file that must be installed).
2023-12-25 22:58:32 -08:00
Omar
05984d405f Whitelist Railway CLI (#7832)
https://railway.app

Railway CLI is used to deploy Railway services. The CLI npm package requires running postinstall scripts.

9de89415f0/package.json (L17)
2023-12-25 20:32:16 -05:00
thunfisch987
696a5a28c9 Update docs/typescript.md (#7825) 2023-12-25 09:22:29 -07:00
Jarred Sumner
b399deebdd 15% faster crypto.randomUUID (#7824)
* Fixes #7811

* [autofix.ci] apply automated fixes

* Update src/bun.js/webcore.zig

Co-authored-by: Markus Staab <maggus.staab@googlemail.com>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
2023-12-25 01:25:35 -08:00
xxxhussein
39ea8cbfea Update installation.md (#7817)
npm states that their name should be written as "npm" in lowercase rather than "NPM" or "Npm" etc.
2023-12-24 19:52:38 -08:00
Jarred Sumner
09d51486e9 Enable forceConsistentCasingInFileNames in bun init 2023-12-24 06:18:25 -08:00
Jarred Sumner
ead3bdf947 Make the tsconfig.json used in bun init sloppier 2023-12-24 06:16:44 -08:00
Arnaud Barré
6077ace528 Update init template & TS documentation (#7813)
* Update init template & TS documentation

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-24 06:13:53 -08:00
Jarred Sumner
a119e8d636 fs.readFile & fs.writeFile encoding + simplify string handling + fix memory leak (#7797)
* Simplify string handling code

* add extra + external

* Update fs.test.ts

* Bump

* woopsie

* prettier

* Rename stats() to resourceUsage()

* Fix leak

* Fix more leaks

* Setup malloc heap breakdown

* Thread safety

* Fix bug when creating buffer from utf-16 string

cc @dylan-conway

* Use global allocator

* More new

* Update fs.test.ts

* Update setTimeout.test.js

* Fix UAF in HTMLRewriter

* More bun.new

* Remove logs

* Un-skip test which no longer is flaky

* Even more `bun.new`

* Fix memory leak in HTMLRewriter.

Fixes #2325

* Don't accept Buffer for now

* Fix issue with node-fetch polyfill

* Don't destruct the response value too soon

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-24 06:10:46 -08:00
vitalspace
72eb607e21 FIx "Inconsistent script not found error message" (#7799) 2023-12-23 01:37:58 -08:00
Ciro Spaciari
26325aca95 fix(setTimeout) fix high CPU usage (#7792)
* fix timers CPU usage

* add stats to subprocess

* fix issue number

* add ResourceUsage

* better names on ResourceUsage

* add wait4 for macOS

* better names 2

* add types

* change comments style

* BigInt
2023-12-22 16:59:00 -08:00
Risu
98242fa10d Add node:test to Node.js compatibility docs (#7779) 2023-12-22 09:21:35 -08:00
Dylan Conway
906f86d6fd always set name (#7783) 2023-12-21 23:46:32 -08:00
Omar
9fdd1068da whitelist lightningcss-cli (#7782)
lightningcss is a popular css library with over 0.5 million weekly downloads. It also offers a cli tool that requires postinstall script to run.

https://www.npmjs.com/package/lightningcss
https://www.npmjs.com/package/lightningcss-cli?activeTab=code
2023-12-21 23:42:57 -08:00
Jarred Sumner
7e59f287a1 Fix bug in bun upgrade --canary (#7777)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-21 20:18:02 -08:00
Jarred Sumner
56df6a9888 Bump! 2023-12-21 18:29:16 -08:00
Jarred Sumner
ada49eb96d Update setInterval-leak-fixture.js 2023-12-21 18:21:00 -08:00
Jarred Sumner
c5436c09ab Fix setInterval regression (#7776)
* Fix setInterval regression

* Add some comments

* Add another test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-21 18:00:24 -08:00
Jarred Sumner
a93f467a74 NAPI fixes (#7765)
* napi fixes

* Make bcrypt work

* Always return this

* Fixes #7685

* [autofix.ci] apply automated fixes

* Update napi.cpp

* Make it clearer what this is doing

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-21 15:55:58 -08:00
Ashcon Partovi
cd55401eba Fix flaky tests 2023-12-21 08:14:43 -08:00
SirHyperNova
0f8bcfdc53 Remove "not production ready" from WebSocket (#7760) 2023-12-20 23:31:48 -08:00
Jarred Sumner
2428da9354 Fix formatting error 2023-12-20 21:18:19 -08:00
Jarred Sumner
65e11c48b6 Fix hashing consistency issue (#7757)
* Fix color issue in `bun test`

* Fix hashing consistentcy issue

* Fix Windows build failure

* Update types.zig

* Fix build

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-20 20:57:20 -08:00
dave caruso
6b549ee592 fix: random improvements to bun.String (#7695)
* make bun.String.createUninitialized harder to mess up

* remove toJSConst

* Update src/bun.js/bindings/BunString.cpp

* ok

* aaaaaaaa

* fix ucs2 encoding oopsies

* a

* [autofix.ci] apply automated fixes

* fix baseline build

* hello

* remove commented code

* aaa

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-20 19:18:32 -08:00
Jarred Sumner
5b538fb076 Fix Windows build failure 2023-12-20 19:09:53 -08:00
Vlad Sirenko
7e511f55de 4415 es5 class http.Server (#7705) 2023-12-20 15:55:30 -08:00
Jarred Sumner
c271c6c38e perf: More efficient setTimeout and setInterval (#7715)
* Use timer heap for `setTimeout`

* Further efficiency improvement to timers

* Fix assertion

* Make this test less flaky?

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-20 15:13:23 -08:00
dave caruso
00955c712e fix: crash in bun init by renaming string function to be more consistant (#7746) 2023-12-20 13:44:53 -08:00
dave caruso
00e745ec2c fix(windows): use path normalizer in bun run index.ts (#7723)
* cleanup stuff

* hi

* fix building on posix

* a

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-20 13:42:09 -08:00
Alex Martin
6ee812d63d Handle holey arrays console log edge case (#7751)
", " was only being written when appropriate before "empty item", and not
"N x empty items".
2023-12-20 13:36:28 -08:00
Jarred Sumner
a623e7c702 Fixes #7736 (#7752)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-20 00:57:16 -08:00
Jarred Sumner
59a0e885d9 Make large stdio in Bun.spawnSync efficient on Linux (#7733)
* Use memfd in spawnSync when possible

* Make it work

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-19 20:25:31 -08:00
Dylan Conway
3f1c39ad0b fix(install): lifecycle script verbose logging and a couple bug fixes (#7726)
* trim trailing slash, always create temp node-gyp

* verbose lifecycle scripts

* move node_modules from other package managers to subdirectory

* fix merge

* remove for another branch

* Update bun-install-registry.test.ts

* Update bun-install-registry.test.ts

* inherit mac only

* Update src/install/lifecycle_script_runner.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* cache directory created when ensuring temp node-gyp

* fix merge

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-19 19:39:33 -08:00
dave caruso
39d062cf3c feat: print the longest postinstall if it took more than 500ms (#7719)
* print the longest postinstall if it took more than 500ms

* build error

* make newlines print right

* fix tests

* sdfafdsa

* i hope this is it
2023-12-19 17:51:39 -08:00
dave caruso
92901eb6e0 fix: change how exit codes and signals are printed (#7674)
* change how exit codes and signals are printed

* second iteration of this

* [autofix.ci] apply automated fixes

* dasfsa

* Fix Linux Build

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-19 16:55:15 -08:00
dave caruso
ab68aa5a8e dx(win): fix codegen.ps1 on 2023-12-19 13:29:31 -08:00
Supachai Kheawjuy
3f131c0411 docs(api): typo Diffie Hellman in http.md (#7744) 2023-12-19 11:17:11 -08:00
Supachai Kheawjuy
db60c92e25 docs(bundler): remove unused callout tag in index.md (#7742) 2023-12-19 10:20:14 -08:00
Bjön Limell
1730cfbbbf docs: fixed Bun.gunzip (#7738) 2023-12-19 09:14:47 -08:00
Supachai Kheawjuy
45a499912b docs(guides/process): change file extension from tsx to ts in stdin.md (#7737) 2023-12-19 08:44:34 -08:00
Jarred Sumner
61f92d9e5f fix(install): fix false positive "lockfile is frozen" when using bun install --production (#7713)
* More lkogs

Add more logs for `--verbose`

* Fixes #5792

This makes `--frozen-lockfile` use a hash of all the resolved package versions that were installed, instead of the more permissive logic used to decide whether or not to re-run the install

* Fix debug assertion failure in `bun install --production`

* Update src/install/install.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-19 00:56:21 -08:00
Spencer Smith
3baaa28f93 Update index.md (#7727) 2023-12-18 22:23:31 -08:00
Dylan Conway
b88324db31 chore: upgrade webkit (#7720)
* update

* alwaysInline

* update webkit commit

* update webkit tag

* remove webkit_url

* check for exception and update webkit commit

* update webkit tag
2023-12-18 20:54:04 -08:00
Dylan Conway
dc19541719 update bun.zig 2023-12-18 20:15:02 -08:00
Jarred Sumner
2d2f3c4e50 fix: Tweaks to syntax highlighter (#7711)
* [syntax highlighter] Highlight `from` and `as` in `import`. Don't bold function calls or identifiers

* Update bun.zig

* Update bun.zig

* Update src/bun.zig

Co-authored-by: dave caruso <me@paperdave.net>

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2023-12-18 18:32:45 -08:00
dave caruso
f3ce571a29 fix: parsing error from "a<b>" as typescript (#7722) 2023-12-18 18:24:04 -08:00
dave caruso
1a2643520b fix(bundler): handle direct eval better (#7693)
* fix(bundler): handle  direct eval better

* error message
2023-12-18 14:41:04 -08:00
Colin McDonnell
31c17a1bb3 Better types (#7670)
* Rewrite bun-types to include @types/node

* Incorporate new commits

* Update bun.lockb

* [autofix.ci] apply automated fixes

* Update readme, add back webkit

* Updates

* BunJS -> Bun

* Switch init to @types/bun

* [autofix.ci] apply automated fixes

* Tweaks

* Revert docs changes

* Fix bugs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-18 13:27:48 -08:00
Jarred Sumner
a1a4178c3f Fix next build integration test 2023-12-18 01:21:00 -08:00
Jarred Sumner
7ac5bdc9dd Fix flaky test 2023-12-18 01:11:36 -08:00
Jarred Sumner
506c165860 Fix napi tests 2023-12-18 00:03:45 -08:00
Jarred Sumner
6fc29b6412 Recommend the .start() method 2023-12-17 23:18:41 -08:00
Jarred Sumner
b6f60680f6 Remove protobuf.js from default trusted dependencies list
The postinstall script will never print anything, since it does not exit with a non-zero exit code.

Therefore, this warning will never have an impact

Therefore, it should not be allowed to increase how long it takes to install your packages

4436cc748c/scripts/postinstall.js
2023-12-17 00:10:49 -08:00
Jarred Sumner
1f71ad5661 Fixes #7694
Verified it now calls the function the correct number of times
2023-12-16 23:47:57 -08:00
dave caruso
cbb477cbe2 perf: make Bun.peek 90x faster on pending promises, 1.5x on resolved (#7697)
* perf: make peek() 90x faster on pending promises, 1.5x faster on resolved promises

* more bench

* test edits
2023-12-16 17:36:08 -08:00
dave caruso
369e3022e4 chore: upgrade zig to 0.12.0-dev.1828+225fe6ddb (#7671)
* chore: upgrade zig to 0.12.0-dev.1828+225fe6ddb

* open as iterable

* fix building identifier cache

* fix windows build

* fix linux build

* fix linux build
2023-12-16 00:14:15 -08:00
Ciro Spaciari
925a94ffe6 test(grpc-js) update certs for macOS (#7678)
* update certs

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-15 20:40:04 -08:00
Jarred Sumner
ca89087684 feat: Make using await inside a non-async function have a helpful error message (#7690)
* Update fs.test.ts

* Make using `await` inside a non-async function have a good error

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-15 18:04:40 -08:00
dave caruso
9e47ceac87 ci: attempt to fix linux-aarch64 ci (#7691)
* experiment with this

* rerun on changed
2023-12-15 17:45:10 -08:00
dave caruso
4098dd0df5 chore: fix the commit of WebKit
bump to "657558d4d4c9c33f41b9670e72d96a5a39fe546e" which has some
windows-specific fixes, as well as fixes linux-arm64 debug build,
and adds the debug windows build.
2023-12-15 16:41:45 -08:00
dave caruso
c3b1333ae8 ci: fix windows release action 2023-12-15 16:41:45 -08:00
Vincent Lechemin
f88e5d128c Fix file descriptor leak in readdir (#7688) 2023-12-15 16:39:40 -08:00
Jarred Sumner
4d7c66066b fix: Resolve specifiers passed to mock.module (#7673)
* Mention module mocks in docs

* [autofix.ci] apply automated fixes

* Fix relative file paths that do not exist

* add test for file: URL

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-15 14:41:56 -08:00
Scott Trinh
3872f7a5b7 Use EdgeQL for expression for bulk insert in seed.ts (#7686)
* Use EdgeQL `for` expression for bulk insert in seed.ts

Perhaps this was a JavaScript for loop before to make it a little easier to grok for non-EdgeDB users. However, hopefully this is easier enough to understand that people can still follow the example even if they do not know EdgeQL.

* Fix small typo in assignment
2023-12-15 14:13:02 -08:00
dave caruso
6443c26a4a fix node_env regression (#7666) 2023-12-15 16:51:26 -03:00
Jarred Sumner
c2cd7402a0 Upgrade from SQLite v3.38.5 to v3.44.2 (#7668)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-14 20:03:29 -08:00
Ashcon Partovi
fbcb622335 Implement expect().toContainEqual() (#6589)
* Support `expect().toBeValidDate()`

* Support `expect().toContainEqual()`

Also fixes a bug where `expect(new Set()).toContain()` would not work

* Update expect.zig

* docs

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-14 17:11:14 -08:00
Mathias Wulff
fc733fe89c Use stderr for info about how to open inspector (#7270)
* Use stderr for info about how to open inspector

* Write to stderr without red colors
2023-12-14 17:07:46 -08:00
dave caruso
441612917d windows: more windows stuff (#6938)
* fix(win/upgrade): do not show powershell expand-archive info while upgrading

* start working bun run

* experiment: `bun.new`

* you can now bun run

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* stuff

* fix stuff

* fix this

* farther but not really

* sadfs

* path hell

not sure how much worse or better this makes things. its a mess. windows path handlign is a mess aaaaaaaaaaaaaaaa

* path.resolve bs

* remove old build system stuff from pr

* a

* fix some path.parse/join cases

* path closer not perfect

* normalize and join tests tests  done

* paths

* implement path.relative

* ,

* stuff

* assert

* fix compile

* hate

* the code isnt great

* stuff

* housekeeping for build system

* blah

* explain windows sitaution in docs

* some progress? not much though

* zig compiler crashes here

* fix

* yippee

* ok

* a

* ala wala

* fix builds on stuff

* clean

* the tests now run

* a

* aa

* dedupe uv event loop

* fix fs test accuracy

* stuff

* [autofix.ci] apply automated fixes

* huge updat e

* [autofix.ci] apply automated fixes

* url

* [autofix.ci] apply automated fixes

* start windows spawnSync

* [autofix.ci] apply automated fixes

* add --webkit for update submodules

* add better err message for `bun setup`

* fix unix platform build

* .

* [autofix.ci] apply automated fixes

* un-upgrade libarchive

* z

* asdfghj

* wrk

* todo -> panic

* ok

* a

* [autofix.ci] apply automated fixes

* fix build scripts l ol

* dfghj

* fa

* [autofix.ci] apply automated fixes

* aaaa

* a

* l

* [autofix.ci] apply automated fixes

* more logs

* [autofix.ci] apply automated fixes

* j

* fix init_command

* CORE DUMP HELL

* i swear im being pranked by the github actions gods

* fadsjkfdshjkhjkdfsahjkdfshjksdafjkhhjkfdsahfsdkjhfsdjkahf

* thanks IAS

* this is the correct fix

* personal review

* ddisablbe these

* revisions!

* ok

* fix submodule

* stuff

* fix libarchive

* [autofix.ci] apply automated fixes

* stuff

* [autofix.ci] apply automated fixes

* a

* fix addressToJS on windows

* make dns async again

* dx: add flag to update submodules ps1 to clone webkit

* dns error case for libuv

* dx improvements on windows

* newline

* obvious fix

* install steps

* extra note

* fix fs test

* Update building-windows.md

* fix builtins bundler to support \r\n line endnigs

* better

* some windows stuff

* a

* a

* a

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

* [autofix.ci] apply automated fixes

* bunfile text works

* fix build on the mac

* hellooooooooooo

* install steps

* ci for baseline?

* fix

* aaa

* wow

* install script revamp

* bug

* OK

* ok

* aaaaaaaaaaaaaa

* okay

* fix the node test runner lol

* fix napi stuff

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2023-12-14 16:56:33 -08:00
Osmose
adcad39e1d Update install.dryRun docs to be accurate. (#7275)
The previous line appeared to be copied from `install.optional`.
2023-12-14 15:44:13 -08:00
Jarred Sumner
453a270b2e linker ld scripts expect unmangled names 2023-12-14 14:25:18 -08:00
Jarred Sumner
fe5e19da59 Implement v8::Isolate::TryGetCurrent, v8::Isolate::GetCurrent, v8::Isolate::GetCurrentContext, stub node::AddEnvironmentCleanupHook & node:: RemoveEnvironmentCleanupHook (#7665)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-14 13:46:38 -08:00
Vlad Sirenko
19e80771ac http convert es5 class (#7485)
* http convert es5 class

* remove additional object with private fields

* add comment to http method
2023-12-14 03:03:30 -08:00
Dylan Conway
36c316a24a fix(install) make sure node-gyp is available during lifecycle scripts (#7622)
* bunx node-gyp

* add test

* create temp node-gyp when used in script

* windows reminder

* closer?

* Update bunx_command.zig

* append fake node to end of path

* Update install.zig

* correct temp node-gyp dir, always append parent `node_modules/.bin` dir

* make sure temp node-gyp doesnt run itself

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-13 23:19:37 -08:00
James Anderson
c0ccdccbeb fix(resolver): wildcard tsconfig path not including suffix (#7612)
* fix(resolver): wildcard tsconfig path not including suffix

* different approach
2023-12-13 23:19:20 -08:00
dave caruso
1fc9b56936 feat(test): rejects.toThrow and resolves.toThrow (#7652) 2023-12-13 23:18:17 -08:00
dave caruso
8ec405facc fix(build): add a missing / in a fallback path route (#7653) 2023-12-13 23:12:25 -08:00
dave caruso
beedb28e38 fix: stuff i forgot to push (#7651)
* i forgot

* a
2023-12-13 22:41:37 -08:00
BaboonKing
1aaf63efc4 fix(types): add "webcrypto" to "node:crypto" (#7580)
* fix(types):  add "webcrypto" to "node:crypto"

* chore(types): remove wrong version flag as jsdoc
2023-12-13 22:15:00 -08:00
Jarred Sumner
0bce2b46ca Fixes #7641 2023-12-13 22:04:05 -08:00
dave caruso
c8305df5c2 fix(runtime): make process.stdin work (fix vite create on linux) (#7650)
* a

* make fds cached

* fghjfdsaa

* dsfafsa

* 😭
2023-12-13 21:52:37 -08:00
dave caruso
9787ea91f2 fix(node): always use .RunCommand when binary is named node (#7615)
* make the cli act more like node when the binary is named node

* mmmmmmmmmmm review comments

* whatever

* fix test

* am stupid am stupid

* sure
2023-12-13 21:43:05 -08:00
Hanaasagi
a648ed9e6a chore: fix build (#7648) 2023-12-13 18:56:51 -08:00
chocolateboy
ab95e2189f Prevent shell-option changes leaking out of the bash-completion script (#7646)
- save and restore `globstar` rather than leaving it unset
  - don't change `extglob` as it's already defined and required by
    bash-completion
2023-12-13 17:32:53 -08:00
Andrew Shoener
dc0736d61d Clarify dead code elimination (#7639) 2023-12-13 17:31:50 -08:00
dave caruso
5029fc8564 fix: do not inline process.env during bun run and bun test (#7614)
* env stuff

* ok

* undo

* remove unused param

* resolve review comment

* dupe

* it compiles now i promise
2023-12-13 06:05:03 -08:00
Jarred Sumner
38c6575dc8 Fix incorrect pipe reading code for lifecycle scripts, add basic ioctl_ficlone support (#7628)
* Move code for lifecycle scripts into a separate file

* Fix slow & incorrect pipe reading code used for bun install lifecycle scripts

* Fix crash in IPC due to calling on_socket_long_timeout when its a null ptr

* Only try to get the node path one time

* Fix incorrect glob pattern for rebuilding Zig files

@paperdave doing `**/**/**` does not work

* Implement basic support for ioctl_ficlone

* lowercase these

* intcast

* This is backwards

* Fix "waiting for tasks" spam

* Update install.zig

* Add helper

* Update install.zig

* Address PR feedback

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-13 06:03:21 -08:00
Dylan Conway
efb2cb5871 get auto and prefer from install expr (#7624) 2023-12-13 03:11:03 -08:00
pacexy
9fc12a1244 Fix install.exact does not work (#7603)
* fix

* fix
2023-12-13 01:24:05 -08:00
Jarred Sumner
900eec71fa Bump 2023-12-12 17:35:36 -08:00
Jarred Sumner
4fec7f84c8 Run libc atexit callbacks 2023-12-12 17:34:19 -08:00
Dylan Conway
5787350243 add sharp 2023-12-12 13:38:43 -08:00
Imamuzzaki Abu Salam
35ba928430 test: init sharp integration test (#7481)
* test: init sharp integration test

* Update sharp integration tests and package.json

* Delete unnecessary files and dependencies

* refactor sharp dir with path.join import.meta.dir

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>

* Update dependencies and fix image resizing

* Remove trustedDependencies from package.json

---------

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2023-12-12 13:35:13 -08:00
Jarred Sumner
7ec64c2cc8 Update lifecycle.md 2023-12-12 02:36:48 -08:00
Jarred Sumner
5e60861c34 Disable this warning 2023-12-12 02:32:48 -08:00
Jarred Sumner
39b66ded08 Bump 2023-12-12 02:31:36 -08:00
dave caruso
a2f595d352 fix: better error message for bun install fs permission errors (#7550)
* remove `prettyWarn`, add easy print utils, clarify a package.json loading error

* error when node_modules isnt writable

* hmm

* fix instal

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-12 00:18:05 -08:00
Dylan Conway
d163351f3e fix(install): fix semver sorting with prereleases (#7588)
* compare number with string correctly

* Update semver.zig

* invalidate cache

* seconds
2023-12-11 22:29:22 -08:00
Dylan Conway
351e47355a add default trustedDependencies and run lifecycle scripts during installation (#7132)
* [install] allow parallel execution of `postinstall` scripts

- fixes spurious exit code 42 from `spawn()`

* postinstall to a pipe

* feat(install): include top 500 packages as defaults for postinstall

* windows newline handling*

*i did not test it

* stuff

* cool

* a

* fix merge

* set `has_trusted_dependencies`

* fix a bunch of tests

* fix merge

* remove `PackageManager`

* remove commented code

* change to function

* Update lockfile.zig

* run scripts if added to `trustedDependencies` after install

* packages without `resolved` properties

* node-gyp scripts

* node-gyp script in the root

* another test

* git deps run prepare scripts

* fix merge

* run lifecycle scripts during installation

* Update lockfile.zig

* always increment

* 🏗️

* update tests

* tickWIthoutIdle

* const uws

* loop forwards through trees

* single buffer bitset list

* tag.isGit

* windows path separators

* `bun.sys.read` and enable/disable buffering

* fix test and waiter thread

* waiter thread and tests

* Update bun-install-registry.test.ts

* workspace exclude `preprepare` and `postprepare`

* Create esbuild.test.ts

* make sure length is the same

* remove deferred binlinks, add estrella test

* test with another version

* address some comments

* remove .verdaccio-db.json

* ooops

* fix build

* use `pid` to wait

* dont register pid_poll when using waiter thread

* stress test

* free

* fix failing tests

* fix linux crash, snapshot stress test

* oops

* concurrent scripts

* activate as soon as possible

* test

* delete stress test packages

* remove unused packages

* comment stress test and maybe fix segfault

* delete snapshot

* fix assertion

* use cpu_count * 2 for default concurrent scripts

* gear emoji

* add --concurrent-scripts to docs

* more docs

---------

Co-authored-by: alexlamsl <alexlamsl@gmail.com>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Dylan Conway <33744874+MilesWright7@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-11 22:08:25 -08:00
hustLer2k
83ed65c687 Add -h as alias to --help (#7519)
* feat: add -h as alias to --help

* fix: remove redundant -h flag check

* fix: remove unneeded -h equality tests
2023-12-11 16:27:17 -08:00
hustLer2k
ab85b2a2a0 test: Migration tests fixes (#7393)
* use lockfile path passed as an argument instead of a literal string

* clean up tmp folders in migrate.test

---------

Co-authored-by: Alex See <alexsee@Alexs-MacBook-Air.local>
2023-12-11 16:07:20 -08:00
hustLer2k
6a63224f86 fix(node:fs): interpret string options as encoding in Readable constructor and fs.createReadStream (#7516)
* fix: match Readable constructor and createReadStream to node api

* remove typo from node-stream.test.js

Co-authored-by: Aaron Silvas <aaronsilvas@gmail.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Aaron Silvas <aaronsilvas@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-11 16:06:29 -08:00
Dale Seo
c9e98db258 docs: remove unncessary empty line (#7581) 2023-12-11 14:54:18 -08:00
Jarred Sumner
351810e5bc Switch to std.sort.pdq from std.sort.block (#7574)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-10 19:49:21 -08:00
Nick Reilingh
3aabe58180 bun-types: add recursive option to readdir/Sync (#7568) 2023-12-10 19:48:54 -08:00
Jarred Sumner
800fb12906 Handle holey arrays in console.log, don't omit length property, cleanup logLevel option (#7557)
* Add `fromJS` helper method to `ComptimeStringMap` and `logLevel` parsing better

* Handle holey arrays

* Update console-log.expected.txt

* More tests

* Add TODO

* More fixture

* [autofix.ci] apply automated fixes

* Update bindings.cpp

* Cleanup some spacing

* update

* Handle externals in `bun build` from package.json "imports"

* Prevent recursion in Web Worker

* Fix failing test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-10 04:33:25 -08:00
Bin Xin
7541f4ce4f fix: jsx key after spread (#7464)
* fix: jsx key after spread

* feat: configurable logLevel
2023-12-09 22:49:39 -08:00
Jarred Sumner
402f3353ac Make some regexes lazy 2023-12-09 22:37:25 -08:00
Jarred Sumner
73b0426596 Fixes #7400 2023-12-09 22:17:08 -08:00
Jarred Sumner
54f1f4635e Fixes #7554 2023-12-09 21:59:27 -08:00
Jarred Sumner
300d17f223 Slightly refactor Bun.file().text() control flow (#7535)
* Clean up control flow in Bun.file().* file reader

* Preallocate large files on Linux

* remove `this.wrote` field

* push

* doesnt work yet

* Create if not exists

* Fix for macOS

* Update blob.zig

* Slightly clean up this test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-09 21:47:40 -08:00
Otger Rogla
ce63023553 fix: re-enable util.parseArgs with memory fixes (#7460)
* Fix parseArgs issues and reenable it

* Minor changes to parseArgs

* Another minor change to parseArgs

* Add exception handling to JSValue putMayBeIndex
2023-12-08 17:43:40 -08:00
dfa
59f9d2fe70 fix: Unconditionally reset stack on Bun.deepEquals exit (#7542)
* Unconditionally reset stack on deepEqual exit

* [autofix.ci] apply automated fixes

---------

Co-authored-by: evan <Evan Bergeron>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-08 17:32:27 -08:00
dave caruso
aaa827f90e fix(node:module): allow file url strings in createRequire (#7533)
* fix(node:module): allow file url strings in createRequire

* add a non-happy path test :)
2023-12-08 16:32:35 -08:00
Brady Madden
c84be8c48b fix: ws onmessage callback to return data within an object (#7529) 2023-12-07 19:05:23 -08:00
Dale Seo
1d45c1c412 docs: remove unncessary phrase (#7532) 2023-12-07 18:48:08 -08:00
Jarred Sumner
653e2934fe Fixes #7503 (#7511)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-07 02:19:11 -08:00
dave caruso
798f548607 fix(resolver): allow builtins to be imported via subpath imports (#7505)
* fix(resolver): allow builtins to be imported via subpath imports

* [autofix.ci] apply automated fixes

* Fix target

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-07 01:51:21 -08:00
dave caruso
1337bb6923 fix(create): make bun create @ org work (#7498) 2023-12-07 00:57:31 -08:00
dave caruso
b6775e2df7 fix(upgrade): print a better message on NixOS (#7489) 2023-12-07 00:56:36 -08:00
Jarred Sumner
4519f97661 Don't call read() with an empty buffer (#7509)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-07 00:55:34 -08:00
Hanaasagi
dfd4b01a97 fix(jest): fix segfault when passing jest.fn into another jest.fn (#7507)
Close: #5900
2023-12-07 00:41:31 -08:00
dave caruso
1bf540efcf feat: allow "bun:test" utilities at runtime (#7486)
* feat: allow "bun:test" utilities at runtime

* fsdafdsafd

* yippee
2023-12-06 22:09:43 -08:00
Jarred Sumner
b1c8ae97ff Rewrite IO for Bun.file() (#7470)
* WIP rewrite IO for Bun.file()

* It seems to work on macOS

* Update ffi.zig

* Handle many more cases

* Clarify this more

* More comments

* [autofix.ci] apply automated fixes

* Add empty

* Make it work in epoll

* fetch fixes + tests fmt

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2023-12-06 18:10:06 -08:00
Jérôme Benoit
6a5995e27d test(worker): refactor worker tests (#6732)
* test(worker): refactor worker tests

+ constify variables
+ typing
+ untangle web worker from worker_threads tests
+ cleanup variables namespace

no functional changes on tests

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* test: move worker_threads related code to node/worker_threads

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* test: move worker tests into workers directory

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* refactor: report upstream changes

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* refactor: report upstream change

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* fix: address review comments

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* chore: fix submodule

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Co-authored-by: dave caruso <me@paperdave.net>
2023-12-06 17:06:11 -08:00
dave caruso
24ca605832 feat(test): run any test file by passing it as a path (#7483)
* feat(test): allow file paths to test specific files.

* [autofix.ci] apply automated fixes

* be less stupid about what files the CI runs as tests

* aa

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-06 08:52:12 -08:00
dave caruso
ad4b98b287 perf: make napi_create_object 2.5x faster (#7475)
* Faster napi

* Reduce number of headers exposed for JSStringDecoder

* Add missing header

* test: this test was meant to be marked as TODO

* revert the string decoder garbage

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-06 00:30:51 -08:00
Sylvain
fd1d4b4e5a Fix small typo in update.md (#7477)
* Fix small typo in update.md

* Update update.md

---------

Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2023-12-05 21:12:55 -08:00
Vlad Sirenko
f0e0c6d5df fix: improve compatibility of http.ServerResponse (#4431) 2023-12-05 16:15:16 -08:00
dave caruso
b77480758f Fix bug with syntax highlighter (#7474)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-05 15:53:44 -08:00
Dylan Conway
93d9b20974 increase (#7476) 2023-12-05 15:53:05 -08:00
Imamuzzaki Abu Salam
f303bcd997 docs: update misleading clonefile information (#7388)
* docs: update misleading `clonefile` information

* Fix macOS exception in cache module
2023-12-05 14:35:19 -08:00
dave caruso
62e1389e17 test: import describe properly
@Jarred-Sumner you forgot to import describe. this is casusing test failures on all PRs.
2023-12-05 14:22:28 -08:00
Anner Visser
b952ef8ad9 Base prelease build stage on base instead of on install (#7289)
There is no reason to have the entire install stage for the
prerelease stage. Instead use the base as base and copy
in the relevent files (which already happened)
2023-12-04 17:06:46 -08:00
Aaron Silvas
ec6339c25a Fix for building lambda runtime zip files (#7446) 2023-12-04 09:44:26 -08:00
Max Kayander
2ff788f463 Update typedarray-to-string.md (#7453) 2023-12-04 09:43:42 -08:00
Jarred Sumner
df17598026 Allow expect.extend in preload, remove "expect must be called in a test" error (#7430)
* Allow `expect.extend` in preload, remove "expect must be called in a test" error

* Bump

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-03 22:31:56 -08:00
Michael H
298a60419b Fix bun create help script (#7450)
* remove unnessary escape + fix bold

* ...
2023-12-03 22:31:36 -08:00
Jarred Sumner
2f83f32582 Update websockets.md 2023-12-02 09:30:58 -08:00
Jarred Sumner
b3bdf22ebb Handle EXDEV when saving lockfile (#7419)
* Handle `EXDEV` when saving lockfile

* Update fs.zig

* Update c.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-02 08:00:35 -08:00
Jarred Sumner
d45f2dae15 Disable usage of O_TMPFILE for now 2023-12-02 06:54:33 -08:00
Jarred Sumner
67c7769ddb Make some warnings errors (#7417)
* Make some warnings errors

* Modifying CMake should trigger a rebuild...

* bring this back + fix tmpfile issue

* Add assertion + fix error

* use cast

* Handle EEXIST

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-02 06:03:14 -08:00
Jarred Sumner
03298cba70 Disable parseArgs implementation until https://github.com/oven-sh/bun/pull/7310#issuecomment-1837135393 is addressed 2023-12-02 04:29:13 -08:00
Jarred Sumner
3963d2de64 Rename async asymmetric matchers 2023-12-02 03:50:30 -08:00
Jarred Sumner
b2bf3f0dcf Handle stack overflow in binary expressions in JS Parser (#7414)
* Fix stack overflow in large files

* Add test for stack overflow

* wip

* Disable cache in debug build

* Remove our extra `captureStackTrace` call

* Update RuntimeTranspilerCache.zig

* Update RuntimeTranspilerCache.zig

* Fix issues with integer environment variables

* Add missing ref

* Add missing null check

* Update bindings.cpp

* Update transpiler-cache.test.ts

* Add version check

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-12-02 03:46:25 -08:00
dave caruso
ffe447ba5a fix(standalone): runtime dynamic imports now transpile correctly. (#7404)
* fix issue in compile

* add tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-02 00:42:34 -08:00
Jay Bell
7389f1b108 fix(lockfile): print yarn lockfile aliases deps with quotes (#7409)
* fix(lockfile): print yarn lockfile aliases deps with quotes

* Update src/install/lockfile.zig

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-12-02 00:42:21 -08:00
Hanaasagi
7538c20afe fix(worker): fix SIGSEGV when terminating a Worker (#7411)
Close: #7209
2023-12-02 00:39:26 -08:00
Dylan Conway
ed02691f8b Remove line truncation in logger (#7413)
* Update logger.zig

* less out of bounds
2023-12-02 00:06:02 -08:00
Ashcon Partovi
dae985ab3c Fix Location header not being cloned from Response.redirect() (#7402)
* Fix `Location` header not being cloned from `Response.redirect()`

* Fix was something else
2023-12-01 16:35:28 -08:00
Jarred Sumner
52e1c2de08 feat: syntax highlight stack traces + overall visual improvements (#7335)
* Parse stack trace string

* Syntax highlight error messages

* Fix off-by-one

* Undo changes to populateStackTrace

* Highlight more things

* Add a way to write tests for it

* Create highlight-cat.ts

* Bump

* fix: off by ones

* feat: add function highlighting to these errors

* revisions

* undo

* l

* fix webkit submodule

* imo this looks worse

* [autofix.ci] apply automated fixes

* fix off by one <3

* fix more situations

* ch changes

* ok

* [autofix.ci] apply automated fixes

* fix this

* fix snapshot

* ok

* mark test as todo

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-01 14:02:08 -08:00
Jarred Sumner
0c532eac7b Make tsc --help 2x faster (#7365) 2023-12-01 22:56:40 +01:00
Jarred Sumner
70e57a7da0 Fixes #4876 (#7391) 2023-12-01 22:54:40 +01:00
Dylan Conway
fdece8611a Update thread_pool.zig (#7389)
* Update thread_pool.zig

* default stack size

* fix assertion
2023-12-01 02:07:13 -08:00
Zack Radisic
1147c70881 Glob fixes + optimization (#7344)
* idk why that was left out

* No need for stat call, add text for broken symlinks

* tests for crashes

* Fix test

* Add some checks to limit max open file descriptors

* Update glob.zig

* Update glob.zig

* Update scan.test.ts

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2023-11-30 19:18:55 -08:00
mimikun
3c97f568a7 Fix typos (#7378) 2023-11-30 18:36:44 -08:00
Dylan Conway
310d0c5646 oopsies 2023-11-30 18:16:47 -08:00
Dylan Conway
d79fa7ac1a remove bun.parseargs and update docs 2023-11-30 18:04:48 -08:00
Ciro Spaciari
906ba8b2a0 fix(WebSocket) improve WebSocket Client (#7371)
* improvements

* autobahn tests

* add all tests

* check if docker is active move autobahn to a new file

* fix non SIMD UTF8 validation

* use no trim to catch utf8 issues

* fix extended payload fragmentation

* fmt

* Update src/string_immutable.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-11-30 18:00:41 -08:00
Dylan Conway
54df5c032d createEmptyObjectWithNullPrototype 2023-11-30 16:48:53 -08:00
Otger Rogla
70039ff038 feat(parseArgs): Native implementation of parseArgs from node:util (#7310)
* Native implementation of parseArgs from node:util

* small change to validators + added some docs
2023-11-30 16:34:44 -08:00
Otger Rogla
90654143bb feat(test): expect.extend and asymmetric matcher improvements (#7319)
* bun-test expect.extend and asymmetric matcher improvements

* [autofix.ci] apply automated fixes

* Changes to expect.extend and asymmetric matchers

* expect-extend: remove global custom matchers registry

* test custom matchers: better way of storing matcher func

* made expect.arrayContaining/objectMatching reject non-arrays/non-objects

* [autofix.ci] apply automated fixes

* fixes for test changes

* create 1 wrapping function instead of 2 per each custom matcher

* fix expect.extend error messages and support for async matchers

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-11-29 23:20:25 -08:00
liqiang
bc114fb9d3 fix console.timeLog (#7089)
* fix console.timeLog

* fix console.timeLog can log arguments

* console timeLog test use bunEnv

Co-authored-by: Ashcon Partovi <ashcon@partovi.net>

* fix console timeLog test

* Update console.timeLog

Co-authored-by: dave caruso <me@paperdave.net>

* Update test/js/web/console/console-timeLog.js

Co-authored-by: Radhi Rasho <54078496+RadhiRasho@users.noreply.github.com>

* Update console-timeLog.js

* fix console-timeLog.js test

* fix timeLog tests due to trailing comma PR

---------

Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Radhi Rasho <54078496+RadhiRasho@users.noreply.github.com>
2023-11-29 20:07:03 -08:00
dave caruso
f3727f00dc allow migrating from npm lockfile v2 (#6695)
* allow lockfile version 2

* force save lockfile

* add migration from npm lockfilev2 test (#7370)

Co-authored-by: Alex See <alexsee@Alexs-MacBook-Air.local>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: hustLer2k <61846786+hustLer2k@users.noreply.github.com>
Co-authored-by: Alex See <alexsee@Alexs-MacBook-Air.local>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-29 20:06:44 -08:00
Jarred Sumner
6389a6e24f fix: reduce noise in stack traces (#7307)
* Mark require as private

* [autofix.ci] apply automated fixes

* fix(runtime): clean up cjs + stack trace stuff

- CJS wrapper is like 200x simpler to understand. it is also 1-10% faster
- Make a few more things hidden in stack tracess. This only affects release build.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2023-11-29 18:03:29 -08:00
Brian Knight
851b19ee0e Fix imports in run-tests example (#7368)
Adds `describe` to the import statement in a run tests example. Without this, the example does not run properly and returns an error.
2023-11-29 18:00:15 -08:00
Nick Reilingh
ebae02a08b Update file-io.md: BunFile.stream() doesn't return promise (#7372)
According to my lsp, `.stream()` returns a ReadableStream directly instead of a promise.
2023-11-29 13:44:31 -08:00
dave caruso
809266fc7a dx: clarify zig version error 2023-11-29 11:21:50 -08:00
Joey Wendt
98885279eb Fix scripts/download-zig.sh (#7364)
* fix: scripts/download-zig.sh file is not gzipped

* fix: scripts/download-zig.sh Linux x86_64 arch var
2023-11-29 00:52:59 -08:00
hustLer2k
666e615889 feat(console): Use trailing commas when printing multiline JS objects (#7334)
* feat: use trailing commas when printing multi-line objects

* test: update console-log.expected.txt to include trailing commas

* test: update a couple tests to match new object output with trailing commas

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Alex See <alexsee@Alexs-MacBook-Air.local>
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-28 13:28:37 -08:00
Adrien Brault
0b99b01b0e fix: printf invalid option in download-zig (#7351) 2023-11-28 13:27:19 -08:00
Adrien Brault
eb98b61201 docs: fix macos clang-16 PATH command (#7350)
Even though I had run the export, `bun setup` was erroring with:
```
$ ./scripts/setup.sh
setup error: LLVM 16 is required. Detected CXX as '/usr/bin/clang++'
error: script "setup" exited with code 1 (SIGHUP)
```

Running `export PATH="$(brew --prefix llvm@16)/bin:$PATH"` fixed the error
2023-11-28 13:26:53 -08:00
Jérôme Benoit
a043497fb4 fix(worker_threads): do not terminate worker at parentPort closing (#7238)
* fix(worker_threads): do not crash worker at parentPort closing

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

* doc: add TODO comment as per review request

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
2023-11-28 11:44:01 -08:00
Sukka
f5115835da dx: fix auto install zig script (#7348) 2023-11-27 20:34:12 -08:00
Alexandre Seo
34881922c8 fix(transpiler): error when parsing keys with hyphen in some JSON files (#7316)
* Quote export aliases with hyphens when converting jsons to modules

* Add test

* Handle quotes in printer and not in bundler

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-27 20:03:53 -08:00
Jérôme Benoit
44b9960113 fix(worker_threads): make onmessageerror setter work (#7237)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
2023-11-27 19:32:24 -08:00
Bin Xin
713d72703d feat(transpiler): add jsx spread children support (#7294)
* feat: jsx spread children

* test: spread children
2023-11-27 19:30:59 -08:00
dave caruso
383a615d21 dx: automatically install and update zig (#7305)
* dx: automatically install and update zig

* update repo

* ensure system zig compiler in ci

* a

* b

* good

* i am stupid

* why did this happen

* fix installer
2023-11-27 17:27:01 -08:00
Jarred Sumner
6ee42f7719 Fixes #7324 (#7330)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-27 12:12:55 -08:00
James Anderson
1840de3661 feat(test): toHaveBeenNthCalledWith + improve some fail messages (#7320)
* feat(test): `toHaveBeenNthCalledWith` + improve some fail messages

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-26 15:59:44 -08:00
Steven Almeroth
6aa1319fd9 fix typo (#7327) 2023-11-26 15:59:19 -08:00
Jarred Sumner
6a7b1a3208 Clean up lifetime handling for napi_create_string_utf16 (#7311)
* Clean up lifetime handling for `napi_create_string_utf16` and `napi_create_string_latin1`

* Fix `napi_create_arraybuffer`

* Update globals.d.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-26 15:59:03 -08:00
Jarred Sumner
5c23d670a3 Fix bug with readable streams that have been detached (#7308)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-26 02:11:42 -08:00
Jarred Sumner
22818e6806 Fix assertion failure when Worker is shutting down 2023-11-25 02:15:53 -08:00
Michael H
0abe3745d2 Add import.meta.env to bun-types (#7309)
* Add `import.meta.env` to `bun-types`

* add type to codeblock
2023-11-24 22:04:20 -08:00
DidaS
ea0ffde991 Update docs (#7193) 2023-11-24 21:25:37 -08:00
Sam
194294f5b5 fix(node:fs): fix fs.promises.opendir not having a path property (#7292)
Closes #4995
2023-11-24 19:11:45 -08:00
Jarred Sumner
7f10622a84 Implement recursive option in fs.readdir (#7296)
* Implement `fs.readdir(path, {recursive: true})` and `fs.readdirSync(path, {recursive: true})`

* Update node_fs.zig

* FIx memory leak in error code

* Add fail test

* Update readdir.mjs

* Update bun.zig

* Update readdir.mjs

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-24 19:08:07 -08:00
Jarred Sumner
a71a9e3447 Fix warning 2023-11-24 18:49:59 -08:00
Ciro Spaciari
53ee2d77b2 fix(crypto) oneshot Sign and Verify (#7256)
* WIP

* native oneshot sign

* add native verify

* fallback rsa to non-native

* WIP der dsaEncoding

* pass encoding

* RSA-PSS padding and saltLength

* oopies

* improve RSA-PSS support

* accepts hash identifiers like nodejs and add options.hashAlgorithm support

* fix string check

* tests

* define hash for ECDSA

* fix compilation
2023-11-24 18:43:17 -08:00
WingLim
3d58437fc8 fix(Response): single Content-Range in http response (#7199)
* fix: only write header if not exist

If user set header by himself, then we not write duplicate header.

* feat: add test to check header

* chore: format code
2023-11-24 18:29:52 -08:00
Michael H
6517252153 Environment Variables (#7306)
* Environment variables

* .
2023-11-24 18:25:34 -08:00
James Anderson
5f86b839b4 feat(test): toHaveBeenCalledWith and toHaveBeenLastCalledWith (#7277) 2023-11-24 18:24:21 -08:00
Jarred Sumner
5692f82aaf Delete bun_dev_http_server.zig (#7283)
* Rename http_client_async -> http

* Delete bun_dev_http_server.zig

* update these

* [uws] Add method for getting SO_ERROR

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-24 18:21:56 -08:00
Dylan Conway
93714292bf require bun:test (#7276) 2023-11-23 01:12:03 -08:00
Jarred Sumner
0766fb5ae8 Fix assertion failure in mocks 2023-11-23 00:54:12 -08:00
Dylan Conway
e83a9132d5 fix duplicate workspace bug (#7281)
* fix duplicate workspace dependency bug

* dedupe workspace names from package json

* more tests

* Update bun-install-registry.test.ts

* make sure workspace path entry is assigned

* Update bun-install-registry.test.ts

* Update bun-install-registry.test.ts
2023-11-22 22:18:27 -08:00
Jarred Sumner
bc4146295f Update nav.ts 2023-11-22 16:13:41 -08:00
Jarred Sumner
d8be3e51b4 Support glob.scan(string) (#7279)
* Support `glob.scan(string)`

* Create glob.md

* Update glob.md

* fixup

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-22 16:12:28 -08:00
Zack Radisic
6ba4e950cc Add Bun.Glob (#6861)
* initial glob impl

* Add `Bun.globMatch`

* Glob boilerplate setup

* Experiment with Rust glob implementation

* Rust impl is slow revert

* Setup glob walking

* Basic glob walker working

* Fix segfault

* Recursive directory traversal

* Fix glob match non-ascii

* Make faster lil bit

* use arena

* ASCII fast path

* Experiment with packed codepoint cursor

Results in ~4% perf boost if the glob pattern needs to create/manipulate cursors (for example when the pattern uses braces)

* Try converting to u32 array

Made it pretty slow

* Lazily create codepoint buffer

* Different walk algorithm

* Fast path optimizations

* Add `dot` option to `Glob`

* .

* Fix some bugs

* Fix bug, clean up lil bit

* Windows fix

* Non absolute paths

* use specific version of fast-glob for benchmarks and tests

* .

* Fix some stuff

* Fix more stuff

* Add `hasPendingActivity()` to glob

* accident

* Symlinks

* fast-glob e2e tests

* remove

* woops

* Fix relative paths

* Fix absolute

* add test for `onlyFiles`

* Fix invalid surrogate pairs problem

* Rename: `match/matchSync` -> `scan/scanSync` and `matchString` -> `match`

* forgot to close cwd fd

* Update types

* Add stress test

* Port `micromatch` / `glob-match` / `globlin` tests

* fix stale reference arena thing

* stupid bug

* Add builtins to classes code generator and add `Glob.scanIter()`

* all iterables

* generate fixtures, remove from git

* fix test

* Fix

* woops on test

* Fix stuff

licenses

license

`has_pending_activity` to usize

cwd threadSafe fix atomic compile errors

`GlobWalker` own `cwd`

Fix windows path and absolute test

stuff

* Fixes

* Fix stuff

* Use Syscall.close

* Use private symbols for underlying scan functions to preevent misuse

* Update types

* Fix build for zig

* Fix tests

* Fix more tests

* Prevent these tests from GC'ing too much

* Make this benchmark work in Node and Bun

* Fix memory leak

* Add leak test

* Fix windows

* comment about arena allocator use for glob walker

* Make leak test run in separate process

* Iterator api for glob

* GlobWalker.Iterator

* fix leak test

* Remove old impl

* filter functions wip start

* stuff

* wip lockfile use glob

* glob working with lockfile

* revert lockfile changes

* Update bun.lockb

* Manually set to cwd to prevent test failing on linux CI

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-22 14:26:09 -08:00
Jarred Sumner
81067477dc Load *.{m,c}ts{x} last in node_modules (#7259)
* Load `.{m,c}ts{x}` last in node_modules

* feat(console.log): Print className for an object if present (#6508)

* feat(console-log): fix className not printed for objects that are instances of classes

Uses getClassName native method instead of getName

* test(console-log): objects with class names are printed correctly

* test(esbuild): add class name to log message

* Fix failing `which` test (#7258)

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>

* Make test less flaky

* Get it working and add test

* Handle relative paths

* Add comment

* Consolidate + add test

* Bump

* Fix getObjectName

* Update dir_info.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Jibran Kalia <jibran.kalia@gmail.com>
2023-11-22 14:11:35 -08:00
Jarred Sumner
d8ca6ca699 Make test less flaky 2023-11-21 18:56:14 -08:00
Jarred Sumner
05ef3329c4 Fix failing which test (#7258)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-21 18:10:21 -08:00
Jibran Kalia
ab93f9f74e feat(console.log): Print className for an object if present (#6508)
* feat(console-log): fix className not printed for objects that are instances of classes

Uses getClassName native method instead of getName

* test(console-log): objects with class names are printed correctly

* test(esbuild): add class name to log message
2023-11-21 17:39:00 -08:00
Dylan Conway
8db407e9a7 make tmpdir more random (#7243)
* make tmpdir more random

* 100
2023-11-21 14:29:35 -08:00
Dylan Conway
5eb6f83251 fix test :( 2023-11-21 12:34:36 -08:00
Jarred Sumner
1b8d7d5cb1 Update base64 library (#7220)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-20 15:12:31 -08:00
Jarred Sumner
bf32d36e4c Cleanup how build errors are displayed slightly (#7223)
* Cleanup error formatting a little

* Add error for using import statement with CommonJS-only features

* Update js_ast.zig

* Further tweaks to formatting, also print error.cause

* Add some snapshot tests for errors

* Make these snapshot tests

* Ignore mimalloc warnings

* Update error message parsing in bundling tests

* Increase timeout on the test

* Update expectBundled.ts

* Update test

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-20 15:07:13 -08:00
Anton Golub
e9661c2953 fix(process): enable SIGKILL and SIGSTOP mappings (#7172)
* fix: enable SIGKILL -> 9 mapping

* fix: enable SIGSTOP -> 18 mapping
2023-11-20 14:11:46 -08:00
Jérôme Benoit
0b66fd643e fix: test for make presence in the buildsystem (#7234)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
2023-11-20 09:12:24 -08:00
Liz
778bad9dfd fix(Bun.serve): return EACCESS when we don't have perms (#7191)
* fix(Bun.serve): return EACCESS when we don't have perms

The error reported to js land when listening fails was always the same,
this adds a second one for EACCESS when we are not the super user.

Fixes: https://github.com/oven-sh/bun/issues/7187

* fix: adjust code to be only ran on linuz

* fix: correct typo

* fix: remove comment since its linux only now
2023-11-19 10:38:33 -08:00
Jarred Sumner
ef8b9efaa4 Fixes #7201 2023-11-18 22:24:49 -08:00
Jarred Sumner
864d59f822 Add missing JSC debug build flag 2023-11-18 21:04:45 -08:00
Dylan Conway
f5bf67bd1b choose correct resolved package for peer dependencies (#7192)
* fix sometimes failing install test

* loop to make sure it happens
2023-11-17 19:15:47 -08:00
Ashcon Partovi
075c09401a Output verbose logs when running in Github Action with debug mode (#7183) 2023-11-17 18:19:29 -08:00
Ciro Spaciari
c23579d66c feat(http2) Client Support (#6761)
* init

* WIP fix post data/refactor

* make it compile again

* more things

* undo padding and continue + fix posting + update lshpack

* re-add fixes

* really simple tests + fixes

* add aborted event

* fix trailers

* add getDefaultSettings, getPackedSettings and getUnpackedSettings

* fix + fmt

* fixes

* fix enablePush o be boolean

* fix sendTrailers

* fmt

* fix goaway, fix some error messages

* oops

* revert some changes

* more reverts

* WIP

* get CMAKE building lspack + ping behavior

* remove files that should not be added anymore

* remove old out files

* remove old file

* fix header reduce

* bunch of fixes

* fix socket unref

* fix abort signal, rebase and fmt

* socket unref tests

* oops re-add cmake

* fix stream state

* more tests and fixes

* fixes and ping tests

* lshpack in Dockerfile

* just copy lshpack

* oops

* fix end

* wantTrailers

* encode/decode fixes + grpc

* channel credentials test

* rebase

* support h2c

* fix h2c

* fix h2c connect event + h2c tests

* 'copy ls-hpack

* ls-hpack build sh

* oops

* changing CMake + Docker

* add ps1 build for ls-hpack fix clean

* optimizations + fixes

* remove protect/unprotect from handlers

* more consistent errors

* fix error code

* oops

* add goaway tests

* oops uncoment tests

* better errors more tests

* add broken priority frame

* better memory leak, some fixes and less flask tests

* zig update .Big -> .big

* closer threshold + h2 fix

* remove log

* test should not be flask

* increase timeout on leak memory test

* windows build

* less flasky

* always 127.0.0.1

* [autofix.ci] apply automated fixes

* remove .call and use primordials

* apply socket fix

* fix win-build

* should properly mark inactive

* postgres fix

* increase deadline

* test tests

* high light deadline timeouts

* event loop test

* make memory leak test faster

* use buffer on payload test

* check for socket.data before use

* reduce iterations to see if timeout on mac intel

* fix assertions

* avoid localhost and simplify things

* refactor memory leak test

* Update src/js/node/tls.js

* fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-17 18:14:54 -08:00
Jarred Sumner
6c200c089c Tweak napi PR (#7177)
* Fix assertion failure

* Fix the test

* Fix assertion failure

* Update bun.lockb

* Add node-gyp

* Update CMakeLists.txt

* Update napi.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-17 17:00:44 -08:00
Mike Dotty
3eb086f5fa fix(dx): Stop swallowing errors from create_hash_table during the build (#7110)
* Stop swallowing errors from create_hash_table during the build

If src/codegen/create_hash_table can't be run due to some reason
(e.g. due to missing Math::BigInt Perl module) the build continues
but fails later, during bindings compilation, because the generated
files are empty.

Fix it by handling the failure to run create_hash_table properly.

Closes #7074

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-17 13:45:32 -08:00
DidaS
fbff18a723 fix(types): Change Bun.serve types to allow void when using websockets (#7160)
* `Response` -> `any`

* Revert previous commit & allow void in ws fetch

* Added type test to check if you can upgrade connection without returning

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-11-17 05:34:05 -08:00
Olivier Guimbal
6e7014c91b Fix napi_get_value_string_utf8 to match node (#7175)
* fix napi_get_value_string_utf8 to match node
closes #6949

* [autofix.ci] apply automated fixes

* Update test/napi/napi.test.ts

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* Update test/napi/napi.test.ts

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-11-17 05:27:58 -08:00
Jarred Sumner
711ea1604b Set umask once (#7176)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-17 05:08:25 -08:00
Jarred Sumner
538a243453 Bump! 2023-11-17 04:12:08 -08:00
Dylan Conway
8be492c080 fix require transpile (#7170)
* bounds checks

* do this all the time

cc @paperdave

* use length of string

* ttest

* min

* can't prefix if length isn't at least equal

* substring

* Update pretty_format.zig

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-11-17 04:10:50 -08:00
jhmaster
6c7a0e5a79 node:util core-js compat. fix (#7101)
* node:util: fix compatibility issue with corejs
2023-11-17 09:10:32 -03:00
Jarred Sumner
f4d14c02c7 Implement process.report.getReport() (#7171)
* Prevent assertion failure

* Implement process.report.getReport()

* Update process.test.js

* }

* Update BunProcess.cpp

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-17 03:35:35 -08:00
Dylan Conway
3ca2d8ae5e ensure .bin folder is created before linking binaries (#7166)
* bin might need to be created after iterating node_modules

* Update bun-install-registry.test.ts

* test this functionality in a few more tests

* fix a test

* another test

* revert

* more test
2023-11-16 23:54:49 -08:00
Jarred Sumner
c23aed993f Update pull_request_template.md 2023-11-16 23:52:27 -08:00
Jarred Sumner
11e07caaa4 Update pull_request_template.md 2023-11-16 23:52:19 -08:00
Jarred Sumner
e4de49df2a Update pull_request_template.md 2023-11-16 23:51:28 -08:00
Jarred Sumner
47e1fbe468 Update pull_request_template.md 2023-11-16 23:50:09 -08:00
Jarred Sumner
8353ba7857 Update pull_request_template.md 2023-11-16 23:50:02 -08:00
HK-SHAO
606c80b049 Fix the TypeError of isValidTLSArray for http (https://github.com/oven-sh/bun/issues/7153) (#7154) 2023-11-16 23:41:19 -08:00
Jarred Sumner
d1436e3ecc Support Object.create in Stats within node:fs (#7168)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-16 23:39:10 -08:00
Jarred Sumner
7e0e007e3e Fix bug where with statements do not trigger CommonJS (#7167)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-16 23:37:22 -08:00
Ashcon Partovi
2e74f7f079 Properly handle errors from posix_spawn (#7163) 2023-11-16 21:02:13 -08:00
Jarred Sumner
2c81c2a13f Fix crash due to isEmpty check checking only size and not capacity 2023-11-16 19:37:14 -08:00
Jarred Sumner
d9a0fd4f59 Don't allocate new "require" and "resolve" strings in CJS modules (#7162)
* Don't allocate new `"require"` and `"resolve"` strings in every CommonJS module

* Use builtinNames more

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-11-16 15:10:27 -08:00
2494 changed files with 501269 additions and 145040 deletions

31
.buildkite/bootstrap.yml Normal file
View File

@@ -0,0 +1,31 @@
# Uploads the latest CI workflow to Buildkite.
# https://buildkite.com/docs/pipelines/defining-steps
#
# Changes to this file must be manually edited here:
# https://buildkite.com/bun/bun/settings/steps
steps:
- if: "build.pull_request.repository.fork"
block: ":eyes:"
prompt: "Did you review the PR?"
blocked_state: "running"
- label: ":pipeline:"
agents:
queue: "build-darwin"
command:
- ".buildkite/scripts/prepare-build.sh"
- if: "build.branch == 'main' && !build.pull_request.repository.fork"
label: ":github:"
agents:
queue: "test-darwin"
depends_on:
- "darwin-aarch64-build-bun"
- "darwin-x64-build-bun"
- "linux-aarch64-build-bun"
- "linux-x64-build-bun"
- "linux-x64-baseline-build-bun"
- "windows-x64-build-bun"
- "windows-x64-baseline-build-bun"
command:
- ".buildkite/scripts/upload-release.sh"

63
.buildkite/ci.md Normal file
View File

@@ -0,0 +1,63 @@
## CI
How does CI work?
### Building
Bun is built on macOS, Linux, and Windows. The process is split into the following steps, the first 3 of which are able to run in parallel:
#### 1. `build-deps`
Builds the static libaries in `src/deps` and outputs a directory: `build/bun-deps`.
- on Windows, this runs the script: [`scripts/all-dependencies.ps1`](scripts/all-dependencies.ps1)
- on macOS and Linux, this runs the script: [`scripts/all-dependencies.sh`](scripts/all-dependencies.sh)
#### 2. `build-zig`
Builds the Zig object file: `build/bun-zig.o`. Since `zig build` supports cross-compiling, this step is run on macOS aarch64 since we have observed it to be the fastest.
- on macOS and Linux, this runs the script: [`scripts/build-bun-zig.sh`](scripts/build-bun-zig.sh)
#### 3. `build-cpp`
Builds the C++ object file: `build/bun-cpp-objects.a`.
- on Windows, this runs the script: [`scripts/build-bun-cpp.ps1`](scripts/build-bun-cpp.ps1)
- on macOS and Linux, this runs the script: [`scripts/build-bun-cpp.sh`](scripts/build-bun-cpp.sh)
#### 4. `link` / `build-bun`
After the `build-deps`, `build-zig`, and `build-cpp` steps have completed, this step links the Zig object file and C++ object file into a single binary: `bun-<os>-<arch>.zip`.
- on Windows, this runs the script: [`scripts/buildkite-link-bun.ps1`](scripts/buildkite-link-bun.ps1)
- on macOS and Linux, this runs the script: [`scripts/buildkite-link-bun.sh`](scripts/buildkite-link-bun.sh)
To speed up the build, thare are two options:
- `--fast`: This disables the LTO (link-time optimization) step.
- without `--fast`: This runs the LTO step, which is the default. The binaries that are release to Github are always built with LTO.
### Testing
### FAQ
> How do I add a new CI agent?
> How do I add/modify system dependencies?
> How do I SSH into a CI agent?
### Known issues
These are things that we know about, but haven't fixed or optimized yet.
- There is no `scripts/build-bun-zig.ps1` for Windows.
- The `build-deps` step does not cache in CI, so it re-builds each time (though it does use ccache). It attempts to check the `BUN_DEPS_CACHE_DIR` environment variable, but for some reason it doesn't work.
- Windows and Linux machines sometimes take up to 1-2 minutes to start tests. This is because robobun is listening for when the job is scheduled to provision the VM. Instead, it can start provisioning during the link step, or keep a pool of idle VMs around (but it's unclear how more expensive this is).
- There are a limited number of macOS VMs. This is because they are expensive and manually provisioned, mostly through MacStadium. If wait times are too long we can just provision more, or buy some.
- To prevent idle machines, robobun periodically checks for idle machines and terminates them. Before doing this, it checks to see if the machine is connected as an agent to Buildkite. However, sometimes the machine picks up a job in-between this time, and the job is terminated.

790
.buildkite/ci.yml Normal file
View File

@@ -0,0 +1,790 @@
# Build and test Bun on macOS, Linux, and Windows.
# https://buildkite.com/docs/pipelines/defining-steps
#
# If a step has the `robobun: true` label, robobun will listen
# to webhooks from Buildkite and provision a VM to run the step.
#
# Changes to this file will be automatically uploaded on the next run
# for a particular commit.
#
# Future tests machines to be added:
# - macOS 12
# - Windows Server 2016 & 2019
# - Amazon Linux 2 & 2023
# - CentOS / RHEL / Fedora / other Linux distros
# - Docker containers
# - Rasberry Pi?
steps:
# macOS aarch64
- key: "darwin-aarch64"
group: ":darwin: aarch64"
steps:
- key: "darwin-aarch64-build-deps"
label: ":darwin: aarch64 - build-deps"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-deps.sh"
- key: "darwin-aarch64-build-zig"
label: ":darwin: aarch64 - build-zig"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh darwin aarch64"
- key: "darwin-aarch64-build-cpp"
label: ":darwin: aarch64 - build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-cpp.sh"
- key: "darwin-aarch64-build-bun"
label: ":darwin: aarch64 - build-bun"
depends_on:
- "darwin-aarch64-build-deps"
- "darwin-aarch64-build-zig"
- "darwin-aarch64-build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-bun.sh"
- key: "darwin-aarch64-test-macos-14"
label: ":darwin: 14 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 3
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "darwin-aarch64-build-bun"
agents:
queue: "test-darwin"
os: "darwin"
arch: "aarch64"
release: "14"
command:
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
- key: "darwin-aarch64-test-macos-13"
label: ":darwin: 13 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 3
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "darwin-aarch64-build-bun"
agents:
queue: "test-darwin"
os: "darwin"
arch: "aarch64"
release: "13"
command:
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
# macOS x64
- key: "darwin-x64"
group: ":darwin: x64"
steps:
- key: "darwin-x64-build-deps"
label: ":darwin: x64 - build-deps"
agents:
queue: "build-darwin"
os: "darwin"
arch: "x64"
command:
- "./.buildkite/scripts/build-deps.sh"
- key: "darwin-x64-build-zig"
label: ":darwin: x64 - build-zig"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh darwin x64"
- key: "darwin-x64-build-cpp"
label: ":darwin: x64 - build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "x64"
command:
- "./.buildkite/scripts/build-cpp.sh"
- key: "darwin-x64-build-bun"
label: ":darwin: x64 - build-bun"
depends_on:
- "darwin-x64-build-deps"
- "darwin-x64-build-zig"
- "darwin-x64-build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "x64"
command:
- "./.buildkite/scripts/build-bun.sh"
- key: "darwin-x64-test-macos-14"
label: ":darwin: 14 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 2
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "darwin-x64-build-bun"
agents:
queue: "test-darwin"
os: "darwin"
arch: "x64"
release: "14"
command:
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
- key: "darwin-x64-test-macos-13"
label: ":darwin: 13 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 2
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "darwin-x64-build-bun"
agents:
queue: "test-darwin"
os: "darwin"
arch: "x64"
release: "13"
command:
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
# Linux aarch64
- key: "linux-aarch64"
group: ":linux: aarch64"
steps:
- key: "linux-aarch64-build-deps"
label: ":linux: aarch64 - build-deps"
agents:
queue: "build-linux"
os: "linux"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-deps.sh"
- key: "linux-aarch64-build-zig"
label: ":linux: aarch64 - build-zig"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh linux aarch64"
- key: "linux-aarch64-build-cpp"
label: ":linux: aarch64 - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-cpp.sh"
- key: "linux-aarch64-build-bun"
label: ":linux: aarch64 - build-bun"
depends_on:
- "linux-aarch64-build-deps"
- "linux-aarch64-build-zig"
- "linux-aarch64-build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-bun.sh"
- key: "linux-aarch64-test-debian-12"
label: ":debian: 12 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-aarch64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "aarch64"
distro: "debian"
release: "12"
command:
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
- key: "linux-aarch64-test-ubuntu-2204"
label: ":ubuntu: 22.04 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-aarch64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "aarch64"
distro: "ubuntu"
release: "22.04"
command:
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
- key: "linux-aarch64-test-ubuntu-2004"
label: ":ubuntu: 20.04 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-aarch64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "aarch64"
distro: "ubuntu"
release: "20.04"
command:
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
# Linux x64
- key: "linux-x64"
group: ":linux: x64"
steps:
- key: "linux-x64-build-deps"
label: ":linux: x64 - build-deps"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-deps.sh"
- key: "linux-x64-build-zig"
label: ":linux: x64 - build-zig"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh linux x64"
- key: "linux-x64-build-cpp"
label: ":linux: x64 - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-cpp.sh"
- key: "linux-x64-build-bun"
label: ":linux: x64 - build-bun"
depends_on:
- "linux-x64-build-deps"
- "linux-x64-build-zig"
- "linux-x64-build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-bun.sh"
- key: "linux-x64-test-debian-12"
label: ":debian: 12 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "debian"
release: "12"
command:
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
- key: "linux-x64-test-ubuntu-2204"
label: ":ubuntu: 22.04 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "ubuntu"
release: "22.04"
command:
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
- key: "linux-x64-test-ubuntu-2004"
label: ":ubuntu: 20.04 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "ubuntu"
release: "20.04"
command:
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
# Linux x64-baseline
- key: "linux-x64-baseline"
group: ":linux: x64-baseline"
steps:
- key: "linux-x64-baseline-build-deps"
label: ":linux: x64-baseline - build-deps"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-deps.sh"
- key: "linux-x64-baseline-build-zig"
label: ":linux: x64-baseline - build-zig"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh linux x64"
- key: "linux-x64-baseline-build-cpp"
label: ":linux: x64-baseline - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-cpp.sh"
- key: "linux-x64-baseline-build-bun"
label: ":linux: x64-baseline - build-bun"
depends_on:
- "linux-x64-baseline-build-deps"
- "linux-x64-baseline-build-zig"
- "linux-x64-baseline-build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
command:
- "./.buildkite/scripts/build-bun.sh"
- key: "linux-x64-baseline-test-debian-12"
label: ":debian: 12 x64-baseline - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-baseline-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "debian"
release: "12"
command:
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
- key: "linux-x64-baseline-test-ubuntu-2204"
label: ":ubuntu: 22.04 x64-baseline - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-baseline-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "ubuntu"
release: "22.04"
command:
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
- key: "linux-x64-baseline-test-ubuntu-2004"
label: ":ubuntu: 20.04 x64-baseline - test-bun"
if: "build.branch != 'main'"
parallelism: 5
soft_fail:
- exit_status: 2
retry:
automatic:
- exit_status: 1
limit: 1
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "linux-x64-baseline-build-bun"
agents:
robobun: "true"
os: "linux"
arch: "x64"
distro: "ubuntu"
release: "20.04"
command:
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
# Windows x64
- key: "windows-x64"
group: ":windows: x64"
steps:
- key: "windows-x64-build-deps"
label: ":windows: x64 - build-deps"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
- "build\\bun-deps\\*.lib"
env:
SCCACHE_DIR: "$$HOME\\.cache\\sccache"
ZIG_LOCAL_CACHE_DIR: "$$HOME\\.cache\\zig-cache"
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
command:
- ".\\scripts\\all-dependencies.ps1"
- key: "windows-x64-build-zig"
label: ":windows: x64 - build-zig"
agents:
queue: "build-darwin"
os: "darwin" # cross-compile on Linux or Darwin
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh windows x64"
- key: "windows-x64-build-cpp"
label: ":windows: x64 - build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
# HACK: See scripts/build-bun-cpp.ps1
# - "build\\bun-cpp-objects.a"
- "build\\bun-cpp-objects.a.*"
command:
- ".\\scripts\\build-bun-cpp.ps1"
- key: "windows-x64-build-bun"
label: ":windows: x64 - build-bun"
depends_on:
- "windows-x64-build-deps"
- "windows-x64-build-zig"
- "windows-x64-build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
- "bun-windows-x64.zip"
- "bun-windows-x64-profile.zip"
- "features.json"
env:
SCCACHE_DIR: "$$HOME\\.cache\\sccache"
ZIG_LOCAL_CACHE_DIR: "$$HOME\\.cache\\zig-cache"
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
command:
- ".\\scripts\\buildkite-link-bun.ps1"
- key: "windows-x64-test-bun"
label: ":windows: x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 10
soft_fail:
- exit_status: 1
retry:
automatic:
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "windows-x64-build-bun"
agents:
robobun: "true"
os: "windows"
arch: "x64"
command:
- "node .\\scripts\\runner.node.mjs --step windows-x64-build-bun"
# Windows x64-baseline
- key: "windows-x64-baseline"
group: ":windows: x64-baseline"
steps:
- key: "windows-x64-baseline-build-deps"
label: ":windows: x64-baseline - build-deps"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
- "build\\bun-deps\\*.lib"
env:
SCCACHE_DIR: "$$HOME\\.cache\\sccache"
ZIG_LOCAL_CACHE_DIR: "$$HOME\\.cache\\zig-cache"
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
USE_BASELINE_BUILD: "1"
command:
- ".\\scripts\\all-dependencies.ps1"
- key: "windows-x64-baseline-build-zig"
label: ":windows: x64-baseline - build-zig"
agents:
queue: "build-darwin"
os: "darwin" # cross-compile on Linux or Darwin
arch: "aarch64"
command:
- "./.buildkite/scripts/build-zig.sh windows x64"
- key: "windows-x64-baseline-build-cpp"
label: ":windows: x64-baseline - build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
# HACK: See scripts/build-bun-cpp.ps1
# - "build\\bun-cpp-objects.a"
- "build\\bun-cpp-objects.a.*"
env:
SCCACHE_DIR: "$$HOME\\.cache\\sccache"
ZIG_LOCAL_CACHE_DIR: "$$HOME\\.cache\\zig-cache"
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
USE_BASELINE_BUILD: "1"
command:
- ".\\scripts\\build-bun-cpp.ps1"
- key: "windows-x64-baseline-build-bun"
label: ":windows: x64-baseline - build-bun"
depends_on:
- "windows-x64-baseline-build-deps"
- "windows-x64-baseline-build-zig"
- "windows-x64-baseline-build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
artifact_paths:
- "bun-windows-x64-baseline.zip"
- "bun-windows-x64-baseline-profile.zip"
- "features.json"
env:
SCCACHE_DIR: "$$HOME\\.cache\\sccache"
ZIG_LOCAL_CACHE_DIR: "$$HOME\\.cache\\zig-cache"
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
USE_BASELINE_BUILD: "1"
command:
- ".\\scripts\\buildkite-link-bun.ps1 -Baseline $$True"
- key: "windows-x64-baseline-test-bun"
label: ":windows: x64-baseline - test-bun"
if: "build.branch != 'main'"
parallelism: 10
soft_fail:
- exit_status: 1
retry:
automatic:
- exit_status: -1
limit: 3
- exit_status: 255
limit: 3
- signal_reason: agent_stop
limit: 3
- signal: SIGTERM
limit: 3
depends_on:
- "windows-x64-baseline-build-bun"
agents:
robobun: "true"
os: "windows"
arch: "x64"
command:
- "node .\\scripts\\runner.node.mjs --step windows-x64-baseline-build-bun"

55
.buildkite/scripts/build-bun.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
set -eo pipefail
source "$(dirname "$0")/env.sh"
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
cwd="$(pwd)"
mkdir -p build
source "$(dirname "$0")/download-artifact.sh" "build/bun-deps/**" --step "$BUILDKITE_GROUP_KEY-build-deps"
source "$(dirname "$0")/download-artifact.sh" "build/bun-zig.o" --step "$BUILDKITE_GROUP_KEY-build-zig"
source "$(dirname "$0")/download-artifact.sh" "build/bun-cpp-objects.a" --step "$BUILDKITE_GROUP_KEY-build-cpp" --split
cd build
run_command cmake .. "${CMAKE_FLAGS[@]}" \
-GNinja \
-DBUN_LINK_ONLY="1" \
-DNO_CONFIGURE_DEPENDS="1" \
-DBUN_ZIG_OBJ_DIR="$cwd/build" \
-DBUN_CPP_ARCHIVE="$cwd/build/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="$cwd/build/bun-deps" \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
-DCPU_TARGET="$CPU_TARGET" \
-DUSE_LTO="$USE_LTO" \
-DUSE_DEBUG_JSC="$USE_DEBUG_JSC" \
-DCANARY="$CANARY" \
-DGIT_SHA="$GIT_SHA"
run_command ninja -v -j "$CPUS"
run_command ls
tag="bun-$BUILDKITE_GROUP_KEY"
if [ "$USE_LTO" == "OFF" ]; then
# Remove OS check when LTO is enabled on macOS again
if [[ "$tag" == *"darwin"* ]]; then
tag="$tag-nolto"
fi
fi
for name in bun bun-profile; do
dir="$tag"
if [ "$name" == "bun-profile" ]; then
dir="$tag-profile"
fi
run_command chmod +x "$name"
run_command "./$name" --revision
run_command mkdir -p "$dir"
run_command mv "$name" "$dir/$name"
run_command zip -r "$dir.zip" "$dir"
source "$cwd/.buildkite/scripts/upload-artifact.sh" "$dir.zip"
done

35
.buildkite/scripts/build-cpp.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
set -eo pipefail
source "$(dirname "$0")/env.sh"
export FORCE_UPDATE_SUBMODULES=1
source "$(realpath $(dirname "$0")/../../scripts/update-submodules.sh)"
{ set +x; } 2>/dev/null
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
mkdir -p build
cd build
mkdir -p tmp_modules tmp_functions js codegen
run_command cmake .. "${CMAKE_FLAGS[@]}" \
-GNinja \
-DBUN_CPP_ONLY="1" \
-DNO_CONFIGURE_DEPENDS="1" \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
-DCPU_TARGET="$CPU_TARGET" \
-DUSE_LTO="$USE_LTO" \
-DUSE_DEBUG_JSC="$USE_DEBUG_JSC" \
-DCANARY="$CANARY" \
-DGIT_SHA="$GIT_SHA"
chmod +x compile-cpp-only.sh
source compile-cpp-only.sh -v -j "$CPUS"
{ set +x; } 2>/dev/null
cd ..
source "$(dirname "$0")/upload-artifact.sh" "build/bun-cpp-objects.a" --split

View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -eo pipefail
source "$(dirname "$0")/env.sh"
source "$(realpath $(dirname "$0")/../../scripts/all-dependencies.sh)"
artifacts=(
libcrypto.a libssl.a libdecrepit.a
libcares.a
libarchive.a
liblolhtml.a
libmimalloc.a libmimalloc.o
libtcc.a
libz.a
libzstd.a
libdeflate.a
liblshpack.a
)
for artifact in "${artifacts[@]}"; do
source "$(dirname "$0")/upload-artifact.sh" "build/bun-deps/$artifact"
done

View File

@@ -0,0 +1,40 @@
#!/bin/bash
set -eo pipefail
source "$(dirname "$0")/env.sh"
function assert_bun() {
if ! command -v bun &>/dev/null; then
echo "error: bun is not installed" 1>&2
exit 1
fi
}
function assert_make() {
if ! command -v make &>/dev/null; then
echo "error: make is not installed" 1>&2
exit 1
fi
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
function build_node_fallbacks() {
local cwd="src/node-fallbacks"
run_command bun install --cwd "$cwd" --frozen-lockfile
run_command bun run --cwd "$cwd" build
}
function build_old_js() {
run_command bun install --frozen-lockfile
run_command make runtime_js fallback_decoder bun_error
}
assert_bun
assert_make
build_node_fallbacks
build_old_js

80
.buildkite/scripts/build-zig.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/bash
set -eo pipefail
source "$(dirname "$0")/env.sh"
function assert_target() {
local arch="${2-$(uname -m)}"
case "$(echo "$arch" | tr '[:upper:]' '[:lower:]')" in
x64 | x86_64 | amd64)
export ZIG_ARCH="x86_64"
if [[ "$BUILDKITE_STEP_KEY" == *"baseline"* ]]; then
export ZIG_CPU_TARGET="nehalem"
else
export ZIG_CPU_TARGET="haswell"
fi
;;
aarch64 | arm64)
export ZIG_ARCH="aarch64"
export ZIG_CPU_TARGET="native"
;;
*)
echo "error: Unsupported architecture: $arch" 1>&2
exit 1
;;
esac
local os="${1-$(uname -s)}"
case "$(echo "$os" | tr '[:upper:]' '[:lower:]')" in
linux)
export ZIG_TARGET="$ZIG_ARCH-linux-gnu" ;;
darwin)
export ZIG_TARGET="$ZIG_ARCH-macos-none" ;;
windows)
export ZIG_TARGET="$ZIG_ARCH-windows-msvc" ;;
*)
echo "error: Unsupported operating system: $os" 1>&2
exit 1
;;
esac
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
assert_target "$@"
# Since the zig build depends on files from the zig submodule,
# make sure to update the submodule before building.
run_command git submodule update --init --recursive --progress --depth=1 --checkout src/deps/zig
# TODO: Move these to be part of the CMake build
source "$(dirname "$0")/build-old-js.sh"
cwd="$(pwd)"
mkdir -p build
cd build
run_command cmake .. "${CMAKE_FLAGS[@]}" \
-GNinja \
-DNO_CONFIGURE_DEPENDS="1" \
-DNO_CODEGEN="0" \
-DWEBKIT_DIR="omit" \
-DBUN_ZIG_OBJ_DIR="$cwd/build" \
-DZIG_LIB_DIR="$cwd/src/deps/zig/lib" \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
-DARCH="$ZIG_ARCH" \
-DCPU_TARGET="$ZIG_CPU_TARGET" \
-DZIG_TARGET="$ZIG_TARGET" \
-DUSE_LTO="$USE_LTO" \
-DUSE_DEBUG_JSC="$USE_DEBUG_JSC" \
-DCANARY="$CANARY" \
-DGIT_SHA="$GIT_SHA"
export ONLY_ZIG="1"
run_command ninja "$cwd/build/bun-zig.o" -v -j "$CPUS"
cd ..
source "$(dirname "$0")/upload-artifact.sh" "build/bun-zig.o"

View File

@@ -0,0 +1,47 @@
param (
[Parameter(Mandatory=$true)]
[string[]] $Paths,
[switch] $Split
)
$ErrorActionPreference = "Stop"
function Assert-Buildkite-Agent() {
if (-not (Get-Command "buildkite-agent" -ErrorAction SilentlyContinue)) {
Write-Error "Cannot find buildkite-agent, please install it: https://buildkite.com/docs/agent/v3/install"
exit 1
}
}
function Assert-Join-File() {
if (-not (Get-Command "Join-File" -ErrorAction SilentlyContinue)) {
Write-Error "Cannot find Join-File, please install it: https://www.powershellgallery.com/packages/FileSplitter/1.3"
exit 1
}
}
function Download-Buildkite-Artifact() {
param (
[Parameter(Mandatory=$true)]
[string] $Path,
)
if ($Split) {
& buildkite-agent artifact download "$Path.*" --debug --debug-http
Join-File -Path "$(Resolve-Path .)\$Path" -Verbose -DeletePartFiles
} else {
& buildkite-agent artifact download "$Path" --debug --debug-http
}
if (-not (Test-Path $Path)) {
Write-Error "Could not find artifact: $Path"
exit 1
}
}
Assert-Buildkite-Agent
if ($Split) {
Assert-Join-File
}
foreach ($Path in $Paths) {
Download-Buildkite-Artifact $Path
}

View File

@@ -0,0 +1,46 @@
#!/bin/bash
set -eo pipefail
function assert_buildkite_agent() {
if ! command -v buildkite-agent &> /dev/null; then
echo "error: Cannot find buildkite-agent, please install it:"
echo "https://buildkite.com/docs/agent/v3/install"
exit 1
fi
}
function download_buildkite_artifact() {
local path="$1"; shift
local split="0"
local args=()
while true; do
if [ -z "$1" ]; then
break
fi
case "$1" in
--split) split="1"; shift ;;
*) args+=("$1"); shift ;;
esac
done
if [ "$split" == "1" ]; then
run_command buildkite-agent artifact download "$path.*" . "${args[@]}"
run_command cat $path.?? > "$path"
run_command rm -f $path.??
else
run_command buildkite-agent artifact download "$path" . "${args[@]}"
fi
if [[ "$path" != *"*"* ]] && [ ! -f "$path" ]; then
echo "error: Could not find artifact: $path"
exit 1
fi
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
assert_buildkite_agent
download_buildkite_artifact "$@"

119
.buildkite/scripts/env.sh Executable file
View File

@@ -0,0 +1,119 @@
#!/bin/bash
set -eo pipefail
function assert_os() {
local os="$(uname -s)"
case "$os" in
Linux)
echo "linux" ;;
Darwin)
echo "darwin" ;;
*)
echo "error: Unsupported operating system: $os" 1>&2
exit 1
;;
esac
}
function assert_arch() {
local arch="$(uname -m)"
case "$arch" in
aarch64 | arm64)
echo "aarch64" ;;
x86_64 | amd64)
echo "x64" ;;
*)
echo "error: Unknown architecture: $arch" 1>&2
exit 1
;;
esac
}
function assert_build() {
if [ -z "$BUILDKITE_REPO" ]; then
echo "error: Cannot find repository for this build"
exit 1
fi
if [ -z "$BUILDKITE_COMMIT" ]; then
echo "error: Cannot find commit for this build"
exit 1
fi
if [ -z "$BUILDKITE_STEP_KEY" ]; then
echo "error: Cannot find step key for this build"
exit 1
fi
if [ -n "$BUILDKITE_GROUP_KEY" ] && [[ "$BUILDKITE_STEP_KEY" != "$BUILDKITE_GROUP_KEY"* ]]; then
echo "error: Build step '$BUILDKITE_STEP_KEY' does not start with group key '$BUILDKITE_GROUP_KEY'"
exit 1
fi
# Skip os and arch checks for Zig, since it's cross-compiled on macOS
if [[ "$BUILDKITE_STEP_KEY" != *"zig"* ]]; then
local os="$(assert_os)"
if [[ "$BUILDKITE_STEP_KEY" != *"$os"* ]]; then
echo "error: Build step '$BUILDKITE_STEP_KEY' does not match operating system '$os'"
exit 1
fi
local arch="$(assert_arch)"
if [[ "$BUILDKITE_STEP_KEY" != *"$arch"* ]]; then
echo "error: Build step '$BUILDKITE_STEP_KEY' does not match architecture '$arch'"
exit 1
fi
fi
}
function assert_buildkite_agent() {
if ! command -v buildkite-agent &> /dev/null; then
echo "error: Cannot find buildkite-agent, please install it:"
echo "https://buildkite.com/docs/agent/v3/install"
exit 1
fi
}
function export_environment() {
source "$(realpath $(dirname "$0")/../../scripts/env.sh)"
source "$(realpath $(dirname "$0")/../../scripts/update-submodules.sh)"
{ set +x; } 2>/dev/null
export GIT_SHA="$BUILDKITE_COMMIT"
export CCACHE_DIR="$HOME/.cache/ccache/$BUILDKITE_STEP_KEY"
export SCCACHE_DIR="$HOME/.cache/sccache/$BUILDKITE_STEP_KEY"
export ZIG_LOCAL_CACHE_DIR="$HOME/.cache/zig-cache/$BUILDKITE_STEP_KEY"
export BUN_DEPS_CACHE_DIR="$HOME/.cache/bun-deps/$BUILDKITE_STEP_KEY"
if [ "$(assert_arch)" == "aarch64" ]; then
export CPU_TARGET="native"
elif [[ "$BUILDKITE_STEP_KEY" == *"baseline"* ]]; then
export CPU_TARGET="nehalem"
else
export CPU_TARGET="haswell"
fi
if [[ "$BUILDKITE_STEP_KEY" == *"nolto"* ]]; then
export USE_LTO="OFF"
else
export USE_LTO="ON"
fi
if $(buildkite-agent meta-data exists release &> /dev/null); then
export CMAKE_BUILD_TYPE="$(buildkite-agent meta-data get release)"
else
export CMAKE_BUILD_TYPE="Release"
fi
if $(buildkite-agent meta-data exists canary &> /dev/null); then
export CANARY="$(buildkite-agent meta-data get canary)"
else
export CANARY="1"
fi
if $(buildkite-agent meta-data exists assertions &> /dev/null); then
export USE_DEBUG_JSC="$(buildkite-agent meta-data get assertions)"
else
export USE_DEBUG_JSC="OFF"
fi
if [ "$BUILDKITE_CLEAN_CHECKOUT" == "true" ]; then
rm -rf "$CCACHE_DIR"
rm -rf "$SCCACHE_DIR"
rm -rf "$ZIG_LOCAL_CACHE_DIR"
rm -rf "$BUN_DEPS_CACHE_DIR"
fi
}
assert_build
assert_buildkite_agent
export_environment

View File

@@ -0,0 +1,97 @@
#!/bin/bash
set -eo pipefail
function assert_build() {
if [ -z "$BUILDKITE_REPO" ]; then
echo "error: Cannot find repository for this build"
exit 1
fi
if [ -z "$BUILDKITE_COMMIT" ]; then
echo "error: Cannot find commit for this build"
exit 1
fi
}
function assert_buildkite_agent() {
if ! command -v buildkite-agent &> /dev/null; then
echo "error: Cannot find buildkite-agent, please install it:"
echo "https://buildkite.com/docs/agent/v3/install"
exit 1
fi
}
function assert_jq() {
assert_command "jq" "jq" "https://stedolan.github.io/jq/"
}
function assert_curl() {
assert_command "curl" "curl" "https://curl.se/download.html"
}
function assert_command() {
local command="$1"
local package="$2"
local help_url="$3"
if ! command -v "$command" &> /dev/null; then
echo "warning: $command is not installed, installing..."
if command -v brew &> /dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install "$package"
else
echo "error: Cannot install $command, please install it"
if [ -n "$help_url" ]; then
echo ""
echo "hint: See $help_url for help"
fi
exit 1
fi
fi
}
function assert_release() {
if [ "$RELEASE" == "1" ]; then
run_command buildkite-agent meta-data set canary "0"
fi
}
function assert_canary() {
local canary="$(buildkite-agent meta-data get canary 2>/dev/null)"
if [ -z "$canary" ]; then
local repo=$(echo "$BUILDKITE_REPO" | sed -E 's#https://github.com/([^/]+)/([^/]+).git#\1/\2#g')
local tag="$(curl -sL "https://api.github.com/repos/$repo/releases/latest" | jq -r ".tag_name")"
if [ "$tag" == "null" ]; then
canary="1"
else
local revision=$(curl -sL "https://api.github.com/repos/$repo/compare/$tag...$BUILDKITE_COMMIT" | jq -r ".ahead_by")
if [ "$revision" == "null" ]; then
canary="1"
else
canary="$revision"
fi
fi
run_command buildkite-agent meta-data set canary "$canary"
fi
}
function upload_buildkite_pipeline() {
local path="$1"
if [ ! -f "$path" ]; then
echo "error: Cannot find pipeline: $path"
exit 1
fi
run_command buildkite-agent pipeline upload "$path"
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
assert_build
assert_buildkite_agent
assert_jq
assert_curl
assert_release
assert_canary
upload_buildkite_pipeline ".buildkite/ci.yml"

View File

@@ -0,0 +1,47 @@
param (
[Parameter(Mandatory=$true)]
[string[]] $Paths,
[switch] $Split
)
$ErrorActionPreference = "Stop"
function Assert-Buildkite-Agent() {
if (-not (Get-Command "buildkite-agent" -ErrorAction SilentlyContinue)) {
Write-Error "Cannot find buildkite-agent, please install it: https://buildkite.com/docs/agent/v3/install"
exit 1
}
}
function Assert-Split-File() {
if (-not (Get-Command "Split-File" -ErrorAction SilentlyContinue)) {
Write-Error "Cannot find Split-File, please install it: https://www.powershellgallery.com/packages/FileSplitter/1.3"
exit 1
}
}
function Upload-Buildkite-Artifact() {
param (
[Parameter(Mandatory=$true)]
[string] $Path,
)
if (-not (Test-Path $Path)) {
Write-Error "Could not find artifact: $Path"
exit 1
}
if ($Split) {
Remove-Item -Path "$Path.*" -Force
Split-File -Path (Resolve-Path $Path) -PartSizeBytes "50MB" -Verbose
$Path = "$Path.*"
}
& buildkite-agent artifact upload "$Path" --debug --debug-http
}
Assert-Buildkite-Agent
if ($Split) {
Assert-Split-File
}
foreach ($Path in $Paths) {
Upload-Buildkite-Artifact $Path
}

View File

@@ -0,0 +1,54 @@
#!/bin/bash
set -eo pipefail
function assert_buildkite_agent() {
if ! command -v buildkite-agent &> /dev/null; then
echo "error: Cannot find buildkite-agent, please install it:"
echo "https://buildkite.com/docs/agent/v3/install"
exit 1
fi
}
function assert_split() {
if ! command -v split &> /dev/null; then
echo "error: Cannot find split, please install it:"
echo "https://www.gnu.org/software/coreutils/split"
exit 1
fi
}
function upload_buildkite_artifact() {
local path="$1"; shift
local split="0"
local args=()
while true; do
if [ -z "$1" ]; then
break
fi
case "$1" in
--split) split="1"; shift ;;
*) args+=("$1"); shift ;;
esac
done
if [ ! -f "$path" ]; then
echo "error: Could not find artifact: $path"
exit 1
fi
if [ "$split" == "1" ]; then
run_command rm -f "$path."*
run_command split -b 50MB -d "$path" "$path."
run_command buildkite-agent artifact upload "$path.*" "${args[@]}"
else
run_command buildkite-agent artifact upload "$path" "${args[@]}"
fi
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
assert_buildkite_agent
upload_buildkite_artifact "$@"

View File

@@ -0,0 +1,211 @@
#!/bin/bash
set -eo pipefail
function assert_main() {
if [ -z "$BUILDKITE_REPO" ]; then
echo "error: Cannot find repository for this build"
exit 1
fi
if [ -z "$BUILDKITE_COMMIT" ]; then
echo "error: Cannot find commit for this build"
exit 1
fi
if [ -n "$BUILDKITE_PULL_REQUEST_REPO" ] && [ "$BUILDKITE_REPO" != "$BUILDKITE_PULL_REQUEST_REPO" ]; then
echo "error: Cannot upload release from a fork"
exit 1
fi
if [ "$BUILDKITE_PULL_REQUEST" != "false" ]; then
echo "error: Cannot upload release from a pull request"
exit 1
fi
if [ "$BUILDKITE_BRANCH" != "main" ]; then
echo "error: Cannot upload release from a branch other than main"
exit 1
fi
}
function assert_buildkite_agent() {
if ! command -v "buildkite-agent" &> /dev/null; then
echo "error: Cannot find buildkite-agent, please install it:"
echo "https://buildkite.com/docs/agent/v3/install"
exit 1
fi
}
function assert_github() {
assert_command "gh" "gh" "https://github.com/cli/cli#installation"
assert_buildkite_secret "GITHUB_TOKEN"
# gh expects the token in $GH_TOKEN
export GH_TOKEN="$GITHUB_TOKEN"
}
function assert_aws() {
assert_command "aws" "awscli" "https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"
for secret in "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY" "AWS_ENDPOINT"; do
assert_buildkite_secret "$secret"
done
assert_buildkite_secret "AWS_BUCKET" --skip-redaction
}
function assert_sentry() {
assert_command "sentry-cli" "getsentry/tools/sentry-cli" "https://docs.sentry.io/cli/installation/"
for secret in "SENTRY_AUTH_TOKEN" "SENTRY_ORG" "SENTRY_PROJECT"; do
assert_buildkite_secret "$secret"
done
}
function run_command() {
set -x
"$@"
{ set +x; } 2>/dev/null
}
function assert_command() {
local command="$1"
local package="$2"
local help_url="$3"
if ! command -v "$command" &> /dev/null; then
echo "warning: $command is not installed, installing..."
if command -v brew &> /dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 run_command brew install "$package"
else
echo "error: Cannot install $command, please install it"
if [ -n "$help_url" ]; then
echo ""
echo "hint: See $help_url for help"
fi
exit 1
fi
fi
}
function assert_buildkite_secret() {
local key="$1"
local value=$(buildkite-agent secret get "$key" ${@:2})
if [ -z "$value" ]; then
echo "error: Cannot find $key secret"
echo ""
echo "hint: Create a secret named $key with a value:"
echo "https://buildkite.com/docs/pipelines/buildkite-secrets"
exit 1
fi
export "$key"="$value"
}
function release_tag() {
local version="$1"
if [ "$version" == "canary" ]; then
echo "canary"
else
echo "bun-v$version"
fi
}
function create_sentry_release() {
local version="$1"
local release="$version"
if [ "$version" == "canary" ]; then
release="$BUILDKITE_COMMIT-canary"
fi
run_command sentry-cli releases new "$release" --finalize
run_command sentry-cli releases set-commits "$release" --auto --ignore-missing
if [ "$version" == "canary" ]; then
run_command sentry-cli deploys new --env="canary" --release="$release"
fi
}
function download_buildkite_artifact() {
local name="$1"
local dir="$2"
if [ -z "$dir" ]; then
dir="."
fi
run_command buildkite-agent artifact download "$name" "$dir"
if [ ! -f "$dir/$name" ]; then
echo "error: Cannot find Buildkite artifact: $name"
exit 1
fi
}
function upload_github_asset() {
local version="$1"
local tag="$(release_tag "$version")"
local file="$2"
run_command gh release upload "$tag" "$file" --clobber --repo "$BUILDKITE_REPO"
# Sometimes the upload fails, maybe this is a race condition in the gh CLI?
while [ "$(gh release view "$tag" --repo "$BUILDKITE_REPO" | grep -c "$file")" -eq 0 ]; do
echo "warn: Uploading $file to $tag failed, retrying..."
sleep "$((RANDOM % 5 + 1))"
run_command gh release upload "$tag" "$file" --clobber --repo "$BUILDKITE_REPO"
done
}
function update_github_release() {
local version="$1"
local tag="$(release_tag "$version")"
if [ "$tag" == "canary" ]; then
run_command gh release edit "$tag" --repo "$BUILDKITE_REPO" \
--notes "This release of Bun corresponds to the commit: $BUILDKITE_COMMIT"
fi
}
function upload_s3_file() {
local folder="$1"
local file="$2"
run_command aws --endpoint-url="$AWS_ENDPOINT" s3 cp "$file" "s3://$AWS_BUCKET/$folder/$file"
}
function create_release() {
assert_main
assert_buildkite_agent
assert_github
assert_aws
assert_sentry
local tag="$1" # 'canary' or 'x.y.z'
local artifacts=(
bun-darwin-aarch64.zip
bun-darwin-aarch64-profile.zip
bun-darwin-x64.zip
bun-darwin-x64-profile.zip
bun-linux-aarch64.zip
bun-linux-aarch64-profile.zip
bun-linux-x64.zip
bun-linux-x64-profile.zip
bun-linux-x64-baseline.zip
bun-linux-x64-baseline-profile.zip
bun-windows-x64.zip
bun-windows-x64-profile.zip
bun-windows-x64-baseline.zip
bun-windows-x64-baseline-profile.zip
)
function upload_artifact() {
local artifact="$1"
download_buildkite_artifact "$artifact"
upload_s3_file "releases/$BUILDKITE_COMMIT" "$artifact" &
upload_s3_file "releases/$tag" "$artifact" &
upload_github_asset "$tag" "$artifact" &
}
for artifact in "${artifacts[@]}"; do
upload_artifact "$artifact" &
done
wait
update_github_release "$tag"
create_sentry_release "$tag"
}
function assert_canary() {
local canary="$(buildkite-agent meta-data get canary 2>/dev/null)"
if [ -z "$canary" ] || [ "$canary" == "0" ]; then
echo "warn: Skipping release because this is not a canary build"
exit 0
fi
}
assert_canary
create_release "canary"

3
.clangd Normal file
View File

@@ -0,0 +1,3 @@
Index:
Background: Skip # Disable slow background indexing of these files.

3
.gitattributes vendored
View File

@@ -42,3 +42,6 @@ docs/**/* linguist-documentation
test/**/* linguist-documentation
bench/**/* linguist-documentation
examples/**/* linguist-documentation
src/deps/*.c linguist-vendored
src/deps/brotli/** linguist-vendored

View File

@@ -1,6 +1,8 @@
name: 🐛 Bug Report
description: Report an issue that should be fixed
labels: [bug]
labels:
- bug
- needs triage
body:
- type: markdown
attributes:

View File

@@ -0,0 +1,45 @@
name: 🇹 TypeScript Type Bug Report
description: Report an issue with TypeScript types
labels: [bug, typescript]
body:
- type: markdown
attributes:
value: |
Thank you for submitting a bug report. It helps make Bun better.
If you need help or support using Bun, and are not reporting a bug, please
join our [Discord](https://discord.gg/CXdq2DP29u) server, where you can ask questions in the [`#help`](https://discord.gg/32EtH6p7HN) forum.
Make sure you are running the [latest](https://bun.sh/docs/installation#upgrading) version of Bun.
The bug you are experiencing may already have been fixed.
Please try to include as much information as possible.
- type: input
attributes:
label: What version of Bun is running?
description: Copy the output of `bun --revision`
- type: input
attributes:
label: What platform is your computer?
description: |
For MacOS and Linux: copy the output of `uname -mprs`
For Windows: copy the output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in the PowerShell console
- type: textarea
attributes:
label: What steps can reproduce the bug?
description: Explain the bug and provide a code snippet that can reproduce it.
validations:
required: true
- type: textarea
attributes:
label: What is the expected behavior?
description: If possible, please provide text instead of a screenshot.
- type: textarea
attributes:
label: What do you see instead?
description: If possible, please provide text instead of a screenshot.
- type: textarea
attributes:
label: Additional information
description: Is there anything else you think we should know?

View File

@@ -0,0 +1,27 @@
name: Prefilled crash report
description: Report a crash in Bun
labels:
- crash
body:
- type: markdown
attributes:
value: |
**Thank you so much** for submitting a crash report. You're helping us make Bun more reliable for everyone!
- type: textarea
id: code
attributes:
label: How can we reproduce the crash?
description: Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun) or [CodeSandbox](https://codesandbox.io/templates/bun)
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be
automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: remapped_trace
attributes:
label: Stack Trace (bun.report)
validations:
required: true

View File

@@ -0,0 +1,27 @@
name: bun install crash report
description: Report a crash in bun install
labels:
- npm
body:
- type: markdown
attributes:
value: |
**Thank you so much** for submitting a crash report. You're helping us make Bun more reliable for everyone!
- type: textarea
id: repro
attributes:
label: How can we reproduce the crash?
description: Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun) or [CodeSandbox](https://codesandbox.io/templates/bun)
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be
automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: remapped_trace
attributes:
label: Stack Trace (bun.report)
validations:
required: true

43
.github/actions/bump/action.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Bump version
description: Bump the version of Bun
inputs:
version:
description: The most recent version of Bun.
required: true
type: string
token:
description: The GitHub token to use for creating a pull request.
required: true
type: string
default: ${{ github.token }}
runs:
using: composite
steps:
- name: Run Bump
shell: bash
id: bump
run: |
set -euo pipefail
MESSAGE=$(bun ./scripts/bump.ts patch --last-version=${{ inputs.version }})
LATEST=$(cat LATEST)
echo "version=$LATEST" >> $GITHUB_OUTPUT
echo "message=$MESSAGE" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
CMakeLists.txt
LATEST
token: ${{ inputs.token }}
commit-message: Bump version to ${{ steps.bump.outputs.version }}
title: Bump to ${{ steps.bump.outputs.version }}
delete-branch: true
branch: github-actions/bump-version-${{ steps.bump.outputs.version }}--${{ github.run_id }}
body: |
## What does this PR do?
${{ steps.bump.outputs.message }}
Auto-bumped by [this workflow](https://github.com/oven-sh/bun/actions/workflows/release.yml)

50
.github/actions/setup-bun/action.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Setup Bun
description: An internal version of the 'oven-sh/setup-bun' action.
inputs:
bun-version:
type: string
description: "The version of bun to install: 'latest', 'canary', 'bun-v1.0.0', etc."
default: latest
required: false
baseline:
type: boolean
description: "Whether to use the baseline version of bun."
default: false
required: false
download-url:
type: string
description: "The base URL to download bun from."
default: "https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases"
required: false
runs:
using: composite
steps:
- name: Setup Bun
shell: bash
run: |
case "$(uname -s)" in
Linux*) os=linux;;
Darwin*) os=darwin;;
*) os=windows;;
esac
case "$(uname -m)" in
arm64 | aarch64) arch=aarch64;;
*) arch=x64;;
esac
case "${{ inputs.baseline }}" in
true | 1) target="bun-${os}-${arch}-baseline";;
*) target="bun-${os}-${arch}";;
esac
case "${{ inputs.bun-version }}" in
latest) release="latest";;
canary) release="canary";;
*) release="bun-v${{ inputs.bun-version }}";;
esac
curl -LO "${{ inputs.download-url }}/${release}/${target}.zip"
unzip ${target}.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv ${target}/bun* ${{ runner.temp }}/.bun/bin/
chmod +x ${{ runner.temp }}/.bun/bin/*
echo "${{ runner.temp }}/.bun/bin" >> ${GITHUB_PATH}

View File

@@ -19,18 +19,17 @@ This adds a new flag --bail to bun test. When set, it will stop running tests af
<!-- If JavaScript/TypeScript modules or builtins changed:
- [ ] I ran `make js` and committed the transpiled changes
- [ ] I or my editor ran Prettier on the changed files (or I ran `bun fmt`)
- [ ] I included a test for the new code, or an existing test covers it
- [ ] I included a test for the new code, or existing tests cover it
- [ ] I ran my tests locally and they pass (`bun-debug test test-file-name.test`)
-->
<!-- If Zig files changed:
- [ ] I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be
- [ ] I or my editor ran `zig fmt` on the changed files
- [ ] I included a test for the new code, or an existing test covers it
- [ ] JSValue used outside outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed
- [ ] I wrote TypeScript/JavaScript tests and they pass locally (`bun-debug test test-file-name.test`)
-->
<!-- If new methods, getters, or setters were added to a publicly exposed class:
@@ -43,17 +42,6 @@ This adds a new flag --bail to bun test. When set, it will stop running tests af
- [ ] I made sure that specific versions of dependencies are used instead of ranged or tagged versions
-->
<!-- If functions were added to exports.zig or bindings.zig
- [ ] I ran `make headers` to regenerate the C header file
-->
<!-- If \*.classes.ts files were added or changed:
- [ ] I ran `make codegen` to regenerate the C++ and Zig code
-->
<!-- If a new builtin ESM/CJS module was added:
- [ ] I updated Aliases in `module_loader.zig` to include the new module

View File

@@ -1,18 +0,0 @@
# redeploy Vercel site when a file in `docs` changes
# using VERCEL_DEPLOY_HOOK environment variable
name: Deploy site
on:
push:
paths:
- "docs/**"
branches: [main]
jobs:
deploy:
name: Deploy site
runs-on: ubuntu-latest
if: github.repository_owner == 'oven-sh'
steps:
- name: Trigger Vercel build
run: curl ${{ secrets.VERCEL_DEPLOY_HOOK }}

View File

@@ -1,130 +0,0 @@
name: bun-linux
concurrency:
group: bun-linux-aarch64-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
linux:
name: ${{matrix.tag}}
runs-on: ${{matrix.runner}}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
permissions: write-all
strategy:
matrix:
include:
- cpu: native
tag: linux-aarch64
arch: aarch64
build_arch: arm64
runner: linux-arm64
build_machine_arch: aarch64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Run
run: |
rm -rf ${{runner.temp}}/release
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
mkdir -p /tmp/.buildx-cache-${{matrix.tag}}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: false
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
ARCH=${{matrix.arch}}
BUILDARCH=${{matrix.build_arch}}
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
CPU_TARGET=${{matrix.cpu}}
GIT_SHA=${{github.sha}}
platforms: linux/${{matrix.build_arch}}
target: artifact
outputs: type=local,dest=${{runner.temp}}/release
- name: Zip
run: |
# if zip is not found
if [ ! -x "$(command -v zip)" ]; then
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
fi
if [ ! -x "$(command -v strip)" ]; then
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
fi
cd ${{runner.temp}}/release
chmod +x bun-profile bun
mkdir bun-${{matrix.tag}}-profile
mkdir bun-${{matrix.tag}}
strip bun
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
mv bun bun-${{matrix.tag}}/bun
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}-profile
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"

View File

@@ -1,301 +0,0 @@
name: bun-linux
concurrency:
group: bun-linux-build-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
linux:
name: ${{matrix.tag}}
runs-on: ${{matrix.runner}}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- cpu: haswell
tag: linux-x64
arch: x86_64
build_arch: amd64
runner: big-ubuntu
build_machine_arch: x86_64
assertions: "OFF"
zig_optimize: "ReleaseFast"
target: "artifact"
- cpu: nehalem
tag: linux-x64-baseline
arch: x86_64
build_arch: amd64
runner: big-ubuntu
build_machine_arch: x86_64
assertions: "OFF"
zig_optimize: "ReleaseFast"
target: "artifact"
# - cpu: haswell
# tag: linux-x64-assertions
# arch: x86_64
# build_arch: amd64
# runner: big-ubuntu
# build_machine_arch: x86_64
# assertions: "ON"
# zig_optimize: "ReleaseSafe"
# target: "artifact-assertions"
# - cpu: nehalem
# tag: linux-x64-baseline-assertions
# arch: x86_64
# build_arch: amd64
# runner: big-ubuntu
# build_machine_arch: x86_64
# assertions: "ON"
# zig_optimize: "ReleaseSafe"
# target: "artifact-assertions"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{github.sha}}
clean: true
- uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Run
run: |
rm -rf ${{runner.temp}}/release
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
mkdir -p /tmp/.buildx-cache-${{matrix.tag}}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: false
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
ARCH=${{matrix.arch}}
BUILDARCH=${{matrix.build_arch}}
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
CPU_TARGET=${{matrix.cpu}}
GIT_SHA=${{github.sha}}
ASSERTIONS=${{matrix.assertions}}
ZIG_OPTIMIZE=${{matrix.zig_optimize}}
SCCACHE_BUCKET=bun
SCCACHE_REGION=auto
SCCACHE_S3_USE_SSL=true
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
platforms: linux/${{matrix.build_arch}}
target: ${{matrix.target}}
outputs: type=local,dest=${{runner.temp}}/release
- name: Zip
run: |
# if zip is not found
if [ ! -x "$(command -v zip)" ]; then
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
fi
if [ ! -x "$(command -v strip)" ]; then
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
fi
cd ${{runner.temp}}/release
chmod +x bun-profile bun
mkdir bun-${{matrix.tag}}-profile
mkdir bun-${{matrix.tag}}
strip bun
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
mv bun bun-${{matrix.tag}}/bun
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}-profile
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
- uses: actions/upload-artifact@v3
with:
name: bun-obj-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-obj
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}-dependencies
path: ${{runner.temp}}/release/bun-dependencies
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
linux-test:
name: Tests ${{matrix.tag}}
runs-on: ubuntu-latest
needs: [linux]
if: github.event_name == 'pull_request'
timeout-minutes: 20
permissions:
pull-requests: write
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
strategy:
fail-fast: false
matrix:
include:
- tag: linux-x64
- tag: linux-x64-baseline
- tag: linux-x64-assertions
- tag: linux-x64-baseline-assertions
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v4
with:
submodules: false
clean: true
- id: download
name: Download
uses: actions/download-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release
- id: install-bun
name: Install Bun
run: |
cd ${{runner.temp}}/release
unzip bun-${{matrix.tag}}.zip
cd bun-${{matrix.tag}}
chmod +x bun
pwd >> $GITHUB_PATH
./bun --version
- id: install-dependnecies
name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y openssl
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test (node runner)
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
# if: ${{github.event.inputs.use_bun == 'false'}}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- uses: sarisia/actions-status-discord@v1
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
- name: Comment on PR
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- name: Uncomment on PR
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- id: fail
name: Fail the build
if: steps.test.outputs.failing_tests != ''
run: exit 1

View File

@@ -1,456 +0,0 @@
name: bun-macOS-aarch64
concurrency:
group: bun-macOS-aarch64-${{ github.ref }}
cancel-in-progress: true
env:
LLVM_VERSION: 16
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
on:
push:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macOS-zig:
name: macOS Zig Object
runs-on: med-ubuntu
if: github.repository_owner == 'oven-sh'
strategy:
matrix:
include:
- cpu: native
arch: aarch64
tag: bun-obj-darwin-aarch64
steps:
- uses: actions/checkout@v4
# - name: Checkout submodules
# run: git submodule update --init --recursive --depth=1 --progress --force
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compile Zig Object
uses: docker/build-push-action@v3
if: runner.arch == 'X64'
with:
context: .
push: false
# This doesnt seem to work
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
build-args: |
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
ARCH=${{ matrix.arch }}
CPU_TARGET=${{ matrix.cpu }}
TRIPLET=${{ matrix.arch }}-macos-none
GIT_SHA=${{ github.sha }}
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
target: build_release_obj
outputs: type=local,dest=${{runner.temp}}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}
path: ${{runner.temp}}/release/bun-zig.o
macOS-dependencies:
name: macOS Dependencies
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 15
strategy:
matrix:
include:
- cpu: native
arch: aarch64
tag: bun-darwin-aarch64
obj: bun-obj-darwin-aarch64
artifact: bun-obj-darwin-aarch64
runner: macos-arm64
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
- name: Hash submodule versions
run: |
print_data() {
git submodule | grep -v WebKit
llvm-config --version
rustc --version
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
}
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
id: submodule-versions
- name: Cache submodule dependencies
id: cache-deps-restore
uses: actions/cache/restore@v3
with:
path: ${{runner.temp}}/bun-deps
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
- name: Compile submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
env:
CPU_TARGET: ${{ matrix.cpu }}
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $BUN_DEPS_OUT_DIR
bash ./scripts/clean-dependencies.sh
bash ./scripts/all-dependencies.sh
- name: Cache submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
id: cache-deps-save
uses: actions/cache/save@v3
with:
path: ${{runner.temp}}/bun-deps
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
- name: Upload submodule dependencies
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
macOS-cpp:
name: macOS C++
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
strategy:
matrix:
include:
- cpu: native
arch: aarch64
tag: bun-darwin-aarch64
obj: bun-obj-darwin-aarch64
artifact: bun-obj-darwin-aarch64
runner: macos-arm64
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
# TODO: replace with sccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
- name: Compile C++
env:
CPU_TARGET: ${{ matrix.cpu }}
SOURCE_DIR: ${{ github.workspace }}
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $OBJ_DIR
cd $OBJ_DIR
cmake -S $SOURCE_DIR -B $OBJ_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_CPP_ONLY=1 \
-DNO_CONFIGURE_DEPENDS=1
bash compile-cpp-only.sh -v
- name: Upload C++
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
macOS-link:
name: macOS Link
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
needs: [macOS-zig, macOS-cpp, macOS-dependencies]
timeout-minutes: 60
permissions: write-all
strategy:
matrix:
include:
- cpu: native
arch: aarch64
tag: bun-darwin-aarch64
obj: bun-obj-darwin-aarch64
package: bun-darwin-aarch64
artifact: bun-obj-darwin-aarch64
runner: macos-arm64
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{github.sha}}
clean: true
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-${{matrix.arch}}.zip"
unzip bun-darwin-${{matrix.arch}}.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv bun-darwin-${{matrix.arch}}/bun ${{ runner.temp }}/.bun/bin/bun
chmod +x ${{ runner.temp }}/.bun/bin/bun
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
- name: Download C++
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj
- name: Download Zig Object
uses: actions/download-artifact@v3
with:
name: ${{ matrix.obj }}
path: ${{ runner.temp }}/release
- name: Downloaded submodule dependencies
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
- name: Link
env:
CPU_TARGET: ${{ matrix.cpu }}
run: |
SRC_DIR=$PWD
mkdir ${{runner.temp}}/link-build
cd ${{runner.temp}}/link-build
cmake $SRC_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
-DNO_CONFIGURE_DEPENDS=1
ninja -v
- name: Zip
run: |
cd ${{runner.temp}}/link-build
chmod +x bun-profile bun
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
mv bun-profile ${{matrix.tag}}-profile/bun-profile
mv bun ${{matrix.tag}}/bun
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}-profile
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
macOS-test:
name: Tests ${{matrix.tag}}
runs-on: ${{ matrix.runner }}
needs: [macOS-link]
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
permissions:
pull-requests: write
timeout-minutes: 30
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
strategy:
fail-fast: false
matrix:
include:
- tag: bun-darwin-aarch64
runner: macos-arm64
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
with:
submodules: false
- id: download
name: Download
uses: actions/download-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/release
- id: install-bun
name: Install Bun
run: |
cd ${{runner.temp}}/release
unzip ${{matrix.tag}}.zip
cd ${{matrix.tag}}
chmod +x bun
pwd >> $GITHUB_PATH
./bun --version
- id: install
name: Install dependencies
run: |
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test (node runner)
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
# if: ${{github.event.inputs.use_bun == 'false'}}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- uses: sarisia/actions-status-discord@v1
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
- name: Comment on PR
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- name: Uncomment on PR
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- id: fail
name: Fail the build
if: steps.test.outputs.failing_tests != ''
run: exit 1

View File

@@ -1,474 +0,0 @@
name: bun-macOS-x64-baseline
concurrency:
group: bun-macOS-x64-baseline-${{ github.ref }}
cancel-in-progress: true
env:
LLVM_VERSION: 16
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
on:
push:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macos-object-files:
name: macOS Object
runs-on: med-ubuntu
if: github.repository_owner == 'oven-sh'
strategy:
matrix:
include:
- cpu: nehalem
arch: x86_64
tag: bun-obj-darwin-x64-baseline
# - cpu: haswell
# arch: x86_64
# tag: bun-obj-darwin-x64
# - cpu: native
# arch: aarch64
# tag: bun-obj-darwin-aarch64
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compile Zig Object
uses: docker/build-push-action@v3
with:
context: .
push: false
# This doesnt seem to work
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# This was used before, but also does not really work
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
ARCH=${{ matrix.arch }}
CPU_TARGET=${{ matrix.cpu }}
TRIPLET=${{ matrix.arch }}-macos-none
GIT_SHA=${{ github.sha }}
SCCACHE_BUCKET=bun
SCCACHE_REGION=auto
SCCACHE_S3_USE_SSL=true
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
target: build_release_obj
outputs: type=local,dest=${{runner.temp}}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}
path: ${{runner.temp}}/release/bun-zig.o
macOS-dependencies:
name: macOS Dependencies
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 15
strategy:
matrix:
include:
- cpu: nehalem
arch: x86_64
tag: bun-darwin-x64-baseline
obj: bun-obj-darwin-x64-baseline
runner: macos-12
artifact: bun-obj-darwin-x64-baseline
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
- name: Hash submodule versions
run: |
print_data() {
git submodule | grep -v WebKit
llvm-config --version
rustc --version
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
}
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
id: submodule-versions
- name: Cache submodule dependencies
id: cache-deps-restore
uses: actions/cache/restore@v3
with:
path: ${{runner.temp}}/bun-deps
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
- name: Compile submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
env:
CPU_TARGET: ${{ matrix.cpu }}
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $BUN_DEPS_OUT_DIR
bash ./scripts/clean-dependencies.sh
bash ./scripts/all-dependencies.sh
- name: Cache submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
id: cache-deps-save
uses: actions/cache/save@v3
with:
path: ${{runner.temp}}/bun-deps
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
- name: Upload submodule dependencies
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
macOS-cpp:
name: macOS C++
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
strategy:
matrix:
include:
- cpu: nehalem
arch: x86_64
tag: bun-darwin-x64-baseline
obj: bun-obj-darwin-x64-baseline
runner: macos-12
artifact: bun-obj-darwin-x64-baseline
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
unzip bun-darwin-x64-baseline.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
chmod +x ${{ runner.temp }}/.bun/bin/bun
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
# TODO: replace with sccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
- name: Compile C++
env:
CPU_TARGET: ${{ matrix.cpu }}
SOURCE_DIR: ${{ github.workspace }}
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $OBJ_DIR
cd $OBJ_DIR
cmake -S $SOURCE_DIR -B $OBJ_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_CPP_ONLY=1 \
-DNO_CONFIGURE_DEPENDS=1
bash compile-cpp-only.sh -v
- name: Upload C++
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
macOS:
name: macOS Link
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
needs: [macOS-cpp, macos-object-files, macOS-dependencies]
timeout-minutes: 90
permissions: write-all
strategy:
matrix:
include:
- cpu: nehalem
arch: x86_64
tag: bun-darwin-x64-baseline
obj: bun-obj-darwin-x64-baseline
package: bun-darwin-x64
runner: macos-12
artifact: bun-obj-darwin-x64-baseline
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
unzip bun-darwin-x64-baseline.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
chmod +x ${{ runner.temp }}/.bun/bin/bun
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
- name: Download C++
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj
- name: Download Zig Object
uses: actions/download-artifact@v3
with:
name: ${{ matrix.obj }}
path: ${{ runner.temp }}/release
- name: Downloaded submodule dependencies
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
- name: Link
env:
CPU_TARGET: ${{ matrix.cpu }}
run: |
SRC_DIR=$PWD
mkdir ${{runner.temp}}/link-build
cd ${{runner.temp}}/link-build
cmake $SRC_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
-DNO_CONFIGURE_DEPENDS=1
ninja -v
- name: Zip
run: |
cd ${{runner.temp}}/link-build
chmod +x bun-profile bun
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
mv bun-profile ${{matrix.tag}}-profile/bun-profile
mv bun ${{matrix.tag}}/bun
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}-profile
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
macOS-test:
name: macOS Test
runs-on: ${{ matrix.runner }}
needs: [macOS]
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
permissions:
pull-requests: write
timeout-minutes: 30
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
strategy:
fail-fast: false
matrix:
include:
- tag: bun-darwin-x64-baseline
runner: macos-12
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
with:
submodules: false
- id: download
name: Download
uses: actions/download-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/release
- id: install-bun
name: Install Bun
run: |
cd ${{runner.temp}}/release
unzip ${{matrix.tag}}.zip
cd ${{matrix.tag}}
chmod +x bun
pwd >> $GITHUB_PATH
./bun --version
- id: install
name: Install dependencies
run: |
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test (node runner)
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
# if: ${{github.event.inputs.use_bun == 'false'}}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- uses: sarisia/actions-status-discord@v1
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
Hey @${{ github.actor }},
${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
- name: Comment on PR
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- name: Uncomment on PR
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- id: fail
name: Fail the build
if: steps.test.outputs.failing_tests != ''
run: exit 1

View File

@@ -1,470 +0,0 @@
name: bun-macOS-x64
concurrency:
group: bun-macOS-x64-${{ github.ref }}
cancel-in-progress: true
env:
LLVM_VERSION: 16
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
on:
push:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macOS-zig:
name: macOS Zig Object
runs-on: med-ubuntu
if: github.repository_owner == 'oven-sh'
strategy:
matrix:
include:
# - cpu: nehalem
# arch: x86_64
# tag: bun-obj-darwin-x64-baseline
- cpu: haswell
arch: x86_64
tag: bun-obj-darwin-x64
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compile Zig Object
uses: docker/build-push-action@v3
with:
context: .
push: false
# This doesnt seem to work
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# This was used before, but also does not really work
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
ARCH=${{ matrix.arch }}
CPU_TARGET=${{ matrix.cpu }}
TRIPLET=${{ matrix.arch }}-macos-none
GIT_SHA=${{ github.sha }}
SCCACHE_BUCKET=bun
SCCACHE_REGION=auto
SCCACHE_S3_USE_SSL=true
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
target: build_release_obj
outputs: type=local,dest=${{runner.temp}}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}
path: ${{runner.temp}}/release/bun-zig.o
macOS-dependencies:
name: macOS Dependencies
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 15
strategy:
matrix:
include:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
runner: macos-12
artifact: bun-obj-darwin-x64
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
- name: Hash submodule versions
run: |
print_data() {
git submodule | grep -v WebKit
llvm-config --version
rustc --version
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
}
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
id: submodule-versions
- name: Cache submodule dependencies
id: cache-deps-restore
uses: actions/cache/restore@v3
with:
path: ${{runner.temp}}/bun-deps
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
- name: Compile submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
env:
CPU_TARGET: ${{ matrix.cpu }}
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $BUN_DEPS_OUT_DIR
bash ./scripts/clean-dependencies.sh
bash ./scripts/all-dependencies.sh
- name: Cache submodule dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
id: cache-deps-save
uses: actions/cache/save@v3
with:
path: ${{runner.temp}}/bun-deps
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
- name: Upload submodule dependencies
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
macOS-cpp:
name: macOS C++
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
strategy:
matrix:
include:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
runner: macos-12
artifact: bun-obj-darwin-x64
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64.zip"
unzip bun-darwin-x64.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun
chmod +x ${{ runner.temp }}/.bun/bin/bun
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
# TODO: replace with sccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
- name: Compile C++
env:
CPU_TARGET: ${{ matrix.cpu }}
SOURCE_DIR: ${{ github.workspace }}
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
run: |
mkdir -p $OBJ_DIR
cd $OBJ_DIR
cmake -S $SOURCE_DIR -B $OBJ_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_CPP_ONLY=1 \
-DNO_CONFIGURE_DEPENDS=1
bash compile-cpp-only.sh -v
- name: Upload C++
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
macOS:
name: macOS Link
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'oven-sh'
needs: [macOS-cpp, macOS-zig, macOS-dependencies]
timeout-minutes: 90
permissions: write-all
strategy:
matrix:
include:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
package: bun-darwin-x64
runner: macos-12
artifact: bun-obj-darwin-x64
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-oct3-4/bun-webkit-macos-amd64-lto.tar.gz"
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1 --progress --force
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
unzip bun-darwin-x64-baseline.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
chmod +x ${{ runner.temp }}/.bun/bin/bun
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
- name: Download C++
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj
- name: Download Zig Object
uses: actions/download-artifact@v3
with:
name: ${{ matrix.obj }}
path: ${{ runner.temp }}/release
- name: Downloaded submodule dependencies
uses: actions/download-artifact@v3
with:
name: ${{ matrix.tag }}-deps
path: ${{runner.temp}}/bun-deps
- name: Link
env:
CPU_TARGET: ${{ matrix.cpu }}
run: |
SRC_DIR=$PWD
mkdir ${{runner.temp}}/link-build
cd ${{runner.temp}}/link-build
cmake $SRC_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
-DNO_CONFIGURE_DEPENDS=1
ninja -v
- name: Zip
run: |
cd ${{runner.temp}}/link-build
chmod +x bun-profile bun
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
mv bun-profile ${{matrix.tag}}-profile/bun-profile
mv bun ${{matrix.tag}}/bun
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}-profile
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
macOS-test:
name: Tests ${{matrix.tag}}
runs-on: ${{ matrix.runner }}
needs: [macOS]
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
permissions:
pull-requests: write
timeout-minutes: 30
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
strategy:
fail-fast: false
matrix:
include:
- tag: bun-darwin-x64
runner: macos-12
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
with:
submodules: false
- id: download
name: Download
uses: actions/download-artifact@v3
with:
name: ${{matrix.tag}}
path: ${{runner.temp}}/release
- id: install-bun
name: Install Bun
run: |
cd ${{runner.temp}}/release
unzip ${{matrix.tag}}.zip
cd ${{matrix.tag}}
chmod +x bun
pwd >> $GITHUB_PATH
./bun --version
- id: install
name: Install dependencies
run: |
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test (node runner)
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
# if: ${{github.event.inputs.use_bun == 'false'}}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- uses: sarisia/actions-status-discord@v1
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
- name: Comment on PR
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- name: Uncomment on PR
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- id: fail
name: Fail the build
if: steps.test.outputs.failing_tests != ''
run: exit 1

View File

@@ -1,41 +0,0 @@
name: bun-types
on:
push:
paths:
- "packages/bun-types/**"
branches: [main]
pull_request:
paths:
- "packages/bun-types/**"
jobs:
tests:
name: type-tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/bun-types
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: canary
- name: Install node
uses: actions/setup-node@v3
with:
node-version: latest
- name: Install dependencies
run: |
bun install
- name: Generate package
run: bun run build
- name: Tests
run: bun run test

View File

@@ -1,337 +0,0 @@
name: bun-windows-x64
concurrency:
group: bun-windows-x64-${{ github.ref }}
cancel-in-progress: true
env:
# note: in other files, this version is only the major version, but for windows it is the full version
LLVM_VERSION: 16.0.6
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
cpu: native
arch: x86_64
tag: bun-windows-x64
# TODO: wire this up to workflow_dispatch.
# github's expression syntax makes this hard to set a default to true
canary: true
on:
push:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches: [main]
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# inputs:
# is-canary:
# type: boolean
# description: Is Canary Build?
# default: true
jobs:
windows-zig:
name: Zig Build
runs-on: med-ubuntu
timeout-minutes: 60
if: github.repository_owner == 'oven-sh'
steps:
- uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate Canary Revision
if: ${{ env.canary == 'true' }}
id: canary
run: |
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" >> $GITHUB_OUTPUT
- name: Compile Zig Object
uses: docker/build-push-action@v3
if: runner.arch == 'X64'
with:
context: .
push: false
# This doesnt seem to work
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
build-args: |
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
ARCH=${{ env.arch }}
CPU_TARGET=${{ env.cpu }}
TRIPLET=${{ env.arch }}-windows-msvc
GIT_SHA=${{ github.sha }}
CANARY=${{ env.canary == 'true' && steps.canary.outputs.canary_revision || '0' }}
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
target: build_release_obj
outputs: type=local,dest=${{runner.temp}}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v3
with:
name: ${{ env.tag }}-zig
path: ${{runner.temp}}/release/bun-zig.o
windows-dependencies:
name: Dependencies
runs-on: windows
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone Submodules
run: .\scripts\update-submodules.ps1
- name: Hash submodule versions
shell: pwsh
run: |
$data = "$(& {
git submodule | Where-Object { $_ -notmatch 'WebKit' }
clang --version
rustc --version
Get-Content -Path (Get-ChildItem -Path 'scripts/build*.sh', 'scripts/all-dependencies.sh' | Sort-Object -Property Name).FullName | Out-String
})"
$hash = ( -join ((New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($data)) | ForEach-Object { $_.ToString("x2") } )).Substring(0, 10)
echo "sha=${hash}" >> $env:GITHUB_OUTPUT
id: submodule-versions
- name: Try fetch dependencies
id: cache-deps-restore
uses: actions/cache/restore@v3
with:
path: bun-deps
key: bun-deps-${{ env.tag }}-${{ steps.submodule-versions.outputs.sha }}
- name: Install LLVM ${{ env.LLVM_VERSION }}
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
with:
version: ${{ env.LLVM_VERSION }}
- name: Install Ninja
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
run: choco install -y ninja
- name: Build Dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
run: |
.\scripts\env.ps1
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip" -OutFile nasm.zip
Expand-Archive nasm.zip (mkdir -Force "nasm")
$Nasm = (Get-ChildItem "nasm")
$env:Path += ";${Nasm}"
$env:BUN_DEPS_OUT_DIR = (mkdir -Force "./bun-deps")
.\scripts\all-dependencies.ps1
- name: Upload Dependencies
uses: actions/upload-artifact@v3
with:
name: ${{ env.tag }}-deps
path: bun-deps/
- name: Cache Dependencies
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
id: cache-deps-save
uses: actions/cache/save@v3
with:
path: bun-deps
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
windows-codegen:
name: Codegen
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.repository_owner == 'oven-sh'
steps:
- uses: actions/checkout@v4
- run: |
curl -fsSL $BUN_DOWNLOAD_URL_BASE/bun-linux-x64.zip > bun.zip
unzip bun.zip
export PATH="$PWD/bun-linux-x64:$PATH"
./scripts/cross-compile-codegen.sh win32 x64
# Sort of a hack to do this step in the codegen stage
- name: Calculate Canary Revision
if: ${{ env.canary == 'true' }}
run: |
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" > build-codegen-win32-x64/.canary_revision
- uses: actions/upload-artifact@v3
with:
name: ${{ env.tag }}-codegen
path: build-codegen-win32-x64/
windows-cpp:
name: C++ Build
needs: [windows-codegen]
runs-on: windows
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
with:
version: ${{ env.LLVM_VERSION }}
- run: choco install -y ninja
- name: Download Codegen
uses: actions/download-artifact@v3
with:
name: ${{ env.tag }}-codegen
path: build
- name: Build C++
run: |
# Using SCCache is blocked by
# https://github.com/mozilla/sccache/issues/1843
# https://github.com/mozilla/sccache/pull/1856
# $sczip = "sccache-v0.6.0-x86_64-pc-windows-msvc"
# Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/v0.6.0/${sczip}.zip" -OutFile "${sczip}.zip"
# Expand-Archive "${sczip}.zip"
# $env:SCCACHE_BUCKET="bun"
# $env:SCCACHE_REGION="auto"
# $env:SCCACHE_S3_USE_SSL="true"
# $env:SCCACHE_ENDPOINT="${{ secrets.CACHE_S3_ENDPOINT }}"
# $env:AWS_ACCESS_KEY_ID="${{ secrets.CACHE_S3_ACCESS_KEY_ID }}"
# $env:AWS_SECRET_ACCESS_KEY="${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}"
# $SCCACHE="$PWD/${sczip}/${sczip}/sccache.exe"
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
.\scripts\env.ps1
.\scripts\update-submodules.ps1
.\scripts\build-libuv.ps1 -CloneOnly $True
cd build
# "-DCCACHE_PROGRAM=${SCCACHE}"
# TODO(@paperdave): pass the proper revision of canary here. without it,
# the properties window will display the wrong version.
# not really a big deal for time being. should be resolved before release
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
-DNO_CODEGEN=1 `
-DNO_CONFIGURE_DEPENDS=1 `
"-DCANARY=${CANARY_REVISION}" `
-DBUN_CPP_ONLY=1
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
.\compile-cpp-only.ps1 -v
if ($LASTEXITCODE -ne 0) { throw "C++ compilation failed" }
- uses: actions/upload-artifact@v3
with:
name: ${{ env.tag }}-cpp
path: build/bun-cpp-objects.a
windows-link:
name: Link
needs: [windows-dependencies, windows-codegen, windows-cpp, windows-zig]
runs-on: windows-latest
if: github.repository_owner == 'oven-sh'
timeout-minutes: 30
permissions: write-all
steps:
- uses: actions/checkout@v4
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
with:
version: ${{ env.LLVM_VERSION }}
- run: choco install -y ninja
- name: Download Codegen
uses: actions/download-artifact@v3
with:
name: ${{ env.tag }}-codegen
path: build
- name: Download Dependencies
uses: actions/download-artifact@v3
with:
name: ${{ env.tag }}-deps
path: bun-deps
- name: Download Zig Object
uses: actions/download-artifact@v3
with:
name: ${{ env.tag }}-zig
path: bun-zig
- name: Download C++ Objects
uses: actions/download-artifact@v3
with:
name: ${{ env.tag }}-cpp
path: bun-cpp
- name: Link
run: |
.\scripts\update-submodules.ps1
.\scripts\env.ps1
Set-Location build
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
-DNO_CODEGEN=1 `
-DNO_CONFIGURE_DEPENDS=1 `
"-DCANARY=${CANARY_REVISION}" `
-DBUN_LINK_ONLY=1 `
"-DBUN_DEPS_OUT_DIR=$(Resolve-Path ../bun-deps)" `
"-DBUN_CPP_ARCHIVE=$(Resolve-Path ../bun-cpp/bun-cpp-objects.a)" `
"-DBUN_ZIG_OBJ=$(Resolve-Path ../bun-zig/bun-zig.o)"
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
ninja -v
if ($LASTEXITCODE -ne 0) { throw "Link failed!" }
- name: Package
run: |
$Dist = mkdir -Force "${{ env.tag }}"
cp -r build\bun.exe "$Dist\bun.exe"
Compress-Archive $Dist ${{ env.tag }}.zip
- uses: actions/upload-artifact@v3
with:
name: ${{ env.tag }}
path: ${{ env.tag }}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{env.tag}}.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ env.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})

85
.github/workflows/comment-lint.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: C++ Linter comment
permissions:
actions: read
pull-requests: write
on:
workflow_run:
workflows:
- lint-cpp
types:
- completed
jobs:
comment-lint:
if: ${{ github.repository_owner == 'oven-sh' }}
name: Comment
runs-on: ubuntu-latest
steps:
- name: Download Comment
uses: actions/download-artifact@v4
with:
name: format.log
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: PR Number
uses: actions/download-artifact@v4
with:
name: pr-number.txt
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Did Fail
uses: actions/download-artifact@v4
with:
name: did_fail.txt
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Setup Environment
id: env
shell: bash
run: |
# Copy to outputs
echo "pr-number=$(cat pr-number.txt)" >> $GITHUB_OUTPUT
{
echo 'text_output<<EOF'
cat format.log
echo EOF
} >> "$GITHUB_OUTPUT"
echo "did_fail=$(cat did_fail.txt)" >> $GITHUB_OUTPUT
- name: Find Comment
id: comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ steps.env.outputs.pr-number }}
comment-author: github-actions[bot]
body-includes: <!-- generated-comment lint-cpp-workflow=${{ github.workflow }} -->
- name: Update Comment
uses: peter-evans/create-or-update-comment@v4
if: steps.env.outputs.did_fail != '0'
with:
comment-id: ${{ steps.comment.outputs.comment-id }}
issue-number: ${{ steps.env.outputs.pr-number }}
body: |
@${{ github.actor }}, `clang-tidy` had something to share with you about your code:
```cpp
${{ steps.env.outputs.text_output }}
```
Commit: ${{ github.event.workflow_run.head_sha || github.sha }}
<!-- generated-comment lint-cpp-workflow=${{ github.workflow }} -->
edit-mode: replace
- name: Update Previous Comment
uses: peter-evans/create-or-update-comment@v4
if: steps.env.outputs.did_fail == '0' && steps.comment.outputs.comment-id != ''
with:
comment-id: ${{ steps.comment.outputs.comment-id }}
issue-number: ${{ steps.env.outputs.pr-number }}
body: |
clang-tidy nits are fixed! Thank you.
<!-- generated-comment lint-cpp-workflow=${{ github.workflow }} -->
edit-mode: replace

21
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Docs
on:
push:
paths:
- "docs/**"
- "CONTRIBUTING.md"
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'oven-sh' }}
steps:
# redeploy Vercel site when a file in `docs` changes
# using VERCEL_DEPLOY_HOOK environment variable
- name: Trigger Webhook
run: |
curl -v ${{ secrets.VERCEL_DEPLOY_HOOK }}

View File

@@ -1,45 +0,0 @@
name: autofix.ci # Must be named this for autofix.ci to work
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
env:
ZIG_VERSION: 0.12.0-dev.1604+caae40c21
permissions:
contents: read
jobs:
format:
name: format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
src
packages
test
bench
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Setup Zig
uses: goto-bus-stop/setup-zig@c7b6cdd3adba8f8b96984640ff172c37c93f73ee
with:
version: ${{ env.ZIG_VERSION }}
- name: Install Dependencies
run: |
bun install
- name: Format
run: |
bun fmt
bun fmt:zig
- name: Commit # https://autofix.ci/
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc

81
.github/workflows/labeled.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Issue Labeled
env:
BUN_VERSION: 1.1.13
on:
issues:
types: [labeled]
jobs:
on-labeled:
runs-on: ubuntu-latest
if: github.event.label.name == 'crash' || github.event.label.name == 'needs repro'
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
.github
CMakeLists.txt
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.13"
- name: "add platform and command label"
id: add-labels
if: github.event.label.name == 'crash'
env:
GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}
GITHUB_ISSUE_TITLE: ${{ github.event.issue.title }}
shell: bash
run: |
LABELS=$(bun scripts/read-issue.ts)
echo "labels=$LABELS" >> $GITHUB_OUTPUT
bun scripts/is-outdated.ts
if [[ -f "is-outdated.txt" ]]; then
echo "is-outdated=true" >> $GITHUB_OUTPUT
fi
if [[ -f "outdated.txt" ]]; then
echo "oudated=$(cat outdated.txt)" >> $GITHUB_OUTPUT
fi
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
rm -rf is-outdated.txt outdated.txt latest.txt
- name: Add labels
uses: actions-cool/issues-helper@v3
if: github.event.label.name == 'crash'
with:
actions: "add-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: ${{ steps.add-labels.outputs.labels }}
- name: Comment outdated
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
@${{ github.event.issue.user.login }}, the latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.oudated }}.
Are you able to reproduce this crash on the latest version of Bun?
```sh
bun upgrade
```
- name: Comment needs repro
if: github.event.label.name == 'needs repro'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun), or [CodeSandbox](https://codesandbox.io/templates/bun). Issues marked with `needs repro` will be closed if they have no activity within 3 days.

30
.github/workflows/lint-cpp.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: lint-cpp
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
run-id:
type: string
description: The workflow ID to download artifacts (skips the build step)
pull_request:
paths:
- ".github/workflows/lint-cpp.yml"
- "**/*.cpp"
- "src/deps/**/*"
- "CMakeLists.txt"
jobs:
lint-cpp:
if: ${{ !inputs.run-id }}
name: Lint C++
uses: ./.github/workflows/run-lint-cpp.yml
secrets: inherit
with:
pr-number: ${{ github.event.number }}

View File

@@ -0,0 +1,89 @@
name: Comment on updated submodule
on:
pull_request_target:
paths:
- "src/generated_versions_list.zig"
- ".github/workflows/on-submodule-update.yml"
jobs:
comment:
name: Comment
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'oven-sh' }}
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout current
uses: actions/checkout@v4
with:
sparse-checkout: |
src
- name: Hash generated versions list
id: hash
run: |
echo "hash=$(sha256sum src/generated_versions_list.zig | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
sparse-checkout: |
src
- name: Hash base
id: base
run: |
echo "base=$(sha256sum src/generated_versions_list.zig | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: Compare
id: compare
run: |
if [ "${{ steps.hash.outputs.hash }}" != "${{ steps.base.outputs.base }}" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Find Comment
id: comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: <!-- generated-comment submodule-updated -->
- name: Write Warning Comment
uses: peter-evans/create-or-update-comment@v4
if: steps.compare.outputs.changed == 'true'
with:
comment-id: ${{ steps.comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
⚠️ **Warning:** @${{ github.actor }}, this PR has changes to submodule versions.
If this change was intentional, please ignore this message. If not, please undo changes to submodules and rebase your branch.
<!-- generated-comment submodule-updated -->
- name: Add labels
uses: actions-cool/issues-helper@v3
if: steps.compare.outputs.changed == 'true'
with:
actions: "add-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
labels: "changed-submodules"
- name: Remove labels
uses: actions-cool/issues-helper@v3
if: steps.compare.outputs.changed == 'false'
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
labels: "changed-submodules"
- name: Delete outdated comment
uses: actions-cool/issues-helper@v3
if: steps.compare.outputs.changed == 'false' && steps.comment.outputs.comment-id != ''
with:
actions: "delete-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.comment.outputs.comment-id }}

View File

@@ -1,8 +1,13 @@
name: bun-release
# TODO: Move this to bash scripts intead of Github Actions
# so it can be run from Buildkite, see: .buildkite/scripts/release.sh
name: Release
concurrency: release
env:
BUN_VERSION: ${{ github.event.inputs.tag || github.event.release.tag_name || 'canary' }}
BUN_LATEST: ${{ (github.event.inputs.is-latest || github.event.release.tag_name) && 'true' || 'false' }}
on:
release:
types:
@@ -39,6 +44,7 @@ on:
description: Should types be released to npm?
type: boolean
default: false
jobs:
sign:
name: Sign Release
@@ -51,16 +57,16 @@ jobs:
working-directory: packages/bun-release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup GPG
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Bun
uses: oven-sh/setup-bun@v1
uses: ./.github/actions/setup-bun
with:
bun-version: latest
bun-version: "1.1.20"
- name: Install Dependencies
run: bun install
- name: Sign Release
@@ -81,11 +87,11 @@ jobs:
working-directory: packages/bun-release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
uses: ./.github/actions/setup-bun
with:
bun-version: latest
bun-version: "1.1.20"
- name: Install Dependencies
run: bun install
- name: Release
@@ -105,15 +111,21 @@ jobs:
working-directory: packages/bun-types
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: latest
- name: Setup Bun
uses: oven-sh/setup-bun@v1
if: ${{ env.BUN_VERSION != 'canary' }}
uses: ./.github/actions/setup-bun
with:
bun-version: latest
bun-version: "1.1.20"
- name: Setup Bun
if: ${{ env.BUN_VERSION == 'canary' }}
uses: ./.github/actions/setup-bun
with:
bun-version: "canary" # Must be 'canary' so tag is correct
- name: Install Dependencies
run: bun install
- name: Setup Tag
@@ -131,14 +143,14 @@ jobs:
if: ${{ env.BUN_VERSION == 'canary' }}
uses: JS-DevTools/npm-publish@v1
with:
package: packages/bun-types/dist/package.json
package: packages/bun-types/package.json
token: ${{ secrets.NPM_TOKEN }}
tag: canary
- name: Release (latest)
if: ${{ env.BUN_LATEST == 'true' }}
uses: JS-DevTools/npm-publish@v1
with:
package: packages/bun-types/dist/package.json
package: packages/bun-types/package.json
token: ${{ secrets.NPM_TOKEN }}
docker:
name: Release to Dockerhub
@@ -164,12 +176,12 @@ jobs:
suffix: -distroless
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Docker emulator
uses: docker/setup-qemu-action@v2
- id: buildx
name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- id: metadata
@@ -186,12 +198,12 @@ jobs:
type=match,pattern=(bun-v)?(canary|\d+.\d+),group=2,value=${{ env.BUN_VERSION }},suffix=${{ matrix.suffix }}
type=match,pattern=(bun-v)?(canary|\d+),group=2,value=${{ env.BUN_VERSION }},suffix=${{ matrix.suffix }}
- name: Login to Docker
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./dockerhub/${{ matrix.dir || matrix.variant }}
platforms: linux/amd64,linux/arm64
@@ -210,7 +222,7 @@ jobs:
if: ${{ github.event_name == 'release' || github.event.inputs.use-homebrew == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: oven-sh/homebrew-bun
token: ${{ secrets.ROBOBUN_TOKEN }}
@@ -246,11 +258,11 @@ jobs:
working-directory: packages/bun-release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
uses: ./.github/actions/setup-bun
with:
bun-version: latest
bun-version: "1.1.20"
- name: Install Dependencies
run: bun install
- name: Release
@@ -261,3 +273,43 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
AWS_BUCKET: bun
notify-sentry:
name: Notify Sentry
runs-on: ubuntu-latest
needs: s3
steps:
- name: Notify Sentry
uses: getsentry/action-release@v1.7.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
ignore_missing: true
ignore_empty: true
version: ${{ env.BUN_VERSION }}
environment: production
bump:
name: "Bump version"
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
if: ${{ env.BUN_LATEST == 'true' }}
- name: Setup Bun
uses: ./.github/actions/setup-bun
if: ${{ env.BUN_LATEST == 'true' }}
with:
bun-version: "1.1.12"
- name: Bump version
uses: ./.github/actions/bump
if: ${{ env.BUN_LATEST == 'true' }}
with:
version: ${{ env.BUN_VERSION }}
token: ${{ github.token }}

52
.github/workflows/run-format.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: Format
permissions:
contents: write
on:
workflow_call:
inputs:
zig-version:
type: string
required: true
jobs:
format:
name: Format
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
src
scripts
packages
test
bench
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.20"
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ inputs.zig-version }}
- name: Install Dependencies
run: |
bun install
- name: Format
run: |
bun fmt
- name: Format Zig
run: |
bun fmt:zig
- name: Generate submodule versions
run: |
bash ./scripts/write-versions.sh
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply formatting changes

84
.github/workflows/run-lint-cpp.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
name: lint-cpp
permissions:
contents: read
env:
LLVM_VERSION: 16
LC_CTYPE: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
on:
workflow_call:
inputs:
pr-number:
required: true
type: number
jobs:
lint-cpp:
name: Lint C++
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-xlarge' || 'macos-13' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: latest
- name: Install Dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install \
llvm@${{ env.LLVM_VERSION }} \
ninja \
coreutils \
openssl@1.1 \
libiconv \
gnu-sed --force --overwrite
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
- name: Bun install
run: |
bun install
- name: clang-tidy
id: format
env:
CPU_TARGET: native
BUN_SILENT: 1
run: |
rm -f did_fail format.log
echo "${{ inputs.pr-number }}" > pr-number.txt
echo "pr_number=$(cat pr-number.txt)" >> $GITHUB_OUTPUT
bun run --silent build:tidy &> >(tee -p format.log) && echo 0 > did_succeed.txt
# Upload format.log as github artifact for the workflow
if [ -f did_succeed.txt ]; then
echo "0" > did_fail.txt
else
echo "1" > did_fail.txt
fi
echo "did_fail=$(cat did_fail.txt)" >> $GITHUB_OUTPUT
- name: Upload format.log
uses: actions/upload-artifact@v2
with:
name: format.log
path: format.log
- name: Upload PR
uses: actions/upload-artifact@v2
with:
name: pr-number.txt
path: pr-number.txt
- name: Upload PR
uses: actions/upload-artifact@v2
with:
name: did_fail.txt
path: did_fail.txt
- name: Fail if formatting failed
if: ${{ steps.format.outputs.did_fail == '1' }}
run: exit 1

32
.github/workflows/run-lint.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: Lint
permissions:
contents: read
env:
LLVM_VERSION: 16
on:
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
outputs:
text_output: ${{ steps.lint.outputs.text_output }}
json_output: ${{ steps.lint.outputs.json_output }}
count: ${{ steps.lint.outputs.count }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.3"
- name: Install Dependencies
run: |
bun --cwd=packages/bun-internal-test install
- name: Lint
id: lint
run: |
bun packages/bun-internal-test/src/linter.ts

29
.github/workflows/test-bump.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Test Bump version
on:
workflow_dispatch:
inputs:
version:
type: string
description: What is the release tag? (e.g. "1.0.2", "canary")
required: true
jobs:
bump:
name: "Bump version"
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.12"
- name: Bump version
uses: ./.github/actions/bump
with:
version: ${{ inputs.version }}
token: ${{ github.token }}

261
.gitignore vendored
View File

@@ -1,161 +1,148 @@
.DS_Store
zig-cache
packages/*/*.wasm
*.o
*.a
profile.json
node_modules
.env
.envrc
.eslintcache
.idea
.next
.ninja_deps
.ninja_log
.npm
.npm.gz
.parcel-cache
.swcrc
yarn.lock
dist
*.tmp
.trace
.uuid
.vs
.vscode/clang*
.vscode/cpp*
.zig-cache
*.a
*.bc
*.big
*.blob
*.bun
*.crash
*.database
*.db
*.dmg
*.dSYM
*.jsb
*.lib
*.log
*.o
*.out.js
*.out.refresh.js
**/package-lock.json
build
*.pdb
*.sqlite
*.tmp
*.trace
*.wat
zig-out
pnpm-lock.yaml
README.md.template
src/deps/zig-clap/example
src/deps/zig-clap/README.md
src/deps/zig-clap/.github
src/deps/zig-clap/.gitattributes
out
outdir
.trace
*.zip
**/.verdaccio-db.json
**/*.dir
**/*.pdb
**/*.sln*
**/*.vcxproj*
**/package-lock.json
/.cache
/.webkit-cache
/build-*/
/bun-webkit
/kcov-out
/src/deps/libuv
/test-report.json
/test-report.md
/test.js
/test.ts
/testdir
/test.zig
build
build.ninja
bun-binary
bun-mimalloc
bun-nomimalloc
bun-singlehtreaded
bun-test-scratch
bun-zigld
cmake_install.cmake
CMakeCache.txt
CMakeFiles
cold-jsc-start
cold-jsc-start.d
compile_commands.json
cover
coverage
coverv
*.trace
github
out.*
out
.parcel-cache
dist
esbuilddir
*.bun
parceldist
esbuilddir
outdir/
outcss
.next
txt.js
.idea
.vscode/cpp*
.vscode/clang*
node_modules_*
*.jsb
*.zip
bun-zigld
bun-singlehtreaded
bun-nomimalloc
bun-mimalloc
examples/lotta-modules/bun-yday
examples/lotta-modules/bun-old
examples/lotta-modules/bun-nofscache
src/node-fallbacks/out/*
src/node-fallbacks/node_modules
sign.json
release/
*.dmg
sign.*.json
packages/debug-*
packages/bun-cli/postinstall.js
examples/lotta-modules/bun-old
examples/lotta-modules/bun-yday
failing-tests.txt
github
make-dev-stats.csv
misctools/fetch
misctools/machbench
misctools/sha
myscript.sh
node_modules
node_modules_*
out
out.*
outcss
outdir
outdir/
packages/*/*.wasm
packages/bun-*/*.o
packages/bun-*/bun
packages/bun-*/bun-profile
packages/bun-*/debug-bun
packages/bun-*/*.o
packages/bun-cli/postinstall.js
packages/bun-cli/bin/*
bun-test-scratch
misctools/fetch
src/deps/libiconv
src/deps/openssl
src/tests.zig
*.blob
src/deps/s2n-tls
.npm
.npm.gz
bun-binary
src/deps/PLCrashReporter/
*.dSYM
*.crash
misctools/sha
packages/bun-wasm/*.mjs
packages/bun-cli/postinstall.js
packages/bun-wasm/*.cjs
packages/bun-wasm/*.map
packages/bun-wasm/*.js
packages/bun-wasm/*.d.ts
packages/bun-wasm/*.d.cts
packages/bun-wasm/*.d.mts
*.bc
src/fallback.version
src/runtime.version
*.sqlite
*.database
*.db
misctools/machbench
*.big
.eslintcache
/bun-webkit
src/deps/c-ares/build
packages/bun-wasm/*.d.ts
packages/bun-wasm/*.js
packages/bun-wasm/*.map
packages/bun-wasm/*.mjs
packages/debug-*
parceldist
pnpm-lock.yaml
profile.json
README.md.template
release/
sign.*.json
sign.json
src/bun.js/bindings-obj
src/bun.js/bindings/GeneratedJS2Native.zig
src/bun.js/debug-bindings-obj
failing-tests.txt
test.txt
myscript.sh
cold-jsc-start
cold-jsc-start.d
/test.ts
/test.js
src/js/out/modules*
src/js/out/functions*
src/js/out/tmp
src/deps/c-ares/build
src/deps/libiconv
src/deps/openssl
src/deps/PLCrashReporter/
src/deps/s2n-tls
src/deps/zig-clap/.gitattributes
src/deps/zig-clap/.github
src/deps/zig-clap/example
src/deps/zig-clap/README.md
src/fallback.version
src/js/out/DebugPath.h
make-dev-stats.csv
.uuid
src/js/out/functions*
src/js/out/modules*
src/js/out/tmp
src/node-fallbacks/node_modules
src/node-fallbacks/out/*
src/runtime.version
src/tests.zig
test.txt
test/js/bun/glob/fixtures
tsconfig.tsbuildinfo
*.lib
*.pdb
CMakeFiles
build.ninja
.ninja_deps
.ninja_log
CMakeCache.txt
cmake_install.cmake
compile_commands.json
*.lib
txt.js
x64
**/*.vcxproj*
**/*.sln*
**/*.dir
**/*.pdb
/.webkit-cache
/.cache
/src/deps/libuv
/build-*/
.vs
yarn.lock
zig-cache
zig-out
test/node.js/upstream
.zig-cache
scripts/env.local

16
.gitmodules vendored
View File

@@ -69,10 +69,20 @@ ignore = dirty
depth = 1
shallow = true
fetchRecurseSubmodules = false
[submodule "src/deps/base64"]
path = src/deps/base64
url = https://github.com/aklomp/base64.git
[submodule "src/deps/ls-hpack"]
path = src/deps/ls-hpack
url = https://github.com/litespeedtech/ls-hpack.git
ignore = dirty
depth = 1
shallow = true
fetchRecurseSubmodules = false
[submodule "zig"]
path = src/deps/zig
url = https://github.com/oven-sh/zig
depth = 1
shallow = true
fetchRecurseSubmodules = false
[submodule "src/deps/libdeflate"]
path = src/deps/libdeflate
url = https://github.com/ebiggers/libdeflate
ignore = "dirty"

4
.lldbinit Normal file
View File

@@ -0,0 +1,4 @@
command script import src/deps/zig/tools/lldb_pretty_printers.py
command script import src/bun.js/WebKit/Tools/lldb/lldb_webkit.py
# type summary add --summary-string "${var} | inner=${var[0-30]}, source=${var[33-64]}, tag=${var[31-32]}" "unsigned long"

View File

@@ -1,13 +1,7 @@
src/fallback.html
src/bun.js/WebKit
src/js/out
src/*.out.js
src/*out.*.js
src/deps
src/test/fixtures
src/react-refresh.js
test/snapshots
test/snapshots-no-hmr
test/js/deno/*.test.ts
test/js/deno/**/*.test.ts
bench/react-hello-world/react-hello-world.node.js
test/js/deno
test/node.js
src/react-refresh.js
*.min.js

24
.prettierrc Normal file
View File

@@ -0,0 +1,24 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"trailingComma": "all",
"useTabs": false,
"quoteProps": "preserve",
"overrides": [
{
"files": [".vscode/*.json"],
"options": {
"parser": "jsonc",
"quoteProps": "preserve",
"singleQuote": false,
"trailingComma": "all"
}
},
{
"files": ["*.md"],
"options": {
"printWidth": 80
}
}
]
}

View File

@@ -1,15 +0,0 @@
module.exports = {
arrowParens: "avoid",
printWidth: 120,
trailingComma: "all",
useTabs: false,
quoteProps: "preserve",
overrides: [
{
files: ["*.md"],
options: {
printWidth: 80,
},
},
],
};

View File

@@ -3,6 +3,7 @@
{
"name": "Debug",
"forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"],
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"includePath": [
"${workspaceFolder}/build/bun-webkit/include",
"${workspaceFolder}/build/codegen",
@@ -16,7 +17,7 @@
"${workspaceFolder}/src/deps",
"${workspaceFolder}/src/napi/*",
"${workspaceFolder}/packages/bun-usockets/src",
"${workspaceFolder}/packages/"
"${workspaceFolder}/packages/",
],
"browse": {
"path": [
@@ -29,10 +30,10 @@
"${workspaceFolder}/src/deps/boringssl/include/*",
"${workspaceFolder}/packages/bun-usockets/*",
"${workspaceFolder}/packages/bun-uws/*",
"${workspaceFolder}/src/napi/*"
"${workspaceFolder}/src/napi/*",
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ".vscode/cppdb"
"databaseFilename": ".vscode/cppdb",
},
"defines": [
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
@@ -43,17 +44,18 @@
"BUILDING_JSCONLY__",
"USE_FOUNDATION=1",
"ASSERT_ENABLED=1",
"DU_DISABLE_RENAMING=1"
"DU_DISABLE_RENAMING=1",
],
"macFrameworkPath": [],
"compilerPath": "${workspaceFolder}/.vscode/clang++",
"cStandard": "c17",
"cppStandard": "c++20"
"cppStandard": "c++20",
},
{
"name": "BunWithJSCDebug",
"forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"],
"includePath": [
"${workspaceFolder}/build/codegen",
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/",
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/",
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/",
@@ -70,7 +72,7 @@
"${workspaceFolder}/src/deps",
"${workspaceFolder}/src/napi/*",
"${workspaceFolder}/packages/bun-usockets/src",
"${workspaceFolder}/packages/"
"${workspaceFolder}/packages/",
],
"browse": {
"path": [
@@ -92,10 +94,10 @@
"${workspaceFolder}/src/deps/boringssl/include/",
"${workspaceFolder}/packages/bun-usockets/",
"${workspaceFolder}/packages/bun-uws/",
"${workspaceFolder}/src/napi"
"${workspaceFolder}/src/napi",
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ".vscode/cppdb_debug"
"databaseFilename": ".vscode/cppdb_debug",
},
"defines": [
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
@@ -106,13 +108,13 @@
"BUILDING_JSCONLY__",
"USE_FOUNDATION=1",
"ASSERT_ENABLED=1",
"DU_DISABLE_RENAMING=1"
"DU_DISABLE_RENAMING=1",
],
"macFrameworkPath": [],
"compilerPath": "${workspaceFolder}/.vscode/clang++",
"cStandard": "c17",
"cppStandard": "c++20"
}
"cppStandard": "c++20",
},
],
"version": 4
"version": 4,
}

View File

@@ -1,10 +1,33 @@
{
"recommendations": [
// Zig
"ziglang.vscode-zig",
"esbenp.prettier-vscode",
// C/C++
"clang.clangd",
"ms-vscode.cmake-tools",
"xaver.clang-format",
"vadimcn.vscode-lldb",
// JavaScript
"oven.bun-vscode",
"esbenp.prettier-vscode",
// TypeScript
"better-ts-errors.better-ts-errors",
"MylesMurphy.prettify-ts",
// Markdown
"bierner.markdown-preview-github-styles",
"bierner.markdown-emoji",
"bierner.emojisense",
"bierner.markdown-checkbox",
"bierner.jsdoc-markdown-highlighting",
// TOML
"tamasfe.even-better-toml",
// Other
"bierner.comment-tagged-templates",
"ms-vscode.cpptools"
]
],
}

1211
.vscode/launch.json generated vendored

File diff suppressed because it is too large Load Diff

281
.vscode/settings.json vendored
View File

@@ -1,50 +1,123 @@
{
"git.autoRepositoryDetection": "openEditors",
// Editor
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
// Search
"search.quickOpen.includeSymbols": false,
"search.seedWithNearestWord": true,
"search.smartCase": true,
"search.exclude": {},
"search.exclude": {
"node_modules": true,
".git": true,
"src/bun.js/WebKit": true,
"src/deps/*/**": true,
"test/node.js/upstream": true,
},
"search.followSymlinks": false,
"search.useIgnoreFiles": true,
"zig.buildOnSave": false,
"zig.formattingProvider": "zls",
"zig.buildOption": "build",
"zig.buildFilePath": "${workspaceFolder}/build.zig",
// Git
"git.autoRepositoryDetection": "openEditors",
"git.ignoreSubmodules": true,
"git.ignoreLimitWarning": true,
// Zig
"zig.initialSetupDone": true,
"editor.formatOnSave": true,
"zig.buildOption": "build",
"zig.zls.zigLibPath": "${workspaceFolder}/src/deps/zig/lib",
"zig.buildArgs": ["-Dgenerated-code=./build/codegen"],
"zig.zls.buildOnSaveStep": "check",
// "zig.zls.enableBuildOnSave": true,
// "zig.buildOnSave": true,
"zig.buildFilePath": "${workspaceFolder}/build.zig",
"zig.path": "${workspaceFolder}/.cache/zig/zig.exe",
"zig.formattingProvider": "zls",
"zig.zls.enableInlayHints": false,
"[zig]": {
"editor.tabSize": 4,
"editor.useTabStops": false,
"editor.defaultFormatter": "ziglang.vscode-zig"
"editor.defaultFormatter": "ziglang.vscode-zig",
},
"[ts]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
// lldb
"lldb.launch.initCommands": ["command source ${workspaceFolder}/.lldbinit"],
"lldb.verboseLogging": false,
// C++
"cmake.configureOnOpen": false,
"C_Cpp.errorSquiggles": "enabled",
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format",
},
"[js]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[c]": {
"editor.defaultFormatter": "xaver.clang-format",
},
"zig.zls.enableInlayHints": false,
"git.ignoreSubmodules": true,
"[jsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[h]": {
"editor.defaultFormatter": "xaver.clang-format",
},
"[tsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {},
"[markdown]": {
"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.unicodeHighlight.invisibleCharacters": false,
"diffEditor.ignoreTrimWhitespace": false,
// JavaScript
"prettier.enable": true,
"prettier.configPath": ".prettierrc",
"eslint.workingDirectories": ["${workspaceFolder}/packages/bun-types"],
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"prettier.prettierPath": "./node_modules/prettier",
// TypeScript
"typescript.tsdk": "${workspaceFolder}/node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
// JSON
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
// Markdown
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.unicodeHighlight.ambiguousCharacters": true,
"editor.unicodeHighlight.invisibleCharacters": true,
"diffEditor.ignoreTrimWhitespace": false,
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
"other": "off",
},
},
"lldb.verboseLogging": false,
// TOML
"[toml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
// YAML
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
// Docker
"[dockerfile]": {
"editor.formatOnSave": false,
},
// Files
"files.exclude": {
"**/.git": true,
"**/.svn": true,
@@ -54,22 +127,14 @@
"**/Thumbs.db": true,
"**/*.xcworkspacedata": true,
"**/*.xcscheme": true,
"**/*.pem": true,
"**/*.xcodeproj": true,
"src/bun.js/WebKit": true,
"src/deps/libarchive": true,
"src/deps/mimalloc": true,
"src/deps/s2n-tls": true,
"src/deps/boringssl": true,
"src/deps/openssl": true,
"src/deps/uws": true,
"src/deps/zlib": true,
"src/deps/lol-html": true,
"src/deps/c-ares": true,
"src/deps/tinycc": true,
"src/deps/zstd": true,
"**/*.i": true,
"packages/bun-uws/fuzzing/seed-corpus/**/*": true
// uws WebSocket.cpp conflicts with webcore WebSocket.cpp
"packages/bun-uws/fuzzing": true,
},
"files.associations": {
"*.idl": "cpp",
},
"C_Cpp.files.exclude": {
"**/.vscode": true,
@@ -87,137 +152,7 @@
"WebKit/WebCore": true,
"WebKit/WebDriver": true,
"WebKit/WebKitBuild": true,
"WebKit/WebInspectorUI": true
"WebKit/WebInspectorUI": true,
},
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[h]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"files.associations": {
"*.lock": "yarnlock",
"*.idl": "cpp",
"memory": "cpp",
"iostream": "cpp",
"algorithm": "cpp",
"random": "cpp",
"ios": "cpp",
"filesystem": "cpp",
"__locale": "cpp",
"type_traits": "cpp",
"__mutex_base": "cpp",
"__string": "cpp",
"string": "cpp",
"string_view": "cpp",
"typeinfo": "cpp",
"__config": "cpp",
"__nullptr": "cpp",
"exception": "cpp",
"__bit_reference": "cpp",
"atomic": "cpp",
"utility": "cpp",
"sstream": "cpp",
"__functional_base": "cpp",
"new": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tuple": "cpp",
"array": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"mutex": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"__bits": "cpp",
"__tree": "cpp",
"map": "cpp",
"numeric": "cpp",
"set": "cpp",
"__memory": "cpp",
"memory_resource": "cpp",
"*.tcc": "cpp",
"list": "cpp",
"shared_mutex": "cpp",
"cinttypes": "cpp",
"variant": "cpp",
"sysctl.h": "c",
"queue": "cpp",
"compare": "cpp",
"concepts": "cpp",
"typeindex": "cpp",
"__verbose_abort": "cpp",
"__std_stream": "cpp",
"any": "cpp",
"charconv": "cpp",
"csignal": "cpp",
"format": "cpp",
"forward_list": "cpp",
"future": "cpp",
"regex": "cpp",
"span": "cpp",
"valarray": "cpp",
"codecvt": "cpp",
"xtr1common": "cpp",
"stop_token": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtree": "cpp",
"xutility": "cpp"
},
"C_Cpp.errorSquiggles": "enabled",
"eslint.workingDirectories": ["packages/bun-types"],
"typescript.tsdk": "node_modules/typescript/lib"
"git.detectSubmodules": false,
}

51
.vscode/tasks.json vendored
View File

@@ -2,10 +2,51 @@
"version": "2.0.0",
"tasks": [
{
"label": "Rebuild Debug",
"command": "ninja",
"args": ["-Cbuild"],
"type": "process",
}
]
"label": "Install Dependencies",
"command": "scripts/all-dependencies.sh",
"windows": {
"command": "scripts/all-dependencies.ps1",
},
"icon": {
"id": "arrow-down",
},
"options": {
"cwd": "${workspaceFolder}",
},
},
{
"type": "process",
"label": "Setup Environment",
"dependsOn": ["Install Dependencies"],
"command": "scripts/setup.sh",
"windows": {
"command": "scripts/setup.ps1",
},
"icon": {
"id": "check",
},
"options": {
"cwd": "${workspaceFolder}",
},
},
{
"type": "process",
"label": "Build Bun",
"dependsOn": ["Setup Environment"],
"command": "bun",
"args": ["run", "build"],
"icon": {
"id": "gear",
},
"options": {
"cwd": "${workspaceFolder}",
},
"isBuildCommand": true,
"runOptions": {
"instanceLimit": 1,
"reevaluateOnRerun": true,
},
},
],
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +1,327 @@
# Contributing to Bun
Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.
> **Important:** All contributions need test coverage. If you are adding a new feature, please add a test. If you are fixing a bug, please add a test that fails before your fix and passes after your fix.
If you are using Windows, please refer to [this guide](/docs/project/building-windows)
## Bun's codebase
{% details summary="For Ubuntu users" %}
TL;DR: Ubuntu 22.04 is suggested.
Bun currently requires `glibc >=2.32` in development which means if you're on Ubuntu 20.04 (glibc == 2.31), you may likely meet `error: undefined symbol: __libc_single_threaded `. You need to take extra configurations. Also, according to this [issue](https://github.com/llvm/llvm-project/issues/97314), LLVM 16 is no longer maintained on Ubuntu 24.04 (noble). And instead, you might want `brew` to install LLVM 16 for your Ubuntu 24.04.
{% /details %}
Bun is written mostly in Zig, but WebKit & JavaScriptCore (the JavaScript engine) is written in C++.
## Install Dependencies
Today (February 2023), Bun's codebase has five distinct parts:
Using your system's package manager, install Bun's dependencies:
- JavaScript, JSX, & TypeScript transpiler, module resolver, and related code
- JavaScript runtime ([`src/bun.js/`](src/bun.js/))
- JavaScript runtime bindings ([`src/bun.js/bindings/**/*.cpp`](src/bun.js/bindings/))
- Package manager ([`src/install/`](src/install/))
- Shared utilities ([`src/string_immutable.zig`](src/string_immutable.zig))
{% codetabs %}
The JavaScript transpiler & module resolver is mostly independent from the runtime. It predates the runtime and is entirely in Zig. The JavaScript parser is mostly in [`src/js_parser.zig`](src/js_parser.zig). The JavaScript AST data structures are mostly in [`src/js_ast.zig`](src/js_ast.zig). The JavaScript lexer is in [`src/js_lexer.zig`](src/js_lexer.zig). A lot of this code started as a port of esbuild's equivalent code from Go to Zig, but has had many small changes since then.
```bash#macOS (Homebrew)
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
```
## Getting started
```bash#Ubuntu/Debian
$ sudo apt install curl wget lsb-release software-properties-common cargo ccache cmake git golang libtool ninja-build pkg-config rustc ruby-full xz-utils
```
Please refer to [Bun's Development Guide](https://bun.sh/docs/project/contributing) to get your dev environment setup!
```bash#Arch
$ sudo pacman -S base-devel ccache cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ruby
```
## Memory management in Bun
```bash#Fedora
$ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
```
For the Zig code, please:
```bash#openSUSE Tumbleweed
$ sudo zypper install go cmake ninja automake git rustup && rustup toolchain install stable
```
1. Do your best to avoid dynamically allocating memory.
2. If we need to allocate memory, carefully consider the owner of that memory. If it's a JavaScript object, it will need a finalizer. If it's in Zig, it will need to be freed either via an arena or manually.
3. Prefer arenas over manual memory management. Manually freeing memory is leak & crash prone.
4. If the memory needs to be accessed across threads, use `bun.default_allocator`. Mimalloc threadlocal heaps are not safe to free across threads.
{% /codetabs %}
The JavaScript transpiler has special-handling for memory management. The parser allocates into a single arena and the memory is recycled after each parse.
> **Note**: The Zig compiler is automatically installed and updated by the build scripts. Manual installation is not required.
## JavaScript runtime
Before starting, you will need to already have a release build of Bun installed, as we use our bundler to transpile and minify our code, as well as for code generation scripts.
Most of Bun's JavaScript runtime code lives in [`src/bun.js`](src/bun.js).
{% codetabs %}
### Calling C++ from Zig & Zig from C++
```bash#Native
$ curl -fsSL https://bun.sh/install | bash
```
TODO: document this (see [`bindings.zig`](src/bun.js/bindings/bindings.zig) and [`bindings.cpp`](src/bun.js/bindings/bindings.cpp) for now)
```bash#npm
$ npm install -g bun
```
### Adding a new JavaScript class
```bash#Homebrew
$ brew tap oven-sh/bun
$ brew install bun
```
1. Add a new file in [`src/bun.js/*.classes.ts`](src/bun.js) to define the instance and static methods for the class.
2. Add a new file in [`src/bun.js/**/*.zig`](src/bun.js) and expose the struct in [`src/bun.js/generated_classes_list.zig`](src/bun.js/generated_classes_list.zig)
3. Run `make codegen`
{% /codetabs %}
Copy from examples like `Subprocess` or `Response`.
## Install LLVM
### ESM Modules and Builtins JS
Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
Bun implements ESM modules in a mix of native code and JavaScript.
{% codetabs %}
Several Node.js modules are implemented in JavaScript and loosely based on browserify polyfills.
```bash#macOS (Homebrew)
$ brew install llvm@16
```
Builtin modules in Bun are located in [`src/js`](src/js/). These files are transpiled and support a JavaScriptCore-only syntax for internal slots, which is explained further in [`src/js/README.md`](src/js/README.md).
```bash#Ubuntu/Debian
$ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 16 all
```
Native C++ modules are in `src/bun.js/modules/`.
```bash#Arch
$ sudo pacman -S llvm clang lld
```
The module loader is in [`src/bun.js/module_loader.zig`](src/bun.js/module_loader.zig).
```bash#Fedora
$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable -y @fedora-llvm-team/llvm-snapshots
$ sudo dnf install llvm clang lld
```
### Memory management in Bun's JavaScript runtime
```bash#openSUSE Tumbleweed
$ sudo zypper install clang16 lld16 llvm16
```
TODO: fill this out (for now, use `JSC.Strong` in most cases)
{% /codetabs %}
### Strings
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6).
TODO: fill this out (for now, use `JSValue.toSlice()` in most cases)
Make sure Clang/LLVM 16 is in your path:
#### JavaScriptCore C API
```bash
$ which clang-16
```
Do not copy from examples leveraging the JavaScriptCore C API. Please do not use this in new code. We will not accept PRs that add new code that uses the JavaScriptCore C API.
If not, run this to manually add it:
## Testing
{% codetabs %}
See [`test/README.md`](test/README.md) for information on how to run tests.
```bash#macOS (Homebrew)
# use fish_add_path if you're using fish
# use path+="$(brew --prefix llvm@16)/bin" if you are using zsh
$ export PATH="$(brew --prefix llvm@16)/bin:$PATH"
```
```bash#Arch
# use fish_add_path if you're using fish
$ export PATH="$PATH:/usr/lib/llvm16/bin"
```
{% /codetabs %}
> ⚠️ Ubuntu distributions (<= 20.04) may require installation of the C++ standard library independently. See the [troubleshooting section](#span-file-not-found-on-ubuntu) for more information.
## Building Bun
After cloning the repository, run the following command to run the first build. This may take a while as it will clone submodules and build dependencies.
```bash
$ bun setup
```
The binary will be located at `./build/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun.
```bash
$ build/bun-debug --version
x.y.z_debug
```
To rebuild, you can invoke `bun run build`
```bash
$ bun run build
```
These two scripts, `setup` and `build`, are aliases to do roughly the following:
```bash
$ ./scripts/setup.sh
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
$ ninja -C build # 'bun run build' runs just this
```
Advanced users can pass CMake flags to customize the build.
## VSCode
VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured.
If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./.cache/zig/zig.exe`. The filename is `zig.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension).
We recommend adding `./build` to your `$PATH` so that you can run `bun-debug` in your terminal:
```sh
$ bun-debug
```
## Code generation scripts
Several code generation scripts are used during Bun's build process. These are run automatically when changes are made to certain files.
In particular, these are:
- `./src/codegen/generate-jssink.ts` -- Generates `build/codegen/JSSink.cpp`, `build/codegen/JSSink.h` which implement various classes for interfacing with `ReadableStream`. This is internally how `FileSink`, `ArrayBufferSink`, `"type": "direct"` streams and other code related to streams works.
- `./src/codegen/generate-classes.ts` -- Generates `build/codegen/ZigGeneratedClasses*`, which generates Zig & C++ bindings for JavaScriptCore classes implemented in Zig. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Zig
- `./src/codegen/bundle-modules.ts` -- Bundles built-in modules like `node:fs`, `bun:ffi` into files we can include in the final binary. In development, these can be reloaded without rebuilding Zig (you still need to run `bun run build`, but it re-reads the transpiled files from disk afterwards). In release builds, these are embedded into the binary.
- `./src/codegen/bundle-functions.ts` -- Bundles globally-accessible functions implemented in JavaScript/TypeScript like `ReadableStream`, `WritableStream`, and a handful more. These are used similarly to the builtin modules, but the output more closely aligns with what WebKit/Safari does for Safari's built-in functions so that we can copy-paste the implementations from WebKit as a starting point.
## Modifying ESM modules
Certain modules like `node:fs`, `node:stream`, `bun:sqlite`, and `ws` are implemented in JavaScript. These live in `src/js/{node,bun,thirdparty}` files and are pre-bundled using Bun.
## Release build
To compile a release build of Bun, run:
```bash
$ bun run build:release
```
The binary will be located at `./build-release/bun` and `./build-release/bun-profile`.
### Download release build from pull requests
To save you time spent building a release build locally, we provide a way to run release builds from pull requests. This is useful for manully testing changes in a release build before they are merged.
To run a release build from a pull request, you can use the `bun-pr` npm package:
```sh
bunx bun-pr pr-number
bunx bun-pr branch/branch-name
bunx bun-pr "https://github.com/oven-sh/bun/pull/1234566"
```
This will download the release build from the pull request and add it to `$PATH` as `bun-${pr-number}`. You can then run the build with `bun-${pr-number}`.
```sh
bun-1234566 --version
```
This works by downloading the release build from the GitHub Actions artifacts on the linked pull request. You may need the `gh` CLI installed to authenticate with GitHub.
## Valgrind
On Linux, valgrind can help find memory issues.
Keep in mind:
- JavaScriptCore doesn't support valgrind. It will report spurious errors.
- Valgrind is slow
- Mimalloc will sometimes cause spurious errors when debug build is enabled
You'll need a very recent version of Valgrind due to DWARF 5 debug symbols. You may need to manually compile Valgrind instead of using it from your Linux package manager.
`--fair-sched=try` is necessary if running multithreaded code in Bun (such as the bundler). Otherwise it will hang.
```bash
$ valgrind --fair-sched=try --track-origins=yes bun-debug <args>
```
## Building WebKit locally + Debug mode of JSC
{% callout %}
**TODO**: This is out of date. TLDR is pass `-DUSE_DEBUG_JSC=1` or `-DWEBKIT_DIR=...` to CMake. it will probably need more fiddling. ask @paperdave if you need this.
{% /callout %}
WebKit is not cloned by default (to save time and disk space). To clone and build WebKit locally, run:
```bash
# once you run this, `make submodule` can be used to automatically
# update WebKit and the other submodules
$ git submodule update --init --depth 1 --checkout src/bun.js/WebKit
# to make a jsc release build
$ make jsc
# JSC debug build does not work perfectly with Bun yet, this is actively being
# worked on and will eventually become the default.
$ make jsc-build-linux-compile-debug cpp
$ make jsc-build-mac-compile-debug cpp
```
Note that the WebKit folder, including build artifacts, is 8GB+ in size.
If you are using a JSC debug build and using VScode, make sure to run the `C/C++: Select a Configuration` command to configure intellisense to find the debug headers.
## Troubleshooting
### 'span' file not found on Ubuntu
> ⚠️ Please note that the instructions below are specific to issues occurring on Ubuntu. It is unlikely that the same issues will occur on other Linux distributions.
The Clang compiler typically uses the `libstdc++` C++ standard library by default. `libstdc++` is the default C++ Standard Library implementation provided by the GNU Compiler Collection (GCC). While Clang may link against the `libc++` library, this requires explicitly providing the `-stdlib` flag when running Clang.
Bun relies on C++20 features like `std::span`, which are not available in GCC versions lower than 11. GCC 10 doesn't have all of the C++20 features implemented. As a result, running `make setup` may fail with the following error:
```
fatal error: 'span' file not found
#include <span>
^~~~~~
```
The issue may manifest when initially running `bun setup` as Clang being unable to compile a simple program:
```
The C++ compiler
"/usr/bin/clang++-16"
is not able to compile a simple test program.
```
To fix the error, we need to update the GCC version to 11. To do this, we'll need to check if the latest version is available in the distribution's official repositories or use a third-party repository that provides GCC 11 packages. Here are general steps:
```bash
$ sudo apt update
$ sudo apt install gcc-11 g++-11
# If the above command fails with `Unable to locate package gcc-11` we need
# to add the APT repository
$ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# Now run `apt install` again
$ sudo apt install gcc-11 g++-11
```
Now, we need to set GCC 11 as the default compiler:
```bash
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100
```
### libarchive
If you see an error on macOS when compiling `libarchive`, run:
```bash
$ brew install pkg-config
```
### macOS `library not found for -lSystem`
If you see this error when compiling, run:
```bash
$ xcode-select --install
```
## Cannot find `libatomic.a`
Bun defaults to linking `libatomic` statically, as not all systems have it. If you are building on a distro that does not have a static libatomic available, you can run the following command to enable dynamic linking:
```bash
$ bun setup -DUSE_STATIC_LIBATOMIC=OFF
```
The built version of Bun may not work on other systems if compiled this way.
## ccache conflicts with building TinyCC on macOS
If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
```bash
brew uninstall ccache
brew install ccache
```

View File

@@ -16,7 +16,7 @@ ARG BUILD_MACHINE_ARCH=x86_64
ARG BUILDARCH=amd64
ARG TRIPLET=${ARCH}-linux-gnu
ARG GIT_SHA=""
ARG BUN_VERSION="bun-v1.0.7"
ARG BUN_VERSION="bun-v1.1.4"
ARG BUN_DOWNLOAD_URL_BASE="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/${BUN_VERSION}"
ARG CANARY=0
ARG ASSERTIONS=OFF
@@ -25,7 +25,9 @@ ARG CMAKE_BUILD_TYPE=Release
ARG NODE_VERSION="20"
ARG LLVM_VERSION="16"
ARG ZIG_VERSION="0.12.0-dev.1604+caae40c21"
ARG ZIG_VERSION="0.13.0"
ARG ZIG_VERSION_SHORT="0.13.0"
ARG SCCACHE_BUCKET
ARG SCCACHE_REGION
@@ -50,11 +52,10 @@ ENV CI 1
ENV CPU_TARGET=${CPU_TARGET}
ENV BUILDARCH=${BUILDARCH}
ENV BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR}
ENV BUN_ENABLE_LTO 1
ENV CXX=clang++-16
ENV CC=clang-16
ENV AR=/usr/bin/llvm-ar-16
ENV LD=lld-16
ENV LC_CTYPE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV SCCACHE_BUCKET=${SCCACHE_BUCKET}
ENV SCCACHE_REGION=${SCCACHE_REGION}
@@ -63,8 +64,7 @@ ENV SCCACHE_ENDPOINT=${SCCACHE_ENDPOINT}
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
RUN apt-get update -y \
&& install_packages \
RUN install_packages \
ca-certificates \
curl \
gnupg \
@@ -88,6 +88,10 @@ RUN apt-get update -y \
lld-${LLVM_VERSION} \
lldb-${LLVM_VERSION} \
clangd-${LLVM_VERSION} \
libc++-${LLVM_VERSION}-dev \
libc++abi-${LLVM_VERSION}-dev \
llvm-${LLVM_VERSION}-runtime \
llvm-${LLVM_VERSION}-dev \
make \
cmake \
ninja-build \
@@ -104,19 +108,30 @@ RUN apt-get update -y \
perl \
python3 \
ruby \
ruby-dev \
golang \
nodejs \
&& ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
&& ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
&& ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
&& ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
&& ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
&& ln -s /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
nodejs && \
for f in /usr/lib/llvm-${LLVM_VERSION}/bin/*; do ln -sf "$f" /usr/bin; done \
&& ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
&& ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
&& ln -sf /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
&& ln -sf /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
&& ln -sf /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
&& ln -sf /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
&& ln -sf /usr/bin/ld.lld /usr/bin/ld \
&& ln -sf /usr/bin/llvm-ranlib-${LLVM_VERSION} /usr/bin/ranlib \
&& ln -sf /usr/bin/clang /usr/bin/cc \
&& ln -sf /usr/bin/clang /usr/bin/c89 \
&& ln -sf /usr/bin/clang /usr/bin/c99 \
&& ln -sf /usr/bin/clang++ /usr/bin/c++ \
&& ln -sf /usr/bin/clang++ /usr/bin/g++ \
&& ln -sf /usr/bin/llvm-ar /usr/bin/ar \
&& ln -sf /usr/bin/clang /usr/bin/gcc \
&& arch="$(dpkg --print-architecture)" \
&& case "${arch##*-}" in \
amd64) variant="x64";; \
arm64) variant="aarch64";; \
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
*) echo "unsupported architecture: $arch"; exit 1 ;; \
esac \
&& wget "${BUN_DOWNLOAD_URL_BASE}/bun-linux-${variant}.zip" \
&& unzip bun-linux-${variant}.zip \
@@ -124,6 +139,7 @@ RUN apt-get update -y \
&& ln -s /usr/bin/bun /usr/bin/bunx \
&& rm -rf bun-linux-${variant} bun-linux-${variant}.zip \
&& mkdir -p ${BUN_DIR} ${BUN_DEPS_OUT_DIR}
# && if [ -n "${SCCACHE_BUCKET}" ]; then \
# echo "Setting up sccache" \
# && wget https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-${BUILD_MACHINE_ARCH}-unknown-linux-musl.tar.gz \
@@ -134,10 +150,13 @@ RUN apt-get update -y \
FROM bun-base as bun-base-with-zig
ARG ZIG_VERSION
ARG ZIG_VERSION_SHORT
ARG BUILD_MACHINE_ARCH
ARG ZIG_FOLDERNAME=zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION}
ARG ZIG_FILENAME=${ZIG_FOLDERNAME}.tar.xz
ARG ZIG_URL="https://ziglang.org/builds/${ZIG_FILENAME}"
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
WORKDIR $GITHUB_WORKSPACE
@@ -152,14 +171,19 @@ FROM bun-base as c-ares
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/c-ares ${BUN_DIR}/src/deps/c-ares
COPY scripts ${BUN_DIR}/scripts
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make c-ares && rm -rf ${BUN_DIR}/src/deps/c-ares ${BUN_DIR}/Makefile
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-cares.sh \
&& rm -rf ${BUN_DIR}/src/deps/c-ares ${BUN_DIR}/Makefile ${BUN_DIR}/scripts
FROM bun-base as lolhtml
@@ -172,10 +196,14 @@ ENV CPU_TARGET=${CPU_TARGET}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/lol-html ${BUN_DIR}/src/deps/lol-html
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN --mount=type=cache,target=/ccache export PATH=$PATH:$HOME/.cargo/bin && cd ${BUN_DIR} && \
make lolhtml && rm -rf src/deps/lol-html Makefile
RUN --mount=type=cache,target=${CCACHE_DIR} \
export PATH=$PATH:$HOME/.cargo/bin \
&& cd ${BUN_DIR} \
&& make lolhtml \
&& rm -rf src/deps/lol-html Makefile
FROM bun-base as mimalloc
@@ -186,11 +214,15 @@ ENV CPU_TARGET=${CPU_TARGET}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc
COPY scripts ${BUN_DIR}/scripts
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && \
make mimalloc && rm -rf src/deps/mimalloc Makefile;
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd ${BUN_DIR} \
&& bash ./scripts/build-mimalloc.sh \
&& rm -rf src/deps/mimalloc Makefile
FROM bun-base as mimalloc-debug
@@ -202,42 +234,74 @@ ENV CPU_TARGET=${CPU_TARGET}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && \
make mimalloc-debug && rm -rf src/deps/mimalloc Makefile;
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd ${BUN_DIR} \
&& make mimalloc-debug \
&& rm -rf src/deps/mimalloc Makefile
FROM bun-base as zlib
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY Makefile ${BUN_DIR}/Makefile
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
COPY scripts ${BUN_DIR}/scripts
COPY src/deps/zlib ${BUN_DIR}/src/deps/zlib
COPY package.json bun.lockb Makefile .gitmodules ${BUN_DIR}/
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \
make zlib && rm -rf src/deps/zlib Makefile
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-zlib.sh && rm -rf src/deps/zlib scripts
FROM bun-base as libdeflate
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY Makefile ${BUN_DIR}/Makefile
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
COPY scripts ${BUN_DIR}/scripts
COPY src/deps/libdeflate ${BUN_DIR}/src/deps/libdeflate
COPY package.json bun.lockb Makefile .gitmodules ${BUN_DIR}/
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-libdeflate.sh && rm -rf src/deps/libdeflate scripts
FROM bun-base as libarchive
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN install_packages autoconf automake libtool pkg-config
COPY Makefile ${BUN_DIR}/Makefile
COPY scripts ${BUN_DIR}/scripts
COPY src/deps/libarchive ${BUN_DIR}/src/deps/libarchive
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \
make libarchive && rm -rf src/deps/libarchive Makefile
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-libarchive.sh && rm -rf src/deps/libarchive .scripts
FROM bun-base as tinycc
@@ -257,27 +321,19 @@ ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
COPY Makefile ${BUN_DIR}/Makefile
COPY scripts ${BUN_DIR}/scripts
COPY src/deps/boringssl ${BUN_DIR}/src/deps/boringssl
WORKDIR $BUN_DIR
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && make boringssl && rm -rf src/deps/boringssl Makefile
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd ${BUN_DIR} \
&& bash ./scripts/build-boringssl.sh \
&& rm -rf src/deps/boringssl Makefile
FROM bun-base as base64
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/base64 ${BUN_DIR}/src/deps/base64
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make base64 && rm -rf src/deps/base64 Makefile
FROM bun-base as zstd
@@ -286,15 +342,40 @@ ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ENV CCACHE_DIR=/ccache
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/zstd ${BUN_DIR}/src/deps/zstd
COPY .prettierrc.cjs ${BUN_DIR}/.prettierrc.cjs
COPY scripts ${BUN_DIR}/scripts
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make zstd
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-zstd.sh \
&& rm -rf src/deps/zstd scripts
FROM bun-base as ls-hpack
ARG BUN_DIR
ARG CPU_TARGET
ENV CPU_TARGET=${CPU_TARGET}
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/ls-hpack ${BUN_DIR}/src/deps/ls-hpack
COPY scripts ${BUN_DIR}/scripts
WORKDIR $BUN_DIR
RUN --mount=type=cache,target=${CCACHE_DIR} \
cd $BUN_DIR \
&& bash ./scripts/build-lshpack.sh \
&& rm -rf src/deps/ls-hpack scripts
FROM bun-base-with-zig as bun-identifier-cache
@@ -309,9 +390,9 @@ WORKDIR $BUN_DIR
COPY src/js_lexer/identifier_data.zig ${BUN_DIR}/src/js_lexer/identifier_data.zig
COPY src/js_lexer/identifier_cache.zig ${BUN_DIR}/src/js_lexer/identifier_cache.zig
RUN cd $BUN_DIR \
&& zig run src/js_lexer/identifier_data.zig \
&& rm -rf zig-cache
RUN --mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
cd $BUN_DIR \
&& zig run src/js_lexer/identifier_data.zig
FROM bun-base as bun-node-fallbacks
@@ -352,27 +433,33 @@ COPY src ${BUN_DIR}/src
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
COPY src/deps/boringssl/include ${BUN_DIR}/src/deps/boringssl/include
ENV CCACHE_DIR=/ccache
# for uWebSockets
COPY src/deps/libdeflate ${BUN_DIR}/src/deps/libdeflate
RUN --mount=type=cache,target=/ccache mkdir ${BUN_DIR}/build \
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
RUN --mount=type=cache,target=${CCACHE_DIR} mkdir ${BUN_DIR}/build \
&& cd ${BUN_DIR}/build \
&& mkdir -p tmp_modules tmp_functions js codegen \
&& cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DUSE_DEBUG_JSC=${ASSERTIONS} -DBUN_CPP_ONLY=1 -DWEBKIT_DIR=/build/bun/bun-webkit -DCANARY=${CANARY} \
&& cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DUSE_LTO=ON -DUSE_DEBUG_JSC=${ASSERTIONS} -DBUN_CPP_ONLY=1 -DWEBKIT_DIR=/build/bun/bun-webkit -DCANARY=${CANARY} -DZIG_COMPILER=system \
&& bash compile-cpp-only.sh -v
FROM bun-base-with-zig as bun-codegen-for-zig
COPY package.json bun.lockb Makefile .gitmodules .prettierrc.cjs ${BUN_DIR}/
COPY package.json bun.lockb Makefile .gitmodules ${BUN_DIR}/
COPY src/runtime ${BUN_DIR}/src/runtime
COPY src/runtime.js src/runtime.footer*.js src/react-refresh.js ${BUN_DIR}/src/
COPY src/runtime.js src/runtime.bun.js ${BUN_DIR}/src/
COPY packages/bun-error ${BUN_DIR}/packages/bun-error
COPY packages/bun-types ${BUN_DIR}/packages/bun-types
COPY src/fallback.ts ${BUN_DIR}/src/fallback.ts
COPY src/api ${BUN_DIR}/src/api
WORKDIR $BUN_DIR
# TODO: move away from Makefile entirely
RUN bun install --frozen-lockfile \
RUN --mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
bun install --frozen-lockfile \
&& make runtime_js fallback_decoder bun_error \
&& rm -rf src/runtime src/fallback.ts node_modules bun.lockb package.json Makefile
@@ -386,6 +473,9 @@ ARG CANARY=0
ARG ASSERTIONS=OFF
ARG ZIG_OPTIMIZE=ReleaseFast
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
COPY *.zig package.json CMakeLists.txt ${BUN_DIR}/
COPY completions ${BUN_DIR}/completions
COPY packages ${BUN_DIR}/packages
@@ -398,20 +488,25 @@ COPY --from=bun-codegen-for-zig ${BUN_DIR}/packages/bun-error/dist ${BUN_DIR}/pa
WORKDIR $BUN_DIR
RUN mkdir -p build \
&& bun run $BUN_DIR/src/codegen/bundle-modules-fast.ts $BUN_DIR/build \
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
mkdir -p build \
&& bun run $BUN_DIR/src/codegen/bundle-modules.ts --debug=OFF $BUN_DIR/build \
&& cd build \
&& cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_LTO=ON \
-DZIG_OPTIMIZE="${ZIG_OPTIMIZE}" \
-DCPU_TARGET="${CPU_TARGET}" \
-DZIG_TARGET="${TRIPLET}" \
-DWEBKIT_DIR="omit" \
-DNO_CONFIGURE_DEPENDS=1 \
-DNO_CODEGEN=1 \
-DBUN_ZIG_OBJ="/tmp/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="/tmp" \
-DCANARY="${CANARY}" \
-DZIG_COMPILER=system \
-DZIG_LIB_DIR=$BUN_DIR/src/deps/zig/lib \
&& ONLY_ZIG=1 ninja "/tmp/bun-zig.o" -v
FROM scratch as build_release_obj
@@ -428,6 +523,10 @@ ARG CANARY
ARG ASSERTIONS
ENV CPU_TARGET=${CPU_TARGET}
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
WORKDIR $BUN_DIR
@@ -435,12 +534,13 @@ RUN mkdir -p build bun-webkit
# lol
COPY src/bun.js/bindings/sqlite/sqlite3.c ${BUN_DIR}/src/bun.js/bindings/sqlite/sqlite3.c
COPY src/deps/brotli ${BUN_DIR}/src/deps/brotli
COPY src/symbols.dyn src/linker.lds ${BUN_DIR}/src/
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
COPY --from=zlib ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=base64 ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=libdeflate ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=lolhtml ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
@@ -448,17 +548,22 @@ COPY --from=mimalloc ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=zstd ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=tinycc ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=c-ares ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=ls-hpack ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=bun-compile-zig-obj /tmp/bun-zig.o ${BUN_DIR}/build/bun-zig.o
COPY --from=bun-cpp-objects ${BUN_DIR}/build/bun-cpp-objects.a ${BUN_DIR}/build/bun-cpp-objects.a
COPY --from=bun-cpp-objects ${BUN_DIR}/build/*.a ${BUN_DIR}/build/
COPY --from=bun-cpp-objects ${BUN_DIR}/build/*.o ${BUN_DIR}/build/
COPY --from=bun-cpp-objects ${BUN_DIR}/bun-webkit/lib ${BUN_DIR}/bun-webkit/lib
WORKDIR $BUN_DIR/build
RUN cmake .. \
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${BUN_DIR}/build/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="${BUN_DIR}/build" \
-DUSE_LTO=ON \
-DUSE_DEBUG_JSC=${ASSERTIONS} \
-DBUN_CPP_ARCHIVE="${BUN_DIR}/build/bun-cpp-objects.a" \
-DWEBKIT_DIR="${BUN_DIR}/bun-webkit" \
@@ -466,6 +571,7 @@ RUN cmake .. \
-DCPU_TARGET="${CPU_TARGET}" \
-DNO_CONFIGURE_DEPENDS=1 \
-DCANARY="${CANARY}" \
-DZIG_COMPILER=system \
&& ninja -v \
&& ./bun --revision \
&& mkdir -p /build/out \
@@ -483,6 +589,10 @@ ARG CANARY
ARG ASSERTIONS
ENV CPU_TARGET=${CPU_TARGET}
ARG CCACHE_DIR=/ccache
ENV CCACHE_DIR=${CCACHE_DIR}
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
WORKDIR $BUN_DIR
@@ -495,7 +605,6 @@ COPY src/symbols.dyn src/linker.lds ${BUN_DIR}/src/
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
COPY --from=zlib ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=base64 ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
COPY --from=lolhtml ${BUN_DEPS_OUT_DIR}/* ${BUN_DEPS_OUT_DIR}/
@@ -509,11 +618,13 @@ COPY --from=bun-cpp-objects ${BUN_DIR}/bun-webkit/lib ${BUN_DIR}/bun-webkit/lib
WORKDIR $BUN_DIR/build
RUN cmake .. \
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${BUN_DIR}/build/bun-zig.o" \
-DBUN_ZIG_OBJ_DIR="${BUN_DIR}/build" \
-DUSE_DEBUG_JSC=ON \
-DBUN_CPP_ARCHIVE="${BUN_DIR}/build/bun-cpp-objects.a" \
-DWEBKIT_DIR="${BUN_DIR}/bun-webkit" \
@@ -521,6 +632,8 @@ RUN cmake .. \
-DCPU_TARGET="${CPU_TARGET}" \
-DNO_CONFIGURE_DEPENDS=1 \
-DCANARY="${CANARY}" \
-DZIG_COMPILER=system \
-DUSE_LTO=ON \
&& ninja -v \
&& ./bun --revision \
&& mkdir -p /build/out \

1
LATEST Normal file
View File

@@ -0,0 +1 @@
1.1.21

73
LICENSE.md Normal file
View File

@@ -0,0 +1,73 @@
Bun itself is MIT-licensed.
## JavaScriptCore
Bun statically links JavaScriptCore (and WebKit) which is LGPL-2 licensed. WebCore files from WebKit are also licensed under LGPL2. Per LGPL2:
> (1) If you statically link against an LGPLd library, you must also provide your application in an object (not necessarily source) format, so that a user has the opportunity to modify the library and relink the application.
You can find the patched version of WebKit used by Bun here: <https://github.com/oven-sh/webkit>. If you would like to relink Bun with changes:
- `git submodule update --init --recursive`
- `make jsc`
- `zig build`
This compiles JavaScriptCore, compiles Buns `.cpp` bindings for JavaScriptCore (which are the object files using JavaScriptCore) and outputs a new `bun` binary with your changes.
## Linked libraries
Bun statically links these libraries:
| Library | License |
|---------|---------|
| [`boringssl`](https://boringssl.googlesource.com/boringssl/) | [several licenses](https://boringssl.googlesource.com/boringssl/+/refs/heads/master/LICENSE) |
| [`brotli`](https://github.com/google/brotli) | MIT |
| [`libarchive`](https://github.com/libarchive/libarchive) | [several licenses](https://github.com/libarchive/libarchive/blob/master/COPYING) |
| [`lol-html`](https://github.com/cloudflare/lol-html/tree/master/c-api) | BSD 3-Clause |
| [`mimalloc`](https://github.com/microsoft/mimalloc) | MIT |
| [`picohttp`](https://github.com/h2o/picohttpparser) | dual-licensed under the Perl License or the MIT License |
| [`zstd`](https://github.com/facebook/zstd) | dual-licensed under the BSD License or GPLv2 license |
| [`simdutf`](https://github.com/simdutf/simdutf) | Apache 2.0 |
| [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
| [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
| [`zlib-cloudflare`](https://github.com/cloudflare/zlib) | zlib |
| [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
| [`libicu`](https://github.com/unicode-org/icu) 72 | [license here](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
| [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
| [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
| [`libdeflate`](https://github.com/ebiggers/libdeflate) | MIT |
| A fork of [`uWebsockets`](https://github.com/jarred-sumner/uwebsockets) | Apache 2.0 licensed |
| Parts of [Tigerbeetle's IO code](https://github.com/tigerbeetle/tigerbeetle/blob/532c8b70b9142c17e07737ab6d3da68d7500cbca/src/io/windows.zig#L1) | Apache 2.0 licensed |
## Polyfills
For compatibility reasons, the following packages are embedded into Bun's binary and injected if imported.
| Package | License |
|---------|---------|
| [`assert`](https://npmjs.com/package/assert) | MIT |
| [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) | MIT |
| [`buffer`](https://npmjs.com/package/buffer) | MIT |
| [`constants-browserify`](https://npmjs.com/package/constants-browserify) | MIT |
| [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) | MIT |
| [`domain-browser`](https://npmjs.com/package/domain-browser) | MIT |
| [`events`](https://npmjs.com/package/events) | MIT |
| [`https-browserify`](https://npmjs.com/package/https-browserify) | MIT |
| [`os-browserify`](https://npmjs.com/package/os-browserify) | MIT |
| [`path-browserify`](https://npmjs.com/package/path-browserify) | MIT |
| [`process`](https://npmjs.com/package/process) | MIT |
| [`punycode`](https://npmjs.com/package/punycode) | MIT |
| [`querystring-es3`](https://npmjs.com/package/querystring-es3) | MIT |
| [`stream-browserify`](https://npmjs.com/package/stream-browserify) | MIT |
| [`stream-http`](https://npmjs.com/package/stream-http) | MIT |
| [`string_decoder`](https://npmjs.com/package/string_decoder) | MIT |
| [`timers-browserify`](https://npmjs.com/package/timers-browserify) | MIT |
| [`tty-browserify`](https://npmjs.com/package/tty-browserify) | MIT |
| [`url`](https://npmjs.com/package/url) | MIT |
| [`util`](https://npmjs.com/package/util) | MIT |
| [`vm-browserify`](https://npmjs.com/package/vm-browserify) | MIT |
## Additional credits
- Bun's JS transpiler, CSS lexer, and Node.js module resolver source code is a Zig port of [@evanw](https://github.com/evanw)s [esbuild](https://github.com/evanw/esbuild) project.
- Credit to [@kipply](https://github.com/kipply) for the name "Bun"!

166
Makefile
View File

@@ -26,8 +26,11 @@ ifeq ($(ARCH_NAME_RAW),arm64)
ARCH_NAME = aarch64
DOCKER_BUILDARCH = arm64
BREW_PREFIX_PATH = /opt/homebrew
DEFAULT_MIN_MACOS_VERSION = 11.0
DEFAULT_MIN_MACOS_VERSION = 13.0
MARCH_NATIVE = -mtune=$(CPU_TARGET)
ifeq ($(OS_NAME),linux)
MARCH_NATIVE = -march=armv8-a+crc -mtune=ampere1
endif
else
ARCH_NAME = x64
DOCKER_BUILDARCH = amd64
@@ -129,7 +132,7 @@ SED = $(shell which gsed 2>/dev/null || which sed 2>/dev/null)
BUN_DIR ?= $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
BUN_DEPS_DIR ?= $(shell pwd)/src/deps
BUN_DEPS_OUT_DIR ?= $(BUN_DEPS_DIR)
BUN_DEPS_OUT_DIR ?= $(shell pwd)/build/bun-deps
CPU_COUNT = 2
ifeq ($(OS_NAME),darwin)
CPU_COUNT = $(shell sysctl -n hw.logicalcpu)
@@ -154,7 +157,12 @@ CMAKE_FLAGS_WITHOUT_RELEASE = -DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$(MIN_MACOS_VERSION) \
$(CMAKE_CXX_COMPILER_LAUNCHER_FLAG) \
-DCMAKE_AR=$(AR) \
-DCMAKE_RANLIB=$(which llvm-16-ranlib 2>/dev/null || which llvm-ranlib 2>/dev/null)
-DCMAKE_RANLIB=$(which llvm-16-ranlib 2>/dev/null || which llvm-ranlib 2>/dev/null) \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_C_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_C_STANDARD_REQUIRED=ON \
-DCMAKE_CXX_EXTENSIONS=ON
@@ -181,8 +189,8 @@ endif
OPTIMIZATION_LEVEL=-O3 $(MARCH_NATIVE)
DEBUG_OPTIMIZATION_LEVEL= -O1 $(MARCH_NATIVE) -gdwarf-4
CFLAGS_WITHOUT_MARCH = $(MACOS_MIN_FLAG) $(OPTIMIZATION_LEVEL) -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden
BUN_CFLAGS = $(MACOS_MIN_FLAG) $(MARCH_NATIVE) $(OPTIMIZATION_LEVEL) -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden
CFLAGS_WITHOUT_MARCH = $(MACOS_MIN_FLAG) $(OPTIMIZATION_LEVEL) -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pie -fno-pic
BUN_CFLAGS = $(MACOS_MIN_FLAG) $(MARCH_NATIVE) $(OPTIMIZATION_LEVEL) -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pie -fno-pic
BUN_TMP_DIR := /tmp/make-bun
CFLAGS=$(CFLAGS_WITHOUT_MARCH) $(MARCH_NATIVE)
@@ -231,14 +239,17 @@ _MIMALLOC_LINK = $(BUN_DEPS_OUT_DIR)/$(MIMALLOC_FILE)
DEFAULT_LINKER_FLAGS =
JSC_BUILD_STEPS :=
JSC_BUILD_STEPS_DEBUG :=
ifeq ($(OS_NAME),linux)
JSC_BUILD_STEPS += jsc-build-linux
JSC_BUILD_STEPS_DEBUG += jsc-build-linux-debug
_MIMALLOC_LINK = $(BUN_DEPS_OUT_DIR)/$(MIMALLOC_FILE)
DEFAULT_LINKER_FLAGS= -pthread -ldl
endif
ifeq ($(OS_NAME),darwin)
_MIMALLOC_OBJECT_FILE = 0
JSC_BUILD_STEPS += jsc-build-mac jsc-copy-headers
JSC_BUILD_STEPS_DEBUG += jsc-build-mac-debug
_MIMALLOC_FILE = libmimalloc.a
_MIMALLOC_INPUT_PATH = libmimalloc.a
_MIMALLOC_LINK = -lmimalloc
@@ -446,8 +457,7 @@ MINIMUM_ARCHIVE_FILES = -L$(BUN_DEPS_OUT_DIR) \
-ldecrepit \
-lssl \
-lcrypto \
-llolhtml \
-lbase64
-llolhtml
ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MINIMUM_ARCHIVE_FILES) \
-larchive \
@@ -455,7 +465,8 @@ ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MINIMUM_ARCHIVE_FILES) \
-lusockets \
-lcares \
-lzstd \
$(BUN_DEPS_OUT_DIR)/libuwsockets.o
$(BUN_DEPS_OUT_DIR)/libuwsockets.o \
$(BUN_DEPS_OUT_DIR)/liblshpack.a
ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO)
@@ -672,7 +683,7 @@ assert-deps:
@echo "You have the dependencies installed! Woo"
# the following allows you to run `make submodule` to update or init submodules. but we will exclude webkit
# unless you explicity clone it yourself (a huge download)
# unless you explicitly clone it yourself (a huge download)
SUBMODULE_NAMES=$(shell cat .gitmodules | grep 'path = ' | awk '{print $$3}')
ifeq ("$(wildcard src/bun.js/WebKit/.git)", "")
SUBMODULE_NAMES := $(filter-out src/bun.js/WebKit, $(SUBMODULE_NAMES))
@@ -749,12 +760,22 @@ wasm: api mimalloc-wasm build-obj-wasm-small
build-obj-safe:
$(ZIG) build obj -Doptimize=ReleaseSafe -Dcpu="$(CPU_TARGET)"
UWS_CC_FLAGS = -pthread -DLIBUS_USE_OPENSSL=1 -DUWS_HTTPRESPONSE_NO_WRITEMARK=1 -DLIBUS_USE_BORINGSSL=1 -DWITH_BORINGSSL=1 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion $(UWS_INCLUDE) -DUWS_WITH_PROXY
UWS_CC_FLAGS = -pthread -DLIBUS_USE_OPENSSL=1 -DUWS_HTTPRESPONSE_NO_WRITEMARK=1 -DLIBUS_USE_BORINGSSL=1 -DWITH_BORINGSSL=1 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion $(UWS_INCLUDE) -DUWS_WITH_PROXY
UWS_CXX_FLAGS = $(UWS_CC_FLAGS) -std=$(CXX_VERSION) -fno-exceptions -fno-rtti
UWS_LDFLAGS = -I$(BUN_DEPS_DIR)/boringssl/include -I$(ZLIB_INCLUDE_DIR)
USOCKETS_DIR = $(BUN_DIR)/packages/bun-usockets
USOCKETS_SRC_DIR = $(USOCKETS_DIR)/src
LSHPACK_SRC_DIR = $(BUN_DEPS_DIR)/ls-hpack
LSHPACK_CC_FLAGS = -DXXH_HEADER_NAME="<xxhash.h>"
LSHPACK_LDFLAGS = -I$(LSHPACK_SRC_DIR) -I$(LSHPACK_SRC_DIR)/deps/xxhash
lshpack:
rm -rf $(LSHPACK_SRC_DIR)/*.i $(LSHPACK_SRC_DIR)/*.bc $(LSHPACK_SRC_DIR)/*.o $(LSHPACK_SRC_DIR)/*.s $(LSHPACK_SRC_DIR)/*.ii $(LSHPACK_SRC_DIR)/*.s
cd $(LSHPACK_SRC_DIR) && $(CC_WITH_CCACHE) -I$(LSHPACK_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CFLAGS) $(LSHPACK_CC_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/lshpack/src $(LSHPACK_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(LSHPACK_SRC_DIR)/lshpack.c) $(wildcard $(LSHPACK_SRC_DIR)/deps/**/*.c)
cd $(LSHPACK_SRC_DIR) && $(AR) rcvs $(BUN_DEPS_OUT_DIR)/liblshpack.a $(LSHPACK_SRC_DIR)/*.{o,bc}
usockets:
rm -rf $(USOCKETS_DIR)/*.i $(USOCKETS_DIR)/*.bc $(USOCKETS_DIR)/*.o $(USOCKETS_DIR)/*.s $(USOCKETS_DIR)/*.ii $(USOCKETS_DIR)/*.s $(BUN_DEPS_OUT_DIR)/libusockets.a
cd $(USOCKETS_DIR) && $(CC_WITH_CCACHE) -I$(USOCKETS_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CFLAGS) $(UWS_CC_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/uSockets/src $(UWS_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(USOCKETS_SRC_DIR)/*.c) $(wildcard $(USOCKETS_SRC_DIR)/**/*.c)
@@ -812,7 +833,6 @@ fmt: fmt-cpp fmt-zig
api:
./node_modules/.bin/peechy --schema src/api/schema.peechy --esm src/api/schema.js --ts src/api/schema.d.ts --zig src/api/schema.zig
$(ZIG) fmt src/api/schema.zig
$(PRETTIER) --config=.prettierrc.cjs --write src/api/schema.js src/api/schema.d.ts
.PHONY: node-fallbacks
node-fallbacks:
@@ -825,17 +845,7 @@ fallback_decoder:
.PHONY: runtime_js
runtime_js:
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js
.PHONY: runtime_js_dev
runtime_js_dev:
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime.bun.js --format=esm --platform=node --minify --external:/bun:* > src/runtime.out.js
.PHONY: bun_error
bun_error:
@@ -917,8 +927,12 @@ bun-codesign-release-local-debug:
.PHONY: jsc
jsc: jsc-build jsc-copy-headers jsc-bindings
.PHONY: jsc-debug
jsc-debug: jsc-build-debug jsc-copy-headers-debug
.PHONY: jsc-build
jsc-build: $(JSC_BUILD_STEPS)
.PHONY: jsc-build-debug
jsc-build-debug: $(JSC_BUILD_STEPS_DEBUG)
.PHONY: jsc-bindings
jsc-bindings: headers bindings
@@ -1175,6 +1189,57 @@ jsc-copy-headers:
cp $(WEBKIT_DIR)/Source/JavaScriptCore/API/JSWeakValue.h $(WEBKIT_RELEASE_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSWeakValue.h
find $(WEBKIT_RELEASE_DIR)/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} $(WEBKIT_RELEASE_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/ \;
jsc-copy-headers-debug:
cp $(WEBKIT_DIR)/Source/JavaScriptCore/heap/WeakHandleOwner.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/WeakHandleOwner.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/LazyClassStructureInlines.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/LazyClassStructureInlines.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/LazyPropertyInlines.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/LazyPropertyInlines.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSTypedArrayViewPrototype.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/JSTypedArrayPrototypes.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSTypedArrayPrototypes.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSModuleNamespaceObject.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JIT.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JIT.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/StructureStubInfo.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/StructureStubInfo.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/AccessCase.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/AccessCase.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/ObjectPropertyConditionSet.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/ObjectPropertyConditionSet.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/PolyProtoAccessChain.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/PolyProtoAccessChain.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/InlineCacheCompiler.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/InlineCacheCompiler.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/StructureStubClearingWatchpoint.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/AdaptiveInferredPropertyValueWatchpointBase.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/AdaptiveInferredPropertyValueWatchpointBase.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/StubInfoSummary.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/StubInfoSummary.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/CommonSlowPaths.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/CommonSlowPaths.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/DirectArguments.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/DirectArguments.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/GenericArguments.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/GenericArguments.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/SamplingProfiler.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/SamplingProfiler.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/ScopedArguments.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/ScopedArguments.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/JSLexicalEnvironment.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSLexicalEnvironment.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITDisassembler.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITDisassembler.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITInlineCacheGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITMathIC.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITMathIC.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITAddGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITAddGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITMathICInlineResult.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITMathICInlineResult.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/SnippetOperand.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/SnippetOperand.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITMulGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITMulGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITNegGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITNegGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITSubGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITSubGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/Repatch.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/Repatch.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITRightShiftGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITRightShiftGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JITBitBinaryOpGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JITBitBinaryOpGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/jit/JSInterfaceJIT.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSInterfaceJIT.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/llint/LLIntData.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/LLIntData.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/FunctionCodeBlock.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/FunctionCodeBlock.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/dfg/DFGAbstractHeap.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/DFGAbstractHeap.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/OperandsInlines.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/OperandsInlines.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/Operands.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/Operands.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/domjit/DOMJITHeapRange.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/DOMJITHeapRange.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/GeneratorPrototype.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/GeneratorPrototype.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/GeneratorFunctionPrototype.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/GeneratorFunctionPrototype.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/AsyncFunctionPrototype.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/AsyncFunctionPrototype.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/SymbolObject.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/SymbolObject.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/JSGenerator.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSGenerator.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/bytecode/UnlinkedFunctionCodeBlock.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/UnlinkedFunctionCodeBlock.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/runtime/AggregateError.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/AggregateError.h
cp $(WEBKIT_DIR)/Source/JavaScriptCore/API/JSWeakValue.h $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/JSWeakValue.h
find $(WEBKIT_DEBUG_DIR)/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} $(WEBKIT_DEBUG_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/ \;
# This is a workaround for a JSC bug that impacts aarch64
# on macOS, it never requests JIT permissions
.PHONY: jsc-force-fastjit
@@ -1246,6 +1311,7 @@ jsc-build-mac-compile-debug:
-DENABLE_FTL_JIT=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-G Ninja \
$(CMAKE_FLAGS_WITHOUT_RELEASE) \
@@ -1265,7 +1331,8 @@ jsc-build-linux-compile-config:
cmake \
-DPORT="JSCOnly" \
-DENABLE_STATIC_JSC=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DUSE_THIN_ARCHIVES=OFF \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DENABLE_FTL_JIT=ON \
@@ -1280,6 +1347,29 @@ jsc-build-linux-compile-config:
$(WEBKIT_DIR) \
$(WEBKIT_RELEASE_DIR)
.PHONY: jsc-build-linux-compile-config-debug
jsc-build-linux-compile-config-debug:
mkdir -p $(WEBKIT_DEBUG_DIR)
cd $(WEBKIT_DEBUG_DIR) && \
cmake \
-DPORT="JSCOnly" \
-DENABLE_STATIC_JSC=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
-DUSE_THIN_ARCHIVES=OFF \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DENABLE_FTL_JIT=ON \
-DENABLE_REMOTE_INSPECTOR=ON \
-DJSEXPORT_PRIVATE=WTF_EXPORT_DECLARATION \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-USE_VISIBILITY_ATTRIBUTE=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G Ninja \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DCMAKE_C_COMPILER=$(CC) \
$(WEBKIT_DIR) \
$(WEBKIT_DEBUG_DIR)
# If you get "Error: could not load cache"
# run rm -rf src/bun.js/WebKit/CMakeCache.txt
.PHONY: jsc-build-linux-compile-build
@@ -1289,17 +1379,32 @@ jsc-build-linux-compile-build:
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON" \
cmake --build $(WEBKIT_RELEASE_DIR) --config relwithdebuginfo --target jsc
.PHONY: jsc-build-linux-compile-build-debug
jsc-build-linux-compile-build-debug:
mkdir -p $(WEBKIT_DEBUG_DIR) && \
cd $(WEBKIT_DEBUG_DIR) && \
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON" \
cmake --build $(WEBKIT_DEBUG_DIR) --config Debug --target jsc
jsc-build-mac: jsc-force-fastjit jsc-build-mac-compile jsc-build-mac-copy
jsc-build-linux: jsc-build-linux-compile-config jsc-build-linux-compile-build jsc-build-mac-copy
jsc-build-mac: jsc-force-fastjit jsc-build-mac-compile jsc-build-copy
jsc-build-mac-debug: jsc-force-fastjit jsc-build-mac-compile-debug jsc-build-copy-debug
jsc-build-mac-copy:
jsc-build-linux: jsc-build-linux-compile-config jsc-build-linux-compile-build jsc-build-copy
jsc-build-linux-debug: jsc-build-linux-compile-config-debug jsc-build-linux-compile-build-debug jsc-build-copy-debug
jsc-build-copy:
cp $(WEBKIT_RELEASE_DIR)/lib/libJavaScriptCore.a $(BUN_DEPS_OUT_DIR)/libJavaScriptCore.a
#cp $(WEBKIT_RELEASE_DIR)/lib/libLowLevelInterpreterLib.a $(BUN_DEPS_OUT_DIR)/libLowLevelInterpreterLib.a
cp $(WEBKIT_RELEASE_DIR)/lib/libWTF.a $(BUN_DEPS_OUT_DIR)/libWTF.a
cp $(WEBKIT_RELEASE_DIR)/lib/libbmalloc.a $(BUN_DEPS_OUT_DIR)/libbmalloc.a
jsc-build-copy-debug:
cp $(WEBKIT_DEBUG_DIR)/lib/libJavaScriptCore.a $(BUN_DEPS_OUT_DIR)/libJavaScriptCore.a
#cp $(WEBKIT_DEBUG_DIR)/lib/libLowLevelInterpreterLib.a $(BUN_DEPS_OUT_DIR)/libLowLevelInterpreterLib.a
cp $(WEBKIT_DEBUG_DIR)/lib/libWTF.a $(BUN_DEPS_OUT_DIR)/libWTF.a
cp $(WEBKIT_DEBUG_DIR)/lib/libbmalloc.a $(BUN_DEPS_OUT_DIR)/libbmalloc.a
clean-jsc:
cd src/bun.js/WebKit && rm -rf **/CMakeCache.txt **/CMakeFiles && rm -rf src/bun.js/WebKit/WebKitBuild
clean-bindings:
@@ -1721,7 +1826,7 @@ sizegen:
# Linux uses bundled SQLite3
ifeq ($(OS_NAME),linux)
sqlite:
$(CC) $(EMIT_LLVM_FOR_RELEASE) $(CFLAGS) $(INCLUDE_DIRS) -DSQLITE_ENABLE_COLUMN_METADATA= -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 $(SRC_DIR)/sqlite/sqlite3.c -c -o $(SQLITE_OBJECT)
$(CC) $(EMIT_LLVM_FOR_RELEASE) $(CFLAGS) $(INCLUDE_DIRS) -DSQLITE_ENABLE_COLUMN_METADATA= -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 $(SRC_DIR)/sqlite/sqlite3.c -c -o $(SQLITE_OBJECT)
endif
picohttp:
@@ -1873,11 +1978,6 @@ copy-to-bun-release-dir-bin:
PACKAGE_MAP = --pkg-begin async_io $(BUN_DIR)/src/io/io_darwin.zig --pkg-begin bun $(BUN_DIR)/src/bun_redirect.zig --pkg-end --pkg-end --pkg-begin javascript_core $(BUN_DIR)/src/jsc.zig --pkg-begin bun $(BUN_DIR)/src/bun_redirect.zig --pkg-end --pkg-end --pkg-begin bun $(BUN_DIR)/src/bun_redirect.zig --pkg-end
.PHONY: base64
base64:
cd $(BUN_DEPS_DIR)/base64 && make clean && rm -rf CMakeCache.txt CMakeFiles && cmake $(CMAKE_FLAGS) . && make
cp $(BUN_DEPS_DIR)/base64/libbase64.a $(BUN_DEPS_OUT_DIR)/libbase64.a
.PHONY: cold-jsc-start
cold-jsc-start:
$(CXX_WITH_CCACHE) $(CLANG_FLAGS) \
@@ -1895,7 +1995,7 @@ cold-jsc-start:
misctools/cold-jsc-start.cpp -o cold-jsc-start
.PHONY: vendor-without-npm
vendor-without-npm: node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive lolhtml sqlite usockets uws tinycc c-ares zstd base64
vendor-without-npm: node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive lolhtml sqlite usockets uws lshpack tinycc c-ares zstd
.PHONY: vendor-without-check

297
README.md
View File

@@ -24,9 +24,9 @@
## What is Bun?
> **Bun is under active development.** Use it to speed up your development workflows or run simpler production code in resource-constrained environments like serverless functions. We're working on more complete Node.js compatibility and integration with existing frameworks. Join the [Discord](https://bun.sh/discord) and watch the [GitHub repository](https://github.com/oven-sh/bun) to keep tabs on future releases.
> **Bun is under active development.** Use it to speed up your development workflows or run simpler production code in resource-constrained environments like serverless functions. We're working on more complete Node.js compatibility and integration with existing frameworks. Join the [Discord](https://bun.sh/discord) and watch the [GitHub repository](https://github.com/oven-sh/bun) to keep tabs on future releases.
Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called `bun`.
Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called `bun`.
At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
@@ -34,27 +34,28 @@ At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-i
bun run index.tsx # TS and JSX supported out-of-the-box
```
The `bun` command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need `bun`. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.
The `bun` command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need `bun`. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.
```bash
bun test # run tests
bun run start # run the `start` script in `package.json`
bun install <pkg> # install a package
bun install <pkg> # install a package
bunx cowsay 'Hello, world!' # execute a package
```
## Install
Bun supports Linux (x64 & arm64) and macOS (x64 & Apple Silicon).
Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon) and Windows (x64).
> **Linux users** — Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.
>
> **Windows users** — Bun does not currently provide a native Windows build. We're working on this; progress can be tracked at [this issue](https://github.com/oven-sh/bun/issues/43). In the meantime, use one of the installation methods below for Windows Subsystem for Linux.
```sh
# with install script (recommended)
curl -fsSL https://bun.sh/install | bash
# on windows
powershell -c "irm bun.sh/install.ps1 | iex"
# with npm
npm install -g bun
@@ -89,42 +90,288 @@ bun upgrade --canary
- [What is Bun?](https://bun.sh/docs/index)
- [Installation](https://bun.sh/docs/installation)
- [Quickstart](https://bun.sh/docs/quickstart)
- CLI
- [`bun run`](https://bun.sh/docs/cli/run)
- [`bun install`](https://bun.sh/docs/cli/install)
- [`bun test`](https://bun.sh/docs/cli/test)
- [TypeScript](https://bun.sh/docs/typescript)
- Templating
- [`bun init`](https://bun.sh/docs/cli/init)
- [`bun create`](https://bun.sh/docs/cli/bun-create)
- [`bunx`](https://bun.sh/docs/cli/bunx)
- Runtime
- [Runtime](https://bun.sh/docs/runtime/index)
- [`bun run`](https://bun.sh/docs/cli/run)
- [File types](https://bun.sh/docs/runtime/loaders)
- [TypeScript](https://bun.sh/docs/runtime/typescript)
- [JSX](https://bun.sh/docs/runtime/jsx)
- [Environment variables](https://bun.sh/docs/runtime/env)
- [Bun APIs](https://bun.sh/docs/runtime/bun-apis)
- [Web APIs](https://bun.sh/docs/runtime/web-apis)
- [Node.js compatibility](https://bun.sh/docs/runtime/nodejs-apis)
- [Single-file executable](https://bun.sh/docs/bundler/executables)
- [Plugins](https://bun.sh/docs/runtime/plugins)
- [Watch mode](https://bun.sh/docs/runtime/hot)
- [Module resolution](https://bun.sh/docs/runtime/modules)
- [Hot &amp; live reloading](https://bun.sh/docs/runtime/hot)
- [Auto-install](https://bun.sh/docs/runtime/autoimport)
- [bunfig.toml](https://bun.sh/docs/runtime/bunfig)
- [Debugger](https://bun.sh/docs/runtime/debugger)
- [Framework API](https://bun.sh/docs/runtime/framework)
- Package manager
- [`bun install`](https://bun.sh/docs/cli/install)
- [`bun add`](https://bun.sh/docs/cli/add)
- [`bun remove`](https://bun.sh/docs/cli/remove)
- [`bun update`](https://bun.sh/docs/cli/update)
- [`bun link`](https://bun.sh/docs/cli/link)
- [`bun pm`](https://bun.sh/docs/cli/pm)
- [Global cache](https://bun.sh/docs/install/cache)
- [Workspaces](https://bun.sh/docs/install/workspaces)
- [Lifecycle scripts](https://bun.sh/docs/install/lifecycle)
- [Filter](https://bun.sh/docs/cli/filter)
- [Lockfile](https://bun.sh/docs/install/lockfile)
- [Scopes and registries](https://bun.sh/docs/install/registries)
- [Overrides and resolutions](https://bun.sh/docs/install/overrides)
- Bundler
- [`Bun.build`](https://bun.sh/docs/bundler)
- [Loaders](https://bun.sh/docs/bundler/loaders)
- [Plugins](https://bun.sh/docs/bundler/plugins)
- Ecosystem
- [Node.js](https://bun.sh/docs/ecosystem/nodejs)
- [TypeScript](https://bun.sh/docs/ecosystem/typescript)
- [React](https://bun.sh/docs/ecosystem/react)
- [Elysia](https://bun.sh/docs/ecosystem/elysia)
- [Hono](https://bun.sh/docs/ecosystem/hono)
- [Express](https://bun.sh/docs/ecosystem/express)
- [awesome-bun](https://github.com/apvarun/awesome-bun)
- [Macros](https://bun.sh/docs/bundler/macros)
- [vs esbuild](https://bun.sh/docs/bundler/vs-esbuild)
- Test runner
- [`bun test`](https://bun.sh/docs/cli/test)
- [Writing tests](https://bun.sh/docs/test/writing)
- [Watch mode](https://bun.sh/docs/test/hot)
- [Lifecycle hooks](https://bun.sh/docs/test/lifecycle)
- [Mocks](https://bun.sh/docs/test/mocks)
- [Snapshots](https://bun.sh/docs/test/snapshots)
- [Dates and times](https://bun.sh/docs/test/time)
- [DOM testing](https://bun.sh/docs/test/dom)
- [Code coverage](https://bun.sh/docs/test/coverage)
- Package runner
- [`bunx`](https://bun.sh/docs/cli/bunx)
- API
- [HTTP](https://bun.sh/docs/api/http)
- [HTTP server](https://bun.sh/docs/api/http)
- [WebSockets](https://bun.sh/docs/api/websockets)
- [TCP Sockets](https://bun.sh/docs/api/tcp)
- [Workers](https://bun.sh/docs/api/workers)
- [Binary data](https://bun.sh/docs/api/binary-data)
- [Streams](https://bun.sh/docs/api/streams)
- [File I/O](https://bun.sh/docs/api/file-io)
- [import.meta](https://bun.sh/docs/api/import-meta)
- [SQLite](https://bun.sh/docs/api/sqlite)
- [FileSystemRouter](https://bun.sh/docs/api/file-system-router)
- [TCP sockets](https://bun.sh/docs/api/tcp)
- [UDP sockets](https://bun.sh/docs/api/udp)
- [Globals](https://bun.sh/docs/api/globals)
- [Spawn](https://bun.sh/docs/api/spawn)
- [$ Shell](https://bun.sh/docs/runtime/shell)
- [Child processes](https://bun.sh/docs/api/spawn)
- [Transpiler](https://bun.sh/docs/api/transpiler)
- [Hashing](https://bun.sh/docs/api/hashing)
- [Console](https://bun.sh/docs/api/console)
- [FFI](https://bun.sh/docs/api/ffi)
- [HTMLRewriter](https://bun.sh/docs/api/html-rewriter)
- [Testing](https://bun.sh/docs/api/test)
- [Utils](https://bun.sh/docs/api/utils)
- [Node-API](https://bun.sh/docs/api/node-api)
- [Glob](https://bun.sh/docs/api/glob)
- [Semver](https://bun.sh/docs/api/semver)
- Project
- [Roadmap](https://bun.sh/docs/project/roadmap)
- [Benchmarking](https://bun.sh/docs/project/benchmarking)
- [Contributing](https://bun.sh/docs/project/contributing)
- [Building Windows](https://bun.sh/docs/project/building-windows)
- [License](https://bun.sh/docs/project/licensing)
## Guides
- Binary
- [Convert a Blob to a DataView](https://bun.sh/guides/binary/blob-to-dataview)
- [Convert a Blob to a ReadableStream](https://bun.sh/guides/binary/blob-to-stream)
- [Convert a Blob to a string](https://bun.sh/guides/binary/blob-to-string)
- [Convert a Blob to a Uint8Array](https://bun.sh/guides/binary/blob-to-typedarray)
- [Convert a Blob to an ArrayBuffer](https://bun.sh/guides/binary/blob-to-arraybuffer)
- [Convert a Buffer to a blob](https://bun.sh/guides/binary/buffer-to-blob)
- [Convert a Buffer to a ReadableStream](https://bun.sh/guides/binary/buffer-to-readablestream)
- [Convert a Buffer to a string](https://bun.sh/guides/binary/buffer-to-string)
- [Convert a Buffer to a Uint8Array](https://bun.sh/guides/binary/buffer-to-typedarray)
- [Convert a Buffer to an ArrayBuffer](https://bun.sh/guides/binary/buffer-to-arraybuffer)
- [Convert a DataView to a string](https://bun.sh/guides/binary/dataview-to-string)
- [Convert a Uint8Array to a Blob](https://bun.sh/guides/binary/typedarray-to-blob)
- [Convert a Uint8Array to a Buffer](https://bun.sh/guides/binary/typedarray-to-buffer)
- [Convert a Uint8Array to a DataView](https://bun.sh/guides/binary/typedarray-to-dataview)
- [Convert a Uint8Array to a ReadableStream](https://bun.sh/guides/binary/typedarray-to-readablestream)
- [Convert a Uint8Array to a string](https://bun.sh/guides/binary/typedarray-to-string)
- [Convert a Uint8Array to an ArrayBuffer](https://bun.sh/guides/binary/typedarray-to-arraybuffer)
- [Convert an ArrayBuffer to a Blob](https://bun.sh/guides/binary/arraybuffer-to-blob)
- [Convert an ArrayBuffer to a Buffer](https://bun.sh/guides/binary/arraybuffer-to-buffer)
- [Convert an ArrayBuffer to a string](https://bun.sh/guides/binary/arraybuffer-to-string)
- [Convert an ArrayBuffer to a Uint8Array](https://bun.sh/guides/binary/arraybuffer-to-typedarray)
- [Convert an ArrayBuffer to an array of numbers](https://bun.sh/guides/binary/arraybuffer-to-array)
- Ecosystem
- [Build a frontend using Vite and Bun](https://bun.sh/guides/ecosystem/vite)
- [Build an app with Astro and Bun](https://bun.sh/guides/ecosystem/astro)
- [Build an app with Next.js and Bun](https://bun.sh/guides/ecosystem/nextjs)
- [Build an app with Nuxt and Bun](https://bun.sh/guides/ecosystem/nuxt)
- [Build an app with Qwik and Bun](https://bun.sh/guides/ecosystem/qwik)
- [Build an app with Remix and Bun](https://bun.sh/guides/ecosystem/remix)
- [Build an app with SolidStart and Bun](https://bun.sh/guides/ecosystem/solidstart)
- [Build an app with SvelteKit and Bun](https://bun.sh/guides/ecosystem/sveltekit)
- [Build an HTTP server using Elysia and Bun](https://bun.sh/guides/ecosystem/elysia)
- [Build an HTTP server using Express and Bun](https://bun.sh/guides/ecosystem/express)
- [Build an HTTP server using Hono and Bun](https://bun.sh/guides/ecosystem/hono)
- [Build an HTTP server using StricJS and Bun](https://bun.sh/guides/ecosystem/stric)
- [Containerize a Bun application with Docker](https://bun.sh/guides/ecosystem/docker)
- [Create a Discord bot](https://bun.sh/guides/ecosystem/discordjs)
- [Deploy a Bun application on Render](https://bun.sh/guides/ecosystem/render)
- [Read and write data to MongoDB using Mongoose and Bun](https://bun.sh/guides/ecosystem/mongoose)
- [Run Bun as a daemon with PM2](https://bun.sh/guides/ecosystem/pm2)
- [Run Bun as a daemon with systemd](https://bun.sh/guides/ecosystem/systemd)
- [Server-side render (SSR) a React component](https://bun.sh/guides/ecosystem/ssr-react)
- [Use Drizzle ORM with Bun](https://bun.sh/guides/ecosystem/drizzle)
- [Use EdgeDB with Bun](https://bun.sh/guides/ecosystem/edgedb)
- [Use Neon's Serverless Postgres with Bun](https://bun.sh/guides/ecosystem/neon-serverless-postgres)
- [Use Prisma with Bun](https://bun.sh/guides/ecosystem/prisma)
- [Use React and JSX](https://bun.sh/guides/ecosystem/react)
- [Add Sentry to a Bun app](https://bun.sh/guides/ecosystem/sentry)
- HTTP
- [Common HTTP server usage](https://bun.sh/guides/http/server)
- [Configure TLS on an HTTP server](https://bun.sh/guides/http/tls)
- [fetch with unix domain sockets in Bun](https://bun.sh/guides/http/fetch-unix)
- [Hot reload an HTTP server](https://bun.sh/guides/http/hot)
- [Proxy HTTP requests using fetch()](https://bun.sh/guides/http/proxy)
- [Send an HTTP request using fetch](https://bun.sh/guides/http/fetch)
- [Start a cluster of HTTP servers](https://bun.sh/guides/http/cluster)
- [Stream a file as an HTTP Response](https://bun.sh/guides/http/stream-file)
- [Streaming HTTP Server with Async Iterators](https://bun.sh/guides/http/stream-iterator)
- [Streaming HTTP Server with Node.js Streams](https://bun.sh/guides/http/stream-node-streams-in-bun)
- [Upload files via HTTP using FormData](https://bun.sh/guides/http/file-uploads)
- [Write a simple HTTP server](https://bun.sh/guides/http/simple)
- Install
- [Add a dependency](https://bun.sh/guides/install/add)
- [Add a development dependency](https://bun.sh/guides/install/add-dev)
- [Add a Git dependency](https://bun.sh/guides/install/add-git)
- [Add a peer dependency](https://bun.sh/guides/install/add-peer)
- [Add a tarball dependency](https://bun.sh/guides/install/add-tarball)
- [Add a trusted dependency](https://bun.sh/guides/install/trusted)
- [Add an optional dependency](https://bun.sh/guides/install/add-optional)
- [Configure a private registry for an organization scope with bun install](https://bun.sh/guides/install/registry-scope)
- [Configure git to diff Bun's lockb lockfile](https://bun.sh/guides/install/git-diff-bun-lockfile)
- [Configuring a monorepo using workspaces](https://bun.sh/guides/install/workspaces)
- [Generate a human-readable lockfile](https://bun.sh/guides/install/yarnlock)
- [Install a package under a different name](https://bun.sh/guides/install/npm-alias)
- [Install dependencies with Bun in GitHub Actions](https://bun.sh/guides/install/cicd)
- [Override the default npm registry for bun install](https://bun.sh/guides/install/custom-registry)
- [Using bun install with an Azure Artifacts npm registry](https://bun.sh/guides/install/azure-artifacts)
- [Using bun install with Artifactory](https://bun.sh/guides/install/jfrog-artifactory)
- Process
- [Get the process uptime in nanoseconds](https://bun.sh/guides/process/nanoseconds)
- [Listen for CTRL+C](https://bun.sh/guides/process/ctrl-c)
- [Listen to OS signals](https://bun.sh/guides/process/os-signals)
- [Parse command-line arguments](https://bun.sh/guides/process/argv)
- [Read from stdin](https://bun.sh/guides/process/stdin)
- [Read stderr from a child process](https://bun.sh/guides/process/spawn-stderr)
- [Read stdout from a child process](https://bun.sh/guides/process/spawn-stdout)
- [Spawn a child process](https://bun.sh/guides/process/spawn)
- [Spawn a child process and communicate using IPC](https://bun.sh/guides/process/ipc)
- Read file
- [Check if a file exists](https://bun.sh/guides/read-file/exists)
- [Get the MIME type of a file](https://bun.sh/guides/read-file/mime)
- [Read a file as a ReadableStream](https://bun.sh/guides/read-file/stream)
- [Read a file as a string](https://bun.sh/guides/read-file/string)
- [Read a file to a Buffer](https://bun.sh/guides/read-file/buffer)
- [Read a file to a Uint8Array](https://bun.sh/guides/read-file/uint8array)
- [Read a file to an ArrayBuffer](https://bun.sh/guides/read-file/arraybuffer)
- [Read a JSON file](https://bun.sh/guides/read-file/json)
- [Watch a directory for changes](https://bun.sh/guides/read-file/watch)
- Runtime
- [Debugging Bun with the VS Code extension](https://bun.sh/guides/runtime/vscode-debugger)
- [Debugging Bun with the web debugger](https://bun.sh/guides/runtime/web-debugger)
- [Define and replace static globals & constants](https://bun.sh/guides/runtime/define-constant)
- [Import a JSON file](https://bun.sh/guides/runtime/import-json)
- [Import a TOML file](https://bun.sh/guides/runtime/import-toml)
- [Import HTML file as text](https://bun.sh/guides/runtime/import-html)
- [Install and run Bun in GitHub Actions](https://bun.sh/guides/runtime/cicd)
- [Install TypeScript declarations for Bun](https://bun.sh/guides/runtime/typescript)
- [Re-map import paths](https://bun.sh/guides/runtime/tsconfig-paths)
- [Read environment variables](https://bun.sh/guides/runtime/read-env)
- [Run a Shell Command](https://bun.sh/guides/runtime/shell)
- [Set a time zone in Bun](https://bun.sh/guides/runtime/timezone)
- [Set environment variables](https://bun.sh/guides/runtime/set-env)
- Streams
- [Convert a Node.js Readable to a Blob](https://bun.sh/guides/streams/node-readable-to-blob)
- [Convert a Node.js Readable to a string](https://bun.sh/guides/streams/node-readable-to-string)
- [Convert a Node.js Readable to an ArrayBuffer](https://bun.sh/guides/streams/node-readable-to-arraybuffer)
- [Convert a Node.js Readable to JSON](https://bun.sh/guides/streams/node-readable-to-json)
- [Convert a ReadableStream to a Blob](https://bun.sh/guides/streams/to-blob)
- [Convert a ReadableStream to a Buffer](https://bun.sh/guides/streams/to-buffer)
- [Convert a ReadableStream to a string](https://bun.sh/guides/streams/to-string)
- [Convert a ReadableStream to a Uint8Array](https://bun.sh/guides/streams/to-typedarray)
- [Convert a ReadableStream to an array of chunks](https://bun.sh/guides/streams/to-array)
- [Convert a ReadableStream to an ArrayBuffer](https://bun.sh/guides/streams/to-arraybuffer)
- [Convert a ReadableStream to JSON](https://bun.sh/guides/streams/to-json)
- Test
- [Bail early with the Bun test runner](https://bun.sh/guides/test/bail)
- [Generate code coverage reports with the Bun test runner](https://bun.sh/guides/test/coverage)
- [Mark a test as a "todo" with the Bun test runner](https://bun.sh/guides/test/todo-tests)
- [Migrate from Jest to Bun's test runner](https://bun.sh/guides/test/migrate-from-jest)
- [Mock functions in `bun test`](https://bun.sh/guides/test/mock-functions)
- [Re-run tests multiple times with the Bun test runner](https://bun.sh/guides/test/rerun-each)
- [Run tests in watch mode with Bun](https://bun.sh/guides/test/watch-mode)
- [Run your tests with the Bun test runner](https://bun.sh/guides/test/run-tests)
- [Set a code coverage threshold with the Bun test runner](https://bun.sh/guides/test/coverage-threshold)
- [Set a per-test timeout with the Bun test runner](https://bun.sh/guides/test/timeout)
- [Set the system time in Bun's test runner](https://bun.sh/guides/test/mock-clock)
- [Skip tests with the Bun test runner](https://bun.sh/guides/test/skip-tests)
- [Spy on methods in `bun test`](https://bun.sh/guides/test/spy-on)
- [Update snapshots in `bun test`](https://bun.sh/guides/test/update-snapshots)
- [Use snapshot testing in `bun test`](https://bun.sh/guides/test/snapshot)
- [Write browser DOM tests with Bun and happy-dom](https://bun.sh/guides/test/happy-dom)
- Util
- [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint)
- [Check if two objects are deeply equal](https://bun.sh/guides/util/deep-equals)
- [Compress and decompress data with DEFLATE](https://bun.sh/guides/util/deflate)
- [Compress and decompress data with gzip](https://bun.sh/guides/util/gzip)
- [Convert a file URL to an absolute path](https://bun.sh/guides/util/file-url-to-path)
- [Convert an absolute path to a file URL](https://bun.sh/guides/util/path-to-file-url)
- [Detect when code is executed with Bun](https://bun.sh/guides/util/detect-bun)
- [Encode and decode base64 strings](https://bun.sh/guides/util/base64)
- [Escape an HTML string](https://bun.sh/guides/util/escape-html)
- [Get the absolute path of the current file](https://bun.sh/guides/util/import-meta-path)
- [Get the absolute path to the current entrypoint](https://bun.sh/guides/util/main)
- [Get the current Bun version](https://bun.sh/guides/util/version)
- [Get the directory of the current file](https://bun.sh/guides/util/import-meta-dir)
- [Get the file name of the current file](https://bun.sh/guides/util/import-meta-file)
- [Get the path to an executable bin file](https://bun.sh/guides/util/which-path-to-executable-bin)
- [Hash a password](https://bun.sh/guides/util/hash-a-password)
- [Sleep for a fixed number of milliseconds](https://bun.sh/guides/util/sleep)
- WebSocket
- [Build a publish-subscribe WebSocket server](https://bun.sh/guides/websocket/pubsub)
- [Build a simple WebSocket server](https://bun.sh/guides/websocket/simple)
- [Enable compression for WebSocket messages](https://bun.sh/guides/websocket/compression)
- [Set per-socket contextual data on a WebSocket](https://bun.sh/guides/websocket/context)
- Write file
- [Append content to a file](https://bun.sh/guides/write-file/append)
- [Copy a file to another location](https://bun.sh/guides/write-file/file-cp)
- [Delete a file](https://bun.sh/guides/write-file/unlink)
- [Write a Blob to a file](https://bun.sh/guides/write-file/blob)
- [Write a file incrementally](https://bun.sh/guides/write-file/filesink)
- [Write a file to stdout](https://bun.sh/guides/write-file/cat)
- [Write a ReadableStream to a file](https://bun.sh/guides/write-file/stream)
- [Write a Response to a file](https://bun.sh/guides/write-file/response)
- [Write a string to a file](https://bun.sh/guides/write-file/basic)
- [Write to stdout](https://bun.sh/guides/write-file/stdout)
## Contributing

Binary file not shown.

View File

@@ -1,7 +1,7 @@
import { bench, run } from "mitata";
import { groupForEmitter } from "./implementations.mjs";
// Psuedo RNG is derived from https://stackoverflow.com/a/424445
// Pseudo RNG is derived from https://stackoverflow.com/a/424445
let rngState = 123456789;
function nextInt() {
const m = 0x80000000; // 2**31;

37
bench/glob/braces.mjs Normal file
View File

@@ -0,0 +1,37 @@
import braces from "braces";
import { group, bench, run } from "mitata";
// const iterations = 1000;
const iterations = 100;
const simplePattern = "foo.{js,jsx,ts,tsx}";
const complexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}} wow {a,b}";
const veryComplexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}}{1,2,{3,4},5}";
console.log(braces(complexPattern, { expand: true }));
function benchPattern(pattern, name) {
group({ name: `${name} pattern: "${pattern}"`, summary: true }, () => {
if (typeof Bun !== "undefined")
bench("Bun", () => {
for (let i = 0; i < iterations; i++) {
Bun.$.braces(pattern);
}
});
bench("micromatch/braces", () => {
for (let i = 0; i < iterations; i++) {
braces(pattern, { expand: true });
}
});
});
}
benchPattern(simplePattern, "simple");
benchPattern(complexPattern, "complex");
benchPattern(veryComplexPattern, "very complex pattern");
await run({
avg: true,
min_max: true,
percentiles: true,
});

19
bench/glob/match.mjs Normal file
View File

@@ -0,0 +1,19 @@
import micromatch from "micromatch";
import { bench, run } from "mitata";
const Glob = typeof Bun !== "undefined" ? Bun.Glob : undefined;
const doMatch = typeof Bun === "undefined" ? micromatch.isMatch : (a, b) => new Glob(b).match(a);
bench((Glob ? "Bun.Glob - " : "micromatch - ") + "**/*.js", () => {
doMatch("foo/bar.js", "**/*.js");
});
bench((Glob ? "Bun.Glob - " : "micromatch - ") + "*.js", () => {
doMatch("bar.js", "*.js");
});
await run({
avg: true,
min_max: true,
percentiles: true,
});

113
bench/glob/scan.mjs Normal file
View File

@@ -0,0 +1,113 @@
import { run, bench, group } from "mitata";
import fg from "fast-glob";
import { fdir } from "fdir";
const normalPattern = "*.ts";
const recursivePattern = "**/*.ts";
const nodeModulesPattern = "**/node_modules/**/*.js";
const benchFdir = false;
const cwd = undefined;
const bunOpts = {
cwd,
followSymlinks: false,
absolute: true,
};
const fgOpts = {
cwd,
followSymbolicLinks: false,
onlyFiles: false,
absolute: true,
};
const Glob = "Bun" in globalThis ? globalThis.Bun.Glob : undefined;
group({ name: `async pattern="${normalPattern}"`, summary: true }, () => {
bench("fast-glob", async () => {
const entries = await fg.glob([normalPattern], fgOpts);
});
if (Glob)
bench("Bun.Glob", async () => {
const entries = await Array.fromAsync(new Glob(normalPattern).scan(bunOpts));
});
if (benchFdir)
bench("fdir", async () => {
const entries = await new fdir().withFullPaths().glob(normalPattern).crawl(process.cwd()).withPromise();
});
});
group({ name: `async-recursive pattern="${recursivePattern}"`, summary: true }, () => {
bench("fast-glob", async () => {
const entries = await fg.glob([recursivePattern], fgOpts);
});
if (Glob)
bench("Bun.Glob", async () => {
const entries = await Array.fromAsync(new Glob(recursivePattern).scan(bunOpts));
});
if (benchFdir)
bench("fdir", async () => {
const entries = await new fdir().withFullPaths().glob(recursivePattern).crawl(process.cwd()).withPromise();
});
});
group({ name: `sync pattern="${normalPattern}"`, summary: true }, () => {
bench("fast-glob", () => {
const entries = fg.globSync([normalPattern], fgOpts);
});
if (Glob)
bench("Bun.Glob", () => {
const entries = [...new Glob(normalPattern).scanSync(bunOpts)];
});
if (benchFdir)
bench("fdir", async () => {
const entries = new fdir().withFullPaths().glob(normalPattern).crawl(process.cwd()).sync();
});
});
group({ name: `sync-recursive pattern="${recursivePattern}"`, summary: true }, () => {
bench("fast-glob", () => {
const entries = fg.globSync([recursivePattern], fgOpts);
});
if (Glob)
bench("Bun.Glob", () => {
const entries = [...new Glob(recursivePattern).scanSync(bunOpts)];
});
if (benchFdir)
bench("fdir", async () => {
const entries = new fdir().withFullPaths().glob(recursivePattern).crawl(process.cwd()).sync();
});
});
group({ name: `node_modules pattern="${nodeModulesPattern}"`, summary: true }, () => {
bench("fast-glob", async () => {
const entries = await fg.glob([nodeModulesPattern], fgOpts);
});
if (Glob)
bench("Bun.Glob", async () => {
const entries = await Array.fromAsync(new Glob(nodeModulesPattern).scan(bunOpts));
});
if (benchFdir)
bench("fdir", async () => {
const entries = await new fdir().withFullPaths().glob(nodeModulesPattern).crawl(process.cwd()).withPromise();
});
});
await run({
avg: true,
colors: false,
min_max: true,
collect: true,
percentiles: true,
});

View File

@@ -1,20 +1,43 @@
import { run, bench } from "mitata";
import { run, bench, group } from "mitata";
import { gzipSync, gunzipSync } from "bun";
const data = new TextEncoder().encode("Hello World!".repeat(9999));
const data = await Bun.file(require.resolve("@babel/standalone/babel.min.js")).arrayBuffer();
const compressed = gzipSync(data);
bench(`roundtrip - "Hello World!".repeat(9999))`, () => {
gunzipSync(gzipSync(data));
const libraries = ["zlib"];
if (Bun.semver.satisfies(Bun.version.replaceAll("-debug", ""), ">=1.1.21")) {
libraries.push("libdeflate");
}
const options = { library: undefined };
const benchFn = (name, fn) => {
if (libraries.length > 1) {
group(name, () => {
for (const library of libraries) {
bench(library, () => {
options.library = library;
fn();
});
}
});
} else {
options.library = libraries[0];
bench(name, () => {
fn();
});
}
};
benchFn(`roundtrip - @babel/standalone/babel.min.js`, () => {
gunzipSync(gzipSync(data, options), options);
});
bench(`gzipSync("Hello World!".repeat(9999)))`, () => {
gzipSync(data);
benchFn(`gzipSync(@babel/standalone/babel.min.js`, () => {
gzipSync(data, options);
});
bench(`gunzipSync("Hello World!".repeat(9999)))`, () => {
gunzipSync(compressed);
benchFn(`gunzipSync(@babel/standalone/babel.min.js`, () => {
gunzipSync(compressed, options);
});
await run();

BIN
bench/gzip/bun.lockb Executable file

Binary file not shown.

View File

@@ -1,19 +1,22 @@
import { run, bench } from "mitata";
import { gzipSync, gunzipSync } from "zlib";
import { createRequire } from "module";
import { readFileSync } from "fs";
const data = new TextEncoder().encode("Hello World!".repeat(9999));
const require = createRequire(import.meta.url);
const data = readFileSync(require.resolve("@babel/standalone/babel.min.js"));
const compressed = gzipSync(data);
bench(`roundtrip - "Hello World!".repeat(9999))`, () => {
bench(`roundtrip - @babel/standalone/babel.min.js)`, () => {
gunzipSync(gzipSync(data));
});
bench(`gzipSync("Hello World!".repeat(9999)))`, () => {
bench(`gzipSync(@babel/standalone/babel.min.js))`, () => {
gzipSync(data);
});
bench(`gunzipSync("Hello World!".repeat(9999)))`, () => {
bench(`gunzipSync(@babel/standalone/babel.min.js))`, () => {
gunzipSync(compressed);
});

View File

@@ -7,5 +7,8 @@
"bench:node": "$NODE node.mjs",
"bench:deno": "$DENO run -A --unstable deno.js",
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
},
"dependencies": {
"@babel/standalone": "7.24.10"
}
}

View File

@@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
// 1. file path
// 2. Byte offset in file
// 3. ms update interval
var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined;
var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined;
pub fn main() anyerror!void {
var allocator = std.heap.c_allocator;

View File

@@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
// 1. file path
// 2. Byte offset in file
// 3. ms update interval
var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined;
var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined;
pub fn main() anyerror!void {
var allocator = std.heap.c_allocator;

View File

@@ -7,280 +7,166 @@
"version": "0.0.34"
},
"timestamps": [
16336202536562, 16336202536908, 16336202537294, 16336202537705,
16336202538114, 16336202538534, 16336202538941, 16336202539323,
16336202539742, 16336202540159, 16336202540877, 16336202541310,
16336202541749, 16336202542159, 16336202542565, 16336202542996,
16336202543333, 16336202543761, 16336202544159, 16336202544534,
16336202544944, 16336202545345, 16336202545744, 16336202546159,
16336202546573, 16336202546986, 16336202547399, 16336202547781,
16336202548202, 16336202548564, 16336202548949, 16336202549329,
16336202549762, 16336202550168, 16336202550534, 16336202550887,
16336202551305, 16336202551659, 16336202552060, 16336202552449,
16336202552854, 16336202553270, 16336202553609, 16336202554034,
16336202554437, 16336202554783, 16336202555191, 16336202555623,
16336202556034, 16336202556449, 16336202556890, 16336202557283,
16336202557669, 16336202558084, 16336202558496, 16336202558863,
16336202559271, 16336202559659, 16336202560051, 16336202560452,
16336202560873, 16336202561290, 16336202561659, 16336202562035,
16336202562440, 16336202562862, 16336202563284, 16336202563659,
16336202564034, 16336202564444, 16336202564853, 16336202565245,
16336202565659, 16336202566034, 16336202566455, 16336202566873,
16336202567284, 16336202567659, 16336202568034, 16336202568386,
16336202568790, 16336202569204, 16336202569620, 16336202570384,
16336202570768, 16336202571188, 16336202571551, 16336202572327,
16336202572717, 16336202573116, 16336202573541, 16336202573959,
16336202574319, 16336202574682, 16336202575040, 16336202575375,
16336202577001, 16336202577342, 16336202577680, 16336202578066,
16336202578451, 16336202579166, 16336202579534, 16336202579960,
16336202580370, 16336202580789, 16336202581159, 16336202581576,
16336202581949, 16336202582294, 16336202583087, 16336202583496,
16336202583858, 16336202584203, 16336202584606, 16336202585034,
16336202585386, 16336202585788, 16336202586211, 16336202586604,
16336202587034, 16336202587459, 16336202587869, 16336202588295,
16336202588668, 16336202589092, 16336202589452, 16336202589831,
16336202590197, 16336202590608, 16336202591034, 16336202591460,
16336202591880, 16336202592295, 16336202592727, 16336202593172,
16336202593567, 16336202593994, 16336202594397, 16336202594795,
16336202595224, 16336202595659, 16336202596058, 16336202596463,
16336202596890, 16336202597322, 16336202597732, 16336202598159,
16336202598534, 16336202598951, 16336202599365, 16336202599785,
16336202600159, 16336202600593, 16336202601005, 16336202601402,
16336202601807, 16336202602214, 16336202602556, 16336202602895,
16336202603307, 16336202603661, 16336202604075, 16336202604491,
16336202604853, 16336202605268, 16336202605670, 16336202606034,
16336202606393, 16336202606748, 16336202607170, 16336202607568,
16336202607982, 16336202608411, 16336202608836, 16336202609197,
16336202609596, 16336202609965, 16336202610333, 16336202610740,
16336202611159, 16336202611573, 16336202611975, 16336202612317,
16336202612691, 16336202613060, 16336202613474, 16336202613903,
16336202614341, 16336202614707, 16336202615094, 16336202615534,
16336202615883, 16336202616296, 16336202616671, 16336202617034,
16336202617391, 16336202617727, 16336202618159, 16336202618534,
16336202618937, 16336202619360, 16336202619770, 16336202620179,
16336202620716, 16336202621143, 16336202621534, 16336202622303,
16336202622659, 16336202623085, 16336202623498, 16336202623850,
16336202624220, 16336202624606, 16336202625034, 16336202625387,
16336202625805, 16336202626210, 16336202626599, 16336202627034,
16336202627386, 16336202627748, 16336202628159, 16336202628534,
16336202628954, 16336202629373, 16336202629809, 16336202630197,
16336202630535, 16336202630916, 16336202631290, 16336202631666,
16336202632034, 16336202632369, 16336202633152, 16336202633534,
16336202633883, 16336202634309, 16336202634717, 16336202635106,
16336202635871, 16336202636253, 16336202636671, 16336202637070,
16336202637434, 16336202637798, 16336202638184, 16336202638539,
16336202638938, 16336202639307, 16336202639666, 16336202640095,
16336202640534, 16336202640962, 16336202641307, 16336202641659,
16336202642087, 16336202642521, 16336202642886, 16336202643309,
16336202643662, 16336202644067, 16336202644491, 16336202644853,
16336202645226, 16336202645659, 16336202646074, 16336202646497,
16336202646890, 16336202647311, 16336202647749, 16336202648169,
16336202648976, 16336202649378, 16336202649810, 16336202650165,
16336202650534, 16336202650875, 16336202651250, 16336202651659,
16336202652093, 16336202652516, 16336202652921, 16336202653332,
16336202653722, 16336202654142, 16336202654534, 16336202654880,
16336202655221, 16336202655562, 16336202655997, 16336202656378,
16336202656811, 16336202657161, 16336202657588, 16336202657944,
16336202658360, 16336202658708, 16336202659089, 16336202659428,
16336202659849, 16336202660273, 16336202660685, 16336202661105,
16336202661534, 16336202661873, 16336202662228, 16336202662658,
16336202663438, 16336202663843, 16336202664219, 16336202664646,
16336202665050, 16336202665487, 16336202665838, 16336202666211,
16336202666573, 16336202666927, 16336202667334, 16336202667746,
16336202668158, 16336202668563, 16336202668980, 16336202669406,
16336202669753, 16336202670192, 16336202670554, 16336202670903,
16336202671324, 16336202671734, 16336202672159, 16336202672573,
16336202672982, 16336202673346, 16336202673680, 16336202674087,
16336202674499, 16336202674909, 16336202675260, 16336202676110,
16336202676535, 16336202676913, 16336202677312, 16336202677658,
16336202678044, 16336202678413, 16336202678793, 16336202679208,
16336202679604, 16336202680034, 16336202680385, 16336202680799,
16336202681213, 16336202681595, 16336202682004, 16336202682346,
16336202682726, 16336202683158, 16336202683586, 16336202683990,
16336202684323, 16336202684742, 16336202685175, 16336202685578,
16336202685979, 16336202686805, 16336202687206, 16336202687614,
16336202688038, 16336202688473, 16336202688848, 16336202689221,
16336202689559, 16336202689971, 16336202690368, 16336202690776,
16336202691159, 16336202691585, 16336202692010, 16336202692373,
16336202692780, 16336202693179, 16336202693580, 16336202693991,
16336202694324, 16336202694727, 16336202695159, 16336202695588,
16336202695991, 16336202696335, 16336202697160, 16336202697542,
16336202697929, 16336202698323, 16336202698674, 16336202699060,
16336202699492, 16336202699835, 16336202700238, 16336202700658,
16336202701059, 16336202701420, 16336202701815, 16336202702229,
16336202702659, 16336202703857, 16336202704256, 16336202704659,
16336202705497, 16336202706309, 16336202706660, 16336202707085,
16336202707511, 16336202707866, 16336202708210, 16336202708552,
16336202708925, 16336202709287, 16336202709670, 16336202710045,
16336202710402, 16336202710802, 16336202711167, 16336202711533,
16336202712249, 16336202712660, 16336202713088, 16336202713519,
16336202713936, 16336202714355, 16336202714740, 16336202715160,
16336202715533, 16336202715878, 16336202716290, 16336202716708,
16336202717102, 16336202718290, 16336202718699, 16336202719052,
16336202719388, 16336202719808, 16336202720225, 16336202720659,
16336202721052, 16336202721414, 16336202721828, 16336202722925,
16336202723664, 16336202724063, 16336202724405, 16336202726003,
16336202726736, 16336202727158, 16336202727543, 16336202727930,
16336202728336, 16336202728703, 16336202729061, 16336202729483,
16336202729832, 16336202730222, 16336202730659, 16336202731084,
16336202731500, 16336202731911, 16336202732326, 16336202733158,
16336202733585, 16336202734001, 16336202734691, 16336202735042,
16336202735442, 16336202735863, 16336202736255, 16336202736671,
16336202737043, 16336202737884, 16336202738671, 16336202739110,
16336202739533, 16336202739886, 16336202740283, 16336202740706,
16336202741143, 16336202741534, 16336202741942, 16336202742352,
16336202742697, 16336202743103, 16336202743940, 16336202745172,
16336202745542, 16336202745937, 16336202746339, 16336202746758,
16336202747531, 16336202747877, 16336202748232, 16336202748658,
16336202749055, 16336202749468, 16336202749859, 16336202750416,
16336202750839, 16336202751178, 16336202751572, 16336202752002,
16336202752419, 16336202753269, 16336202753678, 16336202754086,
16336202754432, 16336202754835, 16336202755260, 16336202755683,
16336202756059, 16336202756402, 16336202756837, 16336202758084,
16336202758507, 16336202758879, 16336202759270, 16336202759674,
16336202760044, 16336202760400, 16336202760801, 16336202761659,
16336202762053, 16336202762397, 16336202763199, 16336202763547,
16336202763948, 16336202764714, 16336202765113, 16336202765947,
16336202766329, 16336202766664, 16336202767085, 16336202768233,
16336202769056, 16336202769758, 16336202770178, 16336202770585,
16336202770929, 16336202771325, 16336202772158, 16336202772594,
16336202773033, 16336202773403, 16336202773801, 16336202774179,
16336202774555, 16336202774989, 16336202775393, 16336202775809,
16336202776209, 16336202776618, 16336202777033, 16336202777421,
16336202777845, 16336202778246, 16336202778658, 16336202779055,
16336202779411, 16336202779761, 16336202780175, 16336202780594,
16336202781002, 16336202781848, 16336202782658, 16336202783033,
16336202783857, 16336202784211, 16336202784557, 16336202784972,
16336202785377, 16336202785810, 16336202786172, 16336202786934,
16336202787343, 16336202787765, 16336202788201, 16336202788563,
16336202788970, 16336202789329, 16336202789672, 16336202790055,
16336202790456, 16336202790802, 16336202791580, 16336202791920,
16336202792326, 16336202793158, 16336202793953, 16336202794368,
16336202795187, 16336202795622, 16336202796033, 16336202796393,
16336202796777, 16336202797173, 16336202797540, 16336202797975,
16336202798317, 16336202798739, 16336202799158, 16336202799567,
16336202799966, 16336202800378, 16336202800803, 16336202801232,
16336202801658, 16336202802033, 16336202802374, 16336202802759,
16336202803158, 16336202803533, 16336202803947, 16336202804354,
16336202804729, 16336202805158, 16336202805534, 16336202805950,
16336202806390, 16336202806805, 16336202807219, 16336202807643,
16336202808033, 16336202808377, 16336202808790, 16336202809211,
16336202809560, 16336202809920, 16336202810355, 16336202810758,
16336202811187, 16336202811596, 16336202811943, 16336202812348,
16336202812710, 16336202813060, 16336202813398, 16336202813791,
16336202814158, 16336202814533, 16336202814878, 16336202815246,
16336202815658, 16336202816079, 16336202816851, 16336202817202,
16336202817540, 16336202817905, 16336202818244, 16336202818663,
16336202819068, 16336202819418, 16336202819777, 16336202820193,
16336202820599, 16336202821033, 16336202821395, 16336202821745,
16336202822158, 16336202822590, 16336202822996, 16336202823396,
16336202823804, 16336202824210, 16336202824581, 16336202824991,
16336202825406, 16336202825806, 16336202826210, 16336202826598,
16336202827033, 16336202827446, 16336202827839, 16336202828201,
16336202828577, 16336202828968, 16336202829362, 16336202829709,
16336202830096, 16336202830533, 16336202830917, 16336202831290,
16336202831699, 16336202832035, 16336202832406, 16336202832804,
16336202833200, 16336202833604, 16336202834033, 16336202834386,
16336202834759, 16336202835190, 16336202835621, 16336202836033,
16336202836405, 16336202837191, 16336202837613, 16336202838033,
16336202838374, 16336202838798, 16336202839200, 16336202839603,
16336202840034, 16336202840389, 16336202840783, 16336202841200,
16336202841617, 16336202842034, 16336202842390, 16336202842737,
16336202843158, 16336202843585, 16336202843923, 16336202844313,
16336202844724, 16336202845158, 16336202845576, 16336202845939,
16336202846368, 16336202846728, 16336202847158, 16336202847568,
16336202847911, 16336202848291, 16336202848695, 16336202849103,
16336202849533, 16336202849942, 16336202850368, 16336202850747,
16336202851158, 16336202851549, 16336202851978, 16336202852383,
16336202852725, 16336202853158, 16336202853554, 16336202853961,
16336202854308, 16336202854704, 16336202855060, 16336202855418,
16336202855776, 16336202856203, 16336202856617, 16336202857036,
16336202857455, 16336202857884, 16336202858262, 16336202858658,
16336202859071, 16336202859847, 16336202860237, 16336202860658,
16336202861037, 16336202861452, 16336202861869, 16336202862218,
16336202862590, 16336202863001, 16336202863422, 16336202863857,
16336202864219, 16336202864658, 16336202865047, 16336202865404,
16336202865789, 16336202866210, 16336202866624, 16336202867033,
16336202867380, 16336202867797, 16336202868227, 16336202868658,
16336202869083, 16336202869500, 16336202869906, 16336202870246,
16336202870658, 16336202871086, 16336202871441, 16336202871820,
16336202872204, 16336202872546, 16336202872943, 16336202873380,
16336202873811, 16336202874213, 16336202874566, 16336202874918,
16336202875261, 16336202875655, 16336202876047, 16336202876771,
16336202877202, 16336202877612, 16336202878033, 16336202878412,
16336202878846, 16336202879241, 16336202879658, 16336202880072,
16336202880508, 16336202880901, 16336202881308, 16336202881725,
16336202882158, 16336202882579, 16336202882945, 16336202883286,
16336202883657, 16336202884048, 16336202884404, 16336202884752,
16336202885158, 16336202885533, 16336202885938, 16336202886364,
16336202886759, 16336202887175, 16336202887585, 16336202887929,
16336202888345, 16336202888743, 16336202889157, 16336202889570,
16336202889970, 16336202890382, 16336202890761, 16336202891187,
16336202891600, 16336202892033, 16336202892454, 16336202892794,
16336202893178, 16336202893533, 16336202893903, 16336202894264,
16336202894668, 16336202895049, 16336202895400, 16336202895774,
16336202896157, 16336202896537, 16336202896883, 16336202897232,
16336202897658, 16336202898065, 16336202898493, 16336202898884,
16336202899251, 16336202899673, 16336202900047, 16336202900467,
16336202900883, 16336202901300, 16336202901676, 16336202902068,
16336202902479, 16336202902902, 16336202903260, 16336202903675,
16336202904094, 16336202904476, 16336202904824, 16336202905158,
16336202905533, 16336202905934, 16336202906289, 16336202906717,
16336202907158, 16336202907547, 16336202907904, 16336202908294,
16336202908717, 16336202909157, 16336202909582, 16336202910005,
16336202910399, 16336202910800, 16336202911220, 16336202911657,
16336202912064, 16336202912405, 16336202912779, 16336202913158,
16336202913553, 16336202913966, 16336202914376, 16336202914719,
16336202915091, 16336202915515, 16336202915887, 16336202916293,
16336202916649, 16336202917438, 16336202917869, 16336202918221,
16336202919053, 16336202919425, 16336202919833, 16336202920234,
16336202920658, 16336202921033, 16336202921433, 16336202921801,
16336202922161, 16336202922589, 16336202923017, 16336202923418,
16336202923804, 16336202924199, 16336202924593, 16336202925033,
16336202925449, 16336202925818, 16336202926223, 16336202926662,
16336202927431, 16336202927812, 16336202928227, 16336202928658,
16336202929061, 16336202929473, 16336202929891, 16336202930241,
16336202930657, 16336202931057, 16336202931396, 16336202931811,
16336202932225, 16336202932657, 16336202933058, 16336202933445,
16336202933790, 16336202934157, 16336202934562, 16336202934988,
16336202935391, 16336202935777, 16336202936160, 16336202936562,
16336202936986, 16336202937396, 16336202937751, 16336202938158,
16336202938578, 16336202938985, 16336202939396, 16336202939752,
16336202940157, 16336202940585
16336202536562, 16336202536908, 16336202537294, 16336202537705, 16336202538114, 16336202538534, 16336202538941,
16336202539323, 16336202539742, 16336202540159, 16336202540877, 16336202541310, 16336202541749, 16336202542159,
16336202542565, 16336202542996, 16336202543333, 16336202543761, 16336202544159, 16336202544534, 16336202544944,
16336202545345, 16336202545744, 16336202546159, 16336202546573, 16336202546986, 16336202547399, 16336202547781,
16336202548202, 16336202548564, 16336202548949, 16336202549329, 16336202549762, 16336202550168, 16336202550534,
16336202550887, 16336202551305, 16336202551659, 16336202552060, 16336202552449, 16336202552854, 16336202553270,
16336202553609, 16336202554034, 16336202554437, 16336202554783, 16336202555191, 16336202555623, 16336202556034,
16336202556449, 16336202556890, 16336202557283, 16336202557669, 16336202558084, 16336202558496, 16336202558863,
16336202559271, 16336202559659, 16336202560051, 16336202560452, 16336202560873, 16336202561290, 16336202561659,
16336202562035, 16336202562440, 16336202562862, 16336202563284, 16336202563659, 16336202564034, 16336202564444,
16336202564853, 16336202565245, 16336202565659, 16336202566034, 16336202566455, 16336202566873, 16336202567284,
16336202567659, 16336202568034, 16336202568386, 16336202568790, 16336202569204, 16336202569620, 16336202570384,
16336202570768, 16336202571188, 16336202571551, 16336202572327, 16336202572717, 16336202573116, 16336202573541,
16336202573959, 16336202574319, 16336202574682, 16336202575040, 16336202575375, 16336202577001, 16336202577342,
16336202577680, 16336202578066, 16336202578451, 16336202579166, 16336202579534, 16336202579960, 16336202580370,
16336202580789, 16336202581159, 16336202581576, 16336202581949, 16336202582294, 16336202583087, 16336202583496,
16336202583858, 16336202584203, 16336202584606, 16336202585034, 16336202585386, 16336202585788, 16336202586211,
16336202586604, 16336202587034, 16336202587459, 16336202587869, 16336202588295, 16336202588668, 16336202589092,
16336202589452, 16336202589831, 16336202590197, 16336202590608, 16336202591034, 16336202591460, 16336202591880,
16336202592295, 16336202592727, 16336202593172, 16336202593567, 16336202593994, 16336202594397, 16336202594795,
16336202595224, 16336202595659, 16336202596058, 16336202596463, 16336202596890, 16336202597322, 16336202597732,
16336202598159, 16336202598534, 16336202598951, 16336202599365, 16336202599785, 16336202600159, 16336202600593,
16336202601005, 16336202601402, 16336202601807, 16336202602214, 16336202602556, 16336202602895, 16336202603307,
16336202603661, 16336202604075, 16336202604491, 16336202604853, 16336202605268, 16336202605670, 16336202606034,
16336202606393, 16336202606748, 16336202607170, 16336202607568, 16336202607982, 16336202608411, 16336202608836,
16336202609197, 16336202609596, 16336202609965, 16336202610333, 16336202610740, 16336202611159, 16336202611573,
16336202611975, 16336202612317, 16336202612691, 16336202613060, 16336202613474, 16336202613903, 16336202614341,
16336202614707, 16336202615094, 16336202615534, 16336202615883, 16336202616296, 16336202616671, 16336202617034,
16336202617391, 16336202617727, 16336202618159, 16336202618534, 16336202618937, 16336202619360, 16336202619770,
16336202620179, 16336202620716, 16336202621143, 16336202621534, 16336202622303, 16336202622659, 16336202623085,
16336202623498, 16336202623850, 16336202624220, 16336202624606, 16336202625034, 16336202625387, 16336202625805,
16336202626210, 16336202626599, 16336202627034, 16336202627386, 16336202627748, 16336202628159, 16336202628534,
16336202628954, 16336202629373, 16336202629809, 16336202630197, 16336202630535, 16336202630916, 16336202631290,
16336202631666, 16336202632034, 16336202632369, 16336202633152, 16336202633534, 16336202633883, 16336202634309,
16336202634717, 16336202635106, 16336202635871, 16336202636253, 16336202636671, 16336202637070, 16336202637434,
16336202637798, 16336202638184, 16336202638539, 16336202638938, 16336202639307, 16336202639666, 16336202640095,
16336202640534, 16336202640962, 16336202641307, 16336202641659, 16336202642087, 16336202642521, 16336202642886,
16336202643309, 16336202643662, 16336202644067, 16336202644491, 16336202644853, 16336202645226, 16336202645659,
16336202646074, 16336202646497, 16336202646890, 16336202647311, 16336202647749, 16336202648169, 16336202648976,
16336202649378, 16336202649810, 16336202650165, 16336202650534, 16336202650875, 16336202651250, 16336202651659,
16336202652093, 16336202652516, 16336202652921, 16336202653332, 16336202653722, 16336202654142, 16336202654534,
16336202654880, 16336202655221, 16336202655562, 16336202655997, 16336202656378, 16336202656811, 16336202657161,
16336202657588, 16336202657944, 16336202658360, 16336202658708, 16336202659089, 16336202659428, 16336202659849,
16336202660273, 16336202660685, 16336202661105, 16336202661534, 16336202661873, 16336202662228, 16336202662658,
16336202663438, 16336202663843, 16336202664219, 16336202664646, 16336202665050, 16336202665487, 16336202665838,
16336202666211, 16336202666573, 16336202666927, 16336202667334, 16336202667746, 16336202668158, 16336202668563,
16336202668980, 16336202669406, 16336202669753, 16336202670192, 16336202670554, 16336202670903, 16336202671324,
16336202671734, 16336202672159, 16336202672573, 16336202672982, 16336202673346, 16336202673680, 16336202674087,
16336202674499, 16336202674909, 16336202675260, 16336202676110, 16336202676535, 16336202676913, 16336202677312,
16336202677658, 16336202678044, 16336202678413, 16336202678793, 16336202679208, 16336202679604, 16336202680034,
16336202680385, 16336202680799, 16336202681213, 16336202681595, 16336202682004, 16336202682346, 16336202682726,
16336202683158, 16336202683586, 16336202683990, 16336202684323, 16336202684742, 16336202685175, 16336202685578,
16336202685979, 16336202686805, 16336202687206, 16336202687614, 16336202688038, 16336202688473, 16336202688848,
16336202689221, 16336202689559, 16336202689971, 16336202690368, 16336202690776, 16336202691159, 16336202691585,
16336202692010, 16336202692373, 16336202692780, 16336202693179, 16336202693580, 16336202693991, 16336202694324,
16336202694727, 16336202695159, 16336202695588, 16336202695991, 16336202696335, 16336202697160, 16336202697542,
16336202697929, 16336202698323, 16336202698674, 16336202699060, 16336202699492, 16336202699835, 16336202700238,
16336202700658, 16336202701059, 16336202701420, 16336202701815, 16336202702229, 16336202702659, 16336202703857,
16336202704256, 16336202704659, 16336202705497, 16336202706309, 16336202706660, 16336202707085, 16336202707511,
16336202707866, 16336202708210, 16336202708552, 16336202708925, 16336202709287, 16336202709670, 16336202710045,
16336202710402, 16336202710802, 16336202711167, 16336202711533, 16336202712249, 16336202712660, 16336202713088,
16336202713519, 16336202713936, 16336202714355, 16336202714740, 16336202715160, 16336202715533, 16336202715878,
16336202716290, 16336202716708, 16336202717102, 16336202718290, 16336202718699, 16336202719052, 16336202719388,
16336202719808, 16336202720225, 16336202720659, 16336202721052, 16336202721414, 16336202721828, 16336202722925,
16336202723664, 16336202724063, 16336202724405, 16336202726003, 16336202726736, 16336202727158, 16336202727543,
16336202727930, 16336202728336, 16336202728703, 16336202729061, 16336202729483, 16336202729832, 16336202730222,
16336202730659, 16336202731084, 16336202731500, 16336202731911, 16336202732326, 16336202733158, 16336202733585,
16336202734001, 16336202734691, 16336202735042, 16336202735442, 16336202735863, 16336202736255, 16336202736671,
16336202737043, 16336202737884, 16336202738671, 16336202739110, 16336202739533, 16336202739886, 16336202740283,
16336202740706, 16336202741143, 16336202741534, 16336202741942, 16336202742352, 16336202742697, 16336202743103,
16336202743940, 16336202745172, 16336202745542, 16336202745937, 16336202746339, 16336202746758, 16336202747531,
16336202747877, 16336202748232, 16336202748658, 16336202749055, 16336202749468, 16336202749859, 16336202750416,
16336202750839, 16336202751178, 16336202751572, 16336202752002, 16336202752419, 16336202753269, 16336202753678,
16336202754086, 16336202754432, 16336202754835, 16336202755260, 16336202755683, 16336202756059, 16336202756402,
16336202756837, 16336202758084, 16336202758507, 16336202758879, 16336202759270, 16336202759674, 16336202760044,
16336202760400, 16336202760801, 16336202761659, 16336202762053, 16336202762397, 16336202763199, 16336202763547,
16336202763948, 16336202764714, 16336202765113, 16336202765947, 16336202766329, 16336202766664, 16336202767085,
16336202768233, 16336202769056, 16336202769758, 16336202770178, 16336202770585, 16336202770929, 16336202771325,
16336202772158, 16336202772594, 16336202773033, 16336202773403, 16336202773801, 16336202774179, 16336202774555,
16336202774989, 16336202775393, 16336202775809, 16336202776209, 16336202776618, 16336202777033, 16336202777421,
16336202777845, 16336202778246, 16336202778658, 16336202779055, 16336202779411, 16336202779761, 16336202780175,
16336202780594, 16336202781002, 16336202781848, 16336202782658, 16336202783033, 16336202783857, 16336202784211,
16336202784557, 16336202784972, 16336202785377, 16336202785810, 16336202786172, 16336202786934, 16336202787343,
16336202787765, 16336202788201, 16336202788563, 16336202788970, 16336202789329, 16336202789672, 16336202790055,
16336202790456, 16336202790802, 16336202791580, 16336202791920, 16336202792326, 16336202793158, 16336202793953,
16336202794368, 16336202795187, 16336202795622, 16336202796033, 16336202796393, 16336202796777, 16336202797173,
16336202797540, 16336202797975, 16336202798317, 16336202798739, 16336202799158, 16336202799567, 16336202799966,
16336202800378, 16336202800803, 16336202801232, 16336202801658, 16336202802033, 16336202802374, 16336202802759,
16336202803158, 16336202803533, 16336202803947, 16336202804354, 16336202804729, 16336202805158, 16336202805534,
16336202805950, 16336202806390, 16336202806805, 16336202807219, 16336202807643, 16336202808033, 16336202808377,
16336202808790, 16336202809211, 16336202809560, 16336202809920, 16336202810355, 16336202810758, 16336202811187,
16336202811596, 16336202811943, 16336202812348, 16336202812710, 16336202813060, 16336202813398, 16336202813791,
16336202814158, 16336202814533, 16336202814878, 16336202815246, 16336202815658, 16336202816079, 16336202816851,
16336202817202, 16336202817540, 16336202817905, 16336202818244, 16336202818663, 16336202819068, 16336202819418,
16336202819777, 16336202820193, 16336202820599, 16336202821033, 16336202821395, 16336202821745, 16336202822158,
16336202822590, 16336202822996, 16336202823396, 16336202823804, 16336202824210, 16336202824581, 16336202824991,
16336202825406, 16336202825806, 16336202826210, 16336202826598, 16336202827033, 16336202827446, 16336202827839,
16336202828201, 16336202828577, 16336202828968, 16336202829362, 16336202829709, 16336202830096, 16336202830533,
16336202830917, 16336202831290, 16336202831699, 16336202832035, 16336202832406, 16336202832804, 16336202833200,
16336202833604, 16336202834033, 16336202834386, 16336202834759, 16336202835190, 16336202835621, 16336202836033,
16336202836405, 16336202837191, 16336202837613, 16336202838033, 16336202838374, 16336202838798, 16336202839200,
16336202839603, 16336202840034, 16336202840389, 16336202840783, 16336202841200, 16336202841617, 16336202842034,
16336202842390, 16336202842737, 16336202843158, 16336202843585, 16336202843923, 16336202844313, 16336202844724,
16336202845158, 16336202845576, 16336202845939, 16336202846368, 16336202846728, 16336202847158, 16336202847568,
16336202847911, 16336202848291, 16336202848695, 16336202849103, 16336202849533, 16336202849942, 16336202850368,
16336202850747, 16336202851158, 16336202851549, 16336202851978, 16336202852383, 16336202852725, 16336202853158,
16336202853554, 16336202853961, 16336202854308, 16336202854704, 16336202855060, 16336202855418, 16336202855776,
16336202856203, 16336202856617, 16336202857036, 16336202857455, 16336202857884, 16336202858262, 16336202858658,
16336202859071, 16336202859847, 16336202860237, 16336202860658, 16336202861037, 16336202861452, 16336202861869,
16336202862218, 16336202862590, 16336202863001, 16336202863422, 16336202863857, 16336202864219, 16336202864658,
16336202865047, 16336202865404, 16336202865789, 16336202866210, 16336202866624, 16336202867033, 16336202867380,
16336202867797, 16336202868227, 16336202868658, 16336202869083, 16336202869500, 16336202869906, 16336202870246,
16336202870658, 16336202871086, 16336202871441, 16336202871820, 16336202872204, 16336202872546, 16336202872943,
16336202873380, 16336202873811, 16336202874213, 16336202874566, 16336202874918, 16336202875261, 16336202875655,
16336202876047, 16336202876771, 16336202877202, 16336202877612, 16336202878033, 16336202878412, 16336202878846,
16336202879241, 16336202879658, 16336202880072, 16336202880508, 16336202880901, 16336202881308, 16336202881725,
16336202882158, 16336202882579, 16336202882945, 16336202883286, 16336202883657, 16336202884048, 16336202884404,
16336202884752, 16336202885158, 16336202885533, 16336202885938, 16336202886364, 16336202886759, 16336202887175,
16336202887585, 16336202887929, 16336202888345, 16336202888743, 16336202889157, 16336202889570, 16336202889970,
16336202890382, 16336202890761, 16336202891187, 16336202891600, 16336202892033, 16336202892454, 16336202892794,
16336202893178, 16336202893533, 16336202893903, 16336202894264, 16336202894668, 16336202895049, 16336202895400,
16336202895774, 16336202896157, 16336202896537, 16336202896883, 16336202897232, 16336202897658, 16336202898065,
16336202898493, 16336202898884, 16336202899251, 16336202899673, 16336202900047, 16336202900467, 16336202900883,
16336202901300, 16336202901676, 16336202902068, 16336202902479, 16336202902902, 16336202903260, 16336202903675,
16336202904094, 16336202904476, 16336202904824, 16336202905158, 16336202905533, 16336202905934, 16336202906289,
16336202906717, 16336202907158, 16336202907547, 16336202907904, 16336202908294, 16336202908717, 16336202909157,
16336202909582, 16336202910005, 16336202910399, 16336202910800, 16336202911220, 16336202911657, 16336202912064,
16336202912405, 16336202912779, 16336202913158, 16336202913553, 16336202913966, 16336202914376, 16336202914719,
16336202915091, 16336202915515, 16336202915887, 16336202916293, 16336202916649, 16336202917438, 16336202917869,
16336202918221, 16336202919053, 16336202919425, 16336202919833, 16336202920234, 16336202920658, 16336202921033,
16336202921433, 16336202921801, 16336202922161, 16336202922589, 16336202923017, 16336202923418, 16336202923804,
16336202924199, 16336202924593, 16336202925033, 16336202925449, 16336202925818, 16336202926223, 16336202926662,
16336202927431, 16336202927812, 16336202928227, 16336202928658, 16336202929061, 16336202929473, 16336202929891,
16336202930241, 16336202930657, 16336202931057, 16336202931396, 16336202931811, 16336202932225, 16336202932657,
16336202933058, 16336202933445, 16336202933790, 16336202934157, 16336202934562, 16336202934988, 16336202935391,
16336202935777, 16336202936160, 16336202936562, 16336202936986, 16336202937396, 16336202937751, 16336202938158,
16336202938578, 16336202938985, 16336202939396, 16336202939752, 16336202940157, 16336202940585
],
"frameTimes": [
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362,
380, 406, 353, 354, 389, 416, 425, 346, 432, 415, 393, 415, 367, 388, 401,
417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399,
418, 363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393,
425, 426, 424, 379, 411, 426, 415, 445, 427, 398, 435, 405, 432, 427, 417,
420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407,
414, 342, 369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426,
352, 386, 353, 405, 435, 362, 375, 419, 388, 381, 376, 335, 382, 426, 389,
382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421,
420, 402, 355, 341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339,
424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405, 426, 439, 349, 410,
414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404,
419, 403, 826, 408, 435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344,
382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355, 342, 362, 375,
400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399,
1598, 422, 387, 367, 422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439,
353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557, 339, 430, 850,
408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148,
702, 407, 396, 436, 370, 378, 434, 416, 409, 388, 401, 397, 350, 419, 846,
375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415, 435, 360,
396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344,
421, 360, 403, 409, 405, 350, 393, 375, 368, 421, 351, 365, 419, 350, 416,
434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373, 336,
398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390,
434, 363, 360, 410, 380, 408, 409, 379, 391, 405, 433, 407, 396, 358, 427,
419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393,
417, 421, 341, 391, 348, 375, 426, 416, 344, 398, 413, 412, 426, 433, 340,
355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382,
334, 401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406,
789, 352, 372, 401, 375, 368, 428, 401, 395, 440, 369, 439, 381, 431, 412,
350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362, 380, 406, 353, 354, 389, 416, 425, 346,
432, 415, 393, 415, 367, 388, 401, 417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399, 418,
363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393, 425, 426, 424, 379, 411, 426, 415, 445, 427,
398, 435, 405, 432, 427, 417, 420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407, 414, 342,
369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426, 352, 386, 353, 405, 435, 362, 375, 419, 388, 381,
376, 335, 382, 426, 389, 382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421, 420, 402, 355,
341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339, 424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405,
426, 439, 349, 410, 414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404, 419, 403, 826, 408,
435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344, 382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355,
342, 362, 375, 400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399, 1598, 422, 387, 367,
422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439, 353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557,
339, 430, 850, 408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148, 702, 407, 396, 436, 370,
378, 434, 416, 409, 388, 401, 397, 350, 419, 846, 375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415,
435, 360, 396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344, 421, 360, 403, 409, 405, 350,
393, 375, 368, 421, 351, 365, 419, 350, 416, 434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373,
336, 398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390, 434, 363, 360, 410, 380, 408, 409,
379, 391, 405, 433, 407, 396, 358, 427, 419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393, 417, 421, 341, 391, 348, 375, 426, 416,
344, 398, 413, 412, 426, 433, 340, 355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382, 334,
401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406, 789, 352, 372, 401, 375, 368, 428, 401, 395,
440, 369, 439, 381, 431, 412, 350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
],
"percentileMs": {
"50": 40.7,

View File

@@ -3,11 +3,18 @@
"dependencies": {
"@babel/core": "^7.16.10",
"@babel/preset-react": "^7.16.7",
"@babel/standalone": "^7.24.7",
"@swc/core": "^1.2.133",
"benchmark": "^2.1.4",
"braces": "^3.0.2",
"esbuild": "^0.14.12",
"eventemitter3": "^5.0.0",
"mitata": "^0.1.6"
"execa": "^8.0.1",
"fast-glob": "3.3.1",
"fdir": "^6.1.0",
"mitata": "^0.1.6",
"string-width": "7.1.0",
"zx": "^7.2.3"
},
"scripts": {
"ffi": "cd ffi && bun run deps && bun run build && bun run bench",
@@ -19,6 +26,5 @@
},
"devDependencies": {
"fast-deep-equal": "^3.1.3"
},
"prettier": "../.prettierrc.cjs"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -6,6 +6,7 @@ const App = () => (
<html>
<body>
<h1>Hello World</h1>
<p>This is an example.</p>
</body>
</html>
);

View File

@@ -0,0 +1,24 @@
import { bench, run } from "./runner.mjs";
var comparator = (a, b) => a - b;
const numbers = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
50, 49, 48.9,
];
const presorted = numbers.slice().sort(comparator);
bench(`Array.sort (${numbers.length} num, unsorted)`, () => {
[
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
51, 50, 49, 48.9,
].sort(comparator);
});
bench(`Array.sort (${numbers.length} num, pre-sorted)`, () => {
presorted.sort(comparator);
});
run();

13
bench/snippets/atob.mjs Normal file
View File

@@ -0,0 +1,13 @@
import { bench, run } from "./runner.mjs";
function makeBenchmark(size) {
const latin1 = btoa("A".repeat(size));
bench(`atob(${size} chars)`, () => {
atob(latin1);
});
}
[32, 512, 64 * 1024, 512 * 1024, 1024 * 1024 * 8].forEach(makeBenchmark);
await run();

View File

@@ -0,0 +1,21 @@
import { bench, run } from "./runner.mjs";
function makeBenchmark(size, isToString) {
const base64Input = Buffer.alloc(size, "latin1").toString("base64");
const base64From = Buffer.from(base64Input, "base64");
if (!isToString)
bench(`Buffer.from(${size} bytes, 'base64')`, () => {
Buffer.from(base64Input, "base64");
});
if (isToString)
bench(`Buffer(${size}).toString('base64')`, () => {
base64From.toString("base64");
});
}
[32, 512, 64 * 1024, 512 * 1024, 1024 * 1024 * 8].forEach(s => makeBenchmark(s, true));
[32, 512, 64 * 1024, 512 * 1024, 1024 * 1024 * 8].forEach(s => makeBenchmark(s, false));
await run();

View File

@@ -0,0 +1,54 @@
import { bench, run } from "./runner.mjs";
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
const first = Buffer.allocUnsafe(size);
const second = Buffer.allocUnsafe(size);
const third = Buffer.allocUnsafe(size);
first.fill(1);
second.fill(2);
third.fill(3);
const check = true;
const buffers = [first, second, third];
const fmt =
size > 1024 * 1024
? new Intl.NumberFormat(undefined, { unit: "megabyte", style: "unit" })
: size > 1024
? new Intl.NumberFormat(undefined, { unit: "kilobyte", style: "unit" })
: new Intl.NumberFormat(undefined, { unit: "byte", style: "unit" });
bench(
`Buffer.concat(${fmt.format(
Number((size > 1024 * 1024 ? size / 1024 / 1024 : size > 1024 ? size / 1024 : size).toFixed(2)),
)} x 3)`,
() => {
const result = Buffer.concat(buffers);
if (check) {
if (result.byteLength != size * 3) throw new Error("Wrong length");
if (result[0] != 1) throw new Error("Wrong first byte");
if (result[size] != 2) throw new Error("Wrong second byte");
if (result[size * 2] != 3) throw new Error("Wrong third byte");
result[0] = 10;
if (first[0] != 1) throw new Error("First buffer was modified");
result[size] = 20;
if (second[0] != 2) throw new Error("Second buffer was modified");
result[size * 2] = 30;
if (third[0] != 3) throw new Error("Third buffer was modified");
}
},
);
}
const chunk = Buffer.alloc(16);
chunk.fill("3");
const array = Array.from({ length: 100 }, () => chunk);
bench("Buffer.concat 100 tiny chunks", () => {
return Buffer.concat(array);
});
await run();

View File

@@ -14,6 +14,14 @@ bench(`Buffer(${uuid.byteLength}).toString('base64')`, () => {
return uuid.toString("base64");
});
bench(`Buffer(${bigBuffer.byteLength}).toString('base64url')`, () => {
return bigBuffer.toString("base64url");
});
bench(`Buffer(${uuid.byteLength}).toString('base64url')`, () => {
return uuid.toString("base64url");
});
bench(`Buffer(${bigBuffer.byteLength}).toString('hex')`, () => {
return bigBuffer.toString("hex");
});

View File

@@ -1,9 +1,10 @@
import { mkdirSync, writeFileSync } from "fs";
import { bench, run } from "./runner.mjs";
import { mkdirSync, rmSync, writeFileSync } from "fs";
import { cp } from "fs/promises";
import { join } from "path";
import { tmpdir } from "os";
import { join, resolve } from "path";
import { bench, run } from "./runner.mjs";
import { fileURLToPath } from "url";
const hugeDirectory = (() => {
const root = join(tmpdir(), "huge");
const base = join(root, "directory", "for", "benchmarks", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
@@ -18,14 +19,21 @@ const hugeDirectory = (() => {
const hugeFilePath = join(tmpdir(), "huge-file-0.txt");
const hugeText = "Hello, world!".repeat(1000000);
writeFileSync(hugeFilePath, hugeText);
let base = process.argv.at(-1);
if (resolve(base) === fileURLToPath(import.meta.url)) {
base = tmpdir();
} else {
rmSync(base, { recursive: true, force: true });
mkdirSync(base, { recursive: true });
}
var hugeCopyI = 0;
bench("cp -r (1000 files)", async b => {
await cp(hugeDirectory, join(tmpdir(), "huge-copy" + hugeCopyI++), { recursive: true });
await cp(hugeDirectory, join(base, "huge-copy" + hugeCopyI++), { recursive: true });
});
bench("cp 1 " + ((hugeText.length / 1024) | 0) + " KB file", async b => {
await cp(hugeFilePath, join(tmpdir(), "huge-file" + hugeCopyI++));
await cp(hugeFilePath, join(base, "huge-file" + hugeCopyI++));
});
await run();

View File

@@ -0,0 +1,7 @@
import { bench, run } from "./runner.mjs";
bench("crypto.randomUUID()", () => {
return crypto.randomUUID();
});
await run();

View File

@@ -0,0 +1,38 @@
// For maximum effect, make sure to clear your DNS cache before running this
//
// To clear your DNS cache on macOS:
// sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
//
// To clear your DNS cache on Linux:
// sudo systemd-resolve --flush-caches && sudo killall -HUP systemd-resolved
//
// To clear your DNS cache on Windows:
// ipconfig /flushdns
//
const url = new URL(process.argv.length > 2 ? process.argv.at(-1) : "https://bun.sh");
const hostname = url.hostname;
const port = url.port ? parseInt(url.port, 10) : url.protocol === "https:" ? 443 : 80;
if (typeof globalThis.Bun?.dns?.prefetch === "function") {
Bun.dns.prefetch(hostname, port);
}
// Delay one second to make sure the DNS prefetch has time to run
await new Promise(resolve => setTimeout(resolve, 1000));
const start = performance.now();
const promises = [];
// Now let's fetch 20 times to see if the DNS prefetch has worked
for (let i = 0; i < 20; i++) {
promises.push(fetch(url, { redirect: "manual", method: "HEAD" }));
}
await Promise.all(promises);
const end = performance.now();
console.log("fetch() took", (end - start) | 0, "ms");
if (typeof globalThis.Bun?.dns?.getCacheStats === "function") {
console.log("DNS cache stats", Bun.dns.getCacheStats());
}

View File

@@ -1,9 +1,9 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
// pure JS implementation will optimze this out
// bench("new Headers", function () {
// return new Headers();
// });
bench("new Headers", function () {
return new Headers();
});
var big = new Headers({
"Content-Type": "text/plain",
@@ -17,17 +17,128 @@ var big = new Headers({
"X-Yet-Another-Custom-Headz": "Hello Worlda",
});
// bench("Header.get", function () {
// return big.get("Content-Type");
// });
bench("new Headers([])", () => {
return new Headers([]);
});
// bench("Header.set (standard)", function () {
// return big.set("Content-Type", "text/html");
// });
bench("new Headers({})", () => {
return new Headers({});
});
// bench("Header.set (non-standard)", function () {
// return big.set("X-My-Custom", "text/html123");
// });
bench("new Headers(object)", () => {
return new Headers({
"Content-Type": "text/plain",
"Content-Length": "123",
"User-Agent": "node-fetch/1.0",
});
});
bench("new Headers(hugeObject)", () => {
return new Headers({
"Accept": "123",
"Accept-Charset": "123",
"Accept-Language": "123",
"Accept-Encoding": "123",
"Accept-Ranges": "123",
"Access-Control-Allow-Credentials": "123",
"Access-Control-Allow-Headers": "123",
"Access-Control-Allow-Methods": "123",
"Access-Control-Allow-Origin": "123",
"Access-Control-Expose-Headers": "123",
"Access-Control-Max-Age": "123",
"Access-Control-Request-Headers": "123",
"Access-Control-Request-Method": "123",
"Age": "123",
"Authorization": "123",
"Cache-Control": "123",
"Connection": "123",
"Content-Disposition": "123",
"Content-Encoding": "123",
"Content-Language": "123",
"Content-Length": "123",
"Content-Location": "123",
"Content-Security-Policy": "123",
"Content-Security-Policy-Report-Only": "123",
"Content-Type": "123",
"Content-Range": "123",
"Cookie": "123",
"Cookie2": "123",
"Cross-Origin-Embedder-Policy": "123",
"Cross-Origin-Embedder-Policy-Report-Only": "123",
"Cross-Origin-Opener-Policy": "123",
"Cross-Origin-Opener-Policy-Report-Only": "123",
"Cross-Origin-Resource-Policy": "123",
"Date": "123",
"DNT": "123",
"Default-Style": "123",
"ETag": "123",
"Expect": "123",
"Expires": "123",
"Host": "123",
"If-Match": "123",
"If-Modified-Since": "123",
"If-None-Match": "123",
"If-Range": "123",
"If-Unmodified-Since": "123",
"Keep-Alive": "123",
"Last-Event-ID": "123",
"Last-Modified": "123",
"Link": "123",
"Location": "123",
"Origin": "123",
"Ping-From": "123",
"Ping-To": "123",
"Purpose": "123",
"Pragma": "123",
"Proxy-Authorization": "123",
"Range": "123",
"Referer": "123",
"Referrer-Policy": "123",
"Refresh": "123",
"Report-To": "123",
"Sec-Fetch-Dest": "123",
"Sec-Fetch-Mode": "123",
"Sec-WebSocket-Accept": "123",
"Sec-WebSocket-Extensions": "123",
"Sec-WebSocket-Key": "123",
"Sec-WebSocket-Protocol": "123",
"Sec-WebSocket-Version": "123",
"Server-Timing": "123",
"Service-Worker": "123",
"Service-Worker-Allowed": "123",
"Service-Worker-Navigation-Preload": "123",
"Set-Cookie": "123",
"Set-Cookie2": "123",
"SourceMap": "123",
"TE": "123",
"Timing-Allow-Origin": "123",
"Trailer": "123",
"Transfer-Encoding": "123",
"Upgrade": "123",
"Upgrade-Insecure-Requests": "123",
"User-Agent": "123",
"Vary": "123",
"Via": "123",
"X-Content-Type-Options": "123",
"X-DNS-Prefetch-Control": "123",
"X-Frame-Options": "123",
"X-SourceMap": "123",
"X-XSS-Protection": "123",
"X-Temp-Tablet": "123",
});
});
bench("Header.get", function () {
return big.get("Content-Type");
});
bench("Header.set (standard)", function () {
return big.set("Content-Type", "text/html");
});
bench("Header.set (non-standard)", function () {
return big.set("X-My-Custom", "text/html123");
});
if (big.toJSON)
bench("Headers.toJSON", function () {
@@ -42,4 +153,4 @@ bench("Object.fromEntries(headers)", function () {
return Object.fromEntries(big);
});
run();
await run();

View File

@@ -54,4 +54,14 @@ bench("JSON.stringify(obj)", () => {
globalThis.bar = JSON.stringify(obj);
});
var long_ascii = `"${"a".repeat(9999)}"`;
bench("JSON.parse(`\"${'a'.repeat(9999)}\"`)", () => {
globalThis.bar = JSON.parse(long_ascii);
});
const long_emoji = `"${"🥟".repeat(9999)}"`;
bench("JSON.parse(`\"${'🥟'.repeat(9999)}\"`)", () => {
globalThis.bar = JSON.parse(long_emoji);
});
await run();

View File

@@ -5,6 +5,11 @@ const lazy = globalThis[Symbol.for("Bun.lazy")];
const noop = lazy("noop");
const fn = noop.function;
const regular = noop.functionRegular;
const callback = noop.callback;
bench("C++ callback into JS", () => {
callback(() => {});
});
bench("C++ fn regular", () => {
regular();

29
bench/snippets/pbkdf2.mjs Normal file
View File

@@ -0,0 +1,29 @@
import { pbkdf2, pbkdf2Sync } from "node:crypto";
import { bench, run } from "./runner.mjs";
const password = "password";
const salt = "salt";
const iterations = 1000;
const keylen = 32;
const hash = "sha256";
bench("pbkdf2(iterations = 1000, 'sha256') -> 32", async () => {
return new Promise((resolve, reject) => {
pbkdf2(password, salt, iterations, keylen, hash, (err, key) => {
if (err) return reject(err);
resolve(key);
});
});
});
bench("pbkdf2(iterations = 500_000, 'sha256') -> 32", async () => {
return new Promise((resolve, reject) => {
pbkdf2(password, salt, 500_000, keylen, hash, (err, key) => {
if (err) return reject(err);
resolve(key);
});
});
});
await run();

View File

@@ -0,0 +1,31 @@
import { bench, run } from "mitata";
import { peek } from "bun";
let pending = Bun.sleep(1000);
let resolved = Promise.resolve(1);
bench("Bun.peek - pending", () => {
return peek(pending);
});
bench("Bun.peek - resolved", () => {
return peek(resolved);
});
bench("Bun.peek - non-promise", () => {
return peek(1);
});
bench("Bun.peek.status - resolved", () => {
return peek.status(pending);
});
bench("Bun.peek.status - pending", () => {
return peek.status(resolved);
});
bench("Bun.peek.status - non-promise", () => {
return peek.status(1);
});
await run();

View File

@@ -26,6 +26,11 @@ group("new Response(stream).arrayBuffer()", () => {
bench("react-dom/server.bun", async () => await new Response(await renderToReadableStreamBun(<App />)).arrayBuffer());
});
group("new Response(stream).bytes()", () => {
bench("react-dom/server.browser", async () => await new Response(await renderToReadableStream(<App />)).bytes());
bench("react-dom/server.bun", async () => await new Response(await renderToReadableStreamBun(<App />)).bytes());
});
group("new Response(stream).blob()", () => {
bench("react-dom/server.browser", async () => await new Response(await renderToReadableStream(<App />)).blob());
bench("react-dom/server.bun", async () => await new Response(await renderToReadableStreamBun(<App />)).blob());

View File

@@ -0,0 +1,73 @@
import { tmpdir } from "node:os";
import { bench, group, run } from "./runner.mjs";
import { createReadStream, writeFileSync } from "node:fs";
import { sep } from "node:path";
if (!Promise.withResolvers) {
Promise.withResolvers = function () {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
}
const ALLOW_BUN = typeof Bun !== "undefined";
const ALLOW_NODE = true;
const dir = tmpdir() + sep;
var short = (function () {
const text = "Hello World!";
const path = dir + "bun-bench-short.text";
writeFileSync(path, text, "utf8");
return { path, length: text.length };
})();
var shortUTF16 = (function () {
const text = "Hello World 💕💕💕";
const path = dir + "bun-bench-shortUTF16.text";
writeFileSync(path, text, "utf8");
return { path, length: text.length };
})();
var long = (function () {
const text = "Hello World!".repeat(1024);
const path = dir + "bun-bench-long.text";
writeFileSync(path, text, "utf8");
return { path, length: text.length };
})();
var longUTF16 = (function () {
const text = "Hello World 💕💕💕".repeat(15 * 70192);
const path = dir + "bun-bench-longUTF16.text";
writeFileSync(path, text, "utf8");
return { path, length: text.length };
})();
async function bun(path) {
for await (const chunk of Bun.file(path).stream()) {
chunk;
}
}
async function node(path) {
const { promise, resolve } = Promise.withResolvers();
const stream = createReadStream(path);
stream.on("data", chunk => {});
stream.on("end", () => resolve());
await promise;
}
ALLOW_BUN && bench("short - bun", () => bun(short.path));
ALLOW_NODE && bench("short - node", () => node(short.path));
ALLOW_BUN && bench("shortUTF16 - bun", () => bun(shortUTF16.path));
ALLOW_NODE && bench("shortUTF16 - node", () => node(shortUTF16.path));
ALLOW_BUN && bench("long - bun", () => bun(long.path));
ALLOW_NODE && bench("long - node", () => node(long.path));
ALLOW_BUN && bench("longUTF16 - bun", () => bun(longUTF16.path));
ALLOW_NODE && bench("longUTF16 - node", () => node(longUTF16.path));
await run();

View File

@@ -1,13 +1,50 @@
import { readdirSync } from "fs";
import { readdirSync, readdir as readdirCb } from "fs";
import { readdir } from "fs/promises";
import { bench, run } from "./runner.mjs";
import { argv } from "process";
import { fileURLToPath } from "url";
import { relative, resolve } from "path";
import { createHash } from "crypto";
const dir = argv.length > 2 ? argv[2] : "/tmp";
let dir = resolve(argv.length > 2 ? argv[2] : fileURLToPath(new URL("../../node_modules", import.meta.url)));
if (dir.includes(process.cwd())) {
dir = relative(process.cwd(), dir);
}
const count = readdirSync(dir).length;
bench(`readdir("${dir}")`, () => {
readdirSync(dir, { withFileTypes: true });
const result = await readdir(dir, { recursive: true });
const count = result.length;
const syncCount = readdirSync(dir, { recursive: true }).length;
const hash = createHash("sha256").update(result.sort().join("\n")).digest("hex");
bench(`await readdir("${dir}", {recursive: true})`, async () => {
await readdir(dir, { recursive: true });
});
bench(`await readdir("${dir}", {recursive: true}) x 10`, async () => {
const promises = [
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
readdir(dir, { recursive: true }),
];
await Promise.all(promises);
});
bench(`await readdir("${dir}", {recursive: false})`, async () => {
await readdir(dir, { recursive: false });
});
await run();
console.log("\n\nFor", count, "files/dirs in", dir);
console.log("\n", count, "files/dirs in", dir, "\n", "SHA256:", hash, "\n");
if (count !== syncCount) {
throw new Error(`Mismatched file counts: ${count} async !== ${syncCount} sync`);
}

View File

@@ -1,16 +1,42 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
bench("setTimeout(, 4) 100 times", async () => {
var i = 100;
while (--i >= 0) {
await new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, 4);
});
}
});
let count = 20_000_000;
const batchSize = 1_000_000;
console.time("Run");
setTimeout(() => {
run({}).then(() => {});
}, 1);
let { promise, resolve, reject } = Promise.withResolvers();
let remaining = count;
if (batchSize === 0) {
for (let i = 0; i < count; i++) {
setTimeout(() => {
remaining--;
if (remaining === 0) {
resolve();
}
}, 0);
}
await promise;
} else {
for (let i = 0; i < count; i += batchSize) {
let batch = Math.min(batchSize, count - i);
console.time("Batch " + i + " - " + (i + batch));
let { promise: batchPromise, resolve: batchResolve } = Promise.withResolvers();
let remaining = batch;
for (let j = 0; j < batch; j++) {
setTimeout(() => {
remaining--;
if (remaining === 0) {
batchResolve();
}
}, 0);
}
await batchPromise;
console.timeEnd("Batch " + i + " - " + (i + batch));
}
}
const fmt = new Intl.NumberFormat();
console.log("Executed", fmt.format(count), "timers");
console.timeEnd("Run");
process.exit(0);

View File

@@ -0,0 +1,37 @@
import { $ as zx } from "zx";
import { $ as execa$ } from "execa";
import { bench, run, group } from "./runner.mjs";
const execa = execa$({ stdio: "ignore", cwd: import.meta.dirname });
group("echo hi", () => {
if (typeof Bun !== "undefined")
bench("$`echo hi`", async () => {
await Bun.$`echo hi`.quiet();
});
bench("execa`echo hi`", async () => {
await execa`echo hi`;
});
bench("zx`echo hi`", async () => {
await zx`echo hi`.quiet();
});
});
group("ls .", () => {
if (typeof Bun !== "undefined")
bench("$`ls .`", async () => {
await Bun.$`ls .`.quiet();
});
bench("execa`ls .`", async () => {
await execa`ls .`;
});
bench("zx`ls .`", async () => {
await zx`ls .`.quiet();
});
});
await run();

View File

@@ -0,0 +1,41 @@
import { bench, run } from "./runner.mjs";
import npmStringWidth from "string-width";
const bunStringWidth = globalThis?.Bun?.stringWidth;
const stringWidth = bunStringWidth || npmStringWidth;
const formatter = new Intl.NumberFormat();
const format = n => {
return formatter.format(n);
};
const inputs = [
["hello", "ascii"],
["[31mhello", "ascii+ansi"],
["hello😀", "ascii+emoji"],
["[31m😀😀", "ansi+emoji"],
["😀hello😀[31m😀😀😀", "ansi+emoji+ascii"],
];
const repeatCounts = [1, 10, 100, 1000, 5000];
const maxInputLength = Math.max(...inputs.map(([input]) => input.repeat(Math.max(...repeatCounts)).length));
for (const [input, textLabel] of inputs) {
for (let repeatCount of repeatCounts) {
const label = bunStringWidth ? "Bun.stringWidth" : "npm/string-width";
const str = input.repeat(repeatCount);
const name = `${label} ${format(str.length).padStart(format(maxInputLength).length, " ")} chars ${textLabel}`;
bench(name, () => {
stringWidth(str);
});
if (bunStringWidth && bunStringWidth(str) !== npmStringWidth(str)) {
throw new Error("string-width mismatch");
}
}
}
await run();

View File

@@ -0,0 +1,14 @@
import { bench, run } from "mitata";
import { join } from "path";
const code = require("fs").readFileSync(
process.argv[2] || join(import.meta.dir, "../node_modules/@babel/standalone/babel.min.js"),
);
const transpiler = new Bun.Transpiler({ minify: true });
bench("transformSync", () => {
transpiler.transformSync(code);
});
await run();

19
bench/snippets/url.mjs Normal file
View File

@@ -0,0 +1,19 @@
import { bench, run } from "./runner.mjs";
bench(`new URL('https://example.com/')`, () => {
const url = new URL("https://example.com/");
});
bench(`new URL('https://example.com')`, () => {
const url = new URL("https://example.com");
});
bench(`new URL('https://www.example.com')`, () => {
const url = new URL("https://www.example.com");
});
bench(`new URL('https://www.example.com/')`, () => {
const url = new URL("https://www.example.com/");
});
await run();

Some files were not shown because too many files have changed in this diff Show More