Compare commits

...

368 Commits

Author SHA1 Message Date
Jarred Sumner
3515f7f755 Fix type declaration 2024-11-18 05:17:53 -08:00
Pham Minh Triet
d5a118e25f Fix(doc): update cluster.md (#15214) 2024-11-18 03:04:36 -08:00
Ciro Spaciari
1911fa1e75 fix(HttpParser) always check if content length is valid before calling requestHandler (#15179) 2024-11-16 19:41:59 -08:00
Meghan Denny
6dbf1bff4f musl: fix test/js/node/process/process.test.js (#15185) 2024-11-16 02:57:20 -08:00
Jarred Sumner
a5a0539f26 Fixes #15177 (#15180) 2024-11-16 02:18:13 -08:00
Meghan Denny
3393b0e1d3 musl: fix third_party/prisma.test.ts (#15186) 2024-11-16 01:44:53 -08:00
Dylan Conway
910efec0b7 fix auto-install on windows when symlinks aren't available (#15182) 2024-11-16 00:43:12 -08:00
Meghan Denny
dafd8156b0 ci: skip running tests on main branch 2024-11-15 22:18:55 -08:00
Meghan Denny
befb269b2d zig: align fromJS methods to using JSError (#15165) 2024-11-15 22:14:18 -08:00
Ashcon Partovi
39d8ade27c ci: musl builds (#15154)
Co-authored-by: Electroid <Electroid@users.noreply.github.com>
Co-authored-by: Meghan Denny <meghan@bun.sh>
2024-11-15 21:01:55 -08:00
Meghan Denny
4fedc41545 musl: fix 'bun upgrade' (#15178) 2024-11-15 20:58:23 -08:00
dave caruso
15f2bbb33a docs: remove contributing instructions involving winget (#15176) 2024-11-15 13:06:51 -08:00
Jarred Sumner
4ddb63e7e2 Try linker script (#15158) 2024-11-15 13:02:10 -08:00
Grigory
3791146476 docs(contributing): group os-specific code tabs (#15173) 2024-11-15 12:50:28 -08:00
ippsav
910e479d29 Fix node:net not handling path in listen (#15162)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-11-15 10:35:14 -08:00
Meghan Denny
266e033d6f node:https: fix prototype chain of Agent (#15160)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-11-14 19:03:16 -08:00
Ashcon Partovi
9a6f033206 ci: Fix changed files detection on forks 2024-11-14 18:34:13 -08:00
Meghan Denny
2810f39802 zig: make all JS constructors use JSError (#15146)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-11-14 16:36:01 -08:00
Michael H
3170b88058 fix vscode debugger (#14995) 2024-11-14 14:24:18 -08:00
Jarred Sumner
357581c61a Shrink Bun's binary by 3.5 MB (#15121) 2024-11-14 06:02:15 -08:00
pfg
d8987ccdb8 Remove assertion in js printer triggering for unicode comments (#15143) 2024-11-14 00:14:43 -08:00
Meghan Denny
fdd8d35845 allow zig js host functions to return JSError (#15120) 2024-11-13 21:11:56 -08:00
dave caruso
32ddf343ee bake: csr, streaming ssr, serve integration, safer jsvalue functions, &more (#14900)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-11-13 18:19:12 -08:00
Meghan Denny
bceb0a2327 ci: fix release script (#15129) 2024-11-13 18:29:14 -07:00
Meghan Denny
9b0cdf01f9 cpp: Bun::toStringRef: return dead when exception has been thrown (#15127)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-11-13 17:03:59 -08:00
Meghan Denny
35513a9d6d zig: remove JSValue.isEmpty (#15128) 2024-11-13 16:04:13 -08:00
Meghan Denny
f8979b05b1 rid nearly all use of ExceptionRef in zig (#15100)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-11-13 15:23:52 -08:00
ippsav
ec91e91fda Pass missing signal code for child_process.spawnSync (#15137) 2024-11-13 15:07:43 -08:00
Meghan Denny
956853f036 test: dont overwrite root package.json when running bun-ipc-inherit.test.ts (#15126) 2024-11-13 00:14:57 -08:00
Dylan Conway
c5df329772 #15059 follow-up (#15118) 2024-11-12 18:17:35 -08:00
Ciro Spaciari
e945146fde fix(bundler) fix pretty path resolution (#15119) 2024-11-12 18:16:13 -08:00
Ciro Spaciari
873b0a7540 fix(socket) Support named pipes on Windows using forward slashes (#15112) 2024-11-12 16:09:43 -08:00
Dennis Dudek
c785ab921b ci: Fix detection of changed files (#15114)
Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2024-11-12 15:27:27 -07:00
Meghan Denny
797958082c musl patches [v4] (#15066) 2024-11-11 19:23:58 -08:00
Jarred Sumner
2b9abc20da Use linux syscall interface more in I/O (#15067) 2024-11-11 14:47:04 -08:00
Jarred Sumner
d713001e35 Fixes #14982 2024-11-11 14:40:11 -08:00
Jarred Sumner
b49f6d143e Postgres client - more progress (#15086) 2024-11-11 14:40:02 -08:00
pfg
4cf9851747 Bump runtime transpiler cache version for #15009 (#15094) 2024-11-11 14:38:17 -08:00
pfg
56f7c8887b Fix unicode imports, unicode-escaped variable names, and printClauseAlias not working for utf-8 (#15009) 2024-11-11 13:27:42 -08:00
Ciro Spaciari
62cabe9003 fix(tests) new grpc certs (#15090) 2024-11-11 13:00:58 -08:00
Jarred Sumner
781a392baa Add micro-optimization to fs.readFile (#15076) 2024-11-11 10:35:17 -08:00
Jarred Sumner
d879f4370d Update hashing.md 2024-11-09 02:27:50 -08:00
Jarred Sumner
ae6e23ab28 Update hashing.md 2024-11-09 02:25:18 -08:00
Jarred Sumner
7a9165555d Update hashing.md 2024-11-09 02:19:24 -08:00
Michael H
b54137174b Bench updates (#15029)
Co-authored-by: RiskyMH <RiskyMH@users.noreply.github.com>
2024-11-08 23:15:24 -08:00
Dylan Conway
635789944b update 2024-11-08 21:14:42 -08:00
Jarred Sumner
a1c4f667d9 Support ${configDir} in tsconfig.json (#15063)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-11-08 17:08:54 -08:00
Zack Radisic
07dc1ae547 .defer(), .onStart(), and some small CSS changes (#15041) 2024-11-08 16:38:30 -08:00
Dylan Conway
8f5eab3c84 fix(install): package-lock.json migration and non-existent cafile fixes (#15059) 2024-11-08 14:34:44 -08:00
Jarred Sumner
6ec03b8b05 Add to documentation 2024-11-07 22:54:08 -08:00
Ciro Spaciari
183c661c40 net compatibility improvements (#14933)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-11-07 22:03:53 -08:00
Meghan Denny
c2e7643aa9 musl patches [v3] (#15031) 2024-11-07 21:31:32 -08:00
Jarred Sumner
376b1b4f97 Support preload option in Worker (#15045) 2024-11-07 21:30:51 -08:00
Jarred Sumner
27067d2a6d Allow using Proxy and module namespace objects in APIs (#15043) 2024-11-07 19:45:29 -08:00
Jarred Sumner
1e932ff38b [VSCode extension] Add [eval with bun] code lens on untitled, unsaved scratch JavaScript files (#14983) 2024-11-07 12:30:38 -08:00
Meghan Denny
a116b2281e musl patches [v2] (#15028) 2024-11-06 23:55:23 -08:00
Dylan Conway
66ba6ba061 fix 14957 (#15025) 2024-11-06 19:41:39 -08:00
Jarred Sumner
8d4bb080a3 Implement console.group (#15026) 2024-11-06 19:40:58 -08:00
Ashcon Partovi
bef50a9b9b ci: misc fixes and test runner changes (#15024) 2024-11-06 18:15:55 -07:00
Jarred Sumner
56b57012ed Bump! 2024-11-06 15:05:23 -08:00
Tim Ermilov
c39ae74d3e Fix importing of ES modules from data URIs (#14959) 2024-11-06 15:00:24 -08:00
Christophe Eymard
fc071d3362 remove checks for self closing tags (#14990) 2024-11-06 14:58:31 -08:00
Jarred Sumner
1a9d20e50a Support debugging builtin modules (#15018) 2024-11-06 14:57:35 -08:00
Jarred Sumner
8d8a6bc5c3 Fix prototypical inheritance issue in node:zlib and add a $toClass helper (#15015) 2024-11-06 14:56:10 -08:00
Jarred Sumner
076d1d3d36 Never try using epoll_pwait2 on old linux kernels (#14980) 2024-11-06 03:42:24 -08:00
Jarred Sumner
484c3de861 Show if napi_module_register or dlopen was called in crash reports (#15008) 2024-11-05 20:57:55 -08:00
Meghan Denny
27a1b2413b patches to allow linux-musl to bootstrap (#14994) 2024-11-05 17:22:05 -08:00
Amit Dhamu
3950873272 Fix typo for configuring specific registry (#15001) 2024-11-05 08:11:57 -08:00
pfg
6fb73f2011 Visually center logo in readme (#14969) 2024-11-04 15:28:16 -07:00
pfg
497fa59bf0 Fix #14865 (#14953) 2024-11-02 17:13:31 -07:00
Jarred Sumner
5e5e7c60f1 Fix release build 2024-11-01 20:41:20 -07:00
Ciro Spaciari
85fd471d9d fix(net) fix bytesWritten drain (#14949) 2024-11-01 19:43:42 -07:00
Jarred Sumner
6914c5e32c Fixes #13816 (#13906)
Co-authored-by: pfg <pfg@pfg.pw>
Co-authored-by: Ryan Gonzalez <git@refi64.dev>
Co-authored-by: Ben Grant <ben@bun.sh>
Co-authored-by: Dave Caruso <me@paperdave.net>
2024-11-01 18:38:01 -07:00
Jarred Sumner
ce2afac827 Align "encoding" option in node fs with node (#14937) 2024-11-01 18:16:04 -07:00
Ciro Spaciari
5236d974b5 revert 2024-11-01 17:25:59 -07:00
Ciro Spaciari
6e448619d0 fix drain event, drain must be called only after internal buffer is drained 2024-11-01 17:23:00 -07:00
Jarred Sumner
c89a958299 Fixes #11754 (#14948) 2024-11-01 15:35:28 -07:00
Jarred Sumner
d75488124d Inline process.versions.bun in bun build --compile (#14940) 2024-11-01 14:45:19 -07:00
Ashcon Partovi
4d269995ad Run tests from npm packages, elysia to start (#14932) 2024-11-01 11:57:47 -07:00
190n
71fdb59918 Fix napi property methods on non-objects (#14935) 2024-10-31 21:02:26 -07:00
Dylan Conway
62881ee36b Redact secrets in bunfig.toml and npmrc logs (#14919) 2024-10-31 18:44:24 -07:00
Dylan Conway
6933208790 fix(install): only globally link requested packages (#12506)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-31 18:21:04 -07:00
Jarred Sumner
b1e9e3b31b Add bytesWritten property to Bun.Socket, fix encoding issue in node:net (#14516)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-10-31 17:54:07 -07:00
Jarred Sumner
7035a1107e Fixes #14918 (#14921) 2024-10-31 14:26:19 -07:00
Ashcon Partovi
353d44f1ae ci: If only tests change, use artifacts from last successful build (#14927) 2024-10-31 12:50:09 -07:00
Jarred Sumner
4b8ca51b87 Clean up some code in node validators (#14897) 2024-10-31 12:28:07 -07:00
Ciro Spaciari
f8d5b2e6e2 Fix module resolution cache keys (#14901)
Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-10-30 22:06:21 -07:00
190n
9647291d73 Implement NAPI type tagging (#14915) 2024-10-30 19:57:48 -07:00
Jarred Sumner
eaa088ba55 Fix missing symbol errors and add a test (#14907)
Co-authored-by: Jarred Sumner <jarred@bun.sh>
2024-10-30 19:55:42 -07:00
Gerd Jungbluth
955cc6265b fix(docs): add missing character in drizzle guide (#14911) 2024-10-30 08:42:38 -07:00
Dylan Conway
489890deb1 fix(install): check cached package.jsons (#14899) 2024-10-29 18:55:52 -07:00
pfg
d7710c6c67 Fix additional arguments when running a package.json script (#14895)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-29 18:55:32 -07:00
Jarred Sumner
9f70f68f00 EventEmitter.name should be "EventEmitter" instead of "EventEmitter2" (#14898) 2024-10-29 18:42:24 -07:00
Jarred Sumner
240b2a539f Introduce Bun.randomUUIDv7 (#14858)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-10-29 16:39:09 -07:00
Jarred Sumner
b9e5420571 Add https://github.com/uNetworking/uWebSockets/pull/1792 (#14864) 2024-10-29 12:56:25 -07:00
Jarred Sumner
b5a73130ad Reduce memory usage in long-running processes (#14885) 2024-10-29 12:56:10 -07:00
Jarred Sumner
d5f9978007 Fix missing symbol error on llvm 18 2024-10-29 00:08:29 -07:00
pfg
698e87aa67 Fix #14187 (#14884) 2024-10-28 18:11:03 -07:00
Zack Radisic
5502278f3e CSS: More stuff and tests (#14832)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-27 13:49:25 -07:00
Jarred Sumner
f005e8c057 Fix HTTP spec issues by upgrading uWS version (#14853) 2024-10-27 12:34:45 -07:00
dave caruso
e93c5ad993 feat(bake): css, production build, dev separateSSRGraph=false (#14622)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-10-27 01:57:36 -07:00
Meghan Denny
5237869101 bun-install-registry.test.ts: remove ini format hint here (#14803) 2024-10-26 16:51:19 -07:00
Jarred Sumner
2456d70ac7 Fixes #14716 (#14834) 2024-10-26 15:15:13 -07:00
Meghan Denny
50d80a805d pm: fix weird package.json formatting after install (#14801) 2024-10-26 01:36:25 -07:00
Meghan Denny
2d9a73fc07 test: fix expected value of 'should perform bin-linking across multiple dependencies' (#14833) 2024-10-26 01:02:24 -07:00
Jarred Sumner
d0b3802a79 github actions 2024-10-25 23:50:12 -07:00
Jarred Sumner
7053212566 Update associate-issue-with-sentry.ts 2024-10-25 23:47:15 -07:00
Jarred Sumner
4f5660a6f7 Add sentry id to crash report comment 2024-10-25 23:40:27 -07:00
Dylan Conway
87279392cf fix 9395 (#14815) 2024-10-25 19:58:45 -07:00
Bjorn Beishline
7f5860331e Fixed compilation issues with no outdir (#14717)
Co-authored-by: Meghan Denny <meghan@bun.sh>
2024-10-25 18:43:58 -07:00
Dylan Conway
b895738156 fix(install): migrate package-lock.json with dependency on root package (#14811)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-25 01:32:17 -07:00
Dylan Conway
61534c7efe Remove warning for unused registry options from npmrc (#14813) 2024-10-25 01:31:39 -07:00
Jarred Sumner
ec4c9f8f84 Update mimalloc (#14814) 2024-10-25 01:31:24 -07:00
Jarred Sumner
35a64d8585 Bump WebKit (#14812) 2024-10-25 01:31:12 -07:00
Minsoo Choo
eb6995e09b Update SvelteKit usage guide (#14777) 2024-10-25 00:04:32 -07:00
Meghan Denny
1391e5269b Revert "ci: merge clang-format and clang-tidy into single pipeline" (#14809) 2024-10-25 00:04:13 -07:00
Dylan Conway
9621b641a1 update test/bun.lockb (#14746) 2024-10-25 00:03:52 -07:00
Dylan Conway
5eaa7301eb fix(install): patches with bin in package.json (#14807) 2024-10-25 00:03:19 -07:00
Arthur
f21870a06c chore(console): updated jsdoc table (#14792) 2024-10-24 21:20:46 -07:00
Don Isaac
0e4006eefd ci: merge clang-format and clang-tidy into single pipeline (#14798) 2024-10-24 15:26:05 -07:00
Dylan Conway
9643a924e1 bump 2024-10-24 14:24:08 -07:00
Dylan Conway
247456b675 fix(install): continue install if optional postinstall fails (#14783) 2024-10-23 21:58:53 -07:00
Meghan Denny
6f60523e6c " -> ' (#14776)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-23 19:21:36 -07:00
Jarred Sumner
2de2e9f600 48 -> 64 2024-10-23 18:27:02 -07:00
Ciro Spaciari
29bf8a505d fix(tests) pq -> pg + populate before (#14748) 2024-10-23 18:01:06 -07:00
Jarred Sumner
93d115f9b7 Reduce default max network connection limit from 256 to 48 in bun install (#14755) 2024-10-23 15:34:16 -07:00
Ashcon Partovi
74e440d58a ci: Set prioritization based on fork, main branch, or queue 2024-10-23 09:16:48 -07:00
Ashcon Partovi
aa4dde976d ci: Fix pipeline script when on main branch 2024-10-23 09:03:06 -07:00
Ashcon Partovi
eb0e9b9bde ci: Skip builds when only docs are changed (#14751) 2024-10-23 08:54:53 -07:00
Liran Tal
a656cc1b70 docs: fix missing code highlight in spawn.md (#14761) 2024-10-23 01:01:21 -07:00
Ashcon Partovi
4044ff740d ci: add scripts for building macOS images (#14743) 2024-10-22 16:07:12 -07:00
Ashcon Partovi
b9240f6ec7 cmake: only enable LTO when release + linux + ci 2024-10-22 13:10:58 -07:00
Eckhardt (Kaizen) Dreyer
3db0191409 fix(install): Skip optional dependencies if false in bunfig.toml (#14629) 2024-10-22 11:55:10 -07:00
Oliver Medhurst
00b055566e contributing: fix fedora llvm install steps (#14726) 2024-10-22 11:40:46 -07:00
snwy
517cdc1392 fix jsx symbol collisions when importing own variables with same names (#14343)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-22 00:17:18 -07:00
Pham Minh Triet
8b4b55725e Fix(doc): update Next.js guide (#14730) 2024-10-22 00:16:15 -07:00
Jarred Sumner
38d39109b3 Fix assertion failure 2024-10-21 21:46:17 -07:00
Jarred Sumner
ec29311c7a Bump 2024-10-21 18:05:10 -07:00
Ciro Spaciari
fe8d0079ec tls(Server) fix connectionListener and make alpnProtocol more compatible with node.js (#14695)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
2024-10-21 01:58:14 +00:00
Jarred Sumner
8063e9d6b8 Fixes #14411 (#14691) 2024-10-20 22:02:44 +00:00
Vaggelis Papadogiannakis
ae8de1926e Update instructions to run a bun application via pm2 with the use… (#14704) 2024-10-20 15:06:45 -07:00
Minsoo Choo
b9b94de5ed icu required on openSUSE for local webkit build (#14690) 2024-10-20 01:08:42 -07:00
Jarred Sumner
070e5804ad Implement crypto.hash() (#14683) 2024-10-19 12:14:23 -07:00
Jarred Sumner
67b4478137 Fixes #14333 (#14679) 2024-10-19 01:14:13 -07:00
Jarred Sumner
522c9fa22d Clarify some of this 2024-10-19 00:26:30 -07:00
Jarred Sumner
4b63ffeceb Clarify node-fallbacks 2024-10-19 00:23:57 -07:00
Pham Minh Triet
fe45b1e9b9 Fix(doc): SNI typo (#14508) 2024-10-18 22:37:57 -07:00
Jarred Sumner
d41ca824dd Bump 2024-10-18 22:32:42 -07:00
Meghan Denny
663331c56f fix regression in BunJSGlobalObjectDebuggable from most recent webkit upgrade (#14675) 2024-10-18 22:31:39 -07:00
Meghan Denny
64d0b626b9 Bun.color: fill out missing options and examples for outputFormat (#14656)
Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
2024-10-18 22:29:53 -07:00
Dylan Conway
e5c00ab4b4 fix(CryptoHasher): throw error if update or digest are called after digest (#14677) 2024-10-19 02:21:41 +00:00
Meghan Denny
4f2d924db3 Bun.color: match accepted outputFormat options to error (#14657) 2024-10-19 00:34:56 +00:00
Ashcon Partovi
bf8a75a63f Revert "Remove soft_fail from Buildkite since merge queue is enabled"
This reverts commit 253cc15a9f.
2024-10-18 16:04:58 -07:00
Ashcon Partovi
253cc15a9f Remove soft_fail from Buildkite since merge queue is enabled 2024-10-18 13:28:24 -07:00
Meghan Denny
fbf4b30e70 bun-types: add missing options to DigestEncoding (#14654) 2024-10-18 19:17:10 +00:00
Dylan Conway
f3b658d9f7 fix double free with invalid TLSOptions (#14648) 2024-10-18 05:16:21 +00:00
Ciro Spaciari
b652136cf7 update docs (#14620) 2024-10-18 01:26:50 +00:00
Ashcon Partovi
8376b82371 Fix merge queue (#14646) 2024-10-18 01:22:35 +00:00
Ashcon Partovi
7bb39023b8 Merge queue (#14639) 2024-10-18 01:14:42 +00:00
Meghan Denny
850cdb0587 vscode: set the launch configs' cwd to the root (#14643) 2024-10-17 16:24:10 -07:00
Ciro Spaciari
2f2a24f625 bench: fix grpc and scripts (#14638) 2024-10-17 13:30:47 -07:00
Dylan Conway
e448c4cc3b fs.mkdir empty string bugfix (#14510) 2024-10-16 18:55:49 -07:00
Ciro Spaciari
2d0b557ff7 add grpc-js bench (#14601) 2024-10-16 11:11:53 -07:00
Meghan Denny
15f5ba3e26 jest: print received value when expect().toThrow() doesnt throw (#14608) 2024-10-16 11:11:26 -07:00
refi64
1385f9f686 cmake: force the c-ares libdir to always be 'lib' (#14602) 2024-10-16 10:13:20 -07:00
Ciro Spaciari
07ccec0fd8 H2 fixes (#14606) 2024-10-16 09:06:56 -07:00
Dylan Conway
7283453eed use memset_patternN in Buffer.fill (#14599) 2024-10-15 21:16:57 -07:00
Ciro Spaciari
1a08cfcd6b fix h2 tests failures (#14598) 2024-10-15 18:36:23 -07:00
Meghan Denny
06e733cc64 ci: run clang-format on .h files too (#14597)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-10-15 16:54:49 -07:00
Ciro Spaciari
409e674526 feat(node:http2) Implement HTTP2 server support (#14286)
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-15 16:28:21 -07:00
Meghan Denny
d15eadaa2c tsconfig.json: update excludes (#14578) 2024-10-15 15:39:09 -07:00
dave caruso
5532e1af10 feat(bake): hot-reloading error modal (#14573) 2024-10-15 00:02:58 -07:00
Meghan Denny
68e6304c73 node:child_process: 'ineherit' stdio should make getters be null (#14576) 2024-10-14 23:41:34 -07:00
Meghan Denny
709cd95c30 test: use isWindows from harness (#14577) 2024-10-14 21:19:09 -07:00
Meghan Denny
3830b0c499 more passing node buffer tests (#14371) 2024-10-14 20:22:14 -07:00
Meghan Denny
291b59eb19 bun-types: small fixes (#12794) 2024-10-14 20:15:03 -07:00
190n
035f97ba13 WIP: nuke EventSource as it doesn't work anyway (#14421) 2024-10-14 19:55:06 -07:00
huseeiin
fef9555f82 fix typo. constributors -> contributors (#14531) 2024-10-14 19:50:17 -07:00
Meghan Denny
ae0106b651 delete legacy node test runner (#14572) 2024-10-14 17:31:34 -07:00
Meghan Denny
355dc56db0 scripts/runner.node.mjs: print list of failing tests when run locally (#14571) 2024-10-14 17:22:06 -07:00
Jarred Sumner
5fc53353fb Allow disabling keep-alive (#14569)
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2024-10-14 16:58:42 -07:00
dave caruso
d2fe1ce1c8 feat(bake): handle bundle errors, re-assemble full client payloads, initial error modal (#14504) 2024-10-14 16:49:38 -07:00
Jarred Sumner
29d287261b Fix several bugs when printing exceptions from Error.captureStackTrace (#14548) 2024-10-14 13:43:06 -07:00
Sebastian
6dbd679c06 docs: fix typo (#14565) 2024-10-14 13:29:28 -07:00
Meghan Denny
a5006a13a8 fetch-tcp-stress.test.ts: todo failing on macos ci (#14514) 2024-10-14 12:48:42 -07:00
Meghan Denny
bebf762bcf streams.test.js: todo failing macos test (#14513) 2024-10-14 12:48:04 -07:00
Minsoo Choo
e6ea389e4e Next.js dev server now runs on Bun (#14566) 2024-10-14 12:11:30 -07:00
Timo Sand
47ff4748bd Remove duplicate in import-json.md (#14521) 2024-10-13 15:34:38 +11:00
Don Isaac
09b031d044 fix(parser): uncaught mismatch between JSX opening/closing tags (#14528) 2024-10-12 19:49:45 -07:00
Zack Radisic
6b8fd718c2 Various CSS stuff (#14499)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-12 07:00:20 -07:00
Jarred Sumner
9ed3858e40 Some types and docs 2024-10-12 06:19:46 -07:00
Dylan Conway
6cf9c41d1f fix(install): ensure read permissions when extracting files (#14511) 2024-10-12 02:37:51 -07:00
Dylan Conway
183a8f61d8 fix bun-build-api.test.ts (#14503) 2024-10-12 00:48:22 -07:00
Jarred Sumner
85fbd1e273 we really need a merge queue 2024-10-11 21:51:40 -07:00
Mathieu Schroeter
9744684b10 Attempt to add support for iterate() with SQLite statements (#14361) 2024-10-11 21:42:59 -07:00
Jarred Sumner
43a5c4a044 Implement Bun.inspect.table (#14486) 2024-10-11 21:35:49 -07:00
Dylan Conway
d3323c84bb fix(publish): missing bins bugfix (#14488)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-11 21:28:47 -07:00
Jarred Sumner
f870293d30 Add timeout warning (#14478) 2024-10-11 21:20:55 -07:00
Jarred Sumner
4c26a257ac Fixes #14398 (#14401) 2024-10-11 21:18:07 -07:00
Jarred Sumner
c77fc5daa0 Implement --drop (#14492)
Co-authored-by: dave caruso <me@paperdave.net>
2024-10-11 20:52:23 -07:00
Dylan Conway
bbb41beadc bump webkit (#14497) 2024-10-11 19:44:53 -07:00
Meghan Denny
3f92ec8af3 fix label in 3-typescript-bug-report.yml (#14502) 2024-10-11 19:39:30 -07:00
Dylan Conway
5fd0a61ae2 CA support for bun install (#14416) 2024-10-11 13:16:26 -07:00
Meghan Denny
9fe6e25372 pm: fix assertion failure when printing lockfile summary after adding git transitive dependency (#14461)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-11 03:43:37 -07:00
190n
50e9be0dc7 Fix napi_value<=>integer conversions and napi_create_empty_array (#14479) 2024-10-10 23:50:39 -07:00
pfg
ba9db6cdb6 Fix console.table for numeric keys (#14484) 2024-10-10 23:50:02 -07:00
Meghan Denny
25fcbed8d1 enhance Buffer.from to support (de)serialization roundtrip (#14201)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-10 22:08:16 -07:00
Meghan Denny
170fafbca9 fix fs-non-number-arguments-throw.test.js (#14312) 2024-10-10 22:07:41 -07:00
Meghan Denny
874c9dbb24 fix fs-open.test.js (#14311) 2024-10-10 22:04:33 -07:00
Jarred Sumner
05f53dc70f Fixes #14464 (#14473) 2024-10-10 21:50:03 -07:00
Meghan Denny
584a8ceb84 enable iterator-helpers in webkit (#14455) 2024-10-10 15:47:59 -07:00
Michael H
05f68d79c8 docs: --conditions flag (#14463) 2024-10-10 04:04:58 -07:00
huseeiin
e650ee7967 Update bun.d.ts (#14429) 2024-10-10 02:35:53 -07:00
190n
50bb5fa1f6 Fix napi_throw_*/napi_create_*_error (#14446) 2024-10-10 02:35:38 -07:00
Dylan Conway
3452f50c96 update webkit (#14449) 2024-10-10 02:35:23 -07:00
snwy
ff476313a8 'let' statements before using statements are now properly converted into 'var' statements (#14260) 2024-10-09 19:14:22 -07:00
Jarred Sumner
def454d859 Bump 2024-10-09 18:20:19 -07:00
Grigory
73537de184 docs(bundler): add missing codetabs closing tag (#14443) 2024-10-09 15:13:42 -07:00
Meghan Denny
1bccd62784 actions: update help text for 'needs repro' label (#14428) 2024-10-09 10:44:31 -07:00
Jarred Sumner
c608a724a6 Update installation.md 2024-10-09 02:36:24 -07:00
Meghan Denny
ca6013acef move .clang-format up a folder so it affects all our c/cpp files (#14400)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-10-08 23:04:05 -07:00
snwy
05e1832c68 remove function hoisting from _parse (#14419) 2024-10-08 18:04:18 -07:00
Jarred Sumner
7a6d17bb99 chore: Make hash formatter reusable (#14372)
Co-authored-by: dave caruso <me@paperdave.net>
2024-10-08 13:30:17 -07:00
Ashcon Partovi
05fb367c5f Move generated files to codegen/ directory (#14392) 2024-10-08 10:32:16 -07:00
versecafe
7996d06b8f --footer esbuild & rollup style! (#14396)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-10-08 02:32:37 -07:00
Jarred Sumner
a234e067a5 Make .get() ignore Object.prototype instead of using getOwn (#14322) 2024-10-08 00:34:31 -07:00
Meghan Denny
c20901fd4e Update 7-install-crash-report.yml (#14394) 2024-10-07 20:45:30 -07:00
Meghan Denny
0d5eb73db0 test: add missing vm.runInContext stubs (#14341) 2024-10-07 20:38:31 -07:00
Kiwi
87c3b2f8d3 Update lockfile.md - fix typo (#14385) 2024-10-07 20:23:45 -07:00
Meghan Denny
1ce2d0e9f5 fix fs-read-empty-buffer.test.js (#14316) 2024-10-07 19:03:30 -07:00
Meghan Denny
c41ff9da93 fix fs-promises-file-handle-write.test.js (#14315) 2024-10-07 18:26:43 -07:00
190n
b0b38b42ba Return undefined from napi_get_property when property does not exist (#14366) 2024-10-07 18:05:31 -07:00
versecafe
62da730060 add banner, .d.ts, cli, make sourcemap compat, and add tests + docs (#14370) 2024-10-07 18:05:06 -07:00
Dylan Conway
c071415664 add bun pm whoami (#14387) 2024-10-07 17:36:14 -07:00
dave caruso
fc85a2dc92 feat(bake): add dependencies to IncrementalGraph (#14368) 2024-10-07 14:18:26 -07:00
Meghan Denny
c5b1c9e302 ci: shorten label names (#14314) 2024-10-07 11:56:37 -07:00
Jarred Sumner
65a6803093 Fixes #14345 (#14374) 2024-10-05 06:00:17 -07:00
Jarred Sumner
6ca68cab65 Update JSType (#14373) 2024-10-05 03:37:24 -07:00
Jarred Sumner
6645eafa08 do not use std.debug.print 2024-10-05 01:16:45 -07:00
Jarred Sumner
29e1ba044d Make this log better 2024-10-05 00:00:19 -07:00
Dylan Conway
fd15e22d64 comment 2024-10-04 23:38:39 -07:00
Dylan Conway
b2cb3603e2 fix(publish): ignore npm-notice when x-local-cache exists (#14352) 2024-10-04 23:36:34 -07:00
Dylan Conway
a15244a4c9 update webkit (#14364) 2024-10-04 22:32:48 -07:00
Zack Radisic
a01f9d8e1b Integrate CSS with bundler (#14281)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Zack Radisic <zackradisic@Mac.attlocal.net>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
Co-authored-by: Zack Radisic <zackradisic@Zacks-MBP.attlocal.net>
2024-10-04 20:23:10 -07:00
lewismiddleton
3ab3dec34d fix(docs): typo in bundler/index.md (#13370) 2024-10-04 20:21:04 -07:00
Dylan Conway
794e416642 Update CONTRIBUTING.md 2024-10-04 18:54:20 -07:00
Mathias
7885742345 fix segfault when decorating computed property #10887 (#14304) 2024-10-04 18:14:20 -07:00
versecafe
7063116c61 add missing docs for new bun pm commands (#14347) 2024-10-04 15:30:30 -07:00
Meghan Denny
4a5ec261ef node: add more passing tests (#14317) 2024-10-04 11:33:46 -07:00
Ashcon Partovi
e3f4c9fd0b ci: Fix analysis commands (#14356) 2024-10-04 09:13:23 -07:00
Dylan Conway
f307d2a6ef test(publish): ci names in user-agent (#14328) 2024-10-04 00:15:22 -07:00
dave caruso
adc86c773b chore: rename kit -> bake (#14335) 2024-10-03 15:34:53 -07:00
Dylan Conway
15427134e1 update 2024-10-03 15:11:44 -07:00
Dylan Conway
808e58cc4d update 2024-10-03 14:50:23 -07:00
Eric Liu
a375ea94ef docs: fix typo in bun publish (#14334) 2024-10-03 14:03:30 -07:00
Dylan Conway
39b1c0111e add docs for bun publish (#14327) 2024-10-03 03:41:11 -07:00
Jarred Sumner
eda608d629 Tweak how we do symbol versioning for glibc (#14272) 2024-10-03 02:42:28 -07:00
Meghan Denny
9446fd60c9 fix Buffer method aliases not being equal to each other (#14198) 2024-10-03 02:31:23 -07:00
Meghan Denny
8e5255d753 node:stream: fix setDefaultHighWaterMark (#14305) 2024-10-03 02:15:39 -07:00
Meghan Denny
13ca4544f2 enhance INVALID_ARG_TYPE and cleanup some node:buffer error handling (#14200) 2024-10-03 02:13:14 -07:00
Jarred Sumner
4d4dd1c180 Refactor node:module (#14227) 2024-10-03 00:54:56 -07:00
dave caruso
dd6554294e bake: release to canary only (#14258)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
2024-10-03 00:52:14 -07:00
Dylan Conway
50ed09654f publish help text 2024-10-02 22:57:34 -07:00
190n
0a54c24bd3 Allow throwing exceptions from napi_async_complete_callback (#14302)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-10-02 22:35:45 -07:00
versecafe
b39f49a5b9 remove bun pack in favor of bun pm pack (#14319) 2024-10-02 22:32:42 -07:00
snwy
e8fec640d8 hoisting of exports when there is top level using (#14313) 2024-10-02 22:32:04 -07:00
Ciro Spaciari
25abe67d43 update root certificates to NSS 3.104 (#14276) 2024-10-02 22:29:32 -07:00
Jarred Sumner
5f135a21b3 Update writing.md 2024-10-02 22:28:14 -07:00
Jarred Sumner
b88ed18245 On test timeout, kill any spawned processes (#14310) 2024-10-02 20:55:59 -07:00
Dylan Conway
f374ae6db1 add bun publish (#14215) 2024-10-02 20:47:22 -07:00
Jarred Sumner
94a656bc4f Support bundling .node files in ESM & CJS when targeting Node.js (#14294)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
2024-10-02 20:15:29 -07:00
190n
54e177e2f9 Rename internal NapiHandleScope push/pop methods to open/close (#14300) 2024-10-02 15:05:38 -07:00
Meghan Denny
39342e34b1 node: define missing constants (#14211) 2024-10-02 14:35:16 -07:00
Mathias
e1cd7e510e Update CONTRIBUTING.md, fix #14225 (#14303) 2024-10-02 13:44:54 -07:00
Meghan Denny
54a225953b use bun.String.static instead of ZigString when immediately converting to JSValue (#14169) 2024-10-02 13:02:48 -07:00
Meghan Denny
419229d950 add ERR_BUFFER_OUT_OF_BOUNDS to internal/errors (#14195) 2024-10-02 07:59:24 -07:00
Meghan Denny
b8a2a11c6f lazy load these requires so that node:cluster imports faster (#14291) 2024-10-02 02:30:19 -07:00
Meghan Denny
25083a4252 pm: print command name to stdout (#14266) 2024-10-02 02:24:37 -07:00
dave caruso
87424390e1 fix 14248 (#14277) 2024-10-02 02:23:54 -07:00
Dylan Conway
92e66691fa fix bun getcompletes index out of bounds (#14289) 2024-10-02 02:23:36 -07:00
Meghan Denny
edebd6faa3 windows: watcher: that line wasnt meant to go to stdout (#14288) 2024-10-02 00:26:20 -07:00
Meghan Denny
531d78aa97 BunProcess: dont use for-loop for isSignalName (#14285) 2024-10-01 23:42:52 -07:00
Meghan Denny
e831bbf4ca node: implement more validators in native code (#14177)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-10-01 21:55:05 -07:00
dave caruso
9870314ff6 fix 13394 (#14278) 2024-10-01 21:27:50 -07:00
Meghan Denny
e44d10cf17 node: lowercase primitive expectations of ERR_INVALID_ARG_TYPE (#14284) 2024-10-01 20:37:13 -07:00
Ashcon Partovi
db0750e90c cmake: Fix version detection 2024-10-01 15:48:13 -07:00
Ashcon Partovi
98e09efd02 cmake: Improve command detection (#14166) 2024-10-01 15:37:57 -07:00
Ashcon Partovi
944f342072 Revert "Remove old clang-tidy workflow"
This reverts commit 16917f7922.
2024-10-01 15:32:18 -07:00
Ashcon Partovi
16917f7922 Remove old clang-tidy workflow 2024-10-01 15:31:42 -07:00
Ashcon Partovi
27a157b6c1 Improve command detection in CMake 2024-10-01 13:50:15 -07:00
Jarred Sumner
07fd814629 Update index.md 2024-10-01 04:32:02 -07:00
Jarred Sumner
e348fef1c6 Update index.md 2024-10-01 04:26:19 -07:00
Jarred Sumner
68b910cbd9 Update index.md 2024-10-01 04:25:30 -07:00
Meghan Denny
e2f20d794f clang-format: add InsertNewlineAtEOF (#14267)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-10-01 03:49:10 -07:00
Jarred Sumner
faa524bf67 Fix missing va_end call 2024-10-01 02:06:56 -07:00
Meghan Denny
016ebf7b9b cmake: only run prettier explicitly (#14228) 2024-09-30 23:43:29 -07:00
Jarred Sumner
2f7ff95e5c Introduce bytecode caching, polish "cjs" bundler output format (#14232)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-09-30 22:37:42 -07:00
Meghan Denny
857a472033 ci: fix build error (#14262) 2024-09-30 22:20:21 -07:00
Jarred Sumner
7720d23da1 Make v8 stack trace parser code more careful (#14205) 2024-09-30 19:09:14 -07:00
Dylan Conway
ecc3e5e187 fix 14250 (#14256) 2024-09-30 19:08:13 -07:00
snwy
dcaaeecfa3 allow importing of files with top level awaits in bundler (#14218)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-09-30 16:50:50 -07:00
dave caruso
9ab51983b8 chore: make watcher use an anyopaque pointer context (#14224) 2024-09-28 01:44:55 -07:00
Jarred Sumner
af82a446df Support hmac in Bun.CryptoHasher (#14210) 2024-09-27 23:33:22 -07:00
190n
dd12715071 Propagate exceptions in napi_run_script (#14222) 2024-09-27 22:27:57 -07:00
dave caruso
514d37b3d2 kit: implement server components dev server (#14025) 2024-09-27 20:53:39 -07:00
Jarred Sumner
d09df1af47 Deflake a test 2024-09-27 14:22:59 -07:00
Meghan Denny
05afe42f31 fix Buffer.fill with a non-null empty fill including uninitialized bytes (#14199) 2024-09-27 02:50:32 -07:00
Meghan Denny
123b5219e0 include code in detached buffer error for Buffer.isUtf8 and Buffer.isAscii (#14197) 2024-09-27 02:49:38 -07:00
Meghan Denny
7113206a7d fix MAX_STRING_LENGTH constant value (#14196) 2024-09-27 02:48:04 -07:00
Andres Kalle
89fc3ef34d types: clarified parameter name (#14209) 2024-09-27 02:09:37 -07:00
Meghan Denny
392a58b0ed remove duplicate root.h includes (#14194) 2024-09-26 22:01:05 -07:00
Ciro Spaciari
02fb802b25 add req.json leak test (#14191) 2024-09-26 22:00:40 -07:00
Meghan Denny
69d33bb1d0 fix small leak in node:process.execArgv getter (#14154) 2024-09-26 17:10:14 -07:00
190n
4e51f7d85b Refactoring and bug fixes in the V8 API (#13754)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-09-26 16:54:37 -07:00
Robert Shuford
5e97fb8d97 Support reading from $HOME/.npmrc (#13990) 2024-09-26 14:41:28 -07:00
Meghan Denny
d42c032eec cleanup some error handling in BunProcess (#14178) 2024-09-26 14:20:35 -07:00
Jarred Sumner
afe974a175 Update color.md 2024-09-26 13:47:09 -07:00
Zack Radisic
274e5a2022 CSS Parser (#14122)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-09-26 13:39:26 -07:00
Jarred Sumner
18822b9f45 Support AbortSignal in Bun.spawn (#14180) 2024-09-26 10:54:54 -07:00
Meghan Denny
7b058e24ff fix memory leak in Bun.shellEscape return value (#14130) 2024-09-25 18:13:28 -07:00
Meghan Denny
ec7078a006 dont leak the address string in UDPSocket.addressToString (#14127) 2024-09-25 18:12:32 -07:00
snwy
af12ff104a fix utf8 handling when importing json (#14168) 2024-09-25 17:50:11 -07:00
Meghan Denny
80db770521 rework node:zlib to match internal js api and properly support async writes (#14079)
Co-authored-by: nektro <nektro@users.noreply.github.com>
2024-09-25 15:55:53 -07:00
Meghan Denny
c4c3019cb0 no need to cache protocol in NewServer when its statically known (#14128) 2024-09-25 14:47:50 -07:00
Ashcon Partovi
1f0f666210 Fix zig build again (#14165) 2024-09-25 13:02:56 -07:00
Ashcon Partovi
73f90c3359 Remove unused .docker directory 2024-09-25 12:43:47 -07:00
Ashcon Partovi
291a50aff5 Fix zig build (#14163) 2024-09-25 12:42:47 -07:00
Ashcon Partovi
128c658f91 Use ephemeral vendor path for now 2024-09-25 11:19:42 -07:00
Ashcon Partovi
a87341b239 Fix download zig script 2024-09-25 10:55:22 -07:00
Ashcon Partovi
3ab990e615 cmake: Fix zig build issue 2024-09-25 10:45:43 -07:00
Ashcon Partovi
ecf5d79e01 bun run clang-tidy (#14162) 2024-09-25 10:31:38 -07:00
Ashcon Partovi
b9a56a6087 cmake: Add target to download Node.js headers 2024-09-25 09:39:06 -07:00
Jarred Sumner
5722ae8d04 Make prototype pollution attacks harder in most Bun APIs that accept objects (#14119) 2024-09-25 01:16:29 -07:00
Meghan Denny
2856267fda add missing defers to JSBundler.Plugin.hasAnyMatches (#14129) 2024-09-25 01:15:32 -07:00
Meghan Denny
da70c891df dont leak the message when node:util.getSystemErrorName is passed an invalid code (#14126) 2024-09-25 01:13:22 -07:00
Wilmer Paulino
6f27b5559d Switch RSA asymmetric sign implementation to BoringSSL (#14125) 2024-09-25 01:12:50 -07:00
Ashcon Partovi
117e1b3883 bun run prettier (#14153)
Co-authored-by: Electroid <Electroid@users.noreply.github.com>
2024-09-24 22:46:18 -07:00
Ashcon Partovi
1e1025ca37 bun run zig-format (#14152) 2024-09-24 22:10:12 -07:00
Ashcon Partovi
30dc72c17b bun run clang-format (#14148)
Co-authored-by: Electroid <Electroid@users.noreply.github.com>
2024-09-24 20:39:29 -07:00
Jarred Sumner
17d719fa4e Make server.stop return a Promise that fulfills when all opened connections are closed (#14120) 2024-09-24 14:07:29 -07:00
Meghan Denny
0ac2a7da0a dont leak return value in crash_handler jsGetFeaturesAsVLQ (#14131) 2024-09-24 12:26:58 -07:00
Dylan Conway
9d23ce16ec fix(install): relative paths to tarballs in workspaces (#14121) 2024-09-23 22:44:24 -07:00
Ashcon Partovi
7d94c59545 Publish VSCode extension 2024-09-23 16:05:12 -07:00
Meghan Denny
33075394a4 cpp: always return empty JSValue value after throwing exception (#13935)
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2024-09-23 13:53:08 -07:00
Jarred Sumner
ff9560c82a Fix unbalanced ref count involving file descriptors passed to Bun.connect (#14107) 2024-09-23 10:28:50 -07:00
Jarred Sumner
2f8c20ef82 Implement --registry CLI flag in bun install (#14090) 2024-09-22 21:27:33 -07:00
Jarred Sumner
d05070dbfd Fix regression from #13414 (#14092) 2024-09-22 16:02:49 -07:00
Jarred Sumner
1244907a92 Bump 2024-09-22 02:53:21 -07:00
Jarred Sumner
81e5ee26bd Don't re-create the FIFO in streams every time (#14088) 2024-09-22 02:13:11 -07:00
Jarred Sumner
27e7aa7923 Update from-npm-install-to-bun-install.md 2024-09-22 00:33:41 -07:00
Jarred Sumner
f89623aa5e Update from-npm-install-to-bun-install.md 2024-09-22 00:31:01 -07:00
Jarred Sumner
3cc51ceb98 Update from-npm-install-to-bun-install.md 2024-09-22 00:30:08 -07:00
Jarred Sumner
e944bb3638 Update from-npm-install-to-bun-install.md 2024-09-22 00:29:23 -07:00
Jarred Sumner
797750ef42 Update from-npm-install-to-bun-install.md 2024-09-22 00:27:47 -07:00
Jarred Sumner
c267d76f05 Update from-npm-install-to-bun-install.md 2024-09-22 00:25:47 -07:00
Jarred Sumner
c5c1e8ff3a Update from-npm-install-to-bun-install.md 2024-09-22 00:24:56 -07:00
Jarred Sumner
1eab8ec107 Update from-npm-install-to-bun-install.md 2024-09-22 00:23:44 -07:00
Jarred Sumner
60d8c8ad4c Update from-npm-install-to-bun-install.md 2024-09-22 00:17:41 -07:00
Jarred Sumner
dba108f8c4 Update from-npm-install-to-bun-install.md 2024-09-21 23:32:34 -07:00
Jarred Sumner
18251e1b60 Create from-npm-install-to-bun-install.md 2024-09-21 23:29:16 -07:00
Xmarmalade
0bc21b3ddf docs: add ccache for Windows System Dependencies (#14080) 2024-09-21 01:35:01 -07:00
Jarred Sumner
c298b23c45 Fix process.cwd on windows (#14081) 2024-09-21 01:32:23 -07:00
snwy
722e3fa481 fix for windows debug support (#14048)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-09-21 00:20:33 -07:00
Jarred Sumner
3fc092d23f Fix ci issue 2024-09-20 22:13:16 -07:00
Jarred Sumner
6e0847ca49 Fix searching for lld in $PATH on Linux 2024-09-20 22:09:21 -07:00
Jarred Sumner
7a190de2f1 Fix upload-s3.ts script 2024-09-20 21:34:50 -07:00
Dylan Conway
57a1d7b4ee update 2024-09-20 20:38:52 -07:00
Dylan Conway
3e0e99176a udpate 2024-09-20 20:37:49 -07:00
1536 changed files with 231730 additions and 42147 deletions

809
.buildkite/ci.mjs Executable file
View File

@@ -0,0 +1,809 @@
#!/usr/bin/env node
/**
* Build and test Bun on macOS, Linux, and Windows.
* @link https://buildkite.com/docs/pipelines/defining-steps
*/
import { writeFileSync } from "node:fs";
import { join } from "node:path";
import {
getBootstrapVersion,
getBuildNumber,
getCanaryRevision,
getChangedFiles,
getCommit,
getCommitMessage,
getLastSuccessfulBuild,
getMainBranch,
getTargetBranch,
isBuildkite,
isFork,
isMainBranch,
isMergeQueue,
printEnvironment,
spawnSafe,
toYaml,
uploadArtifact,
} from "../scripts/utils.mjs";
/**
* @typedef PipelineOptions
* @property {string} [buildId]
* @property {boolean} [buildImages]
* @property {boolean} [publishImages]
* @property {boolean} [skipTests]
*/
/**
* @param {PipelineOptions} options
*/
function getPipeline(options) {
const { buildId, buildImages, publishImages, skipTests } = options;
/**
* Helpers
*/
/**
* @param {string} text
* @returns {string}
* @link https://github.com/buildkite/emojis#emoji-reference
*/
const getEmoji = string => {
if (string === "amazonlinux") {
return ":aws:";
}
return `:${string}:`;
};
/**
* @typedef {"linux" | "darwin" | "windows"} Os
* @typedef {"aarch64" | "x64"} Arch
* @typedef {"musl"} Abi
*/
/**
* @typedef Target
* @property {Os} os
* @property {Arch} arch
* @property {Abi} [abi]
* @property {boolean} [baseline]
*/
/**
* @param {Target} target
* @returns {string}
*/
const getTargetKey = target => {
const { os, arch, abi, baseline } = target;
let key = `${os}-${arch}`;
if (abi) {
key += `-${abi}`;
}
if (baseline) {
key += "-baseline";
}
return key;
};
/**
* @param {Target} target
* @returns {string}
*/
const getTargetLabel = target => {
const { os, arch, abi, baseline } = target;
let label = `${getEmoji(os)} ${arch}`;
if (abi) {
label += `-${abi}`;
}
if (baseline) {
label += "-baseline";
}
return label;
};
/**
* @typedef Platform
* @property {Os} os
* @property {Arch} arch
* @property {Abi} [abi]
* @property {boolean} [baseline]
* @property {string} [distro]
* @property {string} release
*/
/**
* @param {Platform} platform
* @returns {string}
*/
const getPlatformKey = platform => {
const { os, arch, abi, baseline, distro, release } = platform;
const target = getTargetKey({ os, arch, abi, baseline });
if (distro) {
return `${target}-${distro}-${release.replace(/\./g, "")}`;
}
return `${target}-${release.replace(/\./g, "")}`;
};
/**
* @param {Platform} platform
* @returns {string}
*/
const getPlatformLabel = platform => {
const { os, arch, baseline, distro, release } = platform;
let label = `${getEmoji(distro || os)} ${release} ${arch}`;
if (baseline) {
label += "-baseline";
}
return label;
};
/**
* @param {Platform} platform
* @returns {string}
*/
const getImageKey = platform => {
const { os, arch, distro, release } = platform;
if (distro) {
return `${os}-${arch}-${distro}-${release.replace(/\./g, "")}`;
}
return `${os}-${arch}-${release.replace(/\./g, "")}`;
};
/**
* @param {Platform} platform
* @returns {string}
*/
const getImageLabel = platform => {
const { os, arch, distro, release } = platform;
return `${getEmoji(distro || os)} ${release} ${arch}`;
};
/**
* @param {number} [limit]
* @link https://buildkite.com/docs/pipelines/command-step#retry-attributes
*/
const getRetry = (limit = 0) => {
return {
automatic: [
{ exit_status: 1, limit },
{ exit_status: -1, limit: 3 },
{ exit_status: 255, limit: 3 },
{ signal_reason: "agent_stop", limit: 3 },
],
};
};
/**
* @returns {number}
* @link https://buildkite.com/docs/pipelines/managing-priorities
*/
const getPriority = () => {
if (isFork()) {
return -1;
}
if (isMainBranch()) {
return 2;
}
if (isMergeQueue()) {
return 1;
}
return 0;
};
/**
* @param {Target} target
* @returns {Record<string, string | undefined>}
*/
const getBuildEnv = target => {
const { baseline, abi } = target;
return {
ENABLE_BASELINE: baseline ? "ON" : "OFF",
ABI: abi === "musl" ? "musl" : undefined,
};
};
/**
* @param {Target} target
* @returns {string}
*/
const getBuildToolchain = target => {
const { os, arch, abi, baseline } = target;
let key = `${os}-${arch}`;
if (abi) {
key += `-${abi}`;
}
if (baseline) {
key += "-baseline";
}
return key;
};
/**
* Agents
*/
/**
* @typedef {Record<string, string | undefined>} Agent
*/
/**
* @param {Platform} platform
* @returns {boolean}
*/
const isUsingNewAgent = platform => {
const { os, distro } = platform;
if (os === "linux" && distro === "alpine") {
return true;
}
return false;
};
/**
* @param {"v1" | "v2"} version
* @param {Platform} platform
* @param {string} [instanceType]
* @returns {Agent}
*/
const getEmphemeralAgent = (version, platform, instanceType) => {
const { os, arch, abi, distro, release } = platform;
if (version === "v1") {
return {
robobun: true,
os,
arch,
distro,
release,
};
}
let image;
if (distro) {
image = `${os}-${arch}-${distro}-${release}`;
} else {
image = `${os}-${arch}-${release}`;
}
if (buildImages && !publishImages) {
image += `-build-${getBuildNumber()}`;
} else {
image += `-v${getBootstrapVersion()}`;
}
return {
robobun: true,
robobun2: true,
os,
arch,
abi,
distro,
release,
"image-name": image,
"instance-type": instanceType,
};
};
/**
* @param {Target} target
* @returns {Agent}
*/
const getBuildAgent = target => {
const { os, arch, abi } = target;
if (isUsingNewAgent(target)) {
const instanceType = arch === "aarch64" ? "c8g.8xlarge" : "c7i.8xlarge";
return getEmphemeralAgent("v2", target, instanceType);
}
return {
queue: `build-${os}`,
os,
arch,
abi,
};
};
/**
* @param {Target} target
* @returns {Agent}
*/
const getZigAgent = target => {
const { abi, arch } = target;
// if (abi === "musl") {
// const instanceType = arch === "aarch64" ? "c8g.large" : "c7i.large";
// return getEmphemeralAgent("v2", target, instanceType);
// }
return {
queue: "build-zig",
};
};
/**
* @param {Platform} platform
* @returns {Agent}
*/
const getTestAgent = platform => {
const { os, arch, release } = platform;
if (isUsingNewAgent(platform)) {
const instanceType = arch === "aarch64" ? "t4g.large" : "t3.large";
return getEmphemeralAgent("v2", platform, instanceType);
}
if (os === "darwin") {
return {
os,
arch,
release,
queue: "test-darwin",
};
}
return getEmphemeralAgent("v1", platform);
};
/**
* Steps
*/
/**
* @typedef Step
* @property {string} key
* @property {string} [label]
* @property {Record<string, string | undefined>} [agents]
* @property {Record<string, string | undefined>} [env]
* @property {string} command
* @property {string[]} [depends_on]
* @property {Record<string, string | undefined>} [retry]
* @property {boolean} [cancel_on_build_failing]
* @property {boolean} [soft_fail]
* @property {number} [parallelism]
* @property {number} [concurrency]
* @property {string} [concurrency_group]
* @property {number} [priority]
* @property {number} [timeout_in_minutes]
* @link https://buildkite.com/docs/pipelines/command-step
*/
/**
* @param {Platform} platform
* @returns {Step}
*/
const getBuildImageStep = platform => {
const { os, arch, distro, release } = platform;
const action = publishImages ? "publish-image" : "create-image";
return {
key: `${getImageKey(platform)}-build-image`,
label: `${getImageLabel(platform)} - build-image`,
agents: {
queue: "build-image",
},
env: {
DEBUG: "1",
},
command: `node ./scripts/machine.mjs ${action} --ci --cloud=aws --os=${os} --arch=${arch} --distro=${distro} --distro-version=${release}`,
};
};
/**
* @param {Target} target
* @returns {Step}
*/
const getBuildVendorStep = target => {
return {
key: `${getTargetKey(target)}-build-vendor`,
label: `${getTargetLabel(target)} - build-vendor`,
agents: getBuildAgent(target),
retry: getRetry(),
cancel_on_build_failing: isMergeQueue(),
env: getBuildEnv(target),
command: "bun run build:ci --target dependencies",
};
};
/**
* @param {Target} target
* @returns {Step}
*/
const getBuildCppStep = target => {
return {
key: `${getTargetKey(target)}-build-cpp`,
label: `${getTargetLabel(target)} - build-cpp`,
agents: getBuildAgent(target),
retry: getRetry(),
cancel_on_build_failing: isMergeQueue(),
env: {
BUN_CPP_ONLY: "ON",
...getBuildEnv(target),
},
command: "bun run build:ci --target bun",
};
};
/**
* @param {Target} target
* @returns {Step}
*/
const getBuildZigStep = target => {
const toolchain = getBuildToolchain(target);
return {
key: `${getTargetKey(target)}-build-zig`,
label: `${getTargetLabel(target)} - build-zig`,
agents: getZigAgent(target),
retry: getRetry(1), // FIXME: Sometimes zig build hangs, so we need to retry once
cancel_on_build_failing: isMergeQueue(),
env: getBuildEnv(target),
command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`,
};
};
/**
* @param {Target} target
* @returns {Step}
*/
const getBuildBunStep = target => {
return {
key: `${getTargetKey(target)}-build-bun`,
label: `${getTargetLabel(target)} - build-bun`,
depends_on: [
`${getTargetKey(target)}-build-vendor`,
`${getTargetKey(target)}-build-cpp`,
`${getTargetKey(target)}-build-zig`,
],
agents: getBuildAgent(target),
retry: getRetry(),
cancel_on_build_failing: isMergeQueue(),
env: {
BUN_LINK_ONLY: "ON",
...getBuildEnv(target),
},
command: "bun run build:ci --target bun",
};
};
/**
* @param {Platform} platform
* @returns {Step}
*/
const getTestBunStep = platform => {
const { os } = platform;
let command;
if (os === "windows") {
command = `node .\\scripts\\runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
} else {
command = `./scripts/runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
}
let parallelism;
if (os === "darwin") {
parallelism = 2;
} else {
parallelism = 10;
}
let depends;
let env;
if (buildId) {
env = {
BUILDKITE_ARTIFACT_BUILD_ID: buildId,
};
} else {
depends = [`${getTargetKey(platform)}-build-bun`];
}
let retry;
if (os !== "windows") {
// When the runner fails on Windows, Buildkite only detects an exit code of 1.
// Because of this, we don't know if the run was fatal, or soft-failed.
retry = getRetry(1);
}
return {
key: `${getPlatformKey(platform)}-test-bun`,
label: `${getPlatformLabel(platform)} - test-bun`,
depends_on: depends,
agents: getTestAgent(platform),
retry,
cancel_on_build_failing: isMergeQueue(),
soft_fail: isMainBranch(),
parallelism,
command,
env,
};
};
/**
* Config
*/
/**
* @type {Platform[]}
*/
const buildPlatforms = [
{ os: "darwin", arch: "aarch64", release: "14" },
{ os: "darwin", arch: "x64", release: "14" },
{ os: "linux", arch: "aarch64", distro: "debian", release: "11" },
{ os: "linux", arch: "x64", distro: "debian", release: "11" },
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
{ os: "windows", arch: "x64", release: "2019" },
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
];
/**
* @type {Platform[]}
*/
const testPlatforms = [
{ os: "darwin", arch: "aarch64", release: "14" },
{ os: "darwin", arch: "aarch64", release: "13" },
{ os: "darwin", arch: "x64", release: "14" },
{ os: "darwin", arch: "x64", release: "13" },
{ os: "linux", arch: "aarch64", distro: "debian", release: "12" },
// { os: "linux", arch: "aarch64", distro: "debian", release: "11" },
// { os: "linux", arch: "aarch64", distro: "debian", release: "10" },
{ os: "linux", arch: "x64", distro: "debian", release: "12" },
// { os: "linux", arch: "x64", distro: "debian", release: "11" },
// { os: "linux", arch: "x64", distro: "debian", release: "10" },
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "12" },
// { os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
// { os: "linux", arch: "x64", baseline: true, distro: "debian", release: "10" },
// { os: "linux", arch: "aarch64", distro: "ubuntu", release: "24.04" },
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "22.04" },
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "20.04" },
// { os: "linux", arch: "x64", distro: "ubuntu", release: "24.04" },
{ os: "linux", arch: "x64", distro: "ubuntu", release: "22.04" },
{ os: "linux", arch: "x64", distro: "ubuntu", release: "20.04" },
// { os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "24.04" },
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "22.04" },
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "20.04" },
// { os: "linux", arch: "aarch64", distro: "amazonlinux", release: "2023" },
// { os: "linux", arch: "aarch64", distro: "amazonlinux", release: "2" },
// { os: "linux", arch: "x64", distro: "amazonlinux", release: "2023" },
// { os: "linux", arch: "x64", distro: "amazonlinux", release: "2" },
// { os: "linux", arch: "x64", baseline: true, distro: "amazonlinux", release: "2023" },
// { os: "linux", arch: "x64", baseline: true, distro: "amazonlinux", release: "2" },
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
// { os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.17" },
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
// { os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.17" },
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
// { os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.17" },
{ os: "windows", arch: "x64", release: "2019" },
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
];
const imagePlatforms = new Map(
[...buildPlatforms, ...testPlatforms]
.filter(platform => buildImages && isUsingNewAgent(platform))
.map(platform => [getImageKey(platform), platform]),
);
/**
* @type {Step[]}
*/
const steps = [];
if (imagePlatforms.size) {
steps.push({
group: ":docker:",
steps: [...imagePlatforms.values()].map(platform => getBuildImageStep(platform)),
});
}
for (const platform of buildPlatforms) {
const { os, arch, abi, baseline } = platform;
/** @type {Step[]} */
const platformSteps = [];
if (buildImages || !buildId) {
platformSteps.push(
getBuildVendorStep(platform),
getBuildCppStep(platform),
getBuildZigStep(platform),
getBuildBunStep(platform),
);
}
if (!skipTests) {
platformSteps.push(
...testPlatforms
.filter(
testPlatform =>
testPlatform.os === os &&
testPlatform.arch === arch &&
testPlatform.abi === abi &&
testPlatform.baseline === baseline,
)
.map(testPlatform => getTestBunStep(testPlatform)),
);
}
if (!platformSteps.length) {
continue;
}
if (imagePlatforms.has(getImageKey(platform))) {
for (const step of platformSteps) {
if (step.agents?.["image-name"]) {
step.depends_on ??= [];
step.depends_on.push(`${getImageKey(platform)}-build-image`);
}
}
}
steps.push({
key: getTargetKey(platform),
group: getTargetLabel(platform),
steps: platformSteps,
});
}
if (isMainBranch() && !isFork()) {
steps.push({
label: ":github:",
agents: {
queue: "test-darwin",
},
depends_on: buildPlatforms.map(platform => `${getTargetKey(platform)}-build-bun`),
command: ".buildkite/scripts/upload-release.sh",
});
}
return {
priority: getPriority(),
steps,
};
}
async function main() {
printEnvironment();
console.log("Checking last successful build...");
const lastBuild = await getLastSuccessfulBuild();
if (lastBuild) {
const { id, path, commit_id: commit } = lastBuild;
console.log(" - Build ID:", id);
console.log(" - Build URL:", new URL(path, "https://buildkite.com/").toString());
console.log(" - Commit:", commit);
} else {
console.log(" - No build found");
}
let changedFiles;
if (!isFork()) {
console.log("Checking changed files...");
const baseRef = getCommit();
console.log(" - Base Ref:", baseRef);
const headRef = lastBuild?.commit_id || getTargetBranch() || getMainBranch();
console.log(" - Head Ref:", headRef);
changedFiles = await getChangedFiles(undefined, baseRef, headRef);
if (changedFiles) {
if (changedFiles.length) {
changedFiles.forEach(filename => console.log(` - ${filename}`));
} else {
console.log(" - No changed files");
}
}
}
const isDocumentationFile = filename => /^(\.vscode|\.github|bench|docs|examples)|\.(md)$/i.test(filename);
const isTestFile = filename => /^test/i.test(filename) || /runner\.node\.mjs$/i.test(filename);
console.log("Checking if CI should be forced...");
let forceBuild;
{
const message = getCommitMessage();
const match = /\[(force ci|ci force|ci force build)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
forceBuild = true;
}
}
console.log("Checking if CI should be skipped...");
if (!forceBuild) {
const message = getCommitMessage();
const match = /\[(skip ci|no ci|ci skip|ci no)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
return;
}
if (changedFiles && changedFiles.every(filename => isDocumentationFile(filename))) {
console.log(" - Yes, because all changed files are documentation");
return;
}
}
console.log("Checking if CI should re-build images...");
let buildImages;
{
const message = getCommitMessage();
const match = /\[(build images?|images? build)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
buildImages = true;
}
}
console.log("Checking if CI should publish images...");
let publishImages;
{
const message = getCommitMessage();
const match = /\[(publish images?|images? publish)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
publishImages = true;
buildImages = true;
}
}
console.log("Checking if build should be skipped...");
let skipBuild;
if (!forceBuild) {
const message = getCommitMessage();
const match = /\[(only tests?|tests? only|skip build|no build|build skip|build no)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
skipBuild = true;
}
if (changedFiles && changedFiles.every(filename => isTestFile(filename) || isDocumentationFile(filename))) {
console.log(" - Yes, because all changed files are tests or documentation");
skipBuild = true;
}
}
console.log("Checking if tests should be skipped...");
let skipTests;
{
const message = getCommitMessage();
const match = /\[(skip tests?|tests? skip|no tests?|tests? no)\]/i.exec(message);
if (match) {
console.log(" - Yes, because commit message contains:", match[1]);
skipTests = true;
}
if (isMainBranch()) {
console.log(" - Yes, because we're on main branch");
skipTests = true;
}
}
console.log("Checking if build is a named release...");
let buildRelease;
{
const message = getCommitMessage();
const match = /\[(release|release build|build release)\]/i.exec(message);
if (match) {
const [, reason] = match;
console.log(" - Yes, because commit message contains:", reason);
buildRelease = true;
}
}
console.log("Generating pipeline...");
const pipeline = getPipeline({
buildId: lastBuild && skipBuild && !forceBuild ? lastBuild.id : undefined,
buildImages,
publishImages,
skipTests,
});
const content = toYaml(pipeline);
const contentPath = join(process.cwd(), ".buildkite", "ci.yml");
writeFileSync(contentPath, content);
console.log("Generated pipeline:");
console.log(" - Path:", contentPath);
console.log(" - Size:", (content.length / 1024).toFixed(), "KB");
if (isBuildkite) {
await uploadArtifact(contentPath);
}
if (isBuildkite) {
console.log("Setting canary revision...");
const canaryRevision = buildRelease ? 0 : await getCanaryRevision();
await spawnSafe(["buildkite-agent", "meta-data", "set", "canary", `${canaryRevision}`], { stdio: "inherit" });
console.log("Uploading pipeline...");
await spawnSafe(["buildkite-agent", "pipeline", "upload", contentPath], { stdio: "inherit" });
}
}
await main();

View File

@@ -1,790 +0,0 @@
# 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.
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:
- "bun run build:ci --target dependencies"
- key: "darwin-aarch64-build-cpp"
label: ":darwin: aarch64 - build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
env:
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "darwin-aarch64-build-zig"
label: ":darwin: aarch64 - build-zig"
agents:
queue: "build-zig"
command:
- "bun run build:ci --target bun-zig --toolchain darwin-aarch64"
- key: "darwin-aarch64-build-bun"
label: ":darwin: aarch64 - build-bun"
agents:
queue: "build-darwin"
os: "darwin"
arch: "aarch64"
depends_on:
- "darwin-aarch64-build-deps"
- "darwin-aarch64-build-cpp"
- "darwin-aarch64-build-zig"
env:
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- 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:
- "bun run build:ci --target dependencies"
- key: "darwin-x64-build-cpp"
label: ":darwin: x64 - build-cpp"
agents:
queue: "build-darwin"
os: "darwin"
arch: "x64"
env:
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "darwin-x64-build-zig"
label: ":darwin: x64 - build-zig"
agents:
queue: "build-zig"
command:
- "bun run build:ci --target bun-zig --toolchain darwin-x64"
- key: "darwin-x64-build-bun"
label: ":darwin: x64 - build-bun"
agents:
queue: "build-darwin"
os: "darwin"
arch: "x64"
depends_on:
- "darwin-x64-build-deps"
- "darwin-x64-build-cpp"
- "darwin-x64-build-zig"
env:
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "darwin-x64-test-macos-14"
label: ":darwin: 14 x64 - 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-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: 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-x64-build-bun"
agents:
queue: "test-darwin"
os: "darwin"
arch: "x64"
release: "13"
command:
- "./scripts/runner.node.mjs --step darwin-x64-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:
- "bun run build:ci --target dependencies"
- key: "linux-x64-build-cpp"
label: ":linux: x64 - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
env:
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-x64-build-zig"
label: ":linux: x64 - build-zig"
agents:
queue: "build-zig"
command:
- "bun run build:ci --target bun-zig --toolchain linux-x64"
- key: "linux-x64-build-bun"
label: ":linux: x64 - build-bun"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
depends_on:
- "linux-x64-build-deps"
- "linux-x64-build-cpp"
- "linux-x64-build-zig"
env:
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-x64-test-debian-12"
label: ":debian: 12 x64 - test-bun"
if: "build.branch != 'main'"
parallelism: 10
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: 10
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: 10
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"
env:
ENABLE_BASELINE: "ON"
command:
- "bun run build:ci --target dependencies"
- key: "linux-x64-baseline-build-cpp"
label: ":linux: x64-baseline - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
env:
ENABLE_BASELINE: "ON"
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-x64-baseline-build-zig"
label: ":linux: x64-baseline - build-zig"
agents:
queue: "build-zig"
env:
ENABLE_BASELINE: "ON"
command:
- "bun run build:ci --target bun-zig --toolchain linux-x64-baseline"
- key: "linux-x64-baseline-build-bun"
label: ":linux: x64-baseline - build-bun"
agents:
queue: "build-linux"
os: "linux"
arch: "x64"
depends_on:
- "linux-x64-baseline-build-deps"
- "linux-x64-baseline-build-cpp"
- "linux-x64-baseline-build-zig"
env:
ENABLE_BASELINE: "ON"
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-x64-baseline-test-debian-12"
label: ":debian: 12 x64-baseline - test-bun"
if: "build.branch != 'main'"
parallelism: 10
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: 10
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: 10
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"
# 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:
- "bun run build:ci --target dependencies"
- key: "linux-aarch64-build-cpp"
label: ":linux: aarch64 - build-cpp"
agents:
queue: "build-linux"
os: "linux"
arch: "aarch64"
env:
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-aarch64-build-zig"
label: ":linux: aarch64 - build-zig"
agents:
queue: "build-zig"
command:
- "bun run build:ci --target bun-zig --toolchain linux-aarch64"
- key: "linux-aarch64-build-bun"
label: ":linux: aarch64 - build-bun"
agents:
queue: "build-linux"
os: "linux"
arch: "aarch64"
depends_on:
- "linux-aarch64-build-deps"
- "linux-aarch64-build-cpp"
- "linux-aarch64-build-zig"
env:
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "linux-aarch64-test-debian-12"
label: ":debian: 12 aarch64 - test-bun"
if: "build.branch != 'main'"
parallelism: 10
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: 10
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: 10
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"
# 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"
retry:
automatic:
- exit_status: 255
limit: 5
command:
- "bun run build:ci --target dependencies"
- key: "windows-x64-build-cpp"
label: ":windows: x64 - build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
retry:
automatic:
- exit_status: 255
limit: 5
env:
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "windows-x64-build-zig"
label: ":windows: x64 - build-zig"
agents:
queue: "build-zig"
command:
- "bun run build:ci --target bun-zig --toolchain windows-x64"
- key: "windows-x64-build-bun"
label: ":windows: x64 - build-bun"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
depends_on:
- "windows-x64-build-deps"
- "windows-x64-build-cpp"
- "windows-x64-build-zig"
retry:
automatic:
- exit_status: 255
limit: 5
env:
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- 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"
retry:
automatic:
- exit_status: 255
limit: 5
env:
ENABLE_BASELINE: "ON"
command:
- "bun run build:ci --target dependencies"
- key: "windows-x64-baseline-build-cpp"
label: ":windows: x64-baseline - build-cpp"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
retry:
automatic:
- exit_status: 255
limit: 5
env:
ENABLE_BASELINE: "ON"
BUN_CPP_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- key: "windows-x64-baseline-build-zig"
label: ":windows: x64-baseline - build-zig"
agents:
queue: "build-zig"
env:
ENABLE_BASELINE: "ON"
command:
- "bun run build:ci --target bun-zig --toolchain windows-x64-baseline"
- key: "windows-x64-baseline-build-bun"
label: ":windows: x64-baseline - build-bun"
agents:
queue: "build-windows"
os: "windows"
arch: "x64"
depends_on:
- "windows-x64-baseline-build-deps"
- "windows-x64-baseline-build-cpp"
- "windows-x64-baseline-build-zig"
retry:
automatic:
- exit_status: 255
limit: 5
env:
ENABLE_BASELINE: "ON"
BUN_LINK_ONLY: "ON"
command:
- "bun run build:ci --target bun"
- 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"

View File

@@ -2,96 +2,10 @@
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"
run_command node ".buildkite/ci.mjs"

View File

@@ -162,6 +162,27 @@ function upload_s3_file() {
run_command aws --endpoint-url="$AWS_ENDPOINT" s3 cp "$file" "s3://$AWS_BUCKET/$folder/$file"
}
function send_bench_webhook() {
if [ -z "$BENCHMARK_URL" ]; then
echo "error: \$BENCHMARK_URL is not set"
# exit 1 # TODO: this isn't live yet
return
fi
local tag="$1"
local commit="$BUILDKITE_COMMIT"
local artifact_path="${commit}"
if [ "$tag" == "canary" ]; then
artifact_path="${commit}-canary"
fi
local artifact_url="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/$artifact_path/bun-linux-x64.zip"
local webhook_url="$BENCHMARK_URL?tag=$tag&commit=$commit&artifact_url=$artifact_url"
curl -X POST "$webhook_url"
}
function create_release() {
assert_main
assert_buildkite_agent
@@ -181,6 +202,12 @@ function create_release() {
bun-linux-x64-profile.zip
bun-linux-x64-baseline.zip
bun-linux-x64-baseline-profile.zip
bun-linux-aarch64-musl.zip
bun-linux-aarch64-musl-profile.zip
bun-linux-x64-musl.zip
bun-linux-x64-musl-profile.zip
bun-linux-x64-musl-baseline.zip
bun-linux-x64-musl-baseline-profile.zip
bun-windows-x64.zip
bun-windows-x64-profile.zip
bun-windows-x64-baseline.zip
@@ -206,6 +233,7 @@ function create_release() {
update_github_release "$tag"
create_sentry_release "$tag"
send_bench_webhook "$tag"
}
function assert_canary() {

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +0,0 @@
# Note: 2 blank lines are required between entries
Package: *
Pin: release a=eoan
Pin-Priority: 500
Package: *
Pin: origin "ftp.debian.org"
Pin-Priority: 300
# Pattern includes 'chromium', 'chromium-browser' and similarly
# named dependencies:
Package: chromium*
Pin: origin "ftp.debian.org"
Pin-Priority: 700

View File

@@ -1,8 +0,0 @@
#!/bin/bash
set -euxo pipefail
name=$(openssl rand -hex 12)
id=$(docker create --name=bun-binary-$name $CONTAINER_TAG)
docker container cp bun-binary-$name:$BUN_RELEASE_DIR bun-binary
echo -e "bun-binary-$name"

View File

@@ -1,3 +0,0 @@
deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster-updates main
deb http://deb.debian.org/debian-security buster/updates main

View File

@@ -1,34 +0,0 @@
export DOCKER_BUILDKIT=1
export BUILDKIT_ARCH=$(uname -m)
export ARCH=${BUILDKIT_ARCH}
if [ "$BUILDKIT_ARCH" == "amd64" ]; then
export BUILDKIT_ARCH="amd64"
export ARCH=x64
fi
if [ "$BUILDKIT_ARCH" == "x86_64" ]; then
export BUILDKIT_ARCH="amd64"
export ARCH=x64
fi
if [ "$BUILDKIT_ARCH" == "arm64" ]; then
export BUILDKIT_ARCH="arm64"
export ARCH=aarch64
fi
if [ "$BUILDKIT_ARCH" == "aarch64" ]; then
export BUILDKIT_ARCH="arm64"
export ARCH=aarch64
fi
if [ "$BUILDKIT_ARCH" == "armv7l" ]; then
echo "Unsupported platform: $BUILDKIT_ARCH"
exit 1
fi
export BUILD_ID=$(cat build-id)
export CONTAINER_NAME=bun-linux-$ARCH
export DEBUG_CONTAINER_NAME=debug-bun-linux-$ARCH
export TEMP=/tmp/bun-0.0.$BUILD_ID

View File

@@ -1,11 +0,0 @@
#!/bin/bash
set -euxo pipefail
docker pull bunbunbunbun/bun-test-base:latest --platform=linux/amd64
docker pull bunbunbunbun/bun-base:latest --platform=linux/amd64
docker pull bunbunbunbun/bun-base-with-zig-and-webkit:latest --platform=linux/amd64
docker tag bunbunbunbun/bun-test-base:latest bun-base:latest
docker tag bunbunbunbun/bun-base:latest bun-base:latest
docker tag bunbunbunbun/bun-base-with-zig-and-webkit:latest bun-base-with-zig-and-webkit:latest

View File

@@ -1,47 +0,0 @@
#!/bin/bash
source "dockerfile-common.sh"
export $CONTAINER_NAME=$CONTAINER_NAME-local
rm -rf $TEMP
mkdir -p $TEMP
docker build . --target release --progress=plain -t $CONTAINER_NAME:latest --build-arg BUILDKIT_INLINE_CACHE=1 --platform=linux/$BUILDKIT_ARCH --cache-from $CONTAINER_NAME:latest
if (($?)); then
echo "Failed to build container"
exit 1
fi
id=$(docker create $CONTAINER_NAME:latest)
docker cp $id:/home/ubuntu/bun-release $TEMP/$CONTAINER_NAME
if (($?)); then
echo "Failed to cp container"
exit 1
fi
cd $TEMP
mkdir -p $TEMP/$CONTAINER_NAME $TEMP/$DEBUG_CONTAINER_NAME
mv $CONTAINER_NAME/bun-profile $DEBUG_CONTAINER_NAME/bun
zip -r $CONTAINER_NAME.zip $CONTAINER_NAME
zip -r $DEBUG_CONTAINER_NAME.zip $DEBUG_CONTAINER_NAME
docker rm -v $id
abs=$(realpath $TEMP/$CONTAINER_NAME.zip)
debug_abs=$(realpath $TEMP/$DEBUG_CONTAINER_NAME.zip)
case $(uname -s) in
"Linux") target="linux" ;;
*) target="other" ;;
esac
if [ "$target" = "linux" ]; then
if command -v bun --version >/dev/null; then
cp $TEMP/$CONTAINER_NAME/bun $(which bun)
cp $TEMP/$DEBUG_CONTAINER_NAME/bun $(which bun-profile)
fi
fi
echo "Saved to:"
echo $debug_abs
echo $abs

View File

@@ -1,9 +0,0 @@
#!/bin/bash
set -euxo pipefail
bun install
bun install --cwd ./test/snippets
bun install --cwd ./test/scripts
make $BUN_TEST_NAME

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -euxo pipefail
docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --env BUN_TEST_NAME=$BUN_TEST_NAME --ulimit memlock=-1:-1 --init --rm bun-test:latest

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -euxo pipefail
docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --ulimit memlock=-1:-1 --init --rm bun-unit-tests:latest

View File

@@ -11,5 +11,8 @@ packages/**/bun-profile
src/bun.js/WebKit
src/bun.js/WebKit/LayoutTests
zig-build
zig-cache
zig-out
.zig-cache
zig-out
build
vendor
node_modules

2
.gitattributes vendored
View File

@@ -49,3 +49,5 @@ vendor/brotli/** linguist-vendored
test/js/node/test/fixtures linguist-vendored
test/js/node/test/common linguist-vendored
test/js/bun/css/files linguist-vendored

View File

@@ -1,6 +1,6 @@
name: 🇹 TypeScript Type Bug Report
description: Report an issue with TypeScript types
labels: [bug, typescript]
labels: [bug, types]
body:
- type: markdown
attributes:

View File

@@ -11,8 +11,8 @@ body:
- type: textarea
id: package_json
attributes:
label: `package.json` file
description: Can you upload your `package.json` file? This helps us reproduce the crash.
label: "`package.json` file"
description: "Can you upload your `package.json` file? This helps us reproduce the crash."
render: json
- type: textarea
id: repro

View File

@@ -47,4 +47,5 @@ runs:
mkdir -p ${{ runner.temp }}/.bun/bin
mv ${target}/bun* ${{ runner.temp }}/.bun/bin/
chmod +x ${{ runner.temp }}/.bun/bin/*
ln -fs ${{ runner.temp }}/.bun/bin/bun ${{ runner.temp }}/.bun/bin/bunx
echo "${{ runner.temp }}/.bun/bin" >> ${GITHUB_PATH}

41
.github/workflows/clang-format.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: clang-format
permissions:
contents: write
on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
env:
BUN_VERSION: "1.1.27"
LLVM_VERSION: "18.1.8"
LLVM_VERSION_MAJOR: "18"
jobs:
clang-format:
name: clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install LLVM
run: |
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
- name: Clang Format
env:
LLVM_VERSION: ${{ env.LLVM_VERSION }}
run: |
bun run clang-format
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "`bun run clang-format`"

41
.github/workflows/clang-tidy.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: clang-tidy
permissions:
contents: write
on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
env:
BUN_VERSION: "1.1.27"
LLVM_VERSION: "18.1.8"
LLVM_VERSION_MAJOR: "18"
jobs:
clang-tidy:
name: clang-tidy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install LLVM
run: |
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
- name: Clang Tidy
env:
LLVM_VERSION: ${{ env.LLVM_VERSION }}
run: |
bun run clang-tidy:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "`bun run clang-tidy`"

View File

@@ -1,61 +0,0 @@
name: Format
permissions:
contents: write
concurrency:
group: format-${{ 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:
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.prettierrc-ci
.github
.vscode
src
scripts
packages
test
bench
package.json
bun.lockb
.clang-format
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.25"
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: Install Dependencies
run: |
bun install
- name: Format
run: |
bun fmt
- name: Format Zig
run: |
bun fmt:zig
- name: Format Cpp
run: |
bun fmt:cpp
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply formatting changes

View File

@@ -83,6 +83,26 @@ jobs:
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
rm -rf is-outdated.txt outdated.txt latest.txt
- name: Generate comment text with Sentry Link
if: github.event.label.name == 'crash'
# ignore if fail
continue-on-error: true
id: generate-comment-text
env:
GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_EVENTS_SECRET }}
shell: bash
run: |
bun scripts/associate-issue-with-sentry.ts
if [[ -f "sentry-link.txt" ]]; then
echo "sentry-link=$(cat sentry-link.txt)" >> $GITHUB_OUTPUT
fi
if [[ -f "sentry-id.txt" ]]; then
echo "sentry-id=$(cat sentry-id.txt)" >> $GITHUB_OUTPUT
fi
- name: Add labels
uses: actions-cool/issues-helper@v3
if: github.event.label.name == 'crash'
@@ -92,7 +112,7 @@ jobs:
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'
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
@@ -106,6 +126,40 @@ jobs:
```sh
bun upgrade
```
- name: Comment with Sentry Link and outdated version
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true'
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 }}, thank you for reporting this crash. 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
```
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
- name: Comment with Sentry Link
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated != 'true'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for reporting this crash.
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
- name: Comment needs repro
if: github.event.label.name == 'needs repro'
uses: actions-cool/issues-helper@v3
@@ -114,4 +168,4 @@ jobs:
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.
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), [CodeSandbox](https://codesandbox.io/templates/bun), or provide a bulleted list of commands to run that reproduce this issue. Issues marked with `needs repro` will be closed if they have no activity within 3 days.

View File

@@ -1,30 +0,0 @@
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"
# - "vendor/**/*"
# - "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 }}

37
.github/workflows/prettier-format.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: prettier-format
permissions:
contents: write
on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
env:
BUN_VERSION: "1.1.27"
jobs:
prettier-format:
name: prettier-format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Setup Dependencies
run: |
bun install
- name: Prettier Format
run: |
bun run prettier:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "`bun run prettier:extra`"

View File

@@ -1,56 +0,0 @@
name: Format
permissions:
contents: write
on:
workflow_call:
inputs:
zig-version:
type: string
required: true
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.prettierrc-ci
.github
.vscode
src
scripts
packages
test
bench
package.json
bun.lockb
.clang-format
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.25"
- 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: Format Cpp
run: |
bun fmt:cpp
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply formatting changes

View File

@@ -1,84 +0,0 @@
name: lint-cpp
permissions:
contents: read
env:
LLVM_VERSION: 18
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: 1.1.23
- 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@v4
with:
name: format.log
path: format.log
- name: Upload PR
uses: actions/upload-artifact@v4
with:
name: pr-number.txt
path: pr-number.txt
- name: Upload PR
uses: actions/upload-artifact@v4
with:
name: did_fail.txt
path: did_fail.txt
- name: Fail if formatting failed
if: ${{ steps.format.outputs.did_fail == '1' }}
run: exit 1

34
.github/workflows/zig-format.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: zig-format
permissions:
contents: write
on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
env:
BUN_VERSION: "1.1.27"
jobs:
zig-format:
name: zig-format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Zig Format
run: |
bun run zig-format:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "`bun run zig-format`"

5
.gitignore vendored
View File

@@ -141,6 +141,7 @@ test/node.js/upstream
.zig-cache
scripts/env.local
*.generated.ts
src/bake/generated.ts
# Dependencies
/vendor
@@ -163,3 +164,7 @@ scripts/env.local
/src/deps/zstd
/src/deps/zlib
/src/deps/zig
# Generated files
.buildkite/ci.yml

View File

@@ -1,31 +0,0 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"trailingComma": "all",
"useTabs": false,
"quoteProps": "preserve",
"plugins": [
"prettier-plugin-organize-imports"
],
"overrides": [
{
"files": [
".vscode/*.json"
],
"options": {
"parser": "jsonc",
"quoteProps": "preserve",
"singleQuote": false,
"trailingComma": "all"
}
},
{
"files": [
"*.md"
],
"options": {
"printWidth": 80
}
}
]
}

130
.vscode/launch.json generated vendored
View File

@@ -14,7 +14,7 @@
"name": "bun test [file]",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -22,6 +22,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -29,7 +31,7 @@
"name": "bun test [file] --only",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "--only", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -37,6 +39,8 @@
"BUN_DEBUG_jest": "1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -50,7 +54,7 @@
"name": "bun test [file] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -58,6 +62,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -65,7 +71,7 @@
"name": "bun test [file] (verbose)",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "0",
@@ -73,6 +79,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -80,7 +88,7 @@
"name": "bun test [file] --watch",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "--watch", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -88,6 +96,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -95,7 +105,7 @@
"name": "bun test [file] --hot",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "--hot", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -103,6 +113,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -110,7 +122,7 @@
"name": "bun test [file] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -119,6 +131,8 @@
"BUN_INSPECT": "ws://localhost:0/?wait=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -131,7 +145,7 @@
"name": "bun test [file] --inspect-brk",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -140,6 +154,8 @@
"BUN_INSPECT": "ws://localhost:0/?break=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -160,6 +176,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -172,8 +190,14 @@
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
"BUN_DEBUG_IncrementalGraph": "1",
"BUN_DEBUG_Bake": "1",
"BUN_DEBUG_reload_file_list": "1",
"GOMAXPROCS": "1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -188,6 +212,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -202,6 +228,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -216,6 +244,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -231,6 +261,8 @@
"BUN_INSPECT": "ws://localhost:0/?wait=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -251,6 +283,8 @@
"BUN_INSPECT": "ws://localhost:0/?break=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -264,7 +298,7 @@
"name": "bun test [...]",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -272,6 +306,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -279,7 +315,7 @@
"name": "bun test [...] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -287,6 +323,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -294,7 +332,7 @@
"name": "bun test [...] (verbose)",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -302,6 +340,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -309,7 +349,7 @@
"name": "bun test [...] --watch",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "--watch", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -317,6 +357,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -324,7 +366,7 @@
"name": "bun test [...] --hot",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "--hot", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -332,6 +374,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -339,7 +383,7 @@
"name": "bun test [...] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -348,6 +392,8 @@
"BUN_INSPECT": "ws://localhost:0/?wait=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -360,7 +406,7 @@
"name": "bun test [...] --inspect-brk",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -369,6 +415,8 @@
"BUN_INSPECT": "ws://localhost:0/?break=1",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -389,6 +437,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
// bun test [*]
{
@@ -397,13 +447,15 @@
"name": "bun test [*]",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -411,13 +463,15 @@
"name": "bun test [*] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -425,7 +479,7 @@
"name": "bun test [*] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"env": {
"FORCE_COLOR": "1",
"BUN_DEBUG_QUIET_LOGS": "1",
@@ -433,6 +487,8 @@
"BUN_INSPECT": "ws://localhost:0/",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
"serverReadyAction": {
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
@@ -452,6 +508,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
{
"type": "lldb",
@@ -466,6 +524,8 @@
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
},
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
// Windows: bun test [file]
{
@@ -477,7 +537,7 @@
"name": "Windows: bun test [file]",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -506,7 +566,7 @@
"name": "Windows: bun test --only [file]",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "--only", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -535,7 +595,7 @@
"name": "Windows: bun test [file] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -564,7 +624,7 @@
"name": "Windows: bun test [file] (verbose)",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -593,7 +653,7 @@
"name": "Windows: bun test [file] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -631,7 +691,7 @@
"name": "Windows: bun test [file] --inspect-brk",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${file}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -818,7 +878,7 @@
"name": "Windows: bun test [...]",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -847,7 +907,7 @@
"name": "Windows: bun test [...] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -876,7 +936,7 @@
"name": "Windows: bun test [...] (verbose)",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -905,7 +965,7 @@
"name": "Windows: bun test [...] --watch",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "--watch", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -934,7 +994,7 @@
"name": "Windows: bun test [...] --hot",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "--hot", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -963,7 +1023,7 @@
"name": "Windows: bun test [...] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -1001,7 +1061,7 @@
"name": "Windows: bun test [...] --inspect-brk",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test", "${input:testName}"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -1066,7 +1126,7 @@
"name": "Windows: bun test [*]",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -1091,7 +1151,7 @@
"name": "Windows: bun test [*] (fast)",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -1120,7 +1180,7 @@
"name": "Windows: bun test [*] --inspect",
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
"args": ["test"],
"cwd": "${workspaceFolder}/test",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "FORCE_COLOR",
@@ -1178,6 +1238,8 @@
},
],
"console": "internalConsole",
// Don't pause when the GC runs while the debugger is open.
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
},
],
"inputs": [

View File

@@ -52,12 +52,15 @@
"cmake.configureOnOpen": false,
"C_Cpp.errorSquiggles": "enabled",
"[cpp]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"[c]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"[h]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"clangd.arguments": ["-header-insertion=never"],

View File

@@ -30,6 +30,7 @@ include(CompilerFlags)
# --- Tools ---
include(SetupGit)
include(SetupBuildkite)
include(SetupBun)
include(SetupEsbuild)
@@ -39,3 +40,12 @@ include(SetupRust)
# --- Targets ---
include(BuildBun)
# --- Analysis ---
if(ENABLE_ANALYSIS)
include(RunClangFormat)
include(RunClangTidy)
include(RunZigFormat)
include(RunPrettier)
endif()

View File

@@ -11,7 +11,7 @@ Bun currently requires `glibc >=2.32` in development which means if you're on Ub
Using your system's package manager, install Bun's dependencies:
{% codetabs %}
{% codetabs group="os" %}
```bash#macOS (Homebrew)
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
@@ -30,7 +30,7 @@ $ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config
```
```bash#openSUSE Tumbleweed
$ sudo zypper install go cmake ninja automake git rustup && rustup toolchain install stable
$ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable
```
{% /codetabs %}
@@ -60,7 +60,7 @@ $ brew install bun
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:
{% codetabs %}
{% codetabs group="os" %}
```bash#macOS (Homebrew)
$ brew install llvm@18
@@ -77,8 +77,8 @@ $ sudo pacman -S llvm clang lld
```bash#Fedora
$ sudo dnf install 'dnf-command(copr)'
$ sudo dnf copr enable -y @fedora-llvm-team/llvm-snapshots
$ sudo dnf install llvm clang lld
$ sudo dnf copr enable -y @fedora-llvm-team/llvm17
$ sudo dnf install llvm16 clang16 lld16-devel
```
```bash#openSUSE Tumbleweed
@@ -97,7 +97,7 @@ $ which clang-16
If not, run this to manually add it:
{% codetabs %}
{% codetabs group="os" %}
```bash#macOS (Homebrew)
# use fish_add_path if you're using fish
@@ -116,42 +116,26 @@ $ export PATH="$PATH:/usr/lib/llvm16/bin"
## 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`
After cloning the repository, run the following command to build. This may take a while as it will clone submodules and build dependencies.
```bash
$ bun run build
```
These two scripts, `setup` and `build`, are aliases to do roughly the following:
The binary will be located at `./build/debug/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
$ ./scripts/setup.sh
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
$ ninja -C build # 'bun run build' runs just this
$ build/debug/bun-debug --version
x.y.z_debug
```
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).
If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./vendor/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:
We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-debug` in your terminal:
```sh
$ bun-debug
@@ -180,7 +164,7 @@ To compile a release build of Bun, run:
$ bun run build:release
```
The binary will be located at `./build-release/bun` and `./build-release/bun-profile`.
The binary will be located at `./build/release/bun` and `./build/release/bun-profile`.
### Download release build from pull requests
@@ -189,8 +173,8 @@ To save you time spent building a release build locally, we provide a way to run
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 <pr-number>
bunx bun-pr <branch-name>
bunx bun-pr "https://github.com/oven-sh/bun/pull/1234566"
```
@@ -222,24 +206,18 @@ $ 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
# Clone WebKit into ./vendor/WebKit
$ git clone https://github.com/oven-sh/WebKit vendor/WebKit
# Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
# Optionally, you can use `make jsc` for a release build
$ make jsc-debug
# Build bun with the local JSC build
$ bun run build:local
```
Note that the WebKit folder, including build artifacts, is 8GB+ in size.
@@ -307,17 +285,17 @@ If you see this error when compiling, run:
$ xcode-select --install
```
## Cannot find `libatomic.a`
### 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
$ bun run build -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
### ccache conflicts with building TinyCC on macOS
If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
@@ -325,3 +303,9 @@ If you run into issues with `ccache` when building TinyCC, try reinstalling ccac
brew uninstall ccache
brew install ccache
```
## Using bun-debug
- Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
- Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts`

2
LATEST
View File

@@ -1 +1 @@
1.1.27
1.1.34

View File

@@ -77,7 +77,7 @@ BUN_RELEASE_BIN = $(PACKAGE_DIR)/bun
PRETTIER ?= $(shell which prettier 2>/dev/null || echo "./node_modules/.bin/prettier")
ESBUILD = "$(shell which esbuild 2>/dev/null || echo "./node_modules/.bin/esbuild")"
DSYMUTIL ?= $(shell which dsymutil 2>/dev/null || which dsymutil-15 2>/dev/null)
WEBKIT_DIR ?= $(realpath src/bun.js/WebKit)
WEBKIT_DIR ?= $(realpath vendor/WebKit)
WEBKIT_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release
WEBKIT_DEBUG_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Debug
WEBKIT_RELEASE_DIR_LTO ?= $(WEBKIT_DIR)/WebKitBuild/ReleaseLTO
@@ -138,8 +138,8 @@ endif
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 ?= $(shell pwd)/build/bun-deps
BUN_DEPS_DIR ?= $(shell pwd)/vendor
BUN_DEPS_OUT_DIR ?= $(shell pwd)/build/release
CPU_COUNT = 2
ifeq ($(OS_NAME),darwin)
CPU_COUNT = $(shell sysctl -n hw.logicalcpu)
@@ -689,19 +689,10 @@ assert-deps:
@test $(shell cargo --version | awk '{print $$2}' | cut -d. -f2) -gt 57 || (echo -e "ERROR: cargo version must be at least 1.57."; exit 1)
@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 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))
endif
.PHONY: init-submodules
init-submodules: submodule # (backwards-compatibility alias)
.PHONY: submodule
submodule: ## to init or update all submodules
git submodule update --init --recursive --progress --depth=1 --checkout $(SUBMODULE_NAMES)
.PHONY: build-obj
build-obj:
@@ -804,7 +795,7 @@ cls:
@echo -e "\n\n---\n\n"
jsc-check:
@ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo -e "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/src/bun.js/WebKit -f $(shell pwd)/src/bun.js/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1)
@ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo -e "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/vendor/WebKit -f $(shell pwd)/vendor/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1)
@ls $(JSC_INCLUDE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit include directory at $(JSC_INCLUDE_DIR)." && exit 1)
@ls $(JSC_LIB) >/dev/null 2>&1 || (echo "Failed to access WebKit lib directory at $(JSC_LIB)." && exit 1)
@@ -945,7 +936,7 @@ jsc-bindings: headers bindings
.PHONY: clone-submodules
clone-submodules:
git -c submodule."src/bun.js/WebKit".update=none submodule update --init --recursive --depth=1 --progress
git -c submodule."vendor/WebKit".update=none submodule update --init --recursive --depth=1 --progress
.PHONY: headers
@@ -1265,7 +1256,7 @@ jsc-build-mac-compile:
-DENABLE_STATIC_JSC=ON \
-DENABLE_SINGLE_THREADED_VM_ENTRY_SCOPE=ON \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DUSE_THIN_ARCHIVES=OFF \
-DBUN_FAST_TLS=ON \
-DENABLE_FTL_JIT=ON \
@@ -1277,7 +1268,7 @@ jsc-build-mac-compile:
$(WEBKIT_DIR) \
$(WEBKIT_RELEASE_DIR) && \
CFLAGS="$(CFLAGS) -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -ffat-lto-objects" \
cmake --build $(WEBKIT_RELEASE_DIR) --config Release --target jsc
cmake --build $(WEBKIT_RELEASE_DIR) --config RelWithDebInfo --target jsc
.PHONY: jsc-build-mac-compile-lto
jsc-build-mac-compile-lto:
@@ -1379,7 +1370,7 @@ jsc-build-linux-compile-config-debug:
$(WEBKIT_DEBUG_DIR)
# If you get "Error: could not load cache"
# run rm -rf src/bun.js/WebKit/CMakeCache.txt
# run rm -rf vendor/WebKit/CMakeCache.txt
.PHONY: jsc-build-linux-compile-build
jsc-build-linux-compile-build:
mkdir -p $(WEBKIT_RELEASE_DIR) && \
@@ -1414,7 +1405,7 @@ jsc-build-copy-debug:
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
cd vendor/WebKit && rm -rf **/CMakeCache.txt **/CMakeFiles && rm -rf vendor/WebKit/WebKitBuild
clean-bindings:
rm -rf $(OBJ_DIR)/*.o $(DEBUG_OBJ_DIR)/*.o $(DEBUG_OBJ_DIR)/webcore/*.o $(DEBUG_BINDINGS_OBJ) $(OBJ_DIR)/webcore/*.o $(BINDINGS_OBJ) $(OBJ_DIR)/*.d $(DEBUG_OBJ_DIR)/*.d

View File

@@ -1,5 +1,5 @@
<p align="center">
<a href="https://bun.sh"><img src="https://user-images.githubusercontent.com/709451/182802334-d9c42afe-f35d-4a7b-86ea-9985f73f20c3.png" alt="Logo" height=170></a>
<a href="https://bun.sh"><img src="https://github.com/user-attachments/assets/50282090-adfd-4ddb-9e27-c30753c6b161" alt="Logo" height=170></a>
</p>
<h1 align="center">Bun</h1>

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, run } from "../runner.mjs";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -3,9 +3,9 @@
"scripts": {
"deps": "exit 0",
"build": "exit 0",
"bench:bun": "$BUN bun.js",
"bench:node": "$NODE node.mjs",
"bench:deno": "$DENO run -A --unstable deno.js",
"bench:bun": "bun bun.js",
"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"
}
}

Binary file not shown.

View File

@@ -1,5 +1,5 @@
import { bench, run } from "mitata";
import { copyFileSync, statSync, writeFileSync } from "node:fs";
import { bench, run } from "../runner.mjs";
function runner(ready) {
for (let size of [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) {

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const crypto = require("node:crypto");
const keyPair = crypto.generateKeyPairSync("rsa", {

View File

@@ -0,0 +1,24 @@
import { bench, run } from "../runner.mjs";
const crypto = require("node:crypto");
const keyPair = crypto.generateKeyPairSync("rsa", {
modulusLength: 2048,
publicKeyEncoding: {
type: "spki",
format: "pem",
},
privateKeyEncoding: {
type: "pkcs8",
format: "pem",
},
});
// Max message size for 2048-bit RSA keys
const plaintext = crypto.getRandomValues(Buffer.alloc(245));
bench("RSA sign RSA_PKCS1_PADDING round-trip", () => {
const sig = crypto.privateEncrypt(keyPair.privateKey, plaintext);
crypto.publicDecrypt(keyPair.publicKey, sig);
});
await run();

View File

@@ -1,5 +1,5 @@
import { expect } from "bun:test";
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const MAP_SIZE = 10_000;

View File

@@ -1,5 +1,5 @@
import { expect } from "bun:test";
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const SET_SIZE = 10_000;

View File

@@ -1,5 +1,5 @@
import { group } from "mitata";
import EventEmitterNative from "node:events";
import { group } from "../runner.mjs";
export const implementations = [
{

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
import { groupForEmitter } from "./implementations.mjs";
var id = 0;

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
import { groupForEmitter } from "./implementations.mjs";
var id = 0;

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
import { groupForEmitter } from "./implementations.mjs";
// Pseudo RNG is derived from https://stackoverflow.com/a/424445

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const count = 100;

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const count = 100;

View File

@@ -1,5 +1,5 @@
import { CString, dlopen, ptr } from "bun:ffi";
import { bench, group, run } from "mitata";
import { bench, group, run } from "../runner.mjs";
const { napiNoop, napiHash, napiString } = require(import.meta.dir + "/src/ffi_napi_bench.node");

View File

@@ -1,4 +1,4 @@
import { bench, group, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, group, run } from "../runner.mjs";
const extension = "darwin" !== Deno.build.os ? "so" : "dylib";
const path = new URL("src/target/release/libffi_napi_bench." + extension, import.meta.url).pathname;

View File

@@ -1,5 +1,5 @@
import { bench, group, run } from "mitata";
import { createRequire } from "node:module";
import { bench, group, run } from "../runner.mjs";
const require = createRequire(import.meta.url);
const { napiNoop, napiHash, napiString } = require("./src/ffi_napi_bench.node");

View File

@@ -1,11 +1,11 @@
{
"name": "bench",
"scripts": {
"bench:bun": "$BUN bun.js",
"bench:node": "$NODE node.mjs",
"bench:bun": "bun bun.js",
"bench:node": "node node.mjs",
"deps": "cd src && bun run deps",
"build": "cd src && bun run build",
"bench:deno": "$DENO run -A --unstable deno.js",
"bench:deno": "deno run -A --unstable deno.js",
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
}
}

View File

@@ -1,5 +1,5 @@
import braces from "braces";
import { bench, group, run } from "mitata";
import { bench, group, run } from "../runner.mjs";
// const iterations = 1000;
const iterations = 100;
@@ -10,15 +10,16 @@ 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 }, () => {
const _name = `${name} pattern: "${pattern}"`;
group({ name: _name, summary: true }, () => {
if (typeof Bun !== "undefined")
bench("Bun", () => {
bench(`Bun (${_name})`, () => {
for (let i = 0; i < iterations; i++) {
Bun.$.braces(pattern);
}
});
bench("micromatch/braces", () => {
bench(`micromatch/braces ${_name}`, () => {
for (let i = 0; i < iterations; i++) {
braces(pattern, { expand: true });
}

View File

@@ -1,5 +1,5 @@
import micromatch from "micromatch";
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
const Glob = typeof Bun !== "undefined" ? Bun.Glob : undefined;
const doMatch = typeof Bun === "undefined" ? micromatch.isMatch : (a, b) => new Glob(b).match(a);

View File

@@ -1,6 +1,6 @@
import fg from "fast-glob";
import { fdir } from "fdir";
import { bench, group, run } from "mitata";
import { bench, group, run } from "../runner.mjs";
const normalPattern = "*.ts";
const recursivePattern = "**/*.ts";

View File

@@ -0,0 +1,14 @@
syntax = "proto3";
package benchmark;
service BenchmarkService {
rpc Ping(Request) returns (Response);
}
message Request {
string message = 1;
}
message Response {
string message = 1;
}

View File

@@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFxjCCA66gAwIBAgIUUaQCzOcxcFBP0KwoQfNqD/FoI44wDQYJKoZIhvcNAQEL
BQAwYjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1TYW4gRnJh
bmNpc2NvMQwwCgYDVQQKDANCdW4xDDAKBgNVBAsMA0J1bjESMBAGA1UEAwwJbG9j
YWxob3N0MB4XDTI0MTAxNjAwMDExNloXDTM0MTAxNDAwMDExNlowYjELMAkGA1UE
BhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQwwCgYD
VQQKDANCdW4xDDAKBgNVBAsMA0J1bjESMBAGA1UEAwwJbG9jYWxob3N0MIICIjAN
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp2s1CWRRV3bkjUxyBefcRCiZj8v6
LIIWOb/kFJOo1PQsmQtOOWfY/kNEATPhLtEVolMzsQtaKV+u/Jnp6vU6cCU0qfQ/
cha/s0XaSn9zkJSXjmNOPDOXoeJ5wmSUvWETRvDgeYXCg84zTwRnD1pXIsKxHtia
SYkTC29skSn0+63GW2Ebzkbn3jcYbk3gfkRO/qw8EDh/4/TcS2SjoHl96E1QcfBX
InXrPGoHQhuqJV60rmmkVws0lTIZIq0g2p7iFDCg5TG1asakX7+CrEM/q+oyo3e8
RwMfc+9pqFEqyvXGIQSulS+CVKKbpAFMg07UGYe1t0s5iCwfLQ9apaKL31t/3Vkr
uVKgy5FrPLnRXkFXDZ1v+43AZBmdLrKODzsqHEbt2JmV0V6JVUkE4kbeJr/nlkhQ
x6yXloYY3VKbnCb1L3HmMInrK1QSpxlOb8RllTd33oBwd1FKEvH2gza0j9hqq8uQ
hWVN7tlamkgtBteZ8Y9fd3MdxD9iZOx4dVtCX1+sgJFdaL2ZgE0asojn46yT8Uqw
5d0M9vqmWc5AqG7c4UWWRrfB1MfOq/X8GtImmKyhEgizIPdWFeF1cNjhPffJv4yR
Y4Rj33OBTCM+9h8ZSw/fKo55yRXyz3bjrW2Mg8Dtq+6TcRd5gSLCaTN6jX8E9y7G
TobnA9MnKHhSIhsCAwEAAaN0MHIwHQYDVR0OBBYEFEJU6/9ELCp1CAxYJ5FJJxpV
FSRmMB8GA1UdIwQYMBaAFEJU6/9ELCp1CAxYJ5FJJxpVFSRmMA8GA1UdEwEB/wQF
MAMBAf8wHwYDVR0RBBgwFoIJbG9jYWxob3N0ggkxMjcuMC4wLjEwDQYJKoZIhvcN
AQELBQADggIBACyOPdVwfJg1aUNANy78+cm6eoInM9NDdXGWHMqCJwYF6qJTQV11
jYwYrl+OWOi3CEC+ogXl+uJX4tSS5d+rBTXEb73cLpogxP+xuxr4cBHhtgpGRpY0
GqWCFUTexHxXMrYhHQxf3uv79PNauw/dd1Baby1OjF3zSKRzFsv4KId97cAgT/9H
HfUo2ym5jmhNFj5rhUavO3Pw1++1eeDeDAkS6T59buzx0h9760WD20oBdgjt42cb
P6xg9OwV7ALQSwJ8YPEXpkl7u+6jy0j5ceYmXh76tAyA+hDYOJrY0opBjSPmXH99
p3W63gvk/AdfeAdbFHp6en0b04x4EIogOGZxBP35rzBvsQpqavBE3PBpUIyrQs5p
OBUncRrcjEDL6WKh6RJIjZnvpHPrEqOqyxaeWRc4+85ZrVArJHGMc8I+zs9uCFjo
Cjfde3d317kCszUTxo0l3azyBpr007PMIUoBF2VJEAyQp2Tz/yu0CbEscNJO/wCn
Sb1A6ojaQcgQe2hsaJz/mS+OOjHHaDbCp9iltP2CS63PYleEx4q1Bn8KVRy2zYTB
n74y4YaD8Q+hSA6zU741pzqK2SFCpBQnSz757ocr6WspQ47iOonX2giGZS/3KVeK
qNzU14+h0b8HaBqZmOvjF+S4G0HDpRwxPzDWgc7dEIWlzHH+ZCqjBFwL
-----END CERTIFICATE-----

View File

@@ -0,0 +1,31 @@
const grpc = require("@grpc/grpc-js");
const protoLoader = require("@grpc/proto-loader");
const packageDefinition = protoLoader.loadSync("benchmark.proto", {});
const proto = grpc.loadPackageDefinition(packageDefinition).benchmark;
const fs = require("fs");
function ping(call, callback) {
callback(null, { message: "Hello, World" });
}
function main() {
const server = new grpc.Server();
server.addService(proto.BenchmarkService.service, { ping: ping });
const tls = !!process.env.TLS && (process.env.TLS === "1" || process.env.TLS === "true");
const port = process.env.PORT || 50051;
const host = process.env.HOST || "localhost";
let credentials;
if (tls) {
const ca = fs.readFileSync("./cert.pem");
const key = fs.readFileSync("./key.pem");
const cert = fs.readFileSync("./cert.pem");
credentials = grpc.ServerCredentials.createSsl(ca, [{ private_key: key, cert_chain: cert }]);
} else {
credentials = grpc.ServerCredentials.createInsecure();
}
server.bindAsync(`${host}:${port}`, credentials, () => {
console.log(`Server running at ${tls ? "https" : "http"}://${host}:${port}`);
});
}
main();

52
bench/grpc-server/key.pem Normal file
View File

@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCnazUJZFFXduSN
THIF59xEKJmPy/osghY5v+QUk6jU9CyZC045Z9j+Q0QBM+Eu0RWiUzOxC1opX678
menq9TpwJTSp9D9yFr+zRdpKf3OQlJeOY048M5eh4nnCZJS9YRNG8OB5hcKDzjNP
BGcPWlciwrEe2JpJiRMLb2yRKfT7rcZbYRvORufeNxhuTeB+RE7+rDwQOH/j9NxL
ZKOgeX3oTVBx8Fcides8agdCG6olXrSuaaRXCzSVMhkirSDanuIUMKDlMbVqxqRf
v4KsQz+r6jKjd7xHAx9z72moUSrK9cYhBK6VL4JUopukAUyDTtQZh7W3SzmILB8t
D1qloovfW3/dWSu5UqDLkWs8udFeQVcNnW/7jcBkGZ0uso4POyocRu3YmZXRXolV
SQTiRt4mv+eWSFDHrJeWhhjdUpucJvUvceYwiesrVBKnGU5vxGWVN3fegHB3UUoS
8faDNrSP2Gqry5CFZU3u2VqaSC0G15nxj193cx3EP2Jk7Hh1W0JfX6yAkV1ovZmA
TRqyiOfjrJPxSrDl3Qz2+qZZzkCobtzhRZZGt8HUx86r9fwa0iaYrKESCLMg91YV
4XVw2OE998m/jJFjhGPfc4FMIz72HxlLD98qjnnJFfLPduOtbYyDwO2r7pNxF3mB
IsJpM3qNfwT3LsZOhucD0ycoeFIiGwIDAQABAoICAE+YYrDCZwHEXsjmzVcNcuVc
wBVjjt9WQabXGmLGCQClzgY9H8WfH8VSyaQgvDB762MvV2YW1ZjSCunBazrvuAbV
SYJ7wyZEtoNO9IdyrMjSPHPPtsRcavzmJalMFIMtAfM6Vh6wf1gW0sIAf9cGxmKa
WYcmx8OqTcmkAePKJNT7O1D6jDO39kjpvM3EbLTbWQsva6bylasVIR8fC8QhvsCQ
8WwaLfMOSPaCGk1Nxcjai+BYDW/sveUo2lZoJTSLUUT0EaqlxXCsXD3BWSj5F+5t
/AFHzdWdIHkIHB2P6V5xFu9fwHjhC3+dh42jqHLNKX2xza0FMKcTAwdzQ094RjL3
cOGIsa0Vdt7Mks5eLCRxz0xI3kyrbF0/CopxT0pVWZwUzPk1G+Z3HesWkVtQpg7u
RYzsoNKKc5mhc/V+vG290WAcNB4E3m85DgKQr4ib+J/rCy5/SnJYgg4QXsEyNlQ5
ESBtRmuPfnrPIxqrDKZ7ZsJv8XFWydXTOfJxeKR1T1S02iYna+z1FnNu+t0ELTr9
uhmkuqmV8RJVTub1P2EJPdiku/61UwNLyyZMgFjATDxB0hHIj1FP1HbfhEYbkYNc
Dl7a7egJ4KFYWpQ+7MzOmc0OKq1HuJ9H4FhoYpbVq1OQosZ6G3d9afKSZa6dFdK0
8ujvdQBR0NlAhc/LAr6BAoIBAQDfD3h9P4i5L8NCdocovCi3Eo0kcNQ3QuvnWrrs
B/9CLoWhJrcLV85d0dEX6lSYl9BWW02ilVB+Qvom2wS2td1CBUgDxovX4tCZCuXt
otYL/yWWOA7IG0Fjt6YEERQD/tRfKnn8hVBlk5cDTXXxHRGVMku4CHsN3ILtITQS
VnVsTrGoWd6mFFA9X9Qu4zR9wKtjGEuL7BT8ixxtXLa2tMjdc4UL140yAgmMemJS
TzC6EURe2OnhIzVe9yyLKcqw0prkGHg/Lau5lA1CAh67ZMY4EjO3cuda8R+O7vyO
z2afeaTORzzdEbSZPG+8oqIN1/RjRCbl3RXYN8ibSwOzp6X7AoIBAQDAJEVta98J
P2/36rXrkl6WrRfYqUPy6vgo/lPuRpp+BQ7ldgmH4+ZrJW5Mxa5hktVujk/C2kAO
auzhzNlsxR+c/KwtsL1JXwBn8CT1bR0qvi+URmvGQn9GOKrLLy+6cfphuZWuc4/r
hAgXzEjzPcJJJfxA1i2soKPbiFiCGHxot68P4uJSM2sU6QjNIxEjPbTJjEg894pD
GJoiRRVHgnzzxL3cqrK90Zn6MAl9f2tYihfddsENeZb5t84LBppxBSGouE3ZH8uD
Sufs4DSj1ptocbDbX+0kRNqfjTI5ivDxlS+ZKBe05PVTUmGBAWLamfCe89IW3/z+
Rfkh4ZBPtlphAoIBADwjSqPR7kWnN+iCVjxIRl3dNYpelQh1FW7hikW6fjpUmphw
/KalPLEUsV/WQIqHW5b8tLihsvrnidPR9rpf29BB5kGGVQuWThEE3CquXTEM0BBo
+qs+lemRiMPN6uyM1qr1o7/OHXfVS8CLMMIZyTTFQ57RQoPhMLdH3WcYQj46FTHD
UQDLtzpkzKr7fJpuyIZF9ZA6zQmtY7OkbGpj4Ue7LmKb8ahK3lIuaLWyPfvcTeeY
aa3WNTxuPWcjlE8J6NKYOksmQAcfgFeMhMaXC83wMltCMlfVbGG30wWZqxxRynoG
wMUFUgCCR8m+uxwqXewpYqdUbOBHYeFkXxIfn+MCggEAR5p8wQ1NHd4lNOekCfkP
BOnWlChoKRPFjUlSL97h3gq2hW6amKimitF1LGkS1kvo+/1O3heFfZn9UxyK/kzr
vg4vgAt4Tup3dUR6EXgrQW2Ev6YKreTEF4Awre2UxM+K9nY5wLxSKvuWJIA9w2AF
kkr0mZj3hniK99n02e6UFlY1iB8OJoIA6tb5L7FcxpxNTjrYBNhfDygQ8Kp8Bp0r
QZDVDHIUkEaXMjRKpRkiAOndgOurgAEK8V69C0DXtzypUX31jO+bYP8+NPlMxK3K
Vn7f4LD75+M88e6lg+oyZmUpStM1GnWksvtlWLUSiNKLaEEGzv2EA6JB+I1dwUb8
oQKCAQEAlmisUyn1/lpNnEzKsfUnRs53WxS2e1br5vJ5+pet3cjXT2btfp6J5/mf
Tfqv5mZfTjYxydG0Kl3afI/SnhTcRS2/s4svrktZYLOLM2PAGYdCV6j1stXl4ObO
eIfjzB3y1Zc2dEcWTylJ/lABoNGMPWFJQ67q8WS37pUHQPseJ++LmZFvlRyBgZBl
VLqiHHiZ2ax+yC1ZxY4RECtEiYFplspNldNe+bP/lzTJftsUDe1FqRT/SvEam+1f
kb//sbHkJ+l4BEv0Us3SIGwJ0BblhxLYO34IFVpheY4UQBy/nRaeUUdVR9r8JtYD
z/cCLOrUJfealezimyd8SKPWPeHhrA==
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,15 @@
{
"name": "bench",
"scripts": {
"deps": "exit 0",
"build": "exit 0",
"bun:server": "TLS=1 PORT=50051 bun ./index.js",
"node:server": "TLS=1 PORT=50051 node ./index.js",
"bench": "ghz --cacert ./cert.pem --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051",
"bench:insecure": "ghz --insecure --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051"
},
"dependencies": {
"@grpc/grpc-js": "1.12.0",
"@grpc/proto-loader": "0.7.10"
}
}

View File

@@ -1,5 +1,5 @@
import { gunzipSync, gzipSync } from "bun";
import { bench, group, run } from "mitata";
import { bench, group, run } from "../runner.mjs";
const data = await Bun.file(require.resolve("@babel/standalone/babel.min.js")).arrayBuffer();

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, run } from "../runner.mjs";
const data = new TextEncoder().encode("Hello World!".repeat(9999));

View File

@@ -1,7 +1,7 @@
import { readFileSync } from "fs";
import { bench, run } from "mitata";
import { createRequire } from "module";
import { gunzipSync, gzipSync } from "zlib";
import { bench, run } from "../runner.mjs";
const require = createRequire(import.meta.url);
const data = readFileSync(require.resolve("@babel/standalone/babel.min.js"));

View File

@@ -3,9 +3,9 @@
"scripts": {
"deps": "exit 0",
"build": "exit 0",
"bench:bun": "$BUN bun.js",
"bench:node": "$NODE node.mjs",
"bench:deno": "$DENO run -A --unstable deno.js",
"bench:bun": "bun bun.js",
"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": {

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
bench("console.log('hello')", () => console.log("hello"));
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, run } from "../runner.mjs";
bench("console.log", () => console.log("hello"));
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
bench("console.log", () => console.log("hello"));
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));

View File

@@ -3,9 +3,9 @@
"scripts": {
"deps": "exit 0",
"build": "exit 0",
"bench:bun": "$BUN bun.js | grep iter",
"bench:node": "$NODE node.mjs | grep iter",
"bench:deno": "$DENO run -A --unstable deno.mjs | grep iter",
"bench:bun": "bun bun.js | grep iter",
"bench:node": "node node.mjs | grep iter",
"bench:deno": "deno run -A --unstable deno.mjs | grep iter",
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
}
}

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../../runner.mjs";
import {
arch,
cpus,

View File

@@ -1,4 +1,3 @@
import { bench, run } from "mitata";
import {
arch,
cpus,
@@ -19,6 +18,7 @@ import {
userInfo,
version,
} from "node:os";
import { bench, run } from "../../runner.mjs";
bench("cpus()", () => cpus());
bench("networkInterfaces()", () => networkInterfaces());

View File

@@ -3,8 +3,8 @@
"scripts": {
"deps": "exit 0",
"build": "exit 0",
"bench:bun": "$BUN bun.js",
"bench:node": "$NODE node.mjs",
"bench:bun": "bun bun.js",
"bench:node": "node node.mjs",
"bench": "bun run bench:bun && bun run bench:node"
}
}

View File

@@ -7,13 +7,17 @@
"@swc/core": "^1.2.133",
"benchmark": "^2.1.4",
"braces": "^3.0.2",
"color": "^4.2.3",
"esbuild": "^0.14.12",
"eventemitter3": "^5.0.0",
"execa": "^8.0.1",
"fast-glob": "3.3.1",
"fdir": "^6.1.0",
"mitata": "^0.1.6",
"mitata": "^1.0.10",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"string-width": "7.1.0",
"tinycolor2": "^1.6.0",
"zx": "^7.2.3"
},
"scripts": {

19
bench/runner.mjs Normal file
View File

@@ -0,0 +1,19 @@
import * as Mitata from "mitata";
import process from "node:process";
const asJSON = !!process?.env?.BENCHMARK_RUNNER;
/** @param {Parameters<typeof Mitata["run"]>["0"]} opts */
export function run(opts = {}) {
if (asJSON) {
opts.format = "json";
}
return Mitata.run(opts);
}
export const bench = Mitata.bench;
export function group(_name, fn) {
return Mitata.group(fn);
}

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
function doIt(...args) {
// we use .at() to prevent constant folding optimizations

View File

@@ -1,5 +1,5 @@
// https://github.com/oven-sh/bun/issues/1096
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
const identity = x => x;

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
var myArray = new Array(5);
bench("[1, 2, 3, 4, 5].shift()", () => {

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
var comparator = (a, b) => a - b;
const numbers = [

View File

@@ -1,6 +1,6 @@
// @runtime bun
import { ArrayBufferSink } from "bun";
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
var short = "Hello World!";
var shortUTF16 = "Hello World 💕💕💕";

View File

@@ -1,5 +1,5 @@
import * as assert from "assert";
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
bench("deepEqual", () => {
assert.deepEqual({ foo: "123", bar: "baz" }, { foo: "123", bar: "baz" });

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { bench, run } from "../runner.mjs";
bench("noop", function () {});
bench("async function(){}", async function () {});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
function makeBenchmark(size) {
const latin1 = btoa("A".repeat(size));

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, run } from "../runner.mjs";
bench("new Blob(['hello world'])", function () {
return new Blob(["hello world"]);

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
function makeBenchmark(size, isToString) {
const base64Input = Buffer.alloc(size, "latin1").toString("base64");

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
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);

View File

@@ -1,7 +1,7 @@
// @runtime bun,node,deno
import { Buffer } from "node:buffer";
import process from "node:process";
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
const N = parseInt(process.env.RUN_COUNTER ?? "10000", 10);
var isBuffer = new Buffer(0);

View File

@@ -0,0 +1,15 @@
import { bench, run } from "../runner.mjs";
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
for (let fillSize of [4, 8, 16, 11]) {
const buffer = Buffer.allocUnsafe(size);
const pattern = "x".repeat(fillSize);
bench(`Buffer.fill ${size} bytes with ${fillSize} byte value`, () => {
buffer.fill(pattern);
});
}
}
await run();

View File

@@ -1,6 +1,6 @@
import { Buffer } from "node:buffer";
import crypto from "node:crypto";
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
const bigBuffer = Buffer.from("hello world".repeat(10000));
const converted = bigBuffer.toString("base64");

25
bench/snippets/color.mjs Normal file
View File

@@ -0,0 +1,25 @@
import Color from "color";
import tinycolor from "tinycolor2";
import { bench, group, run } from "../runner.mjs";
const inputs = ["#f00", "rgb(255, 0, 0)", "rgba(255, 0, 0, 1)", "hsl(0, 100%, 50%)"];
for (const input of inputs) {
group(`${input}`, () => {
if (typeof Bun !== "undefined") {
bench(`Bun.color() (${input})`, () => {
Bun.color(input, "css");
});
}
bench(`color (${input})`, () => {
Color(input).hex();
});
bench(`'tinycolor2' (${input})`, () => {
tinycolor(input).toHexString();
});
});
}
await run();

View File

@@ -1,6 +1,6 @@
import { allocUnsafe } from "bun";
import { readFileSync } from "fs";
import { bench, group, run } from "./runner.mjs";
import { bench, group, run } from "../runner.mjs";
function polyfill(chunks) {
var size = 0;
@@ -41,15 +41,16 @@ const chunkGroups = [
];
for (const chunks of chunkGroups) {
group(`${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`, () => {
bench("Bun.concatArrayBuffers", () => {
const name = `${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`
group(name, () => {
bench(`Bun.concatArrayBuffers (${name})`, () => {
Bun.concatArrayBuffers(chunks);
});
bench("Uint8Array.set", () => {
bench(`Uint8Array.set (${name})`, () => {
polyfill(chunks);
});
bench("Uint8Array.set (uninitialized memory)", () => {
bench(`Uint8Array.set (uninitialized memory) (${name})`, () => {
polyfillUninitialized(chunks);
});
});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { bench, run } from "../runner.mjs";
const json = {
login: "wongmjane",

View File

@@ -2,7 +2,7 @@ import { mkdirSync, rmSync, writeFileSync } from "fs";
import { cp } from "fs/promises";
import { tmpdir } from "os";
import { join, resolve } from "path";
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
import { fileURLToPath } from "url";
const hugeDirectory = (() => {

View File

@@ -1,6 +1,6 @@
// https://github.com/oven-sh/bun/issues/2190
import { bench, run } from "mitata";
import { createHash } from "node:crypto";
import { bench, run } from "../runner.mjs";
const data =
"Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";

View File

@@ -1,5 +1,5 @@
// so it can run in environments without node module resolution
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
import crypto from "node:crypto";

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { bench, run } from "../runner.mjs";
bench("crypto.randomUUID()", () => {
return crypto.randomUUID();

View File

@@ -1,6 +1,6 @@
// https://github.com/oven-sh/bun/issues/2190
import { bench, run } from "mitata";
import { createHash } from "node:crypto";
import { bench, run } from "../runner.mjs";
const data =
"Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";

Some files were not shown because too many files have changed in this diff Show More