mirror of
https://github.com/oven-sh/bun
synced 2026-02-03 15:38:46 +00:00
Compare commits
1135 Commits
fix-prepar
...
fmt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a3154098c | ||
|
|
a80b3569b4 | ||
|
|
8b5cac1ea1 | ||
|
|
96e7227087 | ||
|
|
f88855da4f | ||
|
|
19cb3ab6ff | ||
|
|
862d35d832 | ||
|
|
a0bcd0f946 | ||
|
|
2264bb3d04 | ||
|
|
3e1231deb4 | ||
|
|
dfcac563bc | ||
|
|
90fd322b5c | ||
|
|
f77b217abf | ||
|
|
7c2be6a877 | ||
|
|
a3c3dad351 | ||
|
|
98b438d0a4 | ||
|
|
58d22b063c | ||
|
|
8cd1db9cda | ||
|
|
2d7df726fd | ||
|
|
1ccf0c2e9c | ||
|
|
db85e04ade | ||
|
|
c2936b205d | ||
|
|
8680641c23 | ||
|
|
e77db8ebac | ||
|
|
dfbedd6a10 | ||
|
|
8624a86eba | ||
|
|
bfc6091faf | ||
|
|
9d0a88ab82 | ||
|
|
2f8f77eeb7 | ||
|
|
7b6e0f7164 | ||
|
|
5df59cb02b | ||
|
|
b61282e290 | ||
|
|
dd3227c436 | ||
|
|
a9a4bbcd24 | ||
|
|
55aa35ee35 | ||
|
|
a99459ffdc | ||
|
|
08f957d33b | ||
|
|
2bd4fe578e | ||
|
|
d672309547 | ||
|
|
e171f04ce6 | ||
|
|
651d5699a0 | ||
|
|
d0d4d8bf85 | ||
|
|
53814dda00 | ||
|
|
d3d5c7a1d6 | ||
|
|
972a7b7080 | ||
|
|
e3759bbbfe | ||
|
|
f722236978 | ||
|
|
e366921e90 | ||
|
|
bd2779b029 | ||
|
|
a05ef0aeb1 | ||
|
|
264142e756 | ||
|
|
51def5f5d6 | ||
|
|
23b292ac21 | ||
|
|
48ed1dfb65 | ||
|
|
bd4d0d15db | ||
|
|
1f0c1c81e9 | ||
|
|
e93eb6c1ab | ||
|
|
1009b07807 | ||
|
|
1a695f13bf | ||
|
|
c75e768a6c | ||
|
|
7d86f9e590 | ||
|
|
a8600b0878 | ||
|
|
5b228256f9 | ||
|
|
ba4daee7e5 | ||
|
|
2c0c562d1d | ||
|
|
683a03d8c7 | ||
|
|
e0c0fe235a | ||
|
|
d16ac87347 | ||
|
|
5934b17f00 | ||
|
|
eedf008c80 | ||
|
|
3a6318b67c | ||
|
|
647b15e4f3 | ||
|
|
625b172a71 | ||
|
|
4959c7d363 | ||
|
|
8808437a02 | ||
|
|
330a4744de | ||
|
|
3a1229d03d | ||
|
|
63a9a8b015 | ||
|
|
f73bde79c7 | ||
|
|
3a7df3f6c7 | ||
|
|
0037dc2537 | ||
|
|
c0fe042102 | ||
|
|
ce1eba1954 | ||
|
|
8191fbd970 | ||
|
|
2af7cdedc2 | ||
|
|
4f98336f86 | ||
|
|
91cfd614ca | ||
|
|
42e4cd8408 | ||
|
|
dbe0a4a978 | ||
|
|
350cc1178a | ||
|
|
dccabd9423 | ||
|
|
345a061d3b | ||
|
|
690346b30b | ||
|
|
16b7b94aea | ||
|
|
fcf0047763 | ||
|
|
af1a124831 | ||
|
|
f5754e3c19 | ||
|
|
4e09f8ef8f | ||
|
|
1969204fa5 | ||
|
|
2d9db9b28f | ||
|
|
0333c7b0bf | ||
|
|
82829c5925 | ||
|
|
8fdb46cb91 | ||
|
|
0aba51230c | ||
|
|
ca801a35fe | ||
|
|
692fb220a4 | ||
|
|
cf1c849e4a | ||
|
|
2eede4f435 | ||
|
|
4989ef88b8 | ||
|
|
9fa26e6a09 | ||
|
|
413aaaff33 | ||
|
|
c538bf87d1 | ||
|
|
1e9b44adda | ||
|
|
3046b0ee39 | ||
|
|
01d41838c5 | ||
|
|
bc7e7027e4 | ||
|
|
eaea6dea54 | ||
|
|
d0b759f784 | ||
|
|
dbfc62e288 | ||
|
|
34ae040d95 | ||
|
|
3caa846988 | ||
|
|
5a0ae3c256 | ||
|
|
568f87eb8f | ||
|
|
968c21d80a | ||
|
|
6faeef6dc2 | ||
|
|
08c9511acc | ||
|
|
1644f341f9 | ||
|
|
17fc1e7be1 | ||
|
|
7492b3a203 | ||
|
|
681baedab2 | ||
|
|
c7c3ae381b | ||
|
|
7543da0bb3 | ||
|
|
83ac4f0c33 | ||
|
|
3c42dfd42b | ||
|
|
e3188c918a | ||
|
|
045672cf67 | ||
|
|
345ed18454 | ||
|
|
5462ca01fd | ||
|
|
4bfd8a8cef | ||
|
|
a2a12b5802 | ||
|
|
b6c1dc1fa8 | ||
|
|
f4f8bb377a | ||
|
|
5c21695db6 | ||
|
|
2c16b204ff | ||
|
|
20f7fd5b08 | ||
|
|
c9a7d24538 | ||
|
|
108cae5189 | ||
|
|
358be9e727 | ||
|
|
2a6388d50b | ||
|
|
aa901a22c2 | ||
|
|
562495b878 | ||
|
|
875728da83 | ||
|
|
47e7e004b1 | ||
|
|
80bd3254cc | ||
|
|
0bf8a25d50 | ||
|
|
effb8f189b | ||
|
|
7eeefc1497 | ||
|
|
025a5ba140 | ||
|
|
885d705d55 | ||
|
|
3447bc2ed3 | ||
|
|
f1f861fd74 | ||
|
|
58ba802ca6 | ||
|
|
73f3b92dc9 | ||
|
|
eeb10f3f7d | ||
|
|
8544f8ae68 | ||
|
|
9f5ce53544 | ||
|
|
82b6a42a3c | ||
|
|
0974479655 | ||
|
|
918e1878a5 | ||
|
|
17deafd05f | ||
|
|
b7ae984ca1 | ||
|
|
e848c3f226 | ||
|
|
cd3de9c788 | ||
|
|
945ad77bce | ||
|
|
04a99deb0e | ||
|
|
cff5dc0ee8 | ||
|
|
77ccf77e35 | ||
|
|
864a726249 | ||
|
|
1407683f95 | ||
|
|
1f928e9b6e | ||
|
|
e0cf77c660 | ||
|
|
07a685bd3d | ||
|
|
80ad8d57f2 | ||
|
|
41b45599c6 | ||
|
|
416e896c63 | ||
|
|
2d1e0dc240 | ||
|
|
c52e7c57d2 | ||
|
|
c4a60f9059 | ||
|
|
15fe30ac41 | ||
|
|
a014f1c566 | ||
|
|
73b0b35a42 | ||
|
|
75524d0ae3 | ||
|
|
c21dc25a65 | ||
|
|
3bc0f90a7c | ||
|
|
eaa1cd5553 | ||
|
|
6019665d4b | ||
|
|
b7b0e28b10 | ||
|
|
c577c64aa7 | ||
|
|
1560a866fe | ||
|
|
5b9e1e5708 | ||
|
|
353f724a9c | ||
|
|
a8ff7be642 | ||
|
|
af67ee77a0 | ||
|
|
b82656d9fc | ||
|
|
7b9201a0fc | ||
|
|
627d60c6c7 | ||
|
|
c00f0787f0 | ||
|
|
3ca0fcb67a | ||
|
|
43107f48fa | ||
|
|
b1273e53d8 | ||
|
|
10e57fdc1e | ||
|
|
fad3db84f0 | ||
|
|
fccab2f0da | ||
|
|
885f9372f4 | ||
|
|
509a2c5a69 | ||
|
|
b433beb016 | ||
|
|
c71bad205c | ||
|
|
d4794bbac8 | ||
|
|
6fa35839c3 | ||
|
|
35d551c174 | ||
|
|
4674ee16a1 | ||
|
|
ce2ef65122 | ||
|
|
0d88dcb0fa | ||
|
|
15f727dc2f | ||
|
|
dcfec52b11 | ||
|
|
7ca4ca8972 | ||
|
|
76ed8d8086 | ||
|
|
1f126cd91a | ||
|
|
5e520884cd | ||
|
|
1c5b318207 | ||
|
|
1b1760a9c9 | ||
|
|
751ff68268 | ||
|
|
3c785c88fb | ||
|
|
8efa01bd62 | ||
|
|
e17709a2d3 | ||
|
|
c50400e186 | ||
|
|
ff965af067 | ||
|
|
48d642e9e0 | ||
|
|
e197b7c3a0 | ||
|
|
95e466628b | ||
|
|
41dda11802 | ||
|
|
8ba332b43a | ||
|
|
52894121ea | ||
|
|
a5e83189df | ||
|
|
405e2d1517 | ||
|
|
483b73c4bf | ||
|
|
cb97baed22 | ||
|
|
01df0e6ef0 | ||
|
|
08aa40c570 | ||
|
|
82fcb38005 | ||
|
|
fc80683256 | ||
|
|
54be1d7705 | ||
|
|
7eed9d893e | ||
|
|
e77f9036e0 | ||
|
|
5a6ef045aa | ||
|
|
9350f6bc0b | ||
|
|
4ccf6fb284 | ||
|
|
83f2432da6 | ||
|
|
f673a84c75 | ||
|
|
51680dbfdc | ||
|
|
1aa36e27cb | ||
|
|
e6285a1cc8 | ||
|
|
a064ae71ad | ||
|
|
f9e78c419f | ||
|
|
0fb864e0ca | ||
|
|
a4da0acb0e | ||
|
|
f47def8515 | ||
|
|
14398ae27e | ||
|
|
64d351b102 | ||
|
|
6b577a3970 | ||
|
|
a159850cce | ||
|
|
87eedc29d5 | ||
|
|
124392ee98 | ||
|
|
e5421c56b1 | ||
|
|
407f42718c | ||
|
|
a36355cefb | ||
|
|
2d21567271 | ||
|
|
611b296a6a | ||
|
|
317998fdd6 | ||
|
|
ab40b0e054 | ||
|
|
2c3dc5176b | ||
|
|
5fc4538477 | ||
|
|
be0896e204 | ||
|
|
56f1e5a362 | ||
|
|
702da52312 | ||
|
|
2a8956a268 | ||
|
|
86b1aa02b3 | ||
|
|
065eae5a95 | ||
|
|
9fa13aec09 | ||
|
|
3e703c4c76 | ||
|
|
01453be2d1 | ||
|
|
9b32516bcb | ||
|
|
7e787d2a5a | ||
|
|
b7a32b87ab | ||
|
|
0491ff4186 | ||
|
|
943c72c8a1 | ||
|
|
cb6f4b9f4d | ||
|
|
45bd2264e3 | ||
|
|
8733748eb6 | ||
|
|
66fa317390 | ||
|
|
ef0e96a2b2 | ||
|
|
b0d326dfb9 | ||
|
|
517d5ecde9 | ||
|
|
072f2f15ea | ||
|
|
0cd7fa1a63 | ||
|
|
2fe0f90d36 | ||
|
|
0783b4bf0e | ||
|
|
4f96bc416b | ||
|
|
f43ecd8aa2 | ||
|
|
31db26b054 | ||
|
|
f5675284c7 | ||
|
|
98d253d9bb | ||
|
|
9846383b01 | ||
|
|
fbe4ed206a | ||
|
|
15263664b6 | ||
|
|
4611b84352 | ||
|
|
922ff08a80 | ||
|
|
4c933f733b | ||
|
|
f1c3e87a06 | ||
|
|
0bfe3760f6 | ||
|
|
68bc548dce | ||
|
|
7d4cef53a8 | ||
|
|
b400b36ca5 | ||
|
|
36d4f09d28 | ||
|
|
e77e1c1a58 | ||
|
|
6e1ef49ad4 | ||
|
|
2daade39a9 | ||
|
|
ae78441b25 | ||
|
|
fb8b47b2db | ||
|
|
9a0dadad24 | ||
|
|
f27fc77b3b | ||
|
|
88fcfa4461 | ||
|
|
9d56ea4880 | ||
|
|
b488734c50 | ||
|
|
8f975ec8ec | ||
|
|
1aee55524a | ||
|
|
8805e6150a | ||
|
|
237b5eded6 | ||
|
|
437faa9444 | ||
|
|
e65bab75bc | ||
|
|
d985e4db65 | ||
|
|
9a267db105 | ||
|
|
06c530ba2e | ||
|
|
a1e742734a | ||
|
|
0dc6108bd3 | ||
|
|
ecdde88670 | ||
|
|
2fd85ef0e6 | ||
|
|
a774f92757 | ||
|
|
eb84ebf974 | ||
|
|
bfe8afd674 | ||
|
|
e8179adcbb | ||
|
|
515ce30a85 | ||
|
|
97f8c92cf4 | ||
|
|
d4d6ef9e89 | ||
|
|
fa7e4bce27 | ||
|
|
89ec2fcb35 | ||
|
|
39ab26a663 | ||
|
|
e103b53c86 | ||
|
|
ee85bbc0a3 | ||
|
|
0103dd56ab | ||
|
|
5d6c68122c | ||
|
|
47acee5d87 | ||
|
|
54d762531a | ||
|
|
e5bd7fcb8f | ||
|
|
f30689256d | ||
|
|
50c1f37230 | ||
|
|
80ebcbf3d8 | ||
|
|
6345add18a | ||
|
|
2946bacbbd | ||
|
|
7fa2cf3f61 | ||
|
|
aa388e6762 | ||
|
|
5a2ad792a0 | ||
|
|
69c85dbe17 | ||
|
|
71d9199270 | ||
|
|
6b3e1af25d | ||
|
|
9f8ee7c8f7 | ||
|
|
233622d6bb | ||
|
|
837cbd60d5 | ||
|
|
9d6c0649a4 | ||
|
|
693a00dc5b | ||
|
|
1f9ce68348 | ||
|
|
492b2d5b76 | ||
|
|
8eebfd8e22 | ||
|
|
1d684e0d4f | ||
|
|
14c60eca94 | ||
|
|
6eab178790 | ||
|
|
32ca195f60 | ||
|
|
c381816c57 | ||
|
|
ae8f2a3afb | ||
|
|
25441ede20 | ||
|
|
a0c8ee31a1 | ||
|
|
135039b137 | ||
|
|
05f14c8d6a | ||
|
|
15755a0246 | ||
|
|
b6cadf387b | ||
|
|
b011fd2567 | ||
|
|
5e72a27a76 | ||
|
|
9ef7b304d9 | ||
|
|
38d5a5fe9a | ||
|
|
43b99021f8 | ||
|
|
8a34b8f6f8 | ||
|
|
70f344101b | ||
|
|
a3a6b894c5 | ||
|
|
a5bf1216d1 | ||
|
|
ae5f1b0168 | ||
|
|
20690403da | ||
|
|
903a202473 | ||
|
|
14bc121dc8 | ||
|
|
eac3bda895 | ||
|
|
0a7bbcb9a6 | ||
|
|
107015fd48 | ||
|
|
813afe6c53 | ||
|
|
411094b82d | ||
|
|
1f90608d66 | ||
|
|
2b09347dc6 | ||
|
|
f02ef8fb35 | ||
|
|
da13884295 | ||
|
|
8a39c02e7a | ||
|
|
bfc065c5cc | ||
|
|
93c081f351 | ||
|
|
4a66091491 | ||
|
|
d1dcf5ccf7 | ||
|
|
f8159f1b36 | ||
|
|
1a370eb483 | ||
|
|
f12ff9d1e5 | ||
|
|
4d6219eda4 | ||
|
|
a3630dde2e | ||
|
|
c6ba32b850 | ||
|
|
05984d405f | ||
|
|
696a5a28c9 | ||
|
|
b399deebdd | ||
|
|
39ea8cbfea | ||
|
|
09d51486e9 | ||
|
|
ead3bdf947 | ||
|
|
6077ace528 | ||
|
|
a119e8d636 | ||
|
|
72eb607e21 | ||
|
|
26325aca95 | ||
|
|
98242fa10d | ||
|
|
906f86d6fd | ||
|
|
9fdd1068da | ||
|
|
7e59f287a1 | ||
|
|
56df6a9888 | ||
|
|
ada49eb96d | ||
|
|
c5436c09ab | ||
|
|
a93f467a74 | ||
|
|
cd55401eba | ||
|
|
0f8bcfdc53 | ||
|
|
2428da9354 | ||
|
|
65e11c48b6 | ||
|
|
6b549ee592 | ||
|
|
5b538fb076 | ||
|
|
7e511f55de | ||
|
|
c271c6c38e | ||
|
|
00955c712e | ||
|
|
00e745ec2c | ||
|
|
6ee812d63d | ||
|
|
a623e7c702 | ||
|
|
59a0e885d9 | ||
|
|
3f1c39ad0b | ||
|
|
39d062cf3c | ||
|
|
92901eb6e0 | ||
|
|
ab68aa5a8e | ||
|
|
3f131c0411 | ||
|
|
db60c92e25 | ||
|
|
1730cfbbbf | ||
|
|
45a499912b | ||
|
|
61f92d9e5f | ||
|
|
3baaa28f93 | ||
|
|
b88324db31 | ||
|
|
dc19541719 | ||
|
|
2d2f3c4e50 | ||
|
|
f3ce571a29 | ||
|
|
1a2643520b | ||
|
|
31c17a1bb3 | ||
|
|
a1a4178c3f | ||
|
|
7ac5bdc9dd | ||
|
|
506c165860 | ||
|
|
6fc29b6412 | ||
|
|
b6f60680f6 | ||
|
|
1f71ad5661 | ||
|
|
cbb477cbe2 | ||
|
|
369e3022e4 | ||
|
|
925a94ffe6 | ||
|
|
ca89087684 | ||
|
|
9e47ceac87 | ||
|
|
4098dd0df5 | ||
|
|
c3b1333ae8 | ||
|
|
f88e5d128c | ||
|
|
4d7c66066b | ||
|
|
3872f7a5b7 | ||
|
|
6443c26a4a | ||
|
|
c2cd7402a0 | ||
|
|
fbcb622335 | ||
|
|
fc733fe89c | ||
|
|
441612917d | ||
|
|
adcad39e1d | ||
|
|
453a270b2e | ||
|
|
fe5e19da59 | ||
|
|
19e80771ac | ||
|
|
36c316a24a | ||
|
|
c0ccdccbeb | ||
|
|
1fc9b56936 | ||
|
|
8ec405facc | ||
|
|
beedb28e38 | ||
|
|
1aaf63efc4 | ||
|
|
0bce2b46ca | ||
|
|
c8305df5c2 | ||
|
|
9787ea91f2 | ||
|
|
a648ed9e6a | ||
|
|
ab95e2189f | ||
|
|
dc0736d61d | ||
|
|
5029fc8564 | ||
|
|
38c6575dc8 | ||
|
|
efb2cb5871 | ||
|
|
9fc12a1244 | ||
|
|
900eec71fa | ||
|
|
4fec7f84c8 | ||
|
|
5787350243 | ||
|
|
35ba928430 | ||
|
|
7ec64c2cc8 | ||
|
|
5e60861c34 | ||
|
|
39b66ded08 | ||
|
|
a2f595d352 | ||
|
|
d163351f3e | ||
|
|
351e47355a | ||
|
|
83ed65c687 | ||
|
|
ab85b2a2a0 | ||
|
|
6a63224f86 | ||
|
|
c9e98db258 | ||
|
|
351810e5bc | ||
|
|
3aabe58180 | ||
|
|
800fb12906 | ||
|
|
7541f4ce4f | ||
|
|
402f3353ac | ||
|
|
73b0426596 | ||
|
|
54f1f4635e | ||
|
|
300d17f223 | ||
|
|
ce63023553 | ||
|
|
59f9d2fe70 | ||
|
|
aaa827f90e | ||
|
|
c84be8c48b | ||
|
|
1d45c1c412 | ||
|
|
653e2934fe | ||
|
|
798f548607 | ||
|
|
1337bb6923 | ||
|
|
b6775e2df7 | ||
|
|
4519f97661 | ||
|
|
dfd4b01a97 | ||
|
|
1bf540efcf | ||
|
|
b1c8ae97ff | ||
|
|
6a5995e27d | ||
|
|
24ca605832 | ||
|
|
ad4b98b287 | ||
|
|
fd1d4b4e5a | ||
|
|
f0e0c6d5df | ||
|
|
b77480758f | ||
|
|
93d9b20974 | ||
|
|
f303bcd997 | ||
|
|
62e1389e17 | ||
|
|
b952ef8ad9 | ||
|
|
ec6339c25a | ||
|
|
2ff788f463 | ||
|
|
df17598026 | ||
|
|
298a60419b | ||
|
|
2f83f32582 | ||
|
|
b3bdf22ebb | ||
|
|
d45f2dae15 | ||
|
|
67c7769ddb | ||
|
|
03298cba70 | ||
|
|
3963d2de64 | ||
|
|
b2bf3f0dcf | ||
|
|
ffe447ba5a | ||
|
|
7389f1b108 | ||
|
|
7538c20afe | ||
|
|
ed02691f8b | ||
|
|
dae985ab3c | ||
|
|
52e1c2de08 | ||
|
|
0c532eac7b | ||
|
|
70e57a7da0 | ||
|
|
fdece8611a | ||
|
|
1147c70881 | ||
|
|
3c97f568a7 | ||
|
|
310d0c5646 | ||
|
|
d79fa7ac1a | ||
|
|
906ba8b2a0 | ||
|
|
54df5c032d | ||
|
|
70039ff038 | ||
|
|
90654143bb | ||
|
|
bc114fb9d3 | ||
|
|
f3727f00dc | ||
|
|
6389a6e24f | ||
|
|
851b19ee0e | ||
|
|
ebae02a08b | ||
|
|
809266fc7a | ||
|
|
98885279eb | ||
|
|
666e615889 | ||
|
|
0b99b01b0e | ||
|
|
eb98b61201 | ||
|
|
a043497fb4 | ||
|
|
f5115835da | ||
|
|
34881922c8 | ||
|
|
44b9960113 | ||
|
|
713d72703d | ||
|
|
383a615d21 | ||
|
|
6ee42f7719 | ||
|
|
1840de3661 | ||
|
|
6aa1319fd9 | ||
|
|
6a7b1a3208 | ||
|
|
5c23d670a3 | ||
|
|
22818e6806 | ||
|
|
0abe3745d2 | ||
|
|
ea0ffde991 | ||
|
|
194294f5b5 | ||
|
|
7f10622a84 | ||
|
|
a71a9e3447 | ||
|
|
53ee2d77b2 | ||
|
|
3d58437fc8 | ||
|
|
6517252153 | ||
|
|
5f86b839b4 | ||
|
|
5692f82aaf | ||
|
|
93714292bf | ||
|
|
0766fb5ae8 | ||
|
|
e83a9132d5 | ||
|
|
bc4146295f | ||
|
|
d8be3e51b4 | ||
|
|
6ba4e950cc | ||
|
|
81067477dc | ||
|
|
d8ca6ca699 | ||
|
|
05ef3329c4 | ||
|
|
ab93f9f74e | ||
|
|
8db407e9a7 | ||
|
|
5eb6f83251 | ||
|
|
1b8d7d5cb1 | ||
|
|
bf32d36e4c | ||
|
|
e9661c2953 | ||
|
|
0b66fd643e | ||
|
|
778bad9dfd | ||
|
|
ef8b9efaa4 | ||
|
|
864d59f822 | ||
|
|
f5bf67bd1b | ||
|
|
075c09401a | ||
|
|
c23579d66c | ||
|
|
6c200c089c | ||
|
|
3eb086f5fa | ||
|
|
fbff18a723 | ||
|
|
6e7014c91b | ||
|
|
711ea1604b | ||
|
|
538a243453 | ||
|
|
8be492c080 | ||
|
|
6c7a0e5a79 | ||
|
|
f4d14c02c7 | ||
|
|
3ca2d8ae5e | ||
|
|
c23aed993f | ||
|
|
11e07caaa4 | ||
|
|
e4de49df2a | ||
|
|
47e1fbe468 | ||
|
|
8353ba7857 | ||
|
|
606c80b049 | ||
|
|
d1436e3ecc | ||
|
|
7e0e007e3e | ||
|
|
2e74f7f079 | ||
|
|
2c81c2a13f | ||
|
|
d9a0fd4f59 | ||
|
|
d1ec8f86f3 | ||
|
|
85c997513d | ||
|
|
904134cc75 | ||
|
|
15e4f1bad3 | ||
|
|
09b8b6b468 | ||
|
|
4dfc7feae0 | ||
|
|
77e6b946f4 | ||
|
|
31814934f3 | ||
|
|
b43a8b54cf | ||
|
|
a165306fd9 | ||
|
|
056d45cf6b | ||
|
|
46955e95ef | ||
|
|
e6e4ffb4ae | ||
|
|
5946e13e27 | ||
|
|
8f3e278ab9 | ||
|
|
547ed6d74d | ||
|
|
d4adcb3ccf | ||
|
|
d4628992d8 | ||
|
|
24b4b2c16d | ||
|
|
35bac672bb | ||
|
|
d649f69404 | ||
|
|
7ce5061343 | ||
|
|
20d9e25ae2 | ||
|
|
89c76f2b45 | ||
|
|
a9a68c3143 | ||
|
|
d1c1c8fb5f | ||
|
|
4228ecea98 | ||
|
|
909a821d3d | ||
|
|
7a4e0158d6 | ||
|
|
228bfbd24a | ||
|
|
45e1bc3a21 | ||
|
|
e1489d4fe3 | ||
|
|
273f612c77 | ||
|
|
a82b2b2d04 | ||
|
|
bf767b53d7 | ||
|
|
1db1941577 | ||
|
|
49f86c87b4 | ||
|
|
346e27083f | ||
|
|
6d666da4b9 | ||
|
|
feca0c2647 | ||
|
|
bf806602d8 | ||
|
|
e3ab7408c9 | ||
|
|
c49a5a7d7d | ||
|
|
450397a277 | ||
|
|
f63eba952e | ||
|
|
eaa9ba99fa | ||
|
|
f0cbc79d8b | ||
|
|
01e0136d7c | ||
|
|
520845217e | ||
|
|
42d8a0b44b | ||
|
|
84414f8fe8 | ||
|
|
046d197519 | ||
|
|
1250655ddb | ||
|
|
29b1a4f61b | ||
|
|
2d5698c719 | ||
|
|
c08e8a76ef | ||
|
|
03298eb8dd | ||
|
|
a86a57e1b8 | ||
|
|
45f2eac44c | ||
|
|
b05e753c9f | ||
|
|
f7f6233ea8 | ||
|
|
6d5c513195 | ||
|
|
131b96bbba | ||
|
|
b7587b76e0 | ||
|
|
ee43932189 | ||
|
|
9082193568 | ||
|
|
b52e503ce4 | ||
|
|
e581f732d7 | ||
|
|
c939ec1544 | ||
|
|
a2f2ed5411 | ||
|
|
55f636ffb8 | ||
|
|
cbba20804e | ||
|
|
91c2edc0f2 | ||
|
|
09a4d864da | ||
|
|
11e7937c3c | ||
|
|
22a7e3a310 | ||
|
|
4fbde727d2 | ||
|
|
990ca9cb9d | ||
|
|
21e32c042e | ||
|
|
d85bd49d87 | ||
|
|
c0853959c2 | ||
|
|
fef7920b17 | ||
|
|
b5a04827e1 | ||
|
|
bb5d6fff77 | ||
|
|
8d3a0ddd47 | ||
|
|
75aa963fef | ||
|
|
b0126b5962 | ||
|
|
a7251047b7 | ||
|
|
2f301e8404 | ||
|
|
3fae8933e5 | ||
|
|
c3a7b574c8 | ||
|
|
fa25d60df8 | ||
|
|
8130d9f3e1 | ||
|
|
3ba9647858 | ||
|
|
c77c6ea53e | ||
|
|
98f20170a3 | ||
|
|
e954bce301 | ||
|
|
8554683297 | ||
|
|
5d1a7d8d5a | ||
|
|
39101d16c3 | ||
|
|
e7a83ad70e | ||
|
|
142cdf1714 | ||
|
|
2d4011b22f | ||
|
|
eeb3f7be18 | ||
|
|
12272bb527 | ||
|
|
4403c40755 | ||
|
|
2a405f691e | ||
|
|
75393e02b8 | ||
|
|
e646853d7a | ||
|
|
3912f4d064 | ||
|
|
53d1acb0a5 | ||
|
|
23d2c4c8e4 | ||
|
|
732650d6a4 | ||
|
|
b29d68bbaf | ||
|
|
715be35764 | ||
|
|
e259056bd8 | ||
|
|
68146d0544 | ||
|
|
7e09c7ca1e | ||
|
|
4d780837ac | ||
|
|
cbc5ca770b | ||
|
|
2972cfadfb | ||
|
|
6be17538e7 | ||
|
|
e5ccce1e89 | ||
|
|
08fdbb3c7d | ||
|
|
8880bf1026 | ||
|
|
d7cb7884c3 | ||
|
|
bb19677ae4 | ||
|
|
a7a74b73f2 | ||
|
|
e4394ef5cc | ||
|
|
e4e811d0a7 | ||
|
|
6851a57ebd | ||
|
|
3b25c8637b | ||
|
|
d1244c8b1f | ||
|
|
d1a7bb4a69 | ||
|
|
a0bd8365da | ||
|
|
16a0801058 | ||
|
|
c4156376d9 | ||
|
|
4ff54139b7 | ||
|
|
8d2e0725e7 | ||
|
|
700f932ddf | ||
|
|
7485c7c7cb | ||
|
|
46a337cbc8 | ||
|
|
58d9a0d770 | ||
|
|
8f42d8c2dd | ||
|
|
b5fb980145 | ||
|
|
2b8aae05d1 | ||
|
|
2327737b14 | ||
|
|
58ce044607 | ||
|
|
85bde43c2f | ||
|
|
4fb5ab0ca8 | ||
|
|
c275cecfd1 | ||
|
|
6a2768f247 | ||
|
|
7bcf60324a | ||
|
|
c700a70872 | ||
|
|
ce4e1894f6 | ||
|
|
f60167c015 | ||
|
|
042a6cdbce | ||
|
|
85a0d71c52 | ||
|
|
fa1bbec023 | ||
|
|
1496681297 | ||
|
|
3906d17165 | ||
|
|
f297b95436 | ||
|
|
fafd9368f5 | ||
|
|
1836ecd2ed | ||
|
|
4cdaabd433 | ||
|
|
4a74a46780 | ||
|
|
b62c010e95 | ||
|
|
074534b292 | ||
|
|
b0393fba62 | ||
|
|
7166fe10b5 | ||
|
|
2890ad53c4 | ||
|
|
01e3474600 | ||
|
|
756eee087a | ||
|
|
4b2cdc4fc1 | ||
|
|
184528e4eb | ||
|
|
8cf7d6157a | ||
|
|
68324daf78 | ||
|
|
66debb1ce4 | ||
|
|
d5d9fc4684 | ||
|
|
f6b694ee2c | ||
|
|
bb623196a3 | ||
|
|
e9948f1291 | ||
|
|
378385ba60 | ||
|
|
ef5930e8bc | ||
|
|
0173571b19 | ||
|
|
35259c0c1d | ||
|
|
e7cba822e4 | ||
|
|
0d34e7a141 | ||
|
|
aedc8c0ead | ||
|
|
9c0cd5c030 | ||
|
|
2f10398c74 | ||
|
|
49ef5bccec | ||
|
|
dcbcf9803a | ||
|
|
e731eff382 | ||
|
|
a57d7ecb5b | ||
|
|
d187563d36 | ||
|
|
e91436e524 | ||
|
|
bbc2e96090 | ||
|
|
f53eb7cd59 | ||
|
|
98d19fa624 | ||
|
|
a3958190e8 | ||
|
|
6504bfef74 | ||
|
|
220cb0eb94 | ||
|
|
01e04e3341 | ||
|
|
0853e19f53 | ||
|
|
a9b8e3ecc8 | ||
|
|
bec6161dce | ||
|
|
8c580e6764 | ||
|
|
c5354951ba | ||
|
|
f1658e2e58 | ||
|
|
90d7f33522 | ||
|
|
d9c0273421 | ||
|
|
d65b1fd80b | ||
|
|
7becb5ec74 | ||
|
|
c3f5baa091 | ||
|
|
800ad150ff | ||
|
|
5608e59270 | ||
|
|
e31ed84b1b | ||
|
|
548b1d02f2 | ||
|
|
f63955a01f | ||
|
|
2996ef7156 | ||
|
|
2b1f3438e6 | ||
|
|
2a8f3a3b4e | ||
|
|
a87aa2fafe | ||
|
|
9b5e66453b | ||
|
|
46f978838d | ||
|
|
21576589c6 | ||
|
|
d7062eb367 | ||
|
|
851dc9aadc | ||
|
|
d08e112d41 | ||
|
|
77d7e47019 | ||
|
|
1bad64bc5e | ||
|
|
0794767291 | ||
|
|
d7c8a58453 | ||
|
|
4fab8fee21 | ||
|
|
3f2df4526e | ||
|
|
d6d4ead438 | ||
|
|
4e67862753 | ||
|
|
584e6dd1c2 | ||
|
|
4bb753295d | ||
|
|
892593c73b | ||
|
|
691cf338c2 | ||
|
|
beb746e5ea | ||
|
|
89faee2522 | ||
|
|
969da088f5 | ||
|
|
c50be68790 | ||
|
|
2fbb95142a | ||
|
|
755e16d962 | ||
|
|
b1063edf3e | ||
|
|
edb4cbac2b | ||
|
|
a59a69e21b | ||
|
|
4c9e009971 | ||
|
|
4531cf18c2 | ||
|
|
31bda68f24 | ||
|
|
1bf28e0d77 | ||
|
|
6a17ebe669 | ||
|
|
39446ebdb8 | ||
|
|
c2c3b0d4a9 | ||
|
|
9a90d90966 | ||
|
|
05781dd91e | ||
|
|
a6a474a83f | ||
|
|
44dd744f0a | ||
|
|
df4ec8aaad | ||
|
|
0348b169d6 | ||
|
|
54dbf3ba21 | ||
|
|
5f09a4dd0a | ||
|
|
e58e85cd5c | ||
|
|
6301778a58 | ||
|
|
3667b93871 | ||
|
|
0a8aab6b23 | ||
|
|
6a73f2b1e7 | ||
|
|
99a78f8540 | ||
|
|
8d4b296bd2 | ||
|
|
a9e1792607 | ||
|
|
0965e6ddfd | ||
|
|
35109160ca | ||
|
|
bb9933fa7e | ||
|
|
673f6fc634 | ||
|
|
09663a5558 | ||
|
|
66b15a8df6 | ||
|
|
96aa9c0a38 | ||
|
|
46736d5ecb | ||
|
|
25cf4016d3 | ||
|
|
48635fd910 | ||
|
|
456d6be022 | ||
|
|
16cf1fe5f3 | ||
|
|
e0e9bc16bf | ||
|
|
30b8993edd | ||
|
|
5c37d5293c | ||
|
|
323ae0f2a3 | ||
|
|
7ef4cd26ac | ||
|
|
df1b0c4332 | ||
|
|
4a2e1574e4 | ||
|
|
5a315f4df0 | ||
|
|
f0a914ea8d | ||
|
|
d4a458a95b | ||
|
|
5c8233515a | ||
|
|
c5c7934ebc | ||
|
|
b0ffe68675 | ||
|
|
5da79a8366 | ||
|
|
ff88510e5f | ||
|
|
df9461ecc5 | ||
|
|
98e9e9b112 | ||
|
|
9308e1bf09 | ||
|
|
aa8ccce952 | ||
|
|
ffe6bb0b7f | ||
|
|
b7982ac131 | ||
|
|
60e7ae9aee | ||
|
|
86e4f72f00 | ||
|
|
0ca9a7889a | ||
|
|
476fa4deda | ||
|
|
4f1710d2d6 | ||
|
|
1acc8191f5 | ||
|
|
0ee04261b9 | ||
|
|
745b6b94ee | ||
|
|
47651f321a | ||
|
|
b444c0b98d | ||
|
|
15880308b7 | ||
|
|
89bb526e14 | ||
|
|
63a00791fa | ||
|
|
a6af1c89b9 | ||
|
|
08bf8b8ad1 | ||
|
|
0c3c57cc35 | ||
|
|
237a5ada47 | ||
|
|
0a2d490bf8 | ||
|
|
ea956e58e9 | ||
|
|
46b5069c40 | ||
|
|
f7618aba20 | ||
|
|
e020ecec15 | ||
|
|
8775d37559 | ||
|
|
54d25b8f6b | ||
|
|
960922bba9 | ||
|
|
c21be13be4 | ||
|
|
c0b758ad45 | ||
|
|
d65fdb6035 | ||
|
|
a97847a494 | ||
|
|
eddb0078b5 | ||
|
|
fa7d7bd1e4 | ||
|
|
72bdd380af | ||
|
|
10bee33909 | ||
|
|
6afa78120a | ||
|
|
6514dcf4cb | ||
|
|
d3caf37b49 | ||
|
|
315125c43a | ||
|
|
f6fbf86910 | ||
|
|
e1117c6ae5 | ||
|
|
4bdec01619 | ||
|
|
2e8d9d4607 | ||
|
|
640b0b4df9 | ||
|
|
16be721d8a | ||
|
|
26794680dd | ||
|
|
5fedc8bd6c | ||
|
|
e62fef6765 | ||
|
|
387f1260c9 | ||
|
|
e60b3607c1 | ||
|
|
31d96a1b7f | ||
|
|
3ee09bfe79 | ||
|
|
3d37684253 | ||
|
|
06a82b7725 | ||
|
|
1d6d639352 | ||
|
|
7cd1dc2817 | ||
|
|
57d1ae234c | ||
|
|
8608b5286a | ||
|
|
a5f76e690a | ||
|
|
a0081f9e29 | ||
|
|
4d2b442a33 | ||
|
|
0268807be2 | ||
|
|
f354a29683 | ||
|
|
e5b62bf074 | ||
|
|
e05d190e6a | ||
|
|
d7b43f8ea1 | ||
|
|
648d5aecf3 | ||
|
|
dc55492698 | ||
|
|
2b2927dedc | ||
|
|
500c52af62 | ||
|
|
c1deec3c16 | ||
|
|
fbbf184b1d | ||
|
|
e127c520a9 | ||
|
|
80195557c9 | ||
|
|
9e26485b04 | ||
|
|
5cf29df066 | ||
|
|
1bf36cf123 | ||
|
|
d060474f3a | ||
|
|
fae646da3b | ||
|
|
298515c368 | ||
|
|
2a14d9e5c9 | ||
|
|
549d01a4d6 | ||
|
|
aec0d35f9b | ||
|
|
b5c80d9476 | ||
|
|
17fa9378e9 | ||
|
|
6cde1d3b89 | ||
|
|
6d842e7dcb | ||
|
|
9d9fcbbdeb | ||
|
|
cd09bb0e9b | ||
|
|
bbc70d2b73 | ||
|
|
3eca2c7fee | ||
|
|
af0cb893b5 | ||
|
|
7027493196 | ||
|
|
bd4523798f | ||
|
|
6326eb4246 | ||
|
|
96411580c1 | ||
|
|
3f463786a5 | ||
|
|
43f092807b | ||
|
|
b8817ab188 | ||
|
|
ef7f679edf | ||
|
|
57010cc448 | ||
|
|
b6a4161cc5 | ||
|
|
a5908e9f27 | ||
|
|
72f9017b21 | ||
|
|
93f1d91083 | ||
|
|
ec0e931e9f | ||
|
|
a229cfd3c6 | ||
|
|
966b636e5d | ||
|
|
ee93f1b88c | ||
|
|
ffd21e98e7 | ||
|
|
a3db02832e | ||
|
|
1445775d64 | ||
|
|
feefaf00d7 | ||
|
|
25e69c71e7 | ||
|
|
9d5459221f | ||
|
|
341c1c1804 | ||
|
|
b218c40a5d | ||
|
|
09d6e8553b | ||
|
|
0502c134e8 | ||
|
|
e34ff61339 | ||
|
|
8684a59029 | ||
|
|
b297fabd17 | ||
|
|
b05e10cd8b | ||
|
|
92a5d845ae | ||
|
|
030407c52e | ||
|
|
cfc56dafeb | ||
|
|
b011f94250 | ||
|
|
66cdb077ad | ||
|
|
4a1573e007 | ||
|
|
0b4a34bbd6 | ||
|
|
d1e9b33cac | ||
|
|
abfc10afeb | ||
|
|
a18ef053a4 | ||
|
|
6abc9af472 | ||
|
|
e1cf08b3a6 | ||
|
|
28f3453466 | ||
|
|
9c45487763 | ||
|
|
01d2cb5d98 | ||
|
|
2664dfad9b | ||
|
|
e0c5debc57 | ||
|
|
e160223627 | ||
|
|
b00588e98c | ||
|
|
ac19c7c62e | ||
|
|
539eec85db | ||
|
|
b7951511a3 | ||
|
|
b65862e23b | ||
|
|
5f66b4e729 | ||
|
|
7319142fd8 | ||
|
|
365fc0d39d | ||
|
|
34d191be67 | ||
|
|
5c6d7760a5 | ||
|
|
3c7b9353e1 | ||
|
|
64a717ab33 | ||
|
|
bbff5b7735 | ||
|
|
2e06dbaffe | ||
|
|
19151bb1d2 | ||
|
|
f8343f25b8 | ||
|
|
67defd95af | ||
|
|
aa3355dc82 | ||
|
|
8c612adcdb | ||
|
|
711a2bcdd1 | ||
|
|
689b28455c | ||
|
|
4439f16155 | ||
|
|
ff7f642099 | ||
|
|
1456c72648 | ||
|
|
5d09a06100 |
@@ -1,17 +1,15 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
src/bun.js/WebKit/LayoutTests
|
||||
zig-out
|
||||
zig-build
|
||||
**/*.o
|
||||
**/*.a
|
||||
|
||||
examples
|
||||
|
||||
**/*.o
|
||||
**/.next
|
||||
.git
|
||||
src/bun.js/WebKit
|
||||
**/CMakeCache.txt
|
||||
**/node_modules
|
||||
.git
|
||||
examples
|
||||
node_modules
|
||||
packages/**/bun
|
||||
packages/**/bun-profile
|
||||
src/bun.js/WebKit
|
||||
src/bun.js/WebKit/LayoutTests
|
||||
zig-build
|
||||
zig-cache
|
||||
zig-out
|
||||
36
.gitattributes
vendored
36
.gitattributes
vendored
@@ -17,37 +17,31 @@
|
||||
*.mjs text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
|
||||
*.mts text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
|
||||
|
||||
*.lockb binary diff=lockb
|
||||
|
||||
.vscode/launch.json linguist-generated
|
||||
src/api/schema.d.ts linguist-generated
|
||||
fixture.*.c linguist-generated
|
||||
src/api/schema.js linguist-generated
|
||||
src/bun.js/bindings/sqlite/sqlite3.c linguist-vendored
|
||||
src/bun.js/bindings/sqlite/sqlite3_local.h linguist-vendored
|
||||
*.lockb binary diff=lockb
|
||||
src/bun.js/bindings/simdutf.cpp linguist-vendored
|
||||
src/bun.js/bindings/simdutf.h linguist-vendored
|
||||
|
||||
src/js/out/WebCoreJSBuiltins.cpp linguist-generated
|
||||
src/js/out/WebCoreJSBuiltins.h linguist-generated
|
||||
src/js/out/WebCoreJSBuiltins.d.ts linguist-generated
|
||||
|
||||
src/bun.js/bindings/ZigGeneratedClasses.h linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedClasses.cpp linguist-generated
|
||||
|
||||
*-fixture* linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedCode.h linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedCode.cpp linguist-generated
|
||||
|
||||
src/bun.js/bindings/headers.h linguist-generated
|
||||
src/bun.js/bindings/headers.zig linguist-generated
|
||||
|
||||
src/bun.js/bindings/JSSink.h linguist-generated
|
||||
src/bun.js/bindings/JSSink.zig linguist-generated
|
||||
packages/bun-uws/fuzzing/seed-corpus/**/* linguist-generated
|
||||
|
||||
src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h linguist-generated
|
||||
src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h linguist-generated
|
||||
src/bun.js/bindings/sqlite/sqlite3.c linguist-vendored
|
||||
src/bun.js/bindings/sqlite/sqlite3_local.h linguist-vendored
|
||||
src/bun.js/bindings/simdutf.cpp linguist-vendored
|
||||
src/bun.js/bindings/simdutf.h linguist-vendored
|
||||
|
||||
docs/**/* linguist-documentation
|
||||
|
||||
packages/bun-uws/fuzzing/seed-corpus/**/* linguist-generated
|
||||
# Don't count tests in the language stats - https://github.com/github-linguist/linguist/blob/master/docs/overrides.md
|
||||
test/**/* linguist-documentation
|
||||
bench/**/* linguist-documentation
|
||||
examples/**/* linguist-documentation
|
||||
|
||||
src/deps/*.c linguist-vendored
|
||||
src/deps/brotli/** linguist-vendored
|
||||
|
||||
45
.github/ISSUE_TEMPLATE/3-typescript-bug-report.yml
vendored
Normal file
45
.github/ISSUE_TEMPLATE/3-typescript-bug-report.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: 🇹 TypeScript Type Bug Report
|
||||
description: Report an issue with TypeScript types
|
||||
labels: [bug, typescript]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for submitting a bug report. It helps make Bun better.
|
||||
|
||||
If you need help or support using Bun, and are not reporting a bug, please
|
||||
join our [Discord](https://discord.gg/CXdq2DP29u) server, where you can ask questions in the [`#help`](https://discord.gg/32EtH6p7HN) forum.
|
||||
|
||||
Make sure you are running the [latest](https://bun.sh/docs/installation#upgrading) version of Bun.
|
||||
The bug you are experiencing may already have been fixed.
|
||||
|
||||
Please try to include as much information as possible.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: What version of Bun is running?
|
||||
description: Copy the output of `bun --revision`
|
||||
- type: input
|
||||
attributes:
|
||||
label: What platform is your computer?
|
||||
description: |
|
||||
For MacOS and Linux: copy the output of `uname -mprs`
|
||||
For Windows: copy the output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in the PowerShell console
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What steps can reproduce the bug?
|
||||
description: Explain the bug and provide a code snippet that can reproduce it.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What is the expected behavior?
|
||||
description: If possible, please provide text instead of a screenshot.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What do you see instead?
|
||||
description: If possible, please provide text instead of a screenshot.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: Is there anything else you think we should know?
|
||||
@@ -8,7 +8,7 @@ body:
|
||||
Thank you for submitting an idea. It helps make Bun better.
|
||||
|
||||
If you want to discuss Bun, or learn how others are using Bun, please
|
||||
join our [Discord](https://discord.gg/CXdq2DP29u) server, where you can share in the [`#feedback-ideas`](https://discord.gg/unwUnHBNqy) channel.
|
||||
join our [Discord](https://discord.gg/CXdq2DP29u) server, where you can share in the [`#feedback`](https://discord.gg/unwUnHBNqy) channel.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What is the problem this feature would solve?
|
||||
18
.github/pull_request_template.md
vendored
18
.github/pull_request_template.md
vendored
@@ -19,18 +19,17 @@ This adds a new flag --bail to bun test. When set, it will stop running tests af
|
||||
|
||||
<!-- If JavaScript/TypeScript modules or builtins changed:
|
||||
|
||||
- [ ] I ran `make js` and committed the transpiled changes
|
||||
- [ ] I or my editor ran Prettier on the changed files (or I ran `bun fmt`)
|
||||
- [ ] I included a test for the new code, or an existing test covers it
|
||||
- [ ] I included a test for the new code, or existing tests cover it
|
||||
- [ ] I ran my tests locally and they pass (`bun-debug test test-file-name.test`)
|
||||
|
||||
-->
|
||||
|
||||
<!-- If Zig files changed:
|
||||
|
||||
- [ ] I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be
|
||||
- [ ] I or my editor ran `zig fmt` on the changed files
|
||||
- [ ] I included a test for the new code, or an existing test covers it
|
||||
- [ ] JSValue used outside outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed
|
||||
- [ ] I wrote TypeScript/JavaScript tests and they pass locally (`bun-debug test test-file-name.test`)
|
||||
-->
|
||||
|
||||
<!-- If new methods, getters, or setters were added to a publicly exposed class:
|
||||
@@ -43,17 +42,6 @@ This adds a new flag --bail to bun test. When set, it will stop running tests af
|
||||
- [ ] I made sure that specific versions of dependencies are used instead of ranged or tagged versions
|
||||
-->
|
||||
|
||||
<!-- If functions were added to exports.zig or bindings.zig
|
||||
|
||||
- [ ] I ran `make headers` to regenerate the C header file
|
||||
|
||||
-->
|
||||
|
||||
<!-- If \*.classes.ts files were added or changed:
|
||||
|
||||
- [ ] I ran `make codegen` to regenerate the C++ and Zig code
|
||||
-->
|
||||
|
||||
<!-- If a new builtin ESM/CJS module was added:
|
||||
|
||||
- [ ] I updated Aliases in `module_loader.zig` to include the new module
|
||||
|
||||
50
.github/workflows/bun-ecosystem-test.yml
vendored
50
.github/workflows/bun-ecosystem-test.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: bun-ecosystem-test
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 15 * * *" # every day at 7am PST
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "The version of Bun to run"
|
||||
required: true
|
||||
default: "canary"
|
||||
type: string
|
||||
jobs:
|
||||
test:
|
||||
name: ${{ matrix.tag }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
tag: linux-x64
|
||||
url: linux/x64?avx2=true
|
||||
- os: ubuntu-latest
|
||||
tag: linux-x64-baseline
|
||||
url: linux/x64?baseline=true
|
||||
# FIXME: runner fails with "No tests found"?
|
||||
#- os: macos-latest
|
||||
# tag: darwin-x64
|
||||
# url: darwin/x64?avx2=true
|
||||
- os: macos-latest
|
||||
tag: darwin-x64-baseline
|
||||
url: darwin/x64?baseline=true
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: Bhacaz/checkout-files@v2
|
||||
with:
|
||||
files: packages/bun-internal-test
|
||||
- id: setup
|
||||
name: Setup
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-download-url: https://bun.sh/download/${{ github.event.inputs.version }}/${{ matrix.url }}
|
||||
- id: test
|
||||
name: Test
|
||||
working-directory: packages/bun-internal-test
|
||||
run: bun run test:ecosystem
|
||||
41
.github/workflows/bun-linux-aarch64.yml
vendored
41
.github/workflows/bun-linux-aarch64.yml
vendored
@@ -4,11 +4,6 @@ concurrency:
|
||||
group: bun-linux-aarch64-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TEST_TAG: bun-test'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -16,9 +11,26 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
- ".github/workflows/bun-linux-aarch64.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
- ".github/workflows/bun-linux-aarch64.yml"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -37,14 +49,15 @@ jobs:
|
||||
arch: aarch64
|
||||
build_arch: arm64
|
||||
runner: linux-arm64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-linux-arm64-lto.tar.gz"
|
||||
webkit_basename: "bun-webkit-linux-arm64-lto"
|
||||
build_machine_arch: aarch64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
submodules: false
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- run: |
|
||||
bash ./scripts/update-submodules.sh
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
@@ -72,9 +85,7 @@ jobs:
|
||||
BUILDARCH=${{matrix.build_arch}}
|
||||
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
|
||||
CPU_TARGET=${{matrix.cpu}}
|
||||
WEBKIT_URL=${{matrix.webkit_url}}
|
||||
GIT_SHA=${{github.sha}}
|
||||
WEBKIT_BASENAME=${{matrix.webkit_basename}}
|
||||
platforms: linux/${{matrix.build_arch}}
|
||||
target: artifact
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
@@ -110,14 +121,6 @@ jobs:
|
||||
with:
|
||||
name: bun-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bun-obj-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/bun-obj
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}-dependencies
|
||||
path: ${{runner.temp}}/release/bun-dependencies
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
|
||||
144
.github/workflows/bun-linux-build.yml
vendored
144
.github/workflows/bun-linux-build.yml
vendored
@@ -4,11 +4,6 @@ concurrency:
|
||||
group: bun-linux-build-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TEST_TAG: bun-test'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -16,6 +11,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -25,6 +23,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -47,22 +48,44 @@ jobs:
|
||||
arch: x86_64
|
||||
build_arch: amd64
|
||||
runner: big-ubuntu
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-linux-amd64-lto.tar.gz"
|
||||
webkit_basename: "bun-webkit-linux-amd64-lto"
|
||||
build_machine_arch: x86_64
|
||||
assertions: "OFF"
|
||||
zig_optimize: "ReleaseFast"
|
||||
target: "artifact"
|
||||
- cpu: nehalem
|
||||
tag: linux-x64-baseline
|
||||
arch: x86_64
|
||||
build_arch: amd64
|
||||
runner: big-ubuntu
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-linux-amd64-lto.tar.gz"
|
||||
webkit_basename: "bun-webkit-linux-amd64-lto"
|
||||
build_machine_arch: x86_64
|
||||
assertions: "OFF"
|
||||
zig_optimize: "ReleaseFast"
|
||||
target: "artifact"
|
||||
# - cpu: haswell
|
||||
# tag: linux-x64-assertions
|
||||
# arch: x86_64
|
||||
# build_arch: amd64
|
||||
# runner: big-ubuntu
|
||||
# build_machine_arch: x86_64
|
||||
# assertions: "ON"
|
||||
# zig_optimize: "ReleaseSafe"
|
||||
# target: "artifact-assertions"
|
||||
# - cpu: nehalem
|
||||
# tag: linux-x64-baseline-assertions
|
||||
# arch: x86_64
|
||||
# build_arch: amd64
|
||||
# runner: big-ubuntu
|
||||
# build_machine_arch: x86_64
|
||||
# assertions: "ON"
|
||||
# zig_optimize: "ReleaseSafe"
|
||||
# target: "artifact-assertions"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
@@ -90,12 +113,23 @@ jobs:
|
||||
BUILDARCH=${{matrix.build_arch}}
|
||||
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
|
||||
CPU_TARGET=${{matrix.cpu}}
|
||||
WEBKIT_URL=${{matrix.webkit_url}}
|
||||
GIT_SHA=${{github.sha}}
|
||||
WEBKIT_BASENAME=${{matrix.webkit_basename}}
|
||||
ASSERTIONS=${{matrix.assertions}}
|
||||
ZIG_OPTIMIZE=${{matrix.zig_optimize}}
|
||||
SCCACHE_BUCKET=bun
|
||||
SCCACHE_REGION=auto
|
||||
SCCACHE_S3_USE_SSL=true
|
||||
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
|
||||
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
|
||||
platforms: linux/${{matrix.build_arch}}
|
||||
target: artifact
|
||||
target: ${{matrix.target}}
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
${{runner.temp}}/release/bun-profile --version
|
||||
- name: Zip
|
||||
run: |
|
||||
# if zip is not found
|
||||
@@ -153,13 +187,33 @@ jobs:
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
linux-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [linux]
|
||||
if: github.event_name == 'pull_request'
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
pull-requests: write
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
@@ -169,27 +223,54 @@ jobs:
|
||||
include:
|
||||
- tag: linux-x64
|
||||
- tag: linux-x64-baseline
|
||||
# - tag: linux-x64-assertions
|
||||
# - tag: linux-x64-baseline-assertions
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
clean: true
|
||||
- id: download
|
||||
name: Download
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: bun-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install
|
||||
name: Install
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip bun-${{matrix.tag}}.zip
|
||||
cd bun-${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
./bun --version
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install-dependnecies
|
||||
name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y openssl
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
|
||||
bun install --cwd=test/js/third_party/prisma --verbose
|
||||
|
||||
# This is disabled because the cores are ~5.5gb each
|
||||
# so it is easy to hit 50gb coredump downloads. Only enable if you need to retrive one
|
||||
|
||||
# - name: Set core dumps to get stored in /cores
|
||||
# run: |
|
||||
# sudo mkdir /cores
|
||||
# sudo chmod 777 /cores
|
||||
# # Core filenames will be of the form executable.pid.timestamp:
|
||||
# sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern'
|
||||
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
@@ -198,11 +279,32 @@ jobs:
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y openssl
|
||||
bun install
|
||||
bun install --cwd test
|
||||
bun install --cwd packages/bun-internal-test
|
||||
ulimit -c unlimited
|
||||
ulimit -c
|
||||
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: steps.test.outputs.failing_tests != ''
|
||||
with:
|
||||
name: cores
|
||||
path: /cores
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
|
||||
489
.github/workflows/bun-mac-aarch64.yml
vendored
489
.github/workflows/bun-mac-aarch64.yml
vendored
@@ -5,9 +5,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TEST_TAG: bun-test'
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -15,6 +14,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -23,6 +25,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -30,79 +35,141 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
macos-object-files:
|
||||
name: macOS Object
|
||||
macOS-zig:
|
||||
name: macOS Zig Object
|
||||
runs-on: med-ubuntu
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-obj-darwin-x64-baseline
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-obj-darwin-x64
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-obj-darwin-aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
# - name: Checkout submodules
|
||||
# run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
- name: Run
|
||||
run: |
|
||||
rm -rf ${{runner.temp}}/release
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'X64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=amd64
|
||||
BUILD_MACHINE_ARCH=x86_64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/amd64
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'ARM64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
build-args: |
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=arm64
|
||||
BUILD_MACHINE_ARCH=aarch64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/arm64
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- uses: actions/upload-artifact@v3
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun.o
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install go sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-aarch64.zip"
|
||||
unzip bun-darwin-aarch64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-aarch64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -111,257 +178,152 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: true
|
||||
# compile_obj: false
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: true
|
||||
# compile_obj: false
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: false
|
||||
# compile_obj: true
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: false
|
||||
# compile_obj: true
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-arm64-lto.tar.gz"
|
||||
runner: macos-arm64
|
||||
dependencies: true
|
||||
compile_obj: true
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install go sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-aarch64.zip"
|
||||
unzip bun-darwin-aarch64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-aarch64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
- name: Download WebKit
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
- name: Compile dependencies
|
||||
if: matrix.dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
make vendor-without-check
|
||||
|
||||
- name: Compile C++
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR
|
||||
make clean-bindings
|
||||
make -j $(sysctl -n hw.ncpu) release-bindings
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
if: matrix.compile_obj
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Upload Dependencies
|
||||
if: matrix.dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
macOS:
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
macOS-link:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-cpp, macos-object-files]
|
||||
timeout-minutes: 90
|
||||
needs: [macOS-zig, macOS-cpp, macOS-dependencies]
|
||||
timeout-minutes: 60
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# package: bun-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# package: bun-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
package: bun-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-arm64-lto.tar.gz"
|
||||
runner: macos-arm64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
- name: Download WebKit
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-${{matrix.arch}}.zip"
|
||||
unzip bun-darwin-${{matrix.arch}}.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-${{matrix.arch}}/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Download Dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
- name: Download Object
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf packages/${{ matrix.package }}
|
||||
mkdir -p packages/${{ matrix.package }}
|
||||
mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/
|
||||
make bun-link-lld-release copy-to-bun-release-dir-bin
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir ${{matrix.tag}}-profile
|
||||
mkdir ${{matrix.tag}}
|
||||
|
||||
/usr/bin/strip -S bun
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
@@ -371,11 +333,11 @@ jobs:
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -392,12 +354,33 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS]
|
||||
needs: [macOS-link]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
@@ -407,7 +390,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-aarch64
|
||||
runner: macos-arm64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
@@ -420,15 +403,25 @@ jobs:
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install
|
||||
name: Install
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
./bun --version
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
@@ -437,10 +430,24 @@ jobs:
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
bun install
|
||||
bun install --cwd test
|
||||
bun install --cwd packages/bun-internal-test
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
|
||||
486
.github/workflows/bun-mac-x64-baseline.yml
vendored
486
.github/workflows/bun-mac-x64-baseline.yml
vendored
@@ -5,9 +5,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TEST_TAG: bun-test'
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -15,6 +14,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -23,6 +25,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -47,62 +52,129 @@ jobs:
|
||||
# arch: aarch64
|
||||
# tag: bun-obj-darwin-aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
- name: Run
|
||||
run: |
|
||||
rm -rf ${{runner.temp}}/release
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'X64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# This was used before, but also does not really work
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=amd64
|
||||
BUILD_MACHINE_ARCH=x86_64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/amd64
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
|
||||
SCCACHE_BUCKET=bun
|
||||
SCCACHE_REGION=auto
|
||||
SCCACHE_S3_USE_SSL=true
|
||||
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
|
||||
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'ARM64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
build-args: |
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=arm64
|
||||
BUILD_MACHINE_ARCH=aarch64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/arm64
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- uses: actions/upload-artifact@v3
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun.o
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -115,138 +187,68 @@ jobs:
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
dependencies: true
|
||||
compile_obj: false
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: true
|
||||
# compile_obj: false
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
runner: macos-12
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
dependencies: false
|
||||
compile_obj: true
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: false
|
||||
# compile_obj: true
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-darwin-aarch64
|
||||
# obj: bun-obj-darwin-aarch64
|
||||
# artifact: bun-obj-darwin-aarch64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# runner: macos-arm64
|
||||
# dependencies: true
|
||||
# compile_obj: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
- name: ccache (dependencies)
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
if: matrix.dependencies
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies
|
||||
- name: ccache (c++)
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
if: matrix.compile_obj
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj
|
||||
- name: Download WebKit
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
- name: Compile dependencies
|
||||
if: matrix.dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR
|
||||
make vendor-without-check
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
|
||||
- name: Compile C++
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR
|
||||
make -j $(sysctl -n hw.ncpu) release-bindings
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
if: matrix.compile_obj
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Upload Dependencies
|
||||
if: matrix.dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
macOS:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-cpp, macos-object-files]
|
||||
needs: [macOS-cpp, macos-object-files, macOS-dependencies]
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
@@ -257,115 +259,72 @@ jobs:
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
package: bun-darwin-x64
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64
|
||||
# obj: bun-obj-darwin-x64
|
||||
# package: bun-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-darwin-aarch64
|
||||
# obj: bun-obj-darwin-aarch64
|
||||
# package: bun-darwin-aarch64
|
||||
# artifact: bun-obj-darwin-aarch64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# runner: macos-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install ccache rust llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
- name: ccache (link)
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
- name: Download WebKit
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Download Dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
- name: Download Object
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf packages/${{ matrix.package }}
|
||||
mkdir -p packages/${{ matrix.package }}
|
||||
mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/
|
||||
make bun-link-lld-release copy-to-bun-release-dir-bin
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir ${{matrix.tag}}-profile
|
||||
mkdir ${{matrix.tag}}
|
||||
|
||||
/usr/bin/strip -S bun
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
@@ -375,11 +334,11 @@ jobs:
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -396,12 +355,34 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
name: macOS Test
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
# if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
if: false
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
@@ -411,7 +392,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-x64-baseline
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
@@ -424,15 +405,25 @@ jobs:
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install
|
||||
name: Install
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
./bun --version
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
@@ -441,10 +432,27 @@ jobs:
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
bun install
|
||||
bun install --cwd test
|
||||
bun install --cwd packages/bun-internal-test
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
Hey @${{ github.actor }},
|
||||
|
||||
${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
|
||||
488
.github/workflows/bun-mac-x64.yml
vendored
488
.github/workflows/bun-mac-x64.yml
vendored
@@ -5,9 +5,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TEST_TAG: bun-test'
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -15,6 +14,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -23,6 +25,9 @@ on:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
@@ -30,8 +35,8 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
macos-object-files:
|
||||
name: macOS Object
|
||||
macOS-zig:
|
||||
name: macOS Zig Object
|
||||
runs-on: med-ubuntu
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
@@ -43,66 +48,131 @@ jobs:
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-obj-darwin-x64
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-obj-darwin-aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
- name: Run
|
||||
run: |
|
||||
rm -rf ${{runner.temp}}/release
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'X64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# This was used before, but also does not really work
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=amd64
|
||||
BUILD_MACHINE_ARCH=x86_64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/amd64
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
|
||||
SCCACHE_BUCKET=bun
|
||||
SCCACHE_REGION=auto
|
||||
SCCACHE_S3_USE_SSL=true
|
||||
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
|
||||
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'ARM64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=min
|
||||
build-args: |
|
||||
ARCH=${{ matrix.arch }}
|
||||
BUILDARCH=arm64
|
||||
BUILD_MACHINE_ARCH=aarch64
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{matrix.arch}}-macos-none
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/arm64
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- uses: actions/upload-artifact@v3
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun.o
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -111,263 +181,148 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: true
|
||||
# compile_obj: false
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
dependencies: true
|
||||
compile_obj: false
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# dependencies: false
|
||||
# compile_obj: true
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
runner: macos-12
|
||||
artifact: bun-obj-darwin-x64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
dependencies: false
|
||||
compile_obj: true
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-darwin-aarch64
|
||||
# obj: bun-obj-darwin-aarch64
|
||||
# artifact: bun-obj-darwin-aarch64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-arm64-lto.tar.gz"
|
||||
# runner: macos-arm64
|
||||
# dependencies: true
|
||||
# compile_obj: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
- name: Download WebKit
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
- name: ccache (dependencies)
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64.zip"
|
||||
unzip bun-darwin-x64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
if: matrix.dependencies
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies
|
||||
- name: ccache (c++)
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
if: matrix.compile_obj
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-obj
|
||||
- name: Compile dependencies
|
||||
if: matrix.dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR
|
||||
make vendor-without-check
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
|
||||
- name: Compile C++
|
||||
if: matrix.compile_obj
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR $BUN_DEPS_OUT_DIR
|
||||
make -j $(sysctl -n hw.ncpu) release-bindings
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
if: matrix.compile_obj
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Upload Dependencies
|
||||
if: matrix.dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
macOS:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-cpp, macos-object-files]
|
||||
needs: [macOS-cpp, macOS-zig, macOS-dependencies]
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-darwin-x64-baseline
|
||||
# obj: bun-obj-darwin-x64-baseline
|
||||
# package: bun-darwin-x64
|
||||
# runner: macos-12
|
||||
# artifact: bun-obj-darwin-x64-baseline
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
package: bun-darwin-x64
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-amd64-lto.tar.gz"
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-darwin-aarch64
|
||||
# obj: bun-obj-darwin-aarch64
|
||||
# package: bun-darwin-aarch64
|
||||
# artifact: bun-obj-darwin-aarch64
|
||||
# webkit_url: "https://github.com/oven-sh/WebKit/releases/download/2023-sept15-1/bun-webkit-macos-arm64-lto.tar.gz"
|
||||
# runner: macos-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress -j $(sysctl -n hw.ncpu) --force
|
||||
- name: Install dependencies
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
brew install rust ccache llvm@16 pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config esbuild --force
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@16)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@16
|
||||
- name: Download WebKit
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf $JSC_BASE_DIR
|
||||
mkdir -p $JSC_BASE_DIR
|
||||
curl -L ${{ matrix.webkit_url }} | tar -xz -C $JSC_BASE_DIR --strip-components=1
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Download Dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
- name: Download Object
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
- name: ccache (link)
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-link
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
rm -rf packages/${{ matrix.package }}
|
||||
mkdir -p packages/${{ matrix.package }}
|
||||
mv ${{ runner.temp }}/release/* packages/${{ matrix.package }}/
|
||||
make bun-link-lld-release copy-to-bun-release-dir-bin
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
JSC_LIB: ${{ runner.temp }}/bun-webkit/lib
|
||||
BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
BUN_RELEASE_DIR: ${{ runner.temp }}/release
|
||||
WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit
|
||||
WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir ${{matrix.tag}}-profile
|
||||
mkdir ${{matrix.tag}}
|
||||
|
||||
/usr/bin/strip -S bun
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
@@ -377,11 +332,11 @@ jobs:
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}-profile.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/${{matrix.tag}}.zip
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -398,12 +353,33 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/${{matrix.tag}}.zip,${{runner.temp}}/release/${{matrix.tag}}-profile.zip"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
@@ -413,7 +389,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-x64
|
||||
runner: macos-12
|
||||
runner: macos-12-large
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
@@ -426,15 +402,25 @@ jobs:
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install
|
||||
name: Install
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
./bun --version
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
@@ -443,10 +429,24 @@ jobs:
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
bun install
|
||||
bun install --cwd test
|
||||
bun install --cwd packages/bun-internal-test
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
|
||||
179
.github/workflows/bun-release-canary.yml
vendored
179
.github/workflows/bun-release-canary.yml
vendored
@@ -1,179 +0,0 @@
|
||||
name: bun-release-canary
|
||||
concurrency: release-canary
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 14 * * *" # every day at 6am PST
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
sign:
|
||||
name: Sign Release
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-gpg
|
||||
name: Setup GPG
|
||||
uses: crazy-max/ghaction-import-gpg@v5
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Sign Release
|
||||
run: |
|
||||
echo "$GPG_PASSPHRASE" | bun upload-assets -- "canary"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
npm:
|
||||
name: Release to NPM
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Release
|
||||
run: bun upload-npm -- canary publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
# npm-types:
|
||||
# name: Release types to NPM
|
||||
# runs-on: ubuntu-latest
|
||||
# defaults:
|
||||
# run:
|
||||
# working-directory: packages/bun-types
|
||||
# steps:
|
||||
# - id: checkout
|
||||
# name: Checkout
|
||||
# uses: actions/checkout@v3
|
||||
# - id: setup-node
|
||||
# name: Setup Node.js
|
||||
# uses: actions/setup-node@v3
|
||||
# with:
|
||||
# node-version: latest
|
||||
# - id: setup-bun
|
||||
# name: Setup Bun
|
||||
# uses: oven-sh/setup-bun@v1
|
||||
# with:
|
||||
# bun-version: canary
|
||||
# - id: bun-install
|
||||
# name: Install Dependencies
|
||||
# run: bun install
|
||||
# - id: setup-env
|
||||
# name: Setup Environment
|
||||
# run: |
|
||||
# SHA=$(git rev-parse --short "$GITHUB_SHA")
|
||||
# VERSION=$(bun --version)
|
||||
# TAG="${VERSION}-canary.$(date '+%Y%m%d').1+${SHA}"
|
||||
# echo "Setup tag: ${TAG}"
|
||||
# echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
# - id: bun-run
|
||||
# name: Build
|
||||
# run: bun run build
|
||||
# env:
|
||||
# BUN_VERSION: ${{ env.TAG }}
|
||||
# - id: npm-publish
|
||||
# name: Release
|
||||
# uses: JS-DevTools/npm-publish@v1
|
||||
# with:
|
||||
# package: packages/bun-types/dist/package.json
|
||||
# token: ${{ secrets.NPM_TOKEN }}
|
||||
# tag: canary
|
||||
docker:
|
||||
name: Release to Dockerhub
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: qemu
|
||||
name: Setup Docker QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- id: buildx
|
||||
name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- id: metadata
|
||||
name: Setup Docker metadata
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: oven/bun
|
||||
tags: canary
|
||||
- id: login
|
||||
name: Login to Docker
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- id: push
|
||||
name: Push to Docker
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./dockerhub
|
||||
file: ./dockerhub/Dockerfile-debian
|
||||
platforms: linux/amd64,linux/arm64
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
push: true
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
build-args: |
|
||||
BUN_VERSION=canary
|
||||
s3:
|
||||
name: Upload to S3
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Release
|
||||
run: bun upload-s3 -- canary
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
|
||||
AWS_BUCKET: bun
|
||||
54
.github/workflows/bun-release-types-canary.yml
vendored
54
.github/workflows/bun-release-types-canary.yml
vendored
@@ -1,54 +0,0 @@
|
||||
name: bun-release-types-canary
|
||||
concurrency: release-canary
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "packages/bun-types/**"
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
npm-types:
|
||||
name: Release types to NPM
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-types
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-node
|
||||
name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
run: bun install
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
SHA=$(git rev-parse --short "$GITHUB_SHA")
|
||||
VERSION=$(bun --version)
|
||||
TAG="${VERSION}-canary.$(date +'%Y%m%dT%H%M%S')"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: bun-run
|
||||
name: Build
|
||||
run: bun run build
|
||||
env:
|
||||
BUN_VERSION: ${{ env.TAG }}
|
||||
- id: npm-publish
|
||||
name: Release
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
package: packages/bun-types/dist/package.json
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
tag: canary
|
||||
258
.github/workflows/bun-release.yml
vendored
258
.github/workflows/bun-release.yml
vendored
@@ -1,87 +1,95 @@
|
||||
name: bun-release
|
||||
concurrency: release
|
||||
env:
|
||||
BUN_VERSION: ${{ github.event.inputs.tag || github.event.release.tag_name || 'canary' }}
|
||||
BUN_LATEST: ${{ (github.event.inputs.is-latest || github.event.release.tag_name) && 'true' || 'false' }}
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
schedule:
|
||||
- cron: "0 14 * * *" # every day at 6am PST
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
is-latest:
|
||||
description: Is this the latest release?
|
||||
type: boolean
|
||||
default: false
|
||||
tag:
|
||||
type: string
|
||||
description: The tag to publish
|
||||
description: What is the release tag? (e.g. "1.0.2", "canary")
|
||||
required: true
|
||||
use-docker:
|
||||
description: Should Docker images be released?
|
||||
type: boolean
|
||||
default: false
|
||||
use-npm:
|
||||
description: Should npm packages be published?
|
||||
type: boolean
|
||||
default: false
|
||||
use-homebrew:
|
||||
description: Should binaries be released to Homebrew?
|
||||
type: boolean
|
||||
default: false
|
||||
use-s3:
|
||||
description: Should binaries be uploaded to S3?
|
||||
type: boolean
|
||||
default: false
|
||||
use-types:
|
||||
description: Should types be released to npm?
|
||||
type: boolean
|
||||
default: false
|
||||
jobs:
|
||||
sign:
|
||||
name: Sign Release
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
if: ${{ github.repository_owner == 'oven-sh' }}
|
||||
permissions:
|
||||
contents: write
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: setup-gpg
|
||||
name: Setup GPG
|
||||
- name: Setup GPG
|
||||
uses: crazy-max/ghaction-import-gpg@v5
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Sign Release
|
||||
- name: Sign Release
|
||||
run: |
|
||||
echo "$GPG_PASSPHRASE" | bun upload-assets -- "${{ env.TAG }}"
|
||||
echo "$GPG_PASSPHRASE" | bun upload-assets -- "${{ env.BUN_VERSION }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
npm:
|
||||
name: Release to NPM
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.use-npm == 'true' }}
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Release
|
||||
run: bun upload-npm -- "${{ env.TAG }}" publish
|
||||
- name: Release
|
||||
run: bun upload-npm -- "${{ env.BUN_VERSION }}" publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -89,63 +97,81 @@ jobs:
|
||||
name: Release types to NPM
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.use-types == 'true' }}
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-types
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: setup-node
|
||||
name: Setup Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
- name: Setup Bun
|
||||
if: ${{ env.BUN_VERSION != 'canary' }}
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
bun-version: "1.0.21"
|
||||
- name: Setup Bun
|
||||
if: ${{ env.BUN_VERSION == 'canary' }}
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: "canary" # Must be 'canary' so tag is correct
|
||||
- name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Build
|
||||
- name: Setup Tag
|
||||
if: ${{ env.BUN_VERSION == 'canary' }}
|
||||
run: |
|
||||
VERSION=$(bun --version)
|
||||
TAG="${VERSION}-canary.$(date +'%Y%m%dT%H%M%S')"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- name: Build
|
||||
run: bun run build
|
||||
env:
|
||||
BUN_VERSION: ${{ env.TAG }}
|
||||
- id: npm-publish
|
||||
name: Release
|
||||
BUN_VERSION: ${{ env.TAG || env.BUN_VERSION }}
|
||||
- name: Release (canary)
|
||||
if: ${{ env.BUN_VERSION == 'canary' }}
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
package: packages/bun-types/dist/package.json
|
||||
package: packages/bun-types/package.json
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
tag: canary
|
||||
- name: Release (latest)
|
||||
if: ${{ env.BUN_LATEST == 'true' }}
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
package: packages/bun-types/package.json
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
docker:
|
||||
name: Release to Dockerhub
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.use-docker == 'true' }}
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- variant: debian
|
||||
suffix: ""
|
||||
- variant: debian
|
||||
suffix: -debian
|
||||
- variant: slim
|
||||
suffix: -slim
|
||||
dir: debian-slim
|
||||
- variant: alpine
|
||||
suffix: -alpine
|
||||
- variant: distroless
|
||||
suffix: -distroless
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: environment
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: qemu
|
||||
name: Setup Docker QEMU
|
||||
- name: Setup Docker emulator
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- id: buildx
|
||||
name: Setup Docker buildx
|
||||
@@ -157,102 +183,84 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: oven/bun
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=match,pattern=(bun-v)?(\d+.\d+.\d+),group=2,value=${{ env.TAG }}
|
||||
type=match,pattern=(bun-v)?(\d+.\d+),group=2,value=${{ env.TAG }}
|
||||
- id: login
|
||||
name: Login to Docker
|
||||
type=raw,value=latest,enable=${{ env.BUN_LATEST == 'true' && matrix.suffix == '' }}
|
||||
type=raw,value=${{ matrix.variant }},enable=${{ env.BUN_LATEST == 'true' }}
|
||||
type=match,pattern=(bun-v)?(canary|\d+.\d+.\d+),group=2,value=${{ env.BUN_VERSION }},suffix=${{ matrix.suffix }}
|
||||
type=match,pattern=(bun-v)?(canary|\d+.\d+),group=2,value=${{ env.BUN_VERSION }},suffix=${{ matrix.suffix }}
|
||||
type=match,pattern=(bun-v)?(canary|\d+),group=2,value=${{ env.BUN_VERSION }},suffix=${{ matrix.suffix }}
|
||||
- name: Login to Docker
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- id: push
|
||||
name: Push to Docker
|
||||
- name: Push to Docker
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./dockerhub
|
||||
file: ./dockerhub/Dockerfile-debian
|
||||
context: ./dockerhub/${{ matrix.dir || matrix.variant }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
push: true
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
build-args: |
|
||||
BUN_VERSION=${{ env.TAG }}
|
||||
BUN_VERSION=${{ env.BUN_VERSION }}
|
||||
homebrew:
|
||||
name: Release to Homebrew
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.event_name == 'release' || github.event.inputs.use-homebrew == 'true' }}
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: oven-sh/homebrew-bun
|
||||
token: ${{ secrets.ROBOBUN_TOKEN }}
|
||||
- id: setup-gpg
|
||||
- id: gpg
|
||||
name: Setup GPG
|
||||
uses: crazy-max/ghaction-import-gpg@v5
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: setup-ruby
|
||||
name: Setup Ruby
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "2.6"
|
||||
- id: update-tap
|
||||
name: Update Tap
|
||||
run: ruby scripts/release.rb "${{ env.TAG }}"
|
||||
- id: commit-tap
|
||||
name: Commit Tap
|
||||
- name: Update Tap
|
||||
run: ruby scripts/release.rb "${{ env.BUN_VERSION }}"
|
||||
- name: Commit Tap
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_options: --gpg-sign=${{ steps.setup-gpg.outputs.keyid }}
|
||||
commit_message: Release ${{ env.TAG }}
|
||||
commit_options: --gpg-sign=${{ steps.gpg.outputs.keyid }}
|
||||
commit_message: Release ${{ env.BUN_VERSION }}
|
||||
commit_user_name: robobun
|
||||
commit_user_email: robobun@oven.sh
|
||||
commit_author: robobun <robobun@oven.sh>
|
||||
s3:
|
||||
name: Upload to S3
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
needs: sign
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.use-s3 == 'true' }}
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-release
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- id: setup-env
|
||||
name: Setup Environment
|
||||
run: |
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
||||
echo "Setup tag: ${TAG}"
|
||||
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
||||
- id: setup-bun
|
||||
name: Setup Bun
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
- id: bun-install
|
||||
name: Install Dependencies
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
run: bun install
|
||||
- id: bun-run
|
||||
name: Release
|
||||
run: bun upload-s3 -- "${{ env.TAG }}"
|
||||
- name: Release
|
||||
run: bun upload-s3 -- "${{ env.BUN_VERSION }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
|
||||
492
.github/workflows/bun-windows.yml
vendored
Normal file
492
.github/workflows/bun-windows.yml
vendored
Normal file
@@ -0,0 +1,492 @@
|
||||
name: bun-windows
|
||||
|
||||
concurrency:
|
||||
group: bun-windows-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# note: in other files, this version is only the major version, but for windows it is the full version
|
||||
LLVM_VERSION: 16.0.6
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
tag: bun-windows
|
||||
# TODO: wire this up to workflow_dispatch.
|
||||
# github's expression syntax makes this hard to set a default to true
|
||||
canary: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
# inputs:
|
||||
# is-canary:
|
||||
# type: boolean
|
||||
# description: Is Canary Build?
|
||||
# default: true
|
||||
|
||||
jobs:
|
||||
windows-zig:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
name: Zig Build
|
||||
runs-on: med-ubuntu
|
||||
timeout-minutes: 60
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Calculate Canary Revision
|
||||
if: ${{ env.canary == 'true' }}
|
||||
id: canary
|
||||
run: |
|
||||
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v3
|
||||
if: runner.arch == 'X64'
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{ matrix.arch }}-windows-msvc
|
||||
GIT_SHA=${{ github.sha }}
|
||||
CANARY=${{ env.canary == 'true' && steps.canary.outputs.canary_revision || '0' }}
|
||||
ZIG_OPTIMIZE=ReleaseSafe
|
||||
# TODO(@paperdave): enable ASSERTIONS=1
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-zig${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
|
||||
windows-dependencies:
|
||||
name: Dependencies
|
||||
runs-on: windows
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Clone Submodules
|
||||
run: .\scripts\update-submodules.ps1
|
||||
- name: Hash submodule versions
|
||||
shell: pwsh
|
||||
run: |
|
||||
$data = "$(& {
|
||||
git submodule | Where-Object { $_ -notmatch 'WebKit' }
|
||||
clang --version
|
||||
rustc --version
|
||||
Get-Content -Path (Get-ChildItem -Path 'scripts/build*.ps1', 'scripts/all-dependencies.ps1', 'scripts/env.ps1' | Sort-Object -Property Name).FullName | Out-String
|
||||
echo 1
|
||||
})"
|
||||
$hash = ( -join ((New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($data)) | ForEach-Object { $_.ToString("x2") } )).Substring(0, 10)
|
||||
echo "sha=${hash}" >> $env:GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Try fetch dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: bun-deps
|
||||
key: bun-deps-${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Install LLVM ${{ env.LLVM_VERSION }}
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
|
||||
- name: Install Ninja
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
run: choco install -y ninja
|
||||
|
||||
- name: Build Dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
run: |
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip" -OutFile nasm.zip
|
||||
Expand-Archive nasm.zip (mkdir -Force "nasm")
|
||||
$Nasm = (Get-ChildItem "nasm")
|
||||
$env:Path += ";${Nasm}"
|
||||
$env:BUN_DEPS_OUT_DIR = (mkdir -Force "./bun-deps")
|
||||
.\scripts\all-dependencies.ps1
|
||||
|
||||
- name: Upload Dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-deps${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-deps/
|
||||
|
||||
- name: Cache Dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
windows-codegen:
|
||||
name: Codegen
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
curl -fsSL $BUN_DOWNLOAD_URL_BASE/bun-linux-x64.zip > bun.zip
|
||||
unzip bun.zip
|
||||
export PATH="$PWD/bun-linux-x64:$PATH"
|
||||
./scripts/cross-compile-codegen.sh win32 x64
|
||||
# Sort of a hack to do this step in the codegen stage
|
||||
- name: Calculate Canary Revision
|
||||
if: ${{ env.canary == 'true' }}
|
||||
run: |
|
||||
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" > build-codegen-win32-x64/.canary_revision
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build-codegen-win32-x64/
|
||||
|
||||
windows-cpp:
|
||||
name: C++ Build
|
||||
needs: [windows-codegen]
|
||||
runs-on: windows
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- run: choco install -y ninja
|
||||
- name: Download Codegen
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build
|
||||
- name: Build C++
|
||||
run: |
|
||||
# Using SCCache was blocked by an issue that is fixed in a newer version.
|
||||
# TODO UPDATE
|
||||
# $sczip = "sccache-v0.6.0-x86_64-pc-windows-msvc"
|
||||
|
||||
# Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/v0.6.0/${sczip}.zip" -OutFile "${sczip}.zip"
|
||||
# Expand-Archive "${sczip}.zip"
|
||||
# $env:SCCACHE_BUCKET="bun"
|
||||
# $env:SCCACHE_REGION="auto"
|
||||
# $env:SCCACHE_S3_USE_SSL="true"
|
||||
# $env:SCCACHE_ENDPOINT="${{ secrets.CACHE_S3_ENDPOINT }}"
|
||||
# $env:AWS_ACCESS_KEY_ID="${{ secrets.CACHE_S3_ACCESS_KEY_ID }}"
|
||||
# $env:AWS_SECRET_ACCESS_KEY="${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}"
|
||||
# $SCCACHE="$PWD/${sczip}/${sczip}/sccache.exe"
|
||||
|
||||
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\build-libuv.ps1 -CloneOnly $True
|
||||
cd build
|
||||
# "-DCCACHE_PROGRAM=${SCCACHE}"
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_CPP_ONLY=1 ${{ matrix.cpu == 'nehalem' && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
.\compile-cpp-only.ps1 -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "C++ compilation failed" }
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-cpp${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: build/bun-cpp-objects.a
|
||||
|
||||
windows-link:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
name: Link
|
||||
needs: [windows-dependencies, windows-codegen, windows-cpp, windows-zig]
|
||||
runs-on: windows-small
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 30
|
||||
permissions: write-all
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- run: choco install -y ninja
|
||||
- name: Download Codegen
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build
|
||||
- name: Download Dependencies
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-deps${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-deps
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-zig${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-zig
|
||||
- name: Download C++ Objects
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-cpp${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-cpp
|
||||
- name: Link
|
||||
run: |
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
Set-Location build
|
||||
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_LINK_ONLY=1 `
|
||||
"-DBUN_DEPS_OUT_DIR=$(Resolve-Path ../bun-deps)" `
|
||||
"-DBUN_CPP_ARCHIVE=$(Resolve-Path ../bun-cpp/bun-cpp-objects.a)" `
|
||||
"-DBUN_ZIG_OBJ=$(Resolve-Path ../bun-zig/bun-zig.o)" `
|
||||
${{ matrix.cpu == 'nehalem' && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
ninja -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "Link failed!" }
|
||||
- name: Package
|
||||
run: |
|
||||
$Dist = mkdir -Force "${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
Compress-Archive "$Dist" "${Dist}.zip"
|
||||
$Dist = "$Dist-profile"
|
||||
MkDir -Force "$Dist"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
cp -r build\bun.pdb "$Dist\bun.pdb"
|
||||
Compress-Archive "$Dist" "$Dist.zip"
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}.zip
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
path: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}.zip,${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
**[Build Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** | [Commit](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
windows-test:
|
||||
name: Test
|
||||
runs-on: windows-small
|
||||
needs: [windows-link]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 180
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# TODO: test baseline, disabled due to noise
|
||||
cpu: [haswell]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: false
|
||||
- id: download
|
||||
name: Download Release
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
path: ${{runner.temp}}/release
|
||||
- name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip
|
||||
cd ${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
pwd >> $env:GITHUB_PATH
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# bun install --verbose
|
||||
# bun install --cwd=test --verbose
|
||||
# bun install --cwd=packages/bun-internal-test --verbose
|
||||
|
||||
npm install
|
||||
cd test && npm install
|
||||
cd ../packages/bun-internal-test && npm install
|
||||
cd ../..
|
||||
- id: test
|
||||
name: Run tests
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
run: |
|
||||
try {
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
$null = node packages/bun-internal-test/src/runner.node.mjs ${{runner.temp}}/release/${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile/bun.exe || $true
|
||||
} catch {}
|
||||
$ErrorActionPreference = "Stop"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK_WINTEST }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### ❌🪟 [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are **${{ steps.test.outputs.failing_test_count }} failing tests** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### ❌🪟 [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are **${{ steps.test.outputs.regressing_test_count }} test regressions** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.regressing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- name: Comment on PR
|
||||
if: always() && steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-windows-${{ matrix.arch }}-${{ matrix.cpu }}
|
||||
message: |
|
||||
### ❌🪟 @${{ github.actor }}, there are **${{ steps.test.outputs.regressing_test_count }} test regressions** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.regressing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.regressing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-windows-${{ matrix.arch }}-${{ matrix.cpu }}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅🪟 Test regressions on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }} have been resolved.
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
run: exit 1
|
||||
45
.github/workflows/format.yml
vendored
Normal file
45
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: autofix.ci # Must be named this for autofix.ci to work
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
ZIG_VERSION: 0.12.0-dev.1828+225fe6ddb
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
src
|
||||
packages
|
||||
test
|
||||
bench
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: "1.0.21"
|
||||
- name: Setup Zig
|
||||
uses: goto-bus-stop/setup-zig@c7b6cdd3adba8f8b96984640ff172c37c93f73ee
|
||||
with:
|
||||
version: ${{ env.ZIG_VERSION }}
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Format
|
||||
run: |
|
||||
bun fmt
|
||||
bun fmt:zig
|
||||
- name: Commit # https://autofix.ci/
|
||||
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
|
||||
76
.github/workflows/prettier-fmt.yml
vendored
76
.github/workflows/prettier-fmt.yml
vendored
@@ -1,76 +0,0 @@
|
||||
name: prettier
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- jarred/test-actions
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prettier-fmt:
|
||||
name: prettier
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
prettier_fmt_errs: ${{ steps.fmt.outputs.prettier_fmt_errs }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- id: setup
|
||||
name: Setup
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: latest
|
||||
- id: install
|
||||
name: Install prettier
|
||||
run: bun install
|
||||
- name: Run prettier
|
||||
id: fmt
|
||||
run: |
|
||||
rm -f .failed
|
||||
bun prettier --check "./bench/**/*.{ts,tsx,js,jsx,mjs}" "./test/**/*.{ts,tsx,js,jsx,mjs}" "./src/**/*.{ts,tsx,js,jsx}" --config .prettierrc.cjs 2> prettier-fmt.err > prettier-fmt1.err || echo 'failed' > .failed
|
||||
|
||||
if [ -s .failed ]; then
|
||||
delimiter="$(openssl rand -hex 8)"
|
||||
echo "prettier_fmt_errs<<${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||
cat prettier-fmt.err >> "${GITHUB_OUTPUT}"
|
||||
cat prettier-fmt1.err >> "${GITHUB_OUTPUT}"
|
||||
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
- name: Comment on PR
|
||||
if: steps.fmt.outputs.prettier_fmt_errs != ''
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: prettier-fmt
|
||||
message: |
|
||||
❌ @${{ github.actor }} `prettier` reported errors
|
||||
|
||||
```js
|
||||
${{ steps.fmt.outputs.prettier_fmt_errs }}
|
||||
```
|
||||
|
||||
To one-off fix this manually, run:
|
||||
```sh
|
||||
bun fmt
|
||||
```
|
||||
|
||||
You might need to run `bun install` locally and configure your text editor to [auto-format on save](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Uncomment on PR
|
||||
if: steps.fmt.outputs.prettier_fmt_errs == ''
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: prettier-fmt
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ `prettier` errors have been resolved. Thank you.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Fail the job
|
||||
if: steps.fmt.outputs.prettier_fmt_errs != ''
|
||||
run: exit 1
|
||||
87
.github/workflows/zig-fmt.yml
vendored
87
.github/workflows/zig-fmt.yml
vendored
@@ -1,87 +0,0 @@
|
||||
name: zig-fmt
|
||||
|
||||
env:
|
||||
ZIG_VERSION: 0.12.0-dev.163+6780a6bbf
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- jarred/test-actions
|
||||
paths:
|
||||
- "src/**/*.zig"
|
||||
- "src/*.zig"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
zig-fmt:
|
||||
name: zig fmt
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
zig_fmt_errs: ${{ steps.fmt.outputs.zig_fmt_errs }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install zig
|
||||
run: |
|
||||
curl https://ziglang.org/builds/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz -L -o zig.tar.xz
|
||||
tar -xf zig.tar.xz
|
||||
echo "$(pwd)/zig-linux-x86_64-${{env.ZIG_VERSION}}" >> $GITHUB_PATH
|
||||
- name: Run zig fmt
|
||||
id: fmt
|
||||
run: |
|
||||
zig fmt --check src/*.zig src/**/*.zig 2> zig-fmt.err > zig-fmt.err2 || echo "Failed"
|
||||
delimiter="$(openssl rand -hex 8)"
|
||||
echo "zig_fmt_errs<<${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
if [ -s zig-fmt.err ]; then
|
||||
echo "// The following errors occurred:" >> "${GITHUB_OUTPUT}"
|
||||
cat zig-fmt.err >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
if [ -s zig-fmt.err2 ]; then
|
||||
echo "// The following files were not formatted:" >> "${GITHUB_OUTPUT}"
|
||||
cat zig-fmt.err2 >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||
- name: Comment on PR
|
||||
if: steps.fmt.outputs.zig_fmt_errs != ''
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: zig-fmt
|
||||
message: |
|
||||
❌ @${{ github.actor }} `zig fmt` reported errors. Consider configuring your text editor to [auto-format on save](https://github.com/ziglang/vscode-zig)
|
||||
|
||||
```zig
|
||||
// # zig fmt --check src/*.zig src/**/*.zig
|
||||
${{ steps.fmt.outputs.zig_fmt_errs }}
|
||||
```
|
||||
|
||||
To one-off fix this manually, run:
|
||||
|
||||
```sh
|
||||
zig fmt src/*.zig src/**/*.zig
|
||||
```
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
<sup>zig v${{env.ZIG_VERSION}}</sup>
|
||||
|
||||
- name: Uncomment on PR
|
||||
if: steps.fmt.outputs.zig_fmt_errs == ''
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: zig-fmt
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ `zig fmt` errors have been resolved. Thank you.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
<sup>zig v${{env.ZIG_VERSION}}</sup>
|
||||
|
||||
- name: Fail the job
|
||||
if: steps.fmt.outputs.zig_fmt_errs != ''
|
||||
run: exit 1
|
||||
302
.gitignore
vendored
302
.gitignore
vendored
@@ -1,135 +1,167 @@
|
||||
.DS_Store
|
||||
zig-cache
|
||||
packages/*/*.wasm
|
||||
*.o
|
||||
*.a
|
||||
profile.json
|
||||
|
||||
node_modules
|
||||
.swcrc
|
||||
yarn.lock
|
||||
dist
|
||||
*.tmp
|
||||
*.log
|
||||
*.out.js
|
||||
*.out.refresh.js
|
||||
**/package-lock.json
|
||||
build
|
||||
*.wat
|
||||
zig-out
|
||||
pnpm-lock.yaml
|
||||
README.md.template
|
||||
src/deps/zig-clap/example
|
||||
src/deps/zig-clap/README.md
|
||||
src/deps/zig-clap/.github
|
||||
src/deps/zig-clap/.gitattributes
|
||||
out
|
||||
outdir
|
||||
|
||||
.trace
|
||||
cover
|
||||
coverage
|
||||
coverv
|
||||
*.trace
|
||||
github
|
||||
out.*
|
||||
out
|
||||
.parcel-cache
|
||||
esbuilddir
|
||||
*.bun
|
||||
parceldist
|
||||
esbuilddir
|
||||
outdir/
|
||||
outcss
|
||||
.next
|
||||
txt.js
|
||||
.idea
|
||||
.vscode/cpp*
|
||||
.vscode/clang*
|
||||
|
||||
node_modules_*
|
||||
*.jsb
|
||||
*.zip
|
||||
bun-zigld
|
||||
bun-singlehtreaded
|
||||
bun-nomimalloc
|
||||
bun-mimalloc
|
||||
examples/lotta-modules/bun-yday
|
||||
examples/lotta-modules/bun-old
|
||||
examples/lotta-modules/bun-nofscache
|
||||
|
||||
src/node-fallbacks/out/*
|
||||
src/node-fallbacks/node_modules
|
||||
sign.json
|
||||
release/
|
||||
*.dmg
|
||||
sign.*.json
|
||||
packages/debug-*
|
||||
packages/bun-cli/postinstall.js
|
||||
packages/bun-*/bun
|
||||
packages/bun-*/bun-profile
|
||||
packages/bun-*/debug-bun
|
||||
packages/bun-*/*.o
|
||||
packages/bun-cli/postinstall.js
|
||||
|
||||
packages/bun-cli/bin/*
|
||||
bun-test-scratch
|
||||
misctools/fetch
|
||||
|
||||
src/deps/libiconv
|
||||
src/deps/openssl
|
||||
src/tests.zig
|
||||
*.blob
|
||||
src/deps/s2n-tls
|
||||
.npm
|
||||
.npm.gz
|
||||
|
||||
bun-binary
|
||||
|
||||
src/deps/PLCrashReporter/
|
||||
|
||||
*.dSYM
|
||||
*.crash
|
||||
misctools/sha
|
||||
packages/bun-wasm/*.mjs
|
||||
packages/bun-wasm/*.cjs
|
||||
packages/bun-wasm/*.map
|
||||
packages/bun-wasm/*.js
|
||||
packages/bun-wasm/*.d.ts
|
||||
packages/bun-wasm/*.d.cts
|
||||
packages/bun-wasm/*.d.mts
|
||||
*.bc
|
||||
|
||||
src/fallback.version
|
||||
src/runtime.version
|
||||
*.sqlite
|
||||
*.database
|
||||
*.db
|
||||
misctools/machbench
|
||||
*.big
|
||||
.eslintcache
|
||||
|
||||
bun-webkit
|
||||
|
||||
src/deps/c-ares/build
|
||||
src/bun.js/bindings-obj
|
||||
src/bun.js/debug-bindings-obj
|
||||
|
||||
failing-tests.txt
|
||||
test.txt
|
||||
myscript.sh
|
||||
|
||||
cold-jsc-start
|
||||
cold-jsc-start.d
|
||||
|
||||
/test.ts
|
||||
|
||||
src/js/out/modules*
|
||||
src/js/out/functions*
|
||||
src/js/out/tmp
|
||||
src/js/out/DebugPath.h
|
||||
|
||||
make-dev-stats.csv
|
||||
|
||||
.uuid
|
||||
tsconfig.tsbuildinfo
|
||||
.DS_Store
|
||||
zig-cache
|
||||
packages/*/*.wasm
|
||||
*.o
|
||||
*.a
|
||||
profile.json
|
||||
|
||||
node_modules
|
||||
.envrc
|
||||
.swcrc
|
||||
yarn.lock
|
||||
dist
|
||||
*.tmp
|
||||
*.log
|
||||
*.out.js
|
||||
*.out.refresh.js
|
||||
**/package-lock.json
|
||||
build
|
||||
*.wat
|
||||
zig-out
|
||||
pnpm-lock.yaml
|
||||
README.md.template
|
||||
src/deps/zig-clap/example
|
||||
src/deps/zig-clap/README.md
|
||||
src/deps/zig-clap/.github
|
||||
src/deps/zig-clap/.gitattributes
|
||||
out
|
||||
outdir
|
||||
|
||||
.trace
|
||||
cover
|
||||
coverage
|
||||
coverv
|
||||
*.trace
|
||||
github
|
||||
out.*
|
||||
out
|
||||
.parcel-cache
|
||||
esbuilddir
|
||||
*.bun
|
||||
parceldist
|
||||
esbuilddir
|
||||
outdir/
|
||||
outcss
|
||||
.next
|
||||
txt.js
|
||||
.idea
|
||||
.vscode/cpp*
|
||||
.vscode/clang*
|
||||
|
||||
node_modules_*
|
||||
*.jsb
|
||||
*.zip
|
||||
bun-zigld
|
||||
bun-singlehtreaded
|
||||
bun-nomimalloc
|
||||
bun-mimalloc
|
||||
examples/lotta-modules/bun-yday
|
||||
examples/lotta-modules/bun-old
|
||||
examples/lotta-modules/bun-nofscache
|
||||
|
||||
src/node-fallbacks/out/*
|
||||
src/node-fallbacks/node_modules
|
||||
sign.json
|
||||
release/
|
||||
*.dmg
|
||||
sign.*.json
|
||||
packages/debug-*
|
||||
packages/bun-cli/postinstall.js
|
||||
packages/bun-*/bun
|
||||
packages/bun-*/bun-profile
|
||||
packages/bun-*/debug-bun
|
||||
packages/bun-*/*.o
|
||||
packages/bun-cli/postinstall.js
|
||||
|
||||
packages/bun-cli/bin/*
|
||||
bun-test-scratch
|
||||
misctools/fetch
|
||||
|
||||
src/deps/libiconv
|
||||
src/deps/openssl
|
||||
src/tests.zig
|
||||
*.blob
|
||||
src/deps/s2n-tls
|
||||
.npm
|
||||
.npm.gz
|
||||
|
||||
bun-binary
|
||||
|
||||
src/deps/PLCrashReporter/
|
||||
|
||||
*.dSYM
|
||||
*.crash
|
||||
misctools/sha
|
||||
packages/bun-wasm/*.mjs
|
||||
packages/bun-wasm/*.cjs
|
||||
packages/bun-wasm/*.map
|
||||
packages/bun-wasm/*.js
|
||||
packages/bun-wasm/*.d.ts
|
||||
packages/bun-wasm/*.d.cts
|
||||
packages/bun-wasm/*.d.mts
|
||||
*.bc
|
||||
|
||||
src/fallback.version
|
||||
src/runtime.version
|
||||
*.sqlite
|
||||
*.database
|
||||
*.db
|
||||
misctools/machbench
|
||||
*.big
|
||||
.eslintcache
|
||||
|
||||
/bun-webkit
|
||||
|
||||
src/deps/c-ares/build
|
||||
src/bun.js/bindings-obj
|
||||
src/bun.js/debug-bindings-obj
|
||||
|
||||
failing-tests.txt
|
||||
test.txt
|
||||
myscript.sh
|
||||
|
||||
cold-jsc-start
|
||||
cold-jsc-start.d
|
||||
|
||||
/testdir
|
||||
/test.ts
|
||||
/test.js
|
||||
|
||||
src/js/out/modules*
|
||||
src/js/out/functions*
|
||||
src/js/out/tmp
|
||||
src/js/out/DebugPath.h
|
||||
|
||||
make-dev-stats.csv
|
||||
|
||||
.uuid
|
||||
tsconfig.tsbuildinfo
|
||||
|
||||
test/js/bun/glob/fixtures
|
||||
*.lib
|
||||
*.pdb
|
||||
CMakeFiles
|
||||
build.ninja
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
compile_commands.json
|
||||
|
||||
*.lib
|
||||
x64
|
||||
**/*.vcxproj*
|
||||
**/*.sln*
|
||||
**/*.dir
|
||||
**/*.pdb
|
||||
|
||||
/.webkit-cache
|
||||
/.cache
|
||||
/src/deps/libuv
|
||||
/build-*/
|
||||
|
||||
.vs
|
||||
|
||||
**/.verdaccio-db.json
|
||||
/test-report.md
|
||||
/test-report.json
|
||||
49
.gitmodules
vendored
49
.gitmodules
vendored
@@ -1,10 +1,3 @@
|
||||
[submodule "src/deps/picohttpparser"]
|
||||
path = src/deps/picohttpparser
|
||||
url = https://github.com/h2o/picohttpparser.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/javascript/jsc/WebKit"]
|
||||
path = src/bun.js/WebKit
|
||||
url = https://github.com/oven-sh/WebKit.git
|
||||
@@ -13,6 +6,13 @@ depth = 1
|
||||
update = none
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/picohttpparser"]
|
||||
path = src/deps/picohttpparser
|
||||
url = https://github.com/h2o/picohttpparser.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/mimalloc"]
|
||||
path = src/deps/mimalloc
|
||||
url = https://github.com/Jarred-Sumner/mimalloc.git
|
||||
@@ -56,15 +56,30 @@ depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/c-ares"]
|
||||
path = src/deps/c-ares
|
||||
url = https://github.com/c-ares/c-ares.git
|
||||
path = src/deps/c-ares
|
||||
url = https://github.com/c-ares/c-ares.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/zstd"]
|
||||
path = src/deps/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
ignore = dirty
|
||||
path = src/deps/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/base64"]
|
||||
path = src/deps/base64
|
||||
url = https://github.com/aklomp/base64.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
path = src/deps/base64
|
||||
url = https://github.com/aklomp/base64.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "src/deps/ls-hpack"]
|
||||
path = src/deps/ls-hpack
|
||||
url = https://github.com/litespeedtech/ls-hpack.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
@@ -1,13 +0,0 @@
|
||||
src/fallback.html
|
||||
src/bun.js/WebKit
|
||||
src/js/out
|
||||
src/*.out.js
|
||||
src/*out.*.js
|
||||
src/deps
|
||||
src/test/fixtures
|
||||
src/react-refresh.js
|
||||
test/snapshots
|
||||
test/snapshots-no-hmr
|
||||
test/js/deno/*.test.ts
|
||||
test/js/deno/**/*.test.ts
|
||||
bench/react-hello-world/react-hello-world.node.js
|
||||
@@ -1,15 +0,0 @@
|
||||
module.exports = {
|
||||
arrowParens: "avoid",
|
||||
printWidth: 120,
|
||||
trailingComma: "all",
|
||||
useTabs: false,
|
||||
quoteProps: "preserve",
|
||||
overrides: [
|
||||
{
|
||||
files: ["*.md"],
|
||||
options: {
|
||||
printWidth: 80,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,21 +0,0 @@
|
||||
// I would have made this a bash script but there isn't an easy way to track
|
||||
// time in bash sub-second cross platform.
|
||||
import fs from "fs";
|
||||
const start = Date.now() + 5;
|
||||
const result = Bun.spawnSync(process.argv.slice(2), {
|
||||
stdio: ["inherit", "inherit", "inherit"],
|
||||
});
|
||||
const end = Date.now();
|
||||
const diff = (Math.max(Math.round(end - start), 0) / 1000).toFixed(3);
|
||||
const success = result.exitCode === 0;
|
||||
try {
|
||||
const line = `${new Date().toISOString()}, ${success ? "success" : "fail"}, ${diff}\n`;
|
||||
if (fs.existsSync(".scripts/make-dev-stats.csv")) {
|
||||
fs.appendFileSync(".scripts/make-dev-stats.csv", line);
|
||||
} else {
|
||||
fs.writeFileSync(".scripts/make-dev-stats.csv", line);
|
||||
}
|
||||
} catch {
|
||||
// Ignore
|
||||
}
|
||||
process.exit(result.exitCode);
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
# if bun-webkit node_modules directory exists
|
||||
if [ -d ./node_modules/bun-webkit ]; then
|
||||
rm -f bun-webkit
|
||||
# get the first matching bun-webkit-* directory name
|
||||
ln -s ./node_modules/$(ls ./node_modules | grep bun-webkit- | head -n 1) ./bun-webkit
|
||||
fi
|
||||
|
||||
# sets up vscode C++ intellisense
|
||||
rm -f .vscode/clang++
|
||||
ln -s $(which clang++-16 || which clang++) .vscode/clang++ 2>/dev/null
|
||||
81
.vscode/c_cpp_properties.json
vendored
81
.vscode/c_cpp_properties.json
vendored
@@ -1,16 +1,65 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"name": "Debug",
|
||||
"forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"],
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/build/bun-webkit/include",
|
||||
"${workspaceFolder}/build/codegen",
|
||||
"${workspaceFolder}/src/bun.js/bindings/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/webcore/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/sqlite/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/webcrypto/",
|
||||
"${workspaceFolder}/src/bun.js/modules/",
|
||||
"${workspaceFolder}/src/js/builtins/",
|
||||
"${workspaceFolder}/src/deps/boringssl/include/",
|
||||
"${workspaceFolder}/src/deps",
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
"${workspaceFolder}/packages/bun-usockets/src",
|
||||
"${workspaceFolder}/packages/"
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}/build/bun-webkit/include",
|
||||
"${workspaceFolder}/src/bun.js/bindings",
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
"${workspaceFolder}/src/js/builtins/*",
|
||||
"${workspaceFolder}/src/bun.js/modules/*",
|
||||
"${workspaceFolder}/src/deps/*",
|
||||
"${workspaceFolder}/src/deps/boringssl/include/*",
|
||||
"${workspaceFolder}/packages/bun-usockets/*",
|
||||
"${workspaceFolder}/packages/bun-uws/*",
|
||||
"${workspaceFolder}/src/napi/*"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ".vscode/cppdb"
|
||||
},
|
||||
"defines": [
|
||||
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
|
||||
"STATICALLY_LINKED_WITH_WTF=1",
|
||||
"BUILDING_WITH_CMAKE=1",
|
||||
"NOMINMAX",
|
||||
"ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0",
|
||||
"BUILDING_JSCONLY__",
|
||||
"USE_FOUNDATION=1",
|
||||
"ASSERT_ENABLED=1",
|
||||
"DU_DISABLE_RENAMING=1"
|
||||
],
|
||||
"macFrameworkPath": [],
|
||||
"compilerPath": "${workspaceFolder}/.vscode/clang++",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20"
|
||||
},
|
||||
{
|
||||
"name": "BunWithJSCDebug",
|
||||
"forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"],
|
||||
"includePath": [
|
||||
"${workspaceFolder}/../webkit-build/include/",
|
||||
"${workspaceFolder}/bun-webkit/include/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/ICU/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/WTF/Headers",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/bmalloc/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/WTF/Headers",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/bmalloc/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/webcore/",
|
||||
"${workspaceFolder}/src/bun.js/bindings/sqlite/",
|
||||
@@ -26,13 +75,11 @@
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}/../webkit-build/include/",
|
||||
"${workspaceFolder}/bun-webkit/include/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/ICU/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/**",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/WTF/Headers/**",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Release/bmalloc/Headers/**",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/**",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/WTF/Headers/**",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/bmalloc/Headers/**",
|
||||
"${workspaceFolder}/src/bun.js/bindings/*",
|
||||
"${workspaceFolder}/src/bun.js/bindings/*",
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
@@ -49,7 +96,7 @@
|
||||
"${workspaceFolder}/src/napi"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ".vscode/cppdb"
|
||||
"databaseFilename": ".vscode/cppdb_debug"
|
||||
},
|
||||
"defines": [
|
||||
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
|
||||
@@ -59,7 +106,7 @@
|
||||
"ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0",
|
||||
"BUILDING_JSCONLY__",
|
||||
"USE_FOUNDATION=1",
|
||||
"ASSERT_ENABLED=0",
|
||||
"ASSERT_ENABLED=1",
|
||||
"DU_DISABLE_RENAMING=1"
|
||||
],
|
||||
"macFrameworkPath": [],
|
||||
|
||||
27
.vscode/extensions.json
vendored
27
.vscode/extensions.json
vendored
@@ -1,10 +1,33 @@
|
||||
{
|
||||
"recommendations": [
|
||||
// Zig
|
||||
"ziglang.vscode-zig",
|
||||
"esbenp.prettier-vscode",
|
||||
|
||||
// C/C++
|
||||
"clang.clangd",
|
||||
"ms-vscode.cmake-tools",
|
||||
"xaver.clang-format",
|
||||
"vadimcn.vscode-lldb",
|
||||
|
||||
// JavaScript
|
||||
"oven.bun-vscode",
|
||||
"biomejs.biome",
|
||||
|
||||
// TypeScript
|
||||
"better-ts-errors.better-ts-errors",
|
||||
"MylesMurphy.prettify-ts",
|
||||
|
||||
// Markdown
|
||||
"bierner.markdown-preview-github-styles",
|
||||
"bierner.markdown-emoji",
|
||||
"bierner.emojisense",
|
||||
"bierner.markdown-checkbox",
|
||||
"bierner.jsdoc-markdown-highlighting",
|
||||
|
||||
// TOML
|
||||
"tamasfe.even-better-toml",
|
||||
|
||||
// Other
|
||||
"bierner.comment-tagged-templates",
|
||||
"ms-vscode.cpptools"
|
||||
]
|
||||
}
|
||||
|
||||
1035
.vscode/launch.json
generated
vendored
1035
.vscode/launch.json
generated
vendored
File diff suppressed because it is too large
Load Diff
186
.vscode/settings.json
vendored
186
.vscode/settings.json
vendored
@@ -1,50 +1,89 @@
|
||||
{
|
||||
"git.autoRepositoryDetection": "openEditors",
|
||||
// Editor
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "file",
|
||||
|
||||
// Search
|
||||
"search.quickOpen.includeSymbols": false,
|
||||
"search.seedWithNearestWord": true,
|
||||
"search.smartCase": true,
|
||||
"search.exclude": {},
|
||||
"search.exclude": {
|
||||
"node_modules": true,
|
||||
".git": true,
|
||||
"src/bun.js/WebKit": true,
|
||||
"src/deps/*/**": true
|
||||
},
|
||||
"search.followSymlinks": false,
|
||||
"search.useIgnoreFiles": true,
|
||||
|
||||
// Git
|
||||
"git.autoRepositoryDetection": "openEditors",
|
||||
"git.ignoreSubmodules": true,
|
||||
"git.ignoreLimitWarning": true,
|
||||
|
||||
// Zig
|
||||
"zig.initialSetupDone": true,
|
||||
"zig.buildOnSave": false,
|
||||
// We do this until we upgrade to latest Zig so that zls doesn't break our code.
|
||||
"zig.formattingProvider": "extension",
|
||||
"zig.buildArgs": ["obj", "-Dfor-editor"],
|
||||
"zig.buildOption": "build",
|
||||
"zig.buildFilePath": "${workspaceFolder}/build.zig",
|
||||
"zig.path": "${workspaceFolder}/.cache/zig/zig.exe",
|
||||
"zig.formattingProvider": "zls",
|
||||
"zig.zls.enableInlayHints": false,
|
||||
"[zig]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.useTabStops": false,
|
||||
"editor.defaultFormatter": "ziglang.vscode-zig",
|
||||
"editor.formatOnSave": true
|
||||
"editor.defaultFormatter": "ziglang.vscode-zig"
|
||||
},
|
||||
"[ts]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[js]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"zig.zls.enableInlayHints": false,
|
||||
|
||||
"[jsx]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
// C++
|
||||
"lldb.verboseLogging": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"[cpp]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[tsx]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true
|
||||
"[c]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[yaml]": {
|
||||
"editor.formatOnSave": true
|
||||
"[h]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
|
||||
// JavaScript
|
||||
"prettier.enable": false,
|
||||
"eslint.workingDirectories": ["${workspaceFolder}/packages/bun-types"],
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
},
|
||||
"[javascriptreact]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
|
||||
// TypeScript
|
||||
"typescript.tsdk": "${workspaceFolder}/node_modules/typescript/lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
|
||||
// JSON
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
},
|
||||
|
||||
// Markdown
|
||||
"[markdown]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
"editor.unicodeHighlight.ambiguousCharacters": false,
|
||||
"editor.unicodeHighlight.invisibleCharacters": false,
|
||||
"diffEditor.ignoreTrimWhitespace": false,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.wordWrap": "on",
|
||||
"editor.quickSuggestions": {
|
||||
"comments": "off",
|
||||
@@ -52,7 +91,18 @@
|
||||
"other": "off"
|
||||
}
|
||||
},
|
||||
"lldb.verboseLogging": false,
|
||||
|
||||
// TOML
|
||||
"[toml]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
},
|
||||
|
||||
// YAML
|
||||
"[yaml]": {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
},
|
||||
|
||||
// Files
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
@@ -64,8 +114,6 @@
|
||||
"**/*.xcscheme": true,
|
||||
"**/*.pem": true,
|
||||
"**/*.xcodeproj": true,
|
||||
"test/snapshots": true,
|
||||
"test/snapshots-no-hmr": true,
|
||||
"src/bun.js/WebKit": true,
|
||||
"src/deps/libarchive": true,
|
||||
"src/deps/mimalloc": true,
|
||||
@@ -78,36 +126,8 @@
|
||||
"src/deps/c-ares": true,
|
||||
"src/deps/tinycc": true,
|
||||
"src/deps/zstd": true,
|
||||
"test/snippets/package-json-exports/_node_modules_copy": true,
|
||||
"src/js/out": true,
|
||||
"src/packages/bun-uws/fuzzing/seed-corpus/": true
|
||||
},
|
||||
"C_Cpp.files.exclude": {
|
||||
"**/.vscode": true,
|
||||
"src/bun.js/WebKit/JSTests": true,
|
||||
"src/bun.js/WebKit/Tools": true,
|
||||
"src/bun.js/WebKit/WebDriverTests": true,
|
||||
"src/bun.js/WebKit/WebKit.xcworkspace": true,
|
||||
"src/bun.js/WebKit/WebKitLibraries": true,
|
||||
"src/bun.js/WebKit/Websites": true,
|
||||
"src/bun.js/WebKit/resources": true,
|
||||
"src/bun.js/WebKit/LayoutTests": true,
|
||||
"src/bun.js/WebKit/ManualTests": true,
|
||||
"src/bun.js/WebKit/PerformanceTests": true,
|
||||
"src/bun.js/WebKit/WebKitLegacy": true,
|
||||
"src/bun.js/WebKit/WebCore": true,
|
||||
"src/bun.js/WebKit/WebDriver": true,
|
||||
"src/bun.js/WebKit/WebKitBuild": true,
|
||||
"src/bun.js/WebKit/WebInspectorUI": true
|
||||
},
|
||||
"[cpp]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[h]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[c]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
"**/*.i": true,
|
||||
"packages/bun-uws/fuzzing/seed-corpus/**/*": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.lock": "yarnlock",
|
||||
@@ -189,20 +209,12 @@
|
||||
"set": "cpp",
|
||||
"__memory": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"resource.h": "c",
|
||||
"sysinfo.h": "c",
|
||||
"*.tcc": "cpp",
|
||||
"list": "cpp",
|
||||
"shared_mutex": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"variant": "cpp",
|
||||
"sysctl.h": "c",
|
||||
"interface_adresses.h": "c",
|
||||
"interface_addresses.h": "c",
|
||||
"ctype.h": "c",
|
||||
"ethernet.h": "c",
|
||||
"inet.h": "c",
|
||||
"packet.h": "c",
|
||||
"queue": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
@@ -218,10 +230,40 @@
|
||||
"regex": "cpp",
|
||||
"span": "cpp",
|
||||
"valarray": "cpp",
|
||||
"codecvt": "cpp"
|
||||
"codecvt": "cpp",
|
||||
"xtr1common": "cpp",
|
||||
"stop_token": "cpp",
|
||||
"xfacet": "cpp",
|
||||
"xhash": "cpp",
|
||||
"xiosbase": "cpp",
|
||||
"xlocale": "cpp",
|
||||
"xlocbuf": "cpp",
|
||||
"xlocinfo": "cpp",
|
||||
"xlocmes": "cpp",
|
||||
"xlocmon": "cpp",
|
||||
"xlocnum": "cpp",
|
||||
"xloctime": "cpp",
|
||||
"xmemory": "cpp",
|
||||
"xstring": "cpp",
|
||||
"xtree": "cpp",
|
||||
"xutility": "cpp"
|
||||
},
|
||||
"C_Cpp.files.exclude": {
|
||||
"**/.vscode": true,
|
||||
"WebKit/JSTests": true,
|
||||
"WebKit/Tools": true,
|
||||
"WebKit/WebDriverTests": true,
|
||||
"WebKit/WebKit.xcworkspace": true,
|
||||
"WebKit/WebKitLibraries": true,
|
||||
"WebKit/Websites": true,
|
||||
"WebKit/resources": true,
|
||||
"WebKit/LayoutTests": true,
|
||||
"WebKit/ManualTests": true,
|
||||
"WebKit/PerformanceTests": true,
|
||||
"WebKit/WebKitLegacy": true,
|
||||
"WebKit/WebCore": true,
|
||||
"WebKit/WebDriver": true,
|
||||
"WebKit/WebKitBuild": true,
|
||||
"WebKit/WebInspectorUI": true
|
||||
},
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"eslint.workingDirectories": ["packages/bun-types"],
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
||||
64
.vscode/tasks.json
vendored
64
.vscode/tasks.json
vendored
@@ -2,33 +2,51 @@
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "process",
|
||||
"command": "zig",
|
||||
"args": ["build"],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": false,
|
||||
"clear": false
|
||||
"label": "Install Dependencies",
|
||||
"command": "scripts/all-dependencies.sh",
|
||||
"windows": {
|
||||
"command": "scripts/all-dependencies.ps1"
|
||||
},
|
||||
"icon": {
|
||||
"id": "arrow-down"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "run",
|
||||
"type": "process",
|
||||
"command": "zig",
|
||||
"args": ["run", "${file}"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"showReuseMessage": false,
|
||||
"clear": true
|
||||
}
|
||||
}
|
||||
"label": "Setup Environment",
|
||||
"dependsOn": ["Install Dependencies"],
|
||||
"command": "scripts/setup.sh",
|
||||
"windows": {
|
||||
"command": "scripts/setup.ps1"
|
||||
},
|
||||
"icon": {
|
||||
"id": "check"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "process",
|
||||
"label": "Build Bun",
|
||||
"dependsOn": ["Setup Environment"],
|
||||
"command": "bun",
|
||||
"args": ["run", "build"],
|
||||
"icon": {
|
||||
"id": "gear"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"isBuildCommand": true,
|
||||
"runOptions": {
|
||||
"instanceLimit": 1,
|
||||
"reevaluateOnRerun": true,
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
1337
CMakeLists.txt
Normal file
1337
CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ Today (February 2023), Bun's codebase has five distinct parts:
|
||||
|
||||
- JavaScript, JSX, & TypeScript transpiler, module resolver, and related code
|
||||
- JavaScript runtime ([`src/bun.js/`](src/bun.js/))
|
||||
- JavaScript runtime bindings ([`src/bun.zig/bindings/**/*.cpp`](src/bun.zig/bindings/))
|
||||
- JavaScript runtime bindings ([`src/bun.js/bindings/**/*.cpp`](src/bun.js/bindings/))
|
||||
- Package manager ([`src/install/`](src/install/))
|
||||
- Shared utilities ([`src/string_immutable.zig`](src/string_immutable.zig))
|
||||
|
||||
@@ -18,7 +18,7 @@ The JavaScript transpiler & module resolver is mostly independent from the runti
|
||||
|
||||
## Getting started
|
||||
|
||||
Please refer to [Bun's Development Guide](https://bun.sh/docs/project/development) to get your dev environment setup!
|
||||
Please refer to [Bun's Development Guide](https://bun.sh/docs/project/contributing) to get your dev environment setup!
|
||||
|
||||
## Memory management in Bun
|
||||
|
||||
|
||||
883
Dockerfile
883
Dockerfile
File diff suppressed because it is too large
Load Diff
120
Makefile
120
Makefile
@@ -39,7 +39,6 @@ endif
|
||||
|
||||
MIN_MACOS_VERSION ?= $(DEFAULT_MIN_MACOS_VERSION)
|
||||
BUN_BASE_VERSION = 1.0
|
||||
|
||||
CI ?= false
|
||||
|
||||
AR=
|
||||
@@ -66,7 +65,7 @@ PACKAGE_JSON_VERSION = $(BUN_BASE_VERSION).$(BUILD_ID)
|
||||
BUN_BUILD_TAG = bun-v$(PACKAGE_JSON_VERSION)
|
||||
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")
|
||||
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_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release
|
||||
@@ -74,7 +73,7 @@ WEBKIT_DEBUG_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Debug
|
||||
WEBKIT_RELEASE_DIR_LTO ?= $(WEBKIT_DIR)/WebKitBuild/ReleaseLTO
|
||||
|
||||
|
||||
NPM_CLIENT ?= $(shell which bun 2>/dev/null || which npm 2>/dev/null)
|
||||
NPM_CLIENT = "$(shell which bun 2>/dev/null || which npm 2>/dev/null)"
|
||||
ZIG ?= $(shell which zig 2>/dev/null || echo -e "error: Missing zig. Please make sure zig is in PATH. Or set ZIG=/path/to-zig-executable")
|
||||
|
||||
# We must use the same compiler version for the JavaScriptCore bindings and JavaScriptCore
|
||||
@@ -187,11 +186,6 @@ BUN_CFLAGS = $(MACOS_MIN_FLAG) $(MARCH_NATIVE) $(OPTIMIZATION_LEVEL) -fno-excep
|
||||
BUN_TMP_DIR := /tmp/make-bun
|
||||
CFLAGS=$(CFLAGS_WITHOUT_MARCH) $(MARCH_NATIVE)
|
||||
|
||||
DEFAULT_USE_BMALLOC := 1
|
||||
|
||||
|
||||
USE_BMALLOC ?= DEFAULT_USE_BMALLOC
|
||||
|
||||
# Set via postinstall
|
||||
ifeq (,$(realpath $(JSC_BASE_DIR)))
|
||||
JSC_BASE_DIR = $(realpath $(firstword $(wildcard bun-webkit)))
|
||||
@@ -380,9 +374,7 @@ ICU_FLAGS ?=
|
||||
# Ideally, we could just look up the linker search paths
|
||||
ifeq ($(OS_NAME),linux)
|
||||
LIB_ICU_PATH ?= $(JSC_LIB)
|
||||
ICU_FLAGS += $(LIB_ICU_PATH)/libicuuc.a $(LIB_ICU_PATH)/libicudata.a $(LIB_ICU_PATH)/libicui18n.a
|
||||
else
|
||||
LIB_ICU_PATH ?= $(BUN_DEPS_DIR)
|
||||
ICU_FLAGS += $(LIB_ICU_PATH)/libicuuc.a $(LIB_ICU_PATH)/libicudata.a $(LIB_ICU_PATH)/libicui18n.a
|
||||
endif
|
||||
|
||||
ifeq ($(OS_NAME),darwin)
|
||||
@@ -463,7 +455,8 @@ ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MINIMUM_ARCHIVE_FILES) \
|
||||
-lusockets \
|
||||
-lcares \
|
||||
-lzstd \
|
||||
$(BUN_DEPS_OUT_DIR)/libuwsockets.o
|
||||
$(BUN_DEPS_OUT_DIR)/libuwsockets.o \
|
||||
$(BUN_DEPS_OUT_DIR)/liblshpack.a
|
||||
|
||||
ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO)
|
||||
|
||||
@@ -680,7 +673,7 @@ assert-deps:
|
||||
@echo "You have the dependencies installed! Woo"
|
||||
|
||||
# the following allows you to run `make submodule` to update or init submodules. but we will exclude webkit
|
||||
# unless you explicity clone it yourself (a huge download)
|
||||
# unless you explicitly clone it yourself (a huge download)
|
||||
SUBMODULE_NAMES=$(shell cat .gitmodules | grep 'path = ' | awk '{print $$3}')
|
||||
ifeq ("$(wildcard src/bun.js/WebKit/.git)", "")
|
||||
SUBMODULE_NAMES := $(filter-out src/bun.js/WebKit, $(SUBMODULE_NAMES))
|
||||
@@ -757,14 +750,24 @@ wasm: api mimalloc-wasm build-obj-wasm-small
|
||||
build-obj-safe:
|
||||
$(ZIG) build obj -Doptimize=ReleaseSafe -Dcpu="$(CPU_TARGET)"
|
||||
|
||||
UWS_CC_FLAGS = -pthread -DLIBUS_USE_OPENSSL=1 -DUWS_HTTPRESPONSE_NO_WRITEMARK=1 -DLIBUS_USE_BORINGSSL=1 -DWITH_BORINGSSL=1 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion $(UWS_INCLUDE) -DUWS_WITH_PROXY
|
||||
UWS_CC_FLAGS = -pthread -DLIBUS_USE_OPENSSL=1 -DUWS_HTTPRESPONSE_NO_WRITEMARK=1 -DLIBUS_USE_BORINGSSL=1 -DWITH_BORINGSSL=1 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion $(UWS_INCLUDE) -DUWS_WITH_PROXY
|
||||
UWS_CXX_FLAGS = $(UWS_CC_FLAGS) -std=$(CXX_VERSION) -fno-exceptions -fno-rtti
|
||||
UWS_LDFLAGS = -I$(BUN_DEPS_DIR)/boringssl/include -I$(ZLIB_INCLUDE_DIR)
|
||||
USOCKETS_DIR = $(BUN_DIR)/packages/bun-usockets
|
||||
USOCKETS_SRC_DIR = $(USOCKETS_DIR)/src
|
||||
|
||||
|
||||
LSHPACK_SRC_DIR = $(BUN_DEPS_DIR)/ls-hpack
|
||||
LSHPACK_CC_FLAGS = -DXXH_HEADER_NAME="<xxhash.h>"
|
||||
LSHPACK_LDFLAGS = -I$(LSHPACK_SRC_DIR) -I$(LSHPACK_SRC_DIR)/deps/xxhash
|
||||
|
||||
lshpack:
|
||||
rm -rf $(LSHPACK_SRC_DIR)/*.i $(LSHPACK_SRC_DIR)/*.bc $(LSHPACK_SRC_DIR)/*.o $(LSHPACK_SRC_DIR)/*.s $(LSHPACK_SRC_DIR)/*.ii $(LSHPACK_SRC_DIR)/*.s
|
||||
cd $(LSHPACK_SRC_DIR) && $(CC_WITH_CCACHE) -I$(LSHPACK_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CFLAGS) $(LSHPACK_CC_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/lshpack/src $(LSHPACK_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(LSHPACK_SRC_DIR)/lshpack.c) $(wildcard $(LSHPACK_SRC_DIR)/deps/**/*.c)
|
||||
cd $(LSHPACK_SRC_DIR) && $(AR) rcvs $(BUN_DEPS_OUT_DIR)/liblshpack.a $(LSHPACK_SRC_DIR)/*.{o,bc}
|
||||
|
||||
usockets:
|
||||
rm -rf $(USOCKETS_DIR)/*.i $(USOCKETS_DIR)/*.bc $(USOCKETS_DIR)/*.o $(USOCKETS_DIR)/*.s $(USOCKETS_DIR)/*.ii $(USOCKETS_DIR)/*.s
|
||||
rm -rf $(USOCKETS_DIR)/*.i $(USOCKETS_DIR)/*.bc $(USOCKETS_DIR)/*.o $(USOCKETS_DIR)/*.s $(USOCKETS_DIR)/*.ii $(USOCKETS_DIR)/*.s $(BUN_DEPS_OUT_DIR)/libusockets.a
|
||||
cd $(USOCKETS_DIR) && $(CC_WITH_CCACHE) -I$(USOCKETS_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CFLAGS) $(UWS_CC_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/uSockets/src $(UWS_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(USOCKETS_SRC_DIR)/*.c) $(wildcard $(USOCKETS_SRC_DIR)/**/*.c)
|
||||
cd $(USOCKETS_DIR) && $(CXX_WITH_CCACHE) -I$(USOCKETS_SRC_DIR) -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc $(EMIT_LLVM_FOR_RELEASE) $(MACOS_MIN_FLAG) -fPIC $(CXXFLAGS) $(UWS_CXX_FLAGS) -save-temps -I$(BUN_DEPS_DIR)/uws/uSockets/src $(UWS_LDFLAGS) -g $(DEFAULT_LINKER_FLAGS) $(PLATFORM_LINKER_FLAGS) $(OPTIMIZATION_LEVEL) -c $(wildcard $(USOCKETS_SRC_DIR)/*.cpp) $(wildcard $(USOCKETS_SRC_DIR)/**/*.cpp)
|
||||
cd $(USOCKETS_DIR) && $(AR) rcvs $(BUN_DEPS_OUT_DIR)/libusockets.a $(USOCKETS_DIR)/*.{o,bc}
|
||||
@@ -820,7 +823,6 @@ fmt: fmt-cpp fmt-zig
|
||||
api:
|
||||
./node_modules/.bin/peechy --schema src/api/schema.peechy --esm src/api/schema.js --ts src/api/schema.d.ts --zig src/api/schema.zig
|
||||
$(ZIG) fmt src/api/schema.zig
|
||||
$(PRETTIER) --config=.prettierrc.cjs --write src/api/schema.js src/api/schema.d.ts
|
||||
|
||||
.PHONY: node-fallbacks
|
||||
node-fallbacks:
|
||||
@@ -833,17 +835,7 @@ fallback_decoder:
|
||||
|
||||
.PHONY: runtime_js
|
||||
runtime_js:
|
||||
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
|
||||
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js
|
||||
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js
|
||||
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js
|
||||
|
||||
.PHONY: runtime_js_dev
|
||||
runtime_js_dev:
|
||||
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
|
||||
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js
|
||||
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js
|
||||
@NODE_ENV=development $(ESBUILD) --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js
|
||||
@NODE_ENV=production $(ESBUILD) --define:process.env.NODE_ENV=\"production\" --target=esnext --bundle src/runtime.bun.js --format=esm --platform=node --minify --external:/bun:* > src/runtime.out.js
|
||||
|
||||
.PHONY: bun_error
|
||||
bun_error:
|
||||
@@ -937,6 +929,9 @@ clone-submodules:
|
||||
|
||||
.PHONY: headers
|
||||
headers:
|
||||
echo please don't run the headers generator anymore. i don't think it works.
|
||||
echo if you really need it, run make headers2
|
||||
headers2:
|
||||
rm -f /tmp/build-jsc-headers src/bun.js/bindings/headers.zig
|
||||
touch src/bun.js/bindings/headers.zig
|
||||
$(ZIG) build headers-obj
|
||||
@@ -1251,6 +1246,7 @@ jsc-build-mac-compile-debug:
|
||||
-DENABLE_FTL_JIT=ON \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DUSE_BUN_JSC_ADDITIONS=ON \
|
||||
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
|
||||
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
|
||||
-G Ninja \
|
||||
$(CMAKE_FLAGS_WITHOUT_RELEASE) \
|
||||
@@ -1291,7 +1287,7 @@ jsc-build-linux-compile-config:
|
||||
jsc-build-linux-compile-build:
|
||||
mkdir -p $(WEBKIT_RELEASE_DIR) && \
|
||||
cd $(WEBKIT_RELEASE_DIR) && \
|
||||
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects" -DUSE_BUN_JSC_ADDITIONS=ON \
|
||||
CFLAGS="$(CFLAGS) -Wl,--whole-archive -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -Wl,--whole-archive -ffat-lto-objects -DUSE_BUN_JSC_ADDITIONS=ON" \
|
||||
cmake --build $(WEBKIT_RELEASE_DIR) --config relwithdebuginfo --target jsc
|
||||
|
||||
|
||||
@@ -1326,7 +1322,7 @@ release-bindings: $(OBJ_DIR) $(OBJ_FILES) $(WEBCORE_OBJ_FILES) $(SQLITE_OBJ_FILE
|
||||
# Do not add $(DEBUG_DIR) to this list
|
||||
# It will break caching, causing you to have to wait for every .cpp file to rebuild.
|
||||
.PHONY: bindings
|
||||
bindings: $(DEBUG_OBJ_DIR) $(DEBUG_OBJ_FILES) $(DEBUG_WEBCORE_OBJ_FILES) $(DEBUG_SQLITE_OBJ_FILES) $(DEBUG_NODE_OS_OBJ_FILES) $(DEBUG_BUILTINS_OBJ_FILES) $(DEBUG_IO_FILES) $(DEBUG_MODULES_OBJ_FILES) $(DEBUG_WEBCRYPTO_OBJ_FILES)
|
||||
bindings-real: $(DEBUG_OBJ_DIR) $(DEBUG_OBJ_FILES) $(DEBUG_WEBCORE_OBJ_FILES) $(DEBUG_SQLITE_OBJ_FILES) $(DEBUG_NODE_OS_OBJ_FILES) $(DEBUG_BUILTINS_OBJ_FILES) $(DEBUG_IO_FILES) $(DEBUG_MODULES_OBJ_FILES) $(DEBUG_WEBCRYPTO_OBJ_FILES)
|
||||
|
||||
.PHONY: jsc-bindings-mac
|
||||
jsc-bindings-mac: bindings
|
||||
@@ -1360,7 +1356,7 @@ mimalloc-debug:
|
||||
-GNinja \
|
||||
. \
|
||||
&& ninja
|
||||
cp $(BUN_DEPS_DIR)/mimalloc/$(_MIMALLOC_DEBUG_FILE) $(BUN_DEPS_OUT_DIR)/$(MIMALLOC_FILE)
|
||||
cp $(BUN_DEPS_DIR)/mimalloc/$(_MIMALLOC_DEBUG_FILE) $(BUN_DEPS_OUT_DIR)/$(_MIMALLOC_DEBUG_FILE)
|
||||
|
||||
|
||||
# mimalloc is built as object files so that it can overload the system malloc on linux
|
||||
@@ -1485,12 +1481,12 @@ wasm-return1:
|
||||
$(ZIG) build-lib -OReleaseSmall test/bun.js/wasm-return-1-test.zig -femit-bin=test/bun.js/wasm-return-1-test.wasm -target wasm32-freestanding
|
||||
|
||||
generate-classes:
|
||||
bun src/bun.js/scripts/generate-classes.ts
|
||||
bun src/codegen/generate-classes.ts
|
||||
$(ZIG) fmt src/bun.js/bindings/generated_classes.zig
|
||||
$(CLANG_FORMAT) -i src/bun.js/bindings/ZigGeneratedClasses.h src/bun.js/bindings/ZigGeneratedClasses.cpp
|
||||
|
||||
generate-sink:
|
||||
bun src/bun.js/scripts/generate-jssink.js
|
||||
bun src/codegen/generate-jssink.js
|
||||
$(CLANG_FORMAT) -i src/bun.js/bindings/JSSink.cpp src/bun.js/bindings/JSSink.h
|
||||
./src/bun.js/scripts/create_hash_table src/bun.js/bindings/JSSink.cpp > src/bun.js/bindings/JSSinkLookupTable.h
|
||||
$(SED) -i -e 's/#include "Lookup.h"//' src/bun.js/bindings/JSSinkLookupTable.h
|
||||
@@ -1900,7 +1896,7 @@ cold-jsc-start:
|
||||
misctools/cold-jsc-start.cpp -o cold-jsc-start
|
||||
|
||||
.PHONY: vendor-without-npm
|
||||
vendor-without-npm: node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive lolhtml sqlite usockets uws tinycc c-ares zstd base64
|
||||
vendor-without-npm: node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive lolhtml sqlite usockets uws lshpack tinycc c-ares zstd base64
|
||||
|
||||
|
||||
.PHONY: vendor-without-check
|
||||
@@ -1913,46 +1909,30 @@ vendor: assert-deps submodule vendor-without-check
|
||||
vendor-dev: assert-deps submodule npm-install-dev vendor-without-npm
|
||||
|
||||
.PHONY: bun
|
||||
bun: vendor identifier-cache build-obj bun-link-lld-release bun-codesign-release-local
|
||||
bun:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: static-hash-table
|
||||
static-hash-table:
|
||||
bun src/js/_codegen/static-hash-tables.ts
|
||||
cpp:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: cpp
|
||||
cpp: ## compile src/js/builtins + all c++ code then link
|
||||
@make clean-bindings js
|
||||
@make static-hash-table
|
||||
@make bindings -j$(CPU_COUNT)
|
||||
@make link
|
||||
zig:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: cpp
|
||||
cpp-no-link:
|
||||
@make clean-bindings js
|
||||
@make bindings -j$(CPU_COUNT)
|
||||
dev:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: zig
|
||||
zig: ## compile zig code then link
|
||||
@make mkdir-dev dev-obj link
|
||||
setup:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: zig-no-link
|
||||
zig-no-link:
|
||||
@make mkdir-dev dev-obj
|
||||
bindings:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
.PHONY: dev
|
||||
dev: # combo of `make cpp` and `make zig`
|
||||
@make cpp-no-link zig-no-link -j2
|
||||
@make link
|
||||
|
||||
.PHONY: setup
|
||||
setup: vendor-dev identifier-cache clean-bindings
|
||||
make jsc-check dev
|
||||
@echo ""
|
||||
@echo "First build complete!"
|
||||
@echo "\"bun-debug\" is available at $(DEBUG_BIN)/bun-debug"
|
||||
@echo ""
|
||||
|
||||
.PHONY: help
|
||||
help: ## to print this help
|
||||
@echo "For detailed build instructions, see https://bun.sh/docs/project/development"
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m \t\t%s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||
help:
|
||||
@echo 'makefile is deprecated - use `cmake` / `bun run build`'
|
||||
@echo 'See https://bun.sh/docs/project/contributing for more details'
|
||||
|
||||
@@ -31,7 +31,7 @@ Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a s
|
||||
At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
|
||||
|
||||
```bash
|
||||
bun run index.tsx # TS and JSX supported out of the box
|
||||
bun run index.tsx # TS and JSX supported out-of-the-box
|
||||
```
|
||||
|
||||
The `bun` command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need `bun`. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.
|
||||
@@ -93,7 +93,8 @@ bun upgrade --canary
|
||||
- [`bun run`](https://bun.sh/docs/cli/run)
|
||||
- [`bun install`](https://bun.sh/docs/cli/install)
|
||||
- [`bun test`](https://bun.sh/docs/cli/test)
|
||||
- [`bun create`](https://bun.sh/docs/cli/create)
|
||||
- [`bun init`](https://bun.sh/docs/cli/init)
|
||||
- [`bun create`](https://bun.sh/docs/cli/bun-create)
|
||||
- [`bunx`](https://bun.sh/docs/cli/bunx)
|
||||
- Runtime
|
||||
- [Runtime](https://bun.sh/docs/runtime/index)
|
||||
@@ -127,7 +128,7 @@ bun upgrade --canary
|
||||
|
||||
## Contributing
|
||||
|
||||
Refer to the [Project > Development](https://bun.sh/docs/project/development) guide to start contributing to Bun.
|
||||
Refer to the [Project > Contributing](https://bun.sh/docs/project/contributing) guide to start contributing to Bun.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
BIN
bench/bun.lockb
BIN
bench/bun.lockb
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
// Psuedo RNG is derived from https://stackoverflow.com/a/424445
|
||||
// Pseudo RNG is derived from https://stackoverflow.com/a/424445
|
||||
let rngState = 123456789;
|
||||
function nextInt() {
|
||||
const m = 0x80000000; // 2**31;
|
||||
|
||||
37
bench/glob/braces.mjs
Normal file
37
bench/glob/braces.mjs
Normal file
@@ -0,0 +1,37 @@
|
||||
import braces from "braces";
|
||||
import { group, bench, run } from "mitata";
|
||||
|
||||
// const iterations = 1000;
|
||||
const iterations = 100;
|
||||
|
||||
const simplePattern = "foo.{js,jsx,ts,tsx}";
|
||||
const complexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}} wow {a,b}";
|
||||
const veryComplexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}}{1,2,{3,4},5}";
|
||||
|
||||
console.log(braces(complexPattern, { expand: true }));
|
||||
function benchPattern(pattern, name) {
|
||||
group({ name: `${name} pattern: "${pattern}"`, summary: true }, () => {
|
||||
if (typeof Bun !== "undefined")
|
||||
bench("Bun", () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
Bun.$.braces(pattern);
|
||||
}
|
||||
});
|
||||
|
||||
bench("micromatch/braces", () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
braces(pattern, { expand: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
benchPattern(simplePattern, "simple");
|
||||
benchPattern(complexPattern, "complex");
|
||||
benchPattern(veryComplexPattern, "very complex pattern");
|
||||
|
||||
await run({
|
||||
avg: true,
|
||||
min_max: true,
|
||||
percentiles: true,
|
||||
});
|
||||
19
bench/glob/match.mjs
Normal file
19
bench/glob/match.mjs
Normal file
@@ -0,0 +1,19 @@
|
||||
import micromatch from "micromatch";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const Glob = typeof Bun !== "undefined" ? Bun.Glob : undefined;
|
||||
const doMatch = typeof Bun === "undefined" ? micromatch.isMatch : (a, b) => new Glob(b).match(a);
|
||||
|
||||
bench((Glob ? "Bun.Glob - " : "micromatch - ") + "**/*.js", () => {
|
||||
doMatch("foo/bar.js", "**/*.js");
|
||||
});
|
||||
|
||||
bench((Glob ? "Bun.Glob - " : "micromatch - ") + "*.js", () => {
|
||||
doMatch("bar.js", "*.js");
|
||||
});
|
||||
|
||||
await run({
|
||||
avg: true,
|
||||
min_max: true,
|
||||
percentiles: true,
|
||||
});
|
||||
113
bench/glob/scan.mjs
Normal file
113
bench/glob/scan.mjs
Normal file
@@ -0,0 +1,113 @@
|
||||
import { run, bench, group } from "mitata";
|
||||
import fg from "fast-glob";
|
||||
import { fdir } from "fdir";
|
||||
|
||||
const normalPattern = "*.ts";
|
||||
const recursivePattern = "**/*.ts";
|
||||
const nodeModulesPattern = "**/node_modules/**/*.js";
|
||||
|
||||
const benchFdir = false;
|
||||
const cwd = undefined;
|
||||
|
||||
const bunOpts = {
|
||||
cwd,
|
||||
followSymlinks: false,
|
||||
absolute: true,
|
||||
};
|
||||
|
||||
const fgOpts = {
|
||||
cwd,
|
||||
followSymbolicLinks: false,
|
||||
onlyFiles: false,
|
||||
absolute: true,
|
||||
};
|
||||
|
||||
const Glob = "Bun" in globalThis ? globalThis.Bun.Glob : undefined;
|
||||
|
||||
group({ name: `async pattern="${normalPattern}"`, summary: true }, () => {
|
||||
bench("fast-glob", async () => {
|
||||
const entries = await fg.glob([normalPattern], fgOpts);
|
||||
});
|
||||
|
||||
if (Glob)
|
||||
bench("Bun.Glob", async () => {
|
||||
const entries = await Array.fromAsync(new Glob(normalPattern).scan(bunOpts));
|
||||
});
|
||||
|
||||
if (benchFdir)
|
||||
bench("fdir", async () => {
|
||||
const entries = await new fdir().withFullPaths().glob(normalPattern).crawl(process.cwd()).withPromise();
|
||||
});
|
||||
});
|
||||
|
||||
group({ name: `async-recursive pattern="${recursivePattern}"`, summary: true }, () => {
|
||||
bench("fast-glob", async () => {
|
||||
const entries = await fg.glob([recursivePattern], fgOpts);
|
||||
});
|
||||
|
||||
if (Glob)
|
||||
bench("Bun.Glob", async () => {
|
||||
const entries = await Array.fromAsync(new Glob(recursivePattern).scan(bunOpts));
|
||||
});
|
||||
|
||||
if (benchFdir)
|
||||
bench("fdir", async () => {
|
||||
const entries = await new fdir().withFullPaths().glob(recursivePattern).crawl(process.cwd()).withPromise();
|
||||
});
|
||||
});
|
||||
|
||||
group({ name: `sync pattern="${normalPattern}"`, summary: true }, () => {
|
||||
bench("fast-glob", () => {
|
||||
const entries = fg.globSync([normalPattern], fgOpts);
|
||||
});
|
||||
|
||||
if (Glob)
|
||||
bench("Bun.Glob", () => {
|
||||
const entries = [...new Glob(normalPattern).scanSync(bunOpts)];
|
||||
});
|
||||
|
||||
if (benchFdir)
|
||||
bench("fdir", async () => {
|
||||
const entries = new fdir().withFullPaths().glob(normalPattern).crawl(process.cwd()).sync();
|
||||
});
|
||||
});
|
||||
|
||||
group({ name: `sync-recursive pattern="${recursivePattern}"`, summary: true }, () => {
|
||||
bench("fast-glob", () => {
|
||||
const entries = fg.globSync([recursivePattern], fgOpts);
|
||||
});
|
||||
|
||||
if (Glob)
|
||||
bench("Bun.Glob", () => {
|
||||
const entries = [...new Glob(recursivePattern).scanSync(bunOpts)];
|
||||
});
|
||||
|
||||
if (benchFdir)
|
||||
bench("fdir", async () => {
|
||||
const entries = new fdir().withFullPaths().glob(recursivePattern).crawl(process.cwd()).sync();
|
||||
});
|
||||
});
|
||||
|
||||
group({ name: `node_modules pattern="${nodeModulesPattern}"`, summary: true }, () => {
|
||||
bench("fast-glob", async () => {
|
||||
const entries = await fg.glob([nodeModulesPattern], fgOpts);
|
||||
});
|
||||
|
||||
if (Glob)
|
||||
bench("Bun.Glob", async () => {
|
||||
const entries = await Array.fromAsync(new Glob(nodeModulesPattern).scan(bunOpts));
|
||||
});
|
||||
|
||||
if (benchFdir)
|
||||
bench("fdir", async () => {
|
||||
const entries = await new fdir().withFullPaths().glob(nodeModulesPattern).crawl(process.cwd()).withPromise();
|
||||
});
|
||||
});
|
||||
|
||||
await run({
|
||||
avg: true,
|
||||
colors: false,
|
||||
min_max: true,
|
||||
collect: true,
|
||||
percentiles: true,
|
||||
});
|
||||
@@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
|
||||
// 1. file path
|
||||
// 2. Byte offset in file
|
||||
// 3. ms update interval
|
||||
var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined;
|
||||
var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined;
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
var allocator = std.heap.c_allocator;
|
||||
|
||||
@@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
|
||||
// 1. file path
|
||||
// 2. Byte offset in file
|
||||
// 3. ms update interval
|
||||
var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined;
|
||||
var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined;
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
var allocator = std.heap.c_allocator;
|
||||
|
||||
@@ -7,280 +7,166 @@
|
||||
"version": "0.0.34"
|
||||
},
|
||||
"timestamps": [
|
||||
16336202536562, 16336202536908, 16336202537294, 16336202537705,
|
||||
16336202538114, 16336202538534, 16336202538941, 16336202539323,
|
||||
16336202539742, 16336202540159, 16336202540877, 16336202541310,
|
||||
16336202541749, 16336202542159, 16336202542565, 16336202542996,
|
||||
16336202543333, 16336202543761, 16336202544159, 16336202544534,
|
||||
16336202544944, 16336202545345, 16336202545744, 16336202546159,
|
||||
16336202546573, 16336202546986, 16336202547399, 16336202547781,
|
||||
16336202548202, 16336202548564, 16336202548949, 16336202549329,
|
||||
16336202549762, 16336202550168, 16336202550534, 16336202550887,
|
||||
16336202551305, 16336202551659, 16336202552060, 16336202552449,
|
||||
16336202552854, 16336202553270, 16336202553609, 16336202554034,
|
||||
16336202554437, 16336202554783, 16336202555191, 16336202555623,
|
||||
16336202556034, 16336202556449, 16336202556890, 16336202557283,
|
||||
16336202557669, 16336202558084, 16336202558496, 16336202558863,
|
||||
16336202559271, 16336202559659, 16336202560051, 16336202560452,
|
||||
16336202560873, 16336202561290, 16336202561659, 16336202562035,
|
||||
16336202562440, 16336202562862, 16336202563284, 16336202563659,
|
||||
16336202564034, 16336202564444, 16336202564853, 16336202565245,
|
||||
16336202565659, 16336202566034, 16336202566455, 16336202566873,
|
||||
16336202567284, 16336202567659, 16336202568034, 16336202568386,
|
||||
16336202568790, 16336202569204, 16336202569620, 16336202570384,
|
||||
16336202570768, 16336202571188, 16336202571551, 16336202572327,
|
||||
16336202572717, 16336202573116, 16336202573541, 16336202573959,
|
||||
16336202574319, 16336202574682, 16336202575040, 16336202575375,
|
||||
16336202577001, 16336202577342, 16336202577680, 16336202578066,
|
||||
16336202578451, 16336202579166, 16336202579534, 16336202579960,
|
||||
16336202580370, 16336202580789, 16336202581159, 16336202581576,
|
||||
16336202581949, 16336202582294, 16336202583087, 16336202583496,
|
||||
16336202583858, 16336202584203, 16336202584606, 16336202585034,
|
||||
16336202585386, 16336202585788, 16336202586211, 16336202586604,
|
||||
16336202587034, 16336202587459, 16336202587869, 16336202588295,
|
||||
16336202588668, 16336202589092, 16336202589452, 16336202589831,
|
||||
16336202590197, 16336202590608, 16336202591034, 16336202591460,
|
||||
16336202591880, 16336202592295, 16336202592727, 16336202593172,
|
||||
16336202593567, 16336202593994, 16336202594397, 16336202594795,
|
||||
16336202595224, 16336202595659, 16336202596058, 16336202596463,
|
||||
16336202596890, 16336202597322, 16336202597732, 16336202598159,
|
||||
16336202598534, 16336202598951, 16336202599365, 16336202599785,
|
||||
16336202600159, 16336202600593, 16336202601005, 16336202601402,
|
||||
16336202601807, 16336202602214, 16336202602556, 16336202602895,
|
||||
16336202603307, 16336202603661, 16336202604075, 16336202604491,
|
||||
16336202604853, 16336202605268, 16336202605670, 16336202606034,
|
||||
16336202606393, 16336202606748, 16336202607170, 16336202607568,
|
||||
16336202607982, 16336202608411, 16336202608836, 16336202609197,
|
||||
16336202609596, 16336202609965, 16336202610333, 16336202610740,
|
||||
16336202611159, 16336202611573, 16336202611975, 16336202612317,
|
||||
16336202612691, 16336202613060, 16336202613474, 16336202613903,
|
||||
16336202614341, 16336202614707, 16336202615094, 16336202615534,
|
||||
16336202615883, 16336202616296, 16336202616671, 16336202617034,
|
||||
16336202617391, 16336202617727, 16336202618159, 16336202618534,
|
||||
16336202618937, 16336202619360, 16336202619770, 16336202620179,
|
||||
16336202620716, 16336202621143, 16336202621534, 16336202622303,
|
||||
16336202622659, 16336202623085, 16336202623498, 16336202623850,
|
||||
16336202624220, 16336202624606, 16336202625034, 16336202625387,
|
||||
16336202625805, 16336202626210, 16336202626599, 16336202627034,
|
||||
16336202627386, 16336202627748, 16336202628159, 16336202628534,
|
||||
16336202628954, 16336202629373, 16336202629809, 16336202630197,
|
||||
16336202630535, 16336202630916, 16336202631290, 16336202631666,
|
||||
16336202632034, 16336202632369, 16336202633152, 16336202633534,
|
||||
16336202633883, 16336202634309, 16336202634717, 16336202635106,
|
||||
16336202635871, 16336202636253, 16336202636671, 16336202637070,
|
||||
16336202637434, 16336202637798, 16336202638184, 16336202638539,
|
||||
16336202638938, 16336202639307, 16336202639666, 16336202640095,
|
||||
16336202640534, 16336202640962, 16336202641307, 16336202641659,
|
||||
16336202642087, 16336202642521, 16336202642886, 16336202643309,
|
||||
16336202643662, 16336202644067, 16336202644491, 16336202644853,
|
||||
16336202645226, 16336202645659, 16336202646074, 16336202646497,
|
||||
16336202646890, 16336202647311, 16336202647749, 16336202648169,
|
||||
16336202648976, 16336202649378, 16336202649810, 16336202650165,
|
||||
16336202650534, 16336202650875, 16336202651250, 16336202651659,
|
||||
16336202652093, 16336202652516, 16336202652921, 16336202653332,
|
||||
16336202653722, 16336202654142, 16336202654534, 16336202654880,
|
||||
16336202655221, 16336202655562, 16336202655997, 16336202656378,
|
||||
16336202656811, 16336202657161, 16336202657588, 16336202657944,
|
||||
16336202658360, 16336202658708, 16336202659089, 16336202659428,
|
||||
16336202659849, 16336202660273, 16336202660685, 16336202661105,
|
||||
16336202661534, 16336202661873, 16336202662228, 16336202662658,
|
||||
16336202663438, 16336202663843, 16336202664219, 16336202664646,
|
||||
16336202665050, 16336202665487, 16336202665838, 16336202666211,
|
||||
16336202666573, 16336202666927, 16336202667334, 16336202667746,
|
||||
16336202668158, 16336202668563, 16336202668980, 16336202669406,
|
||||
16336202669753, 16336202670192, 16336202670554, 16336202670903,
|
||||
16336202671324, 16336202671734, 16336202672159, 16336202672573,
|
||||
16336202672982, 16336202673346, 16336202673680, 16336202674087,
|
||||
16336202674499, 16336202674909, 16336202675260, 16336202676110,
|
||||
16336202676535, 16336202676913, 16336202677312, 16336202677658,
|
||||
16336202678044, 16336202678413, 16336202678793, 16336202679208,
|
||||
16336202679604, 16336202680034, 16336202680385, 16336202680799,
|
||||
16336202681213, 16336202681595, 16336202682004, 16336202682346,
|
||||
16336202682726, 16336202683158, 16336202683586, 16336202683990,
|
||||
16336202684323, 16336202684742, 16336202685175, 16336202685578,
|
||||
16336202685979, 16336202686805, 16336202687206, 16336202687614,
|
||||
16336202688038, 16336202688473, 16336202688848, 16336202689221,
|
||||
16336202689559, 16336202689971, 16336202690368, 16336202690776,
|
||||
16336202691159, 16336202691585, 16336202692010, 16336202692373,
|
||||
16336202692780, 16336202693179, 16336202693580, 16336202693991,
|
||||
16336202694324, 16336202694727, 16336202695159, 16336202695588,
|
||||
16336202695991, 16336202696335, 16336202697160, 16336202697542,
|
||||
16336202697929, 16336202698323, 16336202698674, 16336202699060,
|
||||
16336202699492, 16336202699835, 16336202700238, 16336202700658,
|
||||
16336202701059, 16336202701420, 16336202701815, 16336202702229,
|
||||
16336202702659, 16336202703857, 16336202704256, 16336202704659,
|
||||
16336202705497, 16336202706309, 16336202706660, 16336202707085,
|
||||
16336202707511, 16336202707866, 16336202708210, 16336202708552,
|
||||
16336202708925, 16336202709287, 16336202709670, 16336202710045,
|
||||
16336202710402, 16336202710802, 16336202711167, 16336202711533,
|
||||
16336202712249, 16336202712660, 16336202713088, 16336202713519,
|
||||
16336202713936, 16336202714355, 16336202714740, 16336202715160,
|
||||
16336202715533, 16336202715878, 16336202716290, 16336202716708,
|
||||
16336202717102, 16336202718290, 16336202718699, 16336202719052,
|
||||
16336202719388, 16336202719808, 16336202720225, 16336202720659,
|
||||
16336202721052, 16336202721414, 16336202721828, 16336202722925,
|
||||
16336202723664, 16336202724063, 16336202724405, 16336202726003,
|
||||
16336202726736, 16336202727158, 16336202727543, 16336202727930,
|
||||
16336202728336, 16336202728703, 16336202729061, 16336202729483,
|
||||
16336202729832, 16336202730222, 16336202730659, 16336202731084,
|
||||
16336202731500, 16336202731911, 16336202732326, 16336202733158,
|
||||
16336202733585, 16336202734001, 16336202734691, 16336202735042,
|
||||
16336202735442, 16336202735863, 16336202736255, 16336202736671,
|
||||
16336202737043, 16336202737884, 16336202738671, 16336202739110,
|
||||
16336202739533, 16336202739886, 16336202740283, 16336202740706,
|
||||
16336202741143, 16336202741534, 16336202741942, 16336202742352,
|
||||
16336202742697, 16336202743103, 16336202743940, 16336202745172,
|
||||
16336202745542, 16336202745937, 16336202746339, 16336202746758,
|
||||
16336202747531, 16336202747877, 16336202748232, 16336202748658,
|
||||
16336202749055, 16336202749468, 16336202749859, 16336202750416,
|
||||
16336202750839, 16336202751178, 16336202751572, 16336202752002,
|
||||
16336202752419, 16336202753269, 16336202753678, 16336202754086,
|
||||
16336202754432, 16336202754835, 16336202755260, 16336202755683,
|
||||
16336202756059, 16336202756402, 16336202756837, 16336202758084,
|
||||
16336202758507, 16336202758879, 16336202759270, 16336202759674,
|
||||
16336202760044, 16336202760400, 16336202760801, 16336202761659,
|
||||
16336202762053, 16336202762397, 16336202763199, 16336202763547,
|
||||
16336202763948, 16336202764714, 16336202765113, 16336202765947,
|
||||
16336202766329, 16336202766664, 16336202767085, 16336202768233,
|
||||
16336202769056, 16336202769758, 16336202770178, 16336202770585,
|
||||
16336202770929, 16336202771325, 16336202772158, 16336202772594,
|
||||
16336202773033, 16336202773403, 16336202773801, 16336202774179,
|
||||
16336202774555, 16336202774989, 16336202775393, 16336202775809,
|
||||
16336202776209, 16336202776618, 16336202777033, 16336202777421,
|
||||
16336202777845, 16336202778246, 16336202778658, 16336202779055,
|
||||
16336202779411, 16336202779761, 16336202780175, 16336202780594,
|
||||
16336202781002, 16336202781848, 16336202782658, 16336202783033,
|
||||
16336202783857, 16336202784211, 16336202784557, 16336202784972,
|
||||
16336202785377, 16336202785810, 16336202786172, 16336202786934,
|
||||
16336202787343, 16336202787765, 16336202788201, 16336202788563,
|
||||
16336202788970, 16336202789329, 16336202789672, 16336202790055,
|
||||
16336202790456, 16336202790802, 16336202791580, 16336202791920,
|
||||
16336202792326, 16336202793158, 16336202793953, 16336202794368,
|
||||
16336202795187, 16336202795622, 16336202796033, 16336202796393,
|
||||
16336202796777, 16336202797173, 16336202797540, 16336202797975,
|
||||
16336202798317, 16336202798739, 16336202799158, 16336202799567,
|
||||
16336202799966, 16336202800378, 16336202800803, 16336202801232,
|
||||
16336202801658, 16336202802033, 16336202802374, 16336202802759,
|
||||
16336202803158, 16336202803533, 16336202803947, 16336202804354,
|
||||
16336202804729, 16336202805158, 16336202805534, 16336202805950,
|
||||
16336202806390, 16336202806805, 16336202807219, 16336202807643,
|
||||
16336202808033, 16336202808377, 16336202808790, 16336202809211,
|
||||
16336202809560, 16336202809920, 16336202810355, 16336202810758,
|
||||
16336202811187, 16336202811596, 16336202811943, 16336202812348,
|
||||
16336202812710, 16336202813060, 16336202813398, 16336202813791,
|
||||
16336202814158, 16336202814533, 16336202814878, 16336202815246,
|
||||
16336202815658, 16336202816079, 16336202816851, 16336202817202,
|
||||
16336202817540, 16336202817905, 16336202818244, 16336202818663,
|
||||
16336202819068, 16336202819418, 16336202819777, 16336202820193,
|
||||
16336202820599, 16336202821033, 16336202821395, 16336202821745,
|
||||
16336202822158, 16336202822590, 16336202822996, 16336202823396,
|
||||
16336202823804, 16336202824210, 16336202824581, 16336202824991,
|
||||
16336202825406, 16336202825806, 16336202826210, 16336202826598,
|
||||
16336202827033, 16336202827446, 16336202827839, 16336202828201,
|
||||
16336202828577, 16336202828968, 16336202829362, 16336202829709,
|
||||
16336202830096, 16336202830533, 16336202830917, 16336202831290,
|
||||
16336202831699, 16336202832035, 16336202832406, 16336202832804,
|
||||
16336202833200, 16336202833604, 16336202834033, 16336202834386,
|
||||
16336202834759, 16336202835190, 16336202835621, 16336202836033,
|
||||
16336202836405, 16336202837191, 16336202837613, 16336202838033,
|
||||
16336202838374, 16336202838798, 16336202839200, 16336202839603,
|
||||
16336202840034, 16336202840389, 16336202840783, 16336202841200,
|
||||
16336202841617, 16336202842034, 16336202842390, 16336202842737,
|
||||
16336202843158, 16336202843585, 16336202843923, 16336202844313,
|
||||
16336202844724, 16336202845158, 16336202845576, 16336202845939,
|
||||
16336202846368, 16336202846728, 16336202847158, 16336202847568,
|
||||
16336202847911, 16336202848291, 16336202848695, 16336202849103,
|
||||
16336202849533, 16336202849942, 16336202850368, 16336202850747,
|
||||
16336202851158, 16336202851549, 16336202851978, 16336202852383,
|
||||
16336202852725, 16336202853158, 16336202853554, 16336202853961,
|
||||
16336202854308, 16336202854704, 16336202855060, 16336202855418,
|
||||
16336202855776, 16336202856203, 16336202856617, 16336202857036,
|
||||
16336202857455, 16336202857884, 16336202858262, 16336202858658,
|
||||
16336202859071, 16336202859847, 16336202860237, 16336202860658,
|
||||
16336202861037, 16336202861452, 16336202861869, 16336202862218,
|
||||
16336202862590, 16336202863001, 16336202863422, 16336202863857,
|
||||
16336202864219, 16336202864658, 16336202865047, 16336202865404,
|
||||
16336202865789, 16336202866210, 16336202866624, 16336202867033,
|
||||
16336202867380, 16336202867797, 16336202868227, 16336202868658,
|
||||
16336202869083, 16336202869500, 16336202869906, 16336202870246,
|
||||
16336202870658, 16336202871086, 16336202871441, 16336202871820,
|
||||
16336202872204, 16336202872546, 16336202872943, 16336202873380,
|
||||
16336202873811, 16336202874213, 16336202874566, 16336202874918,
|
||||
16336202875261, 16336202875655, 16336202876047, 16336202876771,
|
||||
16336202877202, 16336202877612, 16336202878033, 16336202878412,
|
||||
16336202878846, 16336202879241, 16336202879658, 16336202880072,
|
||||
16336202880508, 16336202880901, 16336202881308, 16336202881725,
|
||||
16336202882158, 16336202882579, 16336202882945, 16336202883286,
|
||||
16336202883657, 16336202884048, 16336202884404, 16336202884752,
|
||||
16336202885158, 16336202885533, 16336202885938, 16336202886364,
|
||||
16336202886759, 16336202887175, 16336202887585, 16336202887929,
|
||||
16336202888345, 16336202888743, 16336202889157, 16336202889570,
|
||||
16336202889970, 16336202890382, 16336202890761, 16336202891187,
|
||||
16336202891600, 16336202892033, 16336202892454, 16336202892794,
|
||||
16336202893178, 16336202893533, 16336202893903, 16336202894264,
|
||||
16336202894668, 16336202895049, 16336202895400, 16336202895774,
|
||||
16336202896157, 16336202896537, 16336202896883, 16336202897232,
|
||||
16336202897658, 16336202898065, 16336202898493, 16336202898884,
|
||||
16336202899251, 16336202899673, 16336202900047, 16336202900467,
|
||||
16336202900883, 16336202901300, 16336202901676, 16336202902068,
|
||||
16336202902479, 16336202902902, 16336202903260, 16336202903675,
|
||||
16336202904094, 16336202904476, 16336202904824, 16336202905158,
|
||||
16336202905533, 16336202905934, 16336202906289, 16336202906717,
|
||||
16336202907158, 16336202907547, 16336202907904, 16336202908294,
|
||||
16336202908717, 16336202909157, 16336202909582, 16336202910005,
|
||||
16336202910399, 16336202910800, 16336202911220, 16336202911657,
|
||||
16336202912064, 16336202912405, 16336202912779, 16336202913158,
|
||||
16336202913553, 16336202913966, 16336202914376, 16336202914719,
|
||||
16336202915091, 16336202915515, 16336202915887, 16336202916293,
|
||||
16336202916649, 16336202917438, 16336202917869, 16336202918221,
|
||||
16336202919053, 16336202919425, 16336202919833, 16336202920234,
|
||||
16336202920658, 16336202921033, 16336202921433, 16336202921801,
|
||||
16336202922161, 16336202922589, 16336202923017, 16336202923418,
|
||||
16336202923804, 16336202924199, 16336202924593, 16336202925033,
|
||||
16336202925449, 16336202925818, 16336202926223, 16336202926662,
|
||||
16336202927431, 16336202927812, 16336202928227, 16336202928658,
|
||||
16336202929061, 16336202929473, 16336202929891, 16336202930241,
|
||||
16336202930657, 16336202931057, 16336202931396, 16336202931811,
|
||||
16336202932225, 16336202932657, 16336202933058, 16336202933445,
|
||||
16336202933790, 16336202934157, 16336202934562, 16336202934988,
|
||||
16336202935391, 16336202935777, 16336202936160, 16336202936562,
|
||||
16336202936986, 16336202937396, 16336202937751, 16336202938158,
|
||||
16336202938578, 16336202938985, 16336202939396, 16336202939752,
|
||||
16336202940157, 16336202940585
|
||||
16336202536562, 16336202536908, 16336202537294, 16336202537705, 16336202538114, 16336202538534, 16336202538941,
|
||||
16336202539323, 16336202539742, 16336202540159, 16336202540877, 16336202541310, 16336202541749, 16336202542159,
|
||||
16336202542565, 16336202542996, 16336202543333, 16336202543761, 16336202544159, 16336202544534, 16336202544944,
|
||||
16336202545345, 16336202545744, 16336202546159, 16336202546573, 16336202546986, 16336202547399, 16336202547781,
|
||||
16336202548202, 16336202548564, 16336202548949, 16336202549329, 16336202549762, 16336202550168, 16336202550534,
|
||||
16336202550887, 16336202551305, 16336202551659, 16336202552060, 16336202552449, 16336202552854, 16336202553270,
|
||||
16336202553609, 16336202554034, 16336202554437, 16336202554783, 16336202555191, 16336202555623, 16336202556034,
|
||||
16336202556449, 16336202556890, 16336202557283, 16336202557669, 16336202558084, 16336202558496, 16336202558863,
|
||||
16336202559271, 16336202559659, 16336202560051, 16336202560452, 16336202560873, 16336202561290, 16336202561659,
|
||||
16336202562035, 16336202562440, 16336202562862, 16336202563284, 16336202563659, 16336202564034, 16336202564444,
|
||||
16336202564853, 16336202565245, 16336202565659, 16336202566034, 16336202566455, 16336202566873, 16336202567284,
|
||||
16336202567659, 16336202568034, 16336202568386, 16336202568790, 16336202569204, 16336202569620, 16336202570384,
|
||||
16336202570768, 16336202571188, 16336202571551, 16336202572327, 16336202572717, 16336202573116, 16336202573541,
|
||||
16336202573959, 16336202574319, 16336202574682, 16336202575040, 16336202575375, 16336202577001, 16336202577342,
|
||||
16336202577680, 16336202578066, 16336202578451, 16336202579166, 16336202579534, 16336202579960, 16336202580370,
|
||||
16336202580789, 16336202581159, 16336202581576, 16336202581949, 16336202582294, 16336202583087, 16336202583496,
|
||||
16336202583858, 16336202584203, 16336202584606, 16336202585034, 16336202585386, 16336202585788, 16336202586211,
|
||||
16336202586604, 16336202587034, 16336202587459, 16336202587869, 16336202588295, 16336202588668, 16336202589092,
|
||||
16336202589452, 16336202589831, 16336202590197, 16336202590608, 16336202591034, 16336202591460, 16336202591880,
|
||||
16336202592295, 16336202592727, 16336202593172, 16336202593567, 16336202593994, 16336202594397, 16336202594795,
|
||||
16336202595224, 16336202595659, 16336202596058, 16336202596463, 16336202596890, 16336202597322, 16336202597732,
|
||||
16336202598159, 16336202598534, 16336202598951, 16336202599365, 16336202599785, 16336202600159, 16336202600593,
|
||||
16336202601005, 16336202601402, 16336202601807, 16336202602214, 16336202602556, 16336202602895, 16336202603307,
|
||||
16336202603661, 16336202604075, 16336202604491, 16336202604853, 16336202605268, 16336202605670, 16336202606034,
|
||||
16336202606393, 16336202606748, 16336202607170, 16336202607568, 16336202607982, 16336202608411, 16336202608836,
|
||||
16336202609197, 16336202609596, 16336202609965, 16336202610333, 16336202610740, 16336202611159, 16336202611573,
|
||||
16336202611975, 16336202612317, 16336202612691, 16336202613060, 16336202613474, 16336202613903, 16336202614341,
|
||||
16336202614707, 16336202615094, 16336202615534, 16336202615883, 16336202616296, 16336202616671, 16336202617034,
|
||||
16336202617391, 16336202617727, 16336202618159, 16336202618534, 16336202618937, 16336202619360, 16336202619770,
|
||||
16336202620179, 16336202620716, 16336202621143, 16336202621534, 16336202622303, 16336202622659, 16336202623085,
|
||||
16336202623498, 16336202623850, 16336202624220, 16336202624606, 16336202625034, 16336202625387, 16336202625805,
|
||||
16336202626210, 16336202626599, 16336202627034, 16336202627386, 16336202627748, 16336202628159, 16336202628534,
|
||||
16336202628954, 16336202629373, 16336202629809, 16336202630197, 16336202630535, 16336202630916, 16336202631290,
|
||||
16336202631666, 16336202632034, 16336202632369, 16336202633152, 16336202633534, 16336202633883, 16336202634309,
|
||||
16336202634717, 16336202635106, 16336202635871, 16336202636253, 16336202636671, 16336202637070, 16336202637434,
|
||||
16336202637798, 16336202638184, 16336202638539, 16336202638938, 16336202639307, 16336202639666, 16336202640095,
|
||||
16336202640534, 16336202640962, 16336202641307, 16336202641659, 16336202642087, 16336202642521, 16336202642886,
|
||||
16336202643309, 16336202643662, 16336202644067, 16336202644491, 16336202644853, 16336202645226, 16336202645659,
|
||||
16336202646074, 16336202646497, 16336202646890, 16336202647311, 16336202647749, 16336202648169, 16336202648976,
|
||||
16336202649378, 16336202649810, 16336202650165, 16336202650534, 16336202650875, 16336202651250, 16336202651659,
|
||||
16336202652093, 16336202652516, 16336202652921, 16336202653332, 16336202653722, 16336202654142, 16336202654534,
|
||||
16336202654880, 16336202655221, 16336202655562, 16336202655997, 16336202656378, 16336202656811, 16336202657161,
|
||||
16336202657588, 16336202657944, 16336202658360, 16336202658708, 16336202659089, 16336202659428, 16336202659849,
|
||||
16336202660273, 16336202660685, 16336202661105, 16336202661534, 16336202661873, 16336202662228, 16336202662658,
|
||||
16336202663438, 16336202663843, 16336202664219, 16336202664646, 16336202665050, 16336202665487, 16336202665838,
|
||||
16336202666211, 16336202666573, 16336202666927, 16336202667334, 16336202667746, 16336202668158, 16336202668563,
|
||||
16336202668980, 16336202669406, 16336202669753, 16336202670192, 16336202670554, 16336202670903, 16336202671324,
|
||||
16336202671734, 16336202672159, 16336202672573, 16336202672982, 16336202673346, 16336202673680, 16336202674087,
|
||||
16336202674499, 16336202674909, 16336202675260, 16336202676110, 16336202676535, 16336202676913, 16336202677312,
|
||||
16336202677658, 16336202678044, 16336202678413, 16336202678793, 16336202679208, 16336202679604, 16336202680034,
|
||||
16336202680385, 16336202680799, 16336202681213, 16336202681595, 16336202682004, 16336202682346, 16336202682726,
|
||||
16336202683158, 16336202683586, 16336202683990, 16336202684323, 16336202684742, 16336202685175, 16336202685578,
|
||||
16336202685979, 16336202686805, 16336202687206, 16336202687614, 16336202688038, 16336202688473, 16336202688848,
|
||||
16336202689221, 16336202689559, 16336202689971, 16336202690368, 16336202690776, 16336202691159, 16336202691585,
|
||||
16336202692010, 16336202692373, 16336202692780, 16336202693179, 16336202693580, 16336202693991, 16336202694324,
|
||||
16336202694727, 16336202695159, 16336202695588, 16336202695991, 16336202696335, 16336202697160, 16336202697542,
|
||||
16336202697929, 16336202698323, 16336202698674, 16336202699060, 16336202699492, 16336202699835, 16336202700238,
|
||||
16336202700658, 16336202701059, 16336202701420, 16336202701815, 16336202702229, 16336202702659, 16336202703857,
|
||||
16336202704256, 16336202704659, 16336202705497, 16336202706309, 16336202706660, 16336202707085, 16336202707511,
|
||||
16336202707866, 16336202708210, 16336202708552, 16336202708925, 16336202709287, 16336202709670, 16336202710045,
|
||||
16336202710402, 16336202710802, 16336202711167, 16336202711533, 16336202712249, 16336202712660, 16336202713088,
|
||||
16336202713519, 16336202713936, 16336202714355, 16336202714740, 16336202715160, 16336202715533, 16336202715878,
|
||||
16336202716290, 16336202716708, 16336202717102, 16336202718290, 16336202718699, 16336202719052, 16336202719388,
|
||||
16336202719808, 16336202720225, 16336202720659, 16336202721052, 16336202721414, 16336202721828, 16336202722925,
|
||||
16336202723664, 16336202724063, 16336202724405, 16336202726003, 16336202726736, 16336202727158, 16336202727543,
|
||||
16336202727930, 16336202728336, 16336202728703, 16336202729061, 16336202729483, 16336202729832, 16336202730222,
|
||||
16336202730659, 16336202731084, 16336202731500, 16336202731911, 16336202732326, 16336202733158, 16336202733585,
|
||||
16336202734001, 16336202734691, 16336202735042, 16336202735442, 16336202735863, 16336202736255, 16336202736671,
|
||||
16336202737043, 16336202737884, 16336202738671, 16336202739110, 16336202739533, 16336202739886, 16336202740283,
|
||||
16336202740706, 16336202741143, 16336202741534, 16336202741942, 16336202742352, 16336202742697, 16336202743103,
|
||||
16336202743940, 16336202745172, 16336202745542, 16336202745937, 16336202746339, 16336202746758, 16336202747531,
|
||||
16336202747877, 16336202748232, 16336202748658, 16336202749055, 16336202749468, 16336202749859, 16336202750416,
|
||||
16336202750839, 16336202751178, 16336202751572, 16336202752002, 16336202752419, 16336202753269, 16336202753678,
|
||||
16336202754086, 16336202754432, 16336202754835, 16336202755260, 16336202755683, 16336202756059, 16336202756402,
|
||||
16336202756837, 16336202758084, 16336202758507, 16336202758879, 16336202759270, 16336202759674, 16336202760044,
|
||||
16336202760400, 16336202760801, 16336202761659, 16336202762053, 16336202762397, 16336202763199, 16336202763547,
|
||||
16336202763948, 16336202764714, 16336202765113, 16336202765947, 16336202766329, 16336202766664, 16336202767085,
|
||||
16336202768233, 16336202769056, 16336202769758, 16336202770178, 16336202770585, 16336202770929, 16336202771325,
|
||||
16336202772158, 16336202772594, 16336202773033, 16336202773403, 16336202773801, 16336202774179, 16336202774555,
|
||||
16336202774989, 16336202775393, 16336202775809, 16336202776209, 16336202776618, 16336202777033, 16336202777421,
|
||||
16336202777845, 16336202778246, 16336202778658, 16336202779055, 16336202779411, 16336202779761, 16336202780175,
|
||||
16336202780594, 16336202781002, 16336202781848, 16336202782658, 16336202783033, 16336202783857, 16336202784211,
|
||||
16336202784557, 16336202784972, 16336202785377, 16336202785810, 16336202786172, 16336202786934, 16336202787343,
|
||||
16336202787765, 16336202788201, 16336202788563, 16336202788970, 16336202789329, 16336202789672, 16336202790055,
|
||||
16336202790456, 16336202790802, 16336202791580, 16336202791920, 16336202792326, 16336202793158, 16336202793953,
|
||||
16336202794368, 16336202795187, 16336202795622, 16336202796033, 16336202796393, 16336202796777, 16336202797173,
|
||||
16336202797540, 16336202797975, 16336202798317, 16336202798739, 16336202799158, 16336202799567, 16336202799966,
|
||||
16336202800378, 16336202800803, 16336202801232, 16336202801658, 16336202802033, 16336202802374, 16336202802759,
|
||||
16336202803158, 16336202803533, 16336202803947, 16336202804354, 16336202804729, 16336202805158, 16336202805534,
|
||||
16336202805950, 16336202806390, 16336202806805, 16336202807219, 16336202807643, 16336202808033, 16336202808377,
|
||||
16336202808790, 16336202809211, 16336202809560, 16336202809920, 16336202810355, 16336202810758, 16336202811187,
|
||||
16336202811596, 16336202811943, 16336202812348, 16336202812710, 16336202813060, 16336202813398, 16336202813791,
|
||||
16336202814158, 16336202814533, 16336202814878, 16336202815246, 16336202815658, 16336202816079, 16336202816851,
|
||||
16336202817202, 16336202817540, 16336202817905, 16336202818244, 16336202818663, 16336202819068, 16336202819418,
|
||||
16336202819777, 16336202820193, 16336202820599, 16336202821033, 16336202821395, 16336202821745, 16336202822158,
|
||||
16336202822590, 16336202822996, 16336202823396, 16336202823804, 16336202824210, 16336202824581, 16336202824991,
|
||||
16336202825406, 16336202825806, 16336202826210, 16336202826598, 16336202827033, 16336202827446, 16336202827839,
|
||||
16336202828201, 16336202828577, 16336202828968, 16336202829362, 16336202829709, 16336202830096, 16336202830533,
|
||||
16336202830917, 16336202831290, 16336202831699, 16336202832035, 16336202832406, 16336202832804, 16336202833200,
|
||||
16336202833604, 16336202834033, 16336202834386, 16336202834759, 16336202835190, 16336202835621, 16336202836033,
|
||||
16336202836405, 16336202837191, 16336202837613, 16336202838033, 16336202838374, 16336202838798, 16336202839200,
|
||||
16336202839603, 16336202840034, 16336202840389, 16336202840783, 16336202841200, 16336202841617, 16336202842034,
|
||||
16336202842390, 16336202842737, 16336202843158, 16336202843585, 16336202843923, 16336202844313, 16336202844724,
|
||||
16336202845158, 16336202845576, 16336202845939, 16336202846368, 16336202846728, 16336202847158, 16336202847568,
|
||||
16336202847911, 16336202848291, 16336202848695, 16336202849103, 16336202849533, 16336202849942, 16336202850368,
|
||||
16336202850747, 16336202851158, 16336202851549, 16336202851978, 16336202852383, 16336202852725, 16336202853158,
|
||||
16336202853554, 16336202853961, 16336202854308, 16336202854704, 16336202855060, 16336202855418, 16336202855776,
|
||||
16336202856203, 16336202856617, 16336202857036, 16336202857455, 16336202857884, 16336202858262, 16336202858658,
|
||||
16336202859071, 16336202859847, 16336202860237, 16336202860658, 16336202861037, 16336202861452, 16336202861869,
|
||||
16336202862218, 16336202862590, 16336202863001, 16336202863422, 16336202863857, 16336202864219, 16336202864658,
|
||||
16336202865047, 16336202865404, 16336202865789, 16336202866210, 16336202866624, 16336202867033, 16336202867380,
|
||||
16336202867797, 16336202868227, 16336202868658, 16336202869083, 16336202869500, 16336202869906, 16336202870246,
|
||||
16336202870658, 16336202871086, 16336202871441, 16336202871820, 16336202872204, 16336202872546, 16336202872943,
|
||||
16336202873380, 16336202873811, 16336202874213, 16336202874566, 16336202874918, 16336202875261, 16336202875655,
|
||||
16336202876047, 16336202876771, 16336202877202, 16336202877612, 16336202878033, 16336202878412, 16336202878846,
|
||||
16336202879241, 16336202879658, 16336202880072, 16336202880508, 16336202880901, 16336202881308, 16336202881725,
|
||||
16336202882158, 16336202882579, 16336202882945, 16336202883286, 16336202883657, 16336202884048, 16336202884404,
|
||||
16336202884752, 16336202885158, 16336202885533, 16336202885938, 16336202886364, 16336202886759, 16336202887175,
|
||||
16336202887585, 16336202887929, 16336202888345, 16336202888743, 16336202889157, 16336202889570, 16336202889970,
|
||||
16336202890382, 16336202890761, 16336202891187, 16336202891600, 16336202892033, 16336202892454, 16336202892794,
|
||||
16336202893178, 16336202893533, 16336202893903, 16336202894264, 16336202894668, 16336202895049, 16336202895400,
|
||||
16336202895774, 16336202896157, 16336202896537, 16336202896883, 16336202897232, 16336202897658, 16336202898065,
|
||||
16336202898493, 16336202898884, 16336202899251, 16336202899673, 16336202900047, 16336202900467, 16336202900883,
|
||||
16336202901300, 16336202901676, 16336202902068, 16336202902479, 16336202902902, 16336202903260, 16336202903675,
|
||||
16336202904094, 16336202904476, 16336202904824, 16336202905158, 16336202905533, 16336202905934, 16336202906289,
|
||||
16336202906717, 16336202907158, 16336202907547, 16336202907904, 16336202908294, 16336202908717, 16336202909157,
|
||||
16336202909582, 16336202910005, 16336202910399, 16336202910800, 16336202911220, 16336202911657, 16336202912064,
|
||||
16336202912405, 16336202912779, 16336202913158, 16336202913553, 16336202913966, 16336202914376, 16336202914719,
|
||||
16336202915091, 16336202915515, 16336202915887, 16336202916293, 16336202916649, 16336202917438, 16336202917869,
|
||||
16336202918221, 16336202919053, 16336202919425, 16336202919833, 16336202920234, 16336202920658, 16336202921033,
|
||||
16336202921433, 16336202921801, 16336202922161, 16336202922589, 16336202923017, 16336202923418, 16336202923804,
|
||||
16336202924199, 16336202924593, 16336202925033, 16336202925449, 16336202925818, 16336202926223, 16336202926662,
|
||||
16336202927431, 16336202927812, 16336202928227, 16336202928658, 16336202929061, 16336202929473, 16336202929891,
|
||||
16336202930241, 16336202930657, 16336202931057, 16336202931396, 16336202931811, 16336202932225, 16336202932657,
|
||||
16336202933058, 16336202933445, 16336202933790, 16336202934157, 16336202934562, 16336202934988, 16336202935391,
|
||||
16336202935777, 16336202936160, 16336202936562, 16336202936986, 16336202937396, 16336202937751, 16336202938158,
|
||||
16336202938578, 16336202938985, 16336202939396, 16336202939752, 16336202940157, 16336202940585
|
||||
],
|
||||
"frameTimes": [
|
||||
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362,
|
||||
380, 406, 353, 354, 389, 416, 425, 346, 432, 415, 393, 415, 367, 388, 401,
|
||||
417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399,
|
||||
418, 363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393,
|
||||
425, 426, 424, 379, 411, 426, 415, 445, 427, 398, 435, 405, 432, 427, 417,
|
||||
420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407,
|
||||
414, 342, 369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426,
|
||||
352, 386, 353, 405, 435, 362, 375, 419, 388, 381, 376, 335, 382, 426, 389,
|
||||
382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421,
|
||||
420, 402, 355, 341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339,
|
||||
424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405, 426, 439, 349, 410,
|
||||
414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404,
|
||||
419, 403, 826, 408, 435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344,
|
||||
382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355, 342, 362, 375,
|
||||
400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399,
|
||||
1598, 422, 387, 367, 422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439,
|
||||
353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557, 339, 430, 850,
|
||||
408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148,
|
||||
702, 407, 396, 436, 370, 378, 434, 416, 409, 388, 401, 397, 350, 419, 846,
|
||||
375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415, 435, 360,
|
||||
396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344,
|
||||
421, 360, 403, 409, 405, 350, 393, 375, 368, 421, 351, 365, 419, 350, 416,
|
||||
434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373, 336,
|
||||
398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390,
|
||||
434, 363, 360, 410, 380, 408, 409, 379, 391, 405, 433, 407, 396, 358, 427,
|
||||
419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
|
||||
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393,
|
||||
417, 421, 341, 391, 348, 375, 426, 416, 344, 398, 413, 412, 426, 433, 340,
|
||||
355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382,
|
||||
334, 401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406,
|
||||
789, 352, 372, 401, 375, 368, 428, 401, 395, 440, 369, 439, 381, 431, 412,
|
||||
350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
|
||||
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362, 380, 406, 353, 354, 389, 416, 425, 346,
|
||||
432, 415, 393, 415, 367, 388, 401, 417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399, 418,
|
||||
363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393, 425, 426, 424, 379, 411, 426, 415, 445, 427,
|
||||
398, 435, 405, 432, 427, 417, 420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407, 414, 342,
|
||||
369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426, 352, 386, 353, 405, 435, 362, 375, 419, 388, 381,
|
||||
376, 335, 382, 426, 389, 382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421, 420, 402, 355,
|
||||
341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339, 424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405,
|
||||
426, 439, 349, 410, 414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404, 419, 403, 826, 408,
|
||||
435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344, 382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355,
|
||||
342, 362, 375, 400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399, 1598, 422, 387, 367,
|
||||
422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439, 353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557,
|
||||
339, 430, 850, 408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148, 702, 407, 396, 436, 370,
|
||||
378, 434, 416, 409, 388, 401, 397, 350, 419, 846, 375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415,
|
||||
435, 360, 396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344, 421, 360, 403, 409, 405, 350,
|
||||
393, 375, 368, 421, 351, 365, 419, 350, 416, 434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373,
|
||||
336, 398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390, 434, 363, 360, 410, 380, 408, 409,
|
||||
379, 391, 405, 433, 407, 396, 358, 427, 419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
|
||||
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393, 417, 421, 341, 391, 348, 375, 426, 416,
|
||||
344, 398, 413, 412, 426, 433, 340, 355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382, 334,
|
||||
401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406, 789, 352, 372, 401, 375, 368, 428, 401, 395,
|
||||
440, 369, 439, 381, 431, 412, 350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
|
||||
],
|
||||
"percentileMs": {
|
||||
"50": 40.7,
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
"@babel/preset-react": "^7.16.7",
|
||||
"@swc/core": "^1.2.133",
|
||||
"benchmark": "^2.1.4",
|
||||
"braces": "^3.0.2",
|
||||
"esbuild": "^0.14.12",
|
||||
"eventemitter3": "^5.0.0",
|
||||
"mitata": "^0.1.6"
|
||||
"execa": "^8.0.1",
|
||||
"fast-glob": "3.3.1",
|
||||
"fdir": "^6.1.0",
|
||||
"mitata": "^0.1.6",
|
||||
"string-width": "^7.0.0",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
"ffi": "cd ffi && bun run deps && bun run build && bun run bench",
|
||||
@@ -19,6 +25,5 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"fast-deep-equal": "^3.1.3"
|
||||
},
|
||||
"prettier": "../.prettierrc.cjs"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,30 @@ bench("await 1", async function () {
|
||||
return await 1;
|
||||
});
|
||||
|
||||
function callnextTick(resolve) {
|
||||
process.nextTick(resolve);
|
||||
}
|
||||
if (typeof process !== "undefined") {
|
||||
bench("process.nextTick x 100", async function () {
|
||||
var remaining = 100;
|
||||
var cb, promise;
|
||||
promise = new Promise(resolve => {
|
||||
cb = resolve;
|
||||
});
|
||||
|
||||
function awaitNextTick() {
|
||||
return new Promise(callnextTick);
|
||||
}
|
||||
for (let i = 0; i < 100; i++) {
|
||||
process.nextTick(() => {
|
||||
if (--remaining === 0) cb();
|
||||
});
|
||||
}
|
||||
|
||||
bench("promise.nextTick", async function () {
|
||||
return awaitNextTick();
|
||||
});
|
||||
return promise;
|
||||
});
|
||||
|
||||
bench("await 1 x 100", async function () {
|
||||
for (let i = 0; i < 100; i++) await 1;
|
||||
});
|
||||
}
|
||||
|
||||
bench("await new Promise(resolve => resolve())", async function () {
|
||||
await new Promise(resolve => resolve());
|
||||
});
|
||||
bench("Promise.all(Array.from({length: 100}, () => new Promise((resolve) => resolve())))", async function () {
|
||||
return Promise.all(Array.from({ length: 100 }, () => Promise.resolve(1)));
|
||||
});
|
||||
|
||||
await run();
|
||||
|
||||
54
bench/snippets/buffer-concat.mjs
Normal file
54
bench/snippets/buffer-concat.mjs
Normal file
@@ -0,0 +1,54 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
|
||||
const first = Buffer.allocUnsafe(size);
|
||||
const second = Buffer.allocUnsafe(size);
|
||||
const third = Buffer.allocUnsafe(size);
|
||||
first.fill(1);
|
||||
second.fill(2);
|
||||
third.fill(3);
|
||||
|
||||
const check = true;
|
||||
|
||||
const buffers = [first, second, third];
|
||||
|
||||
const fmt =
|
||||
size > 1024 * 1024
|
||||
? new Intl.NumberFormat(undefined, { unit: "megabyte", style: "unit" })
|
||||
: size > 1024
|
||||
? new Intl.NumberFormat(undefined, { unit: "kilobyte", style: "unit" })
|
||||
: new Intl.NumberFormat(undefined, { unit: "byte", style: "unit" });
|
||||
|
||||
bench(
|
||||
`Buffer.concat(${fmt.format(
|
||||
Number((size > 1024 * 1024 ? size / 1024 / 1024 : size > 1024 ? size / 1024 : size).toFixed(2)),
|
||||
)} x 3)`,
|
||||
() => {
|
||||
const result = Buffer.concat(buffers);
|
||||
if (check) {
|
||||
if (result.byteLength != size * 3) throw new Error("Wrong length");
|
||||
if (result[0] != 1) throw new Error("Wrong first byte");
|
||||
if (result[size] != 2) throw new Error("Wrong second byte");
|
||||
if (result[size * 2] != 3) throw new Error("Wrong third byte");
|
||||
|
||||
result[0] = 10;
|
||||
if (first[0] != 1) throw new Error("First buffer was modified");
|
||||
|
||||
result[size] = 20;
|
||||
if (second[0] != 2) throw new Error("Second buffer was modified");
|
||||
|
||||
result[size * 2] = 30;
|
||||
if (third[0] != 3) throw new Error("Third buffer was modified");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const chunk = Buffer.alloc(16);
|
||||
chunk.fill("3");
|
||||
const array = Array.from({ length: 100 }, () => chunk);
|
||||
bench("Buffer.concat 100 tiny chunks", () => {
|
||||
return Buffer.concat(array);
|
||||
});
|
||||
|
||||
await run();
|
||||
7
bench/snippets/crypto-randomUUID.mjs
Normal file
7
bench/snippets/crypto-randomUUID.mjs
Normal file
@@ -0,0 +1,7 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
bench("crypto.randomUUID()", () => {
|
||||
return crypto.randomUUID();
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -1,9 +1,9 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
// pure JS implementation will optimze this out
|
||||
// bench("new Headers", function () {
|
||||
// return new Headers();
|
||||
// });
|
||||
bench("new Headers", function () {
|
||||
return new Headers();
|
||||
});
|
||||
|
||||
var big = new Headers({
|
||||
"Content-Type": "text/plain",
|
||||
@@ -17,17 +17,128 @@ var big = new Headers({
|
||||
"X-Yet-Another-Custom-Headz": "Hello Worlda",
|
||||
});
|
||||
|
||||
// bench("Header.get", function () {
|
||||
// return big.get("Content-Type");
|
||||
// });
|
||||
bench("new Headers([])", () => {
|
||||
return new Headers([]);
|
||||
});
|
||||
|
||||
// bench("Header.set (standard)", function () {
|
||||
// return big.set("Content-Type", "text/html");
|
||||
// });
|
||||
bench("new Headers({})", () => {
|
||||
return new Headers({});
|
||||
});
|
||||
|
||||
// bench("Header.set (non-standard)", function () {
|
||||
// return big.set("X-My-Custom", "text/html123");
|
||||
// });
|
||||
bench("new Headers(object)", () => {
|
||||
return new Headers({
|
||||
"Content-Type": "text/plain",
|
||||
"Content-Length": "123",
|
||||
"User-Agent": "node-fetch/1.0",
|
||||
});
|
||||
});
|
||||
|
||||
bench("new Headers(hugeObject)", () => {
|
||||
return new Headers({
|
||||
"Accept": "123",
|
||||
"Accept-Charset": "123",
|
||||
"Accept-Language": "123",
|
||||
"Accept-Encoding": "123",
|
||||
"Accept-Ranges": "123",
|
||||
"Access-Control-Allow-Credentials": "123",
|
||||
"Access-Control-Allow-Headers": "123",
|
||||
"Access-Control-Allow-Methods": "123",
|
||||
"Access-Control-Allow-Origin": "123",
|
||||
"Access-Control-Expose-Headers": "123",
|
||||
"Access-Control-Max-Age": "123",
|
||||
"Access-Control-Request-Headers": "123",
|
||||
"Access-Control-Request-Method": "123",
|
||||
"Age": "123",
|
||||
"Authorization": "123",
|
||||
"Cache-Control": "123",
|
||||
"Connection": "123",
|
||||
"Content-Disposition": "123",
|
||||
"Content-Encoding": "123",
|
||||
"Content-Language": "123",
|
||||
"Content-Length": "123",
|
||||
"Content-Location": "123",
|
||||
"Content-Security-Policy": "123",
|
||||
"Content-Security-Policy-Report-Only": "123",
|
||||
"Content-Type": "123",
|
||||
"Content-Range": "123",
|
||||
"Cookie": "123",
|
||||
"Cookie2": "123",
|
||||
"Cross-Origin-Embedder-Policy": "123",
|
||||
"Cross-Origin-Embedder-Policy-Report-Only": "123",
|
||||
"Cross-Origin-Opener-Policy": "123",
|
||||
"Cross-Origin-Opener-Policy-Report-Only": "123",
|
||||
"Cross-Origin-Resource-Policy": "123",
|
||||
"Date": "123",
|
||||
"DNT": "123",
|
||||
"Default-Style": "123",
|
||||
"ETag": "123",
|
||||
"Expect": "123",
|
||||
"Expires": "123",
|
||||
"Host": "123",
|
||||
"If-Match": "123",
|
||||
"If-Modified-Since": "123",
|
||||
"If-None-Match": "123",
|
||||
"If-Range": "123",
|
||||
"If-Unmodified-Since": "123",
|
||||
"Keep-Alive": "123",
|
||||
"Last-Event-ID": "123",
|
||||
"Last-Modified": "123",
|
||||
"Link": "123",
|
||||
"Location": "123",
|
||||
"Origin": "123",
|
||||
"Ping-From": "123",
|
||||
"Ping-To": "123",
|
||||
"Purpose": "123",
|
||||
"Pragma": "123",
|
||||
"Proxy-Authorization": "123",
|
||||
"Range": "123",
|
||||
"Referer": "123",
|
||||
"Referrer-Policy": "123",
|
||||
"Refresh": "123",
|
||||
"Report-To": "123",
|
||||
"Sec-Fetch-Dest": "123",
|
||||
"Sec-Fetch-Mode": "123",
|
||||
"Sec-WebSocket-Accept": "123",
|
||||
"Sec-WebSocket-Extensions": "123",
|
||||
"Sec-WebSocket-Key": "123",
|
||||
"Sec-WebSocket-Protocol": "123",
|
||||
"Sec-WebSocket-Version": "123",
|
||||
"Server-Timing": "123",
|
||||
"Service-Worker": "123",
|
||||
"Service-Worker-Allowed": "123",
|
||||
"Service-Worker-Navigation-Preload": "123",
|
||||
"Set-Cookie": "123",
|
||||
"Set-Cookie2": "123",
|
||||
"SourceMap": "123",
|
||||
"TE": "123",
|
||||
"Timing-Allow-Origin": "123",
|
||||
"Trailer": "123",
|
||||
"Transfer-Encoding": "123",
|
||||
"Upgrade": "123",
|
||||
"Upgrade-Insecure-Requests": "123",
|
||||
"User-Agent": "123",
|
||||
"Vary": "123",
|
||||
"Via": "123",
|
||||
"X-Content-Type-Options": "123",
|
||||
"X-DNS-Prefetch-Control": "123",
|
||||
"X-Frame-Options": "123",
|
||||
"X-SourceMap": "123",
|
||||
"X-XSS-Protection": "123",
|
||||
"X-Temp-Tablet": "123",
|
||||
});
|
||||
});
|
||||
|
||||
bench("Header.get", function () {
|
||||
return big.get("Content-Type");
|
||||
});
|
||||
|
||||
bench("Header.set (standard)", function () {
|
||||
return big.set("Content-Type", "text/html");
|
||||
});
|
||||
|
||||
bench("Header.set (non-standard)", function () {
|
||||
return big.set("X-My-Custom", "text/html123");
|
||||
});
|
||||
|
||||
if (big.toJSON)
|
||||
bench("Headers.toJSON", function () {
|
||||
@@ -42,4 +153,4 @@ bench("Object.fromEntries(headers)", function () {
|
||||
return Object.fromEntries(big);
|
||||
});
|
||||
|
||||
run();
|
||||
await run();
|
||||
|
||||
@@ -4,5 +4,9 @@ var i = 0;
|
||||
const server = createServer((req, res) => {
|
||||
res.writeHead(200);
|
||||
res.end("Hello, World!" + i);
|
||||
if (i++ === 200_000 - 1) queueMicrotask(() => process.exit(0));
|
||||
if (i++ === 200_000 - 1)
|
||||
setTimeout(() => {
|
||||
console.log("RSS", (process.memoryUsage().rss / 1024 / 1024) | 0, "MB");
|
||||
process.exit(0);
|
||||
}, 0);
|
||||
}).listen(parseInt(process.env.PORT || "3000", 10));
|
||||
|
||||
52
bench/snippets/new-incomingmessage.mjs
Normal file
52
bench/snippets/new-incomingmessage.mjs
Normal file
@@ -0,0 +1,52 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { IncomingMessage } from "node:http";
|
||||
|
||||
const headers = {
|
||||
date: "Mon, 06 Nov 2023 05:12:49 GMT",
|
||||
expires: "-1",
|
||||
"cache-control": "private, max-age=0",
|
||||
"content-type": "text/html; charset=ISO-8859-1",
|
||||
"content-security-policy-report-only":
|
||||
"object-src 'none';base-uri 'self';script-src 'nonce-lcrU7l9xScCq4urW13K9gw' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp",
|
||||
"x-xss-protection": "0",
|
||||
"x-frame-options": "SAMEORIGIN",
|
||||
"accept-ranges": "none",
|
||||
vary: "Accept-Encoding",
|
||||
"transfer-encoding": "chunked",
|
||||
"set-cookie": [
|
||||
"1P_JAR=2023-11-06-05; expires=Wed, 06-Dec-2023 05:12:49 GMT; path=/; domain=.google.com; Secure",
|
||||
"AEC=Ackid1TiuGtRsmu1yaDCAdL1u1J4eM4S67simzDHfWaMPQzH-UB4DZkRwm8; expires=Sat, 04-May-2024 05:12:49 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax",
|
||||
"NID=511=jQcg9cM7vjKawWnf6f3qhs3WDIIN2gaRq3i4bdMiVRWFkaFNYmiI-Xquf1kAmWGcmDN0skldS7uHheru3CMJrWjMt56VaaqO6Pilb54jFjQS_ZJRfG3Uc7dGV5WXGV-slUGE1Bicxlajdn0E_R8tZOoWiFzFDQW7YGmyfRqWQ2k; expires=Tue, 07-May-2024 05:12:49 GMT; path=/; domain=.google.com; HttpOnly",
|
||||
],
|
||||
p3p: 'CP="This is not a P3P policy! See g.co/p3phelp for more info."',
|
||||
server: "gws",
|
||||
"alt-svc": 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
|
||||
};
|
||||
|
||||
const request = new Request("https://www.google.com/", {
|
||||
headers: new Headers(headers),
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
// const server = Bun.serve({
|
||||
// port: 8080,
|
||||
// async fetch(request) {
|
||||
// // bench("new IncomingMessage()", b => {
|
||||
// // for (let i = 0; i < 1000; i++) {
|
||||
// // new IncomingMessage(request);
|
||||
// // }
|
||||
// // });
|
||||
// const msg = new IncomingMessage(request);
|
||||
// console.log(msg.headers, msg.rawHeaders, msg.url);
|
||||
// // await run();
|
||||
// return new Response("Hello, world!");
|
||||
// },
|
||||
// });
|
||||
|
||||
bench("new IncomingMessage()", b => {
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
new IncomingMessage(request);
|
||||
}
|
||||
});
|
||||
|
||||
await run();
|
||||
31
bench/snippets/peek-promise.mjs
Normal file
31
bench/snippets/peek-promise.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { peek } from "bun";
|
||||
|
||||
let pending = Bun.sleep(1000);
|
||||
let resolved = Promise.resolve(1);
|
||||
|
||||
bench("Bun.peek - pending", () => {
|
||||
return peek(pending);
|
||||
});
|
||||
|
||||
bench("Bun.peek - resolved", () => {
|
||||
return peek(resolved);
|
||||
});
|
||||
|
||||
bench("Bun.peek - non-promise", () => {
|
||||
return peek(1);
|
||||
});
|
||||
|
||||
bench("Bun.peek.status - resolved", () => {
|
||||
return peek.status(pending);
|
||||
});
|
||||
|
||||
bench("Bun.peek.status - pending", () => {
|
||||
return peek.status(resolved);
|
||||
});
|
||||
|
||||
bench("Bun.peek.status - non-promise", () => {
|
||||
return peek.status(1);
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -77,4 +77,24 @@ bench("ConventionalPrivates", () => {
|
||||
new Foo().run();
|
||||
});
|
||||
|
||||
const _state = Symbol("state");
|
||||
const _inc = Symbol("inc");
|
||||
|
||||
bench("SymbolPrivates", () => {
|
||||
class Foo {
|
||||
[_state] = 1;
|
||||
[_inc] = 13;
|
||||
|
||||
run() {
|
||||
let n = 1000000;
|
||||
while (n-- > 0) {
|
||||
this[_state] += this[_inc];
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo().run();
|
||||
});
|
||||
|
||||
await run();
|
||||
|
||||
@@ -1,13 +1,50 @@
|
||||
import { readdirSync } from "fs";
|
||||
import { readdirSync, readdir as readdirCb } from "fs";
|
||||
import { readdir } from "fs/promises";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { argv } from "process";
|
||||
import { fileURLToPath } from "url";
|
||||
import { relative, resolve } from "path";
|
||||
import { createHash } from "crypto";
|
||||
|
||||
const dir = argv.length > 2 ? argv[2] : "/tmp";
|
||||
let dir = resolve(argv.length > 2 ? argv[2] : fileURLToPath(new URL("../../node_modules", import.meta.url)));
|
||||
if (dir.includes(process.cwd())) {
|
||||
dir = relative(process.cwd(), dir);
|
||||
}
|
||||
|
||||
const count = readdirSync(dir).length;
|
||||
bench(`readdir("${dir}")`, () => {
|
||||
readdirSync(dir, { withFileTypes: true });
|
||||
const result = await readdir(dir, { recursive: true });
|
||||
const count = result.length;
|
||||
const syncCount = readdirSync(dir, { recursive: true }).length;
|
||||
|
||||
const hash = createHash("sha256").update(result.sort().join("\n")).digest("hex");
|
||||
|
||||
bench(`await readdir("${dir}", {recursive: true})`, async () => {
|
||||
await readdir(dir, { recursive: true });
|
||||
});
|
||||
|
||||
bench(`await readdir("${dir}", {recursive: true}) x 10`, async () => {
|
||||
const promises = [
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
readdir(dir, { recursive: true }),
|
||||
];
|
||||
await Promise.all(promises);
|
||||
});
|
||||
|
||||
bench(`await readdir("${dir}", {recursive: false})`, async () => {
|
||||
await readdir(dir, { recursive: false });
|
||||
});
|
||||
|
||||
await run();
|
||||
console.log("\n\nFor", count, "files/dirs in", dir);
|
||||
console.log("\n", count, "files/dirs in", dir, "\n", "SHA256:", hash, "\n");
|
||||
|
||||
if (count !== syncCount) {
|
||||
throw new Error(`Mismatched file counts: ${count} async !== ${syncCount} sync`);
|
||||
}
|
||||
|
||||
25
bench/snippets/require-builtins.mjs
Normal file
25
bench/snippets/require-builtins.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { builtinModules } from "node:module";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { spawnSync } from "child_process";
|
||||
|
||||
for (let builtin of builtinModules) {
|
||||
const path = `/tmp/require.${builtin.replaceAll("/", "_")}.cjs`;
|
||||
await writeFile(
|
||||
path,
|
||||
`
|
||||
const builtin = ${JSON.stringify(builtin)};
|
||||
const now = require("perf_hooks").performance.now();
|
||||
require(builtin);
|
||||
const end = require("perf_hooks").performance.now();
|
||||
process.stdout.write(JSON.stringify({builtin, time: end - now}) + "\\n");
|
||||
`,
|
||||
);
|
||||
const result = spawnSync(typeof Bun !== "undefined" ? "bun" : "node", [path], {
|
||||
stdio: ["inherit", "inherit", "inherit"],
|
||||
env: {
|
||||
...process.env,
|
||||
NODE_NO_WARNINGS: "1",
|
||||
},
|
||||
});
|
||||
}
|
||||
22
bench/snippets/rmdir.mjs
Normal file
22
bench/snippets/rmdir.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
import { tmpdir } from "node:os";
|
||||
import { promises, existsSync, mkdirSync } from "node:fs";
|
||||
const count = 1024 * 12;
|
||||
|
||||
var queue = new Array(count);
|
||||
var paths = new Array(count);
|
||||
for (let i = 0; i < count; i++) {
|
||||
const path = `${tmpdir()}/${Date.now()}.rm.dir${i}`;
|
||||
try {
|
||||
mkdirSync(path);
|
||||
} catch (e) {}
|
||||
paths[i] = path;
|
||||
queue[i] = promises.rmdir(path);
|
||||
}
|
||||
|
||||
await Promise.all(queue);
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (existsSync(paths[i])) {
|
||||
throw new Error(`Path ${paths[i]} was not removed`);
|
||||
}
|
||||
}
|
||||
143
bench/snippets/semver.mjs
Normal file
143
bench/snippets/semver.mjs
Normal file
@@ -0,0 +1,143 @@
|
||||
import { satisfies } from "semver";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
const tests = [
|
||||
["~1.2.3", "1.2.3", true],
|
||||
["~1.2", "1.2.0", true],
|
||||
["~1", "1.0.0", true],
|
||||
["~1", "1.2.0", true],
|
||||
["~1", "1.2.999", true],
|
||||
["~0.2.3", "0.2.3", true],
|
||||
["~0.2", "0.2.0", true],
|
||||
["~0.2", "0.2.1", true],
|
||||
["~0 ", "0.0.0", true],
|
||||
|
||||
["~1.2.3", "1.3.0", false],
|
||||
["~1.2", "1.3.0", false],
|
||||
["~1", "2.0.0", false],
|
||||
["~0.2.3", "0.3.0", false],
|
||||
["~0.2.3", "1.0.0", false],
|
||||
["~0 ", "1.0.0", false],
|
||||
["~0.2", "0.1.0", false],
|
||||
["~0.2", "0.3.0", false],
|
||||
|
||||
["~3.0.5", "3.3.0", false],
|
||||
|
||||
["^1.1.4", "1.1.4", true],
|
||||
|
||||
[">=3", "3.5.0", true],
|
||||
[">=3", "2.999.999", false],
|
||||
[">=3", "3.5.1", true],
|
||||
[">=3.x.x", "3.x.x", false],
|
||||
|
||||
["<6 >= 5", "5.0.0", true],
|
||||
["<6 >= 5", "4.0.0", false],
|
||||
["<6 >= 5", "6.0.0", false],
|
||||
["<6 >= 5", "6.0.1", false],
|
||||
|
||||
[">2", "3", false],
|
||||
[">2", "2.1", false],
|
||||
[">2", "2", false],
|
||||
[">2", "1.0", false],
|
||||
[">1.3", "1.3.1", false],
|
||||
[">1.3", "2.0.0", true],
|
||||
[">2.1.0", "2.2.0", true],
|
||||
["<=2.2.99999", "2.2.0", true],
|
||||
[">=2.1.99999", "2.2.0", true],
|
||||
["<2.2.99999", "2.2.0", true],
|
||||
[">2.1.99999", "2.2.0", true],
|
||||
[">1.0.0", "2.0.0", true],
|
||||
["1.0.0", "1.0.0", true],
|
||||
["1.0.0", "2.0.0", false],
|
||||
|
||||
["1.0.0 || 2.0.0", "1.0.0", true],
|
||||
["2.0.0 || 1.0.0", "1.0.0", true],
|
||||
["1.0.0 || 2.0.0", "2.0.0", true],
|
||||
["2.0.0 || 1.0.0", "2.0.0", true],
|
||||
["2.0.0 || >1.0.0", "2.0.0", true],
|
||||
|
||||
[">1.0.0 <2.0.0 <2.0.1 >1.0.1", "1.0.2", true],
|
||||
|
||||
["2.x", "2.0.0", true],
|
||||
["2.x", "2.1.0", true],
|
||||
["2.x", "2.2.0", true],
|
||||
["2.x", "2.3.0", true],
|
||||
["2.x", "2.1.1", true],
|
||||
["2.x", "2.2.2", true],
|
||||
["2.x", "2.3.3", true],
|
||||
|
||||
["<2.0.1 >1.0.0", "2.0.0", true],
|
||||
["<=2.0.1 >=1.0.0", "2.0.0", true],
|
||||
|
||||
["^2", "2.0.0", true],
|
||||
["^2", "2.9.9", true],
|
||||
["~2", "2.0.0", true],
|
||||
["~2", "2.1.0", true],
|
||||
["~2.2", "2.2.1", true],
|
||||
|
||||
["2.1.0 || > 2.2 || >3", "2.1.0", true],
|
||||
[" > 2.2 || >3 || 2.1.0", "2.1.0", true],
|
||||
[" > 2.2 || 2.1.0 || >3", "2.1.0", true],
|
||||
["> 2.2 || 2.1.0 || >3", "2.3.0", true],
|
||||
["> 2.2 || 2.1.0 || >3", "2.2.1", false],
|
||||
["> 2.2 || 2.1.0 || >3", "2.2.0", false],
|
||||
["> 2.2 || 2.1.0 || >3", "2.3.0", true],
|
||||
["> 2.2 || 2.1.0 || >3", "3.0.1", true],
|
||||
["~2", "2.0.0", true],
|
||||
["~2", "2.1.0", true],
|
||||
|
||||
["1.2.0 - 1.3.0", "1.2.2", true],
|
||||
["1.2 - 1.3", "1.2.2", true],
|
||||
["1 - 1.3", "1.2.2", true],
|
||||
["1 - 1.3", "1.3.0", true],
|
||||
["1.2 - 1.3", "1.3.1", true],
|
||||
["1.2 - 1.3", "1.4.0", false],
|
||||
["1 - 1.3", "1.3.1", true],
|
||||
|
||||
["1.2 - 1.3 || 5.0", "6.4.0", false],
|
||||
["1.2 - 1.3 || 5.0", "1.2.1", true],
|
||||
["5.0 || 1.2 - 1.3", "1.2.1", true],
|
||||
["1.2 - 1.3 || 5.0", "5.0", false],
|
||||
["5.0 || 1.2 - 1.3", "5.0", false],
|
||||
["1.2 - 1.3 || 5.0", "5.0.2", true],
|
||||
["5.0 || 1.2 - 1.3", "5.0.2", true],
|
||||
["1.2 - 1.3 || 5.0", "5.0.2", true],
|
||||
["5.0 || 1.2 - 1.3", "5.0.2", true],
|
||||
["5.0 || 1.2 - 1.3 || >8", "9.0.2", true],
|
||||
];
|
||||
|
||||
bench("semver.satisfies x " + tests.length, () => {
|
||||
for (const [range, version, expected] of tests) {
|
||||
if (satisfies(version, range) !== expected) {
|
||||
throw new Error("Unexpected result for " + range + " " + version);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof Bun !== "undefined") {
|
||||
const satisfies = Bun.semver.satisfies;
|
||||
bench("Bun.semver.satisfies x " + tests.length, () => {
|
||||
for (const [range, version, expected] of tests) {
|
||||
if (satisfies(version, range) !== expected) {
|
||||
throw new Error("Unexpected result for " + range + " " + version);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bench("semver.satisfies", () => {
|
||||
const [range, version, expected] = tests[0];
|
||||
if (satisfies(version, range) !== expected) {
|
||||
throw new Error("Unexpected result for " + range + " " + version);
|
||||
}
|
||||
});
|
||||
if (typeof Bun !== "undefined") {
|
||||
const satisfies = Bun.semver.satisfies;
|
||||
bench("Bun.semver.satisfies", () => {
|
||||
const [range, version, expected] = tests[0];
|
||||
if (satisfies(version, range) !== expected) {
|
||||
throw new Error("Unexpected result for " + range + " " + version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await run();
|
||||
37
bench/snippets/shell-spawn.mjs
Normal file
37
bench/snippets/shell-spawn.mjs
Normal file
@@ -0,0 +1,37 @@
|
||||
import { $ as zx } from "zx";
|
||||
import { $ as execa$ } from "execa";
|
||||
import { bench, run, group } from "./runner.mjs";
|
||||
|
||||
const execa = execa$({ stdio: "ignore", cwd: import.meta.dirname });
|
||||
|
||||
group("echo hi", () => {
|
||||
if (typeof Bun !== "undefined")
|
||||
bench("$`echo hi`", async () => {
|
||||
await Bun.$`echo hi`.quiet();
|
||||
});
|
||||
|
||||
bench("execa`echo hi`", async () => {
|
||||
await execa`echo hi`;
|
||||
});
|
||||
|
||||
bench("zx`echo hi`", async () => {
|
||||
await zx`echo hi`.quiet();
|
||||
});
|
||||
});
|
||||
|
||||
group("ls .", () => {
|
||||
if (typeof Bun !== "undefined")
|
||||
bench("$`ls .`", async () => {
|
||||
await Bun.$`ls .`.quiet();
|
||||
});
|
||||
|
||||
bench("execa`ls .`", async () => {
|
||||
await execa`ls .`;
|
||||
});
|
||||
|
||||
bench("zx`ls .`", async () => {
|
||||
await zx`ls .`.quiet();
|
||||
});
|
||||
});
|
||||
|
||||
await run();
|
||||
44
bench/snippets/string-width.mjs
Normal file
44
bench/snippets/string-width.mjs
Normal file
@@ -0,0 +1,44 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import npmStringWidth from "string-width";
|
||||
|
||||
const bunStringWidth = globalThis?.Bun?.stringWidth;
|
||||
|
||||
bench("npm/string-width (ansi + emoji + ascii)", () => {
|
||||
npmStringWidth("hello there! 😀\u001b[31m😀😀");
|
||||
});
|
||||
|
||||
bench("npm/string-width (ansi + emoji)", () => {
|
||||
npmStringWidth("😀\u001b[31m😀😀");
|
||||
});
|
||||
|
||||
bench("npm/string-width (ansi + ascii)", () => {
|
||||
npmStringWidth("\u001b[31mhello there!");
|
||||
});
|
||||
|
||||
if (bunStringWidth) {
|
||||
bench("Bun.stringWidth (ansi + emoji + ascii)", () => {
|
||||
bunStringWidth("hello there! 😀\u001b[31m😀😀");
|
||||
});
|
||||
|
||||
bench("Bun.stringWidth (ansi + emoji)", () => {
|
||||
bunStringWidth("😀\u001b[31m😀😀");
|
||||
});
|
||||
|
||||
bench("Bun.stringWidth (ansi + ascii)", () => {
|
||||
bunStringWidth("\u001b[31mhello there!");
|
||||
});
|
||||
|
||||
if (npmStringWidth("😀\u001b[31m😀😀") !== bunStringWidth("😀\u001b[31m😀😀")) {
|
||||
console.error("string-width mismatch");
|
||||
}
|
||||
|
||||
if (npmStringWidth("hello there! 😀\u001b[31m😀😀") !== bunStringWidth("hello there! 😀\u001b[31m😀😀")) {
|
||||
console.error("string-width mismatch");
|
||||
}
|
||||
|
||||
if (npmStringWidth("\u001b[31mhello there!") !== bunStringWidth("\u001b[31mhello there!")) {
|
||||
console.error("string-width mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
await run();
|
||||
113
bench/snippets/urlsearchparams.mjs
Normal file
113
bench/snippets/urlsearchparams.mjs
Normal file
@@ -0,0 +1,113 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
// bench("new URLSearchParams({})", () => {
|
||||
// return new URLSearchParams({});
|
||||
// });
|
||||
|
||||
bench("new URLSearchParams(obj)", () => {
|
||||
return new URLSearchParams({
|
||||
"Content-Type": "text/plain",
|
||||
"Content-Length": "123",
|
||||
"User-Agent": "node-fetch/1.0",
|
||||
"Accept-Encoding": "gzip,deflate",
|
||||
"Content-Length": "0",
|
||||
"Content-Range": "bytes 0-9/10",
|
||||
});
|
||||
});
|
||||
|
||||
bench("new URLSearchParams(absurdlyHugeObject)", () => {
|
||||
return new URLSearchParams({
|
||||
"Accept": "123",
|
||||
"Accept-Charset": "123",
|
||||
"Accept-Language": "123",
|
||||
"Accept-Encoding": "123",
|
||||
"Accept-Ranges": "123",
|
||||
"Access-Control-Allow-Credentials": "123",
|
||||
"Access-Control-Allow-Headers": "123",
|
||||
"Access-Control-Allow-Methods": "123",
|
||||
"Access-Control-Allow-Origin": "123",
|
||||
"Access-Control-Expose-Headers": "123",
|
||||
"Access-Control-Max-Age": "123",
|
||||
"Access-Control-Request-Headers": "123",
|
||||
"Access-Control-Request-Method": "123",
|
||||
"Age": "123",
|
||||
"Authorization": "123",
|
||||
"Cache-Control": "123",
|
||||
"Connection": "123",
|
||||
"Content-Disposition": "123",
|
||||
"Content-Encoding": "123",
|
||||
"Content-Language": "123",
|
||||
"Content-Length": "123",
|
||||
"Content-Location": "123",
|
||||
"Content-Security-Policy": "123",
|
||||
"Content-Security-Policy-Report-Only": "123",
|
||||
"Content-Type": "123",
|
||||
"Content-Range": "123",
|
||||
"Cookie": "123",
|
||||
"Cookie2": "123",
|
||||
"Cross-Origin-Embedder-Policy": "123",
|
||||
"Cross-Origin-Embedder-Policy-Report-Only": "123",
|
||||
"Cross-Origin-Opener-Policy": "123",
|
||||
"Cross-Origin-Opener-Policy-Report-Only": "123",
|
||||
"Cross-Origin-Resource-Policy": "123",
|
||||
"Date": "123",
|
||||
"DNT": "123",
|
||||
"Default-Style": "123",
|
||||
"ETag": "123",
|
||||
"Expect": "123",
|
||||
"Expires": "123",
|
||||
"Host": "123",
|
||||
"If-Match": "123",
|
||||
"If-Modified-Since": "123",
|
||||
"If-None-Match": "123",
|
||||
"If-Range": "123",
|
||||
"If-Unmodified-Since": "123",
|
||||
"Keep-Alive": "123",
|
||||
"Last-Event-ID": "123",
|
||||
"Last-Modified": "123",
|
||||
"Link": "123",
|
||||
"Location": "123",
|
||||
"Origin": "123",
|
||||
"Ping-From": "123",
|
||||
"Ping-To": "123",
|
||||
"Purpose": "123",
|
||||
"Pragma": "123",
|
||||
"Proxy-Authorization": "123",
|
||||
"Range": "123",
|
||||
"Referer": "123",
|
||||
"Referrer-Policy": "123",
|
||||
"Refresh": "123",
|
||||
"Report-To": "123",
|
||||
"Sec-Fetch-Dest": "123",
|
||||
"Sec-Fetch-Mode": "123",
|
||||
"Sec-WebSocket-Accept": "123",
|
||||
"Sec-WebSocket-Extensions": "123",
|
||||
"Sec-WebSocket-Key": "123",
|
||||
"Sec-WebSocket-Protocol": "123",
|
||||
"Sec-WebSocket-Version": "123",
|
||||
"Server-Timing": "123",
|
||||
"Service-Worker": "123",
|
||||
"Service-Worker-Allowed": "123",
|
||||
"Service-Worker-Navigation-Preload": "123",
|
||||
"Set-Cookie": "123",
|
||||
"Set-Cookie2": "123",
|
||||
"SourceMap": "123",
|
||||
"TE": "123",
|
||||
"Timing-Allow-Origin": "123",
|
||||
"Trailer": "123",
|
||||
"Transfer-Encoding": "123",
|
||||
"Upgrade": "123",
|
||||
"Upgrade-Insecure-Requests": "123",
|
||||
"User-Agent": "123",
|
||||
"Vary": "123",
|
||||
"Via": "123",
|
||||
"X-Content-Type-Options": "123",
|
||||
"X-DNS-Prefetch-Control": "123",
|
||||
"X-Frame-Options": "123",
|
||||
"X-SourceMap": "123",
|
||||
"X-XSS-Protection": "123",
|
||||
"X-Temp-Tablet": "123",
|
||||
});
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -1,7 +1,8 @@
|
||||
import { run, bench } from "mitata";
|
||||
import { Database } from "bun:sqlite";
|
||||
import { join } from "path";
|
||||
|
||||
const db = Database.open("./src/northwind.sqlite");
|
||||
const db = Database.open(join(import.meta.dir, "src", "northwind.sqlite"));
|
||||
|
||||
{
|
||||
const sql = db.prepare(`SELECT * FROM "Order"`);
|
||||
|
||||
70
biome.json
Normal file
70
biome.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": false
|
||||
},
|
||||
"javascript": {
|
||||
"parser": {
|
||||
"unsafeParameterDecoratorsEnabled": true
|
||||
},
|
||||
"formatter": {
|
||||
"arrowParentheses": "asNeeded",
|
||||
"quoteProperties": "preserve",
|
||||
"semicolons": "always",
|
||||
"trailingComma": "all",
|
||||
"indentStyle": "space",
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"indentStyle": "space"
|
||||
},
|
||||
"parser": {
|
||||
"allowComments": true,
|
||||
"allowTrailingCommas": true
|
||||
}
|
||||
},
|
||||
"vcs": {
|
||||
"clientKind": "git",
|
||||
"enabled": false,
|
||||
"root": "./"
|
||||
},
|
||||
"files": {
|
||||
"maxSize": 9128312873
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentWidth": 2,
|
||||
"lineEnding": "lf",
|
||||
"formatWithErrors": true,
|
||||
"lineWidth": 120,
|
||||
"indentStyle": "space",
|
||||
"ignore": [
|
||||
"node_modules/**",
|
||||
"test/snapshots",
|
||||
"test/fixtures",
|
||||
".next",
|
||||
"test/js/deno",
|
||||
"./src/deps",
|
||||
"./src/bun.js/WebKit/**",
|
||||
"packages/bun-polyfills",
|
||||
"./build-*",
|
||||
"./build",
|
||||
".cache",
|
||||
"out/",
|
||||
"test/transpiler/property-non-ascii-fixture.js",
|
||||
"test/transpiler/macro-test.test.ts",
|
||||
"test/transpiler/decorator-metadata.test.ts",
|
||||
"src/react-refresh.js",
|
||||
"bindings-obj/*",
|
||||
"src/deps/**",
|
||||
"./bench/react-hello-world/react-hello-world.node.js",
|
||||
"./test/cli/run/require-cache-bug-leak-fixture-large-ast.js",
|
||||
"./test/cli/run/esm-leak-fixture-large-ast.mjs"
|
||||
]
|
||||
}
|
||||
}
|
||||
286
build.zig
286
build.zig
@@ -1,31 +1,22 @@
|
||||
const std = @import("std");
|
||||
const pathRel = std.fs.path.relative;
|
||||
const builtin = @import("builtin");
|
||||
const Wyhash = @import("./src/wyhash.zig").Wyhash;
|
||||
|
||||
const zig_version = builtin.zig_version;
|
||||
|
||||
/// Do not rename this constant. It is scanned by some scripts to determine which zig version to install.
|
||||
const recommended_zig_version = "0.12.0-dev.1828+225fe6ddb";
|
||||
|
||||
var is_debug_build = false;
|
||||
fn moduleSource(comptime out: []const u8) FileSource {
|
||||
if (comptime std.fs.path.dirname(@src().file)) |base| {
|
||||
const outpath = comptime base ++ std.fs.path.sep_str ++ out;
|
||||
return FileSource.relative(outpath);
|
||||
} else {
|
||||
return FileSource.relative(out);
|
||||
}
|
||||
|
||||
fn exists(path: []const u8) bool {
|
||||
_ = std.fs.openFileAbsolute(path, .{ .mode = .read_only }) catch return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
const color_map = std.ComptimeStringMap([]const u8, .{
|
||||
&.{ "black", "30m" },
|
||||
&.{ "blue", "34m" },
|
||||
&.{ "b", "1m" },
|
||||
&.{ "d", "2m" },
|
||||
&.{ "cyan", "36m" },
|
||||
&.{ "green", "32m" },
|
||||
&.{ "magenta", "35m" },
|
||||
&.{ "red", "31m" },
|
||||
&.{ "white", "37m" },
|
||||
&.{ "yellow", "33m" },
|
||||
});
|
||||
|
||||
fn addInternalPackages(b: *Build, step: *CompileStep, _: std.mem.Allocator, _: []const u8, target: anytype) !void {
|
||||
var io: *Module = brk: {
|
||||
const io: *Module = brk: {
|
||||
if (target.isDarwin()) {
|
||||
break :brk b.createModule(.{
|
||||
.source_file = FileSource.relative("src/io/io_darwin.zig"),
|
||||
@@ -46,19 +37,50 @@ fn addInternalPackages(b: *Build, step: *CompileStep, _: std.mem.Allocator, _: [
|
||||
};
|
||||
|
||||
step.addModule("async_io", io);
|
||||
|
||||
step.addModule("zlib-internal", brk: {
|
||||
if (target.isWindows()) {
|
||||
break :brk b.createModule(.{ .source_file = FileSource.relative("src/deps/zlib.win32.zig") });
|
||||
}
|
||||
|
||||
break :brk b.createModule(.{ .source_file = FileSource.relative("src/deps/zlib.posix.zig") });
|
||||
});
|
||||
|
||||
const async_: *Module = brk: {
|
||||
if (target.isDarwin() or target.isLinux() or target.isFreeBSD()) {
|
||||
break :brk b.createModule(.{
|
||||
.source_file = FileSource.relative("src/async/posix_event_loop.zig"),
|
||||
});
|
||||
} else if (target.isWindows()) {
|
||||
break :brk b.createModule(.{
|
||||
.source_file = FileSource.relative("src/async/windows_event_loop.zig"),
|
||||
});
|
||||
}
|
||||
|
||||
break :brk b.createModule(.{
|
||||
.source_file = FileSource.relative("src/async/stub_event_loop.zig"),
|
||||
});
|
||||
};
|
||||
step.addModule("async", async_);
|
||||
}
|
||||
|
||||
const BunBuildOptions = struct {
|
||||
canary: bool = false,
|
||||
is_canary: bool = false,
|
||||
canary_revision: u32 = 0,
|
||||
sha: [:0]const u8 = "",
|
||||
version: []const u8 = "",
|
||||
baseline: bool = false,
|
||||
bindgen: bool = false,
|
||||
sizegen: bool = false,
|
||||
base_path: [:0]const u8 = "",
|
||||
tracy_callstack_depth: u16,
|
||||
|
||||
runtime_js_version: u64 = 0,
|
||||
fallback_html_version: u64 = 0,
|
||||
|
||||
tinycc: bool = true,
|
||||
project: [:0]const u8 = "",
|
||||
|
||||
pub fn updateRuntime(this: *BunBuildOptions) anyerror!void {
|
||||
if (std.fs.cwd().openFile("src/runtime.out.js", .{ .mode = .read_only })) |file| {
|
||||
defer file.close();
|
||||
@@ -89,7 +111,13 @@ const BunBuildOptions = struct {
|
||||
|
||||
pub fn step(this: BunBuildOptions, b: anytype) *std.build.OptionsStep {
|
||||
var opts = b.addOptions();
|
||||
opts.addOption(@TypeOf(this.canary), "is_canary", this.canary);
|
||||
opts.addOption(@TypeOf(this.is_canary), "is_canary", this.is_canary);
|
||||
opts.addOption(@TypeOf(this.canary_revision), "canary_revision", this.canary_revision);
|
||||
opts.addOption(
|
||||
std.SemanticVersion,
|
||||
"version",
|
||||
std.SemanticVersion.parse(this.version) catch @panic(b.fmt("Invalid version: {s}", .{this.version})),
|
||||
);
|
||||
opts.addOption(@TypeOf(this.sha), "sha", this.sha);
|
||||
opts.addOption(@TypeOf(this.baseline), "baseline", this.baseline);
|
||||
opts.addOption(@TypeOf(this.bindgen), "bindgen", this.bindgen);
|
||||
@@ -97,35 +125,15 @@ const BunBuildOptions = struct {
|
||||
opts.addOption(@TypeOf(this.base_path), "base_path", this.base_path);
|
||||
opts.addOption(@TypeOf(this.runtime_js_version), "runtime_js_version", this.runtime_js_version);
|
||||
opts.addOption(@TypeOf(this.fallback_html_version), "fallback_html_version", this.fallback_html_version);
|
||||
opts.addOption(@TypeOf(this.tinycc), "tinycc", this.tinycc);
|
||||
return opts;
|
||||
}
|
||||
};
|
||||
|
||||
// relative to the prefix
|
||||
var output_dir: []const u8 = "";
|
||||
fn panicIfNotFound(comptime filepath: []const u8) []const u8 {
|
||||
var file = std.fs.cwd().openFile(filepath, .{ .optimize = .read_only }) catch |err| {
|
||||
std.debug.panic("error: {s} opening {s}. Please ensure you've downloaded git submodules, and ran `make vendor`, `make jsc`.", .{ filepath, @errorName(err) });
|
||||
};
|
||||
file.close();
|
||||
|
||||
return filepath;
|
||||
}
|
||||
|
||||
const fmt = struct {
|
||||
pub usingnamespace @import("std").fmt;
|
||||
|
||||
pub fn hexInt(value: anytype) @TypeOf(std.fmt.fmtSliceHexLower("")) {
|
||||
return std.fmt.fmtSliceHexLower(std.mem.asBytes(&value));
|
||||
}
|
||||
|
||||
pub fn hexIntUp(value: anytype) @TypeOf(std.fmt.fmtSliceHexUpper("")) {
|
||||
return std.fmt.fmtSliceHexUpper(std.mem.asBytes(&value));
|
||||
}
|
||||
};
|
||||
|
||||
var x64 = "x64";
|
||||
var optimize: std.builtin.OptimizeMode = undefined;
|
||||
var optimize: std.builtin.OptimizeMode = .Debug;
|
||||
|
||||
const Build = std.Build;
|
||||
const CrossTarget = std.zig.CrossTarget;
|
||||
@@ -146,6 +154,26 @@ pub fn build(b: *Build) !void {
|
||||
}
|
||||
|
||||
pub fn build_(b: *Build) !void {
|
||||
switch (comptime zig_version.order(std.SemanticVersion.parse(recommended_zig_version) catch unreachable)) {
|
||||
.eq => {},
|
||||
.lt => {
|
||||
@compileError("The minimum version of Zig required to compile Bun is " ++ recommended_zig_version ++ ", found " ++ @import("builtin").zig_version_string ++ ". Please follow the instructions at https://bun.sh/docs/project/contributing. You may need to re-run `bun setup`.");
|
||||
},
|
||||
.gt => {
|
||||
const colors = std.io.getStdErr().supportsAnsiEscapeCodes();
|
||||
std.debug.print(
|
||||
"{s}WARNING:\nBun recommends Zig version '{s}', but found '{s}', build may fail...\nMake sure you are following the instructions at https://bun.sh/docs/project/contributing\n{s}You can update to the right version using 'zigup {s}'\n\n",
|
||||
.{
|
||||
if (colors) "\x1b[1;33m" else "",
|
||||
recommended_zig_version,
|
||||
builtin.zig_version_string,
|
||||
if (colors) "\x1b[0m" else "",
|
||||
recommended_zig_version,
|
||||
},
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// what target to build for. Here we do not override the defaults, which
|
||||
// means any target is allowed, and the default is native. Other options
|
||||
@@ -155,47 +183,65 @@ pub fn build_(b: *Build) !void {
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
var generated_code_directory = b.option([]const u8, "generated-code", "Set the generated code directory") orelse "";
|
||||
|
||||
if (generated_code_directory.len == 0) {
|
||||
generated_code_directory = b.pathFromRoot("build/codegen");
|
||||
}
|
||||
|
||||
var output_dir_buf = std.mem.zeroes([4096]u8);
|
||||
var bin_label = if (optimize == std.builtin.OptimizeMode.Debug) "packages/debug-bun-" else "packages/bun-";
|
||||
const bin_label = if (optimize == std.builtin.OptimizeMode.Debug) "packages/debug-bun-" else "packages/bun-";
|
||||
|
||||
var triplet_buf: [64]u8 = undefined;
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
|
||||
const arch: std.Target.Cpu.Arch = target.getCpuArch();
|
||||
|
||||
if (std.mem.eql(u8, os_tagname, "macos")) {
|
||||
os_tagname = "darwin";
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{ .semver = .{ .major = 11, .minor = 0, .patch = 0 } };
|
||||
} else if (target.isLinux()) {
|
||||
target.setGnuLibCVersion(2, 27, 0);
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
|
||||
switch (target.getOs().tag) {
|
||||
.macos => {
|
||||
os_tagname = "darwin";
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{ .semver = .{ .major = 11, .minor = 0, .patch = 0 } };
|
||||
},
|
||||
.windows => {
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{
|
||||
// Windows 1809
|
||||
// Minimum version for a syscall related to bun.sys.renameat
|
||||
// if you update this please update install.ps1
|
||||
.windows = .win10_rs5,
|
||||
};
|
||||
},
|
||||
.linux => {
|
||||
target.setGnuLibCVersion(2, 27, 0);
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
std.mem.copy(
|
||||
u8,
|
||||
&triplet_buf,
|
||||
os_tagname,
|
||||
);
|
||||
var osname = triplet_buf[0..os_tagname.len];
|
||||
|
||||
@memcpy(triplet_buf[0..].ptr, os_tagname);
|
||||
const osname = triplet_buf[0..os_tagname.len];
|
||||
triplet_buf[osname.len] = '-';
|
||||
|
||||
std.mem.copy(u8, triplet_buf[osname.len + 1 ..], @tagName(target.getCpuArch()));
|
||||
@memcpy(triplet_buf[osname.len + 1 ..].ptr, @tagName(target.getCpuArch()));
|
||||
var cpuArchName = triplet_buf[osname.len + 1 ..][0..@tagName(target.getCpuArch()).len];
|
||||
std.mem.replaceScalar(u8, cpuArchName, '_', '-');
|
||||
if (std.mem.eql(u8, cpuArchName, "x86-64")) {
|
||||
std.mem.copy(u8, cpuArchName, "x64");
|
||||
@memcpy(cpuArchName.ptr, "x64");
|
||||
cpuArchName = cpuArchName[0..3];
|
||||
}
|
||||
|
||||
var triplet = triplet_buf[0 .. osname.len + cpuArchName.len + 1];
|
||||
const triplet = triplet_buf[0 .. osname.len + cpuArchName.len + 1];
|
||||
|
||||
if (b.option([]const u8, "output-dir", "target to install to") orelse std.os.getenv("OUTPUT_DIR")) |output_dir_| {
|
||||
output_dir = try pathRel(b.allocator, b.install_prefix, output_dir_);
|
||||
const outfile_maybe = b.option([]const u8, "output-file", "target to install to");
|
||||
|
||||
if (outfile_maybe) |outfile| {
|
||||
output_dir = try pathRel(b.allocator, b.install_prefix, std.fs.path.dirname(outfile) orelse "");
|
||||
} else {
|
||||
const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{s}{s}", .{ bin_label, triplet });
|
||||
output_dir = try pathRel(b.allocator, b.install_prefix, output_dir_base);
|
||||
}
|
||||
|
||||
is_debug_build = optimize == OptimizeMode.Debug;
|
||||
const bun_executable_name = if (optimize == std.builtin.OptimizeMode.Debug) "bun-debug" else "bun";
|
||||
const bun_executable_name = if (outfile_maybe) |outfile| std.fs.path.basename(outfile[0 .. outfile.len - std.fs.path.extension(outfile).len]) else if (is_debug_build) "bun-debug" else "bun";
|
||||
const root_src = if (target.getOsTag() == std.Target.Os.Tag.freestanding)
|
||||
"root_wasm.zig"
|
||||
else
|
||||
@@ -217,10 +263,31 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative(root_src),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = .{ .cwd_relative = b.pathFromRoot(".") },
|
||||
.main_mod_path = .{ .cwd_relative = b.pathFromRoot(".") },
|
||||
});
|
||||
|
||||
b.reference_trace = 16;
|
||||
if (!exists(b.pathFromRoot(try std.fs.path.join(b.allocator, &.{
|
||||
"src",
|
||||
"js_lexer",
|
||||
"id_continue_bitset.blob",
|
||||
})))) {
|
||||
const identifier_data = b.pathFromRoot(try std.fs.path.join(b.allocator, &.{ "src", "js_lexer", "identifier_data.zig" }));
|
||||
var run_step = b.addSystemCommand(&.{
|
||||
b.zig_exe,
|
||||
"run",
|
||||
identifier_data,
|
||||
});
|
||||
run_step.has_side_effects = true;
|
||||
obj.step.dependOn(&run_step.step);
|
||||
}
|
||||
|
||||
b.reference_trace = if (b.option(u32, "reference-trace", "Set the reference trace")) |trace|
|
||||
if (trace == 0)
|
||||
null
|
||||
else
|
||||
trace
|
||||
else
|
||||
16;
|
||||
|
||||
var default_build_options: BunBuildOptions = brk: {
|
||||
const is_baseline = arch.isX86() and (target.cpu_model == .baseline or
|
||||
@@ -231,7 +298,7 @@ pub fn build_(b: *Build) !void {
|
||||
git_sha = b.allocator.dupeZ(u8, sha) catch unreachable;
|
||||
} else {
|
||||
sha: {
|
||||
const result = std.ChildProcess.exec(.{
|
||||
const result = std.ChildProcess.run(.{
|
||||
.allocator = b.allocator,
|
||||
.argv = &.{
|
||||
"git",
|
||||
@@ -246,13 +313,22 @@ pub fn build_(b: *Build) !void {
|
||||
}
|
||||
}
|
||||
|
||||
const is_canary = (std.os.getenvZ("BUN_CANARY") orelse "0")[0] == '1';
|
||||
const is_canary, const canary_revision = if (b.option(u32, "canary", "Treat this as a canary build")) |rev|
|
||||
if (rev == 0)
|
||||
.{ false, 0 }
|
||||
else
|
||||
.{ true, rev }
|
||||
else
|
||||
.{ false, 0 };
|
||||
break :brk .{
|
||||
.canary = is_canary,
|
||||
.is_canary = is_canary,
|
||||
.canary_revision = canary_revision,
|
||||
.version = b.option([]const u8, "version", "Value of `Bun.version`") orelse "0.0.0",
|
||||
.sha = git_sha,
|
||||
.baseline = is_baseline,
|
||||
.bindgen = false,
|
||||
.base_path = try b.allocator.dupeZ(u8, b.pathFromRoot(".")),
|
||||
.tracy_callstack_depth = b.option(u16, "tracy_callstack_depth", "") orelse 10,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -269,10 +345,12 @@ pub fn build_(b: *Build) !void {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 };
|
||||
} else if (arch.isX86()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.x86.cpu.haswell };
|
||||
} else if (arch.isAARCH64() and target.isDarwin()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_m1 };
|
||||
} else if (arch.isAARCH64() and target.isLinux()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic };
|
||||
} else if (arch.isAARCH64()) {
|
||||
if (target.isDarwin()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_m1 };
|
||||
} else {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic };
|
||||
}
|
||||
}
|
||||
|
||||
try default_build_options.updateRuntime();
|
||||
@@ -283,8 +361,8 @@ pub fn build_(b: *Build) !void {
|
||||
min_version,
|
||||
max_version,
|
||||
obj.target.getCpuModel().name,
|
||||
}) catch unreachable;
|
||||
std.io.getStdErr().writer().print("Output: {s}/{s}\n\n", .{ output_dir, bun_executable_name }) catch unreachable;
|
||||
}) catch {};
|
||||
std.io.getStdErr().writer().print("Zig v{s}\n", .{builtin.zig_version_string}) catch {};
|
||||
|
||||
defer obj_step.dependOn(&obj.step);
|
||||
|
||||
@@ -301,15 +379,26 @@ pub fn build_(b: *Build) !void {
|
||||
actual_build_options.sizegen = true;
|
||||
}
|
||||
|
||||
actual_build_options.project = "bun";
|
||||
obj.addOptions("build_options", actual_build_options.step(b));
|
||||
|
||||
obj.linkLibC();
|
||||
// Generated Code
|
||||
// TODO: exit with a better error early if these files do not exist. it is an indication someone ran `zig build` directly without the code generators.
|
||||
obj.addModule("ZigGeneratedClasses", b.createModule(.{
|
||||
.source_file = .{ .path = b.pathJoin(&.{ generated_code_directory, "ZigGeneratedClasses.zig" }) },
|
||||
}));
|
||||
obj.addModule("ResolvedSourceTag", b.createModule(.{
|
||||
.source_file = .{ .path = b.pathJoin(&.{ generated_code_directory, "ResolvedSourceTag.zig" }) },
|
||||
}));
|
||||
|
||||
obj.linkLibC();
|
||||
obj.dll_export_fns = true;
|
||||
obj.strip = false;
|
||||
obj.bundle_compiler_rt = false;
|
||||
obj.omit_frame_pointer = optimize != .Debug;
|
||||
obj.subsystem = .Console;
|
||||
|
||||
// Disable stack probing on x86 so we don't need to include compiler_rt
|
||||
if (target.getCpuArch().isX86()) obj.disable_stack_probing = true;
|
||||
if (target.getCpuArch().isX86() or target.isWindows()) obj.disable_stack_probing = true;
|
||||
|
||||
if (b.option(bool, "for-editor", "Do not emit bin, just check for errors") orelse false) {
|
||||
// obj.emit_bin = .no_emit;
|
||||
@@ -331,7 +420,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("src/bindgen.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -348,7 +437,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("root_wasm.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer wasm_step.dependOn(&wasm.step);
|
||||
wasm.strip = false;
|
||||
@@ -367,7 +456,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("misctools/http_bench.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -381,7 +470,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("misctools/machbench.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -395,7 +484,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("misctools/fetch.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -409,7 +498,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("src/bench/string-handling.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -423,7 +512,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("src/sha.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -437,7 +526,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("src/sourcemap/vlq_bench.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -451,7 +540,7 @@ pub fn build_(b: *Build) !void {
|
||||
.root_source_file = FileSource.relative("misctools/tgz.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
defer headers_step.dependOn(&headers_obj.step);
|
||||
try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target);
|
||||
@@ -461,14 +550,14 @@ pub fn build_(b: *Build) !void {
|
||||
{
|
||||
const headers_step = b.step("test", "Build test");
|
||||
|
||||
var test_file = b.option([]const u8, "test-file", "Input file for test");
|
||||
var test_bin_ = b.option([]const u8, "test-bin", "Emit bin to");
|
||||
var test_filter = b.option([]const u8, "test-filter", "Filter for test");
|
||||
const test_file = b.option([]const u8, "test-file", "Input file for test");
|
||||
const test_bin_ = b.option([]const u8, "test-bin", "Emit bin to");
|
||||
const test_filter = b.option([]const u8, "test-filter", "Filter for test");
|
||||
|
||||
var headers_obj: *CompileStep = b.addTest(.{
|
||||
.root_source_file = FileSource.relative(test_file orelse "src/main.zig"),
|
||||
.target = target,
|
||||
.main_pkg_path = obj.main_pkg_path,
|
||||
.main_mod_path = obj.main_mod_path,
|
||||
});
|
||||
headers_obj.filter = test_filter;
|
||||
if (test_bin_) |test_bin| {
|
||||
@@ -490,7 +579,20 @@ pub fn build_(b: *Build) !void {
|
||||
headers_obj.addOptions("build_options", default_build_options.step(b));
|
||||
}
|
||||
|
||||
b.default_step.dependOn(obj_step);
|
||||
// Running `zig build` with no arguments is almost always a mistake.
|
||||
const mistake_message = b.addSystemCommand(&.{
|
||||
"echo",
|
||||
\\
|
||||
\\error: To build Bun from source, please use `bun run setup` instead of `zig build`"
|
||||
\\
|
||||
\\If you want to build the zig code only, run:
|
||||
\\ 'zig build obj -Dgenerated-code=./build/codegen [...opts]'
|
||||
\\
|
||||
\\For more info, see https://bun.sh/docs/project/contributing
|
||||
\\
|
||||
});
|
||||
|
||||
b.default_step.dependOn(&mistake_message.step);
|
||||
}
|
||||
|
||||
pub var original_make_fn: ?*const fn (step: *std.build.Step) anyerror!void = null;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#/usr/bin/env bash
|
||||
|
||||
_file_arguments() {
|
||||
shopt -s extglob globstar
|
||||
local extensions="${1}";
|
||||
local extensions="${1}"
|
||||
local reset=$(shopt -p globstar)
|
||||
shopt -s globstar
|
||||
|
||||
if [[ -z "${cur_word}" ]]; then
|
||||
COMPREPLY=( $(compgen -fG -X "${extensions}" -- "${cur_word}") );
|
||||
else
|
||||
COMPREPLY=( $(compgen -f -X "${extensions}" -- "${cur_word}") );
|
||||
fi
|
||||
shopt -u extglob globstar
|
||||
|
||||
$reset
|
||||
}
|
||||
|
||||
_long_short_completion() {
|
||||
@@ -43,9 +45,7 @@ _read_scripts_in_package_json() {
|
||||
local package_json_compreply;
|
||||
local matched="${BASH_REMATCH[@]:1}";
|
||||
local scripts="${matched%%\}*}";
|
||||
shopt -s extglob;
|
||||
scripts="${scripts//@(\"|\')/}";
|
||||
shopt -u extglob;
|
||||
readarray -td, scripts <<<"${scripts}";
|
||||
for completion in "${scripts[@]}"; do
|
||||
package_json_compreply+=( "${completion%:*}" );
|
||||
@@ -84,7 +84,7 @@ _bun_completions() {
|
||||
|
||||
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x";
|
||||
|
||||
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js";
|
||||
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --env-file --extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js";
|
||||
GLOBAL_OPTIONS[SHORT_OPTIONS]="-c -v -d -e -h -i -l -u -p";
|
||||
|
||||
PACKAGE_OPTIONS[ADD_OPTIONS_LONG]="--development --optional";
|
||||
|
||||
@@ -51,7 +51,7 @@ function __bun_last_cmd --argument-names n
|
||||
end
|
||||
|
||||
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
|
||||
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependenices" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
|
||||
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependencies" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
|
||||
|
||||
set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init link unlink pm x
|
||||
set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
|
||||
|
||||
1351
completions/bun.zsh
1351
completions/bun.zsh
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,9 @@ subcommands:
|
||||
- name: server-bunfile
|
||||
type: string
|
||||
summary: "Use a specific .bun file for SSR in bun dev (default: node_modules.server.bun)"
|
||||
- name: env-file
|
||||
type: string
|
||||
summary: "Load environment variables from the specified file(s)"
|
||||
- name: extension-order
|
||||
type: string
|
||||
summary: "defaults to: .tsx,.ts,.jsx,.js,.json"
|
||||
@@ -118,7 +121,7 @@ subcommands:
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- name: cache-dir
|
||||
type: string
|
||||
summary: "Store & load cached data from a specific directory path"
|
||||
@@ -153,7 +156,7 @@ subcommands:
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- no-cache -- "Ignore manifest cache entirely"
|
||||
- silent -- "Don't output anything"
|
||||
- verbose -- "Excessively verbose logging"
|
||||
@@ -191,7 +194,7 @@ subcommands:
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- name: cache-dir
|
||||
type: string
|
||||
summary: "Store & load cached data from a specific directory path"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# bun:alpine
|
||||
# Not officially supported (yet)
|
||||
|
||||
ARG GLIBC_RELEASE=2.35-r0
|
||||
|
||||
FROM alpine:latest AS build
|
||||
|
||||
WORKDIR /tmp
|
||||
RUN apk --no-cache add unzip
|
||||
|
||||
ARG GLIBC_RELEASE
|
||||
RUN wget https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
|
||||
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_RELEASE}/glibc-${GLIBC_RELEASE}.apk
|
||||
|
||||
ADD https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip bun-linux-x64.zip
|
||||
RUN unzip bun-linux-x64.zip
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
ARG GLIBC_RELEASE
|
||||
COPY --from=build /tmp/sgerrand.rsa.pub /etc/apk/keys
|
||||
COPY --from=build /tmp/glibc-${GLIBC_RELEASE}.apk /tmp
|
||||
COPY --from=build /tmp/bun-linux-x64/bun /usr/local/bin
|
||||
|
||||
RUN apk --no-cache --force-overwrite add /tmp/glibc-${GLIBC_RELEASE}.apk \
|
||||
&& rm /etc/apk/keys/sgerrand.rsa.pub \
|
||||
&& rm /tmp/glibc-${GLIBC_RELEASE}.apk
|
||||
|
||||
RUN bun --version
|
||||
@@ -1,77 +0,0 @@
|
||||
FROM debian:bullseye-slim AS build
|
||||
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=latest
|
||||
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get install -qq --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
dirmngr \
|
||||
gpg \
|
||||
gpg-agent \
|
||||
unzip \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& arch="$(dpkg --print-architecture)" \
|
||||
&& case "${arch##*-}" in \
|
||||
amd64) build="x64-baseline";; \
|
||||
arm64) build="aarch64";; \
|
||||
*) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
|
||||
esac \
|
||||
&& version="$BUN_VERSION" \
|
||||
&& case "$version" in \
|
||||
latest | canary | bun-v*) tag="$version"; ;; \
|
||||
v*) tag="bun-$version"; ;; \
|
||||
*) tag="bun-v$version"; ;; \
|
||||
esac \
|
||||
&& case "$tag" in \
|
||||
latest) release="latest/download"; ;; \
|
||||
*) release="download/$tag"; ;; \
|
||||
esac \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/bun-linux-$build.zip" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: unknown release: ($tag)" && exit 1) \
|
||||
&& for key in \
|
||||
"F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
|
||||
; do \
|
||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
|
||||
|| gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done \
|
||||
&& gpg --update-trustdb \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
&& grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
&& unzip "bun-linux-$build.zip" \
|
||||
&& mv "bun-linux-$build/bun" /usr/local/bin/bun \
|
||||
&& rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
|
||||
&& chmod +x /usr/local/bin/bun \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
RUN groupadd bun \
|
||||
--gid 1000 \
|
||||
&& useradd bun \
|
||||
--uid 1000 \
|
||||
--gid bun \
|
||||
--shell /bin/sh \
|
||||
--create-home
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bunx /usr/local/bin
|
||||
|
||||
WORKDIR /home/bun/app
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["/usr/local/bin/bun"]
|
||||
118
dockerhub/alpine/Dockerfile
Normal file
118
dockerhub/alpine/Dockerfile
Normal file
@@ -0,0 +1,118 @@
|
||||
FROM alpine:3.18 AS build
|
||||
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=latest
|
||||
|
||||
# TODO: Instead of downloading glibc from a third-party source, we should
|
||||
# build it from source. This is a temporary solution.
|
||||
# See: https://github.com/sgerrand/alpine-pkg-glibc
|
||||
|
||||
# https://github.com/sgerrand/alpine-pkg-glibc/releases
|
||||
# https://github.com/sgerrand/alpine-pkg-glibc/issues/176
|
||||
ARG GLIBC_VERSION=2.34-r0
|
||||
|
||||
# https://github.com/oven-sh/bun/issues/5545#issuecomment-1722461083
|
||||
ARG GLIBC_VERSION_AARCH64=2.26-r1
|
||||
|
||||
RUN apk --no-cache add \
|
||||
ca-certificates \
|
||||
curl \
|
||||
dirmngr \
|
||||
gpg \
|
||||
gpg-agent \
|
||||
unzip \
|
||||
&& arch="$(apk --print-arch)" \
|
||||
&& case "${arch##*-}" in \
|
||||
x86_64) build="x64-baseline";; \
|
||||
aarch64) build="aarch64";; \
|
||||
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
|
||||
esac \
|
||||
&& version="$BUN_VERSION" \
|
||||
&& case "$version" in \
|
||||
latest | canary | bun-v*) tag="$version"; ;; \
|
||||
v*) tag="bun-$version"; ;; \
|
||||
*) tag="bun-v$version"; ;; \
|
||||
esac \
|
||||
&& case "$tag" in \
|
||||
latest) release="latest/download"; ;; \
|
||||
*) release="download/$tag"; ;; \
|
||||
esac \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/bun-linux-$build.zip" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: failed to download: $tag" && exit 1) \
|
||||
&& for key in \
|
||||
"F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
|
||||
; do \
|
||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
|
||||
|| gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& unzip "bun-linux-$build.zip" \
|
||||
&& mv "bun-linux-$build/bun" /usr/local/bin/bun \
|
||||
&& rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
|
||||
&& chmod +x /usr/local/bin/bun \
|
||||
&& cd /tmp \
|
||||
&& case "${arch##*-}" in \
|
||||
x86_64) curl "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: failed to download: glibc v${GLIBC_VERSION}" && exit 1) \
|
||||
&& mv "glibc-${GLIBC_VERSION}.apk" glibc.apk \
|
||||
&& curl "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: failed to download: glibc-bin v${GLIBC_VERSION}" && exit 1) \
|
||||
&& mv "glibc-bin-${GLIBC_VERSION}.apk" glibc-bin.apk ;; \
|
||||
aarch64) curl "https://raw.githubusercontent.com/squishyu/alpine-pkg-glibc-aarch64-bin/master/glibc-${GLIBC_VERSION_AARCH64}.apk" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: failed to download: glibc v${GLIBC_VERSION_AARCH64}" && exit 1) \
|
||||
&& mv "glibc-${GLIBC_VERSION_AARCH64}.apk" glibc.apk \
|
||||
&& curl "https://raw.githubusercontent.com/squishyu/alpine-pkg-glibc-aarch64-bin/master/glibc-bin-${GLIBC_VERSION_AARCH64}.apk" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: failed to download: glibc-bin v${GLIBC_VERSION_AARCH64}" && exit 1) \
|
||||
&& mv "glibc-bin-${GLIBC_VERSION_AARCH64}.apk" glibc-bin.apk ;; \
|
||||
*) echo "error: unsupported architecture '$arch'"; exit 1 ;; \
|
||||
esac
|
||||
|
||||
FROM alpine:3.18
|
||||
|
||||
# Disable the runtime transpiler cache by default inside Docker containers.
|
||||
# On ephemeral containers, the cache is not useful
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
COPY --from=build /tmp/glibc.apk /tmp/
|
||||
COPY --from=build /tmp/glibc-bin.apk /tmp/
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
RUN addgroup -g 1000 bun \
|
||||
&& adduser -u 1000 -G bun -s /bin/sh -D bun \
|
||||
&& apk --no-cache --force-overwrite --allow-untrusted add \
|
||||
/tmp/glibc.apk \
|
||||
/tmp/glibc-bin.apk \
|
||||
&& rm /tmp/glibc.apk \
|
||||
&& rm /tmp/glibc-bin.apk \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
WORKDIR /home/bun/app
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["/usr/local/bin/bun"]
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM debian:bullseye-slim AS build
|
||||
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=0.5.7
|
||||
ARG BUN_VERSION=latest
|
||||
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get install -qq --no-install-recommends \
|
||||
@@ -17,7 +17,7 @@ RUN apt-get update -qq \
|
||||
&& case "${arch##*-}" in \
|
||||
amd64) build="x64-baseline";; \
|
||||
arm64) build="aarch64";; \
|
||||
*) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
|
||||
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
|
||||
esac \
|
||||
&& version="$BUN_VERSION" \
|
||||
&& case "$version" in \
|
||||
@@ -33,44 +33,49 @@ RUN apt-get update -qq \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: unknown release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to download: $tag" && exit 1) \
|
||||
&& for key in \
|
||||
"F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
|
||||
; do \
|
||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
|
||||
|| gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done \
|
||||
&& gpg --update-trustdb \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& unzip "bun-linux-$build.zip" \
|
||||
&& mv "bun-linux-$build/bun" /usr/local/bin/bun \
|
||||
&& rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
|
||||
&& chmod +x /usr/local/bin/bun \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# Disable the runtime transpiler cache by default inside Docker containers.
|
||||
# On ephemeral containers, the cache is not useful
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/bun
|
||||
|
||||
RUN groupadd bun \
|
||||
--gid 1000 \
|
||||
&& useradd bun \
|
||||
--uid 1000 \
|
||||
--gid bun \
|
||||
--shell /bin/sh \
|
||||
--create-home
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bunx /usr/local/bin
|
||||
--create-home \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
WORKDIR /home/bun/app
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM debian:bullseye-slim AS build
|
||||
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=0.5.7
|
||||
ARG BUN_VERSION=latest
|
||||
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get install -qq --no-install-recommends \
|
||||
@@ -17,7 +17,7 @@ RUN apt-get update -qq \
|
||||
&& case "${arch##*-}" in \
|
||||
amd64) build="x64-baseline";; \
|
||||
arm64) build="aarch64";; \
|
||||
*) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
|
||||
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
|
||||
esac \
|
||||
&& version="$BUN_VERSION" \
|
||||
&& case "$version" in \
|
||||
@@ -33,44 +33,47 @@ RUN apt-get update -qq \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: unknown release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to download: $tag" && exit 1) \
|
||||
&& for key in \
|
||||
"F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
|
||||
; do \
|
||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
|
||||
|| gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done \
|
||||
&& gpg --update-trustdb \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& unzip "bun-linux-$build.zip" \
|
||||
&& mv "bun-linux-$build/bun" /usr/local/bin/bun \
|
||||
&& rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
|
||||
&& chmod +x /usr/local/bin/bun \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
&& chmod +x /usr/local/bin/bun
|
||||
|
||||
FROM debian:bullseye
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/bun
|
||||
|
||||
# Disable the runtime transpiler cache by default inside Docker containers.
|
||||
# On ephemeral containers, the cache is not useful
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
RUN groupadd bun \
|
||||
--gid 1000 \
|
||||
&& useradd bun \
|
||||
--uid 1000 \
|
||||
--gid bun \
|
||||
--shell /bin/sh \
|
||||
--create-home
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bunx /usr/local/bin
|
||||
--create-home \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
WORKDIR /home/bun/app
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
FROM debian:bullseye-slim AS build
|
||||
# Not officially supported (yet)
|
||||
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=latest
|
||||
@@ -18,7 +17,7 @@ RUN apt-get update -qq \
|
||||
&& case "${arch##*-}" in \
|
||||
amd64) build="x64-baseline";; \
|
||||
arm64) build="aarch64";; \
|
||||
*) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
|
||||
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
|
||||
esac \
|
||||
&& version="$BUN_VERSION" \
|
||||
&& case "$version" in \
|
||||
@@ -34,36 +33,42 @@ RUN apt-get update -qq \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
|| (echo "error: unknown release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to download: $tag" && exit 1) \
|
||||
&& for key in \
|
||||
"F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
|
||||
; do \
|
||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
|
||||
|| gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done \
|
||||
&& gpg --update-trustdb \
|
||||
&& curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
|
||||
-fsSLO \
|
||||
--compressed \
|
||||
--retry 5 \
|
||||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
|
||||
|| (echo "error: failed to verify release: ($tag)" && exit 1) \
|
||||
|| (echo "error: failed to verify: $tag" && exit 1) \
|
||||
&& unzip "bun-linux-$build.zip" \
|
||||
&& mv "bun-linux-$build/bun" /usr/local/bin/bun \
|
||||
&& rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
|
||||
&& chmod +x /usr/local/bin/bun \
|
||||
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx \
|
||||
&& which bun \
|
||||
&& which bunx \
|
||||
&& bun --version
|
||||
|
||||
FROM gcr.io/distroless/base-nossl-debian11
|
||||
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bunx /usr/local/bin
|
||||
# Disable the runtime transpiler cache by default inside Docker containers.
|
||||
# On ephemeral containers, the cache is not useful
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/
|
||||
|
||||
# Temporarily use the `build`-stage image binaries to create a symlink:
|
||||
RUN --mount=type=bind,from=build,source=/usr/bin,target=/usr/bin \
|
||||
--mount=type=bind,from=build,source=/bin,target=/bin <<EOF
|
||||
ln -s /usr/local/bin/bun /usr/local/bin/bunx
|
||||
which bunx
|
||||
EOF
|
||||
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["/usr/local/bin/bun"]
|
||||
CMD ["/usr/local/bin/bun"]
|
||||
@@ -26,10 +26,10 @@ Below is a quick "cheat sheet" that doubles as a table of contents. Click an ite
|
||||
|
||||
---
|
||||
|
||||
<!-- - [`File`](#file)
|
||||
- _Browser only_. A subclass of `Blob` that represents a file. Has a `name` and `lastModified` timestamp. There is experimental support in Node.js v20; Bun does not support `File` yet; most of its functionality is provided by `BunFile`.
|
||||
- [`File`](#file)
|
||||
- A subclass of `Blob` that represents a file. Has a `name` and `lastModified` timestamp. There is experimental support in Node.js v20.
|
||||
|
||||
--- -->
|
||||
---
|
||||
|
||||
- [`BunFile`](#bunfile)
|
||||
- _Bun only_. A subclass of `Blob` that represents a lazily-loaded file on disk. Created with `Bun.file(path)`.
|
||||
@@ -49,7 +49,6 @@ Despite the name, it isn't an array and supports none of the array methods and o
|
||||
|
||||
```ts
|
||||
const buf = new ArrayBuffer(8);
|
||||
|
||||
buf.byteLength; // => 8
|
||||
|
||||
const slice = buf.slice(0, 4); // returns new ArrayBuffer
|
||||
@@ -66,19 +65,19 @@ Below we create a new `DataView` and set the first byte to 5.
|
||||
|
||||
```ts
|
||||
const buf = new ArrayBuffer(4);
|
||||
// [0x0, 0x0, 0x0, 0x0]
|
||||
// [0b00000000, 0b00000000, 0b00000000, 0b00000000]
|
||||
|
||||
const dv = new DataView(buf);
|
||||
dv.setUint8(0, 3); // write value 3 at byte offset 0
|
||||
dv.getUint8(0); // => 3
|
||||
// [0x11, 0x0, 0x0, 0x0]
|
||||
// [0b00000011, 0b00000000, 0b00000000, 0b00000000]
|
||||
```
|
||||
|
||||
Now let's write a `Uint16` at byte offset `1`. This requires two bytes. We're using the value `513`, which is `2 * 256 + 1`; in bytes, that's `00000010 00000001`.
|
||||
|
||||
```ts
|
||||
dv.setUint16(1, 513);
|
||||
// [0x11, 0x10, 0x1, 0x0]
|
||||
// [0b00000011, 0b00000010, 0b00000001, 0b00000000]
|
||||
|
||||
console.log(dv.getUint16(1)); // => 513
|
||||
```
|
||||
|
||||
@@ -249,6 +249,42 @@ writer.unref();
|
||||
writer.ref();
|
||||
```
|
||||
|
||||
## Directories
|
||||
|
||||
Bun's implementation of `node:fs` is fast, and we haven't implemented a Bun-specific API for reading directories just yet. For now, you should use `node:fs` for working with directories in Bun.
|
||||
|
||||
### Reading directories (readdir)
|
||||
|
||||
To read a directory in Bun, use `readdir` from `node:fs`.
|
||||
|
||||
```ts
|
||||
import { readdir } from "node:fs/promises";
|
||||
|
||||
// read all the files in the current directory
|
||||
const files = await readdir(import.meta.dir);
|
||||
```
|
||||
|
||||
#### Reading directories recursively
|
||||
|
||||
To recursively read a directory in Bun, use `readdir` with `recursive: true`.
|
||||
|
||||
```ts
|
||||
import { readdir } from "node:fs/promises";
|
||||
|
||||
// read all the files in the current directory, recursively
|
||||
const files = await readdir("../", { recursive: true });
|
||||
```
|
||||
|
||||
### Creating directories (mkdir)
|
||||
|
||||
To recursively create a directory, use `mkdir` in `node:fs`:
|
||||
|
||||
```ts
|
||||
import { mkdir } from "node:fs/promises";
|
||||
|
||||
await mkdir("path/to/dir", { recursive: true });
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
The following is a 3-line implementation of the Linux `cat` command.
|
||||
@@ -300,7 +336,7 @@ interface BunFile {
|
||||
readonly type: string;
|
||||
|
||||
text(): Promise<string>;
|
||||
stream(): Promise<ReadableStream>;
|
||||
stream(): ReadableStream;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
json(): Promise<any>;
|
||||
writer(params: { highWaterMark?: number }): FileSink;
|
||||
|
||||
@@ -46,7 +46,7 @@ router.match("/settings?foo=bar");
|
||||
kind: "dynamic",
|
||||
name: "/settings",
|
||||
pathname: "/settings?foo=bar",
|
||||
src: "https://mydomain.com/_next/static/pages/settings.tsx"
|
||||
src: "https://mydomain.com/_next/static/pages/settings.tsx",
|
||||
query: {
|
||||
foo: "bar"
|
||||
}
|
||||
@@ -64,7 +64,7 @@ router.match("/blog/my-cool-post");
|
||||
kind: "dynamic",
|
||||
name: "/blog/[slug]",
|
||||
pathname: "/blog/my-cool-post",
|
||||
src: "https://mydomain.com/_next/static/pages/blog/[slug].tsx"
|
||||
src: "https://mydomain.com/_next/static/pages/blog/[slug].tsx",
|
||||
params: {
|
||||
slug: "my-cool-post"
|
||||
}
|
||||
@@ -93,6 +93,7 @@ interface Bun {
|
||||
style: "nextjs";
|
||||
origin?: string;
|
||||
assetPrefix?: string;
|
||||
fileExtensions?: string[];
|
||||
});
|
||||
|
||||
reload(): void;
|
||||
|
||||
157
docs/api/glob.md
Normal file
157
docs/api/glob.md
Normal file
@@ -0,0 +1,157 @@
|
||||
Bun includes a fast native implementation of file globbing.
|
||||
|
||||
## Quickstart
|
||||
|
||||
**Scan a directory for files matching `*.ts`**:
|
||||
|
||||
```ts
|
||||
import { Glob } from "bun";
|
||||
|
||||
const glob = new Glob("**/*.ts");
|
||||
|
||||
// Scans the current working directory and each of its sub-directories recursively
|
||||
for await (const file of glob.scan(".")) {
|
||||
console.log(file); // => "index.ts"
|
||||
}
|
||||
```
|
||||
|
||||
**Match a string against a glob pattern**:
|
||||
|
||||
```ts
|
||||
import { Glob } from "bun";
|
||||
|
||||
const glob = new Glob("*.ts");
|
||||
|
||||
glob.match("index.ts"); // => true
|
||||
glob.match("index.js"); // => false
|
||||
```
|
||||
|
||||
`Glob` is a class which implements the following interface:
|
||||
|
||||
```ts
|
||||
class Glob {
|
||||
scan(root: string | ScanOptions): AsyncIterable<string>;
|
||||
scanSync(root: string | ScanOptions): Iterable<string>;
|
||||
|
||||
match(path: string): boolean;
|
||||
}
|
||||
|
||||
interface ScanOptions {
|
||||
/**
|
||||
* The root directory to start matching from. Defaults to `process.cwd()`
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Allow patterns to match entries that begin with a period (`.`).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* Return the absolute path for entries.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
absolute?: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether to traverse descendants of symbolic link directories.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
followSymlinks?: boolean;
|
||||
|
||||
/**
|
||||
* Throw an error when symbolic link is broken
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
throwErrorOnBrokenSymlink?: boolean;
|
||||
|
||||
/**
|
||||
* Return only files.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
onlyFiles?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
## Supported Glob Patterns
|
||||
|
||||
Bun supports the following glob patterns:
|
||||
|
||||
### `?` - Match any single character
|
||||
|
||||
```ts
|
||||
const glob = new Glob("???.ts");
|
||||
glob.match("foo.ts"); // => true
|
||||
glob.match("foobar.ts"); // => false
|
||||
```
|
||||
|
||||
### `*` - Matches zero or more characters, except for path separators (`/` or `\`)
|
||||
|
||||
```ts
|
||||
const glob = new Glob("*.ts");
|
||||
glob.match("index.ts"); // => true
|
||||
glob.match("src/index.ts"); // => false
|
||||
```
|
||||
|
||||
### `**` - Match any number of characters including `/`
|
||||
|
||||
```ts
|
||||
const glob = new Glob("**/*.ts");
|
||||
glob.match("index.ts"); // => true
|
||||
glob.match("src/index.ts"); // => true
|
||||
glob.match("src/index.js"); // => false
|
||||
```
|
||||
|
||||
### `[ab]` - Matches one of the characters contained in the brackets, as well as character ranges
|
||||
|
||||
```ts
|
||||
const glob = new Glob("ba[rz].ts");
|
||||
glob.match("bar.ts"); // => true
|
||||
glob.match("baz.ts"); // => true
|
||||
glob.match("bat.ts"); // => false
|
||||
```
|
||||
|
||||
You can use character ranges (e.g `[0-9]`, `[a-z]`) as well as the negation operators `^` or `!` to match anything _except_ the characters contained within the braces (e.g `[^ab]`, `[!a-z]`)
|
||||
|
||||
```ts
|
||||
const glob = new Glob("ba[a-z][0-9][^4-9].ts");
|
||||
glob.match("bar01.ts"); // => true
|
||||
glob.match("baz83.ts"); // => true
|
||||
glob.match("bat22.ts"); // => true
|
||||
glob.match("bat24.ts"); // => false
|
||||
glob.match("ba0a8.ts"); // => false
|
||||
```
|
||||
|
||||
### `{a,b,c}` - Match any of the given patterns
|
||||
|
||||
```ts
|
||||
const glob = new Glob("{a,b,c}.ts");
|
||||
glob.match("a.ts"); // => true
|
||||
glob.match("b.ts"); // => true
|
||||
glob.match("c.ts"); // => true
|
||||
glob.match("d.ts"); // => false
|
||||
```
|
||||
|
||||
These match patterns can be deeply nested (up to 10 levels), and contain any of the wildcards from above.
|
||||
|
||||
### `!` - Negates the result at the start of a pattern
|
||||
|
||||
```ts
|
||||
const glob = new Glob("!index.ts");
|
||||
glob.match("index.ts"); // => false
|
||||
glob.match("foo.ts"); // => true
|
||||
```
|
||||
|
||||
### `\` - Escapes any of the special characters above
|
||||
|
||||
```ts
|
||||
const glob = new Glob("\\!index.ts");
|
||||
glob.match("!index.ts"); // => true
|
||||
glob.match("index.ts"); // => false
|
||||
```
|
||||
@@ -171,14 +171,14 @@ Optionally, you can override the trusted CA certificates by passing a value for
|
||||
});
|
||||
```
|
||||
|
||||
To override Diffie-Helman parameters:
|
||||
To override Diffie-Hellman parameters:
|
||||
|
||||
```ts
|
||||
Bun.serve({
|
||||
// ...
|
||||
tls: {
|
||||
// other config
|
||||
dhParamsFile: "/path/to/dhparams.pem", // path to Diffie Helman parameters
|
||||
dhParamsFile: "/path/to/dhparams.pem", // path to Diffie Hellman parameters
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
@@ -23,6 +23,11 @@ import.meta.resolveSync("zod")
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.dirname`
|
||||
- An alias to `import.meta.dir`, for Node.js compatibility
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.file`
|
||||
- The name of the current file, e.g. `index.tsx`
|
||||
|
||||
@@ -33,11 +38,26 @@ import.meta.resolveSync("zod")
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.filename`
|
||||
- An alias to `import.meta.path`, for Node.js compatibility
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.url`
|
||||
- A string url to the current file, e.g. `file:///path/to/project/index.tx`
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.main`
|
||||
- `boolean` Indicates whether the current file is the entrypoint to the current `bun` process. Is the file being directly executed by `bun run` or is it being imported?
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.env`
|
||||
- An alias to `process.env`.
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.resolve{Sync}`
|
||||
- Resolve a module specifier (e.g. `"zod"` or `"./file.tsx"`) to an absolute path. While file would be imported if the specifier were imported from this file?
|
||||
|
||||
|
||||
52
docs/api/semver.md
Normal file
52
docs/api/semver.md
Normal file
@@ -0,0 +1,52 @@
|
||||
Bun implements a semantic versioning API which can be used to compare versions and determine if a version is compatible with another range of versions. The versions and ranges are designed to be compatible with `node-semver`, which is used by npm clients.
|
||||
|
||||
It's about 20x faster than `node-semver`.
|
||||
|
||||

|
||||
|
||||
Currently, this API is two functions.
|
||||
|
||||
#### `Bun.semver.satisfies(version: string, range: string): boolean`
|
||||
|
||||
Returns `true` if `version` satisfies `range`, otherwise `false`.
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
import { semver } from "bun";
|
||||
|
||||
semver.satisfies("1.0.0", "^1.0.0"); // true
|
||||
semver.satisfies("1.0.0", "^1.0.1"); // false
|
||||
semver.satisfies("1.0.0", "~1.0.0"); // true
|
||||
semver.satisfies("1.0.0", "~1.0.1"); // false
|
||||
semver.satisfies("1.0.0", "1.0.0"); // true
|
||||
semver.satisfies("1.0.0", "1.0.1"); // false
|
||||
semver.satisfies("1.0.1", "1.0.0"); // false
|
||||
semver.satisfies("1.0.0", "1.0.x"); // true
|
||||
semver.satisfies("1.0.0", "1.x.x"); // true
|
||||
semver.satisfies("1.0.0", "x.x.x"); // true
|
||||
semver.satisfies("1.0.0", "1.0.0 - 2.0.0"); // true
|
||||
semver.satisfies("1.0.0", "1.0.0 - 1.0.1"); // true
|
||||
```
|
||||
|
||||
If `range` is invalid, it returns false. If `version` is invalid, it returns false.
|
||||
|
||||
#### `Bun.semver.order(versionA: string, versionB: string): 0 | 1 | -1`
|
||||
|
||||
Returns `0` if `versionA` and `versionB` are equal, `1` if `versionA` is greater than `versionB`, and `-1` if `versionA` is less than `versionB`.
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
import { semver } from "bun";
|
||||
|
||||
semver.order("1.0.0", "1.0.0"); // 0
|
||||
semver.order("1.0.0", "1.0.1"); // -1
|
||||
semver.order("1.0.1", "1.0.0"); // 1
|
||||
|
||||
const unsorted = ["1.0.0", "1.0.1", "1.0.0-alpha", "1.0.0-beta", "1.0.0-rc"];
|
||||
unsorted.sort(semver.order); // ["1.0.0-alpha", "1.0.0-beta", "1.0.0-rc", "1.0.0", "1.0.1"]
|
||||
console.log(unsorted);
|
||||
```
|
||||
|
||||
If you need other semver functions, feel free to open an issue or pull request.
|
||||
@@ -183,6 +183,60 @@ const proc = Bun.spawn(["echo", "hello"]);
|
||||
proc.unref();
|
||||
```
|
||||
|
||||
## Inter-process communication (IPC)
|
||||
|
||||
Bun supports direct inter-process communication channel between two `bun` processes. To receive messages from a spawned Bun subprocess, specify an `ipc` handler.
|
||||
{%callout%}
|
||||
**Note** — This API is only compatible with other `bun` processes. Use `process.execPath` to get a path to the currently running `bun` executable.
|
||||
{%/callout%}
|
||||
|
||||
```ts#parent.ts
|
||||
const child = Bun.spawn(["bun", "child.ts"], {
|
||||
ipc(message) {
|
||||
/**
|
||||
* The message received from the sub process
|
||||
**/
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
The parent process can send messages to the subprocess using the `.send()` method on the returned `Subprocess` instance. A reference to the sending subprocess is also available as the second argument in the `ipc` handler.
|
||||
|
||||
```ts#parent.ts
|
||||
const childProc = Bun.spawn(["bun", "child.ts"], {
|
||||
ipc(message, childProc) {
|
||||
/**
|
||||
* The message received from the sub process
|
||||
**/
|
||||
childProc.send("Respond to child")
|
||||
},
|
||||
});
|
||||
|
||||
childProc.send("I am your father"); // The parent can send messages to the child as well
|
||||
```
|
||||
|
||||
Meanwhile the child process can send messages to its parent using with `process.send()` and receive messages with `process.on("message")`. This is the same API used for `child_process.fork()` in Node.js.
|
||||
|
||||
```ts#child.ts
|
||||
process.send("Hello from child as string");
|
||||
process.send({ message: "Hello from child as object" });
|
||||
|
||||
process.on("message", (message) => {
|
||||
// print message from parent
|
||||
console.log(message);
|
||||
});
|
||||
```
|
||||
|
||||
All messages are serialized using the JSC `serialize` API, which allows for the same set of [transferrable types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) supported by `postMessage` and `structuredClone`, including strings, typed arrays, streams, and objects.
|
||||
|
||||
```ts#child.ts
|
||||
// send a string
|
||||
process.send("Hello from child as string");
|
||||
|
||||
// send an object
|
||||
process.send({ message: "Hello from child as object" });
|
||||
```
|
||||
|
||||
## Blocking API (`Bun.spawnSync()`)
|
||||
|
||||
Bun provides a synchronous equivalent of `Bun.spawn` called `Bun.spawnSync`. This is a blocking API that supports the same inputs and parameters as `Bun.spawn`. It returns a `SyncSubprocess` object, which differs from `Subprocess` in a few ways.
|
||||
|
||||
@@ -57,6 +57,23 @@ import { Database } from "bun:sqlite";
|
||||
const db = new Database("mydb.sqlite", { create: true });
|
||||
```
|
||||
|
||||
### Load via ES module import
|
||||
|
||||
You can also use an import attribute to load a database.
|
||||
|
||||
```ts
|
||||
import db from "./mydb.sqlite" with {"type": "sqlite"};
|
||||
|
||||
console.log(db.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
|
||||
This is equivalent to the following:
|
||||
|
||||
```ts
|
||||
import { Database } from "bun:sqlite";
|
||||
const db = new Database("./mydb.sqlite");
|
||||
```
|
||||
|
||||
### `.close()`
|
||||
|
||||
To close a database:
|
||||
@@ -99,6 +116,20 @@ const query = db.prepare("SELECT * FROM foo WHERE bar = ?");
|
||||
|
||||
{% /callout %}
|
||||
|
||||
## WAL mode
|
||||
|
||||
SQLite supports [write-ahead log mode](https://www.sqlite.org/wal.html) (WAL) which dramatically improves performance, especially in situations with many concurrent writes. It's broadly recommended to enable WAL mode for most typical applications.
|
||||
|
||||
To enable WAL mode, run this pragma query at the beginning of your application:
|
||||
|
||||
```ts
|
||||
db.exec("PRAGMA journal_mode = WAL;");
|
||||
```
|
||||
|
||||
{% details summary="What is WAL mode" %}
|
||||
In WAL mode, writes to the database are written directly to a separate file called the "WAL file" (write-ahead log). This file will be later integrated into the main database file. Think of it as a buffer for pending writes. Refer to the [SQLite docs](https://www.sqlite.org/wal.html) for a more detailed overview.
|
||||
{% /details %}
|
||||
|
||||
## Statements
|
||||
|
||||
A `Statement` is a _prepared query_, which means it's been parsed and compiled into an efficient binary form. It can be executed multiple times in a performant way.
|
||||
|
||||
@@ -73,10 +73,11 @@ sink.end();
|
||||
// ArrayBuffer(5) [ 104, 101, 108, 108, 111 ]
|
||||
```
|
||||
|
||||
To instead retrieve the data as a `Uint8Array`, pass the `asUint8Array` option to the constructor.
|
||||
To instead retrieve the data as a `Uint8Array`, pass the `asUint8Array` option to the `start` method.
|
||||
|
||||
```ts-diff
|
||||
const sink = new Bun.ArrayBufferSink({
|
||||
const sink = new Bun.ArrayBufferSink();
|
||||
sink.start({
|
||||
+ asUint8Array: true
|
||||
});
|
||||
|
||||
@@ -103,7 +104,8 @@ sink.end();
|
||||
Once `.end()` is called, no more data can be written to the `ArrayBufferSink`. However, in the context of buffering a stream, it's useful to continuously write data and periodically `.flush()` the contents (say, into a `WriteableStream`). To support this, pass `stream: true` to the constructor.
|
||||
|
||||
```ts
|
||||
const sink = new Bun.ArrayBufferSink({
|
||||
const sink = new Bun.ArrayBufferSink();
|
||||
sink.start({
|
||||
stream: true,
|
||||
});
|
||||
|
||||
@@ -124,7 +126,8 @@ The `.flush()` method returns the buffered data as an `ArrayBuffer` (or `Uint8Ar
|
||||
To manually set the size of the internal buffer in bytes, pass a value for `highWaterMark`:
|
||||
|
||||
```ts
|
||||
const sink = new Bun.ArrayBufferSink({
|
||||
const sink = new Bun.ArrayBufferSink();
|
||||
sink.start({
|
||||
highWaterMark: 1024 * 1024, // 1 MB
|
||||
});
|
||||
```
|
||||
|
||||
@@ -195,7 +195,10 @@ socket.write("hello");
|
||||
To simplify this for now, consider using Bun's `ArrayBufferSink` with the `{stream: true}` option:
|
||||
|
||||
```ts
|
||||
const sink = new ArrayBufferSink({ stream: true, highWaterMark: 1024 });
|
||||
import { ArrayBufferSink } from "bun";
|
||||
|
||||
const sink = new ArrayBufferSink();
|
||||
sink.start({ stream: true, highWaterMark: 1024 });
|
||||
|
||||
sink.write("h");
|
||||
sink.write("e");
|
||||
@@ -204,10 +207,11 @@ sink.write("l");
|
||||
sink.write("o");
|
||||
|
||||
queueMicrotask(() => {
|
||||
var data = sink.flush();
|
||||
if (!socket.write(data)) {
|
||||
const data = sink.flush();
|
||||
const wrote = socket.write(data);
|
||||
if (wrote < data.byteLength) {
|
||||
// put it back in the sink if the socket is full
|
||||
sink.write(data);
|
||||
sink.write(data.subarray(wrote));
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
@@ -50,7 +50,7 @@ export default jsx(
|
||||
To override the default loader specified in the `new Bun.Transpiler()` constructor, pass a second argument to `.transformSync()`.
|
||||
|
||||
```ts
|
||||
await transpiler.transform("<div>hi!</div>", "tsx");
|
||||
transpiler.transformSync("<div>hi!</div>", "tsx");
|
||||
```
|
||||
|
||||
{% details summary="Nitty gritty" %}
|
||||
|
||||
@@ -261,6 +261,24 @@ This function is optimized for large input. On an M1X, it processes 480 MB/s -
|
||||
20 GB/s, depending on how much data is being escaped and whether there is non-ascii
|
||||
text. Non-string types will be converted to a string before escaping.
|
||||
|
||||
## `Bun.stringWidth()`
|
||||
|
||||
```ts
|
||||
Bun.stringWidth(input: string, options?: { countAnsiEscapeCodes?: boolean = false }): number
|
||||
```
|
||||
|
||||
Returns the number of columns required to display a string. This is useful for aligning text in a terminal. By default, ANSI escape codes are removed before measuring the string. To include them, pass `{ countAnsiEscapeCodes: true }` as the second argument.
|
||||
|
||||
```ts
|
||||
Bun.stringWidth("hello"); // => 5
|
||||
Bun.stringWidth("\u001b[31mhello\u001b[0m"); // => 5
|
||||
Bun.stringWidth("\u001b[31mhello\u001b[0m", { countAnsiEscapeCodes: true }); // => 12
|
||||
```
|
||||
|
||||
Compared with the popular `string-width` npm package, `bun`'s implementation is > [100x faster](https://github.com/oven-sh/bun/blob/8abd1fb088bcf2e78bd5d0d65ba4526872d2ab61/bench/snippets/string-width.mjs#L22)
|
||||
|
||||
|
||||
|
||||
<!-- ## `Bun.enableANSIColors()` -->
|
||||
|
||||
## `Bun.fileURLToPath()`
|
||||
@@ -378,10 +396,10 @@ Decompresses a `Uint8Array` using zlib's GUNZIP algorithm.
|
||||
|
||||
```ts
|
||||
const buf = Buffer.from("hello".repeat(100)); // Buffer extends Uint8Array
|
||||
const compressed = Bun.gunzipSync(buf);
|
||||
const compressed = Bun.gzipSync(buf);
|
||||
|
||||
const dec = new TextDecoder();
|
||||
const uncompressed = Bun.inflateSync(compressed);
|
||||
const uncompressed = Bun.gunzipSync(compressed);
|
||||
dec.decode(uncompressed);
|
||||
// => "hellohellohello..."
|
||||
```
|
||||
@@ -398,7 +416,7 @@ buf; // => Uint8Array(25)
|
||||
compressed; // => Uint8Array(10)
|
||||
```
|
||||
|
||||
The second argument supports the same set of configuration options as [`Bun.gzipSync`](#bun.gzipSync).
|
||||
The second argument supports the same set of configuration options as [`Bun.gzipSync`](#bungzipsync).
|
||||
|
||||
## `Bun.inflateSync()`
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ socket.addEventListener("message", event => {
|
||||
|
||||
### Pub/Sub
|
||||
|
||||
Bun's `ServerWebSocket` implementation implements a native publish-subscribe API for topic-based broadcasting. Individual sockets can `.subscribe()` to a topic (specified with a string identifier) and `.publish()` messages to all other subscribers to that topic. This topic-based broadcast API is similar to [MQTT](https://en.wikipedia.org/wiki/MQTT) and [Redis Pub/Sub](https://redis.io/topics/pubsub).
|
||||
Bun's `ServerWebSocket` implementation implements a native publish-subscribe API for topic-based broadcasting. Individual sockets can `.subscribe()` to a topic (specified with a string identifier) and `.publish()` messages to all other subscribers to that topic (excluding itself). This topic-based broadcast API is similar to [MQTT](https://en.wikipedia.org/wiki/MQTT) and [Redis Pub/Sub](https://redis.io/topics/pubsub).
|
||||
|
||||
```ts
|
||||
const server = Bun.serve<{ username: string }>({
|
||||
@@ -182,17 +182,17 @@ const server = Bun.serve<{ username: string }>({
|
||||
open(ws) {
|
||||
const msg = `${ws.data.username} has entered the chat`;
|
||||
ws.subscribe("the-group-chat");
|
||||
ws.publish("the-group-chat", msg);
|
||||
server.publish("the-group-chat", msg);
|
||||
},
|
||||
message(ws, message) {
|
||||
// this is a group chat
|
||||
// so the server re-broadcasts incoming message to everyone
|
||||
ws.publish("the-group-chat", `${ws.data.username}: ${message}`);
|
||||
server.publish("the-group-chat", `${ws.data.username}: ${message}`);
|
||||
},
|
||||
close(ws) {
|
||||
const msg = `${ws.data.username} has left the chat`;
|
||||
ws.unsubscribe("the-group-chat");
|
||||
ws.publish("the-group-chat", msg);
|
||||
server.publish("the-group-chat", msg);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -200,7 +200,18 @@ const server = Bun.serve<{ username: string }>({
|
||||
console.log(`Listening on ${server.hostname}:${server.port}`);
|
||||
```
|
||||
|
||||
Calling `.publish(data)` will send the message to all subscribers of a topic _except_ the socket that called `.publish()`.
|
||||
Calling `.publish(data)` will send the message to all subscribers of a topic _except_ the socket that called `.publish()`. To send a message to all subscribers of a topic, use the `.publish()` method on the `Server` instance.
|
||||
|
||||
```ts
|
||||
const server = Bun.serve({
|
||||
websocket: {
|
||||
// ...
|
||||
},
|
||||
});
|
||||
|
||||
// listen for some external event
|
||||
server.publish("the-group-chat", "Hello world");
|
||||
```
|
||||
|
||||
### Compression
|
||||
|
||||
@@ -234,11 +245,35 @@ The `.send(message)` method of `ServerWebSocket` returns a `number` indicating t
|
||||
|
||||
This gives you better control over backpressure in your server.
|
||||
|
||||
## Connect to a `Websocket` server
|
||||
### Timeouts and limits
|
||||
|
||||
{% callout %}
|
||||
**🚧** — The `WebSocket` client still does not pass the full [Autobahn test suite](https://github.com/crossbario/autobahn-testsuite) and should not be considered ready for production.
|
||||
{% /callout %}
|
||||
By default, Bun will close a WebSocket connection if it is idle for 120 seconds. This can be configured with the `idleTimeout` parameter.
|
||||
|
||||
```ts
|
||||
Bun.serve({
|
||||
fetch(req, server) {}, // upgrade logic
|
||||
websocket: {
|
||||
idleTimeout: 60, // 60 seconds
|
||||
|
||||
// ...
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Bun will also close a WebSocket connection if it receives a message that is larger than 16 MB. This can be configured with the `maxPayloadLength` parameter.
|
||||
|
||||
```ts
|
||||
Bun.serve({
|
||||
fetch(req, server) {}, // upgrade logic
|
||||
websocket: {
|
||||
maxPayloadLength: 1024 * 1024, // 1 MB
|
||||
|
||||
// ...
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Connect to a `Websocket` server
|
||||
|
||||
Bun implements the `WebSocket` class. To create a WebSocket client that connects to a `ws://` or `wss://` server, create an instance of `WebSocket`, as you would in the browser.
|
||||
|
||||
@@ -289,6 +324,14 @@ namespace Bun {
|
||||
close?: (ws: ServerWebSocket) => void;
|
||||
error?: (ws: ServerWebSocket, error: Error) => void;
|
||||
drain?: (ws: ServerWebSocket) => void;
|
||||
|
||||
maxPayloadLength?: number; // default: 16 * 1024 * 1024 = 16 MB
|
||||
idleTimeout?: number; // default: 120 (seconds)
|
||||
backpressureLimit?: number; // default: 1024 * 1024 = 1 MB
|
||||
closeOnBackpressureLimit?: boolean; // default: false
|
||||
sendPings?: boolean; // default: true
|
||||
publishToSelf?: boolean; // default: false
|
||||
|
||||
perMessageDeflate?:
|
||||
| boolean
|
||||
| {
|
||||
|
||||
@@ -32,6 +32,25 @@ All imported files and packages are bundled into the executable, along with a co
|
||||
|
||||
{% /callout %}
|
||||
|
||||
## SQLite
|
||||
|
||||
You can use `bun:sqlite` imports with `bun build --compile`.
|
||||
|
||||
By default, the database is resolved relative to the current working directory of the process.
|
||||
|
||||
```js
|
||||
import db from './my.db' with {type: "sqlite"};
|
||||
|
||||
console.log(db.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
|
||||
That means if the executable is located at `/usr/bin/hello`, the user's terminal is located at `/home/me/Desktop`, it will look for `/home/me/Desktop/my.db`.
|
||||
|
||||
```
|
||||
$ cd /home/me/Desktop
|
||||
$ ./hello
|
||||
```
|
||||
|
||||
## Embedding files
|
||||
|
||||
Standalone executables support embedding files.
|
||||
@@ -55,6 +74,30 @@ You may need to specify a `--loader` for it to be treated as a `"file"` loader (
|
||||
|
||||
Embedded files can be read using `Bun.file`'s functions or the Node.js `fs.readFile` function (in `"node:fs"`).
|
||||
|
||||
### Embedding SQLite databases
|
||||
|
||||
If your application wants to embed a SQLite database, set `type: "sqlite"` in the import attribute and the `embed` attribute to `"true"`.
|
||||
|
||||
```js
|
||||
import myEmbeddedDb from "./my.db" with {type: "sqlite", embed: "true"};
|
||||
|
||||
console.log(myEmbeddedDb.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
|
||||
This database is read-write, but all changes are lost when the executable exits (since it's stored in memory).
|
||||
|
||||
### Embedding N-API Addons
|
||||
|
||||
As of Bun v1.0.23, you can embed `.node` files into executables.
|
||||
|
||||
```js
|
||||
const addon = require("./addon.node");
|
||||
|
||||
console.log(addon.hello());
|
||||
```
|
||||
|
||||
Unfortunately, if you're using `@mapbox/node-pre-gyp` or other similar tools, you'll need to make sure the `.node` file is directly required or it won't bundle correctly.
|
||||
|
||||
## Minification
|
||||
|
||||
To trim down the size of the executable a little, pass `--minify` to `bun build --compile`. This uses Bun's minifier to reduce the code size. Overall though, Bun's binary is still way too big and we need to make it smaller.
|
||||
|
||||
@@ -43,7 +43,7 @@ Let's build our first bundle. You have the following two files, which implement
|
||||
import * as ReactDOM from 'react-dom/client';
|
||||
import {Component} from "./Component"
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
const root = ReactDOM.createRoot(document.getElementById('root')!);
|
||||
root.render(<Component message="Sup!" />)
|
||||
```
|
||||
|
||||
@@ -155,7 +155,7 @@ Like the Bun runtime, the bundler supports an array of file types out of the box
|
||||
|
||||
---
|
||||
|
||||
- `.js` `.cjs` `.mjs` `.mts` `.cts` `.ts` `.tsx`
|
||||
- `.js` `.jsx`, `.cjs` `.mjs` `.mts` `.cts` `.ts` `.tsx`
|
||||
- Uses Bun's built-in transpiler to parse the file and transpile TypeScript/JSX syntax to vanilla JavaScript. The bundler executes a set of default transforms, including dead code elimination, tree shaking, and environment variable inlining. At the moment Bun does not attempt to down-convert syntax; if you use recently ECMAScript syntax, that will be reflected in the bundled code.
|
||||
|
||||
---
|
||||
@@ -276,15 +276,15 @@ const result = await Bun.build({
|
||||
entrypoints: ["./index.ts"],
|
||||
});
|
||||
|
||||
for (const result of result.outputs) {
|
||||
for (const res of result.outputs) {
|
||||
// Can be consumed as blobs
|
||||
await result.text();
|
||||
await res.text();
|
||||
|
||||
// Bun will set Content-Type and Etag headers
|
||||
new Response(result);
|
||||
new Response(res);
|
||||
|
||||
// Can be written manually, but you should use `outdir` in this case.
|
||||
Bun.write(path.join("out", result.path), result);
|
||||
Bun.write(path.join("out", res.path), res);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -328,7 +328,7 @@ Depending on the target, Bun will apply different module resolution rules and op
|
||||
|
||||
All bundles generated with `target: "bun"` are marked with a special `// @bun` pragma, which indicates to the Bun runtime that there's no need to re-transpile the file before execution.
|
||||
|
||||
If any entrypoints contains a Bun shebang (`#!/usr/bin/env bun`) the bundler will default to `target: "bun"` instead of `"browser`.
|
||||
If any entrypoints contains a Bun shebang (`#!/usr/bin/env bun`) the bundler will default to `target: "bun"` instead of `"browser"`.
|
||||
|
||||
---
|
||||
|
||||
@@ -337,10 +337,6 @@ Depending on the target, Bun will apply different module resolution rules and op
|
||||
|
||||
{% /table %}
|
||||
|
||||
{% callout %}
|
||||
|
||||
{% /callout %}
|
||||
|
||||
### `format`
|
||||
|
||||
Specifies the module format to be used in the generated bundles.
|
||||
@@ -972,8 +968,6 @@ By specifying `.` as `root`, the generated file structure will look like this:
|
||||
|
||||
A prefix to be appended to any import paths in bundled code.
|
||||
|
||||
<!-- $ bun build ./index.tsx --outdir ./out --public-path https://cdn.example.com -->
|
||||
|
||||
In many cases, generated bundles will contain no `import` statements. After all, the goal of bundling is to combine all of the code into a single file. However there are a number of cases with the generated bundles will contain `import` statements.
|
||||
|
||||
- **Asset imports** — When importing an unrecognized file type like `*.svg`, the bundler defers to the [`file` loader](/docs/bundler/loaders#file), which copies the file into `outdir` as is. The import is converted into a variable
|
||||
@@ -1011,7 +1005,7 @@ await Bun.build({
|
||||
```
|
||||
|
||||
```bash#CLI
|
||||
n/a
|
||||
$ bun build ./index.tsx --outdir ./out --public-path https://cdn.example.com/
|
||||
```
|
||||
|
||||
{% /codetabs %}
|
||||
@@ -1052,7 +1046,7 @@ $ bun build ./index.tsx --outdir ./out --define 'STRING="value"' --define "neste
|
||||
|
||||
### `loader`
|
||||
|
||||
A map of file extensions to [built-in loader names](https://bun.sh/docs/bundler/loaders#built-in-loaders). This can be used to quickly customize how certain file files are loaded.
|
||||
A map of file extensions to [built-in loader names](https://bun.sh/docs/bundler/loaders#built-in-loaders). This can be used to quickly customize how certain files are loaded.
|
||||
|
||||
{% codetabs %}
|
||||
|
||||
@@ -1096,7 +1090,7 @@ interface BuildArtifact extends Blob {
|
||||
The `outputs` array contains all the files that were generated by the build. Each artifact implements the `Blob` interface.
|
||||
|
||||
```ts
|
||||
const build = Bun.build({
|
||||
const build = await Bun.build({
|
||||
/* */
|
||||
});
|
||||
|
||||
@@ -1140,7 +1134,7 @@ Each artifact also contains the following properties:
|
||||
Similar to `BunFile`, `BuildArtifact` objects can be passed directly into `new Response()`.
|
||||
|
||||
```ts
|
||||
const build = Bun.build({
|
||||
const build = await Bun.build({
|
||||
/* */
|
||||
});
|
||||
|
||||
@@ -1156,7 +1150,7 @@ The Bun runtime implements special pretty-printing of `BuildArtifact` object to
|
||||
|
||||
```ts#Build_script
|
||||
// build.ts
|
||||
const build = Bun.build({/* */});
|
||||
const build = await Bun.build({/* */});
|
||||
|
||||
const artifact = build.outputs[0];
|
||||
console.log(artifact);
|
||||
|
||||
@@ -171,6 +171,41 @@ console.log(addon);
|
||||
|
||||
In the bundler, `.node` files are handled using the [`file`](#file) loader.
|
||||
|
||||
### `sqlite`
|
||||
|
||||
**SQLite loader**. `with { "type": "sqlite" }` import attribute
|
||||
|
||||
In the runtime and bundler, SQLite databases can be directly imported. This will load the database using [`bun:sqlite`](/docs/api/sqlite.md).
|
||||
|
||||
```ts
|
||||
import db from "./my.db" with {type: "sqlite"};
|
||||
```
|
||||
|
||||
This is only supported when the `target` is `bun`.
|
||||
|
||||
By default, the database is external to the bundle (so that you can potentially use a database loaded elsewhere), so the database file on-disk won't be bundled into the final output.
|
||||
|
||||
You can change this behavior with the `"embed"` attribute:
|
||||
|
||||
```ts
|
||||
// embed the database into the bundle
|
||||
import db from "./my.db" with {type: "sqlite", embed: "true"};
|
||||
```
|
||||
|
||||
When using a [standalone executable](/docs/bundler/executables), the database is embedded into the single-file executable.
|
||||
|
||||
Otherwise, the database to embed is copied into the `outdir` with a hashed filename.
|
||||
|
||||
### `bunshell` loader
|
||||
|
||||
**Bun Shell loader**. Default for `.bun.sh` files
|
||||
|
||||
This loader is used to parse [Bun Shell](/docs/runtime/shell) scripts. It's only supported when starting bun itself, so it's not available in the bundler or in the runtime.
|
||||
|
||||
```sh
|
||||
$ bun run ./script.bun.sh
|
||||
```
|
||||
|
||||
### `file`
|
||||
|
||||
**File loader**. Default for all unrecognized file types.
|
||||
|
||||
@@ -119,7 +119,7 @@ export function returnFalse() {
|
||||
}
|
||||
```
|
||||
|
||||
...then bundling the following file will produce an empty bundle.
|
||||
...then bundling the following file will produce an empty bundle, provided that the minify syntax option is enabled.
|
||||
|
||||
```ts
|
||||
import {returnFalse} from './returnFalse.ts' with { type: 'macro' };
|
||||
|
||||
155
docs/cli/add.md
Normal file
155
docs/cli/add.md
Normal file
@@ -0,0 +1,155 @@
|
||||
To add a particular package:
|
||||
|
||||
```bash
|
||||
$ bun add preact
|
||||
```
|
||||
|
||||
To specify a version, version range, or tag:
|
||||
|
||||
```bash
|
||||
$ bun add zod@3.20.0
|
||||
$ bun add zod@^3.0.0
|
||||
$ bun add zod@latest
|
||||
```
|
||||
|
||||
## `--dev`
|
||||
|
||||
{% callout %}
|
||||
**Alias** — `--development`, `-d`, `-D`
|
||||
{% /callout %}
|
||||
|
||||
To add a package as a dev dependency (`"devDependencies"`):
|
||||
|
||||
```bash
|
||||
$ bun add --dev @types/react
|
||||
$ bun add -d @types/react
|
||||
```
|
||||
|
||||
## `--optional`
|
||||
|
||||
To add a package as an optional dependency (`"optionalDependencies"`):
|
||||
|
||||
```bash
|
||||
$ bun add --optional lodash
|
||||
```
|
||||
|
||||
## `--exact`
|
||||
|
||||
To add a package and pin to the resolved version, use `--exact`. This will resolve the version of the package and add it to your `package.json` with an exact version number instead of a version range.
|
||||
|
||||
```bash
|
||||
$ bun add react --exact
|
||||
$ bun add react -E
|
||||
```
|
||||
|
||||
This will add the following to your `package.json`:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"dependencies": {
|
||||
// without --exact
|
||||
"react": "^18.2.0", // this matches >= 18.2.0 < 19.0.0
|
||||
|
||||
// with --exact
|
||||
"react": "18.2.0" // this matches only 18.2.0 exactly
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To view a complete list of options for this command:
|
||||
|
||||
```bash
|
||||
$ bun add --help
|
||||
```
|
||||
|
||||
## `--global`
|
||||
|
||||
{% callout %}
|
||||
**Note** — This would not modify package.json of your current project folder.
|
||||
**Alias** - `bun add --global`, `bun add -g`, `bun install --global` and `bun install -g`
|
||||
{% /callout %}
|
||||
|
||||
To install a package globally, use the `-g`/`--global` flag. This will not modify the `package.json` of your current project. Typically this is used for installing command-line tools.
|
||||
|
||||
```bash
|
||||
$ bun add --global cowsay # or `bun add -g cowsay`
|
||||
$ cowsay "Bun!"
|
||||
______
|
||||
< Bun! >
|
||||
------
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
```
|
||||
|
||||
{% details summary="Configuring global installation behavior" %}
|
||||
|
||||
```toml
|
||||
[install]
|
||||
# where `bun add --global` installs packages
|
||||
globalDir = "~/.bun/install/global"
|
||||
|
||||
# where globally-installed package bins are linked
|
||||
globalBinDir = "~/.bun/bin"
|
||||
```
|
||||
|
||||
{% /details %}
|
||||
|
||||
## Trusted dependencies
|
||||
|
||||
Unlike other npm clients, Bun does not execute arbitrary lifecycle scripts for installed dependencies, such as `postinstall`. These scripts represent a potential security risk, as they can execute arbitrary code on your machine.
|
||||
|
||||
To tell Bun to allow lifecycle scripts for a particular package, add the package to `trustedDependencies` in your package.json.
|
||||
|
||||
```json-diff
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
+ "trustedDependencies": ["my-trusted-package"]
|
||||
}
|
||||
```
|
||||
|
||||
Bun reads this field and will run lifecycle scripts for `my-trusted-package`.
|
||||
|
||||
<!-- Bun maintains an allow-list of popular packages containing `postinstall` scripts that are known to be safe. To run lifecycle scripts for packages that aren't on this list, add the package to `trustedDependencies` in your package.json. -->
|
||||
|
||||
## Git dependencies
|
||||
|
||||
To add a dependency from a git repository:
|
||||
|
||||
```bash
|
||||
$ bun add git@github.com:moment/moment.git
|
||||
```
|
||||
|
||||
Bun supports a variety of protocols, including [`github`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#github-urls), [`git`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#git-urls-as-dependencies), `git+ssh`, `git+https`, and many more.
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"dayjs": "git+https://github.com/iamkun/dayjs.git",
|
||||
"lodash": "git+ssh://github.com/lodash/lodash.git#4.17.21",
|
||||
"moment": "git@github.com:moment/moment.git",
|
||||
"zod": "github:colinhacks/zod"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tarball dependencies
|
||||
|
||||
A package name can correspond to a publicly hosted `.tgz` file. During installation, Bun will download and install the package from the specified tarball URL, rather than from the package registry.
|
||||
|
||||
```sh
|
||||
$ bun add zod@https://registry.npmjs.org/zod/-/zod-3.21.4.tgz
|
||||
```
|
||||
|
||||
This will add the following line to your `package.json`:
|
||||
|
||||
```json#package.json
|
||||
{
|
||||
"dependencies": {
|
||||
"zod": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,36 +1,12 @@
|
||||
## `bun init`
|
||||
|
||||
Scaffold an empty project with the interactive `bun init` command.
|
||||
|
||||
```bash
|
||||
$ bun init
|
||||
bun init helps you get started with a minimal project and tries to
|
||||
guess sensible defaults. Press ^C anytime to quit.
|
||||
|
||||
package name (quickstart):
|
||||
entry point (index.ts):
|
||||
|
||||
Done! A package.json file was saved in the current directory.
|
||||
+ index.ts
|
||||
+ .gitignore
|
||||
+ tsconfig.json (for editor auto-complete)
|
||||
+ README.md
|
||||
|
||||
To get started, run:
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
Press `enter` to accept the default answer for each prompt, or pass the `-y` flag to auto-accept the defaults.
|
||||
|
||||
## `bun create`
|
||||
|
||||
{% callout %}
|
||||
**Note** — You don’t need `bun create` to use Bun. You don’t need any configuration at all. This command exists to make getting started a bit quicker and easier.
|
||||
{% /callout %}
|
||||
|
||||
Template a new Bun project with `bun create`. This is a flexible command that can be used to create a new project with a `create-<template>` npm package, a GitHub repo, or a local template.
|
||||
|
||||
### From `npm`
|
||||
If you're looking to create a brand new empty project, use [`bun init`](/docs/cli/init).
|
||||
|
||||
## From `npm`
|
||||
|
||||
```sh
|
||||
$ bun create <template> [<destination>]
|
||||
@@ -45,7 +21,7 @@ $ bunx create-remix
|
||||
|
||||
Refer to the documentation of the associated `create-<template>` package for complete documentation and usage instructions.
|
||||
|
||||
### From GitHub
|
||||
## From GitHub
|
||||
|
||||
This will download the contents of the GitHub repo to disk.
|
||||
|
||||
@@ -115,7 +91,7 @@ $ bun create https://github.com/ahfarmer/calculator ./myapp
|
||||
|
||||
Bun installs the files as they currently exist current default branch (usually `main` or `master`). Unlike `git clone` it doesn't download the commit history or configure a remote. -->
|
||||
|
||||
### From a local template
|
||||
## From a local template
|
||||
|
||||
{% callout %}
|
||||
**⚠️ Warning** — Unlike remote templates, running `bun create` with a local template will delete the entire destination folder if it already exists! Be careful.
|
||||
@@ -231,7 +207,7 @@ After cloning a template, `bun create` will automatically remove the `"bun-creat
|
||||
|
||||
---
|
||||
|
||||
- `GITHUB_API_TOKEN`
|
||||
- `GITHUB_ACCESS_TOKEN`
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited
|
||||
|
||||
{% /table %}
|
||||
@@ -268,7 +244,7 @@ ELSE IF local template
|
||||
5. Auto-detect the npm client, preferring `pnpm`, `yarn` (v1), and lastly `npm`
|
||||
6. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client
|
||||
7. Run `${npmClient} install` unless `--no-install` is passed OR no dependencies are in package.json
|
||||
8. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client
|
||||
8. Run any tasks defined in `"bun-create": { "postinstall" }` with the npm client
|
||||
9. Run `git init; git add -A .; git commit -am "Initial Commit";`
|
||||
|
||||
- Rename `gitignore` to `.gitignore`. NPM automatically removes `.gitignore` files from appearing in packages.
|
||||
@@ -21,7 +21,7 @@ Configuring with `bunfig.toml` is optional. Bun tries to be zero configuration i
|
||||
|
||||
# Scope name The value can be a URL string or an object
|
||||
"@mybigcompany" = { token = "123456", url = "https://registry.mybigcompany.com" }
|
||||
# URL is optional and fallsback to the default registry
|
||||
# URL is optional and falls back to the default registry
|
||||
|
||||
# The "@" in the scope is optional
|
||||
mybigcompany2 = { token = "123456" }
|
||||
@@ -59,8 +59,11 @@ optional = true
|
||||
# Install local devDependencies (default: true)
|
||||
dev = true
|
||||
|
||||
# Install peerDependencies (default: false)
|
||||
peer = false
|
||||
# Install peerDependencies (default: true)
|
||||
peer = true
|
||||
|
||||
# Max number of concurrent lifecycle scripts (default: (cpu count or GOMAXPROCS) x2)
|
||||
concurrentScripts = 16
|
||||
|
||||
# When using `bun install -g`, install packages here
|
||||
globalDir = "~/.bun/install/global"
|
||||
@@ -170,7 +173,7 @@ bun stores normalized `cpu` and `os` values from npm in the lockfile, along with
|
||||
|
||||
## Peer dependencies?
|
||||
|
||||
Peer dependencies are handled similarly to yarn. `bun install` does not automatically install peer dependencies and will try to choose an existing dependency.
|
||||
Peer dependencies are handled similarly to yarn. `bun install` will automatically install peer dependencies. If the dependency is marked optional in `peerDependenciesMeta`, an existing dependency will be chosen if possible.
|
||||
|
||||
## Lockfile
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
Bundling is currently an important mechanism for building complex web apps.
|
||||
|
||||
Modern apps typically consist of a large number of files and package dependencies. Despite the fact that modern browsers support [ES Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) imports, it's still too slow to fetch each file via individual HTTP requests. _Bundling_ is the process of concatenating several source files into a single large file that can be loaded in a single request.
|
||||
|
||||
{% callout %}
|
||||
**On bundling** — Despite recent advances like [`modulepreload`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/modulepreload) and [HTTP/3](https://en.wikipedia.org/wiki/HTTP/3), bundling is still the most performant approach.
|
||||
{% /callout %}
|
||||
|
||||
## Bundling your app
|
||||
|
||||
Bun's approach to bundling is a little different from other bundlers. Start by passing your app's entrypoint to `bun bun`.
|
||||
|
||||
```bash
|
||||
$ bun bun ./app.js
|
||||
```
|
||||
|
||||
Your entrypoint can be any `js|jsx|ts|tsx|html` file. With this file as a starting point, Bun will construct a graph of imported files and packages, transpile everything, and generate a file called `node_modules.bun`.
|
||||
|
||||
## What is `.bun`?
|
||||
|
||||
{% callout %}
|
||||
**Note** — [This format may change soon](https://github.com/oven-sh/bun/issues/121)
|
||||
{% /callout %}
|
||||
|
||||
A `.bun` file contains the pre-transpiled source code of your application, plus a bunch of binary-encoded metadata about your application's structure. as a contains:
|
||||
|
||||
- all the bundled source code
|
||||
- all the bundled source code metadata
|
||||
- project metadata & configuration
|
||||
|
||||
Here are some of the questions `.bun` files answer:
|
||||
|
||||
- when I import `react/index.js`, where in the `.bun` is the code for that? (not resolving, just the code)
|
||||
- what modules of a package are used?
|
||||
- what framework is used? (e.g., Next.js)
|
||||
- where is the routes directory?
|
||||
- how big is each imported dependency?
|
||||
- what is the hash of the bundle’s contents? (for etags)
|
||||
- what is the name & version of every npm package exported in this bundle?
|
||||
- what modules from which packages are used in this project? ("project" is defined as all the entry points used to generate the .bun)
|
||||
|
||||
All in one file.
|
||||
|
||||
It’s a little like a build cache, but designed for reuse across builds.
|
||||
|
||||
{% details summary="Position-independent code" %}
|
||||
|
||||
From a design perspective, the most important part of the `.bun` format is how code is organized. Each module is exported by a hash like this:
|
||||
|
||||
```js
|
||||
// preact/dist/preact.module.js
|
||||
export var $eb6819b = $$m({
|
||||
"preact/dist/preact.module.js": (module, exports) => {
|
||||
let n, l, u, i, t, o, r, f, e = {}, c = [], s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
||||
// ... rest of code
|
||||
```
|
||||
|
||||
This makes bundled modules [position-independent](https://en.wikipedia.org/wiki/Position-independent_code). In theory, one could import only the exact modules in-use without reparsing code and without generating a new bundle. One bundle can dynamically become many bundles comprising only the modules in use on the webpage. Thanks to the metadata with the byte offsets, a web server can send each module to browsers [zero-copy](https://en.wikipedia.org/wiki/Zero-copy) using [sendfile](https://man7.org/linux/man-pages/man2/sendfile.2.html). Bun itself is not quite this smart yet, but these optimizations would be useful in production and potentially very useful for React Server Components.
|
||||
|
||||
To see the schema inside, have a look at [`JavascriptBundleContainer`](./src/api/schema.d.ts#:~:text=export%20interface-,JavascriptBundleContainer,-%7B). You can find JavaScript bindings to read the metadata in [src/api/schema.js](./src/api/schema.js). This is not really an API yet. It’s missing the part where it gets the binary data from the bottom of the file. Someday, I want this to be usable by other tools too.
|
||||
{% /details %}
|
||||
|
||||
## Where is the code?
|
||||
|
||||
`.bun` files are marked as executable.
|
||||
|
||||
To print out the code, run `./node_modules.bun` in your terminal or run `bun ./path-to-node_modules.bun`.
|
||||
|
||||
Here is a copy-pastable example:
|
||||
|
||||
```bash
|
||||
$ ./node_modules.bun > node_modules.js
|
||||
```
|
||||
|
||||
This works because every `.bun` file starts with this:
|
||||
|
||||
```
|
||||
#!/usr/bin/env bun
|
||||
```
|
||||
|
||||
To deploy to production with Bun, you’ll want to get the code from the `.bun` file and stick that somewhere your web server can find it (or if you’re using Vercel or a Rails app, in a `public` folder).
|
||||
|
||||
Note that `.bun` is a binary file format, so just opening it in VSCode or vim might render strangely.
|
||||
|
||||
## Advanced
|
||||
|
||||
By default, `bun bun` only bundles external dependencies that are `import`ed or `require`d in either app code or another external dependency. An "external dependency" is defined as, "A JavaScript-like file that has `/node_modules/` in the resolved file path and a corresponding `package.json`".
|
||||
|
||||
To force Bun to bundle packages which are not located in a `node_modules` folder (i.e., the final, resolved path following all symlinks), add a `bun` section to the root project’s `package.json` with `alwaysBundle` set to an array of package names to always bundle. Here’s an example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-package-name-in-here",
|
||||
"bun": {
|
||||
"alwaysBundle": ["@mybigcompany/my-workspace-package"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Bundled dependencies are not eligible for Hot Module Reloading. The code is served to browsers & Bun.js verbatim. But, in the future, it may be sectioned off into only parts of the bundle being used. That’s possible in the current version of the `.bun` file (so long as you know which files are necessary), but it’s not implemented yet. Longer-term, it will include all `import` and `export` of each module inside.
|
||||
|
||||
## What is the module ID hash?
|
||||
|
||||
The `$eb6819b` hash used here:
|
||||
|
||||
```js
|
||||
export var $eb6819b = $$m({
|
||||
```
|
||||
|
||||
Is generated like this:
|
||||
|
||||
1. Murmur3 32-bit hash of `package.name@package.version`. This is the hash uniquely identifying the npm package.
|
||||
2. Wyhash 64 of the `package.hash` + `package_path`. `package_path` means "relative to the root of the npm package, where is the module imported?". For example, if you imported `react/jsx-dev-runtime.js`, the `package_path` is `jsx-dev-runtime.js`. `react-dom/cjs/react-dom.development.js` would be `cjs/react-dom.development.js`
|
||||
3. Truncate the hash generated above to a `u32`
|
||||
|
||||
The implementation details of this module ID hash will vary between versions of Bun. The important part is the metadata contains the module IDs, the package paths, and the package hashes, so it shouldn’t really matter in practice if other tooling wants to make use of any of this.
|
||||
@@ -63,6 +63,12 @@ $ bunx --bun my-cli # good
|
||||
$ bunx my-cli --bun # bad
|
||||
```
|
||||
|
||||
To force bun to always be used with a script, use a shebang.
|
||||
|
||||
```
|
||||
#!/usr/bin/env bun
|
||||
```
|
||||
|
||||
<!-- ## Environment variables
|
||||
|
||||
Bun automatically loads environment variables from `.env` files before running a file, script, or executable. The following files are checked, in order:
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
## `bun init`
|
||||
|
||||
Scaffold an empty project with `bun init`. It's an interactive tool.
|
||||
|
||||
```bash
|
||||
$ bun init
|
||||
bun init helps you get started with a minimal project and tries to
|
||||
guess sensible defaults. Press ^C anytime to quit.
|
||||
|
||||
package name (quickstart):
|
||||
entry point (index.ts):
|
||||
|
||||
Done! A package.json file was saved in the current directory.
|
||||
+ index.ts
|
||||
+ .gitignore
|
||||
+ tsconfig.json (for editor auto-complete)
|
||||
+ README.md
|
||||
|
||||
To get started, run:
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
Press `enter` to accept the default answer for each prompt, or pass the `-y` flag to auto-accept the defaults.
|
||||
|
||||
## `bun create`
|
||||
|
||||
Template a new Bun project with `bun create`.
|
||||
|
||||
```bash
|
||||
$ bun create <template> <destination>
|
||||
```
|
||||
|
||||
{% callout %}
|
||||
**Note** — You don’t need `bun create` to use Bun. You don’t need any configuration at all. This command exists to make getting started a bit quicker and easier.
|
||||
{% /callout %}
|
||||
|
||||
A template can take a number of forms:
|
||||
|
||||
```bash
|
||||
$ bun create <template> # an official template (remote)
|
||||
$ bun create <username>/<repo> # a GitHub repo (remote)
|
||||
$ bun create <local-template> # a custom template (local)
|
||||
```
|
||||
|
||||
Running `bun create` performs the following steps:
|
||||
|
||||
- Download the template (remote templates only)
|
||||
- Copy all template files into the destination folder. By default Bun will _not overwrite_ any existing files. Use the `--force` flag to overwrite existing files.
|
||||
- Install dependencies with `bun install`.
|
||||
- Initialize a fresh Git repo. Opt out with the `--no-git` flag.
|
||||
- Run the template's configured `start` script, if defined.
|
||||
|
||||
<!-- ## Official templates
|
||||
|
||||
The following official templates are available.
|
||||
|
||||
```bash
|
||||
bun create next ./myapp
|
||||
bun create react ./myapp
|
||||
bun create svelte-kit ./myapp
|
||||
bun create elysia ./myapp
|
||||
bun create hono ./myapp
|
||||
bun create kingworld ./myapp
|
||||
```
|
||||
|
||||
Each of these corresponds to a directory in the [bun-community/create-templates](https://github.com/bun-community/create-templates) repo. If you think a major framework is missing, please open a PR there. This list will change over time as additional examples are added. To see an up-to-date list, run `bun create` with no arguments.
|
||||
|
||||
```bash
|
||||
$ bun create
|
||||
Welcome to bun! Create a new project by pasting any of the following:
|
||||
<list of templates>
|
||||
```
|
||||
|
||||
{% callout %}
|
||||
⚡️ **Speed** — At the time of writing, `bun create react app` runs ~11x faster on a M1 Macbook Pro than `yarn create react-app app`.
|
||||
{% /callout %} -->
|
||||
|
||||
## GitHub repos
|
||||
|
||||
A template of the form `<username>/<repo>` will be downloaded from GitHub.
|
||||
|
||||
```bash
|
||||
$ bun create ahfarmer/calculator ./myapp
|
||||
```
|
||||
|
||||
Complete GitHub URLs will also work:
|
||||
|
||||
```bash
|
||||
$ bun create github.com/ahfarmer/calculator ./myapp
|
||||
$ bun create https://github.com/ahfarmer/calculator ./myapp
|
||||
```
|
||||
|
||||
Bun installs the files as they currently exist current default branch (usually `main`). Unlike `git clone` it doesn't download the commit history or configure a remote.
|
||||
|
||||
## Local templates
|
||||
|
||||
{% callout %}
|
||||
**⚠️ Warning** — Unlike remote templates, running `bun create` with a local template will delete the entire destination folder if it already exists! Be careful.
|
||||
{% /callout %}
|
||||
Bun's templater can be extended to support custom templates defined on your local file system. These templates should live in one of the following directories:
|
||||
|
||||
- `$HOME/.bun-create/<name>`: global templates
|
||||
- `<project root>/.bun-create/<name>`: project-specific templates
|
||||
|
||||
{% callout %}
|
||||
**Note** — You can customize the global template path by setting the `BUN_CREATE_DIR` environment variable.
|
||||
{% /callout %}
|
||||
|
||||
To create a local template, navigate to `$HOME/.bun-create` and create a new directory with the desired name of your template.
|
||||
|
||||
```bash
|
||||
$ cd $HOME/.bun-create
|
||||
$ mkdir foo
|
||||
$ cd foo
|
||||
```
|
||||
|
||||
Then, create a `package.json` file in that directory with the following contents:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "foo"
|
||||
}
|
||||
```
|
||||
|
||||
You can run `bun create foo` elsewhere on your file system to verify that Bun is correctly finding your local template.
|
||||
|
||||
{% table %}
|
||||
|
||||
---
|
||||
|
||||
- `postinstall`
|
||||
- runs after installing dependencies
|
||||
|
||||
---
|
||||
|
||||
- `preinstall`
|
||||
- runs before installing dependencies
|
||||
|
||||
<!-- ---
|
||||
|
||||
- `start`
|
||||
- a command to auto-start the application -->
|
||||
|
||||
{% /table %}
|
||||
|
||||
Each of these can correspond to a string or array of strings. An array of commands will be executed in order. Here is an example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "@bun-examples/simplereact",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"bun-create": {
|
||||
"preinstall": "echo 'Installing...'", // a single command
|
||||
"postinstall": ["echo 'Done!'"], // an array of commands
|
||||
"start": "bun run echo 'Hello world!'"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When cloning a template, `bun create` will automatically remove the `"bun-create"` section from `package.json` before writing it to the destination folder.
|
||||
|
||||
## Reference
|
||||
|
||||
### CLI flags
|
||||
|
||||
{% table %}
|
||||
|
||||
- Flag
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- `--force`
|
||||
- Overwrite existing files
|
||||
|
||||
---
|
||||
|
||||
- `--no-install`
|
||||
- Skip installing `node_modules` & tasks
|
||||
|
||||
---
|
||||
|
||||
- `--no-git`
|
||||
- Don’t initialize a git repository
|
||||
|
||||
---
|
||||
|
||||
- `--open`
|
||||
- Start & open in-browser after finish
|
||||
|
||||
{% /table %}
|
||||
|
||||
### Environment variables
|
||||
|
||||
{% table %}
|
||||
|
||||
- Name
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- `GITHUB_API_DOMAIN`
|
||||
- If you’re using a GitHub enterprise or a proxy, you can customize the GitHub domain Bun pings for downloads
|
||||
|
||||
---
|
||||
|
||||
- `GITHUB_API_TOKEN`
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited
|
||||
|
||||
{% /table %}
|
||||
|
||||
{% details summary="How `bun create` works" %}
|
||||
|
||||
When you run `bun create ${template} ${destination}`, here’s what happens:
|
||||
|
||||
IF remote template
|
||||
|
||||
1. GET `registry.npmjs.org/@bun-examples/${template}/latest` and parse it
|
||||
2. GET `registry.npmjs.org/@bun-examples/${template}/-/${template}-${latestVersion}.tgz`
|
||||
3. Decompress & extract `${template}-${latestVersion}.tgz` into `${destination}`
|
||||
|
||||
- If there are files that would overwrite, warn and exit unless `--force` is passed
|
||||
|
||||
IF GitHub repo
|
||||
|
||||
1. Download the tarball from GitHub’s API
|
||||
2. Decompress & extract into `${destination}`
|
||||
|
||||
- If there are files that would overwrite, warn and exit unless `--force` is passed
|
||||
|
||||
ELSE IF local template
|
||||
|
||||
1. Open local template folder
|
||||
2. Delete destination directory recursively
|
||||
3. Copy files recursively using the fastest system calls available (on macOS `fcopyfile` and Linux, `copy_file_range`). Do not copy or traverse into `node_modules` folder if exists (this alone makes it faster than `cp`)
|
||||
|
||||
4. Parse the `package.json` (again!), update `name` to be `${basename(destination)}`, remove the `bun-create` section from the `package.json` and save the updated `package.json` to disk.
|
||||
- IF Next.js is detected, add `bun-framework-next` to the list of dependencies
|
||||
- IF Create React App is detected, add the entry point in /src/index.{js,jsx,ts,tsx} to `public/index.html`
|
||||
- IF Relay is detected, add `bun-macro-relay` so that Relay works
|
||||
5. Auto-detect the npm client, preferring `pnpm`, `yarn` (v1), and lastly `npm`
|
||||
6. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client
|
||||
7. Run `${npmClient} install` unless `--no-install` is passed OR no dependencies are in package.json
|
||||
8. Run any tasks defined in `"bun-create": { "preinstall" }` with the npm client
|
||||
9. Run `git init; git add -A .; git commit -am "Initial Commit";`
|
||||
|
||||
- Rename `gitignore` to `.gitignore`. NPM automatically removes `.gitignore` files from appearing in packages.
|
||||
- If there are dependencies, this runs in a separate thread concurrently while node_modules are being installed
|
||||
- Using libgit2 if available was tested and performed 3x slower in microbenchmarks
|
||||
|
||||
{% /details %}
|
||||
@@ -1,3 +1,27 @@
|
||||
Scaffold an empty Bun project with the interactive `bun init` command.
|
||||
|
||||
```bash
|
||||
$ bun init
|
||||
bun init helps you get started with a minimal project and tries to
|
||||
guess sensible defaults. Press ^C anytime to quit.
|
||||
|
||||
package name (quickstart):
|
||||
entry point (index.ts):
|
||||
|
||||
Done! A package.json file was saved in the current directory.
|
||||
+ index.ts
|
||||
+ .gitignore
|
||||
+ tsconfig.json (for editor auto-complete)
|
||||
+ README.md
|
||||
|
||||
To get started, run:
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
Press `enter` to accept the default answer for each prompt, or pass the `-y` flag to auto-accept the defaults.
|
||||
|
||||
{% details summary="How `bun init` works" %}
|
||||
|
||||
`bun init` is a quick way to start a blank project with Bun. It guesses with sane defaults and is non-destructive when run multiple times.
|
||||
|
||||

|
||||
@@ -11,8 +35,6 @@ It creates:
|
||||
|
||||
If you pass `-y` or `--yes`, it will assume you want to continue without asking questions.
|
||||
|
||||
At the end, it runs `bun install` to install `bun-types`.
|
||||
At the end, it runs `bun install` to install `@types/bun`.
|
||||
|
||||
#### How is `bun init` different than `bun create`?
|
||||
|
||||
`bun init` is for blank projects. `bun create` applies templates.
|
||||
{% /details %}
|
||||
@@ -9,7 +9,7 @@ The `bun` CLI contains a Node.js-compatible package manager designed to be a dra
|
||||
{% /callout %}
|
||||
|
||||
{% details summary="For Linux users" %}
|
||||
The minimum Linux Kernel version is 5.1. If you're on Linux kernel 5.1 - 5.5, `bun install` should still work, but HTTP requests will be slow due to a lack of support for io_uring's `connect()` operation.
|
||||
The recommended minimum Linux Kernel version is 5.6. If you're on Linux kernel 5.1 - 5.5, `bun install` will work, but HTTP requests will be slow due to a lack of support for io_uring's `connect()` operation.
|
||||
|
||||
If you're using Ubuntu 20.04, here's how to install a [newer kernel](https://wiki.ubuntu.com/Kernel/LTSEnablementStack):
|
||||
|
||||
@@ -23,43 +23,19 @@ sudo apt install --install-recommends linux-generic-hwe-20.04
|
||||
|
||||
{% /details %}
|
||||
|
||||
## Manage dependencies
|
||||
|
||||
### `bun install`
|
||||
|
||||
To install all dependencies of a project:
|
||||
|
||||
```bash
|
||||
$ bun install
|
||||
```
|
||||
|
||||
On Linux, `bun install` tends to install packages 20-100x faster than `npm install`. On macOS, it's more like 4-80x.
|
||||
|
||||

|
||||
|
||||
Running `bun install` will:
|
||||
|
||||
- **Install** all `dependencies`, `devDependencies`, and `optionalDependencies`. Bun does not install `peerDependencies` by default.
|
||||
- **Install** all `dependencies`, `devDependencies`, and `optionalDependencies`. Bun will install `peerDependencies` by default.
|
||||
- **Run** your project's `{pre|post}install` and `{pre|post}prepare` scripts at the appropriate time. For security reasons Bun _does not execute_ lifecycle scripts of installed dependencies.
|
||||
- **Write** a `bun.lockb` lockfile to the project root.
|
||||
|
||||
To install in production mode (i.e. without `devDependencies` or `optionalDependencies`):
|
||||
|
||||
```bash
|
||||
$ bun install --production
|
||||
```
|
||||
|
||||
To install with reproducible dependencies, use `--frozen-lockfile`. If your `package.json` disagrees with `bun.lockb`, Bun will exit with an error. This is useful for production builds and CI environments.
|
||||
|
||||
```bash
|
||||
$ bun install --frozen-lockfile
|
||||
```
|
||||
|
||||
To perform a dry run (i.e. don't actually install anything):
|
||||
|
||||
```bash
|
||||
$ bun install --dry-run
|
||||
```
|
||||
## Logging
|
||||
|
||||
To modify logging verbosity:
|
||||
|
||||
@@ -68,86 +44,65 @@ $ bun install --verbose # debug logging
|
||||
$ bun install --silent # no logging
|
||||
```
|
||||
|
||||
{% details summary="Configuring behavior" %}
|
||||
The default behavior of `bun install` can be configured in `bunfig.toml`:
|
||||
## Lifecycle scripts
|
||||
|
||||
```toml
|
||||
[install]
|
||||
Unlike other npm clients, Bun does not execute arbitrary lifecycle scripts like `postinstall` for installed dependencies. Executing arbitrary scripts represents a potential security risk.
|
||||
|
||||
# whether to install optionalDependencies
|
||||
optional = true
|
||||
To tell Bun to allow lifecycle scripts for a particular package, add the package to `trustedDependencies` in your package.json.
|
||||
|
||||
# whether to install devDependencies
|
||||
dev = true
|
||||
|
||||
# whether to install peerDependencies
|
||||
peer = false
|
||||
|
||||
# equivalent to `--production` flag
|
||||
production = false
|
||||
|
||||
# equivalent to `--frozen-lockfile` flag
|
||||
frozenLockfile = false
|
||||
|
||||
# equivalent to `--dry-run` flag
|
||||
dryRun = false
|
||||
```json-diff
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
+ "trustedDependencies": ["my-trusted-package"]
|
||||
}
|
||||
```
|
||||
|
||||
{% /details %}
|
||||
Then re-install the package. Bun will read this field and run lifecycle scripts for `my-trusted-package`.
|
||||
|
||||
### `bun add`
|
||||
|
||||
To add a particular package:
|
||||
Lifecycle scripts will run in parallel during installation. To adjust the maximum number of concurrent scripts, use the `--concurrent-scripts` flag. The default is two times the reported cpu count or GOMAXPROCS.
|
||||
|
||||
```bash
|
||||
$ bun add preact
|
||||
$ bun install --concurrent-scripts 5
|
||||
```
|
||||
|
||||
To specify a version, version range, or tag:
|
||||
## Workspaces
|
||||
|
||||
```bash
|
||||
$ bun add zod@3.20.0
|
||||
$ bun add zod@^3.0.0
|
||||
$ bun add zod@latest
|
||||
```
|
||||
Bun supports `"workspaces"` in package.json. For complete documentation refer to [Package manager > Workspaces](/docs/install/workspaces).
|
||||
|
||||
To add a package as a dev dependency (`"devDependencies"`):
|
||||
|
||||
```bash
|
||||
$ bun add --dev @types/react
|
||||
$ bun add -d @types/react
|
||||
```
|
||||
|
||||
To add a package as an optional dependency (`"optionalDependencies"`):
|
||||
|
||||
```bash
|
||||
$ bun add --optional lodash
|
||||
```
|
||||
|
||||
To add a package and pin to the resolved version, use `--exact`. This will resolve the version of the package and add it to your `package.json` with an exact version number instead of a version range.
|
||||
|
||||
```bash
|
||||
$ bun add react --exact
|
||||
```
|
||||
|
||||
This will add the following to your `package.json`:
|
||||
|
||||
```jsonc
|
||||
```json#package.json
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
"workspaces": ["packages/*"],
|
||||
"dependencies": {
|
||||
// without --exact
|
||||
"react": "^18.2.0", // this matches >= 18.2.0 < 19.0.0
|
||||
|
||||
// with --exact
|
||||
"react": "18.2.0" // this matches only 18.2.0 exactly
|
||||
"preact": "^10.5.13"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To install a package globally:
|
||||
## Overrides and resolutions
|
||||
|
||||
Bun supports npm's `"overrides"` and Yarn's `"resolutions"` in `package.json`. These are mechanisms for specifying a version range for _metadependencies_—the dependencies of your dependencies. Refer to [Package manager > Overrides and resolutions](/docs/install/overrides) for complete documentation.
|
||||
|
||||
```json-diff#package.json
|
||||
{
|
||||
"name": "my-app",
|
||||
"dependencies": {
|
||||
"foo": "^2.0.0"
|
||||
},
|
||||
+ "overrides": {
|
||||
+ "bar": "~4.4.0"
|
||||
+ }
|
||||
}
|
||||
```
|
||||
|
||||
## Global packages
|
||||
|
||||
To install a package globally, use the `-g`/`--global` flag. Typically this is used for installing command-line tools.
|
||||
|
||||
```bash
|
||||
$ bun add --global cowsay # or `bun add -g cowsay`
|
||||
$ bun install --global cowsay # or `bun install -g cowsay`
|
||||
$ cowsay "Bun!"
|
||||
______
|
||||
< Bun! >
|
||||
@@ -159,149 +114,78 @@ $ cowsay "Bun!"
|
||||
|| ||
|
||||
```
|
||||
|
||||
{% details summary="Configuring global installation behavior" %}
|
||||
## Production mode
|
||||
|
||||
```toml
|
||||
[install]
|
||||
# where `bun install --global` installs packages
|
||||
globalDir = "~/.bun/install/global"
|
||||
|
||||
# where globally-installed package bins are linked
|
||||
globalBinDir = "~/.bun/bin"
|
||||
```
|
||||
|
||||
{% /details %}
|
||||
To view a complete list of options for a given command:
|
||||
To install in production mode (i.e. without `devDependencies` or `optionalDependencies`):
|
||||
|
||||
```bash
|
||||
$ bun add --help
|
||||
$ bun install --production
|
||||
```
|
||||
|
||||
### `bun remove`
|
||||
|
||||
To remove a dependency:
|
||||
For reproducible installs, use `--frozen-lockfile`. This will install the exact versions of each package specified in the lockfile. If your `package.json` disagrees with `bun.lockb`, Bun will exit with an error. The lockfile will not be updated.
|
||||
|
||||
```bash
|
||||
$ bun remove preact
|
||||
$ bun install --frozen-lockfile
|
||||
```
|
||||
|
||||
## Local packages (`bun link`)
|
||||
For more information on Bun's binary lockfile `bun.lockb`, refer to [Package manager > Lockfile](/docs/install/lockfile).
|
||||
|
||||
Use `bun link` in a local directory to register the current package as a "linkable" package.
|
||||
## Dry run
|
||||
|
||||
To perform a dry run (i.e. don't actually install anything):
|
||||
|
||||
```bash
|
||||
$ cd /path/to/cool-pkg
|
||||
$ cat package.json
|
||||
{
|
||||
"name": "cool-pkg",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
$ bun link
|
||||
bun link v1.x (7416672e)
|
||||
Success! Registered "cool-pkg"
|
||||
|
||||
To use cool-pkg in a project, run:
|
||||
bun link cool-pkg
|
||||
|
||||
Or add it in dependencies in your package.json file:
|
||||
"cool-pkg": "link:cool-pkg"
|
||||
$ bun install --dry-run
|
||||
```
|
||||
|
||||
This package can now be "linked" into other projects using `bun link cool-pkg`. This will create a symlink in the `node_modules` directory of the target project, pointing to the local directory.
|
||||
## Non-npm dependencies
|
||||
|
||||
```bash
|
||||
$ cd /path/to/my-app
|
||||
$ bun link cool-pkg
|
||||
```
|
||||
Bun supports installing dependencies from Git, GitHub, and local or remotely-hosted tarballs. For complete documentation refer to [Package manager > Git, GitHub, and tarball dependencies](/docs/cli/add).
|
||||
|
||||
In addition, the `--save` flag can be used to add `cool-pkg` to the `dependencies` field of your app's package.json with a special version specifier that tells Bun to load from the registered local directory instead of installing from `npm`:
|
||||
|
||||
```json-diff
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
+ "cool-pkg": "link:cool-pkg"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Trusted dependencies
|
||||
|
||||
Unlike other npm clients, Bun does not execute arbitrary lifecycle scripts for installed dependencies, such as `postinstall`. These scripts represent a potential security risk, as they can execute arbitrary code on your machine.
|
||||
|
||||
<!-- Bun maintains an allow-list of popular packages containing `postinstall` scripts that are known to be safe. To run lifecycle scripts for packages that aren't on this list, add the package to `trustedDependencies` in your package.json. -->
|
||||
|
||||
To tell Bun to allow lifecycle scripts for a particular package, add the package to `trustedDependencies` in your package.json.
|
||||
|
||||
<!-- ```json-diff
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
+ "trustedDependencies": {
|
||||
+ "my-trusted-package": "*"
|
||||
+ }
|
||||
}
|
||||
``` -->
|
||||
|
||||
```json-diff
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
+ "trustedDependencies": ["my-trusted-package"]
|
||||
}
|
||||
```
|
||||
|
||||
Bun reads this field and will run lifecycle scripts for `my-trusted-package`.
|
||||
|
||||
<!-- If you specify a version range, Bun will only execute lifecycle scripts if the resolved package version matches the range. -->
|
||||
<!--
|
||||
```json
|
||||
{
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
"trustedDependencies": {
|
||||
"my-trusted-package": "^1.0.0"
|
||||
}
|
||||
}
|
||||
``` -->
|
||||
|
||||
## Git dependencies
|
||||
|
||||
To add a dependency from a git repository:
|
||||
|
||||
```bash
|
||||
$ bun install git@github.com:moment/moment.git
|
||||
```
|
||||
|
||||
Bun supports a variety of protocols, including [`github`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#github-urls), [`git`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#git-urls-as-dependencies), `git+ssh`, `git+https`, and many more.
|
||||
|
||||
```json
|
||||
```json#package.json
|
||||
{
|
||||
"dependencies": {
|
||||
"dayjs": "git+https://github.com/iamkun/dayjs.git",
|
||||
"lodash": "git+ssh://github.com/lodash/lodash.git#4.17.21",
|
||||
"moment": "git@github.com:moment/moment.git",
|
||||
"zod": "github:colinhacks/zod"
|
||||
"zod": "github:colinhacks/zod",
|
||||
"react": "https://registry.npmjs.org/react/-/react-18.2.0.tgz"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tarball dependencies
|
||||
## Configuration
|
||||
|
||||
A package name can correspond to a publicly hosted `.tgz` file. During `bun install`, Bun will download and install the package from the specified tarball URL, rather than from the package registry.
|
||||
The default behavior of `bun install` can be configured in `bunfig.toml`. The default values are shown below.
|
||||
|
||||
```json#package.json
|
||||
{
|
||||
"dependencies": {
|
||||
"zod": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz"
|
||||
}
|
||||
}
|
||||
```toml
|
||||
[install]
|
||||
|
||||
# whether to install optionalDependencies
|
||||
optional = true
|
||||
|
||||
# whether to install devDependencies
|
||||
dev = true
|
||||
|
||||
# whether to install peerDependencies
|
||||
peer = true
|
||||
|
||||
# equivalent to `--production` flag
|
||||
production = false
|
||||
|
||||
# equivalent to `--frozen-lockfile` flag
|
||||
frozenLockfile = false
|
||||
|
||||
# equivalent to `--dry-run` flag
|
||||
dryRun = false
|
||||
|
||||
# equivalent to `--concurrent-scripts` flag
|
||||
concurrentScripts = 16 # (cpu count or GOMAXPROCS) x2
|
||||
```
|
||||
|
||||
## CI/CD
|
||||
|
||||
Looking to speed up your CI? Use the official `oven-sh/setup-bun` action to install `bun` in a GitHub Actions pipeline.
|
||||
Looking to speed up your CI? Use the official [`oven-sh/setup-bun`](https://github.com/oven-sh/setup-bun) action to install `bun` in a GitHub Actions pipeline.
|
||||
|
||||
```yaml#.github/workflows/release.yml
|
||||
name: bun-types
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user